|
@@ -5,7 +5,7 @@
|
|
|
<!-- 自定义的二级文字标题 -->
|
|
|
<template slot="subTitle">
|
|
|
<a id="purchaseReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
|
- <span style="margin: 0 15px;color: #666;">供应商名称:{{ $route.params.name || '--' }}</span>
|
|
|
+ <span style="margin: 0 15px;color: #666;" v-if="detailData">供应商名称:{{ detailData.returnTargetName || '--' }}</span>
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra" v-if="$hasPermissions('B_purchaseReturnPrint')">
|
|
@@ -20,24 +20,33 @@
|
|
|
<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="采购单号" prop="purchaseBillNo">
|
|
|
- <a-input id="purchaseReturnEdit-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品编码" prop="productCode">
|
|
|
- <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
+ <a-input id="bulkReturnGoodsEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品名称" prop="productName">
|
|
|
- <a-input id="purchaseReturnEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
+ <a-input id="bulkReturnGoodsEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="仓库">
|
|
|
+ <a-select
|
|
|
+ placeholder="请选择仓库"
|
|
|
+ id="bulkReturnGoodsEdit-warehouseSn"
|
|
|
+ allowClear
|
|
|
+ v-model="queryParam.warehouseSn"
|
|
|
+ :showSearch="true"
|
|
|
+ option-filter-prop="children"
|
|
|
+ :filter-option="filterOption">
|
|
|
+ <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseReturnList-refresh">查询</a-button>
|
|
|
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseReturnList-reset">重置</a-button>
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
@@ -54,15 +63,6 @@
|
|
|
:pageSize="10"
|
|
|
:scroll="{ y: 149 }"
|
|
|
bordered>
|
|
|
- <!-- 自定义表头 -->
|
|
|
- <template slot="refundableQtyTitle">
|
|
|
- <a-tooltip placement="top">
|
|
|
- <template slot="title">
|
|
|
- <span>同一个采购单,可多次退货,所以可退数量=采购数量-已退货数量</span>
|
|
|
- </template>
|
|
|
- 可退数量<a-icon type="question-circle" :style="{ marginLeft: '3px' }" />
|
|
|
- </a-tooltip>
|
|
|
- </template>
|
|
|
<!-- 数量 -->
|
|
|
<template slot="returnQty" slot-scope="text, record">
|
|
|
<a-input-number
|
|
@@ -75,6 +75,18 @@
|
|
|
placeholder="请输入"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
+ <!-- 单价 -->
|
|
|
+ <template slot="returnPrice" slot-scope="text, record">
|
|
|
+ <a-input-number
|
|
|
+ size="small"
|
|
|
+ id="purchaseReturnEdit-returnPrice"
|
|
|
+ v-model="record.returnPrice"
|
|
|
+ :precision="2"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入"
|
|
|
+ style="width: 100%;" />
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<span v-if="record.refundableQty==0">--</span>
|
|
@@ -104,6 +116,40 @@
|
|
|
@click.stop="handleDel('', 'all')"
|
|
|
style="margin-right: 10px;float: right;">整单删除</a-button>
|
|
|
</template>
|
|
|
+ <!-- 总计 -->
|
|
|
+ <a-alert type="info" style="margin-bottom:10px">
|
|
|
+ <div slot="message">
|
|
|
+ 总款数<strong>{{ (detailData&&(detailData.totalCategory || detailData.totalCategory==0)) ? detailData.totalCategory : '--' }}</strong> ,
|
|
|
+ 总数量<strong>{{ (detailData&&(detailData.totalQty || detailData.totalQty==0)) ? detailData.totalQty : '--' }}</strong> ,
|
|
|
+ 总金额<strong>{{ (detailData&&(detailData.totalAmount || detailData.totalAmount==0)) ? '¥'+detailData.totalAmount : '--' }}</strong>
|
|
|
+ </div>
|
|
|
+ </a-alert>
|
|
|
+ <!-- 筛选条件 -->
|
|
|
+ <a-row :gutter="15" justify="space-between">
|
|
|
+ <a-col :span="17">
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="9" :sm="24">
|
|
|
+ <a-form-item label="产品编码" prop="productCode">
|
|
|
+ <a-input id="bulkReturnGoodsEdit-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="9" :sm="24">
|
|
|
+ <a-form-item label="产品名称" prop="productName">
|
|
|
+ <a-input id="bulkReturnGoodsEdit-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
+ <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="bulkReturnGoodsEdit-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="bulkReturnGoodsEdit-reset">重置</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="7" style="text-align: right;"></a-col>
|
|
|
+ </a-row>
|
|
|
<!-- 列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
@@ -124,19 +170,22 @@
|
|
|
v-model="record.qty"
|
|
|
:precision="0"
|
|
|
:min="1"
|
|
|
+ :max="record.refundableQty"
|
|
|
placeholder="请输入"
|
|
|
@blur="e => qtyBlur(e.target.value, record)"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
- <!-- 退货原因 -->
|
|
|
- <template slot="remarks" slot-scope="text, record">
|
|
|
- <a-input
|
|
|
+ <!-- 退货单价 -->
|
|
|
+ <template slot="price" slot-scope="text, record">
|
|
|
+ <a-input-number
|
|
|
size="small"
|
|
|
- id="purchaseReturnEdit-remarks"
|
|
|
- v-model.trim="record.remarks"
|
|
|
- :maxLength="30"
|
|
|
- placeholder="退货原因(最多30个字符)"
|
|
|
- @blur="e => remarksBlur(e.target.value, record)"
|
|
|
+ id="purchaseReturnEdit-cost"
|
|
|
+ v-model="record.cost"
|
|
|
+ :precision="2"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入"
|
|
|
+ @blur="e => costBlur(e.target.value, record)"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
@@ -166,15 +215,16 @@ import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import Print from '@/views/common/print.vue'
|
|
|
import { hdPrint } from '@/libs/JGPrint'
|
|
|
+import { stockDetailProductList } from '@/api/sparePartsRet'
|
|
|
import {
|
|
|
- purchaseReturnPurchaseBillDetailList,
|
|
|
purchaseReturnDetailList,
|
|
|
purchaseReturnDetailSave,
|
|
|
purchaseReturnDetailDel,
|
|
|
purchaseReturnSubmit,
|
|
|
purchaseReturnDelAll,
|
|
|
purchaseReturnDetailPrint,
|
|
|
- purchaseReturnDetailExport } from '@/api/purchaseReturn'
|
|
|
+ purchaseReturnDetailExport,
|
|
|
+ purchaseReturnDetailSn } from '@/api/purchaseReturn'
|
|
|
export default {
|
|
|
name: 'PurchaseReturnEdit',
|
|
|
components: { STable, VSelect, Print },
|
|
@@ -182,6 +232,7 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
|
+ detailData: null,
|
|
|
queryParam: {
|
|
|
purchaseBillNo: '',
|
|
|
productCode: '',
|
|
@@ -193,27 +244,26 @@ export default {
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '采购单号', dataIndex: 'purchaseBillNo', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '采购总数', dataIndex: 'qty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { slots: { title: 'refundableQtyTitle' }, dataIndex: 'refundableQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '库存数量', dataIndex: 'stock.currentStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '缺货数量', dataIndex: 'cancelQty', width: '7%', align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: '19%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: '19%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓位', dataIndex: 'warehouseLocationName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '库存数量', dataIndex: 'currentQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '单位', dataIndex: 'unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '8%', align: 'center' },
|
|
|
{ title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '8%', align: 'center' },
|
|
|
- { title: '采购价', dataIndex: 'price', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
- return purchaseReturnPurchaseBillDetailList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ return stockDetailProductList(Object.assign(parameter, this.queryParam)).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.dataSource = data.list
|
|
|
this.disabled = false
|
|
|
return data
|
|
|
})
|
|
@@ -224,11 +274,10 @@ export default {
|
|
|
{ title: '采购单号', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '采购总数', dataIndex: 'purchaseBillQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
|
|
|
- { title: '采购价', dataIndex: 'cost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: '15%', align: 'center' },
|
|
|
+ { title: '退货单价', scopedSlots: { customRender: 'price' }, width: '10%', align: 'center' },
|
|
|
+ { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: '10%', align: 'center' },
|
|
|
+ { title: '退货金额', scopedSlots: { customRender: 'amount' }, width: '6%', align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
@@ -239,8 +288,8 @@ export default {
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
data.list[i].qtyBackups = data.list[i].qty
|
|
|
- data.list[i].remarksBackups = data.list[i].remarks
|
|
|
- data.list[i].refundableQty = data.list[i].purchaseBillRefundableQty + data.list[i].qty
|
|
|
+ data.list[i].costBackups = data.list[i].cost
|
|
|
+ data.list[i].refundableQty = data.list[i].purchaseBillRefundableQty
|
|
|
}
|
|
|
this.dataSource = data.list
|
|
|
return data
|
|
@@ -273,10 +322,15 @@ export default {
|
|
|
// 添加/编辑
|
|
|
handleAdd (row, isEdit) {
|
|
|
// 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
|
|
|
+ if (!isEdit && !row.returnPrice) {
|
|
|
+ this.$message.warning('请输入退货价格')
|
|
|
+ return
|
|
|
+ }
|
|
|
if (!isEdit && !row.returnQty) {
|
|
|
this.$message.warning('请输入退货数量')
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
const params = {
|
|
|
id: isEdit ? row.id : undefined,
|
|
|
purchaseReturnSn: this.$route.params.sn,
|
|
@@ -285,7 +339,16 @@ export default {
|
|
|
purchaseBillDetailSn: row.purchaseBillDetailSn,
|
|
|
qty: isEdit ? row.qty : row.returnQty, // 退货数量
|
|
|
productSn: row.productSn,
|
|
|
- cost: row.price,
|
|
|
+ productCode: row.productCode,
|
|
|
+ productOrigCode: row.productOrigCode,
|
|
|
+ productTypeSn1: row.productTypeSn1,
|
|
|
+ productTypeSn2: row.productTypeSn2,
|
|
|
+ productTypeSn3: row.productTypeSn3,
|
|
|
+ brandSn: row.brandSn,
|
|
|
+ warehouseLocationSn: row.warehouseLocationSn,
|
|
|
+ warehouseSn: row.warehouseSn,
|
|
|
+ productExpiryDate: row.productExpiryDate,
|
|
|
+ cost: isEdit ? row.cost : row.returnPrice,
|
|
|
remarks: row.remarks,
|
|
|
promotionFlag: row.promotionFlag
|
|
|
}
|
|
@@ -295,13 +358,17 @@ export default {
|
|
|
row.qty = row.qtyBackups
|
|
|
return
|
|
|
}
|
|
|
+ if (!row.cost) {
|
|
|
+ row.cost = row.costBackups
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
this.spinning = true
|
|
|
purchaseReturnDetailSave(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
- // this.$refs.table.refresh()
|
|
|
this.$refs.chooseTable.refresh()
|
|
|
+ this.getDetail(true)
|
|
|
this.spinning = false
|
|
|
} else {
|
|
|
this.spinning = false
|
|
@@ -361,7 +428,7 @@ export default {
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
|
_this.spinning = true
|
|
|
- purchaseReturnSubmit({ id: this.$route.params.id }).then(res => {
|
|
|
+ purchaseReturnSubmit({ id: this.detailData.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
setTimeout(() => {
|
|
@@ -375,7 +442,7 @@ export default {
|
|
|
},
|
|
|
// 返回列表
|
|
|
handleBack () {
|
|
|
- this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
|
|
|
+ this.$router.push({ name: 'purchaseReturnOutSyncList' })
|
|
|
},
|
|
|
// 已选产品 退货数量 blur
|
|
|
qtyBlur (val, record) {
|
|
@@ -384,29 +451,33 @@ export default {
|
|
|
this.handleAdd(record, 'edit')
|
|
|
}
|
|
|
},
|
|
|
- // 已选产品 退货原因 blur
|
|
|
- remarksBlur (val, record) {
|
|
|
- if (val && (val != record.remarksBackups)) {
|
|
|
+ // 已选产品 退货单价 blur
|
|
|
+ costBlur (val, record) {
|
|
|
+ if (val && (val != record.costBackups)) {
|
|
|
this.handleAdd(record, 'edit')
|
|
|
}
|
|
|
},
|
|
|
- filterOption (input, option) {
|
|
|
- return (
|
|
|
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
- )
|
|
|
+ // 获取详情
|
|
|
+ getDetail (type) {
|
|
|
+ purchaseReturnDetailSn({ sn: this.$route.params.sn }).then(res => {
|
|
|
+ this.detailData = res.data || null
|
|
|
+ if (!type) {
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
this.$refs.chooseTable.refresh(true)
|
|
|
- this.resetSearchForm()
|
|
|
+ this.getDetail()
|
|
|
}
|
|
|
},
|
|
|
activated () {
|
|
|
// 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|
|
|
if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
|
|
|
this.$refs.chooseTable.refresh(true)
|
|
|
- this.resetSearchForm()
|
|
|
+ this.getDetail()
|
|
|
}
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|