customerList.vue 9.5 KB

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