更新购物车
This commit is contained in:
parent
75e5fb65be
commit
10a47abe13
|
|
@ -12,7 +12,7 @@ export const APIdistiricttopCommon = (data) => {
|
|||
//预约到店(店铺列表)
|
||||
export const APIdistirictsubShopList = (data) => {
|
||||
return request({
|
||||
url: url + '/distirict/subShopList',
|
||||
url: url + '/user/shopInfo/subList',
|
||||
method: 'get',
|
||||
data: data
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||
const debug = false;
|
||||
const debug = false
|
||||
// #ifdef H5
|
||||
const proxyApi = "/api"
|
||||
// #endif
|
||||
|
||||
// #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' // 调试地址
|
||||
|
||||
// // 本地
|
||||
|
|
|
|||
10
pages.json
10
pages.json
|
|
@ -46,7 +46,7 @@
|
|||
"navigationBarTitleText": "红包中心"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"path": "pages/product/index",
|
||||
"style": {
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "会员支付码"
|
||||
}
|
||||
},{
|
||||
}, {
|
||||
"path": "pages/user/member/setPassword",
|
||||
"style": {
|
||||
"navigationBarTitleText": "密码设置"
|
||||
|
|
@ -155,6 +155,12 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "优惠卷"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/subscribeto/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "叫号"
|
||||
}
|
||||
}
|
||||
],
|
||||
"uniIdRouter": {},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<template>
|
||||
<view class="towcontent flex-between" v-if="district">
|
||||
<view class="towcontent_item flex-colum" v-for="(item,index) in district" :key="index"
|
||||
@click="clickdistrict(item,index)">
|
||||
<image :src="item.coverImg" mode="aspectFill"></image>
|
||||
<text>{{item.name}}</text>
|
||||
<view v-for="(item,index) in district" :key="index" @click="clickdistrict(item,index)">
|
||||
<view class="towcontent_item flex-colum" v-if="item.isShowMall == 1">
|
||||
<image :src="item.coverImg" mode="aspectFill"></image>
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -84,8 +86,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
.towcontent_item:nth-child(1) {
|
||||
margin-left: 0rpx;
|
||||
}
|
||||
// .towcontent_item:nth-child(1) {
|
||||
// margin-left: 0rpx;
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<!-- 今日上线 -->
|
||||
<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="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menuList" :key="index"
|
||||
@click="viewHistory(item,index)"
|
||||
|
|
@ -28,10 +28,9 @@
|
|||
<grouping v-if="viewHistoryindex == 1 || viewHistoryindex == 2 || viewHistoryindex == 3"
|
||||
@grouping="openproductlist" />
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 首页抢购区域 -->
|
||||
<view class="fivecontent">
|
||||
<!-- <view class="fivecontent">
|
||||
<view class="fivecontent_item" v-for="(item,index) in formhomelist.list" :key="index"
|
||||
@click="fivecontentclick(item)">
|
||||
<view class="fivecontent_item_nav flex-start">
|
||||
|
|
@ -125,7 +124,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<up-loadmore :status="formhomelist.status" fontSize="14" color="#999" iconSize="14" />
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<indexs v-if="showindex == 'shopIndex'" :shopExtend='orderVIP.shopExtendList'></indexs>
|
||||
</view>
|
||||
|
|
@ -469,9 +468,9 @@
|
|||
background: #fee06a;
|
||||
}
|
||||
|
||||
.fourcontent_item:nth-child(1) {
|
||||
margin-left: 0;
|
||||
}
|
||||
// .fourcontent_item:nth-child(1) {
|
||||
// margin-left: 0;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
address: uni.cache.get('getLocationstorage').address, //地址
|
||||
lng: uni.cache.get('getLocationstorage').lng,
|
||||
lat: uni.cache.get('getLocationstorage').lat,
|
||||
distanceInKm: '10', //默认10 以经纬度为中心 多大范围以内 单位km
|
||||
distance: '2000', //默认10 以经纬度为中心 多大范围以内 单位km
|
||||
isPage: '', //是否分页 1分页 0不分页
|
||||
page: form.page, //页数
|
||||
size: form.size, //页容量
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
});
|
||||
onMounted(() => {
|
||||
init_fn()
|
||||
distiricttopCommon()
|
||||
// distiricttopCommon()
|
||||
})
|
||||
onReachBottom(() => {
|
||||
distirictsubShopList()
|
||||
|
|
@ -246,10 +246,10 @@
|
|||
border-radius: 24rpx 0rpx 0rpx 0rpx;
|
||||
background: #F9F9F9;
|
||||
|
||||
.fivecontent_item:nth-child(1) {
|
||||
margin-top: 0;
|
||||
// .fivecontent_item:nth-child(1) {
|
||||
// margin-top: 0;
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
.fivecontent_item {
|
||||
background: #FFFFFF;
|
||||
|
|
|
|||
|
|
@ -442,6 +442,7 @@
|
|||
buyerRemark: '',
|
||||
seatNum: is_type.value == 0 ? listinfo.seatNum : 0, //用餐人数
|
||||
})
|
||||
orderorderInfo()
|
||||
return false;
|
||||
} else {
|
||||
let checkOrderPay = {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
<scroll-view scroll-y class="scroll-view">
|
||||
<view class="head">
|
||||
<view class="head_bg"></view>
|
||||
<!-- <view class="tips" v-if="shopInfo.registerType == 'before'"> -->
|
||||
<view class="tips">
|
||||
<image class="informIcon"
|
||||
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" />
|
||||
<view class="center">
|
||||
<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">
|
||||
{{item.id == i.productId && item.skuId == i.id ? i.specInfo :""}}
|
||||
{{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;">
|
||||
{{i.proName }}
|
||||
</text>
|
||||
</text>
|
||||
</text>
|
||||
|
||||
<text class="num"> X{{ ifcartNumber(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text
|
||||
class="price">¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}</text>
|
||||
<text class="price">
|
||||
¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}
|
||||
</text>
|
||||
</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>
|
||||
|
||||
|
|
@ -103,28 +97,12 @@
|
|||
</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 class="bottom">
|
||||
<view class="bottom_left">
|
||||
<text style="margin-bottom: 5rpx;">实付金额</text>
|
||||
<text class="totalAmount">¥{{ totalPrices }} </text>
|
||||
</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>
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)"> 提交订单 </view>
|
||||
</block>
|
||||
|
|
@ -231,7 +209,7 @@
|
|||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice || item.salePrice) * parseFloat(item
|
||||
.cartNumber);
|
||||
.cartNumber);
|
||||
} else {
|
||||
// salePrice销售价
|
||||
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({
|
||||
opacitys: false,
|
||||
|
|
|
|||
|
|
@ -141,23 +141,26 @@
|
|||
}
|
||||
// 购物车加减
|
||||
const cartListadd = async (item, i) => {
|
||||
// 是否起售 如果小于或者大于都是1
|
||||
const cartNumberFloat = parseFloat(item.cartNumber);
|
||||
const suitNum = item.suitNum >= cartNumberFloat && i == '-' ? item.cartNumber : 1;
|
||||
|
||||
emits('customevent', {
|
||||
id: item.cartListId ? item.cartListId : '',
|
||||
type: 'shopping',
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
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',
|
||||
product_id: item.id,
|
||||
sku_id: item.skuId,
|
||||
number: await calculateValue(item.cartNumber, i),
|
||||
number: await calculateValue(item.cartNumber, i, suitNum),
|
||||
is_print: 1,
|
||||
})
|
||||
}
|
||||
|
||||
const dataprocessing = computed(() => {
|
||||
return (item) => {
|
||||
console.log(item.pro_group_info)
|
||||
let res = null
|
||||
try {
|
||||
res = JSON.parse(item.pro_group_info)
|
||||
|
|
@ -168,16 +171,16 @@
|
|||
};
|
||||
})
|
||||
|
||||
// 封装加法函数
|
||||
const calculateValue = (cartNumber, i, step = 1) => {
|
||||
if (i == '+') {
|
||||
const result = parseFloat(cartNumber) + step;
|
||||
const result = parseFloat(cartNumber) + parseFloat(step);
|
||||
return result.toFixed(2);
|
||||
} else {
|
||||
const result = parseFloat(cartNumber) - step;
|
||||
// 当减到0返回del
|
||||
const result = parseFloat(cartNumber) - parseFloat(step);
|
||||
return result == 0 ? 'del' : result.toFixed(2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 菜品备注修改
|
||||
const productBlur = (item) => {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@
|
|||
<view class="panelfiveitemthere flex-start">
|
||||
<text>招牌</text>
|
||||
</view>
|
||||
<view class="describe" v-if="item.suitNum>1 && item.type!= 'sku'" style="font-size: 20rpx;">
|
||||
「{{item.suitNum}}{{item.unitName}}起点」
|
||||
</view>
|
||||
<!-- <view class="panelfiveitemfour">
|
||||
{{item.shortTitle?item.shortTitle:''}}
|
||||
</view>
|
||||
|
|
@ -56,10 +59,9 @@
|
|||
<text class="tips"
|
||||
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
||||
<!-- 会员价与价格 -->
|
||||
<text
|
||||
class="price">{{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="price">
|
||||
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}
|
||||
</text>
|
||||
<!-- 单位 -->
|
||||
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text>
|
||||
</view>
|
||||
|
|
@ -72,18 +74,19 @@
|
|||
</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_oen">
|
||||
<text class="tips"
|
||||
:class="shopInfo.isVip ==0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
||||
<!-- 会员价与价格 -->
|
||||
<text
|
||||
class="price">{{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="price">
|
||||
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice|| item.salePrice):item.salePrice}}
|
||||
</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>
|
||||
<!-- single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券 -->
|
||||
|
|
@ -105,8 +108,6 @@
|
|||
</view>
|
||||
</view>
|
||||
<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">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
<view class="btnClick"
|
||||
|
|
@ -162,6 +163,11 @@
|
|||
<view class="lookBack" v-if="specifications.item.isHot == 1">热销</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 class="money">
|
||||
<view>¥</view>
|
||||
|
|
@ -177,13 +183,17 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="flex-between">
|
||||
<view v-else class="flex-between" style="flex-wrap: inherit;">
|
||||
<view class="money">
|
||||
<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}}
|
||||
</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 class="flex-end"
|
||||
v-if="item1.type == 'sku' || (item1.type == 'package' && item1.groupType == '1')">
|
||||
|
|
@ -233,8 +243,8 @@
|
|||
<!-- 店铺详情 -->
|
||||
<shopindex ref="showShopInfoRef"></shopindex>
|
||||
<!-- 购物车 -->
|
||||
<shoppingCartes :cartLists_count="cartLists_count" :cartList="matchedProducts" :showCart="showCart"
|
||||
@customevent='websocketsendMessage' @close="showCart = !showCart">
|
||||
<shoppingCartes :cartLists_count="cartLists_count" v-if="matchedProducts.length>0" :cartList="matchedProducts"
|
||||
:showCart="showCart" @customevent='websocketsendMessage' @close="showCart = !showCart">
|
||||
</shoppingCartes>
|
||||
|
||||
<!-- 显示购物车栏 -->
|
||||
|
|
@ -325,12 +335,21 @@
|
|||
<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 v-if="specifications.item.result.suitNum>1">
|
||||
「{{specifications.item.result.suitNum}}{{specifications.item.result.unitName}}起点」
|
||||
</text>
|
||||
</view>
|
||||
<view class="price" v-else>
|
||||
<text class="i">¥</text>
|
||||
<text
|
||||
class="num">{{shopInfo.isVip ==1 && shopInfo.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 class="num">
|
||||
{{shopInfo.isVip ==1 && shopInfo.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>
|
||||
|
||||
|
||||
|
|
@ -393,6 +412,7 @@
|
|||
import shoppingCartes from './components/shoppingCartes.vue'
|
||||
import confirmorder from './components/confirmorder.vue'
|
||||
import Loading from '@/components/Loading.vue';
|
||||
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
|
|
@ -468,9 +488,7 @@
|
|||
|
||||
try {
|
||||
const shopExtend = uni.cache.get('shopTable').shopExtendMap.shopinfo_bg
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
// 计算高度
|
||||
const navScroll = ref(null)
|
||||
|
|
@ -591,11 +609,6 @@
|
|||
uni.$u.debounce(store.scrollTop = res.scrollTop, 500)
|
||||
uni.$u.debounce(navScroll.value = res.scrollTop, 500)
|
||||
uni.$u.debounce(mainScroll(res), 500)
|
||||
if (res.scrollTop >= 44) {
|
||||
// store.showSearch = true
|
||||
} else {
|
||||
// store.showSearch = false
|
||||
}
|
||||
});
|
||||
|
||||
// 点击详情
|
||||
|
|
@ -683,8 +696,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
// 存储选中的选项
|
||||
|
||||
// 监听 specifications 的变化
|
||||
watch(
|
||||
() => specifications.item.groupSnap,
|
||||
|
|
@ -695,7 +706,6 @@
|
|||
}
|
||||
);
|
||||
|
||||
|
||||
// 存储选中的选项,二维数组
|
||||
const selectedOptions = ref(
|
||||
specifications.item.groupSnap.map(() => [])
|
||||
|
|
@ -763,12 +773,25 @@
|
|||
//添加购物车数量
|
||||
const shopCartNumber = ref(0)
|
||||
|
||||
// 多规格 去添加购物车
|
||||
const shopCart = (i) => {
|
||||
if (i == '+') {
|
||||
shopCartNumber.value++;
|
||||
// 多规格 套餐添加数量
|
||||
const shopCart = async (i) => {
|
||||
let res = await shoppingcart()
|
||||
if (i == '-') {
|
||||
if (!res && shopCartNumber.value == specifications.item.suitNum) {
|
||||
uni.showToast({
|
||||
title: `起点${specifications.item.suitNum}`,
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
} else {
|
||||
shopCartNumber.value--;
|
||||
}
|
||||
} 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 () => {
|
||||
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 (!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
|
||||
})
|
||||
// 清空套餐选中
|
||||
// 是否是套餐 有就传
|
||||
if (specifications.item.type != "package") {
|
||||
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) => {
|
||||
if (item.isSoldStock == 1 || item.isSaleTime == 0) {
|
||||
|
|
@ -939,6 +965,7 @@
|
|||
|
||||
// 单规格
|
||||
const singleclick = async (item, i) => {
|
||||
console.log(item)
|
||||
// 判断购物车是否有该选中商品
|
||||
let res = null
|
||||
try {
|
||||
|
|
@ -948,15 +975,24 @@
|
|||
} catch (error) {
|
||||
//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({
|
||||
id: res ? item.cartListId : '',
|
||||
type: 'shopping',
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
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,
|
||||
sku_id: item.skuId,
|
||||
number: await calculateValue(item.cartNumber, i),
|
||||
number: await calculateValue(item.cartNumber, i, suitNum),
|
||||
is_print: 1,
|
||||
product_type: item.type
|
||||
})
|
||||
|
|
@ -1379,11 +1415,12 @@
|
|||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '暂无列表数据...'
|
||||
title: '暂无列表数据,请重新扫码',
|
||||
icon: "none"
|
||||
});
|
||||
isDataLoaded.value = false;
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
uni.pro.switchTab('index/index')
|
||||
}, 1000)
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,6 +123,20 @@
|
|||
nextTick
|
||||
} from 'vue';
|
||||
|
||||
//接口引入
|
||||
import {
|
||||
APIcallTabletakeNumber,
|
||||
APIusercallTable,
|
||||
APIqueuecallTable,
|
||||
APIqueuedetail,
|
||||
APIcallTablesubMsg
|
||||
} from "@/common/api/subscribeto.js";
|
||||
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
|
||||
const queueUpList = ref([])
|
||||
|
||||
const tableList = ref([])
|
||||
|
|
@ -131,7 +145,10 @@
|
|||
show: false,
|
||||
phone: "",
|
||||
callTableId: "",
|
||||
shopInfo: null,
|
||||
shopInfo: {
|
||||
logo: '',
|
||||
shopName: ''
|
||||
},
|
||||
queueInfo: null,
|
||||
shopId: "",
|
||||
queueId: "",
|
||||
|
|
@ -150,15 +167,14 @@
|
|||
// 获取排号状态
|
||||
const getQueueUpState = async () => {
|
||||
let params = {
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
shopId: this.shopId,
|
||||
shopId: dataform.shopId,
|
||||
}
|
||||
if (this.queueId) {
|
||||
params.queueId = this.queueId;
|
||||
if (dataform.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.queueInfo = res.data.queueInfo;
|
||||
dataform.queueId = dataform.queueInfo.id;
|
||||
|
|
@ -167,34 +183,36 @@
|
|||
|
||||
// 获取排号数据
|
||||
const getQueueUpList = async () => {
|
||||
let res = await this.api.getQueueUpList({
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
shopId: this.shopId,
|
||||
let res = await APIqueuecallTable({
|
||||
shopId: dataform.shopId,
|
||||
})
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
if (res) {
|
||||
queueUpList.value = res.data;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取桌型数据
|
||||
// 叫号队列详情
|
||||
const getQueueUpTablList = async () => {
|
||||
let res = await this.api.getQueueUpTablList({
|
||||
shopId: this.shopId,
|
||||
let res = await APIqueuedetail({
|
||||
shopId: dataform.shopId,
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
})
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
if (res.queueInfo) {
|
||||
tableList.value = res.data;
|
||||
dataform.callTableId = res.data[0].id;
|
||||
|
||||
} else {
|
||||
getQueueUpState()
|
||||
}
|
||||
}
|
||||
|
||||
// 订阅通知
|
||||
const subscribe = async () => {
|
||||
let res = await this.api.setSubMsg({
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
shopId: this.shopId,
|
||||
queueId: this.queueId,
|
||||
let res = await APIcallTablesubMsg({
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
shopId: dataform.shopId,
|
||||
queueId: dataform.queueId,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: '订阅成功',
|
||||
icon: 'none'
|
||||
|
|
@ -229,7 +247,7 @@
|
|||
if (res.code == 0) {
|
||||
dataform.phone = "";
|
||||
dataform.queueId = res.data.id;
|
||||
this.getQueueUpState();
|
||||
getQueueUpState();
|
||||
dataform.show = false;
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
|
||||
|
|
@ -248,15 +266,20 @@
|
|||
const cancelTakeNumber = async () => {
|
||||
let res = await this.api.cancelTakeNumber({
|
||||
queueId: dataform.queueInfo.id,
|
||||
shopId: this.shopId,
|
||||
shopId: dataform.shopId,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.getQueueUpTablList();
|
||||
this.getQueueUpState();
|
||||
if (res) {
|
||||
getQueueUpTablList();
|
||||
getQueueUpState();
|
||||
}
|
||||
}
|
||||
|
||||
// 取消排队
|
||||
// 切换桌型
|
||||
const tableCut = (item) => {
|
||||
dataform.callTableId = item.id;
|
||||
}
|
||||
|
||||
// 弹窗关闭监听
|
||||
const close = async () => {
|
||||
this.phone = "";
|
||||
if (tableList.value.length > 0) {
|
||||
|
|
@ -265,11 +288,6 @@
|
|||
dataform.show = false;
|
||||
}
|
||||
|
||||
// 取消排队
|
||||
const tableCut = async (item) => {
|
||||
dataform.callTableId = item.id;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await proxy.$onLaunched;
|
||||
// 获取当前页面栈
|
||||
|
|
@ -281,22 +299,21 @@
|
|||
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
this.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
|
||||
this.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
|
||||
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) {
|
||||
this.shopId = getApp().globalData.shopId
|
||||
dataform.shopId = getApp().globalData.shopId
|
||||
}
|
||||
if (getApp().globalData.queueId) {
|
||||
this.queueId = getApp().globalData.queueId
|
||||
dataform.queueId = getApp().globalData.queueId
|
||||
}
|
||||
// #endif
|
||||
await nextTick()
|
||||
this.getQueueUpState();
|
||||
this.getQueueUpTablList();
|
||||
getQueueUpTablList();
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue