|
@@ -64,6 +64,9 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <!-- TODO @puhui999:要不加个 deliveryType 筛选;配送方式;然后如果选了快递,就有【快递公司】筛选;如果选了自提,就有【自提门店】;然后把他们这 3 个,坐在一个 el-form-item 里;
|
|
|
+ 目的是;有的时候,会筛选门店,然后做核销;这个时候,就需要筛选自提门店;
|
|
|
+ -->
|
|
|
<el-form-item label="快递公司" prop="type">
|
|
|
<el-select v-model="queryParams.logisticsId" class="!w-280px" clearable placeholder="全部">
|
|
|
<el-option
|
|
@@ -90,7 +93,7 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <!-- TODO 考虑是否移除或重构;这个还是需要的哈-->
|
|
|
+ <!-- TODO 聚合搜索等售后结束后实现-->
|
|
|
<el-form-item label="聚合搜索">
|
|
|
<el-input
|
|
|
v-show="true"
|
|
@@ -100,7 +103,7 @@
|
|
|
placeholder="请输入"
|
|
|
>
|
|
|
<template #prepend>
|
|
|
- <el-select v-model="queryType.k" clearable placeholder="全部" class="!w-110px">
|
|
|
+ <el-select v-model="queryType.k" class="!w-110px" clearable placeholder="全部">
|
|
|
<el-option
|
|
|
v-for="dict in searchList"
|
|
|
:key="dict.value"
|
|
@@ -125,24 +128,59 @@
|
|
|
</ContentWrap>
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
- <!-- TODO @puhui999:列表有可能尽量对齐 https://gitee.com/niushop_team/niushop_b2c_v5_stand/raw/master/image/back_end5.png 哇,主要感觉视觉上有点无法分辨一个订单项,是和哪个订单关联。
|
|
|
-
|
|
|
- 1、订单号、订单类型、订单来源、支付时间那一行,直接做到订单项的数据中
|
|
|
- 2、商品信息、商品原价那一行,应该是在最顶上一行,不用每个订单项都写一条
|
|
|
- 3、然后点击展开和收拢订单项,可以不做哈。
|
|
|
- -->
|
|
|
<ContentWrap>
|
|
|
- <el-table
|
|
|
- v-loading="loading"
|
|
|
- :data="list"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- :stripe="true"
|
|
|
- default-expand-all
|
|
|
- >
|
|
|
- <el-table-column fixed="left" type="expand">
|
|
|
+ <el-table v-loading="loading" :data="list">
|
|
|
+ <el-table-column class-name="order-table-col">
|
|
|
+ <template #header>
|
|
|
+ <!-- TODO @phui999:小屏幕下,会有偏移,后续看看 -->
|
|
|
+ <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>
|
|
|
<template #default="scope">
|
|
|
- <el-table :data="scope.row.items" :span-method="spanMethod" border style="width: 100%">
|
|
|
- <el-table-column label="商品信息" min-width="300" prop="spuName">
|
|
|
+ <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
|
|
|
+ v-if="scope.row.payChannelCode"
|
|
|
+ :type="DICT_TYPE.PAY_CHANNEL_CODE"
|
|
|
+ :value="scope.row.payChannelCode"
|
|
|
+ class="mr-20px"
|
|
|
+ />
|
|
|
+ <v-else class="mr-20px" v-else>未支付</v-else>
|
|
|
+ <span class="mr-20px" v-if="scope.row.payTime">
|
|
|
+ 支付时间:{{ formatDate(scope.row.payTime) }}
|
|
|
+ </span>
|
|
|
+ <span>订单类型:</span>
|
|
|
+ <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.type" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template #default="{ row }">
|
|
|
<div class="flex items-center">
|
|
|
<el-image
|
|
@@ -163,13 +201,9 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="商品原价*数量" prop="price" width="150">
|
|
|
<template #default="{ row }">
|
|
|
- <!-- TODO @puhui999:价格,要有 xxx.00 这种格式 -->
|
|
|
- {{ formatToFraction(row.price) }} 元 * {{ row.count }}
|
|
|
+ {{ floatToFixed2(row.price) }} 元 / {{ row.count }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="合计" prop="payPrice" width="150">
|
|
|
- <template #default="{ row }">{{ formatToFraction(row.payPrice) }}元</template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column label="售后状态" prop="afterSaleStatus" width="120">
|
|
|
<template #default="{ row }">
|
|
|
<dict-tag
|
|
@@ -180,8 +214,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="实际支付" min-width="120" prop="payPrice">
|
|
|
<template #default>
|
|
|
- <!-- TODO @puhui999:价格,要有 xxx.00 这种格式 -->
|
|
|
- {{ formatToFraction(scope.row.payPrice) + '元' }}
|
|
|
+ {{ floatToFixed2(scope.row.payPrice) + '元' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="买家/收货人" min-width="160">
|
|
@@ -218,6 +251,11 @@
|
|
|
<dict-tag :type="DICT_TYPE.TRADE_DELIVERY_TYPE" :value="scope.row.deliveryType" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column align="center" label="订单状态" width="120">
|
|
|
+ <template #default>
|
|
|
+ <dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="scope.row.status" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column align="center" fixed="right" label="操作" width="160">
|
|
|
<template #default>
|
|
|
<!-- TODO 权限后续补齐 -->
|
|
@@ -233,14 +271,16 @@
|
|
|
</el-button>
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu>
|
|
|
- <!-- TODO puhui999:可以判断下状态 + 物流类型,展示【发货】按钮 -->
|
|
|
- <el-dropdown-item command="delivery">
|
|
|
+ <!-- 如果是【快递】,并且【未发货】,则展示【发货】按钮 -->
|
|
|
+ <el-dropdown-item
|
|
|
+ v-if="scope.row.deliveryType === 1 && scope.row.status === 10"
|
|
|
+ command="delivery"
|
|
|
+ >
|
|
|
<Icon icon="ep:takeaway-box" />
|
|
|
发货
|
|
|
</el-dropdown-item>
|
|
|
- <el-dropdown-item command="orderRemarks">
|
|
|
- <Icon icon="ep:chat-line-square" />
|
|
|
- 订单备注
|
|
|
+ <el-dropdown-item command="remark">
|
|
|
+ <Icon icon="ep:chat-line-square" /> 备注
|
|
|
</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
@@ -251,51 +291,6 @@
|
|
|
</el-table>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="订单号" min-width="110" prop="no" />
|
|
|
- <el-table-column align="center" label="订单类型" min-width="100">
|
|
|
- <template #default="{ row }">
|
|
|
- <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="row.type" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" label="订单来源" min-width="145">
|
|
|
- <template #default="{ row }">
|
|
|
- <dict-tag v-if="row.terminal" :type="DICT_TYPE.TERMINAL" :value="row.terminal" />
|
|
|
- <span v-else>{{ row.terminal }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- :formatter="dateFormatter"
|
|
|
- align="center"
|
|
|
- label="支付时间"
|
|
|
- min-width="180"
|
|
|
- prop="payTime"
|
|
|
- />
|
|
|
- <el-table-column align="center" label="支付类型" min-width="120" prop="payChannelCode">
|
|
|
- <template #default="{ row }">
|
|
|
- <dict-tag
|
|
|
- v-if="row.payChannelCode"
|
|
|
- :type="DICT_TYPE.PAY_CHANNEL_CODE"
|
|
|
- :value="row.payChannelCode"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" label="订单状态" min-width="100" prop="status">
|
|
|
- <template #default="{ row }">
|
|
|
- <dict-tag
|
|
|
- v-if="row.status !== ''"
|
|
|
- :type="DICT_TYPE.TRADE_ORDER_STATUS"
|
|
|
- :value="row.status"
|
|
|
- />
|
|
|
- <span v-else>{{ row.status }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- :formatter="dateFormatter"
|
|
|
- align="center"
|
|
|
- label="创建时间"
|
|
|
- min-width="180"
|
|
|
- prop="createTime"
|
|
|
- />
|
|
|
</el-table>
|
|
|
<!-- 分页 -->
|
|
|
<Pagination
|
|
@@ -307,22 +302,19 @@
|
|
|
</ContentWrap>
|
|
|
|
|
|
<!-- 各种操作的弹窗 -->
|
|
|
- <DeliveryOrderForm ref="deliveryOrderFormRef" @success="getList" />
|
|
|
- <OrderRemarksForm ref="orderRemarksFormRef" @success="getList" />
|
|
|
+ <OrderDeliveryForm ref="deliveryFormRef" @success="getList" />
|
|
|
+ <OrderUpdateRemarkForm ref="updateRemarkForm" @success="getList" />
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" name="Order" setup>
|
|
|
import type { FormInstance, TableColumnCtx } from 'element-plus'
|
|
|
-import DeliveryOrderForm from './components/DeliveryOrderForm.vue'
|
|
|
-import OrderRemarksForm from './components/OrderRemarksForm.vue'
|
|
|
-import { dateFormatter } from '@/utils/formatTime'
|
|
|
+import OrderDeliveryForm from './components/OrderDeliveryForm.vue'
|
|
|
+import OrderUpdateRemarkForm from './components/OrderUpdateRemarkForm.vue'
|
|
|
import * as TradeOrderApi from '@/api/mall/trade/order'
|
|
|
-// @puhui999:通过 TradeOrderApi 去引用对应的 VO 就可以啦
|
|
|
-import { OrderItemRespVO, OrderVO } from '@/api/mall/trade/order'
|
|
|
-// @puhui999:使用 XXXApi 哈
|
|
|
-import { getListAllSimple } from '@/api/mall/trade/delivery/pickUpStore'
|
|
|
-import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
|
|
|
-import { formatToFraction } from '@/utils'
|
|
|
+import * as PickUpStoreApi from '@/api/mall/trade/delivery/pickUpStore'
|
|
|
+import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
|
|
+import { formatDate } from '@/utils/formatTime'
|
|
|
+import { floatToFixed2 } from '@/utils'
|
|
|
import { createImageViewer } from '@/components/ImageViewer'
|
|
|
import * as DeliveryExpressApi from '@/api/mall/trade/delivery/express'
|
|
|
|
|
@@ -330,7 +322,7 @@ const { currentRoute, push } = useRouter() // 路由跳转
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
const total = ref(2) // 列表的总页数
|
|
|
-const list = ref<OrderVO[]>([]) // 列表的数据
|
|
|
+const list = ref<TradeOrderApi.OrderVO[]>([]) // 列表的数据
|
|
|
const queryFormRef = ref<FormInstance>() // 搜索的表单
|
|
|
// 表单搜索
|
|
|
const queryParams = reactive({
|
|
@@ -367,25 +359,43 @@ const searchList = ref([
|
|
|
{ value: 'userMobile', label: '用户电话' }
|
|
|
])
|
|
|
|
|
|
+const headerStyle = ({ row, columnIndex }: any) => {
|
|
|
+ // 表头第一行第一列占 8
|
|
|
+ if (columnIndex === 0) {
|
|
|
+ row[columnIndex].colSpan = 8
|
|
|
+ } else {
|
|
|
+ // 其余的不要
|
|
|
+ row[columnIndex].colSpan = 0
|
|
|
+ return {
|
|
|
+ display: 'none'
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
interface SpanMethodProps {
|
|
|
- row: OrderItemRespVO
|
|
|
- column: TableColumnCtx<OrderItemRespVO>
|
|
|
+ row: TradeOrderApi.OrderItemRespVO
|
|
|
+ column: TableColumnCtx<TradeOrderApi.OrderItemRespVO>
|
|
|
rowIndex: number
|
|
|
columnIndex: number
|
|
|
}
|
|
|
-const spanMethod = ({ rowIndex, columnIndex }: SpanMethodProps) => {
|
|
|
- const colIndex = [4, 5, 6, 7]
|
|
|
- // 处理列
|
|
|
+
|
|
|
+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]
|
|
|
if (colIndex.includes(columnIndex)) {
|
|
|
- // 处理被合并的行
|
|
|
+ // 除了第一行其余的不要
|
|
|
if (rowIndex !== 0) {
|
|
|
return {
|
|
|
rowspan: 0,
|
|
|
colspan: 0
|
|
|
}
|
|
|
}
|
|
|
+ // 动态合并行
|
|
|
return {
|
|
|
- rowspan: 2,
|
|
|
+ rowspan: len,
|
|
|
colspan: 1
|
|
|
}
|
|
|
}
|
|
@@ -404,9 +414,9 @@ const getList = async () => {
|
|
|
}
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
-const handleQuery = () => {
|
|
|
+const handleQuery = async () => {
|
|
|
queryParams.pageNo = 1
|
|
|
- getList()
|
|
|
+ await getList()
|
|
|
}
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
@@ -422,27 +432,26 @@ const imagePreview = (imgUrl: string) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-/** 查看商品详情 */
|
|
|
+/** 查看订单详情 */
|
|
|
const openForm = (id: number) => {
|
|
|
- // TODO @puhui999:这里最好用 name 来跳转,因为 url 可能会改
|
|
|
- push('/trade/order/detail/' + id)
|
|
|
+ push({ name: 'TradeOrderDetailForm', params: { orderId: id } })
|
|
|
}
|
|
|
|
|
|
/** 操作分发 */
|
|
|
-const deliveryOrderFormRef = ref()
|
|
|
-const orderRemarksFormRef = ref()
|
|
|
-const handleCommand = (command: string, row: OrderVO) => {
|
|
|
+const deliveryFormRef = ref()
|
|
|
+const updateRemarkForm = ref()
|
|
|
+const handleCommand = (command: string, row: TradeOrderApi.OrderVO) => {
|
|
|
switch (command) {
|
|
|
- case 'orderRemarks': // TODO @puhui999:orderRemarks 是不是改成 remark 会好点,保持统一
|
|
|
- orderRemarksFormRef.value?.open(row)
|
|
|
+ case 'remark':
|
|
|
+ updateRemarkForm.value?.open(row)
|
|
|
break
|
|
|
case 'delivery':
|
|
|
- deliveryOrderFormRef.value?.open(row.id)
|
|
|
+ deliveryFormRef.value?.open(row)
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 监听路由变化更新列表,解决商品保存后,列表不刷新的问题。
|
|
|
+// 监听路由变化更新列表,解决订单保存/更新后,列表不刷新的问题。
|
|
|
watch(
|
|
|
() => currentRoute.value,
|
|
|
() => {
|
|
@@ -455,7 +464,12 @@ const deliveryExpressList = ref([]) // 物流公司
|
|
|
/** 初始化 **/
|
|
|
onMounted(async () => {
|
|
|
await getList()
|
|
|
- pickUpStoreList.value = await getListAllSimple()
|
|
|
+ pickUpStoreList.value = await PickUpStoreApi.getListAllSimple()
|
|
|
deliveryExpressList.value = await DeliveryExpressApi.getSimpleDeliveryExpressList()
|
|
|
})
|
|
|
</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+:deep(.order-table-col > .cell) {
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+</style>
|