productdetails.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="产品详情"
  5. :autoBack="true"
  6. :safeAreaInsetTop="true"
  7. >
  8. </u-navbar>
  9. <u-swiper
  10. :list="details.slideImgList"
  11. @change="e => currentNum = e.current"
  12. :autoplay="false"
  13. indicatorStyle="right: 20px"
  14. >
  15. <view
  16. slot="indicator"
  17. class="indicator-num"
  18. >
  19. <text class="indicator-num__text">{{ currentNum + 1 }}/{{ details.slideImgList.length }}</text>
  20. </view>
  21. </u-swiper>
  22. <view class="product-info view-wrap">
  23. <view class="red">
  24. <view class="" v-if="vuex_member_info.levelType>1">
  25. <text class="price">¥ <text class="price-num">{{details.vipPrice}}</text></text>
  26. <text class="vip-icon">VIP</text>
  27. </view>
  28. <view class="" v-else>
  29. <text class="price">¥ <text class="price-num">{{details.salePrice}}</text></text>
  30. </view>
  31. </view>
  32. <view class="u-flex u-row-between gray">
  33. <text v-if="vuex_member_info.levelType>1" class="line-through">¥ <text class="">{{details.salePrice}}</text></text>
  34. <text class="">库存 {{details.stock}}</text>
  35. </view>
  36. <view class="name">{{details.goodsName}}</view>
  37. </view>
  38. <view class="addr view-wrap">
  39. <view class="addr-line u-flex">
  40. <view class="addr-til">快递</view>
  41. <view class="addr-con u-flex">
  42. 包邮
  43. </view>
  44. </view>
  45. <view class="addr-line u-flex">
  46. <text class="addr-til">送至</text>
  47. <view class="addr-con u-flex u-flex-1">
  48. <view class="u-flex u-row-between u-flex-1">
  49. <text>贵阳市 南明区</text>
  50. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="comment view-wrap u-flex u-row-between">
  56. <view class="left">
  57. <text class="til">评价</text>
  58. <text class="num">({{details.commentNum}})</text>
  59. </view>
  60. <view class="right u-flex" @click="$u.route('/shopping/comment',{id:details.id})">
  61. <text>查看全部</text>
  62. <u-icon name="arrow-right" color="#676767" size="20"></u-icon>
  63. </view>
  64. </view>
  65. <view class="detail view-wrap">
  66. <view class="til">详情</view>
  67. <view class="con">
  68. {{details.detail}}
  69. </view>
  70. </view>
  71. <view class="details-tool-wrap">
  72. <view class="details-tool u-flex u-row-between">
  73. <view class="left u-flex">
  74. <view class="icon-wrap">
  75. <u-icon name="share" color="#676767" size="30"></u-icon>
  76. 分享
  77. </view>
  78. <view class="icon-wrap" @click="$u.route('/shopping/cart')">
  79. <u-icon name="shopping-cart" color="#676767" size="30"></u-icon>
  80. 购物车
  81. <u-badge class="badge" numberType="overflow" type="error " max="99" value="9" :absolute="true" :offset="[0,0]"></u-badge>
  82. </view>
  83. </view>
  84. <view class="right u-flex">
  85. <view class="btn add-btn">加入购物车</view>
  86. <view class="btn buy-btn">立即购买</view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. id:'',
  97. currentNum:0,
  98. swiperList: [],
  99. details:{
  100. slideImgList:[]
  101. }
  102. }
  103. },
  104. onShow() {
  105. },
  106. onLoad(page) {
  107. this.id = page.id;
  108. // console.log('this.id',this.id);
  109. this.getDetails(this.id);
  110. },
  111. methods: {
  112. getDetails(id){
  113. this.$u.api.memberGoodDetails({id:id}).then(res=>{
  114. console.log('res',res.data);
  115. this.details = res.data
  116. }).catch(err=>{
  117. console.log('getDetails',err.data);
  118. })
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. .indicator-num {
  125. padding: 2px 0;
  126. background-color: rgba(0, 0, 0, 0.35);
  127. border-radius: 100px;
  128. width: 35px;
  129. @include flex;
  130. justify-content: center;
  131. &__text {
  132. color: #FFFFFF;
  133. font-size: 12px;
  134. }
  135. }
  136. .product-info{
  137. .price-num{
  138. font-size: 60rpx;
  139. }
  140. .name{
  141. margin-top: 30rpx;
  142. font-size: 36rpx;
  143. font-weight: 600;
  144. color: #333;
  145. line-height: 50rpx;
  146. }
  147. }
  148. .addr{
  149. font-size: 30rpx;
  150. .addr-line{
  151. margin-bottom: 20rpx;
  152. }
  153. .addr-til{
  154. color: #999;
  155. margin-right: 40rpx;
  156. }
  157. .addr-con{
  158. color: #666;
  159. }
  160. }
  161. .comment{
  162. color: #999;
  163. .til{
  164. font-size: 30rpx;
  165. font-weight: 600;
  166. margin-right: 20rpx;
  167. color: #333;
  168. }
  169. }
  170. .detail{
  171. .til{
  172. font-size: 30rpx;
  173. color: #333;
  174. font-weight: 600;
  175. margin-bottom: 20rpx;
  176. }
  177. .con{
  178. // background-color: #F5F5F5;
  179. }
  180. }
  181. .details-tool-wrap{
  182. height: 98rpx;
  183. .details-tool{
  184. position: fixed;
  185. left: 0;
  186. right: 0;
  187. bottom: 0;
  188. height: 98rpx;
  189. background-color: #fff;
  190. }
  191. .left{
  192. text-align: center;
  193. color: #666;
  194. font-size: 24rpx;
  195. .icon-wrap{
  196. position: relative;
  197. margin-left: 20rpx;
  198. }
  199. }
  200. .right{
  201. .btn{
  202. padding: 19rpx 40rpx;
  203. border-radius: 40rpx;
  204. color: #fff;
  205. margin-right: 20rpx;
  206. }
  207. .add-btn{
  208. background-color: #FFB100;
  209. }
  210. .buy-btn{
  211. background-color: #FF3C3F;
  212. }
  213. }
  214. }
  215. </style>