Quellcode durchsuchen

同城店铺新建流程重构

zhujindu vor 1 Jahr
Ursprung
Commit
d83f9973a4

+ 24 - 6
src/api/index.js

@@ -817,19 +817,37 @@ export function getOrderByStoreCode(query) {
   });
 }
 
-// 部门主管审批新建店铺-退回
-export function updateStoreRejectMessage(data) {
+// 部门主管审批新建店铺-通过
+export function getStoreApprovalList(query) {
+  return request({
+    url: '/mobile/store/getStoreApprovalList',
+    method: 'get',
+    params: query,
+  });
+}
+
+// 部门主管审批新建同城店铺
+export function approvalStore(data) {
   return request({
-    url: '/mobile/store/updateStoreRejectMessage',
+    url: '/mobile/store/approvalStore',
     method: 'post',
     data: data,
   });
 }
 
-// 部门主管审批新建店铺-通过
-export function approve(query) {
+// 新建同城店铺提交审核
+export function submitApproval(query) {
+  return request({
+    url: '/mobile/store/submitApproval',
+    method: 'get',
+    params: query,
+  });
+}
+
+// 审批历史
+export function storeApprovaHistory(query) {
   return request({
-    url: '/mobile/store/approve',
+    url: '/mobile/store/storeApprovaHistory',
     method: 'get',
     params: query,
   });

+ 2 - 2
src/views/home/index.vue

@@ -1203,11 +1203,11 @@
       <div class="lineGrey"></div>
     </div>
     <!-- 同城店建店审批 -->
-    <div class="contentborder">
+    <div class="contentborder" v-if="storeApprovalNum != null && storeApprovalNum > 0">
       <van-cell class="homeTitle" title="同城店建店审批" to="/newStoreApprovalList">
         <template #title>
           <span class="custom-title">同城店建店审批&nbsp;&nbsp;</span>
-          <van-tag v-if="approvalPendingNum > 0" type="danger">{{ approvalPendingNum }}</van-tag>
+          <van-tag type="danger">{{ storeApprovalNum }}</van-tag>
         </template>
         <template #right-icon>
           <van-icon class="homeCellIcon" name="arrow" size="16" />

+ 14 - 22
src/views/signApproval/newStoreApprovalDetail.vue

@@ -171,7 +171,7 @@
       <!-- 未结案 未提交状态下可关闭门店、提交审核 -->
       <div class="bottomBtn">
         <van-button color="red" round @click="rejectReasonShow = true">退回</van-button>
-        <van-button type="primary" round @click="approveFun">通过</van-button>
+        <van-button type="primary" round @click="approvalStoreFun('success')">通过</van-button>
       </div>
     </div>
     <!-- 退回原因填写 -->
@@ -228,8 +228,7 @@ import {
   getManagementModelList,
   getpotentialCustomerTypeList,
   getOrderByStoreCode,
-  updateStoreRejectMessage,
-  approve,
+  approvalStore,
 } from '@/api/index';
 import mapmarker from '@/components/mapMarker';
 import viewUploadImg from '@/components/viewUploadImg';
@@ -582,31 +581,24 @@ export default {
     // 退回提交
     rejectReasonSubmit() {
       if (this.rejectMessage != '') {
-        this.toastLoading(0, '正在提交...', true);
-        updateStoreRejectMessage({
-          storeId: this.$route.query.id,
-          rejectReason: this.rejectMessage,
-        }).then((res) => {
-          this.toastLoading().clear();
-          if (res.code == 200) {
-            this.$toast.success('提交成功');
-            this.rejectReasonShow = false;
-            this.onClickLeft();
-          } else {
-            this.$toast.fail(res.msg);
-          }
-        });
+        this.approvalStoreFun('reject');
       } else {
         this.$notify({ type: 'warning', message: '请输入退回原因' });
       }
     },
-    // 审核通过
-    approveFun() {
-      approve({
-        storeId: this.$route.query.id,
+    approvalStoreFun(type) {
+      this.toastLoading(0, '正在提交...', true);
+      let approvalStatus = type == 'reject' ? 3 : '2';
+      let approvalDesc = type == 'reject' ? this.rejectMessage : '';
+      approvalStore({
+        approvalId: this.$route.query.id, // 店铺id
+        approvalStatus: approvalStatus, // 审批类型
+        approvalDesc: this.rejectMessage, // 退回原因
       }).then((res) => {
+        this.toastLoading().clear();
         if (res.code == 200) {
-          this.$toast.success('审核通过');
+          this.$toast.success('提交成功');
+          this.rejectReasonShow = false;
           this.onClickLeft();
         } else {
           this.$toast.fail(res.msg);

+ 5 - 30
src/views/signApproval/newStoreApprovalList.vue

@@ -34,44 +34,19 @@
 </template>
 
 <script>
-import { getApprovalList } from '@/api/index';
+import { getStoreApprovalList } from '@/api/index';
 export default {
   data() {
     return {
-      approvalList: [
-        {
-          storeName: '测试门店1',
-          storeCode: '2345324534',
-          storeCategory: '同城分销A',
-          tijiaoName: '测试',
-          tijiaoTime: '2020-08-08',
-          storeId: '876203',
-        },
-        {
-          storeName: '测试门店2',
-          storeCode: '2345324534',
-          storeCategory: '同城分销A',
-          tijiaoName: '测试',
-          tijiaoTime: '2020-08-08',
-          storeId: '32453',
-        },
-        {
-          storeName: '测试门店3',
-          storeCode: '2345324534',
-          storeCategory: '同城分销A',
-          tijiaoName: '测试',
-          tijiaoTime: '2020-08-08',
-          storeId: '32453',
-        },
-      ],
+      approvalList: [],
     };
   },
   activated() {
-    this.getApprovalListFun();
+    this.getApprovalList();
   },
   methods: {
-    getApprovalListFun() {
-      getApprovalList().then((res) => {
+    getApprovalList() {
+      getStoreApprovalList().then((res) => {
         if (res.code == 200) {
           this.approvalList = res.data.list;
         }

+ 12 - 5
src/views/storeManagement/index.vue

@@ -63,7 +63,8 @@
                 <span>{{ item.storeName }}</span>
                 (<span style="color: #0057ba">{{ item.storeCode }}</span
                 >)
-                <!-- <span
+                <!-- validFlag: 0正常门店,1无效门店,2临时门店 -->
+                <span
                   v-if="item.validFlag == 2"
                   style="
                     display: inline-block;
@@ -74,10 +75,16 @@
                     font-weight: normal;
                   "
                   >临</span
-                > -->
-                <template v-if="item.submit && item.submit != ''">
-                  <span class="statusIcon submit" v-if="item.submit">已提交</span>
-                  <span class="statusIcon noSubmit" v-else>未提交</span>
+                >
+                <!-- "approvalStatus": "1",  结案状态(0=未 结案, -->
+                <!-- "processApprovalStatus": "1"  审批状态(0=未提交,1=已提交待审核,2=审批通过,3=审批拒绝) -->
+                <template v-if="item.approvalStatus == 0 && item.validFlag == 0">
+                  <span class="statusIcon submit" v-if="item.processApprovalStatus == 1"
+                    >已提交</span
+                  >
+                  <span class="statusIcon noSubmit" v-if="item.processApprovalStatus == 0"
+                    >未提交</span
+                  >
                 </template>
                 <van-icon
                   :name="paste"

+ 98 - 215
src/views/storeManagement/storeDetail.vue

@@ -4,30 +4,24 @@
       <!-- 顶部条 -->
       <van-nav-bar class="navBar" title="客户详情" left-arrow @click-left="onClickLeft">
         <template #right>
-          <!-- 未结案状态下 已提交/未提交 -->
-          <template v-if="list.storeType == '未结案'">
-            <!-- 已提交状态禁止操作 -->
-            <template v-if="list.submit"></template>
-            <!-- 未提交 -->
-            <template v-if="!list.submit">
-              <span
-                style="color: #0057ba"
-                v-if="list.updatable && list.validFlag != 2 && type != 'address'"
-                @click="editorFn"
-                >编辑
-              </span>
+          <!-- 未结案状态下 -->
+          <template v-if="list.approvalStatus == 0">
+            <!-- validFlag 正常门店 -->
+            <template v-if="list.validFlag == 0">
+              <!-- 未提交 -->
+              <template v-if="list.processApprovalStatus == 0">
+                <span style="color: #0057ba" v-if="type != 'address'" @click="editorFn">编辑 </span>
+              </template>
+              <span style="color: #0057ba; margin-left: 10px" @click="placeOrderFn">去下单 </span>
             </template>
           </template>
-          <template v-else>
-            <span
-              style="color: #0057ba"
-              v-if="list.updatable && list.validFlag == 2"
-              @click="placeOrderFn"
+          <template v-else-if="list.updatable">
+            <span style="color: #0057ba" v-if="list.validFlag == 2" @click="placeOrderFn"
               >去下单
             </span>
             <span
               style="color: #0057ba"
-              v-if="list.updatable && list.validFlag != 2 && type != 'address'"
+              v-if="list.validFlag != 2 && type != 'address'"
               @click="editorFn"
               >编辑
             </span>
@@ -280,11 +274,7 @@
       <br />
       <br />
       <br />
-      <!-- 未结案 未提交状态下可关闭门店、提交审核 -->
-      <div class="bottomBtn">
-        <van-button color="red" round @click="valid">撤销建店</van-button>
-        <van-button type="primary" round @click="updateStoreAddress">提交审核</van-button>
-      </div>
+      <!-- type:address 拜访时位置偏差过大,可以修改地址(只能修改地址) -->
       <div
         style="
           position: fixed;
@@ -293,58 +283,66 @@
           padding: 14px;
           background-color: white;
           border-top: 1px solid #eee;
-        "
-        v-if="type">
-        <van-row gutter="20">
-          <van-col
-            span="12"
-            v-if="
-              list.storeCategory != '35' &&
-              list.storeCategory != '36' &&
-              list.storeCategory != '37' &&
-              list.storeCategory != '38' &&
-              list.storeCategory != '91'
-            "
-            ><van-button round type="default" style="width: 100%" @click="valid"
-              >无效关店</van-button
-            ></van-col
-          >
-          <van-col
-            span="12"
-            v-if="
-              list.storeCategory != '35' &&
-              list.storeCategory != '36' &&
-              list.storeCategory != '37' &&
-              list.storeCategory != '38' &&
-              list.storeCategory != '91'
-            "
+        ">
+        <van-row gutter="20" v-if="type">
+          <van-col span="12"
             ><van-button
               round
               type="info"
               style="width: 100%; background-color: #0057ba"
               @click="updateStoreAddress"
               >提交</van-button
-            ></van-col
-          >
-          <van-col
-            span="24"
+            >
+          </van-col>
+          <!-- storeCategory:35、36、37、38、91:金牌店铺只显示提交按钮,不支持无效关店  -->
+          <template
             v-if="
-              list.storeCategory == '35' ||
-              list.storeCategory == '36' ||
-              list.storeCategory == '37' ||
-              list.storeCategory == '38' ||
-              list.storeCategory == '91'
-            "
+              list.storeCategory != '35' &&
+              list.storeCategory != '36' &&
+              list.storeCategory != '37' &&
+              list.storeCategory != '38' &&
+              list.storeCategory != '91'
+            ">
+            <!-- 未结案并且未提交的同城店铺,拜访时显示 撤销建店 -->
+            <!-- 未结案并且已提交的同城店铺,拜访时不显示 撤销建店和无效关店 -->
+            <template v-if="list.processApprovalStatus == 0">
+              <van-col span="12" v-if="list.processApprovalStatus == 0">
+                <van-button round type="default" style="width: 100%" @click="valid"
+                  >撤销建店</van-button
+                >
+              </van-col>
+            </template>
+            <van-col span="12" v-else>
+              <van-button round type="default" style="width: 100%" @click="valid"
+                >无效关店</van-button
+              >
+            </van-col>
+          </template>
+        </van-row>
+        <!-- 正常查看详情状态 未结案并且未提交状态下可关闭门店、提交审核 -->
+        <van-row
+          gutter="20"
+          v-else-if="this.list.approvalStatus == 0 && list.processApprovalStatus == 0">
+          <van-col span="12">
+            <van-button round type="default" style="width: 100%" @click="valid"
+              >撤销建店</van-button
+            >
+          </van-col>
+          <van-col span="12"
             ><van-button
               round
               type="info"
               style="width: 100%; background-color: #0057ba"
-              @click="updateStoreAddress"
-              >提交</van-button
-            ></van-col
-          >
+              @click="submitApprovalFun"
+              >提交审核</van-button
+            >
+          </van-col>
         </van-row>
       </div>
+      <!-- <div class="bottomBtn" v-else>
+        <van-button color="red" round @click="valid"></van-button>
+        <van-button type="primary" round @click="submitApprovalFun">提交审核</van-button>
+      </div> -->
       <van-dialog
         v-model="showDialog"
         title="系统提示"
@@ -465,6 +463,8 @@ import {
   getpotentialCustomerTypeList,
   streetQuery,
   getOrderByStoreCode,
+  submitApproval,
+  storeApprovaHistory,
 } from '@/api/index';
 import mapmarker from '@/components/mapMarker';
 import viewUploadImg from '@/components/viewUploadImg';
@@ -546,50 +546,16 @@ export default {
       helpPageFlag: false, //提交修改 不通过 点击帮助弹出框
       rejectMsgShow: false,
       //退回原因
-      rejectMsg: [
-        {
-          approver: '测试111',
-          approvalTime: '2020-08-06 15:08:08',
-          rejectCause: '测试222',
-        },
-        {
-          approver: '测试111',
-          approvalTime: '2020-08-06 15:08:08',
-          rejectCause: '测试222',
-        },
-        {
-          approver: '测试111',
-          approvalTime: '2020-08-06 15:08:08',
-          rejectCause: '测试222',
-        },
-        {
-          approver: '测试111',
-          approvalTime: '2020-08-06 15:08:08',
-          rejectCause: '测试222',
-        },
-      ],
+      rejectMsg: [],
       activeNames: [],
       orderList: [],
     };
   },
-  created() {
-    // this.detilId = this.$route.query.detilId;
-    // this.type = this.$route.query.type;
-    // this.getTCFXList();
-    // this.getSJSList();
-    // this.getQGJZist();
-    // this.getCustomerInfoList();
-    // this.getManagementModelList();
-    // this.getMainRelationList();
-    // this.getMainProjectList();
-    // this.getCustomerNatureList();
-    // this.getpotentialCustomerTypeList();
-  },
   activated() {
     this.showmap = false;
     this.img = '';
     this.detilId = this.$route.query.detilId;
-    this.type = this.$route.query.type;
+    this.type = this.$route.query.type; // type:address 拜访时位置偏差过大,可以修改地址(只能修改地址)
     this.getCustomerInfoList();
     this.getManagementModelList();
     this.getMainRelationList();
@@ -646,27 +612,6 @@ export default {
         });
         // 清楚选中状态
         that.addresssb = -1;
-        // jsonp(
-        //   "https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(" +
-        //     val.location.lat +
-        //     "," +
-        //     val.location.lng +
-        //     ",500,0)&page_size=10&page_index=1&orderby=_distance&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6"
-        // ).then((res) => {
-        //   console.log(res);
-        //   that.maplist = res.data;
-        //   that.marker.setGeometries([]);
-        //   setTimeout(() => {
-        //     for (let p = 0; p < res.data.length; p++) {
-        //       that.marker.updateGeometries([
-        //         {
-        //           id: res.data[p].id,
-        //           position: new TMap.LatLng(res.data[p].location.lat, res.data[p].location.lng),
-        //         },
-        //       ]);
-        //     }
-        //   });
-        // });
       });
     },
     searchFn() {
@@ -745,99 +690,6 @@ export default {
         .catch((err) => {
           console.log(err);
         });
-      // let loading1 = this.$toast.loading({
-      //   duration: 0,
-      //   message: "定位中...",
-      //   forbidClick: true,
-      // });
-      // let url = window.location.href;
-      // // let url = encodeURIComponent("https://ssbsfatest.nipponpaint.com.cn/mobile" + window.location.href.split("/mobile")[1]).replaceAll("%3A", ":")
-      // let that = this;
-      // let qiyeData;
-      // const instance = axios.create();
-      // instance.defaults.headers.common["userId"] = localStorage.getItem("loginName");
-      // instance
-      //   .get(process.env.VUE_APP_BASE_API + "mobile/wx/ticket", {
-      //     params: {
-      //       url: url,
-      //     },
-      //   })
-      //   .then((response) => {
-      //     if (response.status == 200) {
-      //       this.cont = 6;
-      //       var flat = true;
-      //       var times = setInterval(() => {
-      //         this.cont--;
-      //         if (this.cont == "0") {
-      //           if (flat) {
-      //             loading1.clear();
-      //             clearInterval(times);
-      //             that.$dialog.alert({
-      //               message: "定位失败,请开启企微定位权限",
-      //             });
-      //           } else {
-      //             clearInterval(times);
-      //           }
-      //         }
-      //       }, 1000);
-      //       qiyeData = response.data.data;
-      //       that.wx.config({
-      //         beta: true,
-      //         debug: false,
-      //         appId: qiyeData.appId,
-      //         timestamp: qiyeData.timestamp,
-      //         nonceStr: qiyeData.nonceStr,
-      //         signature: qiyeData.signature,
-      //         jsApiList: ["ready", "getLocation"],
-      //       });
-      //       that.wx.ready(function () {
-      //         that.wx.getLocation({
-      //           type: "gcj02",
-      //           success: function (res) {
-      //             flat = false;
-      //             loading1.clear();
-      //             var location = that.CJ02BD(res.latitude, res.longitude);
-      //             that.lat = location.lat;
-      //             that.lon = location.lon;
-      //             if (that.list.lon == "") {
-      //               that.list.lon = location.lon;
-      //               that.list.lat = res.latitude;
-      //             }
-      //             that.pLat = res.latitude;
-      //             that.pLot = res.longitude;
-      //             that.myLat = location.lat;
-      //             that.myLon = location.lon;
-      //             that.showmap = true;
-      //             jsonp(
-      //               "https://apis.map.qq.com/ws/place/v1/search?boundary=nearby(" +
-      //                 res.latitude +
-      //                 "," +
-      //                 res.longitude +
-      //                 ",500,0)&page_size=10&page_index=1&orderby=_distance&output=jsonp&key=WLCBZ-HRM6L-YOMPV-ME62B-AQOG6-JUBW6"
-      //             ).then((res) => {
-      //               console.log(res);
-      //               that.maplist = res.data;
-      //               setTimeout(() => {
-      //                 that.addVisits1("1");
-      //               });
-      //             });
-      //           },
-      //           fail: function () {
-      //             loading1.clear();
-      //             that.$dialog.alert({
-      //               title: "系统提示",
-      //               message: "GPS未开启",
-      //             });
-      //           },
-      //         });
-      //       });
-      //       that.wx.error(function (res) {
-      //         this.$toast.fail("定位失败");
-      //       });
-      //     } else {
-      //       this.$toast.fail("接口异常");
-      //     }
-      //   });
     },
     addVisits1(val) {
       var that = this;
@@ -1442,8 +1294,13 @@ export default {
             .catch((err) => {
               console.log(err);
             });
-          // 获取门店订单
-          this.getStoreOrderList(this.list.storeCode);
+          // 同城店铺 未结案时获取
+          if (this.list.approvalStatus == 0) {
+            // 获取门店订单
+            this.getStoreOrderList(this.list.storeCode);
+            // 获取审批历史
+            this.storeApprovaHistoryFun();
+          }
         } else {
           this.$toast.fail(res.msg);
         }
@@ -1452,7 +1309,7 @@ export default {
     // 获取门店订单
     getStoreOrderList(storeCode) {
       getOrderByStoreCode({ storeCode: storeCode }).then((res) => {
-        if (res.code == 200) {
+        if (res.code == 200 && res.data) {
           let orderList = res.data.ORDERS || [];
           if (orderList.length) {
             let orderMap = new Map();
@@ -1480,6 +1337,11 @@ export default {
         }
       });
     },
+    storeApprovaHistoryFun() {
+      storeApprovaHistory({ storeId: this.list.storeId }).then((res) => {
+        this.rejectMsg = res.data || [];
+      });
+    },
     positionFn() {
       let loading1 = this.$toast.loading({
         duration: 0,
@@ -1666,6 +1528,27 @@ export default {
     examineDetail() {
       this.rejectMsgShow = true;
     },
+    // 新建同城店铺提交审核
+    submitApprovalFun() {
+      if (!this.orderList.length) {
+        this.$notify({ type: 'warning', message: '门店没有订单,无法提交审批' });
+        return;
+      }
+      if (this.list.imgSed == '') {
+        this.$notify({ type: 'warning', message: '请上传门店陈列照' });
+        return;
+      }
+      this.toastLoading(0, '正在提交...', true);
+      submitApproval({
+        storeId: this.list.storeId, // 店铺id
+      }).then((res) => {
+        this.toastLoading().clear();
+        if (res.code == 200) {
+          this.$toast.success('提交成功');
+          this.rejectReasonShow = false;
+        }
+      });
+    },
   },
 };
 </script>