From 3dd2f91fbc88641202a272d8d179d40e0686ace4 Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期二, 08 七月 2025 16:24:00 +0800 Subject: [PATCH] 销售方式跳转、扫码、Isbn弹框、出版日期 --- pages/scanResult/index.js | 80 ++++++++++++++++++++++++++-------------- 1 files changed, 52 insertions(+), 28 deletions(-) diff --git a/pages/scanResult/index.js b/pages/scanResult/index.js index 1164b30..b274c29 100644 --- a/pages/scanResult/index.js +++ b/pages/scanResult/index.js @@ -1,6 +1,5 @@ // pages/index/scanResult/index.js const app = getApp() - Page({ /** @@ -15,7 +14,9 @@ isOther: false, activeCodeAndStoreChannelLinks: [], activeInfo: null, - description: "" + description: "", + itemType: '', + goodsData: '' }, /** @@ -29,7 +30,10 @@ result, textValue: result.type == "PromoteCode" ? '棰嗗彇' : '婵�娲�' }) - this.getRules(); + wx.setNavigationBarTitle({ + title: result.type == "PromoteCode" ? '棰嗗彇浼樻儬鍗�' : '婵�娲诲晢鍝�', + }) + // this.getRules(); this.getProductByCode(); } else { this.setData({ @@ -37,6 +41,7 @@ }) } } catch (error) { + console.log(error); this.setData({ isOther: true }) @@ -93,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; @@ -139,9 +145,9 @@ showCancel: false, success(res) { if (res.confirm) { - setTimeout(() => { - wx.navigateBack() - }, 2500); + wx.switchTab({ + url: '/pages/home/home', + }) } } }) @@ -161,7 +167,12 @@ .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) { @@ -206,19 +217,15 @@ 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: { @@ -230,13 +237,30 @@ }, }) .then(res => { - res.datas.map(item => { - item.price ? item.price = (item.price).toFixed(2) : ""; - item.oldPrice ? item.oldPrice = (item.oldPrice).toFixed(2) : ""; - }) - 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 + }) + } }); }, -- Gitblit v1.9.1