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