From fba71ba1ae5030cb1a20f54f29fb06ad97060297 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 20 九月 2024 18:37:19 +0800 Subject: [PATCH] zs --- packageBookService/pages/bookServices/detail/index.js | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index a8a444c..b4f2294 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -50,10 +50,12 @@ resourceClassList: [], // 璧勬簮鎵�灞炲垎绫� applyState: "", // 鏁欏璧勬簮鐢宠鐘舵�� deadline: "", // 鏁欏璧勬簮鐢宠鏈夋晥鏃ユ湡, + isShowBuyCloundBtn: false, isshowDrawBtn: true, // 浜戝涔犻鍙栨煡鐪嬫寜閽槸鍚︽樉绀� isShowBuyCloundMenu: false, // 浜戝涔犲叏閮ㄨ喘涔版寜閽槸鍚︽樉绀� isCloundHaveSaleMethod: false, // 浜戝涔犳槸鍚︽湁閿�鍞柟寮� cloundMenuIsBuy: false, + learnTaskData: {}, rejectCause: "", // 涓嬭浇鎷掔粷鍘熷洜 buyIdList: [], shoppingCartGetId: [], // 宸茶喘涔癷d鍒楄〃 @@ -524,8 +526,8 @@ app.MG.store.getProductDetail(query).then((res) => { this.setData({ resourceCodeList: res.datas.cmsDatas[0].datas, + learnTaskData: res.datas.cmsDatas[0].datas.filter((item) => item.refCode == 'jsek_learningTasks')[0] }) - console.log('refcode', this.data.resourceCodeList); }) }, //璇锋眰瀛愬晢鍝佺殑鏂囦欢 @@ -1039,6 +1041,8 @@ ) || (flags && cloundSaleMethod.Price == 0) // 鍒ゆ柇浜戝涔犲叏閮ㄨ喘涔版寜閽槸鍚︽樉绀� let isShowBuyCloundMenu = flags && cloundSaleMethod.Price >= 0 + // 鍒ゆ柇璧勬簮璐拱鎸夐挳鏄惁鏄剧ず + let isShowBuyCloundBtn = res.datas.cmsDatas[0].datas.some(citem => citem.saleMethod.length != 0) || type.saleMethod.length // 鍒ゆ柇璐墿杞︽寜閽拰閿佹寜閽槸鍚︽樉绀� this.handleTreeData(list).forEach(item => { item.isbuy = this.resourceIsBuy(item); @@ -1048,6 +1052,7 @@ this.setData({ isshowDrawBtn, isShowBuyCloundMenu, + isShowBuyCloundBtn, isCloundHaveSaleMethod: flags, learn: list, loading: false, @@ -1833,6 +1838,32 @@ }); } }, + // 浜戝涔犲叏閮ㄨ喘涔� + async buyCloudLearnClass() { + const cloundMenu = this.data.resourceCodeList.find((item) => item.refCode == 'jsek_cloudLearning') + debugger + let query = { + remarks: '浜戝涔�', + requests: [{ + saleMethodId: cloundMenu.saleMethod.find((eitem) => eitem.SaleType == 'Normal').Id, + count: 1 + }] + } + const initOrderRes = await app.MG.store.initOrder(query) + // 妫�鏌ヨ鍗曞彿鏄惁瀛樺湪 + if (initOrderRes.orderNumber) { + // bookService: orderNumber.value, 灏戜紶杩欎釜 锛屾殏鏃朵笉鐭ラ亾鏈変粈涔堢敤 + wx.navigateTo({ + url: `/pages/cart/paymentPage/index?&bookId=${this.data.bookDetail.id}&bookName=${this.data.bookDetail.name}&orderNumber=${initOrderRes.orderNumber}`, + }); + } else { + // 璁㈠崟鍙蜂笉瀛樺湪锛屾樉绀鸿鍛婃秷鎭� + wx.showToast({ + icon: "error", + title: "璇烽噸璇�", + }); + } + }, // 浜戝涔犲瓧娈佃喘涔� async buyCloundMenu() { const cloundData = this.data.resourceCodeList.find(item => item.refCode == 'jsek_cloudLearning') @@ -2541,6 +2572,11 @@ return childrenList }, uploadFile(e) { + const userInfo = JSON.parse(wx.getStorageSync(app.config.userInfoKey)) + if (userInfo.role != 'Teacher') return wx.showToast({ + icon: 'error', + title: '璇峰厛杩涜鏁欏笀璁よ瘉', + }) this.setData({ dialogBox: true, isShowUp: true @@ -2785,5 +2821,10 @@ this.setData({ cloundMenuIsBuy: flag }) - } + }, + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() {}, + onShareTimeline() {} }) \ No newline at end of file -- Gitblit v1.9.1