Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ec7668a991
@ -262,7 +262,6 @@ Component({
|
|||||||
},
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
console.log(this.properties.goodsList);
|
|
||||||
this.genIndependentID(this.id || '');
|
this.genIndependentID(this.id || '');
|
||||||
this.setData({
|
this.setData({
|
||||||
type: this.properties.type
|
type: this.properties.type
|
||||||
|
@ -19,6 +19,10 @@ Component({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: true,
|
||||||
}, // 是否有库存
|
}, // 是否有库存
|
||||||
|
isCollect: {
|
||||||
|
type: Boolean,
|
||||||
|
value: false,
|
||||||
|
}, // 是否收藏
|
||||||
isSlotButton: {
|
isSlotButton: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: false,
|
value: false,
|
||||||
|
@ -8,6 +8,12 @@ import {
|
|||||||
import {
|
import {
|
||||||
fetchActivityList
|
fetchActivityList
|
||||||
} from '~/services/activity/fetchActivityList';
|
} from '~/services/activity/fetchActivityList';
|
||||||
|
import {
|
||||||
|
addOrUpdateGoodsCollection
|
||||||
|
} from '~/services/usercenter/goods-collect/addOrUpdateGoodsCollection';
|
||||||
|
import {
|
||||||
|
CancelGoodsCollection
|
||||||
|
} from '~/services/usercenter/goods-collect/CancelGoodsCollection';
|
||||||
import {
|
import {
|
||||||
getGoodsDetailsCommentList,
|
getGoodsDetailsCommentList,
|
||||||
getGoodsDetailsCommentsCount,
|
getGoodsDetailsCommentsCount,
|
||||||
@ -61,7 +67,6 @@ Page({
|
|||||||
title: '收藏',
|
title: '收藏',
|
||||||
url: '',
|
url: '',
|
||||||
iconName: 'star',
|
iconName: 'star',
|
||||||
filled_iconName: 'star-filled',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '购物车',
|
title: '购物车',
|
||||||
@ -132,7 +137,14 @@ Page({
|
|||||||
} = e.detail;
|
} = e.detail;
|
||||||
|
|
||||||
if (title == "收藏") {
|
if (title == "收藏") {
|
||||||
console.log(this.data.details.spuId,'点击收藏的id');
|
if(this.data.details.isCollect){
|
||||||
|
CancelGoodsCollection({goodsGuid: this.data.details.spuId})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
addOrUpdateGoodsCollection({goodsGuid: this.data.details.spuId})
|
||||||
|
}
|
||||||
|
this.getDetail(this.data.spuId)
|
||||||
|
// console.log(this.data.details.spuId, '点击收藏的id');
|
||||||
// console.log("点击收藏");
|
// console.log("点击收藏");
|
||||||
} else {
|
} else {
|
||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
@ -449,7 +461,18 @@ Page({
|
|||||||
// details.desc = details.desc.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
|
// details.desc = details.desc.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
|
||||||
// details.desc = details.desc.replace(/<img[^>]*style\s*=\s*(['"])[^'"]*\1[^>]*>/gi, '<img style="max-width:100%;height:auto;" ');
|
// details.desc = details.desc.replace(/<img[^>]*style\s*=\s*(['"])[^'"]*\1[^>]*>/gi, '<img style="max-width:100%;height:auto;" ');
|
||||||
// details.desc = details.desc.replace(/<img[^>]*>/gi, '<img style="max-3999999996width:100%;height:auto;" >');
|
// details.desc = details.desc.replace(/<img[^>]*>/gi, '<img style="max-3999999996width:100%;height:auto;" >');
|
||||||
|
if (details.isCollect === true) {
|
||||||
|
this.data.jumpArray[0].iconName = 'star_filled';
|
||||||
|
this.setData({
|
||||||
|
jumpArray: this.data.jumpArray
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.data.jumpArray[0].iconName = 'star';
|
||||||
|
this.setData({
|
||||||
|
jumpArray: this.data.jumpArray
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
skuList.forEach((item) => {
|
skuList.forEach((item) => {
|
||||||
skuArray.push({
|
skuArray.push({
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
jumpArray="{{jumpArray}}"
|
jumpArray="{{jumpArray}}"
|
||||||
soldout="{{soldout}}"
|
soldout="{{soldout}}"
|
||||||
isStock="{{isStock}}"
|
isStock="{{isStock}}"
|
||||||
|
isCollect="{{details.isCollect}}"
|
||||||
shopCartNum="{{cartNum}}"
|
shopCartNum="{{cartNum}}"
|
||||||
buttonType="{{buttonType}}"
|
buttonType="{{buttonType}}"
|
||||||
bind:toAddCart="toAddCart"
|
bind:toAddCart="toAddCart"
|
||||||
|
@ -31,12 +31,12 @@
|
|||||||
<view class="pay-item">
|
<view class="pay-item">
|
||||||
<text>运费</text>
|
<text>运费</text>
|
||||||
<view class="pay-item__right font-bold">
|
<view class="pay-item__right font-bold">
|
||||||
<!-- <block wx:if="{{settleDetailData.totalDeliveryFee && settleDetailData.totalDeliveryFee != 0}}"> -->
|
<block wx:if="{{settleDetailData.totalDeliveryFee && settleDetailData.totalDeliveryFee != 0}}">
|
||||||
<!-- {{stores.deliveryFee}} -->
|
<!-- {{stores.deliveryFee}} -->
|
||||||
<block wx:if="{{stores.deliveryFee && stores.deliveryFee != 0}}">
|
<!-- <block wx:if="{{stores.deliveryFee && stores.deliveryFee != 0}}"> -->
|
||||||
+
|
+
|
||||||
<!-- <price priceUnit="yuan" fill decimalSmaller price="{{settleDetailData.totalDeliveryFee}}" /> -->
|
<price priceUnit="yuan" fill decimalSmaller price="{{settleDetailData.totalDeliveryFee}}" />
|
||||||
<price priceUnit="yuan" fill decimalSmaller price="{{stores.deliveryFee}}" />
|
<!-- <price priceUnit="yuan" fill decimalSmaller price="{{stores.deliveryFee}}" /> -->
|
||||||
</block>
|
</block>
|
||||||
<text wx:else>免运费</text>
|
<text wx:else>免运费</text>
|
||||||
</view>
|
</view>
|
||||||
|
@ -12,7 +12,8 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
list: []
|
list: [],
|
||||||
|
goodsListLoadStatus: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,9 +27,11 @@ Page({
|
|||||||
init(reset = false) {
|
init(reset = false) {
|
||||||
const params = {
|
const params = {
|
||||||
pageSize: this.page.size,
|
pageSize: this.page.size,
|
||||||
pageIndex: this.page.num,
|
pageNum: this.page.num,
|
||||||
};
|
};
|
||||||
|
this.setData({
|
||||||
|
goodsListLoadStatus: 1,
|
||||||
|
});
|
||||||
return getGoodsCollectionList(params)
|
return getGoodsCollectionList(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.page.num++;
|
this.page.num++;
|
||||||
@ -36,25 +39,15 @@ Page({
|
|||||||
|
|
||||||
if (res && res.data && res.data.result) {
|
if (res && res.data && res.data.result) {
|
||||||
this.setData({
|
this.setData({
|
||||||
list: res.data.result
|
list: this.data.list.concat(res.data.result),
|
||||||
})
|
goodsListLoadStatus: 0,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
}).catch((err) => {
|
||||||
if (reset) {
|
this.setData({
|
||||||
this.setData({
|
goodsListLoadStatus: 3,
|
||||||
list: [],
|
|
||||||
},
|
|
||||||
() => resolve(),
|
|
||||||
);
|
|
||||||
} else resolve();
|
|
||||||
}).then(() => {
|
|
||||||
this.setData({
|
|
||||||
list: this.data.list.concat(list),
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -71,6 +64,12 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.data.goodsListLoadStatus === 0) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
@ -106,13 +105,6 @@ Page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 用户点击右上角分享
|
||||||
*/
|
*/
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-empty": "tdesign-miniprogram/empty/empty",
|
"t-empty": "tdesign-miniprogram/empty/empty",
|
||||||
"t-toast": "tdesign-miniprogram/toast/toast",
|
"t-toast": "tdesign-miniprogram/toast/toast",
|
||||||
|
"load-more": "/components/load-more/index",
|
||||||
"goods-list": "/components/goods-list/index"
|
"goods-list": "/components/goods-list/index"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,8 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
list: []
|
list: [],
|
||||||
|
goodsListLoadStatus: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,39 +23,36 @@ Page({
|
|||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onReTry() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
|
||||||
// 获取商品浏览记录列表
|
// 获取商品浏览记录列表
|
||||||
init(reset = false) {
|
async init(reset = false) {
|
||||||
const params = {
|
const params = {
|
||||||
pageSize: this.page.size,
|
pageSize: this.page.size,
|
||||||
pageIndex: this.page.num,
|
pageNum: this.page.num,
|
||||||
};
|
};
|
||||||
|
this.setData({
|
||||||
|
goodsListLoadStatus: 1,
|
||||||
|
});
|
||||||
return getGoodsBrowsingHistoryList(params)
|
return getGoodsBrowsingHistoryList(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.page.num++;
|
this.page.num++;
|
||||||
let list = [];
|
|
||||||
|
|
||||||
if (res && res.data && res.data.result) {
|
if (res && res.data && res.data.result) {
|
||||||
this.setData({
|
this.setData({
|
||||||
list: res.data.result
|
list: this.data.list.concat(res.data.result),
|
||||||
})
|
goodsListLoadStatus: 0,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
if (reset) {
|
|
||||||
this.setData({
|
|
||||||
list: [],
|
|
||||||
},
|
|
||||||
() => resolve(),
|
|
||||||
);
|
|
||||||
} else resolve();
|
|
||||||
}).then(() => {
|
|
||||||
this.setData({
|
|
||||||
list: this.data.list.concat(list),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
this.setData({
|
||||||
|
goodsListLoadStatus: 3,
|
||||||
|
});
|
||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -71,6 +69,12 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.data.goodsListLoadStatus === 0) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
@ -106,13 +110,6 @@ Page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户点击右上角分享
|
* 用户点击右上角分享
|
||||||
*/
|
*/
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-empty": "tdesign-miniprogram/empty/empty",
|
"t-empty": "tdesign-miniprogram/empty/empty",
|
||||||
"t-toast": "tdesign-miniprogram/toast/toast",
|
"t-toast": "tdesign-miniprogram/toast/toast",
|
||||||
|
"load-more": "/components/load-more/index",
|
||||||
"goods-list": "/components/goods-list/index"
|
"goods-list": "/components/goods-list/index"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,5 +5,6 @@
|
|||||||
<t-empty t-class="empty-tips" size="240rpx" description="暂无浏览记录" />
|
<t-empty t-class="empty-tips" size="240rpx" description="暂无浏览记录" />
|
||||||
</view>
|
</view>
|
||||||
<goods-list wx:else wr-class="wr-goods-list" type="history-card" goodsList="{{list}}" bind:click="gotoGoodsDetail" />
|
<goods-list wx:else wr-class="wr-goods-list" type="history-card" goodsList="{{list}}" bind:click="gotoGoodsDetail" />
|
||||||
|
<load-more list-is-empty="{{!list.length}}" status="{{goodsListLoadStatus}}" bind:retry="onReTry" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
@ -101,6 +101,10 @@ const getDefaultData = () => ({
|
|||||||
nickName: '正在登录...',
|
nickName: '正在登录...',
|
||||||
phoneNumber: '',
|
phoneNumber: '',
|
||||||
},
|
},
|
||||||
|
collectData: {
|
||||||
|
collectCount: 0,
|
||||||
|
historyCount: 0,
|
||||||
|
},
|
||||||
menuData,
|
menuData,
|
||||||
orderTagInfos,
|
orderTagInfos,
|
||||||
customerServiceInfo: {},
|
customerServiceInfo: {},
|
||||||
@ -133,6 +137,7 @@ Page({
|
|||||||
fetchUserCenter().then(
|
fetchUserCenter().then(
|
||||||
({
|
({
|
||||||
userInfo,
|
userInfo,
|
||||||
|
collectData,
|
||||||
// countsData,
|
// countsData,
|
||||||
// orderTagInfos: orderInfo,
|
// orderTagInfos: orderInfo,
|
||||||
// customerServiceInfo,
|
// customerServiceInfo,
|
||||||
@ -151,9 +156,9 @@ Page({
|
|||||||
// ...v,
|
// ...v,
|
||||||
// ...orderInfo[index],
|
// ...orderInfo[index],
|
||||||
// }));
|
// }));
|
||||||
console.log(userInfo,'来看看');
|
|
||||||
this.setData({
|
this.setData({
|
||||||
userInfo,
|
userInfo,
|
||||||
|
collectData,
|
||||||
// menuData,
|
// menuData,
|
||||||
// orderTagInfos: info,
|
// orderTagInfos: info,
|
||||||
// customerServiceInfo,
|
// customerServiceInfo,
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
<!-- 收藏和足迹 -->
|
<!-- 收藏和足迹 -->
|
||||||
<view class="order-history-box">
|
<view class="order-history-box">
|
||||||
<view class="order-history-content-box" bind:tap="jumpCollect">
|
<view class="order-history-content-box" bind:tap="jumpCollect">
|
||||||
<view class="order-history-content-num">0</view>
|
<view class="order-history-content-num">{{collectData.collectCount}}</view>
|
||||||
<view class="order-history-content-text">收藏</view>
|
<view class="order-history-content-text">收藏</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="order-history-content-line"></view>
|
<view class="order-history-content-line"></view>
|
||||||
<view class="order-history-content-box" bind:tap="jumpHistory">
|
<view class="order-history-content-box" bind:tap="jumpHistory">
|
||||||
<view class="order-history-content-num">0</view>
|
<view class="order-history-content-num">{{collectData.historyCount}}</view>
|
||||||
<view class="order-history-content-text">浏览记录</view>
|
<view class="order-history-content-text">浏览记录</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -13,12 +13,15 @@ export function fetchUserCenter() {
|
|||||||
url: `CustomerApi/getCustomerDetails?CustomerGuid=` + userData?.customerGuid,
|
url: `CustomerApi/getCustomerDetails?CustomerGuid=` + userData?.customerGuid,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
let userInfo = res.data;
|
|
||||||
let data = {
|
let data = {
|
||||||
userInfo: {
|
userInfo: {
|
||||||
avatarUrl: userInfo.customerAvatar,
|
avatarUrl: res.data.customerAvatar,
|
||||||
nickName: userInfo.customerNickname,
|
nickName: res.data.customerNickname,
|
||||||
phoneNumber: userInfo.customerMobilePhoneNumber,
|
phoneNumber: res.data.customerMobilePhoneNumber,
|
||||||
|
},
|
||||||
|
collectData: {
|
||||||
|
collectCount: res.data.collectCount,
|
||||||
|
historyCount: res.data.historyCount,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
20
services/usercenter/goods-collect/CancelGoodsCollection.js
Normal file
20
services/usercenter/goods-collect/CancelGoodsCollection.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '~/services/_utils/request';
|
||||||
|
|
||||||
|
/** 删除商品收藏 */
|
||||||
|
export function CancelGoodsCollection(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: `GoodsCollectionApi/CancelGoodsCollection`,
|
||||||
|
method: 'POST',
|
||||||
|
data: data,
|
||||||
|
success: function (res) {
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail: function (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -2,11 +2,11 @@ import {
|
|||||||
request
|
request
|
||||||
} from '~/services/_utils/request';
|
} from '~/services/_utils/request';
|
||||||
|
|
||||||
/** 添加商品浏览记录 */
|
/** 添加商品收藏 */
|
||||||
export function addOrUpdateGoodsBrowsingHistory(data) {
|
export function addOrUpdateGoodsCollection(data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
url: `GoodsCollectionApi/addOrUpdateGoodsBrowsingHistory`,
|
url: `GoodsCollectionApi/addOrUpdateGoodsCollection`,
|
||||||
method: 'Post',
|
method: 'Post',
|
||||||
data: data,
|
data: data,
|
||||||
success: function (res) {
|
success: function (res) {
|
Loading…
Reference in New Issue
Block a user