Kaynağa Gözat

新增验证

shenjj 7 yıl önce
ebeveyn
işleme
a15d100ce0
1 değiştirilmiş dosya ile 78 ekleme ve 11 silme
  1. 78 11
      pages/mobile/user/index.vue

+ 78 - 11
pages/mobile/user/index.vue

@@ -188,7 +188,7 @@
               <span class="Updatelabel">
                 {{item}}
               </span>
-              <span class="updatespan"@click="addBtn(item)">编辑</span>
+              <span class="updatespan"@click="addBtn(item)">删除</span>
             </label>
             <span class="addBtn" v-show="AddBtnShow" @click="addBtn()"></span>
             <div class="commit" v-show="!AddBtnShow">
@@ -210,15 +210,15 @@
             </div>
           </li>
           <li class="clearfix">
-            <div class="name pull-left">邮箱:</div>
+            <div class="name pull-left">手机:</div>
             <div class="text pull-left">
-              {{userInfo.userEmail || '-'}}
+              {{userInfo.userTel || '-'}}
             </div>
           </li>
           <li class="clearfix">
-            <div class="name pull-left">手机:</div>
+            <div class="name pull-left">邮箱:</div>
             <div class="text pull-left">
-              {{userInfo.userTel || '-'}}
+              {{userInfo.userEmail || '-'}}
             </div>
           </li>
         </ul>
@@ -290,6 +290,7 @@
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <!--<loading v-show="isSearchSearchingMore"></loading>-->
     <div v-if="enterprise && false"></div>
+    <div v-if="storeI && false"></div>
   </div>
 </template>
 
@@ -332,7 +333,8 @@
         TypeObj: {},
         enterpriseInfo: {},
         hidelook: true,
-        titleActive: ''
+        titleActive: '',
+        storeInfo: {}
       }
     },
     components: {
@@ -360,9 +362,10 @@
       getRemindText: function () {
         return '您的账户暂未开通卖家中心,请前往pc端申请开通!'
       },
-      storeInfo() {
+      storeI() {
         let str = JSON.stringify(this.$store.state.option.storeStatus.data)
-        return JSON.parse(str)
+        this.storeInfo = JSON.parse(str)
+        return ''
       },
       enterprise() {
         // return this.$store.state.supplier.material.enUser.data
@@ -464,8 +467,17 @@
       },
       addBtn(text) {
         if (text !== undefined) {
-          this.labelText = text
-          this.IsChange = text
+          this.scopeLabel = []
+          let ms = this.enterpriseInfo.enBusinessScope.split(',')
+          let _newArr = ms.slice()
+          for (let j = 0; j < ms.length; j++) {
+            if (ms[j].trim() === text) {
+              _newArr.splice(j, 1)
+            }
+          }
+          this.enterpriseInfo.enBusinessScope = _newArr.join(',')
+          this.scopeLabel = this.enterpriseInfo.enBusinessScope.split(',')
+          return false
         }
         this.AddBtnShow = false
       },
@@ -588,6 +600,46 @@
           return
         }
         if (this.activeType === 'store') {
+          if (!this.storeInfo) {
+            this.collectResult = '店铺信息不能为空'
+            this.timeoutCount++
+            return false
+          }
+          if (!this.storeInfo.description || this.storeInfo.description === '') {
+            this.collectResult = '店铺简介信息不能为空'
+            this.timeoutCount++
+            return false
+          }
+          if (!this.storeInfo.enterprise) {
+            this.collectResult = '企业信息不能为空'
+            this.timeoutCount++
+            return false
+          }
+          if (!this.storeInfo.enterprise.address || this.storeInfo.enterprise.address === '') {
+            this.collectResult = '企业地址不能为空'
+            this.timeoutCount++
+            return false
+          }
+          if (!this.storeInfo.enterprise.enTel || this.storeInfo.enterprise.enTel === '') {
+            this.collectResult = '请输入正确的电话号码'
+            this.timeoutCount++
+            return false
+          }
+          if (!/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(this.storeInfo.enterprise.enPhone) && this.storeInfo.enterprise.enPhone) {
+            this.collectResult = '请输入正确的手机号码'
+            this.timeoutCount++
+            return false
+          }
+          if (!/^[a-zA-Z]{1}[-_a-zA-Z0-9]{5,19}$/.test(this.storeInfo.enterprise.enWeixin) && this.storeInfo.enterprise.enWeixin) {
+            this.collectResult = '请输入正确的微信号'
+            this.timeoutCount++
+            return false
+          }
+          if (!/^[1-9][0-9]{4,10}$/.test(this.storeInfo.enterprise.enQQ) && this.storeInfo.enterprise.enQQ) {
+            this.collectResult = '请输入正确的QQ号'
+            this.timeoutCount++
+            return false
+          }
           let kay = {
             description: this.storeInfo.description,
             enterprise: this.storeInfo.enterprise,
@@ -598,8 +650,23 @@
             this.collectResult = '保存成功'
             this.timeoutCount++
             this.storeState = 'look'
+          }).catch(err => {
+            this.collectResult = err.response.data
+            this.timeoutCount++
+            let str = JSON.stringify(this.$store.state.option.storeStatus.data)
+            this.storeInfo = JSON.parse(str)
           })
         } else {
+          if (!this.enterpriseInfo.enAddress) {
+            this.collectResult = '企业地址不能为空'
+            this.timeoutCount++
+            return false
+          }
+          if (!this.enterpriseInfo.enUrl) {
+            this.collectResult = '官网地址不能为空'
+            this.timeoutCount++
+            return false
+          }
           this.$http.post(`/basic/enterprise/${this.storeInfo.enUU}/updateInfo`, this.enterpriseInfo).then(res => {
             this.collectResult = '保存成功'
             this.timeoutCount++
@@ -797,7 +864,7 @@
         max-width: 3rem;
       }
       .updatespan {
-        background: #666;
+        background: #b5b5b5;
         color: #fff;
         font-size: 0.26rem;
         padding:0 2px;