axjz.vue 9.4 KB

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