From e293974e1be9d2b6894cbf2fa5841a8bd21163de Mon Sep 17 00:00:00 2001
From: liangjin <liangjin@finlean.com>
Date: Tue, 11 May 2021 15:40:40 +0800
Subject: [PATCH] 支付宝重构

---
 pages/shskPage/orderInfo/orderInfo.js |   63 ++++++++++++++++++++++++-------
 1 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/pages/shskPage/orderInfo/orderInfo.js b/pages/shskPage/orderInfo/orderInfo.js
index cab45f3..c8464e8 100644
--- a/pages/shskPage/orderInfo/orderInfo.js
+++ b/pages/shskPage/orderInfo/orderInfo.js
@@ -1,4 +1,5 @@
 let $api = require('../../../utils/ajaxFn.js')
+let validator = require('../../../utils/validator.js')
 Page({
   data: {
     userStyle: {},
@@ -29,17 +30,24 @@
     } else if (code == 2) {
       obj.goodsName = value
     }
-    console.log(obj)
     this.setData({
       info: { ...this.data.info,...obj }
     })
     if(code == 1&&this.data.info.payAmt){
       this.getTaril()
     }
+    if(code == 1&&!this.data.info.payAmt){
+      this.setData({
+        amtList:[
+            { name: '商家到账', number: 0 },
+            { name: '用户支付金额', number: 0 }
+        ]
+      })
+    }
   },
   getTaril(){
     $api.ajax(
-      '/sib/xcx/order/dmfTrial',
+      '/zic/order/dmfTrial',
       'POST',
       res=>{
         this.setData({
@@ -60,13 +68,32 @@
     this.setData({
       'info.payType': 2
     })
+    // for (let key in this.data.info) {
+    //   if (!this.data.info[key]) {
+    //     my.showToast({
+    //       type: 'none',
+    //       content: '请输入商品金额',
+    //       duration: 2000,
+    //     });
+    //     return
+    //   }
+    // }
+    let info = this.data.info
+    if (!validator.checkbdMoney(info.payAmt)||info.payAmt==0) {
+      my.showToast({
+        type: 'none',
+        content: '请输入0.01-100000之间商品金额',
+        duration: 2000,
+      });
+      return
+    }
     my.scan({
       scanType: ['qrCode', 'barCode'],
       success: (res) => {
         console.log(res)
         // authCode: res.resultStr,
         $api.ajax(
-          '/sib/xcx/order/createDmf',
+          '/zic/order/createDmf',
           'POST',
           (res) => {
             my.reLaunch({
@@ -77,7 +104,7 @@
           true,
           {
             ...this.data.info,
-            authCode: res.resultStr
+            authCode: res.code
           }
         )
       },
@@ -87,17 +114,25 @@
     this.setData({
       'info.payType': 1
     })
-    for (let key in this.data.info) {
-      if (!this.data.info[key]) {
-        my.showToast({
-          type: 'none',
-          content: '请完整输入信息',
-          duration: 2000,
-        });
-        return
-      }
+    // for (let key in this.data.info) {
+    //   if (!this.data.info[key]) {
+    //     my.showToast({
+    //       type: 'none',
+    //       content: '请完整输入信息',
+    //       duration: 2000,
+    //     });
+    //     return
+    //   }
+    // }
+    let info = this.data.info
+    if (!validator.checkbdMoney(info.payAmt)||info.payAmt==0) {
+      my.showToast({
+        type: 'none',
+        content: '请输入0.01-100000之间商品金额',
+        duration: 2000,
+      });
+      return
     }
-    
     let str = JSON.stringify(this.data.info)
     console.log(this.data.info)
     my.navigateTo({

--
Gitblit v1.8.0