|
|
@@ -23,7 +23,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<amountInput ref="amountInput" confirmText="付款" btnColor="#ff9900" placeholder="请输入交易金额" @change="change"
|
|
|
- @confirm="$u.debounce(pay, 1000)"></amountInput>
|
|
|
+ @confirm="debouncePay"></amountInput>
|
|
|
|
|
|
<u-modal v-model="payModalShow" :showCancelButton="true" confirm-color="#FF9447">
|
|
|
<view class="center flex-direction text-df" style="padding: 30rpx 40rpx;">
|
|
|
@@ -32,8 +32,9 @@
|
|
|
</view>
|
|
|
</u-modal>
|
|
|
|
|
|
- <u-modal v-model="modalShow" :mask-close-able="true" :showCancelButton="true" @cancel="payOfh5" @confirm="jumpLDT" cancel-text="直接付款"
|
|
|
- confirm-color="#FF9447" confirmText="去联兑通支付" content="去联兑通小程序付款会有更多优惠哟~"></u-modal>
|
|
|
+ <u-modal v-model="modalShow" :mask-close-able="true" :showCancelButton="true" @cancel="payOfh5"
|
|
|
+ @confirm="jumpLDT" cancel-text="直接付款" confirm-color="#FF9447" confirmText="去联兑通支付"
|
|
|
+ content="去联兑通小程序付款会有更多优惠哟~"></u-modal>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -45,6 +46,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isFirstPay: true,
|
|
|
orderAmount: '',
|
|
|
payModalShow: false,
|
|
|
modalShow: false,
|
|
|
@@ -60,19 +62,19 @@
|
|
|
} else {
|
|
|
this.shopId = options.id
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// #ifdef MP-WEIXIN
|
|
|
//如果是新用户通过微信支付扫码进入此页面,跳回首页
|
|
|
if (this.$isEmpty(this.vuex_userId)) {
|
|
|
uni.reLaunch({
|
|
|
- url:"/pages/mine/mine?query="+ this.shopId + ";" + this.orderAmount
|
|
|
+ url: "/pages/mine/mine?query=" + this.shopId + ";" + this.orderAmount
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
// #endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (this.$isEmpty(this.shopId)) {
|
|
|
this.$dialog.showModal('商户id不能为空', false).then(() => {
|
|
|
uni.navigateBack()
|
|
|
@@ -82,6 +84,15 @@
|
|
|
this.fetchShopDetail()
|
|
|
},
|
|
|
methods: {
|
|
|
+ //防抖支付
|
|
|
+ debouncePay() {
|
|
|
+ if (this.isFirstPay) {
|
|
|
+ this.pay()
|
|
|
+ this.isFirstPay = false
|
|
|
+ } else {
|
|
|
+ this.$u.debounce(this.pay, 500)
|
|
|
+ }
|
|
|
+ },
|
|
|
fetchShopDetail() {
|
|
|
this.$api.shop.detail({
|
|
|
id: this.shopId
|
|
|
@@ -151,12 +162,26 @@
|
|
|
let res = await this.$api.pay.payOrderOfscanCode(payObj)
|
|
|
if (!this.$isEmpty(res.data.qrCodeUrl)) {
|
|
|
location.href = res.data.qrCodeUrl
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.$u.toast('支付失败')
|
|
|
}
|
|
|
},
|
|
|
+ isMoney(s) {
|
|
|
+ var regu = "^[0-9]+[\.][0-9]{0,3}$";
|
|
|
+ var re = new RegExp(regu);
|
|
|
+ if (re.test(s)) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
async pay() {
|
|
|
- if (this.$isEmpty(this.orderAmount)) {
|
|
|
+ if (this.$isEmpty(this.orderAmount)
|
|
|
+ || !this.isMoney(this.orderAmount)
|
|
|
+ || this.orderAmount == '0'
|
|
|
+ || this.orderAmount == '0.'
|
|
|
+ || this.orderAmount == '0.0'
|
|
|
+ || this.orderAmount == '0.00') {
|
|
|
this.$u.toast('请输入交易金额')
|
|
|
return
|
|
|
}
|
|
|
@@ -192,10 +217,10 @@
|
|
|
this.$u.toast(resp.msg)
|
|
|
return
|
|
|
}
|
|
|
- if (resp.data.payAmount==0) {
|
|
|
- this.$dialog.showModal('已使用积分抵扣成功',false).then(()=>{
|
|
|
+ if (resp.data.payAmount == 0) {
|
|
|
+ this.$dialog.showModal('已使用积分抵扣成功', false).then(() => {
|
|
|
uni.navigateBack({
|
|
|
- delta:1
|
|
|
+ delta: 1
|
|
|
})
|
|
|
})
|
|
|
return
|
|
|
@@ -217,7 +242,7 @@
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
- page{
|
|
|
+ page {
|
|
|
background-color: #ffff;
|
|
|
}
|
|
|
</style>
|