|
@@ -4,31 +4,67 @@
|
|
|
ref="ruleForm"
|
|
|
:model="ruleForm"
|
|
|
status-icon
|
|
|
+ :size="'mini'"
|
|
|
:rules="rulesThis"
|
|
|
:label-width="labelWidth || '100px'"
|
|
|
class="demo-ruleForm"
|
|
|
- :size="size || 'medium'"
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="12"
|
|
|
- ><el-form-item label="审核状态" prop="state">
|
|
|
- <el-radio-group
|
|
|
- v-model="ruleForm.state"
|
|
|
- placeholder="审核状态"
|
|
|
- style="width: 100%"
|
|
|
- :disabled="disabled"
|
|
|
- @change="stateChange"
|
|
|
- >
|
|
|
- <el-radio
|
|
|
- v-for="item in stateList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.value"
|
|
|
- >{{ item.label }}</el-radio
|
|
|
- >
|
|
|
- </el-radio-group>
|
|
|
+ ><el-form-item label="客户名称" prop="companyCode">
|
|
|
+ <search-customer
|
|
|
+ :value="ruleForm.companyCode"
|
|
|
+ :names="ruleForm.companyName"
|
|
|
+ :placeholder="'客户名称'"
|
|
|
+ :size="'mini'"
|
|
|
+ @searchChange="customerChange"
|
|
|
+ /></el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12"
|
|
|
+ ><el-form-item label="服务费" prop="service_charge">
|
|
|
+ <digital-input
|
|
|
+ :values="ruleForm.service_charge"
|
|
|
+ :placeholder="'服务费'"
|
|
|
+ :min="0"
|
|
|
+ :disabled="false"
|
|
|
+ :max="100000000000"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="2"
|
|
|
+ :size="'mini'"
|
|
|
+ :controls="false"
|
|
|
+ :append="'元'"
|
|
|
+ @reschange="number_change($event, 'service_charge')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
+ <el-form-item label="平台商品编号" prop="plat_code">
|
|
|
+ <el-input
|
|
|
+ placeholder="平台商品编号"
|
|
|
+ v-model="ruleForm.plat_code"
|
|
|
+ :disabled="disabled"
|
|
|
+ maxlength="50"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12"
|
|
|
+ ><el-form-item label="服务费比例" prop="service_proportion">
|
|
|
+ <digital-input
|
|
|
+ :values="ruleForm.service_proportion"
|
|
|
+ :placeholder="'服务费比例'"
|
|
|
+ :min="0"
|
|
|
+ :disabled="false"
|
|
|
+ :max="100"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="2"
|
|
|
+ :size="'mini'"
|
|
|
+ :controls="false"
|
|
|
+ :append="'%'"
|
|
|
+ @reschange="number_change($event, 'service_proportion')"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
<el-button
|
|
|
v-if="!disabled"
|
|
|
:size="'mini'"
|
|
@@ -38,24 +74,17 @@
|
|
|
>保 存
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="审核备注" prop="remark">
|
|
|
- <el-input
|
|
|
- type="textarea"
|
|
|
- placeholder="审核备注"
|
|
|
- v-model="ruleForm.remark"
|
|
|
- :disabled="disabled"
|
|
|
- maxlength="250"
|
|
|
- :autosize="{ minRows: 2, maxRows: 2 }"
|
|
|
- show-word-limit
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {
|
|
|
+ add_sum, //加法精算
|
|
|
+ accSub, //减法精算
|
|
|
+ accMul, //乘法精算
|
|
|
+ accDiv, //除法精算
|
|
|
+} from "@/utils/validate";
|
|
|
export default {
|
|
|
name: "exam-form",
|
|
|
props: ["size", "disabled", "labelWidth", "sitem"],
|
|
@@ -75,34 +104,32 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
- stateList: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "通过",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "0",
|
|
|
- label: "驳回",
|
|
|
- },
|
|
|
- ],
|
|
|
- showModelThis: this.showModel,
|
|
|
+ is_determine_price: "",
|
|
|
+ cgd_charge: "",
|
|
|
+ price: "",
|
|
|
ruleForm: {
|
|
|
- state: "1", // 通过or驳回
|
|
|
- rebut: "", //驳回至
|
|
|
- remark: "",
|
|
|
+ id: "",
|
|
|
+ status: "",
|
|
|
+ companyCode: [],
|
|
|
+ companyName: "",
|
|
|
+ service_charge: "",
|
|
|
+ service_proportion: "",
|
|
|
+ plat_code: "",
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
- state: [
|
|
|
+ companyCode: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择审核状态",
|
|
|
+ type: "array",
|
|
|
+ message: "请选择企业客户",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
|
|
|
- remark: [
|
|
|
- { required: true, message: "请输入审核备注", trigger: "blur" },
|
|
|
+ service_charge: [{ required: true, message: "请输入服务费", trigger: "blur" }],
|
|
|
+ service_proportion: [
|
|
|
+ { required: true, message: "请输入服务费比例", trigger: "blur" },
|
|
|
],
|
|
|
},
|
|
|
};
|
|
@@ -120,12 +147,8 @@ export default {
|
|
|
this.loading = true;
|
|
|
this.rulesThis = this.rules;
|
|
|
await this.resetForm();
|
|
|
- this.stateChange();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
- stateChange() {
|
|
|
- this.rulesThis.remark[0].required = this.ruleForm.state !== "1";
|
|
|
- },
|
|
|
async resetForm() {
|
|
|
// 重置
|
|
|
await this.$nextTick(() => {
|
|
@@ -133,14 +156,98 @@ export default {
|
|
|
this.$refs.ruleForm.resetFields();
|
|
|
this.$refs.ruleForm.clearValidate();
|
|
|
console.log(this.sitem);
|
|
|
- const { status, remark } = this.sitem;
|
|
|
+ const {
|
|
|
+ id,
|
|
|
+ companyCode,
|
|
|
+ companyName,
|
|
|
+ service_charge,
|
|
|
+ service_proportion,
|
|
|
+ plat_code,
|
|
|
+ cgd_charge,
|
|
|
+ price,
|
|
|
+ is_determine_price,
|
|
|
+ } = this.sitem;
|
|
|
+ this.cgd_charge = cgd_charge;
|
|
|
+ this.price = price;
|
|
|
+ this.is_determine_price = is_determine_price;
|
|
|
this.ruleForm = {
|
|
|
- state: status + "" || "1", // 通过or驳回
|
|
|
- remark: remark || "",
|
|
|
+ id: id,
|
|
|
+ status: "2",
|
|
|
+ companyCode: companyCode ? [companyCode] : [],
|
|
|
+ companyName,
|
|
|
+ service_charge,
|
|
|
+ service_proportion,
|
|
|
+ plat_code,
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //购买方公司选择
|
|
|
+ customerChange(e) {
|
|
|
+ const { code, label } = e;
|
|
|
+ this.ruleForm.companyCode = code ? [code] : [];
|
|
|
+ this.ruleForm.companyName = label ? label : "";
|
|
|
+ this.$refs.ruleForm.validateField("companyCode");
|
|
|
+ },
|
|
|
+ async number_change(e, key) {
|
|
|
+ this.ruleForm[key] = e + "" || "0";
|
|
|
+ this.$refs.ruleForm.validateField(key);
|
|
|
+ await this.num(key);
|
|
|
+ console.log(
|
|
|
+ this.ruleForm.service_charge + "-----" + this.ruleForm.service_proportion
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async num(key) {
|
|
|
+ const is_sale = this.is_determine_price === "1";
|
|
|
+ let cgdAdd = 0,
|
|
|
+ serAdd = 0,
|
|
|
+ qrdAdd = 0,
|
|
|
+ rate = 0;
|
|
|
+ if (is_sale) {
|
|
|
+ qrdAdd = this.price * 1;
|
|
|
+ } else {
|
|
|
+ cgdAdd = this.cgd_charge * 1;
|
|
|
+ }
|
|
|
+ if (key === "service_charge") {
|
|
|
+ serAdd = this.ruleForm.service_charge * 1;
|
|
|
+ }
|
|
|
+ if (key === "service_proportion") {
|
|
|
+ rate = this.ruleForm.service_proportion * 1;
|
|
|
+ }
|
|
|
+ console.log(cgdAdd + "---" + serAdd + "---" + qrdAdd + "----" + rate);
|
|
|
+ if (is_sale && key === "service_charge") {
|
|
|
+ // cgdAdd = qrdAdd - serAdd;
|
|
|
+ // rate = (1 - cgdAdd / qrdAdd)*100;
|
|
|
+ cgdAdd = accSub(qrdAdd, serAdd);
|
|
|
+ rate = accMul(accSub(1, accDiv(cgdAdd, qrdAdd)), 100);
|
|
|
+ await this.set_number_change("service_proportion", rate);
|
|
|
+ }
|
|
|
+ if (is_sale && key === "service_proportion") {
|
|
|
+ // cgdAdd = qrdAdd * (100 - rate);
|
|
|
+ // serAdd = qrdAdd - cgdAdd;
|
|
|
+ cgdAdd = accMul(qrdAdd, accSub(100, rate));
|
|
|
+ serAdd = accSub(qrdAdd, cgdAdd);
|
|
|
+ await this.set_number_change("service_charge", serAdd);
|
|
|
+ }
|
|
|
+ if (!is_sale && key === "service_charge") {
|
|
|
+ // qrdAdd = cgdAdd + serAdd;
|
|
|
+ // rate = 1 - cgdAdd / qrdAdd;
|
|
|
+ qrdAdd = add_sum(cgdAdd, serAdd);
|
|
|
+ rate = accSub(1, accDiv(cgdAdd, qrdAdd));
|
|
|
+ await this.set_number_change("service_proportion", rate);
|
|
|
+ }
|
|
|
+ if (!is_sale && key === "service_proportion") {
|
|
|
+ // qrdAdd = cgdAdd / (100 - rate);
|
|
|
+ // serAdd = qrdAdd - cgdAdd;
|
|
|
+ qrdAdd = accDiv(cgdAdd, accSub(100, rate));
|
|
|
+ serAdd = accSub(qrdAdd, cgdAdd);
|
|
|
+ await this.set_number_change("service_charge", serAdd);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async set_number_change(key, value) {
|
|
|
+ this.ruleForm[key] = value + "" || "0";
|
|
|
+ this.$refs.ruleForm.validateField(key);
|
|
|
+ },
|
|
|
async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
@@ -161,4 +268,4 @@ export default {
|
|
|
font-size: 14px;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|