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.
 
 
 

351 lines
7.6 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. }
  78. },
  79. onLoad(option) {
  80. this.LOADING = true
  81. this.customerId = option.id;
  82. },
  83. async onShow() {
  84. this.buildingID = uni.getStorageSync('buildingID').id;
  85. await this.iniPage()
  86. },
  87. methods: {
  88. change(e) {
  89. console.log(e)
  90. this.keywords = ''
  91. this.listCurrent = Number(e)
  92. this.getFreeList();
  93. },
  94. //
  95. searchFunc() {
  96. },
  97. async iniPage() {
  98. await this.getAllDeptName()
  99. await this.getFreeList();
  100. },
  101. // 获取顾问列表
  102. async getAllDeptName() {
  103. try {
  104. let res = await this.$u.get(`/zkAgentPool/getAllDeptName?itemId=${this.buildingID}`)
  105. console.log(res)
  106. if (res&&res.length>0) {
  107. res.unshift({
  108. id: '',
  109. deptName: '全部'
  110. })
  111. this.list = res
  112. }
  113. } catch(e) {
  114. console.log(e)
  115. }
  116. },
  117. // 获取空闲顾问
  118. async getFreeList() {
  119. try {
  120. // deptId 部门id
  121. // name 顾问名称
  122. let res = await this.$u.get(`/zkAgentPool/freeList?itemId=${this.buildingID}&name=${this.keywords||''}&deptId=${this.list[this.listCurrent].id || ''}`)
  123. if (res.length == 0) {
  124. this.freeList = []
  125. } else {
  126. this.freeList = res;
  127. this.textcdhSKJ = res[0].name
  128. }
  129. this.LOADING = false
  130. }catch (e) {
  131. this.LOADING = false
  132. }
  133. },
  134. //取消
  135. confirmA() {
  136. if (this.daitiReceptionobj.assign != null) {
  137. this.baochunfun()
  138. } else {
  139. uni.showToast({
  140. icon: "none",
  141. title: "【" + this.daitiReceptionobj.owner.name + "】正在接待中"
  142. })
  143. return;
  144. }
  145. },
  146. // 确认
  147. confirmB() {
  148. this.replaceReception = 1;
  149. this.baochunfun()
  150. },
  151. save() {
  152. console.log(this.chosedAgentId)
  153. if (!this.chosedAgentId) {
  154. uni.showToast({
  155. icon: "none",
  156. title: "未选择指派顾问"
  157. })
  158. return
  159. }
  160. const that = this;
  161. this.$u.post("customer/daitiReception", {
  162. agentId: that.chosedAgentId,
  163. id: that.customerId
  164. }).then(res => {
  165. if (res.unchecked == 0) {
  166. that.baochunfun()
  167. } else {
  168. if (res.zs == 0) {
  169. that.baochunfun()
  170. } else {
  171. if (res.assign == null && res.replacement == null) {
  172. that.baochunfun()
  173. } else {
  174. if (res.assign == null) {
  175. that.daitiReceptionobj = res;
  176. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  177. "】代接待吗?"
  178. that.confirmtext = res.replacement.name + "代接待", //确认文字
  179. that.canceltext = res.owner.name + '接待', //取消文字
  180. that.show = true;
  181. } else {
  182. that.daitiReceptionobj = res;
  183. that.content = "此客户的顾问为【" + res.owner.name + "】,确认让【" + res.replacement.name +
  184. "】代接待吗?"
  185. that.confirmtext = res.replacement.name + "代接待", //确认文字
  186. that.canceltext = res.assign.name + '接待', //取消文字
  187. that.show = true;
  188. }
  189. }
  190. }
  191. }
  192. });
  193. },
  194. baochunfun() {
  195. uni.showLoading({
  196. title: "保存中",
  197. mask: true
  198. })
  199. const that = this;
  200. this.$u.post("customer/assign", {
  201. agentId: that.chosedAgentId,
  202. id: that.customerId,
  203. replaceReception: this.replaceReception
  204. }).then(res => {
  205. uni.showToast({
  206. icon: "none",
  207. title: "分配成功"
  208. })
  209. uni.navigateBack();
  210. uni.hideLoading();
  211. });
  212. },
  213. radioChange(evt) {
  214. this.chosedAgentId = '';
  215. this.chosedAgentId = evt.detail.value;
  216. },
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .box {
  222. background: #F8F8F8;
  223. width: 100%;
  224. min-height: calc(100vh - var(--window-top));
  225. display: flex;
  226. flex-direction: column;
  227. font-size: 30rpx;
  228. font-weight: 400;
  229. .nextcon {
  230. flex-shrink: 0;
  231. height: 78rpx;
  232. background: #F4F8FD;
  233. color: #2671E2;
  234. text-align: center;
  235. line-height: 78rpx;
  236. }
  237. .search-tag {
  238. margin: 0 0 20rpx 0;
  239. padding: 30rpx 30rpx 0;
  240. background: #fff;
  241. .tabs-box {
  242. background: #fff;
  243. }
  244. }
  245. .content {
  246. flex-grow: 1;
  247. display: flex;
  248. flex-direction: column;
  249. .content-tips {
  250. display: flex;
  251. justify-content: space-between;
  252. background: #fff;
  253. padding: 0 30rpx;
  254. height: 148rpx;
  255. margin-bottom: 20rpx;
  256. .left {
  257. display: flex;
  258. margin-top: 30rpx;
  259. .img {
  260. width: 72rpx;
  261. height: 72rpx;
  262. background: #FFFFFF;
  263. border: 1px solid #C9C9C9;
  264. line-height: 64rpx;
  265. text-align: center;
  266. border-radius: 50%;
  267. margin-right: 20rpx;
  268. }
  269. .text {
  270. .name {
  271. margin-top: 4rpx;
  272. font-weight: 600;
  273. color: #333333;
  274. line-height: 30rpx;
  275. margin-bottom: 24rpx;
  276. }
  277. }
  278. }
  279. .right {
  280. margin: 54rpx 0;
  281. }
  282. }
  283. .empty {
  284. flex: 1;
  285. display: flex;
  286. flex-direction: column;
  287. justify-content: center;
  288. align-items: center;
  289. .image {
  290. width: 300rpx;
  291. height: 300rpx;
  292. }
  293. .tips {
  294. font-size: 36rpx;
  295. color: #242424;
  296. line-height: 1;
  297. margin-top: 50rpx;
  298. }
  299. }
  300. }
  301. .save {
  302. position: sticky;
  303. bottom: 50rpx;
  304. z-index: 10;
  305. flex-shrink: 0;
  306. margin: 50rpx auto;
  307. width: calc(100vw - 60rpx);
  308. color: #FFFFFF;
  309. font-size: 30rpx;
  310. height: 98rpx;
  311. border-radius: 8rpx;
  312. display: flex;
  313. justify-content: center;
  314. align-items: center;
  315. background: rgba(42, 111, 255, 1);
  316. }
  317. }
  318. </style>