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.
 
 
 

365 lines
8.0 KiB

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