Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

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