Browse Source

bug 修复

lilei 2 years ago
parent
commit
eaa79e9714
2 changed files with 65 additions and 25 deletions
  1. 18 0
      src/api/report.js
  2. 47 25
      src/views/dataStatistics/userAnalysis/activeUser.vue

+ 18 - 0
src/api/report.js

@@ -66,4 +66,22 @@ export const saveStoreLevelParam = params => {
     data: params,
     method: 'post'
   })
+}
+// 活跃用户
+export const activeUserStatistics = params => {
+  return axios({
+    url: `/report/shelf/activeUser/statistics`,
+    data: params,
+    method: 'post'
+  })
+}
+export const queryShelfActiveUserPage = params => {
+  const url = `/report/shelf/queryShelfActiveUserPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
 }

+ 47 - 25
src/views/dataStatistics/userAnalysis/activeUser.vue

@@ -94,7 +94,7 @@
               </a-col>
               <a-col :md="4" :sm="24">
                 <a-form-item label="所在地">
-                  <areaList level="2" placeholder="请选择所在地"></areaList>
+                  <areaList level="2" placeholder="请选择所在地" v-model="areaArr" @change="areaChange"></areaList>
                 </a-form-item>
               </a-col>
               <template v-if="advanced">
@@ -116,15 +116,15 @@
             </a-row>
           </a-form>
         </div>
-        <div class="table-operator">
+        <div class="table-operator" v-if="countData">
           <a-alert type="info">
             <div slot="message" class="total-bar">
               <div>
-                门店数量:<strong>399</strong>;
-                近30天货架取货数量合计:<strong>399</strong>;
-                近30天货架取货金额合计:<strong>26545</strong>;
-                近30天销售数量合计:<strong>26545</strong>;
-                近30天销售金额合计:<strong>26545</strong>;
+                门店数量:<strong>{{ countData.shelfCount }}</strong>;
+                近30天货架取货数量合计:<strong>{{ countData.totalOrderQty }}</strong>;
+                近30天货架取货金额合计:<strong>{{ countData.totalOrderAmount }}</strong>;
+                近30天销售数量合计:<strong>{{ countData.saleOrderQty }}</strong>;
+                近30天销售金额合计:<strong>{{ countData.saleOrderAmount }}</strong>;
               </div>
             </div>
           </a-alert>
@@ -140,6 +140,9 @@
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"
           bordered>
+          <div slot="area" slot-scope="text, record">
+            {{ record.dealerProvinceName }} {{ record.dealerCityName }}
+          </div>
         </s-table>
       </a-spin>
     </a-card>
@@ -151,7 +154,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { bondRecordByPage } from '@/api/boundRecord.js'
+import { queryShelfActiveUserPage, activeUserStatistics } 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'
@@ -170,31 +173,39 @@ export default {
       activeKey: ['1'],
       time: [],
       orderTime: [],
+      areaArr: [],
       // 查询参数
       queryParam: {
-        shelfName: '',
-        state: undefined
+        beginDate: '',
+        endDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        shelfState: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       },
       showModal: false,
       itemData: null, // 编辑行数据
+      countData: null,
       openStatusModal: false, // 货架状态弹窗初始状态
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', 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: '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: '所在地', dataIndex: 'createDate2', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '货架状态', dataIndex: 'stateDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '近30天货架取货数量', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-        { title: '近30天货架取货金额', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-        { title: '近30天销售数量', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-        { title: '近30天销售金额', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true }
+        { title: '所在地', scopedSlots: { customRender: 'area' }, width: '11%', align: 'center' },
+        { 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) || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.spinning = true
-        return bondRecordByPage(Object.assign(parameter, this.queryParam)).then(res => {
+        const params = Object.assign(parameter, this.queryParam)
+        return queryShelfActiveUserPage(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -204,6 +215,7 @@ export default {
               _item.no = no + i + 1
             }
           }
+          this.getCount(params)
           this.spinning = false
           return data
         })
@@ -214,13 +226,13 @@ export default {
     handleBack () {
       this.$router.go(-1)
     },
-    //  时间  change
-    dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+    // 地区
+    areaChange (val, opts) {
+      this.queryParam.dealerProvinceSn = val && val[0] ? val[0] : ''
+      this.queryParam.dealerCitySn = val && val[1] ? val[1] : ''
     },
     //  时间  change
-    orderDateChange (date) {
+    dateChange (date) {
       this.queryParam.beginDate = date[0]
       this.queryParam.endDate = date[1]
     },
@@ -232,6 +244,11 @@ export default {
     storeChange (obj) {
       this.queryParam.storeSn = obj.key || undefined
     },
+    getCount (params) {
+      activeUserStatistics(params).then(res => {
+        this.countData = res.data || null
+      })
+    },
     // 导出
     exportFile () {
       const _this = this
@@ -243,8 +260,13 @@ export default {
     // 重置
     reset () {
       this.queryParam = {
-        shelfName: '',
-        state: undefined
+        beginDate: '',
+        endDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        shelfState: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       }
       this.$refs.dealerList.resetForm()
       this.$refs.storeList.resetForm()