|
@@ -1,65 +1,71 @@
|
|
|
<template>
|
|
|
<div class="work-order__wrapper">
|
|
|
<template v-if="isSalesWarehouselist">
|
|
|
- <el-table size="mini" border :data="list">
|
|
|
- <el-table-column label="销售订单" />
|
|
|
- <el-table-column label="发货申请单" width="110px" />
|
|
|
- <el-table-column label="提退时发货申请单状态" width="150px" />
|
|
|
- <el-table-column label="发货工单" />
|
|
|
- <el-table-column label="发货仓库所在供应商名称" width="160px" />
|
|
|
- <el-table-column label="发货仓库所在供应商编码" width="160px" />
|
|
|
- <el-table-column label="发货仓库名称" width="100px" />
|
|
|
- <el-table-column label="发货仓库编码" width="100px" />
|
|
|
- <el-table-column label="发货仓库负责人" width="110px" />
|
|
|
- <el-table-column label="发货数量" />
|
|
|
- <el-table-column width="110px">
|
|
|
- <template slot="header">
|
|
|
- <span style="color:red;margin-right:2px">*</span>退货数量
|
|
|
- </template>
|
|
|
- <template slot-scope="scope">
|
|
|
- <digital-input
|
|
|
- :values="list[scope.$index].num"
|
|
|
- :placeholder="'退货数量'"
|
|
|
- :min="0"
|
|
|
- :disabled="false"
|
|
|
- :max="100000000000"
|
|
|
- :position="'right'"
|
|
|
- :precision="0"
|
|
|
- :size="'mini'"
|
|
|
- :controls="false"
|
|
|
- :append="''"
|
|
|
- @reschange="onNumberChange($event, scope.$index)"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="退货仓库所在供应商名称" width="160px" />
|
|
|
- <el-table-column label="退货仓库所在供应商编码" width="160px" />
|
|
|
- <el-table-column width="160px">
|
|
|
- <template slot="header">
|
|
|
- <span style="color:red;margin-right:2px">*</span>退货仓库编码
|
|
|
- </template>
|
|
|
- <template slot-scope="scope">
|
|
|
- <search-stock
|
|
|
- :is-detail="false"
|
|
|
- :size="'mini'"
|
|
|
- :value="list[scope.$index].wsmCode"
|
|
|
- :placeholder="'仓库名称'"
|
|
|
- :is-relation="true"
|
|
|
- :wsmtype="'5'"
|
|
|
- :company-no="currentCompany"
|
|
|
- :disbaled="!currentCompany"
|
|
|
- :names="''"
|
|
|
- @searchChange="onStockChange($event, scope.$index)"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="退货仓库负责人" width="110px" />
|
|
|
- </el-table>
|
|
|
+ <el-form ref="formRef" :model="list">
|
|
|
+ <el-table size="mini" border :data="list">
|
|
|
+ <el-table-column prop="orderCode" label="销售订单" width="160px" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="outCode" label="发货申请单" width="160px" show-overflow-toolti />
|
|
|
+ <el-table-column prop="outChildCode" label="发货工单" width="160px" show-overflow-tooltip />
|
|
|
+ <el-table-column label="发货仓库所在供应商名称" prop="supplierName" width="170px" show-overflow-tooltip />
|
|
|
+ <el-table-column label="发货仓库所在供应商编码" prop="supplierNo" width="170px" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="wsm_name" label="发货仓库名称" width="160px" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="wsm_code" label="发货仓库编码" width="170px" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="contactor_name" label="发货仓库负责人" width="110px" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="num" label="发货数量" show-overflow-tooltip />
|
|
|
+ <el-form>
|
|
|
+ <el-table-column width="110px" show-overflow-tooltip>
|
|
|
+ <template slot="header">
|
|
|
+ <span style="color:red;margin-right:2px">*</span>退货数量
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item :prop="`${scope.$index}.return_num`" :rules="paramsRules.return_num">
|
|
|
+ <digital-input
|
|
|
+ :values="list[scope.$index].return_num"
|
|
|
+ :placeholder="'退货数量'"
|
|
|
+ :disabled="false"
|
|
|
+ :max="100000000000"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="0"
|
|
|
+ :size="'mini'"
|
|
|
+ :controls="false"
|
|
|
+ :append="''"
|
|
|
+ @reschange="onNumberChange($event, scope.$index)"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="160px" show-overflow-tooltip>
|
|
|
+ <template slot="header">
|
|
|
+ <span style="color:red;margin-right:2px">*</span>退货仓库编码
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-form-item :prop="`${scope.$index}.return_wsm_code`" :rules="paramsRules.return_wsm_code">
|
|
|
+ <search-stock
|
|
|
+ :is-detail="false"
|
|
|
+ :size="'mini'"
|
|
|
+ :value="list[scope.$index].return_wsm_code"
|
|
|
+ :placeholder="'仓库名称'"
|
|
|
+ :is-relation="true"
|
|
|
+ :wsmtype="'5'"
|
|
|
+ :company-no="currentCompany"
|
|
|
+ :disbaled="!currentCompany"
|
|
|
+ :names="''"
|
|
|
+ @searchChange="onStockChange($event, scope.$index)"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-form>
|
|
|
+ <el-table-column label="退货仓库所在供应商名称" prop="returnSupplierName" width="160px" show-overflow-tooltip />
|
|
|
+ <el-table-column label="退货仓库所在供应商编码" prop="returnSupplierNo" width="160px" show-overflow-tooltip />
|
|
|
+ <el-table-column label="退货仓库负责人" width="110px" prop="returnSupplierNameContactor" show-overflow-tooltip />
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
<el-form :model="formData" :rules="rules">
|
|
|
- <el-form-item prop="wsmCode" label="销售仓" style="display:flex">
|
|
|
+ <el-form-item prop="return_wsm_code" label="销售仓" style="display:flex">
|
|
|
<search-stock
|
|
|
style="width:300px"
|
|
|
:is-detail="false"
|
|
@@ -77,11 +83,12 @@
|
|
|
</el-form>
|
|
|
</template>
|
|
|
|
|
|
- <el-button class="fr" style="margin:10px 0px" size="mini" type="primary">保存</el-button>
|
|
|
+ <el-button class="fr" style="margin:10px 0px" size="mini" type="primary" :loading="subLoading" @click="onSetOrderReturnChild">保存</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import asyncRequest from '@/apis/service/sellOut/sellAfterApply'
|
|
|
import companyHelper from '@/mixins/companyHelper'
|
|
|
import resToken from '@/mixins/resToken'
|
|
|
export default {
|
|
@@ -89,15 +96,10 @@ export default {
|
|
|
mixins: [resToken, companyHelper],
|
|
|
props: ['sitem'],
|
|
|
data: () => ({
|
|
|
- rules: {
|
|
|
- wsmCode: [{ required: true, type: 'array', message: '请选择销售仓', trigger: 'change' }]
|
|
|
- },
|
|
|
- formData: {
|
|
|
- wsmCode: ''
|
|
|
- },
|
|
|
- list: [
|
|
|
- { wsmCode: '', num: 0 }
|
|
|
- ]
|
|
|
+ list: [],
|
|
|
+ loading: false,
|
|
|
+ subLoading: false,
|
|
|
+ companyNo: ''
|
|
|
}),
|
|
|
computed: {
|
|
|
state() {
|
|
@@ -115,25 +117,80 @@ export default {
|
|
|
// 有地址 && 不是库存品
|
|
|
if (isHasAddr && !isStock) return true
|
|
|
return false
|
|
|
+ },
|
|
|
+ paramsRules() {
|
|
|
+ return ({
|
|
|
+ return_wsm_code: [{
|
|
|
+ required: true,
|
|
|
+ message: '请选择退货仓库',
|
|
|
+ trigger: 'change'
|
|
|
+ }],
|
|
|
+ return_num: [{
|
|
|
+ required: false
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ sitem: {
|
|
|
+ handler() {
|
|
|
+ if (!this.sitem) return
|
|
|
+ this.onRequestSendList()
|
|
|
+ },
|
|
|
+ immediate: true
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- onStockChange(e, index, isForm) {
|
|
|
- const { code } = e
|
|
|
- if (isForm) {
|
|
|
- this.formData.wsmCode = code ? [code] : ''
|
|
|
- return
|
|
|
+ async onRequestSendList() {
|
|
|
+ const { data, code, message } = await asyncRequest.sendList({ orderCode: this.sitem.orderCode })
|
|
|
+ switch (code) {
|
|
|
+ case 0:
|
|
|
+ this.list = data.list.map(item => ({ ...item, return_num: 0, return_wsm_code: '' }))
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ this.$message.warning(message)
|
|
|
+ break
|
|
|
}
|
|
|
-
|
|
|
+ },
|
|
|
+ onStockChange({ code, supplierName, supplierNo, contactor } = {}, index) {
|
|
|
this.$set(this.list, index, {
|
|
|
...this.list[index],
|
|
|
- wsmCode: code ? [code] : ''
|
|
|
+ return_wsm_code: code ? [code] : '',
|
|
|
+ returnSupplierName: supplierName,
|
|
|
+ returnSupplierNo: supplierNo,
|
|
|
+ returnSupplierNameContactor: contactor
|
|
|
})
|
|
|
+
|
|
|
+ this.$nextTick(() => this.$refs.formRef.validate())
|
|
|
},
|
|
|
- onNumberChange(num, index) {
|
|
|
+ onNumberChange(return_num, index) {
|
|
|
this.$set(this.list, index, {
|
|
|
...this.list[index],
|
|
|
- num
|
|
|
+ return_num
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async onSetOrderReturnChild() {
|
|
|
+ this.$refs.formRef.validate(async isValid => {
|
|
|
+ if (!isValid) return
|
|
|
+
|
|
|
+ const list = this.list.map(({ outChildCode, return_num, return_wsm_code }) => ({
|
|
|
+ return_wsm_code: Array.isArray(return_wsm_code) ? return_wsm_code[0] : return_wsm_code,
|
|
|
+ outChildCode,
|
|
|
+ return_num
|
|
|
+ }))
|
|
|
+
|
|
|
+ const salesWarehouseParams = { list, type: '1', returnCode: this.sitem.returnCode }
|
|
|
+ const params = { list: [{ ...this.formData }], type: '1', returnCode: this.sitem.returnCode }
|
|
|
+ const { code, message } = await asyncRequest.reorderChildAdd(this.isSalesWarehouselist ? salesWarehouseParams : params)
|
|
|
+ this.subLoading = false
|
|
|
+ switch (code) {
|
|
|
+ case 0:
|
|
|
+ this.$emit('reload')
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ this.$message.warning(message)
|
|
|
+ break
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|