From 898bba7a14a9994546f044d6c9001dcc655f63d1 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Thu, 5 Sep 2024 10:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=92=E6=99=AF=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/info/postProductInfo/index.wxml | 9 +++------ pages/order/components/date/index.js | 16 +++++++++------- pages/order/scene/index.js | 22 ++++++++++++++++++++-- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/pages/info/postProductInfo/index.wxml b/pages/info/postProductInfo/index.wxml index 48812d8..2f079ba 100644 --- a/pages/info/postProductInfo/index.wxml +++ b/pages/info/postProductInfo/index.wxml @@ -126,18 +126,15 @@ - - 立即购买 - 该商品已下架 - - + + 加入购物车 立即购买 该商品已下架 - + {{cartCount}} diff --git a/pages/order/components/date/index.js b/pages/order/components/date/index.js index 554795a..8193e31 100644 --- a/pages/order/components/date/index.js +++ b/pages/order/components/date/index.js @@ -118,14 +118,16 @@ Component({ }) let seldDate = '' if (app.globalData.product.changeFlag) { - res.data.forEach(item=> { - if (item.date == app.globalData.product.date.date) { - seldDate = item + if( app.globalData.product.date) { + res.data.forEach(item=> { + if (item.date == app.globalData.product.date.date) { + seldDate = item + } + }) } - }) - setTimeout(() => { - this.changeDate(seldDate) - }) + setTimeout(() => { + this.changeDate(seldDate) + }) // this.setData({ // activeDate:seldDate // }) diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 31de4f4..c224e55 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -66,7 +66,7 @@ Page({ is_authentication:app.globalData.product.sku.sku_model.is_authentication, is_real_name:app.globalData.product.sku.sku_model.is_real_name, date: app.globalData.product.date, - time: app.globalData.product.time, + time: app.globalData.product.time || {}, showYhq:app.globalData.listName?false:true }) console.log('-------',this.data.showYhq,this.data.time); @@ -74,11 +74,13 @@ Page({ console.log('-------',app.globalData.product.sku.sku_model.is_need_idcard); console.log('---是否实名----',app.globalData.product.sku.sku_model.is_authentication); console.log('---一证一票----',app.globalData.product.sku.sku_model.is_real_name); - if (!app.globalData.product) { util.back(); return; } + if (!app.globalData.product.time) { + app.globalData.product.time = {} + } if (app.globalData.product.productNum) { this.setData({ productNum: app.globalData.product.productNum < 1 ? 1 : app.globalData.product.productNum @@ -421,6 +423,22 @@ Page({ return } } + // 判断时间日期 + if (!date && this.data.ticket_type == 1) { + wx.showToast({ + title: '请选择使用日期', + icon: 'none' + }) + return + } + if (!time && date && date.is_time_stock == true) { + wx.showToast({ + title: '请选择使用时间', + icon: 'none' + }) + return + } + let data = { coupon_id: this.data.coupon ? this.data.coupon.id : null, source: "WECHATXCX",