yiming
2024-04-09 12cc87a1f2f9b91359d3ca43fe052440d9890dac
购物车跳转图书详情
11个文件已修改
289 ■■■■■ 已修改文件
packageBookService/pages/bookServices/detail/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageDomain/pages/resourceDetails/myAudio/index.js 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bibliographyList/index.wxml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookExhibitionList/index.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/bookExhibitionList/index.wxss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/index.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/index.wxss 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/paymentPage/index.js 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/paymentPage/index.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/cart/paymentPage/index.wxml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/retrievalPage/index.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js
@@ -977,6 +977,7 @@
      // 发起订单初始化请求并等待结果
      const res = await app.MG.store.initOrder(query);
      // 获取订单号并赋值给 orderNumber.value
      console.log(res, 'res456');
      bookOrdersId = res.orderNumber;
      // 检查订单号是否存在
      if (bookOrdersId) {
@@ -996,8 +997,7 @@
              }
            });
        } 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,
          });
packageDomain/pages/resourceDetails/myAudio/index.js
@@ -83,13 +83,9 @@
   * 生命周期函数--监听页面加载
   */
  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,
@@ -101,26 +97,10 @@
      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);
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   * 
@@ -137,7 +117,6 @@
    this.setData({
      startTime: Date.now()
    })
  },
  /**
@@ -157,13 +136,27 @@
   * 生命周期函数--监听页面卸载
   */
  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 = {
@@ -219,7 +212,6 @@
  },
  showDialog(e) {
    this.setData({
      submitTitle: this.data.bookName,
      dialogKey: true,
@@ -260,16 +252,13 @@
        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({
@@ -277,38 +266,25 @@
                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,
@@ -436,11 +412,8 @@
      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,
@@ -652,14 +625,11 @@
      this.changeItem(this.data.threeLeveData[index - 1])
      this.setData({
        selectedId: index - 1,
      })
    } else {
      console.log('已经是第一首了');
    }
  },
  //右切换
  onRightSwitch() {
    this.setData({
pages/bibliographyList/index.wxml
@@ -42,7 +42,8 @@
        <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" />
@@ -70,6 +71,7 @@
          <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" />
@@ -97,6 +99,7 @@
          <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" />
pages/bookExhibitionList/index.js
@@ -64,19 +64,19 @@
      value: 'timeAsc',
      options: [{
          value: 'nameAsc',
          label: '名称从高到低',
          label: '名称正序',
        },
        {
          value: 'nameDesc',
          label: '名称从低到高',
          label: '名称倒序',
        },
        {
          value: 'timeAsc',
          label: '创建时间从高到低',
          label: '出版时间正序',
        },
        {
          value: 'timeDesc',
          label: '创建时间从底到高',
          label: '出版时间倒序',
        },
      ],
    },
@@ -218,7 +218,7 @@
        // 'page.start': currentPage,
        'page.size': newSize
      });
      this.bookExhibitionGet(); // 调用方法加载更多数据
      // this.bookExhibitionGet(); // 调用方法加载更多数据
@@ -398,9 +398,10 @@
    this.setData({
      'multipleSelect.value': e.detail.value,
    });
  },
  handleConfirm(event) {
    const {
      value
@@ -411,11 +412,14 @@
    this.data.keynoteValue = value
    this.bookExhibitionGet()
  },
  handleReset() {
  handleReset(e) {
    // 重置操作的处理逻辑
    this.data.keynoteValue = []
    console.log('重置操作');
    this.bookExhibitionGet()
  },
  onSwapRight() {
@@ -466,5 +470,5 @@
    console.log(e.detail.value, 'e.detail.value');
    this.bookExhibitionGet()
  },
})
pages/bookExhibitionList/index.wxss
@@ -256,7 +256,15 @@
  /* 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;
pages/cart/index.js
@@ -32,7 +32,7 @@
      title: '购物车'
    });
    this.shoppingCartGet();
    console.log(this.data.shoppingCartData.length, 'this.data.shoppingCartData.length');
    this.setData({
      swipeOpened: true
    })
@@ -81,7 +81,7 @@
      searchList: []
    };
    app.MG.store.getShoppingCartProductList(query).then(res => {
      console.log(res, 'res');
      this.setData({
        totalSize: res.totalSize
      })
@@ -98,7 +98,7 @@
        // })
        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
      });
@@ -192,7 +192,9 @@
            let data = {
              linkIds: selectedIds
            }
            // '&onNorderSaleMethod=' +
            app.MG.store.shoppingCartCreateOrder(data).then(res => {
              const url = '/pages/cart/paymentPage/index?orderNumber=' + res.orderNumber
              wx.navigateTo({
                url
@@ -221,7 +223,8 @@
          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
          });
@@ -283,8 +286,8 @@
    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
    })
  }
});
pages/cart/index.wxss
@@ -50,7 +50,7 @@
.checkGroupBox {
  /* flex: 1; */
  margin: 0 30rpx;
  width: 120rpx;
  min-width: 120rpx;
}
@@ -65,17 +65,22 @@
.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 {
@@ -126,6 +131,7 @@
.totalPriceText {
  color: #FF6C00;
  min-width: 133rpx;
}
.LaelBox {
pages/cart/paymentPage/index.js
@@ -1,4 +1,5 @@
// pages/cart/paymentPage/index.js
import Toast from 'tdesign-miniprogram/toast/index';
const app = getApp()
import {
  getPublicImage
@@ -10,6 +11,7 @@
   * 页面的初始数据
   */
  data: {
    myOrderOrderNumber: [],
    orderNumber: null,
    navBarHeight: '',
    barHeight: '',
@@ -20,7 +22,8 @@
    orderGoods: '',
    isPaySuccess: false,
    isPayComplete: false,
    type: ''
    type: '',
    onNorderSaleMethod: ''
  },
  /**
@@ -34,10 +37,12 @@
      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()
  },
  /**
@@ -129,58 +134,87 @@
      })
    })
  },
  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() {
pages/cart/paymentPage/index.json
@@ -3,7 +3,8 @@
  "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"
}
pages/cart/paymentPage/index.wxml
@@ -86,4 +86,6 @@
      <t-button class="buttonBox" shape="round" catch:tap="confirmOrderGet">微信支付</t-button>
    </view>
  </view>
</view>
</view>
<t-toast id="t-toast" />
pages/retrievalPage/index.wxml
@@ -31,7 +31,7 @@
          <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}}