-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
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
<template>
    <!-- <up-sticky bgColor="#fff">
        <view class="c-p-18">
            <up-input v-model="contentVal">
                <template #suffix>
                    <up-button @tap="reservation" text="预约送货" type="primary" size="mini"></up-button>
                </template>
            </up-input>
        </view>
    </up-sticky> -->
    <view class="c-p-b-100">
        <view class="c-p-l-20 c-p-r-20" v-if="orderList&&orderList.length>0">
            <view class="listrecord c-p-t-20" v-for="(item,index) in orderList" :key="item.keyid">
                <view class="coreshop-ff chuany-bradius20">
 
                    <view class="chuany-font26">
                        <view class="chuany-flex chuany-justify-between">
                            <text class="chuany-width5">{{index+1}}</text>
                            <view class="chuany-width15">
                                {{$util.formatDate(item.createTime,'riqi')}}
                            </view>
                            <view class="chuany-width65">
                                <u-text size='14' :text="item.remark" lines="1">
                                </u-text>
                            </view>
                            <u-text align="right" size='14' type="error" text="未受理" @click='accept(item)'>
                            </u-text>
                        </view>
                        <view class="c-p-t-8">
                            <u--text :lines="1" :text="item.planContent"></u--text>
                        </view>
                    </view>
                </view>
            </view>
            <up-loadmore :status="loadStatus" />
        </view>
        <view v-else>
            <up-empty text='暂无' icon="/static/order.png">
            </up-empty>
        </view>
    </view>
</template>
 
<script>
    import {
        mapActions,
        mapGetters,
        mapMutations
    } from 'vuex'
    export default {
        data() {
            return {
                orderList: [],
                loadStatus: 'loadmore',
                pageIndex: 1,
                pageSize: 20,
                contentVal: '',
                options2: [{
                    text: '编辑',
                    style: {
                        backgroundColor: '#3c9cff'
                    }
                }, {
                    text: '删除',
                    style: {
                        backgroundColor: '#f56c6c'
                    }
                }],
            }
        },
        onShow() {
            this.init()
        },
        onPullDownRefresh() {
            this.init()
            uni.stopPullDownRefresh();
        },
        onReachBottom() {
            if (this.loadStatus != 'nomore') {
                this.getList()
            }
        },
        computed: {
            ...mapGetters(['userInfo', 'identity']),
            isAdmin() {
                return this.userInfo.userCompany ? this.userInfo.userCompany.isAdmin : false
            },
 
        },
        methods: {
            init() {
                this.pageIndex = 1
                this.pageSize = 20
                this.loadStatus = 'loadmore'
                this.orderList = []
                this.contentVal = ''
                this.getList()
            },
            reservation() {
                this.$api.CreatAppointmentDeliver({
                    remark: this.contentVal
                }).then(res => {
                    if (res.code == 1) {
                        this.contentVal = ''
                        this.init()
                    }
                })
            },
            getList() {
                let data = {
                    deliverState: 0,
                    page: {
                        pageIndex: this.pageIndex,
                        pageSize: this.pageSize,
                    }
                }
                this.$api.driverGetListAppointmentDeliverList(data).then(res => {
                    console.log(res, res.code, '-----------123’');
                    if (res.code == 1) {
                        if (this.pageIndex == 1) {
                            this.orderList = res.data.data
                        } else {
                            this.orderList = this.orderList.concat(...res.data.data)
                        }
                        console.log(this.orderList, 'orderList’');
                        // totalPages = res.data.totalCount
                        // 根据count数量判断是否还有数据
                        if (res.data.page.totalCount > this.orderList.length) {
                            this.loadStatus = 'loadmore'
                            this.pageIndex++
                        } else {
                            // 数据已加载完毕
                            this.loadStatus = 'nomore'
                        }
                    } else {
                        // _that.$refs.uToast.show({ message: res.msg, type: 'error' });
                    }
                })
            },
            accept(item) {
                let that = this
                uni.showModal({
                    title: '提示',
                    content: '确认受理该送货吗?',
                    success: function(res) {
                        if (res.confirm) {
                            // 执行确认后的操作
                            that.$api.AcceptAppointmentDeliver(item.keyid).then(req => {
                                if (req.code == 1) {
                                    that.$util.showToast({
                                        title: '受理成功!'
                                    })
                                    that.init()
                                } else {
                                    that.$util.showToast({
                                        title: req.error
                                    })
                                }
                            })
                        } else {
                            // 执行取消后的操作
                        }
                    }
                })
            }
        }
    }
</script>
 
<style>
</style>