Browse Source

1. 暂存数据
2. 图片、类目回显
3. 暂存调用

郑杰 2 years ago
parent
commit
3593704bb9
1 changed files with 25 additions and 5 deletions
  1. 25 5
      seller/src/views/goods/goods-seller/goodsOperationFirst.vue

+ 25 - 5
seller/src/views/goods/goods-seller/goodsOperationFirst.vue

@@ -149,7 +149,7 @@
149 149
                     :props="cateProps"
150 150
                     :clearable="true"
151 151
                     :show-all-levels="false"
152
-                    v-model="scope.row.categoryPath"
152
+                    v-model="scope.row.categoryPathArr"
153 153
                     @change="handleCategoryChange(scope.row)"
154 154
                   />
155 155
                 </template>
@@ -184,6 +184,7 @@
184 184
         </template>
185 185
         <div style="float: right">
186 186
           <Button @click="modalVisible = false">删除数据</Button>
187
+          <Button @click="saveGoods">暂存数据</Button>
187 188
           <Button type="primary" :loading="submitLoading" @click="handleSubmit"
188 189
             >一键上架</Button
189 190
           >
@@ -414,7 +415,8 @@ export default {
414 415
                 // 获取未提交的导入
415 416
                 API_GOODS.UnSubmitOrder().then((res) => {
416 417
                   if (res.success) {
417
-                    this.goodsImported = res.result;
418
+                    this.initSelectTree();
419
+                    this.initImportGoods(res.result)
418 420
                     this.waitUpload = false;
419 421
                     this.showUploadPanel = true;
420 422
                   }
@@ -492,23 +494,41 @@ export default {
492 494
       let res = await API_GOODS.uploadGoodsExcel(fd);
493 495
       if (res.success) {
494 496
         this.addPicProps(res.result);
495
-        this.goodsImported = res.result;
496
-        console.log(this.goodsImported);
497
+        this.initImportGoods(res.result)
497 498
         this.waitUpload = false;
498 499
       }
499 500
     },
501
+    initImportGoods(interfaceRes){
502
+      interfaceRes.forEach(dat => {
503
+        if(dat.original){
504
+          dat.originalList = [{url: dat.original}]
505
+        }
506
+        if (dat.categoryPath){
507
+          dat.categoryPathArr = dat.categoryPath.split(",")
508
+        }
509
+      })
510
+      this.goodsImported = interfaceRes;
511
+    },
500 512
     addPicProps(data) {
501 513
       data.forEach((dat) => {
502 514
         dat.goodsGalleryFiles = [];
503 515
       });
504 516
     },
505 517
     handleCategoryChange(valArray) {
506
-      valArray.categoryPath = valArray.categoryPath.join(",");
518
+      valArray.categoryPath = valArray.categoryPathArr.join(",");
507 519
     },
508 520
     /** 获取是否又未提交的导入 */
509 521
     hasUnSubmit() {
510 522
       console.log("check");
511 523
     },
524
+    /** 暂存导入的商品 */
525
+    saveGoods(){
526
+      API_GOODS.saveImportGoods(this.goodsImported).then((res) => {
527
+        console.log(res);
528
+        console.log("save");
529
+      });
530
+    },
531
+    /** 一键上架 */
512 532
     handleSubmit() {
513 533
       API_GOODS.submitImportGoods(this.goodsImported).then((res) => {});
514 534
       console.log("submit");