|
@@ -22,7 +22,7 @@
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
<div style="border-top:1px solid #eee;padding-top:10px;">
|
|
|
- <a-button type="primary" :loading="loading" class="button-info" @click="handleAdd">新增产品</a-button>
|
|
|
+ <a-button type="primary" :loading="loading" class="button-info" @click="openModal = true">新增产品</a-button>
|
|
|
<a-button type="primary" :loading="loading" class="button-error" @click="handlePlss">批量实收</a-button>
|
|
|
<div style="float:right;color:#999;margin-top:8px;">说明:红色行表示收货时新增的产品</div>
|
|
|
</div>
|
|
@@ -34,7 +34,7 @@
|
|
|
:rowClassName="(record, index) => record.addFlag == '1' ? (record.addType == 'WAREHOUSE_RECEIVE'?'redBg-row':'orgBg-row'):''"
|
|
|
size="small"
|
|
|
:rowKey="(record) => record.id"
|
|
|
- :row-selection="{ columnWidth: 40 }"
|
|
|
+ :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: record.addFlag == '1' }}) }"
|
|
|
@rowSelection="rowSelectionFun"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
@@ -49,6 +49,7 @@
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
|
:max="999999"
|
|
|
+ @blur="e => onCellBlurReceiveQty(e.target.value, record)"
|
|
|
placeholder="请输入"
|
|
|
style="width: 100%;" />
|
|
|
</template>
|
|
@@ -57,6 +58,7 @@
|
|
|
<a-select
|
|
|
style="width:100%;"
|
|
|
v-model="record.returnReason"
|
|
|
+ @change="e => onCellBlurReturnReason(e, record)"
|
|
|
placeholder="请选择退货原因"
|
|
|
allowClear>
|
|
|
<a-select-option v-for="item in returnReasonList" :value="item.code">
|
|
@@ -66,12 +68,15 @@
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
- <a-button
|
|
|
- size="small"
|
|
|
- type="link"
|
|
|
- class="button-warning"
|
|
|
- @click="handleDel(record)"
|
|
|
- id="salesReturn-eexamine-btn">删除</a-button>
|
|
|
+ <div>
|
|
|
+ <a-button
|
|
|
+ v-if="record.addFlag == '1'&&record.addType == 'WAREHOUSE_RECEIVE'"
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-warning"
|
|
|
+ @click="handleDel(record)"
|
|
|
+ >删除</a-button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
@@ -86,34 +91,36 @@
|
|
|
@click="handleSubmit()"
|
|
|
id="salesReturn-handleSubmit">提交</a-button>
|
|
|
</div>
|
|
|
+
|
|
|
+ <!-- 添加产品 -->
|
|
|
+ <chooseProductsModal ref="chooseProduct" :openModal="openModal" :buyerSn="$route.params.buyerSn" @close="openModal=false" @addProduct="addProduct"></chooseProductsModal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { salesReturnDetail, salesReturnCheck } from '@/api/salesReturn'
|
|
|
+import chooseProductsModal from './chooseProductsModal.vue'
|
|
|
+import { salesReturnDetail, salesReturnReceive } from '@/api/salesReturn'
|
|
|
import {
|
|
|
- salesReturnDetailList,
|
|
|
- updateBackStockQty
|
|
|
+ salesReturnDetailList, salesReturnDetailReceiveBatch, salesReturnDetailUpdateReceiveQty, salesReturnDetailUpdateReason, insertByReceive, deleteByReceiver
|
|
|
} from '@/api/salesReturnDetail'
|
|
|
export default {
|
|
|
- name: 'SalesReturnCheck',
|
|
|
+ name: 'Receiving',
|
|
|
mixins: [commonMixin],
|
|
|
components: {
|
|
|
STable,
|
|
|
- VSelect
|
|
|
+ VSelect,
|
|
|
+ chooseProductsModal
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
|
tableHeight: 0, // 表格高度
|
|
|
- orderId: null,
|
|
|
orderSn: null,
|
|
|
- buyerSn: null,
|
|
|
disabled: false,
|
|
|
- isInster: false, // 是否正在添加产品
|
|
|
- ordeDetail: { discountAmount: 0 },
|
|
|
+ openModal: false, // 添加产品
|
|
|
+ ordeDetail: null,
|
|
|
loading: false,
|
|
|
// 已选产品
|
|
|
dataSource: [],
|
|
@@ -133,6 +140,8 @@ 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].receiveQtyBackups = data.list[i].receiveQty
|
|
|
+ data.list[i].returnReasonBackups = data.list[i].returnReason
|
|
|
}
|
|
|
this.disabled = false
|
|
|
this.chooseLoadData = data.list
|
|
@@ -152,13 +161,13 @@ export default {
|
|
|
columns () {
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '23%', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '产品编码', dataIndex: 'productEntity.code', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
{ title: '申请退货数量', dataIndex: 'qty', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '仓库实收数量', dataIndex: 'receiveQty', align: 'center', width: '10%', scopedSlots: { customRender: 'receiveQty' } },
|
|
|
- { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '退货单价', dataIndex: 'price', align: 'center', width: '10%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '退货原因', dataIndex: 'returnReason', width: '10%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
|
|
|
+ { title: '退货原因', dataIndex: 'returnReason', width: '20%', align: 'center', scopedSlots: { customRender: 'returnReason' } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
]
|
|
|
return arr
|
|
@@ -173,57 +182,110 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'receiveCheckList' })
|
|
|
},
|
|
|
- // 添加
|
|
|
- handleAdd (row) {
|
|
|
-
|
|
|
+ // 添加产品
|
|
|
+ addProduct (data) {
|
|
|
+ const params = {
|
|
|
+ 'salesReturnBillSn': this.orderSn,
|
|
|
+ 'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
|
|
|
+ ...data
|
|
|
+ }
|
|
|
+ insertByReceive(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.resetSearchForm()
|
|
|
+ this.$message.info(res.message)
|
|
|
+ }
|
|
|
+ this.$refs.chooseProduct.resetLoading()
|
|
|
+ })
|
|
|
},
|
|
|
- // 删除
|
|
|
+ // 删除产品
|
|
|
handleDel (row) {
|
|
|
-
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要删除吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.loading = true
|
|
|
+ _this.spinning = true
|
|
|
+ deleteByReceiver({ salesReturnDetailSn: row.salesReturnDetailSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.resetSearchForm(false)
|
|
|
+ }
|
|
|
+ _this.$message.info(res.message)
|
|
|
+ _this.loading = false
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- // 批量返库
|
|
|
+ // 批量实收
|
|
|
handlePlss () {
|
|
|
const _this = this
|
|
|
- if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
+ const snList = []
|
|
|
+ _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
+ snList.push(item.salesReturnDetailSn)
|
|
|
+ })
|
|
|
+ if (snList.length == 0) {
|
|
|
_this.$message.warning('请先选择产品!')
|
|
|
return
|
|
|
}
|
|
|
- this.$confirm({
|
|
|
+ _this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '确认要批量实收吗?',
|
|
|
centered: true,
|
|
|
onOk () {
|
|
|
- const obj = []
|
|
|
- _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
|
|
|
- obj.push({
|
|
|
- salesReturnDetailSn: item.salesReturnDetailSn,
|
|
|
- backStockQty: item.qty
|
|
|
- })
|
|
|
+ _this.loading = true
|
|
|
+ _this.spinning = true
|
|
|
+ salesReturnDetailReceiveBatch(snList).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.rowSelectionInfo = null
|
|
|
+ _this.$refs.table.clearTable()
|
|
|
+ _this.resetSearchForm()
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ }
|
|
|
+ _this.loading = false
|
|
|
+ _this.spinning = false
|
|
|
})
|
|
|
- _this.submitCheck(obj)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 已选产品 blur
|
|
|
- onCellBlur (val, record) {
|
|
|
+ // 仓库实收数量修改
|
|
|
+ onCellBlurReceiveQty (val, record) {
|
|
|
// 光标移出,值发生改变再调用编辑接口
|
|
|
- if (val && val != record.backStockQtyBackups) {
|
|
|
- this.submitCheck([{
|
|
|
+ if (val && val != record.receiveQtyBackups) {
|
|
|
+ this.loading = true
|
|
|
+ this.spinning = true
|
|
|
+ salesReturnDetailUpdateReceiveQty({
|
|
|
salesReturnDetailSn: record.salesReturnDetailSn,
|
|
|
- backStockQty: record.backStockQty
|
|
|
- }])
|
|
|
+ receiveQty: val
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ this.$message.success(res.message)
|
|
|
+ } else {
|
|
|
+ record.receiveQty = record.receiveQtyBackups
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
} else {
|
|
|
- record.backStockQty = record.backStockQtyBackups
|
|
|
+ record.receiveQty = record.receiveQtyBackups
|
|
|
}
|
|
|
},
|
|
|
- // 品检
|
|
|
- submitCheck (data) {
|
|
|
+ // 修改退货原因
|
|
|
+ onCellBlurReturnReason (e, record) {
|
|
|
this.loading = true
|
|
|
this.spinning = true
|
|
|
- updateBackStockQty(data).then(res => {
|
|
|
+ salesReturnDetailUpdateReason({
|
|
|
+ salesReturnDetailSn: record.salesReturnDetailSn,
|
|
|
+ returnReason: record.returnReason
|
|
|
+ }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- this.resetSearchForm(true)
|
|
|
+ this.$refs.table.refresh()
|
|
|
this.$message.success(res.message)
|
|
|
+ } else {
|
|
|
+ record.returnReason = record.returnReasonBackups
|
|
|
}
|
|
|
this.loading = false
|
|
|
this.spinning = false
|
|
@@ -236,16 +298,25 @@ export default {
|
|
|
this.ordeDetail = res.data || null
|
|
|
})
|
|
|
},
|
|
|
- // 提交销售单
|
|
|
+ // 审核销售单
|
|
|
handleSubmit () {
|
|
|
- this.spinning = true
|
|
|
- salesReturnCheck({ salesReturnBillSn: this.orderSn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.handleBack()
|
|
|
- this.$message.success(res.message)
|
|
|
- this.spinning = false
|
|
|
- } else {
|
|
|
- this.spinning = false
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '提交后将进入品检环节,确认提交吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.spinning = true
|
|
|
+ salesReturnReceive({ salesReturnBillSn: _this.orderSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.handleBack()
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.spinning = false
|
|
|
+ } else {
|
|
|
+ _this.spinning = false
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|