AI销管
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

490 líneas
12 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" style="border: none;" @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>
  52. <view class="Pinspeak">顾问</view>
  53. <view class="chented" @click="clickShowhid()">
  54. <view class="title" style="border: none;">
  55. <view class="titletext">接待顾问</view>
  56. <view class="titletext2"
  57. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 110rpx;padding-left: 10rpx;">
  58. <text v-if="text" style="color: #333333;">{{text}}</text>
  59. <text v-else>请选择接待顾问</text>
  60. </view>
  61. <view class="titleimg">
  62. <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="clive" @click="$noMultipleClicks(save)">确定</view>
  67. <u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" value-name="id" label-name="sourceName" :list="list" @cancel="cancel"
  68. @confirm="confirm"></u-select>
  69. <u-select :mask-close-able="false" v-model="Showhid" mode="single-column" :list="freeList" @cancel="cancel1"
  70. @confirm="confirm1"></u-select>
  71. <u-modal v-model="show" :mask-close-able="true" :title="'代接待提醒'" :confirm-text="confirmtext"
  72. :cancel-text='canceltext' @cancel="confirmA" @confirm="confirmB" :show-cancel-button='true'
  73. :content="content"></u-modal>
  74. </view>
  75. </template>
  76. <script>
  77. var app = getApp();
  78. var config = require("../../../config");
  79. export default {
  80. data() {
  81. return {
  82. noClick: true,
  83. Showhiddenunits: false,
  84. list: [{
  85. label: '自然到访',
  86. value: '自然到访'
  87. },
  88. {
  89. label: '渠道推荐',
  90. value: '渠道推荐'
  91. },
  92. ],
  93. parames: {
  94. name: '',
  95. // 性别1男 2女
  96. sex: 1,
  97. phone: '',
  98. source: null,
  99. sourceName: null,
  100. howMany: 1,
  101. agentId: null,
  102. projectId: '',
  103. replaceReception: 0
  104. },
  105. freeList: [],
  106. Showhid: false,
  107. text: null,
  108. show: false,
  109. content: '东临碣石,以观沧海',
  110. confirmtext: '1', //确认文字
  111. canceltext: '2', //取消文字
  112. daitiReceptionobj: {},
  113. isShow: false, // 默认隐藏该权限
  114. isPass: false, // 当前顾问是否正在接待
  115. fromBack: false, // 从选择顾问页面跳回
  116. };
  117. },
  118. computed: {
  119. // 用户详情
  120. userInfo() {
  121. return uni.getStorageSync("weapp_session_userInfo_data")
  122. },
  123. },
  124. onLoad() {
  125. uni.$on('addreception', customerId => {
  126. let obj = this.freeList.find(item => item.agentId == customerId)
  127. this.fromBack = true
  128. this.text = obj.name;
  129. this.parames.agentId = customerId;
  130. })
  131. },
  132. onUnload() {
  133. uni.$off('addreception')
  134. },
  135. onShow() {
  136. let newmenulist = uni.getStorageSync('weapp_session_Menu_data');
  137. this.isShow = newmenulist.jd_zp
  138. this.parames.projectId = uni.getStorageSync('buildingID').id;
  139. this.getFreeList();
  140. this.zkAgentPoolSourceList();
  141. },
  142. methods: {
  143. // 获取客户来源
  144. zkAgentPoolSourceList() {
  145. this.$u.get('/zkAgentPool/source/list', { houseId: this.parames.projectId }).then(res => {
  146. console.log(res)
  147. if (res) {
  148. this.list = res
  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. console.log(this.daitiReceptionobj.replacement.accountId)
  168. this.parames.agentId = this.daitiReceptionobj.replacement.accountId;
  169. this.parames.replaceReception = 1;
  170. this.baochunfun()
  171. },
  172. save() {
  173. // 校验当前登录人是否是顾问
  174. let obj = this.freeList.find(item => {
  175. return item.agentId == this.userInfo.accountId
  176. }) || null
  177. if (!obj && this.userInfo.userRoleType == 6) {
  178. this.isPass = true
  179. } else {
  180. this.isPass = false
  181. }
  182. if (this.parames.name.length == 0) {
  183. uni.showToast({
  184. icon: "none",
  185. title: "客户姓名不能为空"
  186. })
  187. return;
  188. }
  189. if (this.parames.phone && this.parames.phone.length < 11) {
  190. uni.showToast({
  191. icon: "none",
  192. title: "手机号码不能小于11位"
  193. })
  194. return;
  195. }
  196. if (this.parames.phone && this.parames.phone.length > 11) {
  197. uni.showToast({
  198. icon: "none",
  199. title: "手机号码不能大于11位"
  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.$u.post("customer/daitiReception", {
  213. phone: that.parames.phone,
  214. projectId: that.parames.projectId,
  215. agentId: that.parames.agentId
  216. }).then(res => {
  217. if (res.unchecked == 0) {
  218. that.baochunfun()
  219. } else {
  220. if (res.zs == 0) {
  221. that.parames.agentId = res.assign.accountId;
  222. that.baochunfun()
  223. } else {
  224. if (res.assign == null && res.replacement == null) {
  225. that.baochunfun()
  226. } else {
  227. if (res.assign == null) {
  228. that.daitiReceptionobj = res;
  229. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  230. "】代接待吗?"
  231. that.confirmtext = res.replacement.name + "代接待", //确认文字
  232. that.canceltext = res.owner.name + '接待', //取消文字
  233. that.show = true;
  234. } else {
  235. that.daitiReceptionobj = res;
  236. console.log(that.daitiReceptionobj)
  237. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  238. "】代接待吗?"
  239. that.confirmtext = res.replacement.name + "代接待", //确认文字
  240. that.canceltext = res.assign.name + '接待', //取消文字
  241. that.show = true;
  242. }
  243. }
  244. }
  245. }
  246. })
  247. },
  248. baochunfun() {
  249. const {
  250. dataCode
  251. } = uni.getStorageSync("weapp_session_userInfo_data");
  252. if (this.parames.phone.length == 0) {
  253. this.parames.phone = null
  254. }
  255. uni.showLoading({
  256. title: "保存中",
  257. mask: true
  258. })
  259. if (dataCode == 6) {
  260. this.$u.post("/customer/gwAdd", this.parames).then(res => {
  261. uni.hideLoading();
  262. uni.showToast({
  263. icon: "none",
  264. title: "保存成功"
  265. })
  266. uni.navigateBack()
  267. })
  268. } else {
  269. this.$u.post("/customer/add", this.parames).then(res => {
  270. uni.hideLoading();
  271. uni.showToast({
  272. icon: "none",
  273. title: "保存成功"
  274. })
  275. uni.navigateBack()
  276. })
  277. }
  278. },
  279. changeSex(sex) {
  280. this.parames.sex = sex;
  281. },
  282. changeHowMany(num) {
  283. this.parames.howMany = num;
  284. },
  285. clickShowhid() {
  286. if (!this.isShow) {
  287. uni.showToast({
  288. icon: "none",
  289. title: '您没有指派权限~'
  290. })
  291. return
  292. }
  293. if (this.freeList.length == 0) {
  294. uni.showToast({
  295. icon: 'none',
  296. title: '当前无可用排班顾问',
  297. duration: 2000
  298. });
  299. } else {
  300. // this.Showhid = true;
  301. uni.navigateTo({
  302. url: `/pages/mine/reception/consultant?from=addreception&id=${this.parames.agentId}&chosedAgentId=${this.parames.agentId}`
  303. })
  304. }
  305. },
  306. cancel1() {
  307. this.Showhid = false;
  308. },
  309. confirm1(e) {
  310. this.text = e[0].label;
  311. this.parames.agentId = e[0].value;
  312. this.Showhid = false;
  313. },
  314. Buildingselection() {
  315. this.Showhiddenunits = true;
  316. },
  317. cancel() {
  318. this.Showhiddenunits = false;
  319. },
  320. confirm(e) {
  321. console.log(e)
  322. this.parames.sourceName = e[0].label;
  323. this.parames.source = e[0].value;
  324. this.Showhiddenunits = false;
  325. },
  326. //获取顾问列表
  327. getFreeList() {
  328. this.$u.get("/zkAgentPool/freeList?itemId=" + this.parames.projectId).then(res => {
  329. this.freeList = res;
  330. this.freeList.forEach(item => {
  331. // console.log(item, '顾问')
  332. if (item.onLine == 0) {
  333. item.label = item.name + "(离线)";
  334. } else if (item.onLine == 1) {
  335. item.label = item.name + "(在线)";
  336. } else {
  337. item.label = item.name + "(无设备)";
  338. }
  339. item.value = item.agentId
  340. // 从选择顾问页面跳回时需阻断用当前登录人的顾问id选中自身
  341. if (!this.fromBack) {
  342. if (this.userInfo.accountId == item.agentId) {
  343. this.text = item.label
  344. this.parames.agentId = item.agentId;
  345. }
  346. }
  347. })
  348. })
  349. },
  350. }
  351. };
  352. </script>
  353. <style lang="scss" scoped>
  354. .sexRadio {
  355. color: #BFBFBF;
  356. border: 1rpx solid #BFBFBF;
  357. font-size: 24rpx;
  358. width: 120rpx;
  359. height: 60rpx;
  360. text-align: center;
  361. display: flex;
  362. align-items: center;
  363. justify-content: center;
  364. &:last-child {
  365. margin-left: 20rpx;
  366. }
  367. &.active {
  368. background: #2B6FFF;
  369. color: #fff;
  370. border-color: #2B6FFF;
  371. }
  372. }
  373. .num {
  374. width: 50rpx;
  375. height: 50rpx;
  376. background: rgba(43, 110, 253, 0.1);
  377. color: #2B6EFD;
  378. font-size: 30rpx;
  379. display: flex;
  380. align-items: center;
  381. justify-content: center;
  382. &.active {
  383. background: #2B6EFD;
  384. color: #FFFFFF;
  385. }
  386. }
  387. .cented-box {
  388. background: #F8F8F8;
  389. width: 100%;
  390. height: 100vh;
  391. }
  392. .Pinspeak {
  393. width: 100%;
  394. height: 92rpx;
  395. border-bottom: 1rpx solid #E0E0E0;
  396. font-size: 32rpx;
  397. font-weight: bold;
  398. color: #333333;
  399. text-indent: 30rpx;
  400. line-height: 92rpx;
  401. background: #FFFFFF;
  402. margin-top: 20rpx;
  403. padding-left: 10rpx;
  404. }
  405. .chented {
  406. width: 100%;
  407. padding-left: 30rpx;
  408. padding-right: 30rpx;
  409. background-color: #FFFFFF;
  410. .title {
  411. width: 100%;
  412. height: 110rpx;
  413. border-bottom: 1rpx solid #E0E0E0;
  414. display: flex;
  415. align-items: center;
  416. .titletext {
  417. width: 21%;
  418. height: 110rpx;
  419. font-size: 30rpx;
  420. font-weight: 400;
  421. color: #333333;
  422. line-height: 110rpx;
  423. text-indent: 10rpx;
  424. }
  425. .titletext2 {
  426. width: 71%;
  427. height: 110rpx;
  428. }
  429. .titletext-input {
  430. width: 100%;
  431. height: 110rpx;
  432. font-size: 30rpx;
  433. font-weight: 400;
  434. color: #B2B2B2;
  435. line-height: 110rpx;
  436. padding-left: 10rpx;
  437. }
  438. .titleimg {
  439. width: 8%;
  440. text-align: right;
  441. .titleimg1 {
  442. width: 16rpx;
  443. height: 36rpx;
  444. }
  445. }
  446. }
  447. }
  448. .clive {
  449. position: absolute;
  450. bottom: 32rpx;
  451. left: 30rpx;
  452. right: 30rpx;
  453. width: 690rpx;
  454. height: 88rpx;
  455. background: #2671E2;
  456. text-align: center;
  457. line-height: 88rpx;
  458. color: #FFFFFF;
  459. border-radius: 8rpx;
  460. font-size: 32rpx;
  461. }
  462. </style>