diff --git a/src/api/account.js b/src/api/account.js index 6821911..ea94540 100644 --- a/src/api/account.js +++ b/src/api/account.js @@ -90,3 +90,13 @@ export function getPayType(params) { params, }); } + +/** + * 当前登录员工信息 + */ +export function shopStaffInfo() { + return request({ + method: "get", + url: "/account/admin/shopStaff/info", + }); +} diff --git a/src/api/order.js b/src/api/order.js index 7747fc2..2476caa 100644 --- a/src/api/order.js +++ b/src/api/order.js @@ -26,6 +26,19 @@ export function cashPay(data) { }); } +/** + * 查询订单状态 + * @param {*} data + * @returns + */ +export function queryOrderStatus(params) { + return request({ + method: "get", + url: `/order/pay/queryOrderStatus`, + params, + }); +} + /** * 查询订单列表 * @param {*} data @@ -77,3 +90,17 @@ export function refundOrder(data) { data, }); } + +/** + * 订单详情 + * @param {*} data + * @returns + */ +export function getOrderById(params) { + return request({ + method: "get", + url: "/order/admin/order/getOrderById", + params, + }); +} + diff --git a/src/components/lodop/receiptPrint.js b/src/components/lodop/receiptPrint.js index 8cca642..38ddf9e 100644 --- a/src/components/lodop/receiptPrint.js +++ b/src/components/lodop/receiptPrint.js @@ -17,7 +17,7 @@ export default (data) => { let t1 = 40; let t2 = (100 - t1) / 3; let html = ` -
+
${data.shop_name}
@@ -64,7 +64,7 @@ export default (data) => { `; - let proGroupInfo = JSON.parse(item.proGroupInfo); + let proGroupInfo = item.proGroupInfo; for (let item of proGroupInfo) { table += ` @@ -110,14 +110,14 @@ export default (data) => {
折扣 - -${formatDecimal(data.amount - data.discountAmount)} + -${data.discountAmount}

实付 - ¥${data.discountAmount} + ¥${data.amount}

diff --git a/src/components/payCard/payCard.vue b/src/components/payCard/payCard.vue index 598ab8c..842385c 100644 --- a/src/components/payCard/payCard.vue +++ b/src/components/payCard/payCard.vue @@ -299,7 +299,7 @@ async function payTypeChange(index, item) { showBuyerHandle() } if (payActive.value != 'buyer') { - if (payList.value[payActive.value].payType == 'deposit' && !global.orderMemberInfo.id) { + if (payList.value[payActive.value].payType == 'deposit') { scanModalRef.value.show() } } @@ -313,11 +313,12 @@ async function confirmOrder() { try { payLoading.value = true // 暂时使用现金支付 + payData.value.checkOrderPay.orderAmount = formatDecimal(+money.value) + payData.value.checkOrderPay.roundAmount = formatDecimal(props.amount - money.value) + payData.value.checkOrderPay.userId = goodsStore.vipUserInfo.userId ? goodsStore.vipUserInfo.userId : '' + payData.value.checkOrderPay.vipPrice = goodsStore.vipUserInfo.userId ? 1 : 0 await cashPay(payData.value) - payLoading.value = false - ElMessage.success('支付成功') - goodsStore.successDeleteCartItem() emit('paySuccess') return await staffPermission('yun_xu_shou_kuan') @@ -491,27 +492,27 @@ function cancelDiscount() { onMounted(() => { money.value = `${formatDecimal(props.amount)}` - payData.value = { shopId: store.shopInfo.id, buyerRemark: '', // 订单备注 checkOrderPay: { orderId: goodsStore.orderListInfo.id, - userId: '', + vipPrice: 0, // 是否使用会员价 + allPack: 0,// 是否整单打包 + userId: goodsStore.vipUserInfo.id, seatNum: goodsStore.tableInfo.num, // 用餐人数 - originAmount: goodsStore.orderListInfo.originAmount, // 订单原金额(包含打包费+餐位费) 不含折扣价格 + originAmount: formatDecimal(+goodsStore.cartInfo.totalAmount), // 订单原金额(包含打包费+餐位费) 不含折扣价格 discountRatio: 1, // 折扣比例(计算时 向上取整保留 两位小数) discountAmount: 0, // 手动优惠金额 productCouponDiscountAmount: 0, // 商品优惠券抵扣金额 fullCouponDiscountAmount: 0, // 满减优惠券抵扣金额 couponList: [], // 用户使用的卡券 - orderAmount: goodsStore.orderListInfo.originAmount, // 订单金额 + orderAmount: formatDecimal(+goodsStore.cartInfo.totalAmount - goodsStore.cartInfo.packFee), // 订单金额 roundAmount: 0, // 抹零金额 减免多少钱 pointsDiscountAmount: 0, // 积分抵扣金额(tb_points_basic_setting表) pointsNum: 0 // 使用的积分数量 (扣除各类折扣 enable_deduction后使用) } } - queryPayTypeAjax() }) diff --git a/src/components/payCard/scanModal.vue b/src/components/payCard/scanModal.vue index adf5091..34c0252 100644 --- a/src/components/payCard/scanModal.vue +++ b/src/components/payCard/scanModal.vue @@ -58,7 +58,7 @@ import { scanpay, queryOrder, quickPay, queryQuickPayStatus, accountPay, querySc import { useUser } from "@/store/user.js"; import { useGlobal } from '@/store/global.js' import { formatDecimal } from '@/utils' -import { microPay } from '@/api/order.js' +import { microPay, queryOrderStatus } from '@/api/order.js' const store = useUser(); const global = useGlobal() @@ -133,6 +133,7 @@ async function submitHandle() { ...props.payData, authCode: scanCode.value }); + emits('success') } if (props.payType == 'deposit') { await accountPay({ @@ -153,7 +154,7 @@ async function submitHandle() { emits("success"); } catch (error) { console.log(error); - if (error.code === "100015") { + if (error.code === 211) { userPayWait.value = true; fastOrder.value = error.data autoCheckOrder() @@ -178,8 +179,8 @@ function autoCheckOrder() { function clearAutoCheckOrder() { clearInterval(timer.value) timer.value = null - // 开启叫号功能 - global.updateData(true) + // // 开启叫号功能 + // global.updateData(true) } // 查询用户支付状态 @@ -235,8 +236,8 @@ async function checkPayStauts(tips = true) { } } else { // 扫码下单 - const res = await queryOrder({ orderId: props.orderId }); - if (res.status == "closed") { + const res = await queryOrderStatus({ orderId: props.payData.checkOrderPay.orderId }); + if (res == "done") { userPayWait.value = false loading.value = false; scanCode.value = ""; @@ -246,14 +247,14 @@ async function checkPayStauts(tips = true) { emits("success"); return; } - if (res.status == "paying") { + if (res == "unpaid") { if (tips) { ElMessage.warning("用户支付中..."); } return; } else { clearAutoCheckOrder() - ElMessage.error(res.payRemark || "支付失败!"); + ElMessage.error(res.msg); return; } } diff --git a/src/components/selectVipUser.vue b/src/components/selectVipUser.vue index fdc3bb6..1b41c94 100644 --- a/src/components/selectVipUser.vue +++ b/src/components/selectVipUser.vue @@ -34,7 +34,12 @@ diff --git a/src/views/order/components/refundDrawer.vue b/src/views/order/components/refundDrawer.vue index 1bb9fdc..f4f095a 100644 --- a/src/views/order/components/refundDrawer.vue +++ b/src/views/order/components/refundDrawer.vue @@ -44,7 +44,7 @@ {{ scope.row.productName }}
{{ scope.row.skuName }}
-
¥{{ formatDecimal(+scope.row.price) }}
+
¥{{ formatDecimal(+scope.row.payAmount) }}
@@ -76,7 +76,7 @@