Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

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