class.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="root">
  3. <view class="content dfsb">
  4. <view class="secTop">
  5. <scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y">
  6. <view @tap="choose(index)" :class="['topLi', topLiSel == index ? 'topsel' : '']" v-for="(item, index) in topData" :key="index">{{ item.name }}</view>
  7. </scroll-view>
  8. </view>
  9. <view class="topInfo">
  10. <view class="topCInfo">
  11. <scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y" @scrolltolower="lower">
  12. <view class="box dffs">
  13. <view @click="toNext(item)" class="goodLi dffd" v-for="(item, index) in classList" :key="index">
  14. <image class="gdImg" :src="item.logo" mode="aspectFill"></image>
  15. <view class="oneelli">{{ item.name || '商品名称' }}</view>
  16. </view>
  17. </view>
  18. <view v-if="classList.length < 1" class="nodata"><u-empty icon-size="200" text="新品即将上新,敬请期待~" mode="list"></u-empty></view>
  19. </scroll-view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. topData: [], //一层
  30. classList: [
  31. // { name: '姓名', goods_img: '/static/img/pro/hotbgzj.png' },
  32. ], //商品
  33. topLiSel: 0, //一层分类选中
  34. status: 'loadmore',
  35. page: 1,
  36. pagnum: 15
  37. };
  38. },
  39. onLoad(opt) {
  40. this.onload();
  41. },
  42. onPullDownRefresh() {
  43. this.page = 1;
  44. this.topLiSel = 0;
  45. this.topData = [];
  46. this.classList = [];
  47. this.onload();
  48. setTimeout(function() {
  49. uni.stopPullDownRefresh();
  50. }, 800);
  51. },
  52. onReachBottom() {
  53. if (this.status == 'nomore') return;
  54. this.status = 'loadmore';
  55. this.page = ++this.page;
  56. this.onload();
  57. },
  58. onShow() {},
  59. methods: {
  60. toNext(item) {
  61. uni.navigateTo({
  62. url: '/pagesA/mall/mall?flag=2&type=1&id=' + item.id
  63. });
  64. },
  65. choose(index) {
  66. this.topLiSel = index;
  67. this.classList = this.topData[this.topLiSel].son;
  68. },
  69. onload() {
  70. this.status = 'loadmore';
  71. this.$api.request('goods/goods_catlist').then(data => {
  72. console.log(data);
  73. if (data.code == 200) {
  74. this.topData = data.data;
  75. this.classList = this.topData[this.topLiSel].son;
  76. } else {
  77. this.$api.toast(data.msg);
  78. }
  79. });
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .content {
  86. margin-top: 20rpx;
  87. // padding: 20rpx 0;
  88. background-color: #fff;
  89. align-items: flex-start;
  90. border-top: 1rpx solid #e8e8e8;
  91. .secTop {
  92. width: 177rpx;
  93. height: calc(100vh - 20rpx);
  94. .scroll-Y {
  95. height: calc(100vh - 20rpx);
  96. flex-wrap: wrap;
  97. }
  98. .topLi {
  99. font-size: 26rpx;
  100. width: 177rpx;
  101. padding: 26rpx 0;
  102. line-height: 37rpx;
  103. text-align: center;
  104. background: #f4f4f4;
  105. color: #666;
  106. }
  107. .topsel {
  108. font-size: 28rpx;
  109. box-sizing: border-box;
  110. background-color: #fff;
  111. color: $promain;
  112. font-weight: 600;
  113. }
  114. }
  115. .topInfo {
  116. flex: 1;
  117. // background-color: #fff;
  118. .topClass {
  119. position: fixed;
  120. z-index: 1;
  121. background-color: #fff;
  122. padding-left: 15rpx;
  123. width: 556rpx;
  124. .topClaBox {
  125. flex: 1;
  126. height: 98rpx;
  127. line-height: 98rpx;
  128. display: -webkit-box;
  129. overflow-x: auto;
  130. /*适应苹果*/
  131. -webkit-overflow-scrolling: touch;
  132. //父盒子隐藏滚动条
  133. &::-webkit-scrollbar {
  134. display: none;
  135. }
  136. .topClasLi {
  137. font-size: 28rpx;
  138. padding: 0 15rpx;
  139. }
  140. .topClasel {
  141. color: $promain;
  142. }
  143. }
  144. .classDown {
  145. height: 98rpx;
  146. width: 70rpx;
  147. box-shadow: -2rpx -5rpx 2rpx 5rpx rgba($color: #000000, $alpha: 0.05);
  148. background-color: #fff;
  149. .xuanz {
  150. transform: translate(180deg);
  151. }
  152. }
  153. }
  154. .topCInfo {
  155. margin-left: 42rpx;
  156. flex: 1;
  157. height: calc(100vh - 20rpx);
  158. .maskbg {
  159. position: fixed;
  160. top: 170rpx;
  161. left: 200rpx;
  162. width: calc(100% - 120rpx);
  163. height: calc(100% - 100rpx);
  164. background-color: rgba(0, 0, 0, 0.65);
  165. z-index: 2;
  166. }
  167. /* #ifdef MP */
  168. .maskbg {
  169. position: fixed;
  170. top: 70rpx;
  171. }
  172. /* #endif */
  173. .scroll-Y {
  174. height: calc(100vh - 20rpx);
  175. }
  176. .box {
  177. width: 100%;
  178. flex-wrap: wrap;
  179. }
  180. .goodLi {
  181. width: 120rpx;
  182. margin-top: 58rpx;
  183. align-items: center;
  184. margin-right: 55rpx;
  185. .gdImg {
  186. width: 100%;
  187. height: 120rpx;
  188. background-color: #fbf9fa;
  189. margin-bottom: 36rpx;
  190. }
  191. .oneelli {
  192. text-align: center;
  193. font-size: 24rpx;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. .cartBox {
  200. width: 710rpx;
  201. position: fixed;
  202. bottom: 10rpx;
  203. /* #ifdef H5 */
  204. bottom: 128rpx;
  205. /* #endif */
  206. left: 0;
  207. z-index: 999;
  208. margin: 0 20rpx;
  209. .leftbox {
  210. height: 100rpx;
  211. flex: 1;
  212. background: #000000;
  213. border-radius: 200rpx 0px 0px 200rpx;
  214. padding-left: 30rpx;
  215. .imgBox {
  216. position: relative;
  217. image {
  218. width: 90rpx;
  219. height: 82rpx;
  220. }
  221. }
  222. .priceInfo {
  223. position: relative;
  224. margin-left: 60rpx;
  225. .price {
  226. color: #fff;
  227. }
  228. }
  229. }
  230. .rightbox {
  231. height: 100rpx;
  232. line-height: 100rpx;
  233. text-align: center;
  234. color: #fff;
  235. background: #d8d8d8 linear-gradient(90deg, #6fd237 0%, #57c32a 100%);
  236. border-radius: 0px 200rpx 200rpx 0px;
  237. width: 194rpx;
  238. }
  239. .ordbox {
  240. font-size: 24rpx;
  241. text-align: center;
  242. margin-bottom: 10rpx;
  243. text {
  244. font-size: 30rpx;
  245. }
  246. // height: 100rpx;
  247. // line-height: 100rpx;
  248. // text-align: center;
  249. // color: #fff;
  250. // background: linear-gradient(90deg, #6fd237 0%, #57c32a 100%);
  251. // border-radius: 200rpx ;
  252. // margin-right: 15rpx;
  253. // padding: 0 20rpx;
  254. }
  255. .rightBlack {
  256. background: #000;
  257. color: #999;
  258. }
  259. }
  260. .ordbtn {
  261. position: fixed;
  262. bottom: 130rpx;
  263. right: 0;
  264. z-index: 999;
  265. width: 150rpx;
  266. height: 150rpx;
  267. line-height: 150rpx;
  268. border-radius: 50%;
  269. color: #fff;
  270. text-align: center;
  271. vertical-align: middle;
  272. font-size: 30rpx;
  273. background: radial-gradient(#68e670 0%, #5dce2c 100%);
  274. }
  275. </style>