瀏覽代碼

Merge branch 'master' into shandian

# Conflicts:
#	src/views/modules/order/order.vue
#	src/views/modules/print/print-order-info.vue
#	src/views/modules/print/print-order.vue
#	src/views/modules/print/print-scan-delivery.vue
#	src/views/modules/print/third-print-sku-add-or-update.vue
#	src/views/modules/prod/printPicLib-add-or-update.vue
#	src/views/modules/prod/printPicLib.vue
#	src/views/modules/prod/prodTemplate-add-or-update.vue
huangmp 2 年之前
父節點
當前提交
f93462251b

+ 56 - 24
src/components/order-card-item/index.vue

@@ -124,27 +124,57 @@
         }
         let isSize = true;
         //如果当前是编辑的小卡,就需要判断是否符合尺寸
-        if(item.prodName.indexOf("小卡") != -1){
-          isSize = new Promise(function(resolve, reject) {
-            let width = 709;
-            let height = 1087;
-            let _URL = window.URL || window.webkitURL;
-            let img = new Image();
-            img.onload = function() {
-              let valid = img.width == width && img.height == height;
-              valid ? resolve() : reject();
-            };
-            img.src = _URL.createObjectURL(file);
-          }).then(
-            () => {
-              return file;
-            },
-            () => {
-              this.$message.error("上传的图片宽高必须是709*1087!");
-              return Promise.reject();
-            }
-          );
-        }
+        let width = 709;
+        let height = 1087;
+        let prodName = item.prodName;
+        isSize = new Promise(function(resolve, reject) {
+          if(prodName.indexOf("小卡") !== -1 || prodName.indexOf("仿拍立得") !== -1){
+            width = 709;
+            height = 1087;
+          }else if(prodName.indexOf("票根") !== -1){
+            width = 780;
+            height = 1489;
+          }else if(prodName.indexOf("直拍封面") !== -1){
+            width = 697;
+            height = 1217;
+          }else if(prodName.indexOf("明信片") !== -1){
+            width = 1252;
+            height = 1819;
+          }else if(prodName.indexOf("书签") !== -1){
+            width = 638;
+            height = 1819;
+          }else if(prodName.indexOf("方卡") !== -1){
+            width = 1217;
+            height = 1217;
+          }else if(prodName.indexOf("手幅") !== -1){
+            width = 1252;
+            height = 3614;
+          }else if(prodName.indexOf("毛绒徽章") !== -1){
+            width = 827;
+            height = 827;
+          }else if(prodName.indexOf("圆形徽章") !== -1){
+            width = 850;
+            height = 850;
+          }else if(prodName.indexOf("手幅") !== -1){
+            width = 1252;
+            height = 3614;
+          }
+          let _URL = window.URL || window.webkitURL;
+          let img = new Image();
+          img.onload = function() {
+            let valid = img.width == width && img.height == height;
+            valid ? resolve() : reject();
+          };
+          img.src = _URL.createObjectURL(file);
+        }).then(
+          () => {
+            return file;
+          },
+          () => {
+            this.$message.error("上传的图片宽高必须是" + width + "*" + height);
+            return Promise.reject();
+          }
+        );
         return isJpg && isSize;
       },
       deleteCardItem(item, index){
@@ -237,8 +267,8 @@
         this.side = side;
         if(prodName.indexOf('小卡') != -1){
           this.prodType = '小卡';
-        } else if(prodName.indexOf('拍立得') != -1){
-          this.prodType = '拍立得';
+        } else if(prodName.indexOf('仿拍立得') != -1){
+          this.prodType = '仿拍立得';
         }else if(prodName.indexOf('直拍封面') != -1){
           this.prodType = '直拍封面';
         }else if(prodName.indexOf('票根') != -1){
@@ -251,8 +281,10 @@
           this.prodType = '书签';
         }else if(prodName.indexOf('徽章') != -1){
           this.prodType = '徽章';
-        } else if(prodName.indexOf('手幅') != -1){
+        }else if(prodName.indexOf('手幅') != -1){
           this.prodType = '手幅';
+        }else if(prodName.indexOf('毛绒徽章') != -1){
+          this.prodType = '毛绒徽章';
         }
         this.$nextTick(() =>{
           this.$refs.canvasPreviewRef.init(cardItem, this.resourcesUrl + picUrl, this.prodType, side)

+ 33 - 2
src/views/modules/order/order.vue

@@ -352,7 +352,7 @@
           </ul>
           <ul class="nav-right"></ul>
         </div>
-        <el-checkbox @change="checked=>handleSelectAll(checked)" class="all-check-btn" >全选 </el-checkbox>
+        <el-checkbox @change="checked=>handleSelectAll(checked)" class="all-check-btn" v-model="selectAll">全选 </el-checkbox>
         <span v-if="dataListSelections.size" class="had-selected">已选 {{dataListSelections.size}}</span>
         <div
             class="default-btn"
@@ -1024,6 +1024,8 @@ import OrderInfo from "./orderInfo";
 import TopTask from '@/components/top-task';
 import InputNumberRange from '@/components/input-number-range';
 import OrderPromotion from './orderPromotion';
+import {} from "@/utils/excel";
+import {downloadXls} from "@/utils/excel";
 
 export default {
   data () {
@@ -1243,6 +1245,25 @@ export default {
 
   },
   methods: {
+    scanDelivery(order){
+
+    },
+    handleExportDelivery(){
+      this.exportDeliveryLoading = true;
+      this.$http({
+        url: this.$http.adornUrl('/order/order/exportDeliveryInfo'),
+        method: 'GET',
+        params: this.$http.adornParams({startTime: this.dateRange[0], endTime: this.dateRange[1]}),
+        responseType: 'blob'
+      }).then(({data}) => {
+        this.exportDeliveryLoading = false;
+        let fileName = "微信发货订单信息";
+        downloadXls(data, fileName + ".xlsx");
+      }).catch((error) => {
+        this.exportDeliveryLoading = false;
+        this.$message.error(error)
+      })
+    },
     openGeneratePrintPdfBatchDialog(){
       this.generatePrintPdfBatchVisible = true;
     },
@@ -1888,8 +1909,18 @@ export default {
     },
     // 搜索查询
     searchChange (newData = false) {
+      let it = this;
+      this.dataList.forEach((item, index) => {
+        it.$set(item,'checkStatus',false)
+        it.dataListSelections.delete(item.orderNumber);
+        it.selectAll = false;
+        it.checked = false;
+      })
+      this.dataListSelections = new Set();
+      this.selectAll = false;
+      this.selectSheets = 0;
       this.page.currentPage = 1
-
+      // this.getDataList(this.page, null, newData)
       if(this.status === 8){
         this.getWaitPrintPage(this.page, null, newData)
       }else if(this.status === 9){

+ 1 - 0
src/views/modules/order/orderInfo.vue

@@ -1063,6 +1063,7 @@ export default {
         }),
       }).then(({ data }) => {
         if(data){
+          this.modifyCreateTimeVisible = false;
           this.$message({
             message: "修改成功",
             type: 'success'

+ 0 - 2
src/views/modules/print/print-order-info.vue

@@ -233,8 +233,6 @@ export default {
   methods: {
     closeDialog(){
       this.visible = false;
-      this.dataForm.orderNumber = null;
-      this.orderStatus = null;
       this.$emit('printOrderClose');
     },
     init (params) {

+ 2 - 0
src/views/modules/print/third-print-sku-add-or-update.vue

@@ -25,6 +25,8 @@
           <el-option key="stub" label="票根" value="stub"></el-option>
           <el-option key="transformcard" label="变换卡" value="transformcard"></el-option>
           <el-option key="transpolaroid" label="透明胶片拍立得" value="transpolaroid"></el-option>
+          <el-option key="rectanglesticker" label="长形贴纸" value="rectanglesticker"></el-option>
+          <el-option key="squaresticker" label="方形贴纸" value="squaresticker"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="关联产品" prop="prodId">

+ 8 - 1
src/views/modules/prod/post-product/posting-edit-product.vue

@@ -195,6 +195,12 @@
               <el-radio :label="1">非定制</el-radio>
             </el-radio-group>
           </el-form-item>
+          <el-form-item v-if="dataForm.prodType !== 5 && dataForm.customized == 0" label="定制类型">
+            <el-radio-group v-model="dataForm.customType">
+              <el-radio :label="1">上传定制</el-radio>
+              <el-radio :label="2">图库定制</el-radio>
+            </el-radio-group>
+          </el-form-item>
           <div class="prod-name-box">
             <el-form-item label="起订量" class="prod-name-con">
               <el-input type="number" v-model="dataForm.setNum"></el-input>
@@ -600,7 +606,8 @@ export default {
           //   parameterValueEn: ''
           // }
         ],
-        customized: 0
+        customized: 0,
+        customType: 1
       },
       dataRule: {
         prodNameCn: [

+ 72 - 22
src/views/modules/prod/printPicLib-add-or-update.vue

@@ -13,6 +13,9 @@
           </el-option>
         </el-select>
       </el-form-item>
+      <el-form-item label="分类" prop="category">
+        <el-input v-model="dataForm.category" style="width: 185px" />
+      </el-form-item>
       <el-row>
         <el-col :span="6">
             <el-form-item label="正面" prop="frontUrl">
@@ -59,7 +62,9 @@ export default {
         prodName: null,
         seq: null,
         isDelete: 0,
+        category:null
       },
+      resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
       prodList: [],
       dataRule: {
       }
@@ -90,10 +95,48 @@ export default {
         if(item.prodId === prodId){
           this.dataForm.prodName = item.prodName;
         }
-      })
-      // this.dataForm.prodId = prod.value;
-      // this.dataForm.prodName = prod.label;
+      });
+    },
+    getProdTypeSize(){
+      let width = 0;
+      let height = 0;
+      let prodName = this.dataForm.prodName;
+      if(prodName.indexOf('小卡') !== -1 || prodName.indexOf("仿拍立得") !== -1){
+        width = 709;
+        height = 1087;
+      }else if(prodName.indexOf("票根") !== -1){
+        width = 780;
+        height = 1489;
+      }else if(prodName.indexOf("圆形徽章") !== -1){
+        width = 850;
+        height = 850;
+      }else if(prodName.indexOf("明信片") !== -1){
+        width = 1252;
+        height = 1819;
+      }
+      return {width, height};
     },
+    //验证图片尺寸
+    checkImageSize(imageStr, index) {
+      let width = this.getProdTypeSize().width;
+      let height = this.getProdTypeSize().height;
+      return new Promise((resolve, reject) => {
+        let image = new Image();
+        image.onload = function() {
+          let imageFormat = imageStr.split('.').pop();
+          if(imageFormat !== 'jpg'){
+            reject(index);
+          }
+          if ((image.width === width && image.height === height)) {
+            resolve();
+          } else {
+            reject(index);
+          }
+        };
+        image.src = this.resourcesUrl + imageStr;
+      });
+    },
+
     getProdList(){
       this.$http({
         url: this.$http.adornUrl('/prod/prod/simpleList'),
@@ -104,26 +147,33 @@ export default {
       })
     },
     // 表单提交
-    dataFormSubmit () {
-      this.$refs['dataForm'].validate((valid) => {
-        if (valid) {
-          this.$http({
-            url: this.$http.adornUrl('/print/printPicLib'),
-            method: this.dataForm.id ? 'put' : 'post',
-            data: this.$http.adornData(this.dataForm)
-          }).then(({data}) => {
-            this.$message({
-              message: this.$i18n.t('publics.operation'),
-              type: 'success',
-              duration: 1500,
-              onClose: () => {
-                this.visible = false
-                this.$emit('refreshDataList')
-              }
-            })
-          })
+    async dataFormSubmit () {
+      try{
+        let imgs = [];
+        imgs[0] = this.dataForm.frontUrl ? this.dataForm.frontUrl:null;
+        if(this.dataForm.backUrl){
+          imgs[1] = this.dataForm.backUrl ? this.dataForm.backUrl:null;
         }
-      })
+        await Promise.all(imgs.map(this.checkImageSize));
+        this.$http({
+          url: this.$http.adornUrl('/print/printPicLib'),
+          method: this.dataForm.id ? 'put' : 'post',
+          data: this.$http.adornData(this.dataForm)
+        }).then(({data}) => {
+          this.$message({
+            message: this.$i18n.t('publics.operation'),
+            type: 'success',
+            duration: 200,
+            onClose: () => {
+              this.visible = false
+              this.$emit('refreshDataList')
+            }
+          })
+        })
+      }catch (error) {
+        this.$message.error(`第 ${error + 1} 张图片不符合尺寸要求。`)
+      }
+
     }
   }
 }

+ 50 - 13
src/views/modules/prod/printPicLib.vue

@@ -2,7 +2,28 @@
   <div class="mod-print-printPicLib">
     <!-- 搜索相关区域 -->
     <div class="search-bar">
-      <el-button class="default-btn primary-btn" @click="searchChange">{{$t('crud.searchBtn')}}</el-button>
+      <el-form :inline="true" class="search-form" ref="searchForm" :model="searchForm" label-width="auto" size="small">
+        <!-- 表单项 -->
+        <div class="input-row">
+          <el-form-item prop="prodId" label="关联产品">
+            <el-select v-model="searchForm.prodId" clearable filterable>
+              <el-option
+                v-for="node in prodList"
+                :key="node.prodId"
+                :label="node.prodName"
+                :value="node.prodId"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item prop="category" label="分类">
+            <el-input v-model="searchForm.category"></el-input>
+          </el-form-item>
+          <el-form-item>
+            <div class="default-btn primary-btn" @click="searchChange()">{{ $t('crud.searchBtn') }}</div>
+            <div class="default-btn" @click="resetForm()">{{ $t('shop.resetMap') }}</div>
+          </el-form-item>
+        </div>
+      </el-form>
     </div>
     <!-- 列表相关区域 -->
     <div class="main-container">
@@ -40,18 +61,16 @@
               />
             </template>
           </el-table-column>
-          <!--&lt;!&ndash; 关联的产品ID &ndash;&gt;
-          <el-table-column label="关联产品" prop="prodId" align="center">
-            <template slot-scope="scope">
-              <span>{{ scope.row.prodId}}</span>
-            </template>
-          </el-table-column>-->
-          <!-- 产品名称 -->
           <el-table-column label="关联产品" prop="prodName" align="center">
             <template slot-scope="scope">
               <span>{{ scope.row.prodName}}</span>
             </template>
           </el-table-column>
+          <el-table-column label="分类" prop="category" align="center">
+            <template slot-scope="scope">
+              <span>{{ scope.row.category}}</span>
+            </template>
+          </el-table-column>
           <!-- 排序序号 -->
           <el-table-column label="序号" prop="seq" align="center">
             <template slot-scope="scope">
@@ -104,10 +123,14 @@ export default {
         currentPage: 1, // 当前页数
         pageSize: 10 // 每页显示多少条
       },
+      categoryList:[],
+      prodList:[],
       previewPicUrl: null,
       previewPicDialogVisible: false,
       resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
-      searchForm: {}, // 搜索
+      searchForm: {
+        prodId: null
+      }, // 搜索
       dataListLoading: false,
       addOrUpdateVisible: false
     }
@@ -117,16 +140,26 @@ export default {
   },
   created () {
     this.getDataList();
+    this.getProdList();
   },
   mounted () {
   },
   methods: {
+    getProdList(){
+      this.$http({
+        url: this.$http.adornUrl('/prod/prod/simpleList'),
+        method: 'GET',
+        params: this.$http.adornParams({customized:0})
+      }).then(({data}) => {
+        this.prodList = data
+      })
+    },
     previewPic(url){
-      this.previewPicUrl = this.resourcesUrl + url
+      this.previewPicUrl = this.resourcesUrl + url;
       this.previewPicDialogVisible = true;
     },
     getDataList (page) {
-      this.dataListLoading = true
+      this.dataListLoading = true;
       this.$http({
         url: this.$http.adornUrl('/print/printPicLib/page'),
         method: 'get',
@@ -146,7 +179,7 @@ export default {
     },
     // 新增 / 修改
     addOrUpdateHandle (id) {
-      this.addOrUpdateVisible = true
+      this.addOrUpdateVisible = true;
       this.$nextTick(() => {
         this.$refs.addOrUpdate.init(id)
       })
@@ -178,8 +211,12 @@ export default {
       this.page.currentPage = 1
       this.getDataList(this.page)
     },
+    resetForm () {
+      this.searchForm = {
+        prodId: null,
+      }
+    },
     searchChange (params) {
-      this.searchForm = params
       this.getDataList(this.page)
     },
     handleSizeChange (val) {

+ 16 - 14
src/views/modules/prod/prodTemplate-add-or-update.vue

@@ -23,7 +23,7 @@
           <el-option key="stub" label="票根" value="stub"></el-option>
         </el-select>
       </el-form-item>
-      <!--<el-form-item label="模板风格" prop="templateStyle">
+      <el-form-item label="模板风格" prop="templateStyle">
         <el-select v-model="dataForm.templateStyleId" clearable filterable>
           <el-option
                   v-for="node in styleList"
@@ -42,7 +42,7 @@
                   :value="node.seriesId"
           ></el-option>
         </el-select>
-      </el-form-item>-->
+      </el-form-item>
       <el-form-item label="模板图片" prop="templatePic">
         <img-upload v-model="dataForm.templatePic" :limit="20"></img-upload>
       </el-form-item>
@@ -125,7 +125,7 @@ export default {
       let width = 0;
       let height = 0;
       let templateUsage = this.usageList.join(",");
-      let side = this.dataForm.templateSide;
+      let isBack = this.dataForm.templateSide === 'Back';
       return new Promise((resolve, reject) => {
         let image = new Image();
         image.onload = function() {
@@ -135,23 +135,25 @@ export default {
           }else if(templateUsage.indexOf("stub") !== -1){
             width = 780;
             height = 1489;
-          }else if(templateUsage.indexOf("postcard") !== -1) {
+          }else if(templateUsage.indexOf("bookmark") !== -1){
+            width = 638;
+            height = 1819;
+          }else if(templateUsage.indexOf("postcard") !== -1){
             width = 1252;
             height = 1819;
           }
-          if(side === 'Back'){
-            let format = imageStr.split('.').pop();
-            if(format !== 'jpg'){
+          if(isBack){
+            let imageFormat = imageStr.split('.').pop();
+            if(imageFormat != 'jpg'){
               reject(index);
             }
-          }
-          if(side === 'Front' && templateUsage === 'polaroid'){
-            let format = imageStr.split('.').pop();
-            if(format !== 'png'){
+          }else if(!isBack && templateUsage.indexOf("polaroid") !== -1){
+            let imageFormat = imageStr.split('.').pop();
+            if(imageFormat != 'png'){
               reject(index);
             }
           }
-          if (image.width === width && image.height === height) {
+          if ((image.width === width && image.height === height)) {
             resolve();
           } else {
             reject(index);
@@ -176,9 +178,9 @@ export default {
           this.$message({
             message: this.$i18n.t('publics.operation'),
             type: 'success',
-            duration: 1500,
+            duration: 200,
             onClose: () => {
-              this.visible = false
+              this.visible = false;
               this.$emit('refreshDataList')
             }
           })