|
@@ -1,8 +1,279 @@
|
|
|
<template>
|
|
|
+ <a-card size="small" :bordered="false" class="shortageStatisticsCList-wrap">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="创建时间">
|
|
|
+ <a-range-picker
|
|
|
+ style="width:100%"
|
|
|
+ id="shortageStatisticsCList-creatTime"
|
|
|
+ :disabledDate="disabledDate"
|
|
|
+ v-model="time"
|
|
|
+ :format="dateFormat"
|
|
|
+ :placeholder="['开始时间', '结束时间']" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品名称">
|
|
|
+ <a-input id="shortageStatisticsCList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品编码">
|
|
|
+ <a-input id="shortageStatisticsCList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <template v-if="advanced">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="客户名称">
|
|
|
+ <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="区域">
|
|
|
+ <subarea id="shortageStatisticsCList-subarea" v-model="queryParam.subareaSn"></subarea>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品分类">
|
|
|
+ <a-cascader
|
|
|
+ @change="changeProductType"
|
|
|
+ expand-trigger="hover"
|
|
|
+ change-on-select
|
|
|
+ :options="productTypeList"
|
|
|
+ :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }"
|
|
|
+ id="shortageStatisticsCList-productType"
|
|
|
+ placeholder="请选择产品分类"
|
|
|
+ allowClear
|
|
|
+ v-model="productType" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="销售单号">
|
|
|
+ <a-input id="shortageStatisticsCList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </template>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shortageStatisticsCList-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="shortageStatisticsCList-reset">重置</a-button>
|
|
|
+ <a-button
|
|
|
+ style="margin-left: 8px"
|
|
|
+ type="danger"
|
|
|
+ @click="handleExport"
|
|
|
+ :disabled="disabled"
|
|
|
+ :loading="exportLoading"
|
|
|
+ id="shortageStatisticsCList-export">导出</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>
|
|
|
+ <!-- alert -->
|
|
|
+ <a-alert type="info" showIcon style="margin-bottom:10px">
|
|
|
+ <div slot="message">
|
|
|
+ <div>
|
|
|
+ 总客户数:<strong>{{ productTotal ? ((productTotal.totalBuyerQty || productTotal.totalBuyerQty==0) ? productTotal.totalBuyerQty : '--') : '--' }}</strong>,
|
|
|
+ 总单数:<strong>{{ productTotal ? ((productTotal.totalRecord || productTotal.totalRecord==0) ? productTotal.totalRecord : '--') : '--' }}</strong>,
|
|
|
+ 缺货总款数:<strong>{{ productTotal ? ((productTotal.totalCategory || productTotal.totalCategory==0) ? productTotal.totalCategory : '--') : '--' }}</strong>,
|
|
|
+ 缺货总数量:<strong>{{ productTotal ? ((productTotal.totalQty || productTotal.totalQty==0) ? productTotal.totalQty : '--') : '--' }}</strong>,
|
|
|
+ 缺货总金额(¥):<strong>{{ productTotal ? ((productTotal.totalAmount || productTotal.totalAmount==0) ? productTotal.totalAmount : '--') : '--' }}</strong>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ 本页客户数:<strong>{{ currentTotal ? ((currentTotal.totalBuyerQty || currentTotal.totalBuyerQty==0) ? currentTotal.totalBuyerQty : '--') : '--' }}</strong>,
|
|
|
+ 本页总单数:<strong>{{ currentTotal ? ((currentTotal.totalRecord || currentTotal.totalRecord==0) ? currentTotal.totalRecord : '--') : '--' }}</strong>,
|
|
|
+ 本页缺货总款数:<strong>{{ currentTotal ? ((currentTotal.totalCategory || currentTotal.totalCategory==0) ? currentTotal.totalCategory : '--') : '--' }}</strong>,
|
|
|
+ 本页缺货总数量:<strong>{{ currentTotal ? ((currentTotal.totalQty || currentTotal.totalQty==0) ? currentTotal.totalQty : '--') : '--' }}</strong>,
|
|
|
+ 本页缺货总金额(¥):<strong>{{ currentTotal ? ((currentTotal.totalAmount || currentTotal.totalAmount==0) ? currentTotal.totalAmount : '--') : '--' }}</strong>
|
|
|
+ </div>
|
|
|
+ </div></a-alert>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable"
|
|
|
+ ref="table"
|
|
|
+ size="default"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :scroll="{ x: 1120, y: tableHeight }"
|
|
|
+ bordered>
|
|
|
+ <!-- 单号 -->
|
|
|
+ <template slot="salesBillNo" slot-scope="text, record">
|
|
|
+ <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import moment from 'moment'
|
|
|
+import getDate from '@/libs/getDate.js'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import custList from '@/views/common/custList.vue'
|
|
|
+import subarea from '@/views/common/subarea.js'
|
|
|
+import { productTypeQuery } from '@/api/productType'
|
|
|
+import { oosBuyerList, oosBuyerDetailCount, oosBuyerDetailPageCount } from '@/api/oos'
|
|
|
+export default {
|
|
|
+ components: { STable, VSelect, custList, subarea },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ advanced: false, // 高级搜索 展开/关闭
|
|
|
+ tableHeight: 0,
|
|
|
+ queryParam: { // 查询条件
|
|
|
+ buyerSn: undefined,
|
|
|
+ subareaSn: undefined, // 区域
|
|
|
+ productName: '',
|
|
|
+ productCode: '',
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
+ salesBillNo: ''
|
|
|
+ },
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ exportLoading: false, // 导出loading
|
|
|
+ dateFormat: 'YYYY-MM-DD',
|
|
|
+ time: [
|
|
|
+ moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
|
|
|
+ moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
|
|
|
+ ], // 创建时间
|
|
|
+ columns: [
|
|
|
+ { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
+ { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
|
|
|
+ { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '缺货数量', dataIndex: 'qty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
|
|
|
+ ],
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ if (this.tableHeight == 0) {
|
|
|
+ this.tableHeight = window.innerHeight - 380
|
|
|
+ }
|
|
|
+ // 时间
|
|
|
+ if (this.time && this.time.length > 0) {
|
|
|
+ this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
|
|
|
+ this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
|
|
|
+ } else {
|
|
|
+ this.queryParam.beginDate = undefined
|
|
|
+ this.queryParam.endDate = undefined
|
|
|
+ }
|
|
|
+ const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) // 有分页
|
|
|
+ const params = Object.assign(parameter, this.queryParam) // 无分页
|
|
|
+ return oosBuyerList(params).then(res => {
|
|
|
+ const data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
+ }
|
|
|
+ this.disabled = false
|
|
|
+ this.getCount(params)
|
|
|
+ this.getCurrentCount(paramsPage)
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ productType: [],
|
|
|
+ productTypeList: [], // 分类下拉数据
|
|
|
+ productTotal: null,
|
|
|
+ currentTotal: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 不可选日期
|
|
|
+ disabledDate (date, dateStrings) {
|
|
|
+ return date && date.valueOf() > Date.now()
|
|
|
+ },
|
|
|
+ custChange (obj) {
|
|
|
+ this.queryParam.buyerSn = obj.key
|
|
|
+ },
|
|
|
+ // 合计
|
|
|
+ getCount (params) {
|
|
|
+ oosBuyerDetailCount(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.productTotal = res.data
|
|
|
+ } else {
|
|
|
+ this.productTotal = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 本页合计
|
|
|
+ getCurrentCount (params) {
|
|
|
+ oosBuyerDetailPageCount(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.currentTotal = res.data
|
|
|
+ } else {
|
|
|
+ this.currentTotal = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam.buyerSn = undefined
|
|
|
+ this.queryParam.subareaSn = undefined
|
|
|
+ this.queryParam.productName = ''
|
|
|
+ this.queryParam.productCode = ''
|
|
|
+ this.queryParam.productTypeSn1 = ''
|
|
|
+ this.queryParam.productTypeSn2 = ''
|
|
|
+ this.queryParam.productTypeSn3 = ''
|
|
|
+ this.queryParam.salesBillNo = ''
|
|
|
+ this.productType = []
|
|
|
+ this.time = [
|
|
|
+ moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
|
|
|
+ moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
|
|
|
+ ]
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ handleDetail (row) {
|
|
|
+ this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
|
|
|
+ },
|
|
|
+ // 导出
|
|
|
+ handleExport () {
|
|
|
+ // this.exportLoading = true
|
|
|
+ // customerBundleExportDelay({}).then(res => {
|
|
|
+ // this.exportLoading = false
|
|
|
+ // this.download(res)
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ download (data) {
|
|
|
+ if (!data) { return }
|
|
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = url
|
|
|
+ const a = moment().format('YYYYMMDDHHmmss')
|
|
|
+ const fname = '未完成单据_盘点' + a
|
|
|
+ link.setAttribute('download', fname + '.xlsx')
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ },
|
|
|
+ // 产品分类 change
|
|
|
+ changeProductType (val, opt) {
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
+ this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ },
|
|
|
+ // 产品分类 列表
|
|
|
+ getProductType () {
|
|
|
+ productTypeQuery({}).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.productTypeList = res.data
|
|
|
+ } else {
|
|
|
+ this.productTypeList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
+ next(vm => {
|
|
|
+ vm.getProductType()
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
-
|
|
|
-<style>
|
|
|
-</style>
|