index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <view class="main">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="class-box">
  5. <view class="box" v-for="(item,index) in classList" :key="index" @click="goPage(item.url,item.method,item.needLogin)">
  6. <image class="icon" mode="heightFix" :src="item.imgPath"></image>
  7. <view class="text">{{item.text}}</view>
  8. </view>
  9. </view>
  10. <!-- <view class="project-list">
  11. <view class="list-title">
  12. <text>帮扶项目</text>
  13. <view class="right">
  14. <text>查看更多</text>
  15. <text class="right-icon iconfont">&#xe6c7;</text>
  16. </view>
  17. </view>
  18. <view class="list">
  19. <view class="item" v-for="(item,index) in 2" :key="index">
  20. <view class="left">
  21. <view class="title-box">
  22. <image class="tag" mode="aspectFit" src="/static/common/tag4.png"></image>
  23. <text>秭归大脐橙箱装10kg/箱</text>
  24. </view>
  25. <view class="desc">
  26. 帮扶细节说明帮扶细节说明帮扶细节说明帮扶 细节说明帮扶细节说明
  27. </view>
  28. </view>
  29. <image class="cover" mode="aspectFit" :src="index==0?'/static/test/test5.png':'/static/test/test6.png'"></image>
  30. </view>
  31. </view>
  32. </view> -->
  33. <image @click="publicDonation()" mode="widthFix" class="donation-entrance" src="/static/publicWelfare/donationEntrance.png"></image>
  34. <view class="moudle">
  35. <view class="title-box">
  36. <text class="title">积分捐赠</text>
  37. <view class="line"></view>
  38. <text class="tip">捐赠积分获证书</text>
  39. </view>
  40. <scroll-view scroll-x class="list2" scroll-with-animation @scroll="scrollPointsBox">
  41. <view class="item" v-for="(item,index) in donationPoints" :key="item.id">
  42. <view class="cover" :style="`background-image: url(${item.img});`"></view>
  43. <!-- <image class="cover" mode="aspectFill" :src="item.img"></image> --><!-- /static/publicWelfare/integral.png -->
  44. <view style="height: 1px;color: transparent;">{{item.randomNum}}</view>
  45. <view class="bottom">
  46. <view class="collection-box">
  47. <text class="iconfont2 integral-icon">&#xe669;</text>
  48. <text class="integral-num">{{item.points}}</text>
  49. </view>
  50. <button @click="loveDonation(item)">去捐赠</button>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. </view>
  55. <view class="moudle">
  56. <view class="title-box" style="margin-bottom: 3rpx;">
  57. <text class="title">公益申领</text>
  58. <view class="line"></view>
  59. <text class="tip">非认证用户也可领</text>
  60. </view>
  61. </view>
  62. <welfareGoods :listData="listData" :hasFilter="false"></welfareGoods>
  63. <uni-popup class="tip-popup" ref="donationPopup" type="center" :mask-click="false">
  64. <view class="content-box">
  65. <view class="title">官方捐赠渠道</view>
  66. <view class="content">
  67. <view class="tip">
  68. 感谢您对绿马助残公益基金会支持,即将跳转到官方捐款渠道链接在线捐款。
  69. </view>
  70. <button class="btn donation">去捐赠</button>
  71. <view class="tip" style="color: #999999;">
  72. 注意:官方渠道捐赠完成之后需要在本平台申领公益积分
  73. </view>
  74. <view class="btn-box">
  75. <button @click="closePublicDonation()">知道了</button>
  76. <button @click="goApplyPointsPage()">去申领</button>
  77. </view>
  78. </view>
  79. </view>
  80. </uni-popup>
  81. <uni-popup class="tip-popup" ref="lovePopup" type="center" :mask-click="false">
  82. <view class="content-box">
  83. <view class="title">确认捐赠</view>
  84. <view class="content">
  85. <view class="tip">
  86. 感谢您捐赠 {{donationPointsItem.points}} 公益积分,为公益 助残事业做出的贡献!
  87. </view>
  88. <view class="btn-box">
  89. <button @click="closeloveDonation()">取消</button>
  90. <button @click="givePoints()">确认捐赠</button>
  91. </view>
  92. </view>
  93. </view>
  94. </uni-popup>
  95. </view>
  96. </template>
  97. <script>
  98. export default{
  99. data(){
  100. return {
  101. //手机状态栏高度
  102. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  103. config: {
  104. back: true,
  105. title: '公益专区',
  106. color: '#1a1a1a',
  107. backgroundColor: [1, "#fff"],
  108. statusBarFontColor: 'black'
  109. },
  110. classList: [{
  111. imgPath: '/static/publicWelfare/class-icon1.png',
  112. text: '公益专区',
  113. url: '/pages/publicWelfareZone/index',
  114. method: 'navigateTo',
  115. needLogin: false
  116. },{
  117. imgPath: '/static/publicWelfare/class-icon2.png',
  118. text: '身份认证',
  119. url: '/pages/authentication/index',
  120. method: 'navigateTo',
  121. needLogin: true
  122. },{
  123. imgPath: '/static/publicWelfare/class-icon3.png',
  124. text: '公益捐赠',
  125. url: '/pages/publicDonation/index',
  126. method: 'navigateTo',
  127. needLogin: true
  128. },{
  129. imgPath: '/static/publicWelfare/class-icon4.png',
  130. text: '申领物资',
  131. url: '/pages/freeCollection/index',
  132. method: 'switchTab',
  133. needLogin: false
  134. },{
  135. imgPath: '/static/publicWelfare/class-icon5.png',
  136. text: '推荐帮扶',
  137. url: '/pages/recommendDonation/index',
  138. method: 'navigateTo',
  139. needLogin: true
  140. }],
  141. donationPoints: [],
  142. donationPointsItem: {
  143. points: ''
  144. },
  145. listData: []
  146. }
  147. },
  148. onLoad() {
  149. this.getDonationPoints();
  150. this.getList();
  151. },
  152. onPullDownRefresh() {
  153. this.getDonationPoints();
  154. this.getList();
  155. setTimeout(function () {
  156. uni.stopPullDownRefresh();
  157. }, 500);
  158. },
  159. methods:{
  160. getList(){
  161. this.$http.get('/goodsareafeature/page',{
  162. page: 1,
  163. limit: 6,
  164. order_type: 1,
  165. order_mode: '',
  166. area_feature: 3
  167. })
  168. .then(res=>{
  169. if (res.code == 200) {
  170. this.listData = res.page.list;
  171. }
  172. })
  173. },
  174. //顶部tab
  175. goPage(url,method = 'navigateTo',needLogin){
  176. let token = uni.getStorageSync("apiToken")
  177. if (!token && needLogin) {
  178. uni.navigateTo({
  179. url: "/pages/login/index"
  180. })
  181. return ;
  182. }
  183. uni[method]({
  184. url
  185. })
  186. },
  187. //官方捐赠
  188. publicDonation(){
  189. this.$refs.donationPopup.open();
  190. },
  191. closePublicDonation(){
  192. this.$refs.donationPopup.close();
  193. },
  194. goApplyPointsPage(){
  195. let token = uni.getStorageSync("apiToken")
  196. if (!token) {
  197. uni.navigateTo({
  198. url: "/pages/login/index"
  199. })
  200. return ;
  201. }
  202. uni.navigateTo({
  203. url: '/pages/applyPoints/index'
  204. })
  205. },
  206. //爱心捐赠
  207. loveDonation(item){
  208. this.donationPointsItem = item;
  209. this.$refs.lovePopup.open();
  210. },
  211. closeloveDonation(){
  212. this.$refs.lovePopup.close();
  213. },
  214. //积分捐赠列表
  215. getDonationPoints() {
  216. let that = this;
  217. this.$http.get('/donation/points/config/list',{})
  218. .then(res=>{
  219. if (res.code == 200) {
  220. let tempList = res.list;
  221. for(let i in tempList){
  222. tempList[i].randomNum = '';
  223. }
  224. that.donationPoints = tempList;
  225. }
  226. })
  227. },
  228. /**
  229. * @copyright CYZ
  230. * @description 解决ios手机出现的【滑动横向滚动容器后,会导致不可见区域的“图片”和“按钮背景颜色”变成白色的bug】
  231. * 事实上图片加载完了,只不过视图不更新。所以需要让页面产生变化。
  232. */
  233. scrollPointsBox(){
  234. //获取0-10000随机数
  235. let randomNum = Math.floor(Math.random() * (10000 - 0)) + 0
  236. for(let i in this.donationPoints){
  237. this.donationPoints[i].randomNum = randomNum;
  238. }
  239. },
  240. givePoints(){
  241. let that = this;
  242. uni.showLoading({
  243. title: '正在提交中...',
  244. mask: true
  245. });
  246. this.$http.post('/donation/points/donate',{
  247. config_id: this.donationPointsItem.id
  248. })
  249. .then(res=>{
  250. if (res.code == 200) {
  251. uni.showToast({
  252. icon: 'success',
  253. title: '捐赠积分成功'
  254. })
  255. }else{
  256. this.closeloveDonation();
  257. }
  258. })
  259. .finally(()=>{
  260. uni.hideLoading();
  261. })
  262. }
  263. }
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .main{
  268. background-color: #fcfcfc;
  269. overflow-x: hidden;
  270. .class-box{
  271. padding: 35rpx;
  272. box-sizing: border-box;
  273. width: 100%;
  274. display: flex;
  275. justify-content: space-between;
  276. .box{
  277. text-align: center;
  278. .icon{
  279. height: 101rpx;
  280. }
  281. .text{
  282. font-size: 28rpx;
  283. font-family: PingFang SC, PingFang SC-Regular;
  284. font-weight: 400;
  285. text-align: center;
  286. color: #1a1a1a;
  287. line-height: 30rpx;
  288. margin-top: 16rpx;
  289. }
  290. }
  291. }
  292. .project-list{
  293. width: 690rpx;
  294. margin: 0 auto;
  295. background: #ffffff;
  296. border-radius: 16rpx;
  297. padding: 23rpx 20rpx 0 20rpx;
  298. box-sizing: border-box;
  299. filter: drop-shadow(1px 2px 4px rgba(26,58,70,0.1));
  300. .list-title{
  301. font-size: 36rpx;
  302. font-family: PingFang SC, PingFang SC-Bold;
  303. font-weight: 700;
  304. text-align: left;
  305. color: #1a1a1a;
  306. display: flex;
  307. justify-content: space-between;
  308. align-items: baseline;
  309. padding: 0 0 23rpx 10rpx;
  310. box-sizing: border-box;
  311. border-bottom: 1px solid #e6e6e6;
  312. .right{
  313. font-size: 24rpx;
  314. font-family: PingFang SC, PingFang SC-Regular;
  315. font-weight: 400;
  316. text-align: right;
  317. color: #333333;
  318. line-height: 24rpx;
  319. .iconfont{
  320. color: #666666;
  321. margin-left: 8.5rpx;
  322. vertical-align: middle;
  323. }
  324. }
  325. }
  326. .list{
  327. padding: 15rpx 0;
  328. box-sizing: border-box;
  329. .item{
  330. margin: 45rpx 0;
  331. .left{
  332. display: inline-block;
  333. .title-box{
  334. .tag{
  335. width: 70rpx;
  336. height: 30rpx;
  337. vertical-align: middle;
  338. }
  339. text{
  340. font-size: 28rpx;
  341. font-family: PingFang SC, PingFang SC-Regular;
  342. font-weight: 400;
  343. text-align: left;
  344. color: #1a1a1a;
  345. line-height: 36rpx;
  346. margin-left: 11rpx;
  347. overflow: hidden;
  348. white-space: nowrap;
  349. text-overflow: ellipsis;
  350. width: 480rpx;
  351. }
  352. }
  353. .desc{
  354. font-size: 24rpx;
  355. font-family: PingFang SC, PingFang SC-Regular;
  356. font-weight: 400;
  357. text-align: left;
  358. color: #808080;
  359. line-height: 39rpx;
  360. margin-top: 15rpx;
  361. overflow: hidden;
  362. text-overflow: ellipsis;
  363. display: -webkit-box;
  364. -webkit-box-orient: vertical;
  365. -webkit-line-clamp: 2;
  366. word-break: break-word;
  367. width: 480rpx;
  368. }
  369. }
  370. .cover{
  371. width: 136rpx;
  372. height: 136rpx;
  373. background: rgba(0,0,0,0.00);
  374. border-radius: 10rpx;
  375. margin-left: 34rpx;
  376. vertical-align: top;
  377. }
  378. }
  379. }
  380. }
  381. .donation-entrance{
  382. width: 690rpx;
  383. display: block;
  384. margin: 20rpx auto 40rpx auto;
  385. }
  386. .moudle{
  387. padding: 0 30rpx;
  388. box-sizing: border-box;
  389. margin: 50rpx 0 0 0;
  390. .title-box{
  391. margin-bottom: 26rpx;
  392. .title{
  393. font-size: 36rpx;
  394. font-family: PingFang SC, PingFang SC-Bold;
  395. font-weight: 700;
  396. color: #1a1a1a;
  397. line-height: 30rpx;
  398. vertical-align: middle;
  399. }
  400. .line{
  401. margin: 0 15.5rpx 0 14.5rpx;
  402. display: inline-block;
  403. vertical-align: middle;
  404. width: 1px;
  405. height: 33rpx;
  406. background-color: #707070;
  407. }
  408. .tip{
  409. font-size: 24rpx;
  410. font-family: PingFang SC, PingFang SC-Regular;
  411. font-weight: 400;
  412. text-align: left;
  413. color: #666666;
  414. line-height: 24rpx;
  415. vertical-align: middle;
  416. }
  417. }
  418. .list2{
  419. overflow-x: auto;
  420. white-space: nowrap;
  421. padding: 10rpx;
  422. height: 410rpx;
  423. .item{
  424. display: inline-block;
  425. width: 292rpx;
  426. background: #ffffff;
  427. border-radius: 16rpx;
  428. padding: 20rpx 20rpx 26rpx 20rpx;
  429. box-sizing: border-box;
  430. margin-right: 20rpx;
  431. filter: drop-shadow(1px 2px 4px rgba(26,58,70,0.1));
  432. image{
  433. will-change: transform;
  434. }
  435. .cover{
  436. width: 252rpx;
  437. height: 252rpx;
  438. border-radius: 16rpx;
  439. margin-bottom: 23rpx;
  440. background-size: cover;
  441. background-position: center;
  442. }
  443. .bottom{
  444. height: 60rpx;
  445. line-height: 60rpx;
  446. display: flex;
  447. justify-content: space-between;
  448. .collection-box{
  449. margin-left: -10rpx;
  450. .integral-icon{
  451. font-size: 50rpx;
  452. color: #22a736;
  453. display: inline-block;
  454. vertical-align: middle;
  455. }
  456. .integral-num{
  457. font-size: 24rpx;
  458. font-family: PingFang SC, PingFang SC-Medium;
  459. font-weight: 500;
  460. text-align: left;
  461. color: #808080;
  462. line-height: 24rpx;
  463. }
  464. }
  465. button{
  466. width: 138rpx;
  467. height: 63rpx;
  468. background: linear-gradient(180deg,#2eb82a, #027956);
  469. border-radius: 32rpx;
  470. font-size: 28rpx;
  471. font-family: PingFang SC, PingFang SC-Medium;
  472. font-weight: 500;
  473. text-align: left;
  474. color: #ffffff;
  475. line-height: 63rpx;
  476. text-align: center;
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. </style>