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.
 
 
 

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