您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

326 行
7.0 KiB

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