AI销管
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.
 
 
 
 

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