import { required, diyRequired } from '@/components/template/rules_verify.js'
import { goodsPurchaseRetItemImportCode, goodsPurchaseRetDetail } from '@/api/merchandisePurchaseReturn.js'
export default {
data() {
return {}
},
computed: {
storage_goods() {
return [
{
columnAttributes: {
label: '品牌',
prop: 'brandName',
width: 160
}
},
{
columnAttributes: {
label: '商品大类',
prop: 'mainName',
width: 160
}
},
{
columnAttributes: {
label: '商品小类',
prop: 'smallName',
width: 160
}
},
{
columnAttributes: {
label: '商品名称',
prop: 'goodsMaterialName',
width: 160
}
},
{
columnAttributes: {
label: '厂物料编码',
prop: 'factoryNo',
width: 120
}
},
{
columnAttributes: {
label: '规格型号',
prop: 'specsName',
width: 120
}
},
{
columnAttributes: {
label: '单位',
prop: 'unit'
},
render: (h, { row, column, index }) => {
return
{{ C: '整套', I: '单个' }[row[column.columnAttributes.prop]] || ''}
}
},
{
columnAttributes: {
label: '*退货数量',
prop: 'retQty',
width: 160
},
render: (h, { row, column, index }) => {
return !!~[0,1].indexOf(this.formDialogType) ? (
{
if(this.logs){
this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
}
this?.tishicuowu?.()
return new Error('必须填写')
})]}
>
{
if (Number(val) > Number(row.qty)) {
row[column.columnAttributes.prop] = Number(row.qty)
} else {
row[column.columnAttributes.prop] = val ? Number(val) : ''
}
row.retAmount = (row[column.columnAttributes.prop] * Number(row.price)).toFixed(2)
row.retInsideQty =
parseInt(Number(row.insideQty) / Number(row.qty)) * Number(row[column.columnAttributes.prop])
row.retOutQty =
parseInt(Number(row.outQty) / Number(row.qty)) * Number(row[column.columnAttributes.prop])
row.retPartsQty =
parseInt(Number(row.partsQty) / Number(row.qty)) * Number(row[column.columnAttributes.prop])
}}
type="number"
placeholder="请输入"
>
) : (
{row[column.columnAttributes.prop]}
)
}
},
{
columnAttributes: {
label: '退货内机数量',
prop: 'retInsideQty',
width: 120
}
},
{
columnAttributes: {
label: '退货外机数量',
prop: 'retOutQty',
width: 120
}
},
{
columnAttributes: {
label: '退货配件数量',
prop: 'retPartsQty',
width: 120
}
},
{
columnAttributes: {
label: '导入内机条码数量',
prop: 'insideCodeQty',
width: 120
}
},
{
columnAttributes: {
label: '导入外机条码数量',
prop: 'outCodeQty',
width: 120
}
},
{
columnAttributes: {
label: '导入配件条码数量',
prop: 'partsCodeQty',
width: 120
}
},
{
columnAttributes: {
label: '退款金额',
prop: 'retAmount',
width: 160
}
},
{
columnAttributes: {
label: '采购数量',
prop: 'qty',
width: 160
}
},
{
columnAttributes: {
label: '内机数量',
prop: 'insideQty'
}
},
{
columnAttributes: {
label: '外机数量',
prop: 'outQty'
}
},
{
columnAttributes: {
label: '配件数量',
prop: 'partsQty'
}
},
{
columnAttributes: {
label: '采购价格',
prop: 'price',
width: 160
}
},
{
columnAttributes: {
label: '采购金额',
prop: 'amount',
width: 160
}
},
{
columnAttributes: {
label: '库存数量',
prop: 'stockQty'
}
},
...(() => {
if (this.formDialogType < 2 && !~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)) {
return [
{
columnAttributes: {
label: '操作',
fixed: 'right',
width: 140
},
render: (h, { row, column, index }) => {
return (
{
this.formData?.items?.splice(index, 1)
}}
>
删除
)
}
}
]
} else if (this.formDialogType < 2 && !!~[].indexOf(this.formData.status) && this.joinCode) {
return [
{
columnAttributes: {
label: '操作',
fixed: 'right',
width: 140
},
render: (h, { row, column, index }) => {
return (
{this.importButton(goodsPurchaseRetItemImportCode, '导入条码', { id: this.formData.id, purchaseRetItemId: row.id }, () => { }, () => {
if (this.formData.id) {
// 更新表单信息
goodsPurchaseRetDetail({ id: this.formData.id }).then(res => {
Object.assign(this.formData, res.data, {
fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
items: res.data.items.map(item => ({ ...item, details: {} }))
})
})
}
})}
)
}
}
]
}
return []
})()
]
}
},
methods: {}
}