fix: 订单管理退款修改,台桌跳转代客下单页面
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
<span class="">
|
||||
{{ goods.productName }}
|
||||
</span>
|
||||
<span class="color-999 u-m-l-10">x{{ goods.num || "" }}</span>
|
||||
<span class="color-999 u-m-l-10">x{{ goods.selNumber || "" }}</span>
|
||||
<span class="color-333 u-m-l-10 u-font-600">
|
||||
{{ goods.payAmount || "" }}
|
||||
{{ (goods.selNumber * goods.unitPrice).toFixed(2) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-col-top u-m-t-22">
|
||||
<h4span class="u-m-0">支付金额</h4span>
|
||||
<span class="u-m-0">支付金额</span>
|
||||
<div class="u-p-l-20">
|
||||
{{ detail.payAmount }}
|
||||
</div>
|
||||
@@ -32,26 +32,30 @@
|
||||
</div>
|
||||
<div class="u-p-b-16 u-m-t-22">
|
||||
<div class="flex u-row-between">
|
||||
<span>线下收款</span>
|
||||
<span class="color-red">退款金额</span>
|
||||
<div class="u-flex u-flex-1 u-p-l-20">
|
||||
<el-input type="number" v-model="number" :min="min" :max="max">
|
||||
<template #append>可退1元</template>
|
||||
</el-input>
|
||||
<el-input-number
|
||||
type="number"
|
||||
v-model="number"
|
||||
:min="min"
|
||||
:max="canReturnMoney"
|
||||
></el-input-number>
|
||||
<span class="u-m-l-10">可退{{ canReturnMoney }}元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-col-top u-m-t-22">
|
||||
<div class="u-flex u-col-top u-m-t-22" v-if="detail.returnAmount * 1 > 0">
|
||||
<span class="u-m-0">退款金额</span>
|
||||
<div class="u-p-l-20">
|
||||
<span class="color-red">¥ {{ detail.discountAmount }}</span>
|
||||
<span class="color-666 u-m-l-4">(退款商品金额:260.16)</span>
|
||||
<span class="color-red">¥ {{ detail.returnAmount || 0 }}</span>
|
||||
<!-- <span class="color-666 u-m-l-4">(退款商品金额)</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-flex u-col-top u-m-t-22">
|
||||
<!-- <div class="u-flex u-col-top u-m-t-22">
|
||||
<span class="u-m-0">退回优惠券</span>
|
||||
<div class="u-p-l-20">
|
||||
<span class="color-666 u-m-l-4">该订单未使用优惠券</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="u-p-b-16 border-bottom">
|
||||
@@ -130,6 +134,12 @@ export default {
|
||||
const danjia = this.goods.price;
|
||||
return (danjia * this.number).toFixed(2);
|
||||
},
|
||||
canReturnMoney() {
|
||||
if (!this.detail) {
|
||||
return 0;
|
||||
}
|
||||
return this.detail.payAmount - this.detail.refundAmount;
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
to2(val) {
|
||||
@@ -155,6 +165,11 @@ export default {
|
||||
this.note = tag + "," + this.note;
|
||||
},
|
||||
open(goods, detailInfo) {
|
||||
const totalMoney = goods.reduce((prve, cur) => {
|
||||
console.log(cur);
|
||||
return prve + cur.unitPrice * cur.selNumber;
|
||||
}, 0);
|
||||
this.number = totalMoney.toFixed(2);
|
||||
this.goodsList = goods;
|
||||
this.show = true;
|
||||
this.detail = detailInfo;
|
||||
@@ -174,12 +189,12 @@ export default {
|
||||
return ElMessage.error("请输入退款原因");
|
||||
}
|
||||
this.$emit("confirm", {
|
||||
refundAmount: (this.goods.price * this.number).toFixed(2) * 1,
|
||||
refundAmount: this.number,
|
||||
cash: this.cash,
|
||||
refundReason: note,
|
||||
refundDetails: [
|
||||
{ id: this.goods.id, num: this.number, returnAmount: this.tuikuanJine * 1 },
|
||||
],
|
||||
refundDetails: this.goodsList.map((v) => {
|
||||
return { id: v.id, num: v.num };
|
||||
}),
|
||||
});
|
||||
this.close();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user