|
@@ -19,30 +19,31 @@
|
|
|
<el-table :data="props.row.prices" style="width: 100%;margin-bottom: 20px;" row-key="id" >
|
|
|
<el-table-column prop="name" label="结算标准" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="price" label="价格" width="180">
|
|
|
+ <el-table-column prop="price" label="价格" width="160">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="设价方式" min-width="180">
|
|
|
<template #default="{ row }">
|
|
|
<el-form :inline="true" @submit.stop.prevent>
|
|
|
- <el-form-item>
|
|
|
- <el-select placeholder="请选择设价方式" v-model="row.drawPriceWay">
|
|
|
- <el-option label="请选择设价方式" value="0"></el-option>
|
|
|
- <el-option label="抽成比例" value="1"></el-option>
|
|
|
- <el-option label="抽成金额" value="2"></el-option>
|
|
|
+ <el-form-item style="width:120px">
|
|
|
+ <el-select placeholder="设价方式" v-model="row.drawPriceWay" >
|
|
|
+ <el-option label="抽成比例" :value="1"></el-option>
|
|
|
+ <el-option label="抽成金额" :value="2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-input v-if="row.drawPriceWay == 2" v-model="row.drawPrice" placeholder="请输入设价信息"></el-input>
|
|
|
- <el-input v-if="row.drawPriceWay != 2" v-model="row.drawRatio" placeholder="请输入设价信息"></el-input>
|
|
|
+ <el-form-item style="width: 180px;">
|
|
|
+ <el-input v-if="row.drawPriceWay == 2" v-model="row.drawPrice" placeholder="请输入设价信息">
|
|
|
+ <template v-slot:append>元</template>
|
|
|
+ </el-input>
|
|
|
+ <el-input v-if="row.drawPriceWay != 2" v-model="row.drawRatio" placeholder="请输入设价信息">
|
|
|
+ <template v-slot:append>%</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="props.row.status != 1" style="width:120px">
|
|
|
+ <el-date-picker v-model="row.effectDate" type="date" placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
</el-form-item>
|
|
|
- <el-form-item v-if="row.drawPriceWay==2">
|
|
|
- 元
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-else >
|
|
|
- %
|
|
|
- </el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="text" @click="onSetProjectPrice(row)"> 设价 </el-button>
|
|
|
+ <el-button type="text" @click="onSetProjectPrice(row, props.row.status)"> 设价 </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
@@ -83,11 +84,11 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup name="admin/projectprice">
|
|
|
-import { stat } from 'fs'
|
|
|
-import { onMounted, reactive, onBeforeMount, defineAsyncComponent, ref } from 'vue'
|
|
|
-import { CompanyDrawOutput,pageInputProjectPriceSetPageInput, PriceGetPageOutput } from '/@/api/admin/data-contracts'
|
|
|
+import { onMounted, reactive, onBeforeMount, defineAsyncComponent, ref, getCurrentInstance } from 'vue'
|
|
|
+import { CompanyDrawOutput,pageInputProjectPriceSetPageInput, PriceGetPageOutput, PriceGetPageOutput_Price } from '/@/api/admin/data-contracts'
|
|
|
import { ProjectPriceApi } from '/@/api/admin/ProjectPrice'
|
|
|
import eventBus from '/@/utils/mitt'
|
|
|
+const { proxy } = getCurrentInstance() as any
|
|
|
|
|
|
// 引入组件
|
|
|
const CompanyForm = defineAsyncComponent(() => import('./components/company-form.vue'))
|
|
@@ -100,7 +101,7 @@ const state = reactive({
|
|
|
TenantPriceFormTitle:'',
|
|
|
companydraw: {
|
|
|
} as CompanyDrawOutput,
|
|
|
- loading: false,
|
|
|
+ loading: false,
|
|
|
linkFormTitle: '',
|
|
|
filter: {
|
|
|
},
|
|
@@ -109,7 +110,7 @@ const state = reactive({
|
|
|
pageSize: 20,
|
|
|
} as pageInputProjectPriceSetPageInput,
|
|
|
total: 0,
|
|
|
- listData: [] as Array<PriceGetPageOutput>
|
|
|
+ listData: [] as Array<PriceGetPageOutput>,
|
|
|
})
|
|
|
onMounted(() => {
|
|
|
onCompanyQuery();
|
|
@@ -122,7 +123,6 @@ onMounted(() => {
|
|
|
eventBus.on('refreshProjectPrice', async () => {
|
|
|
onQuery()
|
|
|
})
|
|
|
-
|
|
|
})
|
|
|
onBeforeMount(() => {
|
|
|
eventBus.off('refreshCompanyDraw')
|
|
@@ -135,15 +135,45 @@ const onQuery = async () => {
|
|
|
const res = await new ProjectPriceApi().getPricePage(state.pageInput).catch(() => {
|
|
|
state.loading = false
|
|
|
})
|
|
|
- state.listData = res?.data?.list ?? []
|
|
|
+ //数据重组
|
|
|
+ const listData = res?.data?.list ?? [];
|
|
|
+ for (let index = 0; index < listData.length; index++) {
|
|
|
+ const prices = listData[index]?.prices ?? [];
|
|
|
+ for (let j = 0; j < prices.length; j++) {
|
|
|
+ const price = prices[j];
|
|
|
+ if (price.drawPriceWay === 1) {
|
|
|
+ price.drawPrice = null;
|
|
|
+ }
|
|
|
+ else if (price.drawPriceWay === 2) {
|
|
|
+ price.drawRatio = null;
|
|
|
+ } else{
|
|
|
+ price.drawRatio = null;
|
|
|
+ price.drawPrice = null;
|
|
|
+ price.drawPriceWay = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("重组之后",listData);
|
|
|
+ state.listData = listData
|
|
|
state.total = res?.data?.total ?? 0
|
|
|
state.loading = false
|
|
|
}
|
|
|
//设置项目价格
|
|
|
-const onSetProjectPrice = async (row: any) => {
|
|
|
- // state.sureLoading = true
|
|
|
- let res = {} as any
|
|
|
-
|
|
|
+const onSetProjectPrice = async (row: PriceGetPageOutput_Price,status:number) => {
|
|
|
+ // state.sureLoading = true
|
|
|
+ if (row.drawPriceWay !=1 && row.drawPriceWay != 2) {
|
|
|
+ proxy.$modal.alertError(`请选择设价方式!`)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ((row.drawPriceWay == 1 && row.drawRatio==null)|| (row.drawPriceWay == 2 && row.drawPrice == null)) {
|
|
|
+ proxy.$modal.alertError(`请请输入设价信息!`)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (status != 1 && row.effectDate == null) {
|
|
|
+ proxy.$modal.alertError(`请输入生效日期!`)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let res = {} as any
|
|
|
res = await new ProjectPriceApi().updateProjectPrice(row, { showSuccessMessage: true }).catch(() => {
|
|
|
// state.sureLoading = false
|
|
|
})
|