|
@@ -38,7 +38,7 @@
|
|
</a-page-header>
|
|
</a-page-header>
|
|
<a-card size="small" :bordered="false" class="salesReturnEdit-cont">
|
|
<a-card size="small" :bordered="false" class="salesReturnEdit-cont">
|
|
<!-- 查询配件列表 -->
|
|
<!-- 查询配件列表 -->
|
|
- <queryPart ref="partQuery" :returnReasonList="returnReasonList" :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">
|
|
@@ -50,7 +50,7 @@
|
|
</div>
|
|
</div>
|
|
</a-alert>
|
|
</a-alert>
|
|
<div class="table-page-search-wrapper" style="display:flex;align-items: center;justify-content: space-between;">
|
|
<div class="table-page-search-wrapper" style="display:flex;align-items: center;justify-content: space-between;">
|
|
- <div style="width:80%;">
|
|
|
|
|
|
+ <div style="flex-grow:1;">
|
|
<a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
<a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
<a-row :gutter="15">
|
|
<a-row :gutter="15">
|
|
<a-col :md="6" :sm="24">
|
|
<a-col :md="6" :sm="24">
|
|
@@ -71,6 +71,8 @@
|
|
</a-form>
|
|
</a-form>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
|
|
+ <span style="margin-right: 10px;" v-if="selNums">已选{{ selNums }}项</span>
|
|
|
|
+ <a-button type="default" class="button-info" @click="openPlSetReason">批量设置退货原因</a-button>
|
|
<a-button type="primary" class="button-info" id="salesReturnEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
|
|
<a-button type="primary" class="button-info" id="salesReturnEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -80,6 +82,8 @@
|
|
ref="table"
|
|
ref="table"
|
|
size="small"
|
|
size="small"
|
|
:rowKey="(record) => record.id"
|
|
:rowKey="(record) => record.id"
|
|
|
|
+ :row-selection="{ columnWidth: 40 }"
|
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
:columns="columns"
|
|
:columns="columns"
|
|
:data="loadData"
|
|
:data="loadData"
|
|
:defaultLoadData="false"
|
|
:defaultLoadData="false"
|
|
@@ -100,16 +104,7 @@
|
|
</template>
|
|
</template>
|
|
<!-- 退货原因 -->
|
|
<!-- 退货原因 -->
|
|
<template slot="returnReason" slot-scope="text, record">
|
|
<template slot="returnReason" slot-scope="text, record">
|
|
- <a-select
|
|
|
|
- style="width:100%;"
|
|
|
|
- v-model="record.returnReason"
|
|
|
|
- @change="updateReason(record)"
|
|
|
|
- placeholder="请选择退货原因"
|
|
|
|
- >
|
|
|
|
- <a-select-option v-for="item in returnReasonList" :value="item.code">
|
|
|
|
- {{ item.dispName }}
|
|
|
|
- </a-select-option>
|
|
|
|
- </a-select>
|
|
|
|
|
|
+ <returnReason v-model="record.returnReason" @blur="updateReason(record)"></returnReason>
|
|
</template>
|
|
</template>
|
|
<!-- 操作 -->
|
|
<!-- 操作 -->
|
|
<template slot="action" slot-scope="text, record">
|
|
<template slot="action" slot-scope="text, record">
|
|
@@ -138,6 +133,15 @@
|
|
<chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
|
|
<chooseDepartUserModal :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" />
|
|
|
|
+ <!-- 批量设置退货原因 -->
|
|
|
|
+ <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
|
|
|
|
+ <div style="text-align: center;">
|
|
|
|
+ <div style="margin-bottom: 15px;font-size: 14px;"><strong>请输入退货原因</strong></div>
|
|
|
|
+ <div style="line-height: 24px;">
|
|
|
|
+ <div><returnReason size="large" v-model="plReturnReason"></returnReason></div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </commonModal>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -147,15 +151,24 @@ import { STable, VSelect } from '@/components'
|
|
import { printFun, exportExcel } from '@/libs/JGPrint.js'
|
|
import { printFun, exportExcel } from '@/libs/JGPrint.js'
|
|
import ImportGuideModal from './importGuideModal.vue'
|
|
import ImportGuideModal from './importGuideModal.vue'
|
|
import queryPart from './queryPart.vue'
|
|
import queryPart from './queryPart.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 { salesReturnDetail, salesReturnSubmit, salesReturnBatchInsert, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
|
|
|
|
|
|
+import returnReason from '@/views/common/returnReason'
|
|
|
|
+import {
|
|
|
|
+ salesReturnDetail,
|
|
|
|
+ salesReturnSubmit,
|
|
|
|
+ salesReturnBatchInsert,
|
|
|
|
+ salesReturnPrint,
|
|
|
|
+ salesReturnExport
|
|
|
|
+} from '@/api/salesReturn'
|
|
import {
|
|
import {
|
|
salesReturnDetailList,
|
|
salesReturnDetailList,
|
|
salesReturnDetailDel,
|
|
salesReturnDetailDel,
|
|
salesReturnDetailInsert,
|
|
salesReturnDetailInsert,
|
|
salesReturnDetailUpdateQty,
|
|
salesReturnDetailUpdateQty,
|
|
- salesReturnDetailUpdateReason
|
|
|
|
|
|
+ salesReturnDetailUpdateReason,
|
|
|
|
+ salesReturnDetailSetReason
|
|
} from '@/api/salesReturnDetail'
|
|
} from '@/api/salesReturnDetail'
|
|
export default {
|
|
export default {
|
|
name: 'SalesReturnEdit',
|
|
name: 'SalesReturnEdit',
|
|
@@ -166,7 +179,9 @@ export default {
|
|
queryPart,
|
|
queryPart,
|
|
EditableCell,
|
|
EditableCell,
|
|
ImportGuideModal,
|
|
ImportGuideModal,
|
|
- chooseDepartUserModal
|
|
|
|
|
|
+ chooseDepartUserModal,
|
|
|
|
+ returnReason,
|
|
|
|
+ commonModal
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -200,7 +215,7 @@ export default {
|
|
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].qtyBackups = data.list[i].initialQty
|
|
- data.list[i].priceBackups = data.list[i].price
|
|
|
|
|
|
+ data.list[i].returnReasonBackups = data.list[i].returnReason
|
|
}
|
|
}
|
|
this.disabled = false
|
|
this.disabled = false
|
|
this.chooseLoadData = data.list
|
|
this.chooseLoadData = data.list
|
|
@@ -211,10 +226,15 @@ export default {
|
|
},
|
|
},
|
|
openGuideModal: false, // 导入产品引导
|
|
openGuideModal: false, // 导入产品引导
|
|
total: 0,
|
|
total: 0,
|
|
- returnReasonList: [] // 申请退货列表
|
|
|
|
|
|
+ rowSelectionInfo: null,
|
|
|
|
+ plReturnReason: '',
|
|
|
|
+ showPlModal: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
|
|
+ selNums () {
|
|
|
|
+ return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
|
|
|
|
+ },
|
|
columns () {
|
|
columns () {
|
|
const arr = [
|
|
const arr = [
|
|
{ title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
|
|
{ title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
|
|
@@ -237,6 +257,10 @@ export default {
|
|
handleBack () {
|
|
handleBack () {
|
|
this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
|
|
this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
|
|
},
|
|
},
|
|
|
|
+ // 表格选中项
|
|
|
|
+ rowSelectionFun (obj) {
|
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
|
+ },
|
|
// 已选产品 blur
|
|
// 已选产品 blur
|
|
onCellBlur (val, record, type) {
|
|
onCellBlur (val, record, type) {
|
|
const valBackups = record.qtyBackups
|
|
const valBackups = record.qtyBackups
|
|
@@ -264,6 +288,12 @@ export default {
|
|
},
|
|
},
|
|
// 修改退货原因
|
|
// 修改退货原因
|
|
updateReason (row) {
|
|
updateReason (row) {
|
|
|
|
+ console.log(row.returnReason)
|
|
|
|
+ // 空或没有改变时不保存数据
|
|
|
|
+ if (!row.returnReason || row.returnReason == row.returnReasonBackups) {
|
|
|
|
+ row.returnReason = row.returnReasonBackups
|
|
|
|
+ return
|
|
|
|
+ }
|
|
this.spinning = true
|
|
this.spinning = true
|
|
salesReturnDetailUpdateReason({
|
|
salesReturnDetailUpdateReason({
|
|
salesReturnDetailSn: row.salesReturnDetailSn,
|
|
salesReturnDetailSn: row.salesReturnDetailSn,
|
|
@@ -272,10 +302,43 @@ export default {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
this.resetTable(false)
|
|
this.resetTable(false)
|
|
this.$message.success(res.message)
|
|
this.$message.success(res.message)
|
|
|
|
+ } else {
|
|
|
|
+ row.returnReason = row.returnReasonBackups
|
|
}
|
|
}
|
|
this.spinning = false
|
|
this.spinning = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 批量设置退货原因
|
|
|
|
+ openPlSetReason () {
|
|
|
|
+ if (this.selNums) {
|
|
|
|
+ this.showPlModal = true
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.warning('请先选择产品!')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ setPlReturnReason () {
|
|
|
|
+ if (this.plReturnReason == '') {
|
|
|
|
+ this.$message.warning('请输入退货原因!')
|
|
|
|
+ } else {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ const snList = []
|
|
|
|
+ const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
|
|
|
|
+ arr.map(item => {
|
|
|
|
+ snList.push(item.salesReturnDetailSn)
|
|
|
|
+ })
|
|
|
|
+ salesReturnDetailSetReason({
|
|
|
|
+ salesReturnBillDetailSnList: snList,
|
|
|
|
+ returnReason: this.plReturnReason
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.showPlModal = false
|
|
|
|
+ this.$refs.table.clearSelected()
|
|
|
|
+ this.resetTable(false)
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 获取单据详细
|
|
// 获取单据详细
|
|
getOrderDetail () {
|
|
getOrderDetail () {
|
|
salesReturnDetail({ sn: this.orderSn }).then(res => {
|
|
salesReturnDetail({ sn: this.orderSn }).then(res => {
|
|
@@ -317,15 +380,10 @@ export default {
|
|
},
|
|
},
|
|
// 添加或修改产品
|
|
// 添加或修改产品
|
|
saveProduct (row) {
|
|
saveProduct (row) {
|
|
- console.log(row)
|
|
|
|
// 防止多次添加产品
|
|
// 防止多次添加产品
|
|
if (this.isInster) {
|
|
if (this.isInster) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if (!row.returnReason) {
|
|
|
|
- this.$message.info('请选择退货原因')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
this.isInster = true
|
|
this.isInster = true
|
|
const params = {
|
|
const params = {
|
|
'salesReturnBillSn': this.orderSn,
|
|
'salesReturnBillSn': this.orderSn,
|
|
@@ -348,9 +406,14 @@ export default {
|
|
},
|
|
},
|
|
beforeSubmit () {
|
|
beforeSubmit () {
|
|
if (this.total) {
|
|
if (this.total) {
|
|
- this.openDepartUserModal = true
|
|
|
|
|
|
+ const hasKong = this.chooseLoadData.find(item => !item.returnReason)
|
|
|
|
+ if (hasKong) {
|
|
|
|
+ this.$message.warning('请输入退货原因!')
|
|
|
|
+ } else {
|
|
|
|
+ this.openDepartUserModal = true
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- this.$message.info('请添加产品')
|
|
|
|
|
|
+ this.$message.warning('请添加产品!')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 提交销售退货
|
|
// 提交销售退货
|
|
@@ -399,7 +462,6 @@ export default {
|
|
this.buyerSn = this.$route.params.buyerSn
|
|
this.buyerSn = this.$route.params.buyerSn
|
|
this.resetSearchForm(true)
|
|
this.resetSearchForm(true)
|
|
this.$refs.partQuery.pageInit(this.buyerSn, 0)
|
|
this.$refs.partQuery.pageInit(this.buyerSn, 0)
|
|
- this.returnReasonList = this.$store.state.app.returnReason
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|