|
@@ -241,6 +241,7 @@
|
|
|
:precision="2"
|
|
|
:min="0"
|
|
|
:step="0.01"
|
|
|
+ @change="number_change($event, 1)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -254,8 +255,8 @@
|
|
|
placeholder="采购单价"
|
|
|
:precision="2"
|
|
|
:min="0"
|
|
|
- :max="100"
|
|
|
:step="0.01"
|
|
|
+ @change="number_change($event, 1)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -271,6 +272,7 @@
|
|
|
:min="0"
|
|
|
:max="100"
|
|
|
:step="0.01"
|
|
|
+ @change="number_change($event, 2)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -327,7 +329,7 @@
|
|
|
<script>
|
|
|
import asyncRequest from "@/apis/service/netOrderEntry/netOrderEnter";
|
|
|
import companyHelper from "@/mixins/companyHelper";
|
|
|
-import { accMul, isPhone, isMobile } from "@/utils/validate";
|
|
|
+import { accMul, accDiv, accSub, isPhone, isMobile } from "@/utils/validate";
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
|
|
|
const defaultData = {
|
|
@@ -396,14 +398,14 @@ export default {
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
- addr_code: [
|
|
|
- {
|
|
|
- type: "array",
|
|
|
- required: true,
|
|
|
- message: "请选择收货省市区",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
- ],
|
|
|
+ // addr_code: [
|
|
|
+ // {
|
|
|
+ // type: "array",
|
|
|
+ // required: true,
|
|
|
+ // message: "请选择收货省市区",
|
|
|
+ // trigger: "blur",
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
platform_id: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -585,6 +587,27 @@ export default {
|
|
|
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;
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ },
|
|
|
handleClose() {
|
|
|
this.showModelThis = false;
|
|
|
this.companyName = "";
|
|
@@ -594,7 +617,7 @@ export default {
|
|
|
},
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
- await this.getAccounts();
|
|
|
+ // await this.getAccounts();
|
|
|
|
|
|
if (this.id === "003") {
|
|
|
this.title = "添加销售订单信息";
|
|
@@ -700,16 +723,16 @@ export default {
|
|
|
this.pay_name = pay_name || "";
|
|
|
this.$refs.ruleForm.validateField("platform_id");
|
|
|
},
|
|
|
- async getAccounts() {
|
|
|
- const res = await asyncRequest.accountall(this.dataForm);
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- this.accounts = res.data;
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- },
|
|
|
+ // async getAccounts() {
|
|
|
+ // const res = await asyncRequest.accountall(this.dataForm);
|
|
|
+ // if (res && res.code === 0 && res.data) {
|
|
|
+ // this.accounts = res.data;
|
|
|
+ // } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ // await this.logout();
|
|
|
+ // } else {
|
|
|
+ // this.$message.warning(res.message);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
async goods_class_change(e) {
|
|
|
const { id } = e;
|
|
|
this.ruleForm.cat_id = id ? [id] : [];
|