Blame view

pages/rechargeDetail/rechargeDetail.vue 8.13 KB
4b045f7c   刘淇   江阴初始化项目
1
  <template>
00a21ab7   chenbiao   add 余额明细 接口联调
2
  	<view>
0b55ba4d   chenbiao   add 余额明细 接口联调
3
4
5
  		<!-- scrollable speed="50" 滚动 -->
  		<uni-notice-bar backgroundColor="#f0ad4e" color="#fff"  single :text="detailText | tranNull"></uni-notice-bar>
  
00a21ab7   chenbiao   add 余额明细 接口联调
6
7
8
9
10
11
  		<view class="uni-list">
  			<view class="uni-list-cell">
  				<view class="uni-list-cell-left">
  					消费类型
  				</view>
  				<view class="uni-list-cell-db">
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
12
  					<picker @change="bindPickerChange" :value="index" :range="kindArray" :range-key="'kindName'">
00a21ab7   chenbiao   add 余额明细 接口联调
13
14
15
16
17
18
19
20
21
22
23
24
  						<view class="uni-input">{{kindArray[index].kindName}}</view>
  					</picker>
  				</view>
  			</view>
  		</view>
  
  		<view class="uni-list">
  			<view class="uni-list-cell">
  				<view class="uni-list-cell-left">
  					充值方式
  				</view>
  				<view class="uni-list-cell-db">
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
25
  					<picker @change="bindPickerChangeWay" :value="indexWay" :range="arrayWay" :range-key="'typeName'">
10ba946f   chenbiao   add 余额明细 接口联调
26
  						<view class="uni-input">{{arrayWay[indexWay].typeName}}</view>
00a21ab7   chenbiao   add 余额明细 接口联调
27
28
29
30
31
32
33
34
35
36
37
38
39
  					</picker>
  				</view>
  			</view>
  		</view>
  
  
  		<view class="uni-list">
  			<view class="uni-list-cell">
  				<view class="uni-list-cell-left">
  					开始时间
  				</view>
  				<view class="uni-list-cell-db">
  					<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindStartDateChange">
10ba946f   chenbiao   add 余额明细 接口联调
40
  						<view class="uni-input">{{beginDate}}</view>
00a21ab7   chenbiao   add 余额明细 接口联调
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  					</picker>
  				</view>
  			</view>
  		</view>
  
  		<view class="uni-list">
  			<view class="uni-list-cell">
  				<view class="uni-list-cell-left">
  					结束时间
  				</view>
  				<view class="uni-list-cell-db">
  					<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindEndDateChange">
  						<view class="uni-input">{{overDate}}</view>
  					</picker>
  				</view>
  			</view>
  		</view>
  
  		<view class="border-bg"></view>
  
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
61
  		<view class="" v-if="orderList.length > 0">
00a21ab7   chenbiao   add 余额明细 接口联调
62
  
2e99af66   chenbiao   add 账单详情 接口联调
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  			<uni-list class="rechargeWrap pos-rel" clickable v-for="(item, index) in orderList" :key="index" >
  				<view class="" @click="toOutDetail(item)">
  					<view class="recordCon uni-list-cell-pd">
  						<text class="color-black">{{item.changeFeeDetail}}</text>
  						<text>{{item.payStateDesc}}</text>
  					</view>
  					<view class="recordCon uni-list-cell-pd">
  						<text v-if="item.typeName == '购买卡券'" class="color-green">{{item.typeName}}</text>
  						<text v-if="item.typeName == '微信充值'" class="color-green">{{item.typeName}}</text>
  						<text v-if="item.typeName == '支付停车费'" class="color-red">{{item.typeName}}</text>
  						<text v-if="item.typeName == '支付宝充值'" class="color-blue">{{item.typeName}}</text>
  						<text v-if="item.typeName == '平台现金充值'" class="color-red">{{item.typeName}}</text>
  						<text>{{item.opTime}}</text>
  					</view>
  					<view class="uni-icon pos-abs icon-arrowright uni-icon-arrowright">
  					</view>
  				</view>	
  				
00a21ab7   chenbiao   add 余额明细 接口联调
81
  			</uni-list>
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
82
  			<uni-load-more :status="status" />
00a21ab7   chenbiao   add 余额明细 接口联调
83
  
b8bb7d4e   chenbiao   add 余额明细 接口联调
84
  		</view>
00a21ab7   chenbiao   add 余额明细 接口联调
85
  
b8bb7d4e   chenbiao   add 余额明细 接口联调
86
87
88
89
90
  		<view v-else class="margin-top-30">
  			<image class="marginAuto" src="../../static/vipcard/novipcard.png" mode="aspectFit"></image>
  			<view class="text-center">
  				暂无记录
  			</view>
00a21ab7   chenbiao   add 余额明细 接口联调
91
  
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
92
93
  		</view>
  
00a21ab7   chenbiao   add 余额明细 接口联调
94
  
00a21ab7   chenbiao   add 余额明细 接口联调
95
  
00a21ab7   chenbiao   add 余额明细 接口联调
96
  	</view>
4b045f7c   刘淇   江阴初始化项目
97
98
99
  </template>
  
  <script>
00a21ab7   chenbiao   add 余额明细 接口联调
100
101
102
103
104
105
  	export default {
  		data() {
  			const currentDate = this.getDate({
  				format: true
  			})
  			return {
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
106
107
  
  				detailText: '',
00a21ab7   chenbiao   add 余额明细 接口联调
108
109
110
111
112
  				title: 'picker',
  				kindArray: [],
  				arrayWay: [],
  				index: 0,
  				indexWay: 0,
b8bb7d4e   chenbiao   add 余额明细 接口联调
113
114
  				kind: '',
  				type: '',
10ba946f   chenbiao   add 余额明细 接口联调
115
  				beginDate: currentDate,
00a21ab7   chenbiao   add 余额明细 接口联调
116
  				overDate: currentDate,
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
117
  				orderList: [],
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
118
  				// isLoadAll: false,
b8bb7d4e   chenbiao   add 余额明细 接口联调
119
  				totalPages: 1, // 总页数
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
120
  				page: 1,
b79857f8   刘淇   商户券明细
121
  				pageSize: 10,
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
122
  				status: 'no-more',
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
123
  
00a21ab7   chenbiao   add 余额明细 接口联调
124
125
126
127
128
129
  			}
  		},
  		onLoad(params) {
  			wx.showShareMenu({
  				withShareTicket: true
  			});
10ba946f   chenbiao   add 余额明细 接口联调
130
  			this.getKindType();
b79857f8   刘淇   商户券明细
131
  
00a21ab7   chenbiao   add 余额明细 接口联调
132
133
  		},
  		onShow() {
b79857f8   刘淇   商户券明细
134
  
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
135
136
137
  		},
  		// 下拉刷新触发
  		onPullDownRefresh(val) {
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
138
  
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
139
  			this.page = 1
b79857f8   刘淇   商户券明细
140
  			this.pageSize = this.pageSize
b8bb7d4e   chenbiao   add 余额明细 接口联调
141
  			this.totalPages = 1
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
142
  			this.orderList = []
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
143
  			console.log('下拉刷新', val)
b8bb7d4e   chenbiao   add 余额明细 接口联调
144
  			this.fetchData()
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
145
146
147
  		},
  		// 上拉加载触发
  		onReachBottom() {
6bbfedb1   刘淇   商户券明细
148
149
150
            console.log(this.totalPages)
            console.log(this.orderList.length)
  
ca970168   刘淇   商户券明细
151
152
153
154
155
156
            if (this.totalPages == this.orderList.length) {
              this.status = 'no-more'
              console.log('111')
              return
            } else {
              this.page++;
6bbfedb1   刘淇   商户券明细
157
              this.fetchData();
ca970168   刘淇   商户券明细
158
            }
00a21ab7   chenbiao   add 余额明细 接口联调
159
  		},
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
160
  
00a21ab7   chenbiao   add 余额明细 接口联调
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
  		computed: {
  			startDate() {
  				return this.getDate('start');
  			},
  			endDate() {
  				return this.getDate('end');
  			}
  		},
  		methods: {
  			getKindType() {
  				let that = this;
  				that.$myRequest({
  					url: that.$common.walletKindType,
  					method: 'POST',
  					data: that.$common.requestSign()
  				}).then(res => {
10ba946f   chenbiao   add 余额明细 接口联调
177
  
00a21ab7   chenbiao   add 余额明细 接口联调
178
  					let data = res.data;
00a21ab7   chenbiao   add 余额明细 接口联调
179
  					that.kindArray = data;
4d3d7875   chenbiao   add 余额明细 接口联调
180
  					that.kind = data[0].kind;
10ba946f   chenbiao   add 余额明细 接口联调
181
  					that.arrayWay = data[0].typeList;
4d3d7875   chenbiao   add 余额明细 接口联调
182
  					that.type = data[0].typeList[0].type;
10ba946f   chenbiao   add 余额明细 接口联调
183
  					console.log(data)
b8bb7d4e   chenbiao   add 余额明细 接口联调
184
185
  					console.log(that.kind, that.type)
  					that.getDetailSummary();
b79857f8   刘淇   商户券明细
186
  
b8bb7d4e   chenbiao   add 余额明细 接口联调
187
  					that.fetchData()
00a21ab7   chenbiao   add 余额明细 接口联调
188
189
190
191
192
  				})
  			},
  			bindPickerChange: function(e) {
  				let that = this;
  				that.index = e.detail.value
4d3d7875   chenbiao   add 余额明细 接口联调
193
  				that.kind = that.kindArray[that.index].kind;
10ba946f   chenbiao   add 余额明细 接口联调
194
  				that.arrayWay = that.kindArray[that.index].typeList;
4d3d7875   chenbiao   add 余额明细 接口联调
195
  				that.type = that.kindArray[that.index].typeList[0].type;
b8bb7d4e   chenbiao   add 余额明细 接口联调
196
197
  				console.log(that.kind, that.type)
  				that.getDetailSummary();
2e99af66   chenbiao   add 账单详情 接口联调
198
199
200
201
202
  			
  				that.page = 1
  				that.pageSize = this.pageSize
  				that.totalPages = 1
  				that.orderList = []
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
203
  				that.fetchData()
00a21ab7   chenbiao   add 余额明细 接口联调
204
205
206
  			},
  			bindPickerChangeWay: function(e) {
  				console.log('picker发送选择改变,携带值为', e.detail.value)
4d3d7875   chenbiao   add 余额明细 接口联调
207
  				this.indexWay = e.detail.value;
b8bb7d4e   chenbiao   add 余额明细 接口联调
208
209
210
  				this.type = this.arrayWay[this.indexWay].type;
  				console.log(this.kind, this.type)
  				this.getDetailSummary();
2e99af66   chenbiao   add 账单详情 接口联调
211
212
213
214
  				this.page = 1
  				this.pageSize = this.pageSize
  				this.totalPages = 1
  				this.orderList = []
4d3d7875   chenbiao   add 余额明细 接口联调
215
  				this.fetchData()
00a21ab7   chenbiao   add 余额明细 接口联调
216
217
  			},
  			bindStartDateChange: function(e) {
10ba946f   chenbiao   add 余额明细 接口联调
218
  				this.beginDate = e.detail.value
b8bb7d4e   chenbiao   add 余额明细 接口联调
219
  				this.getDetailSummary();
2e99af66   chenbiao   add 账单详情 接口联调
220
221
222
223
  				this.page = 1
  				this.pageSize = this.pageSize
  				this.totalPages = 1
  				this.orderList = []
4d3d7875   chenbiao   add 余额明细 接口联调
224
  				this.fetchData()
00a21ab7   chenbiao   add 余额明细 接口联调
225
226
227
  			},
  			bindEndDateChange: function(e) {
  				this.overDate = e.detail.value
b8bb7d4e   chenbiao   add 余额明细 接口联调
228
  				this.getDetailSummary();
2e99af66   chenbiao   add 账单详情 接口联调
229
230
231
232
  				this.page = 1
  				this.pageSize = this.pageSize
  				this.totalPages = 1
  				this.orderList = []
4d3d7875   chenbiao   add 余额明细 接口联调
233
  				this.fetchData()
00a21ab7   chenbiao   add 余额明细 接口联调
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
  			},
  			getDate(type) {
  				const date = new Date();
  				let year = date.getFullYear();
  				let month = date.getMonth() + 1;
  				let day = date.getDate();
  				if (type === 'start') {
  					year = year - 60;
  				} else if (type === 'end') {
  					year = year + 2;
  				}
  				month = month > 9 ? month : '0' + month;
  				day = day > 9 ? day : '0' + day;
  				return `${year}-${month}-${day}`;
  			},
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
249
250
251
  			getDetailSummary() {
  				let that = this;
  				let data = {
4d3d7875   chenbiao   add 余额明细 接口联调
252
253
  					kind: that.kind,
  					type: that.type,
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
254
255
  					beginDate: new Date(that.beginDate + " 00:00:00"),
  					endDate: new Date(that.overDate + " 23:59:59")
10ba946f   chenbiao   add 余额明细 接口联调
256
257
258
259
260
261
262
  				};
  				console.log(data)
  				that.$myRequest({
  					url: that.$common.detailSummary,
  					method: 'POST',
  					data: that.$common.requestSign(data)
  				}).then(res => {
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
263
  
10ba946f   chenbiao   add 余额明细 接口联调
264
  					let data = res.data;
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
265
  					if (data.rechargeSummary) {
10ba946f   chenbiao   add 余额明细 接口联调
266
267
  						that.detailText = data.rechargeSummary
  					}
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
268
  					if (data.paySummary) {
10ba946f   chenbiao   add 余额明细 接口联调
269
270
  						that.detailText = data.paySummary
  					}
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
271
  
10ba946f   chenbiao   add 余额明细 接口联调
272
  				})
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
273
274
  
  			},
b8bb7d4e   chenbiao   add 余额明细 接口联调
275
  			fetchData() {
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
276
  				let that = this
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
277
  				that.status = 'loading'
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
278
279
280
  				let paramsData = {
  					pageNum: that.page,
  					pageSize: that.pageSize,
4d3d7875   chenbiao   add 余额明细 接口联调
281
282
  					kind: that.kind,
  					type: that.type,
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
283
284
285
  					beginDate: new Date(that.beginDate + " 00:00:00"),
  					endDate: new Date(that.overDate + " 23:59:59")
  				}
0b55ba4d   chenbiao   add 余额明细 接口联调
286
  			
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
287
288
289
290
291
  				that.$myRequest({
  					url: that.$common.walletDetailsPage,
  					method: 'POST',
  					data: that.$common.requestSign(paramsData)
  				}).then(res => {
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
292
293
  					if (res.data.pageTotals < 10) {
  						this.status = 'no-more'
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
294
  					} else {
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
295
  						this.status = 'more'
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
296
  					}
a8e36028   chenbiao   add 我的钱包 小程序支付 接口联调
297
298
  					that.totalPages = res.data.pageTotals;
  					that.orderList = that.orderList.concat(res.data.dataList)
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
299
  				})
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
300
  			},
2e99af66   chenbiao   add 账单详情 接口联调
301
302
303
304
305
306
  			toOutDetail(i){
  				console.log('详情')
  				uni.navigateTo({
  				  url: '../rechargeDetail/outDetail?optionData='+JSON.stringify(i)
  				});
  			}
b9ec5385   chenbiao   add 余额明细 刷新下拉分页请求
307
  
00a21ab7   chenbiao   add 余额明细 接口联调
308
309
  		}
  	}
4b045f7c   刘淇   江阴初始化项目
310
311
312
  </script>
  
  <style lang="scss" scoped>
00a21ab7   chenbiao   add 余额明细 接口联调
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  	.rechargeWrap {
  		position: relative;
  
  		.rechargeArrow {
  			position: absolute;
  			right: 10px;
  			top: 30px;
  			font-size: 20px;
  			color: #999;
  		}
  	}
  
  	.recordCon {
  		padding-right: 35px;
  		color: #999;
  		display: flex;
  		justify-content: space-between;
  	}
0b55ba4d   chenbiao   add 余额明细 接口联调
331
332
333
334
335
336
  	.icon-arrowright {
  		color: #bbb;
  		font-size: 20px;
  		right: 2upx;
  		top: 60upx;
  	}
4b045f7c   刘淇   江阴初始化项目
337
  </style>