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.

customer.vue 13 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <template>
  2. <view class="cented-box">
  3. <view v-if="waitCustomList.length==0" class="empty">
  4. <view style="width: 100%;display: flex;
  5. flex-direction: column;justify-content: center;align-items: center;">
  6. <view style="width: 100%;text-align: center;">
  7. <image style="width: 220rpx;height: 200rpx;"
  8. src="https://static.quhouse.com/zhikong_xcx_img/nodatalist.png" mode=""></image>
  9. </view>
  10. <view style="text-align: center;width: 100%;margin-top: 20rpx;color: #999999;">暂无数据</view>
  11. </view>
  12. </view>
  13. <view class="customer" v-if="waitCustomList.length!=0" v-for="(item,index) in waitCustomList" :key='index'
  14. @click="tapThevisiting(item)">
  15. <view class="title">
  16. <view class="zuo">
  17. <view class="zuoimg">顾</view>
  18. <view class="zuoname">{{item.agentName || '--'}}</view>
  19. </view>
  20. <view class="cen" v-if="timestamp(item.assignedTime) < 60*30">
  21. <view v-if="item.status!=0">
  22. 自动结束 <u-count-down :timestamp="timestamp(item.assignedTime)" color="#E7483C"></u-count-down>
  23. </view>
  24. </view>
  25. <view class="you">
  26. <view class="" v-if="item.status!=0" style="display: flex;">
  27. <block v-if="item.imei!=null">
  28. <!-- 接待中 -->
  29. <view class="">
  30. <!-- 工牌标示 -->
  31. <!-- <image class="you-img" src="../../static/images/cus1.png" mode=""></image> -->
  32. </view>
  33. <!-- 未离线 -->
  34. <view class="" v-if="item.zkEquipmentState.onLine!=0" style="display: flex;">
  35. <view class="">
  36. <!-- 电量 -->
  37. <image v-if="item.zkEquipmentState.electricity>=20" class="you-img"
  38. src="../../static/images/cus2.png" mode=""></image>
  39. <image v-else class="you-img" src="../../static/images/cus5.png" mode=""></image>
  40. </view>
  41. <view class="">
  42. <!-- 录音 -->
  43. <image v-if="item.zkEquipmentState.simAudioStatus=='true'" class="you-img"
  44. src="../../static/images/cus3.png" mode=""></image>
  45. <image v-else class="you-img" src="../../static/images/cus6.png" mode=""></image>
  46. </view>
  47. </view>
  48. <!-- 离线 -->
  49. <view class="" v-else>
  50. <view class="">
  51. <!-- 录音 -->
  52. <image class="you-img" src="../../static/images/cus4.png" mode=""></image>
  53. </view>
  54. </view>
  55. </block>
  56. </view>
  57. <view class="youtext" v-else>
  58. <!--排队中 -->
  59. 排队中
  60. </view>
  61. </view>
  62. </view>
  63. <view class="centerbox">
  64. <view class="content-sec">
  65. <view class="left">
  66. <view class="adviser">客</view>
  67. <view class="cus">{{item.name || '--'}}</view>
  68. <view class="arriveNum">{{ item.phone || '--' }}</view>
  69. </view>
  70. </view>
  71. <view class="content-last">
  72. <view class="c-items">
  73. <image src="../../static/images/people.png" class="c-items-img" mode=""></image>
  74. {{ item.visitRecord || "0" }}次到访
  75. </view>
  76. <view class="c-items">
  77. <image src="../../static/images/time.png" class="c-items-img" mode=""></image>
  78. {{ item.createTime }}
  79. </view>
  80. </view>
  81. </view>
  82. <view class="footer-button" v-if="item.status!=0">
  83. <view v-if="CHECKAUTHORITY('jdys')" class="footer1" @click.stop="addTime(item)">接待延时</view>
  84. <view v-if="CHECKAUTHORITY('jd_zp')" class="footer1" @click.stop="assign(item)">重新指派</view>
  85. <view v-if="CHECKAUTHORITY('jsjd')" class="footer3" @click.stop="changeEnd(item.id)">结束接待</view>
  86. </view>
  87. <view class="footer-button" v-if="item.status==0">
  88. <view v-if="CHECKAUTHORITY('scjd')" @tap.stop="deleteReception(item)" class="footer3">删除接待</view>
  89. <view v-if="CHECKAUTHORITY('jd_zp')" class="footer3" @click.stop="assign(item)">指派顾问</view>
  90. </view>
  91. </view>
  92. <image v-if="CHECKAUTHORITY('jd_xz')" @click="addreception()" class="add" src="/static/images/add.png" mode="">
  93. </image>
  94. <image class="add2" @click="reshCustom()" src="https://static.quhouse.com/zhikong_xcx_img/refresh.png" mode="">
  95. </image>
  96. </view>
  97. </template>
  98. <script>
  99. var config = require("../../config");
  100. export default {
  101. data() {
  102. return {
  103. noClick: true,
  104. // tabbar配置项
  105. current: 0,
  106. //--- end --- tabbar配置项
  107. buildingID: '',
  108. waitCustomList: [],
  109. dataCode: '',
  110. addAccount: '',
  111. };
  112. },
  113. computed: {
  114. timestamp() {
  115. return (e) => {
  116. if (!e) return
  117. let totalTime = new Date(e).getTime() / 1000 + 60 * 60 * 2
  118. let nowTime = new Date().getTime() / 1000
  119. return totalTime - nowTime
  120. }
  121. }
  122. },
  123. onShow() {
  124. this.buildingID = uni.getStorageSync('buildingID').id;
  125. this.getTabBarBadge()
  126. const {
  127. addAccount,
  128. dataCode
  129. } = uni.getStorageSync("weapp_session_userInfo_data");
  130. this.addAccount = addAccount;
  131. this.dataCode = dataCode;
  132. this.init()
  133. this.updateInit()
  134. },
  135. onPullDownRefresh() {
  136. this.init()
  137. setTimeout(function() {
  138. uni.stopPullDownRefresh();
  139. }, 1000);
  140. },
  141. methods: {
  142. // 删除接待
  143. deleteReception(data) {
  144. uni.showModal({
  145. content: `确认删除“${data.name}”接待吗?`,
  146. cancelColor: "#999999",
  147. success: res => {
  148. if (res.confirm) {
  149. this.$u.get(`/customer/delete?id=${data.id}`).then(res => {
  150. if (!res) {
  151. this.init()
  152. }
  153. this.getTabBarBadge()
  154. }).catch(e => {
  155. console.log(e)
  156. uni.showToast({
  157. title: '网络异常,请稍后重试~',
  158. icon: 'none'
  159. });
  160. this.getTabBarBadge()
  161. })
  162. }
  163. }
  164. })
  165. },
  166. // 未读消息数量
  167. updateInit() {
  168. this.$u.get(config.service.notReadNum, {
  169. id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
  170. projectId: uni.getStorageSync('buildingID').id
  171. }).then(res => {
  172. if (res > 0) {
  173. uni.setTabBarBadge({ //显示数字
  174. index: 4, //tabbar下标
  175. text: `${res}` //数字
  176. })
  177. } else {
  178. uni.removeTabBarBadge({
  179. index: 4
  180. })
  181. }
  182. }).catch(e => {
  183. uni.removeTabBarBadge({
  184. index: 4
  185. })
  186. })
  187. },
  188. reshCustom() {
  189. this.init()
  190. },
  191. tapThevisiting(item) {
  192. if (this.CHECKAUTHORITY('jd_ck') != true) {
  193. return
  194. }
  195. uni.showLoading({
  196. title: '加载中',
  197. mask: true
  198. });
  199. if (item.status == 0) {
  200. setTimeout(function() {
  201. uni.hideLoading();
  202. }, 2000);
  203. uni.showToast({
  204. icon: "none",
  205. title: "排队中"
  206. })
  207. return
  208. } else {
  209. const parames = {
  210. pageNum: 1,
  211. pageSize: 100,
  212. query: {
  213. customerId: item.id,
  214. }
  215. }
  216. var itemsd = {
  217. bg: 0,
  218. customerId: item.id,
  219. id: '',
  220. onebest: ''
  221. }
  222. this.$u.post("/corpus/findByPage", parames).then(res => {
  223. setTimeout(function() {
  224. uni.hideLoading();
  225. }, 2000);
  226. if (res) {
  227. let newobj = res[0];
  228. uni.navigateTo({
  229. url: `/pages/mine/details?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(itemsd)}&stateisshow=${"1"}`
  230. })
  231. } else {
  232. uni.showToast({
  233. icon: "none",
  234. title: "暂无音频"
  235. })
  236. return
  237. }
  238. })
  239. }
  240. },
  241. init() {
  242. this.waitCustomList = []
  243. let parames = {
  244. itemId: this.buildingID
  245. }
  246. this.$u.post("/customer/reception", parames).then(data => {
  247. this.waitCustomList = data;
  248. });
  249. },
  250. //延时接待
  251. addTime(item) {
  252. uni.showModal({
  253. content: "确定延长半小时接待时间?",
  254. cancelColor: "#999999",
  255. success: res => {
  256. if (res.confirm) {
  257. this.$u.post("/customer/delayed", {
  258. cusId: item.id
  259. }).then(res => {
  260. uni.showToast({
  261. icon: "none",
  262. title: "操作成功"
  263. })
  264. });
  265. }
  266. }
  267. })
  268. },
  269. //结束接待
  270. changeEnd(id) {
  271. uni.showModal({
  272. content: "确定更改当前客户接待状态为结束?",
  273. cancelColor: "#999999",
  274. success: res => {
  275. if (this.noClick) {
  276. this.noClick = false;
  277. if (res.confirm) {
  278. this.$u.post("/customer/endReception", {
  279. id: id,
  280. houseId: this.buildingID
  281. }).then(res => {
  282. uni.showToast({
  283. icon: "none",
  284. title: "操作成功"
  285. })
  286. this.init();
  287. this.getTabBarBadge()
  288. });
  289. }
  290. setTimeout(() => {
  291. this.noClick = true;
  292. }, 2000)
  293. } else {
  294. // 这里是重复点击的判断
  295. }
  296. }
  297. })
  298. },
  299. //新增接待
  300. addreception() {
  301. uni.navigateTo({
  302. url: '/pages/mine/reception/addreception'
  303. });
  304. },
  305. assign(item) {
  306. let url = `/pages/mine/reception/consultant?id=${item.id}`
  307. if (item.beforeAgentId) {
  308. url += `&beforeAgentId=${item.beforeAgentId}`;
  309. }
  310. uni.navigateTo({
  311. url: url
  312. })
  313. },
  314. },
  315. };
  316. </script>
  317. <style lang="scss" scoped>
  318. .cented-box {
  319. background: #F8F8F8;
  320. width: 100%;
  321. min-height: calc(100vh - var(--window-bottom) - var(--window-top));
  322. padding-bottom: 30rpx;
  323. display: flex;
  324. flex-direction: column;
  325. .empty {
  326. flex-grow: 1;
  327. display: flex;
  328. align-items: center;
  329. }
  330. }
  331. .customer {
  332. margin-top: 30rpx;
  333. width: 100%;
  334. background: #FFFFFF;
  335. box-shadow: 0px 0px 12px 0px rgba(224, 224, 224, 0.3);
  336. .title {
  337. height: 90rpx;
  338. border-bottom: 1px solid #E0E0E0;
  339. display: flex;
  340. align-items: center;
  341. justify-content: space-between;
  342. .zuo {
  343. // width: 25%;
  344. height: 100%;
  345. display: flex;
  346. align-items: center;
  347. .zuoimg {
  348. width: 52rpx;
  349. height: 52rpx;
  350. border-radius: 50%;
  351. // border: 1px solid #C9C9C9;
  352. border: 1px solid #2671E2;
  353. font-size: 30rpx;
  354. color: #2671E2;
  355. font-weight: 400;
  356. line-height: 48rpx;
  357. text-align: center;
  358. margin-left: 30rpx;
  359. }
  360. .zuoname {
  361. font-size: 30rpx;
  362. font-weight: bold;
  363. color: #333333;
  364. line-height: 30rpx;
  365. margin-left: 20rpx;
  366. }
  367. }
  368. .cen {
  369. // width:50%;
  370. color: #E7483C;
  371. text-align: center;
  372. }
  373. .you {
  374. // width: 25%;
  375. height: 100%;
  376. display: flex;
  377. align-items: center;
  378. margin-right: 30rpx;
  379. .youimg1 {
  380. width: 12rpx;
  381. height: 12rpx;
  382. border-radius: 50%;
  383. background: #2B6EFF;
  384. }
  385. .you-img {
  386. width: 24rpx;
  387. height: 32rpx;
  388. margin-left: 24rpx;
  389. }
  390. .youimg1-1 {
  391. width: 12rpx;
  392. height: 12rpx;
  393. border-radius: 50%;
  394. background: #F2A269;
  395. }
  396. .youtext {
  397. font-size: 30rpx;
  398. font-weight: 400;
  399. color: #292929;
  400. line-height: 30rpx;
  401. margin-left: 10rpx;
  402. }
  403. }
  404. }
  405. .centerbox {
  406. .centerbox-che {
  407. width: 100%;
  408. margin-top: 30rpx;
  409. height: 30rpx;
  410. font-size: 30rpx;
  411. font-weight: 400;
  412. color: #666666;
  413. line-height: 30rpx;
  414. text-indent: 30rpx;
  415. .shizai {
  416. color: #333333;
  417. }
  418. }
  419. .centerbox-che2 {
  420. width: 100%;
  421. margin-top: 30rpx;
  422. height: 30rpx;
  423. font-size: 30rpx;
  424. font-weight: 400;
  425. color: #666666;
  426. line-height: 30rpx;
  427. text-indent: 30rpx;
  428. display: flex;
  429. .Workcard {
  430. width: 50%;
  431. }
  432. }
  433. }
  434. .footer-button {
  435. padding: 0 30rpx;
  436. width: 100%;
  437. height: 108rpx;
  438. display: flex;
  439. font-size: 30rpx;
  440. font-weight: 400;
  441. color: #333333;
  442. border-top: 1rpx solid #E0E0E0;
  443. justify-content: flex-end;
  444. line-height: 58rpx;
  445. .footer1 {
  446. // flex: 1;
  447. text-align: center;
  448. margin-top: 24rpx;
  449. // line-height: 90rpx;
  450. // border-right: 1rpx solid #E0E0E0;
  451. width: 156rpx;
  452. height: 60rpx;
  453. background: #FFFFFF;
  454. border-radius: 30rpx;
  455. border: 1px solid #999999;
  456. margin-left: 30rpx;
  457. }
  458. .footer3 {
  459. // flex: 1;
  460. text-align: center;
  461. margin-top: 24rpx;
  462. // line-height: 90rpx;
  463. width: 156rpx;
  464. height: 60rpx;
  465. background: #FFFFFF;
  466. border-radius: 30rpx;
  467. border: 1px solid #999999;
  468. margin-left: 30rpx;
  469. }
  470. }
  471. }
  472. .add {
  473. width: 90rpx;
  474. height: 90rpx;
  475. position: fixed;
  476. bottom: 270rpx;
  477. right: 44rpx;
  478. }
  479. .add2 {
  480. width: 90rpx;
  481. height: 90rpx;
  482. position: fixed;
  483. bottom: 150rpx;
  484. right: 44rpx;
  485. }
  486. .content-sec {
  487. padding: 28rpx 30rpx 32rpx;
  488. width: 100%;
  489. display: flex;
  490. justify-content: space-between;
  491. .left {
  492. flex-shrink: 0;
  493. width: 100%;
  494. display: flex;
  495. align-items: center;
  496. .adviser {
  497. flex-shrink: 0;
  498. margin-right: 10rpx;
  499. padding: 5rpx 11rpx;
  500. border-radius: 50%;
  501. border: 1rpx solid #2671E2;
  502. background: #2671E2;
  503. font-size: 30rpx;
  504. color: #fff;
  505. }
  506. .cus {
  507. font-size: 30rpx;
  508. font-weight: 400;
  509. color: #666666;
  510. overflow: hidden;
  511. /*超出部分隐藏*/
  512. text-overflow: ellipsis;
  513. /* 超出部分显示省略号 */
  514. white-space: nowrap;
  515. /*规定段落中的文本不进行换行 */
  516. }
  517. .arriveNum {
  518. flex-shrink: 0;
  519. font-size: 30rpx;
  520. font-weight: 400;
  521. margin-left: 10rpx;
  522. }
  523. }
  524. .right {
  525. flex-shrink: 0;
  526. font-size: 28rpx;
  527. font-weight: 400;
  528. color: #2671E2;
  529. display: flex;
  530. align-items: center;
  531. .img {
  532. margin-right: 10rpx;
  533. width: 32rpx;
  534. height: 32rpx;
  535. }
  536. }
  537. }
  538. .content-last {
  539. padding: 0 30rpx 34rpx;
  540. font-size: 30rpx;
  541. font-weight: 400;
  542. color: #666666;
  543. display: flex;
  544. align-items: center;
  545. justify-content: space-between;
  546. .c-items {
  547. flex-shrink: 0;
  548. display: flex;
  549. align-items: center;
  550. font-size: 28rpx;
  551. .c-items-img {
  552. margin-right: 10rpx;
  553. width: 32rpx;
  554. height: 32rpx;
  555. }
  556. }
  557. }
  558. </style>