Blame view

src/views/cards/buyCard.vue 6.26 KB
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
1
2
3
4
5
6
7
8
9
10
  <template>
    <div>
      <ul class="choose-area">
        <li>
          <div style="color: #666">卡名称</div>
          <div>微纳园卡</div>
        </li>
  
        <li>
          <div style="color: #666">选择卡类型</div>
8b40a4fc   刘淇   会员卡
11
12
          <div>{{carType}}</div>
          <!--<div class="arrow">></div>-->
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
13
14
15
16
17
18
19
20
21
22
23
        </li>
  
  
        <li>
          <div style="color: #666">绑定车牌</div>
          <div @click="carNumberVisible = true">{{carNumber}}</div>
          <div class="arrow">></div>
        </li>
  
        <li>
          <div style="color: #A31414">生效时间</div>
8b40a4fc   刘淇   会员卡
24
          <div style="color: #A31414" @click="selectData">{{ $utils.timestampToTime(startData) }}</div>
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
          <div class="arrow">></div>
        </li>
  
        <li>
          <div style="color: #666">有效期至</div>
          <div>{{ $utils.timestampToTime(endDate)}}</div>
        </li>
  
  
        <li>
          <div style="color: #666">购买数量</div>
          <div class="choose-num">
            <span @click="addCardNum">+</span>
            <span>{{cardNum}}</span>
            <span @click="reduceCarNum">-</span>
          </div>
        </li>
  
        <li>
          <div style="color: #666">单价</div>
8b40a4fc   刘淇   会员卡
45
          <div>¥{{unitPrice}}</div>
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
46
47
48
49
50
51
52
53
54
55
        </li>
  
  
        <li>
          <div style="color: #666">优惠金额</div>
          <div>¥0.00</div>
        </li>
  
        <li>
          <div style="color: #666">应付金额</div>
8b40a4fc   刘淇   会员卡
56
          <div style="color: #A31414">¥{{needPay}}</div>
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
57
58
59
60
61
62
63
64
65
66
67
68
69
        </li>
  
      </ul>
  
      <div class="parkArea leftRightPadding">
        <p class="parkAreaTitle">
          <span>本卡同时适用于以下停车场:</span>
          <span class="parkMore" @click="parkMoreVisible = true">查看更多</span>
        </p>
  
        <p>停车场停车场停车停车场</p>
      </div>
  
8b40a4fc   刘淇   会员卡
70
      <div style="margin-top: 34px" class="leftRightPadding">
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
        <mt-button type="danger" size="large">确定购买</mt-button>
      </div>
  
      <!-- @touchmove.prevent 阻止默认事件,在选择时间时阻止页面也跟着滚动-->
      <div @touchmove.prevent>
        <mt-datetime-picker
          lockScroll="true"
          ref="datePicker"
          v-model="dateVal"
          type="date"
          year-format="{value} 年"
          month-format="{value} 月"
          date-format="{value} 日"
          :startDate="startDate"
          @confirm="handleConfirm()"
        ></mt-datetime-picker>
      </div>
  
  
      <mt-actionsheet
        :actions="actions"
        v-model="popupVisible">
      </mt-actionsheet>
  
      <mt-actionsheet
        :actions="carNumList"
        v-model="carNumberVisible">
      </mt-actionsheet>
  
      <mt-popup
        v-model="parkMoreVisible" class="park-list-wrap"
8b40a4fc   刘淇   会员卡
102
      >
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
103
104
105
106
107
108
109
110
111
        <ul class="park-list">
          <li v-for="(i, index) in 10">{{index+1}}、停车场{{i}}</li>
        </ul>
      </mt-popup>
  
    </div>
  </template>
  
  <script>
8b40a4fc   刘淇   会员卡
112
  import { timestampToTime } from "../../utils/utils.js";
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
113
  export default {
8b40a4fc   刘淇   会员卡
114
    name: "buyCard",
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
115
116
117
    data() {
      return {
        startDate: new Date(),
8b40a4fc   刘淇   会员卡
118
119
120
121
        dateVal: "",
        selectedValue: "",
        startData: new Date(),
        endDate: new Date(),
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
122
123
        popupVisible: false,
        actions: [
8b40a4fc   刘淇   会员卡
124
125
126
          { name: "月卡", num: 1, method: this.clickAction },
          { name: "季卡", num: 3, method: this.clickAction },
          { name: "年卡", num: 12, method: this.clickAction }
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
127
        ],
8b40a4fc   刘淇   会员卡
128
129
130
131
132
133
134
        carType: "月卡",
        carNumList: [
          { name: "停车场1", method: this.clickActionCarNum },
          { name: "停车场2", method: this.clickActionCarNum },
          { name: "停车场3", method: this.clickActionCarNum },
          { name: "停车场4", method: this.clickActionCarNum },
          { name: "停车场5", method: this.clickActionCarNum }
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
135
        ],
8b40a4fc   刘淇   会员卡
136
137
138
139
140
141
142
        carNumber: "京A12334",
        carNumberVisible: false,
        parkMoreVisible: false,
        cardNum: 1,
        unitPrice: 10,
        needPay: 0
      };
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
143
144
145
146
    },
    methods: {
      //打开时间选择器
      selectData() {
8b40a4fc   刘淇   会员卡
147
148
149
150
        this.$refs["datePicker"].open();
        // console.log(this.startData)
        // this.endDate = this.startData.setMonth(this.startData.getMonth()+1)
        // console.log(this.endDate)
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
151
152
      },
      handleConfirm() {
8b40a4fc   刘淇   会员卡
153
154
155
        console.log(this.dateVal);
        this.startData = this.$utils.timestampToTime(this.dateVal);
        this.endDate = this.dateVal.setMonth(this.dateVal.getMonth() + 1);
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
156
      },
8b40a4fc   刘淇   会员卡
157
158
159
160
      clickAction(e) {
        console.log(e.name);
        this.carType = e.name;
        this.endDate = this.startData;
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
161
      },
8b40a4fc   刘淇   会员卡
162
163
      clickActionCarNum(e) {
        this.carNumber = e.name;
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
164
      },
8b40a4fc   刘淇   会员卡
165
166
167
      addCardNum() { // 增加购买数量
        this.cardNum++;
        this.calcMoney()
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
168
      },
8b40a4fc   刘淇   会员卡
169
170
171
      reduceCarNum() { // 增加购买数量
        if (this.cardNum == 1) {
          return;
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
172
        }
8b40a4fc   刘淇   会员卡
173
174
        this.cardNum--;
        this.calcMoney()
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
175
      },
8b40a4fc   刘淇   会员卡
176
177
178
      calcMoney() {
        this.needPay = this.cardNum*this.unitPrice
      }
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
179
180
181
182
    },
    filters: {
      formatDate(time) {
        var date = new Date(time);
8b40a4fc   刘淇   会员卡
183
        return formatDate(date);
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
184
      }
8b40a4fc   刘淇   会员卡
185
186
    }
  };
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
  </script>
  
  <style scoped lang="scss">
    .choose-area {
      background: #fff;
      padding: 0 10px;
    }
  
    .choose-area > li {
      padding-right: 20px;
      position: relative;
      height: 38px;
      line-height: 38px;
      border-bottom: 1px solid #EFEFEF;
      display: flex;
      justify-content: space-between;
      .arrow {
        position: absolute;
        right: 0;
        top: 0;
        font-size: 16px;
      }
      &:last-child {
        border-bottom: 0;
      }
    }
8b40a4fc   刘淇   会员卡
213
214
  
    .choose-num {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
215
216
217
218
219
      height: 28px;
      margin-top: 5px;
      line-height: 28px;
      display: flex;
      border: 1px solid #D8D8D8;
8b40a4fc   刘淇   会员卡
220
      span {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
221
        display: inline-block;
8b40a4fc   刘淇   会员卡
222
        &:nth-of-type(1) {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
223
224
225
226
227
          width: 28px;
          height: 28px;
          text-align: center;
          cursor: pointer;
        }
8b40a4fc   刘淇   会员卡
228
        &:nth-of-type(2) {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
229
230
231
232
233
          width: 50px;
          text-align: center;
          border-left: 1px solid #D8D8D8;
          border-right: 1px solid #D8D8D8;
        }
8b40a4fc   刘淇   会员卡
234
        &:nth-of-type(3) {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
235
236
237
238
239
240
241
          width: 28px;
          height: 28px;
          text-align: center;
          cursor: pointer;
        }
      }
    }
8b40a4fc   刘淇   会员卡
242
243
  
    .parkArea {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
244
245
246
247
248
249
      padding-top: 10px;
      padding-bottom: 10px;
      margin-top: 10px;
      background: #fff;
      color: #999;
    }
8b40a4fc   刘淇   会员卡
250
251
  
    .parkAreaTitle {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
252
253
254
255
      display: flex;
      justify-content: space-between;
      color: #666;
    }
8b40a4fc   刘淇   会员卡
256
257
  
    .parkMore {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
258
259
      cursor: pointer;
    }
8b40a4fc   刘淇   会员卡
260
261
  
    .park-list-wrap {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
262
263
264
265
266
      width: 80%;
      max-height: 70%;
      overflow-y: scroll;
      border-radius: 5px;
    }
8b40a4fc   刘淇   会员卡
267
268
  
    .park-list {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
269
270
  
      /*width: 80%;*/
8b40a4fc   刘淇   会员卡
271
      li {
bb951693   liuqimichale   赤峰微信公众号 -- 临停支付
272
273
274
275
276
277
        padding-left: 20px;
        line-height: 25px;
      }
    }
  
  </style>