Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

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