Browse Source

项目设价待生效日期

zmq 1 year ago
parent
commit
7277c8f678

+ 20 - 1
src/api/admin/ProjectPrice.ts

@@ -7,7 +7,8 @@ import {
     ResultOutputPageOutputPriceGetPageOutput,
     PageInputTenantPriceGetPageInput,
     ResultOutputPageOutputTenantPriceGetPageOutput,
-    TenantDrawSetInput
+    TenantDrawSetInput,
+    DrawInfoInput
 } from './data-contracts'
 import { ContentType, HttpClient, RequestParams } from './http-client'
 
@@ -126,4 +127,22 @@ export class ProjectPriceApi<SecurityDataType = unknown> extends HttpClient<Secu
             type: ContentType.Json,
             ...params,
         })
+    /**
+* No description
+*
+* @tags project-price
+* @name get-draw-info
+* @summary 下次生效信息
+* @request Post:/api/admin/project-price/get-draw-info
+* @secure
+*/
+    GetDrawInfo = (data: DrawInfoInput, params: RequestParams = {}) =>
+        this.request<AxiosResponse, any>({
+            path: `/api/admin/project-price/get-draw-info`,
+            method: 'Post',
+            body: data,
+            secure: true,
+            type: ContentType.Json,
+            ...params,
+        })
 }

+ 6 - 0
src/api/admin/data-contracts.ts

@@ -5116,6 +5116,7 @@ export interface PriceGetPageOutput_Price {
   //设价金额
   drawPrice?: number | null,                    
   effectDate?: string | null,
+  isExistNextInfo?:number | null
 }
 export interface ProjectPriceSetInput {
   /** 项目价格Id */
@@ -5227,6 +5228,11 @@ export interface TenantDrawSetInput {
   /** 生效时间 */
   effectDate?: string|null
 }
+export interface DrawInfoInput {
+  TenantId?: number,
+  ProjectPriceId: number,
+  DrawType?: number | null,  
+}
 /** 项目统计管理分页信息输入 */
 export interface PageInputProjectStatManagePageInput {
   /**

+ 3 - 1
src/types/mitt.d.ts

@@ -25,6 +25,7 @@
  * @method refreshNotice 刷新公告
  * @method refreshProjectLink 刷新推广码
  * @method refreshProjectPrice 刷新项目价格
+ * @method refreshTenantProjectPrice 刷新平台项目价格
  * @method refreshCompanyDraw 刷新公司抽成
  * @method refreshProjectStat 刷新项目统计
  * @method refreshBanner 刷新轮播图
@@ -60,7 +61,8 @@ declare type MittType<T = any> = {
   refreshCompanyDraw?: T
   refreshProjectStat?: T
   refreshBanner?: T
-  refreshKuaKeInfo?:T
+  refreshKuaKeInfo?: T
+  refreshTenantProjectPrice?:T
 }
 
 // mitt 参数类型定义

+ 34 - 2
src/views/admin/projectprice/components/tenant-price.vue

@@ -34,6 +34,7 @@
                                                 </el-form-item>                                                                                               
                                                 <el-form-item>                                                          
                                                     <el-button type="text" @click="onSetPrice(row, props.row.id)"> 设价 </el-button>
+                                                    <el-button v-if="row.isExistNextInfo > 0" type="text" @click="onDrawInfo(row.projectPriceId, props.row.id)"> 待生效信息 </el-button>
                                                 </el-form-item>
                                             </el-form>                                    
                                         </template>
@@ -63,7 +64,7 @@
 </template>
 
 <script lang="ts" setup name="admin/projectprice/tenantprice">
-import { reactive,  getCurrentInstance } from 'vue'
+import { reactive,  getCurrentInstance, onMounted } from 'vue'
 import { PageInputTenantPriceGetPageInput, TenantPriceGetPageOutput, TenantDrawSetInput } from '/@/api/admin/data-contracts'
 import { ProjectPriceApi } from '/@/api/admin/ProjectPrice'
 import { formatDate } from '/@/utils/formatTime'
@@ -98,6 +99,12 @@ const state = reactive({
     total: 0, 
     listData: [] as Array<TenantPriceGetPageOutput>,
 })
+onMounted(() => {    
+    eventBus.off('refreshTenantProjectPrice')
+    eventBus.on('refreshTenantProjectPrice', async () => {
+        onQuery()
+    })
+})
 
 
 
@@ -169,8 +176,33 @@ const onSetPrice = async (row: TenantDrawSetInput,id:number) => {
     // state.sureLoading = false
 
     if (res?.success) {
-        eventBus.emit('refreshProjectPrice')
+        eventBus.emit('refreshTenantProjectPrice')
+        // state.showDialog = false
+    }
+}
+//待生效日期
+const onDrawInfo = async (projectPriceId: number,tenantId:number) => {
+    // state.sureLoading = true    
+    let res = await new ProjectPriceApi().GetDrawInfo({
+        ProjectPriceId: projectPriceId,
+        TenantId: tenantId,
+        DrawType: 3
+    }).catch(() => {
+        // state.sureLoading = false
+    })
+    
+    // state.sureLoading = false
+
+    if (res?.success && res?.data != null) {
+        const data = res.data;
+        let info = `修改抽成比例为 ${data.drawRatio}% 于${data.effectDate}生效`
+        if (res.data.drawWay == 2) {
+            info = `修改抽成金额为${data.drawRatio}元 于${data.effectDate}生效`
+        }
+        proxy.$modal.alert(`${info}`)
         // state.showDialog = false
+    } else {
+        proxy.$modal.alert(`无待生效信息,请刷新后重试`)
     }
 }
 const onSizeChange = (val: number) => {

+ 32 - 3
src/views/admin/projectprice/index.vue

@@ -43,7 +43,8 @@
                                             </el-date-picker>                                                                                                                                      
                                         </el-form-item>
                                         <el-form-item>                                                          
-                                            <el-button type="text" @click="onSetProjectPrice(row, props.row.status)"> 设价 </el-button>
+                                            <el-button type="text" @click="onSetProjectPrice(row, props.row.status)"> 设价 </el-button>                                            
+                                            <el-button v-if="(row?.isExistNextInfo?? 0) > 0" type="text" @click="onDrawInfo(row.id)"> 待生效信息 </el-button>
                                         </el-form-item>
                                     </el-form>                                    
                                 </template>
@@ -88,6 +89,7 @@ import { onMounted, reactive, onBeforeMount, defineAsyncComponent, ref, getCurre
 import { CompanyDrawOutput,pageInputProjectPriceSetPageInput, PriceGetPageOutput, PriceGetPageOutput_Price } from '/@/api/admin/data-contracts'
 import { ProjectPriceApi } from '/@/api/admin/ProjectPrice'
 import eventBus from '/@/utils/mitt'
+import { formatDate } from '/@/utils/formatTime'
 const { proxy } = getCurrentInstance() as any
 
 // 引入组件
@@ -173,8 +175,9 @@ const onSetProjectPrice = async (row: PriceGetPageOutput_Price,status:number) =>
         proxy.$modal.alertError(`请输入生效日期!`)
         return;
     }  
-    let res = {} as any    
-    res = await new ProjectPriceApi().updateProjectPrice(row, { showSuccessMessage: true }).catch(() => {
+    const effectDate = formatDate(row.effectDate, "YYYY-mm-dd")
+    row.effectDate = effectDate;    
+    let res = await new ProjectPriceApi().updateProjectPrice(row, { showSuccessMessage: true }).catch(() => {
         // state.sureLoading = false
     })
     
@@ -185,6 +188,32 @@ const onSetProjectPrice = async (row: PriceGetPageOutput_Price,status:number) =>
         // state.showDialog = false
     }
 }
+//待生效日期
+const onDrawInfo = async (ProjectPriceId: number) => {
+    // state.sureLoading = true   
+        
+    let res = await new ProjectPriceApi().GetDrawInfo({
+        ProjectPriceId: ProjectPriceId,
+        DrawType:2
+    }).catch(() => {
+        // state.sureLoading = false
+    })
+
+    console.log(res);
+    // state.sureLoading = false
+
+    if (res?.success && res?.data != null) {
+        const data = res.data;        
+         let info = `修改抽成比例为 ${ data.drawRatio }% 于${ data.effectDate }生效`
+        if (res.data.drawWay == 2) {
+            info = `修改抽成金额为${ data.drawRatio }元 于${ data.effectDate }生效`
+        }
+        proxy.$modal.alert(`${info}`)
+        // state.showDialog = false
+    } else { 
+        proxy.$modal.alert(`无待生效信息,请刷新后重试`)
+    }
+}
 //查询公司抽成
 const onCompanyQuery = async () => {
     // state.loading = true

+ 1 - 1
src/views/admin/projectstat/index.vue

@@ -252,7 +252,7 @@ const onSettle = async () => {
 }
 // 导出项目统计模板
 const onDownExcel = () => {   
-  let url = import.meta.env.VITE_API_URL + '/stat/项目统计模板.xlsx'
+  let url = import.meta.env.VITE_API_URL + '/projectstat.xlsx'
   window.open(url, '_self');
 }
 const onSizeChange = (val: number) => {