From b3477f03fe37e01b2ca5979e5bab8e9bd1f92386 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GMUNQ1B\\k" <1154079537@qq.com> Date: Sat, 16 Mar 2024 13:48:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B8=E9=94=80=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/order/orderCancellate.vue | 133 +++++++++++++++------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/src/views/order/orderCancellate.vue b/src/views/order/orderCancellate.vue index b5ff3af..c332192 100644 --- a/src/views/order/orderCancellate.vue +++ b/src/views/order/orderCancellate.vue @@ -1,60 +1,55 @@ @@ -88,7 +83,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -import { orderCancellationApi, goCancellationApi } from '@/api/order' +import { orderCancellationApi, goCancellationApi } from '@/api/order' export default { name: 'OrderCancellate', @@ -101,50 +96,60 @@ export default { orderData: "", multipleSelection: [], ids: [], + verify_code: '', //核销码 isColum: false, productList: [] } }, methods: { searchOrder() { - if(!this.code){ + if (!this.code) { return this.$message.warning('输入核销码!') } this.productDetails(this.code) }, - judgeSelect(row,index){ - return row.is_refund==0 + judgeSelect(row, index) { + return row.is_refund == 0 }, handleCancellation() { - if(!this.code){ + // if (!this.code) { + // return this.$message.warning('输入核销码!') + // } + if (!this.verify_code) { return this.$message.warning('输入核销码!') } + if (!this.multipleSelection.length) { return this.$message.warning('请选择核销商品!') } const data = [] this.multipleSelection.map((item) => { - if(item.refund_num>0){ - data.push({id:item.order_product_id,num:item.refund_num}) + if (item.refund_num > 0) { + data.push({ id: item.order_product_id, num: item.refund_num }) } - + }) - goCancellationApi(this.order_id,{verify_code: this.code,data: data}).then(res => { - this.$message.success(res.message) - this.dialogVisible = false - this.$emit('getList','') + goCancellationApi(this.order_id, { verify_code: this.verify_code, data: data }).then(res => { + this.$message.success(res.message) + this.dialogVisible = false + this.$emit('getList', '') }).catch(({ message }) => { this.$message.error(message) }) }, - productDetails(code) { - this.code = code + productDetails(code, type = false) { + if (type) { this.code = code } + else { + this.code = ""; + this.verify_code = ""; + } this.loading = true orderCancellationApi(code).then(res => { this.orderData = res.data this.order_id = res.data.order_id + if (type) this.verify_code = res.data.verify_code this.productList = res.data.orderProduct - this.productList.forEach((item, index)=>{ + this.productList.forEach((item, index) => { item.max_num = item.refund_num }) this.loading = false @@ -153,19 +158,19 @@ export default { this.$message.error(message) }) }, - resetData(){ + resetData() { this.orderData = {}, - this.productList = []; + this.productList = []; this.code = "" }, - // 选择商品 + // 选择商品 handleSelectionChange(val) { this.multipleSelection = val }, - limitNum(row){ - if(row.refund_num > row.max_num){ + limitNum(row) { + if (row.refund_num > row.max_num) { row.refund_num = row.max_num - }else if(row.refund_num < 1){ + } else if (row.refund_num < 1) { row.refund_num = 1 } } @@ -174,7 +179,7 @@ export default {