|
@@ -54,6 +54,11 @@
|
|
|
:pageSize="10"
|
|
|
:scroll="{ y: 149 }"
|
|
|
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="returnQty" slot-scope="text, record">
|
|
|
<a-input-number
|
|
@@ -67,9 +72,9 @@
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 退货原因 -->
|
|
|
- <template slot="remarks" slot-scope="text, record">
|
|
|
+ <template slot="returnReason" slot-scope="text, record">
|
|
|
<v-select
|
|
|
- v-model="record.remarks"
|
|
|
+ v-model="record.returnReason"
|
|
|
ref="billStatus"
|
|
|
code="RETURN_APPLY_BILL_STATUS"
|
|
|
placeholder="请选择退货原因"
|
|
@@ -146,6 +151,11 @@
|
|
|
:pageSize="10"
|
|
|
:scroll="{ y: 149 }"
|
|
|
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="qty" slot-scope="text, record">
|
|
|
<a-input-number
|
|
@@ -159,9 +169,9 @@
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 退货原因 -->
|
|
|
- <template slot="remarks" slot-scope="text, record">
|
|
|
+ <template slot="returnReason" slot-scope="text, record">
|
|
|
<v-select
|
|
|
- v-model="record.remarks"
|
|
|
+ v-model="record.returnReason"
|
|
|
ref="billStatus"
|
|
|
code="RETURN_APPLY_BILL_STATUS"
|
|
|
placeholder="请选择退货原因"
|
|
@@ -198,13 +208,15 @@ import { STable, VSelect } from '@/components'
|
|
|
import Print from '@/views/common/print.vue'
|
|
|
import { hdPrint } from '@/libs/JGPrint'
|
|
|
import ProductType from '../../common/productType.js'
|
|
|
+import { productList } from '@/api/product'
|
|
|
import {
|
|
|
- purchaseReturnPurchaseBillDetailList,
|
|
|
purchaseReturnDetailList,
|
|
|
purchaseReturnDetailSave,
|
|
|
purchaseReturnDetailDel,
|
|
|
purchaseReturnSubmit,
|
|
|
purchaseReturnDelAll,
|
|
|
+ purchaseReturnModifyQty,
|
|
|
+ modifyReturnReason,
|
|
|
purchaseReturnDetailPrint,
|
|
|
purchaseReturnDetailExport } from '@/api/purchaseReturnApply'
|
|
|
export default {
|
|
@@ -228,11 +240,12 @@ export default {
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
- return purchaseReturnPurchaseBillDetailList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ return productList(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
|
|
|
+ data.list[i].returnQty = 1
|
|
|
}
|
|
|
this.disabled = false
|
|
|
return data
|
|
@@ -250,8 +263,7 @@ 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].returnReasonBackups = data.list[i].returnReason
|
|
|
}
|
|
|
this.dataSource = data.list
|
|
|
return data
|
|
@@ -263,12 +275,12 @@ export default {
|
|
|
columns () {
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '产品分类', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '申请退货数量', scopedSlots: { customRender: 'qty' }, width: '15%', align: 'center' },
|
|
|
- { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: '15%', align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '15%', align: 'center' },
|
|
|
+ { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '申请退货数量', scopedSlots: { customRender: 'returnQty' }, width: '15%', align: 'center' },
|
|
|
+ { title: '退货原因', scopedSlots: { customRender: 'returnReason' }, width: '15%', align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
]
|
|
|
return arr
|
|
@@ -276,12 +288,12 @@ export default {
|
|
|
chooseColumns () {
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '产品分类', dataIndex: 'purchaseBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'name', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '15%', align: 'center' },
|
|
|
+ { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '申请退货数量', scopedSlots: { customRender: 'qty' }, width: '15%', align: 'center' },
|
|
|
- { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: '15%', align: 'center' },
|
|
|
+ { title: '退货原因', scopedSlots: { customRender: 'returnReason' }, width: '15%', align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
]
|
|
|
return arr
|
|
@@ -324,38 +336,26 @@ export default {
|
|
|
this.$refs.chooseTable.refresh(true)
|
|
|
},
|
|
|
// 添加/编辑
|
|
|
- handleAdd (row, isEdit) {
|
|
|
+ handleAdd (row) {
|
|
|
// 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
|
|
|
- if (!isEdit && !row.returnQty) {
|
|
|
+ if (!row.returnQty) {
|
|
|
this.$message.warning('请输入退货数量')
|
|
|
return
|
|
|
}
|
|
|
+ if (!row.returnReason) {
|
|
|
+ this.$message.warning('请选择退货原因')
|
|
|
+ return
|
|
|
+ }
|
|
|
const params = {
|
|
|
- id: isEdit ? row.id : undefined,
|
|
|
purchaseReturnApplySn: this.$route.params.sn,
|
|
|
- purchaseBillSn: row.purchaseBillSn,
|
|
|
- purchaseBillNo: row.purchaseBillNo,
|
|
|
- purchaseBillDetailSn: row.purchaseBillDetailSn,
|
|
|
- qty: isEdit ? row.qty : row.returnQty, // 退货数量
|
|
|
+ qty: row.returnQty, // 退货数量
|
|
|
productSn: row.productSn,
|
|
|
- cost: row.price,
|
|
|
- remarks: row.remarks,
|
|
|
- promotionFlag: row.promotionFlag
|
|
|
- }
|
|
|
- if (isEdit) { // 编辑
|
|
|
- // 清空退货数量时,值应保持未清空前的值,因退货数量都不可为空
|
|
|
- if (!row.qty) {
|
|
|
- row.qty = row.qtyBackups
|
|
|
- return
|
|
|
- }
|
|
|
+ returnReason: row.returnReason
|
|
|
}
|
|
|
this.spinning = true
|
|
|
purchaseReturnDetailSave(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
- if (isEdit) {
|
|
|
- this.$refs.table.refresh()
|
|
|
- }
|
|
|
this.$refs.chooseTable.refresh()
|
|
|
this.spinning = false
|
|
|
} else {
|
|
@@ -399,7 +399,7 @@ export default {
|
|
|
})
|
|
|
} else { // 单个删除
|
|
|
_this.spinning = true
|
|
|
- purchaseReturnDetailDel({ id: row.id }).then(res => {
|
|
|
+ purchaseReturnDetailDel({ purchaseReturnApplySn: _this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.$refs.table.refresh()
|
|
@@ -417,7 +417,7 @@ export default {
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
|
_this.spinning = true
|
|
|
- purchaseReturnSubmit({ id: this.$route.params.id }).then(res => {
|
|
|
+ purchaseReturnSubmit({ purchaseReturnApplySn: _this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
setTimeout(() => {
|
|
@@ -437,19 +437,40 @@ export default {
|
|
|
qtyBlur (val, record) {
|
|
|
// 光标移出,值发生改变再调用编辑接口
|
|
|
if (val != record.qtyBackups) {
|
|
|
- this.handleAdd(record, 'edit')
|
|
|
+ this.spinning = true
|
|
|
+ purchaseReturnModifyQty({
|
|
|
+ qty: record.qty,
|
|
|
+ purchaseReturnApplyDetailSn: record.purchaseReturnApplyDetailSn,
|
|
|
+ purchaseReturnApplySn: this.$route.params.sn
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.$refs.chooseTable.refresh()
|
|
|
+ } else {
|
|
|
+ record.qty = record.qtyBackups
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
// 已选产品 退货原因 blur
|
|
|
remarksBlur (val, record) {
|
|
|
- if (val && (val != record.remarksBackups)) {
|
|
|
- this.handleAdd(record, 'edit')
|
|
|
+ if (val && (val != record.returnReasonBackups)) {
|
|
|
+ this.spinning = true
|
|
|
+ modifyReturnReason({
|
|
|
+ returnReason: val,
|
|
|
+ purchaseReturnApplyDetailSn: record.purchaseReturnApplyDetailSn,
|
|
|
+ purchaseReturnApplySn: this.$route.params.sn
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.$refs.chooseTable.refresh()
|
|
|
+ } else {
|
|
|
+ record.returnReason = record.returnReasonBackups
|
|
|
+ }
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
}
|
|
|
- },
|
|
|
- filterOption (input, option) {
|
|
|
- return (
|
|
|
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
- )
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|