threadList.vue 9.5 KB

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