分销问题修复,订单问题修复
This commit is contained in:
@@ -110,7 +110,7 @@ const shopUserInfo = inject("shopUserInfo");
|
||||
const shopInfo = inject("shopInfo");
|
||||
|
||||
function showLimitDiscount(item) {
|
||||
if (!props.limitDiscount || !props.li) {
|
||||
if (!props.limitDiscount || !props.limitDiscount.id) {
|
||||
return false;
|
||||
}
|
||||
return orderUtils.canUseLimitTimeDiscount(
|
||||
@@ -118,7 +118,7 @@ function showLimitDiscount(item) {
|
||||
props.limitDiscount,
|
||||
shopInfo.value,
|
||||
shopUserInfo.value,
|
||||
"id"
|
||||
"productId"
|
||||
);
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
@@ -891,7 +891,7 @@ async function getDiscountActivity() {
|
||||
}
|
||||
onMounted(async () => {
|
||||
await getConsumeDiscount();
|
||||
getDiscountActivity();
|
||||
// getDiscountActivity();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -442,6 +442,9 @@ const orderorderInfo = async () => {
|
||||
if (!listinfo.id && !options.tableCode) {
|
||||
return;
|
||||
}
|
||||
if (isPayBefor() && !listinfo.id) {
|
||||
return;
|
||||
}
|
||||
let res = listinfo.id
|
||||
? await APIgetOrderById({
|
||||
orderId: listinfo.id,
|
||||
@@ -640,15 +643,16 @@ const createOrder = async () => {
|
||||
orderId: listinfo.id || "",
|
||||
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,
|
||||
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) {
|
||||
@@ -709,7 +713,7 @@ function returnPayParams() {
|
||||
vipPrice: cartStore.useVipPrice ? 1 : 0, //是否使用会员价0否1是
|
||||
userAllPack: is_type.value == 0 ? 0 : 1, //是否整单打包
|
||||
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(不包含打包费+餐位费)
|
||||
discountRatio: 1, //折扣比例(计算时 向上取整保留 两位小数) 写死1
|
||||
discountAmount: 0, //手动优惠金额 写死0
|
||||
productCouponDiscountAmount:
|
||||
@@ -729,18 +733,21 @@ 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,
|
||||
}
|
||||
discountActId: cartStore.orderCostSummary.fullReduction.usedActivity
|
||||
? cartStore.orderCostSummary.fullReduction.usedActivity.id
|
||||
: null,
|
||||
vipDiscountAmount: cartStore.orderCostSummary.vipDiscountAmount, //会员折扣减免金额
|
||||
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,
|
||||
@@ -899,6 +906,7 @@ const goToPay = async (payParams) => {
|
||||
amount: cartStore.orderCostSummary.finalPayAmount, // 最终订单金额
|
||||
orderAmount: cartStore.orderCostSummary.orderOriginFinalPayAmount, // 最终订单原金额
|
||||
originAmount: cartStore.orderCostSummary.goodsRealAmount, //订单原金额(不包含打包费+餐位费)
|
||||
|
||||
returnUrl: "", //跳转地址
|
||||
buyerRemark: "",
|
||||
seatNum: is_type.value == 0 ? cartStore.seatFeeConfig.personCount : 0, //用餐人数
|
||||
@@ -1090,8 +1098,8 @@ async function init(opt) {
|
||||
cartStore.setSeatFeeConfig("personCount", res.seatNum);
|
||||
cartStore.setDinnerType(res.dineMode || "dine-in");
|
||||
cartStore.setOldOrder(res);
|
||||
if(res.limitRate){
|
||||
cartStore.limitTimeDiscount=res.limitRate
|
||||
if (res.limitRate) {
|
||||
cartStore.limitTimeDiscount = res.limitRate;
|
||||
}
|
||||
orderRemarker.value = res.remark;
|
||||
Object.assign(listinfo, res);
|
||||
@@ -1110,6 +1118,8 @@ async function init(opt) {
|
||||
|
||||
orderVIP.value = uni.cache.get("orderVIP");
|
||||
cartStore.freeDineConfig = orderVIP.value.freeDineConfig;
|
||||
const shopUserInfo = uni.cache.get("shopUserInfo");
|
||||
cartStore.shopUserInfo = shopUserInfo;
|
||||
if (options.tableCode) {
|
||||
socketInitPar.table_code = options.tableCode;
|
||||
socketInit();
|
||||
@@ -1124,6 +1134,16 @@ onLoad((opt) => {
|
||||
watch(
|
||||
() => cartStore.orderCostSummary.orderOriginFinalPayAmount,
|
||||
(newval) => {
|
||||
console.log(
|
||||
"cartStore.orderCostSummary.orderOriginFinalPayAmount",
|
||||
orderVIP.value
|
||||
);
|
||||
if (JSON.stringify(orderVIP.value) == "{}") {
|
||||
return;
|
||||
}
|
||||
if (!orderVIP.value) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!orderVIP.value.freeDineConfig ||
|
||||
!orderVIP.value.freeDineConfig.enable
|
||||
@@ -1178,14 +1198,18 @@ const disablePayType = computed(() => {
|
||||
if (rechargeItem.value.id) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
if (!orderVIP.value.amount) {
|
||||
if (!orderVIP.value || !orderVIP.value.amount) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
if (
|
||||
orderVIP.value.amount < cartStore.orderCostSummary.orderOriginFinalPayAmount
|
||||
) {
|
||||
arr.add("余额支付");
|
||||
if (orderVIP.value) {
|
||||
if (
|
||||
orderVIP.value.amount <
|
||||
cartStore.orderCostSummary.orderOriginFinalPayAmount
|
||||
) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
}
|
||||
|
||||
// if (cartStore.orderCostSummary.orderOriginFinalPayAmount <= 0) {
|
||||
// arr.add("微信支付");
|
||||
// }
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
|
||||
const orderinfo = (e) => {
|
||||
if(e.status=='unpaid'){
|
||||
uni.cache.set('shopId',e.shopId)
|
||||
uni.pro.navigateTo('order/confirm-order', {
|
||||
orderId: e.id,
|
||||
shopId: e.shopId,
|
||||
|
||||
@@ -155,9 +155,7 @@
|
||||
>/{{ item.unitName }}</text
|
||||
>
|
||||
|
||||
<text class="old-price"
|
||||
>¥{{ item.salePrice }}</text
|
||||
>
|
||||
<text class="old-price">¥{{ item.salePrice }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="panelfiveitemNum">
|
||||
@@ -201,6 +199,7 @@
|
||||
:limitDiscount="limitTimeDiscountRes"
|
||||
:cart="item"
|
||||
:shopUserInfo="shopUserInfo"
|
||||
:key="item.id"
|
||||
:shopInfo="shopInfo"
|
||||
></GoodsPrice>
|
||||
</view>
|
||||
@@ -208,9 +207,7 @@
|
||||
<text class="unit" v-if="item.unitName"
|
||||
>/{{ item.unitName }}</text
|
||||
>
|
||||
<text class="old-price"
|
||||
>¥{{ item.salePrice }}</text
|
||||
>
|
||||
<text class="old-price">¥{{ item.salePrice }}</text>
|
||||
<!-- <text v-if="item.suitNum>1 && item.type!= 'sku'"
|
||||
style="font-size: 16rpx;">「{{item.suitNum}}{{item.unitName}}起点」</text> -->
|
||||
</view>
|
||||
@@ -444,9 +441,7 @@
|
||||
<text class="money_num" v-if="item1.unitName"
|
||||
>/{{ item1.unitName }}</text
|
||||
>
|
||||
<text class="old-price"
|
||||
>¥{{ item1.salePrice }}</text
|
||||
>
|
||||
<text class="old-price">¥{{ item1.salePrice }}</text>
|
||||
|
||||
<!-- <text v-if="item1.suitNum>1 && item1.type!= 'sku'"
|
||||
style="font-size: 14rpx;">
|
||||
@@ -701,7 +696,17 @@
|
||||
"
|
||||
>
|
||||
<text class="i">¥</text>
|
||||
<text class="num">
|
||||
<view class="num">
|
||||
<GoodsPrice
|
||||
:limitDiscount="limitTimeDiscountRes"
|
||||
:cart="specifications.item.result"
|
||||
:shopUserInfo="shopUserInfo"
|
||||
:shopInfo="shopInfo"
|
||||
></GoodsPrice>
|
||||
</view>
|
||||
|
||||
<text class="num" v-if="false">
|
||||
|
||||
{{
|
||||
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
||||
? specifications.item.result.memberPrice ||
|
||||
@@ -719,7 +724,15 @@
|
||||
</view>
|
||||
<view class="price" v-else>
|
||||
<text class="i">¥</text>
|
||||
<text class="num">
|
||||
<view class="num">
|
||||
<GoodsPrice
|
||||
:limitDiscount="limitTimeDiscountRes"
|
||||
:cart="specifications.item"
|
||||
:shopUserInfo="shopUserInfo"
|
||||
:shopInfo="shopInfo"
|
||||
></GoodsPrice>
|
||||
</view>
|
||||
<text class="num" v-if="false">
|
||||
{{
|
||||
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
|
||||
? specifications.item.memberPrice ||
|
||||
@@ -871,7 +884,7 @@ function onBuyClick(item) {
|
||||
) {
|
||||
for (let i in shopProductList.hots) {
|
||||
const goods = shopProductList.hots[i];
|
||||
if (goods.id==item.id) {
|
||||
if (goods.id == item.id) {
|
||||
index = i;
|
||||
clickspecifications(item, index, index);
|
||||
break;
|
||||
@@ -1424,6 +1437,7 @@ const submitSelection = async () => {
|
||||
: shopCartNumber.value,
|
||||
pro_group_info: selectedGroupSnap.value,
|
||||
goods_type: specifications.item.type == "package" ? "package" : "",
|
||||
memberPrice: specifications.item.memberPrice,
|
||||
is_print: 1,
|
||||
product_type: specifications.item.type,
|
||||
});
|
||||
@@ -1569,6 +1583,7 @@ const singleclick = async (item, i) => {
|
||||
: "add",
|
||||
product_id: item.id,
|
||||
sku_id: item.skuId,
|
||||
memberPrice: item.memberPrice,
|
||||
number: await calculateValue(item.cartNumber, i, suitNum),
|
||||
is_print: 1,
|
||||
product_type: item.type,
|
||||
@@ -1647,21 +1662,25 @@ const updateProductQuantities = () => {
|
||||
|
||||
//websocket产值
|
||||
const websocketsendMessage = (data) => {
|
||||
console.log("websocketsendMessage", data);
|
||||
const sendData = { ...data, is_time_discount: 0 };
|
||||
if (cartStore.limitTimeDiscount && cartStore.limitTimeDiscount.id && data.discount_sale_amount*1<=0) {
|
||||
if (
|
||||
orderUtils.canUseLimitTimeDiscount(
|
||||
data,
|
||||
cartStore.limitTimeDiscount,
|
||||
shopInfo,
|
||||
shopUserInfo.value,
|
||||
"product_id"
|
||||
)
|
||||
) {
|
||||
if (cartStore.limitTimeDiscount && cartStore.limitTimeDiscount.id) {
|
||||
const canUse = orderUtils.canUseLimitTimeDiscount(
|
||||
data,
|
||||
cartStore.limitTimeDiscount,
|
||||
shopInfo,
|
||||
shopUserInfo.value,
|
||||
"product_id"
|
||||
);
|
||||
console.log("canUse", canUse);
|
||||
if (canUse) {
|
||||
sendData.is_time_discount = 1;
|
||||
}
|
||||
}
|
||||
uni.$u.debounce(useSocket.sendMessage(sendData), 500);
|
||||
delete sendData.memberPrice;
|
||||
uni.$u.debounce(() => {
|
||||
useSocket.sendMessage(sendData);
|
||||
}, 500);
|
||||
};
|
||||
|
||||
// 用于记录已经处理过的消息的 msg_id
|
||||
@@ -1792,8 +1811,8 @@ async function onMessage(Message) {
|
||||
});
|
||||
}
|
||||
if (Message.operate_type == "time_discount_save") {
|
||||
console.log("time_discount_save", Message.data);
|
||||
cartStore.limitTimeDiscount = Message.data;
|
||||
console.log("time_discount_save", cartStore.limitTimeDiscount);
|
||||
}
|
||||
|
||||
//除去p 每次返回都回执消息
|
||||
@@ -1955,11 +1974,10 @@ const totalPrices = computed(() => {
|
||||
shopUserInfo: shopUserInfo.value,
|
||||
idKey: "id",
|
||||
});
|
||||
console.log("限时折扣", item, price);
|
||||
return total + parseFloat(price) * parseFloat(item.cartNumber);
|
||||
}
|
||||
// 是否启用会员价 0否1是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
if (shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return (
|
||||
total +
|
||||
@@ -2174,12 +2192,12 @@ onLoad(async (e) => {
|
||||
const limitTimeDiscountRes = ref(null);
|
||||
|
||||
function showLimitDiscount(item) {
|
||||
if (!limitTimeDiscountRes.value) {
|
||||
if (!cartStore.limitTimeDiscount || !cartStore.limitTimeDiscount.id) {
|
||||
return false;
|
||||
}
|
||||
return orderUtils.canUseLimitTimeDiscount(
|
||||
item,
|
||||
limitTimeDiscountRes.value,
|
||||
cartStore.limitTimeDiscount,
|
||||
shopInfo,
|
||||
shopUserInfo.value,
|
||||
"id"
|
||||
@@ -2187,25 +2205,6 @@ function showLimitDiscount(item) {
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
limitTimeDiscountapi
|
||||
.getConfig({
|
||||
shopId: uni.cache.get("shopId"),
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("limitTimeDiscountapi", res);
|
||||
if (res && typeof res == "object") {
|
||||
limitTimeDiscountRes.value = res;
|
||||
cartStore.limitTimeDiscount = res;
|
||||
websocketsendMessage({
|
||||
type: "shopping",
|
||||
operate_type: "time_discount_save",
|
||||
table_code: uni.cache.get("tableCode"),
|
||||
shop_id: uni.cache.get("shopId"),
|
||||
operate_type: "time_discount_save",
|
||||
data: res,
|
||||
});
|
||||
}
|
||||
});
|
||||
// 监听页面显示和隐藏
|
||||
useSocket.setOnMessage(onMessage);
|
||||
useSocket.onShowconnect();
|
||||
@@ -2238,6 +2237,29 @@ onMounted(async () => {
|
||||
let res = await APIhistoryOrder({
|
||||
tableCode: uni.cache.get("tableCode"),
|
||||
});
|
||||
const limitRes = await limitTimeDiscountapi.getConfig({
|
||||
shopId: uni.cache.get("shopId"),
|
||||
});
|
||||
if (limitRes && typeof limitRes == "object") {
|
||||
limitTimeDiscountRes.value = limitRes;
|
||||
websocketsendMessage({
|
||||
type: "shopping",
|
||||
operate_type: "time_discount_save",
|
||||
table_code: uni.cache.get("tableCode"),
|
||||
shop_id: uni.cache.get("shopId"),
|
||||
operate_type: "time_discount_save",
|
||||
data: limitRes,
|
||||
});
|
||||
} else {
|
||||
websocketsendMessage({
|
||||
type: "shopping",
|
||||
operate_type: "time_discount_save",
|
||||
table_code: uni.cache.get("tableCode"),
|
||||
shop_id: uni.cache.get("shopId"),
|
||||
operate_type: "time_discount_save",
|
||||
data: null,
|
||||
});
|
||||
}
|
||||
|
||||
await productqueryProduct();
|
||||
if (res && res.id && shopInfo.registerType == "after") {
|
||||
|
||||
@@ -243,11 +243,14 @@
|
||||
|
||||
<!-- 生成公众号二维码 -->
|
||||
<we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode>
|
||||
|
||||
<devetools></devetools>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import weQrcode from "@/components/wechat-ac-qrcode.vue";
|
||||
import devetools from "@/components/devetools.vue";
|
||||
|
||||
import { ref, computed, onMounted, reactive, watch } from "vue";
|
||||
import { onLoad, onReady, onShow } from "@dcloudio/uni-app";
|
||||
@@ -276,7 +279,7 @@ const myFunList = ref([
|
||||
{
|
||||
name: "分销",
|
||||
type: "fenxiao",
|
||||
icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/my_coupon.png",
|
||||
icon: "/static/icon/fenxiao.svg",
|
||||
},
|
||||
// {
|
||||
// name: "我的订单",
|
||||
|
||||
Reference in New Issue
Block a user