index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']"
  3. class="bodycont">
  4. <tm-menubars ref="fenleig" title="分类" :shadow="0" :showback="true"></tm-menubars>
  5. <div class="cont" :style="{ height: (sys.windowHeight-80) + 'px' }">
  6. <tm-sheet black>
  7. <tm-sliderNav :style="{ height: (sys.windowHeight-80) + 'px' }" class="zuo fl" @change="change"
  8. :list="list" text color="red">
  9. </tm-sliderNav>
  10. <view class="fr you" :style="{ height: (sys.windowHeight-80) + 'px' }">
  11. <view class="huadong">
  12. <view class="py-10 text-size-g dianz mingri text-align-center mt-40">
  13. <image src="/static/img/88.png" mode="widthFix"></image>
  14. <text class="text-white">精选推荐</text>
  15. </view>
  16. <view class="yiguicla mt-20 ml-20 fl" v-for="item in quanbuList" @click="sort(item.id)">
  17. <image :src="item.src" mode="widthFix"></image>
  18. <view class="wenzi text-align-center text-size-m mt-8">{{item.text}}</view>
  19. </view>
  20. <view style="width:100%;height:40px;clear: both;"></view>
  21. </view>
  22. </view>
  23. <view style="clear: both;"></view>
  24. </tm-sheet>
  25. </div>
  26. <!-- 弹出层消息 -->
  27. <tm-message ref="toast"></tm-message>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. myRequest
  33. } from '@/api/request.js'
  34. export default {
  35. data() {
  36. return {
  37. list: [],
  38. quanbuList: [
  39. // {
  40. // src: '/static/img/45.png',
  41. // text: 'NEO CITY 涂鸦',
  42. // type: '手提包'
  43. // },
  44. ]
  45. };
  46. },
  47. onLoad() {
  48. },
  49. created() {
  50. this.sys = uni.getSystemInfoSync();
  51. this.getTop();
  52. },
  53. methods: {
  54. // 获取一级分类
  55. getTop() {
  56. let that = this;
  57. myRequest({
  58. url: '/api/ShopGoods/getMallClassification',
  59. method: 'get',
  60. data: that.reqData
  61. }).then(res => {
  62. console.log(res.data);
  63. if (res.data.code == 200) {
  64. res.data.data.forEach(item => {
  65. that.list.push({
  66. id: item.id,
  67. img: item.image,
  68. title: item.category_name
  69. })
  70. })
  71. this.change(0)
  72. } else {
  73. that.$refs.toast.show({
  74. model: 'error',
  75. label: res.data.msg
  76. })
  77. }
  78. })
  79. },
  80. // 切换更换二级分类
  81. change(e) {
  82. let that = this;
  83. myRequest({
  84. url: '/api/ShopGoods/getMallChildrenClassification',
  85. method: 'post',
  86. data: {
  87. 'id': that.list[e].id
  88. }
  89. }).then(res => {
  90. if (res.data.code == 200) {
  91. that.quanbuList = [];
  92. res.data.data.forEach(item => {
  93. that.quanbuList.push({
  94. id:item.id,
  95. src: item.image,
  96. text: item.category_name
  97. })
  98. })
  99. } else {
  100. that.$refs.toast.show({
  101. model: 'error',
  102. label: res.data.msg
  103. })
  104. }
  105. })
  106. // uni.$tm.toast(`您选中了:${e}`)
  107. },
  108. sort(id){
  109. console.log(id);
  110. uni.navigateTo({
  111. url:'/pages/sort/index?id='+id
  112. })
  113. }
  114. },
  115. }
  116. </script>
  117. <style lang="scss">
  118. /deep/ .tm-menubars .body {
  119. background-color: #1b1b1b !important;
  120. }
  121. // /deep/ .zhuti{padding: 10px 10px;}
  122. // page,.bodycont{height:100%;}
  123. /deep/ .cont {
  124. overflow: hidden;
  125. }
  126. /deep/ .kuang {
  127. margin: 0 !important;
  128. padding: 0px !important;
  129. }
  130. /deep/ .zuo .grey-darken-4.bk {
  131. background-color: #0D0D0D !important;
  132. }
  133. /deep/ .zuo .uni-scroll-view-content {
  134. background-color: #0D0D0D !important;
  135. }
  136. /deep/ .cont .shadow-white-5 {
  137. padding: 0px !important;
  138. margin: 0px !important
  139. }
  140. /deep/ .zuo .border-red-l-2.bk {
  141. border-left-color: #0178FD !important;
  142. }
  143. /deep/ .zuo .text-red,
  144. /deep/ .zuo .text-grey-darken-1 {
  145. color: white !important;
  146. }
  147. .yiguicla image {
  148. width: 100%;
  149. display: block;
  150. margin: 0 auto;
  151. margin-top: 5px;
  152. border-radius: 10px;
  153. }
  154. .yiguicla {
  155. width: 45%;
  156. border-radius: 10px;
  157. position: relative;
  158. padding: 0px !important;
  159. }
  160. .wenzi {
  161. position: absolute;
  162. bottom: 0px;
  163. background: #BCC2C7;
  164. color: white;
  165. width: 100%;
  166. height: 25px;
  167. border-radius: 0px 0px 10px 10px;
  168. }
  169. // /deep/ .zuo uni-scroll-view{height: calc(100% - 45px) !important;}
  170. .mingri image {
  171. width: 25px;
  172. margin-right: 12px;
  173. vertical-align: middle;
  174. }
  175. .mingri text {
  176. vertical-align: middle;
  177. }
  178. .you {
  179. width: calc(100% - 100px);
  180. overflow: auto;
  181. }
  182. .zuo {
  183. overflow: hidden;
  184. }
  185. </style>