doum
7 天以前 b574291c99bba5819fe2d69405ffa10e9d47d994
web/pages/index/index.vue
@@ -53,10 +53,12 @@
               money: '',
               remark: '',
               userId:''
            }
            },
            loading:false
         }
      },
      mounted() {
         this.loading=false
         this.form.userId = this.fetchParams("userId",window.location.href)
      },
      methods: {
@@ -75,17 +77,23 @@
            return decodeURIComponent(results[2].replace(/\+/g, ' '));
         },
         async sendSave() {
            if(this.loading){
               return
            }
            this.loading=true
            var that = this
            if(!this.form.name){
               uni.showToast({
                  'title': '请输入姓名',icon:'none'
               })
               this.loading=false
               return
            }
            if(!this.form.phone){
               uni.showToast({
                  'title': '请输入手机号',icon:'none'
               })
               this.loading=false
               return
            }
            if(!this.form.money || this.form.money < 0.01){
@@ -95,21 +103,15 @@
               return
            }
            let res = await this.$u.api.orderCreate(this.form)
            if (res.code === 200) {
            if (res && res.code === 200) {
                const url = res.data.url
                // axios.post('https://third-party-website.com/api/submit', this.formData, {
                //   headers: { 'Content-Type': 'application/json' } // 根据需要添加其他头部信息,如认证令牌等。
                // })
                // axios.post(res.data.url, res.data.params);
               // const resolve = this.$router.push(url,params);
               // window.open(resolve.href, "_blank")
                console.log(res)
                const elements = document.querySelectorAll('form');
                if(elements&& elements.length){
                   elements.forEach(element => {
                       element.remove();
                   })
                }
                uni.showToast({title:'发起支付中'})
                var demo_form = document.createElement("form");
                  demo_form.action = url;
                  demo_form.id = "tempFromId";
@@ -128,13 +130,11 @@
                     }
                  }
                  document.body.appendChild(demo_form)
                  uni.showToast({
                     'title': '特挑剔',icon:'none'
                  })
                  demo_form.submit() 
                  
               // this.toSuccess()
            }
            this.loading=false
         },
      }
   }