<template>
|
<div class="add-sales-details">
|
<el-dialog
|
:close-on-click-modal="false"
|
:visible.sync="editRow.visible"
|
width="64rem"
|
:before-close="handleClose"
|
append-to-body
|
custom-class="delivery-dalog"
|
>
|
<div slot="title" class="tac drawerHeader">
|
{{ editCommonConfig.title }}
|
</div>
|
<div class="dialog-body">
|
<el-form :model="ruleForm" :rules="rules" ref="form" label-width="90px" class="demo-ruleForm">
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="发货单号:" prop="number">
|
<el-input v-model="ruleForm.number" size="mini"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="承运商:" prop="carrier">
|
<el-input v-model="ruleForm.carrier" size="mini"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="运单号:" prop="waybillNumber">
|
<el-input v-model="ruleForm.waybillNumber" size="mini"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6"></el-col>
|
</el-row>
|
</el-form>
|
<el-table
|
ref="multipleTable"
|
:data="tableData"
|
tooltip-effect="dark"
|
style="width: 100%"
|
height="500"
|
border
|
:header-cell-style="{
|
background: '#f1f3f8',
|
color: '#000009',
|
'font-size': '12px',
|
'font-family': 'PingFangSC'
|
}"
|
size="mini"
|
>
|
<!-- <el-table-column type="selection" width="55"> </el-table-column> -->
|
<el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
|
<el-table-column prop="productName" label="产品名称" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="productId" label="产品编号" show-overflow-tooltip> </el-table-column>
|
<el-table-column prop="amount" label="订单数量"> </el-table-column>
|
<el-table-column prop="sendAmount" label="已发货数量"> </el-table-column>
|
<el-table-column prop="specs" label="产品规格"> </el-table-column>
|
<el-table-column prop="type" label="产品型号"> </el-table-column>
|
<el-table-column prop="unit" label="单位"> </el-table-column>
|
<el-table-column prop="deliveryAmount" label="发货数量">
|
<template slot-scope="scope">
|
<el-input
|
v-model.number="scope.row.deliveryAmount"
|
placeholder=""
|
:min="0"
|
size="mini"
|
@change="
|
(val) => {
|
inputContent(val, scope)
|
}
|
"
|
></el-input>
|
</template>
|
</el-table-column>
|
<div slot="empty">
|
<el-empty description="暂无数据"></el-empty>
|
</div>
|
</el-table>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<template v-if="isView">
|
<el-button @click="editRow.visible = false">关闭</el-button>
|
</template>
|
<template v-else>
|
<!-- <el-button type="primary" :loading="isAddloading" @click="deliveryCompleteClick()">全部发货完成</el-button> -->
|
<el-button @click="editRow.visible = false">取消</el-button>
|
<el-button type="primary" :loading="isAddloading" @click="saveClick('form')">确认发货</el-button>
|
</template>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { getDeliveryPrepare, saveDelivery, changeOutsourceOrderStatus } from "@/api/orderManageModule/orderManage"
|
export default {
|
name: "DeliveryDialog",
|
props: {
|
editCommonConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
title: "发货",
|
infomation: {}
|
}
|
}
|
}
|
},
|
components: {},
|
data() {
|
return {
|
editRow: this.editCommonConfig,
|
isView: this.editCommonConfig.title === "发货信息",
|
editSelCommonConfig: {
|
editVisible: false,
|
isSelectBox: false,
|
title: "",
|
infomation: {}
|
},
|
isAddloading: false,
|
tableData: [],
|
ruleForm: {
|
number: "",
|
carrier: "",
|
waybillNumber: ""
|
},
|
rules: {
|
number: [{ required: true, message: "请输入发货单号", trigger: "blur" }]
|
}
|
}
|
},
|
created() {
|
// this.setTableForm()
|
this.getDeliveryPrepare()
|
},
|
watch: {
|
"editCommonConfig.visible"(val) {
|
if (val) {
|
// this.setTableForm()
|
}
|
}
|
},
|
methods: {
|
handleClose() {
|
this.editRow.visible = false
|
},
|
// 获取发货产品列表
|
getDeliveryPrepare() {
|
getDeliveryPrepare({
|
outsourcingOrderID: this.editRow.infomation.id
|
}).then((res) => {
|
console.log(res)
|
if (res.code == 200) {
|
let list = res.data.map((item) => {
|
return {
|
...item,
|
deliveryAmount: 0
|
}
|
})
|
this.tableData = list
|
}
|
})
|
},
|
// 多选回调
|
getSelectArray(arr) {
|
console.log(arr)
|
},
|
// 数量输入回调
|
inputContent(val, scope) {
|
console.log(val, scope)
|
},
|
saveClick(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
console.log(this.ruleForm, "保存内容处理", this.tableData)
|
let isDeliveryCount = false
|
this.tableData.map((item) => {
|
if (item.deliveryAmount == 0) {
|
isDeliveryCount = true
|
return
|
}
|
})
|
if (isDeliveryCount) {
|
this.$message.error("发货数量必须大于0")
|
} else {
|
let deliveryList = this.tableData.map((item) => {
|
return {
|
outsourcingOrderProductID: item.id,
|
sendAmount: item.deliveryAmount
|
}
|
})
|
let params = {
|
carrier: this.ruleForm.carrier,
|
deliveryList: deliveryList,
|
number: this.ruleForm.number,
|
outsourcingOrderID: this.editRow.infomation.id,
|
waybillNumber: this.ruleForm.waybillNumber
|
}
|
saveDelivery(params).then((res) => {
|
if (res.code == 200) {
|
this.handleClose()
|
this.$message.success("发货成功")
|
this.$emit("reRreshData")
|
}
|
})
|
}
|
}
|
})
|
},
|
// 全部发货完成
|
deliveryCompleteClick() {
|
this.$confirm("是否确认全部发货完成?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
}).then(() => {
|
changeOutsourceOrderStatus({
|
outsourcingOrderNumber: this.editRow.infomation.number,
|
status: 7
|
})
|
.then((reply) => {
|
if (reply.code == 200) {
|
this.handleClose()
|
this.$message.success("全部发货完成成功")
|
this.$emit("reRreshData")
|
}
|
})
|
.catch(() => {})
|
})
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
::v-deep {
|
.delivery-dalog .el-dialog__header {
|
background: #fff;
|
}
|
.delivery-dalog .el-dialog__body {
|
padding: 20px !important;
|
}
|
.el-dialog__footer {
|
width: 100%;
|
height: 65px;
|
// line-height: 55px;
|
background-color: #fff;
|
padding: 0px 20px 0;
|
text-align: right;
|
box-sizing: border-box;
|
border-top: 0px solid #dadee5;
|
position: relative;
|
.footer-left {
|
position: absolute;
|
top: 0px;
|
left: 20px;
|
}
|
}
|
}
|
</style>
|