Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

476 righe
11 KiB

  1. <template>
  2. <view class="box">
  3. <!-- 编辑 -->
  4. <view class="conmsg">
  5. <view class="conmsg-title">
  6. 客户信息
  7. </view>
  8. <view class="conmsg-msg">
  9. <view class="conmsg-msg-lab">
  10. <view class="conmsg-msg-lab-1">
  11. 客户姓名
  12. <view class="star">
  13. *
  14. </view>
  15. </view>
  16. <view class="conmsg-msg-lab-inp">
  17. <input type="text" placeholder="请输入客户姓名" placeholder-style="color:#B2B2B2;" v-model="form.name"/>
  18. </view>
  19. </view>
  20. <view class="conmsg-msg-lab">
  21. <view class="conmsg-msg-lab-1">
  22. 客户性别
  23. </view>
  24. <view class="conmsg-msg-lab-inp" style="margin-top: 20rpx;">
  25. <view style="border: none; display: flex;">
  26. <view class="sexchose" @click="form.sex=1" :style="{border:form.sex==1?'1px solid #0A6EE9':'1px solid #E0E0E0'}">
  27. </view>
  28. <view class="sexchose" @click="form.sex=2" :style="{border:form.sex==2?'1px solid #0A6EE9':'1px solid #E0E0E0'}">
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="conmsg-msg-lab">
  34. <view class="conmsg-msg-lab-1">
  35. 联系电话
  36. <view class="star">
  37. *
  38. </view>
  39. </view>
  40. <template v-if="form.isShow == 1">
  41. <view class="conmsg-msg-lab-inp">
  42. <input disabled type="number" placeholder="请输入联系电话" placeholder-style="color:#B2B2B2;" maxlength="11" v-model="form.showPhone"/>
  43. </view>
  44. </template>
  45. <template v-else>
  46. <view class="conmsg-msg-lab-inp">
  47. <input :disabled="dataCode!=6" type="number" placeholder="请输入联系电话" placeholder-style="color:#B2B2B2;" maxlength="11" v-model="form.phone"/>
  48. </view>
  49. </template>
  50. </view>
  51. <view class="conmsg-msg-lab">
  52. <view class="conmsg-msg-lab-1">
  53. 微信账号
  54. </view>
  55. <view class="conmsg-msg-lab-inp">
  56. <input type="text" placeholder="请输入微信账号" placeholder-style="color:#B2B2B2;" v-model="form.chatNo"/>
  57. </view>
  58. </view>
  59. <view class="conmsg-msg-lab" @click="levelshow = true">
  60. <view class="conmsg-msg-lab-1">
  61. 客户等级
  62. </view>
  63. <view class="conmsg-msg-lab-inp">
  64. <input type="text" placeholder="请选择客户等级" v-model="selectform.level" disabled/>
  65. </view>
  66. <view class="conmsg-msg-lab-img">
  67. <image class="screen-sel-img" src="../../../static/images/right.png" mode=""></image>
  68. </view>
  69. </view>
  70. <view class="conmsg-msg-lab">
  71. <view class="conmsg-msg-lab-1">
  72. 客户来源
  73. </view>
  74. <view class="conmsg-msg-lab-inp">
  75. <input type="text" placeholder="请选择客户来源" @click="Buildingselection" v-model="form.sourceName" disabled/>
  76. </view>
  77. <view class="conmsg-msg-lab-img">
  78. <image class="screen-sel-img" src="../../../static/images/right.png" mode=""></image>
  79. </view>
  80. </view>
  81. <view class="conmsg-msg-lab" style="border: none;">
  82. <view class="conmsg-msg-lab-1">
  83. 备注内容
  84. </view>
  85. <view class="conmsg-msg-lab-inp">
  86. <input type="text" placeholder="请输入备注内容" placeholder-style="color:#B2B2B2;" v-model="form.remarks"/>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="conmsg" v-if="allList.length!=0">
  92. <view class="conmsg-title">
  93. 客户标签
  94. </view>
  95. <view class="conmsg-msg">
  96. <view v-for="(item,index) in allList" :key="index">
  97. <view class="">
  98. <view class="conmsg-msg-lab" style="border: none;">
  99. <view class="conmsg-msg-lab-1">
  100. {{item.name}}
  101. </view>
  102. </view>
  103. <view class="con-msg-con" :style="{borderBottom:index==allList.length-1?'none':'1px solid #E0E0E0'}">
  104. <view v-for="(item1,i) in item.children" :key="i" @click="Edittag(item,item1,index,i)" :style="{border:item1.selected==0?'1px solid #0A6EE9':'1px solid #E0E0E0'}" class="chebox" >
  105. {{item1.label}}
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="submit">
  113. <view class="btn" @click="submit">
  114. 确定
  115. </view>
  116. </view>
  117. <view class="" style="height: 220rpx;" >
  118. <!-- :style="{marginTop:allList.length!=0?'0':'500rpx'}" -->
  119. </view>
  120. <!-- 客户等级 -->
  121. <u-select v-model="levelshow" :list="levellist" @confirm="levelshowCallback"></u-select>
  122. <u-select :mask-close-able="false" label-name="sourceName" value-name="id" v-model="Showhiddenunits" mode="single-column" :list="list" @cancel="cancel" @confirm="confirm"></u-select>
  123. </view>
  124. </template>
  125. <script>
  126. const config = require("@/config");
  127. export default{
  128. data(){
  129. return{
  130. Showhiddenunits: false, // 控制客户来源弹窗
  131. form:{
  132. name:'',
  133. sex:'1',
  134. phone:'',
  135. chatNo:'',
  136. level:'1',
  137. remarks:'',
  138. sourceId: ''
  139. },
  140. selectform:{
  141. level:'A',
  142. stage:'',
  143. demand:'',
  144. area:'',
  145. budget:'',
  146. fouce:'',
  147. soure:'',
  148. },
  149. list: [], // 客户来源数组
  150. levelshow:false,
  151. customerId:'',
  152. // 等级
  153. levellist:[
  154. {
  155. value:1,
  156. label:'A'
  157. },
  158. {
  159. value:2,
  160. label:'B'
  161. },
  162. {
  163. value:3,
  164. label:'C'
  165. },
  166. {
  167. value:4,
  168. label:'D'
  169. },
  170. ],
  171. allList:[],
  172. dataCode:'',
  173. projectId: '', // 项目ID
  174. userInfo: {}, // 当前用户信息
  175. }
  176. },
  177. onLoad(e) {
  178. this.userInfo = uni.getStorageSync("weapp_session_userInfo_data");
  179. console.log()
  180. this.dataCode=this.userInfo.dataCode
  181. console.log(e)
  182. // 先调用借口查询数据
  183. this.customerId=e.id
  184. if (e.projectId) this.projectId = e.projectId
  185. this.getdetail()
  186. this.getFromSource()
  187. },
  188. methods:{
  189. // 获取客户来源
  190. getFromSource() {
  191. uni.request({
  192. url: config.service.sourceList+"?houseId="+this.projectId,
  193. method: "GET",
  194. header: {
  195. 'content-type': 'application/json',
  196. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  197. },
  198. success: (data) => {
  199. console.log(data)
  200. if(data.data.code==10000){
  201. this.list = data.data.data
  202. }
  203. },
  204. fail: (res) => {
  205. console.log(res)
  206. }
  207. })
  208. },
  209. // 选择客户来源
  210. Buildingselection(){
  211. this.Showhiddenunits=true;
  212. },
  213. cancel(){
  214. this.Showhiddenunits=false;
  215. },
  216. confirm(e) {
  217. this.form.sourceName = e[0].label;
  218. this.form.sourceId = e[0].value;
  219. this.Showhiddenunits=false;
  220. },
  221. Edittag(item,item1,index,i){
  222. if(this.allList[index].children[i].selected==0){
  223. this.allList[index].children[i].selected=1;
  224. }else{
  225. this.allList[index].children[i].selected=0;
  226. }
  227. this.$forceUpdate()
  228. },
  229. sourecheck(index){
  230. this.sourelist[index].checked=!this.sourelist[index].checked
  231. this.$forceUpdate()
  232. },
  233. demandcheck(index){
  234. this.demandlist[index].checked=!this.demandlist[index].checked
  235. this.$forceUpdate()
  236. },
  237. areacheck(index){
  238. this.arealist[index].checked=!this.arealist[index].checked
  239. this.$forceUpdate()
  240. },
  241. levelshowCallback(e){
  242. this.selectform.level=e[0].label
  243. this.form.level=e[0].value
  244. },
  245. // 获取用户数据
  246. getdetail(){
  247. this.$u.get("customer/findById?",{id:this.customerId})
  248. .then(res=>{
  249. this.form=res
  250. this.form.showPhone = this.form.phone&&this.form.isShow==1?this.form.phone.length==11?this.form.phone.substr(0, 3) + '****' + this.form.phone.substr(7):this.form.phone:this.form.phone&&this.form.isShow!=1?this.form.phone: '--'
  251. // 给客户等级赋值
  252. let idx= this.levellist.findIndex(item=>item.value==res.level)
  253. if(idx!=-1){
  254. this.selectform.level=this.levellist[idx].label
  255. }else{
  256. this.selectform.level='A';
  257. this.form.level=1;
  258. }
  259. this.showSourceName = res.sourceName;
  260. // 获取置业需求
  261. this.getListByType()
  262. })
  263. },
  264. // 字典表接口
  265. getListByType(){
  266. this.$u.get("/matchKeywords/findPersonalMatchData",{customerId:this.customerId})
  267. .then(res=>{
  268. // console.log(res)
  269. res.forEach(item1=>{
  270. item1.children.map(item=>{
  271. if(item.isInterval==0){
  272. item.label=item.name+item.unit+'-'+item.endName+item.unit;
  273. }else{
  274. item.label=item.name
  275. }
  276. item.value=item.id;
  277. })
  278. })
  279. // console.log(res)
  280. this.allList=res
  281. // return
  282. })
  283. },
  284. // 提交
  285. submit(){
  286. let param={}
  287. let str=[]
  288. if(this.form.name==''){
  289. uni.showToast({
  290. title:'请输入客户姓名',
  291. icon:'none'
  292. })
  293. return
  294. }
  295. if(this.form.phone==''){
  296. uni.showToast({
  297. title:'请输入手机号',
  298. icon:'none'
  299. })
  300. return
  301. }
  302. // if(!(/^1[3456789]\d{9}$/.test(this.form.phone))){
  303. // uni.showToast({
  304. // title: "请检查手机号码格式",
  305. // icon:'none'
  306. // });
  307. // // this.form.phone=''
  308. // return false;
  309. // }
  310. if (this.form.phone.length<5) {
  311. uni.showToast({
  312. icon: "none",
  313. title: "手机号码不能小于5位"
  314. })
  315. return;
  316. }
  317. if (this.form.phone.length>11) {
  318. uni.showToast({
  319. icon: "none",
  320. title: "手机号码不能大于11位"
  321. })
  322. return;
  323. }
  324. this.allList.map(item=>{
  325. item.children.map(item1=>{
  326. if(item1.selected==0){
  327. str.push(item1.keywordsId)
  328. }
  329. })
  330. })
  331. str=str.join(',')
  332. param=this.form
  333. param.keywordIds=str
  334. console.log(param)
  335. // return
  336. this.$u.post("customer/update",param)
  337. .then(res=>{
  338. // console.log(res)
  339. uni.showToast({
  340. title:'操作成功',
  341. icon:'none',
  342. success: () => {
  343. uni.navigateBack()
  344. }
  345. })
  346. })
  347. },
  348. }
  349. }
  350. </script>
  351. <style lang="scss" scoped>
  352. .box {
  353. width: 100%;
  354. height: 100%;
  355. background: #F8F8F8;
  356. overflow: hidden;
  357. }
  358. .conmsg{
  359. background: #FFFFFF;
  360. margin-top: 20rpx;
  361. .conmsg-title{
  362. height: 92rpx;
  363. line-height: 92rpx;
  364. font-weight: bold;
  365. padding: 0 30rpx;
  366. // font-weight: 500;
  367. color: #303030;
  368. font-size: 32rpx;
  369. border-bottom: 1px solid #E0E0E0;
  370. }
  371. .conmsg-msg{
  372. padding: 0 30rpx;
  373. .conmsg-msg-lab{
  374. height: 102rpx;
  375. display: flex;
  376. font-size: 30rpx;
  377. font-weight: 400;
  378. color: #333333;
  379. border-bottom: 1px solid #E0E0E0;
  380. line-height: 102rpx;
  381. .conmsg-msg-lab-1{
  382. display: flex;
  383. min-width: 136rpx;
  384. .star{
  385. color: #E7483C;
  386. line-height: 108rpx;
  387. }
  388. }
  389. .conmsg-msg-lab-inp{
  390. margin-top: 30rpx;
  391. margin-left: 44rpx;
  392. }
  393. .conmsg-msg-lab-img{
  394. width: 14rpx;
  395. height: 30rpx;
  396. margin-top: 6rpx;
  397. margin-left: auto;
  398. image{
  399. width: 100%;
  400. height: 100%;
  401. }
  402. }
  403. }
  404. }
  405. }
  406. .submit{
  407. position: fixed;
  408. bottom: 20rpx;
  409. left: 20rpx;
  410. height: 120rpx;
  411. background: #FFFFFF;
  412. .btn{
  413. // margin: 60rpx auto;
  414. text-align: center;
  415. width: 690rpx;
  416. height: 88rpx;
  417. background: #2671E2;
  418. border-radius: 8rpx;
  419. font-size: 32tpx;
  420. font-weight: 400;
  421. color: #FFFFFF;
  422. line-height: 88rpx;
  423. }
  424. }
  425. .con-msg-con{
  426. display: flex;
  427. flex-wrap: wrap;
  428. // justify-content: space-around;
  429. border-bottom: 1px solid #E0E0E0;
  430. padding-bottom: 16rpx;
  431. .chebox{
  432. // width: 20%;
  433. height: 60rpx;
  434. line-height: 60rpx;
  435. // margin: 10rpx 0;
  436. margin-bottom: 25rpx;
  437. margin-right: 20rpx;
  438. border: 1px solid #E0E0E0;
  439. box-sizing: border-box;
  440. padding: 0 10rpx;
  441. }
  442. }
  443. .sexchose{
  444. width: 120rpx;
  445. height: 60rpx;
  446. background: #FFFFFF;
  447. border-radius: 4rpx;
  448. border: 1px solid #E0E0E0;
  449. text-align: center;
  450. line-height: 60rpx;
  451. margin-right: 20rpx;
  452. }
  453. </style>