QYF-GitLab1
11 小时以前 3dd2f91fbc88641202a272d8d179d40e0686ace4
pages/scanResult/index.js
@@ -30,6 +30,9 @@
          result,
          textValue: result.type == "PromoteCode" ? '领取' : '激活'
        })
        wx.setNavigationBarTitle({
          title: result.type == "PromoteCode" ? '领取优惠卷' : '激活商品',
        })
        // this.getRules();
        this.getProductByCode();
      } else {
@@ -95,13 +98,14 @@
          wx.showModal({
            title: '温馨提示',
            content: res,
            showCancel: false
            showCancel: false,
            success(res) {
              if (res.confirm)
                wx.switchTab({
                  url: '/pages/home/home',
                })
            }
          })
          setTimeout(() => {
            wx.navigateTo({
              url: '/pages/codeRecord/index',
            })
          }, 2500);
        });
    } else {
      let that = this;
@@ -141,7 +145,9 @@
          showCancel: false,
          success(res) {
            if (res.confirm) {
              wx.navigateBack()
              wx.switchTab({
                url: '/pages/home/home',
              })
            }
          }
        })
@@ -231,17 +237,30 @@
        },
      })
      .then(res => {
        res.datas.map(item => {
          item.name = item.name + '-' + this.data.goodsData.saleMethodList[0].name
          item.price ? item.price = (item.price).toFixed(2) : "";
          item.oldPrice ? item.oldPrice = (item.oldPrice).toFixed(2) : "";
          item.icon ? item.icon = item.icon : item.icon = "/static/images/default-book-img.png",
            item.itemType = this.data.goodsData.saleMethodList[0].type == 'createProductFolderSaleMethod' ? '目录' : this.data.goodsData.saleMethodList[0].type == 'createProductItemSaleMethod' ? '资源' : '电子书'
        })
        console.log(1, res.datas[0]);
        that.setData({
          productInfo: res.datas
        })
        if (res.datas?.length > 0) {
          const list = []
          this.data.goodsData.saleMethodList?.forEach(citem => {
            const obj = {
              name: res.datas[0].name + '-' + citem.name,
              icon: res.datas[0].icon ? res.datas[0].icon : "/static/images/default-book-img.png",
              itemType: citem.type == 'createProductFolderSaleMethod' ? '目录' : citem.type == 'createProductItemSaleMethod' ? '资源' : '电子书',
              price: res.datas[0].price ? (res.datas[0].price.price).toFixed(2) : "",
              oldPrice: res.datas[0].oldPrice ? (res.datas[0].oldPrice).toFixed(2) : ''
            }
            list.push(obj)
          })
          // res.datas.map(item => {
          //   item.name = item.name + '-' + this.data.goodsData.saleMethodList.map(item => item.name)
          //   item.price ? item.price = (item.price).toFixed(2) : "";
          //   item.oldPrice ? item.oldPrice = (item.oldPrice).toFixed(2) : "";
          //   item.icon ? item.icon = item.icon : item.icon = "/static/images/default-book-img.png",
          //     item.itemType = this.data.goodsData.saleMethodList[0].type == 'createProductFolderSaleMethod' ? '目录' : this.data.goodsData.saleMethodList[0].type == 'createProductItemSaleMethod' ? '资源' : '电子书'
          // })
          // debugger
          that.setData({
            productInfo: list
          })
        }
      });
  },