2023-06-19 12:42:43 +08:00
|
|
|
|
<template>
|
|
|
|
|
<!-- 搜索 -->
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-form
|
|
|
|
|
ref="queryFormRef"
|
2023-08-20 02:16:13 +08:00
|
|
|
|
:inline="true"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
:model="queryParams"
|
|
|
|
|
class="-mb-15px"
|
|
|
|
|
label-width="68px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="订单状态" prop="status">
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-select v-model="queryParams.status" class="!w-280px" clearable placeholder="全部">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<el-option
|
2023-08-23 00:43:40 +08:00
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.TRADE_ORDER_STATUS)"
|
|
|
|
|
:key="dict.value"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="支付方式" prop="payChannelCode">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.payChannelCode"
|
|
|
|
|
class="!w-280px"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="全部"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
2023-08-23 00:43:40 +08:00
|
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.PAY_CHANNEL_CODE)"
|
|
|
|
|
:key="dict.value"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="创建时间" prop="createTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.createTime"
|
|
|
|
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
|
|
class="!w-280px"
|
|
|
|
|
end-placeholder="自定义时间"
|
2023-08-20 02:16:13 +08:00
|
|
|
|
start-placeholder="自定义时间"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
type="daterange"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="订单来源" prop="terminal">
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-select v-model="queryParams.terminal" class="!w-280px" clearable placeholder="全部">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<el-option
|
2023-08-23 00:43:40 +08:00
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.TERMINAL)"
|
|
|
|
|
:key="dict.value"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="订单类型" prop="type">
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-select v-model="queryParams.type" class="!w-280px" clearable placeholder="全部">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<el-option
|
2023-08-23 00:43:40 +08:00
|
|
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.TRADE_ORDER_TYPE)"
|
|
|
|
|
:key="dict.value"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2023-08-22 18:47:31 +08:00
|
|
|
|
<el-form-item label="快递公司" prop="type">
|
|
|
|
|
<el-select v-model="queryParams.logisticsId" class="!w-280px" clearable placeholder="全部">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in deliveryExpressList"
|
2023-08-23 00:43:40 +08:00
|
|
|
|
:key="item.id"
|
2023-08-22 18:47:31 +08:00
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="自提门店" prop="type">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.pickUpStoreId"
|
|
|
|
|
class="!w-280px"
|
|
|
|
|
clearable
|
|
|
|
|
multiple
|
|
|
|
|
placeholder="全部"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in pickUpStoreList"
|
2023-08-23 00:43:40 +08:00
|
|
|
|
:key="item.id"
|
2023-08-22 18:47:31 +08:00
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.id"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2023-08-24 14:34:35 +08:00
|
|
|
|
<!-- TODO 聚合搜索等售后结束后实现-->
|
2023-08-22 18:47:31 +08:00
|
|
|
|
<el-form-item label="聚合搜索">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<el-input
|
|
|
|
|
v-show="true"
|
|
|
|
|
v-model="queryType.v"
|
2023-08-20 02:16:13 +08:00
|
|
|
|
class="!w-280px"
|
2023-06-19 12:42:43 +08:00
|
|
|
|
clearable
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
>
|
|
|
|
|
<template #prepend>
|
2023-08-23 15:04:46 +08:00
|
|
|
|
<el-select v-model="queryType.k" class="!w-110px" clearable placeholder="全部">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in searchList"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-button @click="handleQuery">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<Icon class="mr-5px" icon="ep:search" />
|
|
|
|
|
搜索
|
|
|
|
|
</el-button>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-button @click="resetQuery">
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<Icon class="mr-5px" icon="ep:refresh" />
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<!-- 列表 -->
|
2023-08-23 00:43:40 +08:00
|
|
|
|
<!-- TODO @puhui999:列表有可能尽量对齐 https://gitee.com/niushop_team/niushop_b2c_v5_stand/raw/master/image/back_end5.png 哇,主要感觉视觉上有点无法分辨一个订单项,是和哪个订单关联。
|
|
|
|
|
|
|
|
|
|
1、订单号、订单类型、订单来源、支付时间那一行,直接做到订单项的数据中
|
|
|
|
|
2、商品信息、商品原价那一行,应该是在最顶上一行,不用每个订单项都写一条
|
|
|
|
|
3、然后点击展开和收拢订单项,可以不做哈。
|
|
|
|
|
-->
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<ContentWrap>
|
2023-08-24 14:34:35 +08:00
|
|
|
|
<el-table v-loading="loading" :data="list">
|
|
|
|
|
<el-table-column class-name="order-table-col">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div class="flex items-center" style="width: 100%">
|
|
|
|
|
<div class="ml-100px mr-200px">商品信息</div>
|
|
|
|
|
<div class="mr-60px">单价(元)/数量</div>
|
|
|
|
|
<div class="mr-60px">售后状态</div>
|
|
|
|
|
<div class="mr-60px">实付金额(元)</div>
|
|
|
|
|
<div class="mr-60px">买家/收货人</div>
|
|
|
|
|
<div class="mr-60px">配送方式</div>
|
|
|
|
|
<div class="mr-60px">订单状态</div>
|
|
|
|
|
<div class="mr-60px">操作</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-06-19 12:42:43 +08:00
|
|
|
|
<template #default="scope">
|
2023-08-24 14:34:35 +08:00
|
|
|
|
<el-table
|
|
|
|
|
:data="scope.row.items"
|
|
|
|
|
:header-cell-style="headerStyle"
|
|
|
|
|
:span-method="spanMethod"
|
|
|
|
|
border
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column min-width="300" prop="spuName">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
style="height: 35px; background-color: #f7f7f7; width: 100%"
|
|
|
|
|
>
|
|
|
|
|
<span class="mr-20px">订单号:{{ scope.row.no }} </span>
|
|
|
|
|
<span class="mr-20px">下单时间:{{ formatDate(scope.row.createTime) }}</span>
|
|
|
|
|
<span>订单来源:</span>
|
|
|
|
|
<dict-tag
|
|
|
|
|
:type="DICT_TYPE.TERMINAL"
|
|
|
|
|
:value="scope.row.terminal"
|
|
|
|
|
class="mr-20px"
|
|
|
|
|
/>
|
|
|
|
|
<span>支付方式:</span>
|
|
|
|
|
<dict-tag
|
|
|
|
|
:type="DICT_TYPE.PAY_CHANNEL_CODE"
|
|
|
|
|
:value="scope.row.payChannelCode"
|
|
|
|
|
class="mr-20px"
|
|
|
|
|
/>
|
|
|
|
|
<span class="mr-20px">支付时间:{{ formatDate(scope.row.payTime) }}</span>
|
|
|
|
|
<span>订单类型:</span>
|
|
|
|
|
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.type" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<template #default="{ row }">
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
<el-image
|
|
|
|
|
:src="row.picUrl"
|
|
|
|
|
class="w-30px h-30px mr-10px"
|
|
|
|
|
@click="imagePreview(row.picUrl)"
|
|
|
|
|
/>
|
|
|
|
|
<span class="mr-10px">{{ row.spuName }}</span>
|
|
|
|
|
<el-tag
|
|
|
|
|
v-for="property in row.properties"
|
|
|
|
|
:key="property.propertyId"
|
|
|
|
|
class="mr-10px"
|
|
|
|
|
>
|
|
|
|
|
{{ property.propertyName }}: {{ property.valueName }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</div>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2023-08-22 17:36:47 +08:00
|
|
|
|
<el-table-column label="商品原价*数量" prop="price" width="150">
|
|
|
|
|
<template #default="{ row }">
|
2023-08-24 14:34:35 +08:00
|
|
|
|
{{ floatToFixed2(row.price) }} 元 / {{ row.count }}
|
2023-08-22 17:36:47 +08:00
|
|
|
|
</template>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="售后状态" prop="afterSaleStatus" width="120">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<dict-tag
|
|
|
|
|
:type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
|
|
|
|
|
:value="row.afterSaleStatus"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<el-table-column align="center" label="实际支付" min-width="120" prop="payPrice">
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<template #default>
|
2023-08-23 15:04:46 +08:00
|
|
|
|
{{ floatToFixed2(scope.row.payPrice) + '元' }}
|
2023-08-20 02:16:13 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2023-08-22 17:36:47 +08:00
|
|
|
|
<el-table-column label="买家/收货人" min-width="160">
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<template #default>
|
2023-08-22 18:47:31 +08:00
|
|
|
|
<!-- 快递发货 -->
|
|
|
|
|
<div v-if="scope.row.deliveryType === 1" class="flex flex-col">
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<span>买家:{{ scope.row.user.nickname }}</span>
|
|
|
|
|
<span>
|
|
|
|
|
收货人:{{ scope.row.receiverName }} {{ scope.row.receiverMobile }}
|
|
|
|
|
{{ scope.row.receiverAreaName }} {{ scope.row.receiverDetailAddress }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2023-08-22 18:47:31 +08:00
|
|
|
|
<!-- 自提 -->
|
|
|
|
|
<div v-if="scope.row.deliveryType === 2" class="flex flex-col">
|
|
|
|
|
<span>
|
|
|
|
|
门店名称:
|
|
|
|
|
{{ pickUpStoreList.find((p) => p.id === scope.row.pickUpStoreId)?.name }}
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
门店手机:
|
|
|
|
|
{{ pickUpStoreList.find((p) => p.id === scope.row.pickUpStoreId)?.phone }}
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
自提门店:
|
|
|
|
|
{{
|
|
|
|
|
pickUpStoreList.find((p) => p.id === scope.row.pickUpStoreId)?.detailAddress
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2023-08-21 22:39:21 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2023-08-22 17:36:47 +08:00
|
|
|
|
<el-table-column align="center" label="配送方式" width="120">
|
|
|
|
|
<template #default>
|
2023-08-23 00:43:40 +08:00
|
|
|
|
<dict-tag :type="DICT_TYPE.TRADE_DELIVERY_TYPE" :value="scope.row.deliveryType" />
|
2023-08-22 17:36:47 +08:00
|
|
|
|
</template>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" fixed="right" label="操作" width="160">
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<template #default>
|
2023-08-22 18:47:31 +08:00
|
|
|
|
<!-- TODO 权限后续补齐 -->
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<div class="flex justify-center items-center">
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<el-button link type="primary" @click="openForm(scope.row.id)">
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<Icon icon="ep:notification" />
|
|
|
|
|
详情
|
|
|
|
|
</el-button>
|
2023-08-21 22:39:21 +08:00
|
|
|
|
<el-dropdown @command="(command) => handleCommand(command, scope.row)">
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-button link type="primary">
|
|
|
|
|
<Icon icon="ep:d-arrow-right" />
|
|
|
|
|
更多
|
|
|
|
|
</el-button>
|
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
2023-08-24 14:34:35 +08:00
|
|
|
|
<!--判断下 物流类型 + 状态,快递 + 待发货时展示【发货】按钮 -->
|
|
|
|
|
<el-dropdown-item
|
|
|
|
|
v-if="scope.row.deliveryType === 1 && scope.row.status === 10"
|
|
|
|
|
command="delivery"
|
|
|
|
|
>
|
2023-08-22 00:38:44 +08:00
|
|
|
|
<Icon icon="ep:takeaway-box" />
|
|
|
|
|
发货
|
|
|
|
|
</el-dropdown-item>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
<el-dropdown-item command="orderRemarks">
|
|
|
|
|
<Icon icon="ep:chat-line-square" />
|
|
|
|
|
订单备注
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2023-06-19 12:42:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<Pagination
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
:total="total"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</ContentWrap>
|
2023-08-23 00:43:40 +08:00
|
|
|
|
|
|
|
|
|
<!-- 各种操作的弹窗 -->
|
2023-08-23 15:04:46 +08:00
|
|
|
|
<OrderDeliveryForm ref="deliveryFormRef" @success="getList" />
|
|
|
|
|
<OrderUpdateRemarkForm ref="updateRemarkForm" @success="getList" />
|
2023-06-19 12:42:43 +08:00
|
|
|
|
</template>
|
2023-08-20 02:16:13 +08:00
|
|
|
|
|
|
|
|
|
<script lang="ts" name="Order" setup>
|
|
|
|
|
import type { FormInstance, TableColumnCtx } from 'element-plus'
|
2023-08-23 15:04:46 +08:00
|
|
|
|
import OrderDeliveryForm from './components/OrderDeliveryForm.vue'
|
|
|
|
|
import OrderUpdateRemarkForm from './components/OrderUpdateRemarkForm.vue'
|
2023-08-21 22:39:21 +08:00
|
|
|
|
import * as TradeOrderApi from '@/api/mall/trade/order'
|
2023-08-23 15:04:46 +08:00
|
|
|
|
import * as PickUpStoreApi from '@/api/mall/trade/delivery/pickUpStore'
|
|
|
|
|
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
2023-08-24 14:34:35 +08:00
|
|
|
|
import { formatDate } from '@/utils/formatTime'
|
2023-08-23 15:04:46 +08:00
|
|
|
|
import { floatToFixed2 } from '@/utils'
|
2023-08-20 02:16:13 +08:00
|
|
|
|
import { createImageViewer } from '@/components/ImageViewer'
|
2023-08-22 18:47:31 +08:00
|
|
|
|
import * as DeliveryExpressApi from '@/api/mall/trade/delivery/express'
|
2023-06-19 12:42:43 +08:00
|
|
|
|
|
2023-08-21 22:39:21 +08:00
|
|
|
|
const { currentRoute, push } = useRouter() // 路由跳转
|
2023-06-19 12:42:43 +08:00
|
|
|
|
|
2023-08-20 02:16:13 +08:00
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const total = ref(2) // 列表的总页数
|
2023-08-23 15:04:46 +08:00
|
|
|
|
const list = ref<TradeOrderApi.OrderVO[]>([]) // 列表的数据
|
2023-08-20 02:16:13 +08:00
|
|
|
|
const queryFormRef = ref<FormInstance>() // 搜索的表单
|
2023-08-23 00:43:40 +08:00
|
|
|
|
// 表单搜索
|
2023-08-20 02:16:13 +08:00
|
|
|
|
const queryParams = reactive({
|
2023-06-19 12:42:43 +08:00
|
|
|
|
pageNo: 1, //首页
|
2023-08-20 02:16:13 +08:00
|
|
|
|
pageSize: 10, //页面大小
|
|
|
|
|
no: '',
|
|
|
|
|
userId: '',
|
|
|
|
|
userNickname: '',
|
|
|
|
|
userMobile: '',
|
|
|
|
|
receiverName: '',
|
|
|
|
|
receiverMobile: '',
|
|
|
|
|
terminal: '',
|
|
|
|
|
type: null,
|
|
|
|
|
status: null,
|
|
|
|
|
payChannelCode: '',
|
|
|
|
|
createTime: [],
|
|
|
|
|
spuName: '',
|
|
|
|
|
itemCount: '',
|
2023-08-22 18:47:31 +08:00
|
|
|
|
pickUpStoreId: [],
|
|
|
|
|
logisticsId: null,
|
2023-08-20 02:16:13 +08:00
|
|
|
|
all: ''
|
2023-06-19 12:42:43 +08:00
|
|
|
|
})
|
|
|
|
|
const queryType = reactive({ k: '', v: '' }) // 订单搜索类型kv
|
2023-08-23 00:43:40 +08:00
|
|
|
|
/**
|
2023-08-20 02:16:13 +08:00
|
|
|
|
* 订单聚合搜索
|
2023-08-23 00:43:40 +08:00
|
|
|
|
* 商品名称、商品件数、全部
|
|
|
|
|
*
|
|
|
|
|
* 需要后端支持 TODO
|
2023-06-19 12:42:43 +08:00
|
|
|
|
*/
|
|
|
|
|
const searchList = ref([
|
|
|
|
|
{ value: 'no', label: '订单号' },
|
|
|
|
|
{ value: 'userId', label: '用户UID' },
|
|
|
|
|
{ value: 'userNickname', label: '用户昵称' },
|
2023-08-20 02:16:13 +08:00
|
|
|
|
{ value: 'userMobile', label: '用户电话' }
|
2023-06-19 12:42:43 +08:00
|
|
|
|
])
|
2023-08-23 00:43:40 +08:00
|
|
|
|
|
2023-08-24 14:34:35 +08:00
|
|
|
|
const headerStyle = ({ row, columnIndex }: any) => {
|
|
|
|
|
// 表头第一行第一列占 8
|
|
|
|
|
if (columnIndex === 0) {
|
|
|
|
|
row[columnIndex].colSpan = 8
|
|
|
|
|
} else {
|
|
|
|
|
// 其余的不要
|
|
|
|
|
row[columnIndex].colSpan = 0
|
|
|
|
|
return {
|
|
|
|
|
display: 'none'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-23 00:43:40 +08:00
|
|
|
|
interface SpanMethodProps {
|
2023-08-23 15:04:46 +08:00
|
|
|
|
row: TradeOrderApi.OrderItemRespVO
|
|
|
|
|
column: TableColumnCtx<TradeOrderApi.OrderItemRespVO>
|
2023-08-23 00:43:40 +08:00
|
|
|
|
rowIndex: number
|
|
|
|
|
columnIndex: number
|
|
|
|
|
}
|
2023-08-23 15:04:46 +08:00
|
|
|
|
|
2023-08-24 14:34:35 +08:00
|
|
|
|
const spanMethod = ({ row, rowIndex, columnIndex }: SpanMethodProps) => {
|
|
|
|
|
const len = list.value.find(
|
|
|
|
|
(order) => order.items?.findIndex((item) => item.id === row.id) !== -1
|
|
|
|
|
)?.items?.length
|
|
|
|
|
// 要合并的列,从零开始
|
|
|
|
|
const colIndex = [3, 4, 5, 6]
|
2023-08-23 00:43:40 +08:00
|
|
|
|
if (colIndex.includes(columnIndex)) {
|
2023-08-24 14:34:35 +08:00
|
|
|
|
// 除了第一行其余的不要
|
2023-08-23 00:43:40 +08:00
|
|
|
|
if (rowIndex !== 0) {
|
|
|
|
|
return {
|
|
|
|
|
rowspan: 0,
|
|
|
|
|
colspan: 0
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-24 14:34:35 +08:00
|
|
|
|
// 动态合并行
|
2023-08-23 00:43:40 +08:00
|
|
|
|
return {
|
2023-08-24 14:34:35 +08:00
|
|
|
|
rowspan: len,
|
2023-08-23 00:43:40 +08:00
|
|
|
|
colspan: 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-20 02:16:13 +08:00
|
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
2023-06-19 12:42:43 +08:00
|
|
|
|
try {
|
2023-08-21 22:39:21 +08:00
|
|
|
|
const data = await TradeOrderApi.getOrderPage(queryParams)
|
2023-08-22 11:01:20 +08:00
|
|
|
|
list.value = data.list
|
2023-08-21 22:39:21 +08:00
|
|
|
|
total.value = data.total
|
2023-06-19 12:42:43 +08:00
|
|
|
|
} finally {
|
2023-08-20 02:16:13 +08:00
|
|
|
|
loading.value = false
|
2023-06-19 12:42:43 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
2023-08-24 14:34:35 +08:00
|
|
|
|
const handleQuery = async () => {
|
2023-08-20 02:16:13 +08:00
|
|
|
|
queryParams.pageNo = 1
|
2023-08-24 14:34:35 +08:00
|
|
|
|
await getList()
|
2023-06-19 12:42:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
2023-08-20 02:16:13 +08:00
|
|
|
|
queryFormRef.value?.resetFields()
|
|
|
|
|
handleQuery()
|
2023-06-19 12:42:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-23 00:43:40 +08:00
|
|
|
|
/** 商品图预览 */
|
|
|
|
|
const imagePreview = (imgUrl: string) => {
|
|
|
|
|
createImageViewer({
|
|
|
|
|
urlList: [imgUrl]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-23 15:04:46 +08:00
|
|
|
|
/** 查看订单详情 */
|
2023-08-23 00:43:40 +08:00
|
|
|
|
const openForm = (id: number) => {
|
2023-08-23 15:04:46 +08:00
|
|
|
|
push({ name: 'TradeOrderDetailForm', params: { orderId: id } })
|
2023-08-23 00:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 操作分发 */
|
2023-08-23 15:04:46 +08:00
|
|
|
|
const deliveryFormRef = ref()
|
|
|
|
|
const updateRemarkForm = ref()
|
|
|
|
|
const handleCommand = (command: string, row: TradeOrderApi.OrderVO) => {
|
2023-08-23 00:43:40 +08:00
|
|
|
|
switch (command) {
|
2023-08-23 15:04:46 +08:00
|
|
|
|
case 'remark':
|
|
|
|
|
updateRemarkForm.value?.open(row)
|
2023-08-23 00:43:40 +08:00
|
|
|
|
break
|
|
|
|
|
case 'delivery':
|
2023-08-23 15:04:46 +08:00
|
|
|
|
deliveryFormRef.value?.open(row)
|
2023-08-23 00:43:40 +08:00
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-23 15:04:46 +08:00
|
|
|
|
// 监听路由变化更新列表,解决订单保存/更新后,列表不刷新的问题。
|
2023-08-21 22:39:21 +08:00
|
|
|
|
watch(
|
|
|
|
|
() => currentRoute.value,
|
|
|
|
|
() => {
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-22 18:47:31 +08:00
|
|
|
|
const pickUpStoreList = ref([]) // 自提门店精简列表
|
|
|
|
|
const deliveryExpressList = ref([]) // 物流公司
|
2023-06-19 12:42:43 +08:00
|
|
|
|
/** 初始化 **/
|
2023-08-22 11:01:20 +08:00
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await getList()
|
2023-08-23 15:04:46 +08:00
|
|
|
|
pickUpStoreList.value = await PickUpStoreApi.getListAllSimple()
|
2023-08-22 18:47:31 +08:00
|
|
|
|
deliveryExpressList.value = await DeliveryExpressApi.getSimpleDeliveryExpressList()
|
2023-06-19 12:42:43 +08:00
|
|
|
|
})
|
|
|
|
|
</script>
|
2023-08-24 14:34:35 +08:00
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
:deep(.order-table-col > .cell) {
|
|
|
|
|
padding: 0px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|