AI销管
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

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