businessList.vue 11 KB

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