Commit 3684fae3 by 宋冰琦

修复部分bug

parent c96c9e2a
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
this.clientYEnd = e.changedTouches[0].clientY; this.clientYEnd = e.changedTouches[0].clientY;
const val = parseInt((this.clientYStart-this.clientYEnd)) const val = parseInt((this.clientYStart-this.clientYEnd))
console.log(val) console.log(val)
if(val<-300){ if(val<-20){
console.log('滑动了:'+val + ',关闭') console.log('滑动了:'+val + ',关闭')
this.close() this.close()
}else{ }else{
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<script> <script>
import { $EventBus } from "../../utils/EventBus"; import { $EventBus } from "../../utils/EventBus";
import Utils from '@/utils/utils' import Utils from '@/utils/utils'
import Order from '@/request/order'
export default { export default {
name: 'menuAssembly', name: 'menuAssembly',
props:['buied'], props:['buied'],
...@@ -184,16 +185,19 @@ export default { ...@@ -184,16 +185,19 @@ export default {
}); });
}, },
cart(item, category){ async cart(item, category){
console.log(item,category) console.log(item,category)
const skuStatus = item.skus.filter(item=>{return Number(item.state)===1}) const skuStatus = item.skus.filter(item=>{return Number(item.state)===1})
const {data} = await Order.checkSku({skuId:item.skus[0].skuId})
const {goods} = data.data
if(skuStatus.length===0){ if(skuStatus.length===0){
this.showToast({ this.showToast({
title: '该商品已售罄', title: '该商品已售罄',
icon: 'none', icon: 'none',
}) })
}else{ }else{
uni.setStorageSync('goodsInfo', JSON.stringify({ ...item, category })); console.log(goods)
uni.setStorageSync('goodsInfo', JSON.stringify({ ...goods, category }));
uni.navigateTo({ url: '/menuSubPackage/pages/goodsDetail/goodsDetail' }) uni.navigateTo({ url: '/menuSubPackage/pages/goodsDetail/goodsDetail' })
} }
......
...@@ -297,7 +297,7 @@ export default { ...@@ -297,7 +297,7 @@ export default {
if(state == 2){ if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' }); this.showToast({ title: '本商品已经售罄', icon: 'none' });
this.getMenuList() // this.getMenuList()
return; return;
}else{ }else{
goods.num = this.size; goods.num = this.size;
...@@ -323,7 +323,7 @@ export default { ...@@ -323,7 +323,7 @@ export default {
if(state == 2){ if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' }); this.showToast({ title: '本商品已经售罄', icon: 'none' });
this.getMenuList() // this.getMenuList()
return; return;
}else{ }else{
goods.num = this.size goods.num = this.size
......
...@@ -113,46 +113,8 @@ import { $EventBus } from "@/utils/EventBus"; ...@@ -113,46 +113,8 @@ import { $EventBus } from "@/utils/EventBus";
export default { export default {
mixins: [systemInfo], mixins: [systemInfo],
async onLoad(option) { onLoad(option) {
this.getSystemInfo() this.initData(option)
let oId = 0
// 从订阅消息进入
this.option = JSON.stringify(option)
const { orderId } = option
let Authorization = uni.getStorageSync('Authorization')
console.log(Authorization)
if(orderId){
if(!Authorization){
this.goBack()
return
}else{
oId = orderId
}
}else{
oId = uni.getStorageSync('orderId');
}
// return
const {data = {}} = await Order.getOrderDetail({orderId:oId})
this.orderInfo = data?.data
const getTime = ['2', '3'].indexOf(this.orderInfo.state) >= 0
const isBuild = ['4', '5'].indexOf(this.orderInfo.state) >= 0;
if(getTime){
const {data = {}} = await Order.getOrderWaiteTime({orderId:oId})
this.waitTime = data?.data
}
if (isBuild) {
new QRCode('myQrcode', {
text: this.orderInfo.pickCode,
width: 141, //canvas 画布的宽
height: 141, //canvas 画布的高
padding: 0, // 生成二维码四周自动留边宽度,不传入默认为0
correctLevel: QRCode.CorrectLevel.L, // 二维码可辨识度
callback: (res) => {
this.ewmImg = res.path
}
})
}
this.isBuild = isBuild
}, },
onUnload(){ onUnload(){
this.goBack() this.goBack()
...@@ -211,10 +173,53 @@ export default { ...@@ -211,10 +173,53 @@ export default {
this.backFlag = true this.backFlag = true
uni.switchTab({ url: '/pages/menu/menu' }) uni.switchTab({ url: '/pages/menu/menu' })
}, },
async initData(option){
this.getSystemInfo()
let oId = uni.getStorageSync('orderId');
// 从订阅消息进入
if(JSON.stringify(option)!=='{}'&&option){
this.option = JSON.stringify(option)
const { orderId = '' } = option
let Authorization = uni.getStorageSync('Authorization')
console.log(Authorization)
if(orderId){
if(!Authorization){
this.goBack()
return
}else{
oId = orderId
}
}
}
// return
const {data = {}} = await Order.getOrderDetail({orderId:oId})
this.orderInfo = data?.data
const getTime = ['2', '3'].indexOf(this.orderInfo.state) >= 0
const isBuild = ['4', '5'].indexOf(this.orderInfo.state) >= 0;
if(getTime){
const {data = {}} = await Order.getOrderWaiteTime({orderId:oId})
this.waitTime = data?.data
}
if (isBuild) {
new QRCode('myQrcode', {
text: this.orderInfo.pickCode,
width: 141, //canvas 画布的宽
height: 141, //canvas 画布的高
padding: 0, // 生成二维码四周自动留边宽度,不传入默认为0
correctLevel: QRCode.CorrectLevel.L, // 二维码可辨识度
callback: (res) => {
this.ewmImg = res.path
}
})
}
this.isBuild = isBuild
},
async PayNow() { async PayNow() {
const orderInfo = await Order.payOrder({ orderId: this.orderInfo.id }) const orderInfo = await Order.payOrder({ orderId: this.orderInfo.id })
const sendData = { const sendData = {
orderId: this.orderInfo.id, orderId: this.orderInfo.id,
switchTab:false,
callBack:this.initData,
...orderInfo.data.data ...orderInfo.data.data
} }
if (orderInfo) { if (orderInfo) {
......
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
requestPayment(data, oldData, buyType) { requestPayment(data, oldData, buyType) {
// res为调起微信支付所需参数 // res为调起微信支付所需参数
// 调起微信支付 // 调起微信支付
const { switchTab = true, callBack } = data
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', // 服务提提供商微信支付 provider: 'wxpay', // 服务提提供商微信支付
timeStamp: data.timeStamp, // 时间戳 timeStamp: data.timeStamp, // 时间戳
...@@ -61,8 +62,12 @@ export default { ...@@ -61,8 +62,12 @@ export default {
uni.setStorageSync('shopCarInfo', []); uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar'); $EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId); uni.setStorageSync('orderId', data.orderId);
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index' let url = '/orderSubPackage/pages/orderInfo/index'
uni.navigateTo({ url }) uni.navigateTo({ url })
}else{
callBack()
}
} }
// 业务逻辑。。。 // 业务逻辑。。。
...@@ -75,8 +80,12 @@ export default { ...@@ -75,8 +80,12 @@ export default {
uni.setStorageSync('shopCarInfo', []); uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar'); $EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId); uni.setStorageSync('orderId', data.orderId);
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index' let url = '/orderSubPackage/pages/orderInfo/index'
uni.navigateTo({ url }) uni.navigateTo({ url })
}else{
callBack()
}
}, },
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment