liangjin
2021-04-26 eec8c2b8ee19027168f3e0694917728f8a321c7f
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
<!--
 * @Author: 小明丶
 * @Date: 2019-08-15 10:57:51
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-11-17 16:03:20
 * @Description: 代理 审批页面
 -->
<template>
    <div class="approve-box">
        <v-navbar title="审批" fixed >
        </v-navbar>
        <div class="fixed-top">
            <nav class="nav text-center-g flex-center-g" :style="{background:$store.state.lastColor}">
                <div class="child flex-start-g">
                    <div class="flex-1-g" :class="navIndex===0?'active':''" @click="setNavIndex(0)">待审批</div>
                    <div class="flex-1-g" :class="navIndex===1?'active':''" @click="setNavIndex(1)">已通过</div>
                    <div class="flex-1-g" :class="navIndex===2?'active':''" @click="setNavIndex(2)">已拒绝</div>
                </div>
            </nav>
            <van-search class="search icons-ser" placeholder="请输入商户名称/负责人电话" v-model="searchKey" shape='round' @search="init">
                <!--<template slot="left-icon">-->
                    <!--<div  class="">-->
                    <!--<svg class="icon" aria-hidden="true"  style="width:20px;height:20px;">-->
                        <!--<use xlink:href="#iconsousuo"></use>-->
                    <!--</svg>-->
                    <!--</div>-->
                <!--</template>-->
            </van-search>
        </div>
 
 
        <hList @scroll="saleOrderLoad" :defScroll='10' :finished='finished' :loading="loading" height="74vh">
            <div class="list-box">
                <div class="mer-item flex-between-g" v-for="(item, index) in calcList" :key="index" @click="goMerDetail(item.merId)">
                    <div class="flex-start-g">
                        <div class="icon-box flex-center-g" :style="{background:$store.state.lastColor}">
                            <svg class="icon" aria-hidden="true" style="width:22px;height:22px;fill:#fff;">
                                <use xlink:href="#iconshanghuguanliliebiao"></use>
                            </svg>
                        </div>
                        <div >
                            <p class="name text-clip-g" style="max-width:170px;">{{item.merName}}</p>
                            <p class="tel">{{ navIndex ===1 ?item.tempName : item.priMblNo}}</p>
                        </div>
                    </div>
                    <!-- v-if="item.hidden!==0" -->
                    <van-button class="btn" :style="{background:$store.state.backColor}"  @click.stop="openModal(item)">{{navIndex ===1 ? '产品管理' :'审批'}}</van-button>
                </div>
            </div>
        </hList>
        <van-popup v-model="isShow">
            <div class="modal">
                <div class="top flex-center-g" :style="{background:$store.state.lastColor}">
                    <van-icon class="cross" name="cross" color='#fff' size='25px' @click="isShow = false;" />
                    <svg class="icon" aria-hidden="true" style="width:85px;height:95px;">
                        <use xlink:href="#iconshenpidanchuang"></use>
                    </svg>
                </div>
                <footer class="footer text-center-g">
                    <p class="name text-clip-g ">{{merName}}</p>
                    <p class="c-text-999-g">请确认商户审批结果</p>
                    <div>
                        <van-button :style="{background:$store.state.backColor}" class="btn" @click="submit(3)">拒绝</van-button>
                        <van-button :style="{background:$store.state.backColor}" class="btn btn-default" @click="submit(1)">同意</van-button>
                    </div>
                </footer>
            </div>
        </van-popup>
    </div>
</template>
 
<script>
    import Template_detail from "../template/detail";
    import hList from '../../components/common/h-list';
    export default {
        components: {Template_detail,hList},
        data() {
            return {
                isShow: false,
                navIndex: 0,
                finished:false,
                loading:false,
                searchKey: '',
                list:[
                    {
                        arr:[],
                    },
                    {
                        arr:[],
                    },
                    {
                        arr:[],
                    },
                ],
                merId:'',
                merName:''
            }
        },
        computed:{
            calcList(){
                return this.list[this.navIndex].arr;
            }
        },
        created(){
            this.init()
        },
        methods: {
            saleOrderLoad(){
                let merId = ''
                var myArr = this.list[this.navIndex].arr
 
                if(this.list[this.navIndex].arr.length >= 10){
                    merId = myArr[myArr.length-1].merId
                }
                console.log(this.finished)
                this.$api.getAuditList({
                    auditStatus:this.navIndex,
                    searchKey:this.searchKey,
                    merId:merId
                }).then((res) => {
                    let {merList} = res.body;
                    if(this.navIndex===0){
                        merList = merList.map(item=>{
                            if(item.canAudit ===0){
                                item.hidden = 0;
                            }
                            return item
                        })
                    }
                    if(merList.length < 10){
                        this.list[this.navIndex].arr = [...myArr,...merList]
                        this.loading = false
                        this.finished = true
                    }else{
                        this.list[this.navIndex].arr = [...myArr,...merList]
                        this.loading = false
                        this.finished = false
                    }
                    console.log(this.finished)
                }).catch((err) => {
 
                });
            },
            //跳转到商户详情
            goMerDetail(merId){
                this.$router.push(`/mine/mer-info?merId=${merId}`)
            },
            //打开审批弹窗 已通过的产品跳转到 产品管理页面
            openModal(item){
                if(this.navIndex!==1){
                    this.merId = item.merId;
                    this.merName = item.merName;
                    this.isShow=true;
                }else{
                    this.$router.push(`/template/detail?merId=${item.merId}`)
                }
            },
            //审批
            submit(status){
                this.$api.merAudit({
                    merId: this.merId,
                    status
                }).then(res => {
                    this.$notify('审批完成!')
                    this.isShow = false;
                });
            },
            // 获取列表数据
            init(){
                this.$api.getAuditList({
                    auditStatus:this.navIndex,
                    searchKey:this.searchKey
                }).then((res) => {
                    let {merList} = res.body;
                    if(merList.length < 10){
                        this.finished = true
                    }
                    if(this.navIndex===0){
                        merList = merList.map(item=>{
                            if(item.canAudit ===0){
                                item.hidden = 0;
                            }
                            return item
                        })
                    }
                    this.list[this.navIndex].arr = merList;
                }).catch((err) => {
 
                });
            },
            setNavIndex(index) {
                this.finished = false;
                this.loading = false;
                this.navIndex = index;
                this.init()
            }
        },
    }
</script>
<style lang="less" scoped>
    .approve-box {
        //padding-bottom: 40px;
        padding-top: 105px;
    }
 
    .list-box{
        background-color: @c-bg-fff;
        //padding-bottom: 10px;
        padding-top: 5px;
    }
 
 
    .fixed-top {
        position: fixed;
        top: 0;
        width: 100%;
        z-index: @zIndex-10;
    }
 
    .search {
        padding: 15px 8px;
    }
 
    .nav {
        height: 44px;
        background-color: @c-bg-black;
        font-weight: bold;
 
        .child {
            width: 360px;
            margin: 0 auto;
            background-color: @c-bg-555;
            border-radius: 16px;
        }
 
        .flex-1-g {
            .lh(32px);
            color: @c-text-fff;
            opacity: 0.4;
 
            &.active {
                opacity: 1;
                border-radius: 16px;
                background-color: @c-bg-fff;
                color: @c-text-black;
            }
        }
    }
 
    .mer-item {
        margin: 0 8px 10px;
        box-shadow: 0px 0px 5px 0px rgba(66, 61, 93, 0.08);
        border-radius: 3px;
        background: @c-bg-fff;
        padding: 0 12px;
        height: 67px;
 
        .icon-box {
            height: 32px;
            width: 32px;
            margin-right: 15px;
            border-radius: 50%;
            background: @c-bg-black;
        }
 
        .name {
            font-weight: bold;
        }
 
        .tel {
            font-size: @font-12;
            color: @c-text-666;
            margin-top: 5px;
        }
 
        .btn {
            .lh(28px);
            padding: 0 13px;
            background: @c-bg-default;
            border-radius: 13px;
            color: @c-text-fff;
        }
    }
 
    .modal {
        width: 280px;
 
        .top {
            position: relative;
            height: 115px;
            background-color: @c-bg-black;
            align-items: flex-end;
 
            .cross {
                position: absolute;
                top: 5px;
                right: 5px;
 
            }
        }
 
        .footer {
            height: 125px;
 
            .name {
                .lh(17px);
                margin: 23px 13px 13px;
            }
 
            .btn {
                .lh(36px);
                margin: 25px 10px 0;
                width: 110px;
                border-radius: 18px;
                background-color: @c-bg-eee;
                color: @c-text-666;
 
                &.btn-default {
                    background-color: @c-bg-default;
                    color: @c-text-fff;
                }
            }
        }
    }
</style>