石广澎
2025-11-30 18b45638fe3aac07e65aeb5b1da337d4e4bdc87c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<template>
  <view>
    <view class="top-card">
      <view class="u-flex">
        <view v-if="cardInfo.type === 0" class="">
          <view class="u-font-26">我的余额</view>
          <view>
            <text style="font-size: 64rpx;font-weight: bold">{{cardInfo.amount}}</text>
            <text class="u-font-26 u-m-l-6">元</text>
          </view>
        </view>
        <view v-if="cardInfo.type === 1" class="">
          <view class="u-font-26">剩余次数</view>
          <view>
            <text style="font-size: 64rpx;font-weight: bold">{{cardInfo.times}}</text>
            <text class="u-font-26 u-m-l-6">次</text>
          </view>
        </view>
        <view class="u-flex-1"></view>
        <navigator :url="`/pages/pay/recharge?cardInfo=${encodeURIComponent(JSON.stringify(cardInfo))}`">
          <u-button size="mini" type="warning">去充值</u-button>
        </navigator>
      </view>
    </view>
 
    <view class="shop-name">{{cardInfo.name}}</view>
    <view v-if="codeContentStr" class="ewmBox">
      <tki-qrcode @result="result" class="ewm" cid="qrcode1" ref="qrcode" :val="codeContentStr" :size="430" unit="upx" onval :loadMake="false" usingComponents />
    </view>
  </view>
</template>
 
<script>
import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
export default {
  components: {tkiQrcode},
  data() {
    return {
      codeContentStr: '{"type":1,"name":"","amount":0,"score":0,"times":12}',
      cardInfo: {
        type: '',
        name: '',
        amount: 0,
        score: 0,
        times: 0
      },
    };
  },
  onLoad(opt) {
    this.cardInfo = JSON.parse(decodeURIComponent(opt.cardInfo))
    this.codeContentStr = opt.cardInfo
  },
  onReady() {
    this.$nextTick(() => {
      this.$refs.qrcode._makeCode()
    })
  },
  methods: {
    result(e){
    }
  },
}
</script>
 
<style lang="scss" scoped>
 
.top-card {
  padding: 24rpx;
  background-color: #e93b3d;
  color: #fff;
}
 
.shop-name{
  margin-top: 60rpx;
  text-align: center;
}
.ewmBox {
  position: relative;
  margin: 60rpx auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ewm {
  width: 430rpx;
  height: 430rpx;
}
</style>