doum
5 天以前 275b6c4986343c3e4230e1ad28ce9548b017d584
web/pages/index/index.vue
@@ -1,5 +1,5 @@
<template>
   <view class="content">
   <view class="content" v-if="validPath">
      <view class="banner">
         <image src="/static/banner.png" mode="widthFix"></image>
      </view>
@@ -38,6 +38,10 @@
      </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>
@@ -46,6 +50,7 @@
      data() {
         return {
            flag:'name',
            validPath : true,
            form: {
               type: 0,
               name: '',
@@ -59,9 +64,26 @@
      },
      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'
@@ -78,7 +100,7 @@
         },
         async sendSave() {
            if(this.loading){
               return
               // return
            }
            this.loading=true
            var that = this
@@ -92,6 +114,13 @@
            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
@@ -133,7 +162,7 @@
                  demo_form.submit() 
                  
               // this.toSuccess()
            }
            }
            this.loading=false
         },
      }
@@ -141,6 +170,25 @@
</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;
@@ -223,7 +271,7 @@
                  width: 100%;
                  font-weight: 400;
                  font-size: 28rpx;
                  color: #999999;
                  //color: #999999;
                  text-align: right;
               }
            }