Browse Source

平台设置价格

zmq 1 year ago
parent
commit
3bd446d0d6

+ 60 - 2
src/api/admin/ProjectPrice.ts

@@ -4,6 +4,9 @@ import {
     CompanyDrawInput,
     pageInputProjectPriceSetPageInput,
     ResultOutputPageOutputPriceGetPageOutput,
+    PageInputTenantPriceGetPageInput,
+    ResultOutputPageOutputTenantPriceGetPageOutput,
+    TenantDrawSetInput
 } from './data-contracts'
 import { ContentType, HttpClient, RequestParams } from './http-client'
 
@@ -54,17 +57,72 @@ export class ProjectPriceApi<SecurityDataType = unknown> extends HttpClient<Secu
    * @tags projectprice
    * @name GetPage
    * @summary 查询项目价格分页
-   * @request POST:/api/admin/project-price/get-page
+   * @request POST:/api/admin/project-price/get-project-page
    * @secure
    */
     getPricePage = (data: pageInputProjectPriceSetPageInput, params: RequestParams = {}) =>
         this.request<ResultOutputPageOutputPriceGetPageOutput, any>({
-            path: `/api/admin/project-price/get-page`,
+            path: `/api/admin/project-price/get-project-page`,
             method: 'Post',
             body: data,
             secure: true,
             type: ContentType.Json,
             format: 'json',
             ...params,
+        })   
+    /**
+  * No description
+  *
+  * @tags org
+  * @name Update
+  * @summary 修改公司抽成比例
+  * @request Post:/api/admin/project-price/set-project-price
+  * @secure
+  */
+    updateProjectPrice = (data: CompanyDrawInput, params: RequestParams = {}) =>
+        this.request<AxiosResponse, any>({
+            path: `/api/admin/project-price/set-project-price`,
+            method: 'Post',
+            body: data,
+            secure: true,
+            type: ContentType.Json,
+            ...params,
+        })
+    /**
+   * No description
+   *
+   * @tags projectprice
+   * @name GetPage
+   * @summary 查询平台单独设价分页
+   * @request POST:/api/admin/project-price/get-tenant-draw-page
+   * @secure
+   */
+    getTenantPage = (data: PageInputTenantPriceGetPageInput, params: RequestParams = {}) =>
+        this.request<ResultOutputPageOutputTenantPriceGetPageOutput, any>({
+            path: `/api/admin/project-price/get-tenant-draw-page`,
+            method: 'Post',
+            body: data,
+            secure: true,
+            type: ContentType.Json,
+            format: 'json',
+            ...params,
+        })
+    /**
+  * No description
+  *
+  * @tags org
+  * @name Update
+  * @summary 修改平台单独设置抽成比例
+  * @request Post:/api/admin/project-price/set-tenant-draw
+  * @secure
+  */
+    updateTenantPriceSet = (data: TenantDrawSetInput, params: RequestParams = {}) =>
+        this.request<AxiosResponse, any>({
+            path: `/api/admin/project-price/set-tenant-draw`,
+            method: 'Post',
+            body: data,
+            secure: true,
+            type: ContentType.Json,
+            ...params,
         })
 }

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

@@ -5091,6 +5091,18 @@ export interface PriceGetPageOutput_Price {
   //设价金额
   DrawPrice?: number,                    
 }
+export interface ProjectPriceSetInput {
+  /** 项目价格Id */
+  id?: number
+  /** 设价方式 */
+  drawPriceWay?: number
+  /** 抽成比例 */
+  drawRatio?: number
+  /** 抽成金额 */
+  drawPrice?: number
+  /** 生效时间 */
+  effectDate?: string
+}
 /** 公司抽成比例结果输出 */
 export interface ResultOutputCompanyDrawOutput {
   /** 是否成功标记 */
@@ -5116,3 +5128,74 @@ export interface CompanyDrawInput {
   /** 生效时间 */
   effectDate?: string  
 }
+/** 平台单独设价分页信息输入 */
+export interface PageInputTenantPriceGetPageInput {
+  /**
+   * 当前页标
+   * @format int32
+   */
+  currentPage?: number
+  /**
+   * 每页大小
+   * @format int32
+   */
+  pageSize?: number
+  dynamicFilter?: DynamicFilterInfo
+  filter?: TenantPriceGetPageInput
+}
+export interface TenantPriceGetPageInput {
+  projectId?:number
+}
+/** 结果输出 */
+export interface ResultOutputPageOutputTenantPriceGetPageOutput {
+  /** 是否成功标记 */
+  success?: boolean
+  /** 编码 */
+  code?: string | null
+  /** 消息 */
+  msg?: string | null
+  /** 分页信息输出 */
+  data?: PageOutputTenantPriceGetPageOutput
+}
+export interface PageOutputTenantPriceGetPageOutput {
+  /**
+   * 数据总数
+   * @format int64
+   */
+  total?: number
+  /** 数据 */
+  list?: TenantPriceGetPageOutput[] | null
+}
+export interface TenantPriceGetPageOutput {
+  // 项目id
+  id?: number  
+  // 名称
+  name?: string | null
+  // 价格
+  prices?: TenantPriceGetPageOutput_Price[] | null
+}
+export interface TenantPriceGetPageOutput_Price {
+  // id
+  id?: number
+  projectPriceId?: number
+  // 标题
+  name?: string
+  // 价格
+  price?: number
+  // 设价方式
+  drawPriceWay?: number,
+  //设价比率
+  DrawRatio?: number,
+  //设价金额
+  DrawPrice?: number,
+}
+export interface TenantDrawSetInput {
+  tenatntId: number,
+  projectPriceId: Number,
+  drawPriceWay: number,  
+  drawPrice: number,
+  /** 抽成比例 */
+  drawRatio?: number
+  /** 生效时间 */
+  effectDate?: string|null
+}

+ 152 - 0
src/views/admin/projectprice/components/tenant-price.vue

@@ -0,0 +1,152 @@
+<template>
+    <div>
+        <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable :close-on-click-modal="false"
+            :close-on-press-escape="false" width="1000px" height="700px">
+                <div>                    
+                    <el-card class="my-fill mt8" shadow="never">
+                    <el-table v-loading="state.loading" :data="state.listData" row-key="id" height="'100%'" style="width: 100%; height: 100%">                                                
+                        <el-table-column type="expand">
+                            <template v-slot="props">
+                                <el-table :data="props.row.prices" style="width: 100%;margin-bottom: 10px;" row-key="projectPriceId" >                                    
+                                    <el-table-column prop="name" label="结算标准" width="180">
+                                    </el-table-column>
+                                    <el-table-column prop="price" label="价格" width="100">
+                                    </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" style="width:110px">                                                        
+                                                        <el-option label="请选择" value="0"></el-option>
+                                                        <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="请输入设价信息" style="width:50px"></el-input>
+                                                    <el-input v-if="row.drawPriceWay != 2" v-model="row.drawRatio" placeholder="请输入设价信息" style="width:50px"></el-input>                                            
+                                                </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="onSetPrice(row, props.row.id)"> 设价 </el-button>
+                                                </el-form-item>
+                                            </el-form>                                    
+                                        </template>
+                                    </el-table-column>                            
+                                </el-table>
+                            </template>
+                        </el-table-column>                        
+                        <el-table-column label="平台名称" prop="name" min-width="100" show-overflow-tooltip/>                                                                        
+                    </el-table>
+                    <div class="my-flex my-flex-end" style="margin-top: 20px">
+                <el-pagination
+                  v-model:currentPage="state.pageInput.currentPage"
+                  v-model:page-size="state.pageInput.pageSize"
+                  :total="state.total"
+                  :page-sizes="[5, 10, 20, 50]"
+                  small
+                  background
+                  @size-change="onSizeChange"
+                  @current-change="onCurrentChange"
+                  layout="total, sizes, prev, pager, next, jumper"
+                />
+              </div>
+                </el-card>
+            </div>        
+        </el-dialog>
+    </div>
+</template>
+
+<script lang="ts" setup name="admin/projectprice/tenantprice">
+import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
+import { PageInputTenantPriceGetPageInput, TenantPriceGetPageOutput, TenantDrawSetInput } from '/@/api/admin/data-contracts'
+import { ProjectPriceApi } from '/@/api/admin/ProjectPrice'
+
+import eventBus from '/@/utils/mitt'
+
+
+defineProps({
+    title: {
+        type: String,
+        default: '',
+    },
+})
+
+// const { proxy } = getCurrentInstance() as any
+
+// const formRef = ref()
+const state = reactive({
+    showDialog: false,
+    sureLoading: false, 
+    loading: false, 
+    filter: {
+        projectId: 0,        
+    },
+    pageInput: {
+        currentPage: 1,
+        pageSize: 5,
+    } as PageInputTenantPriceGetPageInput,
+    total: 0, 
+    listData: [] as Array<TenantPriceGetPageOutput>,
+})
+
+
+
+
+// 打开对话框
+const open = async (row: any = {}) => {    
+    state.filter.projectId = row.id;
+
+    onQuery();
+
+    state.showDialog = true
+}
+
+//查询
+const onQuery = async () => {
+    state.loading = true
+
+    state.pageInput.filter = state.filter
+    const res = await new ProjectPriceApi().getTenantPage(state.pageInput).catch(() => {
+        state.loading = false
+    })
+    state.listData = res?.data?.list ?? []
+    state.total = res?.data?.total ?? 0
+    state.loading = false
+}
+// 设价
+const onSetPrice = async (row: TenantDrawSetInput,id:number) => {
+    // state.sureLoading = true
+    row.tenatntId=id;                
+    let res = {} as any
+
+    res = await new ProjectPriceApi().updateTenantPriceSet(row, { showSuccessMessage: true }).catch(() => {
+        // state.sureLoading = false
+    })
+
+    // state.sureLoading = false
+
+    if (res?.success) {
+        // eventBus.emit('refreshProjectPrice')
+        // state.showDialog = false
+    }
+}
+const onSizeChange = (val: number) => {
+    state.pageInput.pageSize = val
+    onQuery()
+}
+
+const onCurrentChange = (val: number) => {
+    state.pageInput.currentPage = val
+    onQuery()
+}
+
+defineExpose({
+    open,
+})
+</script>

+ 0 - 113
src/views/admin/projectprice/components/tenantprice.vue

@@ -1,113 +0,0 @@
-<template>
-    <div>
-        <el-dialog v-model="state.showDialog" destroy-on-close :title="title" draggable :close-on-click-modal="false"
-            :close-on-press-escape="false" width="1000px">
-                <div>            
-                    <el-card class="mt8" shadow="never" :body-style="{ paddingBottom: '0' }">
-                        <el-form :inline="true" @submit.stop.prevent>                            
-                            <el-form-item label="推广码来源">
-                            <el-input v-model="state.filter.keywords" placeholder="请输入推广码来源" />
-                            </el-form-item>
-                            <el-form-item>
-                            <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>          
-                            </el-form-item>
-                        </el-form>
-                    </el-card>
-                    <el-card class="my-fill mt8" shadow="never">
-                    <el-table v-loading="state.loading" :data="state.projectLinkListData" row-key="id" height="'100%'" style="width: 100%; height: 100%">
-                        <el-table-column label="推广码来源" prop="company" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="所属平台" prop="orgName" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="编号" prop="num" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="二维码" prop="qrcodeUrl" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="查单码" prop="company" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="口令" prop="shareCommand" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="申请时间" min-width="120" show-overflow-tooltip>
-                            <template #default="{ row }">                                
-                                {{row.isUse===1? row.useTime:'' }}
-                            </template>
-                        </el-table-column>
-                        <el-table-column label="姓名" prop="salesman" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="手机号" prop="salesmanPhone" min-width="120" show-overflow-tooltip/>
-                        <el-table-column label="备注" prop="salesmanRemark" min-width="120" show-overflow-tooltip/>                        
-                    </el-table>
-                </el-card>
-            </div>        
-        </el-dialog>
-    </div>
-</template>
-
-<script lang="ts" setup name="admin/tenant/form">
-import { reactive, toRefs, getCurrentInstance, ref } from 'vue'
-import { PageInputProjectLinkGetPageDto, ProjectLinkListOutput } from '/@/api/admin/data-contracts'
-import { ProjectLinkApi } from '/@/api/admin/ProjectLink'
-
-import eventBus from '/@/utils/mitt'
-
-import QRCode from 'qrcodejs2-fixes'
-// 定义变量内容
-const qrcodeRef = ref()
-
-defineProps({
-    title: {
-        type: String,
-        default: '',
-    },
-})
-
-// const { proxy } = getCurrentInstance() as any
-
-// const formRef = ref()
-const state = reactive({
-    showDialog: false,
-    sureLoading: false, 
-    loading: false, 
-    filter: {
-        projectId: 0,
-        isUse: -1,
-        tenantId: 0,
-        keywords: ''
-    }, pageInput: {
-        currentPage: 1,
-        pageSize: 20,
-    } as PageInputProjectLinkGetPageDto,
-    total: 0, 
-    projectLinkListData: [] as Array<ProjectLinkListOutput>,
-})
-// const { form } = toRefs(state)
-
-
-
-// 打开对话框
-const open = async (row: any = {}) => {    
-    state.filter.projectId = row.projectId;
-    onQuery();
-    state.showDialog = true
-}
-
-//查询
-const onQuery = async () => {
-    state.loading = true
-
-    state.pageInput.filter = state.filter
-    const res = await new ProjectLinkApi().getPage(state.pageInput).catch(() => {
-        state.loading = false
-    })
-    state.projectLinkListData = res?.data?.list ?? []
-    state.total = res?.data?.total ?? 0
-    state.loading = false
-}
-// 初始化生成二维码
-const initQrcode = (text:string) => {
-    new QRCode(qrcodeRef.value, {
-        text: text,
-        width: 125,
-        height: 125,
-        colorDark: '#000000',
-        colorLight: '#ffffff',
-    })
-}
-
-defineExpose({
-    open,
-})
-</script>

+ 74 - 27
src/views/admin/projectprice/index.vue

@@ -22,24 +22,29 @@
                             <el-table-column prop="price" label="价格" width="180">
                             </el-table-column>
                             <el-table-column label="设价方式" min-width="180">
-                                <template #default="{ pRow }">
-                                    <el-form label-position="left" inline class="demo-table-expand">
-                                        <el-form-item>
-                                            <el-select placeholder="请选择设价方式">
-                                                <el-option label="抽成比例" value="1"></el-option>
-                                                <el-option label="抽成金额" value="2"></el-option>
-                                            </el-select>
+                                <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-select>                                             
                                         </el-form-item>
-                                        <el-form-item>                                           
-                                            <el-input placeholder="请输入设价信息"></el-input>                                                                                        
+                                        <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>
-                                        <el-form-item>                                             
-                                            %
+                                        <el-form-item v-if="row.drawPriceWay==2">                                            
+                                            
                                         </el-form-item>
-                                        <el-form-item>
-                                            <el-button type="primary" @click="SetPrice">设价</el-button>                                            
+                                        <el-form-item v-else >                                            
+                                                %
+                                            </el-form-item>
+                                        <el-form-item>                                                          
+                                            <el-button type="text" @click="onSetProjectPrice(row)"> 设价 </el-button>
                                         </el-form-item>
-                                    </el-form>
+                                    </el-form>                                    
                                 </template>
                             </el-table-column>                            
                         </el-table>                        
@@ -53,15 +58,28 @@
                 <el-table-column label="项目名称" prop="name" min-width="120" show-overflow-tooltip />                
                 <el-table-column label="操作" width="180" header-align="center" align="center" fixed="right">
                     <template #default="{ row }">
-                        <el-button size="small" text type="primary" @click="onDetail(row)">平台单独设价</el-button>                    
+                        <el-button size="small" text type="primary" @click="onTenantInfo(row)">平台单独设价</el-button>                    
                     </template>
                 </el-table-column>
             </el-table>
-        </el-card>
-        <!-- <LinkForm ref="LinkFormRef" :title="state.linkFormTitle"></LinkForm> -->
-        <!-- <tenant-form ref="tenantFormRef" :title="state.tenantFormTitle"></tenant-form> -->
+            <div class="my-flex my-flex-end" style="margin-top: 20px">
+            <el-pagination
+              v-model:currentPage="state.pageInput.currentPage"
+              v-model:page-size="state.pageInput.pageSize"
+              :total="state.total"
+              :page-sizes="[10, 20, 50, 100]"
+              small
+              background
+              @size-change="onSizeChange"
+              @current-change="onCurrentChange"
+              layout="total, sizes, prev, pager, next, jumper"
+            />
+          </div>
+        </el-card>        
         <!-- 公司抽成from -->
         <company-form ref="companyFormRef" title="公司分成比例修改"></company-form>
+        <!--平台抽成明细-->
+        <tenant-price-form ref="TenantPriceFormRef" :title="state.TenantPriceFormTitle"></tenant-price-form>
     </div>
 </template>
 <script lang="ts" setup name="admin/projectprice">
@@ -73,13 +91,16 @@ import eventBus from '/@/utils/mitt'
 
 // 引入组件
 const CompanyForm = defineAsyncComponent(() => import('./components/company-form.vue'))
+const TenantPriceForm = defineAsyncComponent(() => import('./components/tenant-price.vue'))
+
 const companyFormRef = ref();
+const TenantPriceFormRef = ref();
 
-const state = reactive({    
+const state = reactive({  
+    TenantPriceFormTitle:'',  
     companydraw: {         
     } as CompanyDrawOutput,    
-    loading: false,
-    tenantFormTitle: '',
+    loading: false,    
     linkFormTitle: '',            
     filter: {
     },
@@ -93,6 +114,7 @@ const state = reactive({
 onMounted(() => { 
     onCompanyQuery();   
     onQuery();   
+    eventBus.off('refreshCompanyDraw')
     eventBus.on('refreshCompanyDraw', async () => { 
         onCompanyQuery();
     }) 
@@ -103,9 +125,10 @@ onMounted(() => {
 
 })
 onBeforeMount(() => {
+    eventBus.off('refreshCompanyDraw')
     eventBus.off('refreshProjectPrice')
 })
-//查询
+//查询项目价格
 const onQuery = async () => {
     state.loading = true
     state.pageInput.filter = state.filter
@@ -116,6 +139,22 @@ const onQuery = async () => {
     state.total = res?.data?.total ?? 0
     state.loading = false
 }
+//设置项目价格
+const onSetProjectPrice = async (row: any) => {    
+    // state.sureLoading = true            
+    let res = {} as any
+    
+    res = await new ProjectPriceApi().updateProjectPrice(row, { showSuccessMessage: true }).catch(() => {
+        // state.sureLoading = false
+    })
+    
+    // state.sureLoading = false
+
+    if (res?.success) {
+        eventBus.emit('refreshProjectPrice')
+        // state.showDialog = false
+    }
+}
 //查询公司抽成
 const onCompanyQuery = async () => {
     // state.loading = true
@@ -132,10 +171,18 @@ const onCompanyEdit = () => {
 }
 
 
+// 平台单独设价
+const onTenantInfo = (row: any) => {
+    state.TenantPriceFormTitle = `【${row.name}】平台单独设价`
+    TenantPriceFormRef.value.open(row)    
+}
+const onSizeChange = (val: number) => {
+    state.pageInput.pageSize = val
+    onQuery()
+}
 
-//平台单独设价
-// const onDetail = (row: ProjectLinkManagePageOutput) => {
-//     state.tenantFormTitle = '编辑租户'
-//     tenantFormRef.value.open(row)    
-// }
+const onCurrentChange = (val: number) => {
+    state.pageInput.currentPage = val
+    onQuery()
+}
 </script>