From 0d71873262b6f670eb1814803a04f03cb8fb797e Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期四, 11 九月 2025 18:33:17 +0800
Subject: [PATCH] 修改封面限制数量

---
 seller/src/views/goods/goods-seller/goodsOperationSec.vue |   91 +++++++++++++++++++++++++++------------------
 1 files changed, 55 insertions(+), 36 deletions(-)

diff --git a/seller/src/views/goods/goods-seller/goodsOperationSec.vue b/seller/src/views/goods/goods-seller/goodsOperationSec.vue
index 1d58489..7d899bb 100644
--- a/seller/src/views/goods/goods-seller/goodsOperationSec.vue
+++ b/seller/src/views/goods/goods-seller/goodsOperationSec.vue
@@ -28,6 +28,7 @@
 <!--              <Input v-model="baseInfoForm.commission" max="100" min="0" clearable placeholder="鎶芥垚姣斾緥" style="width: 260px" type="number"/>-->
               <InputNumber v-model="baseInfoForm.commission" :formatter="value => `${value}%`"
                            :parser="value => value.replace('%', '')" :max="100" :min="0" clearable
+                           :active-change="false"
                            placeholder="鎶芥垚姣斾緥" style="width: 260px" type="number"/>
             </FormItem>
 
@@ -269,12 +270,13 @@
                                       </template>
                                     </div>
                                   </vuedraggable>
-<!--                                  todo 3-->
-                                  <Upload ref="uploadSku" action="-"
+                                  <!--                                  todo 3-->
+                                  <Upload ref="uploadSku" :action="uploadFileUrl"
                                           v-if="val.images < 1"
                                           :before-upload="handleBeforeUpload"
                                           :format="['jpg', 'jpeg', 'png', 'webp']"
                                           :max-size="2048"
+                                          :headers="{ ...accessToken }"
                                           :on-error="() => { $Spin.hide(); }"
                                           :on-exceeded-size="handleMaxSize"
                                           :on-format-error="handleFormatError"
@@ -326,9 +328,9 @@
                             overflow-x: hidden;
                           }
                         ">
-                        <template slot="sn" slot-scope="{ row }">
-                          <Input v-model="row.sn" clearable placeholder="璇疯緭鍏ヨ揣鍙�"
-                                 @on-change="updateSkuTable(row, 'sn')"/>
+                        <template slot="sn" slot-scope="{ row, index }">
+                          <Input v-model="row.sn" placeholder="璇疯緭鍏ヨ揣鍙�" disabled
+                                 @on-change="updateSkuTable(row, 'sn')" />
                         </template>
                         <div v-if="baseInfoForm.goodsType !== 'VIRTUAL_GOODS'" slot="weight" slot-scope="{ row }">
                           <Input v-model="row.weight" clearable placeholder="璇疯緭鍏ラ噸閲�"
@@ -400,7 +402,7 @@
             </div>
             <FormItem class="form-item-view-el" label="PC鍟嗗搧鎻忚堪" prop="intro" style="width: 100%">
               <editor
-                :show-upload="false"
+                :show-upload="true"
                 ref="editor"
                 v-model="baseInfoForm.intro"
                 height="800px"
@@ -414,7 +416,7 @@
 
             <FormItem class="form-item-view-el" label="绉诲姩绔弿杩�" prop="skuList" style="width: 100%">
               <editor
-                :show-upload="false"
+                :show-upload="true"
                 ref="introEditor"
                 v-model="baseInfoForm.mobileIntro"
                 height="800px"
@@ -699,6 +701,7 @@
         preSaleTime:[],
         preSaleBeginDate:'',
         preSaleEndDate:'',
+        commission:5
       },
       /** 琛ㄦ牸澶� */
       skuTableColumn: [],
@@ -1114,6 +1117,16 @@
       }
     },
     // sku鍥剧墖涓婁紶鍓嶉挬瀛�
+  // async handleBeforeUpload(file) {
+  //     const check =
+  //       this.selectedSku.images !== undefined &&
+  //       this.selectedSku.images.length > 5;
+  //     if (check) {
+  //       this.$Notice.warning({title: "鍥剧墖鏁伴噺涓嶈兘澶т簬浜斿紶"});
+  //       return false;
+  //     }
+  //   },
+    // sku鍥剧墖涓婁紶鍓嶉挬瀛�
   async handleBeforeUpload(file) {
       const check =
         this.selectedSku.images !== undefined &&
@@ -1457,8 +1470,8 @@
         this.$Message.error("宸插瓨鍦ㄧ浉鍚岃鏍奸」锛�");
         return;
       }
-      if (this.zz(0, val) > 20) {
-        this.$Message.error("瑙勬牸鍊兼渶澶氬崄涓瓧绗﹂暱搴︼紒");
+      if (this.zz(0, val) > 30) {
+        this.$Message.error("瑙勬牸鍊兼渶澶氬崄浜斾釜瀛楃闀垮害锛�");
         // val = val.toString().slice(0, 4);
         this.skuInfo[index].name = this.countCharacters(val, 10);
         this.$forceUpdate();// 璋冪敤璇ユ柟娉曚細瑙﹀彂缁勪欢鐨勯噸鏂版覆鏌�
@@ -1513,8 +1526,8 @@
       if (val.value === '') {
         return;
       }
-      if (this.zz(0, val.value) > 20) {
-        this.$Message.error("瑙勬牸鍊兼渶澶氬崄涓瓧绗﹂暱搴︼紒");
+      if (this.zz(0, val.value) > 30) {
+        this.$Message.error("瑙勬牸鍊兼渶澶氬崄浜斾釜瀛楃闀垮害锛�");
         // val.value = val.value.toString().slice(0, 4);
         this.skuInfo[$index].spec_values[index].value = this.countCharacters(val.value, 10);
         this.$forceUpdate();// 璋冪敤璇ユ柟娉曚細瑙﹀彂缁勪欢鐨勯噸鏂版覆鏌�
@@ -1701,6 +1714,7 @@
         this.baseInfoForm.regeneratorSkuFlag = true;
         this.newSkuValues[$index] = "";
       }
+      this.renderTableData(this.skuTableData);
     },
     handleClearSku() {
       this.skuInfo = [];
@@ -1728,7 +1742,7 @@
      * 娓叉煋table鎵�闇�瑕佺殑column 鍜� data
      */
     renderTableData(skus) {
-      console.log('-------------->閿�鍞被鍨�',skus)
+      console.log('-------------->閿�鍞被鍨�', skus)
       this.skuTableColumn = [];
       let pushData = [];
       // 娓叉煋澶撮儴
@@ -1754,14 +1768,14 @@
         );
       }
       // 棰勫敭妯″紡
-      if (this.baseInfoForm.salesModel !== "PRESALE") {
-        pushData.push(
-          {
-            title: "棰勫敭鏃堕棿",
-            slot: "price",
-          }
-        );
-      }
+      // if (this.baseInfoForm.salesModel !== "PRESALE") {
+      //   pushData.push(
+      //     {
+      //       title: "棰勫敭鏃堕棿",
+      //       slot: "price",
+      //     }
+      //   );
+      // }
       if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) {
         this.wholesaleData.forEach((item, index) => {
           pushData.push({
@@ -1817,6 +1831,7 @@
      * array spec鏁版嵁
      */
     specIterator(result, spec, skus) {
+
       let table = result;
       if (spec.length > 0) {
         //娓呴櫎褰撳墠寰幆鐨勫垎缁�
@@ -1858,6 +1873,11 @@
       } else {
         this.skuIndex++;
       }
+
+      table.forEach((item,index) =>{
+        console.log("鍏冪礌:" + item +"index:" + (index +1))
+          item.sn = index + 1;
+      })
       return table;
     },
     /** 鏍规嵁鍒嗙被id鑾峰彇绯荤粺璁剧疆瑙勬牸淇℃伅*/
@@ -1915,6 +1935,7 @@
           return;
         }
       }
+
       // else if (item === "alertQuantity") {
       //   if (
       //     !/^[0-9]\d*$/.test(row[item]) ||
@@ -1989,20 +2010,20 @@
             }
             this.baseInfoForm.goodsId = this.goodsId;
             let submit = JSON.parse(JSON.stringify(this.baseInfoForm));
-            console.log('----------------->鎻愪氦',submit);
+            console.log('----------------->鎻愪氦', submit);
             if (
               submit.goodsGalleryFiles &&
-                submit.goodsGalleryFiles.length <= 0
+              submit.goodsGalleryFiles.length <= 0
             ) {
               this.submitLoading = false;
               this.$Message.error("璇蜂笂浼犲晢鍝佸浘鐗�");
               return;
             }
-            if (!submit.goodsVideo){
-              this.submitLoading = false;
-              this.$Message.error("璇蜂笂浼犲晢鍝佽棰�");
-              return;
-            }
+            // if (!submit.goodsVideo){
+            //   this.submitLoading = false;
+            //   this.$Message.error("璇蜂笂浼犲晢鍝佽棰�");
+            //   return;
+            // }
             if (submit.templateId === "") submit.templateId = 0;
             let flag = false;
             let paramValue = "";
@@ -2167,18 +2188,18 @@
           this.$Message.error("鍒锋柊澶辫触锛岃閲嶈瘯");
         }
       }).catch(reason => {
-        console.log("鑾峰彇妯℃澘澶辫触",reason)
+        console.log("鑾峰彇妯℃澘澶辫触", reason)
       });
     },
-    removeVideo(){
+    removeVideo() {
       this.baseInfoForm.showGoodsVideo = null;
       this.baseInfoForm.goodsVideo = null;
     },
     // todo 鏂囦欢涓婁紶
     async upLoadImg(file) {
-      console.log(file,this.count++);
-      if (this.listImages.length >= 5) {
-        this.$Message.error("鍥剧墖涓婁紶涓嶈兘瓒呰繃5涓�");
+      console.log(file, this.count++);
+      if (this.listImages.length >= 10) {
+        this.$Message.error("鍥剧墖涓婁紶涓嶈兘瓒呰繃10涓�");
         return;
       }
       try {
@@ -2295,12 +2316,10 @@
         this.baseInfoForm.goodsType = this.firstData.goodsType;
 
 
-
-
-        if (this.categoryId!=null && this.categoryId!=='') {
+        if (this.categoryId != null && this.categoryId !== '') {
           /** 鑾峰彇璇ュ晢鍩庡垎绫讳笅 鍟嗗搧鍙傛暟淇℃伅 */
           this.GET_GoodsParams();
-          console.log('鍒嗙被id------------------>',this.categoryId);
+          console.log('鍒嗙被id------------------>', this.categoryId);
           /** 鏌ヨ鍒嗙被缁戝畾鐨勮鏍间俊鎭� */
           this.Get_SkuInfoByCategory(this.categoryId);
           /** 鏌ヨ鍝佺墝鍒楄〃 */

--
Gitblit v1.8.0