index.vue 5.2 KB

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