|
@@ -10,49 +10,51 @@
|
|
<span
|
|
<span
|
|
>人数:<i>{{ apiData.userGoodsList.length || 0 }}位</i></span
|
|
>人数:<i>{{ apiData.userGoodsList.length || 0 }}位</i></span
|
|
>
|
|
>
|
|
- <span
|
|
|
|
|
|
+ <!-- <span
|
|
>数量:<i>{{ getTotal(apiData.userGoodsList) }}个</i></span
|
|
>数量:<i>{{ getTotal(apiData.userGoodsList) }}个</i></span
|
|
- >
|
|
|
|
|
|
+ > -->
|
|
<span
|
|
<span
|
|
>总金额:<i
|
|
>总金额:<i
|
|
- ><span style="color:red;">¥{{ getTotalPrice(apiData.userGoodsList) | formatPrice }}</span> </i
|
|
|
|
- ></span
|
|
|
|
|
|
+ ><span style="color:red;"
|
|
|
|
+ >¥{{ getTotalPrice(apiData.userGoodsList) | formatPrice }}</span
|
|
|
|
+ >
|
|
|
|
+ </i></span
|
|
>
|
|
>
|
|
</header>
|
|
</header>
|
|
- <header class="header_t">
|
|
|
|
- <div>
|
|
|
|
- <el-input
|
|
|
|
- v-model="searchData.searchKey"
|
|
|
|
- :size="size"
|
|
|
|
- placeholder="输入姓名/身份证号"
|
|
|
|
- style="margin-right:10px;"
|
|
|
|
- ></el-input>
|
|
|
|
- <el-button :size="size" @click="searchData.searchKey = ''"
|
|
|
|
- >重置</el-button
|
|
|
|
- >
|
|
|
|
- </div>
|
|
|
|
- <div>
|
|
|
|
- <el-button :size="size" type="primary" @click="studentPage(-1)"
|
|
|
|
- >新增学员</el-button
|
|
|
|
- >
|
|
|
|
- <el-button :size="size" type="primary" @click="importStudentFunc"
|
|
|
|
- >导入学员</el-button
|
|
|
|
- >
|
|
|
|
- <el-button :size="size" type="primary" @click="goodsCheckBox(-1)"
|
|
|
|
- >匹配商品</el-button
|
|
|
|
- >
|
|
|
|
- <el-button :size="size" type="primary" @click="del(-1)"
|
|
|
|
- >批量删除</el-button
|
|
|
|
- >
|
|
|
|
- <el-button :size="size" type="primary" @click="backFunc"
|
|
|
|
- >上一步</el-button
|
|
|
|
- >
|
|
|
|
- <el-button :size="size" type="warning" @click="submit"
|
|
|
|
- >提交支付</el-button
|
|
|
|
- >
|
|
|
|
- </div>
|
|
|
|
- </header>
|
|
|
|
- <el-main>
|
|
|
|
|
|
+ <el-main v-loading="loading">
|
|
|
|
+ <header class="header_t" style="margin-bottom:14px;">
|
|
|
|
+ <div>
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="searchData.searchKey"
|
|
|
|
+ :size="size"
|
|
|
|
+ placeholder="输入姓名/身份证号"
|
|
|
|
+ style="margin-right:10px;"
|
|
|
|
+ ></el-input>
|
|
|
|
+ <el-button :size="size" @click="searchData.searchKey = ''"
|
|
|
|
+ >重置</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <el-button :size="size" type="primary" @click="studentPage(-1)"
|
|
|
|
+ >新增学员</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button :size="size" type="primary" @click="importStudentFunc"
|
|
|
|
+ >导入学员</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button :size="size" type="primary" @click="goodsCheckBox(-1)"
|
|
|
|
+ >匹配商品</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button :size="size" type="primary" @click="del(-1)"
|
|
|
|
+ >批量删除</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button :size="size" type="primary" @click="backFunc"
|
|
|
|
+ >上一步</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button :size="size" type="warning" @click="submit"
|
|
|
|
+ >提交支付</el-button
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
|
|
+ </header>
|
|
<el-form :model="apiData" :rules="rules" ref="ruleForm">
|
|
<el-form :model="apiData" :rules="rules" ref="ruleForm">
|
|
<el-table
|
|
<el-table
|
|
max-height="520px"
|
|
max-height="520px"
|
|
@@ -92,7 +94,10 @@
|
|
:prop="'userGoodsList.' + scope.$index + '.' + item.prop"
|
|
:prop="'userGoodsList.' + scope.$index + '.' + item.prop"
|
|
:rules="rules[item.prop]"
|
|
:rules="rules[item.prop]"
|
|
>
|
|
>
|
|
- <el-input v-model="scope.row[item.prop]"></el-input>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="scope.row[item.prop]"
|
|
|
|
+ @change="changeInput(item.prop)"
|
|
|
|
+ ></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-select
|
|
<el-select
|
|
@@ -143,10 +148,10 @@
|
|
<el-button
|
|
<el-button
|
|
type="text"
|
|
type="text"
|
|
:size="size"
|
|
:size="size"
|
|
- @click="goodsCheckBox(scope.$index, scope.row.goodsList)"
|
|
|
|
|
|
+ @click="goodsCheckBox(scope.row.code, scope.row.goodsList)"
|
|
>匹配商品</el-button
|
|
>匹配商品</el-button
|
|
>
|
|
>
|
|
- <el-button type="text" :size="size" @click="del(scope.$index)"
|
|
|
|
|
|
+ <el-button type="text" :size="size" @click="del(scope.row.code)"
|
|
>删除</el-button
|
|
>删除</el-button
|
|
>
|
|
>
|
|
</template>
|
|
</template>
|
|
@@ -192,7 +197,20 @@ export default {
|
|
} else if (this.checkTel == value) {
|
|
} else if (this.checkTel == value) {
|
|
return callback(new Error("当前手机号码已被创建"));
|
|
return callback(new Error("当前手机号码已被创建"));
|
|
} else {
|
|
} else {
|
|
- callback();
|
|
|
|
|
|
+ let num = 0;
|
|
|
|
+ for (let i = 0; i < this.apiData.userGoodsList.length; i++) {
|
|
|
|
+ if (num > 1) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (this.apiData.userGoodsList[i].telphone == value) {
|
|
|
|
+ num++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (num > 1) {
|
|
|
|
+ return callback(new Error("提示:手机号码重复"));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const validateIdcard = (rule, value, callback) => {
|
|
const validateIdcard = (rule, value, callback) => {
|
|
@@ -201,10 +219,24 @@ export default {
|
|
if (!_IDRe18.test(value) && !_IDre15.test(value)) {
|
|
if (!_IDRe18.test(value) && !_IDre15.test(value)) {
|
|
return callback(new Error("请输入正确身份证号码"));
|
|
return callback(new Error("请输入正确身份证号码"));
|
|
} else {
|
|
} else {
|
|
- callback();
|
|
|
|
|
|
+ let num = 0;
|
|
|
|
+ for (let i = 0; i < this.apiData.userGoodsList.length; i++) {
|
|
|
|
+ if (num > 1) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (this.apiData.userGoodsList[i].idCard == value) {
|
|
|
|
+ num++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (num > 1) {
|
|
|
|
+ return callback(new Error("提示:身份证重复"));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return {
|
|
return {
|
|
|
|
+ loading: false,
|
|
rules: {
|
|
rules: {
|
|
realname: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
|
realname: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
|
idCard: [
|
|
idCard: [
|
|
@@ -220,6 +252,9 @@ export default {
|
|
trigger: "blur",
|
|
trigger: "blur",
|
|
validator: validateTel
|
|
validator: validateTel
|
|
}
|
|
}
|
|
|
|
+ ],
|
|
|
|
+ companyName: [
|
|
|
|
+ { required: true, message: "请输入所属公司", trigger: "blur" }
|
|
]
|
|
]
|
|
},
|
|
},
|
|
size: "small",
|
|
size: "small",
|
|
@@ -264,8 +299,7 @@ export default {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label: "金额",
|
|
label: "金额",
|
|
- scope: "price",
|
|
|
|
- width: "180px"
|
|
|
|
|
|
+ scope: "price"
|
|
}
|
|
}
|
|
]
|
|
]
|
|
};
|
|
};
|
|
@@ -331,83 +365,7 @@ export default {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- mounted() {
|
|
|
|
- const apiData = {
|
|
|
|
- goodsType: 1,
|
|
|
|
- educationTypeId: 107,
|
|
|
|
- projectId: 3665,
|
|
|
|
- businessId: 34355,
|
|
|
|
- inputFrom: 1,
|
|
|
|
- payType: 1,
|
|
|
|
- userGoodsList: [
|
|
|
|
- {
|
|
|
|
- realname: "唐",
|
|
|
|
- sex: "男",
|
|
|
|
- idCard: "445224199901043000",
|
|
|
|
- telphone: "13602712680",
|
|
|
|
- eduLevel: "小学",
|
|
|
|
- companyName: "中正",
|
|
|
|
- goodsList: [
|
|
|
|
- {
|
|
|
|
- goodsId: 303723,
|
|
|
|
- goodsName: "2023年一级建造师-选修1",
|
|
|
|
- year: 2023,
|
|
|
|
- subjectNames: "市政,必修,矿业,建筑,机电,水利水电,公路",
|
|
|
|
- standPrice: 3433523
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- goodsId: 303724,
|
|
|
|
- goodsName: "2023年一级建造师-选修2",
|
|
|
|
- year: 2023,
|
|
|
|
- subjectNames: "市政,必修,矿业,建筑,机电,水利水电,公路",
|
|
|
|
- standPrice: 34424
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- realname: "连",
|
|
|
|
- sex: "男",
|
|
|
|
- idCard: "445224199901013055",
|
|
|
|
- telphone: "13602711111",
|
|
|
|
- eduLevel: "初中",
|
|
|
|
- companyName: "中正",
|
|
|
|
- goodsList: [
|
|
|
|
- {
|
|
|
|
- goodsId: 303723,
|
|
|
|
- goodsName: "2023年一级建造师-选修1",
|
|
|
|
- year: 2023,
|
|
|
|
- subjectNames: "市政,必修,矿业,建筑,机电,水利水电,公路",
|
|
|
|
- standPrice: 3433523
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- realname: "锋",
|
|
|
|
- sex: "男",
|
|
|
|
- idCard: "445224199901013056",
|
|
|
|
- telphone: "13602711112",
|
|
|
|
- eduLevel: "初中",
|
|
|
|
- companyName: "中正",
|
|
|
|
- goodsList: [
|
|
|
|
- {
|
|
|
|
- goodsId: 303723,
|
|
|
|
- goodsName: "2023年一级建造师-选修1",
|
|
|
|
- year: 2023,
|
|
|
|
- subjectNames: "市政,必修,矿业,建筑,机电,水利水电,公路",
|
|
|
|
- standPrice: 3433523
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- goodsId: 303722,
|
|
|
|
- goodsName: "2023年一级建造师-必修",
|
|
|
|
- year: 2023,
|
|
|
|
- subjectNames: "市政,必修,矿业,建筑,机电,水利水电,公路",
|
|
|
|
- standPrice: 15641651
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
|
|
+ mounted() {},
|
|
methods: {
|
|
methods: {
|
|
submit() {
|
|
submit() {
|
|
if (this.apiData.userGoodsList.length == 0) {
|
|
if (this.apiData.userGoodsList.length == 0) {
|
|
@@ -430,6 +388,7 @@ export default {
|
|
type: "warning"
|
|
type: "warning"
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
|
|
+ this.loading = true;
|
|
let ary = JSON.parse(JSON.stringify(this.apiData));
|
|
let ary = JSON.parse(JSON.stringify(this.apiData));
|
|
ary.userGoodsList.forEach(i => {
|
|
ary.userGoodsList.forEach(i => {
|
|
i.user = {
|
|
i.user = {
|
|
@@ -460,6 +419,9 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.$message.error(err.msg);
|
|
this.$message.error(err.msg);
|
|
}
|
|
}
|
|
|
|
+ })
|
|
|
|
+ .finally(() => {
|
|
|
|
+ this.loading = false;
|
|
});
|
|
});
|
|
})
|
|
})
|
|
.catch(() => {});
|
|
.catch(() => {});
|
|
@@ -468,6 +430,30 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ changeInput(item) {
|
|
|
|
+ if (item == "idCard") {
|
|
|
|
+ this.apiData.userGoodsList.forEach((i, k) => {
|
|
|
|
+ this.$refs["ruleForm"].validateField(
|
|
|
|
+ "userGoodsList." + k + ".idCard"
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (item == "telphone") {
|
|
|
|
+ this.apiData.userGoodsList.forEach((i, k) => {
|
|
|
|
+ this.$refs["ruleForm"].validateField(
|
|
|
|
+ "userGoodsList." + k + ".telphone"
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getCode() {
|
|
|
|
+ var code = "";
|
|
|
|
+ for (var i = 1; i <= 10; i++) {
|
|
|
|
+ const num = Math.floor(Math.random() * 10);
|
|
|
|
+ code += num;
|
|
|
|
+ }
|
|
|
|
+ return code;
|
|
|
|
+ },
|
|
//学员编辑
|
|
//学员编辑
|
|
studentPage(index, row) {
|
|
studentPage(index, row) {
|
|
this.$refs.studentPage.openBoxs(index, row);
|
|
this.$refs.studentPage.openBoxs(index, row);
|
|
@@ -495,9 +481,15 @@ export default {
|
|
this.$refs.importStudent.openBoxs(true);
|
|
this.$refs.importStudent.openBoxs(true);
|
|
},
|
|
},
|
|
backStudentFunc(row) {
|
|
backStudentFunc(row) {
|
|
|
|
+ row.forEach(i => {
|
|
|
|
+ i.goodsList = [];
|
|
|
|
+ i.code = this.getCode();
|
|
|
|
+ });
|
|
this.apiData.userGoodsList.push(...row);
|
|
this.apiData.userGoodsList.push(...row);
|
|
},
|
|
},
|
|
backStudentData(index, row) {
|
|
backStudentData(index, row) {
|
|
|
|
+ row.goodsList = [];
|
|
|
|
+ row.code = this.getCode();
|
|
if (index == -1) {
|
|
if (index == -1) {
|
|
this.apiData.userGoodsList.push(row);
|
|
this.apiData.userGoodsList.push(row);
|
|
} else {
|
|
} else {
|
|
@@ -535,8 +527,16 @@ export default {
|
|
type: "warning"
|
|
type: "warning"
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
- this.apiData.userGoodsList.splice(index, 1);
|
|
|
|
- this.$message.success("操作成功");
|
|
|
|
|
|
+ const findIndex = this.apiData.userGoodsList.findIndex(
|
|
|
|
+ i => i.code == index
|
|
|
|
+ );
|
|
|
|
+ if (findIndex == -1) {
|
|
|
|
+ this.$message.error("数据异常,删除失败");
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ this.apiData.userGoodsList.splice(findIndex, 1);
|
|
|
|
+ this.$message.success("操作成功");
|
|
|
|
+ }
|
|
})
|
|
})
|
|
.catch(() => {});
|
|
.catch(() => {});
|
|
}
|
|
}
|
|
@@ -548,7 +548,16 @@ export default {
|
|
});
|
|
});
|
|
this.$refs.table.clearSelection();
|
|
this.$refs.table.clearSelection();
|
|
} else {
|
|
} else {
|
|
- this.$set(this.apiData.userGoodsList[index], "goodsList", ary);
|
|
|
|
|
|
+ const findIndex = this.apiData.userGoodsList.findIndex(
|
|
|
|
+ i => i.code == index
|
|
|
|
+ );
|
|
|
|
+ if (findIndex == -1) {
|
|
|
|
+ this.$message.error("数据异常,删除失败");
|
|
|
|
+ return;
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(this.apiData.userGoodsList[findIndex], "goodsList", ary);
|
|
|
|
+ this.$message.success("操作成功");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
this.$message.success("操作成功");
|
|
this.$message.success("操作成功");
|
|
},
|
|
},
|