Commit 3684fae3 by 宋冰琦

修复部分bug

parent c96c9e2a
......@@ -101,7 +101,7 @@ export default {
this.clientYEnd = e.changedTouches[0].clientY;
const val = parseInt((this.clientYStart-this.clientYEnd))
console.log(val)
if(val<-300){
if(val<-20){
console.log('滑动了:'+val + ',关闭')
this.close()
}else{
......
......@@ -47,6 +47,7 @@
<script>
import { $EventBus } from "../../utils/EventBus";
import Utils from '@/utils/utils'
import Order from '@/request/order'
export default {
name: 'menuAssembly',
props:['buied'],
......@@ -184,16 +185,19 @@ export default {
});
},
cart(item, category){
async cart(item, category){
console.log(item,category)
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){
this.showToast({
title: '该商品已售罄',
icon: 'none',
})
}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' })
}
......
......@@ -297,7 +297,7 @@ export default {
if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' });
this.getMenuList()
// this.getMenuList()
return;
}else{
goods.num = this.size;
......@@ -323,7 +323,7 @@ export default {
if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' });
this.getMenuList()
// this.getMenuList()
return;
}else{
goods.num = this.size
......
......@@ -113,46 +113,8 @@ import { $EventBus } from "@/utils/EventBus";
export default {
mixins: [systemInfo],
async onLoad(option) {
this.getSystemInfo()
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
onLoad(option) {
this.initData(option)
},
onUnload(){
this.goBack()
......@@ -211,10 +173,53 @@ export default {
this.backFlag = true
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() {
const orderInfo = await Order.payOrder({ orderId: this.orderInfo.id })
const sendData = {
orderId: this.orderInfo.id,
switchTab:false,
callBack:this.initData,
...orderInfo.data.data
}
if (orderInfo) {
......
......@@ -48,6 +48,7 @@ export default {
requestPayment(data, oldData, buyType) {
// res为调起微信支付所需参数
// 调起微信支付
const { switchTab = true, callBack } = data
uni.requestPayment({
provider: 'wxpay', // 服务提提供商微信支付
timeStamp: data.timeStamp, // 时间戳
......@@ -61,8 +62,12 @@ export default {
uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId);
let url = '/orderSubPackage/pages/orderInfo/index'
uni.navigateTo({ url })
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index'
uni.navigateTo({ url })
}else{
callBack()
}
}
// 业务逻辑。。。
......@@ -75,8 +80,12 @@ export default {
uni.setStorageSync('shopCarInfo', []);
$EventBus.$emit('updateCar');
uni.setStorageSync('orderId', data.orderId);
let url = '/orderSubPackage/pages/orderInfo/index'
uni.navigateTo({ url })
if(switchTab){
let url = '/orderSubPackage/pages/orderInfo/index'
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