fuInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. obj.description.repeat(/[&]quot;/g,'')
  127. console.log(obj.description,'123456')
  128. } //小程序商品详情图超出屏幕问题
  129. let time = data.data.endActivityTime;
  130. this.endTime = time*1000;
  131. obj.StartDate();
  132. })
  133. },
  134. IndexShare() {
  135. let obj = this;
  136. let id = obj.id
  137. one_detail({
  138. id: obj.id
  139. }).then(data => {
  140. console.log(9785,data.data)
  141. let img = data.data.slider_image[0]
  142. let title = data.data.title
  143. let info = data.data.info
  144. let item = {
  145. link: 'http://dxhred.igxys.com/index/#/pages/fu/fuInfo?id=' +id,// 分享链接
  146. imgUrl: img,
  147. desc: info,
  148. title: title,
  149. success: console.log('分享加载成功')
  150. };
  151. console.log('分享',item)
  152. weixindata(item);
  153. })
  154. },
  155. StartDate() {
  156. let obj = this;
  157. // 获取当前时间
  158. let now = new Date();
  159. let year = now.getFullYear(); //得到年份
  160. let month = now.getMonth(); //得到月份
  161. let date = now.getDate(); //得到日期
  162. let hour = now.getHours(); //得到小时
  163. let minu = now.getMinutes(); //得到分钟
  164. let sec = now.getSeconds(); //得到秒
  165. //获取现在时间的时间戳
  166. let time = new Date(year, month, date, hour, minu, sec);
  167. let nowTime = time.getTime();
  168. if (nowTime < obj.endTime) {
  169. console.log(nowTime,obj.endTime)
  170. console.log('现在时间小于活动时间,活动进行中');
  171. obj.starting = true;
  172. console.log(obj.starting, '显示');
  173. let starTime = obj.endTime - nowTime;
  174. console.log(starTime,'starTime')
  175. let day = Math.floor(starTime / 1000 / 60 / 60 / 24); //获取剩余天数
  176. let hours = Math.floor((starTime / 1000 / 60 / 60) % 24); //获取剩余小时数
  177. let minutes = Math.floor((starTime / 1000 / 60) % 60); //获取分钟
  178. let seconds = Math.floor((starTime / 1000) % 60); //获取秒数
  179. obj.startday = day;
  180. obj.starthour = hours;
  181. obj.startminute = minutes;
  182. obj.startsecond = seconds;
  183. console.log('时间差是: '+ obj.startday + '天, ' + obj.starthour + '小时, ' + obj.startminute + '分钟, ' + obj.startsecond + '秒', '距离活动结束还剩多少时间');
  184. }else{
  185. obj.starting = false;
  186. }
  187. },
  188. //轮播图
  189. swiperChange(e) {
  190. const index = e.detail.current;
  191. this.swiperCurrent = index;
  192. },
  193. // 申请援助
  194. shenqing() {
  195. this.$refs.popup.open()
  196. },
  197. // 爱心捐款
  198. loveDona(){
  199. console.log('爱心捐款',this.id)
  200. uni.navigateTo({
  201. url: '/pages/applic/loveDonate?id=' + this.id
  202. });
  203. // pages/applic/loveDonate
  204. },
  205. // 关闭弹窗
  206. close() {
  207. this.$refs.popup.close()
  208. },
  209. // 确认
  210. corfim() {
  211. enroll({
  212. hid: this.id,
  213. }).then(res => {
  214. this.close();
  215. this.$api.msg('申请成功');
  216. this.loadData();
  217. })
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang="scss">
  223. page {
  224. background: #F5F5F5;
  225. .container{
  226. height: 100%;
  227. padding-bottom: 180rpx;
  228. }
  229. }
  230. .rich-img {
  231. width: 100% !important;
  232. height: auto;
  233. }
  234. //轮播图
  235. .swiper {
  236. width: 100%;
  237. display: flex;
  238. justify-content: center;
  239. .swiper-box {
  240. width: 100%;
  241. height:650rpx;
  242. overflow: hidden;
  243. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  244. //兼容ios,微信小程序
  245. position: relative;
  246. z-index: 1;
  247. swiper {
  248. width: 100%;
  249. height: 100%;
  250. swiper-item {
  251. image {
  252. width: 100%;
  253. height: 100%;
  254. }
  255. }
  256. }
  257. .indicator {
  258. position: absolute;
  259. bottom: 20upx;
  260. left: 20upx;
  261. background-color: rgba(255, 255, 255, 0.4);
  262. width: 150upx;
  263. height: 5upx;
  264. border-radius: 3upx;
  265. overflow: hidden;
  266. display: flex;
  267. .dots {
  268. width: 0upx;
  269. background-color: rgba(255, 255, 255, 1);
  270. transition: all 0.3s ease-out;
  271. &.on {
  272. width: (100%/3);
  273. }
  274. }
  275. }
  276. }
  277. }
  278. .info-item{
  279. background-color: #FFFFFF;
  280. padding: 45rpx 25rpx;
  281. .list-tip{
  282. background-color: $motif-color;
  283. color: #FFFFFF;
  284. border-radius:8rpx;
  285. padding: 5rpx 12rpx;
  286. padding-bottom: 8rpx !important;
  287. margin-right: 15rpx;
  288. text-align: center;
  289. font-size: 24rpx;
  290. }
  291. .info-title{
  292. max-width: 75%;
  293. font-size:36rpx;
  294. font-weight:500;
  295. color:rgba(34,34,34,1);
  296. }
  297. .info-tip{
  298. font-weight:400;
  299. color:rgba(102,102,102,1);
  300. font-size: 28rpx;
  301. padding: 15rpx 0rpx;
  302. }
  303. .info-number{
  304. padding-top: 25rpx;
  305. color: #EF3D28;
  306. font-size: 24rpx;
  307. // text-align: right;
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-between;
  311. .name-text{
  312. color: #666666;
  313. }
  314. .starting{
  315. font-size: 32rpx;
  316. font-weight: bold;
  317. }
  318. }
  319. }
  320. .introduce-item{
  321. background-color: #FFFFFF;
  322. padding: 45rpx 25rpx;
  323. margin-top: 25rpx;
  324. .introduce-title{
  325. padding-bottom: 40rpx;
  326. font-size: 36rpx;
  327. font-family: PingFang;
  328. font-weight: 500;
  329. color: #222222;
  330. }
  331. .introduce-info{
  332. font-size: 28rpx;
  333. font-weight: 500;
  334. color: #222222;
  335. }
  336. }
  337. .static{
  338. padding: 0rpx !important;
  339. width: 70%;
  340. padding-left:25rpx !important;
  341. }
  342. .btn-bottom{
  343. position:fixed;
  344. bottom: 0rpx;
  345. padding: 24rpx 32rpx;
  346. // height: 88rpx;
  347. width: 100%;
  348. color: #FFFFFF;
  349. background-color: #FFFFFF;
  350. display: flex;
  351. justify-content: space-between;
  352. }
  353. .btn-left{
  354. padding: 12rpx 0;
  355. width: 45%;
  356. // padding: 25rpx 180rpx;
  357. // background:rgba(223,312,18,1);
  358. background: $motif-color;
  359. border-radius:50rpx;
  360. display: flex;
  361. justify-content: center;
  362. align-items: center;
  363. }
  364. .btn-right{
  365. padding: 6rpx 0;
  366. width: 45%;
  367. display: flex;
  368. justify-content: center;
  369. align-items: center;
  370. // padding: 25rpx 180rpx;
  371. // background:rgba(223,36,18,1);
  372. background: $motif-color;
  373. border-radius:50rpx;
  374. }
  375. // .submit{
  376. // width: 45%;
  377. // text-align: center;
  378. // padding: 50rpx 0rpx;
  379. // font-size: $font-lg;
  380. // text{
  381. // padding: 25rpx 180rpx;
  382. // // background:rgba(223,36,18,1);
  383. // background: $motif-color;
  384. // border-radius:50rpx;
  385. // }
  386. // }
  387. .yijieshu {
  388. // padding: 12rpx 0;
  389. // width: 45%;
  390. // background-color: #999999;
  391. text{
  392. color: #C3C3C3;
  393. }
  394. }
  395. .red{
  396. text{
  397. padding: 25rpx 180rpx;
  398. background:rgba(223,36,18,0.6);
  399. border-radius:50rpx;
  400. }
  401. }
  402. .pop-box {
  403. .pop-img {
  404. width: 542rpx;
  405. height: 280rpx;
  406. display: block;
  407. }
  408. .pop-frame {
  409. margin: 0 16rpx;
  410. padding: 35rpx 40rpx;
  411. background: #FFFFFF;
  412. box-shadow: 0px 5rpx 20rpx 0px rgba(0, 0, 0, 0.1);
  413. border-radius: 0 0 10rpx 10rpx;
  414. .pop-text {
  415. margin-top: 30rpx;
  416. font-size: 36rpx;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. color: #333C4C;
  420. line-height: 40rpx;
  421. text-align: center;
  422. }
  423. .pop-btnBox {
  424. margin-top: 78rpx;
  425. display: flex;
  426. align-items: center;
  427. justify-content: space-between;
  428. .pop-btn {
  429. width: 199rpx;
  430. height: 78rpx;
  431. border: 1px solid #FF727E;
  432. border-radius: 10rpx;
  433. font-size: 32rpx;
  434. font-family: PingFang SC;
  435. font-weight: 500;
  436. color: #FF727E;
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. }
  441. .queren {
  442. background: #FF727E;
  443. color: #FFFFFF;
  444. }
  445. }
  446. }
  447. }
  448. </style>