diff --git a/src/views/components/commonBookTags/shopproduct.vue b/src/views/components/commonBookTags/shopproduct.vue index cc81f00..942935e 100644 --- a/src/views/components/commonBookTags/shopproduct.vue +++ b/src/views/components/commonBookTags/shopproduct.vue @@ -1,6 +1,8 @@ - + + --> + + + { - if (data && data.code === 0) { - this.dataList = data.result.records; - this.totalPage = data.result.total; - } else { - this.dataList = []; - this.totalPage = 0; - } - // setTimeout(async () => { - // await this.setSelectRow(); - // }, 200); - this.dataListLoading = false; - }); + if (this.defaultForm.httpType == "raw") { + form.page = this.pageIndex; + this.$http + .request({ + url: this.$http.adornUrl(`${this.urlList.CanBindProductList}`), + method: "POST", + data: { + ...form + }, + header: { + //默认 无 说明:请求头 + "Content-Type": "application/json" + } + }) + .then(({ data }) => { + if (data && data.code === 0) { + this.dataList = [...data.page[this.defaultForm.httpDataValueName]]; + this.totalPage = data.page[this.defaultForm.httpDataTotalName]; + } else { + this.dataList = []; + this.totalPage = 0; + } + // setTimeout(async () => { + // await this.setSelectRow(); + // }, 200); + this.dataListLoading = false; + }); + } else { + form.current = this.pageIndex; + await this.$http({ + url: this.$http.adornUrl(this.urlList.getNotToLabelList), + method: "post", + data: this.$http.adornData(form) + }).then(({ data }) => { + if (data && data.code === 0) { + this.dataList = data.result.records; + this.totalPage = data.result.total; + } else { + this.dataList = []; + this.totalPage = 0; + } + // setTimeout(async () => { + // await this.setSelectRow(); + // }, 200); + this.dataListLoading = false; + }); + } }, clear() { // this.$refs.table.clearSelection(); diff --git a/src/views/modules/shop/commonBookTags/correlation.vue b/src/views/modules/shop/commonBookTags/correlation.vue index 7eb7a6d..380d9cc 100644 --- a/src/views/modules/shop/commonBookTags/correlation.vue +++ b/src/views/modules/shop/commonBookTags/correlation.vue @@ -21,29 +21,37 @@ > -
+
- - - - - - - - - +

+ 已关联图书列表 +

+ + +
+
+
+
+

+ 已关联课程列表 +

+
@@ -129,15 +137,19 @@ export default { chooseBookVisible: false, bookIds: [], goodsTypeList: [], - urlList: { - treeList: "/master/shopProduct/getProductToLabel", - treeMarketList: "/book/labelAndMarket/marketTree", - deleteBookShop: "/book/labelAndMarket/delToLable", - deleteBookShopMarket: "/book/labelAndMarket/delToMarket", - saveBookShop: "/book/labelAndMarket/saveToLabel", - saveBookShopMarket: "/book/labelAndMarket/saveToMarket", - getToLabelList: "/book/labelAndMarket/getToLabelList", - getToMarketList: "/book/labelAndMarket/getToMarketList" + urlBookList: { + deleteShop: "/master/shopProduct/unbindProductAndBook", + saveShop: "/master/shopProduct/bindProductAndBook", + + hasBindProductList: "/master/shopProduct/getHasBindProductAndBook", //已绑定 + CanBindProductList: "/master/shopProduct/getCanBindProductAndBook" //未绑定 + }, + urlCurriculumList: { + deleteShop: "/master/shopProduct/unbindProductAndCourse", + saveShop: "/master/shopProduct/bindProductAndCourse", + + hasBindProductList: "/master/shopProduct/getHasBindProductAndCourse", //已绑定 + CanBindProductList: "/master/shopProduct/getCanBindProductAndCourse" //未绑定 } }; }, @@ -366,7 +378,9 @@ export default { this.activeNames.push(e.collapseMarketKey); }); setTimeout(async () => { - await this.getDataList(id); + // await this.getDataList(id); + await this.$refs.commonOperationsBook.open(id); + await this.$refs.commonOperationsCurriculum.open(id); }, 200); // this.pageIndex = 1; @@ -626,10 +640,10 @@ export default { // border: 1px solid #ebeef5 !important; } .item-content { - padding: 20px; + padding: 10px 10px 0; padding-top: 0; overflow-y: auto; - height: calc(100% - 80px); + height: calc(100% ); } /deep/.el-collapse-item { margin-bottom: 20px; @@ -652,4 +666,12 @@ export default { /deep/.el-collapse { border-bottom: none !important; } +.item-content-title { + background: #17b3a3 !important; + height: 36px !important; + color: #fff; + font-size: 16px; + padding-left: 15px; + line-height: 36px; +} diff --git a/src/views/modules/shop/commonBookTags/operationsList.vue b/src/views/modules/shop/commonBookTags/operationsList.vue index 4072348..18a09fb 100644 --- a/src/views/modules/shop/commonBookTags/operationsList.vue +++ b/src/views/modules/shop/commonBookTags/operationsList.vue @@ -1,11 +1,11 @@ - - + --> @@ -235,8 +250,11 @@ - - + +
+ + + + + +

+{{ selectCourse.courseTitle }} +

+ + +
+ +

+{{ selectCourse.courseCatalogueTitle}} +

+ + +
+ + + + + + + +
+
+ + 取 消 + 确 定 + +
@@ -414,21 +550,31 @@ import commonShopTable from "@/views/components/commonBookTags/shopproductTable. import commonTree from "@/views/components/commonBookTags/tags.vue"; // import dialogComponent from './seckillprodrelation' export default { - props: ["title", "source"], + props: ["title", "source", "urlList", "productId"], data() { return { + selectCourseId: null, + selectCourse: { + courseTitle: "", + courseCatalogueTitle: "" + }, + + validityPeriodList: [ + { + value: 180, + label: "半年(180天)" + }, + { + value: 365, + label: "一年(365天)" + } + ], + validityPeriod: 180, isEdit: false, + dialogVisible: false, checkAll: false, isIndeterminate: true, - urlList: { - treeList: "/master/courseMarket/marketTree", - delete: "/master/courseMarket/delMarket", - deleteShop: "/master/courseMarket/delToMarket", - saveShop: "/master/courseMarket/saveToMarket", - add: "/master/courseMarket/saveOrUpdateMarket", - getAssociatedGoodsList: "/master/courseMarket/getCourseByMarketId", - getNotToLabelList: "/master/courseMarket/getNotToMarketList" - }, + addForm: {}, isFresh: false, dataRule: { @@ -520,6 +666,9 @@ export default { this.getDataList(); }, methods: { + handleChangeValidityPeriod(val) { + console.log("val at line 584:", val); + }, UpNumber(e) { e.target.value = e.target.value.replace(/[^\d]/g, ""); }, @@ -532,33 +681,74 @@ export default { this.$refs.commonShop.handleCheckAllChange(val); }); }, + open(id) { + console.log("id at line 617:", id); + // this.productId=id + console.log("this.productId at line 615:", this.productId); + if (this.$refs.commonShop) { + this.$refs.commonShop.getAssociatedGoodsList(); + } + }, + + handleSubmit(ids, data) { + console.log("ids at line 646:", ids); + + if (this.source == "curriculum") { + this.selectCourseId = data.catalogueId; + this.validityPeriod = 180; + this.selectCourse = data; + this.openSelectTime(); + } else { + this.selectCourseId = ids; + + this.handleSubmitShopTable(); + } + }, + openSelectTime(ids) { + this.dialogVisible = true; + }, handleSubmitShopTable: debounce(async function(ids) { - await this.$http({ - url: this.$http.adornUrl(`${this.urlList.saveShop}`), - method: "post", - data: this.$http.adornData({ - courseId: ids, - marketId: this.addForm.id + var data = { + productId: this.productId + }; + if (this.source == "curriculum") { + data.days = this.validityPeriod; + data.catalogueId = this.selectCourseId; + } else { + data.bookId = this.selectCourseId; + } + console.log(data, "绑定数据信息 111"); + this.$http + .request({ + url: this.$http.adornUrl(`${this.urlList.saveShop}`), + method: "POST", + data: data, + header: { + //默认 无 说明:请求头 + "Content-Type": "application/json" + } }) - }).then(async ({ data }) => { - if (data && data.code === 0) { - this.$message.success(data.msg); - if (this.$refs.commonShop) { - // this.$refs.commonShop.getAssociatedGoodsList.dataForm={ - // ...this.$refs.commonShop.getAssociatedGoodsList.dataForm, - // id:this.addForm.id ? this.addForm.id : null - // } + .then(async ({ data }) => { + if (data && data.code === 0) { + this.$message.success(data.msg); - this.$refs.commonShop.getAssociatedGoodsList(); + if (this.$refs.commonShop) { + // this.$refs.commonShop.getAssociatedGoodsList.dataForm={ + // ...this.$refs.commonShop.getAssociatedGoodsList.dataForm, + // id:this.addForm.id ? this.addForm.id : null + // } + + this.$refs.commonShop.getAssociatedGoodsList(); + } + if (this.$refs.commonShopTable) { + this.$refs.commonShopTable.close(); + } + this.dialogVisible = false; + } else { + this.$message.error(data.msg); } - if (this.$refs.commonShopTable) { - this.$refs.commonShopTable.close(); - } - } else { - this.$message.error(data.msg); - } - }); + }); }, 100), openTable() { this.isEdit = false; @@ -652,7 +842,7 @@ export default { dataFormDelete: debounce(async function(row, deleteType) { console.log("row at line 515:", row); this.$confirm( - `确定要删除${deleteType != "all" ? "该" : "所有"}关联课程嘛?`, + `确定要删除${deleteType != "all" ? "该" : "所有"}关联${this.title}嘛?`, "提示", { confirmButtonText: "确定", @@ -663,7 +853,12 @@ export default { .then(async () => { // var lableIds = row[0].bookLabelId; var productIds = row[0].id; - + var data = { productId: this.productId }; + if (this.source == "curriculum") { + data.catalogueId = row[0].catalogueId; + } else { + data.bookId = row[0].id; + } // // return false // var selectShopArr = this.$refs.commonShop.selectShopArr; // console.log(selectShopArr, "1111"); @@ -673,31 +868,42 @@ export default { // return false; // } this.$refs.commonShop.dataListLoading = true; - - await this.$http({ - url: this.$http.adornUrl( - `${this.urlList.deleteShop}?marketId=${ - this.addForm.id - }&courseId=${productIds}` - ), - method: "post" - }).then(async ({ data }) => { - if (data && data.code === 0) { - this.$message.success("删除成功"); - } else { - this.$message.error(data.msg); - } - this.$nextTick(() => { - // this.$refs.commonShop.selectShopArr = []; - if (this.$refs.commonShop) { - // this.$refs.commonShop.getAssociatedGoodsList.dataForm={ - // ...this.$refs.commonShop.getAssociatedGoodsList.dataForm, - // id:this.addForm.id ? this.addForm.id : null - // } - this.$refs.commonShop.getAssociatedGoodsList(); + this.$http + .request({ + url: this.$http.adornUrl(`${this.urlList.deleteShop}`), + method: "POST", + data: data, + header: { + //默认 无 说明:请求头 + "Content-Type": "application/json" } + }) + // await this.$http({ + // url: this.$http.adornUrl( + // `${this.urlList.deleteShop}?marketId=${ + // this.addForm.id + // }&courseId=${productIds}` + // ), + // method: "post" + // }) + + .then(async ({ data }) => { + if (data && data.code === 0) { + this.$message.success("删除成功"); + } else { + this.$message.error(data.msg); + } + this.$nextTick(() => { + // this.$refs.commonShop.selectShopArr = []; + if (this.$refs.commonShop) { + // this.$refs.commonShop.getAssociatedGoodsList.dataForm={ + // ...this.$refs.commonShop.getAssociatedGoodsList.dataForm, + // id:this.addForm.id ? this.addForm.id : null + // } + this.$refs.commonShop.getAssociatedGoodsList(); + } + }); }); - }); }) .catch(() => {}); }, 200), @@ -1129,7 +1335,7 @@ export default { .mod-config { width: 100%; - height: 82vh; + height: calc(100% - 80px); overflow: hidden; } @@ -1249,4 +1455,23 @@ p { margin-top: -10px !important; // float: right !important; } +/deep/.mod-config .shop_box { + height: calc(100% - 0px); + // float: right !important; +} +/deep/.mod-config .selectTimeBox { + .input_item{ + color: #606266; + display: inline-block; + font-size: inherit; + height: 40px; + line-height: 40px; + outline: 0; + padding: 0 15px; + } + + // float: right !important; +} + + diff --git a/src/views/modules/shop/shopproduct.vue b/src/views/modules/shop/shopproduct.vue index d757a9c..88b07b5 100644 --- a/src/views/modules/shop/shopproduct.vue +++ b/src/views/modules/shop/shopproduct.vue @@ -133,7 +133,7 @@ 关联绑定图书与课程