fuInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <view class="container">
  3. <view class="swiper">
  4. <view class="swiper-box">
  5. <swiper circular="true" autoplay="true" @change="swiperChange">
  6. <swiper-item v-for="swiper in banner" :key="swiper.id"><image :src="swiper"></image></swiper-item>
  7. </swiper>
  8. <view class="indicator"><view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']" :key="index"></view></view>
  9. </view>
  10. </view>
  11. <view class="info-item">
  12. <view class="flex_item">
  13. <view class="list-tip">{{list.cname}}</view>
  14. <view class="info-title clamp">{{list.title}}</view>
  15. </view>
  16. <view class="info-tip">{{list.info}}</view>
  17. <view class="info-number">
  18. <!-- <view v-if="starting == true">
  19. <view class="flex_item">
  20. <view class="name-text">还剩</view>
  21. <uni-countdown
  22. color="#E62129"
  23. background-color="#ffffff"
  24. :show-day="true"
  25. :day='startday'
  26. :hour="starthour"
  27. :minute="startminute"
  28. :second="startsecond"
  29. ></uni-countdown>
  30. </view>
  31. </view>
  32. <view class="starting" v-if="starting == false">活动已结束</view> -->
  33. <view>资金:{{list.money }}</view>
  34. <view v-if="starting == true">已有{{list.sales}}人申请</view>
  35. <view v-if="starting == false">已结束</view>
  36. </view>
  37. </view>
  38. <view class="introduce-item">
  39. <view class="introduce-title ellipsis">项目介绍</view>
  40. <view class="introduce-info">
  41. <rich-text :nodes="list.description"></rich-text>
  42. </view>
  43. </view>
  44. <!-- <view class="introduce-item">
  45. <view class="introduce-title ellipsis">捐款通道</view>
  46. <view class="introduce-info">银行账户:{{list.bank_account}}</view>
  47. </view> -->
  48. <view class="btn-bottom">
  49. <view class="btn-left">
  50. <view class="submit" v-if="starting == true && list.is == 0" @click="shenqing"><text class="">申请援助</text></view>
  51. <view class="submit yijieshu" v-if="starting == true && list.is == 1"><text class="">已申请援助</text></view>
  52. <view class="submit yijieshu" v-if="starting == false" ><text class="">已结束</text></view>
  53. </view>
  54. <view class="btn-right">
  55. <view class="" @click="loveDona">
  56. 爱心捐款
  57. </view>
  58. </view>
  59. </view>
  60. <uni-popup ref="popup" type="center">
  61. <view class="pop-box">
  62. <image class="pop-img" src="../../static/images/sqyz.png"></image>
  63. <view class="pop-frame">
  64. <view class="pop-text">是否确认申请援助</view>
  65. <view class="pop-btnBox">
  66. <view class="pop-btn" @click="close">取消</view>
  67. <view class="pop-btn queren" @click="corfim()">确认</view>
  68. </view>
  69. </view>
  70. </view>
  71. </uni-popup>
  72. </view>
  73. </template>
  74. <script>
  75. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  76. import { one_detail, enroll } from '@/api/applyHelp.js';
  77. import { timeComputed } from '@/utils/rocessor.js';
  78. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  79. import {
  80. weixindata
  81. } from '@/utils/wxAuthorized.js';
  82. export default {
  83. components: {
  84. uniPopup,
  85. uniCountdown
  86. },
  87. data() {
  88. return {
  89. id:'',
  90. money:99,
  91. list: '',
  92. description:'',
  93. swiperCurrent: 0, //轮播图
  94. swiperHeight: 300,
  95. banner:[],//轮播图
  96. img:'',
  97. startday:0,
  98. starthour:0,//距离今天开始时间
  99. startminute:0,
  100. startsecond:0,
  101. title:'',
  102. endTime:'',//结束时间
  103. starting: false, //判断活动是否结束
  104. };
  105. },
  106. onLoad(option) {
  107. console.log(333,option)
  108. this.id = option.id;
  109. this.loadData();
  110. this.IndexShare();
  111. },
  112. methods: {
  113. loadData(){
  114. let obj = this;
  115. let id = obj.id;
  116. console.log(9090,id)
  117. one_detail({
  118. id: obj.id
  119. }).then(data => {
  120. console.log(9785,data.data)
  121. obj.list = data.data;
  122. obj.banner = data.data.slider_image;
  123. console.log('轮播图', obj.banner)
  124. if (obj.list.description) {
  125. obj.description = obj.list.description.replace(/\<img/gi, '<img class="rich-img"');
  126. } //小程序商品详情图超出屏幕问题
  127. let time = data.data.endActivityTime;
  128. this.endTime = time*1000;
  129. obj.StartDate();
  130. })
  131. },
  132. IndexShare() {
  133. let obj = this;
  134. let id = obj.id
  135. one_detail({
  136. id: obj.id
  137. }).then(data => {
  138. console.log(9785,data.data)
  139. let img = data.data.slider_image[0]
  140. let title = data.data.title
  141. let info = data.data.info
  142. let item = {
  143. link: 'http://dxhred.igxys.com/index/#/pages/fu/fuInfo?id=' +id,// 分享链接
  144. imgUrl: img,
  145. desc: info,
  146. title: title,
  147. success: console.log('分享加载成功')
  148. };
  149. console.log('分享',item)
  150. weixindata(item);
  151. })
  152. },
  153. StartDate() {
  154. let obj = this;
  155. // 获取当前时间
  156. let now = new Date();
  157. let year = now.getFullYear(); //得到年份
  158. let month = now.getMonth(); //得到月份
  159. let date = now.getDate(); //得到日期
  160. let hour = now.getHours(); //得到小时
  161. let minu = now.getMinutes(); //得到分钟
  162. let sec = now.getSeconds(); //得到秒
  163. //获取现在时间的时间戳
  164. let time = new Date(year, month, date, hour, minu, sec);
  165. let nowTime = time.getTime();
  166. if (nowTime < obj.endTime) {
  167. console.log(nowTime,obj.endTime)
  168. console.log('现在时间小于活动时间,活动进行中');
  169. obj.starting = true;
  170. console.log(obj.starting, '显示');
  171. let starTime = obj.endTime - nowTime;
  172. console.log(starTime,'starTime')
  173. let day = Math.floor(starTime / 1000 / 60 / 60 / 24); //获取剩余天数
  174. let hours = Math.floor((starTime / 1000 / 60 / 60) % 24); //获取剩余小时数
  175. let minutes = Math.floor((starTime / 1000 / 60) % 60); //获取分钟
  176. let seconds = Math.floor((starTime / 1000) % 60); //获取秒数
  177. obj.startday = day;
  178. obj.starthour = hours;
  179. obj.startminute = minutes;
  180. obj.startsecond = seconds;
  181. console.log('时间差是: '+ obj.startday + '天, ' + obj.starthour + '小时, ' + obj.startminute + '分钟, ' + obj.startsecond + '秒', '距离活动结束还剩多少时间');
  182. }else{
  183. obj.starting = false;
  184. }
  185. },
  186. //轮播图
  187. swiperChange(e) {
  188. const index = e.detail.current;
  189. this.swiperCurrent = index;
  190. },
  191. // 申请援助
  192. shenqing() {
  193. this.$refs.popup.open()
  194. },
  195. // 爱心捐款
  196. loveDona(){
  197. console.log('爱心捐款',this.id)
  198. uni.navigateTo({
  199. url: '/pages/applic/loveDonate?id=' + this.id
  200. });
  201. // pages/applic/loveDonate
  202. },
  203. // 关闭弹窗
  204. close() {
  205. this.$refs.popup.close()
  206. },
  207. // 确认
  208. corfim() {
  209. enroll({
  210. hid: this.id,
  211. }).then(res => {
  212. this.close();
  213. this.$api.msg('申请成功');
  214. this.loadData();
  215. })
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss">
  221. page {
  222. background: #F5F5F5;
  223. .container{
  224. height: 100%;
  225. padding-bottom: 180rpx;
  226. }
  227. }
  228. .rich-img {
  229. width: 100% !important;
  230. height: auto;
  231. }
  232. //轮播图
  233. .swiper {
  234. width: 100%;
  235. display: flex;
  236. justify-content: center;
  237. .swiper-box {
  238. width: 100%;
  239. height:650rpx;
  240. overflow: hidden;
  241. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  242. //兼容ios,微信小程序
  243. position: relative;
  244. z-index: 1;
  245. swiper {
  246. width: 100%;
  247. height: 100%;
  248. swiper-item {
  249. image {
  250. width: 100%;
  251. height: 100%;
  252. }
  253. }
  254. }
  255. .indicator {
  256. position: absolute;
  257. bottom: 20upx;
  258. left: 20upx;
  259. background-color: rgba(255, 255, 255, 0.4);
  260. width: 150upx;
  261. height: 5upx;
  262. border-radius: 3upx;
  263. overflow: hidden;
  264. display: flex;
  265. .dots {
  266. width: 0upx;
  267. background-color: rgba(255, 255, 255, 1);
  268. transition: all 0.3s ease-out;
  269. &.on {
  270. width: (100%/3);
  271. }
  272. }
  273. }
  274. }
  275. }
  276. .info-item{
  277. background-color: #FFFFFF;
  278. padding: 45rpx 25rpx;
  279. .list-tip{
  280. background-color: $motif-color;
  281. color: #FFFFFF;
  282. border-radius:8rpx;
  283. padding: 5rpx 12rpx;
  284. padding-bottom: 8rpx !important;
  285. margin-right: 15rpx;
  286. text-align: center;
  287. font-size: 24rpx;
  288. }
  289. .info-title{
  290. max-width: 75%;
  291. font-size:36rpx;
  292. font-weight:500;
  293. color:rgba(34,34,34,1);
  294. }
  295. .info-tip{
  296. font-weight:400;
  297. color:rgba(102,102,102,1);
  298. font-size: 28rpx;
  299. padding: 15rpx 0rpx;
  300. }
  301. .info-number{
  302. padding-top: 25rpx;
  303. color: #EF3D28;
  304. font-size: 24rpx;
  305. // text-align: right;
  306. display: flex;
  307. align-items: center;
  308. justify-content: space-between;
  309. .name-text{
  310. color: #666666;
  311. }
  312. .starting{
  313. font-size: 32rpx;
  314. font-weight: bold;
  315. }
  316. }
  317. }
  318. .introduce-item{
  319. background-color: #FFFFFF;
  320. padding: 45rpx 25rpx;
  321. margin-top: 25rpx;
  322. .introduce-title{
  323. padding-bottom: 40rpx;
  324. font-size: 36rpx;
  325. font-family: PingFang;
  326. font-weight: 500;
  327. color: #222222;
  328. }
  329. .introduce-info{
  330. font-size: 28rpx;
  331. font-weight: 500;
  332. color: #222222;
  333. }
  334. }
  335. .static{
  336. padding: 0rpx !important;
  337. width: 70%;
  338. padding-left:25rpx !important;
  339. }
  340. .btn-bottom{
  341. position:fixed;
  342. bottom: 0rpx;
  343. padding: 24rpx 32rpx;
  344. // height: 88rpx;
  345. width: 100%;
  346. color: #FFFFFF;
  347. background-color: #FFFFFF;
  348. display: flex;
  349. justify-content: space-between;
  350. }
  351. .btn-left{
  352. padding: 12rpx 0;
  353. width: 45%;
  354. // padding: 25rpx 180rpx;
  355. // background:rgba(223,312,18,1);
  356. background: $motif-color;
  357. border-radius:50rpx;
  358. display: flex;
  359. justify-content: center;
  360. align-items: center;
  361. }
  362. .btn-right{
  363. padding: 6rpx 0;
  364. width: 45%;
  365. display: flex;
  366. justify-content: center;
  367. align-items: center;
  368. // padding: 25rpx 180rpx;
  369. // background:rgba(223,36,18,1);
  370. background: $motif-color;
  371. border-radius:50rpx;
  372. }
  373. // .submit{
  374. // width: 45%;
  375. // text-align: center;
  376. // padding: 50rpx 0rpx;
  377. // font-size: $font-lg;
  378. // text{
  379. // padding: 25rpx 180rpx;
  380. // // background:rgba(223,36,18,1);
  381. // background: $motif-color;
  382. // border-radius:50rpx;
  383. // }
  384. // }
  385. .yijieshu {
  386. // padding: 12rpx 0;
  387. // width: 45%;
  388. // background-color: #999999;
  389. text{
  390. color: #C3C3C3;
  391. }
  392. }
  393. .red{
  394. text{
  395. padding: 25rpx 180rpx;
  396. background:rgba(223,36,18,0.6);
  397. border-radius:50rpx;
  398. }
  399. }
  400. .pop-box {
  401. .pop-img {
  402. width: 542rpx;
  403. height: 280rpx;
  404. display: block;
  405. }
  406. .pop-frame {
  407. margin: 0 16rpx;
  408. padding: 35rpx 40rpx;
  409. background: #FFFFFF;
  410. box-shadow: 0px 5rpx 20rpx 0px rgba(0, 0, 0, 0.1);
  411. border-radius: 0 0 10rpx 10rpx;
  412. .pop-text {
  413. margin-top: 30rpx;
  414. font-size: 36rpx;
  415. font-family: PingFang SC;
  416. font-weight: 500;
  417. color: #333C4C;
  418. line-height: 40rpx;
  419. text-align: center;
  420. }
  421. .pop-btnBox {
  422. margin-top: 78rpx;
  423. display: flex;
  424. align-items: center;
  425. justify-content: space-between;
  426. .pop-btn {
  427. width: 199rpx;
  428. height: 78rpx;
  429. border: 1px solid #FF727E;
  430. border-radius: 10rpx;
  431. font-size: 32rpx;
  432. font-family: PingFang SC;
  433. font-weight: 500;
  434. color: #FF727E;
  435. display: flex;
  436. align-items: center;
  437. justify-content: center;
  438. }
  439. .queren {
  440. background: #FF727E;
  441. color: #FFFFFF;
  442. }
  443. }
  444. }
  445. }
  446. </style>