|
|
|
@ -6,28 +6,29 @@ |
|
|
|
|
<view class="idcard fcorfff font40 fontlet"> |
|
|
|
|
{{plateNumberStr==''?'¥0.00':'¥'+plateNumberStr}} |
|
|
|
|
</view> |
|
|
|
|
<view class="width40w mart10 line1"></view> |
|
|
|
|
<view class="width50w mart10 line1"></view> |
|
|
|
|
</view> |
|
|
|
|
<!-- 商家优惠 --> |
|
|
|
|
<view class="height50 width100 mart10 backcorfff" |
|
|
|
|
v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null"> |
|
|
|
|
v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null" @click="showPopupstore()"> |
|
|
|
|
<view class="width50 flleft fcor666 font16 alijusstart" style="padding-left: 5%;"> |
|
|
|
|
门店优惠 |
|
|
|
|
</view> |
|
|
|
|
<view class="width40 flright fotrt paddtright15 font15 fcoreb5 alijusend" style="align-items: center;" |
|
|
|
|
v-if="storeList.discountActivity.discountType == 1"> |
|
|
|
|
满{{storeList.discountActivity.discountCondition}}元减{{storeList.discountActivity.discountPrice}}元 |
|
|
|
|
v-if="storediscountPrice != 0 && storediscountType !=3"> |
|
|
|
|
-¥{{storediscountPrice}}元 |
|
|
|
|
</view> |
|
|
|
|
<view class="width40 flright fotrt paddtright15 font15 fcoreb5 alijusend" style="align-items: center;" |
|
|
|
|
v-if="storeList.discountActivity.discountType == 2"> |
|
|
|
|
全场立减{{storeList.discountActivity.discountPrice}} |
|
|
|
|
v-if="storediscountPrice != 0 && storediscountType ==3"> |
|
|
|
|
{{storediscountPrice}}折 |
|
|
|
|
</view> |
|
|
|
|
<view class="width40 flright fotrt paddtright15 font15 fcoreb5 alijusend" style="align-items: center;" |
|
|
|
|
v-if="storeList.discountActivity.discountType == 3"> |
|
|
|
|
全场打{{storeList.discountActivity.discountPrice}}折 |
|
|
|
|
<view class="width40 flright fotrt paddtright15 font15 fcor666 alijusend" style="align-items: center;" |
|
|
|
|
v-if="storediscountPrice == 0"> |
|
|
|
|
查看商户活动 |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
|
<view class="width90 line1 mart5 marb5"></view> |
|
|
|
|
<view class=" width90 line1 mart5 marb5"></view> |
|
|
|
|
<!-- 积分抵扣 --> |
|
|
|
|
<!-- <view class="height50 width100 backcorfff" v-if="!user" @click="showPopuplogin()"> |
|
|
|
|
<view class="width30 flleft fcor666 font16 alijusstart" style="padding-left: 5%;"> |
|
|
|
@ -67,10 +68,15 @@ |
|
|
|
|
<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;" |
|
|
|
|
v-if="deductionPrice != 0 && user" @click="showPopup()"> |
|
|
|
|
v-if="deductionPrice != 0 && userDiscountType !=3 && 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;" |
|
|
|
|
v-if="deductionPrice != 0 && userDiscountType ==3 && user" @click="showPopup()"> |
|
|
|
|
{{deductionPrice * 100}}折 |
|
|
|
|
<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;" |
|
|
|
|
v-if="!user" @click="showPopuplogin()"> |
|
|
|
|
登陆查看可享用优惠券 |
|
|
|
@ -115,21 +121,68 @@ |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<!-- 优惠券弹窗 scrollY="true" --> |
|
|
|
|
<wybPopup ref="popup" type="bottom" width="500" radius="6" :showCloseIcon="true"> |
|
|
|
|
<!-- 优惠券弹窗 --> |
|
|
|
|
<wybPopup ref="popup" type="bottom" width="500" radius="6" :showCloseIcon="true" scrollY="true"> |
|
|
|
|
<view class="fotct font18 fontwig6 fcor333 mart10 height30">优惠券选择</view> |
|
|
|
|
<view v-if="discountList == ''" class="mart60 fotct font14 fcor666"> |
|
|
|
|
<image mode="widthFix" style="width: 50vw;" src="../../static/noorder.png"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="width90 height40 tccs mart20 couts" v-for="(discout, index) in discountList" :key="index" |
|
|
|
|
<view class="width90 height60 mart20 couts" v-for="(discout, index) in discountList" :key="index" |
|
|
|
|
@click="radioChanges(discout)"> |
|
|
|
|
<view class="margle20"> |
|
|
|
|
<view class="yhprice"> |
|
|
|
|
<view class="alijusstart width94 mart5"> |
|
|
|
|
<view class="font16 width70 fontwig6 fcor333 text1">{{discout.discountName}}</view> |
|
|
|
|
<view class="width30 fotrt"> |
|
|
|
|
<radio :checked="discout.id == memDiscountId" color="#0083f5" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="font16 fontwig6 fcor333 text1">{{discout.discountName}}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="alijusstart width94 mart5"> |
|
|
|
|
<view class="font14 width40 fcor333" v-if="discout.discountType == 1"> |
|
|
|
|
满{{discout.discountCondition}}-{{discout.discountPrice}}元</view> |
|
|
|
|
<view class="font14 width40 fcor333" v-if="discout.discountType == 2">抵扣{{discout.discountPrice}}元 |
|
|
|
|
</view> |
|
|
|
|
<view class="font14 width40 fcor333" v-if="discout.discountType == 3"> |
|
|
|
|
{{discout.discountPrice * 100}}折 |
|
|
|
|
</view> |
|
|
|
|
<view class="font12 width60 fcor999 fotrt"> |
|
|
|
|
有效期:{{discout.useEndTime | timeFormat('yyyy-mm-dd')}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="height40p"></view> |
|
|
|
|
</wybPopup> |
|
|
|
|
<!-- 门店活动 --> |
|
|
|
|
<wybPopup ref="popupstore" type="bottom" width="500" radius="6" :showCloseIcon="true" scrollY="true"> |
|
|
|
|
<view class="fotct font18 fontwig6 fcor333 mart10 height30">门店活动选择</view> |
|
|
|
|
<view v-if="storeCouponlist == ''" class="mart60 fotct font14 fcor666"> |
|
|
|
|
<image mode="widthFix" style="width: 50vw;" src="../../static/noorder.png"></image> |
|
|
|
|
</view> |
|
|
|
|
<view class="width90 height60 mart20 couts" v-for="(discout, indexs) in storeCouponlist" :key="indexs" |
|
|
|
|
@click="radiostoreChanges(discout)"> |
|
|
|
|
<view class="alijusstart width94 mart5"> |
|
|
|
|
<view class="font16 width70 fontwig6 fcor333 text1">{{discout.name}}</view> |
|
|
|
|
<view class="width30 fotrt"> |
|
|
|
|
<radio :checked="discout.id == storeDiscountId" color="#0083f5" /> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="alijusstart width94 mart5"> |
|
|
|
|
<view class="font14 width40 fcor333" v-if="discout.discountType == 1"> |
|
|
|
|
满{{discout.discountCondition}}-{{discout.discountPrice}}元</view> |
|
|
|
|
<view class="font14 width40 fcor333" v-if="discout.discountType == 2">抵扣{{discout.discountPrice}}元 |
|
|
|
|
</view> |
|
|
|
|
<view class="font14 width40 fcor333" v-if="discout.discountType == 3">{{discout.discountPrice}}折 |
|
|
|
|
</view> |
|
|
|
|
<view class="font12 width60 fcor999 fotrt"> |
|
|
|
|
有效期:{{discout.endTime | timeFormat('yyyy-mm-dd')}} |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<!-- <view class="margle20"> |
|
|
|
|
<view class="yhprice"> |
|
|
|
|
<radio :checked="discout.id == storeDiscountId" color="#0083f5" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="font16 fontwig6 fcor333 text1">{{discout.name}}</view> |
|
|
|
|
</view> --> |
|
|
|
|
</view> |
|
|
|
|
<view class="height40p"></view> |
|
|
|
|
</wybPopup> |
|
|
|
|
|
|
|
|
|
<wybPopup ref="popups" type="center" height="850" width="600" bgColor="" radius="20" :showCloseIcon="false"> |
|
|
|
@ -178,15 +231,17 @@ |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
plateNumberList: [], |
|
|
|
|
length: 6, |
|
|
|
|
discountPrice: 0, //优惠金额 |
|
|
|
|
plateNumberList: [], //输出值 |
|
|
|
|
plateNumberList1: [], //计算值 |
|
|
|
|
length: 11, |
|
|
|
|
discountPrice: 0, //优惠金额 |
|
|
|
|
inputPrice: '', //输入金额 |
|
|
|
|
payPrice: 0, //支付金额 |
|
|
|
|
reNum: 0, // 是否重复 |
|
|
|
|
priceValue: [0, 0], // 可以指定默认值 |
|
|
|
|
discountList: '', //优惠券数据 |
|
|
|
|
memDiscountId: '', //选择中的值 |
|
|
|
|
userDiscountType: '', //选择的类型 |
|
|
|
|
numKeybordList: [ |
|
|
|
|
[1, 2, 3], |
|
|
|
|
[4, 5, 6], |
|
|
|
@ -200,6 +255,7 @@ |
|
|
|
|
cjstu: true, //禁止拖动 |
|
|
|
|
suNo: '', //sn号 |
|
|
|
|
storeList: '', //门店信息 |
|
|
|
|
storeCouponlist: '', //门店优惠券 |
|
|
|
|
isDiscount: true, |
|
|
|
|
user: '', //用户信息 |
|
|
|
|
deductionPrice: '0.00', //优惠券抵扣 |
|
|
|
@ -209,6 +265,11 @@ |
|
|
|
|
getCodeText: '获取验证码', |
|
|
|
|
getCodeBtnColor: "#ffffff", |
|
|
|
|
getCodeisWaiting: false, |
|
|
|
|
|
|
|
|
|
storediscountType: '', //门店优惠类型 |
|
|
|
|
storediscountCondition: '', //门店优惠条件 |
|
|
|
|
storediscountPrice: '', //门店优惠价格 |
|
|
|
|
storeDiscountId: '' //门店活动id |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() {}, |
|
|
|
@ -233,10 +294,10 @@ |
|
|
|
|
parice = str - (this.priceValue[1] / 10 / 10); |
|
|
|
|
if (str == 0) { |
|
|
|
|
this.calculation(0); |
|
|
|
|
} |
|
|
|
|
if (str) { |
|
|
|
|
} |
|
|
|
|
if (str) { |
|
|
|
|
this.calculation(str); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (parice > 0) { |
|
|
|
|
this.cjstu = false; |
|
|
|
|
} else { |
|
|
|
@ -346,6 +407,7 @@ |
|
|
|
|
data: res.return_data.uniqueCode |
|
|
|
|
}) |
|
|
|
|
this.$refs.popups.hide(); |
|
|
|
|
this.getQrCodeDetail(); |
|
|
|
|
this.getUserAccount(); |
|
|
|
|
this.queryUserDiscountList(); |
|
|
|
|
} else { |
|
|
|
@ -366,6 +428,10 @@ |
|
|
|
|
showPopup() { |
|
|
|
|
this.$refs.popup.show(); |
|
|
|
|
}, |
|
|
|
|
//门店活动弹窗 |
|
|
|
|
showPopupstore() { |
|
|
|
|
this.$refs.popupstore.show(); |
|
|
|
|
}, |
|
|
|
|
//查询积分 |
|
|
|
|
getUserAccount() { |
|
|
|
|
getUserAccount().then(res => { |
|
|
|
@ -394,22 +460,27 @@ |
|
|
|
|
let storetype = ''; |
|
|
|
|
let storeprice = ''; |
|
|
|
|
if (this.storeList.discountActivity != '' && this.storeList.discountActivity != null) { |
|
|
|
|
if (item >= this.storeList.discountActivity.discountCondition && this.storeList.discountActivity |
|
|
|
|
.discountType == 1) { |
|
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
|
if (item >= this.storediscountCondition && (this.storediscountType == 1 || this.storediscountType == |
|
|
|
|
2)) { |
|
|
|
|
storetype = this.storediscountType; |
|
|
|
|
storeprice = this.storediscountPrice; |
|
|
|
|
} else { |
|
|
|
|
storetype = this.storeList.discountActivity.discountType; |
|
|
|
|
storeprice = this.storeList.discountActivity.discountPrice; |
|
|
|
|
storetype = this.storediscountType; |
|
|
|
|
storeprice = this.storediscountPrice; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let phone = ''; |
|
|
|
|
if (app.globalData.userInfo) { |
|
|
|
|
phone = app.globalData.userInfo.phone; |
|
|
|
|
} |
|
|
|
|
let datas = { |
|
|
|
|
transactionPrice: item, |
|
|
|
|
storeDiscountType: storetype, |
|
|
|
|
storeDiscountPrice: storeprice, |
|
|
|
|
userDiscountType: this.memDiscountId, |
|
|
|
|
userDiscountPrice: this.deductionPrice |
|
|
|
|
userDiscountType: this.userDiscountType, |
|
|
|
|
userDiscountPrice: this.deductionPrice, |
|
|
|
|
storeDiscountId: this.storeDiscountId, |
|
|
|
|
userPhone: phone |
|
|
|
|
} |
|
|
|
|
calculation(datas).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
@ -421,44 +492,64 @@ |
|
|
|
|
}, |
|
|
|
|
//查询门店详情 |
|
|
|
|
getQrCodeDetail() { |
|
|
|
|
let phone = ''; |
|
|
|
|
if (app.globalData.userInfo) { |
|
|
|
|
phone = app.globalData.userInfo.phone; |
|
|
|
|
} |
|
|
|
|
let datas = { |
|
|
|
|
serialNumber: app.globalData.snNo |
|
|
|
|
serialNumber: app.globalData.snNo, |
|
|
|
|
phone: phone |
|
|
|
|
// app.globalData.snNo |
|
|
|
|
// 1000017421 |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
getQrCodeDetail(datas).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
this.storeList = res.return_data; |
|
|
|
|
if (res.return_data.discountActivity) { |
|
|
|
|
this.storeCouponlist = res.return_data.discountActivity; |
|
|
|
|
this.storediscountType = res.return_data.discountActivity[0].discountType; |
|
|
|
|
this.storediscountCondition = res.return_data.discountActivity[0].discountCondition; |
|
|
|
|
this.storediscountPrice = res.return_data.discountActivity[0].discountPrice; |
|
|
|
|
this.storeDiscountId = res.return_data.discountActivity[0].id; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.return_msg, |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//选择优惠券 |
|
|
|
|
radioChanges(item) { |
|
|
|
|
// this.rechangeload(); |
|
|
|
|
if (this.inputPrice == '') { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的支付金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.payPrice = 0; |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
this.$refs.popup.hide(); |
|
|
|
|
return; |
|
|
|
|
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.userDiscountType = ''; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} else { // 否则进行选中赋值 |
|
|
|
|
this.userDiscountType = item.discountType; |
|
|
|
|
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); |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请满' + item.discountCondition + '使用此券', |
|
|
|
@ -471,21 +562,69 @@ |
|
|
|
|
this.memDiscountId = item.id; |
|
|
|
|
//抵扣价格 |
|
|
|
|
this.deductionPrice = item.discountPrice; |
|
|
|
|
let oldprice = this.inputPrice - this.deductionPrice; |
|
|
|
|
this.calculation(oldprice); |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} |
|
|
|
|
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.deductionPrice = item.discountPrice; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$refs.popup.hide(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//选择门店优惠 |
|
|
|
|
radiostoreChanges(item) { |
|
|
|
|
if (this.inputPrice == '') { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的支付金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.payPrice = 0; |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
this.$refs.popupstore.hide(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.storeDiscountId == item.id) { // 如果已经选中,则取消选中 |
|
|
|
|
this.storeDiscountId = ''; |
|
|
|
|
this.storediscountPrice = '0.00'; |
|
|
|
|
this.storediscountType = ''; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} else { // 否则进行选中赋值 |
|
|
|
|
this.storediscountType = item.discountType; |
|
|
|
|
if (item.discountType == 1) { |
|
|
|
|
if (this.inputPrice >= item.discountCondition) { |
|
|
|
|
this.storeDiscountId = item.id; |
|
|
|
|
//满减价格 |
|
|
|
|
this.storediscountPrice = item.discountPrice; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请满' + item.discountCondition + '使用此券', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (item.discountType == 2) { |
|
|
|
|
this.storeDiscountId = item.id; |
|
|
|
|
//抵扣价格 |
|
|
|
|
this.storediscountPrice = item.discountPrice; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
} |
|
|
|
|
if (item.discountType == 3) { |
|
|
|
|
this.storeDiscountId = item.id; |
|
|
|
|
// 打折 |
|
|
|
|
this.storediscountPrice = item.discountPrice; |
|
|
|
|
this.calculation(this.inputPrice); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.$refs.popupstore.hide(); |
|
|
|
|
}, |
|
|
|
|
rechangeload() { |
|
|
|
|
this.isUse = false; |
|
|
|
|
this.$nextTick(() => (this.isUse = true)) |
|
|
|
@ -508,15 +647,24 @@ |
|
|
|
|
// 必须保证第一个为数字而不是. |
|
|
|
|
n = n.replace(/^\./g, '') |
|
|
|
|
// 保证只有出现一个.而没有多个. |
|
|
|
|
n = n.replace(/\.{2,}/g, '.') |
|
|
|
|
if (n == 0 || this.plateNumberList[lenth] == '') { |
|
|
|
|
n = n.replace(/\.{2,}/g, '.') |
|
|
|
|
// || this.plateNumberList[lenth] == '' |
|
|
|
|
if (n == 0) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的支付金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.payPrice = 0; |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
this.plateNumberList1 = []; |
|
|
|
|
this.storediscountType = ''; //门店优惠类型 |
|
|
|
|
this.storediscountCondition = ''; //门店优惠条件 |
|
|
|
|
this.storediscountPrice = ''; //门店优惠价格 |
|
|
|
|
this.storeDiscountId = ''; //门店活动id |
|
|
|
|
this.userDiscountType = ''; |
|
|
|
|
this.deductionPrice = ''; |
|
|
|
|
this.memDiscountId = ''; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// var userAgent = navigator.userAgent.toLowerCase(); |
|
|
|
@ -529,11 +677,18 @@ |
|
|
|
|
// 创建订单 |
|
|
|
|
createJSAPIOrder(item) { |
|
|
|
|
// "微信:WECHAT 支付宝:ALIPAY 银联:UQRCODEPAY", |
|
|
|
|
let phone = ''; |
|
|
|
|
if (app.globalData.userInfo) { |
|
|
|
|
phone = app.globalData.userInfo.phone; |
|
|
|
|
} |
|
|
|
|
let datas = { |
|
|
|
|
"qrCodeSN": app.globalData.snNo, |
|
|
|
|
"payUserId": app.globalData.openId, |
|
|
|
|
"payMode": item, |
|
|
|
|
"totalAmount": this.inputPrice |
|
|
|
|
"totalAmount": this.inputPrice, |
|
|
|
|
"storeDiscountId": this.storeDiscountId, |
|
|
|
|
"userDiscountId": this.memDiscountId, |
|
|
|
|
"userPhone": phone |
|
|
|
|
} |
|
|
|
|
createJSAPIOrder(datas).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
@ -554,7 +709,15 @@ |
|
|
|
|
} |
|
|
|
|
jsapiPay(datas).then(res => { |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
this.payRequest(res.return_data.payParam); |
|
|
|
|
if (res.return_data.payParam) { |
|
|
|
|
this.payRequest(res.return_data.payParam); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '单比金额最多10000000元', |
|
|
|
|
icon: 'none', |
|
|
|
|
duration: 2000 |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.return_msg, |
|
|
|
@ -566,8 +729,17 @@ |
|
|
|
|
}, |
|
|
|
|
//删除金额 |
|
|
|
|
deleteVal() { |
|
|
|
|
this.plateNumberList.pop(); |
|
|
|
|
this.priceValue[1] = 0; |
|
|
|
|
// this.plateNumberList.pop(); |
|
|
|
|
if (this.plateNumberList1[0] == 0 && this.plateNumberList1[1] == '.' && this.plateNumberList1.length == |
|
|
|
|
2) { |
|
|
|
|
this.plateNumberList = []; |
|
|
|
|
this.plateNumberList1 = []; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.plateNumberList.pop(); |
|
|
|
|
this.plateNumberList1.pop(); |
|
|
|
|
} |
|
|
|
|
// this.priceValue[1] = 0; |
|
|
|
|
this.reload(); |
|
|
|
|
}, |
|
|
|
|
//刷新组件 |
|
|
|
@ -597,32 +769,76 @@ |
|
|
|
|
}, |
|
|
|
|
//输入金额 |
|
|
|
|
input(val) { |
|
|
|
|
if (this.plateNumberList[0] == '.') { |
|
|
|
|
this.plateNumberList1.push(val); |
|
|
|
|
let lists = ''; |
|
|
|
|
this.plateNumberList1.forEach(item => { |
|
|
|
|
lists += item.toString(); |
|
|
|
|
}) |
|
|
|
|
var strdata1 = lists.split('.'); |
|
|
|
|
var strdata2 = /^[0-9]{0,7}(\.[0-9]{1,2})?$/.test(lists); |
|
|
|
|
//第一位输入0时 自动补值 |
|
|
|
|
if (this.plateNumberList1[0] == 0 && this.plateNumberList1.length < 2) { |
|
|
|
|
this.plateNumberList1 = ['0', '.']; |
|
|
|
|
this.plateNumberList = ['0', '.']; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//第一位输入小数点时 |
|
|
|
|
if (this.plateNumberList1[0] == '.') { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.plateNumberList1.pop(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (this.plateNumberList.length >= this.length) { |
|
|
|
|
// if (this.plateNumberList.indexOf('.') == 1 && val == '.') { |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// title: '请输入正确的金额', |
|
|
|
|
// duration: 2000, |
|
|
|
|
// icon: 'none' |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
//如果已经有小数点 并且输入的是小数点 |
|
|
|
|
if (strdata1.length == 3 && !strdata2) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.plateNumberList1.pop(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//校验小数点后两 |
|
|
|
|
if (this.plateNumberList.indexOf('.') != -1 && !strdata2) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请输入正确的金额', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.plateNumberList1.pop(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//校验没有小数点只能输入不超过7位 |
|
|
|
|
if (this.plateNumberList.length > 7 && this.plateNumberList.indexOf('.') == -1) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '输入金额不能超过最大值', |
|
|
|
|
title: '单比金额最多10000000元', |
|
|
|
|
duration: 2000, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
this.plateNumberList1.pop(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.plateNumberList.push(val); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
//微笑支付 |
|
|
|
|
//微信支付 |
|
|
|
|
payRequest: function(self) { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '支付中...' |
|
|
|
|
}) |
|
|
|
|
jweixin.config({ |
|
|
|
|
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 |
|
|
|
|
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 |
|
|
|
|
appId: self.appId, // 必填,公众号的唯一标识 |
|
|
|
|
timestamp: self.timeStamp, // 必填,生成签名的时间戳 |
|
|
|
|
nonceStr: self.nonceStr, // 必填,生成签名的随机串 |
|
|
|
|