index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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="yifu()">
  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. // src: '/static/img/46.png',
  45. // text: '满印迷你标识',
  46. // type: '围巾'
  47. // }, {
  48. // src: '/static/img/47.png',
  49. // text: '大号版型夹克',
  50. // type: '新品'
  51. // }, {
  52. // src: '/static/img/45.png',
  53. // text: 'NEO CITY 涂鸦',
  54. // type: '手提包'
  55. // }, {
  56. // src: '/static/img/46.png',
  57. // text: '满印迷你标识',
  58. // type: '围巾'
  59. // }, {
  60. // src: '/static/img/47.png',
  61. // text: '大号版型夹克',
  62. // type: '新品'
  63. // }, {
  64. // src: '/static/img/46.png',
  65. // text: '满印迷你标识',
  66. // type: '围巾'
  67. // }, {
  68. // src: '/static/img/47.png',
  69. // text: '大号版型夹克',
  70. // type: '新品'
  71. // }, {
  72. // src: '/static/img/45.png',
  73. // text: 'NEO CITY 涂鸦',
  74. // type: '手提包'
  75. // }
  76. ]
  77. };
  78. },
  79. onLoad() {
  80. },
  81. created() {
  82. this.sys = uni.getSystemInfoSync();
  83. this.getTop();
  84. },
  85. methods: {
  86. // 获取一级分类
  87. getTop() {
  88. let that = this;
  89. myRequest({
  90. url: '/api/ShopGoods/getMallClassification',
  91. method: 'get',
  92. data: that.reqData
  93. }).then(res => {
  94. console.log(res.data);
  95. if (res.data.code == 200) {
  96. res.data.data.forEach(item => {
  97. that.list.push({
  98. id: item.id,
  99. img: item.image,
  100. title: item.category_name
  101. })
  102. })
  103. this.change(0)
  104. } else {
  105. that.$refs.toast.show({
  106. model: 'error',
  107. label: res.data.msg
  108. })
  109. }
  110. })
  111. },
  112. // 切换更换二级分类
  113. change(e) {
  114. let that = this;
  115. myRequest({
  116. url: '/api/ShopGoods/getMallChildrenClassification',
  117. method: 'post',
  118. data: {
  119. 'id': that.list[e].id
  120. }
  121. }).then(res => {
  122. if (res.data.code == 200) {
  123. that.quanbuList = [];
  124. res.data.data.forEach(item => {
  125. that.quanbuList.push({
  126. src: item.image,
  127. text: item.category_name
  128. })
  129. })
  130. } else {
  131. that.$refs.toast.show({
  132. model: 'error',
  133. label: res.data.msg
  134. })
  135. }
  136. })
  137. // uni.$tm.toast(`您选中了:${e}`)
  138. }
  139. },
  140. }
  141. </script>
  142. <style lang="scss">
  143. /deep/ .tm-menubars .body {
  144. background-color: #1b1b1b !important;
  145. }
  146. // /deep/ .zhuti{padding: 10px 10px;}
  147. // page,.bodycont{height:100%;}
  148. /deep/ .cont {
  149. overflow: hidden;
  150. }
  151. /deep/ .kuang {
  152. margin: 0 !important;
  153. padding: 0px !important;
  154. }
  155. /deep/ .zuo .grey-darken-4.bk {
  156. background-color: #0D0D0D !important;
  157. }
  158. /deep/ .zuo .uni-scroll-view-content {
  159. background-color: #0D0D0D !important;
  160. }
  161. /deep/ .cont .shadow-white-5 {
  162. padding: 0px !important;
  163. margin: 0px !important
  164. }
  165. /deep/ .zuo .border-red-l-2.bk {
  166. border-left-color: #0178FD !important;
  167. }
  168. /deep/ .zuo .text-red,
  169. /deep/ .zuo .text-grey-darken-1 {
  170. color: white !important;
  171. }
  172. .yiguicla image {
  173. width: 100%;
  174. display: block;
  175. margin: 0 auto;
  176. margin-top: 5px;
  177. border-radius: 10px;
  178. }
  179. .yiguicla {
  180. width: 45%;
  181. border-radius: 10px;
  182. position: relative;
  183. padding: 0px !important;
  184. }
  185. .wenzi {
  186. position: absolute;
  187. bottom: 0px;
  188. background: #BCC2C7;
  189. color: white;
  190. width: 100%;
  191. height: 25px;
  192. border-radius: 0px 0px 10px 10px;
  193. }
  194. // /deep/ .zuo uni-scroll-view{height: calc(100% - 45px) !important;}
  195. .mingri image {
  196. width: 25px;
  197. margin-right: 12px;
  198. vertical-align: middle;
  199. }
  200. .mingri text {
  201. vertical-align: middle;
  202. }
  203. .you {
  204. width: calc(100% - 100px);
  205. overflow: auto;
  206. }
  207. .zuo {
  208. overflow: hidden;
  209. }
  210. </style>