Browse Source

优化店铺详情页和店铺编辑也定位功能和图片批量上传

zhujindu 1 năm trước cách đây
mục cha
commit
d13edba5ca
3 tập tin đã thay đổi với 279 bổ sung282 xóa
  1. 220 211
      src/api/index.js
  2. 15 61
      src/components/uploadImgVStore.vue
  3. 44 10
      src/views/storeManagement/storeDetail.vue

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 220 - 211
src/api/index.js


+ 15 - 61
src/components/uploadImgVStore.vue

@@ -1,15 +1,14 @@
 <template>
   <div>
     <div class="cameraDiv1">
-      <div class="imgPre">
+      <div class="imgPre" v-if="imgArr.length">
         <van-icon
           class="photobrowsing"
           name="expand-o"
           size="22px"
           color="#969696"
-          v-if="imgArr != ''"
-          @click="deleteImgs(imgArr)" />
-        <img :src="imgArr" alt="" v-if="imgArr != ''" />
+          @click="deleteImgs" />
+        <img :src="imgUrlArr[0]" alt="" />
       </div>
       <p class="coverImg" @click="uploadImg">
         <van-icon class="photo ico" name="photograph" size="16px" color="#969696">{{
@@ -68,11 +67,20 @@ export default {
       localIds: [],
       num: 0,
       serverIdArr: [],
+      imgUrlArr: [],
     };
   },
+  watch: {
+    imgArr: {
+      handler(val) {
+        this.imgUrlArr = val.split(',');
+      },
+      immediate: true,
+    },
+  },
   methods: {
-    deleteImgs(val) {
-      ImagePreview([val]);
+    deleteImgs() {
+      ImagePreview(this.imgUrlArr);
     },
     uploadImg() {
       if (localStorage.getItem('chainName') == null) {
@@ -102,60 +110,6 @@ export default {
           },
         });
       });
-      // let url = window.location.href;
-      // let that = this;
-      // let wx = this.wx;
-      // 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) {
-      //       qiyeData = response.data.data;
-      //       wx.config({
-      //         beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
-      //         debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-      //         appId: qiyeData.appId, // 必填,企业微信的corpID
-      //         timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
-      //         nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
-      //         signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
-      //         jsApiList: ['ready', 'chooseImage', 'uploadImage'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
-      //       });
-      //       wx.ready(function () {
-      //         wx.chooseImage({
-      //           count: that.count,
-      //           sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
-      //           sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
-      //           defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
-      //           isSaveToAlbum: 0,
-      //           success: function (chooseRes) {
-      //             let localIds = that.count == 1 ? chooseRes.localIds[0] : chooseRes.localIds;
-      //             console.log('count=' + that.count);
-      //             console.log('chooseRes=' + JSON.stringify(chooseRes));
-      //             console.log('localIds=' + localIds);
-      //             // if (res.localIds != undefined) {
-      //             //   localIds = res.localIds[0];
-      //             // } else {
-      //             //   localIds = res.localId;
-      //             // }
-      //             wx.uploadImage({
-      //               localId: localIds,
-      //               isShowProgressTips: 1,
-      //               success: function (uploadRes) {
-      //                 console.log('serverId=' + uploadRes.serverId);
-      //                 that.uploadImagev(uploadRes.serverId);
-      //               },
-      //             });
-      //           },
-      //         });
-      //       });
-      //     }
-      //   });
     },
     forUploadImage() {
       this.wx.uploadImage({
@@ -189,7 +143,7 @@ export default {
       uploadImagev(form).then((res) => {
         if (res.code == 200) {
           console.log(JSON.stringify(res.data));
-          that.imgArr = res.data.url;
+          // that.imgArr = res.data.url;
           loind1.clear();
           that.$toast('上传成功!');
           that.$emit('newimgarr', { fileUrl: res.data.url, type: that.type });

+ 44 - 10
src/views/storeManagement/storeDetail.vue

@@ -157,7 +157,7 @@
                   <van-image
                     width="100%"
                     height="160"
-                    :src="list.img"
+                    :src="setImgSrc(list.img)"
                     @click="deleteImgs(list.img)" />
                   <p style="text-align: center">
                     {{ list.ifJzStoreType != 1 ? '建店时门店照' : '家装前台照片' }}
@@ -167,7 +167,7 @@
                   <van-image
                     width="100%"
                     height="160"
-                    :src="list.img"
+                    :src="setImgSrc(list.img)"
                     @click="deleteImgs(list.img)" />
                   <p style="text-align: center">
                     {{ list.storeCategory == 'C912' ? '工地铭牌照片' : '公司照片' }}
@@ -179,7 +179,7 @@
                   <van-image
                     width="100%"
                     height="160"
-                    :src="list.imgSed"
+                    :src="setImgSrc(list.imgSed)"
                     @click="deleteImgs(list.imgSed)" />
                   <p style="text-align: center">
                     {{ list.ifJzStoreType != 1 ? '陈列照' : '立邦展厅照片' }}
@@ -194,7 +194,7 @@
                 <van-image
                   width="100%"
                   height="160"
-                  :src="list.newStoreSignPhoto"
+                  :src="setImgSrc(list.newStoreSignPhoto)"
                   @click="deleteImgs(list.newStoreSignPhoto)" />
                 <p style="text-align: center">最近一次拜访店招</p>
               </div>
@@ -222,16 +222,16 @@
             <van-collapse-item title="门店下单记录" name="1">
               <div class="orderItem" v-for="(item, index) in orderList" :key="index">
                 <div class="orderTitle">
-                  {{ item.orderNum }} | {{ item.createTime }} | {{ item.state }}
+                  {{ item.ORDERID }} | {{ item.ORDERDATE }} | {{ item.STATUS_DESCR }}
                 </div>
                 <el-table
                   :data="item.productDetail"
                   border
                   class="table-headermd table-headermdhome"
                   style="width: 100%">
-                  <el-table-column label="产品名称" prop="productName" />
-                  <el-table-column label="数量" prop="productNum" width="80px" />
-                  <el-table-column label="单价" prop="price" width="80px" />
+                  <el-table-column label="产品名称" prop="DESCR" />
+                  <el-table-column label="数量" prop="QTY" width="80px" />
+                  <!-- <el-table-column label="单价" prop="price" width="80px" /> -->
                 </el-table>
               </div>
             </van-collapse-item>
@@ -464,6 +464,7 @@ import {
   getManagementModelList,
   getpotentialCustomerTypeList,
   streetQuery,
+  getOrderByStoreCode,
 } from '@/api/index';
 import mapmarker from '@/components/mapMarker';
 import viewUploadImg from '@/components/viewUploadImg';
@@ -1341,6 +1342,10 @@ export default {
           });
         });
     },
+    setImgSrc(imgUrl) {
+      let imgArr = imgUrl.split(',');
+      return imgArr[0];
+    },
     deleteImgs(val) {
       ImagePreview([val]);
     },
@@ -1470,7 +1475,7 @@ export default {
             this.storeName = '名称';
             this.address = '地址';
           }
-
+          // 获取定位
           getPosition()
             .then((res) => {
               let { TXisBD, resData } = res;
@@ -1484,11 +1489,40 @@ export default {
             .catch((err) => {
               console.log(err);
             });
+          // 获取门店订单
+          this.getStoreOrderList(this.list.storeCode);
         } else {
           this.$toast.fail(res.msg);
         }
       });
     },
+    // 获取门店订单
+    getStoreOrderList(storeCode) {
+      getOrderByStoreCode({ storeCode: storeCode }).then((res) => {
+        if (res.code == 200) {
+          let orderList = res.data.ORDERS;
+          let orderMap = new Map();
+          for (let i = 0; i < orderList.length; i++) {
+            if (orderMap.has(orderList[i].ORDERID)) {
+              orderMap.get(orderList[i].ORDERID).productDetail.push(orderList[i]);
+            } else {
+              let orderObj = {
+                ORDERID: orderList[i].ORDERID,
+                ORDERDATE: orderList[i].ORDERDATE,
+                STATUS_DESCR: orderList[i].STATUS_DESCR,
+                productDetail: [orderList[i]],
+              };
+              orderMap.set(orderList[i].ORDERID, orderObj);
+            }
+          }
+          let orderListArr = [];
+          for (let value of orderMap.values()) {
+            orderListArr.push(value);
+          }
+          this.orderList = orderListArr;
+        }
+      });
+    },
     positionFn() {
       let loading1 = this.$toast.loading({
         duration: 0,
@@ -1743,7 +1777,7 @@ export default {
     flex: 1;
   }
   .examineDetail {
-    width: 90px;
+    width: 70px;
     color: #0057ba;
   }
 }