from_share 加入购物车要跳转到 cart

wechat_user_type
Ge Hao 8 years ago
parent 86e3b8a624
commit 45ebc09c93
  1. 1
      app.js
  2. 11
      pages/show_product/show_product.js

@ -90,6 +90,7 @@ App({
data: {code: that.globalData.code}, data: {code: that.globalData.code},
success: function(res) { success: function(res) {
if (!res.data.token) { if (!res.data.token) {
wx.hideToast()
wx.showModal({ wx.showModal({
title: '未登录', title: '未登录',
content: '请前往 “我的” 页面绑定手机号', content: '请前往 “我的” 页面绑定手机号',

@ -9,7 +9,8 @@ Page({
windowWidth: 375, windowWidth: 375,
windowHeight: 667, windowHeight: 667,
pixelRatio: 2, pixelRatio: 2,
accountType: '' accountType: '',
from_share: false
}, },
onShareAppMessage: function () { onShareAppMessage: function () {
@ -41,6 +42,7 @@ Page({
productUtil.getProduct(id, function(result){ productUtil.getProduct(id, function(result){
var data = app.store.sync(result.data) var data = app.store.sync(result.data)
that.setData({ that.setData({
from_share: true,
id: data.id, id: data.id,
product: data, product: data,
title: data.name title: data.name
@ -59,6 +61,7 @@ Page({
})[0] })[0]
this.setData({ this.setData({
from_share: false,
id: id, id: id,
product: product, product: product,
title: product.name title: product.name
@ -117,5 +120,11 @@ Page({
key: 'cartItems', key: 'cartItems',
data: cartItems data: cartItems
}) })
if (this.data.from_share) {
wx.switchTab({
url: '../cart/cart'
})
}
} }
}) })

Loading…
Cancel
Save