25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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