fix: 订单管理退款修改,台桌跳转代客下单页面
This commit is contained in:
@@ -134,7 +134,9 @@
|
||||
</div>
|
||||
|
||||
<div class="u-m-t-30">
|
||||
<el-button size="large" @click="discountShow">整单打折/减免</el-button>
|
||||
<el-button size="large" @click="discountShow">
|
||||
{{ checkOrderPay.discount ? checkOrderPay.discount / 10 + "折" : "整单打折/减免" }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="u-m-t-30">
|
||||
<p class="u-font-16 font-bold u-m-r-20 font-bold u-flex">选择支付方式</p>
|
||||
@@ -157,6 +159,10 @@
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>账单明细</h3>
|
||||
<p class="u-font-12 u-m-b-20">
|
||||
<span class="color-red">*</span>
|
||||
<span class="color-red">餐位费和打包费不参与折扣和满减</span>
|
||||
</p>
|
||||
<div class="order-info">
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">订单号:</span>
|
||||
@@ -164,15 +170,15 @@
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">餐位费</span>
|
||||
<span class="u-m-l-10 value">¥{{ orderInfo.seatAmount }}</span>
|
||||
<span class="u-m-l-10 value">¥{{ seatAmount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">打包费</span>
|
||||
<span class="u-m-l-10 value">¥{{ orderInfo.packFee }}</span>
|
||||
<span class="u-m-l-10 value">¥{{ carts.packFee }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">总价</span>
|
||||
<span class="u-m-l-10 value">¥{{ carts.payMoney }}</span>
|
||||
<span class="title">商品订单金额</span>
|
||||
<span class="u-m-l-10 value">¥{{ carts.goodsTotal }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">商品优惠券</span>
|
||||
@@ -182,20 +188,25 @@
|
||||
<span class="title">满减优惠券</span>
|
||||
<span class="u-m-l-10 value">¥{{ fullCouponDiscountAmount }}</span>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">整单改价</span>
|
||||
<span class="u-m-l-10 value">-¥{{ discountAmount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">积分抵扣</span>
|
||||
<span class="u-m-l-10 value">-¥{{ pointsDiscountAmount }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">整单改价</span>
|
||||
<span class="u-m-l-10 value">-¥{{ checkOrderPay.discountAmount || 0 }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">抹零</span>
|
||||
<span class="u-m-l-10 value">-¥{{ 0 }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">应付金额</span>
|
||||
<span class="title">总价(商品订单金额-商品优惠券-满减券-整单改价-积分抵扣)</span>
|
||||
<span class="u-m-l-10 value color-red">¥{{ totalMoney }}</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">应付金额(总价+客座费+打包费)</span>
|
||||
<span class="u-m-l-10 value price">¥{{ currentpayMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -206,6 +217,12 @@
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
<!-- 优惠券 -->
|
||||
<popup-coupon ref="refCoupon" :user="user" @confirm="refCouponConfirm"></popup-coupon>
|
||||
<!-- 挂账 -->
|
||||
<chooseGuaZahng
|
||||
ref="refGuaZhang"
|
||||
:payMoney="currentpayMoney"
|
||||
@confirm="refGuaZhangConfirm"
|
||||
></chooseGuaZahng>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -213,6 +230,9 @@
|
||||
import * as quanUtil from "../quan_util.js";
|
||||
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
import { useUserStore } from "@/store/modules/user";
|
||||
import chooseGuaZahng from "./popup-choose-guazhang.vue";
|
||||
const shopUser = useUserStore();
|
||||
const carts = useCartsStore();
|
||||
|
||||
import popupCoupon from "./popup-coupon.vue";
|
||||
@@ -225,6 +245,14 @@ import discount from "./discount.vue";
|
||||
import { ElLoading } from "element-plus";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
|
||||
//挂账
|
||||
const refGuaZhang = ref();
|
||||
function refGuaZhangConfirm(guazhangRen) {
|
||||
payOrder("arrears", true, guazhangRen);
|
||||
}
|
||||
function refGuaZhangShow() {
|
||||
refGuaZhang.value.open();
|
||||
}
|
||||
//商品列表
|
||||
let goodsArr = [];
|
||||
|
||||
@@ -233,7 +261,7 @@ let $goodsPayPriceMap = {};
|
||||
const refCoupon = ref();
|
||||
let quansSelArr = ref([]);
|
||||
function openCoupon() {
|
||||
refCoupon.value.open(carts.payMoney, props.orderInfo);
|
||||
refCoupon.value.open(carts.goodsTotal, props.orderInfo);
|
||||
}
|
||||
//返回商品券抵扣金额
|
||||
function returnProDiscount(row) {
|
||||
@@ -280,15 +308,14 @@ function discountConfirm(e) {
|
||||
console.log(e);
|
||||
Object.assign(checkOrderPay, e);
|
||||
if (e.discount) {
|
||||
checkOrderPay.discountAmount =
|
||||
carts.payMoney - ((carts.payMoney * (100 - e.discount)) / 100).toFixed(2);
|
||||
checkOrderPay.discountAmount = carts.goodsTotal - (carts.goodsTotal * (100 - e.discount)) / 100;
|
||||
} else {
|
||||
checkOrderPay.discount = 0;
|
||||
}
|
||||
}
|
||||
function discountShow(e) {
|
||||
refDiscount.value.open({
|
||||
amount: carts.payMoney,
|
||||
amount: carts.goodsTotal - productCouponDiscountAmount.value,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -303,12 +330,24 @@ const props = defineProps({
|
||||
return { id: "" };
|
||||
},
|
||||
},
|
||||
perpole: {
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
},
|
||||
orderInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const seatAmount = computed(() => {
|
||||
if (shopUser.userInfo.isTableFee) {
|
||||
return "0.00";
|
||||
}
|
||||
if (props.perpole >= 1) {
|
||||
return (props.perpole * shopUser.userInfo.tableFee).toFixed(2);
|
||||
}
|
||||
return "0.00";
|
||||
});
|
||||
watch(
|
||||
() => props.user.id,
|
||||
(newval) => {
|
||||
@@ -327,10 +366,10 @@ watch(
|
||||
);
|
||||
|
||||
//002-获取订单可用积分及抵扣金额(支付页面使用)
|
||||
const pointsRes = ref({ usable: false, maxUsablePoints: 0, minDeductionPoints: 0 });
|
||||
const pointsRes = ref({ usable: true, maxUsablePoints: 0, minDeductionPoints: 0 });
|
||||
const usePointsNumber = ref(0);
|
||||
const orderAmountOrderAmount = computed(() => {
|
||||
return (carts.payMoney - checkOrderPay.discountAmount).toFixed(2);
|
||||
return (carts.goodsTotal - checkOrderPay.discountAmount).toFixed(2);
|
||||
});
|
||||
const pointsDiscountAmount = ref(0);
|
||||
watch(
|
||||
@@ -352,6 +391,8 @@ async function pointsInit() {
|
||||
usePointsNumber.value = res.usable ? res.maxUsablePoints : 0;
|
||||
if (res.usable) {
|
||||
pointsToMoney();
|
||||
} else {
|
||||
score.sel = -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -378,7 +419,7 @@ const coupDiscount = computed(() => {
|
||||
});
|
||||
const score = reactive({
|
||||
list: [],
|
||||
sel: 0,
|
||||
sel: -1,
|
||||
});
|
||||
|
||||
const payTypes = reactive({
|
||||
@@ -426,16 +467,18 @@ function returnPayParams() {
|
||||
vipPrice: props.user.id && props.user.isVip ? 1 : 0,
|
||||
orderId: props.orderInfo.id,
|
||||
// discountRatio: (checkOrderPay.discount / 100).toFixed(2),
|
||||
discountRatio: checkOrderPay.discount ? checkOrderPay.discount : 0,
|
||||
seatNum: props.orderInfo.seatNum,
|
||||
originAmount: carts.payMoney * 1,
|
||||
discountAmount: !checkOrderPay.discount ? checkOrderPay.discountAmount * 1 : 0,
|
||||
productCouponDiscountAmount: 0,
|
||||
discountRatio: 0,
|
||||
seatNum: props.perpole * 1,
|
||||
originAmount: carts.payMoney * 1 - productCouponDiscountAmount.value + seatAmount.value * 1,
|
||||
discountAmount: discountAmount.value,
|
||||
productCouponDiscountAmount: productCouponDiscountAmount.value * 1,
|
||||
orderAmount: currentpayMoney.value * 1,
|
||||
roundAmount: props.orderInfo.roundAmount,
|
||||
pointsDiscountAmount: pointsDiscountAmount.value * 1,
|
||||
pointsNum: usePointsNumber.value * 1,
|
||||
fullCouponDiscountAmount: 0,
|
||||
fullCouponDiscountAmount: fullCouponDiscountAmount.value * 1,
|
||||
couponList: quansSelArr.value.map((v) => v.id),
|
||||
userId: props.user.userId || "",
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -451,6 +494,10 @@ function refScanPayOpen(payType) {
|
||||
if (payType == "scanCode") {
|
||||
return refScanPay.value.open(returnPayParams(), "scanCode");
|
||||
}
|
||||
if (payType == "arrears") {
|
||||
refGuaZhangShow();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
async function getPaytype() {
|
||||
@@ -478,6 +525,7 @@ function nowPayClick(payType) {
|
||||
payOrder(payType);
|
||||
return;
|
||||
}
|
||||
|
||||
refScanPayOpen(payType);
|
||||
}
|
||||
|
||||
@@ -490,7 +538,7 @@ function refScanPayConfirm($authCode, isScan) {
|
||||
|
||||
let payTimer = null;
|
||||
//是否是正扫
|
||||
async function payOrder(payType, isScan) {
|
||||
async function payOrder(payType, isScan, guazhangren) {
|
||||
clearTimeout(payTimer);
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
@@ -522,6 +570,9 @@ async function payOrder(payType, isScan) {
|
||||
shopUserId: props.user.id,
|
||||
});
|
||||
}
|
||||
if (payType == "arrears") {
|
||||
res = await payApi.creditPay({ ...returnPayParams(), creditBuyerId: guazhangren.id });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
clearTimeout(payTimer);
|
||||
@@ -535,6 +586,14 @@ async function payOrder(payType, isScan) {
|
||||
loading.close();
|
||||
}
|
||||
}
|
||||
//整单改价
|
||||
const discountAmount = computed(() => {
|
||||
const money = carts.goodsTotal - productCouponDiscountAmount.value;
|
||||
if (checkOrderPay.discount) {
|
||||
return ((money * (100 - checkOrderPay.discount)) / 100).toFixed(2);
|
||||
}
|
||||
return checkOrderPay.discountAmount;
|
||||
});
|
||||
//满减优惠券
|
||||
const fullCouponDiscountAmount = computed(() => {
|
||||
return quansSelArr.value
|
||||
@@ -551,19 +610,20 @@ const productCouponDiscountAmount = computed(() => {
|
||||
return pre + returnProDiscount(cur, index) * 1;
|
||||
}, 0);
|
||||
});
|
||||
//应付金额
|
||||
const currentpayMoney = computed(() => {
|
||||
if (checkOrderPay.discount) {
|
||||
return (carts.payMoney * (checkOrderPay.discount / 100)).toFixed(2);
|
||||
}
|
||||
//除开客座费,打包费总金额
|
||||
const totalMoney = computed(() => {
|
||||
return (
|
||||
carts.payMoney -
|
||||
carts.goodsTotal -
|
||||
productCouponDiscountAmount.value -
|
||||
discountAmount.value -
|
||||
fullCouponDiscountAmount.value -
|
||||
checkOrderPay.discountAmount -
|
||||
pointsDiscountAmount.value
|
||||
).toFixed(2);
|
||||
});
|
||||
//应付金额
|
||||
const currentpayMoney = computed(() => {
|
||||
return (totalMoney.value * 1 + carts.packFee * 1 + seatAmount.value * 1).toFixed(2);
|
||||
});
|
||||
watch(
|
||||
() => currentpayMoney.value,
|
||||
(newval) => {
|
||||
|
||||
Reference in New Issue
Block a user