fix
13404089107
8 天以前 2e90f57e7d28d6a949247ef39b487d3e75b56683
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
  <view class="content">
    <block v-if="!loading.page">
      <view class="card" v-for="(item,index) of list" :key="index" :class="{'report-lost':item.state == 2}">
        <view class="card-title">卡号:{{ item.kahao }}</view>
        <view class="card-number">已饮水:{{item.yins }}ml</view>
        <view class="card-illustrate">
          <view class="illustrate-text" v-if="item.state == 1">使用中</view>
          <view class="illustrate-text" v-if="item.state == 2">已挂失</view>
          <view class="illustrate-text" @click="openMenu(item)">管理</view>
        </view>
      </view>
      <view class="bind-add-card">
        <button class="button" @click="$navTo('/pages/user/bindCard/addCard')">添加新卡</button>
      </view>
      <view class="nomore" v-if="!loading.page && !list.length">
        <u-loadmore status="nomore" />
      </view>
    </block>
    <u-loading-page :loading="loading.page"></u-loading-page>
    <ActionSheet ref="actionSheet"></ActionSheet>
  </view>
</template>
 
<script>
  export default {
    data() {
      return {
        loading:{
          page:true
        },
        list:[]
      };
    },
    onLoad() {
    },
    onShow() {
      this.init()
    },
    onPullDownRefresh() {
      this.init()
    },
    methods:{
      init(){
        this.$apis.user.binding().then(res=>{
          this.loading.page = false
          this.list = res.data
          uni.stopPullDownRefresh()
        })
      },
      openMenu(item){
        this.$refs.actionSheet.open(["饮水监控","挂失","解绑"],ev=>{
          switch (ev.tapIndex){
            case 0:
              this.$navTo("/pages/user/bindCard/record?id=" + item.kahao)
              break;
            case 1:
              if(item.state == 2){
                this.$toast('已挂失')
                return
              }
              this.$navTo("/pages/user/bindCard/verificationCode?t=1&title=挂失&id=" + item.id)
              break;
            case 2:
              this.$navTo("/pages/user/bindCard/verificationCode?t=2&title=解绑&id=" + item.id)
              break;
            default:
              break;
          }
        })
      },
      reportLostClose(){
        this.reportLostShow = false
      }
    }
  }
</script>
 
<style lang="scss">
.content{
  padding: 28rpx;
  .card{
    margin: 0 auto;
    width: 694rpx;
    height: 244rpx;
    background: #FF2729;
    border-radius: 20rpx;
    padding: 16rpx;
    display: flex;
    flex-direction: column;
    margin-bottom: 20rpx;
    &.report-lost{
      opacity: 0.5;
    }
    .card-title{
      font-size: 23rpx;
      color: #FFFFFF;
      line-height: 27rpx;
      text-align: left;
      font-style: normal;
    }
    .card-number{
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 38rpx;
      color: #FFFFFF;
      line-height: 58rpx;
    }
    .card-illustrate{
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12rpx;
      .illustrate-text{
        padding-left: 16rpx;
        font-size: 24rpx;
        color: #FFFFFF;
        line-height: 24rpx;
      }
    }
  }
  .bind-add-card{
    position: fixed;
    bottom: 0;
    left: 0;
    width: 750rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    padding-bottom: 83rpx;
    .button{
      width: 635rpx;
      height: 96rpx;
      background: #FF2729;
      border-radius: 58rpx;
      font-weight: 700;
      font-size: 35rpx;
      color: #FFFFFF;
      line-height: 48rpx;
    }
  }
}
</style>