AI销管
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

430 líneas
9.3 KiB

  1. <template>
  2. <view class="box">
  3. <!-- 顾问选择 -->
  4. <view class="nextcon">
  5. 下一位接待顾问:{{textcdhSKJ}}
  6. </view>
  7. <!-- 搜索筛选顾问 -->
  8. <view class="search-tag" :class="{ pdBtm: isShowBtn }">
  9. <u-search v-model="keywords" @search="searchFunc" @input="searchFunc" bgColor="#F8F8F8" shape="round" placeholder="顾问名称"
  10. :showAction="false" :clearabled="true"></u-search>
  11. <view class="tabs-box" v-if="list.length > 0">
  12. <u-tabs :list="list" :current="listCurrent" name="deptName" @change="change"></u-tabs>
  13. </view>
  14. </view>
  15. <view class="content" style="padding-bottom: 200rpx;">
  16. <radio-group @change="radioChange">
  17. <view v-for="(item,index) in freeList" :key="index" class="content-tips">
  18. <view class="left">
  19. <view class="img">
  20. {{item.name.slice(0,1)}}
  21. </view>
  22. <view class="text">
  23. <view class="name">
  24. <text class="names">{{item.name}}</text>
  25. <text :class="item.class">{{ item.label }}</text>
  26. </view>
  27. <view class="num">
  28. 今日接待: {{item.todayNum}}
  29. </view>
  30. </view>
  31. </view>
  32. <view class="right">
  33. <radio :value="item.agentId" :checked="index == current" style="transform:scale(0.9)"
  34. color="#2671E2"></radio>
  35. </view>
  36. </view>
  37. </radio-group>
  38. </view>
  39. <view class="empty" v-if="freeList.length == 0">
  40. <image class="image" src="@/static/images/customerEmpty.png" mode=""></image>
  41. <view class="tips">
  42. 暂无空闲顾问
  43. </view>
  44. </view>
  45. <view v-if="freeList.length > 0" class="save" @click="save" :class="{active:chosedAgentId}">
  46. 保存
  47. </view>
  48. <u-modal v-model="show" :mask-close-able="true" :title="'代接待提醒'" :confirm-text="confirmtext"
  49. :cancel-text='canceltext' @cancel="confirmA" @confirm="confirmB" :show-cancel-button='true'
  50. :content="content"></u-modal>
  51. <!-- 加载组件 -->
  52. <u-loadings v-model="LOADING"></u-loadings>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. customerId: '',
  60. buildingID: '',
  61. freeList: [],
  62. current: null,
  63. chosedAgentId: '',
  64. textcdhSKJ: '',
  65. show: false,
  66. content: '',
  67. confirmtext: '', //确认文字
  68. canceltext: '', //取消文字
  69. daitiReceptionobj: {},
  70. replaceReception: 0,
  71. keywords: '', // 关键词
  72. list: [], // 部门列表
  73. listCurrent: 0, //选中分类下标
  74. from: '', // 来源页面需要通知的事件
  75. }
  76. },
  77. computed: {
  78. isShowBtn() {
  79. return this.list.length > 0
  80. }
  81. },
  82. onLoad(option) {
  83. this.LOADING = true
  84. this.freeList = []
  85. if (option.id) this.customerId = option.id;
  86. if (option.from) this.from = option.from
  87. if (option.chosedAgentId) this.chosedAgentId = option.chosedAgentId
  88. },
  89. async onShow() {
  90. this.buildingID = uni.getStorageSync('buildingID').id;
  91. await this.iniPage()
  92. },
  93. methods: {
  94. change(e) {
  95. console.log(e)
  96. this.keywords = ''
  97. this.listCurrent = Number(e)
  98. this.getFreeList();
  99. },
  100. //
  101. searchFunc() {
  102. this.getFreeList();
  103. },
  104. async iniPage() {
  105. await this.getAllDeptName()
  106. await this.getFreeList();
  107. },
  108. // 获取顾问列表
  109. async getAllDeptName() {
  110. try {
  111. let res = await this.$u.get(`/zkAgentPool/getAllDeptName?itemId=${this.buildingID}`)
  112. console.log(res)
  113. if (res && res.length > 0) {
  114. res.unshift({
  115. deptId: '',
  116. deptName: '全部'
  117. })
  118. this.list = res
  119. }
  120. } catch (e) {
  121. console.log(e)
  122. }
  123. },
  124. // 获取空闲顾问
  125. async getFreeList() {
  126. try {
  127. let deptId = this.list.length > 0 ? this.list[this.listCurrent].deptId : ''
  128. // deptId 部门id
  129. // name 顾问名称"
  130. let res = await this.$u.get(
  131. `/zkAgentPool/freeList?itemId=${this.buildingID}&name=${this.keywords||''}&deptId=${deptId}`
  132. )
  133. if (res.length == 0) {
  134. this.freeList = []
  135. } else {
  136. // 回显上次选中的顾问
  137. if (this.from != '' && this.id != '') {
  138. this.current = res.findIndex(item => item.agentId == this.customerId)
  139. }
  140. this.freeList = res;
  141. this.freeList.forEach(item => {
  142. if (item.onLine == 0) {
  143. item.label = "(离线)";
  144. item.class = 'red'
  145. } else if (item.onLine == 1) {
  146. item.label = "(在线)";
  147. item.class = 'gren'
  148. } else {
  149. item.label = "(无设备)";
  150. item.class = 'none'
  151. }
  152. })
  153. this.textcdhSKJ = res[0].name
  154. }
  155. this.LOADING = false
  156. } catch (e) {
  157. this.LOADING = false
  158. }
  159. },
  160. //取消
  161. confirmA() {
  162. if (this.daitiReceptionobj.assign != null) {
  163. this.baochunfun()
  164. } else {
  165. uni.showToast({
  166. icon: "none",
  167. title: "【" + this.daitiReceptionobj.owner.name + "】正在接待中"
  168. })
  169. return;
  170. }
  171. },
  172. // 确认
  173. confirmB() {
  174. this.replaceReception = 1;
  175. this.baochunfun()
  176. },
  177. save() {
  178. console.log(this.chosedAgentId)
  179. if (!this.chosedAgentId) {
  180. uni.showToast({
  181. icon: "none",
  182. title: "未选择指派顾问"
  183. })
  184. return
  185. }
  186. // 如果是从其他页面跳转过来的
  187. if (this.from) {
  188. uni.$emit(this.from, this.chosedAgentId)
  189. uni.navigateBack()
  190. return
  191. }
  192. const that = this;
  193. this.$u.post("customer/daitiReception", {
  194. agentId: that.chosedAgentId,
  195. id: that.customerId,
  196. projectId: this.buildingID
  197. }).then(res => {
  198. if (res.unchecked == 0) {
  199. that.baochunfun()
  200. } else {
  201. if (res.zs == 0) {
  202. that.baochunfun()
  203. } else {
  204. if (res.assign == null && res.replacement == null) {
  205. that.baochunfun()
  206. } else {
  207. if (res.assign == null) {
  208. that.daitiReceptionobj = res;
  209. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  210. "】代接待吗?"
  211. that.confirmtext = res.replacement.name + "代接待", //确认文字
  212. that.canceltext = res.owner.name + '接待', //取消文字
  213. that.show = true;
  214. } else {
  215. that.daitiReceptionobj = res;
  216. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  217. "】代接待吗?"
  218. that.confirmtext = res.replacement.name + "代接待", //确认文字
  219. that.canceltext = res.assign.name + '接待', //取消文字
  220. that.show = true;
  221. }
  222. }
  223. }
  224. }
  225. });
  226. },
  227. baochunfun() {
  228. uni.showLoading({
  229. title: "保存中",
  230. mask: true
  231. })
  232. const that = this;
  233. this.$u.post("customer/assign", {
  234. agentId: that.chosedAgentId,
  235. id: that.customerId,
  236. replaceReception: this.replaceReception
  237. }).then(res => {
  238. uni.showToast({
  239. icon: "none",
  240. title: "分配成功"
  241. })
  242. uni.navigateBack();
  243. uni.hideLoading();
  244. });
  245. },
  246. radioChange(evt) {
  247. this.chosedAgentId = '';
  248. this.chosedAgentId = evt.detail.value;
  249. },
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. .empty {
  255. flex: 1;
  256. display: flex;
  257. flex-direction: column;
  258. justify-content: center;
  259. align-items: center;
  260. .image {
  261. width: 478rpx;
  262. height: 478rpx;
  263. }
  264. .tips {
  265. font-size: 36rpx;
  266. color: #242424;
  267. line-height: 1;
  268. margin-top: 50rpx;
  269. }
  270. }
  271. .save {
  272. position: fixed;
  273. width: calc(100vw - 60rpx);
  274. bottom: 50rpx;
  275. left: 30rpx;
  276. color: #FFFFFF;
  277. font-size: 30rpx;
  278. height: 98rpx;
  279. border-radius: 8rpx;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. background: rgba(42, 111, 255, 1);
  284. }
  285. .box {
  286. background: #F8F8F8;
  287. width: 100%;
  288. height: 100%;
  289. font-size: 30rpx;
  290. font-weight: 400;
  291. .nextcon {
  292. position: sticky;
  293. top: 0;
  294. z-index: 9999;
  295. flex-shrink: 0;
  296. height: 78rpx;
  297. background: #F4F8FD;
  298. color: #2671E2;
  299. text-align: center;
  300. line-height: 78rpx;
  301. }
  302. .search-tag {
  303. position: sticky;
  304. top: 78rpx;
  305. z-index: 9999;
  306. margin: 0 0 20rpx 0;
  307. padding: 30rpx;
  308. background: #fff;
  309. }
  310. .pdBtm {
  311. padding: 30rpx 30rpx 0;
  312. }
  313. .content {
  314. flex-grow: 1;
  315. display: flex;
  316. flex-direction: column;
  317. .content-tips {
  318. display: flex;
  319. justify-content: space-between;
  320. background: #fff;
  321. padding: 0 30rpx;
  322. height: 148rpx;
  323. margin-bottom: 20rpx;
  324. .left {
  325. display: flex;
  326. margin-top: 30rpx;
  327. .img {
  328. width: 72rpx;
  329. height: 72rpx;
  330. background: #FFFFFF;
  331. border: 1px solid #C9C9C9;
  332. line-height: 64rpx;
  333. text-align: center;
  334. border-radius: 50%;
  335. margin-right: 20rpx;
  336. }
  337. .text {
  338. .name {
  339. margin-top: 4rpx;
  340. margin-bottom: 24rpx;
  341. line-height: 30rpx;
  342. .names {
  343. font-weight: 600;
  344. color: #333333;
  345. }
  346. .red {
  347. margin-left: 10rpx;
  348. color: #E7483C;
  349. font-size: 28rpx;
  350. }
  351. .gren {
  352. margin-left: 10rpx;
  353. color: #43CD80;
  354. font-size: 28rpx;
  355. }
  356. .none {
  357. margin-left: 10rpx;
  358. color: #999;
  359. font-size: 28rpx;
  360. }
  361. }
  362. }
  363. }
  364. .right {
  365. margin: 54rpx 0;
  366. }
  367. }
  368. .empty {
  369. flex: 1;
  370. display: flex;
  371. flex-direction: column;
  372. justify-content: center;
  373. align-items: center;
  374. .image {
  375. width: 300rpx;
  376. height: 300rpx;
  377. }
  378. .tips {
  379. font-size: 36rpx;
  380. color: #242424;
  381. line-height: 1;
  382. margin-top: 50rpx;
  383. }
  384. }
  385. }
  386. }
  387. </style>