部分显示问题调整,问题修复,增加购物车初始化和商品更新未找到对应商品发送删除消息
This commit is contained in:
@@ -347,6 +347,9 @@
|
||||
console.log(opt)
|
||||
Object.assign(query, opt)
|
||||
console.log(query)
|
||||
if(query.shopId){
|
||||
uni.cache.set('shopId', query.shopId)
|
||||
}
|
||||
await storelogin.actionslogin()
|
||||
getDetail()
|
||||
}
|
||||
|
||||
@@ -977,9 +977,6 @@ function calcVipDiscountAmount(
|
||||
shopUserInfo : ShopUserInfo
|
||||
) : number {
|
||||
if (!shopUserInfo.isVip || shopUserInfo.discount === 0) return 0;
|
||||
if (shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice != 1) {
|
||||
return 0;
|
||||
}
|
||||
return truncateToTwoDecimals(
|
||||
new BigNumber(goodsRealAmount)
|
||||
.times((100 - (shopUserInfo.discount || 100)) / 100)
|
||||
|
||||
@@ -41,33 +41,10 @@
|
||||
:limitDiscount="cartStore.limitTimeDiscount"
|
||||
></orderItemVue> -->
|
||||
<orderItemVue :useVipPrice="useVipPrice" v-if="cartStore.allGoods.length" :nowCarts="cartStore.allGoods"
|
||||
:shopInfo="cartStore.shopInfo"
|
||||
:shopUserInfo="cartStore.shopUserInfo"
|
||||
:shopInfo="cartStore.shopInfo" :shopUserInfo="cartStore.shopUserInfo"
|
||||
:limitDiscount="cartStore.limitTimeDiscount"></orderItemVue>
|
||||
|
||||
|
||||
|
||||
<view class="total-wrap u-m-t-30" v-if="listinfo.status == 'unpaid' || !listinfo.id">
|
||||
<text>总计</text>
|
||||
<text class="u-font-32">¥</text>
|
||||
<text class="price">
|
||||
{{ cartStore.orderCostSummary.goodsRealAmount }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="total-wrap u-m-t-30" v-else>
|
||||
<text>总计</text>
|
||||
<text class="u-font-32">¥</text>
|
||||
<text class="price">
|
||||
{{ cartStore.orderCostSummary.goodsRealAmount }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <view class="total-wrap" v-else>
|
||||
<view>实付¥</view>
|
||||
<view class="price"> {{listinfo.payAmount||''}} </view>
|
||||
</view> -->
|
||||
|
||||
<template v-if="listinfo.id&&listinfo.status=='done'">
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
<view class="val">
|
||||
@@ -77,7 +54,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item" v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
@@ -86,6 +62,50 @@
|
||||
<view>{{ cartStore.orderCostSummary.seatFee }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="total-wrap u-m-t-30" v-if="listinfo.status == 'unpaid' || !listinfo.id">
|
||||
<text>总计</text>
|
||||
<text class="u-font-32">¥</text>
|
||||
<text class="price">
|
||||
{{ cartStore.orderCostSummary.goodsRealAmount }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="total-wrap u-m-t-30" v-else-if="listinfo.status != 'unpaid'">
|
||||
<text>实付</text>
|
||||
<text class="u-font-32">¥</text>
|
||||
<text class="price">
|
||||
{{ listinfo.payAmount }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- <view class="total-wrap" v-else>
|
||||
<view>实付¥</view>
|
||||
<view class="price"> {{listinfo.payAmount||''}} </view>
|
||||
</view> -->
|
||||
|
||||
<template v-if="!listinfo.id||listinfo.status=='unpaid'">
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx">¥</view>
|
||||
<view>{{ cartStore.orderCostSummary.packFee }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cell-item" v-if="cartStore.orderCostSummary.seatFee">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{ cartStore.seatFeeConfig.personCount }}</view>
|
||||
<view style="font-size: 28rpx">¥</view>
|
||||
<view>{{ cartStore.orderCostSummary.seatFee }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<!-- <view class="cell-item" v-else>
|
||||
<view class="label">免餐位费</view>
|
||||
|
||||
@@ -104,27 +104,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.packFeess}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item"
|
||||
v-if="ordershopUserInfo.isTableFee == 0 && is_type == 0 && listinfo.Seatcharge != 0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.Seatcharge}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.Seatcharge}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="cell-item" v-else>
|
||||
<view class="label">免餐位费</view>
|
||||
<view class="val">
|
||||
@@ -185,6 +166,26 @@
|
||||
</view>
|
||||
</view>
|
||||
</block> -->
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.packFeess}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item"
|
||||
v-if="ordershopUserInfo.isTableFee == 0 && is_type == 0 && listinfo.Seatcharge != 0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.Seatcharge}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.Seatcharge}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="total-wrap" v-if="listinfo.status == 'unpaid'">
|
||||
<text>总计</text>
|
||||
@@ -198,6 +199,8 @@
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -1133,14 +1136,18 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.disocunt {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;overflow: hidden;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
overflow: hidden;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.row {
|
||||
padding: 16rpx 24rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.t {
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
@@ -1154,10 +1161,12 @@
|
||||
color: #666666;
|
||||
}
|
||||
}
|
||||
|
||||
.price {
|
||||
color: #FF1C1C;
|
||||
}
|
||||
}
|
||||
|
||||
.orderInfo {
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
@@ -1236,6 +1245,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@@ -88,7 +88,7 @@
|
||||
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||
|
||||
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status == 'done'"> 再来一单 </view>
|
||||
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status != 'unpaid'"> 再来一单 </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -58,7 +58,8 @@
|
||||
限时折扣{{ limitDiscountCountdown }}</view>
|
||||
<!-- <view class="limitDiscount" v-if="item.is_time_discount">
|
||||
限时折扣{{ limitDiscountCountdown }}</view> -->
|
||||
<view class="stock_warning" v-if="item.isStock&&item.stockNumber<=10">
|
||||
<view class="stock_warning"
|
||||
v-if="item.isStock&&item.stockNumber<=10&&item.stockNumber>0">
|
||||
仅剩{{item.stockNumber}}份</view>
|
||||
</view>
|
||||
|
||||
@@ -208,7 +209,8 @@
|
||||
|
||||
<!-- <view class="limitDiscount" v-if="item1.is_time_discount">
|
||||
限时折扣{{ limitDiscountCountdown }}</view> -->
|
||||
<view class="stock_warning" v-if="item1.isStock&&item1.stockNumber<=10">
|
||||
<view class="stock_warning"
|
||||
v-if="item1.isStock&&item1.stockNumber<=10&&item.stockNumber>0">
|
||||
仅剩{{item1.stockNumber}}份</view>
|
||||
</view>
|
||||
|
||||
@@ -575,46 +577,62 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import xbSwiperPreview from '@/components/xb-swiper-preview/index.vue';
|
||||
//价格计算辅助函数
|
||||
/**
|
||||
* api合集 start
|
||||
*/
|
||||
import * as discountActivityApi from '@/common/api/market/discountActivity';
|
||||
import {
|
||||
consumeDiscount
|
||||
} from '@/common/api/market/index.js';
|
||||
import * as limitTimeDiscountapi from '@/common/api/market/limitTimeDiscount.js';
|
||||
import {
|
||||
APIshopUserInfo,
|
||||
APIusershopInfodetail
|
||||
} from "@/common/api/member.js";
|
||||
|
||||
import {
|
||||
productminiApphotsquery,
|
||||
APIgroupquery,
|
||||
APIminiAppinfo,
|
||||
APIminiAppskuinfo
|
||||
} from '@/common/api/product/product.js';
|
||||
|
||||
import {
|
||||
APIhistoryOrder,
|
||||
APIcancelOrder,
|
||||
APIrmPlaceOrder
|
||||
} from '@/common/api/order/index.js';
|
||||
import {
|
||||
APIproductqueryShop
|
||||
} from '@/common/api/member.js';
|
||||
/**
|
||||
* api合集 end
|
||||
*/
|
||||
|
||||
/**
|
||||
* 三方库 start
|
||||
*/
|
||||
import BigNumber from 'bignumber.js';
|
||||
//价格计算辅助函数
|
||||
import {
|
||||
limitUtils
|
||||
} from 'ysk-utils';
|
||||
|
||||
// 满减活动api
|
||||
import * as discountActivityApi from '@/common/api/market/discountActivity';
|
||||
import dayjs from 'dayjs';
|
||||
import isBetween from 'dayjs/plugin/isBetween';
|
||||
dayjs.extend(isBetween);
|
||||
/**
|
||||
* 三方库 end
|
||||
*/
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import {
|
||||
consumeDiscount
|
||||
} from '@/common/api/market/index.js';
|
||||
/**
|
||||
* 组件 start
|
||||
*/
|
||||
|
||||
import xbSwiperPreview from '@/components/xb-swiper-preview/index.vue';
|
||||
import GoodsPrice from '@/components/goods-price.vue';
|
||||
|
||||
import * as limitTimeDiscountapi from '@/common/api/market/limitTimeDiscount.js';
|
||||
import ModalList from '@/components/modal-list.vue';
|
||||
import recommendGoodsModal from './components/recommend-goods-modal.vue';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
watchEffect,
|
||||
getCurrentInstance,
|
||||
computed,
|
||||
provide,
|
||||
watch
|
||||
} from 'vue';
|
||||
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onHide,
|
||||
onUnload,
|
||||
onPageScroll
|
||||
} from '@dcloudio/uni-app';
|
||||
|
||||
//导航栏
|
||||
import Nav from '@/components/CustomNavbar.vue';
|
||||
import shopindex from './components/shopindex.vue';
|
||||
@@ -622,21 +640,18 @@
|
||||
import shoppingCartes from './components/shoppingCartes.vue';
|
||||
import confirmorder from './components/confirmorder.vue';
|
||||
import Loading from '@/components/Loading.vue';
|
||||
import dayjs from 'dayjs';
|
||||
import isBetween from 'dayjs/plugin/isBetween';
|
||||
/**
|
||||
* 组件 end
|
||||
*/
|
||||
|
||||
import {
|
||||
APIshopUserInfo,
|
||||
APIusershopInfodetail
|
||||
} from "@/common/api/member.js";
|
||||
dayjs.extend(isBetween);
|
||||
|
||||
/**
|
||||
* 项目代码辅助方法 start
|
||||
*/
|
||||
import {
|
||||
filterNumberInput,
|
||||
isJsonArrayString
|
||||
} from '@/utils/util.js';
|
||||
import {
|
||||
APIproductqueryShop
|
||||
} from '@/common/api/member.js';
|
||||
import {
|
||||
getDistance
|
||||
} from '@/utils/address.js';
|
||||
@@ -644,6 +659,56 @@
|
||||
isObjectEqual,
|
||||
isArrayEqual
|
||||
} from './components/utils.js'
|
||||
/**
|
||||
* 项目代码辅助方法 end
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* store本地存储 start
|
||||
*/
|
||||
|
||||
import {
|
||||
useNavbarStore
|
||||
} from '@/stores/navbarStore';
|
||||
|
||||
|
||||
import {
|
||||
useWebSocket
|
||||
} from '@/stores/carts-websocket.js';
|
||||
// 结账管理
|
||||
import {
|
||||
Memberpay
|
||||
} from '@/stores/pay.js';
|
||||
import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
|
||||
const storeMemberpay = Memberpay();
|
||||
const store = useNavbarStore();
|
||||
// 动态更新导航栏配置
|
||||
store.updateNavbarConfig({
|
||||
showBack: true, //左边返回键
|
||||
rightText: '', //右边文字
|
||||
showSearch: false, //true是标题其他事文字
|
||||
title: '',
|
||||
isTransparent: false,
|
||||
hasPlaceholder: false //是否要占位符
|
||||
});
|
||||
const userStore = productStore();
|
||||
// 金额管理
|
||||
import {
|
||||
useCartStore
|
||||
} from '@/stores/order.js';
|
||||
const cartStore = useCartStore();
|
||||
/**
|
||||
* store本地存储 end
|
||||
*/
|
||||
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
|
||||
|
||||
//点单智能推荐
|
||||
@@ -681,81 +746,51 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
|
||||
//接口引入
|
||||
import {
|
||||
productminiApphotsquery,
|
||||
APIgroupquery,
|
||||
APIminiAppinfo,
|
||||
APIminiAppskuinfo
|
||||
} from '@/common/api/product/product.js';
|
||||
|
||||
import {
|
||||
APIhistoryOrder,
|
||||
APIcancelOrder,
|
||||
APIrmPlaceOrder
|
||||
} from '@/common/api/order/index.js';
|
||||
|
||||
// websocket
|
||||
// import useWebSocket from '@/common/js/websocket.js';
|
||||
import {
|
||||
useWebSocket
|
||||
} from '@/stores/carts-websocket.js';
|
||||
|
||||
// pinia管理
|
||||
import {
|
||||
useNavbarStore
|
||||
} from '@/stores/navbarStore';
|
||||
|
||||
// 结账管理
|
||||
import {
|
||||
Memberpay
|
||||
} from '@/stores/pay.js';
|
||||
|
||||
const storeMemberpay = Memberpay();
|
||||
const store = useNavbarStore();
|
||||
|
||||
import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
|
||||
const userStore = productStore();
|
||||
|
||||
// 金额管理
|
||||
import {
|
||||
useCartStore
|
||||
} from '@/stores/order.js';
|
||||
const cartStore = useCartStore();
|
||||
|
||||
// 动态更新导航栏配置
|
||||
store.updateNavbarConfig({
|
||||
showBack: true, //左边返回键
|
||||
rightText: '', //右边文字
|
||||
showSearch: false, //true是标题其他事文字
|
||||
title: '',
|
||||
isTransparent: false,
|
||||
hasPlaceholder: false //是否要占位符
|
||||
});
|
||||
/**
|
||||
* 通用数据合集 start
|
||||
*/
|
||||
// 门店信息
|
||||
const shopInfo = reactive({});
|
||||
Object.assign(shopInfo, uni.cache.get('shopInfo'));
|
||||
// 台桌信息
|
||||
const shopTable = uni.cache.get('shopTable');
|
||||
const distance = uni.cache.get('distance'); //距离
|
||||
//距离
|
||||
const distance = uni.cache.get('distance');
|
||||
|
||||
//店铺详情
|
||||
const showShopInfoRef = ref(null);
|
||||
// 计算高度
|
||||
const navScroll = ref(null);
|
||||
|
||||
// 初始加载中
|
||||
const isLoading = ref(true);
|
||||
|
||||
|
||||
|
||||
// 分步取值 + 每层兜底,避免某一环不存在导致 undefined
|
||||
const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
|
||||
const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
|
||||
// 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
|
||||
const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
|
||||
|
||||
/**
|
||||
* 通用数据合集 end
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 轮播功能 staart
|
||||
*/
|
||||
const swiperCurrent = ref(0);
|
||||
|
||||
function swiperChange(e) {
|
||||
swiperCurrent.value = e.current;
|
||||
}
|
||||
/**
|
||||
* 轮播功能 end
|
||||
*/
|
||||
|
||||
//店铺详情
|
||||
const showShopInfoRef = ref(null);
|
||||
|
||||
// 初始加载中
|
||||
const isLoading = ref(true);
|
||||
|
||||
//调用shop组件
|
||||
const callChildMethod = () => {
|
||||
@@ -764,21 +799,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
// const shopExtend = ref(uni.cache.get('shopTable').shopExtendMap.shopinfo_bg);
|
||||
// console.log('shopExtend', shopExtend);
|
||||
|
||||
// 分步取值 + 每层兜底,避免某一环不存在导致 undefined
|
||||
const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
|
||||
const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
|
||||
// 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
|
||||
const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
|
||||
|
||||
// try {
|
||||
// const shopExtend = uni.cache.get('shopTable').shopExtendMap.shopinfo_bg;
|
||||
// } catch (error) {}
|
||||
|
||||
// 计算高度
|
||||
const navScroll = ref(null);
|
||||
|
||||
|
||||
// 获取商品数据
|
||||
const shopProductList = reactive({
|
||||
@@ -1560,19 +1584,33 @@
|
||||
|
||||
function cartInit(arr) {
|
||||
const result = []
|
||||
console.log('cartInit arr',arr);
|
||||
cartStore.carts = arr.map(v => {
|
||||
const goods = matchedProducts.value.find(g => g.id == v.product_id)
|
||||
const goodsSkuList=goods.skuList||[]
|
||||
const goodsSkuList = goods?goods.skuList : []
|
||||
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
||||
const memberPrice = findSku ? findSku.memberPrice : 0
|
||||
const is_time_discount = limitUtils.canUseLimitTimeDiscount({...v,memberPrice}, cartStore.limitTimeDiscount, shopInfo,
|
||||
const is_time_discount = limitUtils.canUseLimitTimeDiscount({
|
||||
...v,
|
||||
memberPrice
|
||||
}, cartStore.limitTimeDiscount, shopInfo,
|
||||
shopUserInfo.value, 'product_id');
|
||||
if(!goods){
|
||||
useSocket.sendMessage({
|
||||
id: v.id,
|
||||
operate_type: "del",
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
type: "shopping",
|
||||
});
|
||||
return null
|
||||
}
|
||||
return {
|
||||
...v,
|
||||
is_time_discount: is_time_discount ? 1 : 0,
|
||||
memberPrice
|
||||
}
|
||||
})
|
||||
}).filter(v=>v)
|
||||
|
||||
for (let cart of arr) {
|
||||
const findItem = cartStore.carts.find(v => v.id == cart.id)
|
||||
@@ -1603,12 +1641,12 @@
|
||||
// 收到的消息变化
|
||||
async function onMessage(Message) {
|
||||
if (Message) {
|
||||
console.log('product index 收到消息', Message);
|
||||
// 心跳返回 过滤
|
||||
if (Message.type == 'ping_interval' || Message.msg_id == 'ping_interval') {
|
||||
isLoading.value = false;
|
||||
return false;
|
||||
}
|
||||
console.log('product index 收到消息', Message);
|
||||
// 检查消息是否已经处理过
|
||||
if (processedMessageIds.has(Message.msg_id)) {
|
||||
return;
|
||||
@@ -1617,7 +1655,7 @@
|
||||
|
||||
// 初始化
|
||||
if (Message.operate_type == 'init') {
|
||||
cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||
console.log('onMessage:限时折扣', cartStore.limitTimeDiscount)
|
||||
cartInit(Message.data)
|
||||
|
||||
@@ -1752,9 +1790,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (Message.operate_type == 'time_discount_save') {
|
||||
cartStore.limitTimeDiscount = Message.data;
|
||||
}
|
||||
|
||||
|
||||
//除去p 每次返回都回执消息
|
||||
await websocketsendMessage({
|
||||
@@ -1903,7 +1939,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log('limitTimeDiscountRes', item)
|
||||
if (cartStore.limitTimeDiscount && cartStore.limitTimeDiscount.id && item.cartListinfo
|
||||
.is_time_discount ==
|
||||
1) {
|
||||
@@ -2066,6 +2101,7 @@
|
||||
uni.pro.switchTab('index/index');
|
||||
}, 1000);
|
||||
}
|
||||
let allGoodsArr=[]
|
||||
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
||||
//TODO handle the exception
|
||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
||||
@@ -2075,15 +2111,23 @@
|
||||
product.isSaleTimeshow = await isProductAvailable(product.days, product
|
||||
.startTime, product.endTime);
|
||||
|
||||
allGoodsArr.push(product)
|
||||
|
||||
cartStore.setGoodsMap(product.id, product);
|
||||
});
|
||||
});
|
||||
shopProductList.hots.forEach(async (i) => {
|
||||
i.cartNumber = 0;
|
||||
i.isSaleTimeshow = await isProductAvailable(i.days, i.startTime, i.endTime);
|
||||
allGoodsArr.push(i)
|
||||
cartStore.setGoodsMap(i.id, i);
|
||||
});
|
||||
console.log('shopProductList', shopProductList);
|
||||
|
||||
if(cartStore.carts.length>0){
|
||||
cartInit(cartStore.carts)
|
||||
}
|
||||
|
||||
cartStore.goodsIsloading = true;
|
||||
scrollTopSize.value = 0;
|
||||
topArr.value = [];
|
||||
@@ -2285,7 +2329,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
const limitTimeDiscountRes = ref(null);
|
||||
onLoad(async (e) => {
|
||||
if (e.type) {
|
||||
orderType.value = e.type;
|
||||
@@ -2506,9 +2549,9 @@
|
||||
})
|
||||
const oldOrder = ref(null);
|
||||
|
||||
|
||||
// 限时折扣
|
||||
async function getLimitDiscount() {
|
||||
|
||||
const limitRes = await limitTimeDiscountapi.getConfig({
|
||||
shopId: uni.cache.get('shopId')
|
||||
});
|
||||
@@ -2517,15 +2560,6 @@
|
||||
} else {
|
||||
cartStore.limitTimeDiscount = null;
|
||||
}
|
||||
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: cartStore.limitTimeDiscount
|
||||
});
|
||||
console.log('onMounted:限时折扣', cartStore.limitTimeDiscount);
|
||||
return cartStore.limitTimeDiscount
|
||||
}
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
uni.hideLoading()
|
||||
if (openId) {
|
||||
pointGoodsApi.exchange({
|
||||
pointsGoodsId: item.id,
|
||||
paramId: item.id,
|
||||
shopId: item.shopId,
|
||||
number: 1,
|
||||
price: item.extraPrice,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
title="兑换成功"
|
||||
bgColor="transparent"
|
||||
leftIconColor="#333"
|
||||
@leftClick="back()"
|
||||
titleStyle="color:#333"
|
||||
></up-navbar>
|
||||
<view class="content">
|
||||
|
||||
@@ -246,14 +246,15 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
const goodsIsloading = ref(true);
|
||||
|
||||
//商品数据Map
|
||||
const goodsMap = reactive({});
|
||||
const goodsMap = ref({})
|
||||
|
||||
function returnGoods(product_id) {
|
||||
return goodsMap[product_id * 1];
|
||||
return goodsMap.value[product_id * 1];
|
||||
}
|
||||
|
||||
//获取商品数据
|
||||
async function goodsInit() {
|
||||
goodsMap.value={}
|
||||
goodsIsloading.value = true;
|
||||
//获取招牌菜商品
|
||||
const hotres = await productminiApphotsquery();
|
||||
@@ -272,13 +273,13 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
}
|
||||
|
||||
function setGoodsMap(product_id, data) {
|
||||
goodsMap[product_id] = data;
|
||||
goodsMap.value[product_id] = data;
|
||||
}
|
||||
|
||||
const isLoading = ref(true);
|
||||
|
||||
function getProductDetails(v) {
|
||||
const goods = goodsMap[v.product_id];
|
||||
const goods = goodsMap.value[v.product_id];
|
||||
if (!goods) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -327,17 +328,18 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
|
||||
const item = getProductDetails(v);
|
||||
if (!item) {
|
||||
socketSendMsg({
|
||||
id: v.id,
|
||||
operate_type: "del",
|
||||
type: "shopping",
|
||||
});
|
||||
return null
|
||||
}
|
||||
console.log('v',v);
|
||||
console.log('limitTimeDiscount',limitTimeDiscount.value);
|
||||
console.log('shopInfo',shopInfo.value);
|
||||
console.log('shopUserInfo',shopUserInfo.value);
|
||||
|
||||
const is_time_discount = yskUtils.limitUtils.canUseLimitTimeDiscount({...v,memberPrice:item.memberPrice}, limitTimeDiscount
|
||||
.value,
|
||||
shopInfo.value,
|
||||
shopUserInfo.value, 'product_id');
|
||||
console.log('is_time_discount',is_time_discount);
|
||||
return {
|
||||
...item,
|
||||
is_time_discount: is_time_discount ? 1 : 0
|
||||
@@ -391,7 +393,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
// 初始化
|
||||
if (Message.operate_type == "init") {
|
||||
if (!oldOrder.value.id) {
|
||||
limitTimeDiscount.value = Message.time_dis_info;
|
||||
// limitTimeDiscount.value = Message.time_dis_info;
|
||||
}
|
||||
cartsGoodsInfoInit(msgData);
|
||||
isLoading.value = false;
|
||||
@@ -428,7 +430,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
Message.operate_type == "product_update"
|
||||
) {
|
||||
await goodsInit();
|
||||
await cartsGoodsInfoInit();
|
||||
await cartsGoodsInfoInit(carts.value);
|
||||
}
|
||||
|
||||
// 提示
|
||||
@@ -440,12 +442,11 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
}
|
||||
//获取限时折扣
|
||||
if (Message.operate_type == "time_discount_get") {
|
||||
console.log("time_discount_get", Message.data);
|
||||
limitTimeDiscount.value = Message.data;
|
||||
}
|
||||
if (Message.operate_type == "time_discount_save") {
|
||||
limitTimeDiscount.value = Message.data;
|
||||
// limitTimeDiscount.value = Message.data;
|
||||
}
|
||||
// if (Message.operate_type == "time_discount_save") {
|
||||
// limitTimeDiscount.value = Message.data;
|
||||
// }
|
||||
|
||||
if (Message.type == "no_suit_num") {
|
||||
uni.showModal({
|
||||
@@ -703,7 +704,7 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
carts,
|
||||
isEmpty,
|
||||
setGoodsMap,
|
||||
goodsMap: goodsMap,
|
||||
goodsMap: goodsMap.value,
|
||||
goodsIsloading,
|
||||
goodsInit,
|
||||
onMessage,
|
||||
|
||||
@@ -366,7 +366,7 @@
|
||||
shopId: item.shopId,
|
||||
}).then(res=>{
|
||||
if(res){
|
||||
uni.navigateTo({
|
||||
uni.redirectTo({
|
||||
url:'/userPackage/order/detail?orderId='+res
|
||||
})
|
||||
}else{
|
||||
|
||||
@@ -91,9 +91,9 @@
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="item.status">
|
||||
<view class="refund" v-if="item.status=='refunding'">已申请退款,需等待商家审核</view>
|
||||
<view class="refund" v-if="returnTime==='00:00:00'&&!item.isMyself">当前订单已失效</view>
|
||||
<view class="refund" v-if="item.status=='cancel'&&!item.isMyself">当前订单已失效</view>
|
||||
<view class="refund" v-if="item.status=='refunding'&&item.isMyself">已申请退款,需等待商家审核</view>
|
||||
<view class="refund" v-else-if="returnTime==='00:00:00'&&!item.isMyself">当前订单已失效</view>
|
||||
<view class="refund" v-else-if="item.status!='ing'&&!item.isMyself">当前订单已失效</view>
|
||||
</template>
|
||||
|
||||
<view class="shop-box">
|
||||
@@ -528,7 +528,9 @@
|
||||
console.log(opt)
|
||||
Object.assign(query, opt)
|
||||
console.log(query)
|
||||
|
||||
if(query.shopId){
|
||||
uni.cache.set('shopId', query.shopId)
|
||||
}
|
||||
}
|
||||
|
||||
function refund(item) {
|
||||
@@ -711,9 +713,10 @@
|
||||
if (!nowStep.value) {
|
||||
return 0
|
||||
}
|
||||
const index = item.packageInfo.tieredDiscount.findIndex(v => v.peopleNum)
|
||||
const index = item.packageInfo.tieredDiscount.findIndex(v => v.peopleNum==nowStep.value.peopleNum)
|
||||
if (index != -1) {
|
||||
return (index + 1) / item.packageInfo.tieredDiscount.length * 100
|
||||
const percent= (index + 1) / item.packageInfo.tieredDiscount.length * 100
|
||||
return percent>=100?100:0;
|
||||
}
|
||||
return 0
|
||||
})
|
||||
@@ -959,7 +962,7 @@
|
||||
}
|
||||
|
||||
.pin-btn {
|
||||
padding: 14rpx 60rpx;
|
||||
padding: 22rpx 60rpx;
|
||||
border-radius: 200rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
@@ -1090,6 +1093,7 @@
|
||||
$height: 10rpx;
|
||||
height: $height;
|
||||
border-radius: $height;
|
||||
overflow: hidden;
|
||||
|
||||
.progress {
|
||||
height: $height;
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
const accountInfo = wx.getAccountInfoSync();
|
||||
export const envVersion = accountInfo.miniProgram.envVersion;
|
||||
let type = 3;
|
||||
if (envVersion === 'trial') {
|
||||
console.log('当前环境是体验版');
|
||||
type = 2;
|
||||
} else if (envVersion === 'release') {
|
||||
console.log('当前环境是正式版');
|
||||
type = 0;
|
||||
} else {
|
||||
type = 1;
|
||||
console.log('当前环境是开发版或其他');
|
||||
}
|
||||
|
||||
|
||||
export function wxShare(par) {
|
||||
return {
|
||||
...par,
|
||||
type: 2
|
||||
type
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user