lin
2026-06-08 a89c11d01a40ebe2707426774a428b84aeaca464
pages/quanyi/add.vue
@@ -64,8 +64,8 @@
        fontSize: "30rpx",
        fontWeight: "bold",
      },
      bindStatus:false
      bindStatus:false,
      getSmsCodeTimer: null,
    };
  },
@@ -194,43 +194,15 @@
    kk(){
      const _this = this;
      _this.getUserInfo()
      // if(this.addressStr.length < 8){
      if(this.addressStr.length < 8){
        uni.showToast({
          title: '请输入详细地址',
          icon: 'none'
        });
        return
      }
     uni.request({
       url: _this.$webHost + "/api/v2/customer/appAddCstAddress",
       method: "POST",
       data: {
         ..._this.addressDetail,
          customerId: uni.getStorageSync('ygxLogin').customerId,
         sourceId: uni.getStorageSync('ygxLogin').appId
       },
       success(){
         uni.request({
           url: _this.$webHost+'/api/v2/sign/signed/'+uni.getStorageSync('ygxLogin').customerId,
           method:'POST',
         })
         uni.request({
           url: _this.$webHost+'/api/v2/pay/memberPurchaseBenefitsPays',
           method:'POST',
           data:{
             customerId: uni.getStorageSync('ygxLogin').customerId,
             memberPeriodConfigId: uni.getStorageSync('memberPeriodConfigInfo').id
           },
           success(){
             _this.getUserInfo()
           }
         })
       }
     })
      //   uni.showToast({
      //     title: '请输入详细地址',
      //     icon: 'none'
      //   });
      //   return
      // }
      // 移到上面了,先保存地址再走下面的接口
      // uni.request({
@@ -324,6 +296,15 @@
        },
      });*/
    },
    isValidIDCard(IDCard) {
      // 正则:15位纯数字 或 18位(前17位数字 + 最后一位数字/X)
      const idCardReg = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/;
      return idCardReg.test(IDCard)
    },
    isValidChineseBankCard(cardNumber) {
      const length = cardNumber.length;
      return length === 16 || length === 19;
    },
    submit() {
      const _this = this;
      if(!this.protocolChecked[0]){uni.showToast({title: '请阅读并同意相关协议', icon: 'none'});return;}
@@ -340,6 +321,14 @@
          icon: "none",
        });
        return;
      } else {
        if (!_this.isValidIDCard(_this.idCardNo)) {
          uni.showToast({
            title: "请输入正确的身份证号",
            icon: "none",
          });
          return;
        }
      }
      if(!_this.cardNumber){
        uni.showToast({
@@ -347,6 +336,14 @@
          icon: "none",
        });
        return;
      } else {
        if (!_this.isValidChineseBankCard(_this.cardNumber)) {
          uni.showToast({
            title: "请输入正确的银行卡号",
            icon: "none",
          });
          return;
        }
      }
      if(!_this.cardPhone){
        uni.showToast({
@@ -386,6 +383,10 @@
       });
       return;
     }
     if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(_this.addressDetail.contactPhone)) return uni.showToast({
       title: '请输入正确的收件人联系电话',
       icon: 'none'
     });
     if (!_this.addressDetail.provinceCode) {
       uni.showToast({
         title: "请输入收件人所在地",
@@ -432,77 +433,159 @@
          _this.getPayBindCardInfo = res.data.data;
        }
      })
     // 保存地址:地址保存成功后再走提交接口
     uni.request({
       url: _this.$webHost + "/api/v2/customer/appAddCstAddress",
       method: "POST",
       data: {
         ..._this.addressDetail,
          customerId: uni.getStorageSync('ygxLogin').customerId,
         sourceId: uni.getStorageSync('ygxLogin').appId
       },
      success: function (res) {
         if(res.data.code==200){
            uni.request({
              url: _this.$webHost+'/api/v2/pay/verifySMSCodes',
              method:'POST',
              data:{
               ..._this.bindCardId,
               "customerId": uni.getStorageSync('ygxLogin').customerId,
               "cardPhone" : _this.cardPhone,  //手机号
               "cardNumber": _this.cardNumber, //卡号
               "cardName" : _this.cardName, // 名字
               "cardIdNo" : _this.cardIdNo,
               "bankName" : _this.bankName,
               "cardNo" :  _this.cardNumber,
               "verificationCode": _this.verificationCode,
              },
              success(e){
               if(e.data.code!==200){
                  uni.showToast({
                    title: e.data.data,
                    icon: 'none'
                  });
                  return;
               }
               uni.request({
                 url:_this.$webHost+`/api/v2/pay/getPayBindCardInfo/${uni.getStorageSync('ygxLogin').customerId}`,
                 method:'get',
                 success:function(res){
                  const  ls =  res.data.data;
                  _this.getPayBindCardInfo = res.data.data;
                  if(!ls || !ls.some(item => item.bindStatus == 0)) {_this.kk();return;}
                  if(ls.length && !ls[1].bindStatus){
                    _this.$refs.codeUi.open()
                    _this.isCounting = false;
                    _this.countText = '';
                    return;
                  }
                  if(ls.length && !ls[2].bindStatus){
                    _this.$refs.setUi.open();
                    _this.isCounting = false;
                    _this.countText = '';
                    return;
                  }
                  if(!ls || !ls.some(item => item.bindStatus == 0)) {_this.kk();return;}
                  _this.kk()
                 }
               })
              }
            })
         } else {
            uni.showToast({
              title: res.data.msg,
              icon: 'none'
            });
         }
      }
     })
      uni.request({
        url: _this.$webHost+'/api/v2/pay/verifySMSCodes',
        method:'POST',
        data:{
          ..._this.bindCardId,
   //    uni.request({
   //      url: _this.$webHost+'/api/v2/pay/verifySMSCodes',
   //      method:'POST',
   //      data:{
   //        ..._this.bindCardId,
          "customerId": uni.getStorageSync('ygxLogin').customerId,
          "cardPhone" : _this.cardPhone,  //手机号
   //        "customerId": uni.getStorageSync('ygxLogin').customerId,
   //        "cardPhone" : _this.cardPhone,  //手机号
          "cardNumber": _this.cardNumber, //卡号
   //        "cardNumber": _this.cardNumber, //卡号
          "cardName" : _this.cardName, // 名字
          "cardIdNo" : _this.cardIdNo,
          "bankName" : _this.bankName,
          "cardNo" :  _this.cardNumber,
   //        "cardName" : _this.cardName, // 名字
   //        "cardIdNo" : _this.cardIdNo,
   //        "bankName" : _this.bankName,
   //        "cardNo" :  _this.cardNumber,
          "verificationCode": _this.verificationCode,
        },
        success(e){
          if(e.data.code!==200){
            // _this.$util.Tips({
            //   title: e.data.data
            // });
         uni.showToast({
           title: e.data.data,
           icon: 'none'
         });
         return;
          }
          uni.request({
            url:_this.$webHost+`/api/v2/pay/getPayBindCardInfo/${uni.getStorageSync('ygxLogin').customerId}`,
            method:'get',
            success:function(res){
              const  ls =  res.data.data;
              _this.getPayBindCardInfo = res.data.data;
              if(!ls || !ls.some(item => item.bindStatus == 0)) {_this.kk();return;}
   //        "verificationCode": _this.verificationCode,
   //      },
   //      success(e){
   //        if(e.data.code!==200){
   //          // _this.$util.Tips({
   //          //   title: e.data.data
   //          // });
         // uni.showToast({
         //   title: e.data.data,
         //   icon: 'none'
         // });
         // return;
   //        }
   //        uni.request({
   //          url:_this.$webHost+`/api/v2/pay/getPayBindCardInfo/${uni.getStorageSync('ygxLogin').customerId}`,
   //          method:'get',
   //          success:function(res){
   //            const  ls =  res.data.data;
   //            _this.getPayBindCardInfo = res.data.data;
   //            if(!ls || !ls.some(item => item.bindStatus == 0)) {_this.kk();return;}
              if(ls.length && !ls[1].bindStatus){
                _this.$refs.codeUi.open()
                _this.isCounting = false;
                _this.countText = '';
                return;
              }
              if(ls.length && !ls[2].bindStatus){
                _this.$refs.setUi.open();
                _this.isCounting = false;
                _this.countText = '';
                return;
              }
              if(!ls || !ls.some(item => item.bindStatus == 0)) {_this.kk();return;}
   //            if(ls.length && !ls[1].bindStatus){
   //              _this.$refs.codeUi.open()
   //              _this.isCounting = false;
   //              _this.countText = '';
   //              return;
   //            }
   //            if(ls.length && !ls[2].bindStatus){
   //              _this.$refs.setUi.open();
   //              _this.isCounting = false;
   //              _this.countText = '';
   //              return;
   //            }
   //            if(!ls || !ls.some(item => item.bindStatus == 0)) {_this.kk();return;}
              _this.kk()
   //            _this.kk()
            }
   //          }
          })
        }
      })
   //        })
   //      }
   //    })
    },
      getSmsCode(){
        const that = this;
      clearInterval(that.getSmsCodeTimer);
        console.log(that.getPayBindCardInfo[0].paymentMethod);
        if(this.isCounting){
          return
@@ -627,11 +710,11 @@
            that.countText = `${count}s秒后重新获取`;
            const timer = setInterval(() => {
            that.getSmsCodeTimer = setInterval(() => {
              count--;
              that.countText = `${count}s秒后重新获取`;
              if (count <= 0) {
                clearInterval(timer);
                clearInterval(that.getSmsCodeTimer);
                that.isCounting = false;
                that.countText = '';
              }
@@ -936,7 +1019,7 @@
          url: '/pages/index/index'
        });
      },
     // 收件人所在地:弹窗选择城市
      openProvincesCity() {
         let defaultData = []
         if(this.addressDetail.provinceCode && this.addressDetail.cityCode) {
@@ -945,6 +1028,7 @@
         this.$refs.provincesCity.open(defaultData)
      },
      // 弹窗选择城市回调
      provincesCityChange(e) {
         if(e.value.length > 0) {
            this.addressDetail.provinceCode = e.value[0].code
@@ -993,7 +1077,7 @@
           <text>身份证号</text>
         </view>
         <view class="inp_box">
           <input  maxlength="18"   v-model="idCardNo" class="inp" placeholder="请输入身份证号" />
           <input  maxlength="18"   v-model="idCardNo" class="inp" placeholder="请输入身份证号码" />
         </view>
        </view>
@@ -1001,6 +1085,16 @@
<!--      <view style="background: #F7F7F7;height: 20rpx;"></view>-->
      <view class="form-item-title" style="margin:  40rpx;font-size: 32rpx;color: #333333;font-weight: 600;">请输入您的银行卡信息</view>
      <view class="form-item-ct">
           <view class="clo">
            <view class="label">
              <text>银行卡号</text>
            </view>
            <view class="inp_box">
              <input type="number" maxlength="19"  @blur="validateAndCacheCardInfo" v-model="cardNumber" class="inp" placeholder="请输入银行卡号" />
              <image @click="cardNumber=''" v-show="!bindStatus && cardNumber" :src="offIcon" style="width: 40rpx;height: 40rpx;position: absolute;right: 0rpx;top: 30rpx;"></image>
            </view>
           </view>
           <view class="clo">
            <view class="label">
              <text>银行卡名称</text>
@@ -1013,20 +1107,10 @@
           </view>
           <view class="clo">
            <view class="label">
              <text>银行卡号</text>
            </view>
            <view class="inp_box">
              <input  maxlength="30"  @blur="validateAndCacheCardInfo" v-model="cardNumber" class="inp" placeholder="请输入银行卡号" />
              <image @click="cardNumber=''" v-show="!bindStatus && cardNumber" :src="offIcon" style="width: 40rpx;height: 40rpx;position: absolute;right: 0rpx;top: 30rpx;"></image>
            </view>
           </view>
           <view class="clo">
            <view class="label">
              <view>预留手机号</view>
            </view>
            <view class="inp_box" style="position: relative;">
              <input  maxlength="11" v-model="cardPhone"  class="inp" placeholder="请输入预留手机号" />
              <input  maxlength="11" v-model="cardPhone"  class="inp" placeholder="请输入银行预留手机号" />
      <!--          <view class="code" style="position: absolute;top: 30rpx;right: 0;" @click="getSmsCode">-->
      <!--            <text :class="isCounting?'code_k':'code_a'">{{ isCounting ? countText : '获取验证码' }}</text>-->
      <!--          </view>-->
@@ -1038,7 +1122,7 @@
              <text>短信验证码</text>
            </view>
            <view class="inp_box" style="position: relative;">
              <input  maxlength="6" v-model="verificationCode" class="inp" type="number" placeholder="请输入短信验证码" />
              <input  maxlength="6" v-model="verificationCode" class="inp" type="number" placeholder="请输入手机短信验证码" />
              <view class="code" style="position: absolute;top: 30rpx;right: 0;" @click="getSmsCode">
               <text :class="isCounting?'code_k':'code_a'">{{ isCounting ? countText : '获取验证码' }}</text>
@@ -1067,7 +1151,7 @@
              <text>收件人姓名</text>
            </view>
            <view class="inp_box">
              <input maxlength="8" v-model="addressDetail.consignee" class="inp" placeholder="请输入收件人姓名" />
              <input maxlength="20" v-model="addressDetail.consignee" class="inp" placeholder="请输入收件人姓名" />
            </view>
           </view>
           <view class="clo">
@@ -1254,6 +1338,7 @@
                  v-model="verificationCodeT"
                  border="none"
                  placeholder="请输入验证码"
              type="number"
                  style="height: 100rpx;border: 1px solid #EEEEEE;border-radius: 30rpx;padding: 0 50rpx;"
              >
                <template #suffix>
@@ -1361,6 +1446,7 @@
                  v-model="verificationCodeS"
                  border="none"
                  placeholder="请输入验证码"
              type="number"
                  style="height: 100rpx;border: 1px solid #EEEEEE;border-radius: 30rpx;padding: 0 50rpx;"
              >
                <template #suffix>
@@ -1396,7 +1482,7 @@
   
   <provincesCity ref="provincesCity" @confirm="provincesCityChange" />
    <!-- <text-box v-if="showTextBox" ref="textBox" :getPlatformProtocolNewList="getPlatformProtocolNewList"></text-box> -->
    <text-box v-if="showTextBox" ref="textBox" :getPlatformProtocolNewList="getPlatformProtocolNewList"></text-box>
  </view>
</template>