| | |
| | | <template> |
| | | <view class="content"> |
| | | <view class="content" v-if="validPath"> |
| | | <view class="banner"> |
| | | <image src="/static/banner.png" mode="widthFix"></image> |
| | | </view> |
| | |
| | | </view> |
| | | <view class="btn" @click="sendSave">去支付</view> |
| | | </view> |
| | | <view class="box" v-else> |
| | | <image src="/static/ic_payfail.png" mode="widthFix" class="icon"></image> |
| | | <view class="title" >请使用微信或者支付宝应用扫码打开</view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | data() { |
| | | return { |
| | | flag:'name', |
| | | validPath : true, |
| | | form: { |
| | | type: 0, |
| | | name: '', |
| | |
| | | }, |
| | | mounted() { |
| | | this.loading=false |
| | | this.validPath = this.isWeChatBrowser() || this.isAlipayBrowser() |
| | | this.form.userId = this.fetchParams("userId",window.location.href) |
| | | }, |
| | | methods: { |
| | | // 判断是否在微信浏览器中打开 |
| | | isWeChatBrowser() { |
| | | // #ifdef H5 |
| | | const userAgent = navigator.userAgent.toLowerCase(); |
| | | return userAgent.indexOf('micromessenger') !== -1; |
| | | // #endif |
| | | return false; |
| | | }, |
| | | // 判断是否在支付宝浏览器中打开 |
| | | isAlipayBrowser() { |
| | | // #ifdef H5 |
| | | const userAgent = navigator.userAgent.toLowerCase(); |
| | | return userAgent.indexOf('alipayclient') !== -1; |
| | | // #endif |
| | | return false; |
| | | }, |
| | | toSuccess() { |
| | | uni.navigateTo({ |
| | | url: '/pages/success/success' |
| | |
| | | }, |
| | | async sendSave() { |
| | | if(this.loading){ |
| | | return |
| | | // return |
| | | } |
| | | this.loading=true |
| | | var that = this |
| | |
| | | if(!this.form.phone){ |
| | | uni.showToast({ |
| | | 'title': '请输入手机号',icon:'none' |
| | | }) |
| | | this.loading=false |
| | | return |
| | | } |
| | | if(this.form.phone.length != 11){ |
| | | uni.showToast({ |
| | | 'title': '请输入正确的11位手机号',icon:'none' |
| | | }) |
| | | this.loading=false |
| | | return |
| | |
| | | demo_form.submit() |
| | | |
| | | // this.toSuccess() |
| | | } |
| | | } |
| | | this.loading=false |
| | | }, |
| | | } |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .box { |
| | | width: 100%; |
| | | padding: 0 40rpx; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | flex-direction: column; |
| | | .icon { |
| | | width: 180rpx; |
| | | height: 180rpx; |
| | | margin-top: 54rpx; |
| | | } |
| | | .title { |
| | | font-size: 32rpx; |
| | | color: #222222; |
| | | margin-top: 32rpx; |
| | | } |
| | | } |
| | | .content { |
| | | width: 100%; |
| | | padding: 20rpx 30rpx; |
| | |
| | | width: 100%; |
| | | font-weight: 400; |
| | | font-size: 28rpx; |
| | | color: #999999; |
| | | //color: #999999; |
| | | text-align: right; |
| | | } |
| | | } |