|
@@ -315,9 +315,11 @@
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
<el-col :span="24" style="text-align: right">
|
|
|
- <el-button v-if="id !== '007'" type="primary" @click="submitForm"
|
|
|
- >保 存</el-button
|
|
|
- >
|
|
|
+ <el-button
|
|
|
+ v-if="id !== '007'"
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm"
|
|
|
+ >保 存</el-button>
|
|
|
<el-button @click="showModelThis = false">
|
|
|
{{ id == "007" ? "关 闭" : "取 消" }}
|
|
|
</el-button>
|
|
@@ -327,76 +329,76 @@
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import asyncRequest from "@/apis/service/netOrderEntry/netOrderEnter";
|
|
|
-import companyHelper from "@/mixins/companyHelper";
|
|
|
-import { accMul, accDiv, accSub, isPhone, isMobile } from "@/utils/validate";
|
|
|
-import resToken from "@/mixins/resToken";
|
|
|
+import asyncRequest from '@/apis/service/netOrderEntry/netOrderEnter'
|
|
|
+import companyHelper from '@/mixins/companyHelper'
|
|
|
+import { accMul, accDiv, accSub, isPhone, isMobile } from '@/utils/validate'
|
|
|
+import resToken from '@/mixins/resToken'
|
|
|
|
|
|
const defaultData = {
|
|
|
addr_code: [],
|
|
|
- cgdPrice: "",
|
|
|
+ cgdPrice: '',
|
|
|
// buyerid: "",
|
|
|
// buyer_name: "",
|
|
|
- platform_id: "",
|
|
|
- cgd_tax: "",
|
|
|
- workCode: "",
|
|
|
- poCode: "",
|
|
|
- khNo: "",
|
|
|
- companyNo: "",
|
|
|
- contactor: "",
|
|
|
- mobile: "",
|
|
|
- addr: "",
|
|
|
- sendtime: "",
|
|
|
- supplierNo: "",
|
|
|
- cat_id: "",
|
|
|
- goodName: "",
|
|
|
- goodNum: "",
|
|
|
- goodPrice: "",
|
|
|
- good_total: "",
|
|
|
- goodUnit: "",
|
|
|
- tax: "",
|
|
|
-};
|
|
|
+ platform_id: '',
|
|
|
+ cgd_tax: '',
|
|
|
+ workCode: '',
|
|
|
+ poCode: '',
|
|
|
+ khNo: '',
|
|
|
+ companyNo: '',
|
|
|
+ contactor: '',
|
|
|
+ mobile: '',
|
|
|
+ addr: '',
|
|
|
+ sendtime: '',
|
|
|
+ supplierNo: '',
|
|
|
+ cat_id: '',
|
|
|
+ goodName: '',
|
|
|
+ goodNum: '',
|
|
|
+ goodPrice: '',
|
|
|
+ good_total: '',
|
|
|
+ goodUnit: '',
|
|
|
+ tax: ''
|
|
|
+}
|
|
|
|
|
|
export default {
|
|
|
- name: "Terrace",
|
|
|
+ name: 'Terrace',
|
|
|
mixins: [resToken, companyHelper],
|
|
|
- props: ["showModel", "id", "sitem"],
|
|
|
+ props: ['showModel', 'id', 'sitem'],
|
|
|
data() {
|
|
|
const validatemobile = (rule, value, callback) => {
|
|
|
- if (value !== "") {
|
|
|
+ if (value !== '') {
|
|
|
if (isPhone(value) || isMobile(value)) {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
} else {
|
|
|
- callback(new Error("联系电话格式不正确!"));
|
|
|
+ callback(new Error('联系电话格式不正确!'))
|
|
|
}
|
|
|
} else {
|
|
|
- callback(new Error("请输入联系电话!"));
|
|
|
+ callback(new Error('请输入联系电话!'))
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
loading: false,
|
|
|
detailLoading: false,
|
|
|
- title: "添加销售订单信息",
|
|
|
- khName: "",
|
|
|
+ title: '添加销售订单信息',
|
|
|
+ khName: '',
|
|
|
accounts: [],
|
|
|
- cat_id_name: "",
|
|
|
+ cat_id_name: '',
|
|
|
showModelThis: this.showModel,
|
|
|
pickerOptions: {
|
|
|
- disabledDate: (time) => time.getTime() > new Date(),
|
|
|
+ disabledDate: (time) => time.getTime() > new Date()
|
|
|
},
|
|
|
names: [],
|
|
|
- unit_name: "",
|
|
|
- companyName: "",
|
|
|
+ unit_name: '',
|
|
|
+ companyName: '',
|
|
|
ruleForm: { ...defaultData },
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
goodUnit: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择单位",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请选择单位',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
// addr_code: [
|
|
|
// {
|
|
@@ -409,46 +411,46 @@ export default {
|
|
|
platform_id: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入所属平台",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入所属平台',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
|
|
|
cgd_tax: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入采购毛利率",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入采购毛利率',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
cat_id: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择商品分类",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
+ message: '请选择商品分类',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
],
|
|
|
supplierNo: [
|
|
|
{
|
|
|
- type: "array",
|
|
|
+ type: 'array',
|
|
|
required: true,
|
|
|
- message: "请选择供应商公司",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
+ message: '请选择供应商公司',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
],
|
|
|
qrdType: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入订单来源",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入订单来源',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
good_total: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入货款总金额",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入货款总金额',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
// workCode: [
|
|
|
// {
|
|
@@ -460,228 +462,228 @@ export default {
|
|
|
poCode: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入PO编号",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入PO编号',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
khNo: [
|
|
|
{
|
|
|
- type: "array",
|
|
|
+ type: 'array',
|
|
|
required: true,
|
|
|
- message: "请选择购买方公司",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
+ message: '请选择购买方公司',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
],
|
|
|
tax: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择税率",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
+ message: '请选择税率',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
],
|
|
|
companyNo: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择销售方公司",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
+ message: '请选择销售方公司',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
],
|
|
|
contactor: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入收货人",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入收货人',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
mobile: [
|
|
|
{
|
|
|
required: true,
|
|
|
validator: validatemobile,
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
addr: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入联系地址",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入联系地址',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
|
|
|
sendtime: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入发货时间",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
+ message: '请输入发货时间',
|
|
|
+ trigger: 'change'
|
|
|
+ }
|
|
|
],
|
|
|
|
|
|
goodName: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入商品名称",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入商品名称',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
goodPrice: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入销售单价",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请输入销售单价',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
cgdPrice: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择采购单价",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
+ message: '请选择采购单价',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
goodNum: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入数量",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- };
|
|
|
+ message: '请输入数量',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
totalWatchSource() {
|
|
|
- const { goodNum, goodPrice } = this.ruleForm;
|
|
|
- return { goodNum, goodPrice };
|
|
|
- },
|
|
|
+ const { goodNum, goodPrice } = this.ruleForm
|
|
|
+ return { goodNum, goodPrice }
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
- showModel: function (val) {
|
|
|
- this.showModelThis = val;
|
|
|
+ showModel: function(val) {
|
|
|
+ this.showModelThis = val
|
|
|
if (val) {
|
|
|
- this.initForm();
|
|
|
+ this.initForm()
|
|
|
}
|
|
|
},
|
|
|
showModelThis(val) {
|
|
|
if (!val) {
|
|
|
- this.$emit("cancel");
|
|
|
+ this.$emit('cancel')
|
|
|
}
|
|
|
},
|
|
|
totalWatchSource: {
|
|
|
handler({ goodPrice, goodNum }) {
|
|
|
if (goodPrice === 0 || goodNum === 0) {
|
|
|
- this.ruleForm.good_total = 0;
|
|
|
- return;
|
|
|
+ this.ruleForm.good_total = 0
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
- this.ruleForm.good_total = accMul(goodPrice, goodNum);
|
|
|
+ this.ruleForm.good_total = accMul(goodPrice, goodNum)
|
|
|
},
|
|
|
- deep: true,
|
|
|
- },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
async handleHandoverName(e) {
|
|
|
- this.ruleForm.buyerid = e && e.id ? [e.id] : "";
|
|
|
- this.ruleForm.buyer_name = e && e.label ? e.label : "";
|
|
|
- this.$refs.ruleForm.validateField("buyerid");
|
|
|
+ this.ruleForm.buyerid = e && e.id ? [e.id] : ''
|
|
|
+ this.ruleForm.buyer_name = e && e.label ? e.label : ''
|
|
|
+ this.$refs.ruleForm.validateField('buyerid')
|
|
|
},
|
|
|
async select_area_change(e) {
|
|
|
- this.ruleForm.addr_code = e;
|
|
|
- this.$refs.ruleForm.validateField("addr_code");
|
|
|
+ this.ruleForm.addr_code = e
|
|
|
+ this.$refs.ruleForm.validateField('addr_code')
|
|
|
},
|
|
|
number_change(e, type) {
|
|
|
- console.log(1111);
|
|
|
- const { cgdPrice, goodPrice, cgd_tax } = this.ruleForm;
|
|
|
- let tax = 0,
|
|
|
- cgd_price = 0;
|
|
|
+ console.log(1111)
|
|
|
+ const { cgdPrice, goodPrice, cgd_tax } = this.ruleForm
|
|
|
+ let tax = 0
|
|
|
+ let cgd_price = 0
|
|
|
|
|
|
if (type === 1) {
|
|
|
// tax = (1 - cgdPrice / goodPrice)*100
|
|
|
- tax = accMul(accSub(1, accDiv(cgdPrice, goodPrice)), 100);
|
|
|
- this.ruleForm.cgd_tax = tax;
|
|
|
- this.$refs.ruleForm.validateField("cgd_tax");
|
|
|
- console.log(type, tax);
|
|
|
+ tax = accMul(accSub(1, accDiv(cgdPrice, goodPrice)), 100)
|
|
|
+ this.ruleForm.cgd_tax = tax
|
|
|
+ this.$refs.ruleForm.validateField('cgd_tax')
|
|
|
+ console.log(type, tax)
|
|
|
}
|
|
|
if (type === 2) {
|
|
|
// cgd_price = (100 - cgd_tax) * goodPrice;
|
|
|
- cgd_price = accMul(accDiv(100, cgd_tax), goodPrice);
|
|
|
- this.ruleForm.cgdPrice = cgd_price;
|
|
|
- this.$refs.ruleForm.validateField("cgdPrice");
|
|
|
- console.log(type, cgd_tax);
|
|
|
+ cgd_price = accMul(accDiv(100, cgd_tax), goodPrice)
|
|
|
+ this.ruleForm.cgdPrice = cgd_price
|
|
|
+ this.$refs.ruleForm.validateField('cgdPrice')
|
|
|
+ console.log(type, cgd_tax)
|
|
|
}
|
|
|
},
|
|
|
handleClose() {
|
|
|
- this.showModelThis = false;
|
|
|
- this.companyName = "";
|
|
|
- this.khName = "";
|
|
|
- this.supplierName = "";
|
|
|
- this.ruleForm = { ...defaultData };
|
|
|
+ this.showModelThis = false
|
|
|
+ this.companyName = ''
|
|
|
+ this.khName = ''
|
|
|
+ this.supplierName = ''
|
|
|
+ this.ruleForm = { ...defaultData }
|
|
|
},
|
|
|
async initForm() {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
// await this.getAccounts();
|
|
|
|
|
|
- if (this.id === "003") {
|
|
|
- this.title = "添加销售订单信息";
|
|
|
- this.rulesThis = this.rules;
|
|
|
- } else if (this.id === "005") {
|
|
|
- this.title = "修改销售订单信息";
|
|
|
- this.rulesThis = this.rules;
|
|
|
+ if (this.id === '003') {
|
|
|
+ this.title = '添加销售订单信息'
|
|
|
+ this.rulesThis = this.rules
|
|
|
+ } else if (this.id === '005') {
|
|
|
+ this.title = '修改销售订单信息'
|
|
|
+ this.rulesThis = this.rules
|
|
|
} else {
|
|
|
- this.title = "销售订单信息详情";
|
|
|
- this.rulesThis = {};
|
|
|
+ this.title = '销售订单信息详情'
|
|
|
+ this.rulesThis = {}
|
|
|
}
|
|
|
- await this.resetForm();
|
|
|
- this.loading = false;
|
|
|
+ await this.resetForm()
|
|
|
+ this.loading = false
|
|
|
},
|
|
|
|
|
|
handleCompanyChange(e) {
|
|
|
- this.ruleForm.companyNo = e.code || "";
|
|
|
- this.$refs.ruleForm.validateField("companyNo");
|
|
|
+ this.ruleForm.companyNo = e.code || ''
|
|
|
+ this.$refs.ruleForm.validateField('companyNo')
|
|
|
},
|
|
|
handleCustomerChange(e) {
|
|
|
- this.ruleForm.khNo = e.code ? [e.code] : "";
|
|
|
- this.$refs.ruleForm.validateField("khNo");
|
|
|
+ this.ruleForm.khNo = e.code ? [e.code] : ''
|
|
|
+ this.$refs.ruleForm.validateField('khNo')
|
|
|
},
|
|
|
handleSupplierChange(e) {
|
|
|
- this.ruleForm.supplierNo = e.code ? [e.code] : "";
|
|
|
- this.$refs.ruleForm.validateField("supplierNo");
|
|
|
+ this.ruleForm.supplierNo = e.code ? [e.code] : ''
|
|
|
+ this.$refs.ruleForm.validateField('supplierNo')
|
|
|
},
|
|
|
handleGoodClassChange(e) {
|
|
|
- this.ruleForm.cat_id = e;
|
|
|
- this.$refs.ruleForm.validateField("cat_id");
|
|
|
+ this.ruleForm.cat_id = e
|
|
|
+ this.$refs.ruleForm.validateField('cat_id')
|
|
|
},
|
|
|
handleTaxChange(e) {
|
|
|
- this.ruleForm.tax = e;
|
|
|
- this.$refs.ruleForm.validateField("tax");
|
|
|
+ this.ruleForm.tax = e
|
|
|
+ this.$refs.ruleForm.validateField('tax')
|
|
|
},
|
|
|
unitsearchChange(e) {
|
|
|
- console.log(e);
|
|
|
- const { id, code, label } = e;
|
|
|
- this.ruleForm.goodUnit = code ? [code] : [];
|
|
|
- this.$refs.ruleForm.validateField("goodUnit");
|
|
|
+ console.log(e)
|
|
|
+ const { id, code, label } = e
|
|
|
+ this.ruleForm.goodUnit = code ? [code] : []
|
|
|
+ this.$refs.ruleForm.validateField('goodUnit')
|
|
|
},
|
|
|
async resetForm() {
|
|
|
// 重置
|
|
|
await this.$nextTick(() => {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
- this.$refs.ruleForm.resetFields();
|
|
|
- this.$refs.ruleForm.clearValidate();
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.$refs.ruleForm.clearValidate()
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
|
|
|
- console.log(this.id);
|
|
|
+ console.log(this.id)
|
|
|
|
|
|
- if (this.id === "003") {
|
|
|
- this.ruleForm.companyNo = this.currentCompany;
|
|
|
- console.log(this.ruleForm.companyNo);
|
|
|
- return;
|
|
|
+ if (this.id === '003') {
|
|
|
+ this.ruleForm.companyNo = this.currentCompany
|
|
|
+ console.log(this.ruleForm.companyNo)
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
- if (this.id !== "003") this.getDetail();
|
|
|
+ if (this.id !== '003') this.getDetail()
|
|
|
},
|
|
|
async getDetail() {
|
|
|
- this.detailLoading = true;
|
|
|
- const { orderCode } = this.sitem;
|
|
|
- const { data } = await asyncRequest.detail({ orderCode });
|
|
|
+ this.detailLoading = true
|
|
|
+ const { orderCode } = this.sitem
|
|
|
+ const { data } = await asyncRequest.detail({ orderCode })
|
|
|
|
|
|
const {
|
|
|
cat_id,
|
|
@@ -695,33 +697,33 @@ export default {
|
|
|
addr_code,
|
|
|
unitName,
|
|
|
...rest
|
|
|
- } = data;
|
|
|
+ } = data
|
|
|
|
|
|
this.ruleForm = {
|
|
|
...rest,
|
|
|
buyerid: buyerid ? [buyerid] : [],
|
|
|
- addr_code: addr_code ? addr_code.split(",") : [],
|
|
|
+ addr_code: addr_code ? addr_code.split(',') : [],
|
|
|
cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
|
|
|
supplierNo: supplierNo ? [supplierNo] : [],
|
|
|
khNo: khNo ? [khNo] : [],
|
|
|
- tax: tax ? tax + "%" : "",
|
|
|
- goodUnit: goodUnit ? [goodUnit] : "",
|
|
|
- };
|
|
|
+ tax: tax ? tax + '%' : '',
|
|
|
+ goodUnit: goodUnit ? [goodUnit] : ''
|
|
|
+ }
|
|
|
|
|
|
- console.log(this.ruleForm);
|
|
|
+ console.log(this.ruleForm)
|
|
|
|
|
|
- this.cat_id_name = cat_id.map(({ name }) => name).join("_");
|
|
|
- this.unit_name = unitName;
|
|
|
+ this.cat_id_name = cat_id.map(({ name }) => name).join('_')
|
|
|
+ this.unit_name = unitName
|
|
|
|
|
|
- this.khName = khName;
|
|
|
- this.supplierName = supplierNanme;
|
|
|
- this.detailLoading = false;
|
|
|
+ this.khName = khName
|
|
|
+ this.supplierName = supplierNanme
|
|
|
+ this.detailLoading = false
|
|
|
},
|
|
|
platform_codesearchChange(e) {
|
|
|
- const { id, label, pay_name } = e;
|
|
|
- this.ruleForm.platform_id = id || "";
|
|
|
- this.pay_name = pay_name || "";
|
|
|
- this.$refs.ruleForm.validateField("platform_id");
|
|
|
+ const { id, label, pay_name } = e
|
|
|
+ this.ruleForm.platform_id = id || ''
|
|
|
+ this.pay_name = pay_name || ''
|
|
|
+ this.$refs.ruleForm.validateField('platform_id')
|
|
|
},
|
|
|
// async getAccounts() {
|
|
|
// const res = await asyncRequest.accountall(this.dataForm);
|
|
@@ -734,60 +736,60 @@ export default {
|
|
|
// }
|
|
|
// },
|
|
|
async goods_class_change(e) {
|
|
|
- const { id } = e;
|
|
|
- this.ruleForm.cat_id = id ? [id] : [];
|
|
|
- this.$refs.ruleForm.validateField("cat_id");
|
|
|
+ const { id } = e
|
|
|
+ this.ruleForm.cat_id = id ? [id] : []
|
|
|
+ this.$refs.ruleForm.validateField('cat_id')
|
|
|
},
|
|
|
async submitForm() {
|
|
|
- await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
+ await this.$refs.ruleForm.validate(async(valid) => {
|
|
|
if (valid) {
|
|
|
if (this.loading) {
|
|
|
- return;
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
- this.loading = true;
|
|
|
- const model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
- model.supplierNo = model.supplierNo[0];
|
|
|
- model.khNo = model.khNo[0];
|
|
|
- model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid;
|
|
|
- model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : "";
|
|
|
- model.addr_code = model.addr_code.join(",");
|
|
|
- model.tax = model.tax.split("%")[0];
|
|
|
- model.pay_name = this.pay_name;
|
|
|
+ this.loading = true
|
|
|
+ const model = JSON.parse(JSON.stringify(this.ruleForm))
|
|
|
+ model.supplierNo = model.supplierNo[0]
|
|
|
+ model.khNo = model.khNo[0]
|
|
|
+ model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid
|
|
|
+ model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : ''
|
|
|
+ model.addr_code = model.addr_code.join(',')
|
|
|
+ model.tax = model.tax.split('%')[0]
|
|
|
+ model.pay_name = this.pay_name
|
|
|
model.goodUnit = Array.isArray(model.goodUnit)
|
|
|
? model.goodUnit[0]
|
|
|
- : model.goodUnit;
|
|
|
+ : model.goodUnit
|
|
|
|
|
|
- let res = {};
|
|
|
- if (this.id === "003") {
|
|
|
- delete model["id"];
|
|
|
- res = await asyncRequest.add(model);
|
|
|
+ let res = {}
|
|
|
+ if (this.id === '003') {
|
|
|
+ delete model['id']
|
|
|
+ res = await asyncRequest.add(model)
|
|
|
} else {
|
|
|
- res = await asyncRequest.update(model);
|
|
|
+ res = await asyncRequest.update(model)
|
|
|
}
|
|
|
- this.loading = false;
|
|
|
+ this.loading = false
|
|
|
if (res && res.code === 0) {
|
|
|
- const title = this.id === "003" ? "添加成功!" : "修改成功!";
|
|
|
+ const title = this.id === '003' ? '添加成功!' : '修改成功!'
|
|
|
this.$notify.success({
|
|
|
title,
|
|
|
- message: "",
|
|
|
- });
|
|
|
- this.showModelThis = false;
|
|
|
+ message: ''
|
|
|
+ })
|
|
|
+ this.showModelThis = false
|
|
|
// 刷新
|
|
|
- this.$emit("refresh");
|
|
|
+ this.$emit('refresh')
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
+ await this.logout()
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
+ this.$message.warning(res.message)
|
|
|
}
|
|
|
} else {
|
|
|
- console.log("error submit!!");
|
|
|
- return false;
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|