|
@@ -0,0 +1,330 @@
|
|
|
+<template>
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form-model
|
|
|
+ id="rebateDetailReport-form"
|
|
|
+ ref="ruleForm"
|
|
|
+ class="form-model-con"
|
|
|
+ layout="inline"
|
|
|
+ :model="queryParam"
|
|
|
+ :rules="rules"
|
|
|
+ :labelCol="labelCol"
|
|
|
+ :wrapperCol="wrapperCol"
|
|
|
+ @keyup.enter.native="handleSearch" >
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="日期" prop="time">
|
|
|
+ <rangeDate ref="rangeDate" @change="dateChange" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="单号">
|
|
|
+ <a-input id="srebateReport-salesReturnNo" v-model.trim="queryParam.salesReturnNo" allowClear placeholder="请输入单号"/>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="客户名称">
|
|
|
+ <dealerSearchList ref="dealer" id="srebateReport-buyerName" @change="dealerChange" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="直接绑定客户名称">
|
|
|
+ <dealerSearchList ref="directDealer" id="srebateReport-buyerName" @change="directDealerChange" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="间接绑定客户名称">
|
|
|
+ <dealerSearchList ref="indirectDealer" id="srebateReport-buyerName" @change="indirectDealerChange" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="类型">
|
|
|
+ <v-select
|
|
|
+ v-model="queryParam.bizType"
|
|
|
+ ref="bizType"
|
|
|
+ id="srebateReport-bizType"
|
|
|
+ code="REBATE_BILL_BIZ_TYPE"
|
|
|
+ placeholder="请选择类型"
|
|
|
+ allowClear></v-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <template v-if="advanced">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品品牌">
|
|
|
+ <ProductBrand id="rebateDetailReport-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productEntity.productBrandSn"></ProductBrand>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="产品分类">
|
|
|
+ <ProductType id="rebateDetailReport-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="queryParam.productType"></ProductType>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="产品编码">
|
|
|
+ <a-input id="rebateDetailReport-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ </template>
|
|
|
+ <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
+ <a-button type="primary" @click="handleSearch" :disabled="disabled" id="rebateDetailReport-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="rebateDetailReport-reset">重置</a-button>
|
|
|
+ <a-button
|
|
|
+ type="primary"
|
|
|
+ style="margin-left: 5px"
|
|
|
+ @click="handleExport"
|
|
|
+ :disabled="disabled"
|
|
|
+ :loading="exportLoading"
|
|
|
+ v-if="$hasPermissions('M_salesReturnReportExport')"
|
|
|
+ class="button-warning"
|
|
|
+ id="rebateDetailReport-export-btn">导出</a-button>
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 5px">
|
|
|
+ {{ advanced ? '收起' : '展开' }}
|
|
|
+ <a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
+ </a>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form-model>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 列表 -->
|
|
|
+ <s-table
|
|
|
+ class="sTable"
|
|
|
+ ref="table"
|
|
|
+ size="small"
|
|
|
+ :rowKey="(record) => record.id"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :defaultLoadData="false"
|
|
|
+ bordered>·
|
|
|
+ <template slot="footer">
|
|
|
+ <a-row type="flex" justify="end" :gutter="10">
|
|
|
+ <a-col flex="10%" >分公司金额:{{ (totalData && (totalData.wholesalePrice1 || totalData.wholesalePrice1==0)) ? totalData.wholesalePrice1 : '--' }}</a-col>
|
|
|
+ <a-col flex="10%" >加盟商金额:{{ (totalData && (totalData.wholesalePrice2 || totalData.wholesalePrice2==0)) ? totalData.wholesalePrice2 : '--' }}</a-col>
|
|
|
+ <a-col flex="10%" >特约加盟店金额:{{ (totalData && (totalData.wholesalePrice3 || totalData.wholesalePrice3==0)) ? totalData.wholesalePrice3 : '--' }}</a-col>
|
|
|
+ <a-col flex="10%" >直接差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? totalData.directRebateAmount : '--' }}</a-col>
|
|
|
+ <a-col flex="10%" >间接差价金额:{{ (totalData && (totalData.indirectRebateAmount || totalData.indirectRebateAmount==0)) ? totalData.indirectRebateAmount : '--' }}</a-col>
|
|
|
+ </a-row>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-spin>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
+import rangeDate from '@/views/common/rangeDate.vue'
|
|
|
+import { downloadExcel } from '@/libs/JGPrint.js'
|
|
|
+import ProductType from '../../common/productType.js'
|
|
|
+import ProductBrand from '../../common/productBrand.js'
|
|
|
+import dealerSearchList from '@/views/common/dealerSearchList.vue'
|
|
|
+import { rebateDetailQueryList, rebateDetailQueryCount } from '@/api/reportData'
|
|
|
+export default {
|
|
|
+ components: { STable, VSelect, rangeDate, ProductType, ProductBrand, dealerSearchList },
|
|
|
+ mixins: [commonMixin],
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ spinning: false,
|
|
|
+ labelCol: { span: 8 },
|
|
|
+ wrapperCol: { span: 16 },
|
|
|
+ advanced: false, // 高级搜索 展开/关闭
|
|
|
+ tableHeight: 0,
|
|
|
+ queryParam: { // 查询条件
|
|
|
+ time: [],
|
|
|
+ beginDate: '',
|
|
|
+ endDate: '',
|
|
|
+ buyerSn: undefined, // 客户sn
|
|
|
+ bizNo: '', // 单号
|
|
|
+ bizType: undefined,
|
|
|
+ directDealerSn: undefined, // 直接经销商SN
|
|
|
+ indirectDealerSn: undefined, // 间接经销商SN
|
|
|
+ productEntity: {
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
+ code: '', // 产品编码
|
|
|
+ name: '' // 产品名称
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ 'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
|
|
|
+ },
|
|
|
+ disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ exportLoading: false,
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ this.disabled = true
|
|
|
+ const params = Object.assign(parameter, this.queryParam)
|
|
|
+ this.spinning = true
|
|
|
+ delete params.time
|
|
|
+ // 总计
|
|
|
+ this.getCount(params)
|
|
|
+ return rebateDetailQueryList(params).then(res => {
|
|
|
+ let data
|
|
|
+ if (res.status == 200) {
|
|
|
+ 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
|
|
|
+ data.list[i].inStockQty = data.list[i].qty
|
|
|
+ }
|
|
|
+ this.disabled = false
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ totalData: null // 合计
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ columns () {
|
|
|
+ const _this = this
|
|
|
+ const arr = [
|
|
|
+ { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
+ { title: '订单号', dataIndex: 'bizNo', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '类型', dataIndex: 'bizTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '客户名称', dataIndex: 'indirectDealerName', width: '6%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: '6%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '间接绑定客户名称', dataIndex: 'buyerName', width: '6%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '品牌', dataIndex: 'productEntity.productBrandName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品分类', width: '6%', align: 'center', customRender: function (text,record) { return record.productTypeName1 + (record.productTypeName2 ? '>' : '') + (record.productTypeName2 || '') } },
|
|
|
+ { title: '产品编码', dataIndex: 'productEntity.code', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', width: '6%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '分公司金额', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '加盟商金额', dataIndex: 'discountAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '特约加盟店金额', dataIndex: 'discountedAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '直接差价', dataIndex: 'directRebate', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
+ { title: '间接差价', dataIndex: 'indirectRebate', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
|
|
|
+ ]
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 合计
|
|
|
+ getCount (params) {
|
|
|
+ rebateDetailQueryCount(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.totalData = res.data
|
|
|
+ } else {
|
|
|
+ this.totalData = null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 创建时间 change
|
|
|
+ dateChange (date) {
|
|
|
+ this.queryParam.time = date
|
|
|
+ this.queryParam.beginDate = date[0] || ''
|
|
|
+ this.queryParam.endDate = date[1] || ''
|
|
|
+ },
|
|
|
+ // 查询
|
|
|
+ handleSearch () {
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ dealerChange (val) {
|
|
|
+ if (val.row) {
|
|
|
+ this.queryParam.buyerSn = val.row.dealerSn
|
|
|
+ } else {
|
|
|
+ this.queryParam.buyerSn = undefined
|
|
|
+ }
|
|
|
+ },
|
|
|
+ directDealerChange (val) {
|
|
|
+ if (val.row) {
|
|
|
+ this.queryParam.directDealerSn = val.row.dealerSn
|
|
|
+ } else {
|
|
|
+ this.queryParam.directDealerSn = undefined
|
|
|
+ }
|
|
|
+ },
|
|
|
+ indirectDealerChange (val) {
|
|
|
+ if (val.row) {
|
|
|
+ this.queryParam.indirectDealerSn = val.row.dealerSn
|
|
|
+ } else {
|
|
|
+ this.queryParam.indirectDealerSn = undefined
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ resetSearchForm () {
|
|
|
+ this.$refs.rangeDate.resetDate()
|
|
|
+ this.queryParam.time = []
|
|
|
+ this.queryParam.beginDate = ''
|
|
|
+ this.queryParam.endDate = ''
|
|
|
+ this.queryParam.bizNo = ''
|
|
|
+ this.queryParam.bizType = undefined
|
|
|
+ this.queryParam.buyerSn = undefined
|
|
|
+ this.queryParam.indirectDealerSn = undefined
|
|
|
+ this.queryParam.directDealerSn = undefined
|
|
|
+ this.$refs.dealer.resetForm()
|
|
|
+ this.$refs.indirectDealer.resetForm()
|
|
|
+ this.$refs.directDealer.resetForm()
|
|
|
+
|
|
|
+ this.queryParam.productEntity.productBrandSn = undefined
|
|
|
+ this.queryParam.productEntity.productTypeSn1 = ''
|
|
|
+ this.queryParam.productEntity.productTypeSn2 = ''
|
|
|
+ this.queryParam.productEntity.productTypeSn3 = ''
|
|
|
+ this.queryParam.productEntity.code = ''
|
|
|
+ this.queryParam.productEntity.name = ''
|
|
|
+ this.queryParam.productType = []
|
|
|
+ this.productType = []
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.totalData = null
|
|
|
+ this.$refs.table.clearTable()
|
|
|
+ },
|
|
|
+ // 导出
|
|
|
+ handleExport () {
|
|
|
+ const _this = this
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ const params = _this.queryParam
|
|
|
+ params.showCost = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
|
|
|
+ _this.exportLoading = true
|
|
|
+ _this.spinning = true
|
|
|
+ reportSalesReturnDetailExport(params).then(res => {
|
|
|
+ downloadExcel(res, '销售退货明细报表')
|
|
|
+ _this.exportLoading = false
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 产品分类 change
|
|
|
+ changeProductType (val, opt) {
|
|
|
+ this.queryParam.productEntity.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ this.queryParam.productEntity.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
+ this.queryParam.productEntity.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ },
|
|
|
+ pageInit () {
|
|
|
+ this.disabled = false
|
|
|
+ this.spinning = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
+ this.pageInit()
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ activated () {
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
+ this.pageInit()
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRouteEnter (to, from, next) {
|
|
|
+ next(vm => {})
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|