Browse Source

轮胎销售统计报表

chenrui 1 year ago
parent
commit
6b53163cd0

+ 22 - 0
src/api/reportData.js

@@ -955,3 +955,25 @@ export const codeExportImportError = (params) => {
     responseType: 'blob'
   })
 }
+
+// 确定导入轮胎唯一码
+export const traceCodeInsertBatch = (params) => {
+  const url = `/report/tracecode/insertBatch`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取  产品追溯列表
+export const traceCodeList = (params) => {
+  const url = `/report/tracecode/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 4 - 4
src/config/router.config.js

@@ -2453,7 +2453,7 @@ export const asyncRouterMap = [
           },
           {
             path: '/reportData/tireSalesReport',
-            redirect: '/reportData/tireSalesReport/list',
+            redirect: '/reportData/tireSalesReport/index',
             name: 'tireSalesReport',
             component: BlankLayout,
             meta: {
@@ -2464,9 +2464,9 @@ export const asyncRouterMap = [
             hideChildrenInMenu: true,
             children: [
               {
-                path: 'list',
-                name: 'tireSalesReportList',
-                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/tireSalesReport/list.vue'),
+                path: 'index',
+                name: 'tireSalesReportIndex',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/tireSalesReport/index.vue'),
                 meta: {
                   title: '轮胎销售统计报表',
                   icon: 'profile',

+ 4 - 4
src/views/productManagement/productSourcePath/chooseImportModal.vue

@@ -103,17 +103,17 @@ export default {
       nowColumns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '唯一码', dataIndex: 'traceCodeSn', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务单号', dataIndex: 'bizCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '工厂出库单号', dataIndex: 'factoryOutCode', width: '26%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '工厂出库单号', dataIndex: 'factoryOutNo', width: '26%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       loadData: [],
       nowUnColumns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '唯一码', dataIndex: 'traceCodeSn', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务单号', dataIndex: 'bizCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '工厂出库单号', dataIndex: 'factoryOutCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '工厂出库单号', dataIndex: 'factoryOutNo', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '备注', dataIndex: 'errorDesc', width: '27%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       unLoadData: [],

+ 44 - 51
src/views/productManagement/productSourcePath/list.vue

@@ -13,43 +13,43 @@
           @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="审核时间" prop="time">
-                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              <a-form-model-item label="审核时间">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="业务单号">
-                <a-input id="inventoryQueryList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入业务单号"/>
+                <a-input id="productSourceList-bizCode" v-model.trim="queryParam.bizCode" allowClear placeholder="请输入业务单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品编码">
-                <a-input id="inventoryQueryList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+                <a-input id="productSourceList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="唯一码">
-                <a-input id="inventoryQueryList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入唯一码"/>
+                <a-input id="productSourceList-traceCode" v-model.trim="queryParam.traceCode" allowClear placeholder="请输入唯一码"/>
               </a-form-item>
             </a-col>
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-item label="产品名称">
-                  <a-input id="inventoryQueryList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品名称"/>
+                  <a-input id="productSourceList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="客户名称">
                   <a-input
-                    id="salesOrderTotalList-dealerName"
-                    v-model.trim="queryParam.dealerName"
+                    id="productSourceList-buyerName"
+                    v-model.trim="queryParam.buyerName"
                     allowClear
                     placeholder="请输入客户名称" />
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="当前所在客户">
-                  <a-input id="inventoryQueryList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入客户名称"/>
+                  <a-input id="productSourceList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入客户名称"/>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
@@ -57,7 +57,7 @@
                   <v-select
                     v-model="queryParam.dealerLevel"
                     ref="dealerLevel"
-                    id="salesOrderTotalList-dealerLevel"
+                    id="productSourceList-dealerLevel"
                     code="DEALER_LEVEL"
                     placeholder="请选择业务状态"
                     allowClear></v-select>
@@ -70,12 +70,12 @@
                 type="primary"
                 @click="handleSearch"
                 :disabled="disabled"
-                id="salesOrderTotalList-refresh">查询</a-button>
+                id="productSourceList-refresh">查询</a-button>
               <a-button
                 style="margin-left: 8px"
                 @click="resetSearchForm"
                 :disabled="disabled"
-                id="salesOrderTotalList-reset">重置</a-button>
+                id="productSourceList-reset">重置</a-button>
               <a-button
                 style="margin-left: 10px"
                 type="primary"
@@ -84,7 +84,7 @@
                 :disabled="disabled"
                 :loading="exportLoading"
                 v-if="$hasPermissions('B_salesOrderTotalExport')"
-                id="salesOrderTotalList-export">导出</a-button>
+                id="productSourceList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'" />
@@ -162,12 +162,13 @@ import {
   userQueryList
 } from '@/api/power-user'
 import {
-  reportSalesBillList,
+  traceCodeInsertBatch,
   reportSalesBillCount,
-  reportSalesBillExport
+  reportSalesBillExport,
+  traceCodeList
 } from '@/api/reportData'
 export default {
-  name: 'SalesOrderTotalList',
+  name: 'ProductSourceList',
   mixins: [commonMixin],
   components: {
     STable,
@@ -187,41 +188,35 @@ export default {
       tableHeight: 0,
       showExport: false,
       isReturnedTires: false,
+      time: [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
       queryParam: { //  查询条件
-        time: [
-          getDate.getCurrMonthDays().starttime,
-          getDate.getCurrMonthDays().endtime
-        ],
         beginDate: getDate.getCurrMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
-        salesBillNo: '',
-        dealerName: '',
-        dealerLevel: undefined,
-        operatorSn: undefined,
-        dealerProvinceSn: undefined
+        productCode: '',
+        productName: '',
+        bizCode: undefined,
+        traceCode: undefined,
+        buyerName: undefined
       },
       openInfoModal: false, // 质保信息弹窗
       openRecordModal: false, // 流转记录弹窗
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '业务单号', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '审核时间', dataIndex: 'giftQty1', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '导入时间', dataIndex: 'giftQty4', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'indirectDealerName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '唯一码', dataIndex: 'giftQty', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'totalQty2', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户名称', dataIndex: 'dealerName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '业务单号', dataIndex: 'bizCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核时间', dataIndex: 'auditDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '导入时间', dataIndex: 'importDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '质保状态', dataIndex: 'giftQty4', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '质保时间', dataIndex: 'giftQty3', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
       ],
-      rules: {
-        'time': [{
-          required: true,
-          message: '请选择销售日期',
-          trigger: 'change'
-        }]
-      },
+
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false,
       // 加载数据方法 必须为 Promise 对象
@@ -229,7 +224,7 @@ export default {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return reportSalesBillList(params).then(res => {
+        return traceCodeList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -263,7 +258,11 @@ export default {
   },
   methods: {
     handleGuideOk (resData) {
-
+      traceCodeInsertBatch(resData).then(res => {
+        if (res.status == 200 && res.data) {
+          this.resetSearchForm()
+        }
+      })
     },
     onTiresChange (e) {
       console.log(`checked = ${e.target.checked}`)
@@ -288,7 +287,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error('请选择销售日期')
+          _this.$message.error('请选择审核时间')
           return false
         }
       })
@@ -308,21 +307,15 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.time = [
+      this.time = [
         getDate.getCurrMonthDays().starttime,
         getDate.getCurrMonthDays().endtime
       ]
-      this.$refs.rangeDate.resetDate(this.queryParam.time)
+      this.$refs.rangeDate.resetDate(this.time)
       this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
       this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.salesBillNo = ''
-      this.queryParam.dealerName = ''
-      this.queryParam.dealerLevel = undefined
-      this.queryParam.operatorSn = undefined
-      this.queryParam.dealerProvinceSn = undefined
       this.totalData = null
-      this.$refs.ruleForm.resetFields()
-      this.$refs.table.clearTable()
+      this.$refs.table.refresh(true)
     },
     //  导出
     handleExport () {

+ 28 - 68
src/views/reportData/tireSalesReport/list.vue → src/views/reportData/tireSalesReport/dealerList.vue

@@ -13,47 +13,21 @@
           @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="出库时间" prop="time">
+              <a-form-model-item label="下推时间" prop="time">
                 <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品名称">
-                <a-input id="inventoryQueryList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
-              </a-form-item>
+              <a-form-model-item label="地区">
+                <AreaList id="chooseCustomer-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+              </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品编码">
-                <a-input id="inventoryQueryList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+              <a-form-item label="区域/分区">
+                <subarea id="allocateBillList-subarea" ref="subarea" @change="subareaChange"></subarea>
               </a-form-item>
             </a-col>
             <template v-if="advanced">
-              <a-col :md="6" :sm="24">
-                <a-form-item label="唯一码">
-                  <a-input id="inventoryQueryList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入唯一码"/>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="售出状态">
-                  <v-select
-                    v-model="queryParam.dealerLevel"
-                    ref="dealerLevel"
-                    id="salesOrderTotalList-dealerLevel"
-                    code="DEALER_LEVEL"
-                    placeholder="请选择售出状态"
-                    allowClear></v-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="地区">
-                  <AreaList id="chooseCustomer-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="区域/分区">
-                  <subarea id="allocateBillList-subarea" ref="subarea" @change="subareaChange"></subarea>
-                </a-form-item>
-              </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="客户名称">
                   <a-input
@@ -64,9 +38,9 @@
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-item label="当前所在客户">
-                  <a-input id="inventoryQueryList-productOrigCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入客户名称"/>
-                </a-form-item>
+                <a-form-model-item label="区域负责人">
+                  <BizUser v-model="queryParam.bizUserSn"></BizUser>
+                </a-form-model-item>
               </a-col>
             </template>
             <a-col :md="6" :sm="24">
@@ -101,16 +75,6 @@
     </a-card>
     <a-card size="small" :bordered="false">
       <a-spin :spinning="spinning" tip="Loading...">
-        <!-- 统计 -->
-        <div class="tongji-bar" style="margin-bottom:10px">
-          总销售款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '0' }}</strong>;
-          总销售数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
-          总实售金额:<strong>{{ totalData&&(totalData.totalPushedAmount || totalData.totalPushedAmount==0) ? toThousands(totalData.totalPushedAmount) : '--' }}</strong>;
-          已售出数量(从客户系统销售出库):<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
-          已售出金额:<strong>{{ totalData&&(totalData.totalPushedAmount || totalData.totalPushedAmount==0) ? toThousands(totalData.totalPushedAmount) : '--' }}</strong>;
-          未售出数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
-          未售出金额:<strong>{{ totalData&&(totalData.totalPushedAmount || totalData.totalPushedAmount==0) ? toThousands(totalData.totalPushedAmount) : '--' }}</strong>;
-        </div>
         <!-- 列表 -->
         <s-table
           class="sTable fixPagination"
@@ -121,9 +85,16 @@
           rowKeyName="salesBillNo"
           :columns="columns"
           :data="loadData"
-          :scroll="{ y: tableHeight-10 }"
+          :scroll="{ y: tableHeight-30 }"
           :defaultLoadData="false"
           bordered>
+          <template slot="footer">
+            <a-row :gutter="15">
+              <a-col :md="4" :sm="24">采购数量:{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}</a-col>
+              <a-col :md="4" :sm="24">库存数量:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? totalData.totalRealAmount: '--' }}</a-col>
+              <a-col :md="4" :sm="24">已售出数量:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ?totalData.totalAmount: '--' }}</a-col>
+            </a-row>
+          </template>
         </s-table>
       </a-spin>
       <!-- 导出提示框 -->
@@ -146,6 +117,7 @@ import subarea from '@/views/common/subarea.js'
 import custList from '@/views/common/custList.vue'
 import reportModal from '@/views/common/reportModal.vue'
 import AreaList from '@/views/common/areaList.js'
+import BizUser from '@/views/common/bizUser.js'
 import {
   hdExportExcel
 } from '@/libs/exportExcel'
@@ -167,7 +139,8 @@ export default {
     custList,
     subarea,
     reportModal,
-    AreaList
+    AreaList,
+    BizUser
   },
   data () {
     return {
@@ -223,32 +196,19 @@ export default {
       },
       totalData: null,
       operatorList: [], //  操作员下拉数据
-      addrProvinceList: [] //  省下拉
-    }
-  },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
+      addrProvinceList: [], //  省下拉,
+      columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '地区', dataIndex: 'salesBillNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '区域', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'dealerName', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户级别', dataIndex: 'directDealerName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'indirectDealerName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'totalQty', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '唯一码', dataIndex: 'giftQty', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '实售金额', dataIndex: 'totalRealSaleAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '销售审核时间', dataIndex: 'giftQty', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '当前所在客户', dataIndex: 'giftQty', width: '14%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '销售状态', dataIndex: 'giftQty', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'directDealerName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购数量', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存数量', dataIndex: 'dealerName', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, ellipsis: true },
+        { title: '已售出数量', dataIndex: 'dealerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
-      if (this.$hasPermissions('M_salesOrderTotalList_salesPrice')) {
-        arr.splice(10, 0, { title: '实售金额', dataIndex: 'totalRealSaleAmount', width: '12%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      }
-      return arr
     }
   },
   watch: {
@@ -372,7 +332,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 226
+      this.tableHeight = window.innerHeight - tableSearchH - 245
     }
   },
   mounted () {

+ 303 - 0
src/views/reportData/tireSalesReport/index.vue

@@ -0,0 +1,303 @@
+<template>
+  <div>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-tabs default-active-key="1" @change="handleChange" :tabBarStyle="{'background':'#fff'}">
+        <a-tab-pane key="1" tab="轮胎销售报表(经销商)">
+          <dealerList></dealerList>
+        </a-tab-pane>
+        <a-tab-pane key="2" tab="轮胎销售报表(区域/分区)" force-render>
+          <subareaList></subareaList>
+        </a-tab-pane>
+      </a-tabs>
+      <!-- 导出提示框 -->
+      <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+    </a-spin>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import reportModal from '@/views/common/reportModal.vue'
+import { salesPromoReportList, salesPromoReportQueryCount, exportSalesPromoReport } from '@/api/reportData'
+import { hdExportExcel } from '@/libs/exportExcel'
+import subareaList from './subareaList'
+import dealerList from './dealerList'
+import rangeDate from '@/views/common/rangeDate.vue'
+import getDate from '@/libs/getDate.js'
+import subarea from '@/views/common/subarea.js'
+import AreaList from '@/views/common/areaList.js'
+// import moment from 'moment'
+export default {
+  name: 'PriceDifferenceDetailReportList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, subareaList, dealerList, reportModal, AreaList, rangeDate, subarea },
+  data () {
+    const _this = this
+    return {
+      advanced: true, // 高级搜索 展开/关闭
+      time: undefined,
+      spinning: false,
+      queryParam: {
+        salesDate: [
+          getDate.getCurrMonthDays().starttime,
+          getDate.getCurrMonthDays().endtime
+        ],
+        beginAuditDate: getDate.getCurrMonthDays().starttime, // 审核开始时间
+        endAuditDate: getDate.getCurrMonthDays().endtime, // 审核结束时间
+        promoRuleReport: {
+          promotionDateStart: undefined, // 促销时间-开始
+          promotionDateEnd: undefined, // 促销时间-结束
+          title: '', // 促销名称
+          promotionRuleType: undefined, // 促销类型
+          ruleInfo: ''// 规则
+        },
+        salesBillNo: '', // 销售单号
+        buyerLevel: undefined, // 客户级别
+        buyerName: '', // 客户名称
+        subareaArea: {
+          subareaSn: '',
+          subareaAreaSn: ''
+        },
+        dealerProvinceSn: undefined, // 省份编码
+        dealerCitySn: undefined, // 城市编码
+        dealerDistrictSn: undefined // 区域编码
+      },
+      rules: {
+        salesDate: [{ required: true, message: '请选择销售审核时间', trigger: 'change' }]
+      },
+      dateFormat: 'YYYY-MM-DD',
+      tabVal: 1,
+      disabled: false,
+      tableHeight: 0,
+      totalData: null, //  合计
+      exportLoading: false,
+      showExport: false,
+      columns: [
+        { title: '促销名称', dataIndex: 'promotion.title', width: '160px', align: 'left', customRender: function (text) { return text || '--' }, fixed: 'left', ellipsis: true },
+        { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '130px', align: 'center', fixed: 'left' },
+        { title: '费用所属部门', dataIndex: 'departmentName', width: '160px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true, fixed: 'left' },
+        { title: '促销类型', dataIndex: 'promotionRule.promotionRuleTypeDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
+        { title: '规则', dataIndex: 'promotionRule.ruleInfo', width: '180px', align: 'left', customRender: function (text) { return text || '--' }, fixed: 'left' },
+        { title: '销售单号', dataIndex: 'salesBillNo', width: '120px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '地区', dataIndex: 'provinceName', width: '160px', align: 'center', scopedSlots: { customRender: 'addressInfo' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '140px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售审核时间', dataIndex: 'auditDate', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量(非促)', dataIndex: 'notGiftQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '数量(促)', dataIndex: 'giftQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实售金额', dataIndex: 'totalRealAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '开单金额', dataIndex: 'totalAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '成本金额', dataIndex: 'totalRealCost', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '损失成本', dataIndex: 'lossCost', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '损失费用', dataIndex: 'lossAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '采购额结余', dataIndex: 'surplusPromoGiftsAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '采购额超出', dataIndex: 'outPromoGiftsAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '促销品费用归属品牌', dataIndex: 'promoProductBrandName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销品费用归属分类', dataIndex: 'promoProductTypeName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        const params = Object.assign(parameter, this.queryParam)
+        const newParams = JSON.parse(JSON.stringify(params))
+        delete newParams.salesDate
+        this.spinning = true
+        return salesPromoReportList(newParams).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    salesDateChange (date) {
+      if (date[0] && date[1]) {
+        this.queryParam.salesDate = date
+      } else {
+        this.queryParam.salesDate = []
+      }
+      this.queryParam.beginAuditDate = date[0] || ''
+      this.queryParam.endAuditDate = date[1] || ''
+    },
+    dateChange (date, dateString) {
+      this.time = date
+      if (dateString[0] != '' && dateString[1] != '') {
+        this.queryParam.promoRuleReport.promotionDateStart = dateString[0] + ' 00:00:00'
+        this.queryParam.promoRuleReport.promotionDateEnd = dateString[1] + ' 23:59:59'
+      } else {
+        this.$set(this.queryParam.promoRuleReport, 'promotionDateStart', undefined)
+        this.$set(this.queryParam.promoRuleReport, 'promotionDateEnd', undefined)
+      }
+    },
+    // // 不可选日期
+    // disabledDate (date, dateStrings) {
+    //   return date && date.valueOf('day') < moment().subtract(1, 'day') // 今天以后,包含今天
+    // },
+    // 统计
+    getCount (params) {
+      salesPromoReportQueryCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    // tab
+    handleChange (val) {
+      this.tabVal = val
+    },
+    // 导出
+    handleExport () {
+      const _this = this
+      const params = this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      const ajaxUrl = _this.tabVal == 1 ? exportSalesPromoReport : exportSalesPromoRealReport
+      const ajaxName = _this.tabVal == 1 ? '促销销售单报表导出' : '促销销售单实时报表导出'
+      hdExportExcel(ajaxUrl, params, ajaxName, function () {
+        _this.exportLoading = false
+        _this.spinning = false
+        _this.showExport = true
+      })
+    },
+    // 验证表单 type值  search查询 export导出
+    testForm (type) {
+      const _this = this
+      if (!_this.queryParam.salesDate[0] || !_this.queryParam.salesDate[1]) {
+        _this.$message.error('请选择销售审核时间')
+        return
+      }
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          if (type == 'search') {
+            _this.handleSearch()
+          } else {
+            _this.handleExport()
+          }
+        } else {
+          _this.$message.error('请选择销售审核时间')
+          return false
+        }
+      })
+    },
+    areaChange (val) {
+      this.queryParam.dealerProvinceSn = val[0] ? val[0] : ''
+      this.queryParam.dealerCitySn = val[1] ? val[1] : ''
+      this.queryParam.dealerDistrictSn = val[2] ? val[2] : ''
+    },
+    // 查询
+    handleSearch () {
+      const _this = this
+      // 总计
+      const paramData = JSON.parse(JSON.stringify(this.queryParam))
+      delete paramData.salesDate
+      _this.getCount(paramData)
+      _this.$refs.table.refresh(true)
+    },
+    // 重置
+    resetSearchForm () {
+      this.$refs.ruleForm.resetFields()
+      this.queryParam = {
+        salesDate: [
+          getDate.getCurrMonthDays().starttime,
+          getDate.getCurrMonthDays().endtime
+        ],
+        beginAuditDate: getDate.getCurrMonthDays().starttime, // 审核开始时间
+        endAuditDate: getDate.getCurrMonthDays().endtime, // 审核结束时间
+        promoRuleReport: {
+          promotionDateStart: undefined, // 促销时间-开始
+          promotionDateEnd: undefined, // 促销时间-结束
+          title: '', // 促销名称
+          promotionRuleType: undefined, // 促销类型
+          ruleInfo: ''// 规则
+        },
+        salesBillNo: '', // 销售单号
+        buyerLevel: undefined, // 客户级别
+        buyerName: '', // 客户名称
+        subareaArea: {
+          subareaSn: '',
+          subareaAreaSn: ''
+        },
+        dealerProvinceSn: undefined, // 省份编码
+        dealerCitySn: undefined, // 城市编码
+        dealerDistrictSn: undefined // 区域编码
+      }
+      this.time = undefined
+      this.$refs.subarea.clearData()
+      this.$refs.areaList.clearData()
+      this.$refs.rangeDate.resetDate(this.queryParam.salesDate)
+      this.$refs.table.clearTable()
+      this.totalData = null
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 260
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+  }
+}
+
+</script>
+
+<style lang="less" scoped>
+  .monthBox{
+    /deep/.ant-calendar-picker-icon{
+      display:none !important;
+    }
+    /deep/.ant-calendar-picker input{
+      text-align:center;
+    }
+  }
+  .promotionSalesRealTimeReport-wrap{
+    /deep/ .ant-card-body:first-child{
+      padding-bottom: 0;
+    }
+  }
+  .ant-tabs-tabpane.ant-tabs-tabpane-active{
+    margin-top:-11px !important;
+  }
+</style>

+ 333 - 0
src/views/reportData/tireSalesReport/subareaList.vue

@@ -0,0 +1,333 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="tireSalesReportList-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper" ref="tableSearch">
+        <a-form-model
+          id="tireSalesReportList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="下推时间" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="区域/分区">
+                <subarea id="allocateBillList-subarea" ref="subarea" @change="subareaChange"></subarea>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="区域负责人">
+                <BizUser v-model="queryParam.bizUserSn"></BizUser>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                @click="handleSearch"
+                :disabled="disabled"
+                id="salesOrderTotalList-refresh">查询</a-button>
+              <a-button
+                style="margin-left: 8px"
+                @click="resetSearchForm"
+                :disabled="disabled"
+                id="salesOrderTotalList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_salesOrderTotalExport')"
+                id="salesOrderTotalList-export">导出</a-button>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.salesBillNo"
+          :style="{ height: tableHeight+70+'px' }"
+          rowKeyName="salesBillNo"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-30 }"
+          :pageSize="30"
+          :defaultLoadData="false"
+          bordered>
+          <template slot="footer">
+            <a-row :gutter="15">
+              <a-col :md="4" :sm="24">采购数量:{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}</a-col>
+              <a-col :md="4" :sm="24">库存数量:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? totalData.totalRealAmount: '--' }}</a-col>
+              <a-col :md="4" :sm="24">已售出数量:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ?totalData.totalAmount: '--' }}</a-col>
+            </a-row>
+          </template>
+        </s-table>
+      </a-spin>
+      <!-- 导出提示框 -->
+      <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import {
+  commonMixin
+} from '@/utils/mixin'
+import getDate from '@/libs/getDate.js'
+import {
+  STable,
+  VSelect
+} from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import subarea from '@/views/common/subarea.js'
+import custList from '@/views/common/custList.vue'
+import reportModal from '@/views/common/reportModal.vue'
+import AreaList from '@/views/common/areaList.js'
+import BizUser from '@/views/common/bizUser.js'
+import {
+  hdExportExcel
+} from '@/libs/exportExcel'
+import {
+  userQueryList
+} from '@/api/power-user'
+import {
+  reportSalesBillList,
+  reportSalesBillCount,
+  reportSalesBillExport
+} from '@/api/reportData'
+export default {
+  name: 'SalesOrderTotalList',
+  mixins: [commonMixin],
+  components: {
+    STable,
+    VSelect,
+    rangeDate,
+    custList,
+    subarea,
+    reportModal,
+    AreaList,
+    BizUser
+  },
+  data () {
+    return {
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      showExport: false,
+      queryParam: { //  查询条件
+        time: [
+          getDate.getCurrMonthDays().starttime,
+          getDate.getCurrMonthDays().endtime
+        ],
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        salesBillNo: '',
+        dealerName: '',
+        dealerLevel: undefined,
+        operatorSn: undefined,
+        subareaArea: {
+          subareaSn: undefined,
+          subareaAreaSn: undefined
+        },
+        dealerProvinceSn: undefined
+      },
+      rules: {
+        'time': [{
+          required: true,
+          message: '请选择销售日期',
+          trigger: 'change'
+        }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return reportSalesBillList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            this.getCount(params)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null,
+      operatorList: [], //  操作员下拉数据
+      addrProvinceList: [], //  省下拉
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '区域', dataIndex: 'createDate', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'auditDate', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域负责人', dataIndex: 'giftQty1', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '采购数量', dataIndex: 'salesBillNo', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存数量', dataIndex: 'dealerName', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, ellipsis: true },
+        { title: '已售出数量', dataIndex: 'dealerLevelDictValue', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  methods: {
+    // 盘点库存日期
+    handleStock () {
+      this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
+    },
+    // 总计
+    getCount (params) {
+      reportSalesBillCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          _this.$message.error('请选择销售日期')
+          return false
+        }
+      })
+    },
+    //  创建时间  change
+    dateChange (date) {
+      if (date[0] && date[1]) {
+        this.queryParam.time = date
+      } else {
+        this.queryParam.time = []
+      }
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    custChange (val) {
+      this.queryParam.dealerSn = val.key
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.time = [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ]
+      this.$refs.rangeDate.resetDate(this.queryParam.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.salesBillNo = ''
+      this.queryParam.dealerName = ''
+      this.queryParam.dealerLevel = undefined
+      this.queryParam.operatorSn = undefined
+      this.queryParam.subareaArea.subareaSn = undefined
+      this.queryParam.subareaArea.subareaAreaSn = undefined
+      this.queryParam.dealerProvinceSn = undefined
+      this.totalData = null
+      if (this.advanced) {
+        this.$refs.subarea.clearData()
+      }
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = _this.queryParam
+          _this.$store.state.app.curActionPermission = 'B_salesOrderTotalExport'
+          _this.showExport = true
+          _this.exportLoading = true
+          _this.spinning = true
+          hdExportExcel(reportSalesBillExport, params, '销售(开单统计)报表', function () {
+            _this.exportLoading = false
+            _this.spinning = false
+            _this.$store.state.app.curActionPermission = ''
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    // 操作员
+    getUserList () {
+      userQueryList({}).then(res => {
+        if (res.status == 200) {
+          this.operatorList = res.data
+        } else {
+          this.operatorList = []
+        }
+      })
+    },
+    pageInit () {
+      const _this = this
+      _this.getUserList()
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 245
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>