|
|
|
@ -9,7 +9,8 @@ |
|
|
|
|
<view class="width40w mart10 line1"></view> |
|
|
|
|
</view> |
|
|
|
|
<!-- 商家优惠 --> |
|
|
|
|
<view class="height50 width100 mart10 backcorfff" v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null"> |
|
|
|
|
<view class="height50 width100 mart10 backcorfff" |
|
|
|
|
v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null"> |
|
|
|
|
<view class="width50 flleft fcor666 font16 alijusstart" style="padding-left: 5%;"> |
|
|
|
|
门店优惠 |
|
|
|
|
</view> |
|
|
|
@ -67,7 +68,7 @@ |
|
|
|
|
</view> |
|
|
|
|
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;" |
|
|
|
|
v-if="deductionPrice != 0 && user" @click="showPopup()"> |
|
|
|
|
暂无优惠券 |
|
|
|
|
-¥{{deductionPrice}} |
|
|
|
|
<image style="width: 40rpx;height: 40rpx;" src="../../static/jt.png"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;" |
|
|
|
@ -124,7 +125,7 @@ |
|
|
|
|
@click="radioChanges(discout)"> |
|
|
|
|
<view class="margle20"> |
|
|
|
|
<view class="yhprice"> |
|
|
|
|
<radio :checked="discout.id == memDiscountId.indexOf(discout.id)" color="#0083f5" /> |
|
|
|
|
<radio :checked="discout.id == memDiscountId" color="#0083f5" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="font16 fontwig6 fcor333 text1">{{discout.discountName}}</view> |
|
|
|
|
</view> |
|
|
|
@ -145,7 +146,6 @@ |
|
|
|
|
<view class="btn mart30" @tap="doReg">立即登录</view> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
<!-- </view> --> |
|
|
|
|
</wybPopup> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
@ -186,7 +186,7 @@ |
|
|
|
|
reNum: 0, // 是否重复 |
|
|
|
|
priceValue: [0, 0], // 可以指定默认值 |
|
|
|
|
discountList: '', //优惠券数据 |
|
|
|
|
memDiscountId: [], //选择中的值 |
|
|
|
|
memDiscountId: '', //选择中的值 |
|
|
|
|
numKeybordList: [ |
|
|
|
|
[1, 2, 3], |
|
|
|
|
[4, 5, 6], |
|
|
|
@ -211,35 +211,8 @@ |
|
|
|
|
getCodeisWaiting: false, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
// this.openKeyBoard('number'); |
|
|
|
|
}, |
|
|
|
|
mounted() {}, |
|
|
|
|
onLoad: function() { |
|
|
|
|
// var arr1 = window.location.href; |
|
|
|
|
// var arr2 = arr1.split('='); |
|
|
|
|
// if (arr2[1].length == 12) { |
|
|
|
|
// var arr3 = arr2[1].split('#/'); |
|
|
|
|
// app.globalData.snNo = arr3[0]; |
|
|
|
|
// uni.setStorage({ |
|
|
|
|
// key: "snNumber", |
|
|
|
|
// data: arr3[0] |
|
|
|
|
// }) |
|
|
|
|
// this.jumpWeb(); |
|
|
|
|
// } else { |
|
|
|
|
// let that = this; |
|
|
|
|
// var arr4 = arr2[2].split('&'); |
|
|
|
|
// app.globalData.code = arr4[0]; |
|
|
|
|
// uni.getStorage({ |
|
|
|
|
// key: 'snNumber', |
|
|
|
|
// success(e) { |
|
|
|
|
// app.globalData.snNo = e.data; |
|
|
|
|
// that.getQrCodeDetail(); |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// if (app.globalData.code) { |
|
|
|
|
// this.getH5AccessToken(); |
|
|
|
|
// } |
|
|
|
|
if (app.globalData.snNo) { |
|
|
|
|
this.getQrCodeDetail(); |
|
|
|
|
} |
|
|
|
@ -267,7 +240,6 @@ |
|
|
|
|
if (parice > 0) { |
|
|
|
|
this.cjstu = false; |
|
|
|
|
} else { |
|
|
|
|
// this.payPrice = 0; |
|
|
|
|
this.priceValue = [0, 0]; |
|
|
|
|
} |
|
|
|
|
this.inputPrice = str; |
|
|
|
@ -375,6 +347,7 @@ |
|
|
|
|
}) |
|
|
|
|
this.$refs.popups.hide(); |
|
|
|
|
this.getUserAccount(); |
|
|
|
|
this.queryUserDiscountList(); |
|
|
|
|
} else { |
|
|
|
|
this.showtoastdes = res.return_msg; |
|
|
|
|
uni.showToast({ |
|
|
|
@ -389,6 +362,10 @@ |
|
|
|
|
showPopuplogin() { |
|
|
|
|
this.$refs.popups.show(); |
|
|
|
|
}, |
|
|
|
|
//显示弹出 |
|
|
|
|
showPopup() { |
|
|
|
|
this.$refs.popup.show(); |
|
|
|
|
}, |
|
|
|
|
//查询积分 |
|
|
|
|
getUserAccount() { |
|
|
|
|
getUserAccount().then(res => { |
|
|
|
@ -417,7 +394,8 @@ |
|
|
|
|
let storetype = ''; |
|
|
|
|
let storeprice = ''; |
|
|
|
|
if (this.storeList.discountActivity != '' && this.storeList.discountActivity != null) { |
|
|
|
|
if (item >= this.storeList.discountActivity.discountCondition && this.storeList.discountActivity.discountType == 1) { |
|
|
|
|
if (item >= this.storeList.discountActivity.discountCondition && this.storeList.discountActivity |
|
|
|
|
.discountType == 1) { |
|
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
|
} else { |
|
|
|
@ -430,8 +408,8 @@ |
|
|
|
|
transactionPrice: item, |
|
|
|
|
storeDiscountType: storetype, |
|
|
|
|
storeDiscountPrice: storeprice, |
|
|
|
|
userDiscountType: '', |
|
|
|
|
userDiscountPrice: '' |
|
|
|
|
userDiscountType: this.memDiscountId, |
|
|
|
|
userDiscountPrice: this.deductionPrice |
|
|
|
|
} |
|
|
|
|
calculation(datas).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
@ -441,19 +419,6 @@ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//H5 获取openId |
|
|
|
|
// getH5AccessToken(item) { |
|
|
|
|
// let params = { |
|
|
|
|
// code: app.globalData.code |
|
|
|
|
// } |
|
|
|
|
// getH5AccessToken(params).then(res => { |
|
|
|
|
// if (res.return_code == '000000' && res.return_data.openid) { |
|
|
|
|
// app.globalData.openId = res.return_data.openid; |
|
|
|
|
// } else { |
|
|
|
|
// this.jumpWeb(); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// }, |
|
|
|
|
//查询门店详情 |
|
|
|
|
getQrCodeDetail() { |
|
|
|
|
let datas = { |
|
|
|
@ -467,13 +432,63 @@ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//显示弹出 |
|
|
|
|
showPopup() { |
|
|
|
|
this.$refs.popup.show(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//选择优惠券 |
|
|
|
|
radioChanges(item) { |
|
|
|
|
// this.rechangeload(); |
|
|
|
|
if (this.inputPrice == '') { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的支付金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.payPrice = 0; |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
this.$refs.popup.hide(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.memDiscountId == item.id) { // 如果已经选中,则取消选中 |
|
|
|
|
this.memDiscountId = ''; |
|
|
|
|
this.deductionPrice = '0.00'; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} else { // 否则进行选中赋值 |
|
|
|
|
if (item.discountType == 1) { |
|
|
|
|
if (this.inputPrice >= item.discountCondition) { |
|
|
|
|
this.memDiscountId = item.id; |
|
|
|
|
//满减价格 |
|
|
|
|
this.deductionPrice = item.discountPrice; |
|
|
|
|
let oldprice = this.inputPrice - this.deductionPrice; |
|
|
|
|
this.calculation(oldprice); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请满' + item.discountCondition + '使用此券', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (item.discountType == 2) { |
|
|
|
|
this.memDiscountId = item.id; |
|
|
|
|
//抵扣价格 |
|
|
|
|
this.deductionPrice = item.discountPrice; |
|
|
|
|
let oldprice = this.inputPrice - this.deductionPrice; |
|
|
|
|
this.calculation(oldprice); |
|
|
|
|
} |
|
|
|
|
if (item.discountType == 3) { |
|
|
|
|
this.memDiscountId = item.id; |
|
|
|
|
// 打折 |
|
|
|
|
this.deductionPrice = parseFloat(this.inputPrice - (this.inputPrice * item.discountPrice)).toFixed( |
|
|
|
|
2); |
|
|
|
|
let oldprice = parseFloat(this.inputPrice * item.discountPrice).toFixed(2); |
|
|
|
|
this.calculation(oldprice); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$refs.popup.hide(); |
|
|
|
|
}, |
|
|
|
|
rechangeload() { |
|
|
|
|
this.isUse = false; |
|
|
|
|
this.$nextTick(() => (this.isUse = true)) |
|
|
|
|
}, |
|
|
|
|
//重定向方法 |
|
|
|
|
jumpWeb() { |
|
|
|
@ -488,31 +503,13 @@ |
|
|
|
|
//提交支付 |
|
|
|
|
confirm() { |
|
|
|
|
let lenth = this.plateNumberList.length - 1; |
|
|
|
|
// if (!this.payPrice) { |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// title: '请输入支付金额', |
|
|
|
|
// duration: 2000, |
|
|
|
|
// icon: 'none' |
|
|
|
|
// }) |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
if (this.plateNumberList[lenth] == '.') { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的支付金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.payPrice = 0; |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
var n = String(this.payPrice) |
|
|
|
|
var t = n.charAt(0) |
|
|
|
|
// 必须保证第一个为数字而不是. |
|
|
|
|
n = n.replace(/^\./g, '') |
|
|
|
|
// 保证只有出现一个.而没有多个. |
|
|
|
|
n = n.replace(/\.{2,}/g, '.') |
|
|
|
|
if (n == 0) { |
|
|
|
|
if (n == 0 || this.plateNumberList[lenth] == '') { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的支付金额', |
|
|
|
|
duration: 2000, |
|
|
|
@ -641,7 +638,8 @@ |
|
|
|
|
}); |
|
|
|
|
jweixin.chooseWXPay({ |
|
|
|
|
appId: self.appId, |
|
|
|
|
timestamp: self.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 |
|
|
|
|
timestamp: self |
|
|
|
|
.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 |
|
|
|
|
nonceStr: self.nonceStr, // 支付签名随机串,不长于 32 位 |
|
|
|
|
package: self.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***) |
|
|
|
|
signType: self.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' |
|
|
|
|