product.vue 5.1 KB

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