Commit fb561fe3 by songbingqi

修复部分bug

parent 793bf38d
......@@ -172,10 +172,11 @@ export default {
if (item.state == 1) {
item.rules.forEach(rule => {
this.available.push(rule.ruleId)
item.ruleIds.push(rule.ruleId)
})
}
})
console.log(this.selected,skus)
}
this.$nextTick(() => {
this.buildGoods(e => {
......
......@@ -239,6 +239,7 @@ export default {
// 从结算进入
console.log(from)
if(from==='settlement'){
uni.setStorageSync('shopCarInfo',[])
this.backToMneu = true
}
// 从订阅消息进入
......
......@@ -119,10 +119,14 @@ import Menu from '@/request/menu'
import User from '@/request/user'
import Order from '@/request/order'
export default {
onHide() {
this.goods = {}
},
onShow() {
this.goods = uni.getStorageSync('goodsList') || [];
console.log('show',this.goods)
if (JSON.stringify(this.goods)!="{}") {
// this.goods = uni.getStorageSync('goodsList') || {};
// setTimeout(() => {
console.log('onshow',this.returnFlag,uni.getStorageSync('shopCarInfo'))
if ((JSON.stringify(this.goods)!="{}")&&!this.returnFlag) {
Order.getWaitTine({
shopId: uni.getStorageSync('shopData').id,
goods: this.goods
......@@ -132,22 +136,16 @@ export default {
}else{
uni.switchTab({ url: '/pages/menu/menu' })
}
// }, 1000);
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')
this.TermsStatus = uni.getStorageSync('TermsStatus') || false
},
async onLoad(option) {
console.log('onload')
// 清除优惠卷信息
this.$store.commit("cleanInfo",{})
const {data} = await User.getUserMsgInfo()
console.log(data)
const {data:newdata} = data
const {flagExpireDate,sendMsgFlag1 = '',sendMsgFlag2 = '',sendMsgFlag3 = ''} = newdata
this.sendMsgData.sendMsgFlag1 = sendMsgFlag1
this.sendMsgData.sendMsgFlag2 = sendMsgFlag2
this.sendMsgData.sendMsgFlag3 = sendMsgFlag3
this.sendMsgData.flagExpireData = flagExpireDate?Date.parse(flagExpireDate.substring(0,10)):''
if(!this.userms){
User.wxLoginAndGetOpenid(true).then(loginInfo=>{
this.loginInfo = loginInfo
......@@ -155,6 +153,9 @@ export default {
}
// 商品详情页点击立即支付进入
if (option.goodsList) {
console.log('详情进入')
this.returnFlag = false
this.getMessageFlag()
const shopData = uni.getStorageSync('shopData');
this.shopData = shopData
this.buyType = 3;
......@@ -170,6 +171,10 @@ export default {
const { q } = option;
// console.log(q);
if (q) {
console.log('扫码进入')
this.returnFlag = false
this.getMessageFlag()
this.saveGetTicket()
User.getLocation((state, params) => {
uni.removeStorageSync('shopCarInfo');
$EventBus.$emit('updateCar');
......@@ -191,22 +196,26 @@ export default {
}
// 购物车点击进入
if(uni.getStorageSync('shopCarInfo').length!=0) {
console.log('购物车进入')
this.returnFlag = false
this.getMessageFlag()
console.log(uni.getStorageSync('shopCarInfo'))
const shopData = uni.getStorageSync('shopData');
this.shopData = shopData
this.buyType = 3;
const shopCarInfo = uni.getStorageSync('shopCarInfo') || []
this.goods = shopCarInfo.filter(item => item.flag);
// Order.getWaitTine({
// shopId: uni.getStorageSync('shopData').id,
// goods: this.goods
// }).then(({ data }) => {
// this.duration = data.data
// })
console.log(this.goods)
this.saveGetTicket()
return
}
},
data() {
return {
returnFlag:true,
messageList:[
{
tmp:'1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU',
......@@ -257,6 +266,7 @@ export default {
return this.$store.getters.Authorization;
},
totalNum() {
if(JSON.stringify(this.goods)=='{}')return 0
let totalNum = 0;
this.goods.map(item => {
item.flag ? totalNum += item.num : totalNum += 0
......@@ -264,6 +274,7 @@ export default {
return totalNum
},
reduction() {
if(JSON.stringify(this.goods)=='{}')return 0
let price = 0;
let discountNum = 0;
this.goods.forEach(item => {
......@@ -279,8 +290,8 @@ export default {
return (price - discountNum).toFixed(2)
},
amountOld() {
if(JSON.stringify(this.goods)=='{}')return 0
let totalPrice = 0;
this.goods.forEach(item => {
const sku = item.sku;
item.flag ? totalPrice += (item.num * sku.discount) : (totalPrice += 0)
......@@ -289,8 +300,8 @@ export default {
return totalPrice.toFixed(2)
},
totalPrice() {
if(JSON.stringify(this.goods)=='{}')return 0
let totalPrice = 0;
this.goods.forEach(item => {
const sku = item.sku;
item.flag ? totalPrice += (item.num * sku.discount) : (totalPrice += 0)
......@@ -302,6 +313,16 @@ export default {
}
},
methods: {
async getMessageFlag() {
const {data} = await User.getUserMsgInfo()
console.log(data)
const {data:newdata} = data
const {flagExpireDate,sendMsgFlag1 = '',sendMsgFlag2 = '',sendMsgFlag3 = ''} = newdata
this.sendMsgData.sendMsgFlag1 = sendMsgFlag1
this.sendMsgData.sendMsgFlag2 = sendMsgFlag2
this.sendMsgData.sendMsgFlag3 = sendMsgFlag3
this.sendMsgData.flagExpireData = flagExpireDate?Date.parse(flagExpireDate.substring(0,10)):''
},
cancleMessage() {
this.messagePopup = false
this.sendMsgData = {
......
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