feat 对接商品收藏(80%),浏览记录
This commit is contained in:
parent
ca48ddbabf
commit
bb3d0c8c0b
2
app.json
2
app.json
@ -5,6 +5,8 @@
|
|||||||
"pages/login/authorize-avatar-name/index",
|
"pages/login/authorize-avatar-name/index",
|
||||||
"pages/login/phone-register/index",
|
"pages/login/phone-register/index",
|
||||||
"pages/usercenter/index",
|
"pages/usercenter/index",
|
||||||
|
"pages/usercenter/goods-collect/index",
|
||||||
|
"pages/usercenter/goods-history/index",
|
||||||
"pages/usercenter/person-info/index",
|
"pages/usercenter/person-info/index",
|
||||||
"pages/usercenter/address/list/index",
|
"pages/usercenter/address/list/index",
|
||||||
"pages/usercenter/address/edit/index",
|
"pages/usercenter/address/edit/index",
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
addOrUpdateGoodsBrowsingHistory
|
||||||
|
} from '~/services/usercenter/goods-history/addOrUpdateGoodsBrowsingHistory';
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
options: {
|
options: {
|
||||||
addGlobalClass: true,
|
addGlobalClass: true,
|
||||||
@ -68,7 +72,15 @@ Component({
|
|||||||
pageLifeTimes: {},
|
pageLifeTimes: {},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
clickHandle() {
|
clickHandle(e) {
|
||||||
|
// 点击加入历史记录
|
||||||
|
console.log(this.data.goods.spuId,'看看点击商品卡的id');
|
||||||
|
let data = {
|
||||||
|
goodsGuid: this.data.goods.spuId
|
||||||
|
}
|
||||||
|
addOrUpdateGoodsBrowsingHistory(data).then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
this.triggerEvent('click', { goods: this.data.goods });
|
this.triggerEvent('click', { goods: this.data.goods });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -137,3 +137,145 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view
|
||||||
|
id="{{independentID}}"
|
||||||
|
class="goods-category-card"
|
||||||
|
bind:tap="clickHandle"
|
||||||
|
data-goods="{{ goods }}"
|
||||||
|
wx:if="{{type == 'collect-card'}}"
|
||||||
|
>
|
||||||
|
<view class="goods-category-card__main">
|
||||||
|
<view class="goods-category-card__thumb" bind:tap="clickThumbHandle">
|
||||||
|
<!-- <t-image
|
||||||
|
wx:if="{{ !!goods.thumb }}"
|
||||||
|
t-class="goods-card__img"
|
||||||
|
src="{{ goods.thumb }}"
|
||||||
|
mode="aspectFill"
|
||||||
|
lazy-load
|
||||||
|
/> -->
|
||||||
|
<image class="goods-category-card__img" src="{{goods.thumb}}" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
<view class="goods-card__body">
|
||||||
|
<view class="goods-card__upper">
|
||||||
|
<view wx:if="{{ goods.title }}" class="goods-card__title">
|
||||||
|
{{ goods.title }}
|
||||||
|
</view>
|
||||||
|
<!-- <view class="goods-category-sold-num">{{goods.soldNum}}人付款</view> -->
|
||||||
|
<!-- <view class="goods-category-sold-num">月销{{goods.soldNum}}</view> -->
|
||||||
|
|
||||||
|
<view wx:if="{{ goods.tags && !!goods.tags.length }}" class="goods-card__tags">
|
||||||
|
<view
|
||||||
|
wx:for="{{ goods.tags }}"
|
||||||
|
wx:key="index"
|
||||||
|
wx:for-item="tag"
|
||||||
|
class="goods-card__tag"
|
||||||
|
data-index="{{index}}"
|
||||||
|
>
|
||||||
|
{{tag}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods-card__down">
|
||||||
|
<price
|
||||||
|
wx:if="{{ goods.price }}"
|
||||||
|
priceUnit="yuan"
|
||||||
|
wr-class="spec-for-price"
|
||||||
|
symbol-class="spec-for-symbol"
|
||||||
|
symbol="{{currency}}"
|
||||||
|
price="{{goods.price}}"
|
||||||
|
/>
|
||||||
|
<price
|
||||||
|
wx:if="{{ goods.originPrice && isValidityLinePrice }}"
|
||||||
|
priceUnit="yuan"
|
||||||
|
wr-class="goods-card__origin-price"
|
||||||
|
symbol="{{currency}}"
|
||||||
|
price="{{goods.originPrice}}"
|
||||||
|
type="delthrough"
|
||||||
|
/>
|
||||||
|
<!-- <t-icon
|
||||||
|
class="goods-card__add-cart"
|
||||||
|
prefix="wr"
|
||||||
|
name="cartAdd"
|
||||||
|
id="{{independentID}}-cart"
|
||||||
|
data-id="{{independentID}}"
|
||||||
|
catchtap="addCartHandle"
|
||||||
|
size="48rpx"
|
||||||
|
color="#FA550F"
|
||||||
|
/> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view
|
||||||
|
id="{{independentID}}"
|
||||||
|
class="goods-category-card"
|
||||||
|
bind:tap="clickHandle"
|
||||||
|
data-goods="{{ goods }}"
|
||||||
|
wx:if="{{type == 'history-card'}}"
|
||||||
|
>
|
||||||
|
<view class="goods-category-card__main">
|
||||||
|
<view class="goods-category-card__thumb" bind:tap="clickThumbHandle">
|
||||||
|
<!-- <t-image
|
||||||
|
wx:if="{{ !!goods.thumb }}"
|
||||||
|
t-class="goods-card__img"
|
||||||
|
src="{{ goods.thumb }}"
|
||||||
|
mode="aspectFill"
|
||||||
|
lazy-load
|
||||||
|
/> -->
|
||||||
|
<image class="goods-category-card__img" src="{{goods.thumb}}" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
<view class="goods-card__body">
|
||||||
|
<view class="goods-card__upper">
|
||||||
|
<view wx:if="{{ goods.title }}" class="goods-card__title">
|
||||||
|
{{ goods.title }}
|
||||||
|
</view>
|
||||||
|
<!-- <view class="goods-category-sold-num">{{goods.soldNum}}人付款</view> -->
|
||||||
|
<!-- <view class="goods-category-sold-num">月销{{goods.soldNum}}</view> -->
|
||||||
|
|
||||||
|
<view wx:if="{{ goods.tags && !!goods.tags.length }}" class="goods-card__tags">
|
||||||
|
<view
|
||||||
|
wx:for="{{ goods.tags }}"
|
||||||
|
wx:key="index"
|
||||||
|
wx:for-item="tag"
|
||||||
|
class="goods-card__tag"
|
||||||
|
data-index="{{index}}"
|
||||||
|
>
|
||||||
|
{{tag}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="goods-card__down">
|
||||||
|
<price
|
||||||
|
wx:if="{{ goods.price }}"
|
||||||
|
priceUnit="yuan"
|
||||||
|
wr-class="spec-for-price"
|
||||||
|
symbol-class="spec-for-symbol"
|
||||||
|
symbol="{{currency}}"
|
||||||
|
price="{{goods.price}}"
|
||||||
|
/>
|
||||||
|
<price
|
||||||
|
wx:if="{{ goods.originPrice && isValidityLinePrice }}"
|
||||||
|
priceUnit="yuan"
|
||||||
|
wr-class="goods-card__origin-price"
|
||||||
|
symbol="{{currency}}"
|
||||||
|
price="{{goods.originPrice}}"
|
||||||
|
type="delthrough"
|
||||||
|
/>
|
||||||
|
<!-- <t-icon
|
||||||
|
class="goods-card__add-cart"
|
||||||
|
prefix="wr"
|
||||||
|
name="cartAdd"
|
||||||
|
id="{{independentID}}-cart"
|
||||||
|
data-id="{{independentID}}"
|
||||||
|
catchtap="addCartHandle"
|
||||||
|
size="48rpx"
|
||||||
|
color="#FA550F"
|
||||||
|
/> -->
|
||||||
|
<view class="goods-card__crate-time">{{goods.craeteTime}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
@ -179,3 +179,12 @@
|
|||||||
.custom-tab-bar {
|
.custom-tab-bar {
|
||||||
--td-tab-bar-active-bg: #ff0000; /* 设置选中状态的背景颜色为红色 */
|
--td-tab-bar-active-bg: #ff0000; /* 设置选中状态的背景颜色为红色 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.goods-card__crate-time{
|
||||||
|
width: 100%;
|
||||||
|
font-size: 25rpx;
|
||||||
|
color: grey;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
@ -122,7 +122,7 @@
|
|||||||
catchspecs="specsTap"
|
catchspecs="specsTap"
|
||||||
catchclick="goGoodsDetail"
|
catchclick="goGoodsDetail"
|
||||||
>
|
>
|
||||||
<view slot="thumb-cover" class="no-storage-mask" wx:if="{{goods.stockQuantity <=0}}">
|
<view slot="thumb-cover" class="no-storage-mask" wx:if="{{goods.stockQuantity <=0 || (goods.skuId != 0 && goods.skuStockQuantity <=0)}}">
|
||||||
<view class="no-storage-content">无货</view>
|
<view class="no-storage-content">无货</view>
|
||||||
</view>
|
</view>
|
||||||
</goods-card>
|
</goods-card>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
Component({
|
Component({
|
||||||
externalClasses: ['wr-sold-out', 'wr-class'],
|
externalClasses: ['wr-sold-out', 'wr-class'],
|
||||||
|
|
||||||
options: { multipleSlots: true },
|
options: {
|
||||||
|
multipleSlots: true
|
||||||
|
},
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
soldout: {
|
soldout: {
|
||||||
@ -44,23 +46,33 @@ Component({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
toAddCart() {
|
toAddCart() {
|
||||||
const { isStock } = this.properties;
|
const {
|
||||||
|
isStock
|
||||||
|
} = this.properties;
|
||||||
if (!isStock) return;
|
if (!isStock) return;
|
||||||
this.triggerEvent('toAddCart');
|
this.triggerEvent('toAddCart');
|
||||||
},
|
},
|
||||||
|
|
||||||
toBuyNow(e) {
|
toBuyNow(e) {
|
||||||
const { isStock } = this.properties;
|
const {
|
||||||
|
isStock
|
||||||
|
} = this.properties;
|
||||||
if (!isStock) return;
|
if (!isStock) return;
|
||||||
this.triggerEvent('toBuyNow', e);
|
this.triggerEvent('toBuyNow', e);
|
||||||
},
|
},
|
||||||
|
|
||||||
toNav(e) {
|
toNav(e) {
|
||||||
const { url } = e.currentTarget.dataset;
|
const {
|
||||||
|
url,
|
||||||
|
title
|
||||||
|
} = e.currentTarget.dataset;
|
||||||
|
|
||||||
return this.triggerEvent('toNav', {
|
return this.triggerEvent('toNav', {
|
||||||
e,
|
e,
|
||||||
url,
|
url,
|
||||||
|
title
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
@ -11,6 +11,7 @@
|
|||||||
data-ele="foot_navigation"
|
data-ele="foot_navigation"
|
||||||
data-index="{{index}}"
|
data-index="{{index}}"
|
||||||
data-url="{{item.url}}"
|
data-url="{{item.url}}"
|
||||||
|
data-title="{{item.title}}"
|
||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
<text wx:if="{{shopCartNum > 0 && item.showCartNum}}" class="tag-cart-num">
|
<text wx:if="{{shopCartNum > 0 && item.showCartNum}}" class="tag-cart-num">
|
||||||
|
@ -58,9 +58,10 @@ Page({
|
|||||||
storeLogo: `${imgPrefix}common/store-logo.png`,
|
storeLogo: `${imgPrefix}common/store-logo.png`,
|
||||||
storeName: '云mall标准版旗舰店',
|
storeName: '云mall标准版旗舰店',
|
||||||
jumpArray: [{
|
jumpArray: [{
|
||||||
title: '首页',
|
title: '收藏',
|
||||||
url: '/pages/home/home',
|
url: '',
|
||||||
iconName: 'home',
|
iconName: 'star',
|
||||||
|
filled_iconName: 'star-filled',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '购物车',
|
title: '购物车',
|
||||||
@ -126,11 +127,18 @@ Page({
|
|||||||
|
|
||||||
toNav(e) {
|
toNav(e) {
|
||||||
const {
|
const {
|
||||||
url
|
url,
|
||||||
|
title
|
||||||
} = e.detail;
|
} = e.detail;
|
||||||
wx.switchTab({
|
|
||||||
url: url,
|
if (title == "收藏") {
|
||||||
});
|
console.log(this.data.details.spuId,'点击收藏的id');
|
||||||
|
// console.log("点击收藏");
|
||||||
|
} else {
|
||||||
|
wx.switchTab({
|
||||||
|
url: url,
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
showCurImg(e) {
|
showCurImg(e) {
|
||||||
|
@ -28,7 +28,7 @@ Page({
|
|||||||
goodsList: [],
|
goodsList: [],
|
||||||
goodsListLoadStatus: 0,
|
goodsListLoadStatus: 0,
|
||||||
pageLoading: false,
|
pageLoading: false,
|
||||||
current: 1,
|
current: 0,
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
duration: '500',
|
duration: '500',
|
||||||
interval: 5000,
|
interval: 5000,
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
</t-search>
|
</t-search>
|
||||||
</view>
|
</view>
|
||||||
<view class="swiper-wrap">
|
<view class="swiper-wrap">
|
||||||
<t-swiper wx:if="{{imgSrcs.length > 0}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" imageProps="{{swiperImageProps}}" list="{{imgSrcs}}" bind:click="navToActivityDetail" />
|
<t-swiper wx:if="{{imgSrcs.length > 0}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}" imageProps="{{swiperImageProps}}" list="{{imgSrcs}}" />
|
||||||
|
<!-- bind:click="navToActivityDetail" -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="home-page-container">
|
<view class="home-page-container">
|
||||||
|
122
pages/usercenter/goods-collect/index.js
Normal file
122
pages/usercenter/goods-collect/index.js
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
import {
|
||||||
|
getGoodsCollectionList
|
||||||
|
} from '~/services/usercenter/goods-collect/getGoodsCollectionList';
|
||||||
|
|
||||||
|
|
||||||
|
Page({
|
||||||
|
page: {
|
||||||
|
size: 10,
|
||||||
|
num: 1,
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取售后订单列表
|
||||||
|
init(reset = false) {
|
||||||
|
const params = {
|
||||||
|
pageSize: this.page.size,
|
||||||
|
pageIndex: this.page.num,
|
||||||
|
};
|
||||||
|
|
||||||
|
return getGoodsCollectionList(params)
|
||||||
|
.then((res) => {
|
||||||
|
this.page.num++;
|
||||||
|
let list = [];
|
||||||
|
|
||||||
|
if (res && res.data && res.data.result) {
|
||||||
|
this.setData({
|
||||||
|
list: res.data.result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
if (reset) {
|
||||||
|
this.setData({
|
||||||
|
list: [],
|
||||||
|
},
|
||||||
|
() => resolve(),
|
||||||
|
);
|
||||||
|
} else resolve();
|
||||||
|
}).then(() => {
|
||||||
|
this.setData({
|
||||||
|
list: this.data.list.concat(list),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
return Promise.reject(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
gotoGoodsDetail(e) {
|
||||||
|
const {
|
||||||
|
index
|
||||||
|
} = e.detail;
|
||||||
|
const {
|
||||||
|
spuId
|
||||||
|
} = this.data.list[index];
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/goods/details/index?spuId=${spuId}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
8
pages/usercenter/goods-collect/index.json
Normal file
8
pages/usercenter/goods-collect/index.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "我的收藏",
|
||||||
|
"usingComponents": {
|
||||||
|
"t-empty": "tdesign-miniprogram/empty/empty",
|
||||||
|
"t-toast": "tdesign-miniprogram/toast/toast",
|
||||||
|
"goods-list": "/components/goods-list/index"
|
||||||
|
}
|
||||||
|
}
|
9
pages/usercenter/goods-collect/index.wxml
Normal file
9
pages/usercenter/goods-collect/index.wxml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!--pages/usercenter/goods-collect/index.wxml-->
|
||||||
|
<view wx:key="index" class="section">
|
||||||
|
<view class="goods-category-crad">
|
||||||
|
<view class="empty-wrap" wx:if="{{list.length === 0}}">
|
||||||
|
<t-empty t-class="empty-tips" size="240rpx" description="暂无收藏商品" />
|
||||||
|
</view>
|
||||||
|
<goods-list wx:else wr-class="wr-goods-list" type="collect-card" goodsList="{{list}}" bind:click="gotoGoodsDetail" />
|
||||||
|
</view>
|
||||||
|
</view>
|
1
pages/usercenter/goods-collect/index.wxss
Normal file
1
pages/usercenter/goods-collect/index.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/usercenter/goods-collect/index.wxss */
|
122
pages/usercenter/goods-history/index.js
Normal file
122
pages/usercenter/goods-history/index.js
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
import {
|
||||||
|
getGoodsBrowsingHistoryList
|
||||||
|
} from '~/services/usercenter/goods-history/getGoodsBrowsingHistoryList';
|
||||||
|
|
||||||
|
|
||||||
|
Page({
|
||||||
|
page: {
|
||||||
|
size: 10,
|
||||||
|
num: 1,
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取商品浏览记录列表
|
||||||
|
init(reset = false) {
|
||||||
|
const params = {
|
||||||
|
pageSize: this.page.size,
|
||||||
|
pageIndex: this.page.num,
|
||||||
|
};
|
||||||
|
|
||||||
|
return getGoodsBrowsingHistoryList(params)
|
||||||
|
.then((res) => {
|
||||||
|
this.page.num++;
|
||||||
|
let list = [];
|
||||||
|
|
||||||
|
if (res && res.data && res.data.result) {
|
||||||
|
this.setData({
|
||||||
|
list: res.data.result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
if (reset) {
|
||||||
|
this.setData({
|
||||||
|
list: [],
|
||||||
|
},
|
||||||
|
() => resolve(),
|
||||||
|
);
|
||||||
|
} else resolve();
|
||||||
|
}).then(() => {
|
||||||
|
this.setData({
|
||||||
|
list: this.data.list.concat(list),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
return Promise.reject(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
gotoGoodsDetail(e) {
|
||||||
|
const {
|
||||||
|
index
|
||||||
|
} = e.detail;
|
||||||
|
const {
|
||||||
|
spuId
|
||||||
|
} = this.data.list[index];
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `/pages/goods/details/index?spuId=${spuId}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
8
pages/usercenter/goods-history/index.json
Normal file
8
pages/usercenter/goods-history/index.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "我的浏览记录",
|
||||||
|
"usingComponents": {
|
||||||
|
"t-empty": "tdesign-miniprogram/empty/empty",
|
||||||
|
"t-toast": "tdesign-miniprogram/toast/toast",
|
||||||
|
"goods-list": "/components/goods-list/index"
|
||||||
|
}
|
||||||
|
}
|
9
pages/usercenter/goods-history/index.wxml
Normal file
9
pages/usercenter/goods-history/index.wxml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!--pages/usercenter/goods-collect/index.wxml-->
|
||||||
|
<view wx:key="index" class="section">
|
||||||
|
<view class="goods-category-crad">
|
||||||
|
<view class="empty-wrap" wx:if="{{list.length === 0}}">
|
||||||
|
<t-empty t-class="empty-tips" size="240rpx" description="暂无浏览记录" />
|
||||||
|
</view>
|
||||||
|
<goods-list wx:else wr-class="wr-goods-list" type="history-card" goodsList="{{list}}" bind:click="gotoGoodsDetail" />
|
||||||
|
</view>
|
||||||
|
</view>
|
1
pages/usercenter/goods-history/index.wxss
Normal file
1
pages/usercenter/goods-history/index.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/usercenter/goods-history/index.wxss */
|
@ -60,7 +60,7 @@ const menuData = [
|
|||||||
const orderTagInfos = [{
|
const orderTagInfos = [{
|
||||||
title: '待付款',
|
title: '待付款',
|
||||||
iconName: 'wallet',
|
iconName: 'wallet',
|
||||||
orderNum: 0,
|
orderNum: 1,
|
||||||
tabType: 5,
|
tabType: 5,
|
||||||
status: 1,
|
status: 1,
|
||||||
},
|
},
|
||||||
@ -253,6 +253,18 @@ Page({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
jumpCollect() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/usercenter/goods-collect/index'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
jumpHistory() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/usercenter/goods-history/index'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
openMakePhone() {
|
openMakePhone() {
|
||||||
this.setData({
|
this.setData({
|
||||||
showMakePhone: true
|
showMakePhone: true
|
||||||
|
@ -10,6 +10,18 @@
|
|||||||
|
|
||||||
|
|
||||||
<view class="content-wrapper">
|
<view class="content-wrapper">
|
||||||
|
<!-- 收藏和足迹 -->
|
||||||
|
<view class="order-history-box">
|
||||||
|
<view class="order-history-content-box" bind:tap="jumpCollect">
|
||||||
|
<view class="order-history-content-num">0</view>
|
||||||
|
<view class="order-history-content-text">收藏</view>
|
||||||
|
</view>
|
||||||
|
<view class="order-history-content-line"></view>
|
||||||
|
<view class="order-history-content-box" bind:tap="jumpHistory">
|
||||||
|
<view class="order-history-content-num">0</view>
|
||||||
|
<view class="order-history-content-text">浏览记录</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<!-- <button type="primary" bind:tap="getOpenIdFun">获取OpenID</button> -->
|
<!-- <button type="primary" bind:tap="getOpenIdFun">获取OpenID</button> -->
|
||||||
<view class="order-group-wrapper">
|
<view class="order-group-wrapper">
|
||||||
<t-order-group orderTagInfos="{{orderTagInfos}}" bind:onClickTop="jumpAllOrder" bind:onClickItem="jumpNav" />
|
<t-order-group orderTagInfos="{{orderTagInfos}}" bind:onClickTop="jumpAllOrder" bind:onClickItem="jumpNav" />
|
||||||
|
@ -144,3 +144,27 @@ page {
|
|||||||
.cell-box .t-cell-padding {
|
.cell-box .t-cell-padding {
|
||||||
padding: 24rpx 18rpx 24rpx 32rpx;
|
padding: 24rpx 18rpx 24rpx 32rpx;
|
||||||
}
|
}
|
||||||
|
.order-history-box{
|
||||||
|
width: 90%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin: 30rpx auto;
|
||||||
|
}
|
||||||
|
.order-history-content-box{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.order-history-content-num{
|
||||||
|
font-size: 35rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
.order-history-content-line{
|
||||||
|
/* width: 1rpx; */
|
||||||
|
height: 80rpx;
|
||||||
|
border: 1px solid black;
|
||||||
|
display: flex;
|
||||||
|
align-self: center;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '~/services/_utils/request';
|
||||||
|
|
||||||
|
/** 添加商品浏览记录 */
|
||||||
|
export function addOrUpdateGoodsBrowsingHistory(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: `GoodsCollectionApi/addOrUpdateGoodsBrowsingHistory`,
|
||||||
|
method: 'Post',
|
||||||
|
data: data,
|
||||||
|
success: function (res) {
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail: function (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
20
services/usercenter/goods-collect/getGoodsCollectionList.js
Normal file
20
services/usercenter/goods-collect/getGoodsCollectionList.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '~/services/_utils/request';
|
||||||
|
|
||||||
|
/** 获取商品收藏列表 */
|
||||||
|
export function getGoodsCollectionList(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: `GoodsCollectionApi/getGoodsCollectionList`,
|
||||||
|
method: 'GET',
|
||||||
|
data: data,
|
||||||
|
success: function (res) {
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail: function (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '~/services/_utils/request';
|
||||||
|
|
||||||
|
/** 添加商品浏览记录 */
|
||||||
|
export function addOrUpdateGoodsBrowsingHistory(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: `GoodsBrowsingHistoryApi/addOrUpdateGoodsBrowsingHistory`,
|
||||||
|
method: 'Post',
|
||||||
|
data: data,
|
||||||
|
success: function (res) {
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail: function (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
import data from '~/custom-tab-bar/data';
|
||||||
|
import {
|
||||||
|
request
|
||||||
|
} from '~/services/_utils/request';
|
||||||
|
|
||||||
|
/** 获取商品浏览记录列表 */
|
||||||
|
export function getGoodsBrowsingHistoryList(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: `GoodsBrowsingHistoryApi/getGoodsBrowsingHistoryList`,
|
||||||
|
method: 'GET',
|
||||||
|
data: data,
|
||||||
|
success: function (res) {
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail: function (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user