fuInfo.vue 14 KB

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