新人优惠券显示问题,使用优惠券价格问题
This commit is contained in:
parent
c4821f888f
commit
51823edb12
@ -20,6 +20,7 @@ const store = new Vuex.Store({
|
|||||||
token: "", // 储存token
|
token: "", // 储存token
|
||||||
showLoginModel: false, // 登录框
|
showLoginModel: false, // 登录框
|
||||||
question: {}, // 帮助与反馈
|
question: {}, // 帮助与反馈
|
||||||
|
showCoupons: true, // 是否显示新人领取优惠券
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getOrderAddress(state) {
|
getOrderAddress(state) {
|
||||||
@ -79,6 +80,9 @@ const store = new Vuex.Store({
|
|||||||
},
|
},
|
||||||
setQuestion(state, question) {
|
setQuestion(state, question) {
|
||||||
state.question = question;
|
state.question = question;
|
||||||
|
},
|
||||||
|
updateShowCoupons(state, status) {
|
||||||
|
state.showCoupons = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -310,17 +310,30 @@ export default {
|
|||||||
setTotalPrice() {
|
setTotalPrice() {
|
||||||
const goods = this.orderInfo.store_goods_total;
|
const goods = this.orderInfo.store_goods_total;
|
||||||
// console.log(this.freight);
|
// console.log(this.freight);
|
||||||
const freight = this.freight;
|
let freight = 0, price = 0;
|
||||||
let price = 0;
|
|
||||||
// 商品价格加上运费
|
// 商品价格加上运费
|
||||||
[goods, freight].forEach(object => {
|
// [goods, freight].forEach(object => {
|
||||||
for (const key in object) {
|
// for (const key in object) {
|
||||||
if (object.hasOwnProperty(key)) {
|
// if (object.hasOwnProperty(key)) {
|
||||||
const element = object[key];
|
// const element = object[key];
|
||||||
price += Number(element);
|
// price += Number(element);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// 运费
|
||||||
|
for (const key in this.freight) {
|
||||||
|
if (this.freight.hasOwnProperty(key)) {
|
||||||
|
const element = this.freight[key];
|
||||||
|
freight += Number(element);
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
// 商品价格
|
||||||
|
for (const key in goods) {
|
||||||
|
if (goods.hasOwnProperty(key)) {
|
||||||
|
const element = goods[key];
|
||||||
|
price += Number(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 减去优惠券
|
// 减去优惠券
|
||||||
// 平台
|
// 平台
|
||||||
if(JSON.stringify(this.choiceCoupon) != '{}') price -= Number(this.choiceCoupon.voucher_price);
|
if(JSON.stringify(this.choiceCoupon) != '{}') price -= Number(this.choiceCoupon.voucher_price);
|
||||||
@ -333,8 +346,10 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 最低付款 0.01
|
||||||
|
if(price <= 0) price = 0.01;
|
||||||
// console.log(price);
|
// console.log(price);
|
||||||
this.totalPrice = price.toFixed(2);
|
this.totalPrice = (price + freight).toFixed(2);
|
||||||
},
|
},
|
||||||
setDelivery(index) {
|
setDelivery(index) {
|
||||||
if(index == 1) {
|
if(index == 1) {
|
||||||
|
@ -91,6 +91,8 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
async loginOut() {
|
async loginOut() {
|
||||||
|
// 显示新人领取优惠券
|
||||||
|
this.$store.commit('updateShowCoupons', true);
|
||||||
let im = this.imService
|
let im = this.imService
|
||||||
this.logout();
|
this.logout();
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
|
@ -301,17 +301,15 @@
|
|||||||
// that.imService.connectIM()
|
// that.imService.connectIM()
|
||||||
// },2000)
|
// },2000)
|
||||||
// }
|
// }
|
||||||
|
// 新人优惠券
|
||||||
// if (this.hasLogin) {
|
if (this.$store.state.showCoupons) {
|
||||||
// this.isNewmembervoucher();
|
this.isNewmembervoucher();
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
async onLoad(){
|
async onLoad(){
|
||||||
this.articleList = [];
|
this.articleList = [];
|
||||||
this.getArticlelist();
|
this.getArticlelist();
|
||||||
this.getSwiper();
|
this.getSwiper();
|
||||||
this.isNewmembervoucher();
|
|
||||||
|
|
||||||
// 优惠券
|
// 优惠券
|
||||||
// if(this.$store.state.hasLogin){
|
// if(this.$store.state.hasLogin){
|
||||||
// const user = uni.getStorageSync('user_info');
|
// const user = uni.getStorageSync('user_info');
|
||||||
@ -553,6 +551,7 @@
|
|||||||
},
|
},
|
||||||
// 是否显示新人优惠券
|
// 是否显示新人优惠券
|
||||||
isNewmembervoucher() {
|
isNewmembervoucher() {
|
||||||
|
this.$store.commit('updateShowCoupons', false);
|
||||||
this.$u.api.isNewmembervoucher().then(res => {
|
this.$u.api.isNewmembervoucher().then(res => {
|
||||||
if(res.errCode == 0) {
|
if(res.errCode == 0) {
|
||||||
this.$u.route('/pageB/coupon/index');
|
this.$u.route('/pageB/coupon/index');
|
||||||
|
@ -208,8 +208,9 @@ export default {
|
|||||||
this.getUserInfo();
|
this.getUserInfo();
|
||||||
this.getOrderNumber();
|
this.getOrderNumber();
|
||||||
},
|
},
|
||||||
onNavigationBarButtonTap() {
|
onNavigationBarButtonTap(e) {
|
||||||
this.toOtherPage("/setting/Index");
|
console.log(e);
|
||||||
|
if(e.index == 0) this.$u.route('/pageE/setting/Index');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
@ -236,6 +237,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
toOtherPage(url) {
|
toOtherPage(url) {
|
||||||
|
console.log(url);
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pageE' + url
|
url: '/pageE' + url
|
||||||
});
|
});
|
||||||
|
@ -83,7 +83,7 @@ const common = {
|
|||||||
url = '/pageC/merchant/index?id=' + id;
|
url = '/pageC/merchant/index?id=' + id;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
url = '/pageE/tool/MineCoupon'
|
url = '/pageE/mine/MemberServe?current=1'
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user