zh 2 years ago
parent
commit
7dc22b1004

+ 5 - 1
src/components/Common/export-button.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-button size="mini" type="primary" :icon="isIcon ? 'el-icon-download' : ''" @click="handleExport">{{
+    <el-button size="mini" type="primary" :disabled="disabled" :icon="isIcon ? 'el-icon-download' : ''" @click="handleExport">{{
       exText
     }}</el-button>
   </div>
@@ -27,6 +27,10 @@ export default {
     exParams: {
       type: Object,
       default: null
+    },
+    disabled:{
+      type:Boolean,
+      default: false
     }
   },
   methods: {

+ 53 - 4
src/views/sales_policy/components/details.vue

@@ -83,14 +83,36 @@
             <el-col :span="24" class="item">
               <div class="label" style="height: 150px">政策封面图</div>
               <div class="value" style="height: 150px">
-                <el-image
+                <template v-for="item in detail.imgSrc">
+                  <el-image
+                    v-if="checkFileType(item) == 'image'"
+                    ref="img"
+                    :src="$imageUrl + item"
+                    style="width: 120px; height: 120px; margin-right: 20px"
+                    fit="cover"
+                    :preview-src-list="[$imageUrl + item]"
+                  />
+                  <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png" />
+                  <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png" />
+                  <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
+
+                  <img
+                    v-if="checkFileType(item) == 'pdf'"
+                    class="file"
+                    style="cursor: pointer"
+                    src="@/assets/common/pdf.png"
+                    @click="openPdf(item)"
+                  />
 
+                  <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg" />
+                </template>
+                <!-- <el-image
                   v-for="item in detail.imgSrc"
                   style="height: 120px; widht: 120px;margin-left: 20px"
                   :src="$imageUrl + item"
                   fit="fill"
                   :preview-src-list="srcList"
-                />
+                /> -->
               </div>
             </el-col>
           </el-row>
@@ -794,8 +816,8 @@ export default {
         this.detail = res.data
         this.detail.flag = this.detail.flag + ''
         this.detail.imgSrc = this.detail.imgSrc.split(',')
-        this.detail.imgSrc.forEach(k=>{
-          this.srcList.push(this.$imageUrl+k)
+        this.detail.imgSrc.forEach(k => {
+          this.srcList.push(this.$imageUrl + k)
         })
         // this.srcList = [this.$imageUrl + this.detail.imgSrc]
         if (this.$parent.isShow == 5 && this.detail.imgSrc) {
@@ -827,6 +849,30 @@ export default {
         this.clistLoading = false
       })
     },
+    // 检查文件类型
+    checkFileType(url) {
+      if (!url) return ''
+      const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
+
+      if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
+        return 'image'
+      } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
+        return 'word'
+      } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
+        return 'excel'
+      } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
+        return 'ppt'
+      } else if (['pdf'].includes(fileSuffix)) {
+        return 'pdf'
+      } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
+        return 'file'
+      } else {
+        return ''
+      }
+    },
+    openPdf(pdfUrl) {
+      window.open(this.$imageUrl + pdfUrl)
+    },
     getCrList() {
       const customerParams = {
         pageNum: this.currentPage,
@@ -1124,6 +1170,9 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.file {
+  margin-right: 20px;
+}
 .el-col {
   overflow: hidden;
 }

+ 30 - 28
src/views/supply/pickup/check.vue

@@ -62,14 +62,9 @@
                 </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="3" :lg="3">
-                <el-button
-                  size="mini"
-                  type="primary"
-                  @click="getCode"
-                  :disabled="!screenForm.phone || countDown != 60"
-                >{{ countDown == 60 ? getCodeText : '重新获取(' + countDown + 's)' }}
-                </el-button
-                >
+                <el-button size="mini" type="primary" @click="getCode" :disabled="!screenForm.phone || countDown != 60"
+                  >{{ countDown == 60 ? getCodeText : '重新获取(' + countDown + 's)' }}
+                </el-button>
               </el-col>
               <el-col :xs="24" :sm="8" :lg="8">
                 <el-form-item label="验证码" prop="code">
@@ -82,9 +77,8 @@
                   type="primary"
                   :disabled="!screenForm.phone || !screenForm.code"
                   @click="getPickupManInfo"
-                >确 认
-                </el-button
-                >
+                  >确 认
+                </el-button>
               </el-col>
             </el-row>
             <el-row :gutter="20">
@@ -148,9 +142,8 @@
             <el-col :xs="24" :sm="24" :lg="24">
               <el-form-item prop="status" label-width="0">
                 <el-radio-group v-model="screenForm.status" size="mini" @change="getList()">
-                  <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{
-                      item.label
-                    }}
+                  <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value"
+                    >{{ item.label }}
                   </el-radio-button>
                 </el-radio-group>
               </el-form-item>
@@ -175,7 +168,7 @@
       <div class="main-title">
         <div class="title">提货单</div>
         <div class="fr">
-          <ExportButton :exUrl="'pick/storeExport'" :exParams="exParams" />
+          <ExportButton :disabled="disableExport" :exUrl="'pick/storeExport'" :exParams="exParams" />
         </div>
       </div>
 
@@ -251,13 +244,13 @@
                   "
                 />
                 <span>{{
-                    scope.row.orderType === 'TRADE' ||
-                    scope.row.orderType === 'HOME' ||
-                    scope.row.orderType === 'REQUISITION_TRADE' ||
-                    scope.row.orderType === 'REQUISITION_HOME'
-                      ? scope.row.enginOrderNo
-                      : scope.row.mainOrderId
-                  }}</span>
+                  scope.row.orderType === 'TRADE' ||
+                  scope.row.orderType === 'HOME' ||
+                  scope.row.orderType === 'REQUISITION_TRADE' ||
+                  scope.row.orderType === 'REQUISITION_HOME'
+                    ? scope.row.enginOrderNo
+                    : scope.row.mainOrderId
+                }}</span>
               </template>
             </el-table-column>
             <el-table-column align="left" label="发货申请单号" prop="invoiceId" min-width="130" show-overflow-tooltip>
@@ -369,9 +362,8 @@
             @click="toPrint"
             :disabled="tableSelection.length < 1"
             v-if="$checkBtnRole('print', $route.meta.roles)"
-          >打印发货单
-          </el-button
-          >
+            >打印发货单
+          </el-button>
         </div>
       </div>
     </div>
@@ -500,7 +492,9 @@ export default {
       logisticsArr: [],
       pageNum: 1,
       listTotal: 0,
-      dealerList2: []
+      dealerList2: [],
+      // 限制导出
+      disableExport: true
     }
   },
 
@@ -512,7 +506,15 @@ export default {
       }
     }
   },
-
+  watch: {
+    'screenForm.warehouse'() {
+      if (this.check == 1) {
+        this.disableExport = !(this.screenForm.manId && this.screenForm.warehouse)
+      } else {
+        this.disableExport = !(this.screenForm.logisticsId && this.screenForm.warehouse)
+      }
+    }
+  },
   created() {
     this.getDealerList()
     this.getCompanyList()
@@ -713,7 +715,7 @@ export default {
     // 检查是否一致
     isAllEqual(array) {
       if (array.length > 0) {
-        return !array.some(function(item, index) {
+        return !array.some(function (item, index) {
           return item.informationKey !== array[0].informationKey
         })
       } else {