join.vue
5.6 KB
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
<template>
<view style="height: 100vh;">
<image src="http://equiphappy.shs.broing.cn/assets/miniprogram/bg0.png" style="width: 100%; height:100vh;"
mode=""></image>
<view class="box" style="position: absolute;top:740rpx; padding: 32rpx;">
<u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
<u-form-item label="公司名称" labelWidth="200rpx" prop="userInfo.name" borderBottom ref="item1">
<view>
<u--input v-model="model1.userInfo.name1" @input="inputCorpName" placeholder="请输入公司名称"
border="none"></u--input>
</view>
<!-- -->
<view class="select_box" v-if="select">
<view v-for="item in filterArr" >
<view class="select_one" @click="mySelect">
<rich-text ></rich-text>
</view>
</view>
</view>
</u-form-item>
<u-form-item label="主营产品" labelWidth="200rpx" prop="userInfo.product_ids" borderBottom @click="goChoose"
ref="item1">
<u--input v-model="model1.userInfo.name" disabled placeholder="请选择主营产品" disabledColor="#ffffffeb"
border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="联系人" labelWidth="200rpx" prop="userInfo.contract_name" borderBottom ref="item1">
<u--input v-model="model1.userInfo.contract_name" placeholder="请输入联系人姓名" border="none"></u--input>
</u-form-item>
<u-form-item label="联系电话" labelWidth="200rpx" prop="userInfo.contract_mobile" borderBottom ref="item1">
<u--input v-model="model1.userInfo.contract_mobile" placeholder="请输入联系人电话" border="none"></u--input>
</u-form-item>
</u--form>
<view style="margin-top: 40rpx;">
<u-button text="提交" type="primary" @click="submit"></u-button>
</view>
</view>
<view class="font">
合作加盟: {{kfPhone}}
</view>
</view>
</template>
<script>
export default {
data() {
return {
isSelect: '',
select: false,
kfPhone:'',
filterArr: [],
model1: {
userInfo: {
name: '',
contract_mobile: ''
}
}
}
},
onShow() {
let pagearr = getCurrentPages(); //获取应用页面栈
let currentPage = pagearr[pagearr.length - 1]; //获取当前页面信息
console.log('option:', currentPage) //获取页面传递的信息
this.model1.userInfo.product_ids = currentPage.$vm.category_id || ''
this.model1.userInfo.name = currentPage.$vm.name || ''
this.model1.userInfo.contract_mobile = uni.getStorageSync('phone')
this.kfPhone = uni.getStorageSync('kfphone')
},
methods: {
// 修改企业名称
inputCorpName(e) {
console.log(e);
this.isSelect= false
this.select= true
let value = e;
this.model1.userInfo.name1 = value
this.filterArr= []
if (value == '') {
this.filterArr = []
}
// 获取企业
this.getCom(value)
},
getCom(value) {
// 调取企业接口
wx.showLoading({
title: '加载中',
})
uni.$u.http.post('/manager/common/tianyanchaSearch', {
word: value
}).then(r => {
wx.hideLoading()
if (r.code == 1) {
r.data.forEach((item, index) => {
if (item.name.includes(value)) {
this.filterArr = [...this.data.filterArr, {
filter_text: this.join(item.name, value),
filter_name: item.name,
filter_id: item.id,
creditCode: item.creditCode
}]
}
});
}
})
},
mySelect(e) {
console.log(e);
// 当前选中的值值
console.log(e.currentTarget.dataset.name, "9999999999999");
this.select=false
this.isSelect= true //选择了公司
this.model1.userInfo.name1 = e.currentTarget.dataset.name
this.recordCom(e.currentTarget.dataset.name)
},
recordCom(value) {
uni.$u.http.post('/manager/common/tianyanchaBaseinfo', {
company_name: value
}).then(r => {
if (r.code == 1) {
console.log('记录成功', r)
}
})
},
goChoose() {
uni.navigateTo({
url: '/pages/subPages/more?val=2'
})
},
submit() {
delete this.model1.userInfo.name1
uni.$u.http.post('/api/user/company_join', this.model1.userInfo).then(res => {
uni.showToast({
title: res.msg,
icon: 'none'
})
if (res.code == 1) {
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
}
}
}
</script>
<style scoped lang="scss">
.select_box {
background-color: #fff;
padding: 0 20rpx;
width: 100%;
position: absolute;
right: 0;
top: 101%;
z-index: 1;
overflow: hidden;
text-align: left;
animation: myfirst 0.5s;
font-size: 30rpx;
}
.select_one {
padding-left: 20rpx;
text-align: right;
width: 100%;
height: 60rpx;
position: relative;
line-height: 60rpx;
border-bottom: 1px solid #efebeb;
}
.box {
width: 82vw;
border-radius: 16rpx;
background: #ffffffeb;
margin-left: 5%;
}
.font {
position: absolute;
bottom: 66rpx;
width: 100%;
text-align: center;
color: #ffffffff;
font-size: 40rpx;
font-weight: 700;
font-family: "Alibaba PuHuiTi";
text-align: center;
line-height: 44rpx;
letter-spacing: 0.6rpx;
}
/deep/ .u-input {
background: rgb(236, 238, 241) !important;
}
</style>