订单结算修改,增加限时折扣
This commit is contained in:
@@ -223,7 +223,7 @@
|
||||
@close="ispws = false"
|
||||
/>
|
||||
<!-- 私域引流配置 -->
|
||||
<OrderFinshModal v-model="showDrainage" ></OrderFinshModal>
|
||||
<OrderFinshModal v-model="showDrainage"></OrderFinshModal>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
@@ -243,8 +243,10 @@ import {
|
||||
watch,
|
||||
onBeforeMount,
|
||||
onBeforeUnmount,
|
||||
provide,
|
||||
} from "vue";
|
||||
|
||||
provide("shopUserInfo", ref(uni.cache.get("shopUserInfo")));
|
||||
provide("shopInfo", ref(uni.cache.get("shopInfo")));
|
||||
import { getTableInfo } from "@/common/api/shop/index.js";
|
||||
import {
|
||||
APIgetOrderById,
|
||||
@@ -278,8 +280,8 @@ const cartStore = useCartsStore();
|
||||
|
||||
//充值相关start
|
||||
//充值和余额支付是否可用
|
||||
const isCanUseCharge = ref(false);
|
||||
function updateIsShow(e){
|
||||
const isCanUseCharge = ref(true);
|
||||
function updateIsShow(e) {
|
||||
isCanUseCharge.value = e;
|
||||
}
|
||||
const rechargeItem = ref({
|
||||
@@ -437,20 +439,22 @@ let historyTotalPrices = 0;
|
||||
// * 获取订单详情接口
|
||||
const orderorderInfo = async () => {
|
||||
console.log("listinfo.id", listinfo.id);
|
||||
if (!listinfo.id && !options.tableCode) {
|
||||
return;
|
||||
}
|
||||
let res = listinfo.id
|
||||
? await APIgetOrderById({
|
||||
orderId: listinfo.id,
|
||||
})
|
||||
: await APIhistoryOrder({
|
||||
tableCode: options.tableCode||"",
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
orderRemarker.value = res.remark;
|
||||
Object.assign(listinfo, res);
|
||||
if (res && res.tableCode) {
|
||||
socketInitPar.table_code = res.tableCode;
|
||||
let tableRes = await getTableInfo({
|
||||
tableCode: options.tableCode||"",
|
||||
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
console.log(tableRes);
|
||||
listinfo.tableName = tableRes.name;
|
||||
@@ -458,7 +462,7 @@ const orderorderInfo = async () => {
|
||||
if (options.tableCode) {
|
||||
socketInitPar.table_code = options.tableCode;
|
||||
let tableRes = await getTableInfo({
|
||||
tableCode: options.tableCode||"",
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
console.log(tableRes);
|
||||
listinfo.tableName = tableRes.name;
|
||||
@@ -634,8 +638,17 @@ const createOrder = async () => {
|
||||
placeNum: listinfo.id ? listinfo.placeNum * 1 + 1 : 1, //当前订单下单次数
|
||||
waitCall: "", //是否等叫 0 否 1 等叫
|
||||
orderId: listinfo.id || "",
|
||||
tableCode: options.tableCode||'',
|
||||
tableCode: options.tableCode || "",
|
||||
userId: uni.cache.get("userInfo").id || "", //
|
||||
limitRate: (cartStore.limitTimeDiscount&&cartStore.limitTimeDiscount.id)
|
||||
? {
|
||||
id: cartStore.limitTimeDiscount.id,
|
||||
discountRate: cartStore.limitTimeDiscount.discountRate,
|
||||
discountPriority: cartStore.limitTimeDiscount.discountPriority,
|
||||
foodType: cartStore.limitTimeDiscount.foodType,
|
||||
foods: cartStore.limitTimeDiscount.foods,
|
||||
}
|
||||
: null,
|
||||
});
|
||||
// 清空购物车
|
||||
if (res) {
|
||||
@@ -716,7 +729,18 @@ function returnPayParams() {
|
||||
: "",
|
||||
remark: orderRemarker.value, //用户备注
|
||||
discountActAmount: cartStore.orderCostSummary.fullReduction.actualAmount, //满减抵扣金额
|
||||
discountActId:cartStore.orderCostSummary.fullReduction.usedActivity?cartStore.orderCostSummary.fullReduction.usedActivity.id:null,
|
||||
userId: uni.cache.get("userInfo").id || "", //
|
||||
limitRate: (cartStore.limitTimeDiscount&&cartStore.limitTimeDiscount.id)
|
||||
? {
|
||||
id: cartStore.limitTimeDiscount.id,
|
||||
discountRate: cartStore.limitTimeDiscount.discountRate,
|
||||
discountPriority: cartStore.limitTimeDiscount.discountPriority,
|
||||
foodType: cartStore.limitTimeDiscount.foodType,
|
||||
foods: cartStore.limitTimeDiscount.foods,
|
||||
}
|
||||
: null,
|
||||
vipDiscountAmount: cartStore.orderCostSummary.vipDiscountAmount, //会员折扣减免金额
|
||||
};
|
||||
return {
|
||||
isBwc: isBwc.value,
|
||||
@@ -919,7 +943,6 @@ const goToPay = async (payParams) => {
|
||||
orderorderInfo();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
const clickPointsamount = (Pointsamount) => {
|
||||
listinfo.pointsDiscountAmount = Pointsamount.pointsDiscountAmount;
|
||||
@@ -1063,9 +1086,13 @@ async function init(opt) {
|
||||
if (res) {
|
||||
uni.cache.set("tableCode", res.tableCode);
|
||||
uni.cache.set("tableCode", res.seatNum);
|
||||
options.tableCode = res.tableCode||'';
|
||||
options.tableCode = res.tableCode || "";
|
||||
cartStore.setSeatFeeConfig("personCount", res.seatNum);
|
||||
cartStore.setDinnerType(res.dineMode || "dine-in");
|
||||
cartStore.setOldOrder(res);
|
||||
if(res.limitRate){
|
||||
cartStore.limitTimeDiscount=res.limitRate
|
||||
}
|
||||
orderRemarker.value = res.remark;
|
||||
Object.assign(listinfo, res);
|
||||
}
|
||||
@@ -1162,7 +1189,7 @@ const disablePayType = computed(() => {
|
||||
// if (cartStore.orderCostSummary.orderOriginFinalPayAmount <= 0) {
|
||||
// arr.add("微信支付");
|
||||
// }
|
||||
if(!isCanUseCharge.value){
|
||||
if (!isCanUseCharge.value) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user