From 8db1014ad0c02e88609ef3e46a0236f40820ed1d Mon Sep 17 00:00:00 2001 From: mayf <m13160102112@163.com> Date: 星期五, 23 八月 2024 17:49:19 +0800 Subject: [PATCH] 售后相关改动 内容管理改动 --- pages/order/after-sale/index.vue | 253 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 203 insertions(+), 50 deletions(-) diff --git a/pages/order/after-sale/index.vue b/pages/order/after-sale/index.vue index d9d5e89..36d7cdb 100644 --- a/pages/order/after-sale/index.vue +++ b/pages/order/after-sale/index.vue @@ -1,9 +1,20 @@ <template> - <el-bus-crud ref="crud" v-bind="tableConfig"></el-bus-crud> + <el-bus-crud ref="crud" v-bind="tableConfig"> + <template #table="{ list }"> + <template v-if="list && list.length > 0"> + <after-sale-table :list="list" @detail="onDetail" @handle="onHandle" /> + </template> + <el-bus-empty v-else /> + </template> + </el-bus-crud> </template> <script> +import AfterSaleTable from '@/components/order/after-sale-table' export default { + components: { + AfterSaleTable, + }, data() { return { tableConfig: { @@ -11,48 +22,27 @@ hasNew: false, hasEdit: false, hasDelete: false, - onResetView: (row) => { - this.$router.push(`${this.$route.path}/view/${row.id}`) - }, - operationAttrs: { - width: 120, - fixed: 'right', - }, - extraButtons: [ - { - text: '售后处理', - show: (row) => row.status === 'PENDING', - atClick: (row) => { - this.$router.push(`${this.$route.path}/handle/${row.id}`) - }, - }, - ], - columns: [ - { label: '订单号', prop: 'orderNo', minWidth: 150, fixed: 'left' }, - { label: '售后单号', prop: 'salesNo', minWidth: 150 }, - { label: '收货人', prop: 'customer', minWidth: 120 }, - { label: '收货人电话', prop: 'customerTel', minWidth: 120 }, - { - label: '收货地址', - formatter: (row) => - `${row.customerProvince || ''}${row.customerCity || ''}${ - row.customerRegion || '' - }${row.customerAddress || ''}`, - minWidth: 250, - }, - { label: '订单金额', prop: 'totalOrderAmount', minWidth: 150 }, - { label: '售后理由', prop: 'reason', minWidth: 200 }, - { label: '售后状态', prop: 'statusStr', minWidth: 120 }, - { label: '审核状态', prop: 'auditStatusStr', minWidth: 120 }, - { label: '申请时间', prop: 'createTime', minWidth: 180 }, - { label: '处理时间', prop: 'auditTime', minWidth: 180 }, - ], + hasExport: true, + exportUrl: 'flower/api/sales/list/export', + exportText: '售后导出', searchFormAttrs: { labelWidth: 'auto', + }, + beforeRequest: (params) => { + const searchForm = this.$refs.crud?.$refs?.searchForm + if (searchForm) { + const statusComp = searchForm.getComponentById('status') + if (statusComp) { + // 组件内部不会修改这个prop直接修改可忽略警告 + statusComp.extraQuery = { ...params, status: '' } + statusComp.getOtherOptions() + } + } }, searchForm: [ { type: 'row', + id: 'row', items: [ { label: '售后状态:', @@ -60,29 +50,184 @@ type: 'bus-radio', el: { hasAll: true, + otherInterfaceUri: 'flower/api/sales/status/count', childType: 'el-radio-button', - code: 'SALES_STATUS', + filterOptions: (list) => { + return list.map((item) => { + return { + ...item, + label: `${item.label}(${item.orderCount})`, + } + }) + }, + // code: 'ORDER_SALES_STATUS', }, default: '', span: 24, searchImmediately: true, - }, - { - label: '审核状态:', - id: 'auditStatus', - type: 'bus-radio', - el: { - hasAll: true, - childType: 'el-radio-button', - code: 'SALES_AUDIT_STATUS', + on: { + optionsChange: (e, updateForm, { currentComp }) => { + if (Array.isArray(e[0]) && e[0].length > 0) { + const totalCount = e[0].reduce((total, current) => { + return (total += current.orderCount) + }, 0) + // 组件内部不会修改这个prop直接修改可忽略警告 + currentComp.props = { + allLabel: `不限(${totalCount})`, + } + } + }, }, - default: '', - span: 24, - searchImmediately: true, }, + { label: '商品名称:', id: 'flowerName', type: 'input' }, { label: '订单号:', id: 'orderNo', type: 'input' }, { label: '售后单号:', id: 'salesNo', type: 'input' }, + { label: '收货人姓名:', id: 'customer', type: 'input' }, + { label: '收货人电话:', id: 'customerTel', type: 'input' }, + { label: '供应商:', id: 'supplierName', type: 'input' }, + { + label: '下单时间:', + id: 'orderStartDateStr', + component: 'el-bus-date-range', + commonFormat: true, + commonFormatProps: ['orderStartDateStr', 'orderEndDateStr'], + customClass: 'in-bus-form', + }, + { + label: '售后时间:', + id: 'salesStartDateStr', + component: 'el-bus-date-range', + commonFormat: true, + commonFormatProps: ['salesStartDateStr', 'salesEndDateStr'], + customClass: 'in-bus-form', + }, ], + }, + ], + form: [ + { + type: 'row', + items: [ + { label: '商品名称:', id: 'flowerName', type: 'input' }, + { label: '合伙人加价(元):', id: 'markupPartner', type: 'input' }, + { label: '商品价格(元):', id: 'price', type: 'input' }, + { label: '供应商价格(元):', id: 'supplierPrice', type: 'input' }, + { label: '商品数量:', id: 'flowerNum', type: 'input' }, + { label: '申请售后数量:', id: 'num', type: 'input' }, + ], + }, + ], + extraDialogs: [ + { + title: '售后处理', + readonly: true, + confirmText: '通过', + cancelText: '不通过', + confirmButtonAttrs: { + type: 'success', + }, + cancelButtonAttrs: { + type: 'danger', + }, + dialogAttrs: { + width: '70%', + }, + form: [ + { + type: 'row', + items: [ + { + label: '供应商(元):', + id: 'feeSupplier', + type: 'input-number', + el: { min: 0, precision: 2, controls: false }, + }, + { + label: '平台(元):', + id: 'feePlatform', + type: 'input-number', + el: { min: 0, precision: 2, controls: false }, + }, + { + label: '合伙人(元):', + id: 'feePartner', + type: 'input-number', + el: { min: 0, precision: 2, controls: false }, + }, + { + label: '打包(元):', + id: 'feePlatformPack', + type: 'input-number', + el: { min: 0, precision: 2, controls: false }, + }, + { + label: '质检(元):', + id: 'feePlatformCheck', + type: 'input-number', + el: { min: 0, precision: 2, controls: false }, + }, + { + label: '物流(元):', + id: 'feePlatformTransport', + type: 'input-number', + el: { min: 0, precision: 2, controls: false }, + }, + { + label: '申请理由:', + id: 'reason', + type: 'input', + el: { + type: 'textarea', + }, + readonly: true, + span: 24, + }, + { + label: '平台回复:', + id: 'remarks', + type: 'input', + el: { + type: 'textarea', + rows: 6, + }, + rules: { + required: true, + message: '请输入平台回复', + trigger: 'blur', + }, + span: 24, + }, + ], + }, + ], + atConfirm: async (val) => { + const { code } = await this.$elBusHttp.request( + 'flower/api/sales/audit/agree', + { method: 'post', data: val } + ) + if (code === 0) { + this.$message.success('操作成功') + } else { + return false + } + }, + atCancel: async (val) => { + const { code } = await this.$elBusHttp.request( + 'flower/api/sales/audit/reject', + { + method: 'post', + data: { + id: val.id, + remarks: val.remarks, + }, + } + ) + if (code === 0) { + this.$message.success('操作成功') + } else { + return false + } + }, }, ], }, @@ -93,6 +238,14 @@ title: '售后理赔', } }, + methods: { + onDetail(item) { + this.$router.push(`${this.$route.path}/view/${item.id}`) + }, + onHandle(item) { + this.$refs.crud.$refs.extraDialog[0].show(item) + }, + }, } </script> -- Gitblit v1.9.3