|
@@ -5,17 +5,22 @@
|
|
|
class="select-class"
|
|
|
:visible.sync="selectClassModal"
|
|
|
>
|
|
|
- <div class="select-class__content">
|
|
|
- <div class="selection" v-if="goodsDetail.specialGoods">
|
|
|
+ <div
|
|
|
+ class="select-class__content"
|
|
|
+ v-for="(it, ik) in copyDetail"
|
|
|
+ :key="ik"
|
|
|
+ >
|
|
|
+ <h3>{{ it.name }}</h3>
|
|
|
+ <div class="selection" v-if="it.specialGoods || sign">
|
|
|
<el-select
|
|
|
class="select"
|
|
|
- v-model="gradeId"
|
|
|
+ v-model="it.gradeId"
|
|
|
placeholder="请选择班级"
|
|
|
size="small"
|
|
|
- @click.native="selectClick(goodsDetail, 'class')"
|
|
|
+ @click.native="selectClick(it, 'class')"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in gradeList"
|
|
|
+ v-for="item in it.gradeList"
|
|
|
:key="item.gradeId"
|
|
|
:disabled="
|
|
|
item.studentNum > 0 && item.studentNum == item.studentUpper
|
|
@@ -31,18 +36,16 @@
|
|
|
|
|
|
<div
|
|
|
class="selection"
|
|
|
- v-if="
|
|
|
- goodsDetail.templateType == 'apply' && goodsDetail.goodsType == 1
|
|
|
- "
|
|
|
+ v-if="it.templateType == 'apply' && it.goodsType == 1"
|
|
|
>
|
|
|
<el-select
|
|
|
- v-model="educationId"
|
|
|
+ v-model="it.educationId"
|
|
|
placeholder="请选择考期"
|
|
|
size="small"
|
|
|
- @click.native="selectClick(goodsDetail, 'exam')"
|
|
|
+ @click.native="selectClick(it, 'exam')"
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in examineList"
|
|
|
+ v-for="item in it.examineList"
|
|
|
:key="item.educationId"
|
|
|
:label="item.examineName"
|
|
|
:value="item.educationId"
|
|
@@ -52,37 +55,14 @@
|
|
|
<el-cascader
|
|
|
size="small"
|
|
|
:props="props"
|
|
|
- ref="cascader"
|
|
|
+ :ref="'cascader' + ik"
|
|
|
:options="provinceList"
|
|
|
- v-model="examArea"
|
|
|
- @change="areaChange(goodsDetail)"
|
|
|
+ v-model="it.area"
|
|
|
+ @change="areaChange(it, ik)"
|
|
|
clearable
|
|
|
placeholder="请选择报考地区"
|
|
|
></el-cascader>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="selection"
|
|
|
- v-if="goodsDetail.sevenYear && goodsDetail.goodsType == 1"
|
|
|
- >
|
|
|
- <el-form
|
|
|
- :model="ruleForm"
|
|
|
- status-icon
|
|
|
- :rules="rules"
|
|
|
- ref="ruleForm"
|
|
|
- label-width="180px"
|
|
|
- class="demo-ruleForm"
|
|
|
- >
|
|
|
- <el-form-item label="七大员继教可选年份:" prop="checkList">
|
|
|
- <el-checkbox-group v-model="ruleForm.checkList">
|
|
|
- <el-checkbox
|
|
|
- v-for="(item, index) in sevenYear"
|
|
|
- :key="index"
|
|
|
- :label="item"
|
|
|
- ></el-checkbox>
|
|
|
- </el-checkbox-group>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
</div>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -103,69 +83,64 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
selectClassModal: false,
|
|
|
- goodsDetail: {},
|
|
|
+ copyDetail: [], //备份
|
|
|
provinceList: [],
|
|
|
gradeList: [],
|
|
|
+ gradeMap: new Map(),
|
|
|
gradeId: "",
|
|
|
examineList: [],
|
|
|
examArea: [],
|
|
|
- sevenYear: [],
|
|
|
- ruleForm: {
|
|
|
- checkList: []
|
|
|
- },
|
|
|
educationId: "",
|
|
|
+ sign: 0, //是否继教七大员商品
|
|
|
props: {
|
|
|
lazy: true,
|
|
|
lazyLoad: this.lazyLoad
|
|
|
- },
|
|
|
- rules: {
|
|
|
- checkList: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请选择七大员继教年份",
|
|
|
- trigger: "change"
|
|
|
- }
|
|
|
- ]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
- showModal(item) {
|
|
|
- this.gradeId = "";
|
|
|
- this.gradeList = [];
|
|
|
- this.ruleForm.checkList = [];
|
|
|
+ showModal(item, sign) {
|
|
|
this.selectClassModal = true;
|
|
|
- this.goodsDetail = item;
|
|
|
- if (this.goodsDetail.specialGoods) {
|
|
|
- this.selectClick(this.goodsDetail, "class", true);
|
|
|
- }
|
|
|
- if (
|
|
|
- this.goodsDetail.templateType == "apply" &&
|
|
|
- this.goodsDetail.goodsType == 1
|
|
|
- ) {
|
|
|
- this.selectClick(this.goodsDetail, "exam", true);
|
|
|
+ this.getProvinceList();
|
|
|
+ if (Array.isArray(item)) {
|
|
|
+ this.copyDetail = JSON.parse(JSON.stringify(item));
|
|
|
+ } else {
|
|
|
+ this.copyDetail = JSON.parse(JSON.stringify([item]));
|
|
|
}
|
|
|
- if (this.goodsDetail.sevenYear) {
|
|
|
- this.sevenYear = item.sevenYear.split(",") || [];
|
|
|
+ this.sign = sign || 0;
|
|
|
+ for (let i = 0; i < this.copyDetail.length; i++) {
|
|
|
+ this.copyDetail[i].gradeId = "";
|
|
|
+ this.copyDetail[i].gradeList = [];
|
|
|
+ this.copyDetail[i].educationId = "";
|
|
|
+ this.copyDetail[i].examineList = [];
|
|
|
+ if (this.copyDetail[i].specialGoods || this.sign) {
|
|
|
+ this.selectClick(this.copyDetail[i], "class", true);
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ this.copyDetail[i].templateType == "apply" &&
|
|
|
+ this.copyDetail[i].goodsType == 1
|
|
|
+ ) {
|
|
|
+ this.selectClick(this.copyDetail[i], "exam", true);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
selectClick(goodsDetail, type, status) {
|
|
|
if (type == "class") {
|
|
|
//选择班级
|
|
|
- if (!this.gradeList.length) {
|
|
|
+ if (!goodsDetail.gradeList.length) {
|
|
|
this.$request
|
|
|
.goodsGradeList({ goodsId: goodsDetail.goodsId })
|
|
|
.then(res => {
|
|
|
- this.gradeList = res.rows;
|
|
|
- if (this.gradeList.length == 0) {
|
|
|
+ goodsDetail.gradeList = res.rows;
|
|
|
+ if (goodsDetail.gradeList.length == 0) {
|
|
|
let item = {
|
|
|
className: "系统分班",
|
|
|
gradeId: 0
|
|
|
};
|
|
|
- this.gradeList.push(item);
|
|
|
+ goodsDetail.gradeList.push(item);
|
|
|
} else {
|
|
|
- let isGradeFull = this.gradeList.every(
|
|
|
+ let isGradeFull = goodsDetail.gradeList.every(
|
|
|
item =>
|
|
|
item.studentNum > 0 && item.studentNum == item.studentUpper
|
|
|
);
|
|
@@ -175,12 +150,13 @@ export default {
|
|
|
className: "系统分班",
|
|
|
gradeId: 0
|
|
|
};
|
|
|
- this.gradeList.unshift(item);
|
|
|
+ goodsDetail.gradeList.unshift(item);
|
|
|
}
|
|
|
}
|
|
|
if (status) {
|
|
|
- this.gradeId = this.gradeList[0].gradeId;
|
|
|
+ goodsDetail.gradeId = goodsDetail.gradeList[0].gradeId;
|
|
|
}
|
|
|
+ this.$forceUpdate();
|
|
|
});
|
|
|
}
|
|
|
} else if (type == "apply") {
|
|
@@ -190,99 +166,61 @@ export default {
|
|
|
this.$request
|
|
|
.getExamineList({ projectId: goodsDetail.projectId })
|
|
|
.then(res => {
|
|
|
- this.examineList = res.rows;
|
|
|
- if (status) {
|
|
|
- this.educationId = this.examineList[0].educationId;
|
|
|
+ goodsDetail.examineList = res.rows;
|
|
|
+ if (status && res.rows.length > 0) {
|
|
|
+ goodsDetail.educationId = res.rows[0].educationId;
|
|
|
}
|
|
|
+ this.$forceUpdate();
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- validateFunc() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- this.$refs["ruleForm"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- resolve(true);
|
|
|
- } else {
|
|
|
- resolve(false);
|
|
|
- console.log("error submit!!");
|
|
|
- return false;
|
|
|
+ async pay() {
|
|
|
+ try {
|
|
|
+ let itCopyDetail = JSON.parse(JSON.stringify(this.copyDetail));
|
|
|
+ itCopyDetail.forEach(i => {
|
|
|
+ if (
|
|
|
+ (i.specialGoods == 1 || this.sign) &&
|
|
|
+ !i.gradeId &&
|
|
|
+ i.gradeId !== 0
|
|
|
+ ) {
|
|
|
+ throw new Error("请选择班级");
|
|
|
+ }
|
|
|
+ if (i.templateType == "apply" && i.goodsType == 1 && !i.educationId) {
|
|
|
+ throw new Error("请选择考期");
|
|
|
+ }
|
|
|
+ if (i.goodsType == 1) {
|
|
|
+ if (i.specialGoods == 1 || this.sign) {
|
|
|
+ let goodsInputData = {
|
|
|
+ type: "class",
|
|
|
+ gradeId: i.gradeId,
|
|
|
+ gradeJson: JSON.stringify(
|
|
|
+ i.gradeList.find(grade => grade.gradeId == i.gradeId)
|
|
|
+ )
|
|
|
+ };
|
|
|
+ i.goodsInputData = goodsInputData;
|
|
|
+ }
|
|
|
+ if (i.templateType == "apply") {
|
|
|
+ let goodsInputData = {
|
|
|
+ type: "apply",
|
|
|
+ applyAreasJson: JSON.stringify(i.applyAreas),
|
|
|
+ examDateJson: JSON.stringify(
|
|
|
+ i.examineList.find(exam => exam.educationId == i.educationId)
|
|
|
+ )
|
|
|
+ };
|
|
|
+ i.goodsInputData = goodsInputData;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- async pay() {
|
|
|
- if (this.goodsDetail.specialGoods == 1) {
|
|
|
- if (!this.gradeId && this.gradeId !== 0) {
|
|
|
- this.$message({
|
|
|
- message: "请选择班级",
|
|
|
- type: "warning"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (
|
|
|
- this.goodsDetail.templateType == "apply" &&
|
|
|
- this.goodsDetail.goodsType == 1
|
|
|
- ) {
|
|
|
- // if (!item.applyAreas.areaName) {
|
|
|
- // uni.showModal({
|
|
|
- // title: '提示',
|
|
|
- // content: '请选择报考地区',
|
|
|
- // showCancel: false
|
|
|
- // });
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- if (!this.educationId) {
|
|
|
- this.$message({
|
|
|
- message: "请选择考期",
|
|
|
- type: "warning"
|
|
|
- });
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.goodsDetail.sevenYear && this.goodsDetail.goodsType == 1) {
|
|
|
- const A = await this.validateFunc();
|
|
|
- if (!A) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- let selectGoodsList = Object.assign({}, this.goodsDetail);
|
|
|
- if (selectGoodsList.goodsType == 1) {
|
|
|
- if (selectGoodsList.specialGoods == 1) {
|
|
|
- let goodsInputData = {
|
|
|
- type: "class",
|
|
|
- gradeId: this.gradeId,
|
|
|
- gradeJson: JSON.stringify(
|
|
|
- this.gradeList.find(grade => grade.gradeId == this.gradeId)
|
|
|
- )
|
|
|
- };
|
|
|
- selectGoodsList.goodsInputData = goodsInputData;
|
|
|
- }
|
|
|
- if (selectGoodsList.templateType == "apply") {
|
|
|
- let goodsInputData = {
|
|
|
- type: "apply",
|
|
|
- applyAreasJson: JSON.stringify(this.applyAreas),
|
|
|
- examDateJson: JSON.stringify(
|
|
|
- this.examineList.find(
|
|
|
- exam => exam.educationId == this.educationId
|
|
|
- )
|
|
|
- )
|
|
|
- };
|
|
|
- selectGoodsList.goodsInputData = goodsInputData;
|
|
|
- }
|
|
|
- }
|
|
|
- var mas = [selectGoodsList];
|
|
|
- if (this.goodsDetail.sevenYear && this.goodsDetail.goodsType == 1) {
|
|
|
- mas = this.ruleForm.checkList.map(i => {
|
|
|
- return { ...selectGoodsList, sevenYear: i };
|
|
|
+ localStorage.setItem("checkGoodsList", JSON.stringify(itCopyDetail));
|
|
|
+ this.$router.push({
|
|
|
+ path: "/payment"
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "warning"
|
|
|
});
|
|
|
}
|
|
|
- localStorage.setItem("checkGoodsList", JSON.stringify(mas));
|
|
|
-
|
|
|
- this.$router.push({
|
|
|
- path: "/payment"
|
|
|
- });
|
|
|
},
|
|
|
/**
|
|
|
* 获取所有省份
|
|
@@ -296,15 +234,37 @@ export default {
|
|
|
}));
|
|
|
});
|
|
|
},
|
|
|
- areaChange() {
|
|
|
- let node = this.$refs["cascader"].getCheckedNodes()[0]; //选中的根节点
|
|
|
+ areaChange(row, index) {
|
|
|
+ let node = this.$refs["cascader" + index][0].getCheckedNodes()[0]; //选中的根节点
|
|
|
console.log(node);
|
|
|
- this.applyAreas = {
|
|
|
+ row.applyAreas = {
|
|
|
areaName: node.parent.label,
|
|
|
areaId: node.parent.value,
|
|
|
cityId: node.value,
|
|
|
cityName: node.label
|
|
|
};
|
|
|
+ },
|
|
|
+ lazyLoad(node, resolve) {
|
|
|
+ const { level } = node;
|
|
|
+ if (level == 0) {
|
|
|
+ // this.$request.getProvinceList().then((res) => {
|
|
|
+ // const nodes = res.rows.map((item) => ({
|
|
|
+ // value: item.areaId,
|
|
|
+ // label: `${item.areaName}`,
|
|
|
+ // leaf: level >= 1,
|
|
|
+ // }));
|
|
|
+ // resolve(nodes);
|
|
|
+ // });
|
|
|
+ } else if (level == 1) {
|
|
|
+ this.$request.getCityList({ parentId: node.value }).then(res => {
|
|
|
+ const nodes = res.rows.map(item => ({
|
|
|
+ value: item.areaId,
|
|
|
+ label: `${item.areaName}`,
|
|
|
+ leaf: level >= 1
|
|
|
+ }));
|
|
|
+ resolve(nodes);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|