You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

497 lines
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;"
  18. v-model="form.name" />
  19. </view>
  20. </view>
  21. <view class="conmsg-msg-lab">
  22. <view class="conmsg-msg-lab-1">
  23. 客户性别
  24. </view>
  25. <view class="conmsg-msg-lab-inp" style="margin-top: 20rpx;">
  26. <view style="border: none; display: flex;">
  27. <view class="sexchose" @click="form.sex=1"
  28. :style="{border:form.sex==1?'1px solid #0A6EE9':'1px solid #E0E0E0'}">
  29. </view>
  30. <view class="sexchose" @click="form.sex=2"
  31. :style="{border:form.sex==2?'1px solid #0A6EE9':'1px solid #E0E0E0'}">
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="conmsg-msg-lab">
  37. <view class="conmsg-msg-lab-1">
  38. 联系电话
  39. </view>
  40. <view class="conmsg-msg-lab-inp">
  41. <input type="number" @focus="callPhoneFocus" @blur="callPhoneBlur" placeholder="请输入联系电话" placeholder-style="color:#B2B2B2;" maxlength="11"
  42. v-model="form.showPhone" />
  43. </view>
  44. </view>
  45. <view class="conmsg-msg-lab">
  46. <view class="conmsg-msg-lab-1">
  47. 微信账号
  48. </view>
  49. <view class="conmsg-msg-lab-inp">
  50. <input type="text" placeholder="请输入微信账号" placeholder-style="color:#B2B2B2;"
  51. v-model="form.chatNo" />
  52. </view>
  53. </view>
  54. <view class="conmsg-msg-lab" @click="levelshow = true">
  55. <view class="conmsg-msg-lab-1">
  56. 意向等级
  57. </view>
  58. <view class="conmsg-msg-lab-inp">
  59. <input type="text" placeholder="请选择客户等级" v-model="selectform.level" disabled />
  60. </view>
  61. <view class="conmsg-msg-lab-img">
  62. <image class="screen-sel-img" src="../../../static/images/right.png" mode=""></image>
  63. </view>
  64. </view>
  65. <view class="conmsg-msg-lab">
  66. <view class="conmsg-msg-lab-1">
  67. 客户来源
  68. </view>
  69. <view class="conmsg-msg-lab-inp">
  70. <input type="text" placeholder="请选择客户来源" @click="Buildingselection" v-model="form.sourceName"
  71. disabled />
  72. </view>
  73. <view class="conmsg-msg-lab-img">
  74. <image class="screen-sel-img" src="../../../static/images/right.png" mode=""></image>
  75. </view>
  76. </view>
  77. <view class="conmsg-msg-lab" style="border: none;">
  78. <view class="conmsg-msg-lab-1">
  79. 备注内容
  80. </view>
  81. <view class="conmsg-msg-lab-inp">
  82. <input type="text" placeholder="请输入备注内容" placeholder-style="color:#B2B2B2;"
  83. v-model="form.remarks" />
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="conmsg" v-if="allList.length!=0">
  89. <view class="conmsg-title">
  90. 客户标签
  91. </view>
  92. <view class="conmsg-msg">
  93. <view v-for="(item,index) in allList" :key="index">
  94. <view class="">
  95. <view class="conmsg-msg-lab" style="border: none;">
  96. <view class="conmsg-msg-lab-1">
  97. {{item.name}}
  98. </view>
  99. </view>
  100. <view class="con-msg-con"
  101. :style="{borderBottom:index==allList.length-1?'none':'1px solid #E0E0E0'}">
  102. <view v-for="(item1,i) in item.children" :key="i" @click="Edittag(item,item1,index,i)"
  103. :style="{border:item1.selected==0?'1px solid #0A6EE9':'1px solid #E0E0E0'}"
  104. 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"
  123. mode="single-column" :list="list" @cancel="cancel" @confirm="confirm"></u-select>
  124. </view>
  125. </template>
  126. <script>
  127. const config = require("@/config");
  128. export default {
  129. data() {
  130. return {
  131. Showhiddenunits: false, // 控制客户来源弹窗
  132. form: {
  133. name: '',
  134. sex: '1',
  135. phone: '',
  136. chatNo: '',
  137. level: '1',
  138. remarks: '',
  139. sourceId: ''
  140. },
  141. selectform: {
  142. level: 'A',
  143. stage: '',
  144. demand: '',
  145. area: '',
  146. budget: '',
  147. fouce: '',
  148. soure: '',
  149. },
  150. list: [], // 客户来源数组
  151. levelshow: false,
  152. customerId: '',
  153. // 等级
  154. levellist: [{
  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?", {
  248. id: this.customerId
  249. })
  250. .then(res => {
  251. this.form = res
  252. if (!this.form.phone) {
  253. this.form.showPhone = '--'
  254. } else {
  255. if (this.form.isShow == 1 && this.form.phone.length == 11) {
  256. this.form.showPhone = this.form.phone.substr(0, 3) + '****' + this.form.phone.substr(7)
  257. } else {
  258. this.form.showPhone = this.form.phone
  259. }
  260. }
  261. this.form.showPhones = this.form.showPhone
  262. // 给客户等级赋值
  263. let idx = this.levellist.findIndex(item => item.value == res.level)
  264. if (idx != -1) {
  265. this.selectform.level = this.levellist[idx].label
  266. } else {
  267. this.selectform.level = 'A';
  268. this.form.level = 1;
  269. }
  270. this.showSourceName = res.sourceName;
  271. // 获取置业需求
  272. this.getListByType()
  273. })
  274. },
  275. // 字典表接口
  276. getListByType() {
  277. this.$u.get("/matchKeywords/findPersonalMatchData", {
  278. customerId: this.customerId
  279. })
  280. .then(res => {
  281. // console.log(res)
  282. res.forEach(item1 => {
  283. item1.children.map(item => {
  284. if (item.isInterval == 0) {
  285. item.label = item.name + item.unit + '-' + item.endName + item
  286. .unit;
  287. } else {
  288. item.label = item.name
  289. }
  290. item.value = item.id;
  291. })
  292. })
  293. // console.log(res)
  294. this.allList = res
  295. // return
  296. })
  297. },
  298. // 输入框获取焦点
  299. callPhoneFocus() {
  300. if (this.form.isShow == 1 && this.form.showPhone == this.form.showPhones) {
  301. this.form.showPhone = ''
  302. this.$forceUpdate()
  303. }
  304. },
  305. // 输入框失去焦点
  306. callPhoneBlur() {
  307. if (this.form.isShow == 1 && this.form.showPhone == '') {
  308. this.form.showPhone = this.form.showPhones
  309. this.$forceUpdate()
  310. }
  311. },
  312. // 提交
  313. submit() {
  314. let param = {}
  315. let str = []
  316. if (this.form.name == '') {
  317. uni.showToast({
  318. title: '请输入客户姓名',
  319. icon: 'none'
  320. })
  321. return
  322. }
  323. if (this.form.showPhones != this.form.showPhone) {
  324. this.form.phone = this.form.showPhone
  325. }
  326. this.allList.map(item => {
  327. item.children.map(item1 => {
  328. if (item1.selected == 0) {
  329. console.log(item, item1)
  330. str.push(item1.keywordsId)
  331. }
  332. })
  333. })
  334. str = str.join(',')
  335. param = this.form
  336. param.keywordIds = str
  337. console.log(param)
  338. // return
  339. this.$u.post("customer/update", param)
  340. .then(res => {
  341. // console.log(res)
  342. uni.showToast({
  343. title: '操作成功',
  344. icon: 'none',
  345. success: () => {
  346. uni.navigateBack()
  347. }
  348. })
  349. })
  350. },
  351. }
  352. }
  353. </script>
  354. <style lang="scss" scoped>
  355. .box {
  356. width: 100%;
  357. height: 100%;
  358. background: #F8F8F8;
  359. overflow: hidden;
  360. }
  361. .conmsg {
  362. background: #FFFFFF;
  363. margin-top: 20rpx;
  364. .conmsg-title {
  365. height: 92rpx;
  366. line-height: 92rpx;
  367. font-weight: bold;
  368. padding: 0 30rpx;
  369. // font-weight: 500;
  370. color: #303030;
  371. font-size: 32rpx;
  372. border-bottom: 1px solid #E0E0E0;
  373. }
  374. .conmsg-msg {
  375. padding: 0 30rpx;
  376. .conmsg-msg-lab {
  377. height: 102rpx;
  378. display: flex;
  379. font-size: 30rpx;
  380. font-weight: 400;
  381. color: #333333;
  382. border-bottom: 1px solid #E0E0E0;
  383. line-height: 102rpx;
  384. .conmsg-msg-lab-1 {
  385. display: flex;
  386. min-width: 136rpx;
  387. .star {
  388. color: #E7483C;
  389. line-height: 108rpx;
  390. }
  391. }
  392. .conmsg-msg-lab-inp {
  393. margin-top: 30rpx;
  394. margin-left: 44rpx;
  395. }
  396. .conmsg-msg-lab-img {
  397. width: 14rpx;
  398. height: 30rpx;
  399. margin-top: 6rpx;
  400. margin-left: auto;
  401. image {
  402. width: 100%;
  403. height: 100%;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. .submit {
  410. position: fixed;
  411. bottom: 20rpx;
  412. left: 20rpx;
  413. height: 120rpx;
  414. background: #FFFFFF;
  415. .btn {
  416. // margin: 60rpx auto;
  417. text-align: center;
  418. width: 690rpx;
  419. height: 88rpx;
  420. background: #2671E2;
  421. border-radius: 8rpx;
  422. font-size: 32tpx;
  423. font-weight: 400;
  424. color: #FFFFFF;
  425. line-height: 88rpx;
  426. }
  427. }
  428. .con-msg-con {
  429. display: flex;
  430. flex-wrap: wrap;
  431. border-bottom: 1px solid #E0E0E0;
  432. padding-bottom: 16rpx;
  433. .chebox {
  434. height: 60rpx;
  435. line-height: 60rpx;
  436. margin-bottom: 25rpx;
  437. margin-right: 20rpx;
  438. border: 1px solid #E0E0E0;
  439. box-sizing: border-box;
  440. padding: 0 10rpx;
  441. border-radius: 12rpx;
  442. min-width: 150rpx;
  443. text-align: center
  444. }
  445. }
  446. .sexchose {
  447. width: 120rpx;
  448. height: 60rpx;
  449. background: #FFFFFF;
  450. border-radius: 12rpx;
  451. border: 1px solid #E0E0E0;
  452. text-align: center;
  453. line-height: 60rpx;
  454. margin-right: 20rpx;
  455. }
  456. </style>