businessList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view class="content">
  3. <!-- <view class="filter-box">
  4. <u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
  5. </view> -->
  6. <u-dropdown>
  7. <u-dropdown-item v-model="applySaleFlag" :title="applyTitle" :options="applyOptions" @change="handleDropDownClick"></u-dropdown-item>
  8. </u-dropdown>
  9. <u-tabs-swiper ref="uTabs" :active-color="mainColor" :list="tabList" :current="current" @change="tabsChange"
  10. :is-scroll="false"></u-tabs-swiper>
  11. <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" class="swiper-box">
  12. <swiper-item class="swiper-item" v-for="(item, index1) in tabList" :key="index1">
  13. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
  14. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  15. @refresherrestore="onRestore">
  16. <u-card :show-head="false" :foot-border-top="false" margin="10px 15px" borderRadius="40" :foot-style="{padding: '0 10px 5px 0'}" v-for="(site, index2) in item.tableList"
  17. :key="index2" class="card-box" @click="goToOrderList(site)">
  18. <view slot="body" class="card-content">
  19. <view class="student-info">
  20. <view class="info-name">{{site.studentName}}</view>
  21. <!-- <view class="info-type" :class="site.status == 1 ? 'info-type-active' : ''">{{site.status == 0 ? '未报名' : '已报名'}}</view> -->
  22. <view class="info-name">{{site.parentName}}</view>
  23. <view class="info-phone">{{site.parentPhone}}</view>
  24. <view class="info-saleName" v-if="site.saleName!=null">{{site.saleName}}</view>
  25. </view>
  26. <!-- <u-image width="28px" height="28px" :src="site.type == 2 ? iconPath1 : iconPath2"></u-image> -->
  27. </view>
  28. <view slot="foot" style="text-align: right;">
  29. <u-button type="warning" :ripple="true" shape="circle" :custom-style="{...handleCustomStyle, marginRight: '5px'}" size="mini" @click="handleSaleShowClick(site)">分配</u-button>
  30. <u-button type="warning" :ripple="true" shape="circle" :custom-style="{...handleCustomStyle, marginRight: '5px'}" size="mini" @click="handleUpdateClick(site)">修改</u-button>
  31. <u-button type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleJumpSubscribeClick">预约体验</u-button>
  32. </view>
  33. </u-card>
  34. <u-divider v-if="item.isOver" bg-color="transparent" :style="{paddingTop : item.tableList.length == 0 ? '10px' : ''}">没有更多了</u-divider>
  35. </scroll-view>
  36. </swiper-item>
  37. </swiper>
  38. <u-icon name="plus-circle-fill" :color="mainColor" size="96" class="fix-add-icon" @click="handleThreadAddClick"></u-icon>
  39. <!-- 标签 -->
  40. <u-action-sheet :list="signList" v-model="signShow" @click="handleSetSexClick"></u-action-sheet>
  41. <!-- 销售 -->
  42. <u-action-sheet :list="saleList" v-model="saleShow" @click="handleSetSaleClick"></u-action-sheet>
  43. <u-top-tips ref="uTips"></u-top-tips>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. mapGetters
  49. } from 'vuex'
  50. const NET = require('@/utils/request')
  51. const API = require('@/config/api')
  52. export default {
  53. computed: {
  54. ...mapGetters([
  55. 'mainColor',
  56. 'customStyle',
  57. 'handleCustomStyle',
  58. 'handleDefaultCustomStyle',
  59. ])
  60. },
  61. data() {
  62. return {
  63. customerId: '',
  64. // filterText: '',
  65. applyTitle: '已分配',
  66. applySaleFlag: 1,
  67. applyOptions: [
  68. {
  69. label: '已分配',
  70. value: 1,
  71. },
  72. {
  73. label: '未分配',
  74. value: 2,
  75. }
  76. ],
  77. triggered: false,
  78. tabList: [
  79. {
  80. name: '未联系',
  81. isOver: false,
  82. pageIndex: 1,
  83. filterText: '',
  84. type: 1,
  85. tableList: [],
  86. }, {
  87. name: '有意向',
  88. isOver: false,
  89. pageIndex: 1,
  90. filterText: '',
  91. type: 2,
  92. tableList: [],
  93. }, {
  94. name: '已预约',
  95. isOver: false,
  96. pageIndex: 1,
  97. filterText: '',
  98. type: 3,
  99. tableList: [],
  100. }, {
  101. name: '商机',
  102. isOver: false,
  103. pageIndex: 1,
  104. filterText: '',
  105. type: 4,
  106. tableList: [],
  107. },{
  108. name: '无效',
  109. isOver: false,
  110. pageIndex: 1,
  111. filterText: '',
  112. type: 0,
  113. tableList: [],
  114. },],
  115. current: 0,
  116. swiperCurrent: 0,
  117. iconPath1: API.getServerImg + 'weibaoming.png',
  118. iconPath2: API.getServerImg + 'xianshangkehu.png',
  119. signShow: false,
  120. signList: [
  121. { text: '未联系', type: 1 },
  122. { text: '有意向', type: 2 },
  123. { text: '已预约', type: 3 },
  124. { text: '商机', type: 4 },
  125. { text: '无效', type: 0 }
  126. ],
  127. saleShow: false,
  128. saleList: []
  129. }
  130. },
  131. onShow() {
  132. this.getTable()
  133. },
  134. onReady() {},
  135. methods: {
  136. getTable() {
  137. this.tabList = Object.assign([], this.$options.data().tabList)
  138. this.getTableList(0)
  139. this.getTableList(1)
  140. this.getTableList(2)
  141. this.getTableList(3)
  142. this.getTableList(4)
  143. },
  144. handleDropDownClick(e) {
  145. if(e == 1) {
  146. this.applySaleFlag = 1
  147. this.applyTitle = '已分配'
  148. } else {
  149. this.applySaleFlag = 2
  150. this.applyTitle = '未分配'
  151. }
  152. this.tabList = Object.assign([], this.$options.data().tabList)
  153. this.getTable()
  154. },
  155. // 修改
  156. handleUpdateClick(item) {
  157. this.customerId = item.id
  158. this.signShow = true
  159. },
  160. // 修改线索标签
  161. handleSetSexClick(index) {
  162. // 调修改接口
  163. NET.request(API.updateCustomerState, {
  164. customerId: this.customerId,
  165. clueState: this.signList[index].type
  166. }, 'POST').then(res => {
  167. if(res.status === 10000) {
  168. this.$refs.uTips.show({
  169. title: '修改成功',
  170. type: 'success',
  171. })
  172. this.getTable()
  173. } else {
  174. this.$refs.uTips.show({
  175. title: res.msg,
  176. type: 'warning',
  177. })
  178. }
  179. })
  180. },
  181. // 分配
  182. handleSaleShowClick(item) {
  183. this.customerId = item.id
  184. // 显示销售员列表
  185. NET.request(API.findGroups, {}, 'POST').then(res => {
  186. if(res.status === 10000) {
  187. this.saleList = res.data.map( item => {
  188. return {
  189. saleId: item.memberId,
  190. text: item.memberName
  191. }
  192. })
  193. this.saleShow = true
  194. } else {
  195. this.$refs.uTips.show({
  196. title: res.msg,
  197. type: 'warning',
  198. })
  199. }
  200. })
  201. },
  202. // 分配
  203. handleSetSaleClick(index) {
  204. NET.request(API.updateCustomerState, {
  205. customerId: this.customerId,
  206. saleId: this.saleList[index].saleId
  207. }, 'POST').then(res => {
  208. if(res.status === 10000) {
  209. this.$refs.uTips.show({
  210. title: '分配成功',
  211. type: 'success',
  212. })
  213. this.getTable()
  214. } else {
  215. this.$refs.uTips.show({
  216. title: res.msg,
  217. type: 'warning',
  218. })
  219. }
  220. })
  221. },
  222. // 跳转添加信息
  223. handleThreadAddClick() {
  224. uni.navigateTo({
  225. url: '/pagesEnroll/intentionForm?type=1'
  226. });
  227. },
  228. // 跳转场馆列表
  229. handleJumpSubscribeClick() {
  230. uni.navigateTo({
  231. url: '/pagesMain/venueMore'
  232. });
  233. },
  234. // 设置过滤字段
  235. setFilterText(value) {
  236. this.tabList[this.current].filterText = value
  237. this.onRefresh()
  238. },
  239. // tab页面切换
  240. tabsChange(index) {
  241. this.swiperCurrent = index;
  242. },
  243. // swiper-item左右移动,通知tabs的滑块跟随移动
  244. transition(e) {
  245. let dx = e.detail.dx;
  246. this.$refs.uTabs.setDx(dx);
  247. },
  248. // swiper滑动结束,分别设置tabs和swiper的状态
  249. animationfinish(e) {
  250. let current = e.detail.current;
  251. this.$refs.uTabs.setFinishCurrent(current);
  252. this.swiperCurrent = current;
  253. this.current = current;
  254. },
  255. // 下拉刷新
  256. onRefresh() {
  257. if (!this.triggered) {
  258. this.triggered = true
  259. this.tabList[this.current].isOver = false
  260. this.tabList[this.current].pageIndex = 1
  261. this.tabList[this.current].tableList = []
  262. this.getTableList(this.current)
  263. }
  264. },
  265. // 重置下拉刷新状态
  266. onRestore() {
  267. this.triggered = 'restore'
  268. this.triggered = false
  269. },
  270. // 懒加载
  271. handleLoadMore() {
  272. if (!this.tabList[this.current].isOver) {
  273. this.tabList[this.current].pageIndex++
  274. this.getTableList(this.current)
  275. }
  276. },
  277. // 获取列表数据
  278. getTableList(index) {
  279. NET.request(API.getCustomerList, {
  280. isSignUp: 1,
  281. applySaleFlag: this.applySaleFlag == 1 ? true : false,
  282. name: this.tabList[index].filterText,
  283. type: this.tabList[index].type,
  284. page: this.tabList[index].pageIndex,
  285. size: 10,
  286. }, 'POST').then(res => {
  287. this.triggered = false
  288. this.tabList[index].tableList = this.tabList[index].tableList.concat(res.data.row)
  289. this.tabList[index].isOver = res.data.row.length != 10
  290. }).catch(error => {
  291. this.triggered = false
  292. this.$refs.uTips.show({
  293. title: error.msg,
  294. type: 'warning',
  295. })
  296. })
  297. },
  298. // 跳转到报名详情
  299. goToOrderList(item) {
  300. uni.navigateTo({
  301. url: `/pagesMain/customerInfo?id=${item.id}&title=线索信息`
  302. });
  303. }
  304. },
  305. }
  306. </script>
  307. <style>
  308. page {
  309. width: 100%;
  310. height: 100%;
  311. background-color: #f7f7f7;
  312. }
  313. </style>
  314. <style lang="scss" scoped>
  315. @import "@/static/css/themes.scss";
  316. .content {
  317. width: 100%;
  318. float: left;
  319. .filter-box {
  320. height: 48px;
  321. padding: 10px 15px;
  322. background-color: #FFFFFF;
  323. }
  324. .swiper-box {
  325. height: calc(100vh - 82px);
  326. .swiper-item {
  327. height: calc(100vh - 82px);
  328. .scroll-box {
  329. width: 100%;
  330. height: calc(100vh - 82px);
  331. .card-box {
  332. .card-content {
  333. display: flex;
  334. align-items: center;
  335. .student-info {
  336. flex: 1;
  337. .info-name {
  338. width: 64px;
  339. float: left;
  340. line-height: 28px;
  341. font-size: 14px;
  342. font-weight: bold;
  343. }
  344. .info-type {
  345. padding: 0 10px;
  346. margin-top: 3px;
  347. border-radius: 20px;
  348. float: left;
  349. line-height: 20px;
  350. font-size: 10px;
  351. color: #FFFFFF;
  352. background-color: #999999;
  353. }
  354. .info-type-active {
  355. background-color: $mainColor;
  356. }
  357. .info-phone {
  358. width: calc(100% - 64px);
  359. float: left;
  360. line-height: 28px;
  361. font-size: 12px;
  362. color: #999999;
  363. }
  364. .info-saleName{
  365. width: calc(100% - 64px);
  366. float: left;
  367. line-height: 28px;
  368. font-size: 12px;
  369. color: #6287d2;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. }
  376. }
  377. }
  378. .menber-box {
  379. width: 100%;
  380. // float: left;
  381. padding: 10px 15px;
  382. margin-bottom: 10px;
  383. .menber-col {
  384. width: 100%;
  385. padding: 15px;
  386. margin-bottom: 10px;
  387. display: inline-block;
  388. background-color: #FFFFFF;
  389. border-radius: 15px;
  390. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  391. position: relative;
  392. overflow: hidden;
  393. box-sizing: border-box;
  394. .menber-label {
  395. width: 100%;
  396. margin-bottom: 5px;
  397. float: left;
  398. font-size: 14px;
  399. // line-height: 20px;
  400. }
  401. .menber-num {
  402. width: 100%;
  403. float: left;
  404. font-size: 26px;
  405. line-height: 28px;
  406. color: $mainColor;
  407. }
  408. .menber-icon {
  409. font-size: 100px;
  410. color: $mainColor;
  411. position: absolute;
  412. right: -5px;
  413. bottom: -30px;
  414. opacity: 0.5;
  415. }
  416. }
  417. }
  418. .common-title {
  419. width:100%;
  420. text-align: center;
  421. font-size: 20px;
  422. margin: 10px 0;
  423. }
  424. .fix-add-icon {
  425. position: fixed;
  426. bottom: 15px;
  427. right: 15px;
  428. }
  429. </style>