优化订单退款
This commit is contained in:
parent
1e66b2ad1f
commit
48c9f24d4c
|
|
@ -35,11 +35,8 @@ VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
|
|||
# VITE_API_URL = 'https://36z1017t45.goho.co/cashier-client'
|
||||
|
||||
# 谭凯凯
|
||||
VITE_API_URL = 'http://192.168.1.35/'
|
||||
# VITE_API_URL = 'http://192.168.1.35/'
|
||||
|
||||
# 正式
|
||||
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
|
||||
|
||||
# 正式
|
||||
# VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
# 测试
|
||||
VITE_API_URL = 'https://tapi.cashier.sxczgkj.cn'
|
||||
|
||||
|
|
|
|||
16160
dist-electron/main.js
16160
dist-electron/main.js
File diff suppressed because one or more lines are too long
|
|
@ -265,7 +265,7 @@ export function callTableCallState(data) {
|
|||
export function handoverTotal(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/account/admin/handover-record/total",
|
||||
url: "/account/admin/handoverRecord/total",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
@ -276,7 +276,7 @@ export function handoverTotal(params) {
|
|||
export function handover(isPrint) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/account/admin/handover-record/handover?isPrint=" + isPrint,
|
||||
url: "/account/admin/handoverRecord/handover?isPrint=" + isPrint,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ export function handover(isPrint) {
|
|||
export function handoverData(id) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/account/admin/handover-record/detail/${id}`,
|
||||
url: `/account/admin/handoverRecord/detail/${id}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ export function handoverData(id) {
|
|||
export function handoverRecordPage(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: `/account/admin/handover-record/page`,
|
||||
url: `/account/admin/handoverRecord/page`,
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
|
@ -307,7 +307,7 @@ export function handoverRecordPage(params) {
|
|||
export function handoverNetworkPrint(id) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: `/account/admin/handover-record/network/print/${id}`,
|
||||
url: `/account/admin/handoverRecord/network/print/${id}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ const takeFoodCodeRef = ref(null);
|
|||
const props = defineProps({
|
||||
type: {
|
||||
type: [String, Number],
|
||||
default: 0, // 1快捷收银 2会员支付
|
||||
default: 0, // 0 订单支付 1 会员充值 2 快捷收款
|
||||
},
|
||||
userInfo: {
|
||||
type: Object,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
<span class="num">{{ money }}</span>
|
||||
</div>
|
||||
<div class="t2">
|
||||
<span>原价:¥{{ formatDecimal(props.amount - goodsStore.tableInfo.tableFee) }}</span>
|
||||
<span style="margin-left: 20px">餐位费:¥{{ formatDecimal(goodsStore.tableInfo.tableFee) }}</span>
|
||||
<span>原价:¥{{ formatDecimal(props.amount - (goodsStore.tableInfo.tableFee || 0)) }}</span>
|
||||
<span style="margin-left: 20px">餐位费:¥{{ formatDecimal(+goodsStore.tableInfo.tableFee || 0) }}</span>
|
||||
<span style="margin-left: 20px">优惠:¥{{ formatDecimal(props.amount - money) }}</span>
|
||||
<span style="margin-left: 20px" v-if="discountRateVlaue" @click="cancelDiscount">
|
||||
折扣:{{ discountRateVlaue }}折
|
||||
|
|
@ -404,8 +404,7 @@ async function payTypeChange(index, item) {
|
|||
// 结算支付
|
||||
async function confirmOrder() {
|
||||
try {
|
||||
payLoading.value = true;
|
||||
|
||||
if (payLoading.value) return
|
||||
payData.value.checkOrderPay.orderAmount = formatDecimal(+money.value);
|
||||
payData.value.checkOrderPay.roundAmount = roundAmount.value;
|
||||
payData.value.checkOrderPay.vipPrice = goodsStore.vipUserInfo.userId ? 1 : 0;
|
||||
|
|
@ -414,8 +413,10 @@ async function confirmOrder() {
|
|||
// await staffPermission("yun_xu_shou_kuan");
|
||||
if (payActive.value == "buyer") {
|
||||
showBuyerHandle();
|
||||
return
|
||||
} else if (payList.value[payActive.value].payType == "scanCode") {
|
||||
scanModalRef.value.show();
|
||||
return
|
||||
} else {
|
||||
// if (money.value < props.amount) return
|
||||
payLoading.value = true;
|
||||
|
|
@ -424,21 +425,21 @@ async function confirmOrder() {
|
|||
// 会员码支付
|
||||
payLoading.value = false;
|
||||
scanModalRef.value.show();
|
||||
break;
|
||||
return;
|
||||
case "cash":
|
||||
//现金
|
||||
if (props.selecttype == 0) {
|
||||
payLoading.loading = true
|
||||
await cashPay(payData.value);
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
break
|
||||
case "vipPay":
|
||||
// 会员支付
|
||||
console.log("使用会员id支付");
|
||||
payLoading.value = false;
|
||||
showDialog.value = true;
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -677,7 +678,7 @@ const calcPointMoney = _.debounce(async function () {
|
|||
|
||||
// 当dialog打开时
|
||||
function couponDialogOpen() {
|
||||
couponForm.value.amount = formatDecimal(money.value - goodsStore.tableInfo.tableFee)
|
||||
couponForm.value.amount = formatDecimal(money.value - (goodsStore.tableInfo.tableFee || 0))
|
||||
couponForm.value.originAmount = couponForm.value.amount
|
||||
resetCouponForm.value = { ...couponForm.value }
|
||||
|
||||
|
|
@ -840,7 +841,7 @@ function discountConfirm() {
|
|||
payData.value.checkOrderPay.orderAmount = couponForm.value.amount
|
||||
|
||||
// 优惠完之后加上餐位费
|
||||
money.value = formatDecimal(+couponForm.value.amount + +goodsStore.tableInfo.tableFee)
|
||||
money.value = formatDecimal(+couponForm.value.amount + +(goodsStore.tableInfo.tableFee || 0))
|
||||
|
||||
payData.value.checkOrderPay.fullCouponDiscountAmount = couponForm.value.fullCouponDiscountAmount
|
||||
|
||||
|
|
|
|||
|
|
@ -116,13 +116,14 @@ const fastOrder = ref('')
|
|||
|
||||
// 提交扫码支付
|
||||
async function submitHandle() {
|
||||
console.log('props.selecttype===', props.selecttype);
|
||||
|
||||
try {
|
||||
if (!scanCode.value) return;
|
||||
loading.value = true;
|
||||
if (props.selecttype == 0) {
|
||||
// 下单扫码支付
|
||||
if (props.payType == 'payType') {
|
||||
|
||||
if (props.payType == 'scanCode') {
|
||||
await microPay({
|
||||
...props.payData,
|
||||
authCode: scanCode.value
|
||||
|
|
@ -157,7 +158,6 @@ async function submitHandle() {
|
|||
} else if (props.selecttype == 2) {
|
||||
|
||||
}
|
||||
emits('success')
|
||||
}
|
||||
if (props.payType == 'deposit') {
|
||||
await accountPay({
|
||||
|
|
@ -170,10 +170,8 @@ async function submitHandle() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
loading.value = false;
|
||||
scanCode.value = "";
|
||||
ElMessage.success("支付成功");
|
||||
dialogVisible.value = false;
|
||||
emits("success");
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ export const useGlobal = defineStore("global", {
|
|||
label: "待支付",
|
||||
},
|
||||
{
|
||||
type: "in-production",
|
||||
type: "in_production",
|
||||
label: "制作中",
|
||||
},
|
||||
{
|
||||
type: "wait-out",
|
||||
type: "wait_out",
|
||||
label: "待取餐",
|
||||
},
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ export const useGlobal = defineStore("global", {
|
|||
label: "退单",
|
||||
},
|
||||
{
|
||||
type: "part-refund",
|
||||
type: "part_refund",
|
||||
label: "部分退单",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,10 +64,11 @@ export const useGoods = defineStore("goods", {
|
|||
}
|
||||
},
|
||||
// 获取订单列表
|
||||
async historyOrderAjax(tableCode) {
|
||||
async historyOrderAjax(tableCode = "", orderId = "") {
|
||||
try {
|
||||
const res = await historyOrder({
|
||||
tableCode: tableCode,
|
||||
orderId: orderId,
|
||||
});
|
||||
|
||||
if (res) {
|
||||
|
|
@ -221,6 +222,8 @@ export const useGoods = defineStore("goods", {
|
|||
} else {
|
||||
if (this.cartList.length) {
|
||||
tableCode = this.cartList[0].table_code;
|
||||
} else {
|
||||
tableCode = useStorage.get("tableCode");
|
||||
}
|
||||
}
|
||||
const sendData = {
|
||||
|
|
@ -324,7 +327,7 @@ export const useGoods = defineStore("goods", {
|
|||
let sku = val.skuList.find((sku) => sku.id == item.skuId);
|
||||
|
||||
let group_text = "";
|
||||
if (val.type == "package") {
|
||||
if (val.type == "package" && item.pro_group_info) {
|
||||
group_text = JSON.parse(item.proGroupInfo)
|
||||
.flat()
|
||||
.map((item) => item.proName)
|
||||
|
|
@ -442,7 +445,7 @@ export const useGoods = defineStore("goods", {
|
|||
|
||||
total += +val.number;
|
||||
|
||||
if (+val.pack_number) {
|
||||
if (+val.pack_number && !val.is_temporary) {
|
||||
packFeeNumber += +val.pack_number;
|
||||
packFee += +val.pack_number * +val.packFee;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export function RandomNumBoth(Max, Min = 0) {
|
|||
* 去除字符串中除了数字和点以外的其他字符
|
||||
* @param {Object} obj
|
||||
*/
|
||||
export function clearNoNum(obj) {
|
||||
export function clearNoNum(obj) {
|
||||
// 如果用户第一位输入的是小数点,则重置输入框内容
|
||||
if (obj.value != "" && obj.value.substr(0, 1) == ".") {
|
||||
obj.value = "";
|
||||
|
|
@ -139,7 +139,7 @@ export async function getOrderByIdAjax(orderId) {
|
|||
|
||||
arr = arr.flat();
|
||||
arr.map((item) => {
|
||||
if (item.productType == "package") {
|
||||
if (item.productType == "package" && item.proGroupInfo) {
|
||||
item.proGroupInfo = JSON.parse(item.proGroupInfo).flat();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
</template>
|
||||
<template v-else>
|
||||
<el-text tag="del" class="del" size="small">¥{{ item.skuList[0].salePrice
|
||||
}}</el-text>
|
||||
}}</el-text>
|
||||
<el-text>¥{{ item.skuList[0].memberPrice }}</el-text>
|
||||
</template>
|
||||
</div>
|
||||
|
|
@ -249,7 +249,7 @@ import { Swiper, SwiperSlide } from 'swiper/vue'
|
|||
import "swiper/swiper-bundle.css";
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { inputFilterFloat } from '@/utils/index.js'
|
||||
import { inputFilterFloat, clearNoNum } from '@/utils/index.js'
|
||||
|
||||
const swiperRef = ref(null)
|
||||
|
||||
|
|
@ -295,8 +295,8 @@ const temporaryFormRef = ref(null)
|
|||
const resetTemporaryForm = ref({})
|
||||
const temporaryForm = ref({
|
||||
is_temporary: 1, // 是临时菜
|
||||
discount_sale_amount: '12', // 临时菜价格
|
||||
product_name: '西红寺', // 临时菜名称
|
||||
discount_sale_amount: '', // 临时菜价格
|
||||
product_name: '', // 临时菜名称
|
||||
number: 1, // 下单数量
|
||||
remark: '', // 备注
|
||||
})
|
||||
|
|
@ -310,7 +310,7 @@ const noteList = ref([
|
|||
|
||||
function priceInput(e) {
|
||||
setTimeout(() => {
|
||||
temporaryForm.value.price = inputFilterFloat(e)
|
||||
temporaryForm.value.discount_sale_amount = clearNoNum({ value: e })
|
||||
}, 50)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<div class="title_wrap">
|
||||
<div class="item">规格组名:{{ item.title }}</div>
|
||||
<div class="item"
|
||||
v-html="`本组菜品<span style='color: var(--el-color-danger)'>${item.count}</span>选<span style='color: var(--el-color-danger)'>${item.number}</span>`">
|
||||
v-html="`本组菜品<span style='color: var(--el-color-danger)'>${item.count || 0}</span>选<span style='color: var(--el-color-danger)'>${item.number || 0}</span>`">
|
||||
</div>
|
||||
</div>
|
||||
<div class="error">
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ import useStorage from '@/utils/useStorage.js'
|
|||
import { useGlobal } from '@/store/global.js'
|
||||
import { usePrint } from '@/store/print.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
import { useSocket } from '@/store/socket.js'
|
||||
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
|
||||
|
|
@ -102,8 +103,9 @@ const global = useGlobal()
|
|||
const printStore = usePrint()
|
||||
|
||||
const store = useUser();
|
||||
const socket = useSocket()
|
||||
|
||||
const emit = defineEmits("paySuccess");
|
||||
const emits = defineEmits(['success']);
|
||||
|
||||
const cartInfo = ref('')
|
||||
|
||||
|
|
@ -122,10 +124,6 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: "",
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: "",
|
||||
},
|
||||
masterId: {
|
||||
type: String,
|
||||
default: "",
|
||||
|
|
@ -210,11 +208,13 @@ async function printOrderLable(isBefore = false) {
|
|||
|
||||
// 订单已支付
|
||||
function paySuccess() {
|
||||
emits('success')
|
||||
dialogVisible.value = false;
|
||||
ElMessage.success('支付成功')
|
||||
printOrderLable()
|
||||
useStorage.del('tableCode')
|
||||
goodsStore.successClearCart(!cartList.length)
|
||||
socket.cartInit()
|
||||
goodsStore.successClearCart()
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@
|
|||
</div>
|
||||
<div class="n"></div>
|
||||
<div class="p">
|
||||
<span>
|
||||
<span v-if="item.is_temporary">
|
||||
+¥0.00
|
||||
</span>
|
||||
<span v-else>
|
||||
+¥{{ formatDecimal(item.pack_number * item.packFee) }}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
<!-- <takeFoodCode ref="takeFoodCodeRef" title="修改取餐号" placeholder="请输入取餐号" @success="takeFoodCodeSuccess" /> -->
|
||||
<!-- 结算订单 -->
|
||||
<settleAccount ref="settleAccountRef" :cart="cartList" :amount="cartInfo.totalAmount" :remark="remark"
|
||||
:orderInfo="orderInfo" @paySuccess="createCodeAjax(1)" />
|
||||
:orderInfo="orderInfo" @success="" />
|
||||
<!-- 快捷收银 -->
|
||||
<fastCashier ref="fastCashierRef" type="0" />
|
||||
<!-- 挂起订单 -->
|
||||
|
|
|
|||
|
|
@ -106,12 +106,12 @@ const codeUrl = ref('')
|
|||
const codeUrlLoading = ref(false)
|
||||
|
||||
const form = reactive({
|
||||
username: "18888888888",
|
||||
staffUserName: '18821670757',
|
||||
password: "123456",
|
||||
username: "",
|
||||
staffUserName: '',
|
||||
password: "",
|
||||
code: "",
|
||||
uuid: "",
|
||||
loginType: 1, // 0: 商户 1: 员工
|
||||
loginType: 0, // 0: 商户 1: 员工
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
|
|
@ -145,7 +145,7 @@ const submitHandle = () => {
|
|||
loading.value = true;
|
||||
store
|
||||
.userlogin(form)
|
||||
.then(async (res) => {
|
||||
.then(async (res) => {
|
||||
// 登录成功后保存商户号
|
||||
// useStorage.set('merchantLoginAccount', form.username)
|
||||
ElMessage.success("登录成功");
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@
|
|||
<template #prepend>¥</template>
|
||||
</el-input>
|
||||
<template v-else>
|
||||
退款金额:¥{{ formatDecimal(refundType == 1 ? item.originAmount : amount) }}
|
||||
退款金额:¥{{ formatDecimal(refundType == 1 ? item.originAmount - item.refundAmount : amount) }}
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<el-table ref="tableRef" :data="item.goods" brder stripe @selection-change="tabSelectChange">
|
||||
<el-table ref="tableRef" :data="item.onGoods" brder stripe @selection-change="tabSelectChange">
|
||||
<el-table-column type="selection" width="35" :selectable="selectable"></el-table-column>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
|
|
@ -57,12 +57,45 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="退款数量" width="170">
|
||||
<template v-slot="scope">
|
||||
<el-input-number v-model="scope.row.refundNum" :min="1" :max="+scope.row.num"
|
||||
<el-input-number v-model="scope.row.refund_number" :min="1" :max="scope.row.num"
|
||||
style="width: 130px;" @change="numberChange">
|
||||
</el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template v-if="item.returnGoods.length">
|
||||
<div class="tips" style="margin-top: 20px;padding-bottom: 10px;">以下为已退部分退单/退菜</div>
|
||||
<el-table :data="item.returnGoods" brder stripe>
|
||||
<el-table-column label="商品信息">
|
||||
<template v-slot="scope">
|
||||
<div class="goods_info">
|
||||
<el-image :src="scope.row.productImg" style="width: 50px;height: 50px;"></el-image>
|
||||
<div class="info">
|
||||
<div class="name">
|
||||
<span>{{ scope.row.productName }}</span>
|
||||
</div>
|
||||
<div class="sku" v-if="scope.row.skuName">{{ scope.row.skuName }}</div>
|
||||
<div class="sku">¥{{ formatDecimal(+scope.row.payAmount) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单数量" prop="num" width="100"></el-table-column>
|
||||
<el-table-column label="支付金额" width="100">
|
||||
<template v-slot="scope">
|
||||
¥{{ formatDecimal(+scope.row.payAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已退款数量" width="170">
|
||||
<template v-slot="scope">
|
||||
<div class="column">
|
||||
<div class="row">退单数量:{{ scope.row.refundNum }}</div>
|
||||
<div class="row">退菜数量:{{ scope.row.returnNum }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
<div class="ipt">
|
||||
<el-input type="textarea" v-model="remark" placeholder="请输入退单原因" />
|
||||
</div>
|
||||
|
|
@ -153,9 +186,9 @@ async function refundHandle(cash = false) {
|
|||
if (refundType.value != 1) {
|
||||
refundDetails = tableRef.value.getSelectionRows().map(val => {
|
||||
return {
|
||||
id: item.value.id,
|
||||
id: val.id,
|
||||
returnAmount: val.payAmount,
|
||||
num: val.refundNum
|
||||
num: val.refund_number
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -209,7 +242,7 @@ function numberChange() {
|
|||
function tabSelectChange(val) {
|
||||
amount.value = 0
|
||||
val.map(item => {
|
||||
amount.value += item.refundNum * item.payAmount
|
||||
amount.value += item.refund_number * item.payAmount
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -230,10 +263,29 @@ function resetDrawer() {
|
|||
function show(row) {
|
||||
isShow.value = true
|
||||
item.value = { ...row }
|
||||
|
||||
let onGoods = []
|
||||
let returnGoods = []
|
||||
item.value.goods.map(item => {
|
||||
item.refundNum = item.num
|
||||
// 可退的最大数量,下单数量 - 已退数量 - 退菜数量
|
||||
let refundMaxNum = item.num - item.refundNum - item.returnNum
|
||||
|
||||
if (refundMaxNum <= 0) {
|
||||
// 已经退过,不在允许操作
|
||||
returnGoods.push(item)
|
||||
} else {
|
||||
// 可以操作的退款数量
|
||||
item.refund_number = item.num
|
||||
onGoods.push(item)
|
||||
}
|
||||
})
|
||||
|
||||
item.value.onGoods = onGoods
|
||||
item.value.returnGoods = returnGoods
|
||||
|
||||
console.log('item.value===', item.value);
|
||||
|
||||
|
||||
resetDrawer()
|
||||
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
|
|
@ -17,11 +17,17 @@
|
|||
<div class="table_wrap">
|
||||
<div class="table">
|
||||
<el-table :data="tableData.list" v-loading="tableData.loading" border strip height="100%">
|
||||
<el-table-column label="台桌" prop="tableName" width="80"></el-table-column>
|
||||
<el-table-column label="订单信息" width="240">
|
||||
<el-table-column label="台桌" prop="tableName" width="80" align="center">
|
||||
<template v-slot="scope">
|
||||
<span v-if="scope.row.tableName">{{ scope.row.tableName }}</span>
|
||||
<span v-else>无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单信息" width="340">
|
||||
<template v-slot="scope">
|
||||
<div class="column">
|
||||
<div class="row">订单号:{{ scope.row.orderNo }}</div>
|
||||
<div class="row">下单时间:{{ scope.row.createTime }}</div>
|
||||
<div class="row">
|
||||
订单类型:{{ filterLable("orderType", scope.row.orderType) }}
|
||||
</div>
|
||||
|
|
@ -69,9 +75,14 @@
|
|||
<template v-slot="scope">
|
||||
<div class="column">
|
||||
<div class="row">
|
||||
<el-button type="primary" @click="RefundDrawerRef.show(scope.row)">订单退款</el-button>
|
||||
<el-button type="warning" :disabled="scope.row.status != 'unpaid'" :loading="scope.row.payLoading"
|
||||
@click="orderDoneHandle(scope.row)">结算订单</el-button>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 10px">
|
||||
<div class="row">
|
||||
<el-button type="primary" :disabled="refundState(scope.row.status)"
|
||||
@click="RefundDrawerRef.show(scope.row)">订单退款</el-button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<el-button type="success" @click="PrintDrawerRef.show(scope.row)">
|
||||
订单打印
|
||||
</el-button>
|
||||
|
|
@ -92,19 +103,26 @@
|
|||
<RefundDrawer ref="RefundDrawerRef" @success="queryFormHandle" />
|
||||
<!-- 打印操作 -->
|
||||
<PrintDrawer ref="PrintDrawerRef" />
|
||||
<!-- 结算订单 -->
|
||||
<SettleAccount ref="SettleAccountRef" @success="orderListAjax" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, reactive } from "vue";
|
||||
import { orderList } from "@/api/order.js";
|
||||
import { useGlobal } from "@/store/global.js";
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
import DateRange from "./components/dateRange.vue";
|
||||
import RefundDrawer from "./components/refundDrawer.vue";
|
||||
import PrintDrawer from "./components/printDrawer.vue";
|
||||
import SettleAccount from '@/views/home/components/settleAccount.vue'
|
||||
|
||||
const RefundDrawerRef = ref(null);
|
||||
const PrintDrawerRef = ref(null);
|
||||
const DateRangeRef = ref(null);
|
||||
const SettleAccountRef = ref(null)
|
||||
|
||||
const goodsStore = useGoods()
|
||||
const globalStore = useGlobal();
|
||||
|
||||
const queryForm = ref({
|
||||
|
|
@ -154,11 +172,51 @@ function filterLable(key, type) {
|
|||
}
|
||||
}
|
||||
|
||||
// 过滤退款条件
|
||||
function refundState(state) {
|
||||
switch (state) {
|
||||
case 'unpaid':
|
||||
return true;
|
||||
case 'in-production':
|
||||
return false;
|
||||
case 'wait-out':
|
||||
return false;
|
||||
case 'done':
|
||||
return false;
|
||||
case 'refunding':
|
||||
return false;
|
||||
case 'refund':
|
||||
return true;
|
||||
case 'part-refund':
|
||||
return false;
|
||||
case 'cancelled':
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 结算订单
|
||||
async function orderDoneHandle(row) {
|
||||
try {
|
||||
row.payLoading = true
|
||||
await goodsStore.historyOrderAjax('', row.id)
|
||||
row.payLoading = false
|
||||
goodsStore.calcCartInfo()
|
||||
SettleAccountRef.value.show()
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订单列表
|
||||
async function orderListAjax() {
|
||||
try {
|
||||
tableData.loading = true;
|
||||
const res = await orderList(queryForm.value);
|
||||
res.records.map(item => {
|
||||
item.payLoading = false
|
||||
})
|
||||
tableData.list = [];
|
||||
tableData.list = res.records;
|
||||
tableData.total = +res.totalRow;
|
||||
|
|
@ -218,7 +276,7 @@ onMounted(() => {
|
|||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px 0;
|
||||
gap: 10px;
|
||||
|
||||
.row {
|
||||
width: 100%;
|
||||
|
|
|
|||
Loading…
Reference in New Issue