| | |
| | | // pages/index/scanResult/index.js |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | isOther: false, |
| | | activeCodeAndStoreChannelLinks: [], |
| | | activeInfo: null, |
| | | description: "" |
| | | description: "", |
| | | itemType: '', |
| | | goodsData: '' |
| | | }, |
| | | |
| | | /** |
| | |
| | | result, |
| | | textValue: result.type == "PromoteCode" ? '领取' : '激活' |
| | | }) |
| | | this.getRules(); |
| | | // this.getRules(); |
| | | this.getProductByCode(); |
| | | } else { |
| | | debugger |
| | | this.setData({ |
| | | isOther: true |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | console.log(error); |
| | | debugger |
| | | this.setData({ |
| | | isOther: true |
| | | }) |
| | |
| | | showCancel: false, |
| | | success(res) { |
| | | if (res.confirm) { |
| | | setTimeout(() => { |
| | | wx.navigateBack() |
| | | }, 2500); |
| | | } |
| | | } |
| | | }) |
| | |
| | | .then(res => { |
| | | try { |
| | | const list = JSON.parse(res.config); |
| | | console.log('code', res, list); |
| | | if (this.data.result) { |
| | | |
| | | const type = res.saleMethodList[0].type |
| | | this.setData({ |
| | | goodsData: res, |
| | | }) |
| | | this.getProductListById(list); |
| | | } |
| | | if (res?.activeCodeAndStoreChannelLinks) { |
| | |
| | | app.MG.store |
| | | .getProductList({ |
| | | queryType: "*", |
| | | subAccess: [{ |
| | | StoreRefCode: app.config.learnPlatformGoodsStore, // 默认商品库 |
| | | Path: "", |
| | | Type: "*", |
| | | }, ], |
| | | // subAccess: [{ |
| | | // StoreRefCode: app.config.learnPlatformGoodsStore, // 默认商品库 |
| | | // Path: "", |
| | | // Type: "*", |
| | | // }, ], |
| | | sort: { |
| | | CreateDate: "Desc", |
| | | }, |
| | | fields: { |
| | | tourism_author: [], |
| | | tourism_paperPrice: [], |
| | | tourism_publicationDate: [], |
| | | tourism_ISBN: [], |
| | | "Id=": ids.map(item => item.id + ""), |
| | | }, |
| | | paging: { |
| | |
| | | }) |
| | | .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 |
| | | }) |