123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <template>
- <div class="userd-baseInfo">
- <a-page-header :ghost="false" title="使用用户" :backIcon="false" class="userd-back">
- <template slot="subTitle">
- <a href="javascript:;" @click="handleBack" id="userd-handleBack">
- <a-icon type="left"></a-icon> 返回上页
- </a>
- </template>
- </a-page-header>
- <a-card size="small" :bordered="false">
- <a-spin :spinning="spinning" tip="Loading...">
- <div ref="tableSearch" class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="5" :sm="24">
- <a-form-item label="货架创建时间">
- <rangeDate ref="rangeDate" v-model="time" @change="dateChange" />
- </a-form-item>
- </a-col>
- <a-col :md="5" :sm="24">
- <a-form-item label="汽车修理厂">
- <storeList ref="storeList" @change="storeChange" id="userd-storeChange"></storeList>
- </a-form-item>
- </a-col>
- <a-col :md="5" :sm="24">
- <a-form-item label="配件经销商">
- <dealerList ref="dealerList" @change="dealerChange" id="userd-dealerChange"></dealerList>
- </a-form-item>
- </a-col>
- <a-col :md="4" :sm="24">
- <a-form-item label="所在地">
- <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.shelfState"
- allowClear
- placeholder="请选择状态"
- :notIn="['NOT_ENABLE']"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="5" :sm="24">
- <a-form-item label="最近下单时间">
- <rangeDate ref="orderDate" :value="orderTime" @change="orderDateChange" />
- </a-form-item>
- </a-col>
- </template>
- <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" @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'"/>
- </a>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <div class="table-operator" v-if="countData">
- <a-alert type="info">
- <div slot="message" class="total-bar">
- <div>
- 门店数量:<strong>{{ countData.shelfCount||0 }}</strong>;
- 铺货数量合计:<strong>{{ countData.totalShelfMaxQty||0 }}</strong>;
- 铺货金额合计:<strong>{{ countData.totalShelfMaxCost||0 }}</strong>;
- </div>
- </div>
- </a-alert>
- </div>
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
- size="small"
- :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">
- 表示此修理厂最近一次从货架上取货的时间
- </template>
- <a-icon type="question-circle" theme="twoTone" />
- </a-popover>
- 最近下单时间
- </span>
- </s-table>
- </a-spin>
- </a-card>
- </div>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import rangeDate from '@/views/common/rangeDate.vue'
- import { useUserQueryPage, useUserStatistics, exportShelfUseUser } 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 { hdExportExcel } from '@/libs/exportExcel'
- import { toThousands } from '@/libs/tools.js'
- export default {
- name: 'UserList',
- components: { STable, VSelect, rangeDate, dealerList, storeList, areaList },
- data () {
- return {
- spinning: false,
- advanced: false,
- tableHeight: 0,
- areaArr: [],
- time: [],
- orderTime: [],
- // 查询参数
- queryParam: {
- 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: '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: '所在地', 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 || text == 0) ? text : '--' } },
- { title: '铺货金额', dataIndex: 'totalShelfMaxCost', width: '11%', align: 'center', customRender: function (text) { return (text || text == 0) ? toThousands(text, 2) : '--' } },
- { slots: { title: 'customTitle' }, dataIndex: 'lastOrderDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.spinning = true
- const params = Object.assign(parameter, this.queryParam)
- return useUserQueryPage(params).then(res => {
- let data
- if (res.status == 200) {
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (let i = 0; i < data.list.length; i++) {
- const _item = data.list[i]
- _item.no = no + i + 1
- }
- }
- this.getCount(params)
- this.spinning = false
- return data
- })
- }
- }
- },
- methods: {
- 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.shelfCreateBeginDate = date[0]
- this.queryParam.shelfCreateEndDate = date[1]
- },
- // 时间 change
- orderDateChange (date) {
- this.queryParam.lastOrderBeginDate = date[0]
- this.queryParam.lastOrderEndDate = date[1]
- },
- // 经销商 change
- dealerChange (obj) {
- this.queryParam.dealerSn = obj.key || undefined
- },
- // 汽车修理厂 change
- storeChange (obj) {
- this.queryParam.storeSn = obj.key || undefined
- },
- // 导出
- exportFile () {
- const _this = this
- this.spinning = true
- hdExportExcel(exportShelfUseUser, this.queryParam, '用户分析(使用用户)详情', function () {
- _this.spinning = false
- })
- },
- // 重置
- reset () {
- this.queryParam = {
- shelfCreateBeginDate: '',
- shelfCreateEndDate: '',
- lastOrderBeginDate: '',
- lastOrderEndDate: '',
- storeSn: undefined,
- dealerSn: undefined,
- shelfState: undefined,
- dealerProvinceSn: undefined,
- dealerCitySn: undefined
- }
- this.areaArr = []
- this.$refs.rangeDate.resetDate()
- if (this.advanced) {
- this.$refs.orderDate.resetDate()
- }
- this.$refs.dealerList.resetForm()
- this.$refs.storeList.resetForm()
- this.$refs.table.refresh(true)
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 255
- }
- },
- 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()
- this.reset()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- this.reset()
- }
- }
- }
- </script>
- <style lang="less">
- .userd-baseInfo{
- .userd-back{
- margin-bottom: 6px;
- }
- }
- </style>
|