threadList.vue 9.5 KB

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