Blame view

pages/businessCard/businessCard.vue 4.79 KB
4b045f7c   刘淇   江阴初始化项目
1
2
  <template>
      <view>
1bbce61f   刘淇   商户券
3
4
5
6
7
8
9
10
11
          <view v-if="dataList.length>0">
              <view v-for="(i, index) in dataList" :key="i.id">
                  <uni-section :title="`${i.cardRuleName}(${i.cardTypeName })`" type="line">
                      <uni-card padding="0" spacing="0">
  
                          <uni-list>
                              <uni-list-item title="适应车场" :rightText="i.plName">
                                  <text></text>
                              </uni-list-item>
904a46e0   刘淇   卡券购买下单
12
                              <uni-list-item :title="`价格: ¥${$common.moneyFormat(i.value)}/张`"
1bbce61f   刘淇   商户券
13
14
15
16
                                             :rightText="`商户库存:${i.cardNum}张`"></uni-list-item>
                          </uni-list>
                          <view slot="actions" class="card-actions no-border">
  
78e17486   刘淇   商户券明细
17
                              <view class="card-actions-item" @click="toBuy(i)">
1bbce61f   刘淇   商户券
18
19
20
                                  <uni-icons type="cart-filled" size="18" color="#999"></uni-icons>
                                  <text class="card-actions-item-text">购买</text>
                              </view>
75b91c08   刘淇   卡券发放
21
                              <view class="card-actions-item" @click="provideCard(i)" v-show="i.cardNum>0">
1bbce61f   刘淇   商户券
22
23
24
                                  <uni-icons type="redo-filled" size="18" color="#999"></uni-icons>
                                  <text class="card-actions-item-text">发放</text>
                              </view>
75b91c08   刘淇   卡券发放
25
                              <view class="card-actions-item" @click="printClick(i)" v-show="i.cardNum>0">
1bbce61f   刘淇   商户券
26
27
28
29
30
31
32
33
34
                                  <uni-icons type="shop-filled" size="18" color="#999"></uni-icons>
                                  <text class="card-actions-item-text">打印</text>
                              </view>
                          </view>
                      </uni-card>
                  </uni-section>
              </view>
  
          </view>
438e8e43   刘淇   卡券购买下单
35
36
          <uni-load-more :status="status"/>
          <!--<view class="common-page-head" v-else>暂无可以购买的商户卡券</view>-->
4b045f7c   刘淇   江阴初始化项目
37
38
39
40
      </view>
  </template>
  
  <script>
4b045f7c   刘淇   江阴初始化项目
41
42
  export default {
    data() {
4b045f7c   刘淇   江阴初始化项目
43
      return {
1bbce61f   刘淇   商户券
44
        dataList: [],
0b9d5f71   刘淇   停车记录详情
45
46
        rows: [],
        pageNum: 1,//当前页
438e8e43   刘淇   卡券购买下单
47
48
49
        pageSize: 10,//每页条数
        totalPages: '1', // 总条数
        status: 'no-more',
4b045f7c   刘淇   江阴初始化项目
50
51
52
53
54
55
      }
    },
    onLoad(params) {
      wx.showShareMenu({
        withShareTicket: true
      })
0b9d5f71   刘淇   停车记录详情
56
      this.couponRuleParkPage()
4b045f7c   刘淇   江阴初始化项目
57
58
59
    },
    onShow() {
      var me = this;
4b045f7c   刘淇   江阴初始化项目
60
    },
438e8e43   刘淇   卡券购买下单
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
    // 下拉刷新触发
    onPullDownRefresh(val) {
      console.log('下拉刷新触发')
      this.pageNum = 1
      this.pageSize = this.pageSize
      this.totalPages = 1
      this.dataList = []
      this.couponRuleParkPage()
    },
    // 上拉加载触发
    onReachBottom() {
      console.log('上拉加载触发')
      console.log(this.totalPages)
      console.log(this.dataList.length)
      if (this.totalPages == this.dataList.length) {
        this.status = 'no-more'
        return
      } else {
        this.pageNum++;
        this.couponRuleParkPage()
      }
    },
1bbce61f   刘淇   商户券
83
    computed: {},
4b045f7c   刘淇   江阴初始化项目
84
    methods: {
0b9d5f71   刘淇   停车记录详情
85
86
87
      // 通过商户ID查询停车记录信息
      couponRuleParkPage() {
        let that = this
438e8e43   刘淇   卡券购买下单
88
        that.status = 'loading'
0b9d5f71   刘淇   停车记录详情
89
        let paramsData = {
438e8e43   刘淇   卡券购买下单
90
91
          pageNum: this.pageNum,
          pageSize: this.pageSize
4b045f7c   刘淇   江阴初始化项目
92
        }
0b9d5f71   刘淇   停车记录详情
93
94
        // 首页信息获取 接口
        that.$myRequest({
510601e4   刘淇   商户卡券
95
          url: that.$common.couponRuleParkPage,
0b9d5f71   刘淇   停车记录详情
96
97
98
          method: 'POST',
          data: that.$common.requestSign(paramsData)
        }).then(res => {
438e8e43   刘淇   卡券购买下单
99
100
101
102
103
104
105
106
107
108
109
110
111
          if(res.data.dataList.length>0){
            if (res.data.pageTotals < 10) {
              that.status = 'no-more'
            } else {
              that.status = 'more'
              console.log('more')
            }
          }else{
            that.status = 'no-more'
          }
          that.totalPages = res.data.pageTotals;
          that.dataList = that.dataList.concat(res.data.dataList)
          console.log(that.dataList.length)
0b9d5f71   刘淇   停车记录详情
112
        })
4b045f7c   刘淇   江阴初始化项目
113
      },
78e17486   刘淇   商户券明细
114
115
      toBuy(i) {
        uni.navigateTo({
9bac797d   刘淇   卡券发放
116
          url: '../businessCard/buyCard?optionData=' + JSON.stringify(i)
78e17486   刘淇   商户券明细
117
118
        });
      },
9bac797d   刘淇   卡券发放
119
      printClick(i) {
75b91c08   刘淇   卡券发放
120
        uni.navigateTo({
9bac797d   刘淇   卡券发放
121
          url: '../businessCard/cardPrint?optionData=' + JSON.stringify(i)
75b91c08   刘淇   卡券发放
122
123
        });
      },
9bac797d   刘淇   卡券发放
124
      provideCard(i) {
75b91c08   刘淇   卡券发放
125
        uni.navigateTo({
9bac797d   刘淇   卡券发放
126
          url: '../businessCard/provideCard?optionData=' + JSON.stringify(i)
75b91c08   刘淇   卡券发放
127
128
        });
      }
4b045f7c   刘淇   江阴初始化项目
129
130
131
132
133
    }
  }
  </script>
  
  <style lang="scss" scoped>
0b9d5f71   刘淇   停车记录详情
134
      /deep/ .uni-section {
19569f2b   刘淇   购买券
135
136
          padding-bottom: 10px;
      }
0b9d5f71   刘淇   停车记录详情
137
  
4b045f7c   刘淇   江阴初始化项目
138
  
4b045f7c   刘淇   江阴初始化项目
139
140
141
142
143
144
145
146
147
  
      .card-actions {
          display: flex;
          flex-direction: row;
          justify-content: space-around;
          align-items: center;
          height: 45px;
          border-top: 1px #eee solid;
      }
0b9d5f71   刘淇   停车记录详情
148
  
4b045f7c   刘淇   江阴初始化项目
149
150
151
152
153
      .card-actions-item {
          display: flex;
          flex-direction: row;
          align-items: center;
      }
0b9d5f71   刘淇   停车记录详情
154
  
4b045f7c   刘淇   江阴初始化项目
155
156
157
158
159
      .card-actions-item-text {
          font-size: 12px;
          color: #666;
          margin-left: 5px;
      }
0b9d5f71   刘淇   停车记录详情
160
  
4b045f7c   刘淇   江阴初始化项目
161
162
163
164
      .cover-image {
          flex: 1;
          height: 150px;
      }
0b9d5f71   刘淇   停车记录详情
165
  
4b045f7c   刘淇   江阴初始化项目
166
167
168
169
      .no-border {
          border-width: 0;
      }
  </style>