AI销管
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

544 Zeilen
14 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. var app = getApp();
  92. var config = require("../../../config");
  93. export default {
  94. data() {
  95. return {
  96. noClick: true,
  97. Showhiddenunits: false,
  98. list: [{
  99. label: '自然到访',
  100. value: '自然到访'
  101. },
  102. {
  103. label: '渠道推荐',
  104. value: '渠道推荐'
  105. },
  106. ],
  107. parames: {
  108. name: '',
  109. // 性别1男 2女
  110. sex: 1,
  111. phone: '',
  112. source: null,
  113. sourceName: null,
  114. howMany: 1,
  115. agentId: null,
  116. projectId: '',
  117. replaceReception: 0
  118. },
  119. freeList: [],
  120. Showhid: false,
  121. text: null,
  122. show: false,
  123. content: '东临碣石,以观沧海',
  124. confirmtext: '1', //确认文字
  125. canceltext: '2', //取消文字
  126. daitiReceptionobj: {},
  127. isShow: false, // 默认隐藏该权限
  128. isPass: false, // 当前顾问是否正在接待
  129. fromBack: false, // 从选择顾问页面跳回
  130. templateList: [], // 销讲业务
  131. showTemplate: false, // 展示选择销讲业务弹窗
  132. templateName: '', // 销讲业务类型文字
  133. };
  134. },
  135. computed: {
  136. // 用户详情
  137. userInfo() {
  138. return uni.getStorageSync("weapp_session_userInfo_data")
  139. },
  140. },
  141. onLoad() {
  142. uni.$on('addreception', customerId => {
  143. let obj = this.freeList.find(item => item.agentId == customerId)
  144. this.fromBack = true
  145. this.text = obj.name;
  146. this.parames.agentId = customerId;
  147. })
  148. this.getMarketingBusiness();
  149. },
  150. onUnload() {
  151. uni.$off('addreception')
  152. },
  153. onShow() {
  154. let newmenulist = uni.getStorageSync('weapp_session_Menu_data');
  155. this.isShow = newmenulist.jd_zp
  156. this.parames.projectId = uni.getStorageSync('buildingID').id;
  157. this.getFreeList();
  158. this.zkAgentPoolSourceList();
  159. },
  160. methods: {
  161. // 销讲业务方法
  162. templateCancel() {
  163. this.showTemplate = false;
  164. },
  165. templateConfirm(e) {
  166. this.showTemplate = false;
  167. this.templateName = e[0].label;
  168. this.parames.marketingBusiness = e[0].value;
  169. },
  170. // 获取销讲业务
  171. getMarketingBusiness() {
  172. this.$u.get('/customer/marketingBusiness', {
  173. houseId: uni.getStorageSync('buildingID').id,
  174. status: 0,
  175. }).then(res => {
  176. this.templateList = res
  177. if (res && res.length > 0) {
  178. this.parames.marketingBusiness = res[0].id
  179. this.templateName = res[0].templateName
  180. }
  181. })
  182. },
  183. // 获取客户来源
  184. zkAgentPoolSourceList() {
  185. this.$u.get('/zkAgentPool/source/list', {
  186. houseId: this.parames.projectId
  187. }).then(res => {
  188. console.log(res)
  189. if (res) {
  190. this.list = res
  191. }
  192. })
  193. },
  194. //取消
  195. confirmA() {
  196. if (this.daitiReceptionobj.assign != null) {
  197. this.parames.agentId = this.daitiReceptionobj.assign.accountId;
  198. this.baochunfun()
  199. } else {
  200. uni.showToast({
  201. icon: "none",
  202. title: "【" + this.daitiReceptionobj.owner.name + "】正在接待中"
  203. })
  204. return;
  205. }
  206. },
  207. // 确认
  208. confirmB() {
  209. console.log(this.daitiReceptionobj.replacement.accountId)
  210. this.parames.agentId = this.daitiReceptionobj.replacement.accountId;
  211. this.parames.replaceReception = 1;
  212. this.baochunfun()
  213. },
  214. save() {
  215. // 校验当前登录人是否是顾问
  216. let obj = this.freeList.find(item => {
  217. return item.agentId == this.userInfo.accountId
  218. }) || null
  219. if (!obj && this.userInfo.userRoleType == 6) {
  220. this.isPass = true
  221. } else {
  222. this.isPass = false
  223. }
  224. if (this.parames.name.length == 0) {
  225. uni.showToast({
  226. icon: "none",
  227. title: "客户姓名不能为空"
  228. })
  229. return;
  230. }
  231. if (this.parames.phone && this.parames.phone.length < 11) {
  232. uni.showToast({
  233. icon: "none",
  234. title: "手机号码不能小于11位"
  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. // 判断条件2是否选中顾问
  246. if (this.isPass && !this.parames.agentId) {
  247. uni.showToast({
  248. icon: "none",
  249. title: "请选择顾问~"
  250. })
  251. return;
  252. }
  253. const that = this;
  254. this.$u.post("customer/daitiReception", {
  255. phone: that.parames.phone,
  256. projectId: that.parames.projectId,
  257. agentId: that.parames.agentId
  258. }).then(res => {
  259. if (res.unchecked == 0) {
  260. that.baochunfun()
  261. } else {
  262. if (res.zs == 0) {
  263. that.parames.agentId = res.assign.accountId;
  264. that.baochunfun()
  265. } else {
  266. if (res.assign == null && res.replacement == null) {
  267. that.baochunfun()
  268. } else {
  269. if (res.assign == null) {
  270. that.daitiReceptionobj = res;
  271. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  272. "】代接待吗?"
  273. that.confirmtext = res.replacement.name + "代接待", //确认文字
  274. that.canceltext = res.owner.name + '接待', //取消文字
  275. that.show = true;
  276. } else {
  277. that.daitiReceptionobj = res;
  278. console.log(that.daitiReceptionobj)
  279. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  280. "】代接待吗?"
  281. that.confirmtext = res.replacement.name + "代接待", //确认文字
  282. that.canceltext = res.assign.name + '接待', //取消文字
  283. that.show = true;
  284. }
  285. }
  286. }
  287. }
  288. })
  289. },
  290. baochunfun() {
  291. const {
  292. dataCode
  293. } = uni.getStorageSync("weapp_session_userInfo_data");
  294. if (this.parames.phone.length == 0) {
  295. this.parames.phone = null
  296. }
  297. uni.showLoading({
  298. title: "保存中",
  299. mask: true
  300. })
  301. if (dataCode == 6) {
  302. this.$u.post("/customer/gwAdd", this.parames).then(res => {
  303. uni.hideLoading();
  304. uni.showToast({
  305. icon: "none",
  306. title: "保存成功"
  307. })
  308. uni.navigateBack()
  309. })
  310. } else {
  311. this.$u.post("/customer/add", this.parames).then(res => {
  312. uni.hideLoading();
  313. uni.showToast({
  314. icon: "none",
  315. title: "保存成功"
  316. })
  317. uni.navigateBack()
  318. })
  319. }
  320. },
  321. changeSex(sex) {
  322. this.parames.sex = sex;
  323. },
  324. changeHowMany(num) {
  325. this.parames.howMany = num;
  326. },
  327. clickShowhid() {
  328. if (!this.isShow) {
  329. uni.showToast({
  330. icon: "none",
  331. title: '您没有指派权限~'
  332. })
  333. return
  334. }
  335. if (this.freeList.length == 0) {
  336. uni.showToast({
  337. icon: 'none',
  338. title: '当前无可用排班顾问',
  339. duration: 2000
  340. });
  341. } else {
  342. // this.Showhid = true;
  343. uni.navigateTo({
  344. url: `/pages/mine/reception/consultant?from=addreception&id=${this.parames.agentId}&chosedAgentId=${this.parames.agentId}`
  345. })
  346. }
  347. },
  348. cancel1() {
  349. this.Showhid = false;
  350. },
  351. confirm1(e) {
  352. this.text = e[0].label;
  353. this.parames.agentId = e[0].value;
  354. this.Showhid = false;
  355. },
  356. Buildingselection() {
  357. this.Showhiddenunits = true;
  358. },
  359. showTemplateSelect() {
  360. this.showTemplate = true;
  361. },
  362. cancel() {
  363. this.Showhiddenunits = false;
  364. },
  365. confirm(e) {
  366. console.log(e)
  367. this.parames.sourceName = e[0].label;
  368. this.parames.source = e[0].value;
  369. this.Showhiddenunits = false;
  370. },
  371. //获取顾问列表
  372. getFreeList() {
  373. this.$u.get("/zkAgentPool/freeList?itemId=" + this.parames.projectId).then(res => {
  374. this.freeList = res;
  375. this.freeList.forEach(item => {
  376. // console.log(item, '顾问')
  377. if (item.onLine == 0) {
  378. item.label = item.name + "(离线)";
  379. } else if (item.onLine == 1) {
  380. item.label = item.name + "(在线)";
  381. } else {
  382. item.label = item.name + "(无设备)";
  383. }
  384. item.value = item.agentId
  385. // 从选择顾问页面跳回时需阻断用当前登录人的顾问id选中自身
  386. if (!this.fromBack) {
  387. if (this.userInfo.accountId == item.agentId) {
  388. this.text = item.label
  389. this.parames.agentId = item.agentId;
  390. }
  391. }
  392. })
  393. })
  394. },
  395. }
  396. };
  397. </script>
  398. <style lang="scss" scoped>
  399. .sexRadio {
  400. color: #BFBFBF;
  401. border: 1rpx solid #BFBFBF;
  402. font-size: 24rpx;
  403. width: 120rpx;
  404. height: 60rpx;
  405. text-align: center;
  406. display: flex;
  407. align-items: center;
  408. justify-content: center;
  409. &:last-child {
  410. margin-left: 20rpx;
  411. }
  412. &.active {
  413. background: #2B6FFF;
  414. color: #fff;
  415. border-color: #2B6FFF;
  416. }
  417. }
  418. .num {
  419. width: 50rpx;
  420. height: 50rpx;
  421. background: rgba(43, 110, 253, 0.1);
  422. color: #2B6EFD;
  423. font-size: 30rpx;
  424. display: flex;
  425. align-items: center;
  426. justify-content: center;
  427. &.active {
  428. background: #2B6EFD;
  429. color: #FFFFFF;
  430. }
  431. }
  432. .cented-box {
  433. background: #F8F8F8;
  434. width: 100%;
  435. min-height: 100vh;
  436. }
  437. .Pinspeak {
  438. width: 100%;
  439. height: 92rpx;
  440. border-bottom: 1rpx solid #E0E0E0;
  441. font-size: 32rpx;
  442. font-weight: bold;
  443. color: #333333;
  444. text-indent: 30rpx;
  445. line-height: 92rpx;
  446. background: #FFFFFF;
  447. margin-top: 20rpx;
  448. padding-left: 10rpx;
  449. }
  450. .chented {
  451. width: 100%;
  452. padding-left: 30rpx;
  453. padding-right: 30rpx;
  454. background-color: #FFFFFF;
  455. .title {
  456. width: 100%;
  457. height: 110rpx;
  458. border-bottom: 1rpx solid #E0E0E0;
  459. display: flex;
  460. align-items: center;
  461. .titletext {
  462. width: 21%;
  463. height: 110rpx;
  464. font-size: 30rpx;
  465. font-weight: 400;
  466. color: #333333;
  467. line-height: 110rpx;
  468. text-indent: 10rpx;
  469. }
  470. .titletext2 {
  471. width: 71%;
  472. height: 110rpx;
  473. }
  474. .titletext-input {
  475. width: 100%;
  476. height: 110rpx;
  477. font-size: 30rpx;
  478. font-weight: 400;
  479. color: #B2B2B2;
  480. line-height: 110rpx;
  481. padding-left: 10rpx;
  482. }
  483. .titleimg {
  484. width: 8%;
  485. text-align: right;
  486. .titleimg1 {
  487. width: 16rpx;
  488. height: 36rpx;
  489. }
  490. }
  491. }
  492. }
  493. .clive {
  494. position: sticky;
  495. bottom: 32rpx;
  496. margin: 32rpx auto 0;
  497. width: 690rpx;
  498. height: 88rpx;
  499. background: #2671E2;
  500. text-align: center;
  501. line-height: 88rpx;
  502. color: #FFFFFF;
  503. border-radius: 8rpx;
  504. font-size: 32rpx;
  505. }
  506. </style>