更新详情
This commit is contained in:
@@ -28,7 +28,7 @@ class webSocketUtils {
|
||||
this.socketTask = uni.connectSocket({
|
||||
url: this.url,
|
||||
success: () => {
|
||||
console.log('正准备建立websocket中...');
|
||||
// console.log('正准备建立websocket中...');
|
||||
// uni.hideLoading();
|
||||
// 返回实例
|
||||
return this.socketTask;
|
||||
@@ -37,7 +37,7 @@ class webSocketUtils {
|
||||
this.socketTask.onOpen((res) => {
|
||||
uni.hideLoading()
|
||||
this.connectNum = 1;
|
||||
console.log('WebSocket连接正常!');
|
||||
// console.log('WebSocket连接正常!');
|
||||
if (this.params) { //是否初始化请求
|
||||
this.send(this.params);
|
||||
}
|
||||
@@ -52,7 +52,6 @@ class webSocketUtils {
|
||||
let res = JSON.parse(e.data);
|
||||
uni.$emit('message', res)
|
||||
// 普通socket信息处理 TODO
|
||||
|
||||
});
|
||||
});
|
||||
// 监听连接失败,这里代码我注释掉的原因是因为如果服务器关闭后,和下面的onclose方法一起发起重连操作,这样会导致重复连接
|
||||
@@ -107,20 +106,20 @@ class webSocketUtils {
|
||||
}
|
||||
//发送消息
|
||||
send(data) {
|
||||
console.log("发送消息---------->", data);
|
||||
// console.log("发送消息---------->", data);
|
||||
// 注:只有连接正常打开中 ,才能正常成功发送消息
|
||||
if (this.socketTask) {
|
||||
this.socketTask.send({
|
||||
data: JSON.stringify(data),
|
||||
async success() {
|
||||
console.log("消息发送成功");
|
||||
// console.log("消息发送成功");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
//开启心跳检测
|
||||
start(data) {
|
||||
console.log('开启心跳检测', data)
|
||||
// console.log('开启心跳检测', data)
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
this.send({
|
||||
data: '心跳检测',
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #FFFFFF;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.pay-title {
|
||||
|
||||
@@ -19,7 +19,7 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
||||
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
|
||||
// #endif
|
||||
|
||||
// import VConsole from "./vConsole.js"
|
||||
|
||||
@@ -75,8 +75,8 @@ async function request(options) {
|
||||
token: uni.cache.get('token'),
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
id: uni.cache.get('userInfo').id,
|
||||
loginName:"",
|
||||
clientType:''
|
||||
loginName: "",
|
||||
clientType: ''
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -95,12 +95,12 @@ async function request(options) {
|
||||
icon: "none",
|
||||
success: () => {
|
||||
setTimeout(res => {
|
||||
uni.cache.clear();
|
||||
uni.cache.set('token', '');
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
}, 1000)
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
} else if (res.code == 482) {
|
||||
@@ -117,7 +117,6 @@ async function request(options) {
|
||||
setTimeout(res => {
|
||||
if (options.toast) {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.hideLoading()
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.pro.hideLoading()
|
||||
|
||||
@@ -133,12 +133,12 @@
|
||||
onLoad(e) {
|
||||
|
||||
|
||||
console.log(e,'调试1')
|
||||
try {
|
||||
this.types = e.types
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
// console.log(e, '调试1')
|
||||
// try {
|
||||
// this.types = e.types
|
||||
// } catch (e) {
|
||||
// //TODO handle the exception
|
||||
// }
|
||||
// #ifdef APP-PLUS || H5
|
||||
this.showbox = true
|
||||
// #endif
|
||||
@@ -285,7 +285,7 @@
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
if (this.types == 0) {
|
||||
if (uni.cache.get('types') == 'types') {
|
||||
uni.reLaunch({
|
||||
url: '/pages/order_food/order_food'
|
||||
});
|
||||
@@ -319,42 +319,51 @@
|
||||
// },
|
||||
async userlogin(reslange) {
|
||||
var resdataa = reslange
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
try {
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
uni.cache.set('weixincode', data.code);
|
||||
let res = await this.api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
rawData: infoRes.rawData,
|
||||
signature: infoRes.signature,
|
||||
iv: resdataa.detail.iv,
|
||||
encryptedData: resdataa.detail.encryptedData
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('token', res.data.token);
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
if (this.types == 0) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/order_food/order_food'
|
||||
});
|
||||
} else {
|
||||
uni.pro.switchTab('index/index')
|
||||
if (resdataa.detail.iv) {
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
try {
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
uni.cache.set('weixincode', data.code);
|
||||
let res = await this.api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
rawData: infoRes.rawData,
|
||||
signature: infoRes.signature,
|
||||
iv: resdataa.detail.iv,
|
||||
encryptedData: resdataa.detail
|
||||
.encryptedData
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('token', res.data.token);
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
if (uni.cache.get('types') == 'types') {
|
||||
uni.reLaunch({
|
||||
url: '/pages/order_food/order_food'
|
||||
});
|
||||
} else {
|
||||
uni.pro.switchTab('index/index')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '获取手机号失败!请重新获取',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -369,12 +378,12 @@
|
||||
|
||||
.container {
|
||||
// position: relative;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
|
||||
.top {
|
||||
position: absolute;
|
||||
@@ -392,6 +401,7 @@
|
||||
left: 50%;
|
||||
z-index: 22;
|
||||
transform: translateX(-50%);
|
||||
|
||||
image {
|
||||
width: 128rpx;
|
||||
height: 128rpx;
|
||||
@@ -507,6 +517,7 @@
|
||||
background: #ffffff;
|
||||
border-radius: 40rpx 40rpx 0px 0px;
|
||||
top: 220rpx;
|
||||
|
||||
.top_box_one {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<view class="number-wrap"
|
||||
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
|
||||
<text class="t">取餐号</text>
|
||||
<text class="number">{{listinfo.tableName}}</text>
|
||||
<text class="number">{{listinfo.outNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card">
|
||||
@@ -63,8 +63,10 @@
|
||||
</view>
|
||||
<view class="info">
|
||||
<text>{{item.productName}}</text>
|
||||
<text class="n" v-if="item.productSkuName">{{item.productSkuName}}</text>
|
||||
<text class="n">x{{item.num}}</text>
|
||||
</view>
|
||||
|
||||
<view class="price">
|
||||
<text class="i">¥</text>
|
||||
<text class="num">{{item.priceAmount}}</text>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
</view>
|
||||
<view class="info">
|
||||
<text>{{item.productName}}</text>
|
||||
<text class="n" v-if="item.productSkuName">{{item.productSkuName}}</text>
|
||||
<text class="n">x{{item.num}}</text>
|
||||
</view>
|
||||
<view class="price">
|
||||
@@ -88,6 +89,7 @@
|
||||
可用优惠券{{couponAmount}}张
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <u--textarea v-model="remark" placeholder="订单备注" ></u--textarea> -->
|
||||
<!-- 支付方式 -->
|
||||
<view class="payType">
|
||||
<view class="">
|
||||
@@ -193,6 +195,7 @@
|
||||
return {
|
||||
height: '',
|
||||
pay_type: 1,
|
||||
remark:'',
|
||||
listinfoid: '',
|
||||
listinfo: {
|
||||
detailList: [],
|
||||
@@ -263,13 +266,7 @@
|
||||
|
||||
}
|
||||
},
|
||||
// 数据处理
|
||||
socketSendMsg(data) {
|
||||
if (this.socketTicket) {
|
||||
this.socketTicket.send(data);
|
||||
}
|
||||
},
|
||||
orderfoodindex() {
|
||||
orderfoodindex() {//优惠劵
|
||||
uni.pro.navigateTo('index/coupons/index', {
|
||||
orderfood: 0,
|
||||
orderId: this.listinfo.id,
|
||||
@@ -287,13 +284,12 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
async paymodfiyOrderInfo() {
|
||||
async paymodfiyOrderInfo() {//支付完成后请求
|
||||
let res = await this.api.paymodfiyOrderInfo({
|
||||
orderId: this.listinfo.id,
|
||||
})
|
||||
},
|
||||
// 去充值
|
||||
goRecharge() {
|
||||
goRecharge() {// 去充值
|
||||
uni.pro.navigateTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopUser')
|
||||
})
|
||||
@@ -348,7 +344,7 @@
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
uni.cache.set('shopUser', '') //删除shopUser
|
||||
// uni.cache.set('shopUser', '') //删除shopUser
|
||||
_this.paymodfiyOrderInfo()
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order_detail?orderId=' +
|
||||
@@ -372,6 +368,7 @@
|
||||
let res = await this.api.accountPay({
|
||||
orderId: this.listinfo.id,
|
||||
memberId: this.amountVIP.id,
|
||||
// remark: this.remark,
|
||||
pwd
|
||||
})
|
||||
if (res.code == 0) {
|
||||
@@ -462,7 +459,7 @@
|
||||
background-color: #fff;
|
||||
border-radius: 20upx;
|
||||
padding: 28upx;
|
||||
margin-bottom: 28upx;
|
||||
margin-bottom: 48rpx;
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<view id="wrapper">
|
||||
<view v-if="fixedtrue"
|
||||
style="height: 100vh; width: 100%; position: fixed; z-index: 999; top: 0; left: 0; background-color: #fff; display: flex; justify-content: center; align-items: center;">
|
||||
<u-loadmore status="loading" fontSize="50" iconSize="30"/>
|
||||
<image style="width: 140rpx; height: 140rpx;" src="@/static/1.gif" mode="aspectFill"></image>
|
||||
<text style="margin-left10rpx;font-size: 40rpx;color: #7d7d76;">加载中</text>
|
||||
<!-- <u-loadmore status="loading" fontSize="50" iconSize="30"/> -->
|
||||
</view>
|
||||
<view class="nav-wrap" :class="{ 'is-fixed': isFixed }"
|
||||
:style="{ paddingTop: `${menuInfo.top}px`, paddingBottom: `${paddingBtmSize}px` }">
|
||||
@@ -63,11 +65,12 @@
|
||||
空
|
||||
</view>
|
||||
<view class="shop-item" v-for="(item1,index1) in item.products" :key="item1.id">
|
||||
<view class="cover" style="width:180rpx; height: 180rpx;">
|
||||
<c-image :src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_90,h_90`"
|
||||
width="180" height="180"></c-image>
|
||||
<view class="cover langcover" style="width:180rpx; height: 180rpx;" @click.stop="clickspecifications(item1,index,index1)">
|
||||
<c-image style="position: absolute;z-index:2;"
|
||||
:src="`${item1.coverImg}?x-oss-process=image/resize,m_lfit,w_90,h_90`" width="180"
|
||||
height="180"></c-image>
|
||||
</view>
|
||||
<view class="info " style="display: flex;flex-direction: column;justify-content: center;">
|
||||
<view class="info" style="display: flex;flex-direction: column;justify-content: center;">
|
||||
<view class="name">
|
||||
{{ item1.name }}
|
||||
</view>
|
||||
@@ -78,18 +81,18 @@
|
||||
<text class="i">起</text>
|
||||
</view>
|
||||
<view class="sku-wrap" v-if="item1.productSkuResult != null"
|
||||
@click="clickspecifications(item1,index,index1)">
|
||||
@click.stop="clickspecifications(item1,index,index1)">
|
||||
<text class="t">选规格</text>
|
||||
<text class="dot num" v-if="item1.cartNumber != '0'">{{item1.cartNumber}}</text>
|
||||
</view>
|
||||
<view class="operation-wrap" v-else>
|
||||
<view class="btn" v-if="item1.cartNumber != '0'"
|
||||
@click="cartadd(item1,index,index1,'-',item1.cartNumber,item1.productSkuResult == null ? '单规格':'')">
|
||||
@click.stop="cartadd(item1,index,index1,'-',item1.productSkuResult == null ? '单规格':'')">
|
||||
<u-icon :name="require('@/static/icon_sub.png')" size="34"></u-icon>
|
||||
</view>
|
||||
<text class="num">{{ item1.cartNumber }}</text>
|
||||
<view class="btn"
|
||||
@click="cartadd(item1,index,index1,'+',item1.cartNumber,item1.productSkuResult == null ? '单规格':'')">
|
||||
@click.stop="cartadd(item1,index,index1,'+',item1.productSkuResult == null ? '单规格':'')">
|
||||
<u-icon :name="require('@/static/icon_add.png')" size="34"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -117,15 +120,11 @@
|
||||
<u-popup :show="showCart" :round="20" :zIndex="98" :overlayStyle="{ zIndex: 98 }" @close="showCart = false">
|
||||
<view class="cart-list-wrap">
|
||||
<view class="cart-header">
|
||||
<!-- <view class="clear" @click="orderfoodindex">
|
||||
<text class="t" style="color: #ffd100;">可用优惠劵</text>
|
||||
</view> -->
|
||||
<view class="clear" @click="cartclear">
|
||||
<u-icon name="trash" color="#999"></u-icon>
|
||||
<text class="t">清空购物车</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y class="scroll-view">
|
||||
<view class="list-wrap">
|
||||
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
|
||||
@@ -187,12 +186,17 @@
|
||||
<u-popup :show="showShopsku" :round="20" mode="center" @close="showShopsku = false"
|
||||
:safeAreaInsetBottom='false'>
|
||||
<view class="shop_sku">
|
||||
<view class="positionabsolute">
|
||||
<u-icon name="close-circle-fill" @click="showShopsku = false" color="#a3aaa3" size="60"></u-icon>
|
||||
</view>
|
||||
<image class="shop_skucimage" :src="specifications.coverImg" mode="widthFix"></image>
|
||||
<view class="shop_sku_name">
|
||||
{{specifications.name}}
|
||||
</view>
|
||||
<view class="shop_sku_box" v-for="(item,index) in specifications.tagSnap" :key="index">
|
||||
<view class="shop_sku_box" v-for="(item,index) in specifications.tagSnap" :key="index"
|
||||
v-if="specifications.tagSnap">
|
||||
<view class="shop_sku_box_name">
|
||||
<!-- 温度 -->{{item.name}}
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="flex-start">
|
||||
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
|
||||
@@ -202,7 +206,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="shop_skuselect flex-start">
|
||||
<view class="shop_skuselect flex-start" v-if="specifications.tagSnap">
|
||||
已选规格:<view class="shop_skuselectname">{{skuidname.toString()}}</view>
|
||||
</view>
|
||||
<view class="shop_bottom flex-between">
|
||||
@@ -213,18 +217,24 @@
|
||||
</view>
|
||||
<view class="operation-wrap">
|
||||
<view class="btn"
|
||||
@click="cartadd(specifications,specifications.indexa,specifications.indexb,'-',specifications.cartNumber)">
|
||||
@click="cartadd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')">
|
||||
<u-icon :name="require('@/static/icon_sub.png')" size="34"></u-icon>
|
||||
</view>
|
||||
<text class="num">{{amountcartNumber}}</text>
|
||||
<view class="btn"
|
||||
@click="cartadd(specifications,specifications.indexa,specifications.indexb,'+',specifications.cartNumber)">
|
||||
@click="cartadd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
|
||||
<u-icon :name="require('@/static/icon_add.png')" size="34"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<u-popup :show="popupshowInfo" :round="20" mode="center" @close="popupshowInfo = false"
|
||||
:safeAreaInsetBottom='false'>
|
||||
<view class="showInfo">
|
||||
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -247,6 +257,7 @@
|
||||
shopList: {}, //数据类型
|
||||
active: 0,
|
||||
showShopInfo: false,
|
||||
popupshowInfo: false,
|
||||
showShopsku: false,
|
||||
titleTopNumIndex: 0,
|
||||
titleTopNums: [],
|
||||
@@ -258,8 +269,8 @@
|
||||
socketTicket: null,
|
||||
amountcartNumber: 0,
|
||||
skuidsearch: '', //
|
||||
salePrice: '' ,//钱数
|
||||
fixedtrue:true
|
||||
salePrice: '', //钱数
|
||||
fixedtrue: true
|
||||
};
|
||||
},
|
||||
onPageScroll(e) {
|
||||
@@ -283,32 +294,20 @@
|
||||
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
|
||||
uni.cache.set('tableCode', this.tableCode)
|
||||
}
|
||||
if (!uni.cache.get('token')) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login?types=' + 0
|
||||
});
|
||||
return false
|
||||
}
|
||||
uni.cache.set('types', 'types');
|
||||
uni.$on('message', this.getMessage)
|
||||
this.$nextTick(() => {
|
||||
this.countTitleTopNum(); //导航栏
|
||||
});
|
||||
},
|
||||
onUnload() {
|
||||
try {
|
||||
this.socketSendMsg({ //定义socket数据传参
|
||||
"type": "close", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
})
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
this.socketTicket.Close()
|
||||
uni.$off('message')
|
||||
},
|
||||
onShow() {
|
||||
if (uni.cache.get('token')) {
|
||||
setTimeout(() => {
|
||||
this.productqueryShopIdByTableCode() //获取shop User id
|
||||
}
|
||||
}, 500)
|
||||
},
|
||||
methods: {
|
||||
// 单独获取他的shopUserid
|
||||
@@ -327,15 +326,35 @@
|
||||
}
|
||||
},
|
||||
getMessage(msg) { //wss 回显数据
|
||||
// console.log(this.shopList.productInfo)
|
||||
// console.log(msg.data)
|
||||
// const sumValuesByKey = (arr, key) => {
|
||||
// return arr.reduce((accumulator, current) => {
|
||||
// const existing = accumulator.find(item => item[key] === current[key]);
|
||||
// if (existing) {
|
||||
// existing.number += current.number;
|
||||
// } else {
|
||||
// accumulator.push({
|
||||
// ...current
|
||||
// });
|
||||
// }
|
||||
// return accumulator;
|
||||
// }, []);
|
||||
// };
|
||||
// const result = sumValuesByKey(msg.data, 'productId');
|
||||
// this.shopList.productInfo.forEach((item, index) => {
|
||||
// if (item.id == result.categoryId) {
|
||||
// item.products.forEach((item1,index1) => {
|
||||
|
||||
// })
|
||||
// }
|
||||
// });
|
||||
if (msg.status != 'success') {
|
||||
uni.showToast({
|
||||
title: msg.msg,
|
||||
icon: "none",
|
||||
})
|
||||
if (msg.msg == '桌码不存在') { //卓码不存在直接退出
|
||||
this.socketSendMsg({ //定义socket数据传参
|
||||
"type": "close", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
})
|
||||
this.socketTicket.Close()
|
||||
uni.$off('message')
|
||||
uni.navigateBack()
|
||||
@@ -343,12 +362,11 @@
|
||||
}
|
||||
} else {
|
||||
switch (msg.type) {
|
||||
case 'sku': // sku 数量
|
||||
case 'sku': // sku 数量 查询这个商品的价格和数量
|
||||
this.$set(this, 'amountcartNumber', msg.amount)
|
||||
this.productqueryProduct() //list 数据
|
||||
break;
|
||||
case 'clearCart':
|
||||
this.specifications.duoguge = ''
|
||||
this.skuidname = []
|
||||
this.showCart = false
|
||||
setTimeout(() => {
|
||||
@@ -362,7 +380,6 @@
|
||||
break;
|
||||
case 'order':
|
||||
console.log('clearCart')
|
||||
this.specifications.duoguge = ''
|
||||
this.skuidname = []
|
||||
this.showCart = false
|
||||
this.cartLists = msg
|
||||
@@ -397,7 +414,7 @@
|
||||
break;
|
||||
default:
|
||||
this.cartLists = msg
|
||||
this.productqueryProduct() //list 数据
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -416,45 +433,6 @@
|
||||
this.socketTicket.send(data);
|
||||
}
|
||||
},
|
||||
scanCodehandle(e) {
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY
|
||||
uni.login({ //alipay weixin
|
||||
provider: 'weixin',
|
||||
success: async (data) => {
|
||||
try {
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
console.log(infoRes, 81);
|
||||
uni.cache.set('weixincode', data.code);
|
||||
let res = await this.api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
encryptedData: infoRes.encryptedData, // 用户非敏感信息
|
||||
rawData: infoRes.rawData,
|
||||
signature: infoRes.signature,
|
||||
iv: infoRes.iv,
|
||||
qrCode: uni.cache.get('tableCode')
|
||||
})
|
||||
if (res.code == 0) {
|
||||
uni.cache.set('token', res.data.token);
|
||||
uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
.miniAppOpenId)
|
||||
uni.cache.set('userInfo', res.data.userInfo);
|
||||
this.productqueryShopIdByTableCode() //获取shop User id
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
getQueryString(url, name) { //解码
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
var r = url.substr(1).match(reg)
|
||||
@@ -463,14 +441,12 @@
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async cartadd(item, index, index1, a, b, guge) { //列表添加
|
||||
console.log(item, index, index1, a, b, guge)
|
||||
|
||||
if (guge == '单规格') { //没有规格为空
|
||||
this.specifications.duoguge = ''
|
||||
async cartadd(item, index, index1, a, b) { //列表添加 a传参加减号 b是判断单规格多规格
|
||||
console.log(item, index, index1, a, b)
|
||||
if (b == '单规格') { //没有规格为空
|
||||
this.skuidname = []
|
||||
}
|
||||
this.hodgepodge(item, 1, a) //获取skuid
|
||||
this.hodgepodge(item, 1, a) //获取skuid /1添加购物车
|
||||
},
|
||||
async cartListadd(item, index, a) {
|
||||
console.log(item, index, a)
|
||||
@@ -487,7 +463,6 @@
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
},
|
||||
async productqueryProduct() { //list 数据
|
||||
let res = await this.api.productqueryProduct({
|
||||
@@ -496,55 +471,50 @@
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.shopList = res.data
|
||||
this.fixedtrue = false
|
||||
setTimeout(() => {
|
||||
this.fixedtrue = false
|
||||
}, 1000)
|
||||
this.$nextTick(() => {
|
||||
this.countTitleTopNum();
|
||||
});
|
||||
}
|
||||
},
|
||||
clickspecifications(e, a, b, d) {
|
||||
console.log(e, a, b)
|
||||
clickspecifications(item1, index, index1) {
|
||||
this.skuidname = []
|
||||
this.specifications = e
|
||||
this.specifications.indexa = a
|
||||
this.specifications.indexb = b
|
||||
this.specifications.duoguge = 'duoguge'
|
||||
if (e.productSkuResult.tagSnap == null) {
|
||||
uni.showToast({
|
||||
title: '暂无规格',
|
||||
icon: "none",
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.specifications.tagSnap = JSON.parse(e.productSkuResult.tagSnap).map((item) => {
|
||||
let res = {
|
||||
id: e.id, //商品id
|
||||
name: item.name,
|
||||
start: 0,
|
||||
children: item.value.split(",")
|
||||
}
|
||||
return res
|
||||
})
|
||||
this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
|
||||
console.log(val.children[0], 'skuidnam是否为空1')
|
||||
this.skuidname.push(val.children[0])
|
||||
})
|
||||
this.specifications = item1
|
||||
this.specifications.indexa = index
|
||||
this.specifications.indexb = index1
|
||||
try {
|
||||
this.hodgepodge(this.specifications.tagSnap[0], 2)
|
||||
if (item1.productSkuResult == null) {
|
||||
// 但但单个规格弹框的处理
|
||||
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
|
||||
} else {
|
||||
// 多规格数据处理
|
||||
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item) => {
|
||||
let res = {
|
||||
id: item1.id, //商品id
|
||||
name: item.name,
|
||||
start: 0,
|
||||
children: item.value.split(",")
|
||||
}
|
||||
return res
|
||||
})
|
||||
this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
|
||||
this.skuidname.push(val.children[0])
|
||||
})
|
||||
this.hodgepodge(this.specifications.tagSnap[0], 2) //获取skuid /2查找价格和数量
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
if (d != '更新数据') {
|
||||
this.showShopsku = true
|
||||
}
|
||||
},
|
||||
async morloe(e, index, index1, item) {
|
||||
console.log(index, 'skuidnam是否为空2')
|
||||
this.specifications.tagSnap[index]['start'] = index1
|
||||
this.skuidname.splice(index, 1, e) //替换skuidname的数据
|
||||
this.hodgepodge(item, 2)
|
||||
},
|
||||
async hodgepodge(item, a, c) { //去获取商品id 库存等
|
||||
async hodgepodge(item, a, c) { //此接口去获取商品id !!!赋值库存 数量 价格等
|
||||
try {
|
||||
let res = await this.api.productqueryProductSku({
|
||||
shopId: uni.cache.get('shopUser'),
|
||||
@@ -558,9 +528,9 @@
|
||||
})
|
||||
} else {
|
||||
this.skuidsearch = res.data.id // 储存skuid 用于筛选数量
|
||||
this.salePrice = res.data.salePrice // 储存skuid 用于筛选数量
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
let data = null
|
||||
if (a == 1) {
|
||||
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
|
||||
data = { //定义socket数据传参
|
||||
"skuId": res.data.id,
|
||||
"num": c == '-' ? -1 : 1, //数量
|
||||
@@ -570,7 +540,7 @@
|
||||
"userId": uni.cache.get('userInfo').id
|
||||
};
|
||||
} else {
|
||||
data = { //定义socket数据传参
|
||||
data = { //查询这个商品的价格
|
||||
"skuId": res.data.id,
|
||||
"num": '', //数量
|
||||
"type": "sku", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
@@ -578,21 +548,14 @@
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id
|
||||
};
|
||||
this.showShopsku = true //打开弹框
|
||||
}
|
||||
uni.$u.debounce(this.socketSendMsg(data), 500)
|
||||
}
|
||||
} catch (e) {}
|
||||
},
|
||||
orderdetail() {
|
||||
// let data = { //缓存的生成订单 //去结算
|
||||
// "skuId": '',
|
||||
// "num": '', //数量
|
||||
// "type": "queryCart", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
// "productId": '', //商品id
|
||||
// "shopId": uni.cache.get('shopUser'),
|
||||
// "userId": uni.cache.get('userInfo').id
|
||||
// }
|
||||
let data = { // 直接生成订单
|
||||
orderdetail() { // 直接生成订单
|
||||
let data = {
|
||||
"skuId": '',
|
||||
"num": '', //数量
|
||||
"type": "createOrder", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
@@ -605,12 +568,7 @@
|
||||
}
|
||||
uni.$u.debounce(this.socketSendMsg(data), 500)
|
||||
},
|
||||
orderfoodindex() {
|
||||
uni.pro.navigateTo('index/coupons/index', {
|
||||
orderfood: 0
|
||||
})
|
||||
},
|
||||
async cartclear() {
|
||||
async cartclear() { //清空购物车
|
||||
try {
|
||||
const data = { //定义socket数据传参
|
||||
"skuId": '',
|
||||
@@ -779,6 +737,7 @@
|
||||
height: $h;
|
||||
margin-top: -40upx;
|
||||
background: #999;
|
||||
position: relative;
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
@@ -831,6 +790,7 @@
|
||||
.left-wrap {
|
||||
width: $tabLeft;
|
||||
background-color: $bg;
|
||||
padding: 0 0 $paddingSize * 3 + $cartH 0;
|
||||
|
||||
.left {
|
||||
width: $tabLeft;
|
||||
@@ -840,7 +800,8 @@
|
||||
height: $itemH;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: $paddingSize;
|
||||
padding: 0 $paddingSize;
|
||||
justify-content: center;
|
||||
|
||||
&.active {
|
||||
background-color: #fff;
|
||||
@@ -873,6 +834,25 @@
|
||||
display: flex;
|
||||
padding-bottom: $paddingSize;
|
||||
|
||||
.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;
|
||||
@@ -973,7 +953,7 @@
|
||||
width: 100%;
|
||||
padding: $paddingSize;
|
||||
position: fixed;
|
||||
bottom: $paddingSize * 2;
|
||||
bottom: $paddingSize;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
|
||||
@@ -1057,10 +1037,23 @@
|
||||
}
|
||||
|
||||
.shop_sku {
|
||||
position: relative;
|
||||
width: 700rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
|
||||
.positionabsolute {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
left: 10rpx;
|
||||
}
|
||||
|
||||
.shop_skucimage {
|
||||
width: 100%;
|
||||
height: 440rpx;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
.shop_sku_name {
|
||||
padding: 0 $paddingSize;
|
||||
margin-top: 20rpx;
|
||||
@@ -1165,6 +1158,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.showInfo {
|
||||
width: 100%;
|
||||
border-radius: 20rpx;
|
||||
background: #fff;
|
||||
max-height: 70vh;
|
||||
}
|
||||
|
||||
.shop-info-wrap {
|
||||
.info-wrap {
|
||||
padding: $paddingSize * 2 0;
|
||||
|
||||
BIN
static/1.gif
Normal file
BIN
static/1.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user