選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

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