lilei 2 anni fa
parent
commit
dc23682aab

+ 45 - 0
src/api/report.js

@@ -0,0 +1,45 @@
+import { axios } from '@/utils/request'
+// 梯形图
+export const queryUserCount = params => {
+  return axios({
+    url: `/report/user/queryUserCount`,
+    data: params,
+    method: 'post'
+  })
+}
+// 注册用户
+export const queryStatistics = params => {
+  return axios({
+    url: `/report/user/queryStatistics`,
+    data: params,
+    method: 'post'
+  })
+}
+export const registerUserQueryPage = params => {
+  const url = `/report/user/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 使用用户
+export const useUserStatistics = params => {
+  return axios({
+    url: `/report/shelf/useUser/statistics`,
+    data: params,
+    method: 'post'
+  })
+}
+export const useUserQueryPage = params => {
+  const url = `/report/shelf/queryShelfUseUserPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 23 - 6
src/views/dataStatistics/userAnalysis/list.vue

@@ -4,7 +4,7 @@
       <div class="s-row">
         <div class="c-1">
           <div>
-            <span>75%</span>
+            <span>{{ countData?countData.activeRate:0 }}%</span>
             <span>转化率 ◕</span>
           </div>
         </div>
@@ -12,7 +12,7 @@
           <img src="@/assets/s1.png"></img>
           <div class="text">
             <div>注册用户</div>
-            <div>1800个</div>
+            <div>{{ countData?countData.registerUserCount:0 }}个</div>
           </div>
         </div>
         <div class="c-3">
@@ -25,7 +25,7 @@
       <div class="s-row">
         <div class="c-1">
           <div>
-            <span>75%</span>
+            <span>{{ countData?countData.useRate:0 }}%</span>
             <span>转化率 ◕</span>
           </div>
         </div>
@@ -33,7 +33,7 @@
           <img src="@/assets/s2.png"></img>
           <div class="text">
             <div>使用用户</div>
-            <div>802个/450家门店</div>
+            <div>{{ countData?countData.useUserCount:0 }}个/{{ countData?countData.useStoreCount:0 }}家门店</div>
           </div>
         </div>
         <div class="c-3">
@@ -50,7 +50,7 @@
           <img src="@/assets/s3.png"></img>
           <div class="text">
             <div>活跃用户</div>
-            <div>1012个/450家门店</div>
+            <div>{{ countData?countData.activeUserCount:0 }}个/{{ countData?countData.activeStoreCount:0 }}家门店</div>
           </div>
         </div>
         <div class="c-3">
@@ -66,15 +66,32 @@
 </template>
 
 <script>
+import { queryUserCount } from '@/api/report.js'
 export default {
   data () {
     return {
-
+      countData: null
     }
   },
   methods: {
     toPage (name) {
       this.$router.push({ name })
+    },
+    getData () {
+      queryUserCount().then(res => {
+        this.countData = res.data || null
+      })
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.getData()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.getData()
     }
   }
 }

+ 42 - 21
src/views/dataStatistics/userAnalysis/registeredUser.vue

@@ -14,7 +14,7 @@
             <a-row :gutter="15">
               <a-col :md="5" :sm="24">
                 <a-form-item label="注册时间">
-                  <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+                  <rangeDate ref="rangeDate" v-model="time" @change="dateChange" />
                 </a-form-item>
               </a-col>
               <a-col :md="5" :sm="24">
@@ -24,7 +24,7 @@
               </a-col>
               <a-col :md="4" :sm="24">
                 <a-form-item label="用户类型">
-                  <v-select id="registeredUser-userType" code="BOND_RECORD_STATE" v-model="queryParam.userType" allowClear placeholder="请选择用户类型"></v-select>
+                  <v-select id="registeredUser-sysUserFlag" code="USER_TYPE" v-model="queryParam.sysUserFlag" allowClear placeholder="请选择用户类型"></v-select>
                 </a-form-item>
               </a-col>
               <a-col :md="5" :sm="24">
@@ -35,7 +35,7 @@
               <template v-if="advanced">
                 <a-col :md="4" :sm="24">
                   <a-form-item label="职位">
-                    <v-select id="registeredUser-position" code="BOND_RECORD_STATE" v-model="queryParam.position" allowClear placeholder="请选择职位"></v-select>
+                    <v-select id="registeredUser-storeManagerFlag" code="USER_JOB" v-model="queryParam.storeManagerFlag" allowClear placeholder="请选择职位"></v-select>
                   </a-form-item>
                 </a-col>
                 <a-col :md="5" :sm="24">
@@ -55,12 +55,12 @@
             </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>;
-                累计vin扫描次数合计:<strong>26545</strong>;
+                用户数量:<strong>{{ countData.userTotal||0 }}</strong>;
+                累计vin扫描次数合计:<strong>{{ countData.vinCount||0 }}</strong>;
               </div>
             </div>
           </a-alert>
@@ -94,7 +94,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { bondRecordByPage } from '@/api/boundRecord.js'
+import { registerUserQueryPage, queryStatistics } from '@/api/report.js'
 import dealerList from '@/views/common/dealerList.vue'
 import storeList from '@/views/common/storeList.vue'
 import { toThousands } from '@/libs/tools.js'
@@ -109,27 +109,34 @@ export default {
       time: [],
       // 查询参数
       queryParam: {
-        shelfName: '',
-        state: undefined
+        beginDate: '',
+        endDate: '',
+        mobile: '',
+        storeManagerFlag: undefined,
+        sysUserFlag: undefined,
+        dealerSn: undefined,
+        storeSn: undefined
       },
       showModal: false,
       itemData: null, // 编辑行数据
       openStatusModal: false, // 货架状态弹窗初始状态
+      countData: null,
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '注册时间', dataIndex: 'createDate', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '手机号码', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '用户类型', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '注册时间', dataIndex: 'registerDate', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '手机号码', dataIndex: 'mobile', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '用户类型', dataIndex: 'sysUserFlagDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '汽车修理厂', dataIndex: 'storeName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '职位', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '职位', dataIndex: 'storeManagerFlagDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '配件经销商', dataIndex: 'dealerName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { slots: { title: 'customTitle' }, dataIndex: 'bondAmount', width: '10%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' }, sorter: true }
+        { slots: { title: 'customTitle' }, dataIndex: 'vinCount', width: '10%', align: 'center', customRender: function (text) { return 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 registerUserQueryPage(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -139,6 +146,7 @@ export default {
               _item.no = no + i + 1
             }
           }
+          this.getCount(params)
           this.spinning = false
           return data
         })
@@ -149,6 +157,11 @@ export default {
     handleBack () {
       this.$router.go(-1)
     },
+    getCount (params) {
+      queryStatistics(params).then(res => {
+        this.countData = res.data || null
+      })
+    },
     //  时间  change
     dateChange (date) {
       this.queryParam.beginDate = date[0]
@@ -165,17 +178,27 @@ export default {
     // 重置
     reset () {
       this.queryParam = {
-        shelfName: '',
-        state: undefined
+        beginDate: '',
+        endDate: '',
+        mobile: '',
+        storeManagerFlag: undefined,
+        sysUserFlag: undefined,
+        dealerSn: undefined,
+        storeSn: undefined
       }
-      this.$refs.dealerList.resetForm()
-      this.$refs.storeList.resetForm()
+      this.time = []
+      this.$refs.rangeDate.resetDate('')
       this.$refs.table.refresh(true)
+      if (this.advanced) {
+        this.$refs.dealerList.resetForm()
+      }
+      this.$refs.storeList.resetForm()
     },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
+        _this.reset()
       })
     },
     setTableH () {
@@ -197,14 +220,12 @@ export default {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
-      this.reset()
     }
   },
   activated () {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
       this.pageInit()
-      this.reset()
     }
   }
 }

+ 54 - 24
src/views/dataStatistics/userAnalysis/usedUser.vue

@@ -14,7 +14,7 @@
             <a-row :gutter="15">
               <a-col :md="5" :sm="24">
                 <a-form-item label="货架创建时间">
-                  <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+                  <rangeDate ref="rangeDate" v-model="time" @change="dateChange" />
                 </a-form-item>
               </a-col>
               <a-col :md="5" :sm="24">
@@ -29,13 +29,13 @@
               </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">
                 <a-col :md="4" :sm="24">
                   <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-col>
                 <a-col :md="5" :sm="24">
@@ -56,13 +56,13 @@
             </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>;
-                铺货数量合计:<strong>399</strong>;
-                铺货金额合计:<strong>26545</strong>;
+                门店数量:<strong>{{ countData.shelfNum||0 }}</strong>;
+                铺货数量合计:<strong>{{ countData.totalShelfMaxQty||0 }}</strong>;
+                铺货金额合计:<strong>{{ countData.totalShelfMaxCost||0 }}</strong>;
               </div>
             </div>
           </a-alert>
@@ -72,12 +72,14 @@
           ref="table"
           :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
           size="small"
-          rowKey="id"
           :columns="columns"
           :data="loadData"
           :scroll="{ y: tableHeight }"
           :defaultLoadData="false"
           bordered>
+          <div slot="area" slot-scope="text, record">
+            {{ record.dealerProvinceName }} {{ record.dealerCityName }}
+          </div>
           <span slot="customTitle">
             <a-popover>
               <template slot="content">
@@ -96,7 +98,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { bondRecordByPage } from '@/api/boundRecord.js'
+import { useUserQueryPage, useUserStatistics } 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'
@@ -109,32 +111,42 @@ export default {
       spinning: false,
       advanced: false,
       tableHeight: 0,
+      areaArr: [],
       time: [],
       orderTime: [],
       // 查询参数
       queryParam: {
-        shelfName: '',
-        state: undefined
+        shelfCreateBeginDate: '',
+        shelfCreateEndDate: '',
+        lastOrderBeginDate: '',
+        lastOrderEndDate: '',
+        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: '铺货数量', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-        { title: '铺货金额', dataIndex: 'bondAmount', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' }, sorter: true },
-        { slots: { title: 'customTitle' }, dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '所在地', scopedSlots: { customRender: 'area' }, width: '11%', align: 'center' },
+        { title: '货架状态', dataIndex: 'shelfStateDictValue', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '铺货数量', dataIndex: 'totalShelfMaxQty', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' } },
+        { title: '铺货金额', dataIndex: 'totalShelfMaxCost', width: '11%', align: 'center', customRender: function (text) { return text && toThousands(text, 2) || '--' } },
+        { slots: { title: 'customTitle' }, dataIndex: 'lastOrderDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.spinning = true
-        return bondRecordByPage(Object.assign(parameter, this.queryParam)).then(res => {
+        const params = Object.assign(parameter, this.queryParam)
+        return useUserQueryPage(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -144,6 +156,7 @@ export default {
               _item.no = no + i + 1
             }
           }
+          this.getCount(params)
           this.spinning = false
           return data
         })
@@ -154,15 +167,25 @@ export default {
     handleBack () {
       this.$router.go(-1)
     },
+    getCount (params) {
+      useUserStatistics(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] : ''
+    },
     //  时间  change
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.shelfCreateBeginDate = date[0]
+      this.queryParam.shelfCreateEndDate = date[1]
     },
     //  时间  change
     orderDateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.lastOrderBeginDate = date[0]
+      this.queryParam.lastOrderEndDate = date[1]
     },
     // 经销商 change
     dealerChange (obj) {
@@ -175,8 +198,15 @@ export default {
     // 重置
     reset () {
       this.queryParam = {
-        shelfName: '',
-        state: undefined
+        shelfCreateBeginDate: '',
+        shelfCreateEndDate: '',
+        lastOrderBeginDate: '',
+        lastOrderEndDate: '',
+        storeSn: undefined,
+        dealerSn: undefined,
+        shelfState: undefined,
+        dealerProvinceSn: undefined,
+        dealerCitySn: undefined
       }
       this.$refs.dealerList.resetForm()
       this.$refs.storeList.resetForm()