Blame view

pages/businessCard/printCard.vue 3.09 KB
36884ffd   刘淇   打印
1
2
  <template>
      <view>
9bac797d   刘淇   卡券发放
3
          <uni-section :title="`${cardRuleName}(${cardTypeName})`" type="line">
36884ffd   刘淇   打印
4
5
              <uni-card padding="0" spacing="0">
                  <uni-list>
9bac797d   刘淇   卡券发放
6
                      <uni-list-item title="适应车场" :rightText="plName">
36884ffd   刘淇   打印
7
8
                          <text></text>
                      </uni-list-item>
9bac797d   刘淇   卡券发放
9
                      <uni-list-item :title="`价格:¥${price}/张`" :rightText="`商户库存:${cardNum}张`"></uni-list-item>
36884ffd   刘淇   打印
10
11
12
13
                  </uni-list>
              </uni-card>
          </uni-section>
  
9bac797d   刘淇   卡券发放
14
15
          <view class=" uni-card text-center" style="padding: 10px 0">
              <image :src="qrUrl"></image>
36884ffd   刘淇   打印
16
17
          </view>
  
9bac797d   刘淇   卡券发放
18
19
  
          <view class=" uni-card" style="padding: 10px 15px">
fc8d2d1a   刘淇   打印
20
              二维码有效期:(自打印时间算起)
9bac797d   刘淇   卡券发放
21
              <uni-number-box @change="changeValue" min="1"/>
fc8d2d1a   刘淇   打印
22
23
          </view>
  
36884ffd   刘淇   打印
24
          <view class="uni-padding-wrap uni-common-mt">
fc8d2d1a   刘淇   打印
25
              <!--<button type="primary" style="margin-bottom: 15px">停止自动发放</button>-->
9bac797d   刘淇   卡券发放
26
              <button type="warn" @click="changeTime">立即打印</button>
36884ffd   刘淇   打印
27
28
29
30
31
32
33
          </view>
  
  
      </view>
  </template>
  
  <script>
9bac797d   刘淇   卡券发放
34
  import uQRCode from '../../common/uqrcode.js' //引入uqrcode.js
36884ffd   刘淇   打印
35
36
  export default {
    data() {
36884ffd   刘淇   打印
37
      return {
9bac797d   刘淇   卡券发放
38
39
40
41
42
43
44
45
46
        cardTypeName: '',// 卡类型名称
        cardRuleName: '',// 卡名称
        plName: '', // 停车场
        price: '', // 卡价格
        cardNum: '', // 库存
        cardRelParkNo: '',//商券规则关联车场和商户编码
        numberValue: '1',
        hour: '9999999999999999999999',
        qrUrl: '', // 图片地址
36884ffd   刘淇   打印
47
48
49
50
51
52
      }
    },
    onLoad(params) {
      wx.showShareMenu({
        withShareTicket: true
      })
9bac797d   刘淇   卡券发放
53
54
55
56
57
58
59
60
61
      console.log(params)
      let option = params
      this.cardRelParkNo = option.cardRelParkNo
      this.cardTypeName = option.cardTypeName
      this.cardRuleName = option.cardRuleName
      this.plName = option.plName
      this.price = option.price
      this.cardNum = option.cardNum
      this.getCouponStaticQR()
36884ffd   刘淇   打印
62
63
64
    },
    onShow() {
      var me = this;
36884ffd   刘淇   打印
65
    },
9bac797d   刘淇   卡券发放
66
    computed: {},
36884ffd   刘淇   打印
67
    methods: {
9bac797d   刘淇   卡券发放
68
      changeValue(value) {
fc8d2d1a   刘淇   打印
69
70
        this.numberValue = value
      },
9bac797d   刘淇   卡券发放
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
      getCouponStaticQR() {
        let that = this
        let paramsData = {
          cardRelParkNo: this.cardRelParkNo,
          codeType: '2',
          hour: this.hour
        }
        // 首页信息获取 接口
        that.$myRequest({
          url: that.$common.getCouponStaticQR,
          method: 'POST',
          data: that.$common.requestSign(paramsData)
        }).then(res => {
          console.log(res)
          that.qrUrl = res.data.qrUrl
          console.log(that.qrUrl)
36884ffd   刘淇   打印
87
88
        })
      },
9bac797d   刘淇   卡券发放
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
      //**生成二维码**//
      qrFun: function (text) {
        this.qrShow = true
        uQRCode.make({
          canvasId: 'qrcode',
          componentInstance: this,
          text: text,
          size: 150,
          margin: 0,
          backgroundColor: '#ffffff',
          foregroundColor: '#000000',
          fileType: 'jpg',
          errorCorrectLevel: uQRCode.errorCorrectLevel.H,
          success: res => {
          }
        })
36884ffd   刘淇   打印
105
      },
9bac797d   刘淇   卡券发放
106
107
108
109
      changeTime: function () {
        this.hour = this.numberValue
        this.getCouponStaticQR()
      }
36884ffd   刘淇   打印
110
111
112
113
114
    }
  }
  </script>
  
  <style lang="scss" scoped>
36884ffd   刘淇   打印
115
  
36884ffd   刘淇   打印
116
117
  
  </style>