|
|
@@ -26,9 +26,7 @@ Page({
|
|
|
checkedSpecPrice: 0,
|
|
|
openAttr: false,
|
|
|
openShare: false,
|
|
|
- noCollectImage: '/static/images/icon_collect.png',
|
|
|
- hasCollectImage: '/static/images/icon_collect_checked.png',
|
|
|
- collectImage: '/static/images/icon_collect.png',
|
|
|
+ collect: false,
|
|
|
shareImage: '',
|
|
|
isGroupon: false, //标识是否是一个参团购买
|
|
|
soldout: false,
|
|
|
@@ -189,11 +187,11 @@ Page({
|
|
|
|
|
|
if (res.data.userHasCollect == 1) {
|
|
|
that.setData({
|
|
|
- collectImage: that.data.hasCollectImage
|
|
|
+ collect: true
|
|
|
});
|
|
|
} else {
|
|
|
that.setData({
|
|
|
- collectImage: that.data.noCollectImage
|
|
|
+ collect: false
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -471,12 +469,12 @@ Page({
|
|
|
.then(function(res) {
|
|
|
if (that.data.userHasCollect == 1) {
|
|
|
that.setData({
|
|
|
- collectImage: that.data.noCollectImage,
|
|
|
+ collect: false,
|
|
|
userHasCollect: 0
|
|
|
});
|
|
|
} else {
|
|
|
that.setData({
|
|
|
- collectImage: that.data.hasCollectImage,
|
|
|
+ collect: true,
|
|
|
userHasCollect: 1
|
|
|
});
|
|
|
}
|
|
|
@@ -497,10 +495,7 @@ Page({
|
|
|
|
|
|
//提示选择完整规格
|
|
|
if (!this.isCheckedAllSpec()) {
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: '请选择完整规格'
|
|
|
- });
|
|
|
+ util.showErrorToast('请选择完整规格');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -508,20 +503,14 @@ Page({
|
|
|
let checkedProductArray = this.getCheckedProductItem(this.getCheckedSpecKey());
|
|
|
if (!checkedProductArray || checkedProductArray.length <= 0) {
|
|
|
//找不到对应的product信息,提示没有库存
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: '没有库存'
|
|
|
- });
|
|
|
+ util.showErrorToast('没有库存');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
let checkedProduct = checkedProductArray[0];
|
|
|
//验证库存
|
|
|
if (checkedProduct.number <= 0) {
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: '没有库存'
|
|
|
- });
|
|
|
+ util.showErrorToast('没有库存');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -548,11 +537,7 @@ Page({
|
|
|
} catch (e) {}
|
|
|
|
|
|
} else {
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: res.errmsg,
|
|
|
- mask: true
|
|
|
- });
|
|
|
+ util.showErrorToast(res.errmsg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -572,10 +557,7 @@ Page({
|
|
|
|
|
|
//提示选择完整规格
|
|
|
if (!this.isCheckedAllSpec()) {
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: '请选择完整规格'
|
|
|
- });
|
|
|
+ util.showErrorToast('请选择完整规格');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -583,20 +565,14 @@ Page({
|
|
|
let checkedProductArray = this.getCheckedProductItem(this.getCheckedSpecKey());
|
|
|
if (!checkedProductArray || checkedProductArray.length <= 0) {
|
|
|
//找不到对应的product信息,提示没有库存
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: '没有库存'
|
|
|
- });
|
|
|
+ util.showErrorToast('没有库存');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
let checkedProduct = checkedProductArray[0];
|
|
|
//验证库存
|
|
|
if (checkedProduct.number <= 0) {
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: '没有库存'
|
|
|
- });
|
|
|
+ util.showErrorToast('没有库存');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -618,19 +594,15 @@ Page({
|
|
|
});
|
|
|
if (that.data.userHasCollect == 1) {
|
|
|
that.setData({
|
|
|
- collectImage: that.data.hasCollectImage
|
|
|
+ collect: true
|
|
|
});
|
|
|
} else {
|
|
|
that.setData({
|
|
|
- collectImage: that.data.noCollectImage
|
|
|
+ collect: false
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
- wx.showToast({
|
|
|
- image: '/static/images/icon_error.png',
|
|
|
- title: _res.errmsg,
|
|
|
- mask: true
|
|
|
- });
|
|
|
+ util.showErrorToast(_res.errmsg);
|
|
|
}
|
|
|
|
|
|
});
|