jufubao-admin-library 1.1.205 → 1.1.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -134,6 +134,17 @@
134
134
  <el-form-item prop="spider_url" label="产品来源地址">
135
135
  <el-input v-model="setForm.spider_url" placeholder="请输入"></el-input>
136
136
  </el-form-item>
137
+ <div v-if="setForm.skus.length">
138
+ <el-table :data="setForm.skus" style="width: 100%" border>
139
+ <el-table-column prop="product_sku_name" label="规格名称" width="120"></el-table-column>
140
+ <el-table-column prop="spider_url" label="产品来源地址">
141
+ <template slot-scope="scope">
142
+ <el-input v-model="scope.row.spider_url" placeholder="请输入"></el-input>
143
+ </template>
144
+ </el-table-column>
145
+ </el-table>
146
+ </div>
147
+
137
148
  </el-form>
138
149
  </xd-dialog>
139
150
  <xd-dialog :show.sync="showOpen" title="发票名称设置" width="600px" @onConfirm="handleOpenConfirm">
@@ -409,6 +420,7 @@ export default {
409
420
  this.setForm.partner_product_tags = info.data['entity']['partner_product_tags']
410
421
  this.setForm.public = info.data['entity']['is_public']
411
422
  this.setForm.spider_url = info.data['entity']['spider_url']
423
+ this.setForm.skus = info.data['entity']['skus']
412
424
  this.showPublicSet = true
413
425
  }
414
426
  //开票设置
@@ -860,6 +872,7 @@ export default {
860
872
  is_public: this.setForm.public,
861
873
  partner_product_tags:this.setForm.partner_product_tags,
862
874
  spider_url:this.setForm.spider_url,
875
+ skus: this.setForm.skus
863
876
  }
864
877
  }).then(res => {
865
878
  console.log(res)
@@ -159,6 +159,7 @@
159
159
  {"type": "normal", "prop": "volume", "align": "left", "min-width": 80, "label": "体积"},
160
160
  {"type": "normal", "prop": "product_code", "align": "left", "min-width": 80, "label": "商品编码"},
161
161
  {"type": "normal", "prop": "product_bar_code", "align": "left", "min-width": 80, "label": "商品条码"},
162
+ {"type": "normal", "prop": "spider_url", "align": "left", "min-width": 80, "label": "产品来源地址"},
162
163
  {
163
164
  type: "operate",
164
165
  align: "center",
@@ -190,7 +191,7 @@
190
191
  getTableDataFromResponseData(data = []) {
191
192
  let list = this.$xdHelper.cloneDeep(data);
192
193
  return list.map((item) => {
193
- let {specs, stocks, sku_uniq_id, standards,product_sku} = item;
194
+ let {specs, stocks, sku_uniq_id, standards,product_sku, spider_url} = item;
194
195
  let imgStandIndex = standards.findIndex((ss) => ss.image);
195
196
  if (imgStandIndex > -1) {
196
197
  let imgUrl = standards[imgStandIndex].image;
@@ -226,6 +227,7 @@
226
227
  sku_uniq_id,
227
228
  product_sku,
228
229
  standards,
230
+ spider_url
229
231
  };
230
232
  });
231
233
  },
@@ -132,6 +132,26 @@
132
132
  ></xd-pagination-jfb>
133
133
  </div>
134
134
  </el-card>
135
+ <xd-dialog
136
+ :title="stockTitle"
137
+ v-if="showStockDialog"
138
+ :show.sync="showStockDialog"
139
+ width="500px"
140
+ @onCancel="handleCancelStock"
141
+ @onConfirm="handleConfirmStock"
142
+ >
143
+ <el-form ref="stockForm" :model="stockForm" :rules="stockRules" label-width="120px">
144
+ <el-form-item label="秒杀库存数量:" prop="total_stock">
145
+ <el-input
146
+ v-model="stockForm.total_stock"
147
+ placeholder="请输入秒杀库存数量"
148
+ type="number"
149
+ min="0"
150
+ max="99999"
151
+ ></el-input>
152
+ </el-form-item>
153
+ </el-form>
154
+ </xd-dialog>
135
155
  </div>
136
156
  </template>
137
157
 
@@ -194,7 +214,7 @@ export default {
194
214
  lazy: true,
195
215
  lazyLoad(node, resolve) {
196
216
  getOptions({
197
- server: "product-partner",
217
+ server: 'product-partner',
198
218
  fn: "categories",
199
219
  path: "p4",
200
220
  params: {
@@ -310,6 +330,35 @@ export default {
310
330
  ],
311
331
  searchOtherForm: {},
312
332
  cityData: [],
333
+ stockTitle: "",
334
+ showStockDialog: false,
335
+ stockForm: {
336
+ total_stock: '',
337
+ },
338
+ stockRules: {
339
+ total_stock: [
340
+ { required: true, message: '请输入秒杀库存数量', trigger: 'blur' },
341
+ {
342
+ validator: (rule, value, callback) => {
343
+ const num = Number(value);
344
+ if (value === '' || value === null || value === undefined) {
345
+ callback(new Error('请输入秒杀库存数量'));
346
+ } else if (isNaN(num)) {
347
+ callback(new Error('请输入有效的数字'));
348
+ } else if (num < 0) {
349
+ callback(new Error('库存数量不能小于0'));
350
+ } else if (num > 99999) {
351
+ callback(new Error('库存数量不能超过99999'));
352
+ } else {
353
+ callback();
354
+ }
355
+ },
356
+ trigger: 'blur'
357
+ }
358
+ ]
359
+ },
360
+ stock_type: "",
361
+ selectProductIds: [], // 当前选中的商品ID列表(单个或批量)
313
362
  };
314
363
  },
315
364
  computed: {
@@ -364,7 +413,7 @@ export default {
364
413
  let cityData = await this.getAllCityList();
365
414
  this.cityData = cityData.data.list;
366
415
  await getOptions({
367
- server: "supplier-partner",
416
+ server: 'supplier-partner',
368
417
  fn: "supplier-channel",
369
418
  path: "p1",
370
419
  params: {
@@ -387,6 +436,11 @@ export default {
387
436
  console.log(setting,'ssss')
388
437
  this.initSearchForm();
389
438
  await this.getList();
439
+ this.activityGet({
440
+ activity_id: this.activity_id
441
+ }).then(res => {
442
+ this.stock_type = res.data.stock_type;
443
+ })
390
444
  },
391
445
 
392
446
  methods: {
@@ -397,6 +451,7 @@ export default {
397
451
  "getActivityCodeCount",
398
452
  "getPolicyListSetting"
399
453
  ]),
454
+ ...mapActions("flashsale", ["updateStock", "activityGet"]),
400
455
 
401
456
  /**
402
457
  * @description 按钮操作
@@ -406,33 +461,109 @@ export default {
406
461
  */
407
462
  handleTableClick(row, value, idx) {
408
463
  if (value.event === "add") {
464
+ // stock_type === '0' 表示不限库存,直接添加不弹框
465
+ if (this.stock_type === '0') {
466
+ let data = {
467
+ session_id: this.session_id,
468
+ product_ids: [row.product_id], // 单个商品也包裹成数组
469
+ };
470
+ const loading = Loading.service({});
471
+ this.batchSessionAddProduct(data)
472
+ .then((res) => {
473
+ loading.close();
474
+ this.$message.success("添加成功");
475
+ this.getList();
476
+ })
477
+ .catch((err) => {
478
+ loading.close();
479
+ console.log(err, "err");
480
+ });
481
+ } else {
482
+ // 需要设置库存,显示弹框
483
+ this.stockTitle = "请配置商品限购库存";
484
+ this.stockForm = {
485
+ total_stock: '',
486
+ };
487
+ this.selectProductIds = [row.product_id]; // 单个商品也包裹成数组
488
+ this.showStockDialog = true;
489
+ }
490
+ }
491
+ },
492
+ handleBatchadd() {
493
+ // stock_type === '0' 表示不限库存,直接添加不弹框
494
+ if (this.stock_type === '0') {
409
495
  let data = {
410
496
  session_id: this.session_id,
411
- product_id: row.product_id,
497
+ product_ids: this.selectList,
412
498
  };
413
- this.sessionAddProduct(data)
499
+ const loading = Loading.service({});
500
+ this.batchSessionAddProduct(data)
414
501
  .then((res) => {
502
+ loading.close();
415
503
  this.$message.success("添加成功");
416
504
  this.getList();
417
505
  })
418
506
  .catch((err) => {
507
+ loading.close();
419
508
  console.log(err, "err");
420
509
  });
510
+ } else {
511
+ // 需要设置库存,显示弹框
512
+ this.stockTitle = "请配置商品限购库存";
513
+ this.stockForm = {
514
+ total_stock: '',
515
+ };
516
+ this.selectProductIds = this.selectList;
517
+ this.showStockDialog = true;
421
518
  }
422
519
  },
423
- handleBatchadd() {
424
- let data = {
425
- session_id: this.session_id,
426
- product_ids: this.selectList,
427
- };
428
- this.batchSessionAddProduct(data)
429
- .then((res) => {
430
- this.$message.success("添加成功");
431
- this.getList();
432
- })
433
- .catch((err) => {
434
- console.log(err, "err");
435
- });
520
+ /**
521
+ * @description 取消设置库存
522
+ */
523
+ handleCancelStock() {
524
+ this.showStockDialog = false;
525
+ },
526
+ /**
527
+ * @description 确认设置库存并添加商品
528
+ */
529
+ handleConfirmStock() {
530
+ this.$refs.stockForm.validate((valid) => {
531
+ if (valid) {
532
+ const totalStock = Number(this.stockForm.total_stock);
533
+ const loading = Loading.service({});
534
+ this.batchSessionAddProduct({
535
+ session_id: this.session_id,
536
+ product_ids: this.selectProductIds,
537
+ }).then((res) => {
538
+ // 设置库存
539
+ if (totalStock > 0) {
540
+ this.updateStock({
541
+ session_id: this.session_id,
542
+ product_ids: this.selectProductIds,
543
+ total_stock: totalStock,
544
+ }).then(() => {
545
+ loading.close();
546
+ this.$message.success("添加并设置库存成功");
547
+ this.showStockDialog = false;
548
+ this.getList();
549
+ }).catch((err) => {
550
+ loading.close();
551
+ console.log(err, "库存设置失败");
552
+ this.showStockDialog = false;
553
+ this.getList();
554
+ });
555
+ } else {
556
+ loading.close();
557
+ this.$message.success("添加成功");
558
+ this.showStockDialog = false;
559
+ this.getList();
560
+ }
561
+ }).catch((err) => {
562
+ loading.close();
563
+ console.log(err, "err");
564
+ });
565
+ }
566
+ });
436
567
  },
437
568
  /**
438
569
  * @description 点击搜索进行搜索操作
@@ -568,7 +699,7 @@ export default {
568
699
  console.log("remoteSearch", query, resolve);
569
700
  // $vm.handleRemoteSearch(query, resolve)
570
701
  getOptions({
571
- server: "supplier-partner",
702
+ server: 'supplier-partner',
572
703
  fn: "brand",
573
704
  path: "p1",
574
705
  params: {
@@ -639,7 +770,7 @@ export default {
639
770
  handleRemoteSearch({ query }, resolve) {
640
771
  console.log("handleRemoteSearch", query, resolve);
641
772
  getOptions({
642
- server: "supplier-partner",
773
+ server: 'supplier-partner',
643
774
  fn: "supplier",
644
775
  path: "p1",
645
776
  params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-admin-library",
3
- "version": "1.1.205",
3
+ "version": "1.1.207",
4
4
  "description": "聚福宝福利后台管理系统公共模块",
5
5
  "author": "goashiyong <gaoshiyong1272@vip.163.com>",
6
6
  "scripts": {