Browse Source

添加产品更改

xialei 1 year ago
parent
commit
7b7950e38d
1 changed files with 145 additions and 112 deletions
  1. 145 112
      src/views/product/addProduct/index.vue

+ 145 - 112
src/views/product/addProduct/index.vue

@@ -186,23 +186,23 @@
186 186
             </el-form-item> -->
187 187
             <!-- 编辑进来的 -->
188 188
             <div v-if="formValidate.volunteer == false && merInfo.mer_id != 496">
189
-              <el-form-item label="商品类型:">
189
+              <!-- <el-form-item label="商品类型:"> -->
190 190
                 <!-- sadasdasd -->
191
-                <el-radio-group v-model="radio" @change="Typeshang">
192
-                  <el-radio label="1">普通商品</el-radio>
191
+                <!-- <el-radio-group v-model="radio" @change="Typeshang">
192
+                  <el-radio label="1">普通商品</el-radio> -->
193 193
                   <!-- <el-radio :label="2">事业一部</el-radio> -->
194 194
                   <!-- <el-radio :label="5" v-if="this.merchant_type == 3">大仓商品</el-radio> -->
195
-                  <el-radio v-if="specialMerchant == 'beishengtang'" label="7">积分商品</el-radio>
195
+                  <!-- <el-radio v-if="specialMerchant == 'beishengtang'" label="7">积分商品</el-radio> -->
196 196
 
197
-                  <el-radio v-if="merInfo.mer_type == '1'" label="8">会员商品</el-radio>
197
+                  <!-- <el-radio v-if="merInfo.mer_type == '1'" label="8">会员商品</el-radio>
198 198
                   <el-radio v-if="merInfo.mer_type == '1'" label="10">高级会员商品</el-radio>
199 199
                   <el-radio v-if="merInfo.mer_type == '1'" label="14">合伙人商品</el-radio>
200 200
                   <el-radio v-if="merInfo.mer_type == '1'" label="15">股权商品</el-radio>
201 201
                   <el-radio v-if="merInfo.mer_type == '1'" label="16">合伙人+股权商品</el-radio>
202
-                  <el-radio v-if="merInfo.mer_type == '2'" label="17">合伙人商品</el-radio>
202
+                  <el-radio v-if="merInfo.mer_type == '2'" label="17">合伙人商品</el-radio> -->
203 203
                   <!-- <el-radio :label="3">消费积分商品</el-radio> -->
204
-                </el-radio-group>
205
-              </el-form-item>
204
+                <!-- </el-radio-group>
205
+              </el-form-item> -->
206 206
 
207 207
               <!-- <el-form-item label="佣金:" prop="commission1" v-show="type == 2">
208 208
                 <div style="display: flex;">
@@ -239,7 +239,7 @@
239 239
               </el-radio-group>
240 240
             </el-form-item>
241 241
 
242
-            <el-form-item v-if="extensionStatus>0 && merInfo.mer_id != 496" label="佣金设置:" props="extension_type">
242
+            <el-form-item v-if="extensionStatus>0 && merInfo.mer_id != 496" label="分润设置:" props="extension_type">
243 243
               <el-radio-group v-model="formValidate.extension_type" @change="onChangetype(formValidate.extension_type)">
244 244
                 <el-radio label="1" class="radio">单独设置</el-radio>
245 245
                 <el-radio label="0" :disabled="formValidate.volunteer == 1?true:false">默认设置</el-radio>
@@ -324,7 +324,7 @@
324 324
           </el-col>
325 325
           <!-- 批量设置-->
326 326
           <el-col v-if="formValidate.spec_type == 1 && formValidate.attr.length>0" :span="24" class="noForm">
327
-            <el-form-item label="批量设置:" class="labeltop">
327
+            <!-- <el-form-item label="批量设置:" class="labeltop">
328 328
               <el-table :data="oneFormBatch" border class="tabNumWidth" size="mini">
329 329
                 <el-table-column align="center" label="图片" min-width="80">
330 330
                   <template slot-scope="scope">
@@ -336,19 +336,6 @@
336 336
                     </div>
337 337
                   </template>
338 338
                 </el-table-column>
339
-                <!-- 多规格大仓价格 -->
340
-                <!-- <template v-if="this.type == 5">
341
-                  <el-table-column align="center" label="大仓价格" min-width="120">
342
-                    <template slot-scope="scope">
343
-                      <el-input v-model="scope.row.dacang_price" type="number" :min="0" class="priceBox" />
344
-                    </template>
345
-                  </el-table-column>
346
-                </template> -->
347
-                <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
348
-                  <template slot-scope="scope">
349
-                    <el-input v-model="scope.row[iii]" :type="formThead[iii].title==='商品编号'?'text':'number'" :min="0" class="priceBox" placeholder="请输入" />
350
-                  </template>
351
-                </el-table-column>
352 339
 
353 340
                 <template v-if="merInfo.mer_id == 496">
354 341
                   <template v-if="formValidate.share_is == 1">
@@ -386,28 +373,46 @@
386 373
                 </template>
387 374
                 <template v-else>
388 375
                   <template v-if="formValidate.extension_type == 1">
389
-                    <el-table-column align="center" label="返佣(%)" min-width="120">
376
+                    <el-table-column align="center" label="分润比例(%)" min-width="120">
390 377
                       <template slot-scope="scope">
391 378
                         <el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
392 379
                       </template>
393
-                    </el-table-column>
380
+                    </el-table-column> -->
394 381
                     <!-- <el-table-column align="center" label="二级返佣(元)" min-width="120">
395 382
                           <template slot-scope="scope">
396 383
                             <el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
397 384
                           </template>
398 385
                         </el-table-column> -->
386
+                  <!-- </template>
387
+                </template> -->
388
+
389
+                <!-- 多规格大仓价格 -->
390
+                <!-- <template v-if="this.type == 5">
391
+                  <el-table-column align="center" label="大仓价格" min-width="120">
392
+                    <template slot-scope="scope">
393
+                      <el-input v-model="scope.row.dacang_price" type="number" :min="0" class="priceBox" />
394
+                    </template>
395
+                  </el-table-column>
396
+                </template> -->
397
+                <!-- <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
398
+                  <template slot-scope="scope">
399
+                    <el-input  @input="handleInput(scope.row,scope.formThead[iii].title)" :disabled="formThead[iii].title==='销售价格'?'text':disabled" v-model="scope.row[iii]"  :type="formThead[iii].title==='商品编号'?'text':'number'" :min="0" class="priceBox" placeholder="请输入" />
399 400
                   </template>
400
-                </template>
401
+                </el-table-column> -->
401 402
 
403
+           
404
+<!-- 
402 405
                 <el-table-column align="center" label="操作" min-width="80">
403 406
                   <template>
404 407
                     <el-button type="text" class="submission" @click="batchAdd">批量添加</el-button>
405 408
                   </template>
406 409
                 </el-table-column>
407 410
               </el-table>
408
-            </el-form-item>
411
+            </el-form-item> -->
409 412
           </el-col>
410 413
           <el-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
414
+
415
+
411 416
             <!-- 单规格表格-->
412 417
             <el-form-item v-if="formValidate.spec_type == 0">
413 418
               <el-table :data="OneattrValue" border class="tabNumWidth" size="mini">
@@ -430,22 +435,6 @@
430 435
                   </el-table-column>
431 436
                 </template> -->
432 437
 
433
-                <template v-if="this.Spu_id==null||this.Spu_id==''||this.Spu_id==undefined">
434
-                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
435
-                    <template slot-scope="scope">
436
-                      <el-input v-model="scope.row[iii]" :type="formThead[iii].title==='商品编号'?'text':'number'" :min="0" class="priceBox" placeholder="请输入" />
437
-                    </template>
438
-                  </el-table-column>
439
-                </template>
440
-
441
-                <template v-else>
442
-                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
443
-                    <template slot-scope="scope">
444
-                      <el-input v-model="scope.row[iii]" :disabled="formThead[iii].title==='成本价'?'text':disabled" :type="formThead[iii].title==='商品编号'?'text':'number'" :min="0" class="priceBox" placeholder="请输入" />
445
-                    </template>
446
-                  </el-table-column>
447
-                </template>
448
-
449 438
                 <template v-if="merInfo.mer_id == 496">
450 439
                   <template v-if="formValidate.share_is == 1">
451 440
                     <el-table-column align="center" label="分享奖(%)" min-width="120">
@@ -479,27 +468,45 @@
479 468
 
480 469
                 </template>
481 470
                 <template v-else>
482
-
483 471
                   <template v-if="formValidate.extension_type == 1">
484
-                    <el-table-column align="center" label="返利比例" min-width="120">
485
-                      <template slot-scope="scope">
486
-                        <el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
487
-                      </template>
488
-                    </el-table-column>
489
-                    <!-- <el-table-column align="center" label="大仓价格" min-width="120">
490
-                      <template slot-scope="scope">
491
-                        <el-input v-model="scope.row.dacang_price" type="number" :min="0" class="priceBox" />
492
-                      </template>
493
-                    </el-table-column> -->
494
-                    <!-- <el-table-column align="center" label="二级返佣(元)" min-width="120">
495
-                      <template slot-scope="scope">
496
-                        <el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
497
-                      </template>
498
-                    </el-table-column> -->
472
+                  <el-table-column align="center" label="分润比例" min-width="125">
473
+                    <template slot-scope="scope">
474
+                      <div style="display: flex;">
475
+                        <div style="width: 80px;flex: 1;"><el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" /></div>
476
+                        <div style="width: 10px;margin-top: 10px;"><b>%</b></div>
477
+                      </div>
478
+                    </template>
479
+                  </el-table-column>
499 480
                   </template>
500 481
                 </template>
482
+
483
+                <template v-if="this.Spu_id==null||this.Spu_id==''||this.Spu_id==undefined">
484
+                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
485
+                    <template slot-scope="scope">
486
+                      <el-input @input="handleInput(scope.row,formThead[iii].title)" v-model="scope.row[iii]" :disabled="formThead[iii].title==='销售价格'?'text':disabled" :type="formThead[iii].title==='商品编号'?'text':'number'" :min="0" class="priceBox" placeholder="请输入" />
487
+                    </template>
488
+                  </el-table-column>
489
+                </template>
490
+
491
+                <template v-else>
492
+                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
493
+                    <template slot-scope="scope">
494
+                      <el-input v-model="scope.row[iii]" :disabled="formThead[iii].title==='成本价'?'text':disabled" :type="formThead[iii].title==='商品编号'?'text':'number'" :min="0" class="priceBox" placeholder="请输入" />
495
+                    </template>
496
+                  </el-table-column>
497
+                </template>
498
+
501 499
               </el-table>
502 500
             </el-form-item>
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
503 510
             <!-- 多规格表格-->
504 511
             <el-form-item v-if="formValidate.spec_type == 1 && formValidate.attr.length>0" class="labeltop" label="规格列表:">
505 512
               <el-table :data="ManyAttrValue" border class="tabNumWidth" size="mini">
@@ -535,70 +542,71 @@
535 542
                   </el-table-column>
536 543
                 </template> -->
537 544
 
538
-                <template v-if="this.Spu_ids==null || this.Spu_ids=='' || this.Spu_ids==undefined">
539
-                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
545
+                <template v-if="merInfo.mer_id == 496">
546
+
547
+                <template v-if="formValidate.share_is == 1">
548
+                  <el-table-column align="center" label="分享奖(%)" min-width="120">
540 549
                     <template slot-scope="scope">
541
-                      <el-input v-model="scope.row[iii]" :type="formThead[iii].title==='商品编号'?'text':'number'" class="priceBox" placeholder="请输入" />
550
+                      <el-input v-model="scope.row.share_num" placeholder="请输入" type="number" :min="0" :max="100" class="priceBox" @input="handleChangeShare" />
542 551
                     </template>
543 552
                   </el-table-column>
544 553
                 </template>
545
-                <template v-else>
546
-                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
554
+
555
+                <template v-if="formValidate.pension_is == 1">
556
+                  <el-table-column align="center" label="养老金(%)" min-width="120">
547 557
                     <template slot-scope="scope">
548
-                      <el-input v-model="scope.row[iii]" :disabled="formThead[iii].title==='成本价'?'text':disabled" :type="formThead[iii].title==='商品编号'?'text':'number'" class="priceBox" placeholder="请输入" />
558
+                      <el-input v-model="scope.row.pension_num" placeholder="请输入" type="number" :min="0" :max="100" class="priceBox" @input="handleChangePension" />
549 559
                     </template>
550 560
                   </el-table-column>
551
-                </template>
552
-
553
-                <template v-if="merInfo.mer_id == 496">
554 561
 
555
-                  <template v-if="formValidate.share_is == 1">
556
-                    <el-table-column align="center" label="分享奖(%)" min-width="120">
557
-                      <template slot-scope="scope">
558
-                        <el-input v-model="scope.row.share_num" placeholder="请输入" type="number" :min="0" :max="100" class="priceBox" @input="handleChangeShare" />
559
-                      </template>
560
-                    </el-table-column>
561
-                  </template>
562
+                </template>
562 563
 
563
-                  <template v-if="formValidate.pension_is == 1">
564
-                    <el-table-column align="center" label="养老金(%)" min-width="120">
565
-                      <template slot-scope="scope">
566
-                        <el-input v-model="scope.row.pension_num" placeholder="请输入" type="number" :min="0" :max="100" class="priceBox" @input="handleChangePension" />
567
-                      </template>
568
-                    </el-table-column>
564
+                <template>
565
+                  <el-table-column align="center" label="分红股权(%)" min-width="120">
566
+                    <template slot-scope="scope">
567
+                      <el-input v-model="scope.row.stock_num" placeholder="请输入" type="number" :min="0" :max="100" class="priceBox" />
568
+                    </template>
569
+                  </el-table-column>
570
+                  <el-table-column align="center" label="股票数量" min-width="120">
571
+                    <template slot-scope="scope">
572
+                      <el-input v-model="scope.row.shares_num" placeholder="请输入" type="number" :min="0" class="priceBox" />
573
+                    </template>
574
+                  </el-table-column>
569 575
 
570
-                  </template>
576
+                </template>
577
+                </template>
578
+                <template v-else>
571 579
 
572
-                  <template>
573
-                    <el-table-column align="center" label="分红股权(%)" min-width="120">
574
-                      <template slot-scope="scope">
575
-                        <el-input v-model="scope.row.stock_num" placeholder="请输入" type="number" :min="0" :max="100" class="priceBox" />
576
-                      </template>
577
-                    </el-table-column>
578
-                    <el-table-column align="center" label="股票数量" min-width="120">
579
-                      <template slot-scope="scope">
580
-                        <el-input v-model="scope.row.shares_num" placeholder="请输入" type="number" :min="0" class="priceBox" />
581
-                      </template>
582
-                    </el-table-column>
580
+                <template v-if="formValidate.extension_type == 1">
581
+                  <el-table-column align="center" label="分润比例(%)" min-width="120">
582
+                    <template slot-scope="scope">
583
+                      <el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
584
+                    </template>
585
+                  </el-table-column>
586
+                  <!-- <el-table-column align="center" label="二级返佣(元)" min-width="120">
587
+                                    <template slot-scope="scope">
588
+                                      <el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
589
+                                    </template>
590
+                                  </el-table-column> -->
591
+                </template>
592
+                </template>
583 593
 
584
-                  </template>
594
+                <template v-if="this.Spu_ids==null || this.Spu_ids=='' || this.Spu_ids==undefined">
595
+                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
596
+                    <template slot-scope="scope">
597
+                      <el-input v-model="scope.row[iii]" @input="handleInput(scope.row,formThead[iii].title)" :disabled="formThead[iii].title==='销售价格'?'text':disabled" :type="formThead[iii].title==='商品编号'?'text':'number'" class="priceBox" placeholder="请输入" />
598
+                    </template> 
599
+                  </el-table-column>
585 600
                 </template>
586 601
                 <template v-else>
587
-
588
-                  <template v-if="formValidate.extension_type == 1">
589
-                    <el-table-column align="center" label="一级返佣(%)" min-width="120">
590
-                      <template slot-scope="scope">
591
-                        <el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
592
-                      </template>
593
-                    </el-table-column>
594
-                    <!-- <el-table-column align="center" label="二级返佣(元)" min-width="120">
595
-                                      <template slot-scope="scope">
596
-                                        <el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
597
-                                      </template>
598
-                                    </el-table-column> -->
599
-                  </template>
602
+                  <el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
603
+                    <template slot-scope="scope">
604
+                      <el-input v-model="scope.row[iii]" :disabled="formThead[iii].title==='成本价'?'text':disabled" :type="formThead[iii].title==='商品编号'?'text':'number'" class="priceBox" placeholder="请输入" />
605
+                    </template>
606
+                  </el-table-column>
600 607
                 </template>
601 608
 
609
+
602 610
               </el-table>
603 611
             </el-form-item>
604 612
           </el-col>
@@ -617,6 +625,8 @@ import ueditorFrom from '@/components/ueditorFrom'
617 625
 import { shippingListApi, templateLsitApi, productCreateApi, productDetailApi, categorySelectApi, categoryListApi, categoryBrandListApi, productUpdateApi, productConfigApi } from '@/api/product'
618 626
 import { getBaseInfo } from '@/api/user'
619 627
 import { roterPre } from '@/settings'
628
+import { getMerchantProfitApi } from '@/api/setting.js'
629
+import { B } from 'af-table-column'
620 630
 const defaultObj = {
621 631
   dacang_price: '',
622 632
   image: '',
@@ -633,8 +643,8 @@ const defaultObj = {
633 643
   temp_id: '',
634 644
   attrValue: [{
635 645
     image: '',
636
-    price: null,
637 646
     cost: null,
647
+    price: null,
638 648
     ot_price: null,
639 649
     stock: null,
640 650
     bar_code: '',
@@ -662,13 +672,13 @@ const defaultObj = {
662 672
 
663 673
 }
664 674
 const objTitle = {
665
-  price: {
666
-    title: '售价'
667
-  },
668 675
   // no_dacang_cost_price
669 676
   // dacang_cost_price
670 677
   cost: {
671
-    title: '成本价'
678
+    title: '成本价格'
679
+  },
680
+  price: {
681
+    title: '销售价格'
672 682
   },
673 683
   ot_price: {
674 684
     title: '原价'
@@ -863,9 +873,32 @@ export default {
863 873
     this.getBrandListApi()
864 874
     this.getShippingList()
865 875
     this.productCon()
876
+    this.getMerchantProfit()
866 877
   },
867 878
   methods: {
879
+    handleInput(value, title) {
880
+      if(title == '成本价格'){
881
+        console.log('输入的内容:', value);
882
+        var bili = value.extension_one / 100;//比例
883
+        var gong_mer_profit = value.cost * bili//利润
884
+        var gong_market_price = Number(value.cost) + Number(gong_mer_profit)//加入利润后的价格
885
+        var plate_mer_profit = gong_mer_profit;
886
+        value.price = gong_market_price
887
+        value.gong_mer_profit = gong_mer_profit
888
+        value.gong_market_price = gong_market_price
889
+        value.plate_mer_profit = plate_mer_profit
890
+        console.log('计算的内容:', value);
891
+      }
892
+      // 这里可以执行其他逻辑,如发送数据到服务器等
893
+    },
894
+    // 获取商户分润比例
895
+    getMerchantProfit() {
896
+      getMerchantProfitApi().then(res => {
868 897
 
898
+      }).catch(err => {
899
+        this.$message.error(err.message)
900
+      })
901
+    },
869 902
     // 监测输入框的值是否变化
870 903
     handleChangeShare(value) {
871 904
       console.log('输入的', value)