list.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <s-layout title="发票管理" :bgStyle="{ color: '#FFF' }">
  3. <view v-if="state.list.length">
  4. <s-invoice-item
  5. v-for="item in state.list"
  6. hasBorderBottom
  7. :key="item.id"
  8. :item="item"
  9. :isDefault="item.is_default"
  10. @tap="onSelect(item)"
  11. ></s-invoice-item>
  12. </view>
  13. <su-fixed bottom placeholder>
  14. <view class="footer-box ss-flex ss-row-between ss-p-20">
  15. <button
  16. class="add-btn ss-reset-button ui-Shadow-Main"
  17. @tap="sheep.$router.go('/pages/user/invoice/edit')"
  18. >
  19. 新增发票抬头
  20. </button>
  21. </view>
  22. </su-fixed>
  23. <s-empty
  24. v-if="state.list.length === 0 && !state.loading"
  25. text="暂无发票"
  26. icon="/static/data-empty.png"
  27. />
  28. </s-layout>
  29. </template>
  30. <script setup>
  31. import { reactive } from 'vue';
  32. import { onShow } from '@dcloudio/uni-app';
  33. import sheep from '@/sheep';
  34. import _ from 'lodash';
  35. const state = reactive({
  36. list: [],
  37. loading: true,
  38. });
  39. const onSelect = (invoiceInfo) => {
  40. uni.$emit('SELECT_INVOICE', {
  41. invoiceInfo,
  42. });
  43. sheep.$router.back();
  44. };
  45. onShow(async () => {
  46. state.list = (await sheep.$api.user.invoice.list()).data;
  47. state.loading = false;
  48. });
  49. </script>
  50. <style lang="scss" scoped>
  51. // page{
  52. // background-color: red;
  53. // }
  54. .footer-box {
  55. .add-btn {
  56. flex: 1;
  57. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  58. border-radius: 80rpx;
  59. font-size: 30rpx;
  60. font-weight: 500;
  61. line-height: 80rpx;
  62. color: $white;
  63. position: relative;
  64. z-index: 1;
  65. }
  66. .sync-wxaddress {
  67. flex: 1;
  68. line-height: 80rpx;
  69. background: $white;
  70. border-radius: 80rpx;
  71. font-size: 30rpx;
  72. font-weight: 500;
  73. color: $dark-6;
  74. margin-right: 16rpx;
  75. }
  76. }
  77. </style>