更新购物车

This commit is contained in:
wwz 2025-03-28 18:29:06 +08:00
parent 75e5fb65be
commit 10a47abe13
12 changed files with 299 additions and 195 deletions

View File

@ -12,7 +12,7 @@ export const APIdistiricttopCommon = (data) => {
//预约到店(店铺列表) //预约到店(店铺列表)
export const APIdistirictsubShopList = (data) => { export const APIdistirictsubShopList = (data) => {
return request({ return request({
url: url + '/distirict/subShopList', url: url + '/user/shopInfo/subList',
method: 'get', method: 'get',
data: data data: data
}) })

51
common/api/subscribeto.js Normal file
View File

@ -0,0 +1,51 @@
// 引入 request 文件
import request from '@/common/api/request.js'
const urlAccount = '/account'
const urlProduct = '/product'
const urlOrder = '/order'
// 获取叫号号码
export const APIcallTabletakeNumber = (data) => {
return request({
url: urlAccount + '/user/callTable/takeNumber',
method: 'post',
data: data
})
}
// 叫号桌型获取
export const APIusercallTable = (data) => {
return request({
url: urlAccount + '/user/callTable',
method: 'get',
data: data
})
}
// 获取叫号队列
export const APIqueuecallTable = (data) => {
return request({
url: urlAccount + '/user/callTable/queue',
method: 'get',
data: data
})
}
// 叫号队列详情
export const APIqueuedetail = (data) => {
return request({
url: urlAccount + '/user/callTable/queue/detail',
method: 'get',
data: data
})
}
// 消息订阅
export const APIcallTablesubMsg = (data) => {
return request({
url: urlAccount + '/user/callTable/subMsg',
method: 'get',
data: data
})
}

View File

@ -1,11 +1,11 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false; // const debug = process.env.NODE_ENV == 'development' ? true : false;
const debug = false; const debug = false
// #ifdef H5 // #ifdef H5
const proxyApi = "/api" const proxyApi = "/api"
// #endif // #endif
// #ifdef MP-WEIXIN || APP || MP-ALIPAY // #ifdef MP-WEIXIN || APP || MP-ALIPAY
const proxyApi = 'https://tapi.cashier.sxczgkj.cn' // 调试地址 const proxyApi = 'http://192.168.1.31' // 调试地址
const proxyApiwws = 'wss://sockets.sxczgkj.com/wss' // 调试地址 const proxyApiwws = 'wss://sockets.sxczgkj.com/wss' // 调试地址
// // 本地 // // 本地

View File

@ -126,7 +126,7 @@
"style": { "style": {
"navigationBarTitleText": "会员支付码" "navigationBarTitleText": "会员支付码"
} }
},{ }, {
"path": "pages/user/member/setPassword", "path": "pages/user/member/setPassword",
"style": { "style": {
"navigationBarTitleText": "密码设置" "navigationBarTitleText": "密码设置"
@ -155,6 +155,12 @@
"style": { "style": {
"navigationBarTitleText": "优惠卷" "navigationBarTitleText": "优惠卷"
} }
},
{
"path": "pages/subscribeto/index",
"style": {
"navigationBarTitleText": "叫号"
}
} }
], ],
"uniIdRouter": {}, "uniIdRouter": {},

View File

@ -1,10 +1,12 @@
<template> <template>
<view class="towcontent flex-between" v-if="district"> <view class="towcontent flex-between" v-if="district">
<view class="towcontent_item flex-colum" v-for="(item,index) in district" :key="index" <view v-for="(item,index) in district" :key="index" @click="clickdistrict(item,index)">
@click="clickdistrict(item,index)"> <view class="towcontent_item flex-colum" v-if="item.isShowMall == 1">
<image :src="item.coverImg" mode="aspectFill"></image> <image :src="item.coverImg" mode="aspectFill"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view>
</view> </view>
</view> </view>
</template> </template>
@ -84,8 +86,8 @@
} }
} }
.towcontent_item:nth-child(1) { // .towcontent_item:nth-child(1) {
margin-left: 0rpx; // margin-left: 0rpx;
} // }
} }
</style> </style>

View File

@ -12,7 +12,7 @@
<!-- 今日上线 --> <!-- 今日上线 -->
<todaylist :todayList='hometoplist.todayProInfo' :salesList="hometoplist.hotRanking"></todaylist> <todaylist :todayList='hometoplist.todayProInfo' :salesList="hometoplist.hotRanking"></todaylist>
<!-- 类目 --> <!-- 类目 -->
<view :style="{'top':store.height+'px'}" class="fourcontent" id="fourcontent"> <!-- <view :style="{'top':store.height+'px'}" class="fourcontent" id="fourcontent">
<view class="flex-between" style="flex-wrap: inherit;"> <view class="flex-between" style="flex-wrap: inherit;">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menuList" :key="index" <view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menuList" :key="index"
@click="viewHistory(item,index)" @click="viewHistory(item,index)"
@ -28,10 +28,9 @@
<grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3" <grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3"
@grouping="openproductlist" /> @grouping="openproductlist" />
</view> </view>
</view> -->
</view>
<!-- 首页抢购区域 --> <!-- 首页抢购区域 -->
<view class="fivecontent"> <!-- <view class="fivecontent">
<view class="fivecontent_item" v-for="(item,index) in formhomelist.list" :key="index" <view class="fivecontent_item" v-for="(item,index) in formhomelist.list" :key="index"
@click="fivecontentclick(item)"> @click="fivecontentclick(item)">
<view class="fivecontent_item_nav flex-start"> <view class="fivecontent_item_nav flex-start">
@ -125,7 +124,7 @@
</view> </view>
</view> </view>
<up-loadmore :status="formhomelist.status" fontSize="14" color="#999" iconSize="14" /> <up-loadmore :status="formhomelist.status" fontSize="14" color="#999" iconSize="14" />
</view> </view> -->
</view> </view>
<indexs v-if="showindex == 'shopIndex'" :shopExtend='orderVIP.shopExtendList'></indexs> <indexs v-if="showindex == 'shopIndex'" :shopExtend='orderVIP.shopExtendList'></indexs>
</view> </view>
@ -469,9 +468,9 @@
background: #fee06a; background: #fee06a;
} }
.fourcontent_item:nth-child(1) { // .fourcontent_item:nth-child(1) {
margin-left: 0; // margin-left: 0;
} // }
} }

View File

@ -127,7 +127,7 @@
address: uni.cache.get('getLocationstorage').address, // address: uni.cache.get('getLocationstorage').address, //
lng: uni.cache.get('getLocationstorage').lng, lng: uni.cache.get('getLocationstorage').lng,
lat: uni.cache.get('getLocationstorage').lat, lat: uni.cache.get('getLocationstorage').lat,
distanceInKm: '10', //10 km distance: '2000', //10 km
isPage: '', // 1 0 isPage: '', // 1 0
page: form.page, // page: form.page, //
size: form.size, // size: form.size, //
@ -160,7 +160,7 @@
}); });
onMounted(() => { onMounted(() => {
init_fn() init_fn()
distiricttopCommon() // distiricttopCommon()
}) })
onReachBottom(() => { onReachBottom(() => {
distirictsubShopList() distirictsubShopList()
@ -246,10 +246,10 @@
border-radius: 24rpx 0rpx 0rpx 0rpx; border-radius: 24rpx 0rpx 0rpx 0rpx;
background: #F9F9F9; background: #F9F9F9;
.fivecontent_item:nth-child(1) { // .fivecontent_item:nth-child(1) {
margin-top: 0; // margin-top: 0;
} // }
.fivecontent_item { .fivecontent_item {
background: #FFFFFF; background: #FFFFFF;

View File

@ -442,6 +442,7 @@
buyerRemark: '', buyerRemark: '',
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, // seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //
}) })
orderorderInfo()
return false; return false;
} else { } else {
let checkOrderPay = { let checkOrderPay = {

View File

@ -7,7 +7,6 @@
<scroll-view scroll-y class="scroll-view"> <scroll-view scroll-y class="scroll-view">
<view class="head"> <view class="head">
<view class="head_bg"></view> <view class="head_bg"></view>
<!-- <view class="tips" v-if="shopInfo.registerType == 'before'"> -->
<view class="tips"> <view class="tips">
<image class="informIcon" <image class="informIcon"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png"
@ -65,32 +64,27 @@
<image class="img" :src="item.coverImg" mode="aspectFill" /> <image class="img" :src="item.coverImg" mode="aspectFill" />
<view class="center"> <view class="center">
<text class="center_title"> {{item.name}} </text> <text class="center_title"> {{item.name}} </text>
<text class="type" v-if="item.skuList"> <text class="type" v-if="item.skuList && item.type == 'sku'">
<text v-for="i in item.skuList" :key="i.id"> <text v-for="i in item.skuList" :key="i.id">
{{item.id == i.productId && item.skuId == i.id ? i.specInfo :""}} {{item.cartListinfo.sku_id == i.id ? i.name :""}}
</text> </text>
</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;">
{{i.proName }}
</text>
</text>
</text>
<text class="num"> X{{ ifcartNumber(item) }}</text> <text class="num"> X{{ ifcartNumber(item) }}</text>
</view> </view>
</view> </view>
<text <text class="price">
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}</text> {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}
</text>
</view> </view>
<!-- 餐位费 -->
<view class="cell-item" v-if="shopTable.useNum>0">
<view class="label">餐位费</view>
<view class="val">
<view>X{{shopTable.seatNum}}</view>
<view style="font-size: 28rpx;"></view>
<view>{{Seatcharge}}</view>
</view>
</view>
<!-- <view class="totalPrice">
<text style="margin-bottom: 5rpx;">小计</text>
<text class="totalPriceNum"> {{totalCost}} </text>
</view> -->
<!-- <u-divider color="#fa3534" half-width="200" border-color="#6d6d6d">姑苏城外寒山寺</u-divider> -->
</view> </view>
</view> </view>
@ -103,28 +97,12 @@
</view> </view>
</view> </view>
<!-- 支付方式 -->
<!-- <view style="padding: 0 20rpx;" v-if="shopInfo.registerType == 'before'">
<paymentMethod ref="paymentMethodref" @groupChange="groupChange">
</paymentMethod>
</view> -->
<!-- boutton -->
<view style="width: 100%;height: 200rpx;"> </view> <view style="width: 100%;height: 200rpx;"> </view>
<view class="bottom"> <view class="bottom">
<view class="bottom_left"> <view class="bottom_left">
<text style="margin-bottom: 5rpx;">实付金额</text> <text style="margin-bottom: 5rpx;">实付金额</text>
<text class="totalAmount">{{ totalPrices }} </text> <text class="totalAmount">{{ totalPrices }} </text>
</view> </view>
<!-- <block v-if="shopInfo.registerType == 'before'">
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-if="shopInfo">
{{ paymentmethod.paymentBtnText }}
</view>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else>
{{ paymentmethod.paymentBtnText }}
</view>
</block>
<block v-if="shopInfo.registerType == 'after'"> -->
<block> <block>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)"> 提交订单 </view> <view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)"> 提交订单 </view>
</block> </block>
@ -231,7 +209,7 @@
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) { if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
// memberPrice // memberPrice
return total + parseFloat(item.memberPrice || item.salePrice) * parseFloat(item return total + parseFloat(item.memberPrice || item.salePrice) * parseFloat(item
.cartNumber); .cartNumber);
} else { } else {
// salePrice // salePrice
return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber); return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber);
@ -353,7 +331,17 @@
// } // }
} }
const dataprocessing = computed(() => {
return (item) => {
let res = null
try {
res = JSON.parse(item.pro_group_info)
} catch (error) {
//TODO handle the exception
}
return res
};
})
const thisdata = reactive({ const thisdata = reactive({
opacitys: false, opacitys: false,

View File

@ -141,23 +141,26 @@
} }
// //
const cartListadd = async (item, i) => { const cartListadd = async (item, i) => {
// 1
const cartNumberFloat = parseFloat(item.cartNumber);
const suitNum = item.suitNum >= cartNumberFloat && i == '-' ? item.cartNumber : 1;
emits('customevent', { emits('customevent', {
id: item.cartListId ? item.cartListId : '', id: item.cartListId ? item.cartListId : '',
type: 'shopping', type: 'shopping',
table_code: uni.cache.get('tableCode'), table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'), shop_id: uni.cache.get('shopId'),
operate_type: calculateValue(item.cartNumber, i) == 'del' ? 'del' : item.cartListId && operate_type: calculateValue(item.cartNumber, i, suitNum) == 'del' ? 'del' : item.cartListId &&
item.cartNumber > 0 ? 'edit' : 'add', item.cartNumber > 0 ? 'edit' : 'add',
product_id: item.id, product_id: item.id,
sku_id: item.skuId, sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i), number: await calculateValue(item.cartNumber, i, suitNum),
is_print: 1, is_print: 1,
}) })
} }
const dataprocessing = computed(() => { const dataprocessing = computed(() => {
return (item) => { return (item) => {
console.log(item.pro_group_info)
let res = null let res = null
try { try {
res = JSON.parse(item.pro_group_info) res = JSON.parse(item.pro_group_info)
@ -168,16 +171,16 @@
}; };
}) })
//
const calculateValue = (cartNumber, i, step = 1) => { const calculateValue = (cartNumber, i, step = 1) => {
if (i == '+') { if (i == '+') {
const result = parseFloat(cartNumber) + step; const result = parseFloat(cartNumber) + parseFloat(step);
return result.toFixed(2); return result.toFixed(2);
} else { } else {
const result = parseFloat(cartNumber) - step; // 0del
const result = parseFloat(cartNumber) - parseFloat(step);
return result == 0 ? 'del' : result.toFixed(2); return result == 0 ? 'del' : result.toFixed(2);
} }
}; }
// //
const productBlur = (item) => { const productBlur = (item) => {

View File

@ -43,6 +43,9 @@
<view class="panelfiveitemthere flex-start"> <view class="panelfiveitemthere flex-start">
<text>招牌</text> <text>招牌</text>
</view> </view>
<view class="describe" v-if="item.suitNum>1 && item.type!= 'sku'" style="font-size: 20rpx;">
{{item.suitNum}}{{item.unitName}}起点
</view>
<!-- <view class="panelfiveitemfour"> <!-- <view class="panelfiveitemfour">
{{item.shortTitle?item.shortTitle:''}} {{item.shortTitle?item.shortTitle:''}}
</view> </view>
@ -56,10 +59,9 @@
<text class="tips" <text class="tips"
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text> :class="shopInfo.isVip == 0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
<!-- 会员价与价格 --> <!-- 会员价与价格 -->
<text <text class="price">
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}</text> {{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> <text class="unit" v-if="item.unitName">/{{item.unitName}}</text>
</view> </view>
@ -72,18 +74,19 @@
</view> </view>
</view> </view>
<view v-else class="flex-between" style="margin-top: 32rpx;margin-bottom: 48rpx;"> <view v-else class="flex-between"
style="margin-top: 32rpx;margin-bottom: 48rpx; flex-wrap: inherit">
<view class="panelfiveitemsex flex-between"> <view class="panelfiveitemsex flex-between">
<view class="panelfiveitemsex_oen"> <view class="panelfiveitemsex_oen">
<text class="tips" <text class="tips"
:class="shopInfo.isVip ==0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text> :class="shopInfo.isVip ==0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
<!-- 会员价与价格 --> <!-- 会员价与价格 -->
<text <text class="price">
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice|| item.salePrice):item.salePrice}}</text> {{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> <text class="unit" v-if="item.unitName">/{{item.unitName}}</text>
<!-- <text v-if="item.suitNum>1 && item.type!= 'sku'"
style="font-size: 16rpx;">{{item.suitNum}}{{item.unitName}}起点</text> -->
</view> </view>
</view> </view>
<!-- single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券 --> <!-- single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券 -->
@ -105,8 +108,6 @@
</view> </view>
</view> </view>
<text class="num"> {{ ifcartNumber(item) }} </text> <text class="num"> {{ ifcartNumber(item) }} </text>
<!-- <text class="dot num"
v-if="item.suitNum>1">{{item.suitNum<99?item.suitNum:'99+'}}</text> -->
<view class="btn"> <view class="btn">
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon> <up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
<view class="btnClick" <view class="btnClick"
@ -162,6 +163,11 @@
<view class="lookBack" v-if="specifications.item.isHot == 1">热销</view> <view class="lookBack" v-if="specifications.item.isHot == 1">热销</view>
<view class="describe"> {{item1.shortTitle?item1.shortTitle:''}} </view> <view class="describe"> {{item1.shortTitle?item1.shortTitle:''}} </view>
<view class="describe" v-if="item1.suitNum>1 && item1.type!= 'sku'"
style="font-size: 20rpx;">
{{item1.suitNum}}{{item1.unitName}}起点
</view>
<view v-if="item1.isSoldStock == 1 || item1.isSaleTime == 0" class="flex-between"> <view v-if="item1.isSoldStock == 1 || item1.isSaleTime == 0" class="flex-between">
<view class="money"> <view class="money">
<view></view> <view></view>
@ -177,13 +183,17 @@
</view> </view>
</view> </view>
</view> </view>
<view v-else class="flex-between"> <view v-else class="flex-between" style="flex-wrap: inherit;">
<view class="money"> <view class="money">
<view></view> <view></view>
<text class="money_num" style="margin-right: 10rpx;"> <text class="money_num">
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item1.memberPrice||item1.salePrice):item1.salePrice}} {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item1.memberPrice||item1.salePrice):item1.salePrice}}
</text> </text>
<text v-if="item1.unitName">/{{item1.unitName}}</text> <text class="money_num" v-if="item1.unitName">/{{item1.unitName}}</text>
<!-- <text v-if="item1.suitNum>1 && item1.type!= 'sku'"
style="font-size: 14rpx;">
{{item1.suitNum}}{{item1.unitName}}起点
</text> -->
</view> </view>
<view class="flex-end" <view class="flex-end"
v-if="item1.type == 'sku' || (item1.type == 'package' && item1.groupType == '1')"> v-if="item1.type == 'sku' || (item1.type == 'package' && item1.groupType == '1')">
@ -233,8 +243,8 @@
<!-- 店铺详情 --> <!-- 店铺详情 -->
<shopindex ref="showShopInfoRef"></shopindex> <shopindex ref="showShopInfoRef"></shopindex>
<!-- 购物车 --> <!-- 购物车 -->
<shoppingCartes :cartLists_count="cartLists_count" :cartList="matchedProducts" :showCart="showCart" <shoppingCartes :cartLists_count="cartLists_count" v-if="matchedProducts.length>0" :cartList="matchedProducts"
@customevent='websocketsendMessage' @close="showCart = !showCart"> :showCart="showCart" @customevent='websocketsendMessage' @close="showCart = !showCart">
</shoppingCartes> </shoppingCartes>
<!-- 显示购物车栏 --> <!-- 显示购物车栏 -->
@ -325,12 +335,21 @@
<text <text
class="num">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.result.memberPrice||specifications.item.result.salePrice):specifications.item.result.salePrice}}</text> class="num">{{shopInfo.isVip ==1 && shopInfo.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 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>
<view class="price" v-else> <view class="price" v-else>
<text class="i"></text> <text class="i"></text>
<text <text class="num">
class="num">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.memberPrice||specifications.item.salePrice):specifications.item.salePrice}}</text> {{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.memberPrice||specifications.item.salePrice):specifications.item.salePrice}}
<text class="i" v-if="specifications.item.unitName">/{{specifications.item.unitName}}</text> </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>
@ -393,6 +412,7 @@
import shoppingCartes from './components/shoppingCartes.vue' import shoppingCartes from './components/shoppingCartes.vue'
import confirmorder from './components/confirmorder.vue' import confirmorder from './components/confirmorder.vue'
import Loading from '@/components/Loading.vue'; import Loading from '@/components/Loading.vue';
// //
const { const {
proxy proxy
@ -468,9 +488,7 @@
try { try {
const shopExtend = uni.cache.get('shopTable').shopExtendMap.shopinfo_bg const shopExtend = uni.cache.get('shopTable').shopExtendMap.shopinfo_bg
} catch (error) { } catch (error) {}
//TODO handle the exception
}
// //
const navScroll = ref(null) const navScroll = ref(null)
@ -591,11 +609,6 @@
uni.$u.debounce(store.scrollTop = res.scrollTop, 500) uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
uni.$u.debounce(navScroll.value = res.scrollTop, 500) uni.$u.debounce(navScroll.value = res.scrollTop, 500)
uni.$u.debounce(mainScroll(res), 500) uni.$u.debounce(mainScroll(res), 500)
if (res.scrollTop >= 44) {
// store.showSearch = true
} else {
// store.showSearch = false
}
}); });
// //
@ -683,8 +696,6 @@
} }
}; };
//
// specifications // specifications
watch( watch(
() => specifications.item.groupSnap, () => specifications.item.groupSnap,
@ -695,7 +706,6 @@
} }
); );
// //
const selectedOptions = ref( const selectedOptions = ref(
specifications.item.groupSnap.map(() => []) specifications.item.groupSnap.map(() => [])
@ -763,12 +773,25 @@
// //
const shopCartNumber = ref(0) const shopCartNumber = ref(0)
// //
const shopCart = (i) => { const shopCart = async (i) => {
if (i == '+') { let res = await shoppingcart()
shopCartNumber.value++; if (i == '-') {
if (!res && shopCartNumber.value == specifications.item.suitNum) {
uni.showToast({
title: `起点${specifications.item.suitNum}`,
icon: 'none'
})
return false;
} else {
shopCartNumber.value--;
}
} else { } else {
shopCartNumber.value--; if (!res && shopCartNumber.value < 1) {
shopCartNumber.value = parseFloat(specifications.item.suitNum);
} else {
shopCartNumber.value++;
}
} }
} }
@ -844,62 +867,65 @@
}); });
} }
//
const shoppingcart = async () => {
let res = null
if (specifications.item.type == "package") {
if (!allConditionsSatisfied.value) {
return false
}
// package
selectedGroupSnap.value = specifications.item.groupSnap.map((setmenu, index) => {
return {
...setmenu,
goods: selectedOptions.value[index]
};
});
res = await matchingProduct(selectedGroupSnap.value)
} else {
if (!canSubmit.value) {
return false
}
res = await matchingProduct(specifications.item.result)
}
return res;
}
// //
const submitSelection = async () => { const submitSelection = async () => {
if (shopCartNumber.value <= 0) {
return;
}
let res = await shoppingcart()
console.log(res)
if (shopCartNumber.value > 0) { //
let res = null if (specifications.item.type != "package") {
if (specifications.item.type == "package") {
if (!allConditionsSatisfied.value) {
return false
}
// package
selectedGroupSnap.value = specifications.item.groupSnap.map((setmenu, index) => {
return {
...setmenu,
goods: selectedOptions.value[index]
};
});
res = await matchingProduct(selectedGroupSnap.value)
} else {
if (!canSubmit.value) {
return false
}
res = await matchingProduct(specifications.item.result)
}
console.log(res, 'res')
if (res) {
await calculateValue(res.cartNumber, '+', shopCartNumber.value)
}
//
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 = [] selectedGroupSnap.value = []
showShopsku.value = false
} }
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) => { const clickspecifications = async (item, index, indexs, type) => {
if (item.isSoldStock == 1 || item.isSaleTime == 0) { if (item.isSoldStock == 1 || item.isSaleTime == 0) {
@ -939,6 +965,7 @@
// //
const singleclick = async (item, i) => { const singleclick = async (item, i) => {
console.log(item)
// //
let res = null let res = null
try { try {
@ -948,15 +975,24 @@
} catch (error) { } catch (error) {
//TODO handle the exception //TODO handle the exception
} }
// 1
let suitNum = 1;
const cartNumberFloat = parseFloat(item.cartNumber);
if (!res && item.suitNum > cartNumberFloat) {
suitNum = item.suitNum;
} else if (item.suitNum >= cartNumberFloat && i === '-') {
suitNum = item.cartNumber;
}
websocketsendMessage({ websocketsendMessage({
id: res ? item.cartListId : '', id: res ? item.cartListId : '',
type: 'shopping', type: 'shopping',
table_code: uni.cache.get('tableCode'), table_code: uni.cache.get('tableCode'),
shop_id: uni.cache.get('shopId'), shop_id: uni.cache.get('shopId'),
operate_type: await calculateValue(item.cartNumber, i) == 'del' ? 'del' : res ? 'edit' : 'add', operate_type: await calculateValue(item.cartNumber, i, suitNum) == 'del' ? 'del' : res ?
'edit' : 'add',
product_id: item.id, product_id: item.id,
sku_id: item.skuId, sku_id: item.skuId,
number: await calculateValue(item.cartNumber, i), number: await calculateValue(item.cartNumber, i, suitNum),
is_print: 1, is_print: 1,
product_type: item.type product_type: item.type
}) })
@ -1379,11 +1415,12 @@
} else { } else {
uni.showToast({ uni.showToast({
title: '暂无列表数据...' title: '暂无列表数据,请重新扫码',
icon: "none"
}); });
isDataLoaded.value = false; isDataLoaded.value = false;
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.pro.switchTab('index/index')
}, 1000) }, 1000)
return false; return false;
} }

View File

@ -123,6 +123,20 @@
nextTick nextTick
} from 'vue'; } from 'vue';
//
import {
APIcallTabletakeNumber,
APIusercallTable,
APIqueuecallTable,
APIqueuedetail,
APIcallTablesubMsg
} from "@/common/api/subscribeto.js";
//
const {
proxy
} = getCurrentInstance();
const queueUpList = ref([]) const queueUpList = ref([])
const tableList = ref([]) const tableList = ref([])
@ -131,7 +145,10 @@
show: false, show: false,
phone: "", phone: "",
callTableId: "", callTableId: "",
shopInfo: null, shopInfo: {
logo: '',
shopName: ''
},
queueInfo: null, queueInfo: null,
shopId: "", shopId: "",
queueId: "", queueId: "",
@ -150,15 +167,14 @@
// //
const getQueueUpState = async () => { const getQueueUpState = async () => {
let params = { let params = {
openId: uni.cache.get('miniAppOpenId'), shopId: dataform.shopId,
shopId: this.shopId,
} }
if (this.queueId) { if (dataform.queueId) {
params.queueId = this.queueId; params.queueId = dataform.queueId;
} }
let res = await this.api.getQueueUpState(params) let res = await APIusercallTable(params)
if (res.code == 0) { if (res) {
dataform.shopInfo = res.data.shopInfo; dataform.shopInfo = res.data.shopInfo;
dataform.queueInfo = res.data.queueInfo; dataform.queueInfo = res.data.queueInfo;
dataform.queueId = dataform.queueInfo.id; dataform.queueId = dataform.queueInfo.id;
@ -167,34 +183,36 @@
// //
const getQueueUpList = async () => { const getQueueUpList = async () => {
let res = await this.api.getQueueUpList({ let res = await APIqueuecallTable({
openId: uni.cache.get('miniAppOpenId'), shopId: dataform.shopId,
shopId: this.shopId,
}) })
if (res.code == 0 && res.data.length > 0) { if (res) {
queueUpList.value = res.data; queueUpList.value = res.data;
} }
} }
// //
const getQueueUpTablList = async () => { const getQueueUpTablList = async () => {
let res = await this.api.getQueueUpTablList({ let res = await APIqueuedetail({
shopId: this.shopId, shopId: dataform.shopId,
openId: uni.cache.get('userInfo').wechatOpenId,
}) })
if (res.code == 0 && res.data.length > 0) { if (res.queueInfo) {
tableList.value = res.data; tableList.value = res.data;
dataform.callTableId = res.data[0].id;
} else {
getQueueUpState()
} }
} }
// //
const subscribe = async () => { const subscribe = async () => {
let res = await this.api.setSubMsg({ let res = await APIcallTablesubMsg({
openId: uni.cache.get('miniAppOpenId'), openId: uni.cache.get('userInfo').wechatOpenId,
shopId: this.shopId, shopId: dataform.shopId,
queueId: this.queueId, queueId: dataform.queueId,
}) })
if (res.code == 0) { if (res) {
uni.showToast({ uni.showToast({
title: '订阅成功', title: '订阅成功',
icon: 'none' icon: 'none'
@ -229,7 +247,7 @@
if (res.code == 0) { if (res.code == 0) {
dataform.phone = ""; dataform.phone = "";
dataform.queueId = res.data.id; dataform.queueId = res.data.id;
this.getQueueUpState(); getQueueUpState();
dataform.show = false; dataform.show = false;
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw", tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
@ -248,15 +266,20 @@
const cancelTakeNumber = async () => { const cancelTakeNumber = async () => {
let res = await this.api.cancelTakeNumber({ let res = await this.api.cancelTakeNumber({
queueId: dataform.queueInfo.id, queueId: dataform.queueInfo.id,
shopId: this.shopId, shopId: dataform.shopId,
}) })
if (res.code == 0) { if (res) {
this.getQueueUpTablList(); getQueueUpTablList();
this.getQueueUpState(); getQueueUpState();
} }
} }
// //
const tableCut = (item) => {
dataform.callTableId = item.id;
}
//
const close = async () => { const close = async () => {
this.phone = ""; this.phone = "";
if (tableList.value.length > 0) { if (tableList.value.length > 0) {
@ -265,11 +288,6 @@
dataform.show = false; dataform.show = false;
} }
//
const tableCut = async (item) => {
dataform.callTableId = item.id;
}
onMounted(async () => { onMounted(async () => {
await proxy.$onLaunched; await proxy.$onLaunched;
// //
@ -281,22 +299,21 @@
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if (options.q) { if (options.q) {
this.shopId = getQueryString(decodeURIComponent(options.q), 'shopId') dataform.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
this.queueId = getQueryString(decodeURIComponent(options.q), 'queueId') dataform.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
} }
// #endif // #endif
console.log(dataform.shopId, 11)
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { if (getApp().globalData.shopId) {
this.shopId = getApp().globalData.shopId dataform.shopId = getApp().globalData.shopId
} }
if (getApp().globalData.queueId) { if (getApp().globalData.queueId) {
this.queueId = getApp().globalData.queueId dataform.queueId = getApp().globalData.queueId
} }
// #endif // #endif
await nextTick() await nextTick()
this.getQueueUpState(); getQueueUpTablList();
this.getQueueUpTablList();
}) })
</script> </script>