Browse Source

订单汇总添加导出,活跃用户 页面修改

chenrui 2 years ago
parent
commit
4f68c140b0

+ 35 - 32
src/views/dataStatistics/orderDataSummary/list.vue

@@ -88,7 +88,7 @@
               <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
                 <a-button type="primary" @click="$refs.table.refresh(true)" id="userd-refresh">查询</a-button>
                 <a-button type="" @click="reset" style="margin-left: 10px;" id="userd-reset">重置</a-button>
-                <a-button type="primary" class="button-warning" style="margin-left: 10px;" id="userd-reset">导出</a-button>
+                <a-button type="primary" @click="exportFile" class="button-warning" style="margin-left: 10px;" id="userd-reset">导出</a-button>
                 <a @click="advanced=!advanced" style="margin-left: 8px">
                   {{ advanced ? '收起' : '展开' }}
                   <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -102,16 +102,16 @@
             <div slot="message" class="total-bar">
               <div>
                 货架数量:<strong>{{ statisticsObj.shelfNum }}</strong>;
-                铺货数量合计:<strong>399</strong>;
-                铺货金额合计:<strong>26545</strong>;
-                货架取货数量合计:<strong>399</strong>;
-                货架取货金额合计:<strong>26545</strong>;
+                铺货数量合计:<strong>{{ statisticsObj.totalShelfMaxQty }}</strong>;
+                铺货金额合计:<strong>{{ statisticsObj.totalShelfMaxCost }}</strong>;
+                货架取货数量合计:<strong>{{ statisticsObj.totalOrderAmount }}</strong>;
+                货架取货金额合计:<strong>{{ statisticsObj.totalOrderQty }}</strong>;
               </div>
               <div>
-                急送数量合计:<strong>399</strong>;
-                急送金额合计:<strong>26545</strong>;
-                销售数量合计:<strong>399</strong>;
-                销售金额合计:<strong>26545</strong>;
+                急送数量合计:<strong>{{ statisticsObj.tempOrderQty }}</strong>;
+                急送金额合计:<strong>{{ statisticsObj.tempOrderAmount }}</strong>;
+                销售数量合计:<strong>{{ statisticsObj.saleOrderQty }}</strong>;
+                销售金额合计:<strong>{{ statisticsObj.saleOrderAmount }}</strong>;
               </div>
             </div>
           </a-alert>
@@ -121,21 +121,15 @@
           ref="table"
           :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
           size="small"
-          rowKey="id"
+          :rowKey="(record,index)=>{return index}"
           :columns="columns"
           :data="loadData"
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"
           bordered>
-          <span slot="customTitle">
-            <a-popover>
-              <template slot="content">
-                货架铺货情况为实时数据,<br>与查询条件查询中的下单时间无关
-              </template>
-              <a-icon type="question-circle" theme="twoTone" />
-            </a-popover>
-            货架铺货情况
-          </span>
+          <div slot="area" slot-scope="text, record">
+            {{ record.dealerProvinceName }} {{ record.dealerCityName }}
+          </div>
         </s-table>
       </a-spin>
     </a-card>
@@ -145,11 +139,12 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { queryShelfOrderReportPage, queryShelfOrderTotalReport } from '@/api/report.js'
+import { queryShelfOrderReportPage, queryShelfOrderTotalReport, exportShelfOrderReport } from '@/api/report.js'
 import areaList from '@/views/common/areaList.js'
 import dealerList from '@/views/common/dealerList.vue'
 import storeList from '@/views/common/storeList.vue'
 import { toThousands } from '@/libs/tools.js'
+import { hdExportExcel } from '@/libs/exportExcel'
 export default {
   name: 'UserList',
   components: { STable, VSelect, rangeDate, dealerList, storeList, areaList },
@@ -179,37 +174,37 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
-        { title: '货架创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '货架创建时间', dataIndex: 'shelfCreateDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '汽车修理厂', dataIndex: 'storeName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '配件经销商', dataIndex: 'dealerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '所在地', dataIndex: 'createDate2', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '货架状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在地', scopedSlots: { customRender: 'area' }, width: '11%', align: 'center' },
+        { title: '货架状态', dataIndex: 'shelfState', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         {
           slots: { title: 'customTitle' },
           children: [
-            { title: '铺货数量', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-            { title: '铺货金额', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
+            { title: '铺货数量', dataIndex: 'totalShelfMaxQty', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
+            { title: '铺货金额', dataIndex: 'totalShelfMaxCost', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
           ]
         },
         {
           title: '货架订单',
           children: [
-            { title: '取货数量', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-            { title: '取货金额', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
+            { title: '取货数量', dataIndex: 'totalOrderQty', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
+            { title: '取货金额', dataIndex: 'totalOrderAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
           ]
         },
         {
           title: '急送订单',
           children: [
-            { title: '急送数量', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-            { title: '急送金额', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
+            { title: '急送数量', dataIndex: 'tempOrderQty', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
+            { title: '急送金额', dataIndex: 'tempOrderAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
           ]
         },
         {
           title: '销售单',
           children: [
-            { title: '销售数量', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-            { title: '销售金额', dataIndex: 'bondAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
+            { title: '销售数量', dataIndex: 'saleOrderQty', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
+            { title: '销售金额', dataIndex: 'saleOrderAmount', width: '6%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
           ]
         }
       ],
@@ -278,6 +273,14 @@ export default {
         _this.setTableH()
       })
     },
+    // 导出
+    exportFile () {
+      const _this = this
+      this.spinning = true
+      hdExportExcel(exportShelfOrderReport, this.queryParam, '用户分析(活跃用户)详情', function () {
+        _this.spinning = false
+      })
+    },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 225
@@ -285,7 +288,7 @@ export default {
     // 获取订单汇总统计数据
     getStatistics () {
       queryShelfOrderTotalReport({}).then(res => {
-        if (res.status == 200) {
+        if (res.status == 200) {// eslint-disable-line
           this.statisticsObj = res.data
         } else {
           this.$message.error(res.message)

+ 28 - 21
src/views/dataStatistics/userAnalysis/activeUser.vue

@@ -10,7 +10,7 @@
     <a-card size="small" :bordered="false" style="margin-bottom: 6px;">
       <div style="padding:0 10px;color: #00aaff;cursor: pointer;" slot="extra" @click="showSetModal=true"><a-icon type="setting" /> 参数设置</div>
       <div class="gard-box">
-        <div v-for="(card,i) in getShelfLeveData" :key="i" @click="chooseCard(i)" :class="card.isSelect? 'chooseCard':''">
+        <div v-for="(card,i) in getShelfLeveData" :key="i" @click="chooseCard(i)" :class="cardIndex == i? 'chooseCard':''">
           <a-card size="small">
             <h4>{{ card.levelName }}</h4>
             <p v-if="card.levelName == 'LV1'">近{{ card.dayLimit }}天销售金额 ≤ {{ card.amountMax }}元</p>
@@ -110,7 +110,7 @@
               </a-col>
               <a-col :md="4" :sm="24">
                 <a-form-item label="所在地">
-                  <areaList level="2" placeholder="请选择所在地"></areaList>
+                  <areaList level="2" placeholder="请选择所在地" @change="areaChange"></areaList>
                 </a-form-item>
               </a-col>
               <template v-if="advanced">
@@ -193,8 +193,13 @@ export default {
       orderTime: [],
       // 查询参数
       queryParam: {
-        shelfName: '',
-        state: undefined
+        endDate: '',
+        beginDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        state: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       },
       showModal: false,
       itemData: null, // 编辑行数据
@@ -220,7 +225,7 @@ export default {
         this.spinning = true
         return queryShelfActiveUserPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
-          if (res.status == 200) {
+          if (res.status == 200) {// eslint-disable-line
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             for (let i = 0; i < data.list.length; i++) {
@@ -228,6 +233,7 @@ export default {
               _item.no = no + i + 1
             }
           }
+          this.getShelfLeve()
           this.getStatistics()
           this.spinning = false
           return data
@@ -257,6 +263,11 @@ export default {
     storeChange (obj) {
       this.queryParam.storeSn = obj.key || undefined
     },
+    // 地区
+    areaChange (val, opts) {
+      this.queryParam.dealerProvinceSn = val && val[0] ? val[0] : ''
+      this.queryParam.dealerCitySn = val && val[1] ? val[1] : ''
+    },
     // 导出
     exportFile () {
       const _this = this
@@ -269,8 +280,13 @@ export default {
     reset () {
       this.cardIndex = null
       this.queryParam = {
-        shelfName: '',
-        state: undefined
+        endDate: '',
+        beginDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        state: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       }
       this.$refs.dealerList.resetForm()
       this.$refs.storeList.resetForm()
@@ -290,10 +306,7 @@ export default {
     getShelfLeve () {
       const _this = this
       queryShelfLevelReport().then(res => {
-        if (res.status == 200) {
-          res.data.forEach(item => {
-            item.isSelect = false
-          })
+        if (res.status == 200) { // eslint-disable-line
           _this.getShelfLeveData = res.data
         } else {
           _this.$message.error(res.message)
@@ -303,7 +316,7 @@ export default {
     // 获取活跃用户统计数据
     getStatistics () {
       statistics({}).then(res => {
-        if (res.status == 200) {
+        if (res.status == 200) { // eslint-disable-line
           this.statisticsObj = res.data
         } else {
           this.$message.error(res.message)
@@ -312,17 +325,12 @@ export default {
     },
     // 选中盒子
     chooseCard (num) {
-      const flag = this.getShelfLeveData.every(item => {
-        return !item.isSelect
-      })
-      this.getShelfLeveData[num].isSelect = true
-      if (!flag) {
-        this.getShelfLeveData.forEach(item => {
-          item.isSelect = false
-        })
+      if (this.cardIndex == num) { // eslint-disable-line
+        this.cardIndex = null
         var { lvCode, dealerSnList, storeSnList, ...newObj } = this.queryParam
         this.queryParam = newObj
       } else {
+        this.cardIndex = num
         const obj = {
           lvCode: this.getShelfLeveData[num].levelName,
           dealerSnList: this.getShelfLeveData[num].dealerSnList || [],
@@ -345,7 +353,6 @@ export default {
     }
   },
   mounted () {
-    this.getShelfLeve()
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
       this.reset()