|
@@ -14,13 +14,14 @@
|
|
|
</a-affix>
|
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
|
<div class="table-operator">
|
|
|
- <a-button type="primary" class="button-error" @click="backStock">批量返库</a-button>
|
|
|
+ <a-button type="primary" :loading="loading" class="button-error" @click="backStock">批量返库</a-button>
|
|
|
</div>
|
|
|
<!-- 已选配件列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
|
ref="table"
|
|
|
size="default"
|
|
|
+ :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
@@ -60,10 +61,7 @@ import EditableCell from '@/views/common/editInput.js'
|
|
|
import { salesReturnDetail, salesReturnSubmit } from '@/api/salesReturn'
|
|
|
import {
|
|
|
salesReturnDetailList,
|
|
|
- salesReturnDetailDel,
|
|
|
- salesReturnDetailInsert,
|
|
|
- salesReturnDetailUpdateQty,
|
|
|
- salesReturnDetailUpdateReason
|
|
|
+ salesReturnCheck
|
|
|
} from '@/api/salesReturnDetail'
|
|
|
export default {
|
|
|
name: 'SalesReturnEdit',
|
|
@@ -81,7 +79,9 @@ export default {
|
|
|
disabled: false,
|
|
|
isInster: false, // 是否正在添加产品
|
|
|
ordeDetail: { discountAmount: 0 },
|
|
|
- delLoading: false,
|
|
|
+ loading: false,
|
|
|
+ selectedRowKeys: [], // Check here to configure the default column
|
|
|
+ selectedRows: [],
|
|
|
// 已选产品
|
|
|
dataSource: [],
|
|
|
productForm: {
|
|
@@ -154,13 +154,37 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ onSelectChange (selectedRowKeys, selectedRows) {
|
|
|
+ this.selectedRowKeys = selectedRowKeys
|
|
|
+ this.selectedRows = selectedRows
|
|
|
+ },
|
|
|
// 返回
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'salesReturnList' })
|
|
|
},
|
|
|
// 批量返库
|
|
|
backStock () {
|
|
|
+ const _this = this
|
|
|
+ if (_this.selectedRowKeys.length < 1) {
|
|
|
+ _this.$message.warning('请在选择产品!')
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要批量返库吗?',
|
|
|
+ centered: true,
|
|
|
+ onOk () {
|
|
|
+ const obj = []
|
|
|
+ _this.selectedRows.map(item => {
|
|
|
+ obj.push({
|
|
|
+ productSn: item.productSn,
|
|
|
+ backStockQty: item.backStockQty
|
|
|
+ })
|
|
|
+ })
|
|
|
+ _this.submitCheck(obj)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 修改返库数量
|
|
|
onCellChange (id, key, value) {
|
|
@@ -168,27 +192,24 @@ export default {
|
|
|
const row = chooseLoadData.find(item => item.id === id)
|
|
|
if (row) {
|
|
|
row[key] = Number(value)
|
|
|
- salesReturnDetailUpdateQty({
|
|
|
- salesReturnDetailSn: row.salesReturnDetailSn,
|
|
|
+ this.submitCheck([{
|
|
|
+ productSn: row.productSn,
|
|
|
backStockQty: row.backStockQty
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.resetSearchForm(true)
|
|
|
- this.$message.success(res.message)
|
|
|
- }
|
|
|
- })
|
|
|
+ }])
|
|
|
}
|
|
|
},
|
|
|
- // 修改退货原因
|
|
|
- updateRemark (row) {
|
|
|
- salesReturnDetailUpdateReason({
|
|
|
- salesReturnDetailSn: row.salesReturnDetailSn,
|
|
|
- remarks: row.remarks
|
|
|
+ // 品检
|
|
|
+ submitCheck (backStockQty) {
|
|
|
+ this.loading = true
|
|
|
+ salesReturnCheck({
|
|
|
+ salesReturnBillSn: this.orderSn,
|
|
|
+ backStockQty: backStockQty
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.resetSearchForm(true)
|
|
|
this.$message.success(res.message)
|
|
|
}
|
|
|
+ this.loading = false
|
|
|
})
|
|
|
},
|
|
|
// 重置列表
|
|
@@ -201,54 +222,11 @@ export default {
|
|
|
this.ordeDetail = res.data || null
|
|
|
})
|
|
|
},
|
|
|
- // 删除产品
|
|
|
- handleDel (row) {
|
|
|
- const _this = this
|
|
|
- this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: '确认要删除吗?',
|
|
|
- centered: true,
|
|
|
- closable: true,
|
|
|
- onOk () {
|
|
|
- _this.delLoading = true
|
|
|
- salesReturnDetailDel({ id: row.id }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.resetSearchForm(true)
|
|
|
- }
|
|
|
- _this.$message.info(res.message)
|
|
|
- _this.delLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 重置
|
|
|
resetSearchForm (flag) {
|
|
|
this.$refs.table.refresh(!!flag)
|
|
|
this.getOrderDetail()
|
|
|
},
|
|
|
- // 添加或修改产品
|
|
|
- saveProduct (row) {
|
|
|
- console.log(row)
|
|
|
- // 防止多次添加产品
|
|
|
- if (this.isInster) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.isInster = true
|
|
|
- const params = {
|
|
|
- 'salesReturnBillSn': this.orderSn,
|
|
|
- 'price': row.productPrice,
|
|
|
- 'cost': row.lastStockCost,
|
|
|
- 'productSn': row.productSn,
|
|
|
- 'qty': row.qty
|
|
|
- }
|
|
|
- salesReturnDetailInsert(params).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.resetSearchForm(true)
|
|
|
- this.$message.success(res.message)
|
|
|
- }
|
|
|
- this.isInster = false
|
|
|
- })
|
|
|
- },
|
|
|
// 提交销售单
|
|
|
handleSubmit () {
|
|
|
salesReturnSubmit({ sn: this.orderSn }).then(res => {
|