axjz.vue 9.6 KB

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