AI营销辅助 普强使用
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

edit.vue 11 KiB

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