helpDetail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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>资金:{{ list.money }}</view>
  19. <view>帮扶人:{{ list.arr.name }}</view>
  20. </view>
  21. </view>
  22. <view class="introduce-item">
  23. <view class="introduce-title ellipsis">项目介绍</view>
  24. <view class="introduce-info">
  25. <rich-text :nodes="list.description"></rich-text>
  26. </view>
  27. </view>
  28. <view class="introduce-item" v-if="list.arr.info1.remark">
  29. <view class="introduce-title ellipsis">帮扶详情</view>
  30. <view class="introduce-info">
  31. <view>{{ list.arr.info1.remark }}</view>
  32. <view class="img-box">
  33. <image class="img-info" v-for="item in imgList" :src="item" mode="widthFix"></image>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  41. import { one_detail, enroll } from '@/api/applyHelp.js';
  42. import { timeComputed } from '@/utils/rocessor.js';
  43. import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
  44. export default {
  45. components: {
  46. uniPopup,
  47. uniCountdown
  48. },
  49. data() {
  50. return {
  51. id:'',
  52. list: '',
  53. description:'',
  54. swiperCurrent: 0, //轮播图
  55. swiperHeight: 300,
  56. banner:[],//轮播图
  57. startday:0,
  58. starthour:0,//距离今天开始时间
  59. startminute:0,
  60. startsecond:0,
  61. endTime:'',//结束时间
  62. starting: false, //判断活动是否结束
  63. imgList: [], // 图片
  64. };
  65. },
  66. onLoad(option) {
  67. this.id = option.id;
  68. this.loadData();
  69. },
  70. methods: {
  71. loadData(){
  72. let obj = this;
  73. one_detail({
  74. id: obj.id
  75. }).then(data => {
  76. obj.list = data.data;
  77. if (data.data.arr.info1.img) {
  78. obj.imgList = data.data.arr.info1.img.split(';'); // 上传资料图片
  79. }
  80. obj.banner = data.data.slider_image;
  81. if (obj.list.description) {
  82. obj.description = obj.list.description.replace(/\<img/gi, '<img class="rich-img"');
  83. } //小程序商品详情图超出屏幕问题
  84. let time = data.data.endActivityTime;
  85. this.endTime = time*1000;
  86. obj.StartDate();
  87. })
  88. },
  89. StartDate() {
  90. let obj = this;
  91. // 获取当前时间
  92. let now = new Date();
  93. let year = now.getFullYear(); //得到年份
  94. let month = now.getMonth(); //得到月份
  95. let date = now.getDate(); //得到日期
  96. let hour = now.getHours(); //得到小时
  97. let minu = now.getMinutes(); //得到分钟
  98. let sec = now.getSeconds(); //得到秒
  99. //获取现在时间的时间戳
  100. let time = new Date(year, month, date, hour, minu, sec);
  101. let nowTime = time.getTime();
  102. if (nowTime < obj.endTime) {
  103. console.log(nowTime,obj.endTime)
  104. console.log('现在时间小于活动时间,活动进行中');
  105. obj.starting = true;
  106. let starTime = obj.endTime - nowTime;
  107. console.log(starTime,'starTime')
  108. let day = Math.floor(starTime / 1000 / 60 / 60 / 24); //获取剩余天数
  109. let hours = Math.floor((starTime / 1000 / 60 / 60) % 24); //获取剩余小时数
  110. let minutes = Math.floor((starTime / 1000 / 60) % 60); //获取分钟
  111. let seconds = Math.floor((starTime / 1000) % 60); //获取秒数
  112. obj.startday = day;
  113. obj.starthour = hours;
  114. obj.startminute = minutes;
  115. obj.startsecond = seconds;
  116. console.log('时间差是: '+ obj.startday + '天, ' + obj.starthour + '小时, ' + obj.startminute + '分钟, ' + obj.startsecond + '秒', '距离活动结束还剩多少时间');
  117. }else{
  118. obj.starting = false;
  119. }
  120. },
  121. //轮播图
  122. swiperChange(e) {
  123. const index = e.detail.current;
  124. this.swiperCurrent = index;
  125. },
  126. // 申请援助
  127. shenqing() {
  128. this.$refs.popup.open()
  129. },
  130. // 关闭弹窗
  131. close() {
  132. this.$refs.popup.close()
  133. },
  134. // 确认
  135. corfim() {
  136. enroll({
  137. hid: this.id,
  138. }).then(res => {
  139. this.close();
  140. this.$api.msg('申请成功');
  141. this.loadData();
  142. })
  143. }
  144. }
  145. }
  146. </script>
  147. <style lang="scss">
  148. page {
  149. background: #F5F5F5;
  150. .container{
  151. height: 100%;
  152. padding-bottom: 180rpx;
  153. }
  154. }
  155. .rich-img {
  156. width: 100% !important;
  157. height: auto;
  158. }
  159. //轮播图
  160. .swiper {
  161. width: 100%;
  162. display: flex;
  163. justify-content: center;
  164. .swiper-box {
  165. width: 100%;
  166. height:650rpx;
  167. overflow: hidden;
  168. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  169. //兼容ios,微信小程序
  170. position: relative;
  171. z-index: 1;
  172. swiper {
  173. width: 100%;
  174. height: 100%;
  175. swiper-item {
  176. image {
  177. width: 100%;
  178. height: 100%;
  179. }
  180. }
  181. }
  182. .indicator {
  183. position: absolute;
  184. bottom: 20upx;
  185. left: 20upx;
  186. background-color: rgba(255, 255, 255, 0.4);
  187. width: 150upx;
  188. height: 5upx;
  189. border-radius: 3upx;
  190. overflow: hidden;
  191. display: flex;
  192. .dots {
  193. width: 0upx;
  194. background-color: rgba(255, 255, 255, 1);
  195. transition: all 0.3s ease-out;
  196. &.on {
  197. width: (100%/3);
  198. }
  199. }
  200. }
  201. }
  202. }
  203. .info-item{
  204. background-color: #FFFFFF;
  205. padding: 45rpx 25rpx;
  206. .list-tip{
  207. background-color: $motif-color;
  208. color: #FFFFFF;
  209. border-radius:8rpx;
  210. padding: 5rpx 12rpx;
  211. padding-bottom: 8rpx !important;
  212. margin-right: 15rpx;
  213. text-align: center;
  214. font-size: 24rpx;
  215. }
  216. .info-title{
  217. max-width: 75%;
  218. font-size:36rpx;
  219. font-weight:500;
  220. color:rgba(34,34,34,1);
  221. }
  222. .info-tip{
  223. font-weight:400;
  224. color:rgba(102,102,102,1);
  225. font-size: 28rpx;
  226. padding: 15rpx 0rpx;
  227. }
  228. .info-number{
  229. padding-top: 25rpx;
  230. color: #EF3D28;
  231. font-size: 24rpx;
  232. font-weight: normal;
  233. display: flex;
  234. align-items: center;
  235. justify-content: space-between;
  236. .name-text{
  237. color: #666666;
  238. }
  239. .starting{
  240. font-size: 32rpx;
  241. font-weight: bold;
  242. }
  243. }
  244. }
  245. .introduce-item{
  246. background-color: #FFFFFF;
  247. padding: 45rpx 25rpx;
  248. margin-top: 25rpx;
  249. .introduce-title{
  250. padding-bottom: 40rpx;
  251. font-size: 36rpx;
  252. font-family: PingFang;
  253. font-weight: 500;
  254. color: #222222;
  255. }
  256. .introduce-info{
  257. font-size: 28rpx;
  258. font-weight: 500;
  259. color: #222222;
  260. }
  261. .img-box {
  262. width: 100%;
  263. }
  264. .img-info {
  265. width: 100%;
  266. display: block;
  267. margin-top: 30rpx;
  268. }
  269. }
  270. .static{
  271. padding: 0rpx !important;
  272. width: 70%;
  273. padding-left:25rpx !important;
  274. }
  275. .submit{
  276. position:fixed;
  277. bottom: 0rpx;
  278. width: 100%;
  279. color: #FFFFFF;
  280. text-align: center;
  281. background-color: #FFFFFF;
  282. padding: 50rpx 0rpx;
  283. font-size: $font-lg;
  284. text{
  285. padding: 25rpx 180rpx;
  286. // background:rgba(223,36,18,1);
  287. background: $motif-color;
  288. border-radius:50rpx;
  289. }
  290. }
  291. .yijieshu {
  292. text{
  293. background: #999999;
  294. }
  295. }
  296. .red{
  297. text{
  298. padding: 25rpx 180rpx;
  299. background:rgba(223,36,18,0.6);
  300. border-radius:50rpx;
  301. }
  302. }
  303. .pop-box {
  304. .pop-img {
  305. width: 542rpx;
  306. height: 280rpx;
  307. display: block;
  308. }
  309. .pop-frame {
  310. margin: 0 16rpx;
  311. padding: 35rpx 40rpx;
  312. background: #FFFFFF;
  313. box-shadow: 0px 5rpx 20rpx 0px rgba(0, 0, 0, 0.1);
  314. border-radius: 0 0 10rpx 10rpx;
  315. .pop-text {
  316. margin-top: 30rpx;
  317. font-size: 36rpx;
  318. font-family: PingFang SC;
  319. font-weight: 500;
  320. color: #333C4C;
  321. line-height: 40rpx;
  322. text-align: center;
  323. }
  324. .pop-btnBox {
  325. margin-top: 78rpx;
  326. display: flex;
  327. align-items: center;
  328. justify-content: space-between;
  329. .pop-btn {
  330. width: 199rpx;
  331. height: 78rpx;
  332. border: 1px solid #FF727E;
  333. border-radius: 10rpx;
  334. font-size: 32rpx;
  335. font-family: PingFang SC;
  336. font-weight: 500;
  337. color: #FF727E;
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. }
  342. .queren {
  343. background: #FF727E;
  344. color: #FFFFFF;
  345. }
  346. }
  347. }
  348. }
  349. </style>