| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 | 
							- var http = require("../../utils/http.js");
 
- var util = require("../../utils/util.js");
 
- Page({
 
-   /**
 
-    * 页面的初始数据
 
-    */
 
-   data: {
 
-     identityCardNumber: "",
 
-     identityCardPicBack: "",
 
-     identityCardPicFront: "",
 
-     identityCardPicHold: "",
 
-     _identityCardPicBack: "",
 
-     _identityCardPicFront: "",
 
-     _identityCardPicHold: "",
 
-     realName: "",
 
-     sharerCardNo: "",
 
-     // shopId: 1,
 
-     userMobile: "",
 
-     needIdCardNo: false,
 
-     neddIdCardPic: false,
 
-     needRealName: false,
 
-     distributionCardNo: ""
 
-   },
 
-   /**
 
-    * 生命周期函数--监听页面加载
 
-    */
 
-   onLoad: function (options) {
 
-     console.log(options)
 
-     wx.showLoading();
 
-     var params = {
 
-       url: "/p/distribution/register/condition",
 
-       method: "GET",
 
-       callBack: (res) => {
 
-         console.log(res)
 
-         this.setData({
 
-           needIdCardNo: res.identityCardNumber,
 
-           neddIdCardPic: res.identityCardPic,
 
-           needRealName: res.realName
 
-         })
 
-         wx.hideLoading();
 
-       }
 
-     };
 
-     http.request(params);
 
-     if (options.scene) {
 
-       const scene = decodeURIComponent(options.scene);
 
-       this.setData({
 
-         distributionCardNo: scene
 
-       });
 
-     }
 
-   },
 
-   onMobileInput: function (e) {
 
-     this.setData({
 
-       userMobile: e.detail.value
 
-     });
 
-   },
 
-   onRealNameInput: function (e) {
 
-     this.setData({
 
-       realName: e.detail.value
 
-     });
 
-   },
 
-   onIdCardNoInput: function (e) {
 
-     this.setData({
 
-       identityCardNumber: e.detail.value
 
-     });
 
-   },
 
-   uploadIdCardFront: function () {
 
-     var ths = this;
 
-     wx.chooseImage({
 
-       count: 1, // 默认9
 
-       sizeType: ['compressed'],
 
-       sourceType: ['album', 'camera'],
 
-       success: function (res) {
 
-         var tempFilePaths = res.tempFilePaths;
 
-         wx.showLoading({
 
-           mask: true
 
-         })
 
-         var params = {
 
-           url: "/p/file/upload",
 
-           filePath: tempFilePaths[0],
 
-           name: 'file',
 
-           callBack: function (res2) {
 
-             wx.hideLoading();
 
-             ths.setData({
 
-               _identityCardPicFront: JSON.parse(res2).resourcesUrl + JSON.parse(res2).filePath,
 
-               identityCardPicFront: JSON.parse(res2).filePath
 
-             })
 
-           }
 
-         };
 
-         http.upload(params);
 
-       }
 
-     })
 
-   },
 
-   uploadIdCardBack: function () {
 
-     var ths = this;
 
-     wx.chooseImage({
 
-       count: 1, // 默认9
 
-       sizeType: ['compressed'],
 
-       sourceType: ['album', 'camera'],
 
-       success: function (res) {
 
-         var tempFilePaths = res.tempFilePaths;
 
-         wx.showLoading({
 
-           mask: true
 
-         })
 
-         var params = {
 
-           url: "/p/file/upload",
 
-           filePath: tempFilePaths[0],
 
-           name: 'file',
 
-           callBack: function (res2) {
 
-             wx.hideLoading();
 
-             ths.setData({
 
-               _identityCardPicBack: JSON.parse(res2).resourcesUrl + JSON.parse(res2).filePath,
 
-               identityCardPicBack: JSON.parse(res2).filePath
 
-             })
 
-           }
 
-         };
 
-         http.upload(params);
 
-       }
 
-     })
 
-   },
 
-   uploadIdCardHold: function () {
 
-     var ths = this;
 
-     wx.chooseImage({
 
-       count: 1, // 默认9
 
-       sizeType: ['compressed'],
 
-       sourceType: ['album', 'camera'],
 
-       success: function (res) {
 
-         var tempFilePaths = res.tempFilePaths;
 
-         wx.showLoading({
 
-           mask: true
 
-         })
 
-         var params = {
 
-           url: "/p/file/upload",
 
-           filePath: tempFilePaths[0],
 
-           name: 'file',
 
-           callBack: function (res2) {
 
-             wx.hideLoading();
 
-             ths.setData({
 
-               _identityCardPicHold: JSON.parse(res2).resourcesUrl + JSON.parse(res2).filePath,
 
-               identityCardPicHold: JSON.parse(res2).filePath
 
-             })
 
-           }
 
-         };
 
-         http.upload(params);
 
-       }
 
-     })
 
-   },
 
-   /**
 
-    * 提交申请
 
-    */
 
-   submitDisterApply: function () {
 
-     var identityCardNumber = this.data.identityCardNumber;
 
-     var identityCardPicBack = this.data.identityCardPicBack;
 
-     var identityCardPicFront = this.data.identityCardPicFront;
 
-     var identityCardPicHold = this.data.identityCardPicHold;
 
-     var distributionCardNo = this.data.distributionCardNo;
 
-     var realName = this.data.realName;
 
-     var userMobile = this.data.userMobile;
 
-     var needIdCardNo = this.data.needIdCardNo;
 
-     var neddIdCardPic = this.data.neddIdCardPic;
 
-     var needRealName = this.data.needRealName;
 
-     if (!util.checkPhoneNumber(this.data.userMobile)) {
 
-       wx.showToast({
 
-         title: '请输入正确的手机号码',
 
-         icon: "none"
 
-       })
 
-     } else if (needRealName && realName.length < 2) {
 
-       wx.showToast({
 
-         title: '请输入真实姓名',
 
-         icon: "none"
 
-       })
 
-     } else if (needIdCardNo && identityCardNumber.length < 15) {
 
-       wx.showToast({
 
-         title: '请输入正确的身份证号码',
 
-         icon: "none"
 
-       })
 
-     } else if (neddIdCardPic && identityCardPicFront == "") {
 
-       wx.showToast({
 
-         title: '请上传身份证人像面',
 
-         icon: "none"
 
-       })
 
-     } else if (neddIdCardPic && identityCardPicBack == "") {
 
-       wx.showToast({
 
-         title: '请上传身份证国徽面',
 
-         icon: "none"
 
-       })
 
-     } else if (neddIdCardPic && identityCardPicHold == "") {
 
-       wx.showToast({
 
-         title: '请上传手持身份证照片',
 
-         icon: "none"
 
-       })
 
-     } else {
 
-       wx.showLoading({
 
-         mask: true
 
-       })
 
-       var params = {
 
-         url: "/p/distribution/register/addDistributionUser",
 
-         method: "post",
 
-         data: {
 
-           identityCardNumber: identityCardNumber,
 
-           identityCardPicBack: identityCardPicBack,
 
-           identityCardPicFront: identityCardPicFront,
 
-           identityCardPicHold: identityCardPicHold,
 
-           realName: realName,
 
-           sharerCardNo: distributionCardNo,
 
-           // shopId: 1,
 
-           userMobile: userMobile,
 
-         },
 
-         callBack: (res) => {
 
-           wx.hideLoading();
 
-           wx.showModal({
 
-             content: '申请已提交,请等待审核',
 
-             showCancel: false,
 
-             complete: function () {
 
-               wx.switchTab({
 
-                 url: '/pages/user/user',
 
-               })
 
-             }
 
-           })
 
-         }
 
-       };
 
-       http.request(params);
 
-     }
 
-   },
 
- })
 
 
  |