AI销管
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.
 
 
 
 

597 lines
15 KiB

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