|
@@ -43,7 +43,9 @@ Page({
|
|
|
imgHiddenName: false,
|
|
|
page: 1,
|
|
|
size: 4,
|
|
|
- detailContent: ''
|
|
|
+ detailContent: '',
|
|
|
+ storeId: '',
|
|
|
+ detailStoreId: ''
|
|
|
},
|
|
|
toggleNav() {
|
|
|
this.setData({
|
|
@@ -70,8 +72,9 @@ Page({
|
|
|
}, 350)
|
|
|
let that = this;
|
|
|
const regex = new RegExp('<img', 'gi');
|
|
|
+ console.log('分享的storeId'+ wx.getStorageSync('storeId'))
|
|
|
util.request(api.GoodsDetail, { id: that.data.id, referrer: this.data.referrer,
|
|
|
- merchSn: wx.getStorageSync('merchSn') }).then(function (res) {
|
|
|
+ merchSn: wx.getStorageSync('merchSn'), storeId: wx.getStorageSync('storeId') }).then(function (res) {
|
|
|
if (res.errno === 0) {
|
|
|
that.setData({
|
|
|
goods: res.data.info,
|
|
@@ -87,7 +90,8 @@ Page({
|
|
|
cartNumber: res.data.cartNumber,
|
|
|
defaultFreight: res.data.defaultFreight,
|
|
|
checkedSpecText: res.data.specificationList[0].valueList[0].value,
|
|
|
- detailContent: that.escape2Html(res.data.info.goods_desc).replace(regex, `<img style="width: 100%;"`)
|
|
|
+ detailContent: that.escape2Html(res.data.info.goods_desc).replace(regex, `<img style="width: 100%;"`),
|
|
|
+ detailStoreId:res.data.info.storeId
|
|
|
});
|
|
|
|
|
|
if (res.data.userHasCollect == 1) {
|
|
@@ -183,19 +187,16 @@ Page({
|
|
|
onLoad: function (options) {
|
|
|
// 页面初始化 options为页面跳转所带来的参数
|
|
|
this.setData({
|
|
|
- id: parseInt(options.id)
|
|
|
+ id: parseInt(options.id),
|
|
|
+ storeId: options.storeId
|
|
|
// id: 1181000
|
|
|
});
|
|
|
- var that = this;
|
|
|
- this.getGoodsInfo();
|
|
|
- util.request(api.CartGoodsCount).then(function (res) {
|
|
|
- if (res.errno === 0) {
|
|
|
- that.setData({
|
|
|
- cartGoodsCount: res.data.cartTotal.goodsCount
|
|
|
- });
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
+ if(options.storeId){
|
|
|
+ wx.setStorageSync('storeId', options.storeId);
|
|
|
+ wx.setStorageSync('isShare', 'true');
|
|
|
+ }
|
|
|
+ console.log('分享的storeId1:' + wx.getStorageSync('storeId'))
|
|
|
var that = this;
|
|
|
// 高度自适应
|
|
|
wx.getSystemInfo({
|
|
@@ -269,6 +270,15 @@ Page({
|
|
|
wx.setStorageSync('storeId', wx.getStorageSync('storeId'));
|
|
|
wx.setStorageSync('merchSn', wx.getStorageSync('merchSn'));
|
|
|
that.reLoad();
|
|
|
+
|
|
|
+ that.getGoodsInfo();
|
|
|
+ util.request(api.CartGoodsCount, { storeId: wx.getStorageSync('storeId') }).then(function (res) {
|
|
|
+ if (res.errno === 0) {
|
|
|
+ that.setData({
|
|
|
+ cartGoodsCount: res.data.cartTotal.goodsCount
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -387,10 +397,11 @@ Page({
|
|
|
util.showErrorToast('库存不足');
|
|
|
//找不到对应的product信息,提示没有库存
|
|
|
return false;
|
|
|
- }
|
|
|
+ }
|
|
|
+ // console.log(that.data.productList)
|
|
|
// //根据选中的规格,判断是否有对应的sku信息
|
|
|
let checkedProduct = goodsUtil.getCheckedProductItem(goodsUtil.getCheckedSpecKey(that), that);
|
|
|
- console.log(checkedProduct)
|
|
|
+ // console.log(goodsUtil.getCheckedSpecKey(that))
|
|
|
if (!checkedProduct || checkedProduct.length <= 0) {
|
|
|
wx.showToast({
|
|
|
title: '库存不足',
|
|
@@ -399,7 +410,6 @@ Page({
|
|
|
//找不到对应的product信息,提示没有库存
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
//验证库存
|
|
|
// if (checkedProduct.goods_number < this.data.number) {
|
|
|
// //找不到对应的product信息,提示没有库存
|
|
@@ -458,13 +468,15 @@ Page({
|
|
|
onShareAppMessage: function () {
|
|
|
var that = this;
|
|
|
// console.log("url:" + that.data.goods.list_pic_url);
|
|
|
- // var userId = wx.getStorageSync('userId');
|
|
|
- // console.log("userId:" + userId);
|
|
|
+ var userId = wx.getStorageSync('userId');
|
|
|
+ console.log("userId:" + userId);
|
|
|
+ console.log("detailStoreId:" + that.data.detailStoreId);
|
|
|
+
|
|
|
return {
|
|
|
- title: '商业版',
|
|
|
- desc: null != that.data.goods.name ? that.data.goods.name : "商业版",
|
|
|
+ title: '商品详情',
|
|
|
+ desc: null != that.data.goods.name ? that.data.goods.name : "商品详情",
|
|
|
imageUrl: that.data.goods.list_pic_url,
|
|
|
- path: '/pages/goods/goods?id=' + that.data.id + '&&referrer=' + wx.getStorageSync('userId'),
|
|
|
+ path: '/pages/goods/goods?id=' + that.data.id + '&&referrer=' + wx.getStorageSync('userId') + '&&storeId=' + that.data.detailStoreId,
|
|
|
success: function (res) {
|
|
|
console.log("转发成功");
|
|
|
// 转发成功
|