|
@@ -26,17 +26,16 @@
|
|
</a-collapse>
|
|
</a-collapse>
|
|
</a-card>
|
|
</a-card>
|
|
<a-card size="small" :bordered="false" class="salesReturnEdit-cont">
|
|
<a-card size="small" :bordered="false" class="salesReturnEdit-cont">
|
|
- <!-- 查询配件列表 -->
|
|
|
|
- <div>已入库产品信息</div>
|
|
|
|
- <a-divider />
|
|
|
|
|
|
+ <!-- <div>已入库产品信息</div>
|
|
|
|
+ <a-divider /> -->
|
|
<queryPart ref="partQuery" :newLoading="isInster" @add="saveProduct"></queryPart>
|
|
<queryPart ref="partQuery" :newLoading="isInster" @add="saveProduct"></queryPart>
|
|
</a-card>
|
|
</a-card>
|
|
<a-card size="small" :bordered="false" class="salesReturnEdit-cont">
|
|
<a-card size="small" :bordered="false" class="salesReturnEdit-cont">
|
|
<a-alert style="margin-bottom: 10px;" type="info">
|
|
<a-alert style="margin-bottom: 10px;" type="info">
|
|
<div slot="message" class="total-bar">
|
|
<div slot="message" class="total-bar">
|
|
- <div>
|
|
|
|
- <span>申请退货数量:{{ ordeDetail&&(ordeDetail.totalInitialQty || ordeDetail.totalInitialQty==0) ? ordeDetail.totalInitialQty : '--' }};</span>
|
|
|
|
- <span v-if="$hasPermissions('B_isShowPrice')">退货金额:{{ ordeDetail&&(ordeDetail.totalAmount || ordeDetail.totalAmount==0) ? ordeDetail.totalAmount : '--' }}元;</span>
|
|
|
|
|
|
+ <div v-if="statisticsObj">
|
|
|
|
+ <span>申请退货数量:{{ (statisticsObj.returnedQty || statisticsObj.returnedQty==0) ? statisticsObj.returnedQty : '--' }};</span>
|
|
|
|
+ <span>退货金额:{{ statisticsObj.totalCost }}元;</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a-alert>
|
|
</a-alert>
|
|
@@ -73,23 +72,20 @@
|
|
:defaultLoadData="false"
|
|
:defaultLoadData="false"
|
|
:scroll="{ y: 300 }"
|
|
:scroll="{ y: 300 }"
|
|
bordered>
|
|
bordered>
|
|
- <!-- 本次退货数量 -->
|
|
|
|
- <template slot="qty" slot-scope="text, record">
|
|
|
|
|
|
+ <!--申请退货数量 -->
|
|
|
|
+ <template slot="returnQty" slot-scope="text, record">
|
|
<a-input-number
|
|
<a-input-number
|
|
id="salesReturn-qty"
|
|
id="salesReturn-qty"
|
|
size="small"
|
|
size="small"
|
|
- v-model="record.initialQty"
|
|
|
|
|
|
+ v-model="record.returnedQty"
|
|
:precision="0"
|
|
:precision="0"
|
|
:min="0"
|
|
:min="0"
|
|
- :max="999999"
|
|
|
|
|
|
+ :max="record.returnedQty"
|
|
placeholder="请输入"
|
|
placeholder="请输入"
|
|
- @blur="e => onCellBlur(e.target.value, record, 'qty')"
|
|
|
|
- style="width: 100%;" />
|
|
|
|
- </template>
|
|
|
|
- <!-- 退货原因 -->
|
|
|
|
- <template slot="returnReason" slot-scope="text, record">
|
|
|
|
- <returnReason v-model="record.returnReason" @blur="updateReason(record)"></returnReason>
|
|
|
|
|
|
+ style="width: 100%;"
|
|
|
|
+ @blur="e => onCellBlur(e.target.value, record, 'qty')"/>
|
|
</template>
|
|
</template>
|
|
|
|
+
|
|
<!-- 操作 -->
|
|
<!-- 操作 -->
|
|
<template slot="action" slot-scope="text, record">
|
|
<template slot="action" slot-scope="text, record">
|
|
<a-button
|
|
<a-button
|
|
@@ -110,11 +106,11 @@
|
|
:disabled="spinning"
|
|
:disabled="spinning"
|
|
type="primary"
|
|
type="primary"
|
|
class="button-primary"
|
|
class="button-primary"
|
|
- @click="beforeSubmit()"
|
|
|
|
|
|
+ @click="beforeSubmit"
|
|
id="salesReturn-handleSubmit">提交</a-button>
|
|
id="salesReturn-handleSubmit">提交</a-button>
|
|
</div>
|
|
</div>
|
|
<!-- 选择审核人员 -->
|
|
<!-- 选择审核人员 -->
|
|
- <!-- <chooseDepartUserModal ref="chooseDepart" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal> -->
|
|
|
|
|
|
+ <chooseDepartUserModal ref="chooseDepart" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
|
|
<!-- 导入产品 -->
|
|
<!-- 导入产品 -->
|
|
<!-- <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" /> -->
|
|
<!-- <importGuideModal :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" /> -->
|
|
<!-- 批量设置退货原因 -->
|
|
<!-- 批量设置退货原因 -->
|
|
@@ -140,7 +136,7 @@ import queryPart from './queryPart.vue'
|
|
import addModal from './addModal.vue'
|
|
import addModal from './addModal.vue'
|
|
import commonModal from '@/views/common/commonModal.vue'
|
|
import commonModal from '@/views/common/commonModal.vue'
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
-// import chooseDepartUserModal from './chooseDepartUserModal.vue'
|
|
|
|
|
|
+import chooseDepartUserModal from './chooseDepartUserModal.vue'
|
|
import returnReason from '@/views/common/returnReason'
|
|
import returnReason from '@/views/common/returnReason'
|
|
import {
|
|
import {
|
|
salesReturnDetail,
|
|
salesReturnDetail,
|
|
@@ -157,8 +153,10 @@ import {
|
|
salesReturnDetailUpdateReason,
|
|
salesReturnDetailUpdateReason,
|
|
salesReturnDetailSetReason
|
|
salesReturnDetailSetReason
|
|
} from '@/api/salesReturnDetail'
|
|
} from '@/api/salesReturnDetail'
|
|
|
|
+import { sparePartsReturnQueryPage, queryPageCount,sparePartsReturnDetailDelete,sparePartsReturnDetailSave,sparePartsReturnSubmit} from '@/api/sparePartsReturn'
|
|
|
|
+import { toFixedDecimal } from '@/libs/tools.js'
|
|
export default {
|
|
export default {
|
|
- name: 'PurchaseReturnDeatil',
|
|
|
|
|
|
+ name: 'purchaseReturnEdit',
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
components: {
|
|
components: {
|
|
STable,
|
|
STable,
|
|
@@ -167,7 +165,8 @@ export default {
|
|
returnReason,
|
|
returnReason,
|
|
commonModal,
|
|
commonModal,
|
|
queryPart,
|
|
queryPart,
|
|
- addModal
|
|
|
|
|
|
+ addModal,
|
|
|
|
+ chooseDepartUserModal
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -183,29 +182,38 @@ export default {
|
|
// 已选产品
|
|
// 已选产品
|
|
dataSource: [],
|
|
dataSource: [],
|
|
productForm: {
|
|
productForm: {
|
|
- salesReturnBillSn: '',
|
|
|
|
|
|
+ sn: '',
|
|
productName: '',
|
|
productName: '',
|
|
productCode: ''
|
|
productCode: ''
|
|
},
|
|
},
|
|
chooseLoadData: [],
|
|
chooseLoadData: [],
|
|
|
|
+ columns :[
|
|
|
|
+ { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
|
|
|
|
+ { title: '产品编码', dataIndex: 'product.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' }},
|
|
|
|
+ { title: '产品名称', dataIndex: 'product.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '单位', dataIndex: 'product.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' }},
|
|
|
|
+ { title: '退货单价', dataIndex: 'cost', align: 'center', width: '8%',customRender: function (text) { return text || '--' }},
|
|
|
|
+ { title: '申请退货数量', align: 'center', width: '13%', scopedSlots: { customRender: 'returnQty' }},
|
|
|
|
+ { title: '退款金额', dataIndex: 'totalCost', align: 'center', width: '13%', customRender: function (text) { return text || '--' }},
|
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
|
+ ],
|
|
// 加载数据方法 必须为 Promise 对象
|
|
// 加载数据方法 必须为 Promise 对象
|
|
loadData: parameter => {
|
|
loadData: parameter => {
|
|
this.disabled = true
|
|
this.disabled = true
|
|
- // 查询总计
|
|
|
|
- this.productForm.salesReturnBillSn = '481487002858102784'
|
|
|
|
- return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
|
|
|
|
|
|
+ this.productForm.sn = this.$route.params.returnSn;
|
|
|
|
+ return sparePartsReturnQueryPage(Object.assign(parameter, this.productForm)).then(res => {
|
|
let data
|
|
let data
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
data = res.data
|
|
data = res.data
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
data.list[i].no = no + i + 1
|
|
data.list[i].no = no + i + 1
|
|
- data.list[i].qtyBackups = data.list[i].initialQty
|
|
|
|
- data.list[i].returnReasonBackups = data.list[i].returnReason
|
|
|
|
|
|
+ // data.list[i].qtyBackups = data.list[i].initialQty
|
|
|
|
+ // data.list[i].returnReasonBackups = data.list[i].returnReason
|
|
}
|
|
}
|
|
this.disabled = false
|
|
this.disabled = false
|
|
- this.chooseLoadData = data.list
|
|
|
|
- this.total = res.data.count
|
|
|
|
|
|
+ // this.chooseLoadData = data.list
|
|
|
|
+ // this.total = res.data.count
|
|
}
|
|
}
|
|
return data
|
|
return data
|
|
})
|
|
})
|
|
@@ -215,7 +223,8 @@ export default {
|
|
rowSelectionInfo: null,
|
|
rowSelectionInfo: null,
|
|
plReturnReason: '',
|
|
plReturnReason: '',
|
|
showPlModal: false,
|
|
showPlModal: false,
|
|
- openModal: false
|
|
|
|
|
|
+ openModal: false,
|
|
|
|
+ statisticsObj:null
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -228,23 +237,6 @@ export default {
|
|
computed: {
|
|
computed: {
|
|
selNums () {
|
|
selNums () {
|
|
return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
|
|
return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
|
|
- },
|
|
|
|
- columns () {
|
|
|
|
- const arr = [
|
|
|
|
- { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
|
|
|
|
- { title: '产品编码', dataIndex: 'productEntity.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
- { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
|
|
|
|
- { title: '退货单价', dataIndex: 'initialQty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
|
|
|
|
- { title: '申请退款数量', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
|
|
|
|
- { title: '退款金额', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
|
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
|
- ]
|
|
|
|
- // if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
|
|
|
|
- // arr.splice(4, 0, { title: '参考退货单价', dataIndex: 'price', align: 'center', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
|
|
|
|
- // arr.splice(7, 0, { title: '参考退货金额', align: 'center', dataIndex: 'totalAmount', width: '8%', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
|
|
|
|
- // }
|
|
|
|
- return arr
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -344,7 +336,7 @@ export default {
|
|
this.ordeDetail = res.data || null
|
|
this.ordeDetail = res.data || null
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 删除产品
|
|
|
|
|
|
+ // 删除所选产品
|
|
handleDel (row) {
|
|
handleDel (row) {
|
|
const _this = this
|
|
const _this = this
|
|
this.$confirm({
|
|
this.$confirm({
|
|
@@ -355,7 +347,7 @@ export default {
|
|
onOk () {
|
|
onOk () {
|
|
_this.delLoading = true
|
|
_this.delLoading = true
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
- salesReturnDetailDel({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
|
|
|
|
|
|
+ sparePartsReturnDetailDelete({ detailSn: row.sparePartsReturnDetailSn }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.resetTable(false)
|
|
_this.resetTable(false)
|
|
}
|
|
}
|
|
@@ -368,60 +360,69 @@ export default {
|
|
},
|
|
},
|
|
resetTable (flag) {
|
|
resetTable (flag) {
|
|
this.$refs.table.refresh(flag)
|
|
this.$refs.table.refresh(flag)
|
|
- this.getOrderDetail()
|
|
|
|
|
|
+ // this.getOrderDetail()
|
|
},
|
|
},
|
|
// 重置
|
|
// 重置
|
|
resetSearchForm (flag) {
|
|
resetSearchForm (flag) {
|
|
this.productForm.productName = ''
|
|
this.productForm.productName = ''
|
|
this.productForm.productCode = ''
|
|
this.productForm.productCode = ''
|
|
this.$refs.table.refresh(!!flag)
|
|
this.$refs.table.refresh(!!flag)
|
|
- this.getOrderDetail()
|
|
|
|
|
|
+ // this.getOrderDetail()
|
|
},
|
|
},
|
|
// 添加或修改产品
|
|
// 添加或修改产品
|
|
saveProduct (row) {
|
|
saveProduct (row) {
|
|
- // 防止多次添加产品
|
|
|
|
- if (this.isInster) {
|
|
|
|
|
|
+ if (this.isInster) {// 防止多次添加产品
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.isInster = true
|
|
this.isInster = true
|
|
- const params = {
|
|
|
|
- 'salesReturnBillSn': this.orderSn,
|
|
|
|
- 'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
|
|
|
|
- 'price': row.productPrice,
|
|
|
|
- 'cost': row.lastStockCost,
|
|
|
|
- 'returnReason': row.returnReason,
|
|
|
|
- 'productSn': row.productSn,
|
|
|
|
- 'initialQty': row.qty
|
|
|
|
|
|
+ const paramsData = {
|
|
|
|
+ 'sparePartsReturnSn': this.orderSn,
|
|
|
|
+ 'sparePartsReturnNo': this.ordeDetail.salesReturnBillNo,
|
|
|
|
+ 'sparePartsDetailSn': row.productPrice,
|
|
|
|
+ 'productSn': row.lastStockCost,
|
|
|
|
+ 'productCode': row.returnReason,
|
|
|
|
+ 'putQty': row.productSn,
|
|
|
|
+ 'returnedQty': row.qty,
|
|
|
|
+ 'qty': row.qty,
|
|
|
|
+ 'cost': row.qty,
|
|
|
|
+ 'stockBatchNo': row.qty,
|
|
|
|
+ 'warehouseSn': row.qty,
|
|
|
|
+ 'warehouseLocationSn': row.qty
|
|
}
|
|
}
|
|
this.spinning = true
|
|
this.spinning = true
|
|
- salesReturnDetailInsert(params).then(res => {
|
|
|
|
|
|
+ this.saveEdit(paramsData);
|
|
|
|
+ },
|
|
|
|
+ saveEdit(params){
|
|
|
|
+ sparePartsReturnDetailSave(params).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
this.resetSearchForm(true)
|
|
this.resetSearchForm(true)
|
|
- this.$message.success(res.message)
|
|
|
|
|
|
+ // this.$message.success(res.message)
|
|
}
|
|
}
|
|
this.isInster = false
|
|
this.isInster = false
|
|
this.spinning = false
|
|
this.spinning = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+
|
|
beforeSubmit () {
|
|
beforeSubmit () {
|
|
- if (this.total) {
|
|
|
|
- const hasKong = this.chooseLoadData.find(item => !item.returnReason)
|
|
|
|
- if (hasKong) {
|
|
|
|
- this.$message.warning('请输入退货原因!')
|
|
|
|
- } else {
|
|
|
|
- this.openDepartUserModal = true
|
|
|
|
- if (this.ordeDetail.billStatus == 'AUDIT_REJECT') {
|
|
|
|
- this.$refs.chooseDepart.getDetail(this.ordeDetail)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- this.$message.warning('请添加产品!')
|
|
|
|
- }
|
|
|
|
|
|
+ this.openDepartUserModal = true
|
|
|
|
+ // if (this.total) {
|
|
|
|
+ // const hasKong = this.chooseLoadData.find(item => !item.returnReason)
|
|
|
|
+ // if (hasKong) {
|
|
|
|
+ // this.$message.warning('请输入退货原因!')
|
|
|
|
+ // } else {
|
|
|
|
+ // this.openDepartUserModal = true
|
|
|
|
+ // if (this.ordeDetail.billStatus == 'AUDIT_REJECT') {
|
|
|
|
+ // this.$refs.chooseDepart.getDetail(this.ordeDetail)
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$message.warning('请添加产品!')
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
// 提交销售退货
|
|
// 提交销售退货
|
|
handleSubmit (data) {
|
|
handleSubmit (data) {
|
|
this.spinning = true
|
|
this.spinning = true
|
|
- salesReturnSubmit({ salesReturnBillSn: this.orderSn, ...data }).then(res => {
|
|
|
|
|
|
+ sparePartsReturnSubmit({ sparePartsReturnSn: this.sparePartsReturnSn, ...data }).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
this.handleBack()
|
|
this.handleBack()
|
|
this.$message.success(res.message)
|
|
this.$message.success(res.message)
|
|
@@ -460,16 +461,28 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
pageInit () {
|
|
pageInit () {
|
|
- this.orderSn = this.$route.params.sn
|
|
|
|
- this.buyerSn = this.$route.params.buyerSn
|
|
|
|
|
|
+ this.sparePartsNo = this.$route.params.no
|
|
|
|
+ this.sparePartsReturnSn = this.$route.params.returnSn
|
|
this.resetSearchForm(true)
|
|
this.resetSearchForm(true)
|
|
- this.$refs.partQuery.pageInit(this.buyerSn, 0)
|
|
|
|
|
|
+ this.$refs.partQuery.pageInit(this.sparePartsNo, 0)
|
|
|
|
+ },
|
|
|
|
+ getStatisticsData () {
|
|
|
|
+ queryPageCount({ sn: this.$route.params.returnSn }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ res.data.totalCost =(res.data&&(res.data.totalCost ||res.data.totalCost==0)) ? toFixedDecimal(res.data.totalCost,2):'--'
|
|
|
|
+ this.statisticsObj = res.data
|
|
|
|
+ } else {
|
|
|
|
+ this.statisticsObj = null
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
this.pageInit()
|
|
this.pageInit()
|
|
}
|
|
}
|
|
|
|
+ // 获取页面统计数据
|
|
|
|
+ this.getStatisticsData();
|
|
},
|
|
},
|
|
activated () {
|
|
activated () {
|
|
// 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|
|
// 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
|