Jelajahi Sumber

Merge branch 'dev4.5.8.5' of ssh://192.168.3.207:10022/qmx/jy into dev4.5.8.5

wangchuanjin 4 tahun lalu
induk
melakukan
3daec4e28c

+ 5 - 0
src/jfw/modules/app/src/web/templates/dataPack/recharge.html

@@ -43,6 +43,11 @@
                 <van-icon name="question-o" @click="showQuestion"></van-icon>
               </div>
             </div>
+            <div class="order-phone-group" :class="{ error: !validatorPhonePass }">
+              <label for="order_phone">手机号码</label>
+              <input id="order_phone" v-model="userInfo.phone" autocomplete='off' placeholder='请输入手机号码' maxlength='11' type='tel' />
+              <p class="error-message">手机号码输入错误</p>
+            </div>
             <div class="notes-to-buy">
               购买须知:<br />
               1、数据流量包是数据自助导出充值服务,最低1000条起充,仅针对线上自助充值使用(与线下企业数据充值账户不可共享);<br />

+ 45 - 1
src/web/staticres/common-module/data-pack/css/recharge.css

@@ -13,7 +13,7 @@
 }
 
 .spec-list-container {
-  margin-top: .16rem;
+  margin: .16rem 0;
   padding: .32rem;
   background-color: #fff;
 }
@@ -158,3 +158,47 @@
 .question-tip .content-text {
   line-height: .38rem;
 }
+
+.order-phone-group {
+  margin: .24rem;
+  padding: 8px 16px;
+  color: #5F5E64;
+  font-size: 15px;
+  line-height: 22px;
+  letter-spacing: 0px;
+  text-align: left;
+  box-sizing: border-box;
+  background-color: #fff;
+  border-radius: 8px;
+}
+.order-phone-group label {
+  display: inline-block;
+  min-width: 80px;
+  padding: 8px 0;
+}
+.order-phone-group.error input {
+  color: #FB483D;
+}
+.order-phone-group.error p {
+  display: block;
+}
+.order-phone-group input {
+  padding: 8px 0;
+  color: #5F5E64;
+  font-size: 16px;
+  line-height: 24px;
+  letter-spacing: 0px;
+  text-align: left;
+}
+.order-phone-group input::placeholder {
+  color: #C0C4CC;
+}
+.order-phone-group p {
+  display: none;
+  color: #FB483D;
+  font-size: 12px;
+  line-height: 18px;
+  letter-spacing: 0px;
+  text-align: left;
+  margin-top: 2px;
+}

+ 39 - 3
src/web/staticres/common-module/data-pack/js/recharge.js

@@ -4,6 +4,9 @@ var vm = new Vue({
   data: function () {
     return {
       sessKey: '$data-data-pack-recharge',
+      userInfo: {
+        phone: ''
+      },
       priceInfo: {},
       price: {
         before: 0, // 优惠前价格
@@ -74,6 +77,14 @@ var vm = new Vue({
       }
     }
   },
+  computed: {
+    // 手机号校验是否通过
+    validatorPhonePass: function () {
+      var phone = this.userInfo.phone
+      if (!phone) return true
+      return /^1\d{10}$/.test(phone)
+    },
+  },
   watch: {
     'charge.count': function () {
       this.sortPrice()
@@ -82,11 +93,15 @@ var vm = new Vue({
     specActive: function () {
       this.sortPrice()
       this.calcPrice()
-    }
+    },
+    validatorPhonePass: function () {
+      this.checkStatus()
+    },
   },
   created: function () {
     var restore = this.restoreState()
     if (!restore) {
+      this.getUserInfo()
       this.getGoodsList()
     }
   },
@@ -143,6 +158,18 @@ var vm = new Vue({
         }
       })
     },
+    getUserInfo: function () {
+      var _this = this
+      $.ajax({
+        url: '/jypay/user/getAccountInfo?t=' + Date.now(),
+        type: 'GET',
+        success: function (res) {
+          if (res && res.error_code === 0) {
+            Object.assign(_this.userInfo, res.data)
+          }
+        }
+      })
+    },
     // 根据请求返回值初始化页面参数
     initPageInfo: function () {
       var info = this.priceInfo
@@ -246,12 +273,18 @@ var vm = new Vue({
     },
     checkSubmitStatus: function (checkStatus) {
       this.bottomConf.checkboxStatus = checkStatus
-      return checkStatus
+      return checkStatus && this.validatorPhonePass
     },
     // 保证mounted之后执行
     checkConfirmButtonDisabled: function () {
       this.$refs.couponRef.submitStatus = !this.bottomConf.checkboxStatus
     },
+    // 调用此方法,即可检测当前页面表单是否满足条件(可计算出提交按钮是否可用)
+    checkStatus: function () {
+      // 此处取反,因为在调用couponRef.chooseCheckbox时候,会对checkbox再次取反
+      this.bottomConf.checkboxStatus = !this.bottomConf.checkboxStatus
+      this.$refs.couponRef.chooseCheckbox()
+    },
     readEvent: function () {
       this.savePageState()
       if (utils.isWeiXinBrowser) {
@@ -272,7 +305,8 @@ var vm = new Vue({
       var packId = this.getPickId()
       var data = {
         packId: packId,
-        lotteryId: this.$refs.couponRef.coupon.userLotteryId
+        lotteryId: this.$refs.couponRef.coupon.userLotteryId,
+        order_phone: this.userInfo.phone
       }
       $.ajax({
         url: '/subscribepay/dataExportPack/createOrder',
@@ -306,6 +340,7 @@ var vm = new Vue({
       if ($data) {
         $data = JSON.parse($data)
         Object.assign(this.priceInfo, $data.priceInfo)
+        Object.assign(this.userInfo, $data.userInfo)
         Object.assign(this.price, $data.price)
         this.specActive = $data.specActive
         Object.assign(this.charge, $data.charge)
@@ -320,6 +355,7 @@ var vm = new Vue({
     savePageState: function () {
       var data = {
         priceInfo: this.priceInfo,
+        userInfo: this.userInfo,
         price: this.price,
         specActive: this.specActive,
         charge: this.charge,

+ 5 - 0
src/web/templates/weixin/dataPack/recharge.html

@@ -54,6 +54,11 @@
                 <van-icon name="question-o" @click="showQuestion"></van-icon>
               </div>
             </div>
+            <div class="order-phone-group" :class="{ error: !validatorPhonePass }">
+              <label for="order_phone">手机号码</label>
+              <input id="order_phone" v-model="userInfo.phone" autocomplete='off' placeholder='请输入手机号码' maxlength='11' type='tel' />
+              <p class="error-message">手机号码输入错误</p>
+            </div>
             <div class="notes-to-buy">
               购买须知:<br />
               1、数据流量包是数据自助导出充值服务,最低1000条起充,仅针对线上自助充值使用(与线下企业数据充值账户不可共享);<br />