axjz.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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.is_apply">
  31. <text class="fu-shenqing">资金:{{ item.amount || '暂无' }}</text>
  32. <view class="fu-shenqing">帮扶人:{{ item.is_apply.full_name }}</view>
  33. </view>
  34. <view class="fu-bottom" v-else>
  35. <view class="fu-shenqing">已有{{ item.apply_sum }}人申请</view>
  36. <!-- <text class="fu-jifen">+{{ item.integral }}积分</text> -->
  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: 100,//每次信息条数
  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. let arr = data.data.filter((e)=> {
  193. return e.cid == 11
  194. })
  195. obj.list = obj.list.concat(arr);
  196. obj.page++;
  197. if (obj.limit == data.data.length) {
  198. //判断是否还有数据, 有改为 more, 没有改为noMore
  199. obj.loadingType = 'more';
  200. return;
  201. } else {
  202. //判断是否还有数据, 有改为 more, 没有改为noMore
  203. obj.loadingType = 'noMore';
  204. }
  205. })
  206. },
  207. //一级分类点击
  208. tabtap(item,index) {
  209. let obj = this;
  210. obj.tabCurrentIndex = index
  211. obj.currentId = item;
  212. obj.page = 1;
  213. obj.loadingType = 'more';
  214. obj.list = [];
  215. obj.loadData()
  216. },
  217. tabtap1(item,index) {
  218. console.log(item)
  219. this.type = item.type;
  220. this.currentIndex = index
  221. this.page = 1;
  222. this.loadingType = 'more';
  223. this.list = [];
  224. this.loadData()
  225. },
  226. toDetail(item) {
  227. uni.navigateTo({
  228. url: '/pages/fu/fuInfo?id=' + item.id
  229. })
  230. // if ( item.is_show == 1 ) {
  231. // uni.navigateTo({
  232. // url: '/pages/fu/fuInfo?id=' + item.id
  233. // })
  234. // } else {
  235. // uni.navigateTo({
  236. // url: '/pages/fu/helpDetail?id=' + item.id
  237. // })
  238. // }
  239. },
  240. // 筛选 1-帮扶中 2-未帮扶
  241. shaixuan(i) {
  242. this.type = i;
  243. },
  244. comfim() {
  245. this.show = false;
  246. this.page = 1;
  247. this.loadingType = 'more';
  248. this.list = [];
  249. this.loadData()
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss">
  255. page {
  256. height: 100%;
  257. .container{
  258. height: 100%;
  259. }
  260. }
  261. .swiper-box {
  262. height: calc(100% - 40px);
  263. padding: 20rpx 30rpx 0 30rpx;
  264. .list-scroll-content {
  265. height: 100%;
  266. // padding-bottom: 25rpx;
  267. }
  268. }
  269. .scroll-list {
  270. width: 100%;
  271. overflow: hidden;
  272. white-space: nowrap;
  273. background-color: #FFFFFF;
  274. font-size: 32rpx;
  275. height: 40px;
  276. .scoll-box {
  277. text-align: center;
  278. display: inline-block;
  279. margin: 0rpx 38rpx;
  280. // padding: 15rpx 0rpx;
  281. .scoll-img {
  282. width: 130rpx;
  283. height: 85rpx;
  284. border-radius: 100%;
  285. image {
  286. width: 85rpx;
  287. height: 100%;
  288. border-radius: 100%;
  289. }
  290. }
  291. .scoll-name {
  292. padding-top: 15rpx;
  293. }
  294. &.active {
  295. color: $motif-color;
  296. border-bottom:6rpx solid $motif-color;
  297. }
  298. }
  299. }
  300. .fu-box {
  301. padding: 14rpx 20rpx 28rpx 20rpx;
  302. background: #FFFFFF;
  303. box-shadow: 0px 0px 40rpx 0px rgba(0, 0, 0, 0.06);
  304. border-radius: 12rpx;
  305. display: flex;
  306. align-items: center;
  307. margin-bottom: 20rpx;
  308. &:last-of-type {
  309. margin-bottom: 0;
  310. }
  311. .img-box {
  312. position: relative;
  313. }
  314. .fu-img {
  315. width: 220rpx;
  316. height: 182rpx;
  317. border-radius: 8rpx;
  318. }
  319. .fu-cname {
  320. position: absolute;
  321. top: 0;
  322. left: 0;
  323. background: #FF727E;
  324. color: #FFFFFF;
  325. padding: 0 10rpx;
  326. border-radius: 8rpx 0 8rpx 0;
  327. font-size: 24rpx;
  328. }
  329. .fu-right {
  330. margin-left: 20rpx;
  331. width: 62%;
  332. .fu-tit {
  333. overflow: hidden;
  334. text-overflow: ellipsis;
  335. white-space: nowrap;
  336. font-size: 36rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #222222;
  340. }
  341. .fu-text {
  342. margin-top: 17rpx;
  343. overflow : hidden;
  344. text-overflow: ellipsis;
  345. display: -webkit-box;
  346. -webkit-line-clamp: 2;
  347. -webkit-box-orient: vertical;
  348. font-size: $font-sm;
  349. font-family: PingFang SC;
  350. font-weight: 500;
  351. color: #666666;
  352. }
  353. .fu-bottom {
  354. margin-top: 20rpx;
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-between;
  358. .fu-shenqing {
  359. font-size: 21rpx;
  360. font-family: PingFang;
  361. font-weight: 500;
  362. color: #FF727E;
  363. }
  364. .fu-jifen {
  365. padding: 0 5rpx;
  366. border: 1px solid #FF0000;
  367. border-radius: 5rpx;
  368. font-size: 21rpx;
  369. font-family: PingFang SC;
  370. font-weight: 500;
  371. color: #FF0000;
  372. }
  373. .fu-yjs {
  374. font-size: 21rpx;
  375. font-family: PingFang;
  376. font-weight: 500;
  377. color: #999999;
  378. }
  379. .fu-sczl {
  380. padding: 5rpx 17rpx;
  381. font-size: 21rpx;
  382. font-family: PingFang SC;
  383. font-weight: 500;
  384. color: #FFFFFF;
  385. background: #FF727E;
  386. border-radius: 23rpx;
  387. }
  388. }
  389. }
  390. }
  391. .popup-box {
  392. padding: 100rpx 0 100rpx 20rpx ;
  393. .pop-bfu {
  394. display: flex;
  395. margin-bottom: 30rpx;
  396. .bfu-btn {
  397. width: 140rpx;
  398. height: 66rpx;
  399. background: #EDEDED;
  400. border: 1px solid #EDEDED;
  401. font-size: $font-base;
  402. // padding: 10rpx 30rpx;
  403. margin-right: 20rpx;
  404. color: #FF727E;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. position: relative;
  409. .btn-img {
  410. position: absolute;
  411. bottom: 0;
  412. right: 0;
  413. width: 24rpx;
  414. height: 24rpx;
  415. }
  416. }
  417. .checkBtn {
  418. border: 1px solid #FF727E;
  419. background: #FF727E;
  420. color: #FFFFFF;
  421. }
  422. }
  423. .qr-btn {
  424. margin-right: 20rpx;
  425. margin-top: 100rpx;
  426. display: flex;
  427. align-items: center;
  428. justify-content: flex-end;
  429. .btn-qr {
  430. color: #FFFFFF;
  431. background: $motif-color;
  432. font-size: $font-lg;
  433. font-weight: 500;
  434. width: 200rpx;
  435. height: 66rpx;
  436. border-radius: 33rpx;
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. }
  441. }
  442. }
  443. </style>