浏览代码

同城店铺新建流程重构

zhujindu 1 年之前
父节点
当前提交
1a9507d865

+ 27 - 18
src/components/ImgView.vue

@@ -2,63 +2,72 @@
   <div>
     <div class="cameraDiv1" @click="uploadImgView">
       <div class="imgPre">
-        <van-icon class="photobrowsing" name="expand-o" size="22px" color="#969696" v-if="imgArr!=''" />
-        <img :src="imgArr" alt="" v-if="imgArr!=''">
+        <van-icon
+          class="photobrowsing"
+          name="expand-o"
+          size="22px"
+          color="#1989fa"
+          v-if="imgArr != ''" />
+        <img :src="imgArr" alt="" v-if="imgArr != ''" />
       </div>
-      <p class="coverImg"><van-icon class="photo ico" name="photograph" size="16px" color="#969696">{{ imgText }}</van-icon></p>
+      <p class="coverImg">
+        <van-icon class="photo ico" name="photograph" size="16px" color="#969696">{{
+          imgText
+        }}</van-icon>
+      </p>
     </div>
-    <p style="text-align: center;">{{ imgText }}</p>
+    <p style="text-align: center">{{ imgText }}</p>
   </div>
 </template>
 
 <script>
-import {ImagePreview} from "vant";
-import {uploadImage} from "@/api/index";
+import { ImagePreview } from 'vant';
+import { uploadImage } from '@/api/index';
 
 export default {
   name: 'uploadImg',
   props: {
     uploadid: {
       type: String,
-      default: ''
+      default: '',
     },
     imgText: {
       type: String,
-      default: ''
+      default: '',
     },
     visitsId: {
       type: String,
-      default: ''
+      default: '',
     },
     taskId: {
       type: String,
-      default: ''
+      default: '',
     },
     collectionId: {
       type: String,
-      default: ''
+      default: '',
     },
     type: {
       type: Number,
-      default: 1
+      default: 1,
     },
     imgArr: {
       type: String,
-      default: ''
+      default: '',
     },
   },
   data() {
     return {
       shows: false,
-      url: ""
-    }
+      url: '',
+    };
   },
   methods: {
     uploadImgView() {
-      this.$toast("请输入名称!")
+      this.$toast('请输入名称!');
     },
   },
-}
+};
 </script>
 
 <style scoped>
@@ -98,7 +107,7 @@ export default {
   z-index: 99;
   background-color: rgba(255, 255, 255, 0.8);
   border-bottom-left-radius: 3px;
-  border-top-left-radius: 3px
+  border-top-left-radius: 3px;
 }
 
 .coverImg {

+ 1 - 1
src/components/uploadImgVStore.vue

@@ -6,7 +6,7 @@
           class="photobrowsing"
           name="expand-o"
           size="22px"
-          color="#969696"
+          color="#1989fa"
           @click="deleteImgs" />
         <img :src="imgUrlArr[0]" alt="" />
       </div>

+ 101 - 93
src/components/viewaddreddUploadImg.vue

@@ -2,162 +2,170 @@
   <div>
     <div class="cameraDiv1">
       <div class="imgPre">
-        <van-icon class="photobrowsing" name="expand-o" size="22px" color="#969696" v-if="imgArr!=''" @click="deleteImgs(imgArr)"/>
-        <img :src="imgArr" alt="" v-if="imgArr!=''">
+        <van-icon
+          class="photobrowsing"
+          name="expand-o"
+          size="22px"
+          color="#1989fa"
+          v-if="imgArr != ''"
+          @click="deleteImgs(imgArr)" />
+        <img :src="imgArr" alt="" v-if="imgArr != ''" />
       </div>
       <p class="coverImg" @click="uploadImg">
-        <van-icon class="photo ico" name="photograph" size="16px" color="#969696">{{ imgText }}</van-icon>
+        <van-icon class="photo ico" name="photograph" size="16px" color="#969696">{{
+          imgText
+        }}</van-icon>
       </p>
     </div>
-    <p style="text-align: center;">{{ imgText }}</p>
+    <p style="text-align: center">{{ imgText }}</p>
   </div>
 </template>
 
 <script>
-import {ImagePreview} from "vant";
+import { ImagePreview } from 'vant';
 import axios from 'axios';
-import {uploadImageaddress} from "@/api/index";
+import { uploadImageaddress } from '@/api/index';
 
 export default {
   name: 'uploadImg',
   props: {
     uploadid: {
       type: String,
-      default: ''
+      default: '',
     },
     imgText: {
       type: String,
-      default: ''
+      default: '',
     },
     visitsId: {
       type: String,
-      default: ''
+      default: '',
     },
     taskId: {
       type: String,
-      default: ''
+      default: '',
     },
     collectionId: {
       type: String,
-      default: ''
+      default: '',
     },
     type: {
       type: Number,
-      default: 1
+      default: 1,
     },
     imgArr: {
       type: String,
-      default: ''
+      default: '',
     },
   },
   data() {
     return {
       shows: false,
-      url: ""
-    }
+      url: '',
+    };
   },
   methods: {
     deleteImgs(val) {
       ImagePreview([val]);
     },
-    uploadImg(){
+    uploadImg() {
       if (localStorage.getItem('chainName') == null) {
-        this.$toast("请输入名称!")
-        return
+        this.$toast('请输入名称!');
+        return;
       }
       let url = window.location.href;
       let that = this;
-      let wx = this.wx
-      let qiyeData
+      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","getLocation"] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
-          });
-          wx.ready(function () {
-            var locations=""
-            wx.getLocation({
-              type: 'gcj02',
-              success: function (response) {
-                locations=response
+      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', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
+            });
+            wx.ready(function () {
+              var locations = '';
+              wx.getLocation({
+                type: 'gcj02',
+                success: function (response) {
+                  locations = response;
 
-                wx.chooseImage({
-                  count: 1,
-                  sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
-                  sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
-                  defaultCameraMode: "normal", //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
-                  isSaveToAlbum:0,
-                  success: function (res) {
-                    var localIds=""
-                    if(res.localIds!=undefined){
-                      localIds= res.localIds[0]
-                    }else{
-                      localIds=res.localId
-                    }
-                    wx.uploadImage({
-                      localId: localIds,
-                      isShowProgressTips: 1,
-                      success: function (res) {
-                        that.uploadImagev(res.serverId,locations.latitude, locations.longitude)
+                  wx.chooseImage({
+                    count: 1,
+                    sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
+                    sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
+                    defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
+                    isSaveToAlbum: 0,
+                    success: function (res) {
+                      var localIds = '';
+                      if (res.localIds != undefined) {
+                        localIds = res.localIds[0];
+                      } else {
+                        localIds = res.localId;
                       }
-                    });
-                  }
-                });
-              },
-              fail: function () {
-                that.$dialog.alert({
-                  message: 'GPS未开启',
-                })
-              }
+                      wx.uploadImage({
+                        localId: localIds,
+                        isShowProgressTips: 1,
+                        success: function (res) {
+                          that.uploadImagev(res.serverId, locations.latitude, locations.longitude);
+                        },
+                      });
+                    },
+                  });
+                },
+                fail: function () {
+                  that.$dialog.alert({
+                    message: 'GPS未开启',
+                  });
+                },
+              });
             });
-
-          })
-        }
-      });
+          }
+        });
     },
-    uploadImagev(meidaId,lat,lng){
+    uploadImagev(meidaId, lat, lng) {
       var that = this;
-      var form={
-        mediaId:meidaId,
-        storeName:localStorage.getItem('chainName'),
-        locationRemark:localStorage.getItem('locationRemark'),
-        deptName:localStorage.getItem('deptName'),
-        lat:lat,
-        lng:lng
-      }
+      var form = {
+        mediaId: meidaId,
+        storeName: localStorage.getItem('chainName'),
+        locationRemark: localStorage.getItem('locationRemark'),
+        deptName: localStorage.getItem('deptName'),
+        lat: lat,
+        lng: lng,
+      };
       var loind1 = that.$toast.loading({
         duration: 0,
         message: '上传中...',
         forbidClick: true,
       });
-      uploadImageaddress(form).then(res=>{
+      uploadImageaddress(form).then((res) => {
         if (res.code == 200) {
-          that.imgArr = res.data.url
+          that.imgArr = res.data.url;
           loind1.clear();
-          that.$toast("上传成功!")
-          that.$emit('newimgarr', {fileUrl: res.data.url, type: that.type});
+          that.$toast('上传成功!');
+          that.$emit('newimgarr', { fileUrl: res.data.url, type: that.type });
         } else {
-          that.$toast("上传失败!")
+          that.$toast('上传失败!');
         }
-      })
-    }
+      });
+    },
   },
-}
+};
 </script>
 
 <style scoped>
@@ -197,7 +205,7 @@ export default {
   z-index: 99;
   background-color: rgba(255, 255, 255, 0.8);
   border-bottom-left-radius: 3px;
-  border-top-left-radius: 3px
+  border-top-left-radius: 3px;
 }
 
 .coverImg {

+ 58 - 6
src/views/signApproval/newStoreApprovalDetail.vue

@@ -143,16 +143,23 @@
             <van-collapse-item title="门店下单记录" name="1">
               <div class="orderItem" v-for="(item, index) in orderList" :key="index">
                 <div class="orderTitle">
-                  {{ item.ORDERID }} | {{ item.ORDERDATE }} | {{ item.STATUS_DESCR }}
+                  {{ item.ORDERID }} | {{ item.ORDERDATE }} | {{ item.STATUS_DESCR }} |
+                  {{ item.totalPrice }}
                 </div>
                 <el-table
                   :data="item.productDetail"
                   border
                   class="table-headermd table-headermdhome"
+                  show-summary
+                  :summary-method="getSummaries"
                   style="width: 100%">
                   <el-table-column label="产品名称" prop="DESCR" />
                   <el-table-column label="数量" prop="QTY" width="80px" />
-                  <!-- <el-table-column label="单价" prop="price" width="80px" /> -->
+                  <el-table-column label="金额" prop="productTotalPrice" width="80px">
+                    <!-- <template slot-scope="scope">
+                      {{ scope.row.UNITPRICE * scope.row.QTY }}
+                    </template> -->
+                  </el-table-column>
                 </el-table>
               </div>
             </van-collapse-item>
@@ -537,16 +544,24 @@ export default {
                 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]],
+                  ORDERID: orderList[i].ORDERID, // 订单id
+                  ORDERDATE: orderList[i].ORDERDATE, //下单时间
+                  STATUS_DESCR: orderList[i].STATUS_DESCR, // 订单状态
+                  productDetail: [orderList[i]], // 订单详情
                 };
                 orderMap.set(orderList[i].ORDERID, orderObj);
               }
             }
+            // totalPrice:
             let orderListArr = [];
             for (let value of orderMap.values()) {
+              let productTotalPrice = 0; //当前订单总金额
+              for (let i = 0; i < value.productDetail.length; i++) {
+                value.productDetail[i].productTotalPrice =
+                  value.productDetail[i].UNITPRICE * value.productDetail[i].QTY; // 单个商品总金额
+                productTotalPrice = productTotalPrice + value.productDetail[i].productTotalPrice;
+              }
+              value.totalPrice = productTotalPrice;
               orderListArr.push(value);
             }
             this.orderList = orderListArr;
@@ -557,6 +572,43 @@ export default {
         }
       });
     },
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '总金额';
+          return;
+        }
+        if (index === 2) {
+          const values = data.map((item) => Number(item[column.property]));
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          // sums[index] += ' 元';
+        }
+        // const values = data.map((item) => Number(item[column.property]));
+        // if (!values.every((value) => isNaN(value))) {
+        //   sums[index] = values.reduce((prev, curr) => {
+        //     const value = Number(curr);
+        //     if (!isNaN(value)) {
+        //       return prev + curr;
+        //     } else {
+        //       return prev;
+        //     }
+        //   }, 0);
+        //   sums[index] += ' 元';
+        // } else {
+        //   sums[index] = 'N/A';
+        // }
+      });
+      return sums;
+    },
     formLink() {
       this.$router.push('/storeVisit/questions');
     },

+ 38 - 21
src/views/storeManagement/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="bgcolor">
+  <div class="bgcolor storeManagement">
     <div class="navBarTOP" style="background-color: #fff">
       <van-nav-bar class="navBar" title="客户信息" left-arrow @click-left="onClickLeft" />
       <!-- <van-row gutter="20" style="padding:0 16px;" v-if="addShow">
@@ -11,24 +11,6 @@
           <van-button type="info" size="small" style="margin-top: 10px;background: #0057ba;border-color: #0057ba;width: 100%;border-radius: 5px;" @click="onSelect('B')"><van-icon name="guide-o" />&nbsp;{{addBTN}}</van-button>
         </van-col>
       </van-row> -->
-      <div class="selectFilter" v-if="tabVal == 1">
-        <van-dropdown-menu :close-on-click-overlay="false">
-          <van-dropdown-item :title="dropdownTitle" ref="dropdownItem" @open="dropdownOpen">
-            <van-cell
-              center
-              :title="item.text"
-              v-for="item in statusOption"
-              @click.stop="dropdownItemClick(item)">
-              <template #right-icon v-if="item.selectFlag">
-                <van-icon name="success" color="red" />
-              </template>
-            </van-cell>
-            <div style="padding: 5px 16px">
-              <van-button type="danger" block round @click="onConfirm"> 确认 </van-button>
-            </div>
-          </van-dropdown-item>
-        </van-dropdown-menu>
-      </div>
       <div class="searchDiv">
         <van-search
           v-model="fromValue.storeName"
@@ -39,6 +21,24 @@
             <div @click="onSearch">搜索</div>
           </template>
         </van-search>
+        <div class="selectFilter" v-if="tabVal == 1">
+          <van-dropdown-menu :close-on-click-overlay="false">
+            <van-dropdown-item :title="dropdownTitle" ref="dropdownItem" @open="dropdownOpen">
+              <van-cell
+                center
+                :title="item.text"
+                v-for="item in statusOption"
+                @click.stop="dropdownItemClick(item)">
+                <template #right-icon v-if="item.selectFlag">
+                  <van-icon name="success" color="red" />
+                </template>
+              </van-cell>
+              <div style="padding: 5px 16px">
+                <van-button type="danger" block round @click="onConfirm"> 确认 </van-button>
+              </div>
+            </van-dropdown-item>
+          </van-dropdown-menu>
+        </div>
       </div>
       <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @change="tabChange">
         <van-tab title="销售部" name="0" :disabled="disabled"></van-tab>
@@ -46,8 +46,9 @@
       </van-tabs>
       <div class="lineGrey"></div>
     </div>
-    <div v-if="!addShow" style="padding-top: 154px"></div>
-    <div v-if="addShow" style="padding-top: 190px"></div>
+    <!-- <div v-if="!addShow" style="padding-top: 154px"></div> -->
+    <!-- <div v-if="addShow" style="padding-top: 160px"></div> -->
+    <div style="padding-top: 160px"></div>
     <!--        主体内容-->
     <div class="container">
       <van-list
@@ -957,6 +958,22 @@ export default {
 .van-tabs__nav--card .van-tab.van-tab--active {
   background-color: #0057ba !important;
 }
+.storeManagement {
+  .van-search {
+    flex: 1;
+  }
+  .searchDiv {
+    display: flex;
+    background: #fff;
+    align-items: center;
+    .selectFilter {
+      width: 30%;
+      .van-dropdown-menu__bar {
+        height: 40px !important;
+      }
+    }
+  }
+}
 </style>
 <style lang="scss" scoped>
 .container {

+ 58 - 6
src/views/storeManagement/storeDetail.vue

@@ -221,16 +221,23 @@
             <van-collapse-item title="门店下单记录" name="1">
               <div class="orderItem" v-for="(item, index) in orderList" :key="index">
                 <div class="orderTitle">
-                  {{ item.ORDERID }} | {{ item.ORDERDATE }} | {{ item.STATUS_DESCR }}
+                  {{ item.ORDERID }} | {{ item.ORDERDATE }} | {{ item.STATUS_DESCR }} |
+                  {{ item.totalPrice }}
                 </div>
                 <el-table
                   :data="item.productDetail"
                   border
                   class="table-headermd table-headermdhome"
+                  show-summary
+                  :summary-method="getSummaries"
                   style="width: 100%">
                   <el-table-column label="产品名称" prop="DESCR" />
                   <el-table-column label="数量" prop="QTY" width="80px" />
-                  <!-- <el-table-column label="单价" prop="price" width="80px" /> -->
+                  <el-table-column label="金额" prop="productTotalPrice" width="80px">
+                    <!-- <template slot-scope="scope">
+                      {{ scope.row.UNITPRICE * scope.row.QTY }}
+                    </template> -->
+                  </el-table-column>
                 </el-table>
               </div>
             </van-collapse-item>
@@ -1337,16 +1344,24 @@ export default {
                 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]],
+                  ORDERID: orderList[i].ORDERID, // 订单id
+                  ORDERDATE: orderList[i].ORDERDATE, //下单时间
+                  STATUS_DESCR: orderList[i].STATUS_DESCR, // 订单状态
+                  productDetail: [orderList[i]], // 订单详情
                 };
                 orderMap.set(orderList[i].ORDERID, orderObj);
               }
             }
+            // totalPrice:
             let orderListArr = [];
             for (let value of orderMap.values()) {
+              let productTotalPrice = 0; //当前订单总金额
+              for (let i = 0; i < value.productDetail.length; i++) {
+                value.productDetail[i].productTotalPrice =
+                  value.productDetail[i].UNITPRICE * value.productDetail[i].QTY; // 单个商品总金额
+                productTotalPrice = productTotalPrice + value.productDetail[i].productTotalPrice;
+              }
+              value.totalPrice = productTotalPrice;
               orderListArr.push(value);
             }
             this.orderList = orderListArr;
@@ -1357,6 +1372,43 @@ export default {
         }
       });
     },
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '总金额';
+          return;
+        }
+        if (index === 2) {
+          const values = data.map((item) => Number(item[column.property]));
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          // sums[index] += ' 元';
+        }
+        // const values = data.map((item) => Number(item[column.property]));
+        // if (!values.every((value) => isNaN(value))) {
+        //   sums[index] = values.reduce((prev, curr) => {
+        //     const value = Number(curr);
+        //     if (!isNaN(value)) {
+        //       return prev + curr;
+        //     } else {
+        //       return prev;
+        //     }
+        //   }, 0);
+        //   sums[index] += ' 元';
+        // } else {
+        //   sums[index] = 'N/A';
+        // }
+      });
+      return sums;
+    },
     storeApprovaHistoryFun() {
       storeApprovaHistory({ storeId: this.list.storeId }).then((res) => {
         this.rejectMsg = res.data || [];

+ 1 - 0
src/views/storeManagement/storeEdit.vue

@@ -320,6 +320,7 @@
                         :type="2"
                         :count="fromValue.ifJzStoreType != 1 ? 9 : 1"></upload-img>
                     </div>
+                    <!-- <viewUploadImg :imgs="fromValue.imgSed.split(',')"></viewUploadImg> -->
                   </van-col>
                 </van-row>
               </div>