diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 0b8bfa8..fc6256e 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -98,9 +98,9 @@ Page({ info: res.data }) var arr = [] - console.log(this.data.info); - res.data.product.forEach(item => { + res.data.product.forEach((item,index) => { item.sku.forEach(itemB=>{ + itemB.proIndex = index arr.push(itemB) }) }); @@ -269,16 +269,12 @@ Page({ app.globalData.retailId = this.data.retailId; // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product; // let sku = {sku:e.currentTarget.dataset.product.sku[this.data.skuIndex]},product = {product: e.currentTarget.dataset.product} - let sku = {sku:this.data.skuList[this.data.skuIndex]},product = {product: e.currentTarget.dataset.product} + let sku = {sku:this.data.skuList[this.data.skuIndex]},product = {product:this.data.info.product[this.data.skuList[this.data.skuIndex].proIndex]} app.globalData.product = {...sku,...product} - console.log(this.data.skuIndex); - console.log(app.globalData.product); - // app.globalData.product = e.currentTarget.dataset; wx.navigateTo({ url: '/pages/order/scene/index', }) }else { - console.log('111'); commonApi.user_post("cart/add_sku", { sku_id: this.data.skuList[this.data.skuIndex].id, num: this.data.producNum @@ -372,7 +368,6 @@ Page({ }) }, complete(res) { - console.log(res); /* 这里判断一下如果没有授权重新打开设置选项 */ wx.getSetting({ success(res) { diff --git a/pages/info/sceneProductInfo/index.wxml b/pages/info/sceneProductInfo/index.wxml index c592eca..71178ad 100644 --- a/pages/info/sceneProductInfo/index.wxml +++ b/pages/info/sceneProductInfo/index.wxml @@ -115,7 +115,7 @@ - + {{skuList[skuIndex].price/100}} diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 3263c0c..8bd3e44 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -93,6 +93,13 @@ Page({ this.changePrice() }, add: function () { + if (this.data.productNum==undefined) { + wx.showToast({ + title: '请先添加出行人', + icon: 'none' + }) + return + } if (this.data.product.sku.sku_model.traveller_limit_num != 0 && this.data.productNum == this.data.product.sku.sku_model.traveller_limit_num) { wx.showToast({ title: '出行人限购' + this.data.product.sku.sku_model.traveller_limit_num + "份", @@ -107,6 +114,13 @@ Page({ this.changePrice() }, minus: function () { + if (this.data.productNum==undefined) { + wx.showToast({ + title: '请先添加出行人', + icon: 'none' + }) + return + } if (this.data.productNum == 1) return; if (this.data.coupon) { wx.showToast({