|
@@ -1,6 +1,7 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="page shop-cart-page" :class="{ page_red: theme === 1 }">
|
3
|
3
|
<div class="page__top">
|
|
4
|
+ <span class="quick-add" @click="jump('/pages/manage/add-good-form')">新增</span>
|
4
|
5
|
<div class="search">
|
5
|
6
|
<i class="iconfont icontubiao- search__icon"></i>
|
6
|
7
|
<input
|
|
@@ -279,25 +280,52 @@
|
279
|
280
|
</div>
|
280
|
281
|
</div>
|
281
|
282
|
</div>
|
|
283
|
+ <!-- 单商品价格 -->
|
282
|
284
|
<uni-popup ref="popup" type="dialog">
|
283
|
285
|
<uni-popup-dialog
|
284
|
286
|
mode="input"
|
285
|
287
|
:title="'修改价格'"
|
286
|
288
|
:content="rePriceText"
|
|
289
|
+ :value="rePriceValue"
|
287
|
290
|
placeholder="请输入修改后的价格"
|
288
|
291
|
@confirm="setPriceConfirm"
|
289
|
292
|
></uni-popup-dialog>
|
290
|
293
|
</uni-popup>
|
291
|
|
-
|
|
294
|
+ <!-- 多规格商品价格 -->
|
|
295
|
+ <uni-popup ref="popupPriceSkus" type="dialog">
|
|
296
|
+ <uni-popup-spec
|
|
297
|
+ mode="input"
|
|
298
|
+ :title="'修改价格'"
|
|
299
|
+ :content="rePriceText"
|
|
300
|
+ :skuData="rePriceSkuData"
|
|
301
|
+ :nameType="'price'"
|
|
302
|
+ placeholder="请输入修改后的价格"
|
|
303
|
+ @confirm="setSkusPriceConfirm"
|
|
304
|
+ ></uni-popup-spec>
|
|
305
|
+ </uni-popup>
|
|
306
|
+ <!-- 单规格库存 -->
|
292
|
307
|
<uni-popup ref="dialogPopup" type="dialog">
|
293
|
308
|
<uni-popup-dialog
|
294
|
309
|
mode="input"
|
295
|
310
|
:title="'修改库存'"
|
296
|
311
|
:content="reStockText"
|
|
312
|
+ :value="reStockValue"
|
297
|
313
|
placeholder="请输入修改后的库存"
|
298
|
314
|
@confirm="setStockConfirm"
|
299
|
315
|
></uni-popup-dialog>
|
300
|
316
|
</uni-popup>
|
|
317
|
+ <!-- 多规格商品库存 -->
|
|
318
|
+ <uni-popup ref="popupStockSkus" type="dialog">
|
|
319
|
+ <uni-popup-spec
|
|
320
|
+ mode="input"
|
|
321
|
+ :title="'修改库存'"
|
|
322
|
+ :content="reStockText"
|
|
323
|
+ :skuData="reStockSkuData"
|
|
324
|
+ :nameType="'stock'"
|
|
325
|
+ placeholder="请输入修改后的库存"
|
|
326
|
+ @confirm="setSkusStockConfirm"
|
|
327
|
+ ></uni-popup-spec>
|
|
328
|
+ </uni-popup>
|
301
|
329
|
|
302
|
330
|
<div
|
303
|
331
|
class="canvas"
|
|
@@ -330,11 +358,12 @@
|
330
|
358
|
import MyImage from "../../components/image/index";
|
331
|
359
|
import uniPopup from "../../components/uni-popup/uni-popup";
|
332
|
360
|
import uniPopupDialog from "../../components/uni-popup/uni-popup-dialog";
|
|
361
|
+import uniPopupSpec from "../../components/uni-popup/uni-popup-spec";
|
333
|
362
|
import config from "../../common/js/config";
|
334
|
363
|
import MyShare from "../../components/share/index";
|
335
|
364
|
export default {
|
336
|
365
|
name: "",
|
337
|
|
- components: { MyImage, uniPopup, uniPopupDialog, MyShare },
|
|
366
|
+ components: { MyImage, uniPopup, uniPopupDialog, MyShare, uniPopupSpec },
|
338
|
367
|
// 数据
|
339
|
368
|
data() {
|
340
|
369
|
return {
|
|
@@ -357,10 +386,14 @@ export default {
|
357
|
386
|
|
358
|
387
|
// 修改价格文字
|
359
|
388
|
rePriceText: "",
|
|
389
|
+ rePriceValue: "",
|
360
|
390
|
rePriceData: {},
|
|
391
|
+ rePriceSkuData: {},
|
361
|
392
|
// 修改库存文字
|
362
|
393
|
reStockText: "",
|
|
394
|
+ reStockValue: "",
|
363
|
395
|
reStockData: {},
|
|
396
|
+ reStockSkuData: {},
|
364
|
397
|
// 上下架状态
|
365
|
398
|
typeStatus: 1,
|
366
|
399
|
// 搜索
|
|
@@ -597,10 +630,33 @@ export default {
|
597
|
630
|
|
598
|
631
|
// 改价
|
599
|
632
|
setPrice(val) {
|
600
|
|
- this.rePriceText = "当前价格:" + val.price / 100 + "元";
|
601
|
|
- this.rePriceData = val;
|
602
|
|
- this.$refs.popup.open({
|
603
|
|
- type: "dialog",
|
|
633
|
+ uni.showLoading({
|
|
634
|
+ title: "加载中...",
|
|
635
|
+ });
|
|
636
|
+ this.api.get("/Product/Detail", { id: val.id }).then((res) => {
|
|
637
|
+ uni.hideLoading();
|
|
638
|
+ console.log(res.data);
|
|
639
|
+ if (!res.data.skuInfo) {
|
|
640
|
+ // 单商品
|
|
641
|
+ this.rePriceText = val.name;
|
|
642
|
+ this.rePriceValue = val.price / 100;
|
|
643
|
+ this.rePriceData = val;
|
|
644
|
+ this.$refs.popup.open({
|
|
645
|
+ type: "dialog",
|
|
646
|
+ });
|
|
647
|
+ } else {
|
|
648
|
+ // 多商品
|
|
649
|
+ this.rePriceData = res.data;
|
|
650
|
+ this.rePriceText = val.name;
|
|
651
|
+ let data = JSON.parse(res.data.skuInfo);
|
|
652
|
+ for (let item of data.skus) {
|
|
653
|
+ item.price /= 100;
|
|
654
|
+ }
|
|
655
|
+ this.rePriceSkuData = data;
|
|
656
|
+ this.$refs.popupPriceSkus.open({
|
|
657
|
+ type: "dialog",
|
|
658
|
+ });
|
|
659
|
+ }
|
604
|
660
|
});
|
605
|
661
|
},
|
606
|
662
|
|
|
@@ -636,12 +692,48 @@ export default {
|
636
|
692
|
}
|
637
|
693
|
},
|
638
|
694
|
|
|
695
|
+ setSkusPriceConfirm(done, value) {
|
|
696
|
+ console.log(value);
|
|
697
|
+ for (let item of value.skus) {
|
|
698
|
+ item.price = parseInt(Number(item.price) * 100);
|
|
699
|
+ }
|
|
700
|
+ this.rePriceData.skuInfo = JSON.stringify(value);
|
|
701
|
+ this.api.post("/product/SaveEdit", this.rePriceData).then((res) => {
|
|
702
|
+ if (res.success) {
|
|
703
|
+ this.fn.showToast("修改成功");
|
|
704
|
+ done();
|
|
705
|
+ } else {
|
|
706
|
+ this.fn.showToast("修改失败");
|
|
707
|
+ }
|
|
708
|
+ });
|
|
709
|
+ },
|
|
710
|
+
|
639
|
711
|
// 改库存
|
640
|
712
|
setStock(val) {
|
641
|
|
- this.reStockText = "当前库存:" + val.stock;
|
642
|
|
- this.reStockData = val;
|
643
|
|
- this.$refs.dialogPopup.open({
|
644
|
|
- type: "dialog",
|
|
713
|
+ uni.showLoading({
|
|
714
|
+ title: "加载中...",
|
|
715
|
+ });
|
|
716
|
+ this.api.get("/Product/Detail", { id: val.id }).then((res) => {
|
|
717
|
+ uni.hideLoading();
|
|
718
|
+ console.log(res.data);
|
|
719
|
+ if (!res.data.skuInfo) {
|
|
720
|
+ // 单商品
|
|
721
|
+ this.reStockText = val.name;
|
|
722
|
+ this.reStockValue = val.stock;
|
|
723
|
+ this.reStockData = val;
|
|
724
|
+ this.$refs.dialogPopup.open({
|
|
725
|
+ type: "dialog",
|
|
726
|
+ });
|
|
727
|
+ } else {
|
|
728
|
+ // 多商品
|
|
729
|
+ this.reStockData = res.data;
|
|
730
|
+ this.reStockText = val.name;
|
|
731
|
+ let data = JSON.parse(res.data.skuInfo);
|
|
732
|
+ this.reStockSkuData = data;
|
|
733
|
+ this.$refs.popupStockSkus.open({
|
|
734
|
+ type: "dialog",
|
|
735
|
+ });
|
|
736
|
+ }
|
645
|
737
|
});
|
646
|
738
|
},
|
647
|
739
|
|
|
@@ -675,6 +767,22 @@ export default {
|
675
|
767
|
}
|
676
|
768
|
},
|
677
|
769
|
|
|
770
|
+ setSkusStockConfirm(done, value) {
|
|
771
|
+ // console.log(value);
|
|
772
|
+ for (let item of value.skus) {
|
|
773
|
+ item.stock = Number(item.stock);
|
|
774
|
+ }
|
|
775
|
+ this.reStockData.skuInfo = JSON.stringify(value);
|
|
776
|
+ this.api.post("/product/SaveEdit", this.reStockData).then((res) => {
|
|
777
|
+ if (res.success) {
|
|
778
|
+ this.fn.showToast("修改成功");
|
|
779
|
+ done();
|
|
780
|
+ } else {
|
|
781
|
+ this.fn.showToast("修改失败");
|
|
782
|
+ }
|
|
783
|
+ });
|
|
784
|
+ },
|
|
785
|
+
|
678
|
786
|
shareLoading(id, status) {
|
679
|
787
|
for (let item of this.goodsList) {
|
680
|
788
|
if (item.id === id) {
|
|
@@ -1808,4 +1916,10 @@ page {
|
1808
|
1916
|
.remove-icon {
|
1809
|
1917
|
padding-left: px(20);
|
1810
|
1918
|
}
|
|
1919
|
+.quick-add{
|
|
1920
|
+ font-size: px(44);
|
|
1921
|
+ color: rgb(0, 188, 38);
|
|
1922
|
+ flex-shrink: 0;
|
|
1923
|
+ margin-right: px(30);
|
|
1924
|
+}
|
1811
|
1925
|
</style>
|