#
whycq
2023-12-02 178d0ee433ecee57bbd57804cc29c593f3de7829
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
<template>
    <view>
        <!-- 搜索框 -->
        <view class="status_bar">
            <!-- 这里是状态栏 -->
        </view>
        <uni-nav-bar left-icon="left" title="规划申请单" @clickLeft="back" @clickRight="scan"  :fixed="true"
            :border="false" rightWidth="160rpx" leftWidth="160rpx"
            >
            <block slot="right">
                <view class="city">
                    <view>
                        <text class="uni-nav-bar-text">{{user.username}}</text>
                    </view>
                    <uni-icons type="arrowdown" color="#333333" size="20" />
                </view>
            </block>
         </uni-nav-bar>
        <!-- 搜索框 -->
        <view class="search-bg">
            <u-search placeholder="输入" v-model="keyword" :clearabled="true" @custom="search()" @search="search()"></u-search>
        </view>
        <view>
            <!-- 客户列表 -->
            <view class="c-list" v-for="(item,index) in csmtrList" :key="index">
                <view class="titles" @click="getDetails(item.id)">
                    <view style="flex: 1;">
                        <y-title :title="item.name"></y-title>
                    </view>
                    <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
                </view>
                <view style="display: grid;grid-template-columns: 1fr 3fr;">
                    <view class="list-item1">ID</view><view class="list-item2">{{item.id}}</view>
                    <view class="list-item1">业务员</view><view class="list-item2">{{item.userId$}}</view>
                    <view class="list-item1">业务类型</view><view class="list-item2">{{item.planType$}}</view>
                    <view class="list-item1">规划单号</view><view class="list-item2">{{item.uuid}}</view>
                    <view class="list-item1">所需</view><view class="list-item2">{{item.planNeed$}}</view>
                    <view class="list-item1">规划员</view><view class="list-item2">{{item.planner$}}</view>
                    <view class="list-item1">跟踪项目</view><view class="list-item2 color-main" 
                        @click="goDetls(item.orderId)">{{item.orderId$}}</view>
                    <view class="list-item1">申请日期</view><view class="list-item2">{{item.appleTime$}}</view>
                    <view class="list-item1">进度</view><view class="list-item2">{{item.settle$}}</view>
                    <view class="list-item1">状态</view><view class="list-item2">{{item.status$}}</view>
                    <view class="list-item1">修改人</view><view class="list-item2">{{item.updateBy$}}</view>
                    <view class="list-item1">关联流程</view><view class="list-item2 color-main"
                        @click="lookAssistantPlan(item.id)">查看关联流程</view>
                    <view class="list-item1">主副标记</view><view class="list-item2">{{item.assistantHostSign$}}</view>
                </view>
            </view>
        </view>
        <!-- <uni-load-more :status="status" :icon-size="16" :content-text="contentText" /> -->
        <u-empty v-if="true" icon="../../../static/image/emptyList.png" v-show="csmtrList.length <= 0" />
        <view>
            <!-- 添加弹窗 -->
            <uni-popup ref="popup" background-color="#fff">
                <view class="popup-content">
                    <view>
                        <button v-for="item in planType" class="button btnn" type="primary" @click="add(item.value)">{{item.name}}</button>
                    </view>
                </view>
            </uni-popup>
        </view>
        
        <view>
            <!-- 关联流程弹窗 -->
            <uni-popup ref="assistantPlan">
                <view class="popup-bottom">
                    <view style="height: 10rpx;"></view>
                    <!-- 客户列表 -->
                    <view class="c-list" v-for="(item,index) in assCsmtr" :key="index">
                        <view class="titles" @click="getDetails(item.id)">
                            <view style="flex: 1;">
                                <y-title :title="item.name"></y-title>
                            </view>
                            <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
                        </view>
                        <view style="display: grid;grid-template-columns: 1fr 3fr;">
                            <view class="list-item1">ID</view><view class="list-item2">{{item.id}}</view>
                            <view class="list-item1">业务员</view><view class="list-item2">{{item.userId$}}</view>
                            <view class="list-item1">业务类型</view><view class="list-item2">{{item.planType$}}</view>
                            <view class="list-item1">规划单号</view><view class="list-item2">{{item.uuid}}</view>
                            <view class="list-item1">所需</view><view class="list-item2">{{item.planNeed$}}</view>
                            <view class="list-item1">规划员</view><view class="list-item2">{{item.planner$}}</view>
                            <view class="list-item1">跟踪项目</view><view class="list-item2 color-main" 
                                @click="goDetls(item.orderId)">{{item.orderId$}}</view>
                            <view class="list-item1">申请日期</view><view class="list-item2">{{item.appleTime$}}</view>
                            <view class="list-item1">进度</view><view class="list-item2">{{item.settle$}}</view>
                            <view class="list-item1">状态</view><view class="list-item2">{{item.status$}}</view>
                            <view class="list-item1">修改人</view><view class="list-item2">{{item.updateBy$}}</view>
                            <!-- <view class="list-item1">关联流程</view><view class="list-item2 color-main"
                                @click="lookAssistantPlan(item.id)">查看关联流程</view> -->
                            <view class="list-item1">主副标记</view><view class="list-item2">{{item.assistantHostSign$}}</view>
                        </view>
                    </view>
                    <view style="height: 5rpx;"></view>
                </view>
            </uni-popup>
        </view>
        
        <view style="height: 5rpx;"></view>
        <view class="fxbtn">
            <uni-icons type="plusempty" color="#fff" @click="gotoggle()" ></uni-icons>
        </view>
        <uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
    </view>
</template>
 
<script>
    import user from '@/pages/api/user/user.js'
    export default { 
        data() {
            return {
                keyword: '',
                user: {
                    username: '',
                    id: 0,
                    type: ''
                },
                falg: true,
                csmtrList: [],
                assCsmtr: [],
                last_id: '',
                reload: false,
                status: 'more',
                curr:2,
                contentText: {
                    contentdown: '上拉加载更多',
                    contentrefresh: '加载中',
                    contentnomore: '没有更多'
                },
                type: 'center',
                planType :[
                    {
                        name:'立体库(货架)',
                        value: 1
                    },
                    {
                        name:'立体库(集成)',
                        value: 2
                    },
                    {
                        name:'四向穿梭库/两向穿梭库',
                        value: 3
                    },
                    {
                        name:'阁楼货架/钢平台',
                        value: 4
                    },
                    {
                        name:'周转容器',
                        value: 5
                    },
                    {
                        name:'平库',
                        value: 6
                    },
                    {
                        name:'其他',
                        value: 7
                    },
                ],
                param: {curr:1,limit:4}
            }
        },
        onLoad() {
            
        },
        onShow() {
            let that = this
            uni.$on('isRefresh',function(data){
                that.user.username = data.title
                that.user.id = data.id
                that.user.type = data.key
                that.falg = false
            })
            if (this.falg) {
                this.getDetail()
            }
            setTimeout(()=> {
                this.getList()
            },50)
        },
        onReachBottom() {
            this.status = 'more';
            this.getCsmtr()
        },
        methods: {
            async getDetail() {
                let res = await user.getDetail()
                if (res.code === 200) {
                    this.user.username = res.data.username
                    this.user.id = res.data.id
                } else if (res.code === 403) {
                    this.backLogin(res)
                }
            },
            gotoggle() {
                this.toggle('right')
            },
            add(val) {
                let addPlan = 'addPlan',_this = this
                if (val > 1) {
                    addPlan = 'addPlan' + val
                }
                uni.navigateTo({
                    url:'/pages/business/plan/' + addPlan,
                    success() {
                        _this.$refs.popup.close()
                    }
                })
                
                
            },
            toggle(type) {
                this.type = type
                // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
                this.$refs.popup.open(type)
            },
            getList() {
                let that = this
                that.csmtrList = []
                uni.showLoading()
                if (this.user.type == 'user_id') {
                    that.param = {curr:1,limit:4,user_id: that.user.id}
                } else if(this.user.type == 'dept_id') {
                    that.param = {curr:1,limit:4,dept_id: that.user.id}
                } 
                uni.request({
                    url: that.baseUrl + '/plan/page/auth',
                    header: {'token' : uni.getStorageSync('token'),},
                    data: that.param,
                    method:'GET',
                    success(result) {
                        if (result.statusCode ===  404) {
                            uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                            return
                        }
                        var res = result.data
                        if (res.code === 200) {
                            let list = res.data.records
                            that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
                            if (res.data.records.length == 0) {
                                that.status = 'noMore'
                            }
                        } else if (res.code === 403) {
                            uni.showToast({title: res.msg, icon: "none", position: 'top'})
                            setTimeout(() => {
                                uni.reLaunch({
                                    url: '../../login/login'
                                });
                            }, 1000);
                        } else {
                            uni.showToast({title: res.msg, icon: "none",position: 'top'})
                        }
                    },
                    fail(result) {
                        uni.showToast({title: '请求失败'})
                        setTimeout(() => {
                            uni.reLaunch({
                                url: '../../login/login'
                            });
                        }, 1000);
                    },
                    complete() {
                        uni.hideLoading()
                    }
                })
            },
            getCsmtr1(e) {
                let that = this
                that.csmtrList = []
                uni.showLoading()
                let param = {curr:1,limit:4,dept_id: 0,user_id: 67}
                if (this.user.type == 'user_id') {
                    param = {curr:1,limit:4,user_id: that.user.id}
                } else if(this.user.type == 'dept_id') {
                    param = {curr:1,limit:4,dept_id: that.user.id}
                } else {
                    param = {curr:1,limit:4}
                }
                param = {curr:1,limit:4}
                uni.request({
                    url: that.baseUrl + '/plan/page/auth',
                    header: {'token' : uni.getStorageSync('token'),},
                    data: param,
                    method:'GET',
                    success(result) {
                        if (result.statusCode ===  404) {
                            uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                            return
                        }
                        var res = result.data
                        if (res.code === 200) {
                            let list = res.data.records
                            that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
                            if (res.data.records.length == 0) {
                                that.status = 'noMore'
                            }
                        } else if (res.code === 403) {
                            uni.showToast({title: res.msg, icon: "none", position: 'top'})
                            setTimeout(() => {
                                uni.reLaunch({
                                    url: '../../login/login'
                                });
                            }, 1000);
                        } else {
                            uni.showToast({title: res.msg, icon: "none",position: 'top'})
                        }
                    },
                    fail(result) {
                        uni.showToast({title: '请求失败'})
                        setTimeout(() => {
                            uni.reLaunch({
                                url: '../../login/login'
                            });
                        }, 1000);
                    },
                    complete() {
                        uni.hideLoading()
                    }
                })
            },
            getCsmtr() {
                let that = this
                uni.showLoading({})
                let param = {curr:that.curr,limit:4,dept_id: 0,user_id: 67}
                if (this.user.type == 'user_id') {
                    param = {curr:that.curr,limit:4,user_id: that.user.id}
                } else if(this.user.type == 'dept_id') {
                    param = {curr:that.curr,limit:4,dept_id: that.user.id}
                } else {
                    param = {curr:that.curr,limit:4}
                }
                uni.request({
                    url: that.baseUrl + '/plan/page/auth',
                    header: {'token' : uni.getStorageSync('token'),},
                    data: param,
                    method:'GET',
                    success(result) {
                        if (result.statusCode ===  404) {
                            uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                            return
                        }
                        var res = result.data
                        if (res.code === 200) {
                            let list = res.data.records
                            that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
                            console.log(list);
                            if (list.length > 0) {
                                that.curr = that.curr + 1
                            }
                            if (res.data.records.length == 0) {
                                that.status = 'noMore'
                            }
                        } else if (res.code === 403) {
                            uni.showToast({title: res.msg, icon: "none", position: 'top'})
                            setTimeout(() => {
                                uni.reLaunch({
                                    url: '../../login/login'
                                });
                            }, 1000);
                        } else {
                            uni.showToast({title: res.msg, icon: "none",position: 'top'})
                        }
                    },
                    fail(result) {
                        uni.showToast({title: '请求失败'})
                        setTimeout(() => {
                            uni.reLaunch({
                                url: '../../login/login'
                            });
                        }, 1000);
                    },
                    complete() {
                        uni.hideLoading()
                    }
                })
            },
            getDetails(id) {
                uni.navigateTo({
                    url: '/pages/business/plan/planDetails?id=' + id
                })
            },
            goDetls(id) {
                uni.navigateTo({
                    url: '/pages/business/saleManage/saleManageDetails?id=' + id
                })
            },
            lookAssistantPlan(id) {
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/plan/assistantPlan/view/auth`,
                    header: {'token' : uni.getStorageSync('token')},
                    data: {hostPlanId:id},
                    success(res) {
                        res = res.data 
                        if (res.code === 200) {
                            _this.assCsmtr = res.data.records
                            if (_this.assCsmtr.length > 0) {
                                _this.$refs.assistantPlan.open('bottom')
                            } else {
                                uni.showToast({title: '无关联流程', icon: "none", position: 'center'})
                            }
                            
                        }
                    }
                })
            },
            // ---
            search() {
                
            },
            back() {
                uni.navigateBack({
                })
            },
            scan() {
                uni.navigateTo({
                    url: '/pages/authority/authority'
                })
            },
        }
    }
</script>
 
<style>
    .btnn {
        margin-top: 10px;
    }
    .btnn:first-child {
        margin-top: 20px;
    }
    .popup-content {
        width: 60vw;
        margin-top: 260rpx;
        display:  flex;
        align-items: center;
        justify-content: center;
        background-color: #fff;
    }
    .popup-bottom {
        height: 60vh;
        background-color: #fff;
        border-radius: 20rpx 20rpx 0 0;
    }
    .popup-height {
        display: height;
        width: 300px;
    }
    .c-list {
        width: 96%;
        min-height: 100rpx;
        background-color: #fff;
        border-radius: 10rpx;
        margin: 20rpx 2% 0 2%;
        display: flex;
        flex-direction: column;
        font-size: 24rpx;
    }
    /* 父view 换 scroll-view */
    .c-list:last-child {
        margin-bottom: 20px;
    }
    .list-item1 {
        min-height: 45rpx;
        line-height: 45rpx;
        color: #909399;
        text-indent: 30rpx;
    }
    .list-item2 {
        min-height: 45rpx;
        line-height: 45rpx;
        color: black;
    }
    .color-main {
        color: #55aaff
    }
    .titles {
        padding-left: 10rpx;
        text-indent: 5rpx;
        margin-top: 10rpx;
        display: flex;
    }
    /* .title {
        height: 60rpx;
        line-height: 70rpx;
        font-size: 28rpx;
        font-weight: 900;
        color: #303133;
    } */
</style>