fix: 订单管理退款修改,台桌跳转代客下单页面

This commit is contained in:
2025-03-06 19:32:13 +08:00
parent d6eb27186f
commit ef358f33bb
12 changed files with 758 additions and 129 deletions

View File

@@ -105,23 +105,21 @@
<el-table
:data="item"
:ref="'refTable' + index"
@selection-change="selectionChange"
@row-click="rowClick($event, index)"
@select-all="tableSelectAll($event, index)"
>
<el-table-column type="selection" width="55" />
<!-- <el-table-column type="selection" width="55" /> -->
<el-table-column label="数量" type="selection">
<template v-slot="scope">
<el-checkbox v-model="scope.row.checked" />
</template>
</el-table-column>
<el-table-column label="商品">
<template v-slot="scope">
<div class="shop_info">
<el-image
v-if="scope.row.productSkuId != '-999'"
:src="scope.row.productImg"
style="width: 40px; height: 40px"
></el-image>
<div class="packeFee" v-else>
<span>
{{ scope.row.productName || "客座费" }}
</span>
</div>
<div class="info">
<span :class="[scope.row.isVip == 1 ? 'colorStyle' : '']">
{{ scope.row.productName }}
@@ -143,6 +141,22 @@
<el-table-column label="实付">
<template v-slot="scope">{{ scope.row.payAmount }}</template>
</el-table-column>
<el-table-column label="可退款数量" align="center">
<template v-slot="scope">
<el-input-number
v-if="scope.row.checked"
style="width: 120px"
v-model="scope.row.selNumber"
:max="scope.row.num - scope.row.refundNum"
></el-input-number>
<span class="" v-else>0</span>
</template>
</el-table-column>
<el-table-column label="已退" width="100" align="center">
<template v-slot="scope">
<span>{{ scope.row.refundNum }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template v-slot="scope">
<template v-if="detail.status != 'unpaid'">
@@ -154,7 +168,7 @@
>
<span>退款</span>
</el-button>
<span class="color-999" v-if="isTui(scope.row)">已退款</span>
<span class="color-999" v-if="scope.row.status == 'refund'">已退款</span>
</template>
<template v-if="detail.status == 'unpaid'">
<el-button
@@ -171,7 +185,7 @@
</el-table-column>
</el-table>
</template>
<div class="u-p-20 u-flex u-row-right">
<div class="u-p-20 u-flex u-row-right" v-if="detail.status !== 'refund'">
<el-checkbox
v-model="allSelected"
@change="allSelectedChange"
@@ -254,6 +268,18 @@ export default {
},
},
methods: {
tableSelect(e) {
console.log(e);
},
tableSelectAll(e, index) {
const arr = this.detail.detailMap[index];
for (let i in arr) {
arr[i].checked = e.length ? true : false;
}
},
tableSelectionChange(e) {
console.log(e);
},
rowClick(row, index) {
this.$refs["refTable" + index][0].toggleRowSelection(row);
},
@@ -262,17 +288,14 @@ export default {
},
allSelectedChange(newval) {
for (let i in this.detail.detailMap) {
this.detail.detailMap[i].forEach((item) => {
if (newval) {
this.$refs["refTable" + i][0].toggleRowSelection(item, true);
} else {
this.$refs["refTable" + i][0].toggleRowSelection(item, false);
}
});
for (let key in this.detail.detailMap[i]) {
this.detail.detailMap[i][key].checked = newval;
}
}
},
reset() {
this.user = "";
this.allSelected = false;
},
returnPayType(payType) {
if (!payType) {
@@ -351,13 +374,17 @@ export default {
let arr = [];
if (item === "all") {
for (let i in this.detail.detailMap) {
arr.push(...this.$refs["refTable" + i][0].getSelectionRows());
this.detail.detailMap[i].map((v) => {
if (v.checked) {
arr.push(v);
}
});
}
} else {
arr = [item];
}
if (arr.length == 0) {
return ElMessage.error("请选择要退款的商品");
return ElMessage.error("请选择要退款的商品和数量");
}
this.selGoods = item;
this.$refs.refReturnMoney.open(arr, this.detail);
@@ -367,26 +394,7 @@ export default {
console.log(item);
this.$refs.refReturnCart.open(item);
},
// 切换类型
getTableData() {
if (this.type == "3") {
this.tbOrderInfoData();
}
},
// 获取退单列表
async tbOrderInfoData() {
try {
const res = await tbOrderInfoData({
source: this.detail.id,
page: 0,
pageSize: 500,
orderType: "0",
});
this.refoundList = res.content;
} catch (error) {
console.log(error);
}
},
// 获取订单详情
async tbOrderInfoDetail(id) {
try {
@@ -397,7 +405,15 @@ export default {
this.user = res1;
});
}
for (let i in res.detailMap) {
res.detailMap[i] = res.detailMap[i].map((v) => {
return {
...v,
checked: false,
selNumber: v.num - v.returnNum,
};
});
}
this.detail = res;
this.loading = false;
} catch (error) {