axjz.vue 9.4 KB

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