Compare commits
6 Commits
427f32ded7
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| b637a6dea9 | |||
| d5c42f2092 | |||
| 129bc1276a | |||
| 5c2aa2b617 | |||
| 3f6b39f413 | |||
| 036f557c9a |
@@ -122,4 +122,6 @@ export const cancelRefund = (data) => {
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export const exchange=()=>{}
|
||||
@@ -54,4 +54,14 @@ export const productRelated = (data) => {
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//获取相关推荐商品
|
||||
export const getConsStock = (data) => {
|
||||
return request({
|
||||
url: urlProduct + '/user/product/consStock',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -130,9 +130,19 @@
|
||||
</up-button>
|
||||
</template>
|
||||
</view>
|
||||
<view class="fixedview_tow" @tap="$u.debounce(istoricalorders, 1000)">
|
||||
{{ paymentmethod ? paymentmethod.name : "" }}
|
||||
</view>
|
||||
<template v-if="!loading">
|
||||
<template v-if="cartStore.shopInfo.isUserPay">
|
||||
<view class="fixedview_tow" @tap="$u.debounce(istoricalorders, 1000)">
|
||||
{{ paymentmethod ? paymentmethod.name : "" }}
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="fixedview_tow disabled">
|
||||
请前往吧台支付
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<!-- <view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
|
||||
取消订单
|
||||
</view> -->
|
||||
@@ -326,8 +336,8 @@
|
||||
shop_id: uni.cache.get("shopId"),
|
||||
time_dis_info: null
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function socketInit() {
|
||||
cartsSocket = useWebSocket();
|
||||
@@ -1030,15 +1040,15 @@
|
||||
// 跳转到加菜页面
|
||||
function toJiacai() {
|
||||
console.log("跳转到加菜页面");
|
||||
const arr= getCurrentPages()
|
||||
const arr = getCurrentPages()
|
||||
console.log(arr);
|
||||
if(arr.length>=2&&arr[arr.length-2]&&arr[arr.length-2].route=='pages/product/index'){
|
||||
if (arr.length >= 2 && arr[arr.length - 2] && arr[arr.length - 2].route == 'pages/product/index') {
|
||||
back();
|
||||
}else{
|
||||
uni.cache.set('tableCode',listinfo.tableCode)
|
||||
uni.cache.set('shopId',listinfo.shopId)
|
||||
} else {
|
||||
uni.cache.set('tableCode', listinfo.tableCode)
|
||||
uni.cache.set('shopId', listinfo.shopId)
|
||||
uni.redirectTo({
|
||||
url:'/pages/product/index?noJump=1'
|
||||
url: '/pages/product/index?noJump=1'
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1111,11 +1121,13 @@
|
||||
}
|
||||
|
||||
const limitTimeDiscountRes = ref(null)
|
||||
const rechargeConfig=ref(null)
|
||||
const rechargeConfig = ref(null)
|
||||
|
||||
const loading=ref(true)
|
||||
async function init(opt) {
|
||||
const res1= await storeuser.actionsproductqueryProduct();
|
||||
orderVIP.value=res1
|
||||
console.log('orderVIP',orderVIP.value)
|
||||
const res1 = await storeuser.actionsproductqueryProduct();
|
||||
orderVIP.value = res1
|
||||
console.log('orderVIP', orderVIP.value)
|
||||
cartStore.clearOrderConfig();
|
||||
Object.assign(options, opt);
|
||||
listinfo.id = options.orderId;
|
||||
@@ -1145,22 +1157,24 @@
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取台桌信息
|
||||
let tableRes = await getTableInfo({
|
||||
tableCode: options.tableCode || "",
|
||||
});
|
||||
console.log("tableRes", tableRes);
|
||||
listinfo.tableName = tableRes?tableRes.name:'';
|
||||
|
||||
listinfo.tableName = tableRes ? tableRes.name : '';
|
||||
|
||||
//获取店铺信息
|
||||
const shopInfoRes = await APIusershopInfodetail({
|
||||
shopId: options.shopId,
|
||||
});
|
||||
//智慧充值
|
||||
const rechargeConfigRes=await rechargeApi.config({shopId: options.shopId})
|
||||
if(rechargeConfigRes&&typeof rechargeConfigRes ==='object'){
|
||||
rechargeConfig.value=rechargeConfigRes
|
||||
const rechargeConfigRes = await rechargeApi.config({
|
||||
shopId: options.shopId
|
||||
})
|
||||
if (rechargeConfigRes && typeof rechargeConfigRes === 'object') {
|
||||
rechargeConfig.value = rechargeConfigRes
|
||||
}
|
||||
//获取积分配置
|
||||
pointsApi.pointsConfig().then(res => {
|
||||
@@ -1179,6 +1193,7 @@
|
||||
if (shopInfoRes) {
|
||||
cartStore.shopInfo = shopInfoRes.shopInfo;
|
||||
}
|
||||
loading.value=false
|
||||
await cartStore.goodsInit();
|
||||
// * 获取会员信息
|
||||
await nextTick();
|
||||
@@ -1286,7 +1301,7 @@
|
||||
if (!isCanUseCharge.value) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
if(rechargeConfig.value&&!rechargeConfig.value.isEnable){
|
||||
if (rechargeConfig.value && !rechargeConfig.value.isEnable) {
|
||||
arr.add("余额支付");
|
||||
}
|
||||
|
||||
@@ -1296,12 +1311,12 @@
|
||||
watch(() => cartStore.limitTimeDiscount, (newval, oldval) => {
|
||||
|
||||
})
|
||||
|
||||
watch(()=>cartStore.limitTimeDiscount,(newval)=>{
|
||||
socketInitPar.time_dis_info=newval
|
||||
},{
|
||||
deep:true,
|
||||
immediate:true
|
||||
|
||||
watch(() => cartStore.limitTimeDiscount, (newval) => {
|
||||
socketInitPar.time_dis_info = newval
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -1813,7 +1828,16 @@
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #ffffff;
|
||||
padding: 14rpx 44rpx;
|
||||
padding: 0 44rpx;
|
||||
min-height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
box-sizing: border-box;
|
||||
&.disabled {
|
||||
background-color: #eee;
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.fixedview_tows {
|
||||
|
||||
@@ -62,14 +62,13 @@
|
||||
<view class="shop-info">
|
||||
<view class="shop-item">
|
||||
<view class="cover" v-for="(item1,index1) in item.goods" :key="index1">
|
||||
|
||||
|
||||
<u-image width="56" height="56" radius="10" :src="item1.productImg"
|
||||
v-if="!item1.isTemporary"></u-image>
|
||||
|
||||
|
||||
<u-image width="56" height="56" radius="10"
|
||||
v-else-if="item1.isTemporary &&item1.productName=='签子'"
|
||||
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"
|
||||
></u-image>
|
||||
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"></u-image>
|
||||
<u-image width="56" height="56" radius="10"
|
||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||
mode="heightFix" v-else></u-image>
|
||||
@@ -91,8 +90,27 @@
|
||||
<view class="footer-wrap">
|
||||
<view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)"
|
||||
v-if="item.status == 'done' || item.status == 'cancelled'"> 删除订单 </view>
|
||||
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||
<template v-if="shopInfo&&shopInfo.id">
|
||||
<template v-if="shopInfo.id==item.shopId">
|
||||
<template v-if="shopInfo.isUserPay">
|
||||
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="btn s disabled" @click.stop="()=>{}"
|
||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 请前往吧台支付 </view>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||
</template>
|
||||
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||
</template>
|
||||
|
||||
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status != 'unpaid'"> 再来一单 </view>
|
||||
</view>
|
||||
@@ -151,7 +169,7 @@
|
||||
uni.cache.set("shopId", item.shopId);
|
||||
uni.navigateTo({
|
||||
url: "/pages/product/index?type=beforehand&order_id=" + item.id +
|
||||
'&one_more_order=1&shopId='+item.shopId,
|
||||
'&one_more_order=1&shopId=' + item.shopId,
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -167,6 +185,8 @@
|
||||
}, 0)
|
||||
}
|
||||
|
||||
const shopInfo = uni.cache.get('shopInfo')
|
||||
|
||||
function isRemoveOrder(item) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
@@ -523,6 +543,12 @@
|
||||
font-size: 24rpx;
|
||||
color: #333333;
|
||||
margin-left: 32rpx;
|
||||
|
||||
&.disabled {
|
||||
background-color: #eee;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.s {
|
||||
|
||||
@@ -647,7 +647,34 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 封装成 Promise 的确认弹窗
|
||||
const showConfirmModal = (title, content) => {
|
||||
return new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
showCancel: true,
|
||||
cancelText: '取消添加',
|
||||
confirmText: '继续',
|
||||
success(res) {
|
||||
// 确认返回 true,取消/关闭返回 false
|
||||
resolve(res.confirm === true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
// 提取合并 orderinfo.detailMap 数组的逻辑
|
||||
function combineOrderInfoDetailMap(orderinfo) {
|
||||
if (!orderinfo) return [];
|
||||
let combinedArray = [];
|
||||
for (const key in orderinfo.detailMap) {
|
||||
if (orderinfo.detailMap.hasOwnProperty(key)) {
|
||||
let subArray = orderinfo.detailMap[key];
|
||||
combinedArray = [...combinedArray, ...subArray];
|
||||
}
|
||||
}
|
||||
return combinedArray;
|
||||
}
|
||||
// 提交选择并执行下一步操作的方法
|
||||
const submitSelection = async (goods) => {
|
||||
if (!isProductAvailable(goods.days, goods.startTime,
|
||||
@@ -664,7 +691,7 @@
|
||||
if (goods.type == 'package' && goods.groupType != 0 && !allConditionsSatisfied.value) {
|
||||
return
|
||||
}
|
||||
|
||||
const oldGoodsArr = combineOrderInfoDetailMap(props.orderinfo)
|
||||
if ((goods.type == 'package' && allConditionsSatisfied.value) || (goods.type ==
|
||||
'sku' && canSubmit.value)) {
|
||||
let res = null;
|
||||
@@ -688,6 +715,30 @@
|
||||
sku_id = selSku.value.id
|
||||
}
|
||||
console.log('goods', goods);
|
||||
console.log('res',res);
|
||||
const number=await calculateValue(res?res.number:0, '+', shopCartNumber.value)
|
||||
console.log('number',number);
|
||||
console.log('shopCartNumber',shopCartNumber.value);
|
||||
if(res && number*1===2){
|
||||
const isConfirm = await showConfirmModal(
|
||||
'购物车已有该商品,请确认是否重复',
|
||||
'菜品名称:《' + goods.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (oldGoodsArr.find(v => v.productId == goods.id)) {
|
||||
// 等待用户点击
|
||||
const isConfirm = await showConfirmModal(
|
||||
'该商品已下单过,请确认是否重复',
|
||||
'菜品名称:《' + goods.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
emits('websocketsendMessage', {
|
||||
id: res ? res.id : '',
|
||||
type: 'shopping',
|
||||
@@ -697,7 +748,7 @@
|
||||
operate_type: res ? 'edit' : 'add',
|
||||
product_id: goods.id,
|
||||
sku_id,
|
||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
||||
number: res ? number:
|
||||
shopCartNumber.value,
|
||||
pro_group_info: returnSelectedGroupSnap(),
|
||||
goods_type: goods.type == 'package' ? 'package' : '',
|
||||
@@ -708,6 +759,27 @@
|
||||
})
|
||||
} else {
|
||||
let res = cartStore.carts.find(cart => cart.product_id == goods.id && goods.skuList[0].id)
|
||||
const number=await calculateValue(res?res.number:0, '+', shopCartNumber.value)
|
||||
console.log('number',number);
|
||||
if(res && number*1===2){
|
||||
const isConfirm = await showConfirmModal(
|
||||
'购物车已有该商品,请确认是否重复',
|
||||
'菜品名称:《' + goods.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (oldGoodsArr.find(v => v.productId == goods.id)) {
|
||||
// 等待用户点击
|
||||
const isConfirm = await showConfirmModal(
|
||||
'该商品已下单过,请确认是否重复',
|
||||
'菜品名称:《' + goods.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
}
|
||||
emits('websocketsendMessage', {
|
||||
id: res ? res.id : '',
|
||||
type: 'shopping',
|
||||
@@ -717,7 +789,7 @@
|
||||
operate_type: res ? 'edit' : 'add',
|
||||
product_id: goods.id,
|
||||
sku_id: goods.skuList[0].id,
|
||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
||||
number: res ? number:
|
||||
shopCartNumber.value,
|
||||
memberPrice: goods.memberPrice,
|
||||
is_print: 1,
|
||||
|
||||
@@ -58,13 +58,11 @@
|
||||
限时折扣{{ limitDiscountCountdown }}</view>
|
||||
<!-- <view class="limitDiscount" v-if="item.is_time_discount">
|
||||
限时折扣{{ limitDiscountCountdown }}</view> -->
|
||||
<view class="stock_warning"
|
||||
v-if="item.isStock&&item.stockNumber<=10&&item.stockNumber>0">
|
||||
仅剩{{item.stockNumber}}份</view>
|
||||
<view class="stock_warning" v-if="showStockNumber(item)&& !showNoBuy(item)">
|
||||
仅剩{{returnStockNumber(item)}}份</view>
|
||||
</view>
|
||||
|
||||
<view class="vifgoodsImg flex-center"
|
||||
v-if="item.isSale == 0 || (item.isSaleTime == 0 && !item.isSaleTimeshow) || item.isSoldStock == 1 || (item.isStock == 1 && item.stockNumber <= 0)">
|
||||
<view class="vifgoodsImg flex-center" v-if="showNoBuy(item)">
|
||||
<image v-if="item.isSale == 0" src="@/static/ztt/icon_goods_yxj.svg"
|
||||
style="width: 200rpx; height: 100%" mode=""></image>
|
||||
<image v-else-if="item.isSaleTime == 0 && !item.isSaleTimeshow"
|
||||
@@ -72,8 +70,8 @@
|
||||
</image>
|
||||
<image v-else-if="item.isSoldStock == 1" src="@/static/ztt/icon_goods_sq.svg"
|
||||
style="width: 200rpx; height: 100%" mode=""></image>
|
||||
<image v-else-if="item.isStock == 1 && item.stockNumber <= 0"
|
||||
src="@/static/ztt/icon_goods_kcbz.svg" style="width: 200rpx; height: 100%" mode="">
|
||||
<image v-else src="@/static/ztt/icon_goods_kcbz.svg" style="width: 200rpx; height: 100%"
|
||||
mode="">
|
||||
</image>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-32 u-row-between">
|
||||
@@ -201,13 +199,11 @@
|
||||
style="width:600rpx;height: 188rpx;"></image>
|
||||
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
|
||||
<view class="share-btn-box" v-if="showShare(scope.item)">
|
||||
<ymf-share
|
||||
@shareClick="shareBtnClick(scope.item)"
|
||||
>
|
||||
<ymf-share @shareClick="shareBtnClick(scope.item)">
|
||||
<view class="share-btn">分享</view>
|
||||
</ymf-share>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -236,17 +232,11 @@
|
||||
|
||||
<!-- <view class="limitDiscount" v-if="item1.is_time_discount">
|
||||
限时折扣{{ limitDiscountCountdown }}</view> -->
|
||||
<view class="stock_warning"
|
||||
v-if="item1.isStock&&item1.stockNumber<=10&&item.stockNumber>0">
|
||||
仅剩{{item1.stockNumber}}份</view>
|
||||
<view class="stock_warning" v-if="showStockNumber(item1)&&!showNoBuy(item1)">
|
||||
仅剩{{returnStockNumber(item1)}}份</view>
|
||||
</view>
|
||||
|
||||
<view class="vifgoodsImg" v-if="
|
||||
item1.isSale == 0 ||
|
||||
(item1.isSaleTime == 0 && !item1.isSaleTimeshow) ||
|
||||
item1.isSoldStock == 1 ||
|
||||
(item1.isStock == 1 && item1.stockNumber <= 0)
|
||||
">
|
||||
<view class="vifgoodsImg" v-if="showNoBuy(item1)">
|
||||
<image v-if="item1.isSale == 0" src="@/static/ztt/icon_goods_yxj.svg"
|
||||
style="width: 200rpx; height: 100%" mode=""></image>
|
||||
<image v-else-if="item1.isSaleTime == 0 && !item1.isSaleTimeshow"
|
||||
@@ -254,9 +244,8 @@
|
||||
mode=""></image>
|
||||
<image v-else-if="item1.isSoldStock == 1" src="@/static/ztt/icon_goods_sq.svg"
|
||||
style="width: 200rpx; height: 100%" mode=""></image>
|
||||
<image v-else-if="item1.isStock == 1 && item1.stockNumber <= 0"
|
||||
src="@/static/ztt/icon_goods_kcbz.svg" style="width: 200rpx; height: 100%"
|
||||
mode=""></image>
|
||||
<image v-else src="@/static/ztt/icon_goods_kcbz.svg"
|
||||
style="width: 200rpx; height: 100%" mode=""></image>
|
||||
</view>
|
||||
|
||||
<view v-if="index == '0'" class="topSort" :class="'c' + (index1 + 1)">
|
||||
@@ -378,7 +367,7 @@
|
||||
<text class="allDiscountMoney" v-if="allDiscountMoney * 1 > 0">共减¥{{ allDiscountMoney }}</text>
|
||||
</view>
|
||||
<view class="btn" @tap="$u.debounce(orderdetail, 500)" v-if="orderType == 'scan'">
|
||||
<text class="t">结算</text>
|
||||
<text class="t">去下单</text>
|
||||
</view>
|
||||
<view class="btn" v-else>
|
||||
<u-button type="primary" shape="circle" plain @click="beforehandHandle">扫码下单</u-button>
|
||||
@@ -401,193 +390,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
<up-popup :show="showShopsku" :round="20" mode="bottom" @close="(showShopsku = false), (pagemetashow = false)">
|
||||
<view class="shop_sku">
|
||||
<scroll-view scroll-y style="max-height: 60vh; width: 100%">
|
||||
<view class="positionabsolute">
|
||||
<up-icon name="close-circle" @click="
|
||||
showShopsku = false;
|
||||
pagemetashow = false;
|
||||
" color="#000" size="25"></up-icon>
|
||||
</view>
|
||||
<up-swiper :list="specifications.item.images" @change="swiperChange" :current="swiperCurrent"
|
||||
radius="6px" height="250"
|
||||
@click="prveImgs(specifications.item.images, specifications.item.images[swiperCurrent])">
|
||||
<!-- <template v-slot:default="{item}">
|
||||
<image :src=item></image>
|
||||
</templte> -->
|
||||
</up-swiper>
|
||||
|
||||
<view class="shop_sku_name">{{ specifications.item.name }}</view>
|
||||
<view class="shop_sku_description" v-if="isSkuGoods">
|
||||
{{ specifications.item.shortTitle ? specifications.item.shortTitle : '' }}
|
||||
</view>
|
||||
<view v-if="specifications.item.type != 'package'">
|
||||
<view class="shop_sku_box" v-for="(specOptions, specType) in specifications.item.selectSpecInfo"
|
||||
:key="specType">
|
||||
<view class="shop_sku_box_name">
|
||||
{{ specType }}
|
||||
</view>
|
||||
<view class="flex-start">
|
||||
<view class="shop_sku_box_item" v-for="option in specOptions" :key="option"
|
||||
@click="selectSpec(specType, option)" :class="{
|
||||
shop_sku_box_item_selected: isSkuSelected(specType, option)
|
||||
}">
|
||||
{{ option }}
|
||||
<view class="shop_sku_box_item_tip"
|
||||
v-if="specifications.item.result && specifications.item.result.isSoldStock == 1 && selectedSpecs[specType] === option">
|
||||
<view>售罄</view>
|
||||
</view>
|
||||
<view class="shop_sku_box_item_tip"
|
||||
v-if="specifications.item.result == 'kong' && canSubmit == false && selectedSpecs[specType] === option">
|
||||
<view>已下架</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 套餐 -->
|
||||
<view v-else>
|
||||
<view class="shop_sku_box">
|
||||
<view v-for="(setmenu, setmenuindex) in specifications.item.groupSnap" :key="setmenuindex">
|
||||
<view class="shop_sku_box_name">{{ setmenu.title }} {{ setmenu.count }}
|
||||
选{{ setmenu.number }}</view>
|
||||
<view class="flex-start">
|
||||
<view class="shop_sku_box_item" v-for="(option, goodsid) in setmenu.goods"
|
||||
:key="goodsid" @click="goodsidClick(setmenuindex, option, goodsid)" :class="{
|
||||
shop_sku_box_item_selected: isOptionSelected(setmenuindex, option)
|
||||
}" :disabled="isMaxSelected(setmenuindex) && !isOptionSelected(setmenuindex, option)">
|
||||
{{ option.proName }}
|
||||
<text v-if="option.unitName">/{{ option.unitName }}</text>
|
||||
<view class="shop_sku_box_item_tip" v-if="specifications.item.isSoldStock == 1">
|
||||
<view>售罄</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推荐搭配 -->
|
||||
<view class="u-m-t-48 u-p-30">
|
||||
<view class="font-bold u-font-32 ">推荐搭配</view>
|
||||
<view class="u-flex recommand-goods">
|
||||
<view class=" item" v-for="(item,index) in 6" :key="index">
|
||||
<up-image width="210rpx" height="210rpx" radius="12rpx"></up-image>
|
||||
<view class="info">
|
||||
<view class="u-line-2 name u-m-t-10 u-font-32 font-500">
|
||||
商品名
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="font-bold">
|
||||
<text class="u-font-24">¥</text>
|
||||
<text class="u-font-32">40</text>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 占位 -->
|
||||
<view class="shop_bottom">
|
||||
<view class="flex-between">
|
||||
<view class="price price-sku"
|
||||
v-if="specifications.item.type != 'package' && specifications.item.result">
|
||||
<text class="i">¥</text>
|
||||
<view class="num">
|
||||
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount"
|
||||
:cart="specifications.item.result" :shopUserInfo="shopUserInfo"
|
||||
:shopInfo="shopInfo"></GoodsPrice>
|
||||
</view>
|
||||
|
||||
<text class="num" v-if="false">
|
||||
{{
|
||||
shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1
|
||||
? specifications.item.result.memberPrice || specifications.item.result.salePrice
|
||||
: specifications.item.result.salePrice
|
||||
}}
|
||||
</text>
|
||||
<text class="i"
|
||||
v-if="specifications.item.unitName">/{{ specifications.item.unitName }}</text>
|
||||
<text
|
||||
v-if="specifications.item.result.suitNum > 1">「{{ specifications.item.result.suitNum }}{{ specifications.item.result.unitName }}起点」</text>
|
||||
</view>
|
||||
<view class="price price-package" v-else>
|
||||
<text class="i">¥</text>
|
||||
<view class="num">
|
||||
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="specifications.item"
|
||||
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||
</view>
|
||||
<text class="num" v-if="false">
|
||||
{{
|
||||
shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1
|
||||
? specifications.item.memberPrice || specifications.item.salePrice
|
||||
: specifications.item.salePrice
|
||||
}}
|
||||
</text>
|
||||
<text class="i"
|
||||
v-if="specifications.item.unitName">/{{ specifications.item.unitName }}</text>
|
||||
<text
|
||||
v-if="specifications.item.suitNum > 1">「{{ specifications.item.suitNum }}{{ specifications.item.unitName }}起点」</text>
|
||||
</view>
|
||||
|
||||
<view class="operation-wrap"
|
||||
v-if="specifications.item.type != 'package'&&stockNumberIsFull(specifications.item)">
|
||||
<view class="btn">
|
||||
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
|
||||
v-if="shopCartNumber > 0"></up-icon>
|
||||
<view class="btnClick" @click="shopCart('-')"></view>
|
||||
</view>
|
||||
<text class="num">{{ shopCartNumber }}</text>
|
||||
<view class="btn">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
<view class="btnClick" @click="shopCart('+')"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shop_skuselect flex-start" v-if="selectedSpecsStr">
|
||||
<view class="shop_skuselectname">{{ selectedSpecsStr }}</view>
|
||||
</view>
|
||||
<template v-if="!stockNumberIsFull(specifications.item)">
|
||||
<view class="addShopping">
|
||||
库存不足
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="isSkuGoods">
|
||||
<view v-if="specifications.item.type == 'package'" class="addShopping"
|
||||
:class="shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''"
|
||||
@click="submitSelection()">
|
||||
{{ skuBtnText }}
|
||||
</view>
|
||||
<view v-else class="addShopping" :class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
|
||||
@click="submitSelection()">
|
||||
{{ skuBtnText }}
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="addShopping" :class="shopCartNumber > 0 ? 'active' : ''"
|
||||
@click="submitSelection()">
|
||||
{{ skuBtnText }}
|
||||
</view>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
<view class="history_order" @click="toHistory"
|
||||
v-if="shopInfo && shopInfo.registerType == 'after' && orderinfo.id">
|
||||
<image class="img" src="@/static/history.png" mode=""></image>
|
||||
@@ -598,7 +401,7 @@
|
||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||
|
||||
<view v-for="(item,index) in goodsModalList" :key="index">
|
||||
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs"
|
||||
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" :orderinfo="orderinfo"
|
||||
@shareClick="shareClick" @close="goodsModalClose(index)" @websocketsendMessage="websocketsendMessage"
|
||||
@modalAdd="modalAdd" :GoodsIDInCartNumMap="GoodsIDInCartNumMap"></goodsModal>
|
||||
</view>
|
||||
@@ -640,7 +443,7 @@
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<ymf-share-popup ></ymf-share-popup>
|
||||
<ymf-share-popup></ymf-share-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -663,6 +466,7 @@
|
||||
APIgroupquery,
|
||||
APIminiAppinfo,
|
||||
APIminiAppskuinfo,
|
||||
getConsStock,
|
||||
productRelated
|
||||
} from '@/common/api/product/product.js';
|
||||
|
||||
@@ -758,6 +562,32 @@
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
|
||||
// 是否显示禁止购买
|
||||
function showNoBuy(item) {
|
||||
if (item.isSale == 0) {
|
||||
return true
|
||||
}
|
||||
if (item.isSaleTime == 0 && !item.isSaleTimeshow) {
|
||||
return true
|
||||
}
|
||||
if (item.isSoldStock == 1) {
|
||||
return true
|
||||
}
|
||||
if(item.type==="single"){
|
||||
const sku=item.skuList[0]
|
||||
if(!sku){
|
||||
return true
|
||||
}
|
||||
if(sku&&returnStockNumber(item)<sku.suitNum){
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (returnStockNumber(item) <= 0) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const storeMemberpay = Memberpay();
|
||||
const store = useNavbarStore();
|
||||
// 动态更新导航栏配置
|
||||
@@ -776,6 +606,7 @@
|
||||
} from '@/stores/order.js';
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
provide,
|
||||
reactive
|
||||
} from 'vue';
|
||||
@@ -933,6 +764,9 @@
|
||||
|
||||
//左侧导航点击
|
||||
const leftTap = (index) => {
|
||||
console.log('topArr.value[index] ', topArr.value[index]);
|
||||
console.log('store.height', store.height);
|
||||
console.log('scrollTop', topArr.value[index] - store.height);
|
||||
uni.pageScrollTo({
|
||||
scrollTop: topArr.value[index] - store.height,
|
||||
duration: 0
|
||||
@@ -947,6 +781,7 @@
|
||||
|
||||
/* 获取元素顶部信息 */
|
||||
const getElementTop = () => {
|
||||
console.log('getElementTop');
|
||||
new Promise((resolve, reject) => {
|
||||
let view = uni.createSelectorQuery().selectAll('.main-item');
|
||||
view.boundingClientRect(async (data) => {
|
||||
@@ -1024,77 +859,77 @@
|
||||
|
||||
|
||||
/*商品区域轮播图 start*/
|
||||
|
||||
const shareSwiperItem=ref(null)
|
||||
|
||||
const shareSwiperItem = ref(null)
|
||||
|
||||
function swiperClick(item) {
|
||||
console.log('swiperClick',item);
|
||||
shareSwiperItem.value=item
|
||||
const pTag=returnPageTags(item.jumpPagePath)
|
||||
|
||||
if(pTag==='pp-list'){
|
||||
console.log('swiperClick', item);
|
||||
shareSwiperItem.value = item
|
||||
const pTag = returnPageTags(item.jumpPagePath)
|
||||
|
||||
if (pTag === 'pp-list') {
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='pp-detail'){
|
||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||
if (pTag === 'pp-detail') {
|
||||
const url = item.jumpPagePath + '&shopId=' + uni.cache.get('shopId') + '&' + item.extendParam
|
||||
return uni.navigateTo({
|
||||
url:url.replace('goodsId','id')
|
||||
url: url.replace('goodsId', 'id')
|
||||
})
|
||||
}
|
||||
if(pTag==='gb-list'){
|
||||
if (pTag === 'gb-list') {
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='gb-detail'){
|
||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||
if (pTag === 'gb-detail') {
|
||||
const url = item.jumpPagePath + '&shopId=' + uni.cache.get('shopId') + '&' + item.extendParam
|
||||
return uni.navigateTo({
|
||||
url:url.replace('goodsId','wareId')
|
||||
url: url.replace('goodsId', 'wareId')
|
||||
})
|
||||
}
|
||||
if(pTag==='dis'){
|
||||
if (pTag === 'dis') {
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='index'){
|
||||
if (pTag === 'index') {
|
||||
return uni.switchTab({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
|
||||
if(pTag==='eat'){
|
||||
|
||||
if (pTag === 'eat') {
|
||||
if (item.extendParam) {
|
||||
const id=item.extendParam.split('=')[1]
|
||||
const id = item.extendParam.split('=')[1]
|
||||
const item = allGoodsArr.value.find(v => v.id == id)
|
||||
if (item) {
|
||||
clickspecifications(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pTag==='point'){
|
||||
|
||||
if (pTag === 'point') {
|
||||
return uni.navigateTo({
|
||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
||||
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||
})
|
||||
}
|
||||
if(pTag==='point-detail'){
|
||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
||||
if (pTag === 'point-detail') {
|
||||
const url = item.jumpPagePath + '&shopId=' + uni.cache.get('shopId') + '&' + item.extendParam
|
||||
return uni.navigateTo({
|
||||
url:url.replace('goodsId','id')
|
||||
url: url.replace('goodsId', 'id')
|
||||
})
|
||||
}
|
||||
}
|
||||
function showShare(item){
|
||||
if(item.isShareable&&item.isEnabled){
|
||||
|
||||
function showShare(item) {
|
||||
if (item.isShareable && item.isEnabled) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/*商品区域轮播图 end*/
|
||||
// 点击详情
|
||||
const showShopsku = ref(false);
|
||||
|
||||
// 规格信息
|
||||
const specifications = reactive({
|
||||
@@ -1363,6 +1198,7 @@
|
||||
|
||||
// 提交选择并执行下一步操作的方法
|
||||
const submitSelection = async () => {
|
||||
console.log('submitSelection', submitSelection)
|
||||
if (!isProductAvailable(specifications.productListitem.days, specifications.productListitem.startTime,
|
||||
specifications.productListitem.endTime)) {
|
||||
uni.showToast({
|
||||
@@ -1387,6 +1223,33 @@
|
||||
selectedGroupSnap.value = [];
|
||||
}
|
||||
console.log('specifications.item', specifications.item);
|
||||
const number = await calculateValue(res.cartNumber, '+', shopCartNumber.value)
|
||||
|
||||
const oldGoodsArr = combineOrderInfoDetailMap(orderinfo.value)
|
||||
if (oldGoodsArr.find(v => v.productId == specifications.item.id)) {
|
||||
// 等待用户点击
|
||||
const isConfirm = await showConfirmModal(
|
||||
'该商品已下单过,请确认是否重复',
|
||||
'菜品名称:《' + specifications.item.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (res && number * 1 === 2) {
|
||||
const isConfirm = await showConfirmModal(
|
||||
'购物车已有该商品,请确认是否重复',
|
||||
'菜品名称:《' + specifications.item.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
websocketsendMessage({
|
||||
id: res ? res.cartListId : '',
|
||||
type: 'shopping',
|
||||
@@ -1396,8 +1259,7 @@
|
||||
operate_type: res ? 'edit' : 'add',
|
||||
product_id: specifications.product_id,
|
||||
sku_id: specifications.sku_id,
|
||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
||||
shopCartNumber.value,
|
||||
number: res ? number : shopCartNumber.value,
|
||||
pro_group_info: selectedGroupSnap.value,
|
||||
goods_type: specifications.item.type == 'package' ? 'package' : '',
|
||||
memberPrice: specifications.item.memberPrice,
|
||||
@@ -1407,8 +1269,31 @@
|
||||
});
|
||||
// 清空套餐选中
|
||||
selectedGroupSnap.value = [];
|
||||
showShopsku.value = false;
|
||||
} else {
|
||||
const number = await calculateValue(res.cartNumber, '+', shopCartNumber.value)
|
||||
const oldGoodsArr = combineOrderInfoDetailMap(orderinfo.value)
|
||||
if (oldGoodsArr.find(v => v.productId == specifications.item.id)) {
|
||||
// 等待用户点击
|
||||
const isConfirm = await showConfirmModal(
|
||||
'该商品已下单过,请确认是否重复',
|
||||
'菜品名称:《' + specifications.item.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (res && number * 1 === 2) {
|
||||
const isConfirm = await showConfirmModal(
|
||||
'购物车已有该商品,请确认是否重复',
|
||||
'菜品名称:《' + specifications.item.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
websocketsendMessage({
|
||||
id: res ? res.cartListId : '',
|
||||
type: 'shopping',
|
||||
@@ -1418,14 +1303,12 @@
|
||||
operate_type: res ? 'edit' : 'add',
|
||||
product_id: specifications.product_id,
|
||||
sku_id: specifications.sku_id,
|
||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
||||
shopCartNumber.value,
|
||||
number: res ? number : shopCartNumber.value,
|
||||
memberPrice: specifications.item.memberPrice,
|
||||
is_print: 1,
|
||||
product_type: specifications.item.type,
|
||||
is_time_discount: showLimitDiscount(specifications.item)
|
||||
});
|
||||
showShopsku.value = false;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1540,7 +1423,6 @@
|
||||
.filter(([_, value]) => value.length > 0));
|
||||
// 给默认数量
|
||||
specifications.item.amountcartNumber = 0;
|
||||
// showShopsku.value = true;
|
||||
goodsModalList.value.push({
|
||||
show: true,
|
||||
goods: {
|
||||
@@ -1553,7 +1435,7 @@
|
||||
};
|
||||
// 判断商品是否在可售时间内
|
||||
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
||||
if(!sellDaysStr){
|
||||
if (!sellDaysStr) {
|
||||
return false
|
||||
}
|
||||
// 将后端返回的字符串转换为数组
|
||||
@@ -1618,6 +1500,23 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 封装成 Promise 的确认弹窗
|
||||
const showConfirmModal = (title, content) => {
|
||||
return new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
showCancel: true,
|
||||
cancelText: '取消添加',
|
||||
confirmText: '继续',
|
||||
success(res) {
|
||||
// 确认返回 true,取消/关闭返回 false
|
||||
resolve(res.confirm === true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
// 单规格
|
||||
const singleclick = async (item, i) => {
|
||||
console.log('单规格商品点击事件:', item, i);
|
||||
@@ -1645,17 +1544,53 @@
|
||||
} else if (item.suitNum >= cartNumberFloat && i === '-') {
|
||||
suitNum = item.cartNumber;
|
||||
}
|
||||
|
||||
const number = await calculateValue(item.cartNumber, i, suitNum)
|
||||
const goodsStockNumber = returnStockNumber(item)
|
||||
|
||||
console.log('number', number);
|
||||
if (i === '+') {
|
||||
if (goodsStockNumber < suitNum) {
|
||||
return uni.showToast({
|
||||
title: '库存不足',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
const oldGoodsArr = combineOrderInfoDetailMap(orderinfo.value)
|
||||
if (oldGoodsArr.find(v => v.productId == item.id)) {
|
||||
// 等待用户点击
|
||||
const isConfirm = await showConfirmModal(
|
||||
'该商品已下单过,请确认是否重复',
|
||||
'菜品名称:《' + item.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (number * 1 == 2) {
|
||||
const isConfirm = await showConfirmModal(
|
||||
'购物车已有该商品,请确认是否重复',
|
||||
'菜品名称:《' + item.name + '》'
|
||||
);
|
||||
if (!isConfirm) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const sendMsg = {
|
||||
type: 'shopping',
|
||||
suitNum: item.suitNum,
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
operate_type: (await calculateValue(item.cartNumber, i, suitNum)) == 'del' ? 'del' : res ? 'edit' :
|
||||
'add',
|
||||
operate_type: number == 'del' ? 'del' : res ? 'edit' : 'add',
|
||||
product_id: item.id,
|
||||
sku_id: item.skuId,
|
||||
memberPrice: item.memberPrice,
|
||||
number: await calculateValue(item.cartNumber, i, suitNum),
|
||||
number: number,
|
||||
is_print: 1,
|
||||
product_type: item.type,
|
||||
is_time_discount: showLimitDiscount(item)
|
||||
@@ -2089,6 +2024,7 @@
|
||||
const orderinfo = ref({});
|
||||
const confirmorderref = ref(null);
|
||||
|
||||
|
||||
// 结账
|
||||
const orderdetail = async () => {
|
||||
isAutoClose = false;
|
||||
@@ -2504,7 +2440,7 @@
|
||||
|
||||
console.log('options.initMessage', options.initMessage)
|
||||
const newTableCode = userStore.getQueryString(res.result, 'code');
|
||||
console.log('newTableCode',newTableCode);
|
||||
console.log('newTableCode', newTableCode);
|
||||
const shopInfoRes = await APIproductqueryShop({
|
||||
tableCode: newTableCode
|
||||
});
|
||||
@@ -2562,7 +2498,8 @@
|
||||
handleMixinOnLoad,
|
||||
returnQuery,
|
||||
jsonToUrl,
|
||||
wxShare,returnPageTags,
|
||||
wxShare,
|
||||
returnPageTags,
|
||||
returnCommonQuery
|
||||
} from '@/utils/share.js'
|
||||
// defineOptions({
|
||||
@@ -2575,39 +2512,42 @@
|
||||
function shareClick() {
|
||||
isGoodsShare.value = true
|
||||
}
|
||||
|
||||
function getPage(pageStr){
|
||||
|
||||
|
||||
function getPage(pageStr) {
|
||||
|
||||
}
|
||||
function shareBtnClick(item){
|
||||
console.log('shareBtnClick',item);
|
||||
shareSwiperItem.value=item
|
||||
|
||||
function shareBtnClick(item) {
|
||||
console.log('shareBtnClick', item);
|
||||
shareSwiperItem.value = item
|
||||
}
|
||||
function swiperShare(queryJson){
|
||||
console.log('shareSwiperItem',shareSwiperItem.value);
|
||||
const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath)
|
||||
|
||||
function swiperShare(queryJson) {
|
||||
console.log('shareSwiperItem', shareSwiperItem.value);
|
||||
const pTag = returnPageTags(shareSwiperItem.value.jumpPagePath)
|
||||
let query = jsonToUrl(queryJson)
|
||||
query +=('&'+shareSwiperItem.value.extendParam)
|
||||
query += ('&' + shareSwiperItem.value.extendParam)
|
||||
const shopName = uni.cache.get('shopInfo').shopName || ''
|
||||
const path=shareSwiperItem.value.jumpPagePath?shareSwiperItem.value.jumpPagePath:'/pages/product/index?type=beforehand'
|
||||
console.log('path',path);
|
||||
const json={
|
||||
imageUrl:shareSwiperItem.value.imageUrl,
|
||||
path: path+'&'+query,
|
||||
title:shareSwiperItem.value.name+ (shopName ? `-${shopName}` : ''),
|
||||
const path = shareSwiperItem.value.jumpPagePath ? shareSwiperItem.value.jumpPagePath :
|
||||
'/pages/product/index?type=beforehand'
|
||||
console.log('path', path);
|
||||
const json = {
|
||||
imageUrl: shareSwiperItem.value.imageUrl,
|
||||
path: path + '&' + query,
|
||||
title: shareSwiperItem.value.name + (shopName ? `-${shopName}` : ''),
|
||||
}
|
||||
if(pTag==='pp-detail'){
|
||||
json.path=json.path.replace('goodsId','id')
|
||||
if (pTag === 'pp-detail') {
|
||||
json.path = json.path.replace('goodsId', 'id')
|
||||
}
|
||||
if(pTag==='gb-detail'){
|
||||
json.path=json.path.replace('goodsId','wareId')
|
||||
if (pTag === 'gb-detail') {
|
||||
json.path = json.path.replace('goodsId', 'wareId')
|
||||
}
|
||||
if(pTag==='point-detail'){
|
||||
json.path=json.path.replace('goodsId','id')
|
||||
if (pTag === 'point-detail') {
|
||||
json.path = json.path.replace('goodsId', 'id')
|
||||
}
|
||||
if(pTag.includes('eat')){
|
||||
if(shareSwiperItem.value.extendParam){
|
||||
json.path=json.path.replace('goodsId','showGoodsId')
|
||||
if (pTag.includes('eat')) {
|
||||
if (shareSwiperItem.value.extendParam) {
|
||||
json.path = json.path.replace('goodsId', 'showGoodsId')
|
||||
}
|
||||
}
|
||||
return wxShare(json)
|
||||
@@ -2616,7 +2556,7 @@
|
||||
|
||||
async function onShare() {
|
||||
const queryJson = await returnCommonQuery()
|
||||
if(shareSwiperItem.value){
|
||||
if (shareSwiperItem.value) {
|
||||
return swiperShare(queryJson)
|
||||
}
|
||||
let query = jsonToUrl(queryJson)
|
||||
@@ -2633,7 +2573,7 @@
|
||||
json.title = shopName
|
||||
json.imageUrl = uni.cache.get('shopInfo').logo || ''
|
||||
}
|
||||
|
||||
|
||||
return wxShare({
|
||||
query,
|
||||
...json,
|
||||
@@ -2648,6 +2588,42 @@
|
||||
const pageOptions = reactive({})
|
||||
|
||||
const carouselList = ref([])
|
||||
|
||||
async function getConsStocks() {
|
||||
const res = await getConsStock({
|
||||
shopId: userStore.shopInfo.id
|
||||
})
|
||||
consStockList.value = res || []
|
||||
}
|
||||
const consStockList = ref([])
|
||||
|
||||
|
||||
// 是否显示剩余库存数量
|
||||
function showStockNumber(item) {
|
||||
return !item.isSoldStock && returnStockNumber(item) <= 10 && returnStockNumber(item) > 0
|
||||
}
|
||||
|
||||
function returnStockNumber(item) {
|
||||
if (!item.isAutoSoldStock) {
|
||||
return 9999
|
||||
}
|
||||
const consList = item.consList
|
||||
const matchStockList = consStockList.value.filter(v => {
|
||||
return consList.find(c => c.consInfoId == v.consId)
|
||||
}).map(v => {
|
||||
const cItem = item.consList.find(c => c.consInfoId == v.consId)
|
||||
const goodsNumber = Math.floor(v.stockNumber / cItem.surplusStock)
|
||||
return {
|
||||
...v,
|
||||
goodsNumber
|
||||
}
|
||||
}).sort((a, b) => {
|
||||
return a.goodsNumber - b.goodsNumber
|
||||
})
|
||||
|
||||
const minConsStockNumber = matchStockList[0] ? matchStockList[0].goodsNumber : 9999
|
||||
return minConsStockNumber
|
||||
}
|
||||
onLoad(async (e) => {
|
||||
Object.assign(pageOptions, e)
|
||||
if (e.type) {
|
||||
@@ -2723,14 +2699,17 @@
|
||||
tableCode: uni.cache.get('tableCode')
|
||||
});
|
||||
oldOrder.value = res;
|
||||
nextTick(() => {
|
||||
getElementTop();
|
||||
})
|
||||
if (res && res.id && shopInfo.registerType == 'after' && !e.noJump) {
|
||||
toHistory();
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
// 启动网络监听
|
||||
useSocket.initNetworkListener();
|
||||
getElementTop();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
@@ -2811,6 +2790,12 @@
|
||||
id: ''
|
||||
};
|
||||
}
|
||||
// if(!topArr.value.length){
|
||||
// getElementTop()
|
||||
// }
|
||||
|
||||
//耗材列表
|
||||
await getConsStocks()
|
||||
});
|
||||
|
||||
//是否自动关闭socket
|
||||
@@ -2824,7 +2809,7 @@
|
||||
}
|
||||
onHide(() => {
|
||||
isGoodsShare.value = false
|
||||
shareSwiperItem.value=null
|
||||
shareSwiperItem.value = null
|
||||
closeSocket();
|
||||
});
|
||||
onUnload(() => {
|
||||
@@ -4074,11 +4059,12 @@
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.share-btn-box{
|
||||
.share-btn-box {
|
||||
position: absolute;
|
||||
right: 8rpx;
|
||||
bottom: 14rpx;
|
||||
}
|
||||
|
||||
.share-btn {
|
||||
|
||||
padding: 10rpx 32rpx;
|
||||
|
||||
@@ -118,9 +118,8 @@
|
||||
onMounted,
|
||||
getCurrentInstance,
|
||||
nextTick,
|
||||
onShow
|
||||
} from 'vue';
|
||||
|
||||
|
||||
//接口引入
|
||||
import {
|
||||
APIcallTabletakeNumber,
|
||||
|
||||
Reference in New Issue
Block a user