Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

addreception.vue 16 KiB

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