customerList.vue 9.1 KB

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