|
@@ -73,16 +73,7 @@
|
|
|
</template>
|
|
|
<!-- 退货原因 -->
|
|
|
<template slot="returnReason" slot-scope="text, record">
|
|
|
- <a-select
|
|
|
- style="width:100%;"
|
|
|
- size="small"
|
|
|
- v-model="record.returnReason"
|
|
|
- placeholder="请选择退货原因"
|
|
|
- allowClear>
|
|
|
- <a-select-option v-for="item in returnReasonList" :value="item.code">
|
|
|
- {{ item.dispName }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
+ <returnReason v-model="record.returnReason"></returnReason>
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
@@ -109,12 +100,12 @@
|
|
|
<!-- 总计 -->
|
|
|
<a-alert type="info" style="margin-bottom:10px">
|
|
|
<div slot="message">
|
|
|
- 申请退货数量:<strong>{{ (detailData&&(detailData.totalQty || detailData.totalQty==0)) ? detailData.totalQty : '--' }}</strong> ;
|
|
|
+ 申请退货数量:<strong>{{ (detailData&&(detailData.totalInitialQty || detailData.totalInitialQty==0)) ? detailData.totalInitialQty : '--' }}</strong> ;
|
|
|
</div>
|
|
|
</a-alert>
|
|
|
<!-- 筛选条件 -->
|
|
|
<div class="table-page-search-wrapper" style="display:flex;width:100%;">
|
|
|
- <div style="width:80%;">
|
|
|
+ <div style="flex-grow:1;">
|
|
|
<a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
@@ -134,12 +125,15 @@
|
|
|
</a-row>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
- <div style="text-align:right;width:20%;">
|
|
|
+ <div>
|
|
|
+ <span style="margin-right: 10px;" v-if="selNums">已选{{ selNums }}项</span>
|
|
|
+ <a-button type="default" style="margin-right: 10px;" class="button-info" @click="openPlSetReason">批量设置退货原因</a-button>
|
|
|
<a-button
|
|
|
- type="default"
|
|
|
+ type="primary"
|
|
|
id="purchaseReturnEdit-import-btn"
|
|
|
+ class="button-info"
|
|
|
@click="openGuideModal = true"
|
|
|
- style="margin-right: 10px;">产品导入</a-button>
|
|
|
+ >产品导入</a-button>
|
|
|
<a-button
|
|
|
type="primary"
|
|
|
class="button-error"
|
|
@@ -154,6 +148,8 @@
|
|
|
ref="chooseTable"
|
|
|
size="small"
|
|
|
:rowKey="(record) => record.id"
|
|
|
+ :row-selection="{ columnWidth: 40 }"
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
:columns="chooseColumns"
|
|
|
:data="chooseLoadData"
|
|
|
:defaultLoadData="false"
|
|
@@ -170,7 +166,7 @@
|
|
|
<a-input-number
|
|
|
size="small"
|
|
|
id="purchaseReturnEdit-qty"
|
|
|
- v-model="record.qty"
|
|
|
+ v-model="record.initQty"
|
|
|
:precision="0"
|
|
|
:min="1"
|
|
|
placeholder="请输入"
|
|
@@ -179,17 +175,7 @@
|
|
|
</template>
|
|
|
<!-- 退货原因 -->
|
|
|
<template slot="returnReason" slot-scope="text, record">
|
|
|
- <a-select
|
|
|
- style="width:100%;"
|
|
|
- size="small"
|
|
|
- v-model="record.returnReason"
|
|
|
- placeholder="请选择退货原因"
|
|
|
- @change="e => remarksBlur(e, record)"
|
|
|
- allowClear>
|
|
|
- <a-select-option v-for="item in returnReasonList" :value="item.code">
|
|
|
- {{ item.dispName }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
+ <returnReason v-model="record.returnReason" @blur="e => remarksBlur(e, record)"></returnReason>
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
@@ -217,6 +203,16 @@
|
|
|
:params="{purchaseReturnApplySn: $route.params.sn, purchaseReturnApplyNo:detailData?detailData.purchaseReturnApplyNo:''}"
|
|
|
@close="openGuideModal=false"
|
|
|
@ok="hanldeImprotOk" />
|
|
|
+
|
|
|
+ <!-- 批量设置退货原因 -->
|
|
|
+ <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @close="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>
|
|
|
</template>
|
|
|
|
|
@@ -225,9 +221,10 @@ import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import Print from '@/views/common/print.vue'
|
|
|
import { hdPrint } from '@/libs/JGPrint'
|
|
|
+import returnReason from '@/views/common/returnReason'
|
|
|
+import commonModal from '@/views/common/commonModal.vue'
|
|
|
import ProductType from '../../common/productType.js'
|
|
|
import importGuideModal from './importGuideModal.vue'
|
|
|
-import { productList } from '@/api/product'
|
|
|
import {
|
|
|
purchaseReturnDetailList,
|
|
|
purchaseReturnDetail,
|
|
@@ -239,10 +236,12 @@ import {
|
|
|
purchaseReturnSubmit,
|
|
|
purchaseReturnApplyPrint,
|
|
|
purchaseReturnApplyExport,
|
|
|
- purchaseReturnApplyCreateList } from '@/api/purchaseReturnApply'
|
|
|
+ purchaseReturnApplyCreateList,
|
|
|
+ queryDealerScopeProductPage,
|
|
|
+ modifyReturnReasonList } from '@/api/purchaseReturnApply'
|
|
|
export default {
|
|
|
name: 'PurchaseReturnEdit',
|
|
|
- components: { STable, VSelect, Print, ProductType, importGuideModal },
|
|
|
+ components: { STable, VSelect, Print, ProductType, importGuideModal, returnReason, commonModal },
|
|
|
mixins: [commonMixin],
|
|
|
data () {
|
|
|
return {
|
|
@@ -264,7 +263,7 @@ export default {
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
this.queryParam.sysFlag = '1' // 剪冠产品
|
|
|
- return productList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ return queryDealerScopeProductPage(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++) {
|
|
@@ -286,17 +285,30 @@ export default {
|
|
|
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].qtyBackups = data.list[i].initQty
|
|
|
data.list[i].returnReasonBackups = data.list[i].returnReason
|
|
|
}
|
|
|
this.dataSource = data.list
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- detailData: null
|
|
|
+ detailData: null,
|
|
|
+ rowSelectionInfo: null,
|
|
|
+ plReturnReason: '',
|
|
|
+ showPlModal: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ showPlModal (newValue, oldValue) {
|
|
|
+ if (!newValue) {
|
|
|
+ this.plReturnReason = ''
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ selNums () {
|
|
|
+ return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
|
|
|
+ },
|
|
|
columns () {
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
|
|
@@ -329,6 +341,10 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'purchaseReturnApplyFormList' })
|
|
|
},
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
// 打印预览/快捷打印
|
|
|
handlePrint (type, printerType) {
|
|
|
const _this = this
|
|
@@ -378,13 +394,9 @@ export default {
|
|
|
this.$message.warning('请输入退货数量')
|
|
|
return
|
|
|
}
|
|
|
- if (!row.returnReason) {
|
|
|
- this.$message.warning('请选择退货原因')
|
|
|
- return
|
|
|
- }
|
|
|
const params = {
|
|
|
purchaseReturnApplySn: this.$route.params.sn,
|
|
|
- qty: row.returnQty, // 退货数量
|
|
|
+ initQty: row.returnQty, // 退货数量
|
|
|
productSn: row.productSn,
|
|
|
returnReason: row.returnReason
|
|
|
}
|
|
@@ -438,7 +450,7 @@ export default {
|
|
|
fun(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.$message.success(res.message)
|
|
|
- _this.$refs.table.refresh()
|
|
|
+ // _this.$refs.table.refresh()
|
|
|
_this.$refs.chooseTable.refresh()
|
|
|
_this.spinning = false
|
|
|
_this.getDetail()
|
|
@@ -459,14 +471,18 @@ export default {
|
|
|
_this.spinning = true
|
|
|
purchaseReturnSubmit({ sn: _this.$route.params.sn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.$message.success(res.message)
|
|
|
- setTimeout(() => {
|
|
|
+ if (res.data.length) {
|
|
|
+ _this.$warning({
|
|
|
+ title: '以下产品请输入退货原因',
|
|
|
+ centered: true,
|
|
|
+ content: res.data.toString()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ _this.$message.success(res.message)
|
|
|
_this.handleBack()
|
|
|
- _this.spinning = false
|
|
|
- }, 1000)
|
|
|
- } else {
|
|
|
- _this.spinning = false
|
|
|
+ }
|
|
|
}
|
|
|
+ _this.spinning = false
|
|
|
})
|
|
|
},
|
|
|
// 已选产品 退货数量修改
|
|
@@ -475,17 +491,17 @@ export default {
|
|
|
if (val != record.qtyBackups) {
|
|
|
this.spinning = true
|
|
|
purchaseReturnModifyQty({
|
|
|
- qty: record.qty,
|
|
|
+ initQty: record.initQty,
|
|
|
purchaseReturnApplyDetailSn: record.purchaseReturnApplyDetailSn,
|
|
|
purchaseReturnApplySn: this.$route.params.sn
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.$message.success(res.message)
|
|
|
this.$refs.chooseTable.refresh()
|
|
|
- record.qtyBackups = record.qty
|
|
|
+ record.qtyBackups = record.initQty
|
|
|
this.getDetail()
|
|
|
} else {
|
|
|
- record.qty = record.qtyBackups
|
|
|
+ record.initQty = record.qtyBackups
|
|
|
}
|
|
|
this.spinning = false
|
|
|
})
|
|
@@ -493,19 +509,55 @@ export default {
|
|
|
},
|
|
|
// 已选产品 退货原因修改
|
|
|
remarksBlur (val, record) {
|
|
|
- if (val && (val != record.returnReasonBackups)) {
|
|
|
+ // 空或没有改变时不保存数据
|
|
|
+ if (!record.returnReason || record.returnReason == record.returnReasonBackups) {
|
|
|
+ record.returnReason = record.returnReasonBackups
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.spinning = true
|
|
|
+ modifyReturnReason({
|
|
|
+ returnReason: record.returnReason,
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 批量设置退货原因
|
|
|
+ openPlSetReason () {
|
|
|
+ if (this.selNums) {
|
|
|
+ this.showPlModal = true
|
|
|
+ } else {
|
|
|
+ this.$message.warning('请先选择产品!')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setPlReturnReason () {
|
|
|
+ if (this.plReturnReason == '') {
|
|
|
+ this.$message.warning('请输入退货原因!')
|
|
|
+ } else {
|
|
|
this.spinning = true
|
|
|
- modifyReturnReason({
|
|
|
- returnReason: record.returnReason,
|
|
|
- purchaseReturnApplyDetailSn: record.purchaseReturnApplyDetailSn,
|
|
|
- purchaseReturnApplySn: this.$route.params.sn
|
|
|
+ const snList = []
|
|
|
+ const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
|
|
|
+ arr.map(item => {
|
|
|
+ snList.push({
|
|
|
+ purchaseReturnApplyDetailSn: item.purchaseReturnApplyDetailSn,
|
|
|
+ returnReason: this.plReturnReason
|
|
|
+ })
|
|
|
+ })
|
|
|
+ modifyReturnReasonList({
|
|
|
+ purchaseReturnApplySn: this.$route.params.sn,
|
|
|
+ detailList: snList
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.$message.success(res.message)
|
|
|
+ this.showPlModal = false
|
|
|
this.$refs.chooseTable.refresh()
|
|
|
- record.returnReasonBackups = record.returnReason
|
|
|
- } else {
|
|
|
- record.returnReason = record.returnReasonBackups
|
|
|
+ this.$refs.chooseTable.clearSelected()
|
|
|
}
|
|
|
this.spinning = false
|
|
|
})
|