brandDetail.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="container">
  3. <view class="brand-info">
  4. <view class="name">
  5. <image class="img" :src="brand.app_list_pic_url" background-size="cover"></image>
  6. <view class="info-box">
  7. <view class="info">
  8. <text class="txt">{{brand.name||''}}</text>
  9. <text class="line"></text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="desc">
  14. {{brand.simple_desc}}
  15. </view>
  16. </view>
  17. <view class="cate-item">
  18. <view class="b">
  19. <block v-for="(iitem, iindex) in goodsList" :key="iindex">
  20. <navigator :class="'item ' + (iindex % 2 == 0 ? 'item-b' : '')" :url="'../goods/goods?id='+iitem.id">
  21. <image class="img" :src="iitem.list_pic_url" background-size="cover"></image>
  22. <text class="name">{{iitem.name||''}}</text>
  23. <text class="price">¥{{iitem.retail_price||0}}</text>
  24. </navigator>
  25. </block>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. const util = require("@/utils/util.js");
  32. const api = require('@/utils/api.js');
  33. export default {
  34. data() {
  35. return {
  36. id: 0,
  37. brand: {},
  38. goodsList: [],
  39. page: 1,
  40. size: 1000
  41. }
  42. },
  43. methods: {
  44. getBrand: function() {
  45. let that = this;
  46. util.request(api.BrandDetail, {
  47. id: that.id
  48. }).then(function(res) {
  49. if (res.errno === 0) {
  50. that.brand = res.data.brand
  51. that.getGoodsList();
  52. }
  53. });
  54. },
  55. getGoodsList() {
  56. var that = this;
  57. util.request(api.GoodsList, {
  58. brandId: that.id,
  59. page: that.page,
  60. size: that.size
  61. }).then(function(res) {
  62. if (res.errno === 0) {
  63. that.goodsList = res.data.goodsList;
  64. }
  65. });
  66. }
  67. },
  68. onLoad: function(options) {
  69. // 页面初始化 options为页面跳转所带来的参数
  70. var that = this;
  71. that.id = parseInt(options.id);
  72. this.getBrand();
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. page {
  78. background: #f4f4f4;
  79. }
  80. .brand-info .name {
  81. width: 100%;
  82. height: 290rpx;
  83. position: relative;
  84. }
  85. .brand-info .img {
  86. position: absolute;
  87. top: 0;
  88. left: 0;
  89. width: 100%;
  90. height: 290rpx;
  91. }
  92. .brand-info .info-box {
  93. position: absolute;
  94. top: 0;
  95. left: 0;
  96. width: 100%;
  97. height: 290rpx;
  98. text-align: center;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. }
  103. .brand-info .info {
  104. display: block;
  105. }
  106. .brand-info .txt {
  107. display: block;
  108. height: 37.5rpx;
  109. font-size: 37.5rpx;
  110. color: #fff;
  111. }
  112. .brand-info .line {
  113. margin: 0 auto;
  114. margin-top: 16rpx;
  115. display: block;
  116. height: 2rpx;
  117. width: 145rpx;
  118. background: #fff;
  119. }
  120. .brand-info .desc {
  121. background: #fff;
  122. width: 100%;
  123. height: auto;
  124. overflow: hidden;
  125. padding: 41.5rpx 31.25rpx;
  126. font-size: 30rpx;
  127. color: #666;
  128. line-height: 41.5rpx;
  129. text-align: center;
  130. }
  131. .cate-item .b {
  132. width: 750rpx;
  133. height: auto;
  134. overflow: hidden;
  135. border-top: 1rpx solid #f4f4f4;
  136. margin-top: 20rpx;
  137. }
  138. .cate-item .b .item {
  139. float: left;
  140. background: #fff;
  141. width: 375rpx;
  142. padding-bottom: 33.333rpx;
  143. border-bottom: 1rpx solid #f4f4f4;
  144. height: auto;
  145. overflow: hidden;
  146. text-align: center;
  147. }
  148. .cate-item .b .item-b {
  149. border-right: 1rpx solid #f4f4f4;
  150. }
  151. .cate-item .item .img {
  152. margin-top: 10rpx;
  153. width: 302rpx;
  154. height: 302rpx;
  155. }
  156. .cate-item .item .name {
  157. display: block;
  158. width: 365.625rpx;
  159. height: 35rpx;
  160. padding: 0 20rpx;
  161. overflow: hidden;
  162. margin: 11.5rpx 0 22rpx 0;
  163. text-align: center;
  164. font-size: 30rpx;
  165. color: #333;
  166. }
  167. .cate-item .item .price {
  168. display: block;
  169. width: 365.625rpx;
  170. height: 30rpx;
  171. text-align: center;
  172. font-size: 30rpx;
  173. color: #b4282d;
  174. }
  175. </style>