threadList.vue 9.3 KB

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