| | |
| | | name: "", |
| | | }, |
| | | bookDetail: {}, |
| | | bookClass: [], |
| | | bookItemDetail: {}, |
| | | link: { |
| | | jd: "", |
| | |
| | | icon1: { |
| | | name: "/static/images/bookService/detail/dangdang.png", |
| | | }, |
| | | rowCol: [{ |
| | | width: '50%', |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, |
| | | { |
| | | width: '80%' |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, { |
| | | width: '100%' |
| | | }, |
| | | ] |
| | | }, |
| | | |
| | | resetTree: function (e) { |
| | |
| | | onShow() { |
| | | if (wx.getStorageSync("paperBookList")) { |
| | | this.setData({ |
| | | paperBookList: wx.getStorageSync("paperBookList"), |
| | | paperBookList: JSON.parse(wx.getStorageSync("paperBookList")), |
| | | }); |
| | | } |
| | | if (wx.getStorageSync("electronicBookList")) { |
| | | this.setData({ |
| | | electronicBookList: wx.getStorageSync("electronicBookList"), |
| | | electronicBookList: JSON.parse(wx.getStorageSync("electronicBookList")), |
| | | }); |
| | | } |
| | | this.setData({ |
| | | num: this.data.paperBookList.length + this.data.electronicBookList.length, |
| | | num: Number(this.data.paperBookList.length) + Number(this.data.electronicBookList.length), |
| | | }); |
| | | }, |
| | | |
| | |
| | | } |
| | | this.getSubTtem(); |
| | | // 获取图书分类 |
| | | let className = ""; |
| | | if (res.datas.bookClassification) { |
| | | const bookClassification = JSON.parse(res.datas.bookClassification); |
| | | if (Array.isArray(bookClassification) && bookClassification.length) { |
| | | const iconType = bookClassification[0][0]; |
| | | const classType = bookClassification[0][1]; |
| | | className = await this.getBookClass(iconType, classType); |
| | | for (let index = 0; index < bookClassification.length; index++) { |
| | | const element = bookClassification[index]; |
| | | const iconType = element[0]; |
| | | const classType = element[1]; |
| | | await this.getBookClass(iconType, classType); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | "bookDetail.publicationDate": this.formatDate( |
| | | this.data.bookDetail.publicationDate |
| | | ), |
| | | "bookDetail.class": className, |
| | | "bookDetail.price": this.numFormat(this.data.bookDetail.price), |
| | | "bookDetail.oldPrice": this.numFormat(this.data.bookDetail.oldPrice), |
| | | "bookDetail.paperPrice": this.numFormat( |
| | |
| | | ), |
| | | pageLoading: false, |
| | | }); |
| | | console.log("图书信息", this.data.bookDetail); |
| | | console.log("图书信息", this.data.bookClass); |
| | | }); |
| | | }, |
| | | //请求子商品的文件 |
| | |
| | | }; |
| | | app.MG.store.getProductList(obj).then((res) => { |
| | | if (res.datas && res.datas.length > 0) { |
| | | console.log(res.datas[0], 2); |
| | | this.setData({ |
| | | bookItemDetail: res.datas[0], |
| | | selectedIds: res.datas[0].defaultSaleMethod.id, |
| | |
| | | if (item.value == iconType) { |
| | | item.child.forEach((citem) => { |
| | | if (citem.value == classType) { |
| | | name = citem.name; |
| | | const flag = this.data.bookClass.findIndex((ditem) => ditem == citem.name) |
| | | if (flag == -1) { |
| | | let list = this.data.bookClass |
| | | list.push(citem.name) |
| | | this.setData({ |
| | | bookClass: list |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | return name; |
| | | }, |
| | | // 收藏 |
| | | setCollect() { |
| | |
| | | loading: false, |
| | | openTeachids: result, |
| | | }); |
| | | console.log("教学资源", list); |
| | | } else if (type.refCode == "jsek_cloudLearning") { |
| | | let arr = this.handleTreeData(list).filter( |
| | | (item) => item.saleMethod[0] |
| | |
| | | item.disabled = true; |
| | | } |
| | | } |
| | | if (item.file) { |
| | | if (item.file && item.fileMap && item.fileMap[item.file]) { |
| | | if (item.fileMap[item.file].protectType == "Private") |
| | | item.disabled = true; |
| | | } |
| | |
| | | }, |
| | | |
| | | async buyBook() { |
| | | console.log( |
| | | this.data.bookItemDetail.defaultSaleMethodId, |
| | | "this.data.bookItemDetail.defaultSaleMethodId" |
| | | ); |
| | | if (!this.data.expire) { |
| | | let bookOrdersId = ""; |
| | | let query = { |
| | |
| | | // 发起订单初始化请求并等待结果 |
| | | const res = await app.MG.store.initOrder(query); |
| | | // 获取订单号并赋值给 orderNumber.value |
| | | console.log(res, 'res456'); |
| | | bookOrdersId = res.orderNumber; |
| | | console.log(bookOrdersId); |
| | | // 检查订单号是否存在 |
| | | if (bookOrdersId) { |
| | | if (this.data.bookDetail.price == "0.00") { |
| | |
| | | } |
| | | }); |
| | | } else { |
| | | const url = |
| | | "/pages/cart/paymentPage/index?orderNumber=" + bookOrdersId; |
| | | const url = "/pages/cart/paymentPage/index?orderNumber=" + bookOrdersId + '&onNorderSaleMethod=' + res.saleMethodLinks[0].orderSaleMethod.id; |
| | | wx.navigateTo({ |
| | | url, |
| | | }); |
| | |
| | | }, |
| | | |
| | | updateShoppingCartHidden() { |
| | | |
| | | const isSHow = this.data.shoppingCartGetId.some( |
| | | (item) => item == data.saleMethod[0].Id |
| | | ); |
| | | console.log(isSHow); |
| | | return !isSHow; |
| | | }, |
| | | //刷新购物车图标 |
| | | updateCloudLearning() { |
| | | this.getBookInfo() |
| | | this.getShoppingCartProductGet() |
| | | const checkData = this.data.cmsDatas.find( |
| | | (item) => item.refCode == "jsek_cloudLearning" |
| | | ); |
| | | this.getResourceData(checkData); |
| | | debugger; |
| | | console.log(55555); |
| | | |
| | | |
| | | |
| | | }, |
| | | // 遍历树结构转换为数组方法 |
| | | handleTreeData(array) { |
| | |
| | | }, |
| | | }; |
| | | app.MG.store.getProductList(query).then((res) => { |
| | | console.log("完整相关图书", res.datas); |
| | | const Arr = res.datas.filter( |
| | | (item) => item.id != this.data.bookDetail.id |
| | | ); |
| | |
| | | |
| | | //申请电子样书 |
| | | appplyElectronicBook() { |
| | | console.log(this.data.bookDetail); |
| | | if ( |
| | | this.data.bookDetail.isApplyBook == 2 || |
| | | this.data.bookDetail.isApplyBook == 4 |