|
@@ -9,21 +9,21 @@
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra">
|
|
|
- <print :params="{allocateSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
|
|
|
+ <print :params="{allocateReturnSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont">
|
|
|
<a-collapse :activeKey="['0']">
|
|
|
<a-collapse-panel key="0" header="基础信息">
|
|
|
<a-descriptions :column="3">
|
|
|
- <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
|
|
|
- <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.allocateReturnTypeName) || '--' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
|
|
|
<a-descriptions-item label="调拨退货类型">
|
|
|
- <AllocateType id="allocateEdit-allocateTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateTypeSn"></AllocateType>
|
|
|
+ <AllocateType id="allocateEdit-allocateReturnTypeSn" style="width: 200px;" @change="changeAllocateType" v-model="basicInfoData.allocateReturnTypeSn"></AllocateType>
|
|
|
</a-descriptions-item>
|
|
|
- <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.allocateNo) || '--' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.grabFlagDictValue) || '--' }}</a-descriptions-item>
|
|
|
<a-descriptions-item label="备注">
|
|
|
- {{ (basicInfoData&&basicInfoData.remark) || '--' }}
|
|
|
+ {{ (basicInfoData&&basicInfoData.remarks) }}
|
|
|
<a-icon type="form" title="编辑备注" @click="editRemark = true" style="color: dodgerblue;font-size: 14px;" />
|
|
|
</a-descriptions-item>
|
|
|
</a-descriptions>
|
|
@@ -110,8 +110,8 @@
|
|
|
<!-- 总计 -->
|
|
|
<a-alert type="info" style="margin-bottom:10px">
|
|
|
<div slot="message">
|
|
|
- 退货总数量:<strong>{{ (productTotal&&(productTotal.totalQty || productTotal.totalQty==0)) ? productTotal.totalQty : '--' }}</strong> ,
|
|
|
- <span>退货总金额(¥):<strong>{{ (productTotal&&(productTotal.totalPrice || productTotal.totalPrice==0)) ? productTotal.totalPrice : '--' }}</strong></span>
|
|
|
+ 退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ,
|
|
|
+ <span v-if="$hasPermissions('B_isShowPrice')">退货总金额(¥):<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? basicInfoData.totalPrice : '--' }}</strong></span>
|
|
|
</div>
|
|
|
</a-alert>
|
|
|
<!-- 筛选条件 -->
|
|
@@ -122,12 +122,12 @@
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="9" :sm="24">
|
|
|
<a-form-item label="产品编码" prop="productCode">
|
|
|
- <a-input id="allocateBillEdit-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
+ <a-input id="editGrap-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="allocateBillEdit-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
+ <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
@@ -139,7 +139,7 @@
|
|
|
</div>
|
|
|
</a-col>
|
|
|
<a-col :span="7" style="text-align: right;">
|
|
|
- <!-- <a-button size="small" id="allocateBillEdit-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
|
|
|
+ <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
|
|
|
<!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -172,7 +172,7 @@
|
|
|
<template slot="returnQty" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
size="small"
|
|
|
- v-model="record.qty"
|
|
|
+ v-model="record.returnQty"
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
|
:max="999999"
|
|
@@ -201,7 +201,7 @@
|
|
|
style="padding: 0 60px;">提交</a-button>
|
|
|
</div>
|
|
|
<!-- 导入产品 -->
|
|
|
- <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
|
|
|
+ <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateReturnSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
|
|
|
<!-- 修改基础信息 -->
|
|
|
<a-modal
|
|
|
centered
|
|
@@ -214,7 +214,7 @@
|
|
|
@cancle="editRemark = false"
|
|
|
:width="600">
|
|
|
<a-textarea
|
|
|
- v-model="basicInfoData.remark"
|
|
|
+ v-model="basicInfoData.remarks"
|
|
|
placeholder="请输入备注(最多120个字符)"
|
|
|
:maxLength="120"
|
|
|
:auto-size="{ minRows: 3, maxRows: 5 }"
|
|
@@ -233,7 +233,16 @@ import { STable, VSelect } from '@/components'
|
|
|
import print from './print.vue'
|
|
|
import { queryStockProductPage } from '@/api/stock'
|
|
|
import AllocateType from '@/views/common/allocateType.js'
|
|
|
-import { allocateBillSave, allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillBatchInsert } from '@/api/allocateBill'
|
|
|
+import {
|
|
|
+ allocateReturnSave,
|
|
|
+ allocReturnDetailQueryPage,
|
|
|
+ allocateReturnQueryBySn,
|
|
|
+ allocReturnDetailInsert,
|
|
|
+ allocReturnDetailUpdate,
|
|
|
+ allocateReturnSubmit,
|
|
|
+ allocReturnDetailDelete
|
|
|
+ // allocateBillBatchInsert
|
|
|
+} from '@/api/allocateReturn'
|
|
|
|
|
|
export default {
|
|
|
components: { STable, VSelect, print, AllocateType },
|
|
@@ -283,33 +292,31 @@ export default {
|
|
|
],
|
|
|
chooseColumns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productEntity.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '单位', dataIndex: 'productEntity.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'product.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '单位', dataIndex: 'product.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
|
|
|
{ title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
|
|
|
- { title: '退货金额', dataIndex: 'returnAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '退货金额', dataIndex: 'totalReturnPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
chooseLoadData: parameter => {
|
|
|
this.chooseDisabled = true
|
|
|
- const params = Object.assign(parameter, this.chooseQueryParam, { allocateSn: this.$route.params.sn })
|
|
|
- return allocateBillDetailList(params).then(res => {
|
|
|
- this.getDetailCount()
|
|
|
+ const params = Object.assign(parameter, { product: { name: this.chooseQueryParam.productName, code: this.chooseQueryParam.productCode }, allocateReturnSn: this.$route.params.sn })
|
|
|
+ return allocReturnDetailQueryPage(params).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].qtyBackups = data.list[i].qty
|
|
|
- data.list[i].priceBackups = data.list[i].price
|
|
|
+ data.list[i].qtyBackups = data.list[i].returnQty
|
|
|
+ data.list[i].oldPrice = data.list[i].price
|
|
|
}
|
|
|
this.localDataSource = data.list || []
|
|
|
this.chooseDisabled = false
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- productTotal: null, // 合计
|
|
|
basicInfoData: null, // 基本信息
|
|
|
openGuideModal: false, // 导入产品引导
|
|
|
openModal: false,
|
|
@@ -321,17 +328,10 @@ export default {
|
|
|
handleEditRemark () {
|
|
|
const _this = this
|
|
|
const params = _this.basicInfoData
|
|
|
- allocateBillSave({
|
|
|
- allocateSn: params.allocateSn,
|
|
|
- targetType: params.targetType,
|
|
|
- targetSn: params.targetSn,
|
|
|
- targetName: params.targetName,
|
|
|
- allocateTypeSn: params.allocateTypeSn,
|
|
|
- remark: params.remark
|
|
|
- }).then(res => {
|
|
|
+ allocateReturnSave(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
- _this.getDetail()
|
|
|
+ _this.getDetail(true)
|
|
|
} else {
|
|
|
_this.spinning = false
|
|
|
}
|
|
@@ -368,13 +368,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 导入产品
|
|
|
- handleGuideOk (obj) {
|
|
|
- allocateBillBatchInsert(obj).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.$refs.chooseTable.refresh(true)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ // handleGuideOk (obj) {
|
|
|
+ // allocateBillBatchInsert(obj).then(res => {
|
|
|
+ // if (res.status == 200) {
|
|
|
+ // this.$refs.chooseTable.refresh(true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // },
|
|
|
// 已选产品 重置
|
|
|
chooseResetSearchForm () {
|
|
|
this.chooseQueryParam.productCode = ''
|
|
@@ -384,27 +384,29 @@ export default {
|
|
|
// 添加/编辑
|
|
|
handleAdd (row, isEdit, isRefresh) {
|
|
|
const params = {
|
|
|
- id: isEdit ? row.id : undefined,
|
|
|
- allocateSn: this.$route.params.sn,
|
|
|
- cost: isEdit ? row.cost : row.lastStockCost,
|
|
|
+ allocateReturnSn: this.$route.params.sn,
|
|
|
+ productSn: row.productSn,
|
|
|
price: isEdit ? row.price : row.productPrice,
|
|
|
- qty: isEdit ? row.qty : 1, // 添加时调出数量默认为1
|
|
|
- productSn: row.productSn
|
|
|
+ returnQty: isEdit ? row.returnQty : row.qty
|
|
|
}
|
|
|
+ const fun = isEdit ? allocReturnDetailUpdate : allocReturnDetailInsert
|
|
|
if (isEdit) { // 编辑
|
|
|
// 清空数量时,值应保持未清空前的值,因数量不可为空
|
|
|
- if (!row.qty) {
|
|
|
- row.qty = row.qtyBackups
|
|
|
+ if (!row.returnQty) {
|
|
|
+ row.returnQty = row.qtyBackups
|
|
|
return
|
|
|
}
|
|
|
if (!row.price) {
|
|
|
- row.price = row.priceBackups
|
|
|
+ row.price = row.oldPrice
|
|
|
return
|
|
|
}
|
|
|
+ params.oldPrice = row.oldPrice
|
|
|
+ params.allocateReturnDetailSn = row.allocateReturnDetailSn
|
|
|
}
|
|
|
this.spinning = true
|
|
|
- allocateBillDetailSave(params).then(res => {
|
|
|
+ fun(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
+ this.getDetail(true)
|
|
|
this.$message.success(res.message)
|
|
|
if (isRefresh != 'noRefresh') {
|
|
|
this.$refs.table.refresh()
|
|
@@ -426,14 +428,19 @@ export default {
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
if (isAll) { // 整单删除
|
|
|
- allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.$message.success(res.message)
|
|
|
- _this.refashPage()
|
|
|
- }
|
|
|
- })
|
|
|
+ // allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
|
|
|
+ // if (res.status == 200) {
|
|
|
+ // _this.$message.success(res.message)
|
|
|
+ // _this.refashPage()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
} else { // 单个删除
|
|
|
- allocateBillDetailDel({ id: row.id }).then(res => {
|
|
|
+ allocReturnDetailDelete({
|
|
|
+ allocateReturnSn: _this.$route.params.sn,
|
|
|
+ allocateDetailSn: row.allocateDetailSn,
|
|
|
+ price: row.price,
|
|
|
+ productSn: row.productSn
|
|
|
+ }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
_this.refashPage()
|
|
@@ -447,7 +454,7 @@ export default {
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
|
_this.spinning = true
|
|
|
- allocateBillSubmit({ sn: this.$route.params.sn }).then(res => {
|
|
|
+ allocateReturnSubmit({ allocateReturnSn: this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
setTimeout(() => {
|
|
@@ -460,27 +467,20 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 基本信息
|
|
|
- getDetail () {
|
|
|
+ getDetail (flag) {
|
|
|
this.spinning = true
|
|
|
- allocateBillDetail({ sn: this.$route.params.sn }).then(res => {
|
|
|
+ allocateReturnQueryBySn({ allocateReturnSn: this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.basicInfoData = res.data
|
|
|
+ if (!flag) {
|
|
|
+ this.resetSearchForm()
|
|
|
+ }
|
|
|
} else {
|
|
|
this.basicInfoData = null
|
|
|
}
|
|
|
this.spinning = false
|
|
|
})
|
|
|
},
|
|
|
- // 合计
|
|
|
- getDetailCount () {
|
|
|
- allocateBillDetailCount({ allocateSn: this.$route.params.sn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.productTotal = res.data
|
|
|
- } else {
|
|
|
- this.productTotal = null
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 返回列表
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
|
|
@@ -495,12 +495,13 @@ export default {
|
|
|
// 已选产品 退货单价 change
|
|
|
priceChange (val, record) {
|
|
|
// 光标移出,值发生改变再调用编辑接口
|
|
|
- if (val != record.priceBackups) {
|
|
|
+ if (val != record.oldPrice) {
|
|
|
this.handleAdd(record, 'edit', 'noRefresh')
|
|
|
}
|
|
|
},
|
|
|
// 刷新当前页面
|
|
|
refashPage () {
|
|
|
+ this.getDetail(true)
|
|
|
this.$refs.table.refresh()
|
|
|
this.$refs.chooseTable.refresh()
|
|
|
},
|