浏览代码

feature_20250722_金牌店档案收集

zhujindu 4 月之前
父节点
当前提交
2b99521609
共有 2 个文件被更改,包括 93 次插入15 次删除
  1. 9 0
      src/api/storeManagement.js
  2. 84 15
      src/views/storeManagement/JPattributeEditor.vue

+ 9 - 0
src/api/storeManagement.js

@@ -8,3 +8,12 @@ export function getStoreArchives(query) {
     params: query,
   });
 }
+
+// 修改门店档案信息接口
+export function updateArchives(data) {
+  return request({
+    url: 'mobile/store/updateArchives',
+    method: 'post',
+    data,
+  });
+}

+ 84 - 15
src/views/storeManagement/JPattributeEditor.vue

@@ -13,7 +13,7 @@
             <van-button
               size="small"
               style="color: white; background: rgb(0, 87, 186); border-radius: 6px"
-              @click="sendCode(item, index)"
+              @click="sendCode(detail.ownerMobile)"
               :disabled="time != null"
               >发送验证码<span v-if="time">({{ timeNum }})</span>
             </van-button>
@@ -30,12 +30,20 @@
           v-model="detail.ownerBirthday"
           label="主经营者出生日期"
           placeholder="请输入主经营者出生日期"
-          @click="getNyr(detail.ownerName)" />
-        <van-field
-          v-model="detail.mainProductCategorys"
-          autosize
-          type="textarea"
-          label="主营/擅长经营品类" />
+          @click="getNyr('ownerBirthday')" />
+        <van-field autosize type="textarea" label="主营/擅长经营品类">
+          <template #input>
+            <van-checkbox-group v-model="detail.mainProductCategorys" direction="horizontal">
+              <van-checkbox
+                v-for="(item, index) in mainProductCategorys"
+                :name="item.dictValue"
+                shape="square"
+                :key="index">
+                {{ item.dictValue }}
+              </van-checkbox>
+            </van-checkbox-group>
+          </template>
+        </van-field>
         <van-field
           v-model="detail.totalSalesAmount"
           autosize
@@ -45,9 +53,23 @@
         <van-field v-model="detail.mainBrand" autosize type="textarea" label="主营T0P3品牌" />
 
         <van-field v-model="detail.emergencyContact" label="紧急联系人姓名" />
-        <van-field v-model="detail.emergencyContactBirthday" label="紧急联系人出生日期" />
+        <van-field
+          v-model="detail.emergencyContactBirthday"
+          label="紧急联系人出生日期"
+          @click="getNyr('emergencyContactBirthday')" />
         <van-field v-model="detail.emergencyContactMobile" label="紧急联系人电话" />
-        <van-field v-model="detail.emergencyContactRelation" label="紧急联系人身份" />
+        <van-field label="紧急联系人身份">
+          <template #input>
+            <van-radio-group v-model="detail.emergencyContactRelation" direction="horizontal">
+              <van-radio
+                v-for="(item, index) in emergencyContactRelation"
+                :name="item.dictValue"
+                :key="index">
+                {{ item.dictValue }}
+              </van-radio>
+            </van-radio-group>
+          </template>
+        </van-field>
       </van-form>
     </div>
     <div class="footer-btn">
@@ -71,8 +93,8 @@
 </template>
 
 <script>
-import { sendAndCheckVerCode } from '@/api/index';
-import { getStoreArchives } from '@/api/storeManagement';
+import { sendAndCheckVerCode, getDictOption } from '@/api/index';
+import { getStoreArchives, updateArchives } from '@/api/storeManagement';
 export default {
   name: 'JPattributeEditor',
   data() {
@@ -83,19 +105,41 @@ export default {
       verificationVal: '',
       datetimeShowPicker: false,
       activatNyrItem: '',
+      checkboxGroup: [],
+      mainProductCategorys: [],
+      emergencyContactRelation: [],
+      verificationPassedPhoneNum: '', //验证通过手机号
     };
   },
   activated() {
     if (this.time) clearInterval(this.time);
     this.time = null; //计时
     this.timeNum = 30;
-    this.getDetaild();
+    this.toastLoading(0, '加载中...', true);
+    getDictOption({}, 'archives_main_product_categorys').then((res) => {
+      let mainProductCategorys = [];
+      let emergencyContactRelation = [];
+      res.data.forEach((val) => {
+        if (val.remark == 'mainProductCategorys') {
+          mainProductCategorys.push(val);
+        } else {
+          emergencyContactRelation.push(val);
+        }
+      });
+      this.mainProductCategorys = mainProductCategorys;
+      this.emergencyContactRelation = emergencyContactRelation;
+      this.getDetaild();
+    });
   },
   methods: {
     getDetaild() {
       getStoreArchives({ storeCode: this.$route.query.storeCode }).then((res) => {
+        this.toastLoading().clear();
         if (res.code == 200) {
+          //   let copyData = JSON.parse(JSON.stringify(res.data));
+          res.data.mainProductCategorys = res.data.mainProductCategorys.split(',');
           this.detail = res.data;
+          this.verificationPassedPhoneNum = this.detail.ownerMobile;
         }
       });
     },
@@ -149,19 +193,38 @@ export default {
           verification: val, //String	手机号验证码
         },
         (res) => {
+          this.verificationPassedPhoneNum = this.detail.ownerMobile;
           this.$toast(res.data ? '验证成功' : '验证码错误');
         }
       );
     },
-    getNyr() {
+    getNyr(val) {
+      this.activatNyrItem = val;
       this.datetimeShowPicker = true;
     },
     datetimeOnConfirm(time) {
-      this.detail.ownerBirthday = this.parseTime(time, '{y}-{m}-{d}');
+      this.$set(this.detail, this.activatNyrItem, this.parseTime(time, '{y}-{m}-{d}'));
+      //   this.detail.ownerBirthday = this.parseTime(time, '{y}-{m}-{d}');
       this.datetimeShowPicker = false;
     },
     // 保存
-    confirmShare() {},
+    confirmShare() {
+      if (this.detail.ownerMobile != this.verificationPassedPhoneNum) {
+        this.$toast('请验证手机号');
+        return;
+      }
+      this.toastLoading(0, '加载中...', true);
+      let params = JSON.parse(JSON.stringify(this.detail));
+      params.mainProductCategorys = params.mainProductCategorys.join(',');
+      updateArchives(params).then((res) => {
+        this.toastLoading().clear();
+        if (res.code == 200) {
+          this.$toast(res.msg);
+        } else {
+          this.$toast(res.msg);
+        }
+      });
+    },
     onClickLeft() {
       this.$router.go(-1);
     },
@@ -198,6 +261,12 @@ export default {
         height: 35px;
       }
     }
+    .van-checkbox--horizontal {
+      margin-bottom: 10px;
+    }
+    .van-radio--horizontal {
+      margin-bottom: 10px;
+    }
   }
   .footer-btn {
     display: flex;