liangjin
2021-04-01 006010711477c17f05de52f074a284e0184923b5
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
<!--
* @Author: c.y
 * @Date: 2019-09-02 09:01:22
 * @LastEditors: 小明丶
 * @LastEditTime: 2019-09-02 09:15:03
 * @Description:
 -->
<template>
    <div class="open-heyd-page">
        <group>
            <x-input title='门店名称' v-model.trim="storeInfo.storeName" readonly text-align='right'></x-input>
            <x-input title='经营地所在省' v-model.trim="storeInfo.storeProvinceName" readonly text-align='right'></x-input>
            <x-input title='经营地所在市' v-model.trim="storeInfo.storeCityName" readonly text-align='right'></x-input>
            <x-input title='经营地所在区' v-model.trim="storeInfo.storeDistrictName" readonly text-align='right'></x-input>
            <x-input title='经营详细地址' v-model.trim="storeInfo.storeDetailAddr" readonly placeholder='请输入' text-align='right'></x-input>
        </group>
        <f-space></f-space>
        <group>
            <selector title='营业执照类型' placeholder='请选择' @on-change='handleLicenseTypeChange' v-model="storeInfo.bizLicenseType"
                      :options='bizLicenseTypeList' :value-map="['code','name']" direction='rtl'></selector>
            <x-input title='营业执照号' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.licenseNo" placeholder='请输入' text-align='right'></x-input>
            <x-input title='营业执照名称' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.orgName" placeholder='请输入' :max='50'  text-align='right'></x-input>
            <datetime v-if="storeInfo.bizLicenseType ===2" v-model="storeInfo.issueDate" format="YYYY-MM-DD" title="注册日期" placeholder="请选择"></datetime>
        </group>
        <group>
            <van-field v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.addrText" clearable :readonly="true" right-icon="arrow" label="注册省市区"
                       @click="isShowArea = !isShowArea" placeholder="                                        请选择" text-align='right'/>
            <x-input title='注册详细地址' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.regDetailAddr" placeholder='请输入' :max='100' text-align='right'></x-input>
            <x-input title='营业厅编码' v-model.trim="storeInfo.outStoreNo" placeholder='请输入' :max='100' text-align='right'></x-input>
        </group>
        <f-space></f-space>
        <group>
            <x-input title='法人名称' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.legalName"  placeholder='请输入' text-align='right'></x-input>
            <x-input title='法人身份证号' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.legalIdCardNo" placeholder='请输入' text-align='right'></x-input>
            <x-input title='法人身份证地址' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.legalIdCardAddress" placeholder='请输入' text-align='right'></x-input>
            <x-input title='法人手机号' v-if="storeInfo.bizLicenseType ===2" v-model.trim="storeInfo.legalPhone" placeholder='请输入' :max='11' text-align='right'></x-input>
        </group>
        <van-popup v-model="isShowArea" position="bottom" :close-on-click-overlay="false">
            <van-area ref='Area' :area-list='areaList' @cancel="closeAreaModal" @confirm="setAreaValue"></van-area>
        </van-popup>
    </div>
</template>
 
<script>
    import {calcArea} from '@/utils/index';
    import {
        mapState,
        mapActions
    } from 'vuex';
    import {
        Datetime,
        XAddress
    } from 'vux';
    export default {
        name: 'heydStoreBase',
        components: {
            Datetime,
            XAddress,
            ...mapState(['areaList'])
        },
        data() {
            return {
                areaList:{//地区列表
                    province_list:{}, //省
                    city_list:{}, //市
                    county_list:{}, //地区、县
                }
            };
        },
        props: {
            addressList: {
                type: Array,
                default: []
            },
            address: {
                type: Array,
                default: []
            },
            isShowArea: {
                type: Boolean,
                default: false
            },
            storeInfo: {
                type: Object
            },
            bizLicenseTypeList: {
                type: Array,
                default: () => {
                    return [];
                }
            },
        },
        computed:{
            calcAddress:{
                get(){
                    return this.address || [];
                },
                set(newV){
                    this.$emit('addr-change', newV);
                }
            }
 
        },
        created() {
            this.getArea();
        },
        methods: {
            ...mapActions(['getArea']),
            // 获取地区列表
            getArea() {
                Vue.prototype.$api.getArea().then((res) => {
                    let { provList } = res.body;
                    let obj = calcArea(provList);
                    this.areaList =  {
                        province_list:obj.province_list,
                        city_list:obj.city_list,
                        county_list:obj.county_list
                    }
                }).catch((err) => {
 
                });
            },
            //关闭地区弹窗
            closeAreaModal() {
                console.log(this.areaList);
                this.isShowArea = false;
                this.$refs.Area.reset()
            },
            //保存 地区选择
            setAreaValue(arr) {
                this.storeInfo.addrText = arr[0].name + '-' + arr[1].name + '-' + arr[2].name;
                this.storeInfo.regProvinceCode = arr[0].code;
                this.storeInfo.regCityCode = arr[1].code;
                this.storeInfo.regDistrictCode = arr[2].code;
                this.isShowArea = false;
                this.$refs.Area.reset()
            },
            // 账号类型
            handleLicenseTypeChange(val) {
                let currentEle = JSON.parse(JSON.stringify(this.bizLicenseTypeList)).find((item) => {
                    return item.code = val;
                });
            }
        }
    };
 
</script>
 
<style lang="less" scoped>
    .open-heyd-page {
        .title {
            padding: 14px 12px;
            font-size: 15px;
            color: #333;
 
            .line {
                display: inline-block;
                width: 2px;
                height: 16px;
                margin-right: 8px;
                background: @color-text-three;
                vertical-align: middle;
                margin-top: -1px;
            }
        }
 
        .vux-datetime {
            font-size: 15Px;
        }
 
        .vux-datetime-value {
            span {
                width: 100%;
                text-align: right;
            }
        }
    }
 
</style>