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.
 
 
 

527 lines
12 KiB

  1. <template>
  2. <view class="cented-box">
  3. <view v-if="waitCustomList.length==0" style="width: 100%;height: 100%;display: flex;align-items: center;">
  4. <view style="width: 100%;padding-top: 200rpx;">
  5. <view style="width: 100%;text-align: center;">
  6. <image style="width: 220rpx;height: 200rpx;"
  7. src="https://static.quhouse.com/zhikong_xcx_img/nodatalist.png" mode=""></image>
  8. </view>
  9. <view style="text-align: center;width: 100%;margin-top: 20rpx;color: #999999;">暂无数据</view>
  10. </view>
  11. </view>
  12. <view class="customer" v-if="waitCustomList.length!=0" v-for="(item,index) in waitCustomList" :key='index'
  13. @click="tapThevisiting(item)">
  14. <view class="title">
  15. <view class="zuo">
  16. <!-- <view class="zuoimg">A</view> -->
  17. <view class="zuoname">{{item.name}}</view>
  18. </view>
  19. <view class="you">
  20. <view class="youimg1" v-if="item.status!=0"></view>
  21. <view class="youimg1-1" v-if="item.status==0"></view>
  22. <view class="youtext">{{item.status==0?"排队中":item.status==1?"接待中":"已完成"}}</view>
  23. </view>
  24. </view>
  25. <view class="centerbox" v-if="item.status!=0">
  26. <view class="centerbox-che">手机号码:<text class="shizai">{{item.phone || "--"}}</text></view>
  27. <view class="centerbox-che">开始时间:<text class="shizai">{{item.createTime}}</text></view>
  28. <view class="centerbox-che">顾问姓名:<text class="shizai" style="color: #333333;">{{item.agentName}}</text>
  29. </view>
  30. <view class="centerbox-che2" v-if="item.status==1">
  31. <view class="Workcard" v-if="item.status==1&&item.zkEquipmentState.onLine==0">设备状态:<text
  32. class="shizai" style="color: red;">离线</text></view>
  33. <view class="Workcard" v-if="item.status==1&&item.zkEquipmentState.onLine!=0">工牌电量:<text
  34. class="shizai" style="color: #333333;">{{item.zkEquipmentState.electricity}}%</text></view>
  35. <view class="Workcard" v-if="item.status==1&&item.zkEquipmentState.onLine==1">录音状态:
  36. <text v-if="item.zkEquipmentState.audioStatus=='true'" class="shizai"
  37. style="color: #333333;">使用中</text>
  38. <text v-if="item.zkEquipmentState.audioStatus=='false'" class="shizai"
  39. style="color: #333333;">未使用</text>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- checkAuthority('顾问指派顾问') -->
  44. <view class="footer-button" v-if="item.status!=0">
  45. <view class="footer1" @click.stop="addTime(item)">接待延时</view>
  46. <template v-if="zhipai">
  47. <view class="footer1" @click.stop="assign(item)">重新指派</view>
  48. </template>
  49. <template v-if="endReception">
  50. <view class="footer3" @click.stop="changeEnd(item.id)">结束接待</view>
  51. </template>
  52. </view>
  53. <view class="centerbox" v-if="item.status==0">
  54. <view class="centerbox-che">手机号码:<text class="shizai">{{item.phone || "--"}}</text></view>
  55. </view>
  56. <view class="footer-button" v-if="item.status==0">
  57. <template v-if="zhipai">
  58. <view class="footer3" @click.stop="assign(item)">指派顾问</view>
  59. </template>
  60. <template v-if="checkAuthority('删除接待记录')">
  61. <view @tap.stop="deleteReception(item)" class="footer3">删除接待</view>
  62. </template>
  63. </view>
  64. </view>
  65. <image v-if="dataCode!=6||(dataCode==6&&addAccount==0)" @click="addreception()" class="add"
  66. src="/static/images/add.png" mode=""></image>
  67. <image class="add2" @click="reshCustom()" src="https://static.quhouse.com/zhikong_xcx_img/refresh.png" mode="">
  68. </image>
  69. <u-tabbar activeColor="#1296db" inactiveColor="#999999" v-model="current" :list="tabbarList"></u-tabbar>
  70. <!-- 加载组件 -->
  71. <loading v-model="LOADING"></loading>
  72. </view>
  73. </template>
  74. <script>
  75. var util = require("../../utils/util.js");
  76. var config = require("../../config");
  77. import tabbarList from '@/utils/tabbar.js'
  78. import loading from "@/components/loading/index.vue"
  79. export default {
  80. components: {
  81. loading
  82. },
  83. data() {
  84. return {
  85. noClick: true,
  86. tabbarList: tabbarList,
  87. current: 0,
  88. buildingID: '',
  89. waitCustomList: [],
  90. dataCode: '',
  91. addAccount: '',
  92. endReception: true,
  93. fdFlag: null,
  94. isAdd: 0, // 默认能指派
  95. };
  96. },
  97. computed: {
  98. zhipai() {
  99. if (this.isAdd == 0) {
  100. // 如果改角色是顾问
  101. if (this.dataCode == 6) {
  102. return this.checkAuthority('顾问指派顾问')
  103. } else return true
  104. } else {
  105. return false
  106. }
  107. }
  108. },
  109. components: {},
  110. onShow() {
  111. this.LOADING = true
  112. this.buildingID = uni.getStorageSync('buildingID').id;
  113. const {
  114. addAccount,
  115. dataCode
  116. } = uni.getStorageSync("weapp_session_userInfo_data");
  117. let menulist = uni.getStorageSync('weapp_session_Menu_data')
  118. this.endReception = menulist.findIndex(item => {
  119. return item.name == '结束接待'
  120. }) != -1
  121. this.addAccount = addAccount;
  122. this.dataCode = dataCode;
  123. this.init()
  124. this.updateInit()
  125. this.queryHaveDept()
  126. this.initrealTimeStatistics()
  127. },
  128. methods: {
  129. //实时统计
  130. initrealTimeStatistics() {
  131. uni.request({
  132. url: config.service.realTimeStatistics,
  133. method: "POST",
  134. header: {
  135. 'content-type': 'application/json',
  136. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  137. },
  138. data: {
  139. houseId: this.buildingID
  140. },
  141. success: (data) => {
  142. if (data.data.data == null) {
  143. return
  144. } else {
  145. this.tabbarList[1].count = data.data.data.receivingCustomer || 0
  146. this.$forceUpdate()
  147. }
  148. },
  149. fail: () => {
  150. }
  151. })
  152. },
  153. // 删除接待
  154. deleteReception(data) {
  155. uni.showModal({
  156. content: `确认删除“${data.name}”接待吗?`,
  157. cancelColor: "#999999",
  158. success: res => {
  159. if (res.confirm) {
  160. this.$u.get(`/customer/delete?id=${data.id}`).then(res => {
  161. if (!res) {
  162. this.init()
  163. }
  164. }).catch(e => {
  165. console.log(e)
  166. uni.showToast({
  167. title: '网络异常,请稍后重试~',
  168. icon: 'none'
  169. });
  170. })
  171. }
  172. }
  173. })
  174. },
  175. // 获取未读消息数量
  176. updateInit() {
  177. uni.request({
  178. url: config.service.notReadNum,
  179. method: "GET",
  180. data: {
  181. id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
  182. projectId: uni.getStorageSync('buildingID').id,
  183. },
  184. header: {
  185. 'content-type': 'application/json',
  186. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  187. },
  188. success: (res) => {
  189. this.count = res.data.data
  190. this.tabbarList[3].count = res.data.data || 0
  191. }
  192. })
  193. },
  194. reshCustom() {
  195. this.init()
  196. this.initrealTimeStatistics()
  197. },
  198. tapThevisiting(item) {
  199. uni.showLoading({
  200. title: '加载中',
  201. mask: true
  202. });
  203. if (item.status == 0) {
  204. setTimeout(function() {
  205. uni.hideLoading();
  206. }, 2000);
  207. uni.showToast({
  208. icon: "none",
  209. title: "排队中"
  210. })
  211. return
  212. } else {
  213. const parames = {
  214. pageNum: 1,
  215. pageSize: 100,
  216. query: {
  217. customerId: item.id,
  218. }
  219. }
  220. var itemsd = {
  221. bg: 0,
  222. customerId: item.id,
  223. id: '',
  224. onebest: ''
  225. }
  226. this.$u.post("/corpus/findByPage", parames).then(res => {
  227. setTimeout(function() {
  228. uni.hideLoading();
  229. }, 2000);
  230. if (res) {
  231. let newobj = res[0];
  232. uni.navigateTo({
  233. url: `/pages/mine/details?customerId=${newobj.customerId}&status=${newobj.status}&itemobj=${JSON.stringify(itemsd)}&stateisshow=${"1"}`
  234. })
  235. } else {
  236. uni.showToast({
  237. icon: "none",
  238. title: "暂无音频"
  239. })
  240. return
  241. }
  242. })
  243. }
  244. },
  245. init() {
  246. this.waitCustomList = []
  247. let parames = {
  248. itemId: this.buildingID
  249. }
  250. this.$u.post("/customer/reception", parames).then(data => {
  251. this.LOADING = false
  252. this.waitCustomList = data;
  253. }).catch(e => {
  254. this.LOADING = false
  255. });
  256. },
  257. //延时接待
  258. addTime(item) {
  259. uni.showModal({
  260. content: "确定延长半小时接待时间?",
  261. cancelColor: "#999999",
  262. success: res => {
  263. if (res.confirm) {
  264. this.$u.post("/customer/delayed", {
  265. cusId: item.id
  266. }).then(res => {
  267. uni.showToast({
  268. icon: "none",
  269. title: "操作成功"
  270. })
  271. });
  272. }
  273. }
  274. })
  275. },
  276. //结束接待
  277. changeEnd(id) {
  278. uni.showModal({
  279. content: "确定更改当前客户接待状态为结束?",
  280. cancelColor: "#999999",
  281. success: res => {
  282. if (res.confirm) {
  283. uni.showLoading({
  284. mask: true,
  285. title: '结束中...'
  286. })
  287. this.$u.post("/customer/endReception", {
  288. id: id,
  289. houseId: this.buildingID
  290. }).then(res => {
  291. uni.hideLoading()
  292. uni.showToast({
  293. icon: "none",
  294. title: "操作成功"
  295. })
  296. this.init();
  297. this.initrealTimeStatistics()
  298. }).catch(() => {
  299. uni.hideLoading()
  300. });
  301. }
  302. }
  303. })
  304. },
  305. // 检测是否有添加顾问的权限
  306. queryHaveDept() {
  307. uni.request({
  308. url: config.service.getSelfAssignedByHouseId + "?houseId=" + uni.getStorageSync('buildingID')
  309. .id,
  310. method: "GET",
  311. header: {
  312. 'content-type': 'application/json',
  313. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  314. },
  315. success: (data) => {
  316. if (data.data.code == 10000) {
  317. this.isAdd = data.data.data.selfAssigned
  318. }
  319. }
  320. })
  321. },
  322. //新增接待
  323. addreception() {
  324. const {
  325. dataCode,
  326. addAccount
  327. } = uni.getStorageSync("weapp_session_userInfo_data");
  328. if (dataCode == 6) {
  329. if (addAccount != 0) {
  330. uni.showToast({
  331. title: '不允许自建客户!',
  332. duration: 2000
  333. });
  334. return
  335. }
  336. uni.navigateTo({
  337. url: '/pages/mine/reception/addreception'
  338. });
  339. } else {
  340. uni.navigateTo({
  341. url: '/pages/mine/reception/addreception'
  342. });
  343. }
  344. },
  345. assign(item) {
  346. let url = `/pages/mine/reception/consultant?id=${item.id}`
  347. if (item.beforeAgentId) {
  348. url += `&beforeAgentId=${item.beforeAgentId}`;
  349. }
  350. uni.navigateTo({
  351. url: url
  352. })
  353. },
  354. },
  355. };
  356. </script>
  357. <style lang="scss" scoped>
  358. .cented-box {
  359. background: #F8F8F8;
  360. width: 100%;
  361. height: 100vh;
  362. padding-bottom: 30rpx;
  363. }
  364. .customer {
  365. margin-top: 30rpx;
  366. width: 100%;
  367. background: #FFFFFF;
  368. box-shadow: 0px 0px 12px 0px rgba(224, 224, 224, 0.3);
  369. .title {
  370. height: 90rpx;
  371. border-bottom: 1px solid #E0E0E0;
  372. display: flex;
  373. align-items: center;
  374. .zuo {
  375. width: 80%;
  376. height: 100%;
  377. display: flex;
  378. align-items: center;
  379. .zuoimg {
  380. width: 52rpx;
  381. height: 52rpx;
  382. border-radius: 50%;
  383. border: 1px solid #C9C9C9;
  384. font-size: 30rpx;
  385. color: #292929;
  386. font-weight: 400;
  387. line-height: 52rpx;
  388. text-align: center;
  389. margin-left: 30rpx;
  390. }
  391. .zuoname {
  392. font-size: 30rpx;
  393. font-weight: 500;
  394. color: #333333;
  395. line-height: 30rpx;
  396. margin-left: 20rpx;
  397. }
  398. }
  399. .you {
  400. width: 20%;
  401. height: 100%;
  402. display: flex;
  403. align-items: center;
  404. .youimg1 {
  405. width: 12rpx;
  406. height: 12rpx;
  407. border-radius: 50%;
  408. background: #2B6EFF;
  409. }
  410. .youimg1-1 {
  411. width: 12rpx;
  412. height: 12rpx;
  413. border-radius: 50%;
  414. background: #F2A269;
  415. }
  416. .youtext {
  417. font-size: 30rpx;
  418. font-weight: 400;
  419. color: #292929;
  420. line-height: 30rpx;
  421. margin-left: 10rpx;
  422. }
  423. }
  424. }
  425. .centerbox {
  426. .centerbox-che {
  427. width: 100%;
  428. margin-top: 30rpx;
  429. height: 30rpx;
  430. font-size: 30rpx;
  431. font-weight: 400;
  432. color: #666666;
  433. line-height: 30rpx;
  434. text-indent: 30rpx;
  435. .shizai {
  436. color: #333333;
  437. }
  438. }
  439. .centerbox-che2 {
  440. width: 100%;
  441. margin-top: 30rpx;
  442. height: 30rpx;
  443. font-size: 30rpx;
  444. font-weight: 400;
  445. color: #666666;
  446. line-height: 30rpx;
  447. text-indent: 30rpx;
  448. display: flex;
  449. .Workcard {
  450. width: 50%;
  451. }
  452. }
  453. }
  454. .footer-button {
  455. margin-top: 30rpx;
  456. width: 100%;
  457. height: 90rpx;
  458. display: flex;
  459. font-size: 30rpx;
  460. font-weight: 400;
  461. color: #333333;
  462. border-top: 1rpx solid #E0E0E0;
  463. .footer1 {
  464. flex-grow: 1;
  465. text-align: center;
  466. line-height: 90rpx;
  467. border-right: 1rpx solid #E0E0E0;
  468. }
  469. .footer3 {
  470. flex-grow: 1;
  471. text-align: center;
  472. line-height: 90rpx;
  473. }
  474. }
  475. }
  476. .add {
  477. width: 90upx;
  478. height: 90upx;
  479. position: fixed;
  480. bottom: 275upx;
  481. right: 44upx;
  482. }
  483. .add2 {
  484. width: 90upx;
  485. height: 90upx;
  486. position: fixed;
  487. bottom: 160upx;
  488. right: 44upx;
  489. }
  490. </style>