|
@@ -12,7 +12,6 @@
|
|
|
</div>
|
|
|
<el-table border :data="tableData" style="width: 100%; margin-top: 16px">
|
|
|
<el-table-column
|
|
|
- align="center"
|
|
|
v-for="(item, index) in tableSet"
|
|
|
:key="index"
|
|
|
:prop="item.prop"
|
|
@@ -21,8 +20,15 @@
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<ul v-if="item.scope === 'list'">
|
|
|
- <li v-for="(items, indexs) in scope.row[item.prop]" :key="indexs">
|
|
|
- {{ items.goodsName }}({{ items.majob }})
|
|
|
+ <li
|
|
|
+ v-for="(items, indexs) in comList(
|
|
|
+ scope.row[item.prop],
|
|
|
+ item.goodsType
|
|
|
+ )"
|
|
|
+ :key="indexs"
|
|
|
+ >
|
|
|
+ {{ items.goodsName }}
|
|
|
+ <span v-if="items.categoryName">({{ items.categoryName }})</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
<span v-else>{{ scope.row[item.prop] }}</span>
|
|
@@ -34,6 +40,95 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="disBoxs"
|
|
|
+ width="660px"
|
|
|
+ :show-close="false"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <div slot="title" class="hearders">
|
|
|
+ <div class="leftTitle">
|
|
|
+ {{ newData.subjectName }} - 设置默认匹配商品
|
|
|
+ </div>
|
|
|
+ <div class="rightBoxs">
|
|
|
+ <img
|
|
|
+ src="@/assets/images/Close@2x.png"
|
|
|
+ alt=""
|
|
|
+ @click="disBoxs = false"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="4">
|
|
|
+ <ul>
|
|
|
+ <li
|
|
|
+ v-for="(item, index) in goodsType"
|
|
|
+ :key="index"
|
|
|
+ class="liSty"
|
|
|
+ :style="activeType === item.value ? 'color:red;' : ''"
|
|
|
+ @click="searchGoods(item.value)"
|
|
|
+ >
|
|
|
+ {{ item.label }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="20">
|
|
|
+ <div>
|
|
|
+ <el-input
|
|
|
+ :size="size"
|
|
|
+ v-model="goodsName"
|
|
|
+ style="width: 190px"
|
|
|
+ placeholder="请输入商品名称"
|
|
|
+ ></el-input>
|
|
|
+ <el-input
|
|
|
+ :size="size"
|
|
|
+ v-model="goodsPrice"
|
|
|
+ style="width: 190px"
|
|
|
+ placeholder="请输入商品标准价格"
|
|
|
+ ></el-input>
|
|
|
+ <el-button
|
|
|
+ :size="size"
|
|
|
+ style="margin-left: 10px"
|
|
|
+ type="primary"
|
|
|
+ @click="getSeachData(activeType)"
|
|
|
+ >查询</el-button
|
|
|
+ >
|
|
|
+ <el-button :size="size" @click="init">重置</el-button>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="margin-top: 14px; text-align: center"
|
|
|
+ v-if="!goodsList.length"
|
|
|
+ >
|
|
|
+ 暂无符合条件商品
|
|
|
+ </div>
|
|
|
+ <el-checkbox-group v-model="checkList">
|
|
|
+ <ul
|
|
|
+ style="
|
|
|
+ max-height: 240px;
|
|
|
+ overflow: auto;
|
|
|
+ background: #eee;
|
|
|
+ margin-top: 10px;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <li
|
|
|
+ v-for="(item, index) in goodsList"
|
|
|
+ :key="index"
|
|
|
+ style="padding: 10px; font-size: 13px"
|
|
|
+ >
|
|
|
+ <el-checkbox :label="item.goodsId">
|
|
|
+ {{ item.code }} - {{ item.goodsName }} -
|
|
|
+ <span style="color: red">¥{{ item.standPrice }}</span>
|
|
|
+ </el-checkbox>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="disBoxs = false">取 消</el-button>
|
|
|
+ <el-button @click="submitForms">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -42,38 +137,10 @@ export default {
|
|
|
name: "MatchInfoData",
|
|
|
data() {
|
|
|
return {
|
|
|
+ size: "mini",
|
|
|
queryData: {},
|
|
|
businessData: {},
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- subjectId: 1,
|
|
|
- subjectName: "科目一",
|
|
|
- videoGoods: [
|
|
|
- {
|
|
|
- goodsName: "商品一",
|
|
|
- majob: "专业",
|
|
|
- },
|
|
|
- ],
|
|
|
- bankGoods: [
|
|
|
- {
|
|
|
- goodsName: "商品二",
|
|
|
- majob: "专业",
|
|
|
- },
|
|
|
- ],
|
|
|
- bukaoGoods: [
|
|
|
- {
|
|
|
- goodsName: "商品三",
|
|
|
- majob: "专业",
|
|
|
- },
|
|
|
- ],
|
|
|
- qianpeiGoods: [
|
|
|
- {
|
|
|
- goodsName: "商品四",
|
|
|
- majob: "专业",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
+ tableData: [],
|
|
|
tableSet: [
|
|
|
{
|
|
|
label: "科目",
|
|
@@ -81,25 +148,55 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "视频-默认匹配商品",
|
|
|
- prop: "videoGoods",
|
|
|
+ prop: "goodsList",
|
|
|
scope: "list",
|
|
|
+ goodsType: 1,
|
|
|
},
|
|
|
{
|
|
|
label: "题库-默认匹配商品",
|
|
|
- prop: "bankGoods",
|
|
|
+ prop: "goodsList",
|
|
|
scope: "list",
|
|
|
+ goodsType: 2,
|
|
|
},
|
|
|
{
|
|
|
label: "补考-默认匹配商品",
|
|
|
- prop: "bukaoGoods",
|
|
|
+ prop: "goodsList",
|
|
|
scope: "list",
|
|
|
+ goodsType: 3,
|
|
|
},
|
|
|
{
|
|
|
label: "前培-默认匹配商品",
|
|
|
- prop: "qianpeiGoods",
|
|
|
+ prop: "goodsList",
|
|
|
scope: "list",
|
|
|
+ goodsType: 4,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ disBoxs: false,
|
|
|
+ goodsType: [
|
|
|
+ {
|
|
|
+ label: "视频商品",
|
|
|
+ value: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "题库商品",
|
|
|
+ value: 2,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "补考商品",
|
|
|
+ value: 3,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "前培商品",
|
|
|
+ value: 4,
|
|
|
},
|
|
|
],
|
|
|
+ activeType: "",
|
|
|
+ goodsName: "",
|
|
|
+ goodsPrice: "",
|
|
|
+ newData: {},
|
|
|
+ goodsList: [],
|
|
|
+ checkList: [],
|
|
|
+ statusPop: "", //1新增2修改
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -108,7 +205,112 @@ export default {
|
|
|
mounted() {
|
|
|
this.initData();
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ comList: function () {
|
|
|
+ return function (v, int) {
|
|
|
+ let arr = [];
|
|
|
+ v.forEach((item) => {
|
|
|
+ if (item.goodsType == int) {
|
|
|
+ arr.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return arr;
|
|
|
+ };
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ activeType(val, oldVal) {
|
|
|
+ if (!val) return;
|
|
|
+ this.getSeachData(val);
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ this.goodsName = "";
|
|
|
+ this.goodsPrice = "";
|
|
|
+ this.getSeachData(this.activeType);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 搜索弹窗内容
|
|
|
+ */
|
|
|
+ getSeachData(type) {
|
|
|
+ var priceReg = /(^[1-9]\d*(\.\d{1,2})?$)|(^0(\.\d{1,2})?$)/;
|
|
|
+ if (this.goodsPrice && !priceReg.test(this.goodsPrice)) {
|
|
|
+ this.$message.warning("请输入正确价格");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var data = {
|
|
|
+ goodsType: type,
|
|
|
+ goodsName: this.goodsName || "",
|
|
|
+ standPrice: this.goodsPrice || "",
|
|
|
+ };
|
|
|
+ if (type == 1 || type == 2) {
|
|
|
+ data.subjectId = this.newData.subjectId;
|
|
|
+ }
|
|
|
+ if (type == 3 || type == 4) {
|
|
|
+ data.businessIds = this.businessData.id;
|
|
|
+ }
|
|
|
+ this.$api.inquireGoods(data).then((res) => {
|
|
|
+ this.goodsList = res.rows;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 设置
|
|
|
+ */
|
|
|
+ setOption(v) {
|
|
|
+ this.newData = JSON.parse(JSON.stringify(v));
|
|
|
+ this.checkList = v.goodsList.map((item) => {
|
|
|
+ return item.goodsId;
|
|
|
+ });
|
|
|
+ if (this.checkList.length) {
|
|
|
+ this.statusPop = 2;
|
|
|
+ } else {
|
|
|
+ this.statusPop = 1;
|
|
|
+ }
|
|
|
+ this.activeType = 1;
|
|
|
+ this.goodsNameOrPrice = "";
|
|
|
+ this.disBoxs = true;
|
|
|
+ },
|
|
|
+ searchGoods(int) {
|
|
|
+ this.activeType = int;
|
|
|
+ },
|
|
|
+ submitForms() {
|
|
|
+ if (this.statusPop === 1) {
|
|
|
+ if (!this.checkList.length) {
|
|
|
+ this.$message.warning("请选择匹配商品");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //新增
|
|
|
+ this.$api
|
|
|
+ .apporderconfiggoods({
|
|
|
+ configId: this.queryData.id,
|
|
|
+ subjectId: this.newData.subjectId,
|
|
|
+ status: 1,
|
|
|
+ goodsIds: this.checkList.toString(),
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success("提交成功");
|
|
|
+ this.initData(true);
|
|
|
+ this.disBoxs = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.statusPop === 2) {
|
|
|
+ //修改
|
|
|
+ this.$api
|
|
|
+ .editorderconfiggoods({
|
|
|
+ configId: this.queryData.id,
|
|
|
+ id: this.newData.id,
|
|
|
+ subjectId: this.newData.subjectId,
|
|
|
+ status: this.checkList.length ? 1 : -1,
|
|
|
+ goodsIds: this.checkList.toString(),
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success("提交成功");
|
|
|
+ this.initData(true);
|
|
|
+ this.disBoxs = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
backConfig() {
|
|
|
this.$store.dispatch("tagsView/delView", this.$route).then((res) => {
|
|
|
this.$router.push({
|
|
@@ -116,24 +318,52 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- initData() {
|
|
|
+ initData(status) {
|
|
|
+ if (!status) {
|
|
|
+ this.$api
|
|
|
+ .obtainbusiness(Number(this.queryData.businessId))
|
|
|
+ .then((res) => {
|
|
|
+ this.businessData = res.data;
|
|
|
+ });
|
|
|
+ }
|
|
|
this.$api
|
|
|
- .obtainbusiness(Number(this.queryData.businessId))
|
|
|
+ .inquireCourseSubject({ businessId: Number(this.queryData.businessId) })
|
|
|
.then((res) => {
|
|
|
- this.businessData = res.data;
|
|
|
+ this.$api
|
|
|
+ .inquireorderconfiggoodsList({
|
|
|
+ configId: Number(this.queryData.id),
|
|
|
+ })
|
|
|
+ .then((result) => {
|
|
|
+ let arr = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ subjectId: item.id,
|
|
|
+ subjectName: item.subjectName,
|
|
|
+ goodsList: [],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ result.rows.forEach((item) => {
|
|
|
+ 0;
|
|
|
+ arr.forEach((items) => {
|
|
|
+ if (items.subjectId == item.subjectId) {
|
|
|
+ items.goodsList = item.goodsList;
|
|
|
+ items.id = item.id;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.tableData = arr;
|
|
|
+ });
|
|
|
});
|
|
|
- this.$api
|
|
|
- .inquireorderconfiggoodsList({
|
|
|
- configId: Number(this.queryData.id),
|
|
|
- })
|
|
|
- .then((res) => {});
|
|
|
},
|
|
|
- setOption(v) {},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
+.liSty {
|
|
|
+ padding: 8px 0px;
|
|
|
+ cursor: pointer;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
.topSty {
|
|
|
display: inline-block;
|
|
|
font-size: 14px;
|
|
@@ -141,4 +371,96 @@ export default {
|
|
|
background: #eee;
|
|
|
padding: 4px;
|
|
|
}
|
|
|
+/deep/.el-button {
|
|
|
+ border-radius: 8px;
|
|
|
+}
|
|
|
+/deep/.el-dialog {
|
|
|
+ border-radius: 8px;
|
|
|
+ .el-dialog__header {
|
|
|
+ padding: 0;
|
|
|
+ .hearders {
|
|
|
+ height: 40px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0px 18px 0px 20px;
|
|
|
+ border-bottom: 1px solid #e2e2e2;
|
|
|
+ .leftTitle {
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #2f4378;
|
|
|
+ }
|
|
|
+ .rightBoxs {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ img {
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+ margin-left: 13px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-dialog__body {
|
|
|
+ padding: 10px 20px;
|
|
|
+ }
|
|
|
+ .el-dialog__footer {
|
|
|
+ padding: 0;
|
|
|
+ .dialog-footer {
|
|
|
+ padding: 0px 40px;
|
|
|
+ height: 70px;
|
|
|
+ border-top: 1px solid #e2e2e2;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.imgBox {
|
|
|
+ width: 100%;
|
|
|
+ // height: 210px;
|
|
|
+ border: 1px solid #e2e2e2;
|
|
|
+ border-radius: 8px;
|
|
|
+ padding: 8px 8px 3px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ .imgLabel {
|
|
|
+ flex: 1;
|
|
|
+ width: 100%;
|
|
|
+ border: 1px dotted #e2e2e2;
|
|
|
+ color: #999;
|
|
|
+ font-size: 14px;
|
|
|
+ cursor: pointer;
|
|
|
+ border-radius: 8px;
|
|
|
+ .msPhoto {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 270px;
|
|
|
+ img {
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 270px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .imgbbx {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ i {
|
|
|
+ font-weight: bold;
|
|
|
+ margin: 14px 0;
|
|
|
+ font-size: 24px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ p {
|
|
|
+ margin: 5px 0px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|