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',
|
5fe46b70
刘淇
卡券购买回到上一页面刷新页面
|
50
|
refreshIfNeeded: false,
|
4b045f7c
刘淇
江阴初始化项目
|
51
52
53
54
55
56
|
}
},
onLoad(params) {
wx.showShareMenu({
withShareTicket: true
})
|
aae61a93
刘淇
余额明细
|
57
|
this.couponRuleParkPage()
|
4b045f7c
刘淇
江阴初始化项目
|
58
59
|
},
onShow() {
|
5fe46b70
刘淇
卡券购买回到上一页面刷新页面
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
var pages = getCurrentPages(); // 获取当前页面栈
var currentPage = pages[pages.length - 1]; // 当前页面
if (currentPage.data.refreshIfNeeded) {
console.log('show')
currentPage.data.refreshIfNeeded = false;
this.pageNum = 1//当前页
this.pageSize = 10//每页条数
this.dataList = []
this.status = 'no-more'
this.couponRuleParkPage(); // 当前页面 method中的方法,用来刷新当前页面
}
},
watch: {
// //监听reFresh,如果有修改就执行监听器
// reFresh: function() {
// //调接口刷新数据
// this.couponRuleParkPage()
// }
|
4b045f7c
刘淇
江阴初始化项目
|
78
|
},
|
438e8e43
刘淇
卡券购买下单
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// 下拉刷新触发
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
刘淇
商户券
|
101
|
computed: {},
|
4b045f7c
刘淇
江阴初始化项目
|
102
|
methods: {
|
0b9d5f71
刘淇
停车记录详情
|
103
104
105
|
// 通过商户ID查询停车记录信息
couponRuleParkPage() {
let that = this
|
438e8e43
刘淇
卡券购买下单
|
106
|
that.status = 'loading'
|
0b9d5f71
刘淇
停车记录详情
|
107
|
let paramsData = {
|
438e8e43
刘淇
卡券购买下单
|
108
109
|
pageNum: this.pageNum,
pageSize: this.pageSize
|
4b045f7c
刘淇
江阴初始化项目
|
110
|
}
|
0b9d5f71
刘淇
停车记录详情
|
111
112
|
// 首页信息获取 接口
that.$myRequest({
|
510601e4
刘淇
商户卡券
|
113
|
url: that.$common.couponRuleParkPage,
|
0b9d5f71
刘淇
停车记录详情
|
114
115
116
|
method: 'POST',
data: that.$common.requestSign(paramsData)
}).then(res => {
|
5fe46b70
刘淇
卡券购买回到上一页面刷新页面
|
117
|
if (res.data.dataList.length > 0) {
|
438e8e43
刘淇
卡券购买下单
|
118
119
120
121
122
123
|
if (res.data.pageTotals < 10) {
that.status = 'no-more'
} else {
that.status = 'more'
console.log('more')
}
|
5fe46b70
刘淇
卡券购买回到上一页面刷新页面
|
124
|
} else {
|
438e8e43
刘淇
卡券购买下单
|
125
126
127
128
129
|
that.status = 'no-more'
}
that.totalPages = res.data.pageTotals;
that.dataList = that.dataList.concat(res.data.dataList)
console.log(that.dataList.length)
|
0b9d5f71
刘淇
停车记录详情
|
130
|
})
|
4b045f7c
刘淇
江阴初始化项目
|
131
|
},
|
78e17486
刘淇
商户券明细
|
132
|
toBuy(i) {
|
433bc1df
刘淇
购买卡券
|
133
|
console.log(i.cardNum)
|
f7833e67
刘淇
卡券数量限制
|
134
135
136
|
uni.navigateTo({
url: '../businessCard/buyCard?optionData=' + JSON.stringify(i)
});
|
f7833e67
刘淇
卡券数量限制
|
137
138
|
},
printClick(i) {
|
27ddc5cb
刘淇
卡券发放
|
139
140
141
142
143
144
145
|
// uni.navigateTo({
// url: '../businessCard/cardPrint?optionData=' + JSON.stringify(i)
// });
uni.showToast({
title: '产品开发中,敬请期待',
icon: 'none',
duration: 2000
|
f7833e67
刘淇
卡券数量限制
|
146
147
148
|
});
},
provideCard(i) {
|
5fe46b70
刘淇
卡券购买回到上一页面刷新页面
|
149
|
if (i.cardNum == 0) {
|
433bc1df
刘淇
购买卡券
|
150
|
uni.showToast({
|
f7833e67
刘淇
卡券数量限制
|
151
|
title: '暂无卡券库存,无法发放',
|
433bc1df
刘淇
购买卡券
|
152
153
154
|
icon: 'none',
duration: 2000
});
|
5fe46b70
刘淇
卡券购买回到上一页面刷新页面
|
155
|
} else {
|
433bc1df
刘淇
购买卡券
|
156
|
uni.navigateTo({
|
f7833e67
刘淇
卡券数量限制
|
157
|
url: '../businessCard/provideCard?optionData=' + JSON.stringify(i)
|
433bc1df
刘淇
购买卡券
|
158
159
|
});
}
|
75b91c08
刘淇
卡券发放
|
160
|
}
|
4b045f7c
刘淇
江阴初始化项目
|
161
162
163
164
165
|
}
}
</script>
<style lang="scss" scoped>
|
0b9d5f71
刘淇
停车记录详情
|
166
|
/deep/ .uni-section {
|
19569f2b
刘淇
购买券
|
167
168
|
padding-bottom: 10px;
}
|
0b9d5f71
刘淇
停车记录详情
|
169
|
|
4b045f7c
刘淇
江阴初始化项目
|
170
171
172
173
174
175
176
177
|
.card-actions {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 45px;
border-top: 1px #eee solid;
}
|
0b9d5f71
刘淇
停车记录详情
|
178
|
|
4b045f7c
刘淇
江阴初始化项目
|
179
180
181
182
183
|
.card-actions-item {
display: flex;
flex-direction: row;
align-items: center;
}
|
0b9d5f71
刘淇
停车记录详情
|
184
|
|
4b045f7c
刘淇
江阴初始化项目
|
185
186
187
188
189
|
.card-actions-item-text {
font-size: 12px;
color: #666;
margin-left: 5px;
}
|
0b9d5f71
刘淇
停车记录详情
|
190
|
|
4b045f7c
刘淇
江阴初始化项目
|
191
192
193
194
|
.cover-image {
flex: 1;
height: 150px;
}
|
0b9d5f71
刘淇
停车记录详情
|
195
|
|
4b045f7c
刘淇
江阴初始化项目
|
196
197
198
199
|
.no-border {
border-width: 0;
}
</style>
|