فهرست منبع

打印次数限制

natasha 1 سال پیش
والد
کامیت
6e3da93b21
2فایلهای تغییر یافته به همراه55 افزوده شده و 16 حذف شده
  1. 16 1
      src/views/bookShelf/articleDetail.vue
  2. 39 15
      src/views/bookShelf/components/PrintModel.vue

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

@@ -976,7 +976,22 @@ export default {
                     if(type==='cloud'){
                         this.ciyunEvent()
                     }else if(type==='print'){
-                        this.printFlag = true
+                        let MethodName = "/ShopServer/Client/PrintRecordManager/GetMyPrintCount_Article"
+                        getLogin(MethodName, {
+                            goods_type: 21,
+                            date_range: 'TODAY',
+                            article_id: this.articleId
+                        })
+                        .then((res) => {
+                            if(res.status===1){
+                                if(res.print_count<5){
+                                    this.printFlag = true
+                                }else{
+                                    this.$message.warning('今日打印次数已达上限')
+                                }
+                            }
+                        })
+                        
                     }else{
                         this.handleCreateShare()
                     }

+ 39 - 15
src/views/bookShelf/components/PrintModel.vue

@@ -518,21 +518,45 @@ export default {
         },
         // 打印
         handlePrint(){
-            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 MethodName = "/ShopServer/Client/PrintRecordManager/GetMyPrintCount_Article"
+            getLogin(MethodName, {
+                goods_type: 21,
+                date_range: 'TODAY',
+                article_id: this.articleId
+            })
+            .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.$nextTick(() => {
+                            this.$print(this.$refs["printArea"], {
+                            noPrint: ".noPrint",
+                            type: "html",
+                            scanStyles: true,
+                            showModal: true,
+                            // style: style,// 亦可使用引入的外部css;
+                            onStart: () => {
+                                console.log("打印开始");
+                            },
+                            onEnd: () => {
+                                console.log("打印完成");
+                            },
+                            });
+                        });
+                    }else{
+                        this.$message.warning('今日打印次数已达上限')
+                    }
+                }
+            })
+            
         },
         // 清除
         handleClear(){