|
|
@@ -14,18 +14,50 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle> -->
|
|
|
- <trade-card title="基础资料" style="margin-top: 60px">
|
|
|
+ <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
|
|
|
<avue-form ref="form" class="trading-form" v-model="form" :option="option">
|
|
|
+ <template slot="corpId">
|
|
|
+ <ypj-corp v-model="form.corpId" :disabled="detailData.status == 1" @getCorpData="getCorpData"
|
|
|
+ :dataInfo="true"></ypj-corp>
|
|
|
+ </template>
|
|
|
</avue-form>
|
|
|
</trade-card>
|
|
|
- <trade-card title="商品信息">
|
|
|
+ <trade-card title="商品信息" v-loading="loadingBtn">
|
|
|
<avue-form ref="form" class="trading-form" v-model="form" :option="option2">
|
|
|
+ <template slot="thisUsedProfit">
|
|
|
+ <el-input-number v-model="form.thisUsedProfit" @change="amountChange" placeholder="请输入" size="small"
|
|
|
+ :controls="false" style="width:100%;"></el-input-number>
|
|
|
+ </template>
|
|
|
</avue-form>
|
|
|
<avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
|
|
|
@resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
|
|
|
- <template slot="menuLeft">
|
|
|
- <el-button type="primary" @click="addRow" size="mini" :disabled="detailData.status == 1">新增产品
|
|
|
- </el-button>
|
|
|
+ <template slot="headerSerial">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
|
|
|
+ :disabled="detailData.status == 1" circle></el-button>
|
|
|
+ </template>
|
|
|
+ <template slot="cname" slot-scope="{ row, index }">
|
|
|
+ <span style="display:flex">
|
|
|
+ <el-select v-model="row.cname" placeholder="请选择" size="small" filterable
|
|
|
+ @change="cnameChange(row, index)">
|
|
|
+ <el-option v-for="item in goodsoptions" :key="item.itemId" :label="item.cname" :value="item.cname">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <template slot="storageInQuantity" slot-scope="{ row, index }">
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.storageInQuantity" @change="countChange(row)" placeholder="请输入"
|
|
|
+ size="small" :controls="false" style="width:100%;"></el-input-number>
|
|
|
+ <span v-else>{{ row.storageInQuantity }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="price" slot-scope="{ row, index }">
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" placeholder="请输入"
|
|
|
+ size="small" :controls="false" style="width:100%;"></el-input-number>
|
|
|
+ <span v-else>{{ row.price }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="purchaseAmount" slot-scope="{ row, index }">
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.purchaseAmount" @change="countChange(row)" placeholder="请输入"
|
|
|
+ size="small" :controls="false" style="width:100%;"></el-input-number>
|
|
|
+ <span v-else>{{ row.purchaseAmount }}</span>
|
|
|
</template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
<el-button size="small" type="text" @click="rowCell(row, index)">{{
|
|
|
@@ -36,10 +68,11 @@
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
</trade-card>
|
|
|
- <fee-info :data="orderFeeList" :form="form" :detailData="detailData"></fee-info>
|
|
|
+ <fee-info :data="settlementList" :form="form" :detailData="detailData" v-loading="loadingBtn"></fee-info>
|
|
|
<containerTitle title="上传附件"></containerTitle>
|
|
|
- <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
|
|
|
- :data="orderFilesList" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
|
|
|
+ <c-upload v-loading="loadingBtn" typeUpload="CD"
|
|
|
+ deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display
|
|
|
+ :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
|
|
|
<el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
|
|
|
width="50%" append-to-body>
|
|
|
<span>
|
|
|
@@ -63,10 +96,9 @@
|
|
|
|
|
|
<script>
|
|
|
import { optionList } from "./js/optionList";
|
|
|
-import { getDetails } from "@/api/basicData/client";
|
|
|
-import { areaTypeTree } from "@/api/basicData/customerInformation";
|
|
|
-import { getCode } from "@/api/basicData/customerInquiry";
|
|
|
+import { getDetails, submit, getCorpDetails, remove, getGoodsList } from "@/api/basicData/salesOrder";
|
|
|
import feeInfo from "./components/feeInfo.vue";
|
|
|
+import { multiply, sum, subtract } from "@/util/calculate";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
data() {
|
|
|
@@ -88,8 +120,7 @@ export default {
|
|
|
column: [
|
|
|
{
|
|
|
label: "客户名称",
|
|
|
- prop: "id",
|
|
|
- type: "select",
|
|
|
+ prop: "corpId",
|
|
|
rules: [
|
|
|
{
|
|
|
required: true,
|
|
|
@@ -97,46 +128,48 @@ export default {
|
|
|
trigger: "blur"
|
|
|
}
|
|
|
],
|
|
|
- span: 16,
|
|
|
+ span: 8,
|
|
|
},
|
|
|
{
|
|
|
- label: "非产品费用",
|
|
|
- prop: "Fax",
|
|
|
- span: 8,
|
|
|
+ label: "送货地址",
|
|
|
+ prop: "arrivalAddress",
|
|
|
+ type: 'select',
|
|
|
+ dicData: [],
|
|
|
+ props: {
|
|
|
+ label: 'detailedAddress',
|
|
|
+ value: 'detailedAddress'
|
|
|
+ },
|
|
|
+ allowCreate: true,
|
|
|
+ filterable: true,
|
|
|
+ span: 16,
|
|
|
},
|
|
|
{
|
|
|
label: "销售日期",
|
|
|
- prop: "mailbox",
|
|
|
+ prop: "businesDate",
|
|
|
type: "date",
|
|
|
format: "yyyy-MM-dd",
|
|
|
- valueFormat: "yyyy-MM-dd",
|
|
|
+ valueFormat: "yyyy-MM-dd 00:00:00",
|
|
|
span: 8,
|
|
|
},
|
|
|
{
|
|
|
label: "计划收款日期",
|
|
|
- prop: "mailbox",
|
|
|
+ prop: "advanceCollectionDate",
|
|
|
type: "date",
|
|
|
format: "yyyy-MM-dd",
|
|
|
- valueFormat: "yyyy-MM-dd",
|
|
|
+ valueFormat: "yyyy-MM-dd 00:00:00",
|
|
|
span: 8,
|
|
|
},
|
|
|
{
|
|
|
label: "送货日期",
|
|
|
- prop: "mailbox",
|
|
|
+ prop: "requiredDeliveryDate",
|
|
|
type: "date",
|
|
|
format: "yyyy-MM-dd",
|
|
|
- valueFormat: "yyyy-MM-dd",
|
|
|
+ valueFormat: "yyyy-MM-dd 00:00:00",
|
|
|
span: 8,
|
|
|
},
|
|
|
{
|
|
|
- label: "送货地址",
|
|
|
- prop: "mailbox",
|
|
|
- type: 'select',
|
|
|
- span: 24,
|
|
|
- },
|
|
|
- {
|
|
|
label: "备注",
|
|
|
- prop: "g",
|
|
|
+ prop: "orderRemark",
|
|
|
placeholder: "打印时显示",
|
|
|
type: "textarea",
|
|
|
minRows: 3,
|
|
|
@@ -146,30 +179,36 @@ export default {
|
|
|
},
|
|
|
option2: {
|
|
|
menuBtn: false,
|
|
|
- labelWidth: 90,
|
|
|
+ labelWidth: 70,
|
|
|
column: [
|
|
|
{
|
|
|
label: "税率",
|
|
|
- prop: "id",
|
|
|
+ prop: "exchangeRate",
|
|
|
type: "select",
|
|
|
- span: 6,
|
|
|
+ props: {
|
|
|
+ label: "dictValue",
|
|
|
+ value: "dictKey"
|
|
|
+ },
|
|
|
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=tax_rate",
|
|
|
+ span: 4,
|
|
|
},
|
|
|
{
|
|
|
label: "订单金额",
|
|
|
- prop: "id",
|
|
|
+ prop: "purchaseAmount",
|
|
|
disabled: true,
|
|
|
- span: 6,
|
|
|
+ span: 4,
|
|
|
},
|
|
|
{
|
|
|
label: "优惠金额",
|
|
|
- prop: "id",
|
|
|
- span: 6,
|
|
|
+ prop: "thisUsedProfit",
|
|
|
+ span: 4,
|
|
|
},
|
|
|
{
|
|
|
label: "合同金额",
|
|
|
- prop: "id",
|
|
|
+ prop: "orderAmount",
|
|
|
disabled: true,
|
|
|
- span: 6,
|
|
|
+ offset: 8,
|
|
|
+ span: 4,
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
@@ -275,7 +314,8 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
optionList: {},
|
|
|
- orderFeeList: []
|
|
|
+ goodsoptions: [],
|
|
|
+ settlementList: [],
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
@@ -298,35 +338,82 @@ export default {
|
|
|
this.option.disabled = true;
|
|
|
}
|
|
|
this.getAllWorkDicts()
|
|
|
+ getGoodsList(1, 10).then(res => {
|
|
|
+ if (res.data.data.total > 0) {
|
|
|
+ this.goodsoptions = res.data.data.records;
|
|
|
+ if (Math.ceil(res.data.data.total / 10) > 1) {
|
|
|
+ for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
|
|
|
+ getGoodsList(i, 10).then(e => {
|
|
|
+ this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
getAllWorkDicts() {
|
|
|
- this.findObject(this.optionList.column, "departureId").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
|
|
|
+ this.getWorkDicts("unit").then(res => {
|
|
|
+ this.findObject(this.optionList.column, "unit").dicData = res.data.data;
|
|
|
+ });
|
|
|
+ this.$refs.crud.init();
|
|
|
},
|
|
|
cellStyle() {
|
|
|
return "padding:0;height:40px;";
|
|
|
},
|
|
|
- selectValue(value, row) {
|
|
|
- console.log(value, row)
|
|
|
- if (row.feesId) {
|
|
|
- row.feesName = value.cname
|
|
|
+ cnameChange(row) {
|
|
|
+ console.log(row)
|
|
|
+ if (row.cname) {
|
|
|
+ this.goodsoptions.forEach(e => {
|
|
|
+ if (e.cname == row.cname) {
|
|
|
+ row.unit = e.unit
|
|
|
+ row.price = e.standardPrice
|
|
|
+ row.storageInQuantity = 1
|
|
|
+ row.amount = e.standardPrice
|
|
|
+ row.purchaseAmount = e.purchasePrice
|
|
|
+ row.storageAmount = e.purchasePrice
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
- row.feesName = ""
|
|
|
+ row.unit = null
|
|
|
+ row.price = null
|
|
|
+ row.purchaseAmount = null
|
|
|
}
|
|
|
},
|
|
|
+ amountChange() {
|
|
|
+ let val = 0
|
|
|
+ this.data.forEach(e => {
|
|
|
+ val = sum(val, e.amount)
|
|
|
+ this.form.purchaseAmount = val
|
|
|
+ this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ countChange(row) {
|
|
|
+ row.amount = multiply(row.price, row.storageInQuantity)
|
|
|
+ row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
|
|
|
+ },
|
|
|
getDetail(id) {
|
|
|
this.loadingBtn = true
|
|
|
getDetails({ id: id })
|
|
|
.then(res => {
|
|
|
this.form = res.data.data;
|
|
|
- this.data = res.data.data.orderCostItemList;
|
|
|
+ this.data = res.data.data.orderItemsList;
|
|
|
+ this.settlementList = res.data.data.settlementList
|
|
|
+ this.getAddress(res.data.data)
|
|
|
})
|
|
|
.finally(() => {
|
|
|
this.loadingBtn = false;
|
|
|
});
|
|
|
},
|
|
|
getCorpData(row) {
|
|
|
- this.form.corpName = row.cname
|
|
|
+ console.log(row)
|
|
|
+ this.findObject(this.option.column, "arrivalAddress").dicData = row.corpsAddrList;
|
|
|
+ // this.form.corpName = row.cname
|
|
|
+ },
|
|
|
+ getAddress(row) {
|
|
|
+ getCorpDetails({ id: row.corpId }).then(res => {
|
|
|
+ this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
|
|
|
+ })
|
|
|
},
|
|
|
addRow() {
|
|
|
this.data.push({ $cellEdit: true })
|
|
|
@@ -347,13 +434,13 @@ export default {
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
if (row.id) {
|
|
|
- // itemDel(row.id).then(res => {
|
|
|
- // this.$message({
|
|
|
- // type: "success",
|
|
|
- // message: "删除成功!"
|
|
|
- // });
|
|
|
- // this.data.splice(index, 1);
|
|
|
- // });
|
|
|
+ remove(row.id).then(res => {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "删除成功!"
|
|
|
+ });
|
|
|
+ this.data.splice(index, 1);
|
|
|
+ });
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
@@ -368,19 +455,17 @@ export default {
|
|
|
this.$refs["form"].validate((valid, done) => {
|
|
|
done();
|
|
|
if (valid) {
|
|
|
- this.data.forEach(e => {
|
|
|
- e.departure = e.departureId ? e.departureId.replace(/,/g, "/") : ''
|
|
|
- })
|
|
|
this.loadingBtn = true;
|
|
|
- // submit({ ...this.form, feesType: 1, orderCostItemList: this.data })
|
|
|
- // .then(res => {
|
|
|
- // this.$message.success("保存成功");
|
|
|
- // this.form = res.data.data;
|
|
|
- // this.data = res.data.data.orderCostItemList;
|
|
|
- // })
|
|
|
- // .finally(() => {
|
|
|
- // this.loadingBtn = false;
|
|
|
- // });
|
|
|
+ submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
|
|
|
+ .then(res => {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ this.form = res.data.data;
|
|
|
+ this.data = res.data.data.orderItemsList;
|
|
|
+ this.settlementList = res.data.data.settlementList
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loadingBtn = false;
|
|
|
+ });
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -418,7 +503,16 @@ export default {
|
|
|
//返回列表
|
|
|
backToList() {
|
|
|
this.$emit("goBack");
|
|
|
- console.log(11111)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ data: function (rows) {
|
|
|
+ let val = 0
|
|
|
+ rows.forEach(e => {
|
|
|
+ val = sum(val, e.amount)
|
|
|
+ this.form.purchaseAmount = val
|
|
|
+ this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
};
|