|
@@ -72,10 +72,46 @@
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="滞销天数">
|
|
|
+ <a-input-group>
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="11">
|
|
|
+ <a-input-number
|
|
|
+ id="shelfMonitoringList-minUnsalableDays"
|
|
|
+ v-model="queryParam.minUnsalableDays"
|
|
|
+ :precision="0"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="起始天数"
|
|
|
+ style="width: 100%;display: inline-block;" />
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="2"><span style="display: block;text-align: center;line-height: 32px;">至</span></a-col>
|
|
|
+ <a-col :span="11">
|
|
|
+ <a-input-number
|
|
|
+ id="shelfMonitoringList-maxUnsalableDays"
|
|
|
+ v-model="queryParam.maxUnsalableDays"
|
|
|
+ :precision="0"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="截止天数"
|
|
|
+ style="width: 100%;display: inline-block;" />
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-input-group>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
</template>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainStockReportList-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainStockReportList-reset">重置</a-button>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ class="button-warning"
|
|
|
+ @click="handleExport"
|
|
|
+ :disabled="disabled"
|
|
|
+ :loading="exportLoading"
|
|
|
+ id="inventoryQueryList-export">导出</a-button>
|
|
|
<a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
|
@@ -101,6 +137,12 @@
|
|
|
:data="loadData"
|
|
|
:defaultLoadData="false"
|
|
|
bordered>
|
|
|
+ <!-- 直销天数 -->
|
|
|
+ <template slot="unsalableDays" slot-scope="text, record" >
|
|
|
+ <span v-if="record.unsalableDays>=180&&record.unsalableDays<=360" style="color:#FF9900">{{num(record.unsalableDays)}}</span>
|
|
|
+ <span v-else-if="record.unsalableDays>360" style="color:#FF0000">{{num(record.unsalableDays)}}</span>
|
|
|
+ <span v-else >{{num(record.unsalableDays)}}</span>
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button size="small" type="link" class="button-success" @click="goDetail(record)" id="chainStockReportList-detail-btn">详情</a-button>
|
|
@@ -120,6 +162,8 @@ import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
|
import { linkageGroupList } from '@/api/reportData'
|
|
|
import { reportStockList, reportStockCount } from '@/api/reportStock'
|
|
|
+import { downloadExcel } from '@/libs/JGPrint.js'
|
|
|
+import { stockExport } from '@/api/stock'
|
|
|
export default {
|
|
|
components: { STable, VSelect, chainStockReportDetailModal },
|
|
|
mixins: [commonMixin],
|
|
@@ -136,7 +180,9 @@ export default {
|
|
|
productBrandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品分类1
|
|
|
productTypeSn2: '', // 产品分类2
|
|
|
- productTypeSn3: '' // 产品分类3
|
|
|
+ productTypeSn3: '' ,// 产品分类3
|
|
|
+ minUnsalableDays:undefined, //滞销天数最小值
|
|
|
+ maxUnsalableDays:undefined, //滞销天数最大值
|
|
|
},
|
|
|
labelCol: { span: 8 },
|
|
|
wrapperCol: { span: 16 },
|
|
@@ -152,6 +198,7 @@ export default {
|
|
|
{ title: '原厂编码', dataIndex: 'productOrigCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '可用库存数量(个)', dataIndex: 'currentStockQty', width: '14%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '14%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip> 滞销天数</div>, width: '7%', align: 'center', scopedSlots: { customRender: 'unsalableDays' },sorter: true, },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
@@ -160,6 +207,7 @@ export default {
|
|
|
const params = Object.assign(parameter, this.queryParam)
|
|
|
this.spinning = true
|
|
|
if (params.tenantId) {
|
|
|
+ if (this.checkValueRange()) {
|
|
|
return reportStockList(params).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
@@ -175,6 +223,17 @@ export default {
|
|
|
this.spinning = false
|
|
|
return data
|
|
|
})
|
|
|
+ }else{
|
|
|
+ const _this = this
|
|
|
+ _this.disabled = false
|
|
|
+ _this.spinning = false
|
|
|
+ const data = {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ list: [],
|
|
|
+ count: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
const _this = this
|
|
|
return new Promise(function (resolve, reject) {
|
|
@@ -203,6 +262,45 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 校验滞销天数数值范围
|
|
|
+ checkValueRange () {
|
|
|
+ const isONull = this.queryParam.minUnsalableDays === null || this.queryParam.minUnsalableDays === undefined
|
|
|
+ const isOEmpty = this.queryParam.minUnsalableDays === ''
|
|
|
+ const isOZero = this.queryParam.minUnsalableDays === 0
|
|
|
+ const isTNull = this.queryParam.maxUnsalableDays === null || this.queryParam.maxUnsalableDays === undefined
|
|
|
+ const isTEmpty = this.queryParam.maxUnsalableDays === ''
|
|
|
+ const isTZero = this.queryParam.maxUnsalableDays === 0
|
|
|
+ // 第一个为空(可为null可为空字符)第二个不为空
|
|
|
+ // 第一个不为空第二个为空(可为null可为空字符)
|
|
|
+ // 第一个大于第二个
|
|
|
+ if ((isONull || isOEmpty) && (this.queryParam.maxUnsalableDays || isTZero)) {
|
|
|
+ this.$message.info('请输入正确的滞销天数查询范围!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if ((this.queryParam.minUnsalableDays || isOZero) && (isTNull || isTEmpty)) {
|
|
|
+ this.$message.info('请输入正确的滞销天数查询范围!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.queryParam.minUnsalableDays > this.queryParam.maxUnsalableDays) {
|
|
|
+ this.$message.info('请输入正确的滞销天数查询范围!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.queryParam.minUnsalableDays = this.queryParam.minUnsalableDays > 999999999 ? 999999999 : this.queryParam.minUnsalableDays
|
|
|
+ this.queryParam.maxUnsalableDays = this.queryParam.maxUnsalableDays > 999999999 ? 999999999 : this.queryParam.maxUnsalableDays
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ num(val){
|
|
|
+ let days
|
|
|
+ if(val>=30){
|
|
|
+ const a=Math.floor(val/30)
|
|
|
+ const b=val-a*30
|
|
|
+ days=a+'个月'+b+'天'
|
|
|
+ }else{
|
|
|
+ days=b+'天'
|
|
|
+ }
|
|
|
+ return days
|
|
|
+ console.log(days,'天数')
|
|
|
+ },
|
|
|
// 合计
|
|
|
getCount (params) {
|
|
|
reportStockCount(params).then(res => {
|
|
@@ -235,11 +333,44 @@ export default {
|
|
|
this.queryParam.productTypeSn1 = ''
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
+ this.queryParam.minUnsalableDays=undefined, //滞销天数最小值
|
|
|
+ this.queryParam.maxUnsalableDays=undefined, //滞销天数最大值
|
|
|
this.productType = []
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.totalData = null
|
|
|
this.$refs.table.clearTable()
|
|
|
},
|
|
|
+ // 导出
|
|
|
+ handleExport () {
|
|
|
+ const _this = this
|
|
|
+ const params = JSON.parse(JSON.stringify(this.queryParam))
|
|
|
+ if (params.tenantId) {
|
|
|
+ this.exportLoading = true
|
|
|
+ _this.spinning = true
|
|
|
+ stockExport(params).then(res => {
|
|
|
+ this.exportLoading = false
|
|
|
+ _this.spinning = false
|
|
|
+ if (res.type == 'application/json') {
|
|
|
+ var reader = new FileReader()
|
|
|
+ reader.addEventListener('loadend', function () {
|
|
|
+ const obj = JSON.parse(reader.result)
|
|
|
+ _this.$notification.error({
|
|
|
+ message: '提示',
|
|
|
+ description: obj.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ reader.readAsText(res)
|
|
|
+ } else {
|
|
|
+ downloadExcel(res, '连锁库存总表')
|
|
|
+ }
|
|
|
+ })}else{
|
|
|
+ this.exportLoading = false
|
|
|
+ _this.spinning = false
|
|
|
+ this.$message.info('请选择连锁店')
|
|
|
+ return false
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
// 详情
|
|
|
goDetail (row) {
|
|
|
this.productSn = row.productSn
|