-
zhangwei
2025-03-04 aaa8b1b2fca572d6a989179d568991ce4bd48cfb
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
<template>
    <up-sticky bgColor="#fff">
        <view class="coreshop-ff content c-p-10">
            <view class="coreshop-ff content c-p-l-10 c-p-t-10 c-p-r-10">
                <up-search placeholder="请点击选择日期" @click='clickTime' :show-action="false" @clear='init' disabled
                    v-model="workTime" search-icon="calendar" @search='init'></up-search>
            </view>
            <view class="coreshop-ff content c-p-10 chuany-flex chuany-justify-between">
                <view class="chuany-width82">
                    <up-search placeholder="请点击选择司机" @click='clickIcon' @clear='PostMyDakaListPage' disabled
                        action-text="查询" v-model="wordDate" search-icon="calendar" @search='PostMyDakaListPage'
                        @custom='PostMyDakaListPage'></up-search>
                </view>
                <up-text align="right"  text='送货安排' size='14' @click="arrange('Yes')"></up-text>
            </view>
        </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>
                            <view class="chuany-width11 chuany-flex chuany-justify-between">
                                <up-icon name="edit-pen" @click='editOrder(item)'></up-icon>
                                <up-icon name="trash" @click='delOrder(item)'></up-icon>
                            </view>
                        </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>
        <up-modal title="送货安排" :show="show7" showCancelButton @confirm="() => show7 = false">
            <up-form labelPosition="left" :model="model1" :rules="rules" ref="form1">
                <up-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1">
                    <up-input v-model="model1.userInfo.name" border="none"></up-input>
                </up-form-item>
                <up-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1">
                    <up-input v-model="model1.userInfo.name" border="none"></up-input>
                </up-form-item>
                <up-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1">
                    <up-input v-model="model1.userInfo.name" border="none"></up-input>
                </up-form-item>
                <up-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1">
                    <up-input v-model="model1.userInfo.name" border="none"></up-input>
                </up-form-item>
                <up-form-item label="姓名" prop="userInfo.name" borderBottom ref="item1">
                    <up-input v-model="model1.userInfo.name" border="none"></up-input>
                </up-form-item>
                <up-form-item label="性别" prop="userInfo.sex" borderBottom @click="showSex = true; hideKeyboard()"
                    ref="item1">
                    <up-input v-model="model1.userInfo.sex" disabled disabledColor="#ffffff" placeholder="请选择性别"
                        border="none"></up-input>
                    <template #right>
                        <up-icon name="arrow-right"></up-icon>
                    </template>
                </up-form-item>
            </up-form>
        </up-modal>
        <fui-date-picker range :show="datePickerShow" :value="getFirstDayOfMonth()" type="3" @change="changePicker" :minDate='minDate' :maxDate='maxDate'
            @cancel="clickTime"></fui-date-picker>
    </view>
</template>
 
<script>
    import {
        mapActions,
        mapGetters,
        mapMutations
    } from 'vuex'
    export default {
        data() {
            return {
                datePickerShow:false,
                workTime:'',
                orderList: [],
                loadStatus: 'loadmore',
                pageIndex: 1,
                pageSize: 20,
                contentVal: '',
                options2: [{
                    text: '编辑',
                    style: {
                        backgroundColor: '#3c9cff'
                    }
                }, {
                    text: '删除',
                    style: {
                        backgroundColor: '#f56c6c'
                    }
                }],
                isEdit: false,
                editItem: {},
                isLoading: false,
                show7: false,
                showSex: false,
                model1: {
                    userInfo: {
                        name: 'uview-plus UI',
                        sex: '',
                    },
                },
                actions: [{
                        name: '男',
                    },
                    {
                        name: '女',
                    },
                    {
                        name: '保密',
                    },
                ],
                rules: {
                    'userInfo.name': {
                        type: 'string',
                        required: true,
                        message: '请填写姓名',
                        trigger: ['blur', 'change']
                    },
                    'userInfo.sex': {
                        type: 'string',
                        max: 1,
                        required: true,
                        message: '请选择男或女',
                        trigger: ['blur', 'change']
                    },
                },
                radio: '',
                switchVal: false
            }
        },
        onShow() {
            this.init()
        },
        onPullDownRefresh() {
            this.init()
            uni.stopPullDownRefresh();
        },
        methods: {
            getFirstDayOfMonth ()  {
                var currentDate = new Date();
                // currentDate.setDate(1); // 将日期设为1
                return this.$util.formatDate(currentDate);
            },
            clickTime () {
                this.datePickerShow = !this.datePickerShow
            },
            editOrder(item) {
                this.isEdit = true
                this.contentVal = item.remark
                this.editItem = item
            },
            delOrder(item) {
                let that = this
                uni.showModal({
                    title: '提示',
                    content: '确认删除该送货吗?',
                    success: function(res) {
                        if (res.confirm) {
                            // 执行确认后的操作
                            that.$api.DelAppointmentDeliver({
                                keyid: item.keyid
                            }).then(req => {
                                if (req.code == 1) {
                                    that.$util.showToast({
                                        title: '删除成功!'
                                    })
                                    that.init()
                                } else {
                                    that.$util.showToast({
                                        title: req.error
                                    })
                                }
                            })
                        } else {
                            // 执行取消后的操作
                        }
                    }
                })
            },
            init() {
                this.pageIndex = 1
                this.pageSize = 20
                this.loadStatus = 'loadmore'
                this.orderList = []
                this.contentVal = ''
                this.getList()
            },
            reservation() {
                this.show7 = true
                if (!this.contentVal) {
                    return this.$util.showToast({
                        title: '请先输入内容!'
                    })
                }
                this.isLoading = true
                if (this.isEdit) {
                    let obj = {
                        keyid: this.editItem.keyid,
                        remark: this.contentVal
                    }
                    this.$api.UpDataAppointmentDeliver(obj).then(res => {
                        if (res.code == 1) {
                            this.isEdit = false
                            this.editItem = {}
                            this.contentVal = ''
                            this.init()
                        } else {
                            this.$util.showToast({
                                title: res.error
                            })
                        }
                        this.isLoading = false
                    })
                    return
                }
                this.$api.CreatAppointmentDeliver({
                    remark: this.contentVal
                }).then(res => {
                    if (res.code == 1) {
                        this.contentVal = ''
                        this.init()
                    } else {
                        this.$util.showToast({
                            title: res.error
                        })
                    }
                    this.isLoading = false
                })
            },
            getList() {
                let data = {
                    deliverState: 0,
                    page: {
                        pageIndex: this.pageIndex,
                        pageSize: this.pageSize,
                    }
                }
                this.$api.GetListAppointmentDeliverList(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 {
                            // 执行取消后的操作
                        }
                    }
                })
            },
            actionClick(item, e) {
                console.log(e);
                if (e.index == 0) {
                    this.contentVal = item.remark
                }
            }
        }
    }
</script>
 
<style>
</style>