Blame view

src/views/cards/Cards.vue 5.57 KB
8b40a4fc   刘淇   会员卡
1
2
3
  <template>
    <div style="height: 100%;display: flex;flex-direction: column;">
      <div style="flex: 1;overflow-y: auto;padding: 15px">
555e2a0e   刘淇   续费会员卡
4
        <div class="noCardData" v-if="cardList.length == 0">
8b40a4fc   刘淇   会员卡
5
          <p>您目前没有任何会员卡,</p>
8cfc6ab9   刘淇   西城购买月卡
6
  
8b40a4fc   刘淇   会员卡
7
        </div>
aabd3df4   刘淇   购买会员卡
8
9
  
        <div v-else>
555e2a0e   刘淇   续费会员卡
10
11
12
          <div v-for="(i ,index) in cardList" class="cardBg"
               :class="{'nianka':i.cardType==1,'bannianka':i.cardType==2,'jika':i.cardType==3,'yueka':i.cardType==4,'rika':i.cardType==5,shixiao:i.cardStatus==0}"
          >
aabd3df4   刘淇   购买会员卡
13
            <ul class="cardList">
555e2a0e   刘淇   续费会员卡
14
15
16
              <li style="padding-left: 25px;">
                会员卡-
                {{i.cardType=="1"?"年卡":(i.cardType=="2"?"半年卡":(i.cardType=="3"?"季卡":(i.cardType=="4"?"月卡":(i.cardType=="5"?"日卡":""))))}}
aabd3df4   刘淇   购买会员卡
17
18
19
20
21
22
23
24
25
26
27
              </li>
              <li>
                绑定车牌号: {{ i.carNumber }}
              </li>
              <li>
                有效时间段: {{i.effDate}} 至 {{i.expDate}}
              </li>
              <li>
                卡名称: {{ i.cardName }}
              </li>
            </ul>
555e2a0e   刘淇   续费会员卡
28
29
30
31
32
33
34
35
36
37
38
            <div class="cardStatus"
                 v-if="i.cardStatus==1"
                 :class="{'niankaStatus':i.cardType==1,'banniankaStatus':i.cardType==2,'jikaStatus':i.cardType==3,'yuekaStatus':i.cardType==4,'rikaStatus':i.cardType==5}"
            >
              月卡生效中
            </div>
            <div class="cardStatus shixiaocardStatus" v-else>月卡已失效</div>
            <div class="renewBtn" @click="toReNew(i)"
                 v-if="i.cardStatus==1"
                 :class="{'niankaStatus':i.cardType==1,'banniankaStatus':i.cardType==2,'jikaStatus':i.cardType==3,'yuekaStatus':i.cardType==4,'rikaStatus':i.cardType==5}"
            >续费</div>
aabd3df4   刘淇   购买会员卡
39
40
41
42
          </div>
          <!--cardType=='1'?'年卡':(cardType=='2'?'半年卡':(cardType=='3'?'季卡':(cardType=='4'?'月卡':(cardType=='5'?'日卡':''))))-->
  
  
8b40a4fc   刘淇   会员卡
43
        </div>
aabd3df4   刘淇   购买会员卡
44
45
  
  
8b40a4fc   刘淇   会员卡
46
      </div>
6e6de4e6   刘淇   修改整体颜色
47
      <!--<x-button type="primary" ></x-button>-->
d2fe64ed   刘淇   西城 所有车牌购买会员卡
48
49
      <!--<mt-button type="primary" size="large" @click.native="$router.push({path:'buyCard'})">购买会员卡</mt-button>-->
      <mt-button type="primary" size="large" @click.native="toBuy">购买会员卡</mt-button>
8b40a4fc   刘淇   会员卡
50
51
52
53
    </div>
  </template>
  
  <script>
d2fe64ed   刘淇   西城 所有车牌购买会员卡
54
  import { queryVipCardsByCustId, queryVipCardsByCarNumberForH5 } from "@/api/cards/cards";
8b40a4fc   刘淇   会员卡
55
56
57
58
  export default {
    name: "Cards",
    data() {
      return {
89d61651   刘淇   西城购买月卡
59
60
        cardList: [],
        custId:''
8b40a4fc   刘淇   会员卡
61
62
63
      };
    },
    mounted() {
d2fe64ed   刘淇   西城 所有车牌购买会员卡
64
65
      // this.queryVipCardsByCustId();
      this.queryVipCardsByCarNumberForH5()
8b40a4fc   刘淇   会员卡
66
67
    },
    methods: {
555e2a0e   刘淇   续费会员卡
68
      // 获取会员卡列表
d2fe64ed   刘淇   西城 所有车牌购买会员卡
69
70
71
72
73
74
75
76
      queryVipCardsByCarNumberForH5:function(){
        let jsondata = this.$utils.commonParams();
        jsondata.carNumber = this.$route.query.carNumber
        jsondata.carNumberColor = this.$route.query.carNumberColor
        jsondata.sign = this.$utils.signObject(jsondata);
        queryVipCardsByCarNumberForH5(jsondata).then(data => {
          console.log(data);
          if (data.code == 0) {
89d61651   刘淇   西城购买月卡
77
78
79
80
            this.cardList = data.data
            if(this.cardList.length>0){
              this.custId = this.cardList[0].custId
            }
d2fe64ed   刘淇   西城 所有车牌购买会员卡
81
82
83
84
85
          } else {
            this.$vux.toast.text(data.message, "top");
          }
        });
      },
8b40a4fc   刘淇   会员卡
86
87
88
89
90
91
92
      queryVipCardsByCustId: function() {
        let jsondata = this.$utils.commonParams();
        jsondata.sign = this.$utils.signObject(jsondata);
        queryVipCardsByCustId(jsondata).then(data => {
          console.log(data);
          if (data.code == 0) {
            let res = data.data;
555e2a0e   刘淇   续费会员卡
93
            this.cardList = res;
8b40a4fc   刘淇   会员卡
94
95
96
97
          } else {
            this.$vux.toast.text(data.message, "top");
          }
        });
555e2a0e   刘淇   续费会员卡
98
99
100
101
102
103
      },
      // 续费
      toReNew: function(i) {
        console.log(i);
        sessionStorage.setItem("renewData", JSON.stringify(i));
        this.$router.push("renew");
d2fe64ed   刘淇   西城 所有车牌购买会员卡
104
105
106
107
108
109
110
111
      },
  
      // 购买
      toBuy:function() {
        this.$router.push({
          path:'buyCard',
          query:{
            carNumber:this.$route.query.carNumber,
89d61651   刘淇   西城购买月卡
112
113
            carNumberColor: this.$route.query.carNumberColor,
            custId:this.custId
d2fe64ed   刘淇   西城 所有车牌购买会员卡
114
115
          }
        })
8b40a4fc   刘淇   会员卡
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
      }
    }
  };
  </script>
  
  <style scoped lang="scss">
    .noCardData {
      padding-top: 130px;
      background: url("../../assets/images/cards/nodata.png") no-repeat center 0;
      background-size: 121px 100px;
      text-align: center;
    }
  
    .cardBg {
      width: 100%;
      height: 150px;
555e2a0e   刘淇   续费会员卡
132
133
134
135
      position: relative;
      background-image: url("../../assets/images/cards/cards.png");
      background-repeat: no-repeat;
      background-position: 20px 20px;
8b40a4fc   刘淇   会员卡
136
137
138
      background-size: 90% 90%;
      border-radius: 8px;
      margin-bottom: 15px;
555e2a0e   刘淇   续费会员卡
139
140
141
142
      overflow: hidden;
    }
    .nianka{
      background-color: #dd6c1e;
8b40a4fc   刘淇   会员卡
143
    }
555e2a0e   刘淇   续费会员卡
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
    .bannianka{
      background-color: #2A1DD2;
    }
    .jika{
      background-color: #DF6B1B;
    }
  
    .yueka{
      background-color:  #33CCFF;
    }
    .rika{
      background-color: #498816;
    }
    .shixiao{
      background-color: #ccc;
    }
  
    .cardList {
8b40a4fc   刘淇   会员卡
162
163
      padding: 20px 0 0 20px;
      color: #fff;
555e2a0e   刘淇   续费会员卡
164
      li {
8b40a4fc   刘淇   会员卡
165
166
167
        line-height: 30px;
      }
    }
555e2a0e   刘淇   续费会员卡
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
    .cardStatus{
      position: absolute;
      left: -22px;
      top: 21px;
      font-size: 12px;
      -webkit-transform: rotate(30deg);
      transform: rotate(-43deg);
      width: 100px;
      text-align: center;
      color: #fff;
    }
    .niankaStatus{
      background-color: #c17b12;
    }
    .yuekaStatus{
      background-color: #3989a3;
    }
    .banniankaStatus{
      background-color: #7972cb;
    }
    .jikaStatus{
      background-color: #f19f67;
    }
    .rikaStatus{
      background-color: #7edb33;
    }
    .shixiaocardStatus{
      background-color: #a59d9d;
    }
  
    .renewBtn {
      position: absolute;
      top: 20px;
      right: 20px;
      /*border: 1px solid #ffbe00;*/
      /*background: #ffbe00;*/
      color: #fff;
      padding: 2px 10px;
      border-radius: 4px;
      cursor: pointer;
    }
8b40a4fc   刘淇   会员卡
209
210
  
  </style>