cr лет назад: 4
Родитель
Сommit
5b5b587487
4 измененных файлов с 653 добавлено и 71 удалено
  1. 2 2
      src/pages/index/register.vue
  2. 5 5
      src/pages/manage/good-list.vue
  3. 27 25
      src/pages/youxuan/brand.vue
  4. 619 39
      src/pages/youxuan/good.vue

+ 2 - 2
src/pages/index/register.vue

@@ -373,9 +373,9 @@ export default {
373 373
             if (!this.form.teamNum) {
374 374
                 return this.fn.showToast(`请输入团长号`);
375 375
             }
376
-            let reg = /^9\d{9}$/;
376
+            let reg = /^\d{10}$/;
377 377
             if (!reg.test(this.form.teamNum)) {
378
-                return this.fn.showToast("团长号为9开头的10位数字");
378
+                return this.fn.showToast("团长号为10位数字");
379 379
             }
380 380
             uni.showLoading({
381 381
                 title: "提交中",

+ 5 - 5
src/pages/manage/good-list.vue

@@ -1309,11 +1309,6 @@ export default {
1309 1309
             }
1310 1310
         },
1311 1311
 
1312
-        closeSearchVal() {
1313
-            this.searchVal = "";
1314
-            this.getGoodsList();
1315
-        },
1316
-
1317 1312
         shareEnd() {
1318 1313
             this.shareRootLoading = false;
1319 1314
             if (this.shareLoadList.length > 0) {
@@ -1325,6 +1320,11 @@ export default {
1325 1320
             }
1326 1321
         },
1327 1322
 
1323
+        closeSearchVal() {
1324
+            this.searchVal = "";
1325
+            this.getGoodsList();
1326
+        },
1327
+
1328 1328
         openMore(item) {
1329 1329
             let arr = [];
1330 1330
             if (item.status === 0) {

+ 27 - 25
src/pages/youxuan/brand.vue

@@ -396,29 +396,30 @@ export default {
396 396
 
397 397
         // 推送
398 398
         pushGive(item,type) {
399
-            let sendData = {
400
-                pid: item.aid,
401
-                aid: item.aid,
402
-                // storeId: item.storeId,
403
-                platform:1000
404
-            };
405
-            if (type === "text") {
406
-                sendData.sendTxt = false;
407
-                sendData.sendVideo = false;
408
-                sendData.sendImg = 0;
409
-            } else {
410
-                // sendData.sendTxt = true;
411
-                // sendData.sendVideo = true;
412
-                // sendData.sendImg = 3;
413
-            }
414
-
415
-            this.api
416
-                .get(this.otherUrl + "Home/sendproduct", sendData, {
417
-                    pass: true,
418
-                })
419
-                .then((res) => {
420
-                    this.fn.showToast(res.message);
421
-                });
399
+            this.fn.showToast('暂无法使用');
400
+            // let sendData = {
401
+            //     pid: item.aid,
402
+            //     aid: item.aid,
403
+            //     // storeId: item.storeId,
404
+            //     platform:1000
405
+            // };
406
+            // if (type === "text") {
407
+            //     sendData.sendTxt = false;
408
+            //     sendData.sendVideo = false;
409
+            //     sendData.sendImg = 0;
410
+            // } else {
411
+            //     // sendData.sendTxt = true;
412
+            //     // sendData.sendVideo = true;
413
+            //     // sendData.sendImg = 3;
414
+            // }
415
+
416
+            // this.api
417
+            //     .get(this.otherUrl + "Home/sendproduct", sendData, {
418
+            //         pass: true,
419
+            //     })
420
+            //     .then((res) => {
421
+            //         this.fn.showToast(res.message);
422
+            //     });
422 423
         },
423 424
 
424 425
 
@@ -780,7 +781,7 @@ page {
780 781
         max-height: px(88);
781 782
         line-height: px(44);
782 783
         margin-top: px(30);
783
-        font-size: px(38);
784
+        font-size: px(40 );
784 785
         color: #333;
785 786
     }
786 787
 
@@ -788,7 +789,7 @@ page {
788 789
         // margin-top: px(30);
789 790
     }
790 791
     &__sale {
791
-        font-size: px(34);
792
+        font-size: px(36);
792 793
         line-height: px(40);
793 794
         color: #999;
794 795
         margin-top: px(20);
@@ -802,6 +803,7 @@ page {
802 803
         }
803 804
         &.black {
804 805
             color: #666;
806
+            margin-top: px(30);
805 807
         }
806 808
     }
807 809
 

+ 619 - 39
src/pages/youxuan/good.vue

@@ -39,7 +39,7 @@
39 39
                                         <div class="tags">
40 40
                                             <span
41 41
                                                 >{{
42
-                                                    item.onlineProductCount
42
+                                                    activity.onlineProductCount
43 43
                                                 }}款</span
44 44
                                             >
45 45
                                             <span>正品保障</span>
@@ -51,10 +51,16 @@
51 51
                                     </div>
52 52
                                 </div>
53 53
                                 <div class="des">
54
-                                    发货:{{ activity.deliveryDesc }}
54
+                                    <span>说明:</span>
55
+                                    {{ activity.description }}
55 56
                                 </div>
56 57
                                 <div class="des">
57
-                                    服务:退换无忧,支持7天无理由退换
58
+                                    <span>发货:</span
59
+                                    >{{ activity.deliveryDesc }}
60
+                                </div>
61
+                                <div class="des">
62
+                                    <span>服务:</span>
63
+                                    退换无忧,支持7天无理由退换
58 64
                                 </div>
59 65
                                 <div class="a-btns">
60 66
                                     <span @click="setActivityTop(activity)">
@@ -167,8 +173,12 @@
167 173
                                     </div>
168 174
 
169 175
                                     <div class="btns">
170
-                                        <div class="btn" @click="share(item)">
171
-                                            海报
176
+                                        <div class="btn" @click="sharePoster(item)">
177
+                                            {{
178
+                                                item.shareLoading
179
+                                                    ? "生成中"
180
+                                                    : "海报"
181
+                                            }}
172 182
                                         </div>
173 183
                                         <div
174 184
                                             class="btn"
@@ -215,6 +225,29 @@
215 225
                 </div>
216 226
             </div>
217 227
         </div>
228
+
229
+        <div
230
+            class="canvas"
231
+            v-show="canvasShow"
232
+            @touchmove.stop=""
233
+            @click="closeCanvas"
234
+        >
235
+            <div class="canvas__content">
236
+                <div class="canvas__close">
237
+                    <img
238
+                        class="canvas__img"
239
+                        src="/static/live/close.png"
240
+                        alt=""
241
+                    />
242
+                </div>
243
+                <canvas
244
+                    class="canvas__box"
245
+                    canvas-id="canvas"
246
+                    :disable-scroll="true"
247
+                    @click.stop="viewImg()"
248
+                ></canvas>
249
+            </div>
250
+        </div>
218 251
     </div>
219 252
 </template>
220 253
 
@@ -235,6 +268,12 @@ export default {
235 268
             shopId: "",
236 269
             searchVal: "",
237 270
             otherUrl: "https://bot.ixiaokejia.com/",
271
+
272
+            // 分享
273
+            canvasShow: false,
274
+            shareGood: {},
275
+            shareRootLoading: false,
276
+            shareLoadList: [],
238 277
         };
239 278
     },
240 279
     filters: {
@@ -334,8 +373,13 @@ export default {
334 373
             }
335 374
             sendData = this.pushSort(sendData);
336 375
 
376
+            uni.showLoading({
377
+                title: "加载中...",
378
+            });
337 379
             this.api.get("/Yx/GetProductList", sendData).then((res) => {
338
-                this.goodList = res.data;
380
+                uni.hideLoading();
381
+                // this.goodList = res.data;
382
+                this.goodList = res.data.item2;
339 383
                 if (!res.data.length) {
340 384
                     this.dataEnd = true;
341 385
                 }
@@ -480,30 +524,9 @@ export default {
480 524
         },
481 525
 
482 526
         // 推送
483
-        pushGive(item,type) {
484
-            let sendData = {
485
-                pid: item.aid,
486
-                aid: item.aid,
487
-                // storeId: item.storeId,
488
-                platform:1000
489
-            };
490
-            if (type === "text") {
491
-                sendData.sendTxt = false;
492
-                sendData.sendVideo = false;
493
-                sendData.sendImg = 0;
494
-            } else {
495
-                // sendData.sendTxt = true;
496
-                // sendData.sendVideo = true;
497
-                // sendData.sendImg = 3;
498
-            }
499
-
500
-            this.api
501
-                .get(this.otherUrl + "Home/sendproduct", sendData, {
502
-                    pass: true,
503
-                })
504
-                .then((res) => {
505
-                    this.fn.showToast(res.message);
506
-                });
527
+        pushGive(item, type) {
528
+            this.fn.showToast("暂无法使用");
529
+            //
507 530
         },
508 531
 
509 532
         // 分享
@@ -519,11 +542,11 @@ export default {
519 542
         },
520 543
 
521 544
         // 推荐商品
522
-        pushProduct(item,type) {
545
+        pushProduct(item, type) {
523 546
             let sendData = {
524 547
                 pid: item.id,
525 548
                 // storeId: item.storeId,
526
-                platform:1000
549
+                platform: 1000,
527 550
             };
528 551
             if (type === "text") {
529 552
                 sendData.sendTxt = false;
@@ -567,23 +590,580 @@ export default {
567 590
             this.fn.showActionSheet(arr).then((res) => {
568 591
                 switch (arr[res]) {
569 592
                     case "置顶":
570
-                        // this.edit(val);
571
-                        breathisk;
593
+                        this.setProductTop(val, true);
594
+                        break;
572 595
                     case "取消置顶":
573
-                        // .remove(val, false);
596
+                        this.setProductTop(val, false);
574 597
                         break;
575 598
                 }
576 599
             });
577 600
         },
578 601
 
602
+        // 商品置顶
603
+        setProductTop(val, isUp) {
604
+            if (isUp) {
605
+                // 置顶
606
+                this.api
607
+                    .get("/Yx/SetProductTop", {
608
+                        pid: val.id,
609
+                    })
610
+                    .then((res) => {
611
+                        if (res.success) {
612
+                            val.top = 0;
613
+                            this.$forceUpdate();
614
+                            this.fn.showToast("置顶成功");
615
+                        } else {
616
+                            this.fn.showModal({
617
+                                title: "设置失败",
618
+                                content: res.message,
619
+                                showCancel: false,
620
+                            });
621
+                        }
622
+                    });
623
+            } else {
624
+                // 取消置顶
625
+                this.api
626
+                    .get("/Yx/CancelProductTop", {
627
+                        pid: val.id,
628
+                    })
629
+                    .then((res) => {
630
+                        if (res.success) {
631
+                            val.top = 1;
632
+                            this.$forceUpdate();
633
+                            this.fn.showToast("取消成功");
634
+                        } else {
635
+                            this.fn.showModal({
636
+                                title: "设置失败",
637
+                                content: res.message,
638
+                                showCancel: false,
639
+                            });
640
+                        }
641
+                    });
642
+            }
643
+        },
644
+
579 645
         // 去详情
580 646
         goDetail(val) {
581 647
             this.router.push({
582
-                path:'/pages/youxuan/good-detail',
583
-                query:{
584
-                    id:val.id
648
+                path: "/pages/youxuan/good-detail",
649
+                query: {
650
+                    id: val.id,
651
+                },
652
+            });
653
+        },
654
+
655
+        shareLoading(id, status) {
656
+            for (let item of this.goodList) {
657
+                if (item.id === id) {
658
+                    item.shareLoading = status;
659
+                }
660
+            }
661
+            this.goodList = [...this.goodList];
662
+        },
663
+
664
+        // 分享
665
+        sharePoster(val) {
666
+            if (val.shareLoading) {
667
+                return;
668
+            }
669
+            if (this.shareRootLoading) {
670
+                this.shareLoadList.push(val);
671
+            }
672
+            this.shareRootLoading = true;
673
+            const self = this;
674
+            this.shareLoading(val.id, true);
675
+            // uni.showLoading({
676
+            //     title: "加载中...",
677
+            //     mask:true
678
+            // });
679
+            this.api.get("/Yx/GetProduct", { id: val.id }).then((res) => {
680
+                this.shareGood = JSON.parse(res.data);
681
+                // uni.hideLoading();
682
+                // self.$refs.share.open("", "", "", () => {
683
+                //     self.canvasShow = false;
684
+                // });
685
+                this.saveImage("single");
686
+            });
687
+        },
688
+        // 获取换算成画布使用的像素
689
+        getPx(size) {
690
+            let windowWidth = uni.getSystemInfoSync().windowWidth || 414;
691
+            let multiple = (windowWidth / 1080) * (920 / 670);
692
+            size = size * multiple;
693
+
694
+            return Number(size.toFixed(2));
695
+        },
696
+        // 创建分享图
697
+        creationShare() {
698
+            const self = this;
699
+            const ctx = uni.createCanvasContext("canvas", self);
700
+
701
+            // uni.showLoading({
702
+            //     title: "正在生成海报",
703
+            //     mask:true
704
+            // });
705
+            return new Promise((resolve) => {
706
+                self.router.getScene(self.$mp.query).then((res) => {
707
+                    Promise.all([
708
+                        uni.getImageInfo({
709
+                            src:
710
+                                this.user.appLogo ||
711
+                                self.config.imageResourceUrl +
712
+                                    "images/common/avatar.png",
713
+                        }),
714
+                        uni.getImageInfo({
715
+                            src: self.shareGood.pictureUrls[0],
716
+                        }),
717
+                        // 获取小程序吗
718
+                        self.api
719
+                            .get("/Share/GetQRCode", {
720
+                                path: "pages/recommend/detail",
721
+                                paremeters: JSON.stringify({
722
+                                    goodsId: self.shareGood.pid,
723
+                                    shopId:this.shopId
724
+                                }),
725
+                            })
726
+                            .then((res) => {
727
+                                return uni.getImageInfo({
728
+                                    src: res.data,
729
+                                });
730
+                            }),
731
+                    ]).then((res) => {
732
+                        // 背景
733
+                        ctx.setFillStyle("#fff");
734
+                        ctx.fillRect(0, 0, self.getPx(670), self.getPx(1080));
735
+
736
+                        // 头像
737
+                        if (res[0][1].path) {
738
+                            let avatarurl_width = self.getPx(70);
739
+                            let avatarurl_heigth = self.getPx(70);
740
+                            let avatarurl_x = self.getPx(30);
741
+                            let avatarurl_y = self.getPx(40);
742
+                            ctx.save();
743
+                            ctx.beginPath();
744
+                            ctx.arc(
745
+                                avatarurl_width / 2 + avatarurl_x,
746
+                                avatarurl_heigth / 2 + avatarurl_y,
747
+                                avatarurl_width / 2,
748
+                                0,
749
+                                Math.PI * 2,
750
+                                true
751
+                            );
752
+                            ctx.clip();
753
+                            ctx.drawImage(
754
+                                res[0][1].path,
755
+                                avatarurl_x,
756
+                                avatarurl_y,
757
+                                avatarurl_width,
758
+                                avatarurl_heigth
759
+                            );
760
+                            ctx.restore();
761
+                        }
762
+
763
+                        // 昵称
764
+                        ctx.setFontSize(self.getPx(28));
765
+                        ctx.setFillStyle("#333");
766
+                        ctx.fillText(
767
+                            self.user.appName,
768
+                            self.getPx(115),
769
+                            self.getPx(90)
770
+                        );
771
+                        ctx.stroke();
772
+
773
+                        // 商品图片
774
+                        ctx.drawImage(
775
+                            res[1][1].path,
776
+                            self.getPx(0),
777
+                            self.getPx(145),
778
+                            self.getPx(670),
779
+                            self.getPx(670)
780
+                        );
781
+
782
+                        // 商品标题,第一行
783
+                        let goodsName = self.shareGood.name;
784
+
785
+                        if (goodsName.length > 12) {
786
+                            goodsName = goodsName.substr(0, 12);
787
+                        }
788
+                        ctx.setFontSize(self.getPx(28));
789
+                        ctx.setFillStyle("#333");
790
+                        ctx.fillText(
791
+                            goodsName,
792
+                            self.getPx(50),
793
+                            self.getPx(880)
794
+                        );
795
+                        ctx.stroke();
796
+
797
+                        // 商品标题,第二行
798
+                        let goodsName2 = self.shareGood.name;
799
+                        if (goodsName2.length > 12) {
800
+                            goodsName2 = goodsName2.substr(12, 10) + "...";
801
+
802
+                            ctx.setFontSize(self.getPx(28));
803
+                            ctx.setFillStyle("#333");
804
+                            ctx.fillText(
805
+                                goodsName2,
806
+                                self.getPx(50),
807
+                                self.getPx(920)
808
+                            );
809
+                            ctx.stroke();
810
+                        }
811
+
812
+                        // 商品描述,第一行
813
+                        let descName =
814
+                            self.shareGood.description || "";
815
+
816
+                        if (descName.length > 14) {
817
+                            descName = descName.substr(0, 14);
818
+                        }
819
+                        ctx.setFontSize(self.getPx(24));
820
+                        ctx.setFillStyle("#666");
821
+                        ctx.fillText(descName, self.getPx(50), self.getPx(965));
822
+                        ctx.stroke();
823
+
824
+                        // 商品描述,第二行
825
+                        let descName2 =
826
+                            self.shareGood.description || "";
827
+                        if (descName2.length > 14) {
828
+                            descName2 = descName2.substr(14, 14) + "...";
829
+
830
+                            ctx.setFontSize(self.getPx(24));
831
+                            ctx.setFillStyle("#666");
832
+                            ctx.fillText(
833
+                                descName2,
834
+                                self.getPx(50),
835
+                                self.getPx(995)
836
+                            );
837
+                            ctx.stroke();
838
+                        }
839
+
840
+                        // 商品价格符号
841
+                        ctx.setFontSize(self.getPx(20));
842
+                        ctx.setFillStyle("#f8662a");
843
+                        ctx.fillText("¥", self.getPx(50), self.getPx(1050));
844
+                        ctx.stroke();
845
+
846
+                        // 商品价格
847
+                        ctx.setFontSize(self.getPx(40));
848
+                        ctx.setFillStyle("#f8662a");
849
+                        ctx.fillText(
850
+                            self.shareGood.agentFee / 100,
851
+                            self.getPx(65),
852
+                            self.getPx(1050)
853
+                        );
854
+                        ctx.stroke();
855
+
856
+                        // 小程序吗
857
+                        ctx.drawImage(
858
+                            res[2][1].path,
859
+                            self.getPx(460),
860
+                            self.getPx(850),
861
+                            self.getPx(170),
862
+                            self.getPx(170)
863
+                        );
864
+
865
+                        // 长按扫码购买
866
+                        ctx.setFontSize(self.getPx(24));
867
+                        ctx.setFillStyle("#999");
868
+                        ctx.fillText(
869
+                            "长按扫码购买",
870
+                            self.getPx(470),
871
+                            self.getPx(1050)
872
+                        );
873
+                        ctx.stroke();
874
+
875
+                        ctx.draw();
876
+
877
+                        self.canvasShow = true;
878
+                        // uni.hideLoading();
879
+                        setTimeout(() => {
880
+                            // 生成临时路径
881
+                            uni.canvasToTempFilePath({
882
+                                canvasId: "canvas",
883
+                                fileType: "jpg",
884
+                                success: function (res) {
885
+                                    self.canvasShow = false;
886
+                                    self.canvasImgPath = [res.tempFilePath];
887
+                                    resolve(res.tempFilePath);
888
+                                },
889
+                            });
890
+                        }, 100);
891
+                    });
892
+                });
893
+            });
894
+        },
895
+        viewImg() {
896
+            let self = this;
897
+            //查看图片
898
+            uni.previewImage({
899
+                urls: self.canvasImgPath,
900
+                longPressActions: true,
901
+            });
902
+        },
903
+
904
+        // 关闭海报
905
+        closeCanvas() {
906
+            const self = this;
907
+
908
+            self.canvasShow = false;
909
+        },
910
+        // 创建多张分享图
911
+        creationShares(url) {
912
+            const self = this;
913
+            const ctx = uni.createCanvasContext("canvas", self);
914
+
915
+            return new Promise((resolve) => {
916
+                self.router.getScene(self.$mp.query).then((res) => {
917
+                    Promise.all([
918
+                        uni.getImageInfo({
919
+                            src:
920
+                                this.user.avatar ||
921
+                                self.config.imageResourceUrl +
922
+                                    "images/common/avatar.png",
923
+                        }),
924
+                        uni.getImageInfo({
925
+                            src: url,
926
+                        }),
927
+                        uni.getImageInfo({
928
+                            src:
929
+                                self.config.imageResourceUrl +
930
+                                "resource/share/recognition.jpg",
931
+                        }),
932
+                        // 获取小程序吗
933
+                        self.api
934
+                            .get("/Share/GetQRCode", {
935
+                                path: "pages/goods/detail",
936
+                                paremeters: JSON.stringify({
937
+                                    goodsId: self.shareGood.pid,
938
+                                    shopId:this.shopId
939
+                                }),
940
+                            })
941
+                            .then((res) => {
942
+                                return uni.getImageInfo({
943
+                                    src: res.data,
944
+                                });
945
+                            }),
946
+                    ]).then((res) => {
947
+                        // 背景
948
+                        ctx.setFillStyle("#fff");
949
+                        ctx.fillRect(0, 0, self.getPx(670), self.getPx(1080));
950
+
951
+                        // 头像
952
+                        if (res[0][1].path) {
953
+                            let avatarurl_width = self.getPx(70);
954
+                            let avatarurl_heigth = self.getPx(70);
955
+                            let avatarurl_x = self.getPx(30);
956
+                            let avatarurl_y = self.getPx(40);
957
+                            ctx.save();
958
+                            ctx.beginPath();
959
+                            ctx.arc(
960
+                                avatarurl_width / 2 + avatarurl_x,
961
+                                avatarurl_heigth / 2 + avatarurl_y,
962
+                                avatarurl_width / 2,
963
+                                0,
964
+                                Math.PI * 2,
965
+                                true
966
+                            );
967
+                            ctx.clip();
968
+                            ctx.drawImage(
969
+                                res[0][1].path,
970
+                                avatarurl_x,
971
+                                avatarurl_y,
972
+                                avatarurl_width,
973
+                                avatarurl_heigth
974
+                            );
975
+                            ctx.restore();
976
+                        }
977
+
978
+                        // 昵称
979
+                        ctx.setFontSize(self.getPx(28));
980
+                        ctx.setFillStyle("#333");
981
+                        ctx.fillText(
982
+                            self.user.nickName + "分享一件好物给你~",
983
+                            self.getPx(115),
984
+                            self.getPx(90)
985
+                        );
986
+                        ctx.stroke();
987
+
988
+                        // 商品图片
989
+                        ctx.drawImage(
990
+                            res[1][1].path,
991
+                            self.getPx(0),
992
+                            self.getPx(145),
993
+                            self.getPx(670),
994
+                            self.getPx(670)
995
+                        );
996
+
997
+                        // 底部图片
998
+                        ctx.drawImage(
999
+                            res[2][1].path,
1000
+                            self.getPx(30),
1001
+                            self.getPx(880),
1002
+                            self.getPx(400),
1003
+                            self.getPx(120)
1004
+                        );
1005
+
1006
+                        // 小程序吗
1007
+                        ctx.drawImage(
1008
+                            res[3][1].path,
1009
+                            self.getPx(460),
1010
+                            self.getPx(850),
1011
+                            self.getPx(170),
1012
+                            self.getPx(170)
1013
+                        );
1014
+
1015
+                        // 长按扫码购买
1016
+                        ctx.setFontSize(self.getPx(24));
1017
+                        ctx.setFillStyle("#999");
1018
+                        ctx.fillText(
1019
+                            "长按扫码购买",
1020
+                            self.getPx(470),
1021
+                            self.getPx(1050)
1022
+                        );
1023
+                        ctx.stroke();
1024
+
1025
+                        ctx.draw();
1026
+
1027
+                        self.canvasShow = true;
1028
+                        uni.hideLoading();
1029
+                        setTimeout(() => {
1030
+                            // 生成临时路径
1031
+                            uni.canvasToTempFilePath({
1032
+                                canvasId: "canvas",
1033
+                                fileType: "jpg",
1034
+                                success: function (res) {
1035
+                                    resolve(res.tempFilePath);
1036
+                                },
1037
+                            });
1038
+                        }, 100);
1039
+                    });
1040
+                });
1041
+            });
1042
+        },
1043
+        // 保存图片到相册
1044
+        async saveImage(type) {
1045
+            const self = this;
1046
+            const good = this.shareGood;
1047
+            if (type === "single" && !self.canvasHandleStatus) {
1048
+                // 分享图
1049
+                self.canvasHandleStatus = true;
1050
+                // 获取用户设置
1051
+                uni.getSetting({
1052
+                    success(res) {
1053
+                        if (
1054
+                            res.authSetting["scope.writePhotosAlbum"] === false
1055
+                        ) {
1056
+                            //用户拒绝权限打开设置界面
1057
+                            self.fn
1058
+                                .showModal({
1059
+                                    title: "图片保存失败",
1060
+                                    content:
1061
+                                        "需要你打开允许使用“相册”权限,才能成功保存图片",
1062
+                                    confirmText: "去设置",
1063
+                                })
1064
+                                .then((res) => {
1065
+                                    if (res.confirm) {
1066
+                                        self.canvasHandleStatus = false;
1067
+                                        self.shareEnd();
1068
+                                        self.fn.openSetting();
1069
+                                    } else {
1070
+                                        self.shareLoading(
1071
+                                            good.pid,
1072
+                                            false
1073
+                                        );
1074
+                                    }
1075
+                                });
1076
+                        } else {
1077
+                            // 生成分享图
1078
+                            self.creationShare().then((res) => {
1079
+                                // 保存分享图到相册
1080
+                                uni.saveImageToPhotosAlbum({
1081
+                                    filePath: res,
1082
+                                    success: function () {
1083
+                                        self.shareLoading(
1084
+                                            good.pid,
1085
+                                            false
1086
+                                        );
1087
+                                        self.shareEnd();
1088
+                                        self.fn.showToast("海报保存成功");
1089
+                                    },
1090
+                                    complete: function () {
1091
+                                        // self.shareLoading(
1092
+                                        //     good.baseInfo.id,
1093
+                                        //     false
1094
+                                        // );
1095
+                                        self.canvasHandleStatus = false;
1096
+                                        // self.shareEnd();
1097
+                                    },
1098
+                                });
1099
+                            });
1100
+                        }
1101
+                    },
1102
+                });
1103
+            } else {
1104
+                // 素材图
1105
+                let setting = await uni.getSetting();
1106
+
1107
+                if (
1108
+                    setting[1].authSetting["scope.writePhotosAlbum"] === false
1109
+                ) {
1110
+                    //用户拒绝权限打开设置界面
1111
+                    self.fn
1112
+                        .showModal({
1113
+                            title: "图片保存失败",
1114
+                            content:
1115
+                                "需要你打开允许使用“相册”权限,才能成功保存图片",
1116
+                            confirmText: "去设置",
1117
+                        })
1118
+                        .then((res) => {
1119
+                            if (res.confirm) {
1120
+                                self.fn.openSetting();
1121
+                            }
1122
+                        });
1123
+                } else if (!self.canvasHandleStatus) {
1124
+                    let imageList = self.shareGood.images;
1125
+                    let num = imageList.length;
1126
+
1127
+                    self.canvasHandleStatus = true;
1128
+                    uni.showLoading({
1129
+                        title: "正在生成海报",
1130
+                    });
1131
+
1132
+                    for (let i = 0; i < num; i++) {
1133
+                        let url = await self.creationShares(imageList[i]);
1134
+
1135
+                        // 保存分享图到相册
1136
+                        uni.saveImageToPhotosAlbum({
1137
+                            filePath: url,
1138
+                            complete: function () {
1139
+                                if (i + 1 === num) {
1140
+                                    self.canvasHandleStatus = false;
1141
+                                    self.canvasShow = false;
1142
+                                    self.fn.showModal({
1143
+                                        title:
1144
+                                            "已经保存" +
1145
+                                            num +
1146
+                                            "张商品素材图到手机相册可在相册直接查看",
1147
+                                        showCancel: false,
1148
+                                        confirmText: "我知道了",
1149
+                                    });
1150
+                                }
1151
+                            },
1152
+                        });
1153
+                    }
585 1154
                 }
586
-            })
1155
+            }
1156
+        },
1157
+
1158
+        shareEnd() {
1159
+            this.shareRootLoading = false;
1160
+            if (this.shareLoadList.length > 0) {
1161
+                let val = this.shareLoadList[0];
1162
+                this.shareLoadList.splice(0, 1);
1163
+                this.shareLoadList = [...this.shareLoadList];
1164
+                val.shareLoading = false;
1165
+                this.sharePoster(val);
1166
+            }
587 1167
         },
588 1168
     },
589 1169