product.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="pages">
  3. <view class="swiper-wrap">
  4. <swiper class="swiper"
  5. :indicator-dots="swiper.indicatorDots"
  6. :indicator-color="swiper.indicatorColor"
  7. :indicator-active-color="swiper.indicatorActiveColor"
  8. :autoplay="swiper.autoplay"
  9. :interval="swiper.interval" :duration="swiper.duration">
  10. <swiper-item v-for="(item, index) in bannerList" :key="index">
  11. <view class="adv-item" @click="swiperClick"><image :src="$onlineImg +item" class="pic" mode="scaleToFill"></image></view>
  12. </swiper-item>
  13. </swiper>
  14. </view>
  15. <view class="goods-name">
  16. <view class="name">{{product.goodsName}}</view>
  17. <view class="type">类别:{{product.goodsType || "T001"}}</view>
  18. </view>
  19. <view class="goods-base-info padding24">
  20. <view class="goods-base-info-item">产品编号:{{product.goodsCode}}</view>
  21. <view class="goods-base-info-item">认购期:{{time}}</view>
  22. <view class="goods-base-info-item">预估总释放量:{{product.carbonVal}}kg</view>
  23. <view class="goods-price">
  24. <text class="rmb">¥</text>
  25. <text class="price">{{product.price}}/kg</text>
  26. </view>
  27. </view>
  28. <view class="main-body">
  29. <view class="main-body-til">
  30. <view class="til">碳汇研发主体</view>
  31. <view class="con">
  32. <text>青龙村</text>
  33. <text class="iconfont icon-jiantou"></text>
  34. </view>
  35. </view>
  36. <view class="main-body-info">
  37. <image :src="$getimg+'home-buy-now-img.png'" class="main-body-info-img" mode="scaleToFill"></image>
  38. <view class="main-body-info-text">
  39. <view class="text-item">
  40. <text class="text">家庭成员:5人</text>
  41. <text class="text">涉及产品数:3</text>
  42. </view>
  43. <view class="main-body-info-text">地址:重庆市渝中区解放碑街道民生路</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="main-body product-info">
  48. <view class="main-body-til">
  49. <view class="til">产品信息</view>
  50. </view>
  51. <view class="main-body-info">
  52. <view class="product-info-item">
  53. 产品类型:
  54. </view>
  55. <view class="product-info-item">
  56. 村小组:
  57. </view>
  58. <view class="product-info-item">
  59. 造林主体:
  60. </view>
  61. <view class="product-info-item">
  62. 小地名:
  63. </view>
  64. </view>
  65. </view>
  66. <view class="bottom-btn-wrap">
  67. <view class="bottom-btn-wrap-bg">
  68. <view class="bottom-btn btn" @click="randomPop">
  69. 立即购碳
  70. </view>
  71. </view>
  72. </view>
  73. <quick-buy class="quickbuy" ref="quickBuy" @closeModal="closeModal" productType='self' :prohelpPeople='prohelpPeople' :visible="modal.visibleModal" v-if="modal.visibleModal"></quick-buy>
  74. </view>
  75. </template>
  76. <script>
  77. import quickBuy from '../index/modal/quickBuy';
  78. export default {
  79. components:{
  80. quickBuy,
  81. },
  82. data() {
  83. return {
  84. $getimg:this.$getimg,
  85. $onlineImg:this.$onlineImg,
  86. token:'',
  87. thetoken:'',
  88. modal: {
  89. visibleModal: false
  90. },
  91. params:{
  92. goodsId:'',
  93. },
  94. bannerList:[],
  95. swiper: {
  96. indicatorDots: true,
  97. autoplay: true,
  98. interval: 9000,
  99. duration: 500,
  100. indicatorColor:"rgba(255, 255, 255, 0.7)",
  101. indicatorActiveColor:"rgba(255, 255, 255, 1)",
  102. },
  103. product:null,
  104. prohelpPeople:[{'goodsName':'','goodsImages':'','guid':'','price':0,carbonSkin:0}],//要传递的数据
  105. time:'2020',
  106. }
  107. },
  108. onShow() {
  109. },
  110. onLoad(option) {
  111. // console.log('option',option);
  112. this.thetoken = 'Bearer' + ' ' + this.$store.state.token;
  113. this.params.goodsId = option.guid;
  114. this.getdetails();
  115. },
  116. methods: {
  117. getdetails(){
  118. this.$api.http.get(this.config.apiBaseurl + '/carbon-h5/wap/goods/getById?goodsId='+this.params.goodsId,{
  119. header: {
  120. Accept:'application/json',
  121. Authorization: this.thetoken, //注意Bearer后面有一空格
  122. },
  123. }).then(res => {
  124. this.bannerList = res.data.retBody.goodsImages.split(';');
  125. this.product = res.data.retBody;
  126. this.prohelpPeople[0].goodsName=res.data.retBody.goodsName;
  127. this.prohelpPeople[0].goodsImages=res.data.retBody.goodsImages;
  128. this.prohelpPeople[0].guid=res.data.retBody.guid;
  129. this.prohelpPeople[0].price=res.data.retBody.price;
  130. // console.log('res',JSON.parse(JSON.stringify(res.data.retBody)));
  131. }).catch(err =>{
  132. console.log('err',err)
  133. });
  134. },
  135. //开启多株购碳
  136. randomPop() {
  137. this.modal.visibleModal = true;
  138. this.$nextTick(res => {
  139. // console.log('this.$refs',this.$refs.quickBuy)
  140. this.$refs.quickBuy.openPop();
  141. });
  142. },
  143. closeModal() {
  144. this.modal.visibleModal = false;
  145. },
  146. }
  147. }
  148. </script>
  149. <style>
  150. @import url("./product.css");
  151. </style>