details.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div class="details-p">
  3. <div class="tops">
  4. <h3>
  5. <van-icon class="word01" :name="'diy-' + fileType(detailData.docFileType)" />
  6. {{detailData.docName}}
  7. </h3>
  8. </div>
  9. <div class="middles">
  10. <h3>摘要</h3>
  11. <p>{{detailData.docSummary}}</p>
  12. <div class="continue" v-show="!buyed">全文共{{detailData.docPageSize}}页,<span @click="continued">继续阅读<van-icon name="arrow-down" size="18" /></span></div>
  13. </div>
  14. <div class="botts" v-show="buyed">
  15. <div class="cont-page">
  16. 优化招投标市场营商环境与国企采购人主体责任、采购与招标培训资料摘要摘要。优化招投标市场营商环境与国企采购人主体责任、采购与招标培训资料摘要摘要。优化招投标市场营商环境与国企采购人主体责任、采购与招标培训资料摘要摘要。优化招投标市场营商环境与国企采购人主体责任、采购与招标培训资料摘要摘要。优化招投标市场营商环境与国企采购人主体责任、采购与招标培训资料摘要摘要。优化招投标市场营商环境与国企采购人主体责任、采购与招标培训资料摘要摘要。
  17. </div>
  18. </div>
  19. <van-goods-action>
  20. <van-goods-action-icon class="no-icon">
  21. <template #default>
  22. <p class="p1">剑鱼币</p>
  23. <p class="p2">{{detailData.price}}</p>
  24. </template>
  25. </van-goods-action-icon>
  26. <van-goods-action-icon icon="diy-jubao" text="投诉举报" @click="jubaod" />
  27. <van-goods-action-icon :icon="collectd==1?'diy-guanzhu':'diy-weiguanzhu'" text="收藏" @click="canged" />
  28. <van-goods-action-button text="下载文档" @click="uploaded" />
  29. </van-goods-action>
  30. <!-- 充值 -->
  31. <recharge ref="charge" :detailData="detailData" :coins="coins"></recharge>
  32. <!-- 购买 -->
  33. <purchase ref="buys" :detailData="detailData" :coins="coins"></purchase>
  34. </div>
  35. </template>
  36. <script lang="ts">
  37. import { Component, Vue } from 'vue-property-decorator'
  38. import { mapActions } from 'vuex'
  39. import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant'
  40. import Recharge from '@/components/Recharge.vue'
  41. import Purchase from '@/components/RechargeHave.vue'
  42. @Component({
  43. name: 'details-p',
  44. components: {
  45. [Icon.name]: Icon,
  46. [GoodsAction.name]: GoodsAction,
  47. [GoodsActionIcon.name]: GoodsActionIcon,
  48. [GoodsActionButton.name]: GoodsActionButton,
  49. Recharge,
  50. Purchase
  51. },
  52. methods: {
  53. ...mapActions({
  54. getDetails: 'main/getDetails',
  55. getCoin: 'main/getCoin',
  56. getAdd: 'main/getAdd',
  57. getRemove: 'main/getRemove'
  58. })
  59. }
  60. })
  61. export default class extends Vue {
  62. getDetails: any
  63. getCoin: any
  64. coins: any = []
  65. getAdd: any
  66. getRemove: any
  67. detailData: any = []
  68. collectd = 0
  69. buyed = 0
  70. created () {
  71. this.onList()
  72. }
  73. onList () {
  74. this.getDetails({ docId: '111' }).then((res: any) => {
  75. console.log(res.data)
  76. this.detailData = res.data.detail
  77. this.buyed = res.data.status
  78. this.collectd = res.data.docCang
  79. })
  80. this.getCoin({ L: true }).then((res: any) => {
  81. console.log(res.data.data)
  82. this.coins = res.data.data.points
  83. })
  84. }
  85. jubaod () {
  86. Toast({
  87. duration: 3500,
  88. message: '如果您发现此内容有侵权行为,请联系客服400-108-6670进行投诉'
  89. })
  90. }
  91. canged () {
  92. if (this.collectd === 0) {
  93. this.getAdd({ docId: '111' }).then((res: any) => {
  94. console.log(res)
  95. if (res.error_code === 0) {
  96. this.collectd = 1
  97. Toast('收藏成功')
  98. }
  99. })
  100. } else {
  101. this.getRemove({ docId: '111' }).then((res: any) => {
  102. console.log(res)
  103. if (res.error_code === 0) {
  104. this.collectd = 0
  105. Toast('取消收藏')
  106. }
  107. })
  108. }
  109. }
  110. continued () {
  111. this.uploaded()
  112. }
  113. uploaded () {
  114. if (this.buyed === 1) {
  115. this.$router.push('/')
  116. } else {
  117. if (this.coins.balance < this.detailData.price) {
  118. ;(this.$refs.charge as any).show = true
  119. } else {
  120. ;(this.$refs.buys as any).show = true
  121. }
  122. }
  123. }
  124. fileType (val: any) {
  125. if (val === 1) {
  126. return 'word'
  127. } else if (val === 2) {
  128. return 'pdf'
  129. } else if (val === 3) {
  130. return 'excel'
  131. } else if (val === 4) {
  132. return 'ppt'
  133. } else if (val === 5) {
  134. return 'txt'
  135. } else {
  136. return ''
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. @include diy-icon('pdf', 24, 24);
  143. @include diy-icon('word', 24, 24);
  144. @include diy-icon('excel', 24, 24);
  145. @include diy-icon('ppt', 24, 24);
  146. @include diy-icon('jubao', 20, 20);
  147. @include diy-icon('weiguanzhu', 20, 20);
  148. @include diy-icon('guanzhu', 20, 20);
  149. .details-p {
  150. display: flex;
  151. flex-direction: column;
  152. .tops {
  153. display: flex;
  154. background: #fff;
  155. padding: 24px 16px;
  156. h3 {
  157. display: flex;
  158. flex-direction: initial;
  159. color: #171826;
  160. font-weight: 500;
  161. font-size: 20px;
  162. line-height: 30px;
  163. .word01 {
  164. display: inline-table;
  165. width: 26px;
  166. height: 24px;
  167. margin-right: 8px;
  168. }
  169. }
  170. }
  171. .middles {
  172. padding: 16px;
  173. background: #fff;
  174. margin: 8px 0;
  175. h3 {
  176. font-size: 16px;
  177. line-height: 24px;
  178. font-weight: 500;
  179. color: #171826;
  180. }
  181. p {
  182. color: #5F5E64;
  183. font-size: 14px;
  184. line-height: 20px;
  185. margin-top: 8px;
  186. }
  187. .continue {
  188. color: #5F5E64;
  189. font-size: 14px;
  190. line-height: 20px;
  191. text-align: center;
  192. margin-top: 32px;
  193. span {
  194. display: inline-flex;
  195. align-items: center;
  196. color: #2ABED1;
  197. cursor: pointer;
  198. i {
  199. margin-left: 4px;
  200. }
  201. }
  202. }
  203. }
  204. .botts {
  205. padding: 16px 24px;
  206. background: #fff;
  207. .cont-page {
  208. height: 900px;
  209. }
  210. }
  211. .van-goods-action {
  212. // height: 56px;
  213. padding: 8px 16px;
  214. box-shadow: 0px -2px 8px 0px #eee;
  215. display: flex;
  216. justify-content: space-between;
  217. .no-icon {
  218. .p1 {
  219. font-size: 12px;
  220. line-height: 18px;
  221. color: #5F5E64;
  222. }
  223. .p2 {
  224. font-size: 18px;
  225. line-height: 26px;
  226. color: #FB483D;
  227. }
  228. .van-icon {
  229. display: none!important;
  230. }
  231. }
  232. .van-goods-action-icon:not(.no-icon) {
  233. font-size: 10px;
  234. color: #5F5E64;
  235. }
  236. .van-goods-action-button--first {
  237. margin-left: 0;
  238. }
  239. .van-goods-action-button--last {
  240. margin-right: 0;
  241. }
  242. .van-goods-action-button {
  243. flex: none;
  244. }
  245. .van-button--large {
  246. width: 165px;
  247. height: 40px;
  248. }
  249. ::v-deep .van-button--default {
  250. background-color: #2ABED1;
  251. .van-button__content {
  252. .van-button__text {
  253. color: #fff;
  254. font-size: 16px;
  255. }
  256. }
  257. }
  258. }
  259. }
  260. </style>