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.
 
 
 

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