index.vue
15.7 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<template>
<!-- 我的培训 -->
<view>
<view class="bgWhite">
<view class="uni-padding-wrap uni-common-mt">
<uni-segmented-control
:current="current"
:values="items"
style-type="text"
:active-color="activeColor"
@clickItem="onClickItem"
/>
</view>
<view class="topSearch">
<!-- 搜索框 -->
<uni-search-bar
style="width: 670rpx;"
@clear="onclear()"
@confirm="onconfirm()"
clearButton="auto"
cancelButton="none"
v-model="queryParam.trainName"
></uni-search-bar>
<!-- 弹出框 -->
<uni-icons type="settings" size="30" @click="showSearchPop"></uni-icons>
</view>
</view>
<!-- 报项 -->
<view class="content" v-if="current == 0">
<view v-for="item in list" :key="item.id" class="list-conter" @click="singDetail(item)">
<uniList :item="item" :pic="item.cover" :title="item.trainName" :card="item.statusStr" />
</view>
</view>
<!-- 订单 -->
<view class="billcontent" v-if="current == 1">
<!-- 订单 -->
<uni-collapse>
<uni-collapse-item
title-border="none"
:border="false"
class="baoItem"
:show-animation="true"
v-for="(b, index) in billList"
:key="index"
>
<template v-slot:title>
<view class="bold">{{ b.trainName }}</view>
<view class="pp">
订单编号:
<text>{{ b.id }}</text>
</view>
<!-- <view class="pp">
下单时间:
<text>{{ b.commitTime }}</text>
</view> -->
<view class="pp" v-if="b.totalPayAmount">
已付金额:
<text class="orange">¥{{ b.totalPayAmount }}</text>
</view>
<view class="pp" v-if="b.payment">
订单金额:
<text class="orange" style="font-size: 34rpx;">¥{{ b.payment }}</text>
</view>
</template>
<view class="collapseBody">
<view class="pp" v-if="b.payTime">
付款时间:
<text>{{ b.payTime }}</text>
</view>
<view class="pp" v-if="b.payType">
付款方式:
<text v-if="b.payType == '0'">微信支付</text>
<text v-else-if="b.payType == '1'">线下支付</text>
<text v-else-if="b.payType == '2'">会员支付</text>
<text v-else-if="b.payType == '4'">后台新增</text>
</view>
<view class="pp" v-if="b.needPay == '0'">
状态:
<text class="green">免费订单</text>
</view>
<view class="pp" v-else>
付款状态:
<!-- 0 未支付 1 线下支付待核销 2 付款中 3 已支付 4 退款中 5 已退款 6 退款待核销' -->
<text v-if="b.payStatus == '0'" @click="payBill(b)" class="orange">
{{ b.payStatusStr }}
</text>
<text v-if="b.payStatus == '1'" class="green">{{ b.payStatusStr }}</text>
<text v-if="b.payStatus == '2'" class="orange">{{ b.payStatusStr }}</text>
<text v-if="b.payStatus == '3'" class="green">{{ b.payStatusStr }}</text>
<text v-if="b.payStatus == '4'" class="red">{{ b.payStatusStr }}</text>
<text v-if="b.payStatus == '5'" class="red">{{ b.payStatusStr }}</text>
<text v-if="b.payStatus == '6'">{{ b.payStatusStr }}</text>
</view>
<view class="pp" v-if="b.auditStatus != '0'">
审核状态:
<text v-if="b.auditStatus == '1'" class="orange">待审核</text>
<text v-if="b.auditStatus == '2'" class="green">审核通过</text>
<text v-if="b.auditStatus == '3'" class="red">审核未通过</text>
<text v-if="b.auditStatus == '4'" class="gary">已取消</text>
</view>
<view class="btnsView">
<button class="comKx" @click="goMatchBillDetail(b)">详情</button>
<!-- 如果未付款可以取消订单(非报项) -->
<button class="comKx" @click="cancelBill(b)" v-if="b.payStatus == 0">取消订单</button>
<button class="greenKx" v-if="b.payStatus == 0" @click="goPay(b)">继续付款</button>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
<view class="nodata" v-if="billList.length == 0">
<image mode="aspectFit" src="/static/nodata.png"></image>
<text>还没有赛事订单</text>
</view>
</view>
<uni-popup ref="searchPop" type="bottom" background-color="#fff">
<view class="popTT">筛选</view>
<view class="popBody">
<uni-form :modelValue="queryParam" label-position="top" v-if="current == 0">
<uni-forms-item label="赛事时间">
<uni-datetime-picker v-model="timePeriod" type="datetimerange" />
</uni-forms-item>
<view class="searchBtns">
<button class="btn btnGray" @click="reset">重置</button>
<button class="btn btn1" @click="search">查询</button>
</view>
</uni-form>
<uni-form :modelValue="queryParam" label-position="top" v-if="current == 1">
<uni-forms-item label="状态">
<uni-data-select v-model="queryParam.payStatus" :localdata="billStatusList"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="付款时间">
<uni-datetime-picker @change="changeTime" v-model="timePeriod" type="daterange" />
</uni-forms-item>
<!-- <uni-forms-item label="下单时间">
<uni-datetime-picker v-model="commitTimeArr" type="daterange" />
</uni-forms-item> -->
<view class="searchBtns">
<button class="btn btnGray" @click="reset">重置</button>
<button class="btn btn1" @click="searchBill">查询</button>
</view>
</uni-form>
</view>
</uni-popup>
<uni-popup ref="popPayType" type="bottom" :is-mask-click="false" safe-area background-color="#fff">
<view class="PopcloseBtn" @click="alertGiveup">
<uni-icons type="closeempty" size="30" color="#999"></uni-icons>
</view>
<view class="rrcard" style="padding-bottom: 100rpx;">
<view class="moneyNum">
¥
<text>{{ finialFee }}</text>
</view>
<view class="t">支付方式</view>
<view class="whitebg">
<radio-group @change="payChange">
<!-- 支付方式 0 会员卡支付 1 微信支付 2 线下支付 -->
<label class="uni-list-cell uni-list-cell-pd">
<view class="littleimgBox">
<image class="littleimg" src="@/static/zf01.png"></image>
微信支付
</view>
<view><radio checked="checked" value="1" /></view>
</label>
<label class="uni-list-cell uni-list-cell-pd">
<view class="littleimgBox">
<image class="littleimg" src="@/static/zf02.png"></image>
会员卡支付(余额:¥{{ myBalance }})
</view>
<view><radio checked="checked" value="0" /></view>
</label>
<label class="uni-list-cell uni-list-cell-pd">
<view class="littleimgBox">
<image class="littleimg" src="@/static/zf03.png"></image>
线下支付
</view>
<view><radio checked="checked" value="2" /></view>
</label>
</radio-group>
</view>
<button class="payBtn" @click="pay">确认交易</button>
</view>
</uni-popup>
<uni-popup ref="giveup" type="dialog">
<uni-popup-dialog
type="success"
confirmText="放弃"
cancelText="继续支付"
content="是否放弃本次支付"
@confirm="cancelPay"
@close="closeGiveup"
></uni-popup-dialog>
</uni-popup>
<uni-popup ref="payMationPop" :is-mask-click="false">
<view class="payMationPopBody">
<view class="t">线下支付</view>
<view @click="copyOrg(organizerInfo)" class="hoverBg">
<view class="p">
公司:
<text>{{ organizerInfo.organizerName }}</text>
</view>
<view class="p">
开户:
<text>{{ organizerInfo.organizerBank }}</text>
</view>
<view class="p">
账号:
<text>{{ organizerInfo.organizerAccount }}</text>
</view>
<view class="p">
应付:
<text class="orange">{{ organizerInfo.organizerFee }}元</text>
</view>
</view>
<view @click="copyOrg(platformInfo)" v-if="platformInfo" class="hoverBg" style="margin: 40rpx 0 0;">
<view class="p">
公司:
<text>{{ platformInfo.platformName }}</text>
</view>
<view class="p">
开户:
<text>{{ platformInfo.platformBank }}</text>
</view>
<view class="p">
账号:
<text>{{ platformInfo.platformAccount }}</text>
</view>
<view class="p">
应付:
<text class="orange">{{ platformInfo.platformFee }}元</text>
</view>
</view>
<button class="btn btn1" @click="tipForPayMation">确定</button>
</view>
</uni-popup>
</view>
</template>
<script setup>
import { reactive, toRefs, getCurrentInstance } from 'vue';
import * as match from '@/common/match.js';
import * as train from '@/common/train.js';
import * as api from '@/common/api.js';
import { onShow, onReady, onLoad } from '@dcloudio/uni-app';
import uniList from '@/components/train/ulist/ulist1';
const data = reactive({
items: ['报项', '订单'],
// 0 未支付 1 线下支付待核销 2 付款中 3 线下支付已核销/已支付 4 退款中 5 已退款 6 线下退款待核销
billStatusList: [
{ value: 0, text: '未支付' },
{ value: 1, text: '支付待核销' },
{ value: 2, text: '付款中' },
{ value: 3, text: '已付款' },
{ value: 4, text: '退款中' },
{ value: 5, text: '已退款' },
{ value: 6, text: '退款待核销' }
],
queryParam: {},
queryParam2: {
cptName: '',
payTimeRange: '',
createTimeRange: ''
},
list: [],
current: 0,
billList: [],
cptPeriodArr: [],
payTimeArr: [],
commitTimeArr: [],
searchPop: null,
popPayType: null,
payMationPop: null,
time: '',
myBalance: '',
finialFee: '',
giveup: null,
payType: '2',
organizerInfo: {},
platformInfo: {},
timePeriod: []
});
const {
timePeriod,
items,
queryParam,
queryParam2,
list,
current,
billList,
payTimeArr,
commitTimeArr,
cptPeriodArr,
searchPop,
popPayType,
payMationPop,
billStatusList,
time,
myBalance,
finialFee,
payType,
giveup,
organizerInfo,
platformInfo
} = toRefs(data);
const currUser = uni.getStorageSync('currUser');
onLoad(option => {
if (option.current) {
current.value = option.current;
}
getList();
getBillList();
// current
});
// 报项列表
function getList() {
//赛选时间
if (timePeriod.value.length > 0) queryParam.value.timePeriod = timePeriod.value.join();
train.signList(queryParam.value).then(res => {
list.value = res.data;
});
}
// 订单列表
async function getBillList() {
if (timePeriod.value.length > 0) queryParam.value.timePeriod = timePeriod.value.join();
let res = await train.orderList(queryParam.value);
billList.value = res.data;
console.log(res);
}
function singDetail(item) {
uni.navigateTo({
url: `/pages/usercenter/myTrain/trainSing/trainSing?id=${item.id}&str=${item.statusStr}&trainName=${
item.trainName
}`
});
}
// 订单详情
function goMatchBillDetail(item) {
uni.navigateTo({
url: `/pages/usercenter/myTrain/trainBillDetail/trainBillDetail?id=${item.trainId}&order=${JSON.stringify(
item
)}`
});
}
// 去支付
function payBill(item) {
let path =
'/pages/train/costBreakdown/costBreakdown?ids=' + item.id + '&payType =' + item.payType + '&id=' + item.trainId;
uni.navigateTo({
url: path
});
}
function onClickItem(e) {
current.value = e.currentIndex;
if (current.value == 0) {
getList();
} else {
getBillList();
}
queryParam.value = {};
}
function bindTimeChange(e) {
time.value = e.detail.value;
}
function showSearchPop() {
searchPop.value.open();
}
function onconfirm() {
if (current.value == 0) {
getList();
} else {
getBillList();
}
}
function onclear() {
queryParam.value.name = '';
if (current.value == 0) {
getList();
} else {
getBillList();
}
}
function search() {
getList();
searchPop.value.close();
}
function searchBill() {
getBillList();
searchPop.value.close();
}
function reset() {
timePeriod.value = [];
queryParam.value = {};
if (current.value == 0) {
getList();
} else {
getBillList();
}
}
let thisBill = {};
function goPay(item) {
// // 获取会员卡余额
// api.getMyBalance().then(res => {
// myBalance.value = res.data;
// });
// popPayType.value.open();
// thisBill = b;
// finialFee.value = b.totalAmount;
let path =
'/pages/train/costBreakdown/costBreakdown?ids=' + item.id + '&payType =' + item.payType + '&id=' + item.trainId;
uni.navigateTo({
url: path
});
}
function payChange(evt) {
payType.value = evt.detail.value;
}
function alertGiveup() {
giveup.value.open();
}
function closeGiveup() {
giveup.value.close();
}
function cancelPay() {
// 点击放弃
popPayType.value.close();
}
function tipForPayMation() {
uni.showModal({
title: '提示',
content: '点击信息复制到剪贴板',
cancelText: '好的',
confirmText: '我已复制',
success: function(res) {
if (res.confirm) {
// 去订单详情页
payMationPop.value.close();
} else if (res.cancel) {
console.log('返回');
}
}
});
}
function copyOrg(info) {
let str = `公司:${info.organizerName};开户行:${info.organizerBank};账户:${info.organizerAccount};`;
uni.setClipboardData({
data: str,
success: function() {
console.log('success');
}
});
}
function pay() {
// 继续支付
if (payType.value == '') {
uni.showToast({
title: '请选择支付方式',
icon: 'none',
duration: 2000
});
return;
}
match.payMatch({ orderId: thisBill.id, payType: payType.value }).then(res => {
thisBill = {};
finialFee.value = '0';
if (res.data.success == '1') {
console.log('支付成功');
popPayType.value.close();
getList();
getBillList();
if (payType.value == '2') {
// 线下支付
organizerInfo.value = res.data.org;
platformInfo.value = res.data.plat;
payMationPop.value.open();
} else {
uni.showToast({
title: '支付成功',
duration: 2000
});
}
} else {
uni.showToast({
title: '支付失败,请稍后重试',
icon: 'none',
duration: 2000
});
}
});
}
function cancelBill(b) {
uni.showModal({
title: '提示',
content: '确定取消吗',
success: async function(res) {
if (res.confirm) {
let res = await train.cancelOrder({ id: b.id });
getBillList();
getList();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
</script>
<style lang="scss" scoped>
.list-conter {
padding: 5rpx 20rpx;
background-color: #fff;
}
.topSearch {
display: flex;
align-items: center;
}
.bgWhite {
background: #fff;
}
.popTT {
text-align: center;
padding: 30rpx 0 0;
}
.popBody {
background: #fff;
padding: 30rpx;
height: 50vh;
}
.searchBtns {
display: flex;
}
.btnGray {
color: #1b1b1b;
background: #f5f7f9;
}
.billcontent {
:deep(.uni-collapse) {
background-color: transparent;
margin: 30rpx;
width: 700rpx;
}
:deep(.uni-collapse-item) {
position: relative;
}
}
.baoItem {
.bold {
color: #2b3133;
font-weight: 500;
font-size: 30rpx;
margin: 0 0 20rpx;
}
.pp {
font-size: 28rpx;
color: #7b7f83;
padding: 10rpx 0;
text {
color: #2b3133;
float: right;
}
}
.orange {
font-size: 26rpx;
}
button {
border-radius: 60rpx;
line-height: 60rpx;
font-size: 28rpx;
background: #fff;
margin: 0 0 0 25rpx;
}
.btnsView {
display: flex;
justify-content: flex-end;
margin: 34rpx 0 0;
padding-bottom: 10rpx;
}
.comKx {
color: #0d0d0d;
border: 1rpx solid #d2d7d9;
}
.greenKx {
color: #00c176;
border: 1rpx solid #00c176;
}
}
:deep(.uni-collapse-item__title-arrow) {
position: absolute;
right: 0;
top: 20rpx;
line-height: 20px;
}
.littleimgBox {
display: flex;
align-items: center;
}
.littleimg {
width: 50rpx;
height: 50rpx;
margin-right: 15rpx;
}
.payMationPopBody {
background: #ffffff;
width: 550rpx;
border-radius: 15px;
padding: 50rpx;
box-sizing: border-box;
.t {
text-align: center;
color: #7b7f83;
font-size: 34rpx;
margin: 0 0 50rpx;
}
.p {
color: #7b7f83;
font-size: 30rpx;
text {
color: #1a1a1a;
}
}
.btn {
margin-top: 60rpx;
}
}
.payBtn {
margin: 100rpx 0;
}
</style>