优化长链接

This commit is contained in:
duan
2024-05-31 10:20:13 +08:00
parent 1799fc158c
commit b880b65e9e

View File

@@ -125,7 +125,6 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="sixcontent" > <!-- <view class="sixcontent" >
<view class="sixcontentone flex-between"> <view class="sixcontentone flex-between">
<view class="sixcontent_one"> <view class="sixcontent_one">
@@ -252,7 +251,7 @@
}) })
}, },
methods: { methods: {
s groupChange(n) { groupChange(n) {
// console.log('groupChange', n); // console.log('groupChange', n);
this.radiovalue1 = n this.radiovalue1 = n
uni.cache.set('radiovalue1', n) uni.cache.set('radiovalue1', n)
@@ -290,8 +289,7 @@ s groupChange(n) {
} else if (msg.type == 'createOrder') { } else if (msg.type == 'createOrder') {
console.log(msg, 'createOrder执行') console.log(msg, 'createOrder执行')
uni.cache.set('order_detailinfoid', msg.data.id); this.listinfoid = msg.data.id //下单需要的id
// this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data this.orderInfo = msg.data
if (this.radiovalue1 == 1) { if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付 this.showpopupclickdds() //微信支付
@@ -300,7 +298,7 @@ s groupChange(n) {
} }
}, },
handlemessage() { handlemessage() {
// this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接 this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils( this.socketTicket = new webSocketUtils(
`${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`, `${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
5000) 5000)
@@ -315,7 +313,7 @@ s groupChange(n) {
orderfoodindex() { orderfoodindex() {
uni.pro.navigateTo('index/coupons/index', { uni.pro.navigateTo('index/coupons/index', {
orderfood: 0, orderfood: 0,
orderId: uni.cache.get('order_detailinfoid'), orderId: this.listinfoid,
amount: this.listinfo.amounts amount: this.listinfo.amounts
}) })
}, },
@@ -332,7 +330,7 @@ s groupChange(n) {
}, },
async paymodfiyOrderInfo() { async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({ let res = await this.api.paymodfiyOrderInfo({
orderId: uni.cache.get('order_detailinfoid') orderId: this.listinfoid
}) })
}, },
// 去结算 // 去结算
@@ -370,7 +368,7 @@ s groupChange(n) {
shopId_id: uni.cache.get('shopUser') shopId_id: uni.cache.get('shopUser')
}) })
} else { } else {
if (this.amountVIP.amount >= this.listinfo.amount) { if (this.amountVIP.amount > this.listinfo.amount) {
this.ispws = true this.ispws = true
this.showpopupclick() //生成订单 this.showpopupclick() //生成订单
this.$nextTick(() => { this.$nextTick(() => {
@@ -378,7 +376,6 @@ s groupChange(n) {
}) })
} else { } else {
uni.showToast({ uni.showToast({
icon: 'none',
title: "余额不足" title: "余额不足"
}) })
} }
@@ -389,7 +386,7 @@ s groupChange(n) {
// 微信支付 // 微信支付
async showpopupclickdds() { async showpopupclickdds() {
let res = await this.api.payorderPay({ let res = await this.api.payorderPay({
orderId: uni.cache.get('order_detailinfoid') orderId: this.listinfoid
}) //判断是否支付成功 }) //判断是否支付成功
if (res.code == 0) { if (res.code == 0) {
// uni.showLoading({ // uni.showLoading({
@@ -420,8 +417,8 @@ s groupChange(n) {
// .radiovalue1 // .radiovalue1
// }); // });
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + uni.cache url: '/pages/order/order_detail?orderId=' + this
.get('order_detailinfoid') .listinfoid
}); });
}, 500) }, 500)
// uni.redirectTo({ // uni.redirectTo({
@@ -442,8 +439,8 @@ s groupChange(n) {
// .radiovalue1 // .radiovalue1
// }); // });
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + uni.cache url: '/pages/order/order_detail?orderId=' + this
.get('order_detailinfoid') .listinfoid
}); });
}, 500) }, 500)
}, },
@@ -458,7 +455,7 @@ s groupChange(n) {
async accountPayevent(pwd) { async accountPayevent(pwd) {
this.ispws = false this.ispws = false
let res = await this.api.accountPay({ let res = await this.api.accountPay({
orderId: uni.cache.get('order_detailinfoid'), orderId: this.listinfoid,
memberId: this.amountVIP.id, memberId: this.amountVIP.id,
pwd: pwd pwd: pwd
}) })
@@ -475,26 +472,22 @@ s groupChange(n) {
// .radiovalue1 // .radiovalue1
// }); // });
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + uni.cache url: '/pages/order/order_detail?orderId=' + this
.get('order_detailinfoid') .listinfoid
}); });
}, 500) }, 500)
} }
}) })
} else { } else if (res.data == 1) {
setTimeout(res => { setTimeout(() => {
uni.redirectTo({ // 去充值
url: '/pages/order/order_detail?orderId=' + uni.cache.get( this.goRecharge()
'order_detailinfoid') }, 2000)
});
}, 500)
} }
// else if (res.data == 1) {
// setTimeout(() => {
// // 去充值
// this.goRecharge()
// }, 2000)
// }
}, },
clickselect(b) { clickselect(b) {
@@ -791,19 +784,4 @@ s groupChange(n) {
} }
} }
} }
.u-popupflex-colum {
width: 400rpx;
padding: 80rpx 40rpx;
border-radius: 50rpx;
background: #FFFFFF;
.u-popupflex-columview {
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #000;
font-weight: bold;
margin-bottom: 50rpx;
}
}
</style> </style>