|
|
@ -9,7 +9,8 @@ |
|
|
|
<view class="width40w mart10 line1"></view> |
|
|
|
<view class="width40w mart10 line1"></view> |
|
|
|
</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 class="width50 flleft fcor666 font16 alijusstart" style="padding-left: 5%;"> |
|
|
|
门店优惠 |
|
|
|
门店优惠 |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -67,7 +68,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;" |
|
|
|
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;" |
|
|
|
v-if="deductionPrice != 0 && user" @click="showPopup()"> |
|
|
|
v-if="deductionPrice != 0 && user" @click="showPopup()"> |
|
|
|
暂无优惠券 |
|
|
|
-¥{{deductionPrice}} |
|
|
|
<image style="width: 40rpx;height: 40rpx;" src="../../static/jt.png"></image> |
|
|
|
<image style="width: 40rpx;height: 40rpx;" src="../../static/jt.png"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;" |
|
|
|
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;" |
|
|
@ -124,7 +125,7 @@ |
|
|
|
@click="radioChanges(discout)"> |
|
|
|
@click="radioChanges(discout)"> |
|
|
|
<view class="margle20"> |
|
|
|
<view class="margle20"> |
|
|
|
<view class="yhprice"> |
|
|
|
<view class="yhprice"> |
|
|
|
<radio :checked="discout.id == memDiscountId.indexOf(discout.id)" color="#0083f5" /> |
|
|
|
<radio :checked="discout.id == memDiscountId" color="#0083f5" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="font16 fontwig6 fcor333 text1">{{discout.discountName}}</view> |
|
|
|
<view class="font16 fontwig6 fcor333 text1">{{discout.discountName}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -145,7 +146,6 @@ |
|
|
|
<view class="btn mart30" @tap="doReg">立即登录</view> |
|
|
|
<view class="btn mart30" @tap="doReg">立即登录</view> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- </view> --> |
|
|
|
|
|
|
|
</wybPopup> |
|
|
|
</wybPopup> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
@ -180,13 +180,13 @@ |
|
|
|
return { |
|
|
|
return { |
|
|
|
plateNumberList: [], |
|
|
|
plateNumberList: [], |
|
|
|
length: 6, |
|
|
|
length: 6, |
|
|
|
discountPrice: 0, //优惠金额 |
|
|
|
discountPrice: 0, //优惠金额 |
|
|
|
inputPrice: '', //输入金额 |
|
|
|
inputPrice: '', //输入金额 |
|
|
|
payPrice: 0, //支付金额 |
|
|
|
payPrice: 0, //支付金额 |
|
|
|
reNum: 0, // 是否重复 |
|
|
|
reNum: 0, // 是否重复 |
|
|
|
priceValue: [0, 0], // 可以指定默认值 |
|
|
|
priceValue: [0, 0], // 可以指定默认值 |
|
|
|
discountList: '', //优惠券数据 |
|
|
|
discountList: '', //优惠券数据 |
|
|
|
memDiscountId: [], //选择中的值 |
|
|
|
memDiscountId: '', //选择中的值 |
|
|
|
numKeybordList: [ |
|
|
|
numKeybordList: [ |
|
|
|
[1, 2, 3], |
|
|
|
[1, 2, 3], |
|
|
|
[4, 5, 6], |
|
|
|
[4, 5, 6], |
|
|
@ -211,35 +211,8 @@ |
|
|
|
getCodeisWaiting: false, |
|
|
|
getCodeisWaiting: false, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() {}, |
|
|
|
// this.openKeyBoard('number'); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onLoad: function() { |
|
|
|
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) { |
|
|
|
if (app.globalData.snNo) { |
|
|
|
this.getQrCodeDetail(); |
|
|
|
this.getQrCodeDetail(); |
|
|
|
} |
|
|
|
} |
|
|
@ -257,17 +230,16 @@ |
|
|
|
this.plateNumberList.forEach(item => { |
|
|
|
this.plateNumberList.forEach(item => { |
|
|
|
str += item.toString(); |
|
|
|
str += item.toString(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
parice = str - (this.priceValue[1] / 10 / 10); |
|
|
|
parice = str - (this.priceValue[1] / 10 / 10); |
|
|
|
if(str == 0){ |
|
|
|
if (str == 0) { |
|
|
|
this.calculation(0); |
|
|
|
this.calculation(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (str) { |
|
|
|
|
|
|
|
this.calculation(str); |
|
|
|
} |
|
|
|
} |
|
|
|
if(str){ |
|
|
|
|
|
|
|
this.calculation(str); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (parice > 0) { |
|
|
|
if (parice > 0) { |
|
|
|
this.cjstu = false; |
|
|
|
this.cjstu = false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// this.payPrice = 0; |
|
|
|
|
|
|
|
this.priceValue = [0, 0]; |
|
|
|
this.priceValue = [0, 0]; |
|
|
|
} |
|
|
|
} |
|
|
|
this.inputPrice = str; |
|
|
|
this.inputPrice = str; |
|
|
@ -375,6 +347,7 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.$refs.popups.hide(); |
|
|
|
this.$refs.popups.hide(); |
|
|
|
this.getUserAccount(); |
|
|
|
this.getUserAccount(); |
|
|
|
|
|
|
|
this.queryUserDiscountList(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.showtoastdes = res.return_msg; |
|
|
|
this.showtoastdes = res.return_msg; |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
@ -389,6 +362,10 @@ |
|
|
|
showPopuplogin() { |
|
|
|
showPopuplogin() { |
|
|
|
this.$refs.popups.show(); |
|
|
|
this.$refs.popups.show(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
//显示弹出 |
|
|
|
|
|
|
|
showPopup() { |
|
|
|
|
|
|
|
this.$refs.popup.show(); |
|
|
|
|
|
|
|
}, |
|
|
|
//查询积分 |
|
|
|
//查询积分 |
|
|
|
getUserAccount() { |
|
|
|
getUserAccount() { |
|
|
|
getUserAccount().then(res => { |
|
|
|
getUserAccount().then(res => { |
|
|
@ -415,23 +392,24 @@ |
|
|
|
//计算价格 |
|
|
|
//计算价格 |
|
|
|
calculation(item) { |
|
|
|
calculation(item) { |
|
|
|
let storetype = ''; |
|
|
|
let storetype = ''; |
|
|
|
let storeprice = ''; |
|
|
|
let storeprice = ''; |
|
|
|
if(this.storeList.discountActivity !='' && this.storeList.discountActivity !=null){ |
|
|
|
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 |
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
.discountType == 1) { |
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
}else{ |
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
} else { |
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
} |
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let datas = { |
|
|
|
let datas = { |
|
|
|
transactionPrice: item, |
|
|
|
transactionPrice: item, |
|
|
|
storeDiscountType: storetype, |
|
|
|
storeDiscountType: storetype, |
|
|
|
storeDiscountPrice: storeprice, |
|
|
|
storeDiscountPrice: storeprice, |
|
|
|
userDiscountType: '', |
|
|
|
userDiscountType: this.memDiscountId, |
|
|
|
userDiscountPrice: '' |
|
|
|
userDiscountPrice: this.deductionPrice |
|
|
|
} |
|
|
|
} |
|
|
|
calculation(datas).then(res => { |
|
|
|
calculation(datas).then(res => { |
|
|
|
if (res.return_code == '000000') { |
|
|
|
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() { |
|
|
|
getQrCodeDetail() { |
|
|
|
let datas = { |
|
|
|
let datas = { |
|
|
@ -467,13 +432,63 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//显示弹出 |
|
|
|
|
|
|
|
showPopup() { |
|
|
|
|
|
|
|
this.$refs.popup.show(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//选择优惠券 |
|
|
|
//选择优惠券 |
|
|
|
radioChanges(item) { |
|
|
|
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() { |
|
|
|
jumpWeb() { |
|
|
@ -488,31 +503,13 @@ |
|
|
|
//提交支付 |
|
|
|
//提交支付 |
|
|
|
confirm() { |
|
|
|
confirm() { |
|
|
|
let lenth = this.plateNumberList.length - 1; |
|
|
|
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 n = String(this.payPrice) |
|
|
|
var t = n.charAt(0) |
|
|
|
var t = n.charAt(0) |
|
|
|
// 必须保证第一个为数字而不是. |
|
|
|
// 必须保证第一个为数字而不是. |
|
|
|
n = n.replace(/^\./g, '') |
|
|
|
n = n.replace(/^\./g, '') |
|
|
|
// 保证只有出现一个.而没有多个. |
|
|
|
// 保证只有出现一个.而没有多个. |
|
|
|
n = n.replace(/\.{2,}/g, '.') |
|
|
|
n = n.replace(/\.{2,}/g, '.') |
|
|
|
if (n == 0) { |
|
|
|
if (n == 0 || this.plateNumberList[lenth] == '') { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '请输入正确的支付金额', |
|
|
|
title: '请输入正确的支付金额', |
|
|
|
duration: 2000, |
|
|
|
duration: 2000, |
|
|
@ -641,7 +638,8 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
jweixin.chooseWXPay({ |
|
|
|
jweixin.chooseWXPay({ |
|
|
|
appId: self.appId, |
|
|
|
appId: self.appId, |
|
|
|
timestamp: self.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 |
|
|
|
timestamp: self |
|
|
|
|
|
|
|
.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 |
|
|
|
nonceStr: self.nonceStr, // 支付签名随机串,不长于 32 位 |
|
|
|
nonceStr: self.nonceStr, // 支付签名随机串,不长于 32 位 |
|
|
|
package: self.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***) |
|
|
|
package: self.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***) |
|
|
|
signType: self.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' |
|
|
|
signType: self.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' |
|
|
|