duanshenglang 8 tháng trước cách đây
mục cha
commit
58736e395a
2 tập tin đã thay đổi với 125 bổ sung6 xóa
  1. 62 4
      lottery/registrationActivity.html
  2. 63 2
      lottery/signUp.html

+ 62 - 4
lottery/registrationActivity.html

@@ -293,13 +293,22 @@
         <div class="form_title">报名表单</div>
         <el-form ref="form" label-position="left" label-width="100px">
           <el-form-item v-for="(item, index) in toshopData.formProList" :key="index" :label="item.name + ':'" :required="Boolean(item.isNeed)">
+            <el-cascader v-if="item.type === 10" v-model="item.value" :options="transformedData" @change="handleInfoCity">
+            </el-cascader>
+            <el-select v-if="item.type === 11" v-model="item.value" placeholder="请选择" @change="handlechange">
+              <el-option v-for="(sto, sindex) in storeList" :key="sindex" :label="sto.name" :value="sto.name">
+              </el-option>
+            </el-select>
             <el-input v-if="item.type === 0" v-model="item.value" placeholder="请输入"></el-input>
             <el-input v-if="item.type === 1" type="textarea" autosize v-model="item.value" placeholder="请输入"></el-input>
             <el-input v-if="item.type === 2" type="number" v-model="item.value" placeholder="请输入"></el-input>
+            <el-select v-if="item.type === 3" v-model="item.value" placeholder="请选择">
+              <el-option v-for="sto in item.formProTagReqs" :key="sto.proValue" :label="sto.proValue" :value="sto.proValue">
+              </el-option>
+            </el-select>
             <el-date-picker v-if="item.type === 5" v-model="item.value" type="date" placeholder="选择日期">
             <el-time-picker v-if="item.type === 6" v-model="item.value" placeholder="请选择"></el-time-picker>
             <el-date-picker v-if="item.type === 7" v-model="item.value" type="datetime" placeholder="选择日期时间"></el-date-picker>
-            <el-cascader v-if="item.type === 10" v-model="item.value" :options="transformedData"></el-cascader>
           </el-form-item>
         </el-form>
       </div>
@@ -329,6 +338,9 @@
         step: 2,
         verificationCode: '',
 				transformedData: [],
+        storeList: [],
+        province: '',
+        city: '',
       }
     },
     created() {
@@ -436,6 +448,50 @@
           return newItem;
         })
       },
+      handleInfoCity(value) {
+        this.province = value[0]
+        this.city = value[1]
+        // 清空经销商类型的数据
+        this.toshopData.formProList.forEach(item => {
+          if (item.type === 11) {
+            item.value = ''
+          }
+        })
+        this.storeList = []
+        this.getStoreList()
+      },
+      handlechange(value) {
+        this.toshopData.formProList.forEach(item => {
+          if (item.type === 11) {
+            item.value = value
+          }
+        })
+        this.$forceUpdate()
+      },
+      getStoreList() {
+        fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-store/p/findListByPage?city=${this.city}&province=${this.province}`, {
+          method: 'post',
+          body: JSON.stringify({
+            page: 1,
+            pageCount: 10000,
+          }),
+          headers: {
+            'Content-Type': 'application/json'
+          }
+        }).then(res => {
+          return res.json()
+        }).then(result => {
+          let { data, code, msg } = result
+          if (code === 1) {
+            this.storeList = data.records
+          } else {
+            this.$message({
+              message: msg,
+              type: 'warning'
+            })
+          }
+        })
+      },
       lightenShare() {
         let externalUserid = this.getQueryParam('externalUserid')
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -476,21 +532,23 @@
         if (this.step === 1) {
           this.step = 2 
         } else {
-          this.toshopData.formProList.forEach(item => {
+          const isValid = this.toshopData.formProList.some(item => {
             if (item.isNeed && !item.value) {
               this.$message({
                 message: '必填项不能为空',
                 type: 'warning' 
               })
-              return false
+              return true
             }
+            return false
           })
+          if (isValid) return
           let cols = []
           cols = this.toshopData.formProList.map(item => {
             return {
               name: item.name,
               type: item.type,
-              value: [item.value]
+              value: item.type === 10 ? [item.value.join('')] : [item.value],
             } 
           })
           let openId = this.getQueryParam('openId') || localStorage.getItem('openId')

+ 63 - 2
lottery/signUp.html

@@ -161,13 +161,22 @@
           </el-form-item>
           <el-form-item v-for="(item, index) in toshopData.formProList" :key="index" :label="item.name + ':'"
             :required="Boolean(item.isNeed)">
+            <el-cascader v-if="item.type === 10" v-model="item.value" :options="transformedData" @change="handleInfoCity">
+            </el-cascader>
+            <el-select v-if="item.type === 11" v-model="item.value" placeholder="请选择" @change="handlechange">
+              <el-option v-for="(sto, sindex) in storeList" :key="sindex" :label="sto.name" :value="sto.name">
+              </el-option>
+            </el-select>
             <el-input v-if="item.type === 0" v-model="item.value" placeholder="请输入"></el-input>
             <el-input v-if="item.type === 1" type="textarea" autosize v-model="item.value" placeholder="请输入"></el-input>
             <el-input v-if="item.type === 2" type="number" v-model="item.value" placeholder="请输入"></el-input>
+            <el-select v-if="item.type === 3" v-model="item.value" placeholder="请选择">
+              <el-option v-for="sto in item.formProTagReqs" :key="sto.proValue" :label="sto.proValue" :value="sto.proValue">
+              </el-option>
+            </el-select>
             <el-date-picker v-if="item.type === 5" v-model="item.value" type="date" placeholder="选择日期">
             <el-time-picker v-if="item.type === 6" v-model="item.value" placeholder="请选择"></el-time-picker>
             <el-date-picker v-if="item.type === 7" v-model="item.value" type="datetime" placeholder="选择日期时间"></el-date-picker>
-            <el-cascader v-if="item.type === 10" v-model="item.value" :options="transformedData"></el-cascader>
           </el-form-item>
         </el-form>
       </div>
@@ -209,6 +218,9 @@
         step: 1,
         verificationCode: '',
 				transformedData: [],
+        storeList: [],
+        province: '',
+        city: '',
       }
     },
     created() {
@@ -316,6 +328,50 @@
           return newItem;
         })
       },
+      handleInfoCity(value) {
+        this.province = value[0]
+        this.city = value[1]
+        // 清空经销商类型的数据
+        this.toshopData.formProList.forEach(item => {
+          if (item.type === 11) {
+            item.value = ''
+          }
+        })
+        this.storeList = []
+        this.getStoreList()
+      },
+      handlechange(value) {
+        this.toshopData.formProList.forEach(item => {
+          if (item.type === 11) {
+            item.value = value
+          }
+        })
+        this.$forceUpdate()
+      },
+      getStoreList() {
+        fetch(this.httpUrl + `/scrm/v1/wxcp-toshop-store/p/findListByPage?city=${this.city}&province=${this.province}`, {
+          method: 'post',
+          body: JSON.stringify({
+            page: 1,
+            pageCount: 10000,
+          }),
+          headers: {
+            'Content-Type': 'application/json'
+          }
+        }).then(res => {
+          return res.json()
+        }).then(result => {
+          let { data, code, msg } = result
+          if (code === 1) {
+            this.storeList = data.records
+          } else {
+            this.$message({
+              message: msg,
+              type: 'warning'
+            })
+          }
+        })
+      },
       lightenShare() {
         let externalUserid = this.getQueryParam('externalUserid')
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -353,7 +409,7 @@
           return {
             name: item.name,
             type: item.type,
-            value: [item.value]
+            value: item.type === 10 ? [item.value.join('')] : [item.value],
           }
         })
         let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
@@ -384,6 +440,11 @@
               message: '核销码无效',
               type: 'warning' 
             })
+          } else if (code === 3) {
+            this.$message({
+              message: msg,
+              type: 'warning'
+            })
           } else {
             this.$message({
               message: msg,