积分接口联调

This commit is contained in:
2024-03-21 23:22:24 +08:00
parent 792aa4268a
commit 4fb648f003
9 changed files with 67 additions and 33 deletions

View File

@@ -10,6 +10,6 @@ enum URL {
export const getCategoryList = () => get<CategoryBean>({ url: URL.categoryList }); export const getCategoryList = () => get<CategoryBean>({ url: URL.categoryList });
export const getGoodsList = (params: any) => post<GoodsBean>({ url: URL.goodsList, data: params }); export const getGoodsList = (params: any) => get<GoodsBean>({ url: URL.goodsList, data: params });
export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` }); export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` });

View File

@@ -21,6 +21,7 @@ enum URL {
dynamicCode = '/member/dynccode', dynamicCode = '/member/dynccode',
rechargeList = '/ext/recharge/rule_config', rechargeList = '/ext/recharge/rule_config',
couponList = '/wechat/coupons/coupons/pageList', couponList = '/wechat/coupons/coupons/pageList',
integralList = '/ext/member/integral_query'
} }
export const getUserProfile = () => get<UserState>({ url: URL.profile }); export const getUserProfile = () => get<UserState>({ url: URL.profile });
@@ -43,3 +44,5 @@ export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
export const getRechargeList = () => get<any>({ url: URL.rechargeList }); export const getRechargeList = () => get<any>({ url: URL.rechargeList });
export const getCouponList = (data: any) => post<any>({ url: URL.couponList, data }); export const getCouponList = (data: any) => post<any>({ url: URL.couponList, data });
export const getIntegralList =(data:any)=>post({url:URL.integralList, data})

View File

@@ -31,3 +31,12 @@ export interface LoginResult {
userInfo: any; userInfo: any;
token: string; token: string;
} }
export interface IntegralBean {
id: string;
createtime: string;
exsitvalue: number;
remark: string;
type: number;
value: number;
}

View File

@@ -22,7 +22,7 @@
<view class='sku-title' style='margin-top: 43rpx'>尺码</view> <view class='sku-title' style='margin-top: 43rpx'>尺码</view>
<view class='sku-color-list c-flex-row'> <view class='sku-color-list c-flex-row'>
<view class='sku-item' <view class='sku-item'
:class='{"sku-item-active":currentSizeIndex==index,"sku-item-disabled":item.existingNumber<=0}' :class='{"sku-item-active":currentSizeIndex==index,"sku-item-disabled":item.existingNumber<=-1}'
v-for='(item, index) in skuSizeList' :key='index' v-for='(item, index) in skuSizeList' :key='index'
@click='sizeChange(index)'> @click='sizeChange(index)'>
<text>{{ item.sizeName }}</text> <text>{{ item.sizeName }}</text>
@@ -104,7 +104,7 @@ const countChange = (isPlus: boolean) => {
const confirm = () => { const confirm = () => {
emits('confirm', { emits('confirm', {
...skuSizeList.value[currentSizeIndex.value], ...skuSizeList.value[currentSizeIndex.value],
goodsCount: goodsCount.value count: goodsCount.value
}); });
popupRef.value.close(); popupRef.value.close();
}; };

View File

@@ -65,20 +65,25 @@ const changeCategory = async (index: number) => {
}; };
const fetchGoodsList = async () => { const fetchGoodsList = async () => {
const data = await getGoodsList({ const { rows } = await getGoodsList({
pageNum: 1, page: {
pageSize: 20, pageNum: 1,
bean: { pageSize: 100,
keyword: '', bean: {
typeIds: [categoryList.value[categorySelectedIndex.value].typeId] keyword: '',
typeIds: [categoryList.value[categorySelectedIndex.value].typeId]
}
} }
}); });
goodsList.value = data.rows; goodsList.value = rows;
}; };
const addShoppingCart = (goodsBean: GoodsBean) => { const addShoppingCart = (goodsBean: GoodsBean) => {
shoppingCart.save({ shoppingCart.save({
...goodsBean ...goodsBean,
name: goodsBean.goodsName,
count: 1
}); });
}; };
</script> </script>

View File

@@ -116,11 +116,13 @@ const swiperIndex = ref(0);
onLoad(async (e: any) => { onLoad(async (e: any) => {
goodsBean.value = await getGoodsDetail(e.goodsId); goodsBean.value = await getGoodsDetail(e.goodsId);
const { rows } = await getGoodsList({ const { rows } = await getGoodsList({
page: 1, page: {
pageSize: 10, page: 1,
bean: { pageSize: 20,
keyword: '', bean: {
typeIds: ['1724629185362591745'] keyword: '',
typeIds: ['1724629185362591745']
}
} }
}); });
recommendList.value = rows; recommendList.value = rows;
@@ -146,7 +148,8 @@ const addShoppingCart = () => {
shoppingCart.save( shoppingCart.save(
{ {
...goodsBean.value, ...goodsBean.value,
...skuBean.value ...skuBean.value,
count: 1
} }
); );
showToast('加入购物车成功'); showToast('加入购物车成功');

View File

@@ -11,12 +11,12 @@
<image v-show='isEditMode' class='checkbox' :src='assetsUrl("ic_checkbox_active_red.png")' /> <image v-show='isEditMode' class='checkbox' :src='assetsUrl("ic_checkbox_active_red.png")' />
<image class='goods-image' :src='item.images' /> <image class='goods-image' :src='item.images' />
<view class='c-flex-column'> <view class='c-flex-column'>
<text>{{item.name}}</text> <text>{{ item.name }}</text>
<view class='sku-view'> <view class='sku-view'>
<text>紫色120cm x1</text> <text>{{ item?.colorName }}{{ item?.sizeName }} x{{ item?.count }}</text>
<image :src='assetsUrl("ic_arrow_down_gray.png")' /> <image :src='assetsUrl("ic_arrow_down_gray.png")' />
</view> </view>
<text>{{item.price}}</text> <text style='margin-top: 50rpx'>{{ item.price }}</text>
<view class='count-change-view c-flex-row'> <view class='count-change-view c-flex-row'>
<view class='count-image' @click.stop='countChange(false)'> <view class='count-image' @click.stop='countChange(false)'>
<image :src='assetsUrl("ic_reduce.png")' /> <image :src='assetsUrl("ic_reduce.png")' />
@@ -57,8 +57,6 @@ const checkedAll = ref(false);
const shoppingCart = useShoppingCartStore(); const shoppingCart = useShoppingCartStore();
const { shoppingCartList } = storeToRefs(shoppingCart); const { shoppingCartList } = storeToRefs(shoppingCart);
// const goodsCount = ref(1);
const countChange = (isPlus: Boolean) => { const countChange = (isPlus: Boolean) => {
}; };

View File

@@ -1,23 +1,25 @@
<template> <template>
<view class='card-view'> <view class='card-view'>
<text class='category-title'>2023-02-12</text> <!-- <text class='category-title'>2023-02-12</text>-->
<view class='item c-flex-column' v-for='(item,index) in 3' :key='index'> <!-- <view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>-->
<view class='c-flex-row'> <view class='c-flex-row'>
<text class='primary-text-color' style='flex: 1'>消费</text> <text class='primary-text-color' style='flex: 1'>{{item?.remark}}</text>
<text class='accent-text-color'>-30</text> <text class='accent-text-color'>{{item?.value}}</text>
</view> </view>
<view class='c-flex-row'> <view class='c-flex-row'>
<text class='secondary-text-color' style='flex: 1'>2023-06-27 15:02:11</text> <text class='secondary-text-color' style='flex: 1'>{{ item?.createtime }}</text>
<text style='color: #999999'>会员积分30.00</text> <text style='color: #999999'>会员积分30.00</text>
</view> </view>
<view class='divider' style='margin-top: 20rpx'/> <view class='divider' style='margin-top: 20rpx'/>
</view> <!-- </view>-->
</view> </view>
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import { IntegralBean } from '@/api/user/types';
defineProps({ defineProps({
item: Object item: Object as PropType<IntegralBean>
}); });
</script> </script>

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class='content'> <view class='content'>
<view class='top-view c-flex-column'> <view class='top-view c-flex-column'>
<text>2520</text> <text>{{ userInfo.integration }}</text>
<text>会员积分</text> <text>会员积分</text>
</view> </view>
<text class='integral-detail-title'>积分明细</text> <text class='integral-detail-title'>积分明细</text>
@@ -12,9 +12,23 @@
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import IntegralItem from '@/pages/mine/subs/integral/components/integral-item.vue'; import IntegralItem from './components/integral-item.vue';
import { getIntegralList } from '@/api/user';
import { useUserStore } from '@/store';
const userStore = useUserStore();
const { userInfo } = storeToRefs(userStore);
const tradeList = ref([]);
onLoad((e) => {
fetchData();
});
const fetchData = async () => {
const { rows } = await getIntegralList({ 'pageNum': 1, 'pageSize': 10, 'bean': {} });
tradeList.value = rows;
};
const tradeList = ref([1, 2, 3, 4, 5]);
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
@@ -47,7 +61,7 @@ const tradeList = ref([1, 2, 3, 4, 5]);
position: relative; position: relative;
} }
scroll-view{ scroll-view {
width: auto; width: auto;
} }
</style> </style>