From d6f073dc4ee7e1ef1949c2bf4384cfbc17af772d Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Fri, 14 Feb 2025 17:32:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E9=A2=84=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 2 +- pages/info/activityInfo/index.js | 43 ++++++++++++++++++++- pages/order/scene/index.js | 1 + pages/user/order/activityOrderInfo/index.js | 3 +- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 419407e..6cc941c 100644 --- a/app.js +++ b/app.js @@ -21,7 +21,7 @@ App({ unique_key: "wechatxcx" }).then(res => { let data = JSON.parse(res.data); - data.isTest = data.isTest164? true : false; + data.isTest = data.isTest165? true : false; this.globalData.configJson = data }).then(() => { // 获取ui配置文件 diff --git a/pages/info/activityInfo/index.js b/pages/info/activityInfo/index.js index a2082a2..8f8e824 100644 --- a/pages/info/activityInfo/index.js +++ b/pages/info/activityInfo/index.js @@ -339,9 +339,48 @@ Page({ product: res.data.product } app.globalData.retailId = this.data.retailId; - wx.navigateTo({ - url: '/pages/order/scene/index', + + this.getDefaultTime() + + + }) + }, + + + // 获取默认时间 + getDefaultTime () { + let today = util.formatDate(new Date()), end_date = util.formatDate(new Date(new Date().getTime() + 60 * 24 * 60 * 60 * 1000)); + commonApi.user_post("product/product_date_price", { + start_date: today, + end_date: end_date, + sku_id: this.data.info.sku_id + }).then(res => { + for (let i = 0; i < res.data.length; i++) { + if (res.data[i].stock > 0) { + this.getTimeStock(res.data[i]) + break; + } + } }) + }, + + getTimeStock: function (dateObj) { + commonApi.user_post("product/product_timestock_price", { + date: dateObj.date, + sku_id: this.data.info.sku_id + }).then(res => { + for (let i = 0; i < res.data.length; i++) { + if (res.data[i].stock_number > 0) { + app.globalData.product.date = dateObj + app.globalData.product.time = res.data[i] + // app.globalData.product.changeFlag = true + break + } + } + }).finally(()=>{ + wx.navigateTo({ + url: '/pages/order/scene/index?type=museum', + }) }) }, diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 1bdae09..98a9afd 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -399,6 +399,7 @@ Page({ }, changed() { + console.log('time---',this.data.date,this.data.time) app.globalData.product.date = this.data.date app.globalData.product.time = this.data.time app.globalData.product.changeFlag = true diff --git a/pages/user/order/activityOrderInfo/index.js b/pages/user/order/activityOrderInfo/index.js index f46cc3d..6137a8a 100644 --- a/pages/user/order/activityOrderInfo/index.js +++ b/pages/user/order/activityOrderInfo/index.js @@ -26,10 +26,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - console.log(productState) this.setData({ id:options.id }) + console.log(this.data.id) + }, getCodeImg:function(){ let that = this,sys =wx.getSystemInfoSync(),radio = sys.screenWidth / 750,qrcode=this.data.info.order_product_list[0].qrcode,codeImgs=[];