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.
 
 
 

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