123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <div class="salesReturnDetail-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-page-header :ghost="false" :backIcon="false" class="salesReturnDetail-cont">
- <template slot="subTitle">
- <a href="javascript:;" @click="handleBack">
- <a-icon type="left"></a-icon>
- 返回列表
- </a>
- </template>
- <!-- 操作区,位于 title 行的行尾 -->
- <template slot="extra">
- <a-button
- key="3"
- type="default"
- class="button-info"
- id="salesReturnEdit-preview-btn"
- v-if="$hasPermissions('B_salesReturnPrint')"
- :disabled="chooseLoadData.length==0"
- @click="handlePrint('preview')">打印预览</a-button>
- <a-button
- key="2"
- type="primary"
- class="button-info"
- id="salesReturnEdit-print-btn"
- v-if="$hasPermissions('B_salesReturnPrint')"
- :disabled="chooseLoadData.length==0"
- @click="handlePrint('print')">快捷打印</a-button>
- <a-divider type="vertical" />
- <a-button
- key="1"
- type="primary"
- class="button-warning"
- id="salesReturnEdit-export-btn"
- v-if="$hasPermissions('B_salesReturnExport')"
- :disabled="chooseLoadData.length==0"
- @click="handlePrint('export')">导出Excel</a-button>
- </template>
- </a-page-header>
- <!-- 基础信息 -->
- <a-card size="small" :bordered="false" class="salesReturnDetail-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1" header="基础信息">
- <a-descriptions size="small" :column="3">
- <a-descriptions-item label="单据来源">{{ detailData&&detailData.salesReturnBillSourceDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="销售退货单号">{{ detailData&&detailData.salesReturnBillNo || '--' }}</a-descriptions-item>
- <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
- <a-descriptions-item label="客户采退申请单号">{{ detailData&&detailData.purchaseReturnApplyNo || '--' }}</a-descriptions-item>
- <a-descriptions-item label="是否同步给客户">{{ detailData&&detailData.syncFlag ? ['否', '是'][detailData.syncFlag] : '--' }}</a-descriptions-item>
- <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
- <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
- <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditTime || '--' }}</a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <a-card size="small" :bordered="false" class="pages-wrap">
- <a-tabs default-active-key="1" @change="callback">
- <a-tab-pane key="1" tab="产品明细" force-render>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="record => record.id"
- :columns="columns"
- :data="loadData"
- :defaultLoadData="false"
- bordered></s-table>
- </a-tab-pane>
- <a-tab-pane key="2" tab="审核进度" >
- <auditDetail ref="auditDetail" businessType="SALES_RETURN" :itemSn="$route.params.sn"></auditDetail>
- </a-tab-pane>
- <a-tab-pane key="3" tab="操作记录" force-render>
- 操作记录
- </a-tab-pane>
- </a-tabs>
- </a-card>
- </a-spin>
- <!-- 打印 -->
- <div id="print"></div>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { getOperationalPrecision } from '@/libs/tools.js'
- import { STable, VSelect } from '@/components'
- import { printFun, exportExcel } from '@/libs/JGPrint.js'
- import auditDetail from './auditDetail.vue'
- import { salesReturnDetail, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
- import { salesReturnDetailList } from '@/api/salesReturnDetail'
- export default {
- name: 'SalesReturnDetail',
- mixins: [commonMixin],
- components: { STable, VSelect, auditDetail },
- data () {
- return {
- spinning: false,
- disabled: false,
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- const params = Object.assign(parameter, { salesReturnBillSn: this.$route.params.sn })
- return salesReturnDetailList(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
- // 折后退货金额小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
- data.list[i].saleReturnSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
- }
- this.chooseLoadData = data.list
- this.disabled = false
- }
- return data
- })
- },
- chooseLoadData: [],
- detailData: null, // 详情数据
- visibleAudit: false,
- spinningAudit: false
- }
- },
- computed: {
- columns () {
- const arr = [
- { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
- { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'productEntity.name', width: '8%', align: 'left', customRender: function (text) { return text || '--' } },
- { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '坏件数量', dataIndex: 'badQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '良品数量', dataIndex: 'goodQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '返库数量', dataIndex: 'backStockQty', align: 'center', width: '6%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '退货原因', dataIndex: 'returnReasonDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '参考退货单价', dataIndex: 'initialPrice', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '参考退货金额', dataIndex: 'initialAmount', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '实际退货单价', dataIndex: 'price', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '实际退货金额', dataIndex: 'totalAmount', align: 'center', width: '7%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '实际退货单价说明', dataIndex: 'priceRemark', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
- ]
- return arr
- }
- },
- methods: {
- // 返回
- handleBack () {
- this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
- },
- // 详情
- getDetail () {
- salesReturnDetail({ sn: this.$route.params.sn }).then(res => {
- if (res.status == 200) {
- this.detailData = res.data
- } else {
- this.detailData = null
- }
- })
- },
- // 打印预览/快捷打印
- handlePrint (type) {
- const _this = this
- const params = { sn: this.$route.params.sn }
- _this.spinning = true
- // 导出
- if (type == 'export') {
- exportExcel(salesReturnExport, params, '销售退货', function () {
- _this.spinning = false
- })
- } else {
- // 打印或预览
- printFun(salesReturnPrint, params, type, '销售退货', () => { _this.spinning = false })
- }
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.$refs.table.refresh(true)
- this.getDetail()
- }
- },
- activated () {
- // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
- if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
- this.$refs.table.refresh(true)
- this.getDetail()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .salesReturnDetail-wrap {
- .salesReturnDetail-cont {
- margin-bottom: 10px;
- }
- .footer-cont{
- margin-top: 5px;
- text-align: center;
- }
- }
- </style>
|