浏览代码

轮胎商城统计销售 2024-3-13

caojunjie 1 年之前
父节点
当前提交
d2b75dd73d

+ 9 - 0
src/api/saleDetail/index.js

@@ -1,5 +1,6 @@
 import request from '@/router/axios';
 
+// 统计销售明细
 export const statisticsSaleDetail = (params) => {
   return request({
     url: '/api/blade-sales-part/statistics/saleDetail',
@@ -7,3 +8,11 @@ export const statisticsSaleDetail = (params) => {
     params: params
   })
 }
+// 统计销售明细合计
+export const statisticsSaleDetailSum = (params) => {
+  return request({
+    url: '/api/blade-sales-part/statistics/saleDetailSum',
+    method: 'get',
+    params: params
+  })
+}

+ 4 - 0
src/enums/column-name.js

@@ -1575,6 +1575,10 @@ const columnName = [{
     code: 336,
     name: '货运代理-决策分析-财务利润'
   },
+  {
+    code: 337,
+    name: '轮胎商城-财务管理-统计销售'
+  },
 ]
 export const getColumnName = (key) => {
   for (let index = 0; index < columnName.length; index++) {

+ 15 - 0
src/router/views/index.js

@@ -2708,6 +2708,21 @@ export default [{
     component: () => import( /* webpackChunkName: "views" */ '@/views/tirePartsMall/financialManagement/paymentSettlement/index')
   }]
 },
+  // 统计销售
+  {
+    path: '/tirePartsMall/financialManagement/saleDetail/index',
+    component: Layout,
+    hidden: true,
+    children: [{
+      path: '/tirePartsMall/financialManagement/saleDetail/index',
+      name: '统计销售(L)',
+      meta: {
+        i18n: '/tirePartsMall/financialManagement/saleDetail/index',
+        keepAlive: true,
+      },
+      component: () => import( /* webpackChunkName: "views" */ '@/views/tirePartsMall/financialManagement/saleDetail/index')
+    }]
+  },
 {
   path: '/tirePartsMall/statisticAnalysis/customerTransactions/index',
   component: Layout,

+ 100 - 35
src/views/iosBasicData/financeProfit/index.vue

@@ -18,7 +18,12 @@
                    @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 336)"
                    @on-load="onLoad" >
             <template slot-scope="{disabled,size}" slot="billTypeSearch">
-                <avue-input-tree :check-strictly="true" multiple v-model="query.billType" placeholder="请选择业务类型" :dic="billTypeData" :style="{ width: '100%' }"></avue-input-tree>
+                <avue-input-tree :check-strictly="true"
+                                 :tags="true"
+                                 multiple v-model="query.billType"
+                                 placeholder="请选择业务类型"
+                                 :dic="billTypeData" :style="{ width: '100%' }">
+                </avue-input-tree>
             </template>
             <template slot="carrierCnNameSearch">
                 <search-query :datalist="carrierData"
@@ -157,7 +162,7 @@
                     total: 0
                 },
                 query: {
-                    billType:'SE',
+                    billType:'SE,SI',
                     costMerge:1,
                     statisticsDateStart:defaultDate3()[0],
                     statisticsDateEnd:defaultDate3()[1],
@@ -178,6 +183,67 @@
                     viewBtn:false,
                     delBtn:false,
                     editBtn:false,
+
+                    showSummary: true,
+                    summaryText: "合计",
+                    sumColumnList: [
+                        {
+                            name: 'amountDrUsd',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountDrUsd',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'amountDr',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountDr',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'amountDrLoc',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountDrLoc',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'amountCrUsd',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountCrUsd',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'amountCr',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountCr',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'amountCrLoc',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountCrLoc',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'amountProfitLoc',
+                            type: 'sum',
+                            decimals: 2
+                        },{
+                            name: 'realAmountProfitLoc',
+                            type: 'sum',
+                            decimals: 2
+                        }],
                     column:[
                         {
                             label: "业务类型",
@@ -185,7 +251,13 @@
                             overHidden:true,
                             search:true,
                             searchslot:true,
-                            searchOrder:1
+                            searchOrder:1,
+                            type: 'select',
+                            dicData:[],
+                            props: {
+                                label: "dictValue",
+                                value: "dictKey"
+                            },
                         },
                         {
                             label: "业务编号",
@@ -195,13 +267,13 @@
                             searchOrder:11
                         },
                         {
-                            label: "H B/l",
-                            prop: "hBlNo",
+                            label: "H B/L",
+                            prop: "hblNo",
                             overHidden:true,
                         },
                         {
-                            label: "M B/l",
-                            prop: "mBlNo",
+                            label: "M B/L",
+                            prop: "mblNo",
                             overHidden:true,
                         },
                         {
@@ -217,6 +289,7 @@
                             prop: "statisticsDateStart",
                             overHidden:true,
                             search:true,
+                            hide: true,
                             searchOrder:7,
                             type: "date",
                             format: "yyyy-MM-dd",
@@ -227,6 +300,7 @@
                             prop: "statisticsDateEnd",
                             overHidden:true,
                             search:true,
+                            hide: true,
                             searchOrder:8,
                             type: "date",
                             format: "yyyy-MM-dd",
@@ -378,6 +452,7 @@
                             label: "业务来源",
                             prop: "srcType",
                             overHidden:true,
+                            hide: true,
                             search:true,
                             searchslot:true,
                             searchOrder:9
@@ -396,28 +471,7 @@
                 },
                 data:[],
                 // 业务类型数据
-                billTypeData:[
-                    {
-                        label:'海运出口',
-                        value:'SE',
-                    },
-                    {
-                        label:'海运进口',
-                        value:'SI',
-                    },
-                    {
-                        label:'空运出口',
-                        value:'AE',
-                    },
-                    {
-                        label:'空运进口',
-                        value:'AI',
-                    },
-                    {
-                        label:'报关业务',
-                        value:'BGSE,BGSI,BGAE,BGAI',
-                    },
-                ],
+                billTypeData:[],
                 // 船公司数据
                 carrierData:[],
                 // 委托人数据
@@ -435,20 +489,31 @@
         },
         async created() {
             this.option = await this.getColumnData(this.getColumnName(336), this.optionBack);
+            this.getWorkDictsfun()
             this.getLazylistfun() // 获取部门数据
         },
         methods:{
+            // 获取字典数据
+            getWorkDictsfun(){
+                // 获取业务类型
+                getWorkDicts('profit_business_type_los').then(res=>{
+                    this.findObject(this.option.column, "billType").dicData = res.data.data
+                    this.billTypeData = res.data.data.map(item=>{
+                        return {label:item.dictValue, value:item.dictKey}
+                    })
+                })
+            },
             // 单选
             radioSearchfun(name){
                 if (name == 'costMerge') {
-                    this.$set(this.query,'consistentCorpMerge',0)
-                    this.$set(this.query,'inconsistentCorpMerge',0)
+                    this.$set(this.query,'consistentCorpMerge',null)
+                    this.$set(this.query,'inconsistentCorpMerge',null)
                 }else if (name == 'consistentCorpMerge') {
-                    this.$set(this.query,'inconsistentCorpMerge',0)
-                    this.$set(this.query,'costMerge',0)
+                    this.$set(this.query,'inconsistentCorpMerge',null)
+                    this.$set(this.query,'costMerge',null)
                 }else if (name == 'inconsistentCorpMerge') {
-                    this.$set(this.query,'costMerge',0)
-                    this.$set(this.query,'consistentCorpMerge',0)
+                    this.$set(this.query,'costMerge',null)
+                    this.$set(this.query,'consistentCorpMerge',null)
                 }
             },
             // 业务员下拉

+ 301 - 6
src/views/tirePartsMall/financialManagement/saleDetail/index.vue

@@ -8,21 +8,101 @@
             :search.sync="search"
             @on-load="onLoad"
             @search-reset="query={}"
-            :page.sync="page" >
-
+            :page.sync="page"
+            @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 337)"
+            @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 337)" >
+            <template slot="header">
+                {{commodityLabel[0]}}
+                <el-table
+                    :data="commodityData"
+                    border
+                    size="small"
+                    @header-click="cellClick"
+                    style="width: 100%">
+                    <el-table-column
+                        v-for="(item,index) in commodityLabel" :key="index"
+                        :prop="item.prop"
+                        width="200"
+                        show-overflow-tooltip
+                        :label="item.label" />
+                </el-table>
+            </template>
+            <template slot="customerNameSearch">
+                <search-query :datalist="customerData"
+                              :selectValue="search.customerName"
+                              :filterable="true"
+                              :clearable="true"
+                              :remote="true"
+                              :buttonIf="false"
+                              :forParameter="{key:'id',label:'cname',value:'cname'}"
+                              placeholder="请选择客户名称"
+                              @remoteMethod="KHgetListfun"
+                              @corpFocus="KHgetListfun"
+                              @corpChange="corpChange($event,'customerName')">
+                </search-query>
+            </template>
+            <template slot="goodsNameSearch">
+                <search-query :datalist="goodsData"
+                              :selectValue="search.goodsName"
+                              :filterable="true"
+                              :clearable="true"
+                              :remote="true"
+                              :buttonIf="false"
+                              :forParameter="{key:'id',label:'cname',value:'cname'}"
+                              placeholder="请选择商品名称"
+                              @remoteMethod="SPgetListfun"
+                              @corpFocus="SPgetListfun"
+                              @corpChange="corpChange($event,'goodsName')">
+                </search-query>
+            </template>
+            <template slot="salerNameSearch">
+                <search-query :datalist="salerData"
+                              :selectValue="search.salerName"
+                              :filterable="true"
+                              :clearable="true"
+                              :remote="true"
+                              :buttonIf="false"
+                              :forParameter="{key:'id',label:'name',value:'name'}"
+                              placeholder="请选择业务员"
+                              @remoteMethod="YWYgetListfun"
+                              @corpFocus="YWYgetListfun"
+                              @corpChange="corpChange($event,'salerName')">
+                </search-query>
+            </template>
+            <template slot="actualPaymentStatusSearch">
+                <search-query :datalist="actualPaymentStatusData"
+                              :selectValue="search.actualPaymentStatus"
+                              :clearable="true"
+                              :buttonIf="false"
+                              :forParameter="{key:'dictKey',label:'dictValue',value:'dictKey'}"
+                              placeholder="请选择结算方式"
+                              @corpFocus="actualPaymentWorkDictsfun"
+                              @corpChange="corpChange($event,'actualPaymentStatus')">
+                </search-query>
+            </template>
         </avue-crud>
     </basic-container>
 </template>
 
 <script>
 
-import {statisticsSaleDetail} from "@/api/saleDetail";
+import {statisticsSaleDetail, statisticsSaleDetailSum} from "@/api/saleDetail";
+import {defaultDate3} from "@/util/date";
+import {getList as KHgetList } from '@/api/tirePartsMall/basicData/customerInformation/index'
+import {getList as SPgetList} from '@/api/tirePartsMall/basicData/commodityInformation/index'
+import {getList as YWYgetList} from "@/api/system/user"
+import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
+import {getWorkDicts} from "@/api/system/dictbiz";
 
 export default {
+    components: {SearchQuery},
         data(){
             return {
                 key: 0,
-                search: {},
+                search: {
+                    businesDateStart:defaultDate3()[0],
+                    businesDateEnd:defaultDate3()[1],
+                },
                 data: [],
                 total: [],
                 query: {},
@@ -33,10 +113,198 @@ export default {
                     pageSizes: [10, 50, 100, 200, 300]
                 },
                 option: {},
-
+                optionList: {
+                    align: 'center',
+                    stripe: true,
+                    index: true,
+                    menu: false,
+                    height: "auto",
+                    searchSpan: 6,
+                    // searchIcon: true,
+                    // searchIndex: 2,
+                    // highlightCurrentRow: true,
+                    addBtn: false,
+                    showSummary: true,
+                    summaryText: "合计",
+                    sumColumnList: [
+                        {
+                            name: 'sliceNumber',
+                            type: 'sum',
+                            decimals: 2
+                        }],
+                    column: [{
+                        label: '客户名称',
+                        prop: 'customerName',
+                        overHidden: true,
+                        search:true,
+                        searchslot:true,
+                        searchOrder:3
+                    },{
+                        label: '业务员',
+                        prop: 'salerName',
+                        overHidden: true,
+                        search:true,
+                        searchslot:true,
+                        searchOrder:4
+                    },{
+                        label: '仓库',
+                        prop: 'storageName',
+                        overHidden: true,
+                    },{
+                        label: '销售单号',
+                        prop: 'ordNo',
+                        overHidden: true,
+                        search: true,
+                        searchOrder:5
+                    },{
+                        label: '业务日期',
+                        prop: 'businesDate',
+                        overHidden: true,
+                    },{
+                        label: '结算状态',
+                        prop: 'actualPaymentStatus',
+                        overHidden: true,
+                        search:true,
+                        searchslot:true,
+                        searchOrder:7
+                    },{
+                        label: '品牌',
+                        prop: 'brandNames',
+                        overHidden: true,
+                    },{
+                        label: '商品名称',
+                        prop: 'goodsName',
+                        overHidden: true,
+                        search:true,
+                        searchslot:true,
+                        searchOrder:6
+                    },{
+                        label: '规格型号',
+                        prop: 'propertyName',
+                        overHidden: true,
+                    },{
+                        label: '花纹',
+                        prop: 'pattern',
+                        overHidden: true,
+                    },{
+                        label: '数量',
+                        prop: 'goodsNum',
+                        overHidden: true,
+                    },{
+                        label: '价格',
+                        prop: 'price',
+                        overHidden: true,
+                    },{
+                        label: '金额',
+                        prop: 'subTotalMoney',
+                        overHidden: true,
+                    },{
+                        label: '成本',
+                        prop: 'costprie',
+                        overHidden: true,
+                    },{
+                        label: '毛利',
+                        prop: 'profit',
+                        overHidden: true,
+                    },{
+                        label: '业务开始',
+                        prop: 'businesDateStart',
+                        overHidden: true,
+                        search:true,
+                        hide: true,
+                        searchOrder:1,
+                        type: "date",
+                        format: "yyyy-MM-dd",
+                        valueFormat: "yyyy-MM-dd",
+                    },{
+                        label: '业务结束',
+                        prop: 'businesDateEnd',
+                        overHidden: true,
+                        search:true,
+                        hide: true,
+                        searchOrder:2,
+                        type: "date",
+                        format: "yyyy-MM-dd",
+                        valueFormat: "yyyy-MM-dd",
+                    },]
+                },
+                customerData:[], // 客户数据
+                goodsData:[], // 商品名称
+                salerData:[], // 业务员
+                actualPaymentStatusData:[], // 结算状态
+                commodityData:[], // 合计数据
+                // 合计的配置项
+                commodityLabel:[{
+                    label:'销售数量',
+                    prop:'goodsSum'
+                }],
+                // commodityLabel:[{
+                //     id:1,
+                //     label:'销售数量',
+                //     prop:'goodsSum'
+                // },{
+                //     id:2,
+                //     label:'销售金额',
+                //     prop:'amount'
+                // },{
+                //     id:3,
+                //     label:'销售成本',
+                //     prop:'costprie'
+                // },,{
+                //     id:4,
+                //     label:'销售毛利',
+                //     prop:'profit'
+                // },{
+                //     id:5,
+                //     label:'已取消数量',
+                //     prop:'goodsSumCancellation'
+                // },{
+                //     id:6,
+                //     label:'已取消金额',
+                //     prop:'amountCancellation'
+                // },{
+                //     id:7,
+                //     label:'已取消成本',
+                //     prop:'costprieCancellation'
+                // },{
+                //     id:8,
+                //     label:'已取消毛利',
+                //     prop:'profitCancellation'
+                // }],
             }
         },
+        async created() {
+            this.option = await this.getColumnData(this.getColumnName(337), this.optionList);
+        },
         methods:{
+            // 获取客户数据
+            KHgetListfun(cname){
+                KHgetList({current: 1, size: 20, corpType: 'KH', cname:cname?cname:null}).then(res=>{
+                    this.customerData = res.data.data.records
+                })
+            },
+            // 获取业务员数据
+            YWYgetListfun(realName){
+                YWYgetList(1,10,{realName:realName?realName:null}).then(res=>{
+                    this.salerData = res.data.data.records
+                })
+            },
+            // 获取商品数据
+            SPgetListfun(cname){
+                SPgetList({current: 1, size: 20, cname:cname?cname:null}).then(res=>{
+                    this.goodsData = res.data.data.records
+                })
+            },
+            // 结算状态
+            actualPaymentWorkDictsfun(){
+                getWorkDicts('settlement_Status').then(res=>{
+                    this.actualPaymentStatusData = res.data.data
+                })
+            },
+            // 下拉回调
+            corpChange(value,name) {
+                this.$set(this.search,name,value)
+            },
             // 获取列表数据
             onLoad(page, params = {}) {
                 let queryParams = {
@@ -47,12 +315,39 @@ export default {
                 statisticsSaleDetail(queryParams).then(res => {
                     this.data = res.data.data.records
                     this.page.total = res.data.data.total
-                    this.option.height = window.innerHeight - 230;
+                    // this.option.height = window.innerHeight - 230;
                     // generalLedgerTotal(queryParams).then(res=>{
                     //     this.total = res.data.data
                     // })
+                    statisticsSaleDetailSum({...Object.assign(params, this.search)}).then(re=>{
+                        console.log(re,285)
+                    })
                 })
             },
+            //自定义列保存
+            async saveColumnTwo(ref, option, optionBack, code) {
+                /**
+                 * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+                 * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+                 * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+                 */
+                const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+                if (inSave) {
+                    this.$message.success("保存成功");
+                    //关闭窗口
+                    this.$refs[ref].$refs.dialogColumn.columnBox = false;
+                }
+            },
+            //自定义列重置
+            async resetColumnTwo(ref, option, optionBack, code) {
+                this[option] = this[optionBack];
+                const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+                if (inSave) {
+                    this.$message.success("重置成功");
+                    this.$refs[ref].$refs.dialogColumn.columnBox = false;
+                }
+            },
+
         }
     }
 </script>