diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js
index c38f82f..5135dbe 100644
--- a/pages/info/postProductInfo/index.js
+++ b/pages/info/postProductInfo/index.js
@@ -30,7 +30,8 @@ Page({
shareImg: null,
showShareFlag: false,
allowance_data: null,
- showAllowance: false
+ showAllowance: false,
+ tjList: [], //推荐商品列表
},
/**
@@ -108,6 +109,20 @@ Page({
})
})
+ commonApi._post("product/get_product_by_type", {
+ offset: 0,
+ limit: 6,
+ rand: true,
+ type: 'post'
+ }).then(res => {
+ try {
+ this.setData({
+ tjList: res.data.list
+ })
+ } catch (error) {
+ console.log(error);
+ }
+ })
},
changeAllowance: function () {
this.setData({
@@ -263,64 +278,64 @@ Page({
if (res && res.code != 1) {
return;
} else {
- if (this.data.skuFlag == 'order') {
- util.pagePoint({
- event: 'product_order',
- param: {
- id: this.data.info.id,
- type: this.data.info.type
- }
- }, 1)
- wx.setStorageSync('login_from', 'product_order_login')
- wx.setStorageSync('order_from', 'product_order_submit')
- app.globalData.couponInfo = null;
- // 购买
- let product = [{
- product: this.data.info,
- sku: this.data.info.sku[this.data.skuIndex],
- productNum: this.data.producNum
- }];
- app.globalData.postProduct = product;
- app.globalData.retailId = this.data.retailId;
- wx.navigateTo({
- url: '/pages/order/postOrder/index',
- })
- } else {
- commonApi.user_post("cart/add_sku", {
- sku_id: this.data.info.sku[this.data.skuIndex].id,
- num: this.data.producNum
- }).then(res => {
- if (res.code == 1) {
- commonApi.user_post('cart/get_list', {}).then(res => {
- this.setData({
- cartCount: res.data.length
- })
+ if (this.data.skuFlag == 'order') {
+ util.pagePoint({
+ event: 'product_order',
+ param: {
+ id: this.data.info.id,
+ type: this.data.info.type
+ }
+ }, 1)
+ wx.setStorageSync('login_from', 'product_order_login')
+ wx.setStorageSync('order_from', 'product_order_submit')
+ app.globalData.couponInfo = null;
+ // 购买
+ let product = [{
+ product: this.data.info,
+ sku: this.data.info.sku[this.data.skuIndex],
+ productNum: this.data.producNum
+ }];
+ app.globalData.postProduct = product;
+ app.globalData.retailId = this.data.retailId;
+ wx.navigateTo({
+ url: '/pages/order/postOrder/index',
})
- // 加动效
- this.setData({
- skuFlag: null,
- aniSkuIndex: this.data.skuIndex,
- cartImgInfo: null
+ } else {
+ commonApi.user_post("cart/add_sku", {
+ sku_id: this.data.info.sku[this.data.skuIndex].id,
+ num: this.data.producNum
+ }).then(res => {
+ if (res.code == 1) {
+ commonApi.user_post('cart/get_list', {}).then(res => {
+ this.setData({
+ cartCount: res.data.length
+ })
+ })
+ // 加动效
+ this.setData({
+ skuFlag: null,
+ aniSkuIndex: this.data.skuIndex,
+ cartImgInfo: null
+ })
+ setTimeout(() => {
+ this.setData({
+ aniSkuIndex: -1
+ })
+ wx.showModal({
+ title: "提示",
+ content: "去购物车结算?",
+ success: function (res) {
+ if (res.confirm) {
+ wx.navigateTo({
+ url: '/pages/user/cartlist/list',
+ })
+ }
+ }
+ })
+ }, 650)
+ }
})
- setTimeout(() => {
- this.setData({
- aniSkuIndex: -1
- })
- wx.showModal({
- title: "提示",
- content: "去购物车结算?",
- success: function (res) {
- if (res.confirm) {
- wx.navigateTo({
- url: '/pages/user/cartlist/list',
- })
- }
- }
- })
- }, 650)
}
- })
- }
}
})
@@ -592,6 +607,24 @@ Page({
ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth);
}
},
+ gotoDetail: function (e) {
+ let item = e.currentTarget.dataset.item;
+ util.pagePoint({
+ event: 'recommend_click',
+ param: {
+ id: item.id,
+ type: item.type
+ }
+ }, 1)
+ if (item.type == 'travels') {
+ // 游记做特殊处理 其他都按照原来的来
+ wx.navigateTo({
+ url: '/pages/info/strategyInfo/index?id=' + item.s_id,
+ })
+ } else {
+ util.gotoDetail(item);
+ }
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
diff --git a/pages/info/postProductInfo/index.wxml b/pages/info/postProductInfo/index.wxml
index d9fb7cd..4a088a5 100644
--- a/pages/info/postProductInfo/index.wxml
+++ b/pages/info/postProductInfo/index.wxml
@@ -2,10 +2,8 @@