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.
 
 
 

588 lignes
15 KiB

  1. <template>
  2. <view class="cented-box">
  3. <view class="cented-boxs">
  4. <view class="Pinspeak">客户信息</view>
  5. <view class="chented">
  6. <view class="title">
  7. <view class="titletext">客户姓名</view>
  8. <view class="titletext2">
  9. <input class="titletext-input" style="color: #333333;" v-model="parames.name"
  10. placeholder-class="titletext-input" placeholder-style="color:#B2B2B2;" type="text"
  11. placeholder="请输入客户姓名(必填)" />
  12. </view>
  13. </view>
  14. <view class="title">
  15. <view class="titletext">客户性别</view>
  16. <view class="titletext2 displayclick"
  17. style="display: flex;align-items: center;padding-left: 10rpx;">
  18. <view class="sexRadio" @click="changeSex(1)" :class="{active:parames.sex == 1}">男士</view>
  19. <view class="sexRadio" @click="changeSex(2)" :class="{active:parames.sex == 2}">女士</view>
  20. </view>
  21. </view>
  22. <view class="title">
  23. <view class="titletext">联系电话</view>
  24. <view class="titletext2">
  25. <input class="titletext-input" style="color: #333333;" v-model="parames.phone"
  26. placeholder-class="titletext-input" placeholder-style="color:#B2B2B2;" type="number"
  27. placeholder="请输入联系电话" />
  28. </view>
  29. </view>
  30. <view class="title">
  31. <view class="titletext">接待人数</view>
  32. <view class="titletext2" style="display: flex;align-items: center;justify-content: space-around;">
  33. <view class="num" v-for="i in 6" :key="i" :class="{active:parames.howMany == i+1}"
  34. @click="changeHowMany(i+1)">
  35. {{i + 1}}
  36. </view>
  37. </view>
  38. </view>
  39. <view class="title" @click="Buildingselection()">
  40. <view class="titletext">客户来源</view>
  41. <view class="titletext2"
  42. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 90rpx;padding-left: 10rpx;">
  43. <text v-if="showSourceName" style="color: #333333;">{{showSourceName}}</text>
  44. <text v-else>请选择客户来源</text>
  45. </view>
  46. <view class="titleimg">
  47. <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image>
  48. </view>
  49. </view>
  50. <view class="title" style="border: none;" @click="showTemplateSelect()">
  51. <view class="titletext">销讲业务</view>
  52. <view class="titletext2"
  53. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 90rpx;padding-left: 10rpx;">
  54. <text v-if="templateName" style="color: #333333;">{{templateName}}</text>
  55. <text v-else>请选择销讲业务</text>
  56. </view>
  57. <view class="titleimg">
  58. <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="Pinspeak">顾问</view>
  63. <view class="chented" @click="clickShowhid()">
  64. <view class="title" style="border: none;">
  65. <view class="titletext">接待顾问</view>
  66. <view class="titletext2"
  67. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 90rpx;padding-left: 10rpx;">
  68. <text v-if="text" style="color: #333333;">{{text}}</text>
  69. <text v-else>请选择接待顾问</text>
  70. </view>
  71. <view class="titleimg">
  72. <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 提交按钮 -->
  78. <view class="clive" @click.stop="$noMultipleClicks(save)"
  79. :style="{background:(isBand==false?'#2671E2':'#949494')}">确定</view>
  80. <!-- 客户来源 -->
  81. <u-select :mask-close-able="false" label-name="sourceName" value-name="id" v-model="Showhiddenunits"
  82. mode="single-column" :list="list" @cancel="cancel" @confirm="confirm"></u-select>
  83. <!-- 销讲业务 -->
  84. <u-select :mask-close-able="false" label-name="templateName" value-name="id" v-model="showTemplate"
  85. mode="single-column" :list="templateList" @cancel="templateCancel" @confirm="templateConfirm"></u-select>
  86. <!-- 代接代提示窗 -->
  87. <u-modal v-model="show" :mask-close-able="true" :title="'代接待提醒'" :confirm-text="confirmtext"
  88. :cancel-text='canceltext' @cancel="confirmA" @confirm="confirmB" :show-cancel-button='true'
  89. :content="content"></u-modal>
  90. </view>
  91. </template>
  92. <script>
  93. var app = getApp();
  94. var config = require("../../../config");
  95. export default {
  96. data() {
  97. return {
  98. noClick: true,
  99. Showhiddenunits: false,
  100. list: [], // 客户来源
  101. parames: {
  102. name: '',
  103. // 性别1男 2女
  104. sex: 1,
  105. phone: '',
  106. source: null,
  107. sourceId: null,
  108. howMany: 1,
  109. agentId: null,
  110. projectId: '',
  111. replaceReception: 0,
  112. marketingBusiness: '', // 销讲业务默认为第一个
  113. },
  114. showSourceName: '', // 展示文字
  115. shifoinfo: 0, // 高级权限 项目是否能指派顾问
  116. freeList: [], // 顾问列表
  117. text: null,
  118. show: false,
  119. content: '',
  120. confirmtext: '', //确认文字
  121. canceltext: '', //取消文字
  122. daitiReceptionobj: {},
  123. saveisshow: true,
  124. isBand: false, // 阻止二次提交
  125. tap: true,
  126. fdFlag: null,
  127. isPass: false, // 当前顾问是否正在接待
  128. fromBack: false, // 从选择顾问页面跳回
  129. templateList: [], // 销讲业务
  130. showTemplate: false, // 展示选择销讲业务弹窗
  131. templateName: '', // 销讲业务类型文字
  132. };
  133. },
  134. computed: {
  135. // 用户详情
  136. userInfo() {
  137. return uni.getStorageSync("weapp_session_userInfo_data")
  138. },
  139. },
  140. onLoad() {
  141. uni.$on('addreception', customerId => {
  142. let obj = this.freeList.find(item => item.agentId == customerId)
  143. this.fromBack = true
  144. this.text = obj.name;
  145. this.parames.agentId = customerId;
  146. })
  147. },
  148. onUnload() {
  149. uni.$off('addreception')
  150. },
  151. onShow() {
  152. this.parames.projectId = uni.getStorageSync('buildingID').id;
  153. console.log(this.$u)
  154. this.init()
  155. this.getFreeList();
  156. this.getFromSource();
  157. this.getMarketingBusiness();
  158. },
  159. methods: {
  160. // 获取销讲业务
  161. getMarketingBusiness() {
  162. this.$u.get('/customer/marketingBusiness', {
  163. houseId: this.parames.projectId,
  164. }).then(res => {
  165. this.templateList = res
  166. if (res && res.length > 0) {
  167. this.parames.marketingBusiness = res[0].id
  168. this.templateName = res[0].templateName
  169. }
  170. })
  171. },
  172. // 获取客户来源
  173. getFromSource() {
  174. uni.request({
  175. url: config.service.sourceList + "?houseId=" + this.parames.projectId,
  176. method: "GET",
  177. header: {
  178. 'content-type': 'application/json',
  179. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  180. },
  181. success: (data) => {
  182. console.log(data)
  183. if (data.data.code == 10000) {
  184. this.list = data.data.data
  185. }
  186. }
  187. })
  188. },
  189. //取消
  190. confirmA() {
  191. if (this.daitiReceptionobj.assign != null) {
  192. this.parames.agentId = this.daitiReceptionobj.assign.accountId;
  193. this.baochunfun()
  194. } else {
  195. uni.showToast({
  196. icon: "none",
  197. title: "【" + this.daitiReceptionobj.owner.name + "】正在接待中"
  198. })
  199. return;
  200. }
  201. },
  202. // 确认
  203. confirmB() {
  204. this.parames.agentId = this.daitiReceptionobj.replacement.accountId;
  205. this.parames.replaceReception = 1;
  206. this.baochunfun()
  207. },
  208. btnSave() {
  209. if (this.isBand) return
  210. this.save()
  211. },
  212. save() {
  213. // 校验当前登录人是否是顾问
  214. let obj = this.freeList.find(item => {
  215. return item.agentId == this.userInfo.accountId
  216. }) || null
  217. if (!obj && this.userInfo.dataCode == 6) {
  218. this.isPass = true
  219. } else {
  220. this.isPass = false
  221. }
  222. if (this.parames.name.length == 0) {
  223. uni.showToast({
  224. icon: "none",
  225. title: "客户姓名不能为空"
  226. })
  227. return;
  228. }
  229. if (this.parames.phone && !this.$u.test.mobile(this.parames.phone)) {
  230. uni.showToast({
  231. icon: "none",
  232. title: "手机号码格式不正确"
  233. })
  234. return;
  235. }
  236. // 判断条件2是否选中顾问
  237. if (this.isPass && !this.parames.agentId) {
  238. uni.showToast({
  239. icon: "none",
  240. title: "请选择顾问~"
  241. })
  242. return;
  243. }
  244. const that = this;
  245. this.isBand = true
  246. this.$u.post("customer/daitiReception", {
  247. phone: that.parames.phone,
  248. projectId: that.parames.projectId,
  249. agentId: that.parames.agentId
  250. }).then(res => {
  251. if (res.unchecked == 0) {
  252. that.baochunfun()
  253. this.tap = false;
  254. } else {
  255. if (res.zs == 0) {
  256. that.parames.agentId = res.assign.accountId;
  257. that.baochunfun()
  258. this.tap = false;
  259. } else {
  260. console.log("zo")
  261. if (res.assign == null && res.replacement == null) {
  262. that.baochunfun()
  263. this.tap = false;
  264. } else {
  265. if (res.assign == null) {
  266. that.daitiReceptionobj = res;
  267. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  268. "】代接待吗?"
  269. that.confirmtext = res.replacement.name + "代接待", //确认文字
  270. that.canceltext = res.owner.name + '接待', //取消文字
  271. that.show = true;
  272. this.isBand = false
  273. } else {
  274. that.daitiReceptionobj = res;
  275. console.log(that.daitiReceptionobj)
  276. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  277. "】代接待吗?"
  278. that.confirmtext = res.replacement.name + "代接待", //确认文字
  279. that.canceltext = res.assign.name + '接待', //取消文字
  280. that.show = true;
  281. this.isBand = false
  282. }
  283. }
  284. }
  285. }
  286. }).catch(e => {
  287. that.show = true;
  288. this.isBand = false
  289. })
  290. },
  291. baochunfun() {
  292. const {
  293. dataCode
  294. } = uni.getStorageSync("weapp_session_userInfo_data");
  295. if (this.parames.phone.length == 0) {
  296. this.parames.phone = null
  297. }
  298. uni.showLoading({
  299. title: "保存中",
  300. mask: true
  301. })
  302. if (dataCode == 6) {
  303. this.$u.post("/customer/gwAdd", this.parames).then(res => {
  304. this.saveisshow = true;
  305. uni.hideLoading();
  306. uni.showToast({
  307. icon: "none",
  308. title: "保存成功"
  309. })
  310. uni.navigateBack()
  311. }).catch(e => {
  312. this.isBand = false
  313. })
  314. } else {
  315. this.$u.post("/customer/add", this.parames).then(res => {
  316. this.saveisshow = true;
  317. uni.hideLoading();
  318. uni.showToast({
  319. icon: "none",
  320. title: "保存成功"
  321. })
  322. uni.navigateBack()
  323. }).catch(e => {
  324. this.isBand = false
  325. })
  326. }
  327. },
  328. changeSex(sex) {
  329. this.parames.sex = sex;
  330. },
  331. changeHowMany(num) {
  332. this.parames.howMany = num;
  333. },
  334. clickShowhid() {
  335. if (this.shifoinfo != 0) {
  336. uni.showToast({
  337. icon: 'none',
  338. title: '您没有指派权限~',
  339. duration: 2000
  340. });
  341. return
  342. }
  343. if (this.userInfo.dataCode == 6 && !this.checkAuthority('顾问指派顾问')) {
  344. uni.showToast({
  345. icon: "none",
  346. title: "您没有指派权限~",
  347. duration: 2000
  348. })
  349. return
  350. }
  351. if (this.freeList.length == 0) {
  352. uni.showToast({
  353. icon: 'none',
  354. title: '当前无可用排班顾问',
  355. duration: 2000
  356. });
  357. } else {
  358. uni.navigateTo({
  359. url: `/pages/mine/reception/consultant?from=addreception&id=${this.parames.agentId}&chosedAgentId=${this.parames.agentId}`
  360. })
  361. }
  362. },
  363. Buildingselection() {
  364. this.Showhiddenunits = true;
  365. },
  366. showTemplateSelect() {
  367. this.showTemplate = true;
  368. },
  369. cancel() {
  370. this.Showhiddenunits = false;
  371. },
  372. confirm(e) {
  373. console.log(e)
  374. this.showSourceName = e[0].label;
  375. this.parames.sourceId = e[0].value;
  376. this.Showhiddenunits = false;
  377. },
  378. // 销讲业务方法
  379. templateCancel() {
  380. this.showTemplate = false;
  381. },
  382. templateConfirm(e) {
  383. this.showTemplate = false;
  384. this.templateName = e[0].label;
  385. this.parames.marketingBusiness = e[0].value;
  386. },
  387. init() {
  388. uni.request({
  389. url: config.service.getSelfAssignedByHouseId + "?houseId=" + this.parames.projectId,
  390. method: "GET",
  391. header: {
  392. 'content-type': 'application/json',
  393. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  394. },
  395. success: (data) => {
  396. if (data.data.code == 10000) {
  397. this.shifoinfo = data.data.data.selfAssigned
  398. }
  399. }
  400. })
  401. },
  402. //获取顾问列表
  403. getFreeList() {
  404. this.$u.get("/zkAgentPool/freeList?itemId=" + this.parames.projectId + "&deptId=" + '' + '&name=' + '')
  405. .then(res => {
  406. this.freeList = res;
  407. this.freeList.forEach(item => {
  408. if (item.onLine == 0) {
  409. item.label = item.name + "(离线)";
  410. } else if (item.onLine == 1) {
  411. item.label = item.name + "(在线)";
  412. } else {
  413. item.label = item.name + "(无设备)";
  414. }
  415. item.value = item.agentId
  416. // 从选择顾问页面跳回时需阻断用当前登录人的顾问id选中自身
  417. if (!this.fromBack) {
  418. if (this.userInfo.accountId == item.agentId) {
  419. this.text = item.label
  420. this.parames.agentId = item.agentId;
  421. }
  422. }
  423. })
  424. })
  425. },
  426. }
  427. };
  428. </script>
  429. <style lang="scss" scoped>
  430. .sexRadio {
  431. color: #BFBFBF;
  432. border: 1rpx solid #BFBFBF;
  433. font-size: 24upx;
  434. width: 100rpx;
  435. height: 43rpx;
  436. text-align: center;
  437. line-height: 40rpx;
  438. &:last-child {
  439. margin-left: 20rpx;
  440. }
  441. &.active {
  442. color: #2B6FFF;
  443. border-color: #2B6FFF;
  444. }
  445. }
  446. .num {
  447. width: 50rpx;
  448. height: 50rpx;
  449. background: rgba(43, 110, 253, 0.1);
  450. color: #2B6EFD;
  451. font-size: 30rpx;
  452. display: flex;
  453. align-items: center;
  454. justify-content: center;
  455. &.active {
  456. background: #2B6EFD;
  457. color: #FFFFFF;
  458. }
  459. }
  460. .cented-box {
  461. background: #F8F8F8;
  462. width: 100%;
  463. min-height: 100vh;
  464. display: flex;
  465. flex-direction: column;
  466. .cented-boxs {
  467. flex-grow: 1;
  468. }
  469. }
  470. .Pinspeak {
  471. width: 100%;
  472. height: 92rpx;
  473. border-bottom: 1rpx solid #E0E0E0;
  474. font-size: 32rpx;
  475. font-weight: bold;
  476. color: #333333;
  477. text-indent: 30rpx;
  478. line-height: 92rpx;
  479. background: #FFFFFF;
  480. margin-top: 20rpx;
  481. padding-left: 10rpx;
  482. }
  483. .chented {
  484. width: 100%;
  485. padding-left: 30rpx;
  486. padding-right: 30rpx;
  487. background-color: #FFFFFF;
  488. .title {
  489. width: 100%;
  490. height: 90rpx;
  491. border-bottom: 1rpx solid #E0E0E0;
  492. display: flex;
  493. align-items: center;
  494. .titletext {
  495. width: 21%;
  496. height: 90rpx;
  497. font-size: 30rpx;
  498. font-weight: 400;
  499. color: #333333;
  500. line-height: 90rpx;
  501. text-indent: 10rpx;
  502. }
  503. .titletext2 {
  504. width: 71%;
  505. height: 90rpx;
  506. }
  507. .titletext-input {
  508. width: 100%;
  509. height: 90rpx;
  510. font-size: 30rpx;
  511. font-weight: 400;
  512. color: #B2B2B2;
  513. line-height: 90rpx;
  514. padding-left: 10rpx;
  515. }
  516. .titleimg {
  517. width: 8%;
  518. text-align: right;
  519. .titleimg1 {
  520. width: 16rpx;
  521. height: 36rpx;
  522. }
  523. }
  524. }
  525. }
  526. .clive {
  527. flex-shrink: 0;
  528. position: sticky;
  529. bottom: 32rpx;
  530. width: 690rpx;
  531. height: 88rpx;
  532. background: #2671E2;
  533. text-align: center;
  534. line-height: 88rpx;
  535. color: #FFFFFF;
  536. border-radius: 8rpx;
  537. margin: 0 auto;
  538. font-size: 32rpx;
  539. }
  540. </style>