liangjin
2021-04-01 17b4a933b86881641eb65e6ffcdc3d253cb3e7e1
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
<!--
 * @Date: 2019-09-02 09:01:22
 * @LastEditors  : 小明丶
 * @LastEditTime : 2019-12-27 10:50:39
 * @Description:
 -->
<template>
    <div class="open-xyg-index">
        <x-header :title="'开通信用购'" :left-options="{backText: '', preventGoBack: true}" @on-click-back="goBackPage">
        </x-header>
        <!-- v-show="step === 1"  -->
        <base-info
                v-show="step === 1"
                :storeInfo="storeInfo"
        >
        </base-info>
        <f-space type="large"></f-space>
        <!-- <f-button @on-click="handleNextStep" fixed>{{'提交开通'}}</f-button> -->
        <van-button class="btn" round @click="handleNextStep" >{{'提交开通'}}</van-button>
    </div>
</template>
 
<script>
    import BaseInfo from './mgrBaseInfo.vue';
    import formCheckAndComt from '@/utils/formCheckAndComb';
 
    import {
        dateFormat
    } from 'vux'
 
    export default {
        name: 'xygMgrOpen',
        components: {
            BaseInfo,
        },
        data() {
            return {
                orgType:0,
                step: 1,
                stepText: '下一步',
                storeInfo: {
                    staffName: '',
                    staffPhone: '',
                    post:'',
                    oprId:''//营业员编号
                },
                // 验证开户信息字段
                storeCheckInfo: [
                    {
                        key: 'staffName',
                        tipType: 1,
                        message: '营业员姓名'
                    },
                    {
                        key: 'staffPhone',
                        tipType: 1,
                        message: '营业员电话'
                    },
                    {
                        key: 'post',
                        tipType: 1,
                        message: '营业员岗位'
                    },
                ],
                bankNo:''
            };
        },
        computed:{
            // 通过icon字段判断是智享云还是购机直降
        },
        created(){
            this.init();
            this.orgType = Number(this.$route.query.orgType);
        },
        methods: {
            // 设置地区code
 
            goBackPage() {
                if (this.step === 2) {
                    this.step -= 1;
                } else {
                    this.$router.push({
                        path: '/store/productManage'
                    });
                }
            },
            // 初始化页面
            init() {
                let fn = this.$api.xygInitMgr;
                fn().then(res => {
                    let body = res.body;
                    for (let i in this.storeInfo) {
                        this.storeInfo[i] = body[i] ? body[i] : '';
                    }
                });
            },
            // 处理点击下一步跳转处理
            handleNextStep() {
                // 判断表单字段必填性
                if (this.step === 1) {
                    // 信用购增加这两个字段验证
 
                    // 判断表单是否必填
                    if (!formCheckAndComt.checkRequiredField(this.storeCheckInfo,this.storeInfo,this)) {
                        return false;
                    }
                } else {
                    this.handleSubmitOpen();
                }
                this.handleSubmitOpen();
            },
            // 处理提交
            handleSubmitOpen() {
                let submitInfo = {
                    ...this.storeInfo
                };
 
 
                let fn;
                fn = this.$api.xygOpenMgr; //营业员开通接口
                fn(submitInfo).then((res) => {
                    this.$router.push({
                        path: '/xyg/open-result',
                        // 提交后,默认跳转审核结果页面,状态为开通中
                        query: {
                            orgType: this.orgType,
                            openStatus: 1,
                            icon:this.$route.query.icon
                        }
                    })
                });
            }
        }
    };
 
</script>
 
<style lang="less" scoped>
    .open-xyg-index{
        padding-top: 54px;
        height:100%;
        background-color: #f1f1f1;
    }
    .btn {
        position: fixed;
        bottom: 15px;
        width: 84%;
        margin: 0 8%;
        background: @c-default;
        color: @c-text-fff;
        display: block;
        margin-top: 15px;
        }
</style>