Ui
yfx
2026-03-13 2a845d6c48b9f1674369f5bc6581b6c4da439800
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
<template>
    <view>
        <view class="order-tab">
            <view :class="statusIndex == 0 ? 'active' : ''" @tap="tabClick(0)">全部</view>
            <view :class="statusIndex == 2 ? 'active' : ''" @tap="tabClick(2)">待审核</view>
            <view :class="statusIndex == 3 ? 'active' : ''" @tap="tabClick(3)">待签约</view>
            <view :class="statusIndex == 5 ? 'active' : ''" @tap="tabClick(5)">待收货</view>
            <view :class="statusIndex == 6 ? 'active' : ''" @tap="tabClick(6)">已逾期</view>
            <view :class="statusIndex == 8 ? 'active' : ''" @tap="tabClick(8)">已完成</view>
            <view :class="statusIndex == -3 ? 'active' : ''" @tap="tabClick(-3)">已退款</view>
        </view>
        <view class="order">
            <view class="" v-if="orderData.length > 0">
                <view class="cartsItem" v-for="(item, index) in orderData">
                    <view class="cartTitle" @tap="$util.goPages('/pages/orderinfo/orderinfo?orderid=' + item.id)">
                        <view>
                            <text class="label">时间:</text>
                            <text>{{item.addtime}}</text>
                            <text class="status-name">{{item.statusName}}</text>
                        </view>
                        <view class="sn">
                            <text class="label">订单号:</text>
                            <text>{{item.sn}}</text>
                            <text class="status-name">查看详情</text>
                        </view>
                    </view>
                    <view class="cartsGoods" v-for="(itm, idx) in item.cartsData" @tap="$util.goPages('/pages/ginfo/ginfo?id=' + itm.goodsid)">
                        <view class="cartsGoodsView">
                            <image class="cartsIcon" lazy-load :src="itm.icon" mode="widthFix"></image>
                            <view class="carts-item">
                                <view class="carts-title">{{itm.title}}</view>
                                <view class="carts-set">
                                    <view class="carts-price">
                                        <view class="">
                                            <text>单价:¥</text>
                                            <text class="red">{{itm.price}}</text>
                                            <text style="margin-left: 20upx;">数量:</text>
                                            <text class="red">{{itm.nums}}</text>
                                        </view>
                                        <view class="">
                                            <text>总价:¥</text>
                                            <text class="red">{{itm.total}}</text>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                    <view class="cartsCon">
                        <view class="total">
                            <text class="red">合计:{{item.total}}</text>
                        </view>
                        <view class="cons">
                            <template v-if="item.payment == 1">
                                <text class="payOrder" v-if="item.status == 1" @tap="$util.goPages('/pages/pays/pays?cartsIds=' + item.cartsids)">支付</text>
                                <text class="payback" v-if="item.status == 2" @tap="refundOrder(item)">退款</text>
                                <text class="payOrder" v-if="item.status == 3 && item.payment == 1 && item.zid != 0 && item.zstatus == 0" @tap="zsign(item)">签约</text>
                                <text class="exOrder" v-if="item.status == 4 || item.status == 5 || item.status == 6" @tap="getExpress(item)">物流</text>
                                <text class="payOrder" v-if="item.status == 4" @tap="receiveOrder(item)">收货</text>
                                <text class="payback" v-if="item.status == 3 || item.status == 4 || item.status == 5 || item.status == 6" @tap="getPlan(item)">还款</text>
                                <text class="delOrder" v-if="item.status == -1 || item.status == 1 || item.status == 7 || item.status == 8" @tap="delOrder(item, index)">删除</text>
                            </template>
                            <template v-if="item.payment != 1">
                                <text class="payOrder" v-if="item.status == 1" @tap="$util.goPages('/pages/pays/pays?cartsIds=' + item.cartsids)">支付</text>
                                <text class="payback" v-if="item.status == 3" @tap="refundOrder(item)">退款</text>
                                <text class="payOrder" v-if="item.status == 4" @tap="receiveOrder(item)">收货</text>
                                <text class="delOrder" v-if="item.status == -1 || item.status == 1 || item.status == 7 || item.status == 8" @tap="delOrder(item, index)">删除</text>
                            </template>
                        </view>
                    </view>
                </view>
            </view>
            <view class="noData" v-else>
                <image src="/static/imgs/noData.png"  style="margin-top: 200upx;"></image>
                <view class="">没有订单信息</view>
                <view class="noDataBtn" @tap="$util.goSwitch('/pages/index/index')">去看看</view>
            </view>
        </view>
        <uni-popup ref="popup" type="bottom">
            <view class="popup-content">
                <view class="pop-title">物流信息</view>
                <view class="pop-main">
                    <view class="pop-main-view" v-for="(item, index) in expressData">
                        <view class="pop-nums">{{item.datetime.slice(0, 16)}}</view>
                        <view class="pop-pay">
                            <view class="">{{item.remark}}</view>
                        </view>
                    </view>
                </view>
            </view>
        </uni-popup>
        
        <uni-popup ref="popup2" type="bottom">
            <view class="popup-content">
                <view class="pop-title">还款计划({{planData.length}})</view>
                <view class="pop-main" style="padding-bottom: 90upx;height: 600upx;">
                    <view class="pop-main-view" v-for="(item, index) in planData">
                        <view class="pop-pay" style="width: 100%;">
                            <view class="" @tap="planClick(item)" style="padding: 10upx 0;">
                                <image v-if="planId == item.id" src="/static/imgs/checked.png" ></image>
                                <image v-else src="/static/imgs/check.png" ></image>
                                <text>日期:{{item.paydate}}</text>
                                <text style="margin-left: 30upx;">还款金额:{{item.total}}</text>
                                <text style="margin-left: 30upx;">({{item.statusName}})</text>
                            </view>
                        </view>
                    </view>
                    <view class="planBtn" @tap="popup3Open">立即还款({{payTotal}})</view>
                </view>
            </view>
        </uni-popup>
        
        <uni-popup ref="popup3" type="center" style="width: 100%;">
            <view class="popup-content" style="width: 100%;">
                <view class="pop-title" style="">还款方式</view>
                <view class="pop-main" style="height: 240upx;width: 100%;">
                    <view class="pop-main-view">
                        <view class="pop-pay" style="width: 100%;border-bottom: none;">
                            <view class="pay-item" style="border-bottom: 1px solid #eeeeee;padding: 20upx 20upx 30upx 20upx;" @tap="payback(2)">
                                <image class="pay-icon" src="/static/imgs/wxpay.png" ></image>
                                <text>微信还款({{payTotal}}元)</text>
                            </view>
                            <view class="pay-item" style="padding: 20upx;border-bottom: none;" @tap="payback(3)">
                                <image class="pay-icon" src="/static/imgs/bankpay.png" style="height: 40upx; margin-right: 10upx;" ></image>
                                <view>
                                    <text>银行卡还款({{payTotal}}元)</text>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </uni-popup>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                statusIndex: 0,
                pageIndex: 1,
                pageSize: 50,
                orderData: [],
                expressData: [],
                planData: [],
                payTotal: 0,
                planId: 0,
            }
        },
        onLoad(op) {
            this.statusIndex = op.status ? op.status : 0 
            this.getOrderList()
        },
        //监听返回直接返回到我的
        onBackPress(options) {
            if (options.from === 'navigateBack') return false
            uni.reLaunch({ url: '/pages/my/my' })
            return true
        },
        methods: {
            //租大师签约
            zsign (item) {
                let t = this
                this.$util.post('Order/zsign', {orderid: item.id}).then(res => {
                    console.log(res)
                    if(res.code == 1){
                        t.$goWebUrl(res.data.url)
                    } else {
                        uni.showToast({
                            title: res.msg || '操作失败',
                            icon: 'error'
                        })
                    }
                })
            },
            popup3Open () {
                if(this.planId == 0) {
                    return uni.showToast({
                        title: '未选中还款计划',
                        icon: 'error'
                    })
                }
                let t = this
                uni.showModal({
                    title: '温馨提示',
                    content: '确认还款?',
                    success: function (resp) {
                        if(resp.confirm){
                            t.payback(2)
                        }
                    }
                })
            },
            //点击计划
            planClick(e){
                if(e.status != 7) {
                    this.planId = e.id
                    this.payTotal = parseFloat(e.total).toFixed(2)
                }
            },
            //计划
            getPlan (item) {
                this.payTotal = 0
                this.planId = 0
                this.$util.post('Order/getPlanData', {orderid: item.id}).then(res => {
                    console.log(res)
                    if(res.code == 1){
                        this.planData = res.data
                        this.$refs.popup2.open()
                    } else {
                        uni.showToast({
                            title: res.msg || '操作失败',
                            icon: 'error'
                        })
                    }
                })
            },
            //物流
            getExpress(item) {
                this.$util.post('Order/getExpress2', {express_no: item.express_no, express_val: item.express_val, status: item.status}).then(res => {
                    console.log('res', res)
                    if(res.code == 1){
                        this.expressData = res.data.list
                        this.$refs.popup.open()
                    } else {
                        uni.showToast({
                            title: res.msg || '查看物流失败',
                            icon: 'error'
                        })
                    }
                })
            },
            tabClick (e) {
                this.pageIndex = 1
                this.statusIndex = e
                this.getOrderList()
            },
            getOrderList () {
                this.$util.post('Order/getOrderList', {status: this.statusIndex, pageIndex: this.pageIndex, pageSize: this.pageSize}).then(res => {
                    //console.log(res)
                    if(res.code == 1){
                        this.orderData = res.data.list
                    }
                })
            },
            //删除
            delOrder (e, idx) {
                let t = this
                uni.showModal({
                    title: '温馨提示',
                    content: '确认是否删除?',
                    success: function (resp) {
                        if(resp.confirm){
                            t.$util.post('Order/delOrder', {orderid: e.id}).then(res => {
                                if(res.code == 1){
                                    uni.showToast({
                                        title: res.msg || '操作成功'
                                    })
                                    setTimeout(() => {
                                        t.orderData.splice(idx, 1)
                                    }, 500)
                                    
                                } else {
                                    uni.showToast({
                                        title: res.msg || '操作失败'
                                    })
                                }
                            })
                        }
                    }
                })
            },
            //收货
            receiveOrder (e) {
                let t = this
                uni.showModal({
                    title: '温馨提示',
                    content: '确认是否收货?',
                    success: function (res) {
                        if (res.confirm) {
                            t.$util.post('Order/receiveOrder', {orderId: e.id}).then(res => {
                                if(res.code == 1) {
                                    uni.showToast({
                                        title: res.msg || '操作成功'
                                    })
                                    setTimeout(() => {
                                        t.tabClick(5)
                                    }, 1000)
                                } else {
                                    uni.showToast({
                                        title: res.msg || '操作失败'
                                    })
                                }
                            })
                        }
                    }
                })
            },
            //退款
            refundOrder (e) {
                let t = this
                uni.showModal({
                    title: '温馨提示',
                    content: '确认是否退款?',
                    success: function (res) {
                        if (res.confirm) {
                            t.$util.post('Order/refundOrder', {orderId: e.id}).then(res => {
                                console.log(res)
                                if(res.code == 1) {
                                    uni.showToast({
                                        title: res.msg || '操作成功'
                                    })
                                    setTimeout(() => {
                                        t.tabClick(8)
                                    }, 1000)
                                } else {
                                    uni.showToast({
                                        title: res.msg || '操作失败',
                                        icon: 'error'
                                    })
                                }
                            })
                        }
                    }
                })
            },
            //还款
            payback (payment) {
                let t = this
                t.$util.post('Order/payback', {planId: t.planId, payment: payment}).then(res => {
                    if(res.code == 1) {
                        if(payment == 2) {
                            uni.requestPayment({
                                "provider": "wxpay",
                                "orderInfo": res.data,
                                success(rs) {
                                    uni.showToast({
                                        title: res.msg || '还款成功',
                                        icon: 'success',
                                    })
                                    setTimeout(() => {
                                        t.$refs.popup2.close()
                                    }, 1000)
                                    //三秒之后刷新
                                    setTimeout(() => {
                                        t.getOrderList()
                                    }, 3000)
                                },
                                fail(e) {
                                    uni.showToast({
                                        title: '还款失败',
                                        icon: 'error',
                                    })
                                    setTimeout(() => {
                                        t.$refs.popup2.close()
                                    }, 1000)
                                }
                            })
                        }
                        if(payment == 3) { 
                            uni.showToast({
                                title: res.msg || '还款成功',
                                icon: 'success',
                            })
                            setTimeout(() => {
                                t.$refs.popup2.close()
                                t.$refs.popup3.close()
                            }, 1000)
                            //三秒之后刷新
                            setTimeout(() => {
                                t.getOrderList()
                            }, 3000)
                        }
                    } else {
                        uni.showToast({
                            title: res.msg || '操作失败'
                        })
                    }
                })
            } 
        }
    }
</script>
 
<style>
    @import url(/static/css/order.css);
</style>