giftApply.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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">
  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. <text class="info-name">{{ site.venueName }}</text>
  20. </view>
  21. <view class="info-phone">{{ site.className }}</view>
  22. <view class="info-phone">{{ getStatus(site.approvalStatus) }}</view>
  23. <view style="width: 100%;" v-if="site.giftType == 1">
  24. <text class="info-phone" style="margin-right: 10px;">{{ site.giftTypeName }}</text>
  25. <text class="info-phone">{{ site.giftName }}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view slot="foot" style="text-align: right;"v-if="site.giftType == 0" >
  30. <u-button type="warning" :ripple="true" shape="circle" :custom-style="{...handleCustomStyle, marginRight: '5px'}" size="mini" @click="handleGiveClick(site.venueId)">赠送</u-button>
  31. <u-button type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleNoGiveClick">不送</u-button>
  32. </view>
  33. </u-card>
  34. <u-divider v-if="item.isOver" bg-color="transparent" :style="{paddingTop : item.tableList.length == 0 ? '10px' : ''}">没有更多了</u-divider>
  35. </scroll-view>
  36. </swiper-item>
  37. </swiper>
  38. <!-- 礼物数据 -->
  39. <u-popup v-model="giftShow" mode="center" border-radius="30" width="600rpx" height="500px" >
  40. <view class="common-title">礼物</view>
  41. <view class="menber-box" style="overflow-y: auto;height:390px;">
  42. <view @click="handleOneClick"></view>
  43. </view>
  44. <view class="button-box">
  45. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="recordShow = false">确定</u-button>
  46. </view>
  47. </u-popup>
  48. <!-- 一级礼物 -->
  49. <u-action-sheet :list="oneList" v-model="oneShow" @click="handleSetOneClick"></u-action-sheet>
  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. venueId: '',
  71. // filterText: '',
  72. triggered: false,
  73. tabList: [
  74. {
  75. name: '未赠送',
  76. isOver: false,
  77. pageIndex: 1,
  78. filterText: '',
  79. tableList: [],
  80. }, {
  81. name: '已赠送',
  82. isOver: false,
  83. pageIndex: 1,
  84. filterText: '',
  85. tableList: [],
  86. }, {
  87. name: '不赠送',
  88. isOver: false,
  89. pageIndex: 1,
  90. filterText: '',
  91. tableList: [],
  92. }],
  93. current: 0,
  94. swiperCurrent: 0,
  95. giftShow: false,
  96. oneShow: false,
  97. oneList: [],
  98. }
  99. },
  100. onShow() {
  101. this.getData()
  102. },
  103. computed: {
  104. getStatus() {
  105. return function(index) {
  106. switch (index) {
  107. case 0:
  108. return '待审批'
  109. case 1:
  110. return '审批通过'
  111. case 2:
  112. return '提交'
  113. }
  114. }
  115. }
  116. },
  117. methods: {
  118. getData() {
  119. this.tabList = Object.assign([], this.$options.data().tabList)
  120. this.getTableList(0)
  121. this.getTableList(1)
  122. this.getTableList(2)
  123. },
  124. handleGiveClick(id) {
  125. this.giftShow = true
  126. this.venueId = id
  127. },
  128. handleOneClick() {
  129. NET.request(API.findVenueGiftOneListudentPage, {
  130. id: thisvenueId
  131. }, 'POST').then(res => {
  132. console.log(res);
  133. })
  134. },
  135. // 赠送
  136. handleJumpGiftInfoClick(id) {
  137. uni.navigateTo({
  138. url: `/pagesMain/giftInfo?id=${id}`
  139. })
  140. },
  141. // 不送
  142. handleNoGiveClick() {
  143. console.log('不送');
  144. },
  145. // 获取列表数据
  146. getTableList(index) {
  147. NET.request(API.giftStudentPage, {
  148. giftType: index,
  149. name: this.tabList[index].filterText,
  150. page: this.tabList[index].pageIndex,
  151. size: 10,
  152. }, 'POST').then(res => {
  153. this.triggered = false
  154. this.tabList[index].tableList = this.tabList[index].tableList.concat(res.data.row)
  155. this.tabList[index].isOver = res.data.row.length != 10
  156. }).catch(error => {
  157. this.triggered = false
  158. this.$refs.uTips.show({
  159. title: error.msg,
  160. type: 'warning',
  161. })
  162. })
  163. },
  164. // 设置过滤字段
  165. setFilterText(value) {
  166. this.tabList[this.current].filterText = value
  167. this.onRefresh()
  168. },
  169. // tab页面切换
  170. tabsChange(index) {
  171. this.swiperCurrent = index;
  172. },
  173. // swiper-item左右移动,通知tabs的滑块跟随移动
  174. transition(e) {
  175. let dx = e.detail.dx;
  176. this.$refs.uTabs.setDx(dx);
  177. },
  178. // swiper滑动结束,分别设置tabs和swiper的状态
  179. animationfinish(e) {
  180. let current = e.detail.current;
  181. this.$refs.uTabs.setFinishCurrent(current);
  182. this.swiperCurrent = current;
  183. this.current = current;
  184. },
  185. // 下拉刷新
  186. onRefresh() {
  187. if (!this.triggered) {
  188. this.triggered = true
  189. this.tabList[this.current].isOver = false
  190. this.tabList[this.current].pageIndex = 1
  191. this.tabList[this.current].tableList = []
  192. this.getTableList(this.current)
  193. }
  194. },
  195. // 重置下拉刷新状态
  196. onRestore() {
  197. this.triggered = 'restore'
  198. this.triggered = false
  199. },
  200. // 懒加载
  201. handleLoadMore() {
  202. if (!this.tabList[this.current].isOver) {
  203. this.tabList[this.current].pageIndex++
  204. this.getTableList(this.current)
  205. }
  206. }
  207. },
  208. }
  209. </script>
  210. <style>
  211. page {
  212. width: 100%;
  213. height: 100%;
  214. background-color: #f7f7f7;
  215. }
  216. </style>
  217. <style lang="scss" scoped>
  218. @import "@/static/css/themes.scss";
  219. .content {
  220. width: 100%;
  221. float: left;
  222. .filter-box {
  223. height: 48px;
  224. padding: 10px 15px;
  225. background-color: #FFFFFF;
  226. }
  227. .swiper-box {
  228. height: calc(100vh - 82px);
  229. .swiper-item {
  230. height: calc(100vh - 82px);
  231. .scroll-box {
  232. width: 100%;
  233. height: calc(100vh - 82px);
  234. .card-box {
  235. .card-content {
  236. display: flex;
  237. align-items: center;
  238. .student-info {
  239. flex: 1;
  240. .info-name {
  241. // width: 64px;
  242. // float: left;
  243. line-height: 28px;
  244. font-size: 14px;
  245. font-weight: bold;
  246. }
  247. .info-type {
  248. padding: 0 10px;
  249. margin-top: 3px;
  250. border-radius: 20px;
  251. float: left;
  252. line-height: 20px;
  253. font-size: 10px;
  254. color: #FFFFFF;
  255. background-color: #999999;
  256. }
  257. .info-type-active {
  258. background-color: $mainColor;
  259. }
  260. .info-phone {
  261. // float: left;
  262. line-height: 28px;
  263. font-size: 12px;
  264. color: #999999;
  265. }
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. .menber-box {
  274. width: 100%;
  275. // float: left;
  276. padding: 10px 15px;
  277. margin-bottom: 10px;
  278. .menber-col {
  279. width: 100%;
  280. padding: 15px;
  281. margin-bottom: 10px;
  282. display: inline-block;
  283. background-color: #FFFFFF;
  284. border-radius: 15px;
  285. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  286. position: relative;
  287. overflow: hidden;
  288. box-sizing: border-box;
  289. .menber-label {
  290. width: 100%;
  291. margin-bottom: 5px;
  292. float: left;
  293. font-size: 14px;
  294. // line-height: 20px;
  295. }
  296. .menber-num {
  297. width: 100%;
  298. float: left;
  299. font-size: 26px;
  300. line-height: 28px;
  301. color: $mainColor;
  302. }
  303. .menber-icon {
  304. font-size: 100px;
  305. color: $mainColor;
  306. position: absolute;
  307. right: -5px;
  308. bottom: -30px;
  309. opacity: 0.5;
  310. }
  311. }
  312. }
  313. .common-title {
  314. width:100%;
  315. text-align: center;
  316. font-size: 20px;
  317. margin: 10px 0;
  318. }
  319. .fix-add-icon {
  320. position: fixed;
  321. bottom: 15px;
  322. right: 15px;
  323. }
  324. .button-box {
  325. // width: 100%;
  326. padding: 10px 15px;
  327. box-sizing: border-box;
  328. }
  329. </style>