axjz.vue 10 KB

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