扫码排队

This commit is contained in:
wwz 2025-04-02 14:12:57 +08:00
parent e352acbdd0
commit a95315f42a
8 changed files with 547 additions and 516 deletions

View File

@ -45,22 +45,23 @@ export default (params) => {
if (res.code == 200) {
uni.hideLoading();
uni.hideToast();
resolve(res.data ?res.data: true);
resolve(res.data ? res.data : true);
} else {
switch (res.code) {
case '501':
uni.cache.remove('shopId')
uni.showToast({
title: '',
icon: "none",
success: () => {
setTimeout(() => {
uni.reLaunch({
url: "/pages/index/index",
})
}, 1000);
}
})
// uni.showToast({
// title: '',
// icon: "none",
// success: () => {
// }
// })
setTimeout(() => {
uni.reLaunch({
url: "/pages/index/index",
})
}, 1000);
break;
case 404:
uni.showToast({

View File

@ -40,12 +40,19 @@ export const APIqueuedetail = (data) => {
})
}
// 消息订阅
export const APIcallTablesubMsg = (data) => {
return request({
url: urlAccount + '/user/callTable/subMsg',
method: 'get',
method: 'post',
data: data
})
}
// 取消排队
export const APIqueuecancel = (data) => {
return request({
url: urlAccount + '/user/callTable/cancel?queueId=' + data.queueId + '&shopId=' + data.shopId,
method: 'DELETE'
})
}

View File

@ -1,5 +1,5 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false;
const debug = true
const debug = false
// #ifdef H5
const proxyApi = "/api"
// #endif
@ -7,10 +7,9 @@ const proxyApi = "/api"
// #ifdef MP-WEIXIN || APP || MP-ALIPAY
const proxyApi = 'http://192.168.1.31' // 调试地址
const proxyApiwws = 'ws://192.168.1.31:2348' // 调试地址
// // 本地
// const proxyApi = 'http://192.168.1.31' // 固定的测试
// const proxyApiwws = 'ws://192.168.1.43:2348' //宏哥本地
// 测试
// const proxyApi = "https://fv901fw8033.vicp.fun"
// const proxyApiwws = 'wss://sockets.sxczgkj.com/wss'
// #endif
// #ifdef H5

View File

@ -60,13 +60,13 @@
<view class="fixedview_tow" @tap="$u.debounce(istoricalorders,1000)">
{{paymentmethod.paymentBtnText}}
</view>
<view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
<!-- <view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
取消订单
</view>
</view> -->
</view>
</view>
</view>
<view style="width: 100%;height: 290rpx;"> </view>
<view style="width: 100%;height: 200rpx;"> </view>
<payPassword ref="payPasswordref" :isShow="ispws" @inputComplete="accountPayevent" @close="ispws = false" />
</view>
</template>
@ -553,7 +553,9 @@
orderVIP.value = uni.cache.get('orderVIP')
ordershopUserInfo.value = orderVIP.value.shopInfo
paymentMethodref.value.orderVIPfun(uni.cache.get('orderVIP'))
orderorderInfo()
if (orderId.value) {
orderorderInfo()
}
}
} catch (error) {
//TODO handle the exception

View File

@ -37,7 +37,7 @@
<view class="info">
<text class="productName">{{item.productName}}</text>
<text class="productSkuName"
v-if="item.productSkuName">{{item.productSkuName}}</text>
v-if="item.skuName">{{item.skuName}}</text>
</view>
<view class="price">
@ -69,7 +69,7 @@
{{item.cartListinfo.sku_id == i.id ? i.name :""}}
</text>
</text>
<text class="type" v-if="item.type == 'package'">
<text v-for="(a,b) in dataprocessing(item.cartListinfo)" :key="b">
<text v-for="i in a.goods" :key="i.proId" style="margin-left: 4rpx;">
@ -135,7 +135,8 @@
const props = defineProps({
cartList: {
type: Array
type: Array,
default: []
},
cartLists_count: {
type: Number,
@ -263,71 +264,36 @@
//
const orderdetail = async () => {
let res = await storeMemberpay.actionscreateOrder({
dineMode: 'dine-in', // dine-in take-out take-away
seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //
// packFee: packFee.value, //
packFee: 0, //
originAmount: totalPrices.value, //
remark: remark.value, //
placeNum: props.orderinfo.placeNum + 1, //
waitCall: '', // 0 1
orderId: props.orderinfo.id,
userId: uni.cache.get('userInfo').id || '' //
})
//
emits('customevent', {
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: 'cleanup',
})
// uni.pro.redirectTo('order/detail', {
// orderId: res.id,
// shopId: uni.cache.get('shopId')
// })
uni.reLaunch({
url: '/pages/order/detail?orderId=' + res.id + '&shopId=' + uni.cache.get('shopId')
})
// uni.pro.navigateTo('order/detail', {
// orderId: res.id,
// shopId: uni.cache.get('shopId')
// })
// uni.showLoading({
// title: '',
// mask: true
// })
// if (res) {
// let checkOrderPay = {
// orderId: res.id,
// vipPrice: shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1 ? 1 : 0, //使01
// allPack: is_type.value == 0 ? 0 : 1, //
// seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //
// orderAmount: totalCost.value, //+
// discountRatio: 1, //( ) 1
// discountAmount: 0, // 0
// productCouponDiscountAmount: '', //
// fullCouponDiscountAmount: '', //
// couponList: '', //使
// orderAmount: totalCost.value, //
// roundAmount: 0, //
// pointsDiscountAmount: 0, //(tb_points_basic_setting)
// pointsNum: 0, //( enable_deduction使)
// remark: '', //
// }
// let successdata = await storeMemberpay.actionsltPayOrder({
// checkOrderPay,
// payType: paymentmethod.payType,
// buyerRemark: '',
// returnUrl: ''
// })
// if (successdata) {
// console.log(res.id, 'res.id')
// uni.redirectTo({
// url: '/order/detail?orderId=' + res.id
// });
// }
// }
if (props.cartList.length > 0) {
let res = await storeMemberpay.actionscreateOrder({
dineMode: 'dine-in', // dine-in take-out take-away
seatNum: uni.cache.get('dinersNum') ? uni.cache.get('dinersNum') : '', //
// packFee: packFee.value, //
packFee: 0, //
originAmount: totalPrices.value, //
remark: remark.value, //
placeNum: props.orderinfo.placeNum + 1, //
waitCall: '', // 0 1
orderId: props.orderinfo.id,
userId: uni.cache.get('userInfo').id || '' //
})
//
emits('customevent', {
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: 'cleanup',
})
uni.reLaunch({
url: '/pages/order/detail?orderId=' + res.id + '&shopId=' + uni.cache.get('shopId')
})
} else {
uni.reLaunch({
url: '/pages/order/detail?orderId=' + props.orderinfo.id + '&shopId=' + uni.cache.get(
'shopId')
})
}
}
const dataprocessing = computed(() => {

View File

@ -3,70 +3,80 @@
<up-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@close="close">
<view class="cart-list-wrap">
<view class="cart-header flex-between">
<!-- <view class="cart-header flex-between">
<view class="num">已点 {{ cartLists_count }} </view>
<view class="clear" @click="cartclear">
<up-icon name="trash" color="#999"></up-icon>
<text class="t">清空</text>
</view>
</view>
</view> -->
<scroll-view scroll-y class="scroll-view">
<view class="list-wrap">
<view class="ShoppingCart">
购物车
</view>
<view class="shop-item" v-for="(item,index) in cartList" :key="item.id">
<view class="shop-item-content">
<view class="cover" v-if="item.productId!=-999">
<up-image :src="item.coverImg" width="80" radius="10" height="80"></up-image>
<view v-if="cartList.length>0">
<view class="ShoppingCart flex-between">
<view>
购物车
</view>
<view class="info">
<view class="name"> {{item.cartListinfo.is_temporary == 1?'临时菜' :item.name }}
<view class="flex-between" @click="cartclear">
<up-icon name="trash" color="#999" size="20"></up-icon>
<text class="t">清空购物车</text>
</view>
</view>
<view class="shop-item" v-for="(item,index) in cartList" :key="item.id">
<view class="shop-item-content">
<view class="cover" v-if="item.productId!=-999">
<up-image :src="item.coverImg" width="80" radius="10" height="80"></up-image>
</view>
<view class="select-sku-wrap" v-if="item.type == 'sku'">
<text v-for="i in item.skuList" :key="i.id">
{{item.cartListinfo.sku_id == i.id? i.name:"" }}
</text>
</view>
<view class="select-sku-wrap" v-if="item.type == 'package'">
<view v-for="(a,b) in dataprocessing(item.cartListinfo)" :key="b">
<!-- <view>{{a.title}}</view> -->
<text v-for="i in a.goods" :key="i.proId" style="margin-left: 4rpx;">
{{i.proName }}
<view class="info">
<view class="name"> {{item.cartListinfo.is_temporary == 1?'临时菜' :item.name }}
</view>
<view class="select-sku-wrap" v-if="item.type == 'sku'">
<text v-for="i in item.skuList" :key="i.id">
{{item.cartListinfo.sku_id == i.id? i.name:"" }}
</text>
</view>
</view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<!-- 会员价与价格 -->
<text class="price" v-if="item.type == 'sku'">
<text v-for="i in item.skuList" :key="i.id">
<!-- -->
{{item.cartListinfo.sku_id == i.id?(shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(i.memberPrice || i.salePrice):i.salePrice):''}}
<view class="select-sku-wrap" v-if="item.type == 'package'">
<view v-for="(a,b) in dataprocessing(item.cartListinfo)" :key="b">
<!-- <view>{{a.title}}</view> -->
<text v-for="i in a.goods" :key="i.proId" style="margin-left: 4rpx;">
{{i.proName }}
</text>
</text>
<text class="price" v-else>
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice || item.salePrice):item.salePrice}}
</text>
<!-- <text class="originalprice"
v-if="item.originPrice">¥{{item.originPrice}}</text>
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text> -->
</view>
<view class="operation-wrap">
<view class="btn">
<up-icon name="minus-circle-fill" size="25"></up-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
</view>
<text class="num">{{ ifcartNumber(item) }}</text>
<view class="btn">
<!-- <up-icon name="plus-circle-fill"
:color="{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? '#CECECE' : '#E9AB7A'"
size="25"></up-icon> -->
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
</view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<!-- 会员价与价格 -->
<text class="price" v-if="item.type == 'sku'">
<text v-for="i in item.skuList" :key="i.id">
<!-- -->
{{item.cartListinfo.sku_id == i.id?(shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(i.memberPrice || i.salePrice):i.salePrice):''}}
</text>
</text>
<text class="price" v-else>
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice || item.salePrice):item.salePrice}}
</text>
<!-- <text class="originalprice"
v-if="item.originPrice">¥{{item.originPrice}}</text>
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text> -->
</view>
<view class="operation-wrap">
<view class="btn">
<up-icon name="minus-circle-fill" size="25"></up-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
</view>
<text class="num">{{ ifcartNumber(item) }}</text>
<view class="btn">
<!-- <up-icon name="plus-circle-fill"
:color="{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? '#CECECE' : '#E9AB7A'"
size="25"></up-icon> -->
<up-icon name="plus-circle-fill" color="#E9AB7A"
size="25"></up-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
</view>
</view>
</view>
</view>
@ -76,11 +86,11 @@
<!-- 历史订单 -->
<view class="card" v-if="orderinfo.detailMap">
<!-- 订单头部 -->
<view class="cardcalorders">
<view class="cardcalorders flex-between">
<!-- ··· 历史订单 ··· -->
历史订单
<view class="absolute flex-start">
<up-icon name="trash" color="#999"></up-icon>
<text>待支付订单</text>
<view class="flex-start">
<up-icon name="trash" color="#999" size="20"></up-icon>
<text style="color:' #999;'" @click="clickcancelOrder('all')">清空历史订单</text>
</view>
</view>
@ -90,7 +100,7 @@
<text class="placeNum">{{key}}次下单</text>
<view class="placeTime flex-start">
<up-icon name="trash" color="#999"></up-icon>
<text class="t" @click="clickcancelOrder('',key)">清空</text>
<text class="t" @click="clickcancelOrder('Single',key)">清空</text>
</view>
</view>
</view>
@ -107,7 +117,7 @@
<view class="info">
<text class="productName">{{item.productName}}</text>
<text class="productSkuName"
v-if="item.productSkuName">{{item.productSkuName}}</text>
v-if="item.skuName">{{item.skuName}}</text>
</view>
<view class="price">
@ -232,6 +242,12 @@
i,
key
})
emits('customevent', {
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
operate_type: 'clearOrder',
})
}
const calculateValue = (cartNumber, i, step = 1) => {
@ -302,195 +318,202 @@
}
.scroll-view {
max-height: 50vh;
max-height: 60vh;
margin-bottom: 190rpx;
}
.list-wrap {
padding: 28rpx 0 0 28rpx;
}
.list-wrap {
padding: 0 28rpx;
.ShoppingCart {
margin: 10rpx 0 20rpx 0;
font-size: 30rpx;
text-align: center;
color: #969494;
}
.ShoppingCart {
font-size: 30rpx;
text-align: left;
padding: 20rpx 0;
font-weight: 700;
border-bottom: 1rpx solid #cecece;
color: #000;
.shop-item {
display: flex;
flex-direction: column;
padding-bottom: 28rpx;
.shop-item-content {
display: flex;
justify-content: center;
align-items: center;
}
.shop-item-remark {
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.label {
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.langcover {
position: relative;
}
.langcover::after {
content: '加载中..';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #e8e8e8;
color: #6b6b6b;
border-radius: 10rpx;
text-align: center;
line-height: 180rpx;
z-index: 1;
}
.info {
flex: 1;
padding-left: 20upx;
padding-right: 28rpx;
.name {
font-size: 28upx;
font-weight: bold;
color: #333;
margin-bottom: 5rpx;
.shop-item:last-child {
border-bottom: 1rpx solid #cecece;
padding-bottom: 20rpx;
}
.select-sku-wrap {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.price-wrap {
margin-top: 16rpx;
.shop-item {
margin-top: 15rpx;
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: column;
.price {
.shop-item-content {
display: flex;
align-items: flex-end;
.i,
.num {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.i {
position: relative;
bottom: 4upx;
}
.price {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
.originalprice {
margin-left: 10rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 20rpx;
text-decoration: line-through;
}
.unit {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 36rpx;
color: #333333;
}
.lineThrough {
font-weight: normal;
text-decoration: line-through;
color: #999 !important;
font-size: 24rpx !important;
}
}
.sku-wrap {
padding: 6upx 16upx;
background-color: #ffd100;
border-radius: 12upx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
align-items: center;
}
.t {
font-size: 24upx;
font-weight: bold;
}
.shop-item-remark {
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.dot {
display: flex;
align-items: center;
justify-content: center;
font-size: 20upx;
position: absolute;
padding: 2upx 12upx;
border-radius: 8upx;
background-color: #eb5232;
color: #fff;
position: absolute;
top: -14upx;
right: -8upx;
.label {
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.operation-wrap {
display: flex;
align-items: center;
.langcover {
position: relative;
}
.num {
font-size: 32upx;
padding: 0 16upx;
.langcover::after {
content: '加载中..';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #e8e8e8;
color: #6b6b6b;
border-radius: 10rpx;
text-align: center;
line-height: 180rpx;
z-index: 1;
}
.info {
flex: 1;
padding-left: 20rpx;
.name {
font-size: 28upx;
font-weight: bold;
color: #333;
margin-bottom: 5rpx;
}
.btn {
position: relative;
.select-sku-wrap {
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.price-wrap {
margin-top: 16rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
justify-content: space-between;
.btnClick {
width: 100rpx;
height: 100rpx;
position: absolute;
// bottom: 0;
.price {
display: flex;
align-items: flex-end;
.i,
.num {
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.i {
position: relative;
bottom: 4upx;
}
.price {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
.originalprice {
margin-left: 10rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 20rpx;
text-decoration: line-through;
}
.unit {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 36rpx;
color: #333333;
}
.lineThrough {
font-weight: normal;
text-decoration: line-through;
color: #999 !important;
font-size: 24rpx !important;
}
}
.btnClick.l {
right: 0;
.sku-wrap {
padding: 6upx 16upx;
background-color: #ffd100;
border-radius: 12upx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.t {
font-size: 24upx;
font-weight: bold;
}
.dot {
display: flex;
align-items: center;
justify-content: center;
font-size: 20upx;
position: absolute;
padding: 2upx 12upx;
border-radius: 8upx;
background-color: #eb5232;
color: #fff;
position: absolute;
top: -14upx;
right: -8upx;
}
}
.btnClick.r {
left: 0;
.operation-wrap {
display: flex;
align-items: center;
.num {
font-size: 32upx;
padding: 0 16upx;
}
.btn {
position: relative;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.btnClick {
width: 100rpx;
height: 100rpx;
position: absolute;
// bottom: 0;
}
.btnClick.l {
right: 0;
}
.btnClick.r {
left: 0;
}
}
}
}
}
@ -499,22 +522,19 @@
}
.card {
// background-color: #fff;
border-radius: 20upx;
margin-bottom: 28upx;
position: relative;
.cardcalorders {
position: relative;
margin: 40rpx 0 20rpx;
padding: 20rpx 0;
font-size: 35rpx;
text-align: left;
font-weight: bold;
color: #000000;
border-bottom: 1rpx solid #cecece;
color: #000;
.absolute {
position: absolute;
right: 28rpx;
right: 0;
top: 2rpx;
font-size: 24rpx;
}
@ -524,23 +544,22 @@
display: flex;
flex-direction: column;
position: relative;
padding-right: 20rpx;
.head {
display: flex;
justify-content: space-between;
// padding: 32rpx 0;
.head_left {
width: 100%;
display: flex;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1rpx solid #cecece;
.placeNum {
font-weight: bold;
font-size: 32rpx;
color: #333333;
font-weight: 700;
font-size: 27rpx;
color: #3e3d3d;
}
.placeTime {
@ -599,7 +618,6 @@
display: flex;
flex-direction: column;
align-items: flex-end;
padding: 0 28rpx;
.priceAmount {
font-weight: 500;

View File

@ -133,7 +133,7 @@
<view class="list-box">
<view class="left" :style="{top: `${store.height}px`}">
<scroll-view :scroll-into-view="leftIntoView" :scroll-with-animation="false" :scroll-y="true"
:style="{height:`${store.screenHeight - store.height}px`}">
:style="{height:`${store.screenHeight - store.height}px`}" style="padding-bottom: 200rpx;">
<view class="item" v-for="(item,index) in shopProductList.productInfo" :key="index"
:class="{ 'active':index==leftIndex }" :id="'left-'+index" :data-index="index"
@click="leftTap(index)"><text>{{item.name}}</text></view>
@ -243,9 +243,9 @@
<!-- 店铺详情 -->
<shopindex ref="showShopInfoRef"></shopindex>
<!-- 购物车 -->
<shoppingCartes :cartLists_count="cartLists_count" v-if="matchedProducts.length>0" :cartList="matchedProducts"
:showCart="showCart" @customevent='websocketsendMessage' @close="showCart = !showCart"
:orderinfo="orderinfo" @clickcancelOrder='clickcancelOrder'>
<shoppingCartes :cartLists_count="cartLists_count" :cartList="matchedProducts" :showCart="showCart"
@customevent='websocketsendMessage' @close="showCart = !showCart" :orderinfo="orderinfo"
@clickcancelOrder='clickcancelOrder' v-if="cartLists_count > 0">
</shoppingCartes>
<!-- 显示购物车栏 -->
@ -353,7 +353,6 @@
</text>
</view>
<view class="operation-wrap">
<view class="btn">
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
@ -677,13 +676,11 @@
specInfo: selectedSpecsStr.value,
id: specifications.item.id
});
// console.log(result)
if (result != true) {
specifications.sku_id = result.id
specifications.product_id = result.productId
//
specifications.item.result = result
// console.log(specifications.item)
if (result.isPauseSale == 0) {
canSubmit.value = true;
} else {
@ -778,11 +775,15 @@
//
const shopCart = async (i) => {
if (i == '-' && shopCartNumber.value >= 0) {
shopCartNumber.value = 0
return false;
}
let res = await shoppingcart()
if (i == '-') {
if (!res && shopCartNumber.value == specifications.item.suitNum) {
uni.showToast({
title: `起点${specifications.item.suitNum}`,
title: `起点${specifications.item.suitNum}`,
icon: 'none'
})
return false;
@ -859,7 +860,6 @@
//
return result;
} else if (specifications.item.type == 'sku') {
// console.log(product,data, 'product,data')
//
return product.cartListinfo.sku_id == data.id && product.cartListinfo.product_id == data
.productId
@ -897,41 +897,50 @@
//
const submitSelection = async () => {
// 0
if (shopCartNumber.value <= 0) {
return;
}
let res = await shoppingcart()
console.log(res)
if ((specifications.item.type == 'package' && allConditionsSatisfied.value) || (specifications.item.type ==
'sku' && canSubmit.value)) {
let res = await shoppingcart()
//
if (specifications.item.type != "package") {
//
if (specifications.item.type != "package") {
selectedGroupSnap.value = []
}
websocketsendMessage({
id: res ? res.cartListId : '',
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
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,
pro_group_info: selectedGroupSnap.value,
goods_type: specifications.item.type == "package" ? 'package' : '',
is_print: 1,
product_type: specifications.item.type
})
//
selectedGroupSnap.value = []
showShopsku.value = false
} else {
return;
}
websocketsendMessage({
id: res ? res.cartListId : '',
type: 'shopping',
table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'),
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,
pro_group_info: selectedGroupSnap.value,
goods_type: specifications.item.type == "package" ? 'package' : '',
is_print: 1,
product_type: specifications.item.type
})
//
selectedGroupSnap.value = []
showShopsku.value = false
}
//
const clickspecifications = async (item, index, indexs, type) => {
if (item.isSoldStock == 1 || item.isSaleTime == 0) {
// single- sku- package- weight- coupon-
if (item.isSoldStock == 1 || item.isSaleTime == 0 || item.type == 'single' || item.type == 'weight' || (item.type == 'package' && item.groupType == '0')) {
return false;
}
//
@ -1033,7 +1042,6 @@
initNetworkListener
} = useWebSocket(options);
//
const showCart = ref(false)
@ -1116,6 +1124,9 @@
//
if (Message.operate_type == 'cleanup') {
cartList.value = []
setTimeout(() => {
Historicalorders()
}, 400)
showCart.value = false
}
@ -1138,6 +1149,11 @@
});
}
//
if (Message.operate_type == 'clearOrder') {
Historicalorders()
}
//
if (Message.type == 'product' && Message.data_type == 'product_update' && Message
.operate_type == 'product_update') {
@ -1207,26 +1223,95 @@
})
//
const cartLists_count = computed(() => {
if (matchedProducts.value.length > 0) {
return matchedProducts.value.reduce((sum, item) => {
// cartNumberToAdd
// const num = typeof item.cartNumberToAdd === 'string' ? parseFloat(item.cartNumberToAdd) : item.cartNumberToAdd;
const num = typeof item.cartNumber === 'string' ? parseFloat(item.cartNumber) : item
.cartNumber;
return sum + num;
}, 0);
//
const clickcancelOrder = async (data) => {
if (data.i == 'all') {
await APIcancelOrder({
shopId: uni.cache.get('shopId'),
orderId: orderinfo.value.id,
})
} else {
return 0;
await APIrmPlaceOrder({
shopId: uni.cache.get('shopId'),
orderId: orderinfo.value.id,
placeNum: data.key
})
}
});
Historicalorders()
}
//
//
const orderinfo = ref({})
const confirmorderref = ref(null)
//
const orderdetail = async () => {
try {
await Historicalorders()
} catch (error) {}
confirmordershow.value = true
showCart.value = false
}
//
const Historicalorders = async (W) => {
let res = await APIhistoryOrder({
tableCode: uni.cache.get('tableCode'),
})
orderinfo.value = {
id: res.id,
detailMap: res.detailMap,
placeNum: res.placeNum
}
if (W) {
showCart.value = !showCart.value
}
}
// 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 totalPrices = computed(() => {
//
let cartone = 0
if (orderinfo.value) {
let combinedArray = [];
for (const key in orderinfo.value.detailMap) {
if (orderinfo.value.detailMap.hasOwnProperty(key)) {
let subArray = orderinfo.value.detailMap[key];
combinedArray = [...combinedArray, ...subArray]
}
}
//
cartone = combinedArray.reduce((total, item) => {
// 01
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
// memberPrice
return total + (parseFloat(item.memberPrice || item.price) * parseFloat(item.num - item
.returnNum));
} else {
// salePrice
return total + (parseFloat(item.price || 0) * parseFloat(item.num - item.returnNum));
}
}, 0);
}
console.log(cartone, 'orderinfo.value')
//
let cart = 0
if (matchedProducts.value.length > 0) {
//
let cart = matchedProducts.value.reduce((total, item) => {
cart = matchedProducts.value.reduce((total, item) => {
if (item.type == 'sku') {
item.skuList.forEach((i, t) => {
if (item.cartListinfo.sku_id == i.id) {
@ -1245,56 +1330,29 @@
return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber);
}
}, 0);
return parseFloat(cart.toFixed(2));
} else {
return 0
}
cart = parseFloat(cartone) + parseFloat(cart)
console.log(cart, 'orderinfo.value')
//
return parseFloat(cart.toFixed(2));
});
//
const clickcancelOrder = async (i, key) => {
if (i == 'all') {
await APIcancelOrder({
shopId: uni.cache.get('shopId'),
orderId: orderinfo.id,
})
} else {
await APIrmPlaceOrder({
shopId: uni.cache.get('shopId'),
orderId: orderinfo.id,
placeNum: key
})
}
Historicalorders()
}
//
const cartLists_count = computed(() => {
const combinedOrderInfo = combineOrderInfoDetailMap(orderinfo.value);
const orderInfoCount = combinedOrderInfo.reduce((sum, item) => {
return sum + parseFloat(item.num);
}, 0);
//
const orderinfo = ref({})
const confirmorderref = ref(null)
const matchedProductsCount = matchedProducts.value.reduce((sum, item) => {
const num = typeof item.cartNumber === 'string' ? parseFloat(item.cartNumber) : item
.cartNumber;
return sum + num;
}, 0);
//
const orderdetail = async () => {
try {
await Historicalorders()
} catch (error) {}
confirmordershow.value = true
}
//
const Historicalorders = async (W) => {
let res = await APIhistoryOrder({
tableCode: uni.cache.get('tableCode'),
})
orderinfo.value = {
id: res.id,
detailMap: res.detailMap,
placeNum: res.placeNum
}
if (W) {
showCart.value = !showCart.value
}
}
const totalCount = orderInfoCount + matchedProductsCount;
return parseFloat(totalCount.toFixed(2));
});
// ifcartNumber
const ifcartNumber = computed(() => {
@ -1407,7 +1465,8 @@
// userStore.actionsAPIuser()
//
isDataLoaded.value = true;
//
Historicalorders()
} else {
uni.showToast({
title: '暂无列表数据,请重新扫码',

View File

@ -1,44 +1,6 @@
<template>
<view class="container">
<block v-if="!dataform.queueInfo">
<image class="top_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_bg.png"
mode="aspectFill"></image>
<view class="content">
<image class="top_img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_img.png"
mode="aspectFill"></image>
<view class="head">
<image class="avatar" :src="dataform.shopInfo.logo" mode="aspectFill"></image>
<view class="head_text">
<text class="shopName">{{shopInfo.shopName}}</text>
<text class="tip">{{dataform.shopInfo.status == 1 ? '营业中' : '休息中'}}</text>
</view>
</view>
<view class="center">
<view class="center_head">
<text>餐桌类型</text>
<text>等待桌数</text>
<text>预计等待</text>
</view>
<view class="center_list" v-for="(item,index) in tableList" :key="index">
<view class="w center_list_item">
<text>{{item.name||''}}</text>
<text>{{item.note||''}}</text>
</view>
<view class="w center_list_item">
<text>{{item.waitingCount}}</text>
<text></text>
</view>
<view class="w time">{{item.waitTime}}分钟</view>
</view>
</view>
</view>
<view class="addBtn" @click="dataform.show = true" v-if="dataform.shopInfo.status == 1">
立即排队
</view>
</block>
<block v-else>
<block v-if="dataform.queueInfo">
<view class="result"
style="background: url('https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_su_bg.png') no-repeat center 26rpx / 96%;">
<view class="head">
@ -60,7 +22,7 @@
<view class="footer_item_bom">前方等待桌数</view>
</view>
<view class="footer_item">
<view class="footer_item_top"><text>{{dataform.queueInfo.waitTime||''}}</text><text>分钟</text>
<view class="footer_item_top"><text>{{dataform.queueInfo.waitTime || 0}}</text><text>分钟</text>
</view>
<view class="footer_item_bom">预计等待时长</view>
</view>
@ -73,8 +35,43 @@
取消排队
</view>
</view>
</view>
</block>
<block v-else>
<image class="top_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_bg.png"
mode="aspectFill"></image>
<view class="content">
<image class="top_img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_img.png"
mode="aspectFill"></image>
<view class="head">
<image class="avatar" :src="dataform.shopInfo.logo" mode="aspectFill"></image>
<view class="head_text">
<text class="shopName">{{dataform.shopInfo.shopName}}</text>
<text class="tip">{{dataform.shopInfo.status == 1 ? '营业中' : '休息中'}}</text>
</view>
</view>
<view class="center">
<view class="center_head">
<text>餐桌类型</text>
<text>等待桌数</text>
<text>预计等待</text>
</view>
<view class="center_list" v-for="(item,index) in tableList" :key="index">
<view class="w center_list_item">
<text>{{item.name||''}}</text>
<text>{{item.note||''}}</text>
</view>
<view class="w center_list_item">
<text>{{item.nearNum}}</text>
<text></text>
</view>
<view class="w time">{{item.waitTime}}分钟</view>
</view>
</view>
</view>
<view class="addBtn" @click="dataform.show = true" v-if="dataform.shopInfo.status == 1">
立即排队
</view>
</block>
@ -120,7 +117,8 @@
ref,
onMounted,
getCurrentInstance,
nextTick
nextTick,
onShow
} from 'vue';
//
@ -129,7 +127,8 @@
APIusercallTable,
APIqueuecallTable,
APIqueuedetail,
APIcallTablesubMsg
APIcallTablesubMsg,
APIqueuecancel
} from "@/common/api/subscribeto.js";
//
@ -146,11 +145,10 @@
phone: "",
callTableId: "",
shopInfo: {
logo: '',
shopName: ''
},
queueInfo: null,
shopId: "",
shopId: 29,
queueId: "",
})
@ -164,31 +162,15 @@
return null;
}
//
const getQueueUpState = async () => {
let params = {
shopId: dataform.shopId,
}
if (dataform.queueId) {
params.queueId = dataform.queueId;
}
let res = await APIusercallTable(params)
if (res) {
dataform.shopInfo = res.data.shopInfo;
dataform.queueInfo = res.data.queueInfo;
dataform.queueId = dataform.queueInfo.id;
}
}
//
const getQueueUpList = async () => {
let res = await APIqueuecallTable({
//
const userorderList = async () => {
let res = await APIusercallTable({
shopId: dataform.shopId,
queueId: dataform.queueId
})
if (res) {
queueUpList.value = res.data;
}
tableList.value = res.records
}
//
@ -198,11 +180,11 @@
openId: uni.cache.get('userInfo').wechatOpenId,
})
if (res.queueInfo) {
tableList.value = res.data;
dataform.queueInfo = res.queueInfo;
} else {
getQueueUpState()
userorderList()
}
dataform.shopInfo = res.shopInfo;
}
//
@ -210,7 +192,7 @@
let res = await APIcallTablesubMsg({
openId: uni.cache.get('userInfo').wechatOpenId,
shopId: dataform.shopId,
queueId: dataform.queueId,
queueId: dataform.queueInfo.id,
})
if (res) {
uni.showToast({
@ -238,17 +220,17 @@
});
return;
}
let res = await this.api.getTakeNumber({
openId: uni.cache.get('miniAppOpenId'),
let res = await APIcallTabletakeNumber({
openId: uni.cache.get('userInfo').wechatOpenId,
shopId: dataform.shopId,
phone: dataform.phone,
callTableId: dataform.callTableId,
})
if (res.code == 0) {
if (res) {
dataform.phone = "";
dataform.queueId = res.data.id;
getQueueUpState();
dataform.queueId = res.id;
dataform.show = false;
getQueueUpTablList()
uni.requestSubscribeMessage({
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
"yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM",
@ -264,14 +246,11 @@
//
const cancelTakeNumber = async () => {
let res = await this.api.cancelTakeNumber({
let res = await APIqueuecancel({
queueId: dataform.queueInfo.id,
shopId: dataform.shopId,
})
if (res) {
getQueueUpTablList();
getQueueUpState();
}
getQueueUpTablList();
}
//
@ -281,7 +260,7 @@
//
const close = async () => {
this.phone = "";
dataform.phone = "";
if (tableList.value.length > 0) {
dataform.callTableId = tableList.value[0].id;
}
@ -291,28 +270,28 @@
onMounted(async () => {
await proxy.$onLaunched;
//
const pages = getCurrentPages();
//
const currentPage = pages[pages.length - 1];
//
const options = currentPage.options;
// const pages = getCurrentPages();
// //
// const currentPage = pages[pages.length - 1];
// //
// const options = currentPage.options;
// #ifdef MP-WEIXIN
if (options.q) {
dataform.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
dataform.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
}
// #endif
console.log(dataform.shopId, 11)
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) {
dataform.shopId = getApp().globalData.shopId
}
if (getApp().globalData.queueId) {
dataform.queueId = getApp().globalData.queueId
}
// #endif
// // #ifdef MP-WEIXIN
// if (options.q) {
// dataform.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
// dataform.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
// }
// // #endif
// // #ifdef MP-ALIPAY
// if (getApp().globalData.shopId) {
// dataform.shopId = getApp().globalData.shopId
// }
// if (getApp().globalData.queueId) {
// dataform.queueId = getApp().globalData.queueId
// }
//// #endif
await nextTick()
uni.cache.set('shopId', 29, 30)
getQueueUpTablList();
})
</script>