|
@@ -25,18 +25,18 @@
|
|
|
<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="productCode">
|
|
|
- <a-input id="purchaseReturnEdit-productCode" v-model="queryParam.productCode" placeholder="请输入采购单号" allowClear />
|
|
|
+ <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="queryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
+ <a-input id="purchaseReturnEdit-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="queryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
+ <a-input id="purchaseReturnEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 24px;">
|
|
@@ -58,13 +58,13 @@
|
|
|
:pagination="paginationProps"
|
|
|
bordered>
|
|
|
<!-- 数量 -->
|
|
|
- <template slot="putQty" slot-scope="text, record">
|
|
|
+ <template slot="returnQty" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
- id="purchaseReturnEdit-putQty"
|
|
|
- v-model="record.putQty"
|
|
|
+ id="purchaseReturnEdit-returnQty"
|
|
|
+ v-model="record.returnQty"
|
|
|
:precision="0"
|
|
|
:min="1"
|
|
|
- :max="999999"
|
|
|
+ :max="record.qtyLeft"
|
|
|
placeholder="请输入"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
@@ -99,19 +99,19 @@
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="chooseColumns"
|
|
|
:dataSource="chooseLoadData"
|
|
|
- :scroll="{ x: 1185, y: 300 }"
|
|
|
+ :scroll="{ x: 1320, y: 300 }"
|
|
|
:pagination="choosePaginationProps"
|
|
|
bordered>
|
|
|
<!-- 退货数量 -->
|
|
|
- <template slot="outQty" slot-scope="text, record">
|
|
|
+ <template slot="qty" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
- id="purchaseReturnEdit-outQty"
|
|
|
- v-model="record.outQty"
|
|
|
+ id="purchaseReturnEdit-qty"
|
|
|
+ v-model="record.qty"
|
|
|
:precision="0"
|
|
|
:min="1"
|
|
|
- :max="999999"
|
|
|
+ :max="record.qtyLeft"
|
|
|
placeholder="请输入"
|
|
|
- @blur="e => outQtyChange(e.target.value, record)"
|
|
|
+ @blur="e => qtyChange(e.target.value, record)"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 退货原因 -->
|
|
@@ -121,7 +121,7 @@
|
|
|
v-model="record.remarks"
|
|
|
:maxLength="30"
|
|
|
placeholder="退货原因(最多30个字符)"
|
|
|
- @change="e => outQtyChange(e.target.value, record)"
|
|
|
+ @change="e => remarksChange(e.target.value, record)"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
@@ -142,39 +142,27 @@
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { purchaseReturnPurchaseBillDetailList, purchaseReturnDetailList, purchaseReturnSave } from '@/api/purchaseReturn'
|
|
|
+import { purchaseReturnPurchaseBillDetailList, purchaseReturnDetailList, purchaseReturnDetailSave, purchaseReturnDetailDel, purchaseReturnSubmit } from '@/api/purchaseReturn'
|
|
|
export default {
|
|
|
components: { STable, VSelect },
|
|
|
data () {
|
|
|
return {
|
|
|
queryParam: {
|
|
|
- productCode: '',
|
|
|
- productName: '',
|
|
|
- warehouseSn: undefined,
|
|
|
- brandSn: undefined,
|
|
|
- productTypeSn1: undefined,
|
|
|
- productTypeSn2: undefined,
|
|
|
- productTypeSn3: undefined
|
|
|
- },
|
|
|
- chooseQueryParam: {
|
|
|
+ purchaseBillNo: '',
|
|
|
productCode: '',
|
|
|
productName: ''
|
|
|
},
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
- chooseDisabled: false, // 查询、重置按钮是否可操作
|
|
|
advanced: false, // 高级搜索 展开/关闭
|
|
|
- productBrandList: [], // 产品品牌 下拉数据
|
|
|
- productTypeList: [], // 产品分类 下拉数据
|
|
|
- productType: [],
|
|
|
- warehouseList: [], // 仓库 下拉数据
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '采购单号', dataIndex: 'purchaseBillNo', width: 200, align: 'center' },
|
|
|
{ title: '产品编码', dataIndex: 'productEntity.code', width: 200, align: 'center' },
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', ellipsis: true },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', width: 200, align: 'center', ellipsis: true },
|
|
|
{ title: '采购总数', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '退货数量', scopedSlots: { customRender: 'putQty' }, width: 200, align: 'center' },
|
|
|
+ { title: '可退数量', dataIndex: 'qtyLeft', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: 100, align: 'center' },
|
|
|
{ title: '采购价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
@@ -193,13 +181,13 @@ export default {
|
|
|
chooseColumns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '采购单号', dataIndex: 'purchaseBillNo', width: 200, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
|
|
|
- { title: '采购总数', dataIndex: 'currentQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '退货数量', scopedSlots: { customRender: 'putQty' }, width: 100, align: 'center' },
|
|
|
- { title: '采购价', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: 100, align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
|
|
|
+ { title: '采购总数', dataIndex: 'purchaseBillQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: 100, align: 'center' },
|
|
|
+ { title: '采购价', dataIndex: 'cost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: 200, align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
chooseLoadData: [],
|
|
@@ -211,46 +199,40 @@ export default {
|
|
|
current: 1,
|
|
|
onShowSizeChange: (current, pageSize) => this.changeChoosePageSize(current, pageSize),
|
|
|
onChange: (current) => this.changeChoosePage(current)
|
|
|
- },
|
|
|
- productTotal: null // 合计
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 重置
|
|
|
resetSearchForm () {
|
|
|
+ this.queryParam.purchaseBillNo = ''
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productName = ''
|
|
|
- this.queryParam.warehouseSn = undefined
|
|
|
- this.queryParam.brandSn = undefined
|
|
|
- this.queryParam.productTypeSn1 = undefined
|
|
|
- this.queryParam.productTypeSn2 = undefined
|
|
|
- this.queryParam.productTypeSn3 = undefined
|
|
|
- this.$refs.table.refresh(true)
|
|
|
- },
|
|
|
- // 已选产品 重置
|
|
|
- chooseResetSearchForm () {
|
|
|
- this.chooseQueryParam.productCode = ''
|
|
|
- this.chooseQueryParam.productName = ''
|
|
|
- this.getChooseProductList(1)
|
|
|
+ this.getPurchaseBillDetailList()
|
|
|
},
|
|
|
// 添加/编辑
|
|
|
handleAdd (row, isEdit) {
|
|
|
+ // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
|
|
|
+ if (!isEdit && !row.returnQty) {
|
|
|
+ this.$message.warning('请输入退货数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (isEdit && !row.qty) {
|
|
|
+ this.$message.warning('请输入退货数量')
|
|
|
+ return
|
|
|
+ }
|
|
|
const params = {
|
|
|
id: isEdit ? row.id : undefined,
|
|
|
- storeCallOutSn: this.$route.params.sn,
|
|
|
- outCost: row.putCost,
|
|
|
- outQty: isEdit ? row.outQty : 1, // 添加时调出数量默认为1
|
|
|
+ purchaseReturnSn: this.$route.params.sn,
|
|
|
+ purchaseBillSn: row.purchaseBillSn,
|
|
|
+ purchaseBillNo: row.purchaseBillNo,
|
|
|
+ purchaseBillDetailSn: row.purchaseBillDetailSn,
|
|
|
+ qty: isEdit ? row.qty : row.returnQty, // 退货数量
|
|
|
productSn: row.productSn,
|
|
|
- productCode: row.productCode,
|
|
|
- productOrigCode: row.productOrigCode || undefined,
|
|
|
- productTypeSn1: row.productTypeSn1,
|
|
|
- productTypeSn2: row.productTypeSn2,
|
|
|
- productTypeSn3: row.productTypeSn3,
|
|
|
- brandSn: row.brandSn,
|
|
|
- warehouseSn: row.warehouseSn,
|
|
|
- warehouseLocationSn: row.warehouseLocationSn
|
|
|
+ cost: row.price,
|
|
|
+ remarks: row.remarks
|
|
|
}
|
|
|
- purchaseReturnSave(params).then(res => {
|
|
|
+ purchaseReturnDetailSave(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
this.getChooseProductList()
|
|
@@ -279,7 +261,7 @@ export default {
|
|
|
content: '删除后不可恢复,确定要进行删除吗?',
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
- storeCallOutDetailDel({ id: row.id }).then(res => {
|
|
|
+ purchaseReturnDetailDel({ id: row.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.getChooseProductList()
|
|
@@ -291,7 +273,7 @@ export default {
|
|
|
// 提交
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
|
- storeCallOutSubmit({ id: this.$route.params.id }).then(res => {
|
|
|
+ purchaseReturnSubmit({ id: this.$route.params.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
setTimeout(() => {
|
|
@@ -300,8 +282,6 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 导入明细
|
|
|
- handleImport () {},
|
|
|
// 返回列表
|
|
|
handleBack () {
|
|
|
this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
|
|
@@ -344,13 +324,12 @@ export default {
|
|
|
// 已选产品列表数据
|
|
|
getChooseProductList (pageNo) {
|
|
|
this.choosePageNo = this.choosePageNo || pageNo
|
|
|
- this.chooseDisabled = true
|
|
|
const params = {
|
|
|
pageNo: this.choosePageNo,
|
|
|
pageSize: this.choosePageSize,
|
|
|
- purchaseBillNo: this.$route.params.sn
|
|
|
+ purchaseReturnSn: this.$route.params.sn
|
|
|
}
|
|
|
- purchaseReturnDetailList(Object.assign(params, this.chooseQueryParam)).then(res => {
|
|
|
+ purchaseReturnDetailList(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
const data = res.data
|
|
|
this.choosePaginationProps.total = Number(res.data.count) || 0
|
|
@@ -360,7 +339,6 @@ export default {
|
|
|
data.list[i].no = no + i + 1
|
|
|
}
|
|
|
this.chooseLoadData = data.list
|
|
|
- this.chooseDisabled = false
|
|
|
} else {
|
|
|
this.choosePaginationProps.total = 0
|
|
|
this.choosePaginationProps.current = 1
|
|
@@ -368,8 +346,12 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 已选产品 调出数量 change
|
|
|
- outQtyChange (val, record) {
|
|
|
+ // 已选产品 退货数量 change
|
|
|
+ qtyChange (val, record) {
|
|
|
+ this.handleAdd(record, 'edit')
|
|
|
+ },
|
|
|
+ // 已选产品 退货数量 change
|
|
|
+ remarksChange (val, record) {
|
|
|
this.handleAdd(record, 'edit')
|
|
|
},
|
|
|
filterOption (input, option) {
|
|
@@ -382,8 +364,6 @@ export default {
|
|
|
next(vm => {
|
|
|
vm.getPurchaseBillDetailList()
|
|
|
vm.getChooseProductList(1)
|
|
|
- // vm.getProductBrand()
|
|
|
- // vm.getProductType()
|
|
|
})
|
|
|
}
|
|
|
}
|