1
0
Переглянути джерело

小程序页面逻辑提交

hyq 5 роки тому
батько
коміт
baeb1b9d1c

+ 211 - 0
wx-mall/pages/checkVideo/checkVideo.js

@@ -0,0 +1,211 @@
+const util = require('../../utils/util.js');
+const api = require('../../config/api.js');
+const user = require('../../services/user.js');
+
+//获取应用实例
+const app = getApp();
+Page({
+  data: {
+    // text:"这是一个页面"
+    videoSource: '',
+    videoHidden: true,
+    cameraCtx: null,
+    src: null,
+    videoSrc: null,
+    isStartDisable: null,
+    isEndDisable: null
+  },
+
+  /**
+* 生命周期函数--监听页面初次渲染完成
+*/
+  onReady: function (res) {
+    if (wx.createCameraContext()) {
+      // this.cameraContext = wx.createCameraContext('myCamera')
+      // this.takePhoto();
+
+      this.cameraContext = wx.createCameraContext()
+    } else {
+      // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
+      wx.showModal({
+        title: '提示',
+        content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
+      })
+    }
+  },
+  takePhoto() {
+    var that = this;
+    const ctx = wx.createCameraContext()
+    console.log(ctx)
+    ctx.takePhoto({
+      quality: 'high',
+      success: (res) => {
+        that.setData({
+          src: res.tempImagePath
+        })
+      },
+      fail: (res) => {
+        console.log('拍摄失败')
+        console.log(res)
+      },
+      complete: (res) => {
+        console.log('接口调用结束的回调函数(调用成功、失败都会执行)')
+        console.log(res)
+      }
+    })
+  },
+  takeVideo() {
+    wx.showLoading({
+      title: '视频录制开始...',
+    });
+    var that = this;
+    // const ctx = wx.createCameraContext()
+    console.log(that.cameraContext)
+    that.cameraContext.startRecord({
+      timeoutCallback: (res) => {
+        console.log('摄影开始中1')
+        console.log(res)
+        that.setData({
+          isStartDisable: true,
+          isEndDisable: false
+        })
+      },
+      success: (res) => {
+        console.log('摄影开始成功2')
+        console.log(res)
+        that.setData({
+          isStartDisable: true,
+          isEndDisable: false
+        })
+      },
+      fail: (res) => {
+        console.log('摄影开始失败')
+        console.log(res)
+        that.setData({
+          isStartDisable: false,
+          isEndDisable: false
+        })
+      },
+      complete: (res) => {
+        console.log('摄影开始,接口调用结束的回调函数(调用成功、失败都会执行)')
+        console.log(res)
+      }
+    })
+  },
+  stopVideo: function () {
+    wx.hideLoading();
+    var that = this;
+    that.cameraContext.stopRecord({
+      success: (videoRes) => {
+        console.log('摄影成功2')
+        console.log(videoRes.tempVideoPath)
+        that.setData({
+          isStartDisable: true,
+          isEndDisable: true,
+          videoSrc: videoRes.tempVideoPath
+        })
+        that.getBase64(videoRes.tempVideoPath);
+        // util.request(api.CheckLivenessRecognition, {
+        //   storeId: wx.getStorageSync('storeId'),
+        //   merchId: wx.getStorageSync('merchSn'),
+        //   idCard: '',
+        //   name: '',
+        //   videoBase64: 'base64',
+        //   livenessType: 'SILENT'
+        // }, 'POST').then(function (urlRes) {
+        //   console.log(urlRes);
+        //   // wx.showToast({
+        //   //   title: '成功',
+        //   //   icon: 'success',
+        //   //   duration: 2000
+        //   // })
+        //   wx.showToast({
+        //     title: urlRes.msg,
+        //     icon: 'success'
+        //   })
+        // });
+      },
+      fail: (videoFailRes) => {
+        console.log('摄影失败')
+        console.log(videoFailRes)
+        that.setData({
+          isStartDisable: false,
+          isEndDisable: false
+        })
+      },
+      complete: (videoComRes) => {
+        console.log('接口调用结束的回调函数(调用成功、失败都会执行)')
+        console.log(videoComRes)
+      }
+    });
+  },
+  getBase64(path) {
+    wx.showLoading({
+      title: '人脸身份核验中...',
+    });
+    var that = this;
+    wx.getFileSystemManager().readFile({
+      filePath: path,
+      encoding: "base64",
+      complete: res => {
+        // var baseRes = wx.getFileSystemManager().readFileSync(videoRes.tempVideoPath, 'base64')
+        console.log('base64码');
+        // console.log(res);
+        var base64 = res.data;
+        util.request(api.CheckLivenessRecognition, {
+          storeId: wx.getStorageSync('storeId'),
+          merchId: wx.getStorageSync('merchSn'),
+          idCard: '',
+          name: '',
+          videoBase64: base64,
+          livenessType: 'SILENT'
+        }, 'POST').then(function (urlRes) {
+          console.log(urlRes);
+          if(urlRes.errno!=undefined){
+            if(urlRes.errno===0){
+              wx.showToast({
+                title: '人脸核验成功',
+                icon: 'success',
+                duration: 2000
+              })
+            }else{
+              wx.showToast({
+                title: urlRes.errmsg,
+                icon: 'none'
+              });
+            }
+          } else {
+            if (urlRes.code != 0) {
+              wx.showToast({
+                title: urlRes.msg,
+                icon: 'none'
+              });
+              that.setData({
+                isStartDisable: false,
+                isEndDisable: false
+              })
+            }
+          }
+        });
+      },
+      fail: function (baseFailRes) {
+        console.log(baseFailRes);
+      }
+    });
+  },
+  error(e) {
+    console.log(e.detail)
+  },
+  onLoad: function (options) {
+    // 页面初始化 options为页面跳转所带来的参数
+  },
+  onShow: function () {
+    // 页面显示
+  },
+  onHide: function () {
+    // 页面隐藏
+  },
+  onUnload: function () {
+    // 页面关闭
+  }
+})

+ 4 - 0
wx-mall/pages/checkVideo/checkVideo.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 7 - 0
wx-mall/pages/checkVideo/checkVideo.wxml

@@ -0,0 +1,7 @@
+<camera device-position="front" mode='normal' flash="off" binderror="error" style="width: 80vw; height: 300px;border-radius: 1000rpx;margin: 0px auto;"></camera>
+<!-- <button type="primary" bindtap="takePhoto">拍照</button> -->
+<button type="primary" bindtap="takeVideo" disabled="{{isStartDisable}}">开始摄影</button>
+<button type="primary" bindtap="stopVideo" disabled="{{isEndDisable}}">结束摄影</button>
+<!-- <view>预览</view> -->
+<!-- <image mode="widthFix" src="{{src}}"></image> -->
+<video style="width: 80vw; height: 300px;border-radius: 1000rpx;margin: 0px auto;" src="{{videoSrc}}"></video>

+ 19 - 0
wx-mall/pages/checkVideo/checkVideo.wxss

@@ -0,0 +1,19 @@
+.camera{
+  height:1080rpx;
+  width:750rpx;
+}
+.pause .time {
+  flex: 1;
+  height:100%;
+}
+.time {
+  text-align: center;
+  background-color: rgba(0, 0, 0, .5);
+  color: white;
+  line-height:50px;
+}
+.img {
+  width: 40px;
+  height: 40px;
+  margin: 5px auto;
+}

+ 241 - 0
wx-mall/pages/checkoutIdCard/checkoutIdCard.js

@@ -0,0 +1,241 @@
+var util = require('../../utils/util.js');
+var api = require('../../config/api.js');
+var app = getApp()
+Page({
+  data: {
+    userInfo: {},
+    curUser: {},
+    idNoM: '',
+    idNo: '',
+    currentIdNo: '',
+    userName: '',
+    array: ['居民身份证'],
+    items: [
+      { name: '1', value: '反光识别', checked: 'true' },
+      { name: '2', value: '读数识别' },
+    ],
+    isAgree: false
+  },
+  radioChange: function (e) {
+    console.log('radio发生change事件,携带value值为:', e.detail.value)
+  },
+  checkBoxAgree: function(e){
+    this.setData({
+      isAgree: !this.data.isAgree
+    });
+  },
+  onLoad: function (options) {
+    // 页面初始化 options为页面跳转所带来的参数
+    let that = this;
+  },
+  onReady: function () {
+
+  },
+  onShow: function () {
+    let that = this;
+    let userInfo = wx.getStorageSync('userInfo');
+    let token = wx.getStorageSync('token');
+
+    // 页面显示
+    if (userInfo && token) {
+      app.globalData.userInfo = userInfo;
+      app.globalData.token = token;
+
+      this.setData({
+        userInfo: app.globalData.userInfo,
+      });
+      util.request(api.getCurUser, {
+        userInfo: app.globalData.userInfo
+      }, 'POST').then(function (res) {
+        if (res.errno === 0) {
+          that.setData({
+            curUser: res.data
+          });
+          if (res.data.idNo) {
+            that.setData({
+              idNoM: that.formatidcard(res.data.idNo),
+              idNo: res.data.idNo,
+              currentIdNo: res.data.idNo,
+              userName: res.data.username
+            });
+          }
+        }
+      });
+    } else {
+      wx.navigateTo({
+        url: '/pages/ucenter/userLogin/userLogin'
+      })
+    }
+
+  },
+  onHide: function () {
+    // 页面隐藏
+
+  },
+  onUnload: function () {
+    // 页面关闭
+  },
+  readUserService: function(){
+    // wx.navigateTo({
+    //   url: '../userService/userService'
+    // });
+  },
+  readUserPrivacy: function () {
+    // wx.navigateTo({
+    //   url: '../userPrivacy/userPrivacy'
+    // });
+  },
+  saveIdCard: function (e) {
+    let that = this;
+    if (that.data.isAgree == false) {
+      wx.showToast({
+        title: '请先阅读并勾选内容',
+        icon: 'none'
+      });
+      return false;
+    }
+    if (!e.detail.value.idNo) {
+      wx.showToast({
+        title: '身份证号不能为空',
+        icon: 'none'
+      });
+      return false;
+    }
+
+    if (!e.detail.value.username) {
+      wx.showToast({
+        title: '姓名不能为空',
+        icon: 'none'
+      });
+      return false;
+    }
+    if (that.data.idNoM != that.formatidcard(e.detail.value.idNo)) {
+      that.setData({
+        idNo: e.detail.value.idNo
+      });
+    } else {
+      that.setData({
+        idNo: that.data.currentIdNo
+      });
+    }
+    that.setData({
+      userName: e.detail.value.username
+    });
+    console.log(that.data.idNo);
+
+    if (!that.checkIdcard(that.data.idNo)) {
+      wx.showToast({
+        title: '请输入正确的身份证号',
+        icon: 'none'
+      });
+      return false;
+    }
+
+    wx.navigateTo({
+      url: '../checkVideo/checkVideo'
+    });
+    /**util.request(api.idCardRealName, {
+      idNo: that.data.idNo,
+      userName: that.data.userName
+    }, 'POST').then(function (res) {
+      if (res.errno === 0) {
+        //成功提示
+        // wx.showToast({
+        //   title: res.errmsg
+        // });
+        that.setData({
+          idNoM: that.formatidcard(e.detail.value.idNo)
+        });
+        wx.navigateTo({
+          url: '../checkVideo/checkVideo'
+        });
+      } else {
+        wx.showToast({
+          title: res.errmsg,
+          icon: 'none'
+        });
+      }
+    });**/
+  },
+  clearData: function () {
+    let that = this;
+    that.setData({
+      idNoM: ''
+    });
+  },
+  formatidcard(idcard) {
+    var reg = /^(.).+(.)$/g;
+    if (idcard.length == 15) {
+      // return idcard.replace(/(\d{6})\d{6}(\d{3})/, "$1******$2");
+      return idcard.replace(reg, "$1*************$2");
+    } else {
+      return idcard.replace(reg, "$1****************$2");
+    }
+  },
+  // 校验身份证号
+  //校验码校验
+  checkCode: function (val) {
+    var p = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
+    var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
+    var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
+    var code = val.substring(17);
+    if (p.test(val)) {
+      var sum = 0;
+      for (var i = 0; i < 17; i++) {
+        sum += val[i] * factor[i];
+      }
+      if (parity[sum % 11] == code.toUpperCase()) {
+        return true;
+      }
+    }
+    return false;
+  },
+  //省份校验
+  checkProv: function (val) {
+    var pattern = /^[1-9][0-9]/;
+    var provs = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门" };
+    if (pattern.test(val)) {
+      if (provs[val]) {
+        return true;
+      }
+    }
+    return false;
+  },
+  //出生日期码校验
+  checkDate: function (val) {
+    var pattern = /^(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)$/;
+    if (pattern.test(val)) {
+      var year = val.substring(0, 4);
+      var month = val.substring(4, 6);
+      var date = val.substring(6, 8);
+      var date2 = new Date(year + "-" + month + "-" + date);
+      if (date2 && date2.getMonth() == (parseInt(month) - 1)) {
+        return true;
+      }
+    }
+    return false;
+  },
+  checkIdcard: function (val) {
+    if (this.checkCode(val)) {
+      var date = val.substring(6, 14);
+      if (this.checkDate(date)) {
+        if (this.checkProv(val.substring(0, 2))) {
+          return true;
+        }
+      }
+    }
+    // this.isError("请输入正确身份证号");
+    return false;
+  },
+  // 通过身份证号获取出生日期和性别
+  getBirthAndSex: function (idCard) {
+    var that = this;
+    var info = {};
+    var birth = (idCard.length === 18) ? idCard.slice(6, 14) : idCard.slice(6, 12);
+    var order = (idCard.length === 18) ? idCard.slice(-2, -1) : idCard.slice(-1);
+    info.birthDay = (idCard.length === 18) ? ([birth.slice(0, 4), birth.slice(4, 6), birth.slice(-2)]).join('-') : (['19' + birth.slice(0, 2), birth.slice(2, 4), birth.slice(-2)]).join('-');
+    info.sex = (order % 2 === 0 ? 2 : 0);
+    return info;
+  }
+
+})

+ 4 - 0
wx-mall/pages/checkoutIdCard/checkoutIdCard.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "navigationBarTitleText": "身份校验"
+}

+ 55 - 0
wx-mall/pages/checkoutIdCard/checkoutIdCard.wxml

@@ -0,0 +1,55 @@
+<form bindsubmit="saveIdCard" report-submit='true'>
+  <view class="add-idCard">
+    <view class="add-form">
+      <image class="idcard-img" src="/static/images/face_know.png"></image>
+      <view class='id-card-title'>当前业务需要人脸识别验证</view>
+      <view class='id-card-txt'>信息将与当前微信绑定(身份证信息用于用与身份验证,以及跨境商品入境申报,请输入购买者姓名和身份证号码一致的身份证信息确保正常清关;姓名需要与身份证信息一致。)</view>
+      <view class="form-item">
+        <label>证件类型</label>
+        <!-- <input class="input" name='idNo' value="居民身份证"/> -->
+        <picker style="flex:1" bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
+          <view class="picker">
+            居民身份证
+          </view>
+        </picker>
+      </view>
+      <view class="form-item">
+        <label>姓名</label>
+        <input type="text" class="input" name='username' value="{{curUser.username}}" placeholder="请输入姓名" />
+      </view>
+      <view class="form-item">
+        <label>身份证号</label>
+        <input type="idcard" class="input" name='idNo' placeholder="请输入身份证号" value="{{idNoM}}"/>
+        <view bindtap="clearData">
+          <image class="clear-icon" src="/static/images/clear-fb.png"></image>
+        </view>
+      </view>
+      <view class="form-item">
+        <radio-group class="radio-group" bindchange="radioChange">
+          <radio class="radio radio-class {{item.name==2?'radio2-class':''}}" wx:for-items="{{items}}" wx:key="name" value="{{item.name}}" checked="{{item.checked}}">
+            <text>{{item.value}}</text>
+          </radio>
+        </radio-group>
+      </view>
+    </view>
+    <view class='id-card-agree-view'>
+      <checkbox bindtap="checkBoxAgree" value="{{isAgree}}" checked="{{isAgree}}"/>
+      <view class='id-card-txt2'>
+        <text bindtap="checkBoxAgree">我同意****使用我所提交的信息用于人脸识别信息绑定。查看</text>
+        <text style="color:blue;" bindtap="readUserService">《用户服务协议》</text>
+        <text bindtap="checkBoxAgree">及</text>
+        <text style="color:blue;" bindtap="readUserPrivacy">《隐私政策》</text>
+      </view>
+    </view>
+
+    <view class="btns">
+      <button class="save" form-type="submit">开始人脸识别验证</button>
+    </view>
+    
+    <view style="padding-bottom: 100px;margin-top: 43px;">
+      <view class='info-'>本服务由**公司提供技术支持</view>
+      <view class='info-'>****保障您的个人信息安全</view>
+    </view>
+
+  </view>
+</form>

+ 248 - 0
wx-mall/pages/checkoutIdCard/checkoutIdCard.wxss

@@ -0,0 +1,248 @@
+page {
+  height: 100%;
+  background: #f4f4f4;
+}
+.add-idCard {
+  background: #fff;
+}
+
+.add-idCard .add-form {
+  background: #fff;
+  width: 100%;
+  height: auto;
+  overflow: hidden;
+}
+
+.add-idCard .form-item {
+  height: 116rpx;
+  padding-left: 31.25rpx;
+  border-bottom: 1px solid #d9d9d9;
+  display: flex;
+  align-items: center;
+  padding-right: 31.25rpx;
+}
+
+.add-idCard .form-item .location{
+ height: 60rpx;
+ width: 60rpx;
+}
+
+.add-idCard label {
+  width: 160rpx;
+  font-weight: bold;
+}
+
+.add-idCard .input {
+  flex: 1;
+  height: 44rpx;
+  line-height: 44rpx;
+  overflow: hidden;
+}
+
+.add-idCard .form-default {
+  border-bottom: 1px solid #d9d9d9;
+  height: 96rpx;
+  background: #fafafa;
+  padding-top: 28rpx;
+  font-size: 28rpx;
+}
+
+.default-input {
+  margin: 0 auto;
+  display: block;
+  width: 240rpx;
+  height: 40rpx;
+  padding-left: 50rpx;
+  line-height: 40rpx;
+  background: url(http://120.76.26.84:80/group1/M00/00/02/rBJEdVvr3NeAQgp_AAAJkFQSrpc594.png) 1rpx -448rpx no-repeat;
+  background-size: 38rpx 486rpx;
+  font-size: 28rpx;
+}
+
+.default-input.selected {
+  background: url(http://120.76.26.84:80/group1/M00/00/02/rBJEdVvr3NeAQgp_AAAJkFQSrpc594.png) 0 -192rpx no-repeat;
+  background-size: 38rpx 486rpx;
+}
+
+.add-idCard .btns {
+  /* position: fixed;
+  bottom: 0;
+  left: 0; */
+  overflow: hidden;
+  display: flex;
+  height: 100rpx;
+  width: 100%;
+  margin-top: 60rpx;
+}
+
+.add-idCard .cannel, .add-idCard .save {
+  /* flex: 1; */
+  height: 100rpx;
+  text-align: center;
+  line-height: 100rpx;
+  font-size: 28rpx;
+  color: #fff;
+  border: none;
+  border-radius: 0;
+  width: 90vw;
+}
+
+.add-idCard .cannel {
+  background: #333;
+}
+
+.add-idCard .save {
+  background: #b4282d;
+}
+
+.region-select {
+  width: 100%;
+  height: 600rpx;
+  background: #fff;
+  position: fixed;
+  z-index: 10;
+  left: 0;
+  bottom: 0;
+}
+
+.region-select .hd {
+  height: 108rpx;
+  width: 100%;
+  border-bottom: 1px solid #f4f4f4;
+  padding: 46rpx 30rpx 0 30rpx;
+}
+
+.region-select .region-selected {
+  float: left;
+  height: 60rpx;
+  display: flex;
+}
+
+.region-select .region-selected .item {
+  max-width: 140rpx;
+  margin-right: 30rpx;
+  text-align: left;
+  line-height: 60rpx;
+  height: 100%;
+  color: #333;
+  font-size: 28rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.region-select .region-selected .item.disabled {
+  color: #999;
+}
+
+.region-select .region-selected .item.selected {
+  color: #b4282d;
+}
+
+.region-select .done {
+  float: right;
+  height: 60rpx;
+  width: 60rpx;
+  border: none;
+  background: #fff;
+  line-height: 60rpx;
+  text-align: center;
+  color: #333;
+  font-size: 28rpx;
+}
+
+.region-select .done.disabled {
+  color: #999;
+}
+
+.region-select .bd {
+  height: 492rpx;
+  width: 100%;
+  padding: 0 30rpx;
+}
+
+.region-select .region-list {
+  height: auto;
+  overflow: scroll;
+}
+
+.region-select .region-list .item {
+  width: 100%;
+  height: 104rpx;
+  line-height: 104rpx;
+  text-align: left;
+  color: #333;
+  font-size: 28rpx;
+}
+
+.region-select .region-list .item.selected {
+  color: #b4282d;
+}
+
+.bg-mask {
+  height: 100%;
+  width: 100%;
+  background: rgba(0, 0, 0, 0.4);
+  position: fixed;
+  top: 0;
+  left: 0;
+  z-index: 8;
+}
+
+.id-card-txt{
+  font-size:22rpx;
+  margin-left: 20rpx;
+  color: #a5a3a3;
+  text-align: center;
+  margin-bottom: 30rpx;
+  width: 96vw;
+}
+
+.id-card-title{
+  font-size: 40rpx;
+  width: 100vw;
+  margin: 5rpx auto 20rpx auto;
+  color: #555454;
+  text-align: center;
+  font-weight: bold;
+}
+.clear-icon{
+  position: absolute;
+  top:709rpx;
+  right:30rpx;
+  width:32rpx;
+  height:32rpx;
+  z-index:9999;
+}
+.idcard-img{
+  width: 238rpx;
+height: 215rpx;
+margin: 10rpx auto 30rpx auto;
+display: flex;
+}
+.radio-class{
+  width: 43vw;
+  border-right: 1px solid #ccc;
+  font-weight: bold;
+}
+.radio2-class{
+  border-right: 0px solid #ccc;
+  margin-left: 40rpx;
+}
+.id-card-txt2 {
+  font-size: 26rpx;
+  color: #686666;
+  width: 86vw;
+  float: right;
+
+}
+.id-card-agree-view{
+  margin-top: 63rpx;
+  margin-left: 30rpx;
+}
+.info-{
+  margin: 0px auto;
+  text-align: center;
+  color: #ccc;
+  font-weight: bold
+}

+ 31 - 0
wx-mall/pages/prompt/prompt.js

@@ -0,0 +1,31 @@
+var util = require('../../utils/util.js');
+var api = require('../../config/api.js');
+
+Page({
+  data: {
+    orderId: 0,
+    orderSn: ''
+  },
+  onLoad: function (options) {
+    // 页面初始化 options为页面跳转所带来的参数
+    let that = this;
+    that.setData({
+      orderId: options.id
+    });
+  },
+  onReady: function () {
+    // 页面渲染完成
+  },
+  onShow: function () {
+    // 页面显示
+    this.setData({
+      currentStoreId: wx.getStorageSync('storeId')
+    });
+  },
+  onHide: function () {
+    // 页面隐藏
+  },
+  onUnload: function () {
+    // 页面关闭
+  }
+})

+ 4 - 0
wx-mall/pages/prompt/prompt.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 8 - 0
wx-mall/pages/prompt/prompt.wxml

@@ -0,0 +1,8 @@
+<view class="container">
+  <view class="list-group goods-info">
+  实打实的实打实的
+  </view>
+  <view class="btns" wx:if="{{tabIndex != 5}}">
+    <view class="save" wx:if="{{ handleOption.pay==true && orderInfo.dateformat}}" bindtap="payOrder">去付款 {{orderInfo.dateformat.min}}{{orderInfo.dateformat?':':''}}{{orderInfo.dateformat.sec}}</view>
+  </view>
+</view>

+ 508 - 0
wx-mall/pages/prompt/prompt.wxss

@@ -0,0 +1,508 @@
+page {
+  height: 100%;
+  width: 100%;
+  background: #f4f4f4;
+}
+
+.strong {
+  font-size: 1em !important;
+}
+
+.week {
+  font-size: 0.9em !important;
+}
+
+.orange {
+  color: #d81e06;
+}
+
+.orange2 {
+  height: 40rpx;
+  text-align: center;
+  line-height: 40rpx;
+  font-size: 28rpx;
+  color: #fff;
+  border: none;
+  border-radius: 30rpx;
+  background: #d81e06;
+}
+
+.order-info {
+  margin-top: 20rpx;
+  padding-top: 25rpx;
+  background: #fff;
+  height: auto;
+  overflow: hidden;
+}
+
+.item-a {
+  padding-left: 31.25rpx;
+  height: 42.5rpx;
+  padding-bottom: 12.5rpx;
+  line-height: 24rpx;
+  font-size: 24rpx;
+  color: #666;
+}
+
+.item-b {
+  padding-left: 31.25rpx;
+  height: 29rpx;
+  line-height: 29rpx;
+  margin-top: 12.5rpx;
+  margin-bottom: 41.5rpx;
+  font-size: 24rpx;
+  color: #666;
+}
+
+.item-c {
+  margin-left: 31.25rpx;
+  border-top: 1px solid #f4f4f4;
+  height: 103rpx;
+  line-height: 103rpx;
+}
+
+.item-c .l {
+  float: left;
+}
+
+.item-c .r {
+  height: 103rpx;
+  float: right;
+  display: flex;
+  align-items: center;
+  padding-right: 16rpx;
+}
+
+.item-c .r .btn {
+  float: right;
+}
+
+.item-c .cost {
+  color: #b4282d;
+}
+
+.item-c .btn {
+  border: 1px solid #d81e06;
+  color: #d81e06;
+  border-radius: 30rpx;
+  font-size: 0.8em;
+  display: inline-block;
+  margin-left: 20rpx;
+  line-height: 1.6;
+  padding: 5rpx 15rpx;
+  background-color: #fff;
+}
+
+.goods-info .list-cell-ft {
+  padding-right: 0;
+}
+
+.goods-list {
+  width: 100%;
+}
+
+.goods-list-cell {
+  /* padding: 20rpx 0; *//* padding: 10rpx 10rpx; */
+  padding-right: 0rpx;
+  height:120rpx;
+}
+
+.goods-list-cell text {
+  font-size: 0.9em;
+  color: #9b9b9b;
+}
+
+.goods-list-cell .name {
+  width: 470rpx;
+  font-size: 25rpx;
+  color: #333;
+  display: inline-block;
+  /* overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap; */
+}
+
+.goods-list-cell .price {
+  padding-right: 20rpx;
+  color:black;
+}
+
+.fr {
+  margin-left: auto;
+  width: 50rpx;
+  text-align: right;
+}
+
+.attr {
+  margin-bottom: 17rpx;
+  height: 24rpx;
+  line-height: 24rpx;
+  font-size: 22rpx;
+  color: #666;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+}
+
+.num {
+  padding-right: 20rpx;
+  padding-top: 57rpx;
+}
+
+.order-goods {
+  margin-top: 20rpx;
+  background: #fff;
+}
+
+.order-goods .h {
+  height: 93.75rpx;
+  line-height: 93.75rpx;
+  margin-left: 31.25rpx;
+  border-bottom: 1px solid #f4f4f4;
+  padding-right: 31.25rpx;
+}
+
+.order-goods .h .label {
+  float: left;
+  font-size: 30rpx;
+  color: #333;
+}
+
+.order-goods .h .status {
+  float: right;
+  font-size: 30rpx;
+  color: #b4282d;
+}
+
+.order-goods .item {
+  display: flex;
+  align-items: center;
+  height: 192rpx;
+  margin-left: 31.25rpx;
+  padding-right: 31.25rpx;
+  border-bottom: 1px solid #f4f4f4;
+}
+
+.order-goods .item:last-child {
+  border-bottom: none;
+}
+
+.order-goods .item .img {
+  height: 145.83rpx;
+  width: 145.83rpx;
+  background: #f4f4f4;
+}
+
+.order-goods .item .img image {
+  height: 145.83rpx;
+  width: 145.83rpx;
+}
+
+.order-goods .item .info {
+  flex: 1;
+  height: 145.83rpx;
+  margin-left: 20rpx;
+}
+
+.order-goods .item .t {
+  margin-top: 8rpx;
+  height: 33rpx;
+  line-height: 33rpx;
+  margin-bottom: 10.5rpx;
+}
+
+.order-goods .item .t .name {
+  display: block;
+  float: left;
+  height: 33rpx;
+  line-height: 33rpx;
+  color: #333;
+  font-size: 30rpx;
+}
+
+.order-goods .item .t .number {
+  display: block;
+  float: right;
+  height: 33rpx;
+  text-align: right;
+  line-height: 33rpx;
+  color: #333;
+  font-size: 30rpx;
+}
+
+.order-goods .item .attr {
+  height: 29rpx;
+  line-height: 29rpx;
+  color: #666;
+  margin-bottom: 25rpx;
+  font-size: 25rpx;
+}
+
+.order-goods .item .price {
+  height: 30rpx;
+  line-height: 30rpx;
+  color: #333;
+  font-size: 30rpx;
+}
+
+.order-bottom {
+  margin-top: 20rpx;
+  padding-left: 31.25rpx;
+  height: auto;
+  overflow: hidden;
+  background: #fff;
+}
+
+.order-bottom .address {
+  height: 128rpx;
+  padding-top: 25rpx;
+  border-bottom: 1px solid #f4f4f4;
+}
+
+.order-bottom .address .t {
+  height: 35rpx;
+  line-height: 35rpx;
+  margin-bottom: 7.5rpx;
+}
+
+.order-bottom .address .name {
+  display: inline-block;
+  height: 35rpx;
+  width: 140rpx;
+  line-height: 35rpx;
+  font-size: 25rpx;
+}
+
+.order-bottom .address .mobile {
+  display: inline-block;
+  height: 35rpx;
+  line-height: 35rpx;
+  font-size: 25rpx;
+}
+
+.order-bottom .address .b {
+  height: 35rpx;
+  line-height: 35rpx;
+  font-size: 25rpx;
+}
+
+.order-bottom .total {
+  height: 106rpx;
+  padding-top: 20rpx;
+  border-bottom: 1px solid #f4f4f4;
+}
+
+.order-bottom .total .t {
+  height: 25rpx;
+  line-height: 25rpx;
+  margin-bottom: 7.5rpx;
+  display: flex;
+}
+
+.order-bottom .total .label {
+  width: 140rpx;
+  display: inline-block;
+  height: 35rpx;
+  line-height: 35rpx;
+  font-size: 25rpx;
+}
+
+.order-bottom .total .txt {
+  flex: 1;
+  display: inline-block;
+  height: 35rpx;
+  line-height: 35rpx;
+  font-size: 25rpx;
+}
+
+.order-bottom .pay-fee {
+  height: 81rpx;
+  line-height: 81rpx;
+}
+
+.order-bottom .pay-fee .label {
+  display: inline-block;
+  width: 140rpx;
+  color: #b4282d;
+}
+
+.order-bottom .pay-fee .txt {
+  display: inline-block;
+  width: 140rpx;
+  color: #b4282d;
+}
+
+.order-shipping {
+  margin-top: 20rpx;
+  background: #fff;
+  margin-bottom: 20rpx;
+  height: 1024rpx;
+}
+
+.order-shipping .h {
+  height: 80rpx;
+  line-height: 80rpx;
+  margin-left: 31.25rpx;
+  border-bottom: 1px solid #f4f4f4;
+  padding-right: 31.25rpx;
+}
+
+.order-shipping .h .label {
+  float: left;
+  font-size: 27rpx;
+  color: #333;
+}
+
+.order-shipping .shipping {
+  background: #fff;
+}
+
+.order-shipping .shipping .item {
+  display: flex;
+  float: left;
+  margin-left: 31.25rpx;
+  padding-right: 31.25rpx;
+  height: auto;
+  border-bottom: 1px solid #f4f4f4;
+}
+
+.order-shipping .shipping .item   li {
+  display: block;
+}
+
+.icon {
+  width: 35rpx;
+  height: 35rpx;
+  /* margin-left: 15rpx;
+  margin-top: 20rpx; */
+  margin-bottom: -8rpx;
+}
+
+.item-b2 {
+  padding-left: 31.25rpx;
+  height: 29rpx;
+  line-height: 29rpx;
+  margin-top: 22.5rpx;
+  margin-bottom: 41.5rpx;
+  font-size: 24rpx;
+  color: #666;
+  margin-left: 38rpx;
+}
+
+.icon2 {
+  width: 30rpx;
+  height: 30rpx;
+  /* margin-left: 15rpx;
+  margin-top: 20rpx; */
+  margin-bottom: -5rpx;
+}
+
+.strong2 {
+  font-size: 0.95em !important;
+  color: white;
+}
+
+.list-cell-bd2 {
+  flex: 1;
+  margin-top: -15px;
+  color: white;
+}
+
+.order-info2 {
+  padding-top: 20rpx;
+  background: rgb(126, 125, 125);
+  height: auto;
+  overflow: hidden;
+  color: white;
+  font-weight: bold;
+}
+
+.week2 {
+  font-size: 0.9em !important;
+  color: white;
+}
+
+.week3 {
+  font-size: 0.9em !important;
+  color: white;
+  margin-left: 40rpx;
+}
+
+.week4 {
+  font-size: 0.8em !important;
+  color: white;
+  margin-left: 40rpx;
+}
+
+.btns {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  overflow: hidden;
+  display: flex;
+  height: 70rpx;
+  width: 100%;
+}
+
+.btns .cannel {
+  flex: 1;
+  height: 70rpx;
+  text-align: center;
+  line-height: 70rpx;
+  font-size: 28rpx;
+  color: rgb(20, 20, 20);
+  border: none;
+  border-radius: 0;
+  background: rgb(255, 253, 253);
+}
+
+.btns .save {
+  flex: 1;
+  height: 70rpx;
+  text-align: center;
+  line-height: 70rpx;
+  font-size: 28rpx;
+  color: #fff;
+  border: none;
+  border-radius: 0;
+  background: #b4282d;
+}
+
+.refund {
+  height: 40rpx;
+  text-align: center;
+  line-height: 40rpx;
+  font-size: 24rpx;
+  color: #fff;
+  border: none;
+  border-radius: 30rpx;
+  background: #d81e06;
+  display: block;
+  width: 130rpx;
+}
+
+.list-group2 {
+  margin-top: 0.6em;
+  background-color: #fff;
+  line-height: 1.41176471;
+  font-size: 28rpx;
+  overflow: hidden;
+  position: relative;
+  padding-bottom: 89rpx;
+}
+
+.order-image {
+  width: 100rpx;
+  height: 100rpx;
+}
+
+.name {
+  height: 40rpx;
+}
+.camps{
+  color:#fff;
+  background: #d81e06;
+  border-radius: 8rpx;
+  font-size: 20rpx;
+  float:left;
+}

+ 244 - 0
wx-mall/pages/ucenter/crossBoundaryQuotaQuery/crossBoundaryQuotaQuery.js

@@ -0,0 +1,244 @@
+var util = require('../../../utils/util.js');
+var api = require('../../../config/api.js');
+var app = getApp()
+Page({
+  data: {
+    userInfo: {},
+    curUser: {},
+    idNoM: '',
+    idNo: '',
+    currentIdNo: '',
+    userName: '',
+    listData: [],
+    idCardIsNull: null,
+    startTime: '',
+    endTime: '',
+    isQuery: null
+  },
+  onLoad: function (options) {
+    // 页面初始化 options为页面跳转所带来的参数
+    let that = this;
+    var timestamp = Date.parse(new Date());
+    var date = new Date(timestamp);
+    //获取年份  
+    var Y = date.getFullYear();
+    //获取月份  
+    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
+    //获取当日日期 
+    var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
+    console.log("当前时间:" + Y + '年' + M + '月' + D + '日'); 
+    that.setData({
+      startTime: Y+'年1月1日00:00',
+      endTime: Y + '年' + M + '月' + (D-1) + '日24:00'
+    });
+  },
+  onReady: function () {
+
+  },
+  onShow: function () {
+    let that = this;
+    let userInfo = wx.getStorageSync('userInfo');
+    let token = wx.getStorageSync('token');
+
+    // 页面显示
+    if (userInfo && token) {
+      app.globalData.userInfo = userInfo;
+      app.globalData.token = token;
+
+      this.setData({
+        userInfo: app.globalData.userInfo,
+      });
+      util.request(api.getCurUser, {
+        userInfo: app.globalData.userInfo
+      }, 'POST').then(function (res) {
+        if (res.errno === 0) {
+          that.setData({
+            curUser: res.data
+          });
+          if (res.data.idNo) {
+            that.setData({
+              idNoM: that.formatidcard(res.data.idNo),
+              idNo: res.data.idNo,
+              currentIdNo: res.data.idNo,
+              userName: res.data.username
+            });
+          } else {
+            that.setData({
+              idCardIsNull: 'true'
+            });
+          }
+        }
+      });
+    } else {
+      wx.navigateTo({
+        url: '/pages/ucenter/userLogin/userLogin'
+      })
+    }
+
+  },
+  onHide: function () {
+    // 页面隐藏
+
+  },
+  onUnload: function () {
+    // 页面关闭
+  },
+  saveIdCard: function (e) {
+    this.setData({
+      isQuery: true
+    });
+    wx.showLoading({
+      title: '加载中...',
+    })
+    let that = this;
+    if (!e.detail.value.idNo) {
+      wx.showToast({
+        title: '身份证号不能为空',
+        icon: 'none'
+      });
+      return false;
+    }
+
+    if (!e.detail.value.username) {
+      wx.showToast({
+        title: '姓名不能为空',
+        icon: 'none'
+      });
+      return false;
+    }
+    if (that.data.idNoM != that.formatidcard(e.detail.value.idNo)) {
+      that.setData({
+        idNo: e.detail.value.idNo
+      });
+    } else {
+      that.setData({
+        idNo: that.data.currentIdNo
+      });
+    }
+    that.setData({
+      userName: e.detail.value.username
+    });
+
+    if (!that.checkIdcard(that.data.idNo)) {
+      wx.showToast({
+        title: '请输入正确的身份证号',
+        icon: 'none'
+      });
+      return false;
+    }
+    util.request(api.GetCrossBoundaryQuotaQuery, {
+      idCard: that.data.idNo,
+      name: that.data.userName,
+      merchId: wx.getStorageSync('merchSn'),
+      storeId: wx.getStorageSync('storeId')
+    }, 'POST').then(function (res) {
+      if (res.errno != undefined) {
+        if (res.errno === 0) {
+          wx.hideLoading();
+          that.setData({
+            listData: [
+              { "totalAmount": res.data.totalAmount, "innerbalance": res.data.innerbalance }
+            ],
+            isQuery: false
+          });
+        } else {
+          wx.showToast({
+            title: res.errmsg,
+            icon: 'none'
+          });
+          that.setData({
+            isQuery: false
+          });
+        }
+      } else {
+        if (res.code != 0) {
+          wx.showToast({
+            title: res.msg,
+            icon: 'none'
+          });
+          that.setData({
+            isQuery: false
+          });
+        }
+      }
+    });
+  },
+  clearData: function () {
+    let that = this;
+    that.setData({
+      idNoM: ''
+    });
+  },
+  formatidcard(idcard) {
+    if (idcard.length == 15) {
+      return idcard.replace(/(\d{3})\d{10}(\d{1})/, "$1**********$2");
+    } else {
+      return idcard.replace(/(\d{3})\d{13}(\d{1})/, "$1*************$2");
+    }
+  },
+  // 校验身份证号
+  //校验码校验
+  checkCode: function (val) {
+    var p = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
+    var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
+    var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
+    var code = val.substring(17);
+    if (p.test(val)) {
+      var sum = 0;
+      for (var i = 0; i < 17; i++) {
+        sum += val[i] * factor[i];
+      }
+      if (parity[sum % 11] == code.toUpperCase()) {
+        return true;
+      }
+    }
+    return false;
+  },
+  //省份校验
+  checkProv: function (val) {
+    var pattern = /^[1-9][0-9]/;
+    var provs = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门" };
+    if (pattern.test(val)) {
+      if (provs[val]) {
+        return true;
+      }
+    }
+    return false;
+  },
+  //出生日期码校验
+  checkDate: function (val) {
+    var pattern = /^(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)$/;
+    if (pattern.test(val)) {
+      var year = val.substring(0, 4);
+      var month = val.substring(4, 6);
+      var date = val.substring(6, 8);
+      var date2 = new Date(year + "-" + month + "-" + date);
+      if (date2 && date2.getMonth() == (parseInt(month) - 1)) {
+        return true;
+      }
+    }
+    return false;
+  },
+  checkIdcard: function (val) {
+    if (this.checkCode(val)) {
+      var date = val.substring(6, 14);
+      if (this.checkDate(date)) {
+        if (this.checkProv(val.substring(0, 2))) {
+          return true;
+        }
+      }
+    }
+    // this.isError("请输入正确身份证号");
+    return false;
+  },
+  // 通过身份证号获取出生日期和性别
+  getBirthAndSex: function (idCard) {
+    var that = this;
+    var info = {};
+    var birth = (idCard.length === 18) ? idCard.slice(6, 14) : idCard.slice(6, 12);
+    var order = (idCard.length === 18) ? idCard.slice(-2, -1) : idCard.slice(-1);
+    info.birthDay = (idCard.length === 18) ? ([birth.slice(0, 4), birth.slice(4, 6), birth.slice(-2)]).join('-') : (['19' + birth.slice(0, 2), birth.slice(2, 4), birth.slice(-2)]).join('-');
+    info.sex = (order % 2 === 0 ? 2 : 0);
+    return info;
+  }
+})

+ 3 - 0
wx-mall/pages/ucenter/crossBoundaryQuotaQuery/crossBoundaryQuotaQuery.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "跨境额度查询"
+}

+ 41 - 0
wx-mall/pages/ucenter/crossBoundaryQuotaQuery/crossBoundaryQuotaQuery.wxml

@@ -0,0 +1,41 @@
+<form bindsubmit="saveIdCard" report-submit='true'>
+  <view class="add-idCard">
+    <view class="add-form">
+      <text class='id-card-txt'>此处身份证信息用于查询跨境额度信息;身份证号、姓名需要与身份证信息一致。</text>
+      <view class='id-card-txt' style="color:red" wx:if="{{idCardIsNull=='true'}}">用户未绑定身份证信息,请先绑定身份证信息后再进行查询</view>
+      <view class="form-item">
+        <label>身份证号:</label>
+        <input class="input" name='idNo' placeholder="身份证" value="{{idNoM}}" disabled="disabled"/>
+        <!-- <view bindtap="clearData">
+          <image class="clear-icon" src="/static/images/clear-fb.png"></image>
+        </view> -->
+      </view>
+      <view class="form-item">
+        <label>姓名:</label>
+        <input class="input" name='username' value="{{curUser.username}}" placeholder="姓名"  disabled="disabled"/>
+      </view>
+    </view>
+
+    <view class="line-query">
+      <view class="line-query-label">自{{startTime}}起,至{{endTime}},您的个人额度如下:</view>
+
+      <view class="table">
+        <view class="tr bg-w">
+          <view class="th">本年已用金额</view>
+          <view class="th" style="border-right: 0px solid">本年可用金额</view>
+        </view>
+        <block wx:for="{{listData}}" wx:key="{{code}}">
+          <view class="tr bg-g">
+            <view class="td">{{item.totalAmount}}</view>
+            <view class="td">{{item.innerbalance}}</view>
+          </view>
+        </block>
+      </view>
+    </view>
+
+    <view class="btns">
+      <button class=" {{isQuery?'save-disab':'save'}}" disabled="{{isQuery}}" form-type="submit">查询额度</button>
+    </view>
+
+  </view>
+</form>

+ 252 - 0
wx-mall/pages/ucenter/crossBoundaryQuotaQuery/crossBoundaryQuotaQuery.wxss

@@ -0,0 +1,252 @@
+page {
+  height: 100%;
+  background: #f4f4f4;
+}
+
+.add-idCard .add-form {
+  background: #fff;
+  width: 100%;
+  height: auto;
+  overflow: hidden;
+}
+
+.add-idCard .form-item {
+  height: 116rpx;
+  padding-left: 31.25rpx;
+  border-bottom: 1px solid #d9d9d9;
+  display: flex;
+  align-items: center;
+  padding-right: 31.25rpx;
+}
+
+.add-idCard .form-item .location{
+ height: 60rpx;
+ width: 60rpx;
+}
+
+.add-idCard label {
+  width: 160rpx;
+  font-weight: bold;
+}
+
+.add-idCard .input {
+  flex: 1;
+  height: 44rpx;
+  line-height: 44rpx;
+  overflow: hidden;
+}
+
+.add-idCard .form-default {
+  border-bottom: 1px solid #d9d9d9;
+  height: 96rpx;
+  background: #fafafa;
+  padding-top: 28rpx;
+  font-size: 28rpx;
+}
+
+.default-input {
+  margin: 0 auto;
+  display: block;
+  width: 240rpx;
+  height: 40rpx;
+  padding-left: 50rpx;
+  line-height: 40rpx;
+  background: url(http://120.76.26.84:80/group1/M00/00/02/rBJEdVvr3NeAQgp_AAAJkFQSrpc594.png) 1rpx -448rpx no-repeat;
+  background-size: 38rpx 486rpx;
+  font-size: 28rpx;
+}
+
+.default-input.selected {
+  background: url(http://120.76.26.84:80/group1/M00/00/02/rBJEdVvr3NeAQgp_AAAJkFQSrpc594.png) 0 -192rpx no-repeat;
+  background-size: 38rpx 486rpx;
+}
+
+.add-idCard .btns {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  overflow: hidden;
+  display: flex;
+  height: 100rpx;
+  width: 100%;
+}
+
+.add-idCard .cannel, .add-idCard .save {
+  flex: 1;
+  height: 100rpx;
+  text-align: center;
+  line-height: 100rpx;
+  font-size: 28rpx;
+  color: #fff;
+  border: none;
+  border-radius: 0;
+  background: #b4282d;
+}
+
+.add-idCard .cannel, .add-idCard .save-disab {
+  flex: 1;
+  height: 100rpx;
+  text-align: center;
+  line-height: 100rpx;
+  font-size: 28rpx;
+  color: #fff;
+  border: none;
+  border-radius: 0;
+  background: #7c7b7b;
+}
+
+.add-idCard .cannel {
+  background: #333;
+}
+
+.region-select {
+  width: 100%;
+  height: 600rpx;
+  background: #fff;
+  position: fixed;
+  z-index: 10;
+  left: 0;
+  bottom: 0;
+}
+
+.region-select .hd {
+  height: 108rpx;
+  width: 100%;
+  border-bottom: 1px solid #f4f4f4;
+  padding: 46rpx 30rpx 0 30rpx;
+}
+
+.region-select .region-selected {
+  float: left;
+  height: 60rpx;
+  display: flex;
+}
+
+.region-select .region-selected .item {
+  max-width: 140rpx;
+  margin-right: 30rpx;
+  text-align: left;
+  line-height: 60rpx;
+  height: 100%;
+  color: #333;
+  font-size: 28rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.region-select .region-selected .item.disabled {
+  color: #999;
+}
+
+.region-select .region-selected .item.selected {
+  color: #b4282d;
+}
+
+.region-select .done {
+  float: right;
+  height: 60rpx;
+  width: 60rpx;
+  border: none;
+  background: #fff;
+  line-height: 60rpx;
+  text-align: center;
+  color: #333;
+  font-size: 28rpx;
+}
+
+.region-select .done.disabled {
+  color: #999;
+}
+
+.region-select .bd {
+  height: 492rpx;
+  width: 100%;
+  padding: 0 30rpx;
+}
+
+.region-select .region-list {
+  height: auto;
+  overflow: scroll;
+}
+
+.region-select .region-list .item {
+  width: 100%;
+  height: 104rpx;
+  line-height: 104rpx;
+  text-align: left;
+  color: #333;
+  font-size: 28rpx;
+}
+
+.region-select .region-list .item.selected {
+  color: #b4282d;
+}
+
+.bg-mask {
+  height: 100%;
+  width: 100%;
+  background: rgba(0, 0, 0, 0.4);
+  position: fixed;
+  top: 0;
+  left: 0;
+  z-index: 8;
+}
+
+.id-card-txt{
+  font-size:22rpx;
+  margin-left: 20rpx;
+  color: #a5a3a3;
+}
+
+.clear-icon{
+  position: absolute;
+  top:110rpx;
+  right:30rpx;
+  width:32rpx;
+  height:32rpx;
+  z-index:9999;
+}
+.line-query{
+  margin-top: 70rpx;
+}
+.line-query-label{
+  margin-left: 30rpx;
+  width: 93vw;
+  margin: 0px auto;
+  font-weight: bolder;
+}
+.table {
+  border: 0px solid darkgray;
+  /* margin-top: 70rpx; */
+  width: 96vw;
+  margin: 70rpx auto 0px auto;
+}
+.tr {
+  display: flex;
+  width: 100%;
+  justify-content: center;
+  height: 3rem;
+  align-items: center;
+}
+.td {
+    width:40%;
+    justify-content: center;
+    text-align: center;
+}
+.bg-w{
+  background: #3366FF;
+}
+.bg-g{
+  background: #E6F3F9;
+}
+.th {
+  width: 40%;
+  justify-content: center;
+  /* background: #3366FF; */
+  color: #fff;
+  display: flex;
+  height: 3rem;
+  align-items: center;
+  border-right: 6px solid #f4f4f4;
+}

+ 452 - 0
wx-mall/pages/ucenter/userLogin/userLogin.js

@@ -0,0 +1,452 @@
+var api = require('../../../config/api.js');
+var util = require('../../../utils/util.js');
+var app = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    phone: '',
+    smscode: '',
+    second: '发送验证码',
+    disabled: false,
+    disabledUpdate: false,
+    paramView: '',
+    navUrl: '',
+    isRegist: true
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    var that = this;
+    if(options.view){
+      that.setData({
+        paramView: options.view
+      });
+    }
+    console.log(that.data.paramView)
+    if (wx.getStorageSync("navUrl")) {
+      that.setData({
+        navUrl: wx.getStorageSync("navUrl")
+      })
+    } else {
+      that.setData({
+        navUrl: '/pages/index/index'
+      })
+    }
+  },
+  /**
+   * 页面渲染完成
+   */
+  onReady: function () {
+
+  },
+  /**
+   * 页面显示
+   */
+  onShow: function () {
+
+  },
+  /**
+   * 页面隐藏
+   */
+  onHide: function () {
+  },
+  /**
+   * 页面关闭
+   */
+  onUnload: function () {
+    console.log('登陆页面返回2,进入登陆页参数:' + this.data.paramView)
+    wx.setStorageSync('isRefusedLogin', 'true');//拒绝授权
+    if (this.data.paramView == 'hotGoods' || this.data.paramView == 'indexGoods' || this.data.paramView == 'cart') {
+      wx.setStorageSync("isLocationIndex", "true");//购物车是否已跳转登录页,跳转成功设置为true已跳转
+      wx.switchTab({
+        url: '/pages/index/index'
+      });
+    }
+    if (this.data.paramView == 'cateGoods') {
+      wx.switchTab({
+        url: '/pages/catalog/catalog'
+      });
+    }
+    if (this.data.paramView == 'hotGoodsView') {
+      wx.navigateBack({
+        delta: 1
+      })
+    }
+  },
+
+  clearPhone() {
+    this.setData({
+      phone: ''
+    });
+  },
+  clearCode() {
+    this.setData({
+      smscode: ''
+    });
+  },
+  bindPhoneInput: function (e) {
+    console.log(e.detail.value)
+    this.setData({
+      phone: e.detail.value
+    });
+  },
+  bindSmscodeInput: function (e) {
+    this.setData({
+      smscode: e.detail.value
+    });
+  },
+  /**
+  * 用户登录,获取授权用户信息,查询授权用户openid是否与登录用户手机号绑定一致,
+  * 不一致的提示是否更新手机绑定信息,一致则登录成功
+  */
+  loginUser: function () {
+    let regular = /^1[3|4|5|7|8]\d{9}$/;
+    if (!regular.test(this.data.phone)) {
+      util.showErrorToast('手机格式不正确')
+      return false;
+    }
+    if (this.data.smscode.length == 0) {
+      util.showErrorToast('验证码不能为空')
+      return false;
+    }
+    var that = this;
+    wx.login({
+      success: function (res) {
+        if (res.code) {
+          wx.getUserInfo({
+            withCredentials: true,
+            success: function (succRes) {
+              util.request(api.getOpenId, {
+                code: res.code
+              }).then((openIdRes) => {
+                if (openIdRes.errno === 0){
+                  //授权成功登录用户信息
+                  util.request(api.userLogin, {
+                    smscode: that.data.smscode,
+                    phone: that.data.phone,
+                    storeId: wx.getStorageSync('storeId'),
+                    merchSn: wx.getStorageSync('merchSn'),
+                    userInfo: succRes,
+                    openId: openIdRes.data
+                  }, 'POST').then(function (userLoginRes) {
+                    if (userLoginRes.errno === 0) {
+                      //存储用户信息
+                      that.setLoginUserInfo(userLoginRes);
+                      console.log("登录成功");
+                      util.showSuccessToast('登录成功');
+                    }else if (userLoginRes.errno === 2) {//openid的绑定的手机号与当前用户登录的手机号不一致
+                      wx.showModal({
+                        title: '提示',
+                        content: userLoginRes.errmsg,
+                        success: function (conRes) {
+                          if (conRes.confirm) {
+                            util.request(api.userLoginMobileUpdate, {
+                              phone: that.data.phone,
+                              openId: openIdRes.data,
+                              storeId: wx.getStorageSync('storeId'),
+                              merchSn: wx.getStorageSync('merchSn'),
+                              userInfo: succRes,
+                            }, 'POST').then(function (loginMobUpdRes) {
+                              if (loginMobUpdRes.errno === 0) {
+                                //存储用户信息
+                                that.setLoginUserInfo(loginMobUpdRes);
+                                console.log("登录成功");
+                                util.showSuccessToast('登录成功');
+                              } else {
+                                util.showErrorToast(loginMobUpdRes.errmsg);
+                              }
+                            })
+                          } else {
+                            console.log('弹框后点取消')
+                          }
+                        }
+                      })
+                    } else {
+                      if (userLoginRes.errmsg.length>8){
+                        wx.showModal({
+                          title: '提示',
+                          content: userLoginRes.errmsg,
+                          showCancel: false
+                        })
+                      } else {
+                        util.showErrorToast(userLoginRes.errmsg);
+                      }
+                    }
+                  });
+                }
+              });
+              
+            },
+            fail: function (err) {
+              wx.setStorageSync('isRefusedLogin', 'true');//拒绝授权
+              // wx.switchTab({
+              //   url: '/pages/index/index'
+              // });
+              console.log("登录页重新认证");
+            }
+          });
+        } else {
+          console.log("failed");
+        }
+      },
+      fail: function (err) {
+        console.log("failed");
+      }
+    });
+  },
+  /**
+   * 存储用户信息
+   */
+  setLoginUserInfo: function (loginMobUpdRes){
+    var that = this;
+    wx.setStorageSync('userInfo', loginMobUpdRes.data.userInfo);
+    wx.setStorageSync('token', loginMobUpdRes.data.token);
+    wx.setStorageSync('userId', loginMobUpdRes.data.userId);
+
+    if (that.data.paramView == 'goodsView') {
+      wx.navigateBack({
+        delta: 1
+      });
+    } else {
+      if (that.data.navUrl && that.data.navUrl == '/pages/index/index') {
+        console.log(that.data.navUrl)
+        wx.switchTab({
+          url: that.data.navUrl,
+        });
+      } else if (that.data.navUrl) {
+        wx.redirectTo({
+          url: that.data.navUrl,
+        });
+      }
+    }
+
+    wx.setStorageSync('isRefusedLogin', 'false');//允许授权
+  },
+  /**
+   * 发送短信
+   */
+  smscode: function () {
+    var that = this;
+
+    let regular = /^1[3|4|5|7|8]\d{9}$/;
+    if (!regular.test(that.data.phone)) {
+      util.showErrorToast('手机格式不正确')
+      return false;
+    }
+    util.request(api.smscodeSend, {
+      phone: that.data.phone
+    }, 'POST').then(function (res) {
+      let n = 59;
+      var timer = setInterval(function () {
+        if (n == 0) {
+          clearInterval(timer);
+          that.setData({
+            second: '发送验证码',
+            disabled: false
+          });
+        } else {
+          that.setData({
+            second: n-- + 's后重新获取',
+            disabled: true
+          });
+        }
+      }, 1000);
+      if (res.errno == 0) {
+        wx.showToast({
+          title: '短信发送成功'
+        })
+      } else {
+        util.showErrorToast('发送失败');
+        clearInterval(timer);
+        that.setData({
+          second: '发送验证码',
+          disabled: false
+        });
+        return false;
+      }
+    });
+  },
+  backHome: function () {
+    wx.reLaunch({
+      url: '../index/index',
+    })
+  },
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+  // /**
+  //  * 用户点击右上角分享
+  //  */
+  // onShareAppMessage: function () {
+
+  // },
+  bindCancelLogin: function () {
+    wx.setStorageSync('isRefusedLogin', 'true');//拒绝授权
+    wx.switchTab({
+      url: '/pages/index/index'
+    });
+  },
+  /**
+   * 登录页直接触发微信授权,授权成功保存用户信息
+   */
+  bindGetUserInfo: function () {
+    let that = this;
+    
+    wx.login({
+      success: function (res) {
+        if (res.code) {
+          wx.getUserInfo({
+            withCredentials: true,
+            success: function (succRes) {
+              //保存授权用户信息
+              wx.request({
+                url: api.AuthLoginByWeixin,
+                data: {
+                  code: res.code, userInfo: succRes, storeId: wx.getStorageSync('storeId'), merchSn: wx.getStorageSync('merchSn')
+                },
+                method: 'POST',
+                header: {
+                  'Content-Type': 'application/json'
+                },
+                success: function (wxRes) {
+                  if (wxRes.data.errno === 0) {
+                    //存储用户信息到缓存
+                    wx.setStorageSync('userInfo', wxRes.data.data.userInfo);
+                    wx.setStorageSync('token', wxRes.data.data.token);
+                    wx.setStorageSync('userId', wxRes.data.data.userId);
+
+                    if (that.data.paramView == 'goodsView') {
+                      wx.navigateBack({
+                        delta: 1
+                      });
+                    } else {
+                      if (that.data.navUrl && that.data.navUrl == '/pages/index/index') {
+                        console.log(that.data.navUrl)
+                        wx.switchTab({
+                          url: that.data.navUrl,
+                        });
+                      } else if (that.data.navUrl) {
+                        wx.redirectTo({
+                          url: that.data.navUrl,
+                        });
+                      }
+                    }
+
+                    wx.setStorageSync('isRefusedLogin', 'false');//允许授权
+                    // console.log("登录成功");
+                  }
+                },
+                fail: function (err) {
+                  console.log("failed");
+                }
+              });
+            },
+            fail: function (err) {
+              wx.setStorageSync('isRefusedLogin', 'true');//拒绝授权
+              // wx.switchTab({
+              //   url: '/pages/index/index'
+              // });
+              console.log("登录页重新认证");
+            }
+          });
+        } else {
+          console.log("failed");
+        }
+      },
+      fail: function (err) {
+        console.log("failed");
+      }
+    });
+
+  },
+  /*registUser: function () {
+    var that = this;
+    let regular = /^1[3|4|5|7|8]\d{9}$/;
+    if (!regular.test(that.data.phone)) {
+      util.showErrorToast('手机格式不正确')
+      return false;
+    }
+    if (that.data.smscode.length == 0) {
+      util.showErrorToast('验证码不能为空')
+      return false;
+    }
+    wx.login({
+      success: function (res) {
+        if (res.code) {
+          wx.getUserInfo({
+            withCredentials: true,
+            success: function (succRes) {
+              util.request(api.getOpenId, {
+                code: res.code
+              }).then((openIdRes) => {
+                if (openIdRes.errno === 0) {
+                  that.registUserUtil();
+                }
+              });
+            },
+            fail: function (err) {
+              wx.setStorageSync('isRefusedLogin', 'true');//拒绝授权
+              console.log("注册前进行授权重新认证");
+            }
+          });
+        } else {
+          console.log("faild");
+        }
+      },
+      fail: function (err) {
+        console.log("failed");
+      }
+    })
+  },
+  registUserUtil: function () {
+    var that = this;
+    util.request(api.registUser, {
+      smscode: that.data.smscode,
+      phone: that.data.phone
+    }, 'POST').then(function (res) {
+      if (res.errno === 0) {
+        //存储用户信息
+        wx.setStorageSync('userInfo', res.data.data.userInfo);
+        wx.setStorageSync('token', res.data.data.token);
+        wx.setStorageSync('userId', res.data.data.userId);
+
+        if (that.data.navUrl && that.data.navUrl == '/pages/index/index') {
+          wx.switchTab({
+            url: that.data.navUrl,
+          });
+        } else if (that.data.navUrl) {
+          wx.redirectTo({
+            url: that.data.navUrl,
+          });
+        }
+
+        wx.setStorageSync('isRefusedLogin', 'false');//允许授权
+        // console.log("登录成功");
+      } else {
+        util.showErrorToast(res.errmsg);
+      }
+    });
+  },
+  showRegist: function(){
+    var that = this;
+    that.setData({
+      isRegist: false
+    });
+    wx.setNavigationBarTitle({
+      title: '注册'
+    })
+  }*/
+})

+ 4 - 0
wx-mall/pages/ucenter/userLogin/userLogin.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "用户登录",
+  "component": true
+}

+ 59 - 0
wx-mall/pages/ucenter/userLogin/userLogin.wxml

@@ -0,0 +1,59 @@
+<view class="container">
+  <view class="form-box" wx:if="{{isRegist}}">
+    <view class="form-item">
+    <!-- 用于微信支付人手机号联系 -->
+      <input class="phone" value="{{phone}}" disabled="{{disabledUpdate}}"  type="number" maxlength="{{11}}" bindinput="bindPhoneInput" placeholder="手机号" />
+      <image wx:if="{{ phone.length > 0 }}" id="clear-phone" class="clear" src="/static/images/clear_input.png" catchtap="clearPhone"></image>
+    </view>
+    <view class="form-item-code">
+      <view class="form-item code-item">
+        <input class="smscode" disabled="{{disabledUpdate}}" value="{{smscode}}" type="number" bindinput="bindSmscodeInput" placeholder="验证码" />
+        <image class="clear" id="clear-smscode" wx:if="{{ smscode.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearCode"></image>
+      </view>
+      <view class="sms-rr">
+          <button class="btn" disabled="{{disabled}}" catchtap="smscode" >{{second}}</button>
+      </view>
+
+    </view>
+    <view style='width:100%;margin: 0px auto;'>
+      <button  class="login-btn" open-type="getUserInfo" bindtap="loginUser">手机号绑定登录</button>
+      <button class="no-login-btn" bindtap="bindCancelLogin">暂不登录</button>
+    </view>
+  </view>
+
+  <!-- <view class="form-box" wx:if="{{!isRegist}}">
+    <view class="form-item">
+      <input class="phone" value="{{phone}}" disabled="{{disabledUpdate}}"  type="number" maxlength="{{11}}" bindinput="bindPhoneInput" placeholder="手机号" auto-focus/>
+      <image wx:if="{{ phone.length > 0 }}" id="clear-phone" class="clear" src="/static/images/clear_input.png" catchtap="clearPhone"></image>
+    </view>
+    <view class="form-item-code">
+      <view class="form-item code-item">
+        <input class="smscode" disabled="{{disabledUpdate}}" value="{{smscode}}" type="number" bindinput="bindSmscodeInput" placeholder="验证码" />
+        <image class="clear" id="clear-smscode" wx:if="{{ smscode.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearCode"></image>
+      </view>
+      <view class="sms-rr">
+          <button class="btn" disabled="{{disabled}}" catchtap="smscode" >{{second}}</button>
+      </view>
+
+    </view>
+    <view style='width:100%;margin: 0px auto;'>
+      <button class="regist-btn" open-type="getUserInfo" bindtap="registUser">注册</button>
+    </view>
+  </view> -->
+  <!-- <view class='regist' wx:if="{{isRegist}}" bindtap='showRegist'>立即注册</view> -->
+  <view style='margin:80rpx auto 80rpx auto;width:100%;' wx:if="{{isRegist}}">
+    <view class='login-third-div'></view>
+    <view class='login-third'>
+      <view class='login-third-text'>第三方账号登录</view>
+      <view class='login-third-div2'></view>
+    </view>
+    
+    
+    <view class='sq-weixin-view'>
+      <button open-type="getUserInfo" class="sq-weixin" bindgetuserinfo="bindGetUserInfo"></button>
+      <!-- <image class="sq-weixin" src="/static/images/weixin_sq.png">
+      
+      </image> -->
+    </view>
+  </view>
+</view>

+ 184 - 0
wx-mall/pages/ucenter/userLogin/userLogin.wxss

@@ -0,0 +1,184 @@
+page ,.container{
+  width: 750rpx;
+  height: 100%;
+  overflow: hidden;
+  background: #fff;
+}
+
+.form-box{
+  width:90%;
+  height:36%;
+  overflow:hidden;
+  padding:0 80rpx;
+  margin:65px auto 20px auto;
+  box-shadow:3px 1px 10px #ccc;
+  border-radius:19rpx;
+}
+
+.form-item{
+  position: relative;
+  background: #fff;
+  display: flex;
+  flex: 1;
+  align-items: center;
+  border-bottom: 1px solid #d9d9d9;
+  border-radius: 4px;
+  margin-top:55rpx;
+}
+.form-item input{
+  flex: 1;
+}
+.form-item .username, .form-item .password, .form-item .code{
+  position: absolute;
+  top: 26rpx;
+  left: 0;
+  display: block;
+  width: 100%;
+  height: 44rpx;
+  background: #fff;
+  color: #333;
+  font-size: 30rpx;
+}
+
+.form-item-code{
+  margin-top:17rpx;
+  height: auto;
+  overflow: hidden;
+  width: 100%;
+  display: flex;
+  align-items: center;
+}
+
+.form-item-code .form-item{
+  float: left;
+  width: 350rpx;
+}
+
+.form-item-code .sms-r{
+  float: right;
+  margin-top: 4rpx;
+  height: 68rpx;
+  width: 186rpx;
+}
+
+.form-item .clear{
+  display: block;
+  background: #fff;
+  height: 44rpx;
+  width: 44rpx;
+}
+
+.login-btn{
+  margin-top:70rpx;
+  height:72rpx;
+  line-height:72rpx;
+  color:#fff;
+  font-size:28rpx;
+width:48%;
+  background:#1AAD19;
+  border-radius:50rpx;
+  float:left;
+  margin-left: 10rpx;
+}
+
+.no-login-btn{
+  margin-top:70rpx;
+  height:72rpx;
+  line-height:72rpx;
+  color:#fff;
+  font-size:28rpx;
+  width:48%;
+  background:#a09e9e;
+  border-radius:50rpx;
+  float:left;
+  margin-left: 12rpx;
+}
+
+.form-item-text{
+  height: 35rpx;
+  width: 100%;
+}
+
+.form-item-text .register{
+  display: block;
+  height: 34rpx;
+  float: left;
+  font-size: 28rpx;
+  color: #999;
+}
+
+.form-item-text .reset{
+  display: block;
+  height: 34rpx;
+  float: right;
+  font-size: 28rpx;
+  color: #999;
+}
+
+.sms-rr .btn{
+  height: 60rpx;
+  line-height: 60rpx;
+  font-size: 28rpx;
+  margin-top:30rpx;
+}
+.login-third{
+  /* margin: 117rpx auto 60rpx auto; */
+  width:65%;
+  float:left;
+}
+.login-third-text{
+  /* margin: 117rpx auto 60rpx auto; */
+  color: #999;
+  text-align: center;
+  font-size:32rpx;
+  width:50%;
+  float:left;
+}
+.login-third-div{
+  width:170rpx;
+  background:#ccc;
+  height:1px;
+  float:left;
+  margin-top:24rpx;
+  margin-left:84rpx;
+}
+.login-third-div2{
+  width:170rpx;
+  background:#ccc;
+  height:1px;
+  margin-top:24rpx;
+  margin-left:243rpx;
+}
+.sq-weixin-view{
+  width: 150rpx;
+  margin: 0px auto;
+  padding-top:100rpx;
+}
+.sq-weixin-view button{
+  width: 150rpx;
+  height: 150rpx;
+  background:url(http://120.76.26.84:80/group1/M00/00/49/rBJEdV3JDzaAI3ceAAAreqbIuTw477.png) 0 0 no-repeat;
+  background-size:156.803rpx;
+}
+
+.sq-weixin-view button:after{
+  border: none;
+}
+.regist{
+  width:17%;
+  height:60rpx;
+  margin-left:581rpx;
+  color:#b4282d;
+  /* text-align:right; */
+}
+
+.regist-btn{
+  margin-top:70rpx;
+  height:72rpx;
+  line-height:72rpx;
+  color:#fff;
+  font-size:30rpx;
+  width:100%;
+  background:#1AAD19;
+  border-radius:50rpx;
+}