fuInfo.vue 13 KB

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