|
@@ -1,361 +1,370 @@
|
1
|
|
-<template>
|
2
|
|
- <view class="page">
|
3
|
|
- <cu-custom :isBack="true"></cu-custom>
|
4
|
|
- <view class="header" :style="[{top:topHeader + 'px'}]">
|
5
|
|
- <view class="header-title">
|
6
|
|
- <view class="header-title-main">
|
7
|
|
- <view class="margin-bottom-xs">{{title}}</view>
|
8
|
|
- <view class="point"></view>
|
9
|
|
- </view>
|
10
|
|
- </view>
|
11
|
|
- <swiper-tab :menuList="menuList" @changeTab="changeTab" :activeTab="currentIndex"></swiper-tab>
|
12
|
|
- </view>
|
13
|
|
- <scroll-view scroll-y="true" class="scroll-main"
|
14
|
|
- :style="[{height:'calc(100vh - 74px - '+ topHeader+'px)'}]"
|
15
|
|
- :refresher-enabled="true"
|
16
|
|
- :refresher-triggered="triggered"
|
17
|
|
- @refresherrefresh="onRefresh" @scrolltolower="loadMore">
|
18
|
|
- <view class="list" v-if="params.type<7">
|
19
|
|
- <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in list" :key="index">
|
20
|
|
- <view class="cu-item" v-for="(course,i) in item.list" :key="i">
|
21
|
|
- <view class="card-header flex justify-between solid-bottom">
|
22
|
|
- <view>{{index}}</view>
|
23
|
|
- <view class="text-student course-status">
|
24
|
|
- {{item.status|status}}
|
25
|
|
- </view>
|
26
|
|
- </view>
|
27
|
|
- <view class="card flex">
|
28
|
|
- <view class="card-left">
|
29
|
|
- <img mode="scaleToFill" :src="course.image" alt="" class="card-image">
|
30
|
|
- </view>
|
31
|
|
- <view class="card-right flex-sub margin-left-sm">
|
32
|
|
- <view class="card-title">{{course.name}}</view>
|
33
|
|
- <view class="card-item margin-top-xs">
|
34
|
|
- <text class="card-label">时间:</text>
|
35
|
|
- <text class="card-text">{{course.attend_day}}</text>
|
36
|
|
- </view>
|
37
|
|
- <view class="card-item margin-top-xs" >
|
38
|
|
- <text class="card-label">课时:</text>
|
39
|
|
- <text class="card-text">{{course.class_total}}</text>
|
40
|
|
- </view>
|
41
|
|
- <view class="card-item margin-top-xs">
|
42
|
|
- <text class="card-label">学生:</text>
|
43
|
|
- <text class="card-text">{{course.student_name}}</text>
|
44
|
|
- </view>
|
45
|
|
- <view class="card-item margin-top-xs">
|
46
|
|
- <text class="card-label">老师:</text>
|
47
|
|
- <text class="card-text">{{course.teacher||'--'}}</text>
|
48
|
|
- </view>
|
49
|
|
- </view>
|
50
|
|
- </view>
|
51
|
|
- <view class="flex card-footer solid-bottom padding-bottom-xs">
|
52
|
|
- <view v-for="(prop,k) in course.prop" :key="k" class="margin-right-xs">
|
53
|
|
- <text class="card-label">{{prop.name}}:</text><text class="text-price">{{prop.money}}</text>
|
54
|
|
- </view>
|
55
|
|
- </view>
|
56
|
|
- <view class="card-bottom margin-top-xs flex justify-between">
|
57
|
|
- <view>
|
58
|
|
- <text class="text-price text-red">{{item.sum_money}}</text>
|
59
|
|
- </view>
|
60
|
|
- <view>
|
61
|
|
- <button @tap="dropCourse(course.order_info_id)" class="cu-btn round bg-student text-white" v-if="dropStatus.includes(item.status)&&course.is_return===0">退课</button>
|
62
|
|
- <button @tap="droping" class="cu-btn round sm line-cyan" v-if="dropStatus.includes(item.status)&&course.is_return===1">退课中</button>
|
63
|
|
- <button @tap="pay(item.order_id)" class="cu-btn round bg-student text-white margin-right-sm" v-if="item.status===0">立即付款</button>
|
64
|
|
- <button @tap="cancel(item.order_id)" class="cu-btn round bg-gray" v-if="item.status===0">取消</button>
|
65
|
|
- </view>
|
66
|
|
- </view>
|
67
|
|
- </view>
|
68
|
|
- </view>
|
69
|
|
- </view>
|
70
|
|
- <view class="list" v-else>
|
71
|
|
- <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in list" :key="index">
|
72
|
|
- <view class="cu-item">
|
73
|
|
- <view class="card-header flex justify-between solid-bottom">
|
74
|
|
- <view>{{item.code}}</view>
|
75
|
|
- <view class="text-student course-status">
|
76
|
|
- {{item.status|dropStatus}}
|
77
|
|
- </view>
|
78
|
|
- </view>
|
79
|
|
- <view class="card flex">
|
80
|
|
- <view class="card-left">
|
81
|
|
- <img mode="scaleToFill" :src="item.image" alt="" class="card-image">
|
82
|
|
- </view>
|
83
|
|
- <view class="card-right flex-sub margin-left-sm">
|
84
|
|
- <view class="card-title">{{item.name}}</view>
|
85
|
|
- <view class="card-item margin-top-xs">
|
86
|
|
- <text class="card-label">时间:</text>
|
87
|
|
- <text class="card-text">{{item.attend_day}}</text>
|
88
|
|
- </view>
|
89
|
|
- <view class="card-item margin-top-xs" >
|
90
|
|
- <text class="card-label">课时:</text>
|
91
|
|
- <text class="card-text">{{item.class_total}}</text>
|
92
|
|
- </view>
|
93
|
|
- <view class="card-item margin-top-xs">
|
94
|
|
- <text class="card-label">学生:</text>
|
95
|
|
- <text class="card-text">{{item.student_name}}</text>
|
96
|
|
- </view>
|
97
|
|
- <view class="card-item margin-top-xs">
|
98
|
|
- <text class="card-label">老师:</text>
|
99
|
|
- <text class="card-text">{{item.teacher||'--'}}</text>
|
100
|
|
- </view>
|
101
|
|
- </view>
|
102
|
|
- </view>
|
103
|
|
- <view class="flex card-footer padding-bottom-xs">
|
104
|
|
- <view v-for="(prop,k) in course.prop" :key="k" class="margin-right-xs">
|
105
|
|
- <text class="card-label">{{prop.name}}:</text><text class="text-price">{{prop.money}}</text>
|
106
|
|
- </view>
|
107
|
|
- </view>
|
108
|
|
- </view>
|
109
|
|
- </view>
|
110
|
|
- </view>
|
111
|
|
- </scroll-view>
|
112
|
|
- <web-view v-if="showForm" :src="payurl"></web-view>
|
113
|
|
- </view>
|
114
|
|
-</template>
|
115
|
|
-
|
116
|
|
-<script>
|
117
|
|
-import { _orderCenter, _dropList, _payOrder, _dropCourse, _cancelOrder } from '@/api/course'
|
118
|
|
-import swiperTab from '@/components/swiper-tab.vue'
|
119
|
|
-export default {
|
120
|
|
- components: {
|
121
|
|
- swiperTab
|
122
|
|
- },
|
123
|
|
- data () {
|
124
|
|
- return {
|
125
|
|
- title: '订单',
|
126
|
|
- topHeader: this.globalCustomBarHeight,
|
127
|
|
- noMore: false, // 加载判断
|
128
|
|
- triggered: false, // 下拉
|
129
|
|
- showForm: false, // 支付弹窗
|
130
|
|
- payurl: '',
|
131
|
|
- menuList: ['全部订单', '待付款', '已付款', '退课售后'],
|
132
|
|
- currentIndex: 0,
|
133
|
|
- list: [],
|
134
|
|
- dropStatus: [1, 4],
|
135
|
|
- orderTypes: {
|
136
|
|
- 0: 5,
|
137
|
|
- 1: 0,
|
138
|
|
- 2: 1,
|
139
|
|
- 3: 7
|
140
|
|
- },
|
141
|
|
- params: {
|
142
|
|
- type: 5,
|
143
|
|
- page: 1
|
144
|
|
- }
|
145
|
|
- }
|
146
|
|
- },
|
147
|
|
- filters: {
|
148
|
|
- status: function(value) {
|
149
|
|
- switch (value) {
|
150
|
|
- case 0:
|
151
|
|
- return '未付款'
|
152
|
|
- case 1:
|
153
|
|
- return '已付款'
|
154
|
|
- case 2:
|
155
|
|
- return '申诉'
|
156
|
|
- case 3:
|
157
|
|
- return '已取消'
|
158
|
|
- case 4:
|
159
|
|
- return '部分退课'
|
160
|
|
- case 5:
|
161
|
|
- return '全部退课'
|
162
|
|
- case 6:
|
163
|
|
- return '正在付款'
|
164
|
|
- default:
|
165
|
|
- return '状态未知'
|
166
|
|
- }
|
167
|
|
- },
|
168
|
|
- dropStatus(v) {
|
169
|
|
- return v === 0 ? '审核中' : v === 1 ? '审核通过' : '驳回'
|
170
|
|
- }
|
171
|
|
- },
|
172
|
|
- onLoad (option) {
|
173
|
|
- if (option.type) {
|
174
|
|
- const index = decodeURIComponent(option.type)
|
175
|
|
- this.changeTab(index)
|
176
|
|
- } else {
|
177
|
|
- this.get_list()
|
178
|
|
- }
|
179
|
|
- },
|
180
|
|
- methods: {
|
181
|
|
- refresh() {
|
182
|
|
- this.currentIndex = 0
|
183
|
|
- this.params.page = 1
|
184
|
|
- this.params.type = 5
|
185
|
|
- this.get_list()
|
186
|
|
- },
|
187
|
|
- onRefresh() {
|
188
|
|
- this.triggered = true
|
189
|
|
- this.refresh()
|
190
|
|
- setTimeout(() => {
|
191
|
|
- this.triggered = false
|
192
|
|
- }, 1000)
|
193
|
|
- },
|
194
|
|
- loadMore() {
|
195
|
|
- if (this.noMore) {
|
196
|
|
- uni.showToast({ title: '没有更多了', icon: 'none' })
|
197
|
|
- return false
|
198
|
|
- }
|
199
|
|
- this.params.page++
|
200
|
|
- this.get_list()
|
201
|
|
- },
|
202
|
|
- get_list() {
|
203
|
|
- if (this.params.type < 7) {
|
204
|
|
- this.get_orders()
|
205
|
|
- } else {
|
206
|
|
- this.get_drops()
|
207
|
|
- }
|
208
|
|
- },
|
209
|
|
- get_orders() {
|
210
|
|
- _orderCenter(this.params).then(res => {
|
211
|
|
- if (this.params.page > 1) {
|
212
|
|
- if (Object.keys(res.data).length < this.page_size) this.noMore = true
|
213
|
|
- this.list = Object.assign({}, this.list, res.data)
|
214
|
|
- } else {
|
215
|
|
- this.noMore = false
|
216
|
|
- this.list = res.data
|
217
|
|
- }
|
218
|
|
- })
|
219
|
|
- },
|
220
|
|
- get_drops() {
|
221
|
|
- _dropList({ page: this.params.page }).then(res => {
|
222
|
|
- if (this.params.page > 1) {
|
223
|
|
- if (!res.data.drop_course_data) {
|
224
|
|
- this.noMore = true
|
225
|
|
- return
|
226
|
|
- }
|
227
|
|
- if (res.data.drop_course_data.length < this.page_size) this.noMore = true
|
228
|
|
- this.list = this.list.concat(res.data.drop_course_data)
|
229
|
|
- } else {
|
230
|
|
- this.noMore = false
|
231
|
|
- this.list = res.data.drop_course_data || []
|
232
|
|
- }
|
233
|
|
- })
|
234
|
|
- },
|
235
|
|
- droping() {
|
236
|
|
- this.changeTab(3)
|
237
|
|
- },
|
238
|
|
- dropCourse(id) {
|
239
|
|
- const params = { order_info_id: id, refund_explanation: '', type_id: 0 }
|
240
|
|
- const _self = this
|
241
|
|
- uni.showModal({
|
242
|
|
- title: '提示',
|
243
|
|
- content: '确定要删除?',
|
244
|
|
- cancelText: '取消',
|
245
|
|
- confirmText: '确定',
|
246
|
|
- success: res => {
|
247
|
|
- if (res.confirm) {
|
248
|
|
- _dropCourse(params).then(res => {
|
249
|
|
- uni.showToast({ title: '已经发起退课,请耐心等待', icon: 'none' })
|
250
|
|
- _self.refresh()
|
251
|
|
- })
|
252
|
|
- }
|
253
|
|
- }
|
254
|
|
- })
|
255
|
|
- },
|
256
|
|
- pay(id) {
|
257
|
|
- const _self = this
|
258
|
|
- uni.showModal({
|
259
|
|
- title: '温馨提示:',
|
260
|
|
- content: '1、感谢您的购买;\n' +
|
261
|
|
- '2、退费规则请咨询客服;\n' +
|
262
|
|
- '3、本平台对以上细则有最终解释权。',
|
263
|
|
- cancelText: '取消',
|
264
|
|
- confirmText: '确定',
|
265
|
|
- success: res => {
|
266
|
|
- if (res.confirm) {
|
267
|
|
- _payOrder({ order_id: id, pay_type: 'wechat', trade_type: 'JSAPI' }).then(res => {
|
268
|
|
- if (res.code === 0) {
|
269
|
|
- return false
|
270
|
|
- }
|
271
|
|
- if (res.code === 200) {
|
272
|
|
- uni.showToast({ title: res.msg, icon: 'success', duration: 2000 })
|
273
|
|
- _self.changeTab(2)
|
274
|
|
- return true
|
275
|
|
- }
|
276
|
|
- if (res.code === 301) {
|
277
|
|
- _self.showForm = true
|
278
|
|
- _self.payurl = res.data
|
279
|
|
- return true
|
280
|
|
- }
|
281
|
|
- // 进行支付
|
282
|
|
- uni.requestPayment({
|
283
|
|
- timeStamp: res.data.timeStamp,
|
284
|
|
- nonceStr: res.data.nonceStr,
|
285
|
|
- package: res.data.package,
|
286
|
|
- signType: res.data.signType,
|
287
|
|
- paySign: res.data.paySign,
|
288
|
|
- success: function (res) {
|
289
|
|
- _self.refresh()
|
290
|
|
- }
|
291
|
|
- })
|
292
|
|
- })
|
293
|
|
- }
|
294
|
|
- }
|
295
|
|
- })
|
296
|
|
- },
|
297
|
|
- cancel(id) {
|
298
|
|
- const _self = this
|
299
|
|
- uni.showModal({
|
300
|
|
- title: '提示',
|
301
|
|
- content: '确定取消?',
|
302
|
|
- cancelText: '取消',
|
303
|
|
- confirmText: '确定',
|
304
|
|
- success: res => {
|
305
|
|
- if (res.confirm) {
|
306
|
|
- _cancelOrder({ order_id: id }).then(res => {
|
307
|
|
- uni.showToast({ title: res.msg, icon: 'none' })
|
308
|
|
- _self.refresh()
|
309
|
|
- })
|
310
|
|
- }
|
311
|
|
- }
|
312
|
|
- })
|
313
|
|
- },
|
314
|
|
- changeTab(index) {
|
315
|
|
- this.params.page = 1
|
316
|
|
- this.currentIndex = index
|
317
|
|
- this.params.type = this.orderTypes[index]
|
318
|
|
- this.get_list()
|
319
|
|
- }
|
320
|
|
- }
|
321
|
|
-}
|
322
|
|
-</script>
|
323
|
|
-
|
324
|
|
-<style lang="scss">
|
325
|
|
-@import '~@/common/css/mixin.scss';
|
326
|
|
-.scroll-main{
|
327
|
|
- margin-top:74px;
|
328
|
|
- padding:20rpx;
|
329
|
|
-}
|
330
|
|
-.cu-card{
|
331
|
|
- .cu-item{
|
332
|
|
- margin-top:10rpx;
|
333
|
|
- padding:20rpx;
|
334
|
|
- margin:0;
|
335
|
|
- }
|
336
|
|
-}
|
337
|
|
-.card-header{
|
338
|
|
- padding-bottom:10px;
|
339
|
|
- @include title(10px,18px);
|
340
|
|
-}
|
341
|
|
-.card{
|
342
|
|
- &-title{
|
343
|
|
- font-size:16px;
|
344
|
|
- }
|
345
|
|
- &-image{
|
346
|
|
- width:35vw;
|
347
|
|
- height:35vw;
|
348
|
|
- border-radius:10rpx;
|
349
|
|
- }
|
350
|
|
- &-label{
|
351
|
|
- color:#999;
|
352
|
|
- }
|
353
|
|
- &-text{
|
354
|
|
- color:#333;
|
355
|
|
- }
|
356
|
|
-}
|
357
|
|
-.course-status{
|
358
|
|
- font-size:14px;
|
359
|
|
- font-weight:normal;
|
360
|
|
-}
|
361
|
|
-</style>
|
|
1
|
+<template>
|
|
2
|
+ <view class="page">
|
|
3
|
+ <cu-custom :isBack="true"></cu-custom>
|
|
4
|
+ <view class="header" :style="[{top:topHeader + 'px'}]">
|
|
5
|
+ <view class="header-title">
|
|
6
|
+ <view class="header-title-main">
|
|
7
|
+ <view class="margin-bottom-xs">{{title}}</view>
|
|
8
|
+ <view class="point"></view>
|
|
9
|
+ </view>
|
|
10
|
+ </view>
|
|
11
|
+ <swiper-tab :menuList="menuList" @changeTab="changeTab" :activeTab="currentIndex"></swiper-tab>
|
|
12
|
+ </view>
|
|
13
|
+ <scroll-view scroll-y="true" class="scroll-main"
|
|
14
|
+ :style="[{height:'calc(100vh - 74px - '+ topHeader+'px)'}]"
|
|
15
|
+ :refresher-enabled="true"
|
|
16
|
+ :refresher-triggered="triggered"
|
|
17
|
+ @refresherrefresh="onRefresh" @scrolltolower="loadMore">
|
|
18
|
+ <view class="list" v-if="params.type<7">
|
|
19
|
+ <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in list" :key="index">
|
|
20
|
+ <view class="cu-item" v-for="(course,i) in item.list" :key="i">
|
|
21
|
+ <view class="card-header flex justify-between solid-bottom">
|
|
22
|
+ <view>{{index}}</view>
|
|
23
|
+ <view class="text-student course-status">
|
|
24
|
+ {{item.status|status}}
|
|
25
|
+ </view>
|
|
26
|
+ </view>
|
|
27
|
+ <view class="card flex">
|
|
28
|
+ <view class="card-left">
|
|
29
|
+ <img mode="scaleToFill" :src="course.image" alt="" class="card-image">
|
|
30
|
+ </view>
|
|
31
|
+ <view class="card-right flex-sub margin-left-sm">
|
|
32
|
+ <view class="card-title">{{course.name}}</view>
|
|
33
|
+ <view class="card-item margin-top-xs">
|
|
34
|
+ <text class="card-label">时间:</text>
|
|
35
|
+ <text class="card-text">{{course.attend_day}}</text>
|
|
36
|
+ </view>
|
|
37
|
+ <view class="card-item margin-top-xs" >
|
|
38
|
+ <text class="card-label">课时:</text>
|
|
39
|
+ <text class="card-text">{{course.class_total}}</text>
|
|
40
|
+ </view>
|
|
41
|
+ <view class="card-item margin-top-xs">
|
|
42
|
+ <text class="card-label">学生:</text>
|
|
43
|
+ <text class="card-text">{{course.student_name}}</text>
|
|
44
|
+ </view>
|
|
45
|
+ <view class="card-item margin-top-xs">
|
|
46
|
+ <text class="card-label">老师:</text>
|
|
47
|
+ <text class="card-text">{{course.teacher||'--'}}</text>
|
|
48
|
+ </view>
|
|
49
|
+ </view>
|
|
50
|
+ </view>
|
|
51
|
+ <view class="flex card-footer solid-bottom padding-bottom-xs">
|
|
52
|
+ <view v-for="(prop,k) in course.prop" :key="k" class="margin-right-xs">
|
|
53
|
+ <text class="card-label">{{prop.name}}:</text><text class="text-price">{{prop.money}}</text>
|
|
54
|
+ </view>
|
|
55
|
+ </view>
|
|
56
|
+ <view class="card-bottom margin-top-xs flex justify-between">
|
|
57
|
+ <view>
|
|
58
|
+ <text class="text-price text-red">{{item.sum_money}}</text>
|
|
59
|
+ </view>
|
|
60
|
+ <view>
|
|
61
|
+ <button @tap="dropCourse(course.order_info_id)" class="cu-btn round bg-student text-white" v-if="dropStatus.includes(item.status)&&course.is_return===0">退课</button>
|
|
62
|
+ <button @tap="droping" class="cu-btn round sm line-cyan" v-if="dropStatus.includes(item.status)&&course.is_return===1">退课中</button>
|
|
63
|
+ <button @tap="pay(item.order_id)" class="cu-btn round bg-student text-white margin-right-sm" v-if="item.status===0">立即付款</button>
|
|
64
|
+ <button @tap="cancel(item.order_id)" class="cu-btn round bg-gray" v-if="item.status===0&&!isPaying">取消</button>
|
|
65
|
+ </view>
|
|
66
|
+ </view>
|
|
67
|
+ </view>
|
|
68
|
+ </view>
|
|
69
|
+ </view>
|
|
70
|
+ <view class="list" v-else>
|
|
71
|
+ <view class="cu-card margin-top margin-bottom shadow" v-for="(item,index) in list" :key="index">
|
|
72
|
+ <view class="cu-item">
|
|
73
|
+ <view class="card-header flex justify-between solid-bottom">
|
|
74
|
+ <view>{{item.code}}</view>
|
|
75
|
+ <view class="text-student course-status">
|
|
76
|
+ {{item.status|dropStatus}}
|
|
77
|
+ </view>
|
|
78
|
+ </view>
|
|
79
|
+ <view class="card flex">
|
|
80
|
+ <view class="card-left">
|
|
81
|
+ <img mode="scaleToFill" :src="item.image" alt="" class="card-image">
|
|
82
|
+ </view>
|
|
83
|
+ <view class="card-right flex-sub margin-left-sm">
|
|
84
|
+ <view class="card-title">{{item.name}}</view>
|
|
85
|
+ <view class="card-item margin-top-xs">
|
|
86
|
+ <text class="card-label">时间:</text>
|
|
87
|
+ <text class="card-text">{{item.attend_day}}</text>
|
|
88
|
+ </view>
|
|
89
|
+ <view class="card-item margin-top-xs" >
|
|
90
|
+ <text class="card-label">课时:</text>
|
|
91
|
+ <text class="card-text">{{item.class_total}}</text>
|
|
92
|
+ </view>
|
|
93
|
+ <view class="card-item margin-top-xs">
|
|
94
|
+ <text class="card-label">学生:</text>
|
|
95
|
+ <text class="card-text">{{item.student_name}}</text>
|
|
96
|
+ </view>
|
|
97
|
+ <view class="card-item margin-top-xs">
|
|
98
|
+ <text class="card-label">老师:</text>
|
|
99
|
+ <text class="card-text">{{item.teacher||'--'}}</text>
|
|
100
|
+ </view>
|
|
101
|
+ </view>
|
|
102
|
+ </view>
|
|
103
|
+ <view class="flex card-footer padding-bottom-xs">
|
|
104
|
+ <view v-for="(prop,k) in course.prop" :key="k" class="margin-right-xs">
|
|
105
|
+ <text class="card-label">{{prop.name}}:</text><text class="text-price">{{prop.money}}</text>
|
|
106
|
+ </view>
|
|
107
|
+ </view>
|
|
108
|
+ </view>
|
|
109
|
+ </view>
|
|
110
|
+ </view>
|
|
111
|
+ </scroll-view>
|
|
112
|
+ <web-view v-if="showForm" :src="payurl"></web-view>
|
|
113
|
+ </view>
|
|
114
|
+</template>
|
|
115
|
+
|
|
116
|
+<script>
|
|
117
|
+import { _orderCenter, _dropList, _payOrder, _dropCourse, _cancelOrder } from '@/api/course'
|
|
118
|
+import swiperTab from '@/components/swiper-tab.vue'
|
|
119
|
+export default {
|
|
120
|
+ components: {
|
|
121
|
+ swiperTab
|
|
122
|
+ },
|
|
123
|
+ data () {
|
|
124
|
+ return {
|
|
125
|
+ title: '订单',
|
|
126
|
+ topHeader: this.globalCustomBarHeight,
|
|
127
|
+ noMore: false, // 加载判断
|
|
128
|
+ triggered: false, // 下拉
|
|
129
|
+ showForm: false, // 支付弹窗
|
|
130
|
+ isPaying: false, // 支付中...
|
|
131
|
+ payurl: '',
|
|
132
|
+ menuList: ['全部订单', '待付款', '已付款', '退课售后'],
|
|
133
|
+ currentIndex: 0,
|
|
134
|
+ list: [],
|
|
135
|
+ dropStatus: [1, 4],
|
|
136
|
+ orderTypes: {
|
|
137
|
+ 0: 5,
|
|
138
|
+ 1: 0,
|
|
139
|
+ 2: 1,
|
|
140
|
+ 3: 7
|
|
141
|
+ },
|
|
142
|
+ params: {
|
|
143
|
+ type: 5,
|
|
144
|
+ page: 1
|
|
145
|
+ }
|
|
146
|
+ }
|
|
147
|
+ },
|
|
148
|
+ filters: {
|
|
149
|
+ status: function(value) {
|
|
150
|
+ switch (value) {
|
|
151
|
+ case 0:
|
|
152
|
+ return '未付款'
|
|
153
|
+ case 1:
|
|
154
|
+ return '已付款'
|
|
155
|
+ case 2:
|
|
156
|
+ return '申诉'
|
|
157
|
+ case 3:
|
|
158
|
+ return '已取消'
|
|
159
|
+ case 4:
|
|
160
|
+ return '部分退课'
|
|
161
|
+ case 5:
|
|
162
|
+ return '全部退课'
|
|
163
|
+ case 6:
|
|
164
|
+ return '正在付款'
|
|
165
|
+ default:
|
|
166
|
+ return '状态未知'
|
|
167
|
+ }
|
|
168
|
+ },
|
|
169
|
+ dropStatus(v) {
|
|
170
|
+ return v === 0 ? '审核中' : v === 1 ? '审核通过' : '驳回'
|
|
171
|
+ }
|
|
172
|
+ },
|
|
173
|
+ onLoad (option) {
|
|
174
|
+ if (option.type) {
|
|
175
|
+ const index = decodeURIComponent(option.type)
|
|
176
|
+ this.changeTab(index)
|
|
177
|
+ } else {
|
|
178
|
+ this.get_list()
|
|
179
|
+ }
|
|
180
|
+ },
|
|
181
|
+ methods: {
|
|
182
|
+ refresh() {
|
|
183
|
+ this.currentIndex = 0
|
|
184
|
+ this.params.page = 1
|
|
185
|
+ this.params.type = 5
|
|
186
|
+ this.get_list()
|
|
187
|
+ },
|
|
188
|
+ onRefresh() {
|
|
189
|
+ this.triggered = true
|
|
190
|
+ this.refresh()
|
|
191
|
+ setTimeout(() => {
|
|
192
|
+ this.triggered = false
|
|
193
|
+ }, 1000)
|
|
194
|
+ },
|
|
195
|
+ loadMore() {
|
|
196
|
+ if (this.noMore) {
|
|
197
|
+ uni.showToast({ title: '没有更多了', icon: 'none' })
|
|
198
|
+ return false
|
|
199
|
+ }
|
|
200
|
+ this.params.page++
|
|
201
|
+ this.get_list()
|
|
202
|
+ },
|
|
203
|
+ get_list() {
|
|
204
|
+ if (this.params.type < 7) {
|
|
205
|
+ this.get_orders()
|
|
206
|
+ } else {
|
|
207
|
+ this.get_drops()
|
|
208
|
+ }
|
|
209
|
+ },
|
|
210
|
+ get_orders() {
|
|
211
|
+ _orderCenter(this.params).then(res => {
|
|
212
|
+ if (this.params.page > 1) {
|
|
213
|
+ if (Object.keys(res.data).length < this.page_size) this.noMore = true
|
|
214
|
+ this.list = Object.assign({}, this.list, res.data)
|
|
215
|
+ } else {
|
|
216
|
+ this.noMore = false
|
|
217
|
+ this.list = res.data
|
|
218
|
+ }
|
|
219
|
+ })
|
|
220
|
+ },
|
|
221
|
+ get_drops() {
|
|
222
|
+ _dropList({ page: this.params.page }).then(res => {
|
|
223
|
+ if (this.params.page > 1) {
|
|
224
|
+ if (!res.data.drop_course_data) {
|
|
225
|
+ this.noMore = true
|
|
226
|
+ return
|
|
227
|
+ }
|
|
228
|
+ if (res.data.drop_course_data.length < this.page_size) this.noMore = true
|
|
229
|
+ this.list = this.list.concat(res.data.drop_course_data)
|
|
230
|
+ } else {
|
|
231
|
+ this.noMore = false
|
|
232
|
+ this.list = res.data.drop_course_data || []
|
|
233
|
+ }
|
|
234
|
+ })
|
|
235
|
+ },
|
|
236
|
+ droping() {
|
|
237
|
+ this.changeTab(3)
|
|
238
|
+ },
|
|
239
|
+ dropCourse(id) {
|
|
240
|
+ const params = { order_info_id: id, refund_explanation: '', type_id: 0 }
|
|
241
|
+ const _self = this
|
|
242
|
+ uni.showModal({
|
|
243
|
+ title: '提示',
|
|
244
|
+ content: '确定要删除?',
|
|
245
|
+ cancelText: '取消',
|
|
246
|
+ confirmText: '确定',
|
|
247
|
+ success: res => {
|
|
248
|
+ if (res.confirm) {
|
|
249
|
+ _dropCourse(params).then(res => {
|
|
250
|
+ uni.showToast({ title: '已经发起退课,请耐心等待', icon: 'none' })
|
|
251
|
+ _self.refresh()
|
|
252
|
+ })
|
|
253
|
+ }
|
|
254
|
+ }
|
|
255
|
+ })
|
|
256
|
+ },
|
|
257
|
+ pay(id) {
|
|
258
|
+ const _self = this
|
|
259
|
+ _self.isPaying = true
|
|
260
|
+ uni.showModal({
|
|
261
|
+ title: '温馨提示:',
|
|
262
|
+ content: '1、感谢您的购买;\n' +
|
|
263
|
+ '2、退费规则请咨询客服;\n' +
|
|
264
|
+ '3、本平台对以上细则有最终解释权。',
|
|
265
|
+ cancelText: '取消',
|
|
266
|
+ confirmText: '确定',
|
|
267
|
+ success: res => {
|
|
268
|
+ if (res.confirm) {
|
|
269
|
+ _payOrder({ order_id: id, pay_type: 'wechat', trade_type: 'JSAPI' }).then(res => {
|
|
270
|
+ if (res.code === 0) {
|
|
271
|
+ _self.isPaying = false
|
|
272
|
+ return false
|
|
273
|
+ }
|
|
274
|
+ if (res.code === 200) {
|
|
275
|
+ uni.showToast({ title: res.msg, icon: 'success', duration: 2000 })
|
|
276
|
+ _self.changeTab(2)
|
|
277
|
+ return true
|
|
278
|
+ }
|
|
279
|
+ if (res.code === 301) {
|
|
280
|
+ _self.showForm = true
|
|
281
|
+ _self.payurl = res.data
|
|
282
|
+ return true
|
|
283
|
+ }
|
|
284
|
+ // 进行支付
|
|
285
|
+ uni.requestPayment({
|
|
286
|
+ timeStamp: res.data.timeStamp,
|
|
287
|
+ nonceStr: res.data.nonceStr,
|
|
288
|
+ package: res.data.package,
|
|
289
|
+ signType: res.data.signType,
|
|
290
|
+ paySign: res.data.paySign,
|
|
291
|
+ success: function (res) {
|
|
292
|
+ _self.isPaying = false
|
|
293
|
+ _self.refresh()
|
|
294
|
+ },
|
|
295
|
+ fail: function(res) {
|
|
296
|
+ _self.isPaying = false
|
|
297
|
+ }
|
|
298
|
+ })
|
|
299
|
+ })
|
|
300
|
+ } else if (res.cancel) {
|
|
301
|
+ _self.isPaying = false
|
|
302
|
+ }
|
|
303
|
+ }
|
|
304
|
+ })
|
|
305
|
+ },
|
|
306
|
+ cancel(id) {
|
|
307
|
+ const _self = this
|
|
308
|
+ uni.showModal({
|
|
309
|
+ title: '提示',
|
|
310
|
+ content: '确定取消?',
|
|
311
|
+ cancelText: '取消',
|
|
312
|
+ confirmText: '确定',
|
|
313
|
+ success: res => {
|
|
314
|
+ if (res.confirm) {
|
|
315
|
+ _cancelOrder({ order_id: id }).then(res => {
|
|
316
|
+ uni.showToast({ title: res.msg, icon: 'none' })
|
|
317
|
+ _self.refresh()
|
|
318
|
+ })
|
|
319
|
+ }
|
|
320
|
+ }
|
|
321
|
+ })
|
|
322
|
+ },
|
|
323
|
+ changeTab(index) {
|
|
324
|
+ this.params.page = 1
|
|
325
|
+ this.currentIndex = index
|
|
326
|
+ this.params.type = this.orderTypes[index]
|
|
327
|
+ this.get_list()
|
|
328
|
+ }
|
|
329
|
+ }
|
|
330
|
+}
|
|
331
|
+</script>
|
|
332
|
+
|
|
333
|
+<style lang="scss">
|
|
334
|
+@import '~@/common/css/mixin.scss';
|
|
335
|
+.scroll-main{
|
|
336
|
+ margin-top:74px;
|
|
337
|
+ padding:20rpx;
|
|
338
|
+}
|
|
339
|
+.cu-card{
|
|
340
|
+ .cu-item{
|
|
341
|
+ margin-top:10rpx;
|
|
342
|
+ padding:20rpx;
|
|
343
|
+ margin:0;
|
|
344
|
+ }
|
|
345
|
+}
|
|
346
|
+.card-header{
|
|
347
|
+ padding-bottom:10px;
|
|
348
|
+ @include title(10px,18px);
|
|
349
|
+}
|
|
350
|
+.card{
|
|
351
|
+ &-title{
|
|
352
|
+ font-size:16px;
|
|
353
|
+ }
|
|
354
|
+ &-image{
|
|
355
|
+ width:35vw;
|
|
356
|
+ height:35vw;
|
|
357
|
+ border-radius:10rpx;
|
|
358
|
+ }
|
|
359
|
+ &-label{
|
|
360
|
+ color:#999;
|
|
361
|
+ }
|
|
362
|
+ &-text{
|
|
363
|
+ color:#333;
|
|
364
|
+ }
|
|
365
|
+}
|
|
366
|
+.course-status{
|
|
367
|
+ font-size:14px;
|
|
368
|
+ font-weight:normal;
|
|
369
|
+}
|
|
370
|
+</style>
|