my-business.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="my-business-box">
  3. <Navbar :title="_userInfo.balance === 1 ? '我的顾客' : '我的商家'" color="#333"></Navbar>
  4. <view class="content">
  5. <view class="item" v-for="item in list" :key="item.id">
  6. <image :src="item.shopIcon" mode="aspectFill"></image>
  7. <view class="info">
  8. <view class="name">{{item.shopName}}</view>
  9. <view class="status" :class="{status2: item.status === 3}">{{statusMap[item.status]}}</view>
  10. <view class="phone">商家手机号:{{item.shopPhone}}</view>
  11. </view>
  12. <view class="btn" @click="toDetail(item.id)">
  13. 详情
  14. <IconText :code="`\ue84a`" size="10" color="#fff"></IconText>
  15. </view>
  16. </view>
  17. <view class="no-data" v-if="!list.length">
  18. <NoData :show="!list.length" topNum="10" title="暂无商家!"></NoData>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script lang='ts'>
  24. import {
  25. Component,
  26. Prop,
  27. Vue
  28. } from 'vue-property-decorator';
  29. import {
  30. namespace
  31. } from 'vuex-class';
  32. const baseModule = namespace('base');
  33. @Component({})
  34. export default class MyBusiness extends Vue {
  35. @baseModule.Getter('_userInfo') _userInfo: any;
  36. list: any = [];
  37. current: number = 0;
  38. size: number = 20;
  39. finish: boolean = false;
  40. loading: boolean = false;
  41. statusMap: any = {
  42. 1: '待审核',
  43. 2: '审核通过',
  44. 3: '审核未通过'
  45. }
  46. onShow() {
  47. this.list = [];
  48. this.getBusinessList();
  49. }
  50. onReachBottom() {
  51. if (this.finish || this.loading) return;
  52. this.current++;
  53. this.getBusinessList();
  54. }
  55. getBusinessList() {
  56. this.$http
  57. .get({
  58. url: this.$api.getBusinessList,
  59. data: {
  60. page: this.current,
  61. size: this.size
  62. }
  63. })
  64. .then((res: any) => {
  65. this.list = [...this.list, ...res.list];
  66. if (res.list.length < this.size) this.finish = true;
  67. this.loading = false;
  68. }, (err: any) => {
  69. console.log(err);
  70. this.loading = false;
  71. });
  72. }
  73. toDetail(id: any) {
  74. this.$Router.push({
  75. path: '/packages/user/business/business-detail',
  76. query: {
  77. id
  78. }
  79. })
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .my-business-box {
  85. .content {
  86. .item {
  87. height: vw(88);
  88. background: #fff;
  89. margin-top: vw(10);
  90. @include flex-x();
  91. padding: 0 vw(15);
  92. image {
  93. width: vw(64);
  94. height: vw(64);
  95. border-radius: vw(5);
  96. }
  97. .info {
  98. flex: 1;
  99. height: vw(64);
  100. @include flex-y(space-between, flex-start);
  101. margin-right: vw(18);
  102. margin-left: vw(10);
  103. .name {
  104. @include word-vw(18, #333);
  105. }
  106. .status {
  107. padding: 0 vw(8);
  108. height: vw(16);
  109. background: #EDEDED;
  110. border-radius: vw(8);
  111. @include word-vw(10, #333);
  112. }
  113. .status2 {
  114. background: #FFE6E6;
  115. }
  116. .phone {
  117. @include word-vw(13, #333);
  118. }
  119. }
  120. .btn {
  121. width: vw(56);
  122. height: vw(24);
  123. border-radius: vw(12);
  124. background: $btn-color;
  125. @include flex-x(center);
  126. @include word-vw(14, #fff);
  127. }
  128. }
  129. }
  130. }
  131. </style>