index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div class="my-layout">
  3. <el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
  4. <el-form :inline="true" @submit.stop.prevent>
  5. <el-form-item>
  6. <p>所有项目默认抽成比例<span style="color:red;">{{ state.companydraw.currentRatio }}%</span> (抽成金额精确到小数点后一位)</p>
  7. <p v-if="state.companydraw.nextRatio != 0">修改所有项目默认抽成比例为<span style="color:red;"> {{state.companydraw.nextRatio}}% 于{{ state.companydraw.nextEffectDate}} </span>生效</p>
  8. </el-form-item>
  9. <el-form-item>
  10. <el-button type="text" @click="onCompanyEdit"> 修改 </el-button>
  11. </el-form-item>
  12. </el-form>
  13. </el-card>
  14. <el-card class="my-fill mt8" shadow="never">
  15. <el-table v-loading="state.loading" :data="state.listData" row-key="id" height="'100%'"
  16. style="width: 100%; height: 100%">
  17. <el-table-column type="expand">
  18. <template v-slot="props">
  19. <el-table :data="props.row.prices" style="width: 100%;margin-bottom: 20px;" row-key="id" >
  20. <el-table-column prop="name" label="结算标准" width="180">
  21. </el-table-column>
  22. <el-table-column prop="price" label="价格" width="180">
  23. </el-table-column>
  24. <el-table-column label="设价方式" min-width="180">
  25. <template #default="{ pRow }">
  26. <el-form label-position="left" inline class="demo-table-expand">
  27. <el-form-item>
  28. <el-select placeholder="请选择设价方式">
  29. <el-option label="抽成比例" value="1"></el-option>
  30. <el-option label="抽成金额" value="2"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-input placeholder="请输入设价信息"></el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. %
  38. </el-form-item>
  39. <el-form-item>
  40. <el-button type="primary" @click="SetPrice">设价</el-button>
  41. </el-form-item>
  42. </el-form>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="Logo" prop="logo" min-width="120" show-overflow-tooltip >
  49. <template #default="{ row }">
  50. <div class="block"><el-avatar shape="square" size="medium" :src="row.logo"></el-avatar></div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="项目名称" prop="name" min-width="120" show-overflow-tooltip />
  54. <el-table-column label="操作" width="180" header-align="center" align="center" fixed="right">
  55. <template #default="{ row }">
  56. <el-button size="small" text type="primary" @click="onDetail(row)">平台单独设价</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. </el-card>
  61. <!-- <LinkForm ref="LinkFormRef" :title="state.linkFormTitle"></LinkForm> -->
  62. <!-- <tenant-form ref="tenantFormRef" :title="state.tenantFormTitle"></tenant-form> -->
  63. <!-- 公司抽成from -->
  64. <company-form ref="companyFormRef" title="公司分成比例修改"></company-form>
  65. </div>
  66. </template>
  67. <script lang="ts" setup name="admin/projectprice">
  68. import { stat } from 'fs'
  69. import { onMounted, reactive, onBeforeMount, defineAsyncComponent, ref } from 'vue'
  70. import { CompanyDrawOutput,pageInputProjectPriceSetPageInput, PriceGetPageOutput } from '/@/api/admin/data-contracts'
  71. import { ProjectPriceApi } from '/@/api/admin/ProjectPrice'
  72. import eventBus from '/@/utils/mitt'
  73. // 引入组件
  74. const CompanyForm = defineAsyncComponent(() => import('./components/company-form.vue'))
  75. const companyFormRef = ref();
  76. const state = reactive({
  77. companydraw: {
  78. } as CompanyDrawOutput,
  79. loading: false,
  80. tenantFormTitle: '',
  81. linkFormTitle: '',
  82. filter: {
  83. },
  84. pageInput: {
  85. currentPage: 1,
  86. pageSize: 20,
  87. } as pageInputProjectPriceSetPageInput,
  88. total: 0,
  89. listData: [] as Array<PriceGetPageOutput>
  90. })
  91. onMounted(() => {
  92. onCompanyQuery();
  93. onQuery();
  94. eventBus.on('refreshCompanyDraw', async () => {
  95. onCompanyQuery();
  96. })
  97. eventBus.off('refreshProjectPrice')
  98. eventBus.on('refreshProjectPrice', async () => {
  99. onQuery()
  100. })
  101. })
  102. onBeforeMount(() => {
  103. eventBus.off('refreshProjectPrice')
  104. })
  105. //查询
  106. const onQuery = async () => {
  107. state.loading = true
  108. state.pageInput.filter = state.filter
  109. const res = await new ProjectPriceApi().getPricePage(state.pageInput).catch(() => {
  110. state.loading = false
  111. })
  112. state.listData = res?.data?.list ?? []
  113. state.total = res?.data?.total ?? 0
  114. state.loading = false
  115. }
  116. //查询公司抽成
  117. const onCompanyQuery = async () => {
  118. // state.loading = true
  119. const res = await new ProjectPriceApi().getCompanyDraw({ })
  120. if (res?.success) {
  121. state.companydraw = res.data as CompanyDrawOutput;
  122. state.companydraw.nextEffectDate = state.companydraw.nextEffectDate?.split(' ')[0];
  123. }
  124. }
  125. //更新公司抽成
  126. const onCompanyEdit = () => {
  127. companyFormRef.value.open()
  128. }
  129. //平台单独设价
  130. // const onDetail = (row: ProjectLinkManagePageOutput) => {
  131. // state.tenantFormTitle = '编辑租户'
  132. // tenantFormRef.value.open(row)
  133. // }
  134. </script>