fuInfo.vue 13 KB

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