diff --git a/app.js b/app.js index 3470599..4773a83 100644 --- a/app.js +++ b/app.js @@ -38,7 +38,7 @@ App({ // 获取前端配置文件 commonApi._post("pbservice/Other/getClientConfig", {unique_key: "wechatxcx"}).then(res => { let data = JSON.parse(res.data); - data.isTest = data.isTest132? true : false; + data.isTest = data.isTest133? true : false; data.indexSeason = null this.globalData.configJson = data }).then(() => { diff --git a/pages/component/TitleHeader.js b/pages/component/TitleHeader.js index 1fc9b5a..07c67a8 100644 --- a/pages/component/TitleHeader.js +++ b/pages/component/TitleHeader.js @@ -92,6 +92,12 @@ Component({ else if (pages[pages.length-1].route.indexOf('orderList') != -1){ + // 清空购物车 + try { + console.log("清除购物车") + app.globalData.list = null;app.globalData.createDate = null; + app.globalData.index = 0;app.globalData.productPrice = 0;app.globalData.ticketPrice = 0; + } catch(e) { console.log("清空购物车失败", e) } wx.navigateTo({ url: '/pages/user/cartlist/list' }) diff --git a/pages/order/orderList/index.js b/pages/order/orderList/index.js index ced412f..3fe0fed 100644 --- a/pages/order/orderList/index.js +++ b/pages/order/orderList/index.js @@ -80,7 +80,6 @@ Page({ app.globalData.createDate.coupon_id= this.data.coupon ? this.data.coupon.id : null; let service = "order/create", postData = {data: JSON.stringify(app.globalData.createDate)} commonApi.user_post(service, postData).then(res => { - }) }, changePrice: function () { @@ -165,7 +164,18 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload: function () { - + // 清空购物车 + console.log("清除购物车") + try { + app.globalData.list = null + app.globalData.createDate = null + app.globalData.index = 0 + app.globalData.productPrice = 0 + app.globalData.ticketPrice = 0 + } catch(e) { + console.log("清空购物车失败", e) + } + }, /** diff --git a/pages/user/order/postOrderInfo/index.js b/pages/user/order/postOrderInfo/index.js index 0d3c819..6325b72 100644 --- a/pages/user/order/postOrderInfo/index.js +++ b/pages/user/order/postOrderInfo/index.js @@ -191,8 +191,12 @@ Page({ goDetail(e){ console.log(e.currentTarget.dataset); let item = e.currentTarget.dataset.set - util.gotoDetail(item) - return + if (item.compose_product_id) { + wx.navigateTo({ + url: '/pages/info/roadInfo/index?id='+item.compose_product_id + }) + return + } if (item.is_package == 1) { wx.navigateTo({ url:"/pages/info/postProductInfo/index?id="+item.product_id diff --git a/pages/user/order/sceneOrderInfo/index.js b/pages/user/order/sceneOrderInfo/index.js index 1d682c1..9e48030 100644 --- a/pages/user/order/sceneOrderInfo/index.js +++ b/pages/user/order/sceneOrderInfo/index.js @@ -226,9 +226,6 @@ Page({ goDetail(e){ console.log(e.currentTarget.dataset); let item = e.currentTarget.dataset.set - - util.gotoDetail(item) - return // 组合产品 跳线路 if (item.compose_product_id) { wx.navigateTo({ diff --git a/pages/user/order/showOrderInfo/index.js b/pages/user/order/showOrderInfo/index.js index bae81e8..428abb1 100644 --- a/pages/user/order/showOrderInfo/index.js +++ b/pages/user/order/showOrderInfo/index.js @@ -223,8 +223,12 @@ Page({ goDetail(e){ console.log(e.currentTarget.dataset); let item = e.currentTarget.dataset.set - util.gotoDetail(item) - return + if (item.compose_product_id) { + wx.navigateTo({ + url: '/pages/info/roadInfo/index?id='+item.compose_product_id + }) + return + } if (item.is_package==1) { wx.navigateTo({ diff --git a/utils/https.js b/utils/https.js index ac1e739..d55ab84 100644 --- a/utils/https.js +++ b/utils/https.js @@ -225,6 +225,15 @@ function user_post_new(url, data = {}, type) { if (url.indexOf('/order/create') != -1 && res.data.code == 1 && res.data.data) { // 下单成功 wx.removeStorageSync('prizeId') + + // 清空购物车 + try { + console.log("清除购物车") + let app = getApp() + app.globalData.list = null;app.globalData.createDate = null; + app.globalData.index = 0;app.globalData.productPrice = 0;app.globalData.ticketPrice = 0; + } catch(e) { console.log("清空购物车失败", e) } + if (res.data.data.pay_status == 1) { // 0元直接付款成功 wx.navigateTo({ diff --git a/utils/util.js b/utils/util.js index dc2cb8b..5fe8ecd 100644 --- a/utils/util.js +++ b/utils/util.js @@ -579,6 +579,13 @@ const detailPagePoint = function (url, res) { // app 要传进来 util 获取不到 const orderByShoppingCart = function (listData, app) { + app.globalData.list = [] + app.globalData.postProduct = [] + app.globalData.product = null + app.globalData.createDate = null + app.globalData.index = 0 + app.globalData.productPrice = 0 + app.globalData.ticketPrice = 0 let productType,flag,isCar; commonApi.user_post('wx/get_user_keep', { jumpurl: '/pages/user/cartlist/list',