|
@@ -10,6 +10,7 @@ Page({
|
|
|
data: {
|
|
|
hidePrice: wx.getStorageSync('hidePrice'),
|
|
|
badge: getApp().globalData.collectCount,
|
|
|
+ favoriteCount: getApp().globalData.favoriteCount,
|
|
|
loading: true,
|
|
|
content: {
|
|
|
sa_itemgroupid: null,
|
|
@@ -209,13 +210,6 @@ Page({
|
|
|
content
|
|
|
})
|
|
|
},
|
|
|
- clickBut() {
|
|
|
- this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
|
- title: '请选择加入产品领域',
|
|
|
- icon: "none",
|
|
|
- duration: 3000
|
|
|
- }) : this.handleStorage(0);
|
|
|
- },
|
|
|
/* 打开文档 */
|
|
|
openDocument(e) {
|
|
|
const {
|
|
@@ -258,11 +252,19 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ clickBut(e) {
|
|
|
+ this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
|
+ title: '请选择加入产品领域',
|
|
|
+ icon: "none",
|
|
|
+ duration: 3000
|
|
|
+ }) : this[e.target.id](0);
|
|
|
+ },
|
|
|
/* 选择领域 */
|
|
|
storage(e) {
|
|
|
- this.handleStorage(e.detail.value)
|
|
|
+ this.addToShoppingCart(e.detail.value)
|
|
|
},
|
|
|
- handleStorage(index) {
|
|
|
+ /* 加入购物车 */
|
|
|
+ addToShoppingCart(index) {
|
|
|
let detail = this.data.detail,
|
|
|
content = this.data.content;
|
|
|
if (detail.iscustomsize == 1) {
|
|
@@ -297,6 +299,33 @@ Page({
|
|
|
}))
|
|
|
})
|
|
|
},
|
|
|
+ /* 加入收藏夹 */
|
|
|
+ addToFavorites() {
|
|
|
+ let iscollection = this.data.detail.iscollection == 1 ? false : true
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20231121143403,
|
|
|
+ "content": {
|
|
|
+ "itemid": this.data.detail.itemid, //货品id
|
|
|
+ iscollection
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log(iscollection + "收藏夹", res)
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? iscollection ? '收藏成功' : "已取消收藏" : res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ if (res.msg == '成功') {
|
|
|
+ getApp().globalData.getFavoriteCount().then(num => {
|
|
|
+ this.setData({
|
|
|
+ favoriteCount: num
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ "detail.iscollection": iscollection ? 1 : 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/* 前往购物车 */
|
|
|
toCollect(e) {
|
|
|
getApp().globalData.changeBar({
|