goods.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!--
  2. * @Descripttion: 订货tabber
  3. * @version: 1.0.0
  4. * @Author: dream
  5. * @Date: 2021-03-25 15:55:15
  6. * @LastEditors: dream
  7. * @LastEditTime: 2021-03-31 14:10:13
  8. -->
  9. <template>
  10. <view class="goods-main">
  11. <iph-header />
  12. <view class="goods-search-area">
  13. <u-search
  14. v-model="keyword"
  15. placeholder="请输入商品名称"
  16. bg-color="#F5F5F5"
  17. search-icon-color="#BABABA"
  18. placeholder-color="#999999"
  19. :show-action="false"
  20. ></u-search>
  21. </view>
  22. <view class="main u-flex u-col-top" :style="{ height: `${mainHeight}px` }">
  23. <view class="main-left">
  24. <iph-left-mune v-model="currentCateVal" :list="cateList" />
  25. </view>
  26. <scroll-view class="main-right u-flex-1" scroll-y>
  27. <block v-for="(item, index) in goodList" :key="index">
  28. <view class="u-p-b-48">
  29. <iph-good-card
  30. :showType="1"
  31. :value="item"
  32. :isShowEmpty="!item.stock"
  33. @cardClick="toGoodDetail"
  34. />
  35. </view>
  36. </block>
  37. <iph-empty :show="!goodList.length" :type="1" />
  38. </scroll-view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import IphHeader from '@/components/iphHeader.vue'
  44. import IphLeftMune from '@/components/iphLeftMenu.vue'
  45. import IphGoodCard from '@/components/iphGoodCard.vue'
  46. import IphEmpty from '@/components/iphEmpty.vue'
  47. export default {
  48. components: { IphHeader, IphLeftMune, IphGoodCard, IphEmpty },
  49. name: 'goods',
  50. data () {
  51. return {
  52. searchHeight: 0, // 搜索区域高度
  53. currentCateVal: 1,
  54. cateList: [{
  55. value: 1,
  56. label: '包材'
  57. }, {
  58. value: 2,
  59. label: '调料'
  60. }, {
  61. value: 3,
  62. label: '面粉'
  63. }],
  64. goodList: [{
  65. img: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=288400877,2749955263&fm=26&gp=0.jpg',
  66. astrict: '1件起订',
  67. name: '华硕天选',
  68. spce: '一件',
  69. warehouse: '云东仓',
  70. salesPrice: 468,
  71. originalPrice: 480,
  72. stock: 400
  73. }, {
  74. img: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=288400877,2749955263&fm=26&gp=0.jpg',
  75. astrict: '1件起订',
  76. name: '两行文案两行文案两行文案两行文案两行文案两行文案两行文案两',
  77. spce: '一件',
  78. warehouse: '云东仓',
  79. salesPrice: 468,
  80. stock: 0
  81. }]
  82. }
  83. },
  84. computed: {
  85. mainHeight () {
  86. const system = this.$store.state.systemStore.systemInfo
  87. const height = system.windowHeight - system.statusBarHeight - this.searchHeight - 48
  88. return height
  89. }
  90. },
  91. onReady () {
  92. const view = uni.createSelectorQuery().in(this).select('.goods-search-area')
  93. view.fields({
  94. size: true
  95. }, data => {
  96. this.searchHeight = data.height
  97. }).exec()
  98. },
  99. methods: {
  100. toGoodDetail () {
  101. uni.navigateTo({
  102. url: '/pageSubs/goods/detail'
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .goods-main {
  110. .goods-search-area {
  111. padding: 16px 24px 36px;
  112. background-color: $iph-standby-bg;
  113. }
  114. .main {
  115. box-sizing: border-box;
  116. width: 100%;
  117. .main-left {
  118. box-sizing: border-box;
  119. height: 100%;
  120. }
  121. .main-right {
  122. @extend .main-left;
  123. padding: 0 24px;
  124. background-color: $iph-standby-bg;
  125. }
  126. }
  127. }
  128. </style>