<template>
|
<div class="add-sales-return">
|
<el-dialog
|
:title="editCommonConfig.title + '销售退货单'"
|
:visible.sync="editConfig.visible"
|
:width="dialogWidth"
|
:before-close="handleClose"
|
>
|
<el-form
|
ref="form"
|
:model="editConfig.infomation"
|
:rules="rules"
|
label-position="right"
|
label-width="308px"
|
size="mini"
|
style="height: 60vh; overflow-x: hidden"
|
>
|
<!-- 信息 -->
|
<div class="basic-info">
|
<!-- 基本信息 -->
|
<div class="basic-info-title">基本信息</div>
|
<div class="basic-info-view">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="客户名称" prop="clientId">
|
<div class="custom-name">
|
<el-input v-model="editConfig.infomation.clientId"></el-input>
|
<div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
|
<div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
|
</div>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="销售退货单编号" prop="number">
|
<el-input v-model="editConfig.infomation.number"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="选择源单" prop="selSourceOrder">
|
<el-select v-model="editConfig.infomation.selSourceOrder" size="mini" style="width: 63%">
|
<el-option
|
v-for="item in selSourceOrderOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="退入仓库" prop="repository">
|
<el-select v-model="editConfig.infomation.repository" size="mini" style="width: 63%">
|
<el-option
|
v-for="item in repositoryOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="销售负责人" prop="memberId">
|
<el-select
|
v-model="editConfig.infomation.memberId"
|
placeholder="请选择"
|
size="mini"
|
style="width: 63%"
|
>
|
<el-option v-for="item in memberOptions" :key="item.value" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="退货日期" prop="returnDate">
|
<el-date-picker v-model="editConfig.infomation.returnDate" type="date" placeholder="选择日期">
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
<!-- 动态信息 -->
|
<div class="basic-info-title">动态信息</div>
|
<div class="basic-info-view">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="状态" prop="status">
|
<div class="common-select">
|
<el-select
|
v-model="editConfig.infomation.status"
|
placeholder="请选择"
|
class="common-select-sel"
|
size="mini"
|
>
|
<el-option v-for="item in statusOptions" :key="item.id" :label="item.name" :value="item.id">
|
</el-option>
|
</el-select>
|
<div class="common-select-btn" @click="editDropdownBox">
|
<i class="el-icon-setting"></i>
|
</div>
|
</div>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
<!-- 备注信息 -->
|
<div class="basic-info-title">备注信息</div>
|
<div class="basic-info-view">
|
<el-row>
|
<el-col :span="24">
|
<el-form-item label="退货原因" prop="reason">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 2 }"
|
v-model="editConfig.infomation.reason"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
<!-- 附件信息 -->
|
<div class="basic-info-title">附件信息</div>
|
<div class="basic-info-view">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="附件" prop="">
|
<template slot="label">
|
<div style="display: flex; float: right">
|
<div style="font-size: 16px">
|
<i class="el-icon-warning-outline" title="最多上传20个附件,最大限制5MB"></i>
|
</div>
|
<span style="margin-left: 5px">附件</span>
|
</div>
|
</template>
|
<div class="annex-view">
|
<div @click="addAnnexClick">
|
<div style="display: flex; float: right">
|
<div style="font-size: 16px"><i class="el-icon-paperclip"></i></div>
|
<span>添加</span>
|
</div>
|
</div>
|
<div class="setFormat" @click="setFormatClick">设置允许上传的文件格式</div>
|
</div>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
<!-- 产品管理 -->
|
<div class="basic-info-title" style="display: flex">
|
产品管理
|
<div style="margin-left: 400px">
|
币种
|
<el-select v-model="editConfig.infomation.currency" placeholder="请选择" size="mini" style="width: 63%">
|
<el-option v-for="item in currencyOptions" :key="item.value" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div class="product-view">
|
<CommonFormTableView :show-summary="showSummary" :product-table-list="productTableList" />
|
</div>
|
</div>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" size="small" @click="editConfig.visible = false">保存</el-button>
|
<el-button size="small" @click="editConfig.visible = false">取消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
|
import { getAllData } from "@/api/client/client"
|
import { getAddSalesReturn, getUpdateSalesReturn } from "@/api/sales/salesReturn"
|
export default {
|
name: "AddSalesReturnDialog",
|
props: {
|
editCommonConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
title: "新建",
|
infomation: {}
|
}
|
}
|
}
|
},
|
components: { CommonFormTableView },
|
computed: {},
|
data() {
|
return {
|
dialogWidth: "80%",
|
editConfig: this.editCommonConfig,
|
rules: {
|
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
repository: [{ required: true, message: "请选择", trigger: "change" }],
|
memberId: [{ required: true, message: "请选择负责人", trigger: "change" }]
|
},
|
memberOptions: [],
|
selSourceOrderOptions: [], // 选择源单
|
repositoryOptions: [
|
{ value: "1", label: "总仓" },
|
{ value: "2", label: "赠品仓" },
|
{ value: "3", label: "其他仓" }
|
], // 退入仓库
|
statusOptions: [], // 状态
|
currencyOptions: [
|
{ value: "1", label: "人民币(¥)" },
|
{ value: "2", label: "英镑(£)" },
|
{ value: "3", label: "欧元(€)" }
|
], // 币种
|
productTableList: {},
|
showSummary: {
|
show: true,
|
total: false,
|
refundable: true,
|
sumProp: ["other1", "other2", "other3", "other4"],
|
mergeNumber: 4
|
}
|
}
|
},
|
created() {
|
this.setTableForm()
|
this.getCommonData()
|
},
|
methods: {
|
getCommonData() {
|
getAllData()
|
.then((res) => {
|
this.memberOptions = res.data.member
|
})
|
.catch((err) => {
|
console.log(err)
|
})
|
},
|
// 保存
|
saveClick(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
console.log(this.editConfig.infomation)
|
const params = this.saveParams()
|
console.log(params)
|
if (this.editConfig.title === "新建") {
|
getAddSalesReturn(params)
|
.then((res) => {
|
console.log(res)
|
this.editConfig.visible = false
|
if (res.code === 200) {
|
this.$message({
|
message: "添加成功",
|
type: "success"
|
})
|
this.$parent.getData()
|
}
|
})
|
.catch((err) => {
|
console.log(err)
|
})
|
} else {
|
getUpdateSalesReturn(params)
|
.then((res) => {
|
console.log(res)
|
this.editConfig.visible = false
|
if (res.code === 200) {
|
this.$message({
|
message: "编辑成功",
|
type: "success"
|
})
|
this.$parent.getData()
|
}
|
})
|
.catch((err) => {
|
console.log(err)
|
})
|
}
|
} else {
|
console.log("error submit")
|
return false
|
}
|
})
|
},
|
saveParams() {
|
let data = this.editConfig.infomation
|
let params = {
|
id: this.editConfig.title === "新建" ? 0 : data.id,
|
salesReturn: {
|
clientId: data.clientId || 0,
|
memberId: data.memberId || 0,
|
number: data.number || "",
|
products: [
|
{
|
amount: 0,
|
desc: "",
|
id: 0,
|
name: "",
|
number: "",
|
price: 0,
|
total: 0
|
}
|
],
|
reason: data.reason || "",
|
repository: data.repository || "",
|
returnDate: data.returnDate || "",
|
status: data.status || 0
|
}
|
}
|
return params
|
},
|
handleClose() {
|
this.editConfig.visible = false
|
},
|
// 添加附件
|
addAnnexClick() {},
|
// 设置允许上传文件格式
|
setFormatClick() {},
|
setTableForm() {
|
this.productTableList = {
|
tableData: [],
|
tableColumn: [
|
{ label: "#", prop: "id", width: 40 },
|
{ label: "产品名称", prop: "productName", input: true, isRequird: true },
|
{ label: "产品编号", prop: "other0" },
|
{ label: "源单类型", prop: "other5" },
|
{ label: "源单", prop: "other6" },
|
{ label: "数量", prop: "other1", input: true, isRequird: true },
|
{ label: "含税单价", prop: "other9", input: true },
|
{ label: "不含税单价", prop: "other7", input: true },
|
{ label: "折扣率(%)", prop: "other6", input: true },
|
{ label: "折扣额", prop: "other2" },
|
{ label: "税(销售)", prop: "other7", input: true },
|
{ label: "实际含税单价", prop: "other3" },
|
{ label: "不含税金额", prop: "other4" },
|
{ label: "价税合计", prop: "other3", input: true },
|
{ label: "描述", prop: "other8" }
|
]
|
}
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
.add-sales-return {
|
.basic-info {
|
.basic-info-title {
|
background-color: #f4f8fe;
|
padding-left: 10px;
|
font-size: 15px;
|
font-weight: bold;
|
color: #666;
|
height: 42px;
|
line-height: 42px;
|
}
|
.basic-info-view {
|
margin-top: 10px;
|
padding-right: 40px;
|
.custom-name {
|
display: flex;
|
.common-select-btn {
|
margin-left: 5px;
|
font-size: 18px;
|
}
|
}
|
.common-select {
|
display: flex;
|
.common-select-sel {
|
width: 270px;
|
}
|
.common-select-btn {
|
margin-left: 5px;
|
font-size: 16px;
|
cursor: pointer;
|
}
|
}
|
}
|
.annex-view {
|
display: flex;
|
color: #6166d3;
|
.setFormat {
|
margin-left: 10px;
|
}
|
}
|
}
|
.unflod-collapse {
|
display: flex;
|
height: 30px;
|
justify-content: center;
|
align-items: center;
|
color: #6166d3;
|
}
|
.dialog-footer {
|
background-color: #f5f5f5;
|
height: 55px;
|
line-height: 55px;
|
}
|
}
|
</style>
|