fuInfo.vue 13 KB

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