feat 对金额商品分类

This commit is contained in:
lwh 2023-07-09 00:35:00 +08:00
parent 7612ee24b9
commit 03367933d0
5 changed files with 31 additions and 19 deletions

View File

@ -11,6 +11,7 @@
<c-tabbar <c-tabbar
wx:if="{{isSlotRight}}" wx:if="{{isSlotRight}}"
activeKey="{{subActiveKey}}" activeKey="{{subActiveKey}}"
tabList="{{category[activeKey].children}}"
bindchange="onChildChange" bindchange="onChildChange"
showMore showMore
> >
@ -47,7 +48,7 @@
bindtap="changCategory" bindtap="changCategory"
data-item="{{item}}" data-item="{{item}}"
> >
<t-image src="{{item.thumbnail}}" t-class="image" /> <image src="{{item.thumbnail}}" class="item-image" />
<view class="flex goods-category-normal-item-container-item-title"> <view class="flex goods-category-normal-item-container-item-title">
{{item.name}} {{item.name}}
</view> </view>

View File

@ -100,3 +100,10 @@
font-size: 24rpx; font-size: 24rpx;
color: #222427; color: #222427;
} }
.item-image{
width: 180rpx;
height: 180rpx;
object-fit: contain;
overflow: hidden;
}

View File

@ -1,11 +1,11 @@
import { getCategoryList } from '../../../services/good/fetchCategoryList'; import { getGoodsCategoryTreeList } from '../../../services/good/fetchCategoryList';
Page({ Page({
data: { data: {
list: [], list: [],
}, },
async init() { async init() {
try { try {
const result = await getCategoryList(); const result = await getGoodsCategoryTreeList();
this.setData({ this.setData({
list: result, list: result,
}); });

View File

@ -1,6 +1,7 @@
<view class="wrap"> <view class="wrap">
<goods-category <goods-category
level="{{3}}" level="{{2}}"
isSlotRight="{{false}}"
custom-class="goods-category-class" custom-class="goods-category-class"
category="{{list}}" category="{{list}}"
bind:changeCategory="onChange" bind:changeCategory="onChange"

View File

@ -1,18 +1,21 @@
import { config } from '../../config/index'; import {
request
} from '../_utils/request';
/** 获取商品列表 */ /** 获取经营类目列表 */
function mockFetchGoodCategory() { export function getGoodsCategoryTreeList() {
const { delay } = require('../_utils/delay'); return new Promise((resolve, reject) => {
const { getCategoryList } = require('../../model/category'); request({
return delay().then(() => getCategoryList()); url: `GoodsCategoryApi/getGoodsCategoryTreeList`,
} method: 'GET',
success: function (res) {
let list = res.data;
/** 获取商品列表 */ resolve(list);
export function getCategoryList() { },
if (config.useMock) { fail: function (error) {
return mockFetchGoodCategory(); reject(error);
} }
return new Promise((resolve) => { });
resolve('real api');
}); });
} }