25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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