闫增涛
2025-03-31 04c7b0163caeae4ab1c5da62e301fa993101cfad
packagePersonal/pages/myOrder/index.js
@@ -49,7 +49,6 @@
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    console.log(options);
    this.getDataList(false)
  },
@@ -80,7 +79,6 @@
  getDataList(isReachBottom) {
    var searchArr = [];
    console.log(this.data.searchText, "earch")
    if (this.data.searchText != undefined && this.data.searchText != "") {
      searchArr.push({
        compareType: "Contains",
@@ -156,8 +154,11 @@
            loading: false
          })
        } else {
          wx.showToast({
            icon: 'error',
            title: '暂无数据',
          })
          this.setData({
            list: [],
            skeletonLoding: false,
            loading: false
          })
@@ -168,28 +169,40 @@
    })
  },
  onSearchOrder(e) {
    console.log(e.detail.value);
    this.setData({
      searchText: e.detail.value,
    })
    this.getDataList(false);
  },
  async goBookDetails(e) {
    console.log(e.currentTarget.dataset);
    const {
      book,
      remarks
    } = e.currentTarget.dataset;
    let parentData = null;
    let bookId = book.orderSaleMethod.product.id;
    if (remarks == null) {
    const type = book.orderSaleMethod.product.cmsTypeRefCode
    let url = ''
    if (type == 'jsek_mediaBook') {
      // 图书、云学习
      parentData = await app.MG.store.getProductBySaleMethod({
        'saleMethodId': book.orderSaleMethod.id
      })
      bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id;
    } else if (remarks != null && JSON.stringify(remarks).slice(1, -1) == 'object' && JSON.parse(remarks).pId) {
      bookId = JSON.parse(remarks).pId
      if (parentData.parentProduct.length > 0) {
        bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id;
      }
      url = `/packageBookService/pages/bookServices/detail/index?id=${bookId}&name=${book.name}`
    } else if (type == 'jsek_digitalCourses') {
      // 课程
      url = '/pages/digitalCourses/digitalCoursesDetails/index?id=' + book.orderSaleMethod.product.id + '&path=' + ''
    } else if (type == 'jsek_digitalTextbooks') {
      // 数字教材
      url = '/pages/digitalTextbooks/digitalTextbooksDetails/index?id=' + book.orderSaleMethod.product.id
    }
    wx.navigateTo({
      url: `/packageBookService/pages/bookServices/detail/index?id=${bookId}&name=${book.name}`,
      url
    });
  },
@@ -331,7 +344,29 @@
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
  onShareAppMessage() {},
  // 处理订单类型显示
  handleOrderType(book) {
    console.log(book);
    const type = book.orderSaleMethod.product.cmsTypeRefCode
    let title = ''
    if (type == 'jsek_mediaBook') {
      if (book.orderSaleMethod.type == 'defaultSaleMethod') {
        title = '图书服务-电子书'
      } else if (book.orderSaleMethod.type == 'createProductSaleMethod' && book.orderSaleMethod.cmsItemList == 0) {
        title = '图书服务-组卷'
      } else {
        if (book.orderSaleMethod.cmsItemList.length && book.orderSaleMethod.cmsItemList[0].type == "questionBankFolder") {
          title = '图书服务-云测试'
        } else {
          title = '图书服务-云学习'
        }
      }
    } else if (type == 'jsek_digitalCourses') {
      title = '数字教材'
    } else {
      title = '数字课程'
    }
    return title
  }
})