Browse Source

购买提示

natasha 1 day ago
parent
commit
99cb242474

+ 4 - 1
src/views/bookShelf/articleDetail.vue

@@ -554,6 +554,7 @@
         :articleInfo="articleInfo"
         @closePrint="closePrint"
         :articleImg="articleImg"
+        :printCount="printCount"
       ></print-model>
     </el-dialog>
   </div>
@@ -1055,6 +1056,7 @@ export default {
       ciyunShow: false, // 显示词云
       printFlag: false, // 打印
       articleImg: {}, // 文章图片
+      printCount: 0,
     };
   },
   watch: {
@@ -1646,7 +1648,8 @@ export default {
                 article_id: this.articleId,
               }).then((res) => {
                 if (res.status === 1) {
-                  if (res.print_count < 5) {
+                  this.printCount = res.print_count;
+                  if (res.print_count < 1000) {
                     this.printFlag = true;
                   } else {
                     this.$message.warning(

+ 10 - 0
src/views/bookShelf/bookItem.vue

@@ -204,6 +204,9 @@
                 :loading="createOrderLoading"
                 >立即购买</a
               >
+              <p v-if="bookType === 'baozhi'" class="print-tips">
+                温馨提示:电子报刊每篇文章打印+下载共5次机会,支持一键多篇打印,不支持一键多篇下载。
+              </p>
             </template>
             <template v-else-if="isBuy === 'true' && bookType !== 'zhuanji'">
               <a class="continue" @click="handleLink">继续学习</a>
@@ -1252,6 +1255,8 @@ export default {
         }
         .btn-box {
           display: flex;
+          align-items: center;
+          gap: 10px;
           .el-button {
             width: 112px;
             height: 40px;
@@ -1294,6 +1299,11 @@ export default {
             text-align: center;
             width: 130px;
           }
+          .print-tips {
+            margin: 0;
+            color: #ea5939;
+            font-size: 12px;
+          }
         }
       }
     }

+ 46 - 36
src/views/bookShelf/components/LexicalType.vue

@@ -1142,43 +1142,53 @@ export default {
       }).then((res) => {
         if (res.status === 1) {
           if (res.print_count < 5) {
-            getLogin(
-              "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
-              {
-                goods_type: 21,
-                article_id: this.articleId,
-              }
-            ).then((res) => {
-              if (res.status === 1) {
-              }
-            });
-            this.isPrintMore = true;
-            setTimeout(() => {
-              waterMark.set(
-                this.userMessage.user_name + " " + this.userMessage.phone,
-                "",
-                "showWaterMarkLexical"
-              );
-            }, 1000);
-            setTimeout(() => {
-              this.$nextTick(() => {
-                this.$print(this.$refs["printAreaManys"], {
-                  noPrint: ".noPrint",
-                  type: "html",
-                  scanStyles: true,
-                  showModal: true,
-                  // style: style,// 亦可使用引入的外部css;
-                  onStart: () => {
-                    // console.log("打印开始");
-                  },
-                  onEnd: () => {
-                    // console.log("打印完成");
-                    // window.location.reload();
-                  },
-                });
-                this.isPrintMore = false;
+            let str =
+              "剩余次数为" +
+              (5 - res.print_count) +
+              "次,是否确认打印?(每篇打印+下载次数共5次)";
+            this.$confirm(str, "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning",
+            }).then(() => {
+              getLogin(
+                "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
+                {
+                  goods_type: 21,
+                  article_id: this.articleId,
+                }
+              ).then((res) => {
+                if (res.status === 1) {
+                }
               });
-            }, 1500);
+              this.isPrintMore = true;
+              setTimeout(() => {
+                waterMark.set(
+                  this.userMessage.user_name + " " + this.userMessage.phone,
+                  "",
+                  "showWaterMarkLexical"
+                );
+              }, 1000);
+              setTimeout(() => {
+                this.$nextTick(() => {
+                  this.$print(this.$refs["printAreaManys"], {
+                    noPrint: ".noPrint",
+                    type: "html",
+                    scanStyles: true,
+                    showModal: true,
+                    // style: style,// 亦可使用引入的外部css;
+                    onStart: () => {
+                      // console.log("打印开始");
+                    },
+                    onEnd: () => {
+                      // console.log("打印完成");
+                      // window.location.reload();
+                    },
+                  });
+                  this.isPrintMore = false;
+                });
+              }, 1500);
+            });
           } else {
             this.$message.warning("每篇文章打印+下载次数共5次,现已达上限。");
           }

+ 112 - 74
src/views/bookShelf/components/PrintModel.vue

@@ -951,6 +951,7 @@ export default {
     "likePhraseList",
     "likeWord",
     "articleImg",
+    "printCount",
   ],
   data() {
     return {
@@ -1103,6 +1104,7 @@ export default {
       printManyMenu: [], // 打印多篇文章目录
       printManyDetails: [], // 最终确定打印文章内容详情
       isPrintMore: false,
+      printCountNow: this.printCount,
     };
   },
   created() {
@@ -1326,30 +1328,42 @@ export default {
         article_id: this.articleId,
       }).then((res) => {
         if (res.status === 1) {
+          this.printCountNow = res.print_count;
           if (res.print_count < 5) {
-            getLogin(
-              "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
-              {
-                goods_type: 21,
-                article_id: this.articleId,
-              }
-            ).then((res) => {
-              if (res.status === 1) {
-              }
-            });
-            this.$nextTick(() => {
-              this.$print(this.$refs["printArea"], {
-                noPrint: ".noPrint",
-                type: "html",
-                scanStyles: true,
-                showModal: true,
-                // style: style,// 亦可使用引入的外部css;
-                onStart: () => {
-                  // console.log("打印开始");
-                },
-                onEnd: () => {
-                  // console.log("打印完成");
-                },
+            let str =
+              "剩余次数为" +
+              (5 - res.print_count) +
+              "次,是否确认打印?(每篇打印+下载次数共5次)";
+            this.$confirm(str, "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning",
+            }).then(() => {
+              getLogin(
+                "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
+                {
+                  goods_type: 21,
+                  article_id: this.articleId,
+                }
+              ).then((res) => {
+                if (res.status === 1) {
+                  this.printCountNow++;
+                }
+              });
+              this.$nextTick(() => {
+                this.$print(this.$refs["printArea"], {
+                  noPrint: ".noPrint",
+                  type: "html",
+                  scanStyles: true,
+                  showModal: true,
+                  // style: style,// 亦可使用引入的外部css;
+                  onStart: () => {
+                    // console.log("打印开始");
+                  },
+                  onEnd: () => {
+                    // console.log("打印完成");
+                  },
+                });
               });
             });
           } else {
@@ -1388,33 +1402,45 @@ export default {
         article_id: this.articleId,
       }).then((res) => {
         if (res.status === 1) {
+          this.printCountNow = res.print_count;
           if (res.print_count < 5) {
-            getLogin(
-              "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
-              {
-                goods_type: 21,
-                article_id: this.articleId,
-              }
-            ).then((res) => {
-              if (res.status === 1) {
-              }
-            });
-            this.$nextTick(() => {
-              this.isPrint = true;
-              const element = document.getElementById("showWaterMark");
-              const opt = {
-                margin: [0, 0, 0, 0],
-                useCORS: true,
-                filename: title + ".pdf",
-                image: { type: "jpeg", quality: 0.98 },
-                html2canvas: { scale: 2 }, // 或其他自定义设置,例如scale可以放大内容以便更容易阅读和打印。
-                jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, // A4尺寸的PDF,纵向打印。
-              };
-              html2pdf().set(opt).from(element).save();
+            let str =
+              "剩余次数为" +
+              (5 - res.print_count) +
+              "次,是否确认下载?(每篇打印+下载次数共5次)";
+            this.$confirm(str, "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning",
+            }).then(() => {
+              getLogin(
+                "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
+                {
+                  goods_type: 21,
+                  article_id: this.articleId,
+                }
+              ).then((res) => {
+                if (res.status === 1) {
+                  this.printCountNow++;
+                }
+              });
+              this.$nextTick(() => {
+                this.isPrint = true;
+                const element = document.getElementById("showWaterMark");
+                const opt = {
+                  margin: [0, 0, 0, 0],
+                  useCORS: true,
+                  filename: title + ".pdf",
+                  image: { type: "jpeg", quality: 0.98 },
+                  html2canvas: { scale: 2 }, // 或其他自定义设置,例如scale可以放大内容以便更容易阅读和打印。
+                  jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, // A4尺寸的PDF,纵向打印。
+                };
+                html2pdf().set(opt).from(element).save();
 
-              setTimeout(() => {
-                this.isPrint = false;
-              }, 100);
+                setTimeout(() => {
+                  this.isPrint = false;
+                }, 100);
+              });
             });
           } else {
             this.$message.warning("每篇文章打印+下载次数共5次,现已达上限。");
@@ -1768,35 +1794,47 @@ export default {
         article_id: this.articleId,
       }).then((res) => {
         if (res.status === 1) {
+          this.printCountNow = res.print_count;
           if (res.print_count < 5) {
-            getLogin(
-              "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
-              {
-                goods_type: 21,
-                article_id: this.articleId,
-              }
-            ).then((res) => {
-              if (res.status === 1) {
-              }
-            });
-            this.$nextTick(() => {
-              this.$print(this.$refs["printAreaManys"], {
-                noPrint: ".noPrint",
-                type: "html",
-                scanStyles: true,
-                showModal: true,
-                // style: style,// 亦可使用引入的外部css;
-                onStart: () => {
-                  // console.log("打印开始");
-                },
-                onEnd: () => {
-                  // console.log("打印完成");
-                },
+            let str =
+              "剩余次数为" +
+              (5 - res.print_count) +
+              "次,是否确认打印?(每篇打印+下载次数共5次)";
+            this.$confirm(str, "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning",
+            }).then(() => {
+              getLogin(
+                "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
+                {
+                  goods_type: 21,
+                  article_id: this.articleId,
+                }
+              ).then((res) => {
+                if (res.status === 1) {
+                  this.printCountNow++;
+                }
               });
+              this.$nextTick(() => {
+                this.$print(this.$refs["printAreaManys"], {
+                  noPrint: ".noPrint",
+                  type: "html",
+                  scanStyles: true,
+                  showModal: true,
+                  // style: style,// 亦可使用引入的外部css;
+                  onStart: () => {
+                    // console.log("打印开始");
+                  },
+                  onEnd: () => {
+                    // console.log("打印完成");
+                  },
+                });
 
-              this.loading = false;
-              this.printManyFlag = false;
-              this.isPrintMore = false;
+                this.loading = false;
+                this.printManyFlag = false;
+                this.isPrintMore = false;
+              });
             });
           } else {
             this.loading = false;

+ 10 - 0
src/views/bookStore/Subscribe.vue

@@ -390,6 +390,9 @@
               >立即购买</el-button
             >
             <!-- <el-button class="upgrade" @click="handleChangeWay('dui')">使用兑换码</el-button> -->
+            <p v-if="bookType === 'baozhi'" class="print-tips">
+              温馨提示:电子报刊每篇文章打印+下载共5次机会,支持一键多篇打印,不支持一键多篇下载。
+            </p>
           </div>
         </div>
       </div>
@@ -1490,6 +1493,8 @@ export default {
         }
         .btn-box {
           display: flex;
+          align-items: center;
+          gap: 10px;
           .el-button {
             width: 112px;
             height: 40px;
@@ -1532,6 +1537,11 @@ export default {
             text-align: center;
             width: 130px;
           }
+          .print-tips {
+            margin: 0;
+            color: #ea5939;
+            font-size: 12px;
+          }
         }
       }
     }