|
@@ -58,18 +58,33 @@
|
|
|
@row-del="rowDel"
|
|
|
@saveColumn="saveColumn"
|
|
|
:summary-method="summaryMethod"
|
|
|
+ :cell-style="cellStyle"
|
|
|
>
|
|
|
<template slot="cname" slot-scope="{ row, index }">
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- type="text"
|
|
|
- @click="rePick(row, index)"
|
|
|
- :disabled="detailData.status == 1"
|
|
|
- class="picker"
|
|
|
- style="padding:4px 10px;float:left"
|
|
|
- >选择</el-button
|
|
|
- >
|
|
|
- <span> {{ row.cname }}</span>
|
|
|
+ <span v-if="row.$cellEdit" style="display:flex">
|
|
|
+ <el-select
|
|
|
+ v-model="row.cname"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ style="width:60%"
|
|
|
+ @change="cnameChange(row, index)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in goodsoptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.cname"
|
|
|
+ :value="item.cname"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="mini"
|
|
|
+ @click="rePick(row, index)"
|
|
|
+ ></el-button>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span v-else> {{ row.cname }}</span>
|
|
|
</template>
|
|
|
<template slot="price" slot-scope="{ row }">
|
|
|
<el-input
|
|
@@ -81,6 +96,44 @@
|
|
|
></el-input>
|
|
|
<span v-else>{{ row.price }}</span>
|
|
|
</template>
|
|
|
+ <template slot="taxRate" slot-scope="{ row }">
|
|
|
+ <el-input
|
|
|
+ v-if="row.$cellEdit"
|
|
|
+ v-model="row.taxRate"
|
|
|
+ size="small"
|
|
|
+ oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
|
|
|
+ @change="priceChange(row)"
|
|
|
+ ></el-input>
|
|
|
+ <span v-else>{{ row.taxRate ? row.taxRate : 0 }}%</span>
|
|
|
+ </template>
|
|
|
+ <template slot="coefficient" slot-scope="{ row }">
|
|
|
+ <el-input
|
|
|
+ v-if="row.$cellEdit"
|
|
|
+ v-model="row.coefficient"
|
|
|
+ size="small"
|
|
|
+ oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
|
|
|
+ @change="priceChange(row)"
|
|
|
+ ></el-input>
|
|
|
+ <span v-else>{{ row.coefficient ? row.coefficient : 0 }}%</span>
|
|
|
+ </template>
|
|
|
+ <template slot="currency" slot-scope="{ row }">
|
|
|
+ <el-select
|
|
|
+ v-if="row.$cellEdit"
|
|
|
+ v-model="row.currency"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="small"
|
|
|
+ @change="currencyChange(row)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in currencyList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictValue"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <span v-else>{{ row.currency }}</span>
|
|
|
+ </template>
|
|
|
<template slot="orderQuantity" slot-scope="{ row }">
|
|
|
<el-input
|
|
|
v-if="row.$cellEdit"
|
|
@@ -99,6 +152,7 @@
|
|
|
allow-create
|
|
|
default-first-option
|
|
|
placeholder="请输入"
|
|
|
+ size="small"
|
|
|
@focus="itemTypeFocus(row)"
|
|
|
>
|
|
|
<el-option
|
|
@@ -129,13 +183,7 @@
|
|
|
<span v-else>{{ row.corpName }}</span>
|
|
|
</template>
|
|
|
<template slot="purchaseAmount" slot-scope="{ row }">
|
|
|
- <el-input
|
|
|
- v-if="row.$cellEdit"
|
|
|
- v-model="row.purchaseAmount"
|
|
|
- size="small"
|
|
|
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
|
|
|
- ></el-input>
|
|
|
- <span v-else>{{ row.purchaseAmount | micrometerFormat }}</span>
|
|
|
+ <span>{{ row.purchaseAmount | micrometerFormat }}</span>
|
|
|
</template>
|
|
|
<template slot="menuLeft">
|
|
|
<el-button
|
|
@@ -278,13 +326,6 @@ export default {
|
|
|
{
|
|
|
label: "客户名称",
|
|
|
prop: "corpId",
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "",
|
|
|
- trigger: "blur"
|
|
|
- }
|
|
|
- ],
|
|
|
span: 16,
|
|
|
slot: true
|
|
|
},
|
|
@@ -419,7 +460,9 @@ export default {
|
|
|
olddata: [],
|
|
|
subLoading: false,
|
|
|
pageLoading: false,
|
|
|
- showBut: true
|
|
|
+ showBut: true,
|
|
|
+ goodsoptions: [],
|
|
|
+ currencyList: []
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
@@ -453,6 +496,12 @@ export default {
|
|
|
this.getWorkDicts("unit").then(res => {
|
|
|
this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
|
|
|
});
|
|
|
+ this.getWorkDicts("currency").then(res => {
|
|
|
+ this.currencyList = res.data.data;
|
|
|
+ });
|
|
|
+ getGoods().then(res => {
|
|
|
+ this.goodsoptions = res.data.data.records;
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
cellStyle() {
|
|
@@ -465,6 +514,18 @@ export default {
|
|
|
};
|
|
|
this.newDetails();
|
|
|
},
|
|
|
+ cnameChange(row) {
|
|
|
+ this.goodsoptions.forEach(e => {
|
|
|
+ if (e.cname == row.cname) {
|
|
|
+ row.itemId = e.id;
|
|
|
+ row.code = e.code;
|
|
|
+ row.priceCategory = e.goodsTypeName;
|
|
|
+ row.itemUrl = e.url;
|
|
|
+ row.itemDescription = e.cnameDescription;
|
|
|
+ row.unit = e.unit;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
getcorpId(row) {
|
|
|
console.log(row);
|
|
|
this.data[row.index].corpId = row.id;
|
|
@@ -484,18 +545,45 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
priceChange(row) {
|
|
|
- console.log(row);
|
|
|
if (!row.price) {
|
|
|
row.price = 0;
|
|
|
} else {
|
|
|
- row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
|
|
|
+ row.purchaseAmount = Number(
|
|
|
+ _.divide(
|
|
|
+ Number(row.price ? row.price : 0),
|
|
|
+ _.multiply(
|
|
|
+ _.add(1, _.divide(Number(row.taxRate ? row.taxRate : 0), 100)),
|
|
|
+ _.add(
|
|
|
+ 1,
|
|
|
+ _.divide(Number(row.coefficient ? row.coefficient : 0), 100)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ).toFixed(2);
|
|
|
+ row.amount = Number(
|
|
|
+ _.multiply(
|
|
|
+ _.divide(
|
|
|
+ Number(row.price ? row.price : 0),
|
|
|
+ _.multiply(
|
|
|
+ _.add(1, _.divide(Number(row.taxRate ? row.taxRate : 0), 100)),
|
|
|
+ _.add(
|
|
|
+ 1,
|
|
|
+ _.divide(Number(row.coefficient ? row.coefficient : 0), 100)
|
|
|
+ )
|
|
|
+ )
|
|
|
+ ),
|
|
|
+ row.orderQuantity
|
|
|
+ )
|
|
|
+ ).toFixed(2);
|
|
|
}
|
|
|
},
|
|
|
quantityChange(row) {
|
|
|
if (!row.orderQuantity) {
|
|
|
row.orderQuantity = 0;
|
|
|
} else {
|
|
|
- row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
|
|
|
+ row.amount = _.multiply(row.purchaseAmount, row.orderQuantity).toFixed(
|
|
|
+ 2
|
|
|
+ );
|
|
|
}
|
|
|
},
|
|
|
rowSave(row) {
|
|
@@ -569,6 +657,7 @@ export default {
|
|
|
freight: 0,
|
|
|
discount: null,
|
|
|
amount: 0,
|
|
|
+ coefficient: 0,
|
|
|
taxRate: 0,
|
|
|
unit: e.unit,
|
|
|
remarks: null,
|
|
@@ -583,6 +672,14 @@ export default {
|
|
|
this.treeDeptId = "";
|
|
|
this.reData = null;
|
|
|
},
|
|
|
+ currencyChange(row) {
|
|
|
+ if (row.currency == "CNY") {
|
|
|
+ row.exchangeRate = 1;
|
|
|
+ }
|
|
|
+ if (row.currency == "USD") {
|
|
|
+ row.exchangeRate = 6.3843;
|
|
|
+ }
|
|
|
+ },
|
|
|
selectionChange(list) {
|
|
|
this.selectionList = list;
|
|
|
},
|