| | |
| | | loading: false, |
| | | shoppingList: [], |
| | | shoppingCartGetId: [], |
| | | methodId: [] |
| | | methodId: [], |
| | | paymentPage: false, |
| | | superior: false |
| | | }, |
| | | |
| | | /** |
| | |
| | | this.getShoppingCartProductGet() |
| | | this.getBookInfo(options.bookId) |
| | | }, |
| | | batchPurchase() { |
| | | let saleMethodIds = [] |
| | | let requests = [] |
| | | const child = this.selectComponent('#tree') |
| | | |
| | | console.log(child.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); |
| | | const item = child.data.superiorPurchaseSaleMethodId |
| | | if (item) { |
| | | item.forEach(item => { |
| | | if (item.saleMethod != 0) { |
| | | saleMethodIds = item.saleMethod[0].Id |
| | | requests.push({ saleMethodIds, count: 1 }) |
| | | } |
| | | }) |
| | | console.log(requests, 'saleMethodId'); |
| | | let query = { |
| | | remarks: '云学习', |
| | | requests, |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | // 发起订单初始化请求并等待结果 |
| | | const res = app.MG.store.initOrder(query) |
| | | let bookOrdersId = res.orderNumber |
| | | // 检查订单号是否存在 |
| | | if (bookOrdersId) { |
| | | const url = '/pages/cart/paymentPage/index?orderNumber=' + bookOrdersId |
| | | wx.navigateTo({ |
| | | url |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // console.log(child.data.sonPurchaseSaleMethodId, 'child.data.'); |
| | | // this.data.methodId.push(child.data.sonPurchaseSaleMethodId) |
| | | |
| | | |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | |
| | | const child = this.selectComponent('#tree') |
| | | child.checkAll() |
| | | }, |
| | | //购买按钮 |
| | | batchPurchase() { |
| | | let saleMethodIds = [] |
| | | let requests = [] |
| | | let item = [] |
| | | const child = this.selectComponent('#tree') |
| | | |
| | | console.log(child.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); |
| | | console.log(child.data.sonPurchaseSaleMethodId, 'child.data'); |
| | | item = child.data.superiorPurchaseSaleMethodId |
| | | const sonItem = child.data.sonPurchaseSaleMethodId |
| | | |
| | | if (item) { |
| | | console.log(item, 'sadsdasd'); |
| | | // 拿到id |
| | | item.forEach(items => { |
| | | if (items.saleMethod != 0) { |
| | | saleMethodIds.push(items.saleMethod[0].Id) |
| | | } |
| | | }) |
| | | console.log(saleMethodIds, 'saleMethodIds'); |
| | | |
| | | app.MG.store.initOrder({ |
| | | requests: saleMethodIds.map(id => ({ |
| | | saleMethodId: id, |
| | | count: 1, |
| | | })), |
| | | }).then(res => { |
| | | if (res) { |
| | | wx.navigateTo({ |
| | | url: '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber, |
| | | }) |
| | | this.setData({ |
| | | superior: true |
| | | }) |
| | | |
| | | } |
| | | }) |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (item.length == 0 && sonItem) { |
| | | |
| | | |
| | | app.MG.store.initOrder({ |
| | | requests: sonItem.map(id => ({ |
| | | saleMethodId: id, |
| | | count: 1, |
| | | })), |
| | | }).then(res => { |
| | | if (res) { |
| | | wx.navigateTo({ |
| | | url: '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber, |
| | | }) |
| | | this.setData({ |
| | | paymentPage: true |
| | | }) |
| | | |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | }) |
| | |
| | | <!-- 内容 --> |
| | | |
| | | <view class="buy-resource" wx:if="{{!loading}}"> |
| | | <tree id="tree" treeList="{{learn}}" tab="{{'jsek_cloudLearning'}}" isShowCheck="{{true}}" openIds="{{openLearnids}}" /> |
| | | <tree id="tree" paymentPage="{{paymentPage}}" superior="{{superior}}" treeList="{{learn}}" tab="{{'jsek_cloudLearning'}}" isShowCheck="{{true}}" openIds="{{openLearnids}}" /> |
| | | </view> |
| | | |
| | | <view class="noData" wx:if="{{loading}}"> |
| | |
| | | isShowCheck: { |
| | | type: Boolean, |
| | | value: false, |
| | | }, |
| | | paymentPage: { |
| | | type: Boolean, |
| | | value: false, |
| | | }, |
| | | superior: { |
| | | type: Boolean, |
| | | value: false, |
| | | } |
| | | }, |
| | | data: { |
| | |
| | | console.log('准备'); |
| | | }, |
| | | onShow() { |
| | | debugger |
| | | this.setData({ |
| | | sonPurchaseSaleMethodId: '' |
| | | }) |
| | | }, |
| | | onLoad() { |
| | | this.setData({ |
| | | sonPurchaseSaleMethodId: '' |
| | | }) |
| | | }, |
| | | observers: { |
| | | 'openIds': function (newValue) { |
| | |
| | | treeList: updatedTreeList // 更新 treeList 数据 |
| | | }); |
| | | |
| | | if (!list.checked) { |
| | | if (this.properties.superior) { |
| | | console.log(852); |
| | | |
| | | this.properties.superior = false |
| | | this.setData({ |
| | | superiorPurchaseSaleMethodId: [] |
| | | }) |
| | | } |
| | | if (!this.properties.superior) { |
| | | this.setData({ |
| | | superiorPurchaseSaleMethodId: list |
| | | }) |
| | | console.log(this.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); |
| | | } |
| | | } |
| | | |
| | | // console.log(this.data.superiorPurchaseSaleMethodId, 'superiorPurchaseSaleMethodId'); |
| | | list.forEach(items => { |
| | | console.log(items.checked, 'itesasd'); |
| | | if (!items.checked) { |
| | |
| | | }) |
| | | } |
| | | }) |
| | | this.onCloudShoppingCart() |
| | | // this.onCloudShoppingCart() |
| | | }, |
| | | // 子项勾选 |
| | | checkResource(e) { |
| | | const citem = e.currentTarget.dataset.item |
| | | // console.log(e); |
| | | |
| | | |
| | | console.log(citem, '5648'); |
| | | const updataList = this.checkResoucrceInfo(this.properties.treeList, citem.id) |
| | | console.log(updataList); |
| | | console.log(citem.checked, 'citem.checked'); |
| | | if (!citem.checked) { |
| | | //选中的时候添加id |
| | | let sonPurchaseSaleMethodId = this.data.sonPurchaseSaleMethodId || [] |
| | | console.log(this.properties.paymentPage, 'this.properties.paymentPage'); |
| | | if (this.properties.paymentPage) { |
| | | console.log(789987); |
| | | sonPurchaseSaleMethodId = [] |
| | | this.properties.paymentPage = false |
| | | } |
| | | if (!this.properties.paymentPage) { |
| | | sonPurchaseSaleMethodId.push(citem.saleMethod[0].Id) |
| | | } |
| | | |
| | | |
| | | this.setData({ |
| | | sonPurchaseSaleMethodId: sonPurchaseSaleMethodId |
| | | }) |
| | | console.log(this.data.sonPurchaseSaleMethodId); |
| | | } else { |
| | | // 取消选中的时候删除id |
| | | |
| | | } |
| | | |
| | | this.setData({ |
| | | treeList: updataList, |
| | | sonPurchaseSaleMethodId: citem.saleMethod[0].Id |
| | | }) |
| | | |
| | | }) |
| | | }, |
| | | // 加入购物车 |
| | | async onCloudShoppingCart() { |
| | |
| | | Toast({ |
| | | context: this, |
| | | selector: '#t-toast', |
| | | message: '已添加', |
| | | theme: 'success', |
| | | message: '该书已在购物车,请勿重复添加', |
| | | theme: 'warning', |
| | | direction: 'column', |
| | | }); |
| | | } |
| | |
| | | buyBtn() { |
| | | if (this.data.tabValue == 'brief' && !this.data.bookBuy) { |
| | | this.buyBook() |
| | | } else if (this.data.tabValue == 'jsek_cloudLearning') { |
| | | const tree = this.selectComponent('#tree') |
| | | tree.onCloudShoppingCart() |
| | | } else if (this.data.tabValue == 'questionBank') { |
| | | this.buyMock() |
| | | } else { |
| | | console.log(this.data.tabValue); |
| | | } |
| | | // else if (this.data.tabValue == 'jsek_cloudLearning') { |
| | | // const tree = this.selectComponent('#tree') |
| | | // tree.onCloudShoppingCart() |
| | | // } else if (this.data.tabValue == 'questionBank') { |
| | | // this.buyMock() |
| | | // } else { |
| | | // console.log(this.data.tabValue); |
| | | // } |
| | | }, |
| | | |
| | | goRead() { |
| | |
| | | |
| | | .mp-slider-bar { |
| | | margin: 0 18rpx; |
| | | /* margin-top: 10rpx; */ |
| | | } |
| | | |
| | | .t-tabs__item--active { |
| | |
| | | |
| | | .publicText { |
| | | display: flex; |
| | | |
| | | } |
| | | |
| | | .noData { |
| | | margin-top: 150rpx; |
| | | } |
| | | |
| | | .audioIconBox { |
| | | width: 50rpx; |
| | | } |
| | |
| | | "t-search": "tdesign-miniprogram/search/search", |
| | | "t-icon": "tdesign-miniprogram/icon/icon", |
| | | "t-loading": "tdesign-miniprogram/loading/loading", |
| | | "t-image": "tdesign-miniprogram/image/image" |
| | | "t-image": "tdesign-miniprogram/image/image", |
| | | "t-empty": "tdesign-miniprogram/empty/empty" |
| | | }, |
| | | "navigationStyle": "custom", |
| | | "enablePullDownRefresh": true, |
| | |
| | | <view class="bibliographyList"> |
| | | <view class="titlesBox"> |
| | | <!--pages/bibliographyList/index.wxml--> |
| | | <view wx:if="{{downloadLoadin}}" class="loadinBox"> |
| | | <t-loading class="colors" theme="circular" size="70rpx" class="wrapper" /> |
| | | |
| | | </view> |
| | | <view class="bibliographyListBox"> |
| | | <view class="bibliographyListBox"></view> |
| | | <view class="titleBox"> |
| | | <view style="width: 100%; height: {{barHeight}}px; "></view> |
| | | <view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> |
| | |
| | | </view> |
| | | |
| | | <view class="example-search"> |
| | | <t-search model:value="{{value}}" placeholder="请输入书目名称" bind:submit="onSearchSubmit" /> |
| | | <t-search model:value="{{value}}" placeholder="请输入书目名称" bind:submit="onSearchSubmit"> |
| | | |
| | | |
| | | </t-search> |
| | | <!-- <t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" /> --> |
| | | |
| | | |
| | | |
| | | </view> |
| | | |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | | |
| | | |
| | | |
| | | <t-tabs class="contentBox" defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs" t-class-content="custom-panel"> |
| | | <t-tab-panel label="高等教育({{higherTotal}})" value="0"> |
| | | <view class="outsideHigherBox"> |
| | | |
| | | <view wx:if="{{higherList.length <= 0}}" class="noDataBox"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | |
| | | <view wx:else class="outsideHigherBox"> |
| | | <view class="higherBox" wx:for="{{higherList}}" wx:key="index" wx:for-item="item" wx:for-index="index" bind:tap="downloadData" data-item="{{item}}"> |
| | | <view class="outsideHigherImageBox"> |
| | | <image class="higherImageBox" src="{{item.icon}}" mode="" /> |
| | |
| | | <view class="higherTextBox">{{item.name}}</view> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | <view class="bottom-box"> |
| | | <view wx:if="{{higherList.length > 0}}" class="bottom-box"> |
| | | <t-loading theme="circular" size="40rpx" class="wrapper" wx:if="{{isMore == true}}" /> |
| | | <text wx:if="{{isMore == false}}">没有更多了</text> |
| | | </view> |
| | | |
| | | </t-tab-panel> |
| | | <t-tab-panel label="职业教育({{vocationalTotal}})" value="1"> |
| | | <view class="outsideHigherBox"> |
| | | <view wx:if="{{vocationalList.length <= 0}}" class="noDataBox"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | |
| | | |
| | | |
| | | <view wx:else class="outsideHigherBox"> |
| | | <view class="higherBox" wx:for="{{vocationalList}}" wx:key="index" wx:for-item="item" wx:for-index="index" bind:tap="downloadData" data-item="{{item}}"> |
| | | <view class="outsideHigherImageBox"> |
| | | <image class="higherImageBox" src="{{item.icon}}" mode="" /> |
| | |
| | | </view> |
| | | |
| | | </view> |
| | | <view class="bottom-box"> |
| | | |
| | | <view wx:if="{{vocationalList.length > 0}}" class="bottom-box"> |
| | | <t-loading theme="circular" size="40rpx" class="wrapper" wx:if="{{isMore == true}}" /> |
| | | <text wx:if="{{isMore == false}}">没有更多了</text> |
| | | </view> |
| | | |
| | | </t-tab-panel> |
| | | <t-tab-panel label="教师教育({{teacherTotal}})" value="2"> |
| | | <view class="outsideHigherBox"> |
| | | |
| | | <view wx:if="{{teacherList.length <= 0}}" class="noDataBox"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | <view wx:else class="outsideHigherBox"> |
| | | <view class="higherBox" wx:for="{{teacherList}}" wx:key="index" wx:for-item="item" wx:for-index="index" data-item="{{item}}" bind:tap="downloadData"> |
| | | <view class="outsideHigherImageBox"> |
| | | <image class="higherImageBox" src="{{item.icon}}" mode="" /> |
| | |
| | | </view> |
| | | |
| | | </view> |
| | | <view class="bottom-box"> |
| | | |
| | | <view wx:if="{{teacherList.length > 0}}" class="bottom-box"> |
| | | <t-loading theme="circular" size="40rpx" class="wrapper" wx:if="{{isMore == true}}" /> |
| | | <text wx:if="{{isMore == false}}">没有更多了</text> |
| | | </view> |
| | | |
| | | </t-tab-panel> |
| | | |
| | | </t-tabs> |
| | |
| | | .example-search { |
| | | background-color: #fff; |
| | | /* padding: 16rpx 32rpx; */ |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | color: #FF6C00; |
| | | } |
| | | |
| | | .t-loading__spinner { |
| | | /* .t-loading__spinner { |
| | | color: #FF6C00 !important; |
| | | } */ |
| | | |
| | | .bibliographyList { |
| | | position: relative; |
| | | } |
| | | |
| | | .titlesBox { |
| | | position: fixed; |
| | | top: 0; |
| | | background-color: #fff; |
| | | width: 100%; |
| | | z-index: 999; |
| | | height: 200rpx; |
| | | } |
| | | |
| | | .contentBox { |
| | | margin-top: 200rpx; |
| | | } |
| | | |
| | | .noDataBox { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | margin: 0 auto; |
| | | margin-top: 250rpx; |
| | | } |
| | |
| | | import { getPublicImage } from '../../assets/js/middleGround/tool'; |
| | | import Toast from 'tdesign-miniprogram/toast/index'; |
| | | |
| | | import { loginInfo } from '../../assets/js/login'; |
| | | Page({ |
| | | data: { |
| | | onDisabled: false, |
| | |
| | | totalPrice: totalPrice.toFixed(2) |
| | | }); |
| | | }, |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | goPaymentPage() { |
| | | |
| | | |
| | | // 首页测试登录功能,后续注释 |
| | | // 检查登录状态 |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | // 如果不是第一次登录,会执行回调 |
| | | if (data) { |
| | | |
| | | |
| | | const selectedItems = this.data.shoppingCartData.filter(item => item.checked); |
| | | // console.log(selectedItems, 789); |
| | | const selectedIds = selectedItems.map(item => item.id); |
| | |
| | | direction: 'column', |
| | | }); |
| | | } |
| | | } else { |
| | | // 出现错误,返回false |
| | | } |
| | | }) |
| | | } else { |
| | | // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | onLogin() { |
| | | wx.navigateTo({ |
| | |
| | | app.MG.store.confirmOrder(query).then(res => { |
| | | console.log(res.orderNumber, 'res'); |
| | | if (res.orderNumber) { |
| | | const resOrderNum = { |
| | | let resOrderNum = { |
| | | orderNum: res.orderNumber, |
| | | }; |
| | | |
| | | console.log(resOrderNum, 'resOrderNum'); |
| | | // 用户未绑定微信 报500 |
| | | app.MG.store.makeWeChatPay(resOrderNum).then(payRes => { |
| | | console.log(payRes, 'payRes'); |
| | | const payVal = JSON.parse(payRes); |
| | | wx.requestPayment({ |
| | | "appId": payVal.appId, |
| | |
| | | |
| | | // 首页测试登录功能,后续注释 |
| | | // 检查登录状态 |
| | | // const token = wx.getStorageSync(app.config.tokenKey) |
| | | // if (!token) { |
| | | // loginInfo(app, (data) => { |
| | | // // 如果不是第一次登录,会执行回调 |
| | | // if (data) { |
| | | // // 登录成功,自动记录token和用户信息,并返回true |
| | | // } else { |
| | | // // 出现错误,返回false |
| | | // } |
| | | // }) |
| | | // } else { |
| | | // // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) |
| | | // } |
| | | const token = wx.getStorageSync(app.config.tokenKey) |
| | | if (!token) { |
| | | loginInfo(app, (data) => { |
| | | // 如果不是第一次登录,会执行回调 |
| | | if (data) { |
| | | // 登录成功,自动记录token和用户信息,并返回true |
| | | } else { |
| | | // 出现错误,返回false |
| | | } |
| | | }) |
| | | } else { |
| | | // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) |
| | | } |
| | | |
| | | this.init(); |
| | | }, |
| | |
| | | <!--pages/retrievalPage/index.wxml--> |
| | | <view class="outsideRetrievalPageBox"> |
| | | |
| | | <view class="retrievalPageBox"> |
| | | <view style="width: 100%; height: {{barHeight}}px; "></view> |
| | | <view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> |
| | | <view> |
| | |
| | | <view class="cancellation" bind:tap="onCancellation">取消</view> |
| | | </view> |
| | | |
| | | </view> |
| | | <!--pages/retrievalPage/index.wxml--> |
| | | |
| | | |
| | | |
| | | <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs" t-class-content="custom-panel"> |
| | | |
| | | |
| | | <t-tabs class="tabsBox" defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs" t-class-content="custom-panel"> |
| | | <t-tab-panel label="图书({{bookTotal}})" value="0"> |
| | | <view wx:if="{{bookData.length <= 0}}" class="noDataBox"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | |
| | | |
| | | </t-tab-panel> |
| | | </t-tabs> |
| | | </view> |
| | |
| | | .t-tabs__item--evenly { |
| | | flex: 1 0 auto !important; |
| | | } |
| | | |
| | | .outsideRetrievalPageBox { |
| | | position: relative; |
| | | } |
| | | |
| | | .retrievalPageBox { |
| | | position: fixed; |
| | | top: 0px; |
| | | background-color: #fff; |
| | | height: 150px; |
| | | z-index: 999; |
| | | } |
| | | |
| | | .tabsBox { |
| | | margin-top: 300rpx; |
| | | } |