Commit fb561fe3 by songbingqi

修复部分bug

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