Storeclass.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view class="div container">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="店铺分类" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="div class-list">
  13. <flex-line v-for="item in storeclass_list" :is-link="true" :show-border="true" v-bind:key="item.storeclass_id" @click.native="goHomeStorelist(item.storeclass_id)">
  14. {{item.storeclass_name}}
  15. </flex-line>
  16. </view>
  17. <empty-record v-if="storeclass_list && !storeclass_list.length"></empty-record>
  18. </view></home-base>
  19. </template>
  20. <script>
  21. import {getFontSize} from '@/util/common'
  22. import TitleHeader from '../../TitleHeader'
  23. import { urlencode } from '@/util/common'
  24. import HomeBase from '../HomeBase'
  25. import { getStoreClass } from '../../../api/seller'
  26. import EmptyRecord from '../../EmptyRecord'
  27. import flexLine from '../../flexLine'
  28. export default {
  29. components:{
  30. TitleHeader,
  31. HomeBase,
  32. flexLine,
  33. EmptyRecord
  34. },
  35. name: 'Storeclass',
  36. mounted(){
  37. // #ifdef MP-WEIXIN
  38. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  39. // #endif
  40. },
  41. computed:{
  42. fontSize(){
  43. return getFontSize()
  44. },
  45. },
  46. data(){
  47. return {
  48. navHeight: 0,
  49. storeclass_list: false
  50. }
  51. },
  52. created: function () {
  53. this.getStoreclassList()
  54. },
  55. methods:{
  56. goBack(){uni.navigateBack({delta:1})},
  57. getStoreclassList () {
  58. uni.showLoading({ title: '加载中' })
  59. getStoreClass().then(res => {
  60. uni.hideLoading()
  61. this.storeclass_list = res.result.store_class
  62. }).catch(function (error) {
  63. uni.hideLoading()
  64. uni.showToast({icon:'none',title: error.message})
  65. })
  66. },
  67. goHomeStorelist (storeclassId) {
  68. uni.navigateTo({ url: '/pages/home/storelist/Storelist'+'?'+urlencode( { storeclass_id: storeclassId } )})
  69. }
  70. }
  71. }
  72. </script>
  73. <style scoped lang="scss">
  74. .class-list{padding:0 $pageSpace;background: #fff}
  75. </style>