yue.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <view class="content">
  3. <image :src="$store.state.baseURL + art.image" mode="widthFix" class="logo"></image>
  4. <view class="art-info">
  5. <view class="tit">
  6. {{art.title}}
  7. </view>
  8. <view class="des">
  9. {{art.synopsis}}
  10. </view>
  11. <view class="join">
  12. 善款接受:{{$store.state.baseName}}
  13. </view>
  14. <view class="join">
  15. 执行机构:{{$store.state.baseName}}
  16. </view>
  17. <view class="share-num">
  18. <image src="../../static/icon/sharenum.png" mode=""></image>已有{{art.num}}人参与
  19. </view>
  20. <image src="../../static/icon/share1.png" mode="" class="share" @click="isShowBase = true"></image>
  21. </view>
  22. <view class="art-detail">
  23. <view class="de-tit flex">
  24. <view class="line"></view>
  25. <view class="ct">项目介绍</view>
  26. <view class="line"></view>
  27. </view>
  28. <view class="notice-item">
  29. <jyf-parser :html="description" ref="article"></jyf-parser>
  30. </view>
  31. </view>
  32. <view class="tc">
  33. </view>
  34. <view class="btn" v-show="!isOpen" @click="openTc">
  35. <view class="">
  36. 参与月捐
  37. </view>
  38. <view class="tip">开通月捐后,每月自动扣费,可随时取消</view>
  39. </view>
  40. <uni-popup ref="popup" type="bottom" @change="changeTc">
  41. <view class="tc-wrap">
  42. <view class="tit flex">
  43. <view class="">
  44. 捐款金额
  45. </view>
  46. <image src="../../static/icon/cl.png" mode="" @click="closeTc"></image>
  47. </view>
  48. <view class="m-list flex">
  49. <view class="mitem" v-for="item in list" :class="{'action': item == money}" @click="money = item">
  50. ¥{{item}}/月
  51. </view>
  52. </view>
  53. <view class="sy-wrap flex">
  54. <input type="number" placeholder="请输入自定义金额" class="user-inp" v-if="diy" v-model="money" />
  55. <view class="user-inp" v-if="!diy" @click="diy = true">自定义金额</view>
  56. <view @click="sy" class="flex" style="align-items: center;">
  57. <image src="../../static/icon/re.png" mode="" class="re"></image>
  58. <view class="sy">
  59. 随缘
  60. </view>
  61. </view>
  62. </view>
  63. <view class="" style="text-align: center;padding: 20rpx;">
  64. <checkbox style="transform:scale(0.7)" :value="isok" :checked="isok" @click="changeOK" />
  65. 我已阅读并同意<text style="color: #4768c9;" @click="openxy">用户协议</text>
  66. </view>
  67. <view class="" style="text-align: center;font-size: 24rpx;padding-top: 10rpx;color: red;">
  68. 开通月捐后,每月自动扣费,可随时取消
  69. </view>
  70. <view class="go" @click="go">
  71. 确认支付{{money}}元/月
  72. </view>
  73. </view>
  74. </uni-popup>
  75. <image v-if="isShowBase" src="../../static/images/shareimg.png" mode="" class="sharebase"
  76. @click="isShowBase = false"></image>
  77. </view>
  78. </template>
  79. <script>
  80. import {
  81. mapState,
  82. mapMutations
  83. } from 'vuex';
  84. import {
  85. saveUrl,
  86. interceptor
  87. } from '@/utils/loginUtils.js';
  88. import {
  89. weixindata
  90. } from '@/utils/wxAuthorized.js';
  91. import {
  92. getPlanInfo
  93. } from '@/api/money.js'
  94. import {
  95. details,
  96. deconstructArticle
  97. } from '@/api/info.js';
  98. import jyfParser from "@/components/jyf-parser/jyf-parser.vue";
  99. export default {
  100. components: {
  101. jyfParser
  102. },
  103. computed: {
  104. ...mapState('user', ['hasLogin', 'userInfo']),
  105. },
  106. data() {
  107. return {
  108. isok: false,
  109. isShowBase: false,
  110. diy: false,
  111. isOpen: false,
  112. money: 100,
  113. umoney: '',
  114. list: [50, 100, 200],
  115. description: '',
  116. art: {},
  117. id: 0
  118. }
  119. },
  120. onLoad(opt) {
  121. if (opt.id) {
  122. this.id = opt.id
  123. this.getInfo()
  124. uni.setStorageSync('tcplant_id', this.id)
  125. } else {
  126. let id = uni.getStorageSync('tcplant_id') || '';
  127. console.log(id, 'did')
  128. if (id) {
  129. this.id = id;
  130. this.getInfo()
  131. } else {
  132. uni.switchTab({
  133. url: '/pages/index/index'
  134. })
  135. }
  136. }
  137. },
  138. methods: {
  139. openxy() {
  140. },
  141. changeOK(e) {
  142. // console.log(e);
  143. this.isok = !this.isok
  144. },
  145. go() {
  146. if (this.isok) {
  147. uni.showModal({
  148. title: '提示',
  149. content: '功能审核中...',
  150. success(res) {
  151. if (res.confirm) {
  152. console.log('用户点击确定');
  153. } else if (res.cancel) {
  154. console.log('用户点击取消');
  155. }
  156. }
  157. })
  158. } else {
  159. uni.showModal({
  160. title: '提示',
  161. content: '请先阅读并同意用户协议',
  162. success(res) {
  163. if (res.confirm) {
  164. console.log('用户点击确定');
  165. } else if (res.cancel) {
  166. console.log('用户点击取消');
  167. }
  168. }
  169. })
  170. }
  171. },
  172. goShare() {
  173. },
  174. getInfo() {
  175. getPlanInfo({
  176. id: this.id
  177. }).then(e => {
  178. this.art = e.data[0];
  179. if (this.art.text != null) {
  180. this.description = this.art.text.replace(/<img/g, "<img class='baseimg'");
  181. } //小程序商品详情图超出屏幕问题
  182. this.IndexShare(this.art.title, this.art.info)
  183. });
  184. },
  185. changeTc(e) {
  186. console.log(e);
  187. },
  188. closeTc() {
  189. this.$refs.popup.close()
  190. },
  191. openTc() {
  192. if (this.hasLogin) {
  193. uni.navigateTo({
  194. url: '/pages/index/pay?id=' + this.art.plan_id + '&tit=' + this.art.title
  195. })
  196. } else {
  197. saveUrl();
  198. uni.showModal({
  199. title: '登录',
  200. content: '您未登录,是否马上登陆?',
  201. success: e => {
  202. if (e.confirm) {
  203. interceptor();
  204. }
  205. },
  206. fail: e => {
  207. console.log(e);
  208. }
  209. });
  210. }
  211. },
  212. sy() {
  213. this.diy = true
  214. this.money = Math.floor(Math.random() * 500) + 1;
  215. },
  216. IndexShare(title, desc) {
  217. let obj = this;
  218. // let money = obj.money;
  219. let item = {
  220. link: this.$store.state.baseURL + '/index/#/pages/index/yue?id=' + obj.id, // 分享链接
  221. imgUrl: this.$store.state.baseURL + '/index/static/img/002.png',
  222. desc: desc,
  223. title: title,
  224. success() {
  225. console.log('分享成功');
  226. }
  227. };
  228. weixindata(item);
  229. },
  230. }
  231. }
  232. </script>
  233. <style lang="scss">
  234. .logo {
  235. width: 750rpx;
  236. }
  237. .art-info {
  238. background-color: #fff;
  239. padding: 0 30rpx 35rpx;
  240. margin-bottom: 20rpx;
  241. position: relative;
  242. .tit,
  243. .des {
  244. width: 80%;
  245. }
  246. .tit {
  247. font-weight: bold;
  248. font-size: 42rpx;
  249. color: #1B282E;
  250. padding-top: 30rpx;
  251. }
  252. .des {
  253. font-size: 28rpx;
  254. color: #898d8f;
  255. padding: 15rpx 0 30rpx;
  256. }
  257. .share-num {
  258. font-weight: 500;
  259. font-size: 24rpx;
  260. color: #FB2D42;
  261. image {
  262. width: 28rpx;
  263. height: 26rpx;
  264. vertical-align: bottom;
  265. margin-right: 8rpx;
  266. }
  267. }
  268. .share {
  269. width: 44rpx;
  270. height: 44rpx;
  271. position: absolute;
  272. right: 26rpx;
  273. top: 32rpx;
  274. }
  275. }
  276. .art-detail {
  277. width: 100%;
  278. background-color: #fff;
  279. padding: 30rpx;
  280. .de-tit {
  281. text-align: center;
  282. font-size: 31rpx;
  283. color: #898d8f;
  284. align-items: center;
  285. justify-content: center;
  286. .line {
  287. width: 38rpx;
  288. height: 2rpx;
  289. background-color: #E0E0DF;
  290. margin: 0 20rpx;
  291. }
  292. }
  293. }
  294. .tc {
  295. height: 99rpx;
  296. }
  297. .btn {
  298. width: 750rpx;
  299. height: 120rpx;
  300. background: #f3392c;
  301. position: fixed;
  302. bottom: 0;
  303. font-size: 36rpx;
  304. color: #FFFFFF;
  305. text-align: center;
  306. display: flex;
  307. flex-direction: column;
  308. justify-content: center;
  309. .tip {
  310. font-size: 24rpx;
  311. }
  312. }
  313. .tc-wrap {
  314. width: 750rpx;
  315. // height: 578rpx;
  316. background: #FFFFFF;
  317. border-radius: 30rpx 30rpx 0 0;
  318. padding: 0 31rpx 66rpx 32rpx;
  319. .tit {
  320. height: 114rpx;
  321. align-items: center;
  322. justify-content: space-between;
  323. font-weight: bold;
  324. font-size: 42rpx;
  325. color: #1E2B31;
  326. border-bottom: 1px solid #EDF0F2;
  327. image {
  328. width: 34rpx;
  329. height: 34rpx;
  330. }
  331. }
  332. .m-list {
  333. justify-content: space-between;
  334. padding: 30rpx 0;
  335. .mitem {
  336. width: 215rpx;
  337. line-height: 96rpx;
  338. background: #FFFFFF;
  339. border-radius: 5rpx;
  340. border: 1px solid #78919d;
  341. text-align: center;
  342. font-weight: bold;
  343. font-size: 29rpx;
  344. color: #1E2B31;
  345. }
  346. .action {
  347. background: #fdecee;
  348. border: 1px solid #ed3142;
  349. color: #ED3142;
  350. }
  351. }
  352. .sy-wrap {
  353. align-items: center;
  354. justify-content: space-between;
  355. }
  356. .user-inp {
  357. display: inline-block;
  358. width: 554rpx;
  359. height: 81rpx;
  360. line-height: 81rpx;
  361. background: #FFFFFF;
  362. border-radius: 5rpx;
  363. border: 1px solid #78919d;
  364. text-align: center;
  365. font-weight: bold;
  366. font-size: 29rpx;
  367. color: #1E2B31;
  368. }
  369. .re {
  370. width: 30rpx;
  371. height: 30rpx;
  372. margin-left: 33rpx;
  373. margin-right: 14rpx;
  374. }
  375. .sy {
  376. font-weight: bold;
  377. font-size: 29rpx;
  378. color: #0C0C0C;
  379. }
  380. .go {
  381. width: 100%;
  382. line-height: 94rpx;
  383. background: #f3392c;
  384. border-radius: 46rpx;
  385. text-align: center;
  386. font-weight: bold;
  387. font-size: 33rpx;
  388. color: #FFFFFF;
  389. margin-top: 20rpx;
  390. }
  391. }
  392. .notice_name {
  393. font-size: 35rpx !important;
  394. color: #303133;
  395. padding: 25rpx 25rpx 0rpx 25rpx;
  396. margin-bottom: 25rpx;
  397. }
  398. .course-video {
  399. width: 100%;
  400. height: 500rpx;
  401. }
  402. .notice-item {
  403. width: 100%;
  404. height: 100%;
  405. color: #666666;
  406. padding: 35rpx 0;
  407. font-size: 23rpx;
  408. padding-bottom: 30rpx;
  409. }
  410. .baseimg {
  411. max-width: 100%;
  412. height: auto;
  413. }
  414. .sharebase {
  415. display: block;
  416. position: fixed;
  417. top: 0;
  418. left: 0;
  419. width: 100%;
  420. height: 100%;
  421. }
  422. .join {
  423. padding-bottom: 10rpx;
  424. }
  425. </style>