Forráskód Böngészése

Merge branch 'develop_szhj05' of http://git.chelingzhu.com/jianguan-web/jq-repairFusion-html into develop_szhj05

# Conflicts:
#	src/api/report.js
#	src/views/dataStatistics/userAnalysis/activeUser.vue
lilei 2 éve
szülő
commit
5b3f395541

+ 56 - 4
src/api/report.js

@@ -67,14 +67,17 @@ export const saveStoreLevelParam = params => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
-// 活跃用户
-export const activeUserStatistics = params => {
+
+// 获取货架等级数据
+export const queryShelfLevelReport = params => {
   return axios({
   return axios({
-    url: `/report/shelf/activeUser/statistics`,
+    url: `/report/shelf/queryShelfLevelReport`,
     data: params,
     data: params,
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+
+// 获取活跃用户列表数据
 export const queryShelfActiveUserPage = params => {
 export const queryShelfActiveUserPage = params => {
   const url = `/report/shelf/queryShelfActiveUserPage/${params.pageNo}/${params.pageSize}`
   const url = `/report/shelf/queryShelfActiveUserPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageNo
@@ -82,6 +85,55 @@ export const queryShelfActiveUserPage = params => {
   return axios({
   return axios({
     url: url,
     url: url,
     data: params,
     data: params,
+    method: 'POST'
+  })
+}
+
+// 活跃用户-导出
+export const exportShelfActiveUser = params => {
+  return axios({
+    url: `/report/shelf/exportShelfActiveUser`,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+
+// 活跃用户-统计
+export const statistics = params => {
+  return axios({
+    url: `/report/shelf/useUser/statistics`,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取订单数据汇总列表
+export const queryShelfOrderReportPage = params => {
+  const url = `/report/shelf/queryShelfOrderReportPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+// 订单汇总-统计
+export const queryShelfOrderTotalReport = params => {
+  return axios({
+    url: `/report/shelf/queryShelfOrderTotalReport`,
+    data: params,
     method: 'post'
     method: 'post'
   })
   })
-}
+}
+
+// 订单汇总-导出
+export const exportShelfOrderReport = params => {
+  return axios({
+    url: `/report/shelf/exportShelfOrderReport`,
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 79 - 45
src/views/dataStatistics/orderDataSummary/list.vue

@@ -21,14 +21,14 @@
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
               <a-col :md="4" :sm="24">
               <a-col :md="4" :sm="24">
-                <a-form-item label="所在地">
-                  <areaList level="2" placeholder="请选择所在地"></areaList>
+                <a-form-item label="所在地" >
+                  <areaList level="2" placeholder="请选择所在地" @change="areaChange"></areaList>
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
               <template v-if="advanced">
               <template v-if="advanced">
                 <a-col :md="4" :sm="24">
                 <a-col :md="4" :sm="24">
                   <a-form-item label="货架状态">
                   <a-form-item label="货架状态">
-                    <v-select id="userd-state" code="SHELF_STATE" v-model="queryParam.state" allowClear placeholder="请选择状态"></v-select>
+                    <v-select id="userd-state" code="SHELF_STATE" v-model="queryParam.shelfState" allowClear placeholder="请选择状态"></v-select>
                   </a-form-item>
                   </a-form-item>
                 </a-col>
                 </a-col>
                 <a-col :md="5" :sm="24">
                 <a-col :md="5" :sm="24">
@@ -36,7 +36,7 @@
                     <rangeDate ref="orderDate" :value="orderTime" @change="orderDateChange" />
                     <rangeDate ref="orderDate" :value="orderTime" @change="orderDateChange" />
                   </a-form-item>
                   </a-form-item>
                 </a-col>
                 </a-col>
-                <a-col :md="5" :sm="24">
+                <!-- <a-col :md="5" :sm="24">
                   <a-form-item label="货架取货数量">
                   <a-form-item label="货架取货数量">
                     <a-input-group compact>
                     <a-input-group compact>
                       <a-input-number
                       <a-input-number
@@ -83,12 +83,12 @@
                         placeholder="请输入最大值"/>
                         placeholder="请输入最大值"/>
                     </a-input-group>
                     </a-input-group>
                   </a-form-item>
                   </a-form-item>
-                </a-col>
+                </a-col> -->
               </template>
               </template>
               <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
               <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="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="" @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">
                 <a @click="advanced=!advanced" style="margin-left: 8px">
                   {{ advanced ? '收起' : '展开' }}
                   {{ advanced ? '收起' : '展开' }}
                   <a-icon :type="advanced ? 'up' : 'down'"/>
                   <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -97,21 +97,21 @@
             </a-row>
             </a-row>
           </a-form>
           </a-form>
         </div>
         </div>
-        <div class="table-operator">
+        <div class="table-operator" v-if="statisticsObj">
           <a-alert type="info">
           <a-alert type="info">
             <div slot="message" class="total-bar">
             <div slot="message" class="total-bar">
               <div>
               <div>
-                货架数量:<strong>399</strong>;
-                铺货数量合计:<strong>399</strong>;
-                铺货金额合计:<strong>26545</strong>;
-                货架取货数量合计:<strong>399</strong>;
-                货架取货金额合计:<strong>26545</strong>;
+                货架数量:<strong>{{ statisticsObj.shelfNum }}</strong>;
+                铺货数量合计:<strong>{{ statisticsObj.totalShelfMaxQty }}</strong>;
+                铺货金额合计:<strong>{{ statisticsObj.totalShelfMaxCost }}</strong>;
+                货架取货数量合计:<strong>{{ statisticsObj.totalOrderAmount }}</strong>;
+                货架取货金额合计:<strong>{{ statisticsObj.totalOrderQty }}</strong>;
               </div>
               </div>
               <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>
             </div>
             </div>
           </a-alert>
           </a-alert>
@@ -121,21 +121,15 @@
           ref="table"
           ref="table"
           :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
           :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
           size="small"
           size="small"
-          rowKey="id"
+          :rowKey="(record,index)=>{return index}"
           :columns="columns"
           :columns="columns"
           :data="loadData"
           :data="loadData"
           :scroll="{ y: tableHeight }"
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"
           :defaultLoadData="false"
           bordered>
           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>
         </s-table>
       </a-spin>
       </a-spin>
     </a-card>
     </a-card>
@@ -145,11 +139,12 @@
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { bondRecordByPage } from '@/api/boundRecord.js'
+import { queryShelfOrderReportPage, queryShelfOrderTotalReport, exportShelfOrderReport } from '@/api/report.js'
 import areaList from '@/views/common/areaList.js'
 import areaList from '@/views/common/areaList.js'
 import dealerList from '@/views/common/dealerList.vue'
 import dealerList from '@/views/common/dealerList.vue'
 import storeList from '@/views/common/storeList.vue'
 import storeList from '@/views/common/storeList.vue'
 import { toThousands } from '@/libs/tools.js'
 import { toThousands } from '@/libs/tools.js'
+import { hdExportExcel } from '@/libs/exportExcel'
 export default {
 export default {
   name: 'UserList',
   name: 'UserList',
   components: { STable, VSelect, rangeDate, dealerList, storeList, areaList },
   components: { STable, VSelect, rangeDate, dealerList, storeList, areaList },
@@ -162,53 +157,61 @@ export default {
       orderTime: [],
       orderTime: [],
       // 查询参数
       // 查询参数
       queryParam: {
       queryParam: {
-        shelfName: '',
-        state: undefined
+        beginDate: '', // 下单时间
+        endDate: '',
+        shelfCreateBeginDate: '', // 货架创建时间
+        shelfCreateEndDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        shelfState: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       },
       },
       showModal: false,
       showModal: false,
       itemData: null, // 编辑行数据
       itemData: null, // 编辑行数据
       openStatusModal: false, // 货架状态弹窗初始状态
       openStatusModal: false, // 货架状态弹窗初始状态
+      statisticsObj: null,
       // 表头
       // 表头
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { 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: '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: '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: 'shelfStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         {
         {
           slots: { title: 'customTitle' },
           slots: { title: 'customTitle' },
           children: [
           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 || text == 0) ? text : '--') } },
+            { title: '铺货金额', dataIndex: 'totalShelfMaxCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } }
           ]
           ]
         },
         },
         {
         {
           title: '货架订单',
           title: '货架订单',
           children: [
           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 || text == 0) ? text : '--') } },
+            { title: '取货金额', dataIndex: 'totalOrderAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } }
           ]
           ]
         },
         },
         {
         {
           title: '急送订单',
           title: '急送订单',
           children: [
           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 || text == 0) ? text : '--') } },
+            { title: '急送金额', dataIndex: 'tempOrderAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } }
           ]
           ]
         },
         },
         {
         {
           title: '销售单',
           title: '销售单',
           children: [
           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 || text == 0) ? text : '--') } },
+            { title: '销售金额', dataIndex: 'saleOrderAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } }
           ]
           ]
         }
         }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.spinning = true
         this.spinning = true
-        return bondRecordByPage(Object.assign(parameter, this.queryParam)).then(res => {
+        return queryShelfOrderReportPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           let data
           if (res.status == 200) {
           if (res.status == 200) {
             data = res.data
             data = res.data
@@ -218,6 +221,7 @@ export default {
               _item.no = no + i + 1
               _item.no = no + i + 1
             }
             }
           }
           }
+          this.getStatistics(this.queryParam)
           this.spinning = false
           this.spinning = false
           return data
           return data
         })
         })
@@ -230,8 +234,8 @@ export default {
     },
     },
     //  时间  change
     //  时间  change
     dateChange (date) {
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.shelfCreateBeginDate = date[0]
+      this.queryParam.shelfCreateEndDate = date[1]
     },
     },
     //  时间  change
     //  时间  change
     orderDateChange (date) {
     orderDateChange (date) {
@@ -246,11 +250,23 @@ export default {
     storeChange (obj) {
     storeChange (obj) {
       this.queryParam.storeSn = obj.key || undefined
       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] : ''
+    },
     // 重置
     // 重置
     reset () {
     reset () {
       this.queryParam = {
       this.queryParam = {
-        shelfName: '',
-        state: undefined
+        beginDate: '', // 下单时间
+        endDate: '',
+        shelfCreateBeginDate: '', // 货架创建时间
+        shelfCreateEndDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        shelfState: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       }
       }
       this.$refs.dealerList.resetForm()
       this.$refs.dealerList.resetForm()
       this.$refs.storeList.resetForm()
       this.$refs.storeList.resetForm()
@@ -262,9 +278,27 @@ export default {
         _this.setTableH()
         _this.setTableH()
       })
       })
     },
     },
+    // 导出
+    exportFile () {
+      const _this = this
+      this.spinning = true
+      hdExportExcel(exportShelfOrderReport, this.queryParam, '订单数据汇总', function () {
+        _this.spinning = false
+      })
+    },
     setTableH () {
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 225
       this.tableHeight = window.innerHeight - tableSearchH - 225
+    },
+    // 获取订单汇总统计数据
+    getStatistics (ajaxData) {
+      queryShelfOrderTotalReport(ajaxData).then(res => {
+        if (res.status == 200) {// eslint-disable-line
+          this.statisticsObj = res.data
+        } else {
+          this.$message.error(res.message)
+        }
+      })
     }
     }
   },
   },
   watch: {
   watch: {

+ 104 - 42
src/views/dataStatistics/userAnalysis/activeUser.vue

@@ -10,19 +10,35 @@
     <a-card size="small" :bordered="false" style="margin-bottom: 6px;">
     <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 style="padding:0 10px;color: #00aaff;cursor: pointer;" slot="extra" @click="showSetModal=true"><a-icon type="setting" /> 参数设置</div>
       <div class="gard-box">
       <div class="gard-box">
-        <div>
+        <div v-for="(card,i) in getShelfLeveData" :key="i" @click="chooseCard(i)" :class="cardIndex == i? 'chooseCard':''">
           <a-card size="small">
           <a-card size="small">
-            <h4>LV1</h4>
-            <p>近30天销售金额 ≤ 1000元</p>
+            <h4>{{ card.levelName }}</h4>
+            <p v-if="card.levelName == 'LV1'">近{{ card.dayLimit }}天销售金额 ≤ {{ card.amountMax }}元</p>
+            <p v-if="card.levelName == 'LV2'">{{ card.amountMin }}元 < 近{{ card.dayLimit }}天销售金额 ≤ {{ card.amountMax }}元</p>
+            <p v-if="card.levelName == 'LV3'">{{ card.amountMin }}元 < 近{{ card.dayLimit }}天销售金额 ≤ {{ card.amountMax }}元</p>
+            <p v-if="card.levelName == 'LV4'">{{ card.amountMin }}元 < 近{{ card.dayLimit }}天销售金额 ≤ {{ card.amountMax }}元</p>
+            <p v-if="card.levelName == 'LV5'">{{ card.amountMin }}元 < 近{{ card.dayLimit }}天销售金额</p>
             <div>
             <div>
-              <div><span>门店数量</span><span>21个</span></div>
-              <div><span>累计销售金额</span><span>21元</span></div>
-              <div><span>门店数量占比</span><span>21%</span></div>
-              <div><span>累计销售金额占比</span><span>21%</span></div>
+              <div>
+                <span>门店数量</span>
+                <span>{{ card.shelfCount }}个</span>
+              </div>
+              <div>
+                <span>累计销售金额</span>
+                <span>{{ card.amountSum }}元</span>
+              </div>
+              <div>
+                <span>门店数量占比</span>
+                <span>{{ card.shelfRate? card.shelfRate : 0 }}</span>
+              </div>
+              <div>
+                <span>累计销售金额占比</span>
+                <span>{{ card.amountRate? card.amountRate : 0 }}</span>
+              </div>
             </div>
             </div>
           </a-card>
           </a-card>
         </div>
         </div>
-        <div>
+        <!-- <div>
           <a-card size="small">
           <a-card size="small">
             <h4>LV2</h4>
             <h4>LV2</h4>
             <p> 1000元 < 近30天销售金额 ≤ 2000元</p>
             <p> 1000元 < 近30天销售金额 ≤ 2000元</p>
@@ -69,7 +85,7 @@
               <div><span>累计销售金额占比</span><span>21%</span></div>
               <div><span>累计销售金额占比</span><span>21%</span></div>
             </div>
             </div>
           </a-card>
           </a-card>
-        </div>
+        </div> -->
       </div>
       </div>
     </a-card>
     </a-card>
     <a-card size="small" :bordered="false">
     <a-card size="small" :bordered="false">
@@ -94,7 +110,7 @@
               </a-col>
               </a-col>
               <a-col :md="4" :sm="24">
               <a-col :md="4" :sm="24">
                 <a-form-item label="所在地">
                 <a-form-item label="所在地">
-                  <areaList level="2" placeholder="请选择所在地" v-model="areaArr" @change="areaChange"></areaList>
+                  <areaList level="2" placeholder="请选择所在地" @change="areaChange"></areaList>
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
               <template v-if="advanced">
               <template v-if="advanced">
@@ -116,15 +132,15 @@
             </a-row>
             </a-row>
           </a-form>
           </a-form>
         </div>
         </div>
-        <div class="table-operator" v-if="countData">
+        <div class="table-operator" v-if="statisticsObj">
           <a-alert type="info">
           <a-alert type="info">
             <div slot="message" class="total-bar">
             <div slot="message" class="total-bar">
               <div>
               <div>
-                门店数量:<strong>{{ countData.shelfCount }}</strong>;
-                近30天货架取货数量合计:<strong>{{ countData.totalOrderQty }}</strong>;
-                近30天货架取货金额合计:<strong>{{ countData.totalOrderAmount }}</strong>;
-                近30天销售数量合计:<strong>{{ countData.saleOrderQty }}</strong>;
-                近30天销售金额合计:<strong>{{ countData.saleOrderAmount }}</strong>;
+                门店数量:<strong>{{ statisticsObj.shelfNum || 0 }}</strong>;
+                近30天货架取货数量合计:<strong>{{ statisticsObj.totalShelfMaxQty }}</strong>;
+                近30天货架取货金额合计:<strong>{{ statisticsObj.totalShelfMaxCost }}</strong>;
+                近30天销售数量合计:<strong>{{ statisticsObj.saleOrderQty }}</strong>;
+                近30天销售金额合计:<strong>{{ statisticsObj.saleOrderAmount || 0 }}</strong>;
               </div>
               </div>
             </div>
             </div>
           </a-alert>
           </a-alert>
@@ -134,7 +150,7 @@
           ref="table"
           ref="table"
           :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
           :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
           size="small"
           size="small"
-          rowKey="id"
+          :rowKey="(record,index)=>{return index}"
           :columns="columns"
           :columns="columns"
           :data="loadData"
           :data="loadData"
           :scroll="{ y: tableHeight }"
           :scroll="{ y: tableHeight }"
@@ -154,13 +170,15 @@
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { queryShelfActiveUserPage, activeUserStatistics } from '@/api/report.js'
+import { queryShelfActiveUserPage, queryShelfLevelReport, exportShelfActiveUser, statistics } from '@/api/report.js'
 import areaList from '@/views/common/areaList.js'
 import areaList from '@/views/common/areaList.js'
 import dealerList from '@/views/common/dealerList.vue'
 import dealerList from '@/views/common/dealerList.vue'
 import storeList from '@/views/common/storeList.vue'
 import storeList from '@/views/common/storeList.vue'
 import { toThousands } from '@/libs/tools.js'
 import { toThousands } from '@/libs/tools.js'
 import { hdExportExcel } from '@/libs/exportExcel'
 import { hdExportExcel } from '@/libs/exportExcel'
 import setModal from './setModal.vue'
 import setModal from './setModal.vue'
+// import { forEach } from 'core-js/js/array'
+// import { assign } from 'core-js/es7/object'
 export default {
 export default {
   name: 'UserList',
   name: 'UserList',
   components: { STable, VSelect, rangeDate, dealerList, storeList, areaList, setModal },
   components: { STable, VSelect, rangeDate, dealerList, storeList, areaList, setModal },
@@ -173,21 +191,22 @@ export default {
       activeKey: ['1'],
       activeKey: ['1'],
       time: [],
       time: [],
       orderTime: [],
       orderTime: [],
-      areaArr: [],
       // 查询参数
       // 查询参数
       queryParam: {
       queryParam: {
-        beginDate: '',
         endDate: '',
         endDate: '',
+        beginDate: '',
         storeSn: undefined,
         storeSn: undefined,
         dealerSn: undefined,
         dealerSn: undefined,
-        shelfState: undefined,
+        state: undefined,
         dealerProvinceSn: undefined,
         dealerProvinceSn: undefined,
         dealerCitySn: undefined
         dealerCitySn: undefined
       },
       },
       showModal: false,
       showModal: false,
       itemData: null, // 编辑行数据
       itemData: null, // 编辑行数据
-      countData: null,
       openStatusModal: false, // 货架状态弹窗初始状态
       openStatusModal: false, // 货架状态弹窗初始状态
+      getShelfLeveData: [], // 货架等级数据
+      statisticsObj: null,
+      cardIndex: null,
       // 表头
       // 表头
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
@@ -196,18 +215,17 @@ export default {
         { title: '配件经销商', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '配件经销商', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '所在地', scopedSlots: { customRender: 'area' }, width: '11%', align: 'center' },
         { title: '所在地', scopedSlots: { customRender: 'area' }, width: '11%', align: 'center' },
         { title: '货架状态', dataIndex: 'shelfStateDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '货架状态', dataIndex: 'shelfStateDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '近30天货架取货数量', dataIndex: 'totalOrderQty', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' } },
-        { title: '近30天货架取货金额', dataIndex: 'totalOrderAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' } },
-        { title: '近30天销售数量', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' } },
-        { title: '近30天销售金额', dataIndex: 'bondAmount1', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' } }
+        { title: '近30天货架取货数量', dataIndex: 'totalOrderQty', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
+        { title: '近30天货架取货金额', dataIndex: 'totalOrderAmount', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') }, sorter: true },
+        { title: '近30天销售数量', dataIndex: 'saleOrderQty', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
+        { title: '近30天销售金额', dataIndex: 'saleOrderAmount', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') }, sorter: true }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.spinning = true
         this.spinning = true
-        const params = Object.assign(parameter, this.queryParam)
-        return queryShelfActiveUserPage(params).then(res => {
+        return queryShelfActiveUserPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           let data
-          if (res.status == 200) {
+          if (res.status == 200) {// eslint-disable-line
             data = res.data
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             const no = (data.pageNo - 1) * data.pageSize
             for (let i = 0; i < data.list.length; i++) {
             for (let i = 0; i < data.list.length; i++) {
@@ -215,8 +233,9 @@ export default {
               _item.no = no + i + 1
               _item.no = no + i + 1
             }
             }
           }
           }
-          this.getCount(params)
           this.spinning = false
           this.spinning = false
+          this.getShelfLeve()
+          this.getStatistics(this.queryParam)
           return data
           return data
         })
         })
       }
       }
@@ -226,16 +245,16 @@ export default {
     handleBack () {
     handleBack () {
       this.$router.go(-1)
       this.$router.go(-1)
     },
     },
-    // 地区
-    areaChange (val, opts) {
-      this.queryParam.dealerProvinceSn = val && val[0] ? val[0] : ''
-      this.queryParam.dealerCitySn = val && val[1] ? val[1] : ''
-    },
     //  时间  change
     //  时间  change
     dateChange (date) {
     dateChange (date) {
       this.queryParam.beginDate = date[0]
       this.queryParam.beginDate = date[0]
       this.queryParam.endDate = date[1]
       this.queryParam.endDate = date[1]
     },
     },
+    //  时间  change
+    orderDateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
     // 经销商 change
     // 经销商 change
     dealerChange (obj) {
     dealerChange (obj) {
       this.queryParam.dealerSn = obj.key || undefined
       this.queryParam.dealerSn = obj.key || undefined
@@ -244,27 +263,28 @@ export default {
     storeChange (obj) {
     storeChange (obj) {
       this.queryParam.storeSn = obj.key || undefined
       this.queryParam.storeSn = obj.key || undefined
     },
     },
-    getCount (params) {
-      activeUserStatistics(params).then(res => {
-        this.countData = res.data || null
-      })
+    // 地区
+    areaChange (val, opts) {
+      this.queryParam.dealerProvinceSn = val && val[0] ? val[0] : ''
+      this.queryParam.dealerCitySn = val && val[1] ? val[1] : ''
     },
     },
     // 导出
     // 导出
     exportFile () {
     exportFile () {
       const _this = this
       const _this = this
       this.spinning = true
       this.spinning = true
-      hdExportExcel(exportShelfUseUser, this.queryParam, '用户分析(活跃用户)详情', function () {
+      hdExportExcel(exportShelfActiveUser, this.queryParam, '用户分析(活跃用户)详情', function () {
         _this.spinning = false
         _this.spinning = false
       })
       })
     },
     },
     // 重置
     // 重置
     reset () {
     reset () {
+      this.cardIndex = null
       this.queryParam = {
       this.queryParam = {
-        beginDate: '',
         endDate: '',
         endDate: '',
+        beginDate: '',
         storeSn: undefined,
         storeSn: undefined,
         dealerSn: undefined,
         dealerSn: undefined,
-        shelfState: undefined,
+        state: undefined,
         dealerProvinceSn: undefined,
         dealerProvinceSn: undefined,
         dealerCitySn: undefined
         dealerCitySn: undefined
       }
       }
@@ -281,6 +301,44 @@ export default {
     setTableH () {
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 255
       this.tableHeight = window.innerHeight - tableSearchH - 255
+    },
+    // 获取货架等级
+    getShelfLeve () {
+      const _this = this
+      queryShelfLevelReport().then(res => {
+        if (res.status == 200) { // eslint-disable-line
+          _this.getShelfLeveData = res.data
+        } else {
+          _this.$message.error(res.message)
+        }
+      })
+    },
+    // 获取活跃用户统计数据
+    getStatistics (ajaxData) {
+      statistics(ajaxData).then(res => {
+        if (res.status == 200) { // eslint-disable-line
+          this.statisticsObj = res.data
+        } else {
+          this.$message.error(res.message)
+        }
+      })
+    },
+    // 选中盒子
+    chooseCard (num) {
+      if (this.cardIndex == num) { // eslint-disable-line
+        this.cardIndex = null
+        var { lvCode, dealerSnList, customerSnList, ...newObj } = this.queryParam
+        this.queryParam = newObj
+      } else {
+        this.cardIndex = num
+        const obj = {
+          lvCode: this.getShelfLeveData[num].levelName,
+          dealerSnList: this.getShelfLeveData[num].dealerSnList || [],
+          customerSnList: this.getShelfLeveData[num].customerSnList || []
+        }
+        Object.assign(this.queryParam, obj)
+      }
+      this.$refs.table.refresh(true)
     }
     }
   },
   },
   watch: {
   watch: {
@@ -344,4 +402,8 @@ export default {
       }
       }
     }
     }
   }
   }
+  .chooseCard .ant-card-bordered{
+    border:1px solid #91d5ff !important;
+    background:#e6f7ff !important;
+  }
 </style>
 </style>

+ 2 - 2
src/views/dataStatistics/userAnalysis/list.vue

@@ -4,7 +4,7 @@
       <div class="s-row">
       <div class="s-row">
         <div class="c-1">
         <div class="c-1">
           <div>
           <div>
-            <span>{{ countData?countData.activeRate:0 }}%</span>
+            <span>{{ countData?countData.useRate:0 }}%</span>
             <span>转化率 ◕</span>
             <span>转化率 ◕</span>
           </div>
           </div>
         </div>
         </div>
@@ -25,7 +25,7 @@
       <div class="s-row">
       <div class="s-row">
         <div class="c-1">
         <div class="c-1">
           <div>
           <div>
-            <span>{{ countData?countData.useRate:0 }}%</span>
+            <span>{{ countData?countData.activeRate:0 }}%</span>
             <span>转化率 ◕</span>
             <span>转化率 ◕</span>
           </div>
           </div>
         </div>
         </div>

+ 1 - 1
src/views/dataStatistics/userAnalysis/usedUser.vue

@@ -60,7 +60,7 @@
           <a-alert type="info">
           <a-alert type="info">
             <div slot="message" class="total-bar">
             <div slot="message" class="total-bar">
               <div>
               <div>
-                门店数量:<strong>{{ countData.shelfNum||0 }}</strong>;
+                门店数量:<strong>{{ countData.shelfCount||0 }}</strong>;
                 铺货数量合计:<strong>{{ countData.totalShelfMaxQty||0 }}</strong>;
                 铺货数量合计:<strong>{{ countData.totalShelfMaxQty||0 }}</strong>;
                 铺货金额合计:<strong>{{ countData.totalShelfMaxCost||0 }}</strong>;
                 铺货金额合计:<strong>{{ countData.totalShelfMaxCost||0 }}</strong>;
               </div>
               </div>