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.
 
 
 

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