Browse Source

二维码导出

Joe 3 years ago
parent
commit
59776a74c0

+ 2 - 1
src/settings.js

@@ -27,5 +27,6 @@ module.exports = {
    * The default is only used in the production env
    * If you want to also use it in dev, you can pass ['production', 'development']
    */
-  errorLog: 'production'
+  errorLog: 'production',
+  baseURL:"http://mp.huijy.net/",
 }

+ 7 - 0
src/utils/base64.js

@@ -1,5 +1,12 @@
 export default class Base64 {  
    
+  static getInstance(){
+    if (!this.instance) {
+      this.instance = new Base64();
+    }
+    return this.instance
+  }
+
   // private property  
   _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";  
  

+ 35 - 5
src/views/coupon/Coupon_CreateIssue.vue

@@ -263,6 +263,19 @@
             {{ scope.row.issueType == "3" ? "支付成功后的领取位" : "" }}
           </template>
         </af-table-column>
+        <af-table-column label="操作" align="left">
+          <template slot-scope="scope">
+            {{ scope.row.issueType == "1"||scope.row.issueType == "3" ? "-------" : "" }}
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-download"
+              @click="handleExport(scope.row)"
+              v-if="scope.row.issueType=='2'"
+              >导出二维码、网址</el-button
+            >
+          </template>
+        </af-table-column>
         <af-table-column label="发放门槛" align="left">
           <template slot-scope="scope">
             {{
@@ -589,9 +602,10 @@
       title="导出标签"
     >
       <div>
-        <qr :text="currentExport.text" @downloadImg="downloadImg" name="总标签码">
-          <div>网站:你好呀</div>
+        <qr :text="currentExport.text" @downloadImg="downloadImg" :name="currentExport.name + '活动二维码'">
+          <div>{{ currentExport.name }} 活动二维码<b></b></div>
         </qr>
+        <div style="text-align: center;margin-top: 10px;">活动网址:{{currentExport.text}}</div>
       </div>
     </el-dialog>
 
@@ -610,6 +624,8 @@ import {
 } from "@/api/station/manage";
 import { listPrice } from "@/api/station/price";
 import qr from "@/components/QrCode";
+import Base64 from "@/utils/base64";
+
 
 import {
   addInfo,
@@ -621,6 +637,7 @@ import {
   upIssueStatus,
 } from "@/api/coupon";
 import SelectDay from "@/components/SelectDay";
+import settings from "@/settings"
 
 export default {
   name: "Coupon_CreateIssue",
@@ -654,7 +671,7 @@ export default {
     };
     return {
       couponEnabledFlag: "1",
-      exportQrDialog: true,
+      exportQrDialog: false,
       pageStatus: 4,
       createForm: {
         issueRemark: "",
@@ -670,8 +687,10 @@ export default {
         giveCount: 999999,
       },
       currentExport:{
-        text:"http://mp.huijy.net/123/coupon/get",
-        type:"你好"
+        text:"error",
+        type:"你好",
+        name:"二维码",
+        
       },
       couponList: [],
       oilNameList: [],
@@ -769,6 +788,8 @@ export default {
     qr,
   },
   created() {
+    console.log('哈哈');
+    console.log('settings',settings);
     // this.init();
     this.getCoupon();
     // this.setPageStatus();
@@ -819,6 +840,15 @@ export default {
     //   this.currentExport.text = "https://goto.huijy.net/" + this.deptId + "/" + trimEqualStr;
     //   this.exportQrDialog = true;
     // },
+    handleExport(row){
+      this.currentExport.name = row.issueName
+      const base64 =  Base64.getInstance();
+      const encodeStr = "i" + row.id
+      const encodedStr = base64.encode(encodeStr) 
+      const trimEqualStr = encodedStr.replace(/={1,}$/g, "");
+      this.exportQrDialog = true;
+      this.currentExport.text = settings.baseURL + this.deptId + "/" + trimEqualStr 
+    },
     downloadImg(){
       console.log(1221);
     },

+ 1 - 1
src/views/label/Label_AddLabel.vue

@@ -256,7 +256,7 @@ export default {
       this.setPageStatus();
       this.getList();
       this.getEmployeeList();
-      this.base = new Base64();
+      this.base = Base64.getInstance();
     },
     getEmployeeList() {
       listPersonnel({