分销问题修复,订单问题修复

This commit is contained in:
2025-10-30 17:11:18 +08:00
parent 6283d168e9
commit 09fc28de06
29 changed files with 2652 additions and 533 deletions

View File

@@ -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") {