index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: index.vue
  4. * @Description: 审批查看(直销)
  5. * @Author: xinyan
  6. */
  7. import VerticalDivider from '/src/components/VerticalDivider/index.vue';
  8. import { RefreshLeft, Search } from '@element-plus/icons-vue';
  9. import { useResponse } from '/@/utils/useResponse';
  10. import { useTemplateRef } from 'vue';
  11. import * as api from './api';
  12. import DataTable from './component/DataTable.vue';
  13. import { useTableHeight } from '/@/utils/useTableHeight';
  14. const titleContainer: Ref<HTMLElement | null> = useTemplateRef('titleContainer');
  15. const queryContainer: Ref<HTMLElement | null> = useTemplateRef('queryContainer');
  16. const { tableHeight } = useTableHeight(titleContainer, queryContainer);
  17. const tableRef: Ref<any> = useTemplateRef('table');
  18. const btnLoading = ref(false);
  19. const resetLoading = ref(false);
  20. const formInline = reactive<any>({
  21. description: '',
  22. platform: '',
  23. station: '',
  24. });
  25. provide('query-parameter', formInline);
  26. const stationOptions = <any>ref([]);
  27. const platformOptions = <any>ref([]);
  28. provide('stationOptions', stationOptions);
  29. provide('platformOptions', platformOptions);
  30. onBeforeMount(() => {
  31. fetchOptions();
  32. });
  33. async function fetchOptions() {
  34. const resp = (await useResponse(api.getCostOptions)).data;
  35. platformOptions.value = resp.platform_list;
  36. stationOptions.value = resp.station_list;
  37. }
  38. async function handleQuery() {
  39. btnLoading.value = true;
  40. await tableRef.value?.fetchList(true);
  41. btnLoading.value = false;
  42. }
  43. async function resetParameter() {
  44. for (const key in formInline) {
  45. formInline[key] = '';
  46. }
  47. resetLoading.value = true;
  48. await tableRef.value?.fetchList(true);
  49. resetLoading.value = false;
  50. }
  51. </script>
  52. <template>
  53. <div class="p-5">
  54. <el-card class="h-full" style="color: rgba(0, 0, 0, 0.88)">
  55. <div ref="titleContainer" class="text-xl font-semibold pb-5">成本查看</div>
  56. <!-- 查询条件 -->
  57. <div ref="queryContainer" class="flex justify-between">
  58. <div class="flex flex-1">
  59. <div class="w-full whitespace-nowrap">
  60. <el-row :gutter="20" style="margin-bottom: 5px">
  61. <el-col :span="5">
  62. <div class="flex items-center">
  63. <span class="mr-2">SKU</span>
  64. <el-input v-model="formInline.description" clearable placeholder="请输入SKU" />
  65. </div>
  66. </el-col>
  67. <el-col :span="5">
  68. <div class="flex items-center">
  69. <span class="mr-2">平 台</span>
  70. <el-select v-model="formInline.platform" placeholder="请选择平台">
  71. <el-option v-for="item in platformOptions" :key="item" :label="item" :value="item"> </el-option>
  72. </el-select>
  73. </div>
  74. </el-col>
  75. <el-col :span="5" class="flex">
  76. <div class="flex items-center">
  77. <span class="mr-2">地 区</span>
  78. <el-select v-model="formInline.station" clearable placeholder="请输入店铺">
  79. <el-option></el-option>
  80. </el-select>
  81. </div>
  82. </el-col>
  83. <el-col :span="5">
  84. <div class="flex items-center">
  85. <span class="mr-2">销售模式</span>
  86. <el-select v-model="formInline.description" clearable placeholder="请输入ASIN">
  87. <el-option></el-option>
  88. </el-select>
  89. </div>
  90. </el-col>
  91. </el-row>
  92. </div>
  93. </div>
  94. <VerticalDivider />
  95. <div class="flex gap-1.5 ml-5">
  96. <el-button :icon="Search" :loading="btnLoading" type="primary" @click="handleQuery"> 查 询 </el-button>
  97. <el-button :icon="RefreshLeft" :loading="resetLoading" color="#ECECF1C9" style="width: 88px; color: #3c3c3c" @click="resetParameter">
  98. 重 置
  99. </el-button>
  100. </div>
  101. </div>
  102. <el-divider ref="dividerContainer" style="margin: 20px 0 12px 0" />
  103. <div :style="{ height: tableHeight + 'px' }">
  104. <DataTable ref="table" />
  105. </div>
  106. </el-card>
  107. </div>
  108. </template>
  109. <style scoped></style>