zengh
2022-05-09 52c39f5e2711e5535b689b66dfa5e100c7882b7f
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
<template>
    <view class="content">
            <view class="row regis-info">
                <text class="info-title"><!-- <span style="color: red;">* --></span>客户名称: </text>
                <picker @change="tenantNameSelect" :range="tenantNameArray" class="tenant-select">
                      <label :style="{color:tenantNameColor}" v-model="tenantName">{{ tenantNameArrayType }}</label>
                </picker>
                <!-- <input class="input" type="text"  v-model="tenantName" placeholder="请输入客户名称" placeholder-class="placeholder" /> -->
            </view>
            <view class="row regis-info">
                <text class="info-title"><!-- <span style="color: red;">* --></span>客户类型: </text>
                <picker @change="typeSelect" :range="typeArray" class="type-select">
                      <label :style="{color:typeArrayTypeColor}" v-model="typeArrayType">{{ typeArrayType }}</label>
                </picker>
                <!-- <input class="input" type="text"  v-model="type" placeholder="请输入客户类型" placeholder-class="placeholder" /> -->
            </view>
            <view class="row regis-info-linkman">
                <text class="info-title"><!-- <span style="color: red;">* --></span>联系人: </text>
                <input class="input" type="text"  v-model="linkman" placeholder="请输入联系人名称" placeholder-class="placeholder" />
            </view>
            <view class="row regis-info">
                <text class="info-title"><!-- <span style="color: red;">* --></span>联系电话: </text>
                <input class="input" type="text"  v-model="contactNumber" placeholder="请输入联系电话" placeholder-class="placeholder" />
            </view>
            <view class="row regis-info">
                <text class="info-title"><!-- <span style="color: red;">* --></span>客户地址: </text>
                <input class="input" type="text"  v-model="address" placeholder="请输入客户地址" placeholder-class="placeholder" />
            </view>
            <view class="row regis-info-desc">
                <text class="info-title"><!-- <span style="color: red;">* --></span>域名地址: </text>
                <input class="input" type="text"  v-model="domain" placeholder="请输入域名地址" placeholder-class="placeholder" />
            </view>
            
            <button class="btn" @click="confirm">上传</button>
        </view>
    </view>
</template>
 
<script>
    export default{
        data () {
            return {
                typeArrayTypeColor:"#808080",
                tenantNameColor:"#808080",
                id:"",
                tenantName:"",
                linkman:"",
                contactNumber:"",
                address:"",
                type:null,
                domain:"",
                display:'none',
                display1:'none',
                display2:'none',
                display3:'none',
                tenantArr:[],
                tenantNameArray:[],
                tenantNameArrayIndex:0,
                tenantNameArrayType:'请选择客户',
                typeArray:["学校","医院","小区"],
                typeArrayIndex:0,
                typeArrayType:'请选择客户类型',
                pathUrl:this.$store.state.piAPI + "",
                // pathUrl: "http://localhost:8106"
            }
        },
        onLoad() {
            
        },
        mounted(){
            this.getTenantList();
        },
        methods: {
            
            //获取客户信息
            getTenantList(){
                var that = this;
                uni.request({
                    url: this.pathUrl + '/blade-system/tenant/page',
                    method:'GET',
                    success: (res) => {
                        that.tenantArr = res.data.data.records;
                        if(that.tenantArr.length>0 ){
                            for (var i = 0; i < that.tenantArr.length; i++) {
                                if(that.tenantArr[i].tenantName!=""){
                                    that.tenantNameArray.push(that.tenantArr[i].tenantName);
                                }
                            }
                        }
                    }
                });
            },
            
            //客户名称下拉改变事件
            tenantNameSelect(e) {
                var that = this;
                this.tenantNameArrayIndex = e.target.value;
                this.tenantNameArrayType=this.tenantNameArray[this.tenantNameArrayIndex];
                //获取id
                for (var i = 0; i < that.tenantArr.length; i++) {
                    if(that.tenantArr[i].tenantName==that.tenantNameArrayType){
                        that.id = that.tenantArr[i].id;
                        that.tenantName = that.tenantArr[i].tenantName;
                        that.linkman = that.tenantArr[i].linkman;
                        that.contactNumber = that.tenantArr[i].contactNumber;
                        that.address = that.tenantArr[i].address;
                        that.type = that.tenantArr[i].type;
                        if(that.tenantArr[i].type=="1"){
                            that.typeArrayType = '学校';
                            this.typeArrayTypeColor = "#000000";
                        }
                        if(that.tenantArr[i].type=="2"){
                            that.typeArrayType = '医院';
                            this.typeArrayTypeColor = "#000000";
                        }
                        if(that.tenantArr[i].type=="3"){
                            that.typeArrayType = '小区';
                            this.typeArrayTypeColor = "#000000";
                        }
                        that.domain = that.tenantArr[i].domain;
                    }
                }
                
                //修改样式
                this.tenantNameColor = "#000000";
                
            },
            
            //客户类型下拉改变事件
            typeSelect(e){
                var that = this;
                this.typeArrayIndex = e.target.value;
                this.typeArrayType=this.typeArray[this.typeArrayIndex];
                if(that.typeArrayType == '学校'){
                    that.type = 1;
                }
                if(that.typeArrayType =='医院'){
                    that.type = 2;
                }
                if(that.typeArrayType =='小区'){
                    that.type = 3;
                }
                //修改样式
                this.typeArrayTypeColor = "#000000";
            },
            
            //提交修改
            confirm(){
                uni.request({
                    url: this.pathUrl +'/blade-system/tenant/submit',
                    method:'POST',
                    data:{
                            "id":this.id,
                            "tenantName":this.tenantName,
                            "linkman":this.linkman,
                            "contactNumber":this.contactNumber,
                            "address":this.address,
                            "type":this.type,
                            "domain":this.domain
                    },
                    success: (res) => {
                        if(res.data.code==200){
                            uni.showToast({
                                title: '提交成功!',
                                duration: 2000
                            });
                        }
                    }
                });
            }
                    
        }
    }
</script>
 
<style>
    .regis-info {
        width: 100%;
        height: 100rpx;
        position: relative;
        left: 20rpx;
        border-bottom: 1px solid rgba(128,128,128,0.1);
    }
    
    .regis-info-desc {
        width: 100%;
        height: 100rpx;
        position: relative;
        left: 20rpx;
    }
    
    .regis-info-desc input{
        position: relative;
        left: 40rpx;
        top: 27rpx;
        letter-spacing: 1rpx;
    }
    
    .regis-info-linkman{
        width: 100%;
        height: 100rpx;
        position: relative;
        left: 20rpx;
        border-bottom: 1px solid rgba(128,128,128,0.1);
    }
    
    .regis-info-linkman input{
        position: relative;
        left: 73rpx;
        top: 27rpx;
        letter-spacing: 1rpx;
    }
    
    .info-title{
        letter-spacing: 1rpx;
        float: left;
        line-height: 100rpx;
        font-weight: 530;
    }
    
    .regis-info input{
        position: relative;
        left: 40rpx;
        top: 27rpx;
        letter-spacing: 1rpx;
    }
    
    .btn{
        position: relative;
        top: 40rpx;
        background-color: #007AFF;
        width: 180rpx;
        height: 180rpx;
        border-radius: 100rpx;
        line-height:180rpx;
        color: #FFFFFF;
        letter-spacing: 2rpx;
    }
    
    .tenant-select{
        position: relative;
        left: 40rpx;
        top: 28rpx;
    }
    
    .type-select{
        position: relative;
        left: 40rpx;
        top: 28rpx;
    }
</style>