1.修改扫码支付的页面

dev
杨杰 2 years ago
parent fd9cc64bf6
commit f1a67b1131
  1. 182
      pages/index/index.vue
  2. 2
      pages/welcome/welcome.vue

@ -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使timeStampS timestamp: self
.timeStamp, // jssdk使timestamp使timeStampS
nonceStr: self.nonceStr, // 32 nonceStr: self.nonceStr, // 32
package: self.package, // prepay_idprepay_id=*** package: self.package, // prepay_idprepay_id=***
signType: self.signType, // 'SHA1'使'MD5' signType: self.signType, // 'SHA1'使'MD5'

@ -60,7 +60,7 @@
url:'../index/index' url:'../index/index'
}) })
} else { } else {
this.jumpcdx(); this.jumpWeb();
} }
}); });
}, },

Loading…
Cancel
Save