|
@@ -32,12 +32,12 @@
|
|
|
<template v-if="advanced">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-model-item label="产品编码">
|
|
|
- <a-input id="salesDetailReportList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
|
|
|
+ <a-input id="salesDetailReportList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-model-item label="产品名称">
|
|
|
- <a-input id="salesDetailReportList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
|
|
|
+ <a-input id="salesDetailReportList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</template>
|
|
@@ -67,14 +67,16 @@
|
|
|
<!-- 合计 -->
|
|
|
<div class="table-operator">
|
|
|
<div class="alert-message">
|
|
|
- 销售数量:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? totalData.discountedAmount : '--' }}</strong>;
|
|
|
- 销售金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? toThousands(totalData.discountedAmount) : '--' }}</strong>;
|
|
|
- 销售折后金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? toThousands(totalData.discountedAmount) : '--' }}</strong>;
|
|
|
- 销售退货数量:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? totalData.discountedAmount : '--' }}</strong>;
|
|
|
- 销售退货金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? totalData.discountedAmount : '--' }}</strong>;
|
|
|
- 销售退货折后金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? totalData.discountedAmount : '--' }}</strong>;
|
|
|
- 合计销售数量:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? totalData.discountedAmount : '--' }}</strong>;
|
|
|
- 合计销售金额:<strong>{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? totalData.discountedAmount : '--' }}</strong>;
|
|
|
+ 销售数量:<strong>{{ (totalData && (totalData.salesTotalQty || totalData.salesTotalQty==0)) ? totalData.salesTotalQty : '--' }}</strong>;
|
|
|
+ 销售金额:<strong>{{ (totalData && (totalData.salesTotalAmount || totalData.salesTotalAmount==0)) ? toThousands(totalData.salesTotalAmount) : '--' }}</strong>;
|
|
|
+ 销售折后金额:<strong>{{ (totalData && (totalData.salesTotalDiscountedAmount || totalData.salesTotalDiscountedAmount==0)) ? toThousands(totalData.salesTotalDiscountedAmount) : '--' }}</strong>;
|
|
|
+ <div style="display: inline-block;" v-if="totalData&&totalData.delFlag==1">
|
|
|
+ 销售退货数量:<strong>{{ (totalData && (totalData.salesReturnTotalQty || totalData.salesReturnTotalQty==0)) ? totalData.salesReturnTotalQty : '--' }}</strong>;
|
|
|
+ 销售退货金额:<strong>{{ (totalData && (totalData.salesReturnTotalAmount || totalData.salesReturnTotalAmount==0)) ?toThousands(totalData.salesReturnTotalAmount) : '--' }}</strong>;
|
|
|
+ 销售退货折后金额:<strong>{{ (totalData && (totalData.salesReturnTotalDiscountedAmount || totalData.salesReturnTotalDiscountedAmount==0)) ? toThousands(totalData.salesReturnTotalDiscountedAmount) : '--' }}</strong>;
|
|
|
+ 销售数量合计:<strong>{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}</strong>;
|
|
|
+ 销售金额合计:<strong>{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</strong>;
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<span>显示:</span>
|
|
@@ -103,6 +105,11 @@
|
|
|
:scroll="{ x: 1820}"
|
|
|
:defaultLoadData="false"
|
|
|
bordered>
|
|
|
+ <!-- 产品分类 -->
|
|
|
+ <template slot="productType" slot-scope="text, record">
|
|
|
+ <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
|
|
|
+ <span v-else>--</span>
|
|
|
+ </template>
|
|
|
<!-- 销售数量 标题 -->
|
|
|
<template slot="salesNumTit">
|
|
|
<a-tooltip placement="top">
|
|
@@ -129,11 +136,13 @@
|
|
|
</template>
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button
|
|
|
+ v-if="record.sysFlag==1"
|
|
|
size="small"
|
|
|
type="link"
|
|
|
class="button-primary"
|
|
|
- @click="handleEexamine(record)"
|
|
|
+ @click="addShopCar(record)"
|
|
|
>加入购物车</a-button>
|
|
|
+ <span v-else>--</span>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-spin>
|
|
@@ -147,7 +156,9 @@ import { STable, VSelect } from '@/components'
|
|
|
import rangeDate from '@/views/common/rangeDate.vue'
|
|
|
import ProductBrand from '@/views/common/productBrand.js'
|
|
|
import ProductType from '@/views/common/productType.js'
|
|
|
-import { reportBigCustomerList, reportBigCustomerCount } from '@/api/reportData'
|
|
|
+import { downloadExcel } from '@/libs/JGPrint.js'
|
|
|
+import { purchaseCartSave } from '@/api/purchaseCart'
|
|
|
+import { salesBillRankList, salesBillRankCount, salesBillRankExport } from '@/api/reportData'
|
|
|
export default {
|
|
|
mixins: [commonMixin],
|
|
|
name: 'SalesRankingReport',
|
|
@@ -163,12 +174,12 @@ export default {
|
|
|
time: [],
|
|
|
beginDate: '',
|
|
|
endDate: '',
|
|
|
- productBrandSn: '',
|
|
|
- productTypeSn1: '', // 产品一级分类
|
|
|
- productTypeSn2: '', // 产品二级分类
|
|
|
- productTypeSn3: '', // 产品三级分类
|
|
|
- code: undefined,
|
|
|
- name: undefined
|
|
|
+ productBrandSn: undefined,
|
|
|
+ productTypeSn1: undefined, // 产品一级分类
|
|
|
+ productTypeSn2: undefined, // 产品二级分类
|
|
|
+ productTypeSn3: undefined, // 产品三级分类
|
|
|
+ productCode: undefined,
|
|
|
+ productName: undefined
|
|
|
},
|
|
|
productType: [],
|
|
|
rules: {
|
|
@@ -180,10 +191,11 @@ export default {
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
const params = Object.assign(parameter, this.queryParam)
|
|
|
- this.spinning = true
|
|
|
+ params.returnFlag = this.showCols.includes('returnFlag') ? 1 : 0
|
|
|
delete params.time
|
|
|
- if (params.beginDate) {
|
|
|
- return reportBigCustomerList(params).then(res => {
|
|
|
+ this.spinning = true
|
|
|
+ if (params.beginDate && params.endDate) {
|
|
|
+ return salesBillRankList(params).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
@@ -192,7 +204,6 @@ export default {
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
- data.list[i].percentageUnit = data.list[i].percentage ? data.list[i].percentage + '%' : undefined
|
|
|
}
|
|
|
this.disabled = false
|
|
|
}
|
|
@@ -219,12 +230,11 @@ export default {
|
|
|
colsArr: [
|
|
|
{
|
|
|
title: '销售退货(明细)',
|
|
|
- value: 'totalCancelQty',
|
|
|
- key: 'totalCancelQty',
|
|
|
- disabled: false,
|
|
|
- checkedFlag: true
|
|
|
+ value: 'returnFlag',
|
|
|
+ key: 'returnFlag',
|
|
|
+ disabled: false
|
|
|
}],
|
|
|
- showCols: ['totalCancelQty']
|
|
|
+ showCols: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -232,32 +242,37 @@ export default {
|
|
|
const _this = this
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
|
|
|
- { title: '品牌', dataIndex: 'salesTargetName', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '分类', dataIndex: 'customerTypeName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品编码', dataIndex: 'discountedAmount', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '产品名称', dataIndex: 'discountedAmount', width: 150, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'discountedAmount', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '单位', dataIndex: 'discountedAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { slots: { title: 'salesNumTit' }, dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售折扣金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售折后金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售成本金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { slots: { title: 'salesReturnNum' }, dataIndex: 'discountedAmount', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售退货金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售退货折扣金额', dataIndex: 'discountedAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售退货折后金额', dataIndex: 'discountedAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '销售退货成本金额', dataIndex: 'discountedAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '合计销售数量', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '合计销售金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '当前库存数量', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '当前库存金额', dataIndex: 'discountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '品牌', dataIndex: 'productBrandName', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '分类', scopedSlots: { customRender: 'productType' }, width: 100, align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: 150, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '原厂编码', dataIndex: 'productOrigCode', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '单位', dataIndex: 'productUnit', width: 70, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { slots: { title: 'salesNumTit' }, dataIndex: 'salesTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '销售金额', dataIndex: 'salesTotalAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '销售折扣金额', dataIndex: 'salesTotalDiscountAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '销售折后金额', dataIndex: 'salesTotalDiscountedAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '销售成本金额', dataIndex: 'salesTotalCost', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { slots: { title: 'salesReturnNum' }, dataIndex: 'salesReturnTotalQty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { title: '销售退货金额', dataIndex: 'salesReturnTotalAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { title: '销售退货折扣金额', dataIndex: 'salesReturnTotalDiscountAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { title: '销售退货折后金额', dataIndex: 'salesReturnTotalDiscountedAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { title: '销售退货成本金额', dataIndex: 'salesReturnTotalCost', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { title: '销售数量合计', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ // { title: '销售金额合计', dataIndex: 'totalAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '当前库存数量', dataIndex: 'stockTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '当前库存金额', dataIndex: 'stockTotalCost', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 120, align: 'center', fixed: 'right' }
|
|
|
]
|
|
|
- // if (this.$hasPermissions('M_ShowAllCost')) {
|
|
|
- // arr.splice(4, 0, { title: '毛利', dataIndex: 'totalGrossProfit', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
- // arr.splice(5, 0, { title: '毛利率', dataIndex: 'percentageUnit', width: '15%', align: 'right', customRender: function (text) { return text || '--' } })
|
|
|
- // }
|
|
|
+ if (this.showCols.includes('returnFlag')) {
|
|
|
+ arr.splice(12, 0, { slots: { title: 'salesReturnNum' }, dataIndex: 'salesReturnTotalQty', width: 110, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
|
|
|
+ arr.splice(13, 0, { title: '销售退货金额', dataIndex: 'salesReturnTotalAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
+ arr.splice(14, 0, { title: '销售退货折扣金额', dataIndex: 'salesReturnTotalDiscountAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
+ arr.splice(15, 0, { title: '销售退货折后金额', dataIndex: 'salesReturnTotalDiscountedAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
+ arr.splice(16, 0, { title: '销售退货成本金额', dataIndex: 'salesReturnTotalCost', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
+ arr.splice(17, 0, { title: '销售数量合计', dataIndex: 'totalQty', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
|
|
|
+ arr.splice(18, 0, { title: '销售金额合计', dataIndex: 'totalAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
+ }
|
|
|
return arr
|
|
|
}
|
|
|
},
|
|
@@ -269,7 +284,7 @@ export default {
|
|
|
},
|
|
|
// 合计
|
|
|
getCount (params) {
|
|
|
- reportBigCustomerCount(params).then(res => {
|
|
|
+ salesBillRankCount(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.totalData = res.data
|
|
|
} else {
|
|
@@ -309,12 +324,12 @@ export default {
|
|
|
this.queryParam.time = []
|
|
|
this.queryParam.beginDate = ''
|
|
|
this.queryParam.endDate = ''
|
|
|
- this.queryParam.productBrandSn = ''
|
|
|
- this.queryParam.productTypeSn1 = ''
|
|
|
- this.queryParam.productTypeSn2 = ''
|
|
|
- this.queryParam.productTypeSn3 = ''
|
|
|
- this.queryParam.code = undefined
|
|
|
- this.queryParam.name = undefined
|
|
|
+ this.queryParam.productBrandSn = undefined
|
|
|
+ this.queryParam.productTypeSn1 = undefined
|
|
|
+ this.queryParam.productTypeSn2 = undefined
|
|
|
+ this.queryParam.productTypeSn3 = undefined
|
|
|
+ this.queryParam.productCode = undefined
|
|
|
+ this.queryParam.productName = undefined
|
|
|
this.productType = []
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.totalData = null
|
|
@@ -327,7 +342,41 @@ export default {
|
|
|
this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
},
|
|
|
handleExport () {
|
|
|
-
|
|
|
+ const _this = this
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ const params = JSON.parse(JSON.stringify(_this.queryParam))
|
|
|
+ params.returnFlag = _this.showCols.includes('returnFlag') ? 1 : 0
|
|
|
+ delete params.time
|
|
|
+ _this.exportLoading = true
|
|
|
+ _this.spinning = true
|
|
|
+ salesBillRankExport(params).then(res => {
|
|
|
+ downloadExcel(res, '销售排行报表')
|
|
|
+ _this.exportLoading = false
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 加入购物车
|
|
|
+ addShopCar (row) {
|
|
|
+ this.spinning = true
|
|
|
+ purchaseCartSave({
|
|
|
+ productSn: row.productSn,
|
|
|
+ qty: 1,
|
|
|
+ productCode: row.productCode,
|
|
|
+ sysFlag: row.sysFlag
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if (res.data) {
|
|
|
+ this.$message.info('此产品已添加到购物车!')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
},
|
|
|
setTableH () {
|
|
|
const tableSearchH = this.$refs.tableSearch.offsetHeight
|