feat:扫一扫的退款(没有购物车的退款)
This commit is contained in:
1 parent
25013139ab
commit
31ccf613a4
3 files changed
+41
-33
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog title="后台退款" v-model="visible" width="50%" :close-on-click-modal="false" draggable>
|
<el-dialog title="后台退款" v-model="visible" width="70%" :close-on-click-modal="false" draggable>
|
||||||
<el-tabs v-model="state.currentTab" class="demo-tabs" @tab-click="tabClick">
|
<el-tabs v-model="state.currentTab" class="demo-tabs" @tab-click="tabClick">
|
||||||
<el-tab-pane v-for="(v) in data.tabs" :key="v.name" :label="v.label" :name="v.name" />
|
<el-tab-pane v-for="(v) in data.tabs" :key="v.name" :label="v.label" :name="v.name" />
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|||||||
@@ -161,43 +161,47 @@ const { getDataList, sortChangeHandle, tableStyle } = useTable(state)
|
|||||||
|
|
||||||
const getCarList = async (orderId: string) => {
|
const getCarList = async (orderId: string) => {
|
||||||
state.queryForm.orderId = orderId
|
state.queryForm.orderId = orderId
|
||||||
// 获取订单商品列表
|
try {
|
||||||
await getDataList()
|
// 获取订单商品列表
|
||||||
if (!state.dataList || !state.dataList.length) {
|
await getDataList()
|
||||||
return
|
if (!state.dataList || !state.dataList.length) {
|
||||||
}
|
return
|
||||||
// 获取已退款的商品
|
}
|
||||||
const { data } = await hardCar.refundCar({ orderId })
|
// 获取已退款的商品
|
||||||
if (!data || !data.length) {
|
const { data } = await hardCar.refundCar({ orderId })
|
||||||
disposeDataList.value = state.dataList.map((item) => {
|
if (!data || !data.length) {
|
||||||
|
disposeDataList.value = state.dataList.map((item) => {
|
||||||
|
if (!item) return null
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
refundProductCount: 0,
|
||||||
|
maxRefundProductCount: item.productCount,
|
||||||
|
refundProductWeight: 0,
|
||||||
|
maxRefundProductWeight: displayWeight(item.productWeight),
|
||||||
|
refundTotalPrice: 0,
|
||||||
|
}
|
||||||
|
}).filter(Boolean)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
refundSuccessList.value = data
|
||||||
|
// 计算出需要退款的商品
|
||||||
|
const refundViewList = [...state.dataList]
|
||||||
|
disposeDataList.value = refundViewList.map((item) => {
|
||||||
if (!item) return null
|
if (!item) return null
|
||||||
|
const target = data.find((v: any) => v.productId == item.productId)
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
refundProductCount: 0,
|
refundProductCount: 0,
|
||||||
maxRefundProductCount: item.productCount,
|
maxRefundProductCount: item.productCount - (target?.productCount ?? 0),
|
||||||
refundProductWeight: 0,
|
refundProductWeight: 0,
|
||||||
maxRefundProductWeight: displayWeight(item.productWeight),
|
maxRefundProductWeight: displayWeight(item.productWeight - (target?.productWeight ?? 0)),
|
||||||
refundTotalPrice: 0,
|
refundTotalPrice: 0,
|
||||||
}
|
}
|
||||||
}).filter(Boolean)
|
}).filter(Boolean)
|
||||||
return
|
} catch (error: any) {
|
||||||
|
state.dataList = []
|
||||||
|
disposeDataList.value = []
|
||||||
}
|
}
|
||||||
refundSuccessList.value = data
|
|
||||||
// 计算出需要退款的商品
|
|
||||||
const refundViewList = [...state.dataList]
|
|
||||||
disposeDataList.value = refundViewList.map((item) => {
|
|
||||||
if (!item) return null
|
|
||||||
const target = data.find((v: any) => v.productId == item.productId)
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
refundProductCount: 0,
|
|
||||||
maxRefundProductCount: item.productCount - (target?.productCount ?? 0),
|
|
||||||
refundProductWeight: 0,
|
|
||||||
maxRefundProductWeight: displayWeight(item.productWeight - (target?.productWeight ?? 0)),
|
|
||||||
refundTotalPrice: 0,
|
|
||||||
}
|
|
||||||
}).filter(Boolean)
|
|
||||||
console.log("disposeDataList:", disposeDataList.value);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,8 +224,6 @@ const handleAllRefund = () => {
|
|||||||
v.refundTotalPrice = target.totalPrice
|
v.refundTotalPrice = target.totalPrice
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log("全部:", _list);
|
|
||||||
|
|
||||||
disposeDataList.value = _list
|
disposeDataList.value = _list
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,6 +250,11 @@ const getSummaries = (param: any) => {
|
|||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const validate = async () => {
|
const validate = async () => {
|
||||||
|
// 如果购物车为空直接返回true
|
||||||
|
if (!state.dataList || !state.dataList.length) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
let valid = false
|
let valid = false
|
||||||
for (const v of disposeDataList.value) {
|
for (const v of disposeDataList.value) {
|
||||||
if (v.refundProductCount > 0 || v.refundProductWeight > 0) {
|
if (v.refundProductCount > 0 || v.refundProductWeight > 0) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="200px" prop="paymentInformation" label="付款信息">
|
<el-table-column width="220px" prop="paymentInformation" label="付款信息">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="flex justify-between items-start">
|
<div class="flex justify-between items-start">
|
||||||
<div class="w-[200px] h-[25px]">
|
<div class="w-[200px] h-[25px]">
|
||||||
@@ -229,7 +229,8 @@
|
|||||||
v-auth="'hard_hardwareOrder_edit'" @click="formDialogRef.openDialog(row.id)">
|
v-auth="'hard_hardwareOrder_edit'" @click="formDialogRef.openDialog(row.id)">
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="row.orderType !== '5' && !['5', '6', '8'].includes(row.payType)"
|
<el-button
|
||||||
|
v-if="row.orderType !== '5' && !['5', '6', '8'].includes(row.payType) && row.refundPrice != row.payPrice"
|
||||||
icon="stamp" text type="primary" v-auth="'hard_hardAfterSale_adminRefund'"
|
icon="stamp" text type="primary" v-auth="'hard_hardAfterSale_adminRefund'"
|
||||||
@click="adminRefundDailogRef.openDialog(row.id)">
|
@click="adminRefundDailogRef.openDialog(row.id)">
|
||||||
退款
|
退款
|
||||||
|
|||||||
Reference in new issue
Block a user