| | |
| | | // 发起订单初始化请求并等待结果 |
| | | const res = await app.MG.store.initOrder(query); |
| | | // 获取订单号并赋值给 orderNumber.value |
| | | console.log(res, 'res456'); |
| | | bookOrdersId = res.orderNumber; |
| | | // 检查订单号是否存在 |
| | | if (bookOrdersId) { |
| | |
| | | } |
| | | }); |
| | | } 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, |
| | | }); |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | |
| | | |
| | | const systInfo = wx.getSystemInfoSync(); |
| | | const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息 |
| | | const navBarHeight = (menu.top - systInfo.statusBarHeight) * 2 + menu.height; // 导航栏高度 |
| | | |
| | | this.setData({ |
| | | navBarHeight: navBarHeight, |
| | | barHeight: systInfo.statusBarHeight, |
| | |
| | | parentProductLinkPath: options.parentProductLinkPath, |
| | | productLinkPath: options.productLinkPath |
| | | }) |
| | | |
| | | this.resourceDetailsData() |
| | | this.getNoteList() |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | onUnload() { |
| | | myAudio.src = '' |
| | | myAudio.destroy() |
| | | |
| | | this.setData({ |
| | | myAudioPos: '', |
| | | isplay: false, //是否默认播放, |
| | | myAudioCurrent: '00:00', // 当前播放进度 |
| | | showData: '', |
| | | }); |
| | | // console.log(myAudio.src); |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | * |
| | |
| | | this.setData({ |
| | | startTime: Date.now() |
| | | }) |
| | | |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | this.setData({ |
| | | pauseTime: Date.now() |
| | | }) |
| | | if (wx.getStorageSync(app.config.tokenKey)) { |
| | | let duration = this.data.pauseTime - this.data.startTime |
| | | this.count(duration) |
| | | } |
| | | // this.setData({ |
| | | // pauseTime: Date.now() |
| | | // }) |
| | | // if (wx.getStorageSync(app.config.tokenKey)) { |
| | | // let duration = this.data.pauseTime - this.data.startTime |
| | | // this.count(duration) |
| | | // } |
| | | |
| | | |
| | | // myAudio.src = '' |
| | | // myAudio.destroy() |
| | | // this.setData({ |
| | | // myAudioPos: '', |
| | | // isplay: false, //是否默认播放, |
| | | // myAudioCurrent: '00:00', // 当前播放进度 |
| | | // showData: '', |
| | | // }); |
| | | // 停止音频播放 |
| | | myAudio.stop(); |
| | | // 销毁 InnerAudioContext 实例 |
| | | myAudio.destroy(); |
| | | }, |
| | | count(timeStr) { |
| | | const data = { |
| | |
| | | |
| | | }, |
| | | showDialog(e) { |
| | | |
| | | this.setData({ |
| | | submitTitle: this.data.bookName, |
| | | dialogKey: true, |
| | |
| | | size: 999 |
| | | } |
| | | } |
| | | |
| | | app.MG.store.getProductDetail(query).then(res => { |
| | | res.datas.cmsDatas[0].datas.forEach((item, index) => { |
| | | |
| | | if (item.selectType === "audio") { |
| | | this.data.threeLeveData.push(item) |
| | | this.setData({ |
| | | threeLeveData: this.data.threeLeveData |
| | | }) |
| | | |
| | | this.data.threeLeveData.forEach((items, index) => { // 修改此处添加index参数 |
| | | if (this.data.productLinkPath == items.productLinkPath) { |
| | | this.setData({ |
| | |
| | | titleName: items.name |
| | | }) |
| | | this.pubulicPlayFun() |
| | | |
| | | let selectedIndex = index; // 存储选中项的索引 |
| | | this.setData({ |
| | | selectedId: selectedIndex // 设置选中项的索引 |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | }) |
| | | this.data.threeLeveData.forEach((item) => { |
| | | // console.log(item.name); |
| | | }) |
| | | this.data.threeLeveData.forEach((item) => {}) |
| | | }) |
| | | }, |
| | | onVideo(e) { |
| | | // console.log(e, 'e'); |
| | | this.setData({ |
| | | myAudioCurrent: '00:00', |
| | | myAudioPos: '', |
| | | |
| | | |
| | | isplay: false |
| | | }) |
| | | |
| | | const item = e.currentTarget.dataset.item |
| | | |
| | | if (this.data.showData != '') { |
| | | |
| | | |
| | | this.setData({ |
| | | titleName: item.name, |
| | | selectId: item.id, |
| | |
| | | topicIdOrRefCode: topicId + '' |
| | | } |
| | | await app.MG.ugc.getTopicMessageList(query).then((res) => { |
| | | // notePage.value.total = res.totalSize |
| | | res.datas.forEach((item) => { |
| | | |
| | | item.createDate = this.convertTimestamp(item.createDate) |
| | | |
| | | }) |
| | | this.setData({ |
| | | "pageCount.total": res.totalSize, |
| | |
| | | this.changeItem(this.data.threeLeveData[index - 1]) |
| | | this.setData({ |
| | | selectedId: index - 1, |
| | | |
| | | }) |
| | | } else { |
| | | console.log('已经是第一首了'); |
| | | } |
| | | |
| | | }, |
| | | |
| | | //右切换 |
| | | onRightSwitch() { |
| | | this.setData({ |
| | |
| | | <view class="higherBox" wx:for="{{higherList}}" wx:key="index" wx:for-item="item" wx:for-index="index"> |
| | | <view class="outsideHigherImageBox"> |
| | | <view class="higherImageBox"> |
| | | <image data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" /> |
| | | <image wx:if="{{item.icon}}" data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" /> |
| | | <image wx:if="{{!item.icon}}" src="/static/images/default-book-img.png" mode="aspectFill" /> |
| | | <view class="downloadIcon" data-item="{{item}}" data-key="showWithInput" bind:tap="mailbox"> |
| | | <image wx:if="{{determine}}" class="download" src="/static/images/bibliographyList/email-click.png" mode="aspectFit" /> |
| | | <image wx:else="" class="downloadshiftin" src="/static/images/bibliographyList/email.png" mode="aspectFit" /> |
| | |
| | | <view class="outsideHigherImageBox"> |
| | | <view class="higherImageBox"> |
| | | <image data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" /> |
| | | <image wx:if="{{!item.icon}}" src="/static/images/default-book-img.png" mode="aspectFill" /> |
| | | <view class="downloadIcon" data-item="{{item}}" data-key="showWithInput" bind:tap="mailbox"> |
| | | <image wx:if="{{determine}}" class="download" src="/static/images/bibliographyList/email-click.png" mode="aspectFit" /> |
| | | <image wx:else="" class="downloadshiftin" src="/static/images/bibliographyList/email.png" mode="aspectFit" /> |
| | |
| | | <view class="outsideHigherImageBox"> |
| | | <view class="higherImageBox"> |
| | | <image data-item="{{item}}" bind:tap="downloadData" src="{{item.icon}}" mode="aspectFill" /> |
| | | <image wx:if="{{!item.icon}}" src="/static/images/default-book-img.png" mode="aspectFill" /> |
| | | <view class="downloadIcon" data-item="{{item}}" data-key="showWithInput" bind:tap="mailbox"> |
| | | <image wx:if="{{determine}}" class="download" src="/static/images/bibliographyList/email-click.png" mode="aspectFit" /> |
| | | <image wx:else="" class="downloadshiftin" src="/static/images/bibliographyList/email.png" mode="aspectFit" /> |
| | |
| | | value: 'timeAsc', |
| | | options: [{ |
| | | value: 'nameAsc', |
| | | label: '名称从高到低', |
| | | label: '名称正序', |
| | | }, |
| | | { |
| | | value: 'nameDesc', |
| | | label: '名称从低到高', |
| | | label: '名称倒序', |
| | | }, |
| | | { |
| | | value: 'timeAsc', |
| | | label: '创建时间从高到低', |
| | | label: '出版时间正序', |
| | | }, |
| | | { |
| | | value: 'timeDesc', |
| | | label: '创建时间从底到高', |
| | | label: '出版时间倒序', |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | // 'page.start': currentPage, |
| | | 'page.size': newSize |
| | | }); |
| | | this.bookExhibitionGet(); // 调用方法加载更多数据 |
| | | // this.bookExhibitionGet(); // 调用方法加载更多数据 |
| | | |
| | | |
| | | |
| | |
| | | this.setData({ |
| | | 'multipleSelect.value': e.detail.value, |
| | | }); |
| | | |
| | | }, |
| | | handleConfirm(event) { |
| | | |
| | | |
| | | |
| | | const { |
| | | value |
| | |
| | | this.data.keynoteValue = value |
| | | this.bookExhibitionGet() |
| | | }, |
| | | handleReset() { |
| | | |
| | | |
| | | handleReset(e) { |
| | | |
| | | // 重置操作的处理逻辑 |
| | | this.data.keynoteValue = [] |
| | | console.log('重置操作'); |
| | | |
| | | |
| | | this.bookExhibitionGet() |
| | | }, |
| | | onSwapRight() { |
| | |
| | | console.log(e.detail.value, 'e.detail.value'); |
| | | this.bookExhibitionGet() |
| | | }, |
| | | |
| | | |
| | | }) |
| | |
| | | /* height: 700rpx; */ |
| | | } |
| | | |
| | | |
| | | |
| | | .bottom-box { |
| | | display: flex; |
| | | justify-content: center; |
| | | color: #999; |
| | | height: 80rpx; |
| | | font-size: 28rpx; |
| | | --td-loading-color: #ff6c00; |
| | | margin-top: 100rpx; |
| | | display: flex; |
| | | justify-content: center; |
| | |
| | | title: '购物车' |
| | | }); |
| | | this.shoppingCartGet(); |
| | | console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length'); |
| | | |
| | | this.setData({ |
| | | swipeOpened: true |
| | | }) |
| | |
| | | searchList: [] |
| | | }; |
| | | app.MG.store.getShoppingCartProductList(query).then(res => { |
| | | console.log(res, 'res'); |
| | | |
| | | this.setData({ |
| | | totalSize: res.totalSize |
| | | }) |
| | |
| | | // }) |
| | | const type = item.saleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product'; |
| | | item.type = type; // 将type设置为item对象的属性,而不是使用setData |
| | | console.log(item.linkCmsItems[0].name); |
| | | |
| | | item.name = item.linkCmsItems[0].name ? item.productMonWithLinkDto.product.name + ':' + item.linkCmsItems[0].name : item.productMonWithLinkDto.product.name |
| | | }); |
| | | |
| | |
| | | let data = { |
| | | linkIds: selectedIds |
| | | } |
| | | // '&onNorderSaleMethod=' + |
| | | app.MG.store.shoppingCartCreateOrder(data).then(res => { |
| | | |
| | | const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber |
| | | wx.navigateTo({ |
| | | url |
| | |
| | | linkIds: selectedIds |
| | | } |
| | | app.MG.store.shoppingCartCreateOrder(data).then(res => { |
| | | const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber |
| | | console.log(res.saleMethodLinks[0].orderSaleMethod.id, 'ressss798'); |
| | | const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber + '&onNorderSaleMethod=' + res.saleMethodLinks[0].orderSaleMethod.id |
| | | wx.navigateTo({ |
| | | url |
| | | }); |
| | |
| | | console.log(item); |
| | | console.log(item.productMonWithLinkDto.product.id); |
| | | console.log(item.productMonWithLinkDto.product.name); |
| | | // wx.navigateTo({ |
| | | // url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name |
| | | // }) |
| | | wx.navigateTo({ |
| | | url: '/packageBookService/pages/bookServices/detail/index?id=' + item.productMonWithLinkDto.product.id + '&name=' + item.productMonWithLinkDto.product.name |
| | | }) |
| | | } |
| | | }); |
| | |
| | | .checkGroupBox { |
| | | /* flex: 1; */ |
| | | margin: 0 30rpx; |
| | | width: 120rpx; |
| | | min-width: 120rpx; |
| | | } |
| | | |
| | | |
| | |
| | | .totalPrice { |
| | | flex: 1; |
| | | /* margin: 0 50rpx; */ |
| | | |
| | | min-width: 295rpx; |
| | | } |
| | | |
| | | .buttonBox { |
| | | margin-right: 80rpx; |
| | | min-width: 200rpx; |
| | | } |
| | | |
| | | .tButtonBox { |
| | | /* background-color: #FF6C00; */ |
| | | width: 200rpx; |
| | | height: 80rpx; |
| | | } |
| | | |
| | | .t-button__content { |
| | | min-width: 170rpx; |
| | | } |
| | | |
| | | checkbox .wx-checkbox-input { |
| | |
| | | |
| | | .totalPriceText { |
| | | color: #FF6C00; |
| | | min-width: 133rpx; |
| | | } |
| | | |
| | | .LaelBox { |
| | |
| | | // pages/cart/paymentPage/index.js |
| | | import Toast from 'tdesign-miniprogram/toast/index'; |
| | | const app = getApp() |
| | | import { |
| | | getPublicImage |
| | |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | myOrderOrderNumber: [], |
| | | orderNumber: null, |
| | | navBarHeight: '', |
| | | barHeight: '', |
| | |
| | | orderGoods: '', |
| | | isPaySuccess: false, |
| | | isPayComplete: false, |
| | | type: '' |
| | | type: '', |
| | | onNorderSaleMethod: '' |
| | | }, |
| | | |
| | | /** |
| | |
| | | orderNumber: options.orderNumber, |
| | | navBarHeight: navBarHeight, |
| | | barHeight: systInfo.statusBarHeight, |
| | | selectedIds: options.selectedIds |
| | | selectedIds: options.selectedIds, |
| | | onNorderSaleMethod: options.onNorderSaleMethod |
| | | }) |
| | | console.log('接收到的订单号:', this.data.orderNumber); |
| | | console.log(this.data.onNorderSaleMethod, 'options'); |
| | | this.getOrderByOrderNumData() |
| | | this.getDataList() |
| | | }, |
| | | |
| | | /** |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | confirmOrderGet() { |
| | | var that = this; |
| | | let query = { |
| | | orderNum: this.data.orderGoods |
| | | } |
| | | app.MG.store.confirmOrder(query).then(res => { |
| | | console.log(res.orderNumber, 'res'); |
| | | if (res.orderNumber) { |
| | | let resOrderNum = { |
| | | orderNum: res.orderNumber, |
| | | platform: "WeChatAppCustom" |
| | | }; |
| | | 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, |
| | | "timeStamp": payVal.timeStamp, |
| | | "nonceStr": payVal.nonceStr, |
| | | "package": payVal.package, |
| | | "signType": payVal.signType, |
| | | "paySign": payVal.paySign, |
| | | success: function (res) { |
| | | console.log('支付成功'); |
| | | if (res.errMsg == 'requestPayment:ok') { |
| | | that.setData({ |
| | | isPaySuccess: true |
| | | }) |
| | | } |
| | | }, |
| | | fail: function (res) { |
| | | console.log('支付失败'); |
| | | }, |
| | | // 无论支付成功失败都会调用 |
| | | "complete": function (res) { |
| | | if (res.errMsg == 'requestPayment:ok') { |
| | | that.setData({ |
| | | isPayComplete: true |
| | | }) |
| | | } |
| | | if (that.data.isPaySuccess && that.data.isPayComplete) { |
| | | that.navToBack() |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | getDataList() { |
| | | let data = { |
| | | start: 0, |
| | | size: 999, |
| | | filterList: [{ |
| | | field: 'State', |
| | | value: 'WaitPay' |
| | | }], |
| | | sort: { |
| | | type: 'Desc', |
| | | field: 'CreateDate' |
| | | } |
| | | |
| | | } |
| | | app.MG.store.getUserOrderList(data).then((res) => { |
| | | res.datas.forEach((item) => { |
| | | this.data.myOrderOrderNumber.push(item.saleMethodLinks[0].orderSaleMethod.id) |
| | | console.log(this.data.myOrderOrderNumber); |
| | | }) |
| | | }) |
| | | // 调取微信二维码支付 |
| | | }, |
| | | confirmOrderGet() { |
| | | if (this.data.myOrderOrderNumber.includes(parseInt(this.data.onNorderSaleMethod))) { |
| | | Toast({ |
| | | context: this, |
| | | selector: '#t-toast', |
| | | message: '已经在订单中', |
| | | theme: 'warning', |
| | | direction: 'column', |
| | | }); |
| | | } else { |
| | | var that = this; |
| | | let query = { |
| | | orderNum: this.data.orderGoods |
| | | } |
| | | app.MG.store.confirmOrder(query).then(res => { |
| | | console.log(res.orderNumber, 'res'); |
| | | if (res.orderNumber) { |
| | | let resOrderNum = { |
| | | orderNum: res.orderNumber, |
| | | platform: "WeChatAppCustom" |
| | | }; |
| | | 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, |
| | | "timeStamp": payVal.timeStamp, |
| | | "nonceStr": payVal.nonceStr, |
| | | "package": payVal.package, |
| | | "signType": payVal.signType, |
| | | "paySign": payVal.paySign, |
| | | success: function (res) { |
| | | console.log('支付成功'); |
| | | if (res.errMsg == 'requestPayment:ok') { |
| | | that.setData({ |
| | | isPaySuccess: true |
| | | }) |
| | | } |
| | | }, |
| | | fail: function (res) { |
| | | console.log('支付失败'); |
| | | }, |
| | | // 无论支付成功失败都会调用 |
| | | "complete": function (res) { |
| | | if (res.errMsg == 'requestPayment:ok') { |
| | | that.setData({ |
| | | isPayComplete: true |
| | | }) |
| | | } |
| | | if (that.data.isPaySuccess && that.data.isPayComplete) { |
| | | that.navToBack() |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | // 页面返回 |
| | | navToBack() { |
| | |
| | | "usingComponents": { |
| | | "t-icon": "tdesign-miniprogram/icon/icon", |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog" |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog", |
| | | "t-toast": "tdesign-miniprogram/toast/toast" |
| | | }, |
| | | "navigationStyle": "custom" |
| | | } |
| | |
| | | <t-button class="buttonBox" shape="round" catch:tap="confirmOrderGet">微信支付</t-button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <t-toast id="t-toast" /> |
| | |
| | | <view class="bookDataBox"> |
| | | <view class="bookDataForBox" wx:for="{{bookData}}" wx:key="index" wx:for-item="item" wx:for-index="index" data-item="{{item}}" bind:tap="onBook"> |
| | | <view class="imageBox"> |
| | | <image src="{{item.icon}}" mode="aspectFill" /> |
| | | <image src="{{item.icon}}" mode="aspectFit" /> |
| | | </view> |
| | | <view class="bookDataNmae"> |
| | | {{item.name}} |