product.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="container">
  3. <u-swiper :list="product.images" @change="e => currentNum = e.current" :autoplay="false" height="750rpx" radius="0" indicatorStyle="right: 20px">
  4. <view slot="indicator" class="indicator-num">
  5. <text class="indicator-num__text">{{ currentNum + 1 }}/{{ product.images.length }}</text>
  6. </view>
  7. </u-swiper>
  8. <view class="product-box">
  9. <view class="prod-info">
  10. <view class="info-text">
  11. <u--text :lines="2" size="14px" color="#333333" :text="product.title"></u--text>
  12. <u-gap height="5px"></u-gap>
  13. <u--text :lines="3" size="12px" color="#939393" :text="product.desc"></u--text>
  14. </view>
  15. <view class="price-and-cart">
  16. <u--text-price color="red" size="16" intSize="26" :text="product.price"></u--text-price>
  17. </view>
  18. </view>
  19. <view class="prod-collect">
  20. <u-icon name="heart" color="#2979ff" size="28"></u-icon>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. current: 0,
  30. currentNum: 0,
  31. product: {
  32. id: '',
  33. images: ['https://cdn.uviewui.com/uview/album/1.jpg', 'https://cdn.uviewui.com/uview/album/2.jpg', 'https://cdn.uviewui.com/uview/album/3.jpg'],
  34. title: '山不在高,有仙则名。水不在深,有龙则灵。斯是陋室,惟吾德馨。',
  35. desc: '山不在于高,有了神仙就会有名气。水不在于深,有了龙就会有灵气。这是简陋的房子,只是我品德好就感觉不到简陋了。',
  36. price: '13.00'
  37. }
  38. }
  39. },
  40. onLoad(e) {
  41. if (!e.productId) {
  42. uni.$u.toast('请求参数错误');
  43. } else {
  44. this.product.id = e.productId;
  45. this.loadProductData();
  46. // TODO 请求接口获取商品详情数据
  47. }
  48. console.log(e);
  49. },
  50. methods: {
  51. loadProductData(){
  52. }
  53. },
  54. computed: {
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .indicator-num {
  60. padding: 2px 0;
  61. background-color: rgba(0, 0, 0, 0.35);
  62. border-radius: 100px;
  63. width: 35px;
  64. @include flex;
  65. justify-content: center;
  66. &__text {
  67. color: #FFFFFF;
  68. font-size: 12px;
  69. }
  70. }
  71. .product-box {
  72. padding: 40rpx 40rpx 10rpx 40rpx;
  73. display: flex;
  74. border-bottom: $custom-border-style;
  75. .prod-info {
  76. padding-right: 30rpx;
  77. .info-text {
  78. padding-bottom: 10rpx;
  79. }
  80. .price-and-cart {
  81. display: flex;
  82. justify-content: space-between;
  83. }
  84. }
  85. .prod-collect {
  86. margin-top: 15rpx;
  87. }
  88. }
  89. </style>