axjz.vue 11 KB

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