axjz.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view class="container">
  3. <scroll-view class="scroll-list" scroll-x style="margin-bottom: 10rpx;">
  4. <view class="scoll-box" v-for="(itemz,indez) in navList" :key="indez" :class="{ active: indez == currentIndex }" @click="tabtap1(itemz,indez)">
  5. <view class="scoll-name">{{ itemz.name }}</view>
  6. </view>
  7. </scroll-view>
  8. <scroll-view class="scroll-list" scroll-x>
  9. <view class="scoll-box" v-for="(ls,index) in cationList" :key="index" :class="{ active: index === tabCurrentIndex }" @click="tabtap(ls.id,index)">
  10. <view class="scoll-name">{{ ls.name }}</view>
  11. </view>
  12. </scroll-view>
  13. <swiper class="swiper-box" duration="300" @change="changeTab">
  14. <swiper-item class="tab-content">
  15. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  16. <!-- 空白页 -->
  17. <empty v-if="list.length === 0"></empty>
  18. <!-- 订单列表 -->
  19. <view >
  20. <view class="fu-box" v-for='(item, index) in list' :key="index" @click="toDetail(item)">
  21. <view class="img-box">
  22. <image class="fu-img" :src="baseURL + item.userimage" mode="aspectFill"></image>
  23. <text class="fu-cname">{{ item.category }}</text>
  24. </view>
  25. <view class="fu-right">
  26. <view>
  27. <view class="fu-tit">{{ item.title }}</view>
  28. <view class="fu-text">{{ item.info }}</view>
  29. </view>
  30. <view class="fu-bottom" v-if="item.apply_user_id == 0">
  31. <view class="fu-shenqing">已有{{ item.apply_sum }}人申请</view>
  32. <text class="fu-jifen">+{{ item.integral }}积分</text>
  33. </view>
  34. <view class="fu-bottom" v-else>
  35. <text class="fu-shenqing">资金:{{ item.amount || '暂无' }}</text>
  36. <view class="fu-shenqing">帮扶人:{{ item.apply_user.full_name }}</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <uni-load-more :status="loadingType"></uni-load-more>
  42. </scroll-view>
  43. </swiper-item>
  44. </swiper>
  45. <u-popup v-model="show" mode="right">
  46. <view class="popup-box">
  47. <view class="pop-bfu">
  48. <view class="bfu-btn" :class="{'checkBtn': type == 1 }" @click="shaixuan(1)">
  49. 未帮扶
  50. <image class="btn-img" v-if="type == 1" src="../../static/images/icon_pick.png"></image>
  51. </view>
  52. <view class="bfu-btn" :class="{'checkBtn': type == 2}" @click="shaixuan(2)">
  53. 帮扶中
  54. <image class="btn-img" v-if="type == 2" src="../../static/images/icon_pick.png"></image>
  55. </view>
  56. <view class="bfu-btn" :class="{'checkBtn': type == 3 }" @click="shaixuan(3)">
  57. 公示中
  58. <image class="btn-img" v-if="type == 3" src="../../static/images/icon_pick.png"></image>
  59. </view>
  60. </view>
  61. <view class="pop-bfu">
  62. <view class="bfu-btn" :class="{'checkBtn': type == 4 }" @click="shaixuan(4)">
  63. 已完结
  64. <image class="btn-img" v-if="type == 4" src="../../static/images/icon_pick.png"></image>
  65. </view>
  66. </view>
  67. <view class="qr-btn">
  68. <text class="btn-qr" @click="comfim">确认</text>
  69. </view>
  70. </view>
  71. </u-popup>
  72. </view>
  73. </template>
  74. <script>
  75. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  76. import empty from '@/components/empty';
  77. import { getHelpList, getHelpIfy } from '@/api/help.js'
  78. import { one_help, } from '@/api/index.js';
  79. import { getUserInfo } from '@/api/login.js';
  80. import { getList } from '@/api/applyHelp.js';
  81. import {
  82. mapState,
  83. mapMutations
  84. } from 'vuex';
  85. // import { map}
  86. export default {
  87. components: {
  88. uniLoadMore,
  89. empty,
  90. },
  91. data() {
  92. return {
  93. currentIndex: 0,
  94. navList: [{
  95. name: '未帮扶',
  96. type: 1
  97. },
  98. {
  99. name: '帮扶中',
  100. type: 2
  101. },
  102. {
  103. name: '公示中',
  104. type: 3
  105. },
  106. {
  107. name: '已完结',
  108. type: 4
  109. }
  110. ],
  111. category_id: 0,
  112. tabCurrentIndex:0,
  113. page: 1, //当前页数
  114. limit: 10,//每次信息条数
  115. loadingType: 'more',
  116. list: [],
  117. userInfo:'',
  118. keyword:'',
  119. money:'',//捐款金额
  120. integral:'',//捐款积分
  121. cationList: [{name:'全部',id: 0}], // 分类列表
  122. currentId:0,
  123. show: false, // 弹窗开关
  124. type: 1, // 筛选条件 1-帮扶中 2-未帮扶 3-公示中 4-已完成
  125. };
  126. },
  127. onLoad() {
  128. this.getHelpIfy();
  129. },
  130. onShow() {
  131. this.page = 1;
  132. this.loadingType = 'more';
  133. this.list = [];
  134. this.loadData();
  135. },
  136. computed: {
  137. ...mapState(['baseURL'])
  138. },
  139. // 搜索按钮点击
  140. onNavigationBarButtonTap() {
  141. this.show = true;
  142. },
  143. watch:{
  144. // keyword(n, o){
  145. // this.keyword = n;
  146. // this.loadData();
  147. // },
  148. },
  149. methods: {
  150. // 获取帮扶分类
  151. getHelpIfy() {
  152. getHelpIfy().then( ({data}) => {
  153. this.cationList = this.cationList.concat(data)
  154. // this.currentId = this.cationList[0].id
  155. // this.loadData()
  156. })
  157. },
  158. // GetCation(){
  159. // let obj = this;
  160. // getList({})
  161. // .then(({ data }) => {
  162. // let res =[{
  163. // cate_name:'全部',
  164. // id:0
  165. // }]
  166. // res.unshift(0,0);
  167. // Array.prototype.splice.apply(data,res);
  168. // obj.cationList = data;
  169. // })
  170. // .catch(err => {
  171. // console.log(err);
  172. // });
  173. // },
  174. //获取订单列表
  175. loadData() {
  176. let obj = this;
  177. if (obj.loadingType === 'noMore') {
  178. //防止重复加载
  179. return;
  180. }
  181. // 修改当前对象状态为加载中
  182. obj.loadingType = 'loading';
  183. getHelpList({
  184. page:obj.page,
  185. limit:obj.limit,
  186. // isrec:obj.type,
  187. category_id: obj.currentId,
  188. status: obj.type
  189. })
  190. .then(data => {
  191. console.log(data.data)
  192. obj.list = obj.list.concat(data.data);
  193. obj.page++;
  194. if (obj.limit == data.data.length) {
  195. //判断是否还有数据, 有改为 more, 没有改为noMore
  196. obj.loadingType = 'more';
  197. return;
  198. } else {
  199. //判断是否还有数据, 有改为 more, 没有改为noMore
  200. obj.loadingType = 'noMore';
  201. }
  202. })
  203. },
  204. //一级分类点击
  205. tabtap(item,index) {
  206. let obj = this;
  207. obj.tabCurrentIndex = index
  208. obj.currentId = item;
  209. obj.page = 1;
  210. obj.loadingType = 'more';
  211. obj.list = [];
  212. obj.loadData()
  213. },
  214. tabtap1(item,index) {
  215. console.log(item)
  216. this.type = item.type;
  217. this.currentIndex = index
  218. this.page = 1;
  219. this.loadingType = 'more';
  220. this.list = [];
  221. this.loadData()
  222. },
  223. toDetail(item) {
  224. uni.navigateTo({
  225. url: '/pages/fu/fuInfo?id=' + item.id
  226. })
  227. // if ( item.is_show == 1 ) {
  228. // uni.navigateTo({
  229. // url: '/pages/fu/fuInfo?id=' + item.id
  230. // })
  231. // } else {
  232. // uni.navigateTo({
  233. // url: '/pages/fu/helpDetail?id=' + item.id
  234. // })
  235. // }
  236. },
  237. // 筛选 1-帮扶中 2-未帮扶
  238. shaixuan(i) {
  239. this.type = i;
  240. },
  241. comfim() {
  242. this.show = false;
  243. this.page = 1;
  244. this.loadingType = 'more';
  245. this.list = [];
  246. this.loadData()
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="scss">
  252. page {
  253. height: 100%;
  254. .container{
  255. height: 100%;
  256. }
  257. }
  258. .swiper-box {
  259. height: calc(100% - 40px);
  260. padding: 20rpx 30rpx 0 30rpx;
  261. .list-scroll-content {
  262. height: 100%;
  263. // padding-bottom: 25rpx;
  264. }
  265. }
  266. .scroll-list {
  267. width: 100%;
  268. overflow: hidden;
  269. white-space: nowrap;
  270. background-color: #FFFFFF;
  271. font-size: 32rpx;
  272. height: 40px;
  273. .scoll-box {
  274. text-align: center;
  275. display: inline-block;
  276. margin: 0rpx 38rpx;
  277. // padding: 15rpx 0rpx;
  278. .scoll-img {
  279. width: 130rpx;
  280. height: 85rpx;
  281. border-radius: 100%;
  282. image {
  283. width: 85rpx;
  284. height: 100%;
  285. border-radius: 100%;
  286. }
  287. }
  288. .scoll-name {
  289. padding-top: 15rpx;
  290. }
  291. &.active {
  292. color: $motif-color;
  293. border-bottom:6rpx solid $motif-color;
  294. }
  295. }
  296. }
  297. .fu-box {
  298. padding: 14rpx 20rpx 28rpx 20rpx;
  299. background: #FFFFFF;
  300. box-shadow: 0px 0px 40rpx 0px rgba(0, 0, 0, 0.06);
  301. border-radius: 12rpx;
  302. display: flex;
  303. align-items: center;
  304. margin-bottom: 20rpx;
  305. &:last-of-type {
  306. margin-bottom: 0;
  307. }
  308. .img-box {
  309. position: relative;
  310. }
  311. .fu-img {
  312. width: 220rpx;
  313. height: 182rpx;
  314. border-radius: 8rpx;
  315. }
  316. .fu-cname {
  317. position: absolute;
  318. top: 0;
  319. left: 0;
  320. background: #FF727E;
  321. color: #FFFFFF;
  322. padding: 0 10rpx;
  323. border-radius: 8rpx 0 8rpx 0;
  324. font-size: 24rpx;
  325. }
  326. .fu-right {
  327. margin-left: 20rpx;
  328. width: 62%;
  329. .fu-tit {
  330. overflow: hidden;
  331. text-overflow: ellipsis;
  332. white-space: nowrap;
  333. font-size: 36rpx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #222222;
  337. }
  338. .fu-text {
  339. margin-top: 17rpx;
  340. overflow : hidden;
  341. text-overflow: ellipsis;
  342. display: -webkit-box;
  343. -webkit-line-clamp: 2;
  344. -webkit-box-orient: vertical;
  345. font-size: $font-sm;
  346. font-family: PingFang SC;
  347. font-weight: 500;
  348. color: #666666;
  349. }
  350. .fu-bottom {
  351. margin-top: 20rpx;
  352. display: flex;
  353. align-items: center;
  354. justify-content: space-between;
  355. .fu-shenqing {
  356. font-size: 21rpx;
  357. font-family: PingFang;
  358. font-weight: 500;
  359. color: #FF727E;
  360. }
  361. .fu-jifen {
  362. padding: 0 5rpx;
  363. border: 1px solid #FF0000;
  364. border-radius: 5rpx;
  365. font-size: 21rpx;
  366. font-family: PingFang SC;
  367. font-weight: 500;
  368. color: #FF0000;
  369. }
  370. .fu-yjs {
  371. font-size: 21rpx;
  372. font-family: PingFang;
  373. font-weight: 500;
  374. color: #999999;
  375. }
  376. .fu-sczl {
  377. padding: 5rpx 17rpx;
  378. font-size: 21rpx;
  379. font-family: PingFang SC;
  380. font-weight: 500;
  381. color: #FFFFFF;
  382. background: #FF727E;
  383. border-radius: 23rpx;
  384. }
  385. }
  386. }
  387. }
  388. .popup-box {
  389. padding: 100rpx 0 100rpx 20rpx ;
  390. .pop-bfu {
  391. display: flex;
  392. margin-bottom: 30rpx;
  393. .bfu-btn {
  394. width: 140rpx;
  395. height: 66rpx;
  396. background: #EDEDED;
  397. border: 1px solid #EDEDED;
  398. font-size: $font-base;
  399. // padding: 10rpx 30rpx;
  400. margin-right: 20rpx;
  401. color: #FF727E;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. position: relative;
  406. .btn-img {
  407. position: absolute;
  408. bottom: 0;
  409. right: 0;
  410. width: 24rpx;
  411. height: 24rpx;
  412. }
  413. }
  414. .checkBtn {
  415. border: 1px solid #FF727E;
  416. background: #FF727E;
  417. color: #FFFFFF;
  418. }
  419. }
  420. .qr-btn {
  421. margin-right: 20rpx;
  422. margin-top: 100rpx;
  423. display: flex;
  424. align-items: center;
  425. justify-content: flex-end;
  426. .btn-qr {
  427. color: #FFFFFF;
  428. background: $motif-color;
  429. font-size: $font-lg;
  430. font-weight: 500;
  431. width: 200rpx;
  432. height: 66rpx;
  433. border-radius: 33rpx;
  434. display: flex;
  435. align-items: center;
  436. justify-content: center;
  437. }
  438. }
  439. }
  440. </style>