您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

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