Merge pull request '新人优惠券显示问题,使用优惠券价格问题' (#256) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/256
This commit is contained in:
hansu 2020-08-20 10:26:39 +08:00
commit 30539ddf64
6 changed files with 41 additions and 19 deletions

View File

@ -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;
} }
} }
}) })

View File

@ -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);
// }
// }
// })
//
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); 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) {

View File

@ -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({

View File

@ -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');

View File

@ -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
}); });

View File

@ -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;