From 8fcd605102207334635978c7bbe9b24695630aca Mon Sep 17 00:00:00 2001 From: Ge Hao Date: Thu, 8 Dec 2016 14:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E7=AE=A1=E9=81=93=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E8=B4=AD=E7=89=A9=E8=BD=A6=EF=BC=8C=E8=BF=98=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E7=9C=9F=E6=9C=BA=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/cart/cart.js | 15 +++++++++++++++ pages/category/category.js | 31 ++++++++++++++++++++++++++++-- pages/show_product/show_product.js | 13 +++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/pages/cart/cart.js b/pages/cart/cart.js index b35bfc5..11ce221 100644 --- a/pages/cart/cart.js +++ b/pages/cart/cart.js @@ -128,6 +128,21 @@ Page({ return rObj }) + + // 管到屏蔽 + var guandao_item_block = cartItems.filter(function(obj){ + return parseInt(obj.product['category-id']) === 18 + }) + if (guandao_item_block.length >= 1) { + wx.showModal({ + title: '管到商品暂未开放', + content: '目前无法在小程序上购买管到商品,如有需要,可以在巴爷微信商城上进行购买。感谢您的理解,我们会尽快完善此功能。', + showCancel: false, + success: function(res) {} + }) + return + } + var params = this.data.address params['order_from'] = 'from_applet' params['order_items'] = order_items_attributes diff --git a/pages/category/category.js b/pages/category/category.js index 43060fa..4bf540d 100644 --- a/pages/category/category.js +++ b/pages/category/category.js @@ -5,13 +5,15 @@ Page({ data: { title: '', items: [], - accountType: '' + accountType: '', + categoryType: null }, onLoad: function(params) { var that = this this.setData({ - title: '巴爷供销社 - ' + params.type + title: '巴爷供销社 - ' + params.type, + categoryType: params.type }) product.getCategories(params.type, function(result) { var data = getApp().store.sync(result.data) @@ -40,6 +42,19 @@ Page({ bindTapProduct: function(e) { var that = this + + // 管到屏蔽 + if (this.data.categoryType === '管到') { + wx.showModal({ + title: '管到商品暂未开放', + content: '目前无法在小程序上购买管到商品,如有需要,可以在巴爷微信商城上进行购买。感谢您的理解,我们会尽快完善此功能。', + showCancel: false, + success: function(res) {} + }) + return + } + + var cartItems = wx.getStorageSync('cartItems') || [] var thisItem = this.data.items.filter(function(ele){ return ele.id === e.currentTarget.dataset.id @@ -51,6 +66,18 @@ Page({ })[0] } + + // 管到屏蔽 + if (thisItem && (parseInt(thisItem['category-id']) === 18)) { + wx.showModal({ + title: '管到商品暂未开放', + content: '目前无法在小程序上购买管到商品,如有需要,可以在巴爷微信商城上进行购买。感谢您的理解,我们会尽快完善此功能。', + showCancel: false, + success: function(res) {} + }) + return + } + if (exist) { exist.quantity = parseInt(exist.quantity) + 1 } else { diff --git a/pages/show_product/show_product.js b/pages/show_product/show_product.js index 7f7caf1..6107f4c 100644 --- a/pages/show_product/show_product.js +++ b/pages/show_product/show_product.js @@ -52,6 +52,19 @@ Page({ bindAddToCart (e) { var that = this + + //管到屏蔽 + if (this.data.product && (parseInt(this.data.product['category-id']) === 18)) { + wx.showModal({ + title: '管到商品暂未开放', + content: '目前无法在小程序上购买管到商品,如有需要,可以在巴爷微信商城上进行购买。感谢您的理解,我们会尽快完善此功能。', + showCancel: false, + success: function(res) {} + }) + return + } + + var cartItems = wx.getStorageSync('cartItems') || [] var exist = cartItems.filter(function(ele){