Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

addreception.vue 15 KiB

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