Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(point): add points system #182

Merged
merged 19 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@
"path": "pages/users/me/comments",
"style": {}
},
{
"path": "pages/users/me/points",
"style": {}
},
{
"path": "pages/products/index",
"style": {}
},
{
"path": "pages/products/upload",
"style": {}
},
{
"path": "pages/users/settings/telephone",
"style": {}
Expand Down
132 changes: 132 additions & 0 deletions src/pages/products/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<template>
<view class="mall-page">
<cu-custom title="积分商城" />
<view class="product-list">
<view
v-for="product in products"
:key="product.id"
class="product-item"
>
<image
:src="product.picture"
class="product-image"
/>
<view class="product-details">
<view class="product-name">
{{ product.name }}
</view>
<view class="product-points">
所需积分: {{ product.points }}
</view>
<view class="product-quantity">
剩余数量: {{ product.quantity }}
</view>
</view>
</view>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加点什么样式?不说能买了 先弄的好看一点的展示页面

</view>
<view class="pagination-info">
当前页码: {{ pageInfo.page }}
总页数: {{ pageInfo.total_pages }}
每页数量: {{ pageInfo.pageSize }}
总数量: {{ pageInfo.amount }}
</view>
<view
class="circle-button"
@click="toUploadProductsPage()"
>
<i class="iconfont icon-plus" />
</view>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

图标弄个上传之类的
然后条件编译,如果是微信小程序则不显示

</view>
</template>

<script>
import { getProductInfo } from '@/services/user';
import { toUploadProductsPage } from '@/routers/product';

export default {
data() {
return {
products: [],
pageInfo: {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要设置默认值,否则空白页面时候显示有问题

};
},
methods: {
toUploadProductsPage,
async loadProducts() {
try {
const response = await getProductInfo();
this.products = response.result;
this.pageInfo = {
page: response.page,
total_pages: response.total_pages,
pageSize: response.pageSize,
amount: response.amount,
};
} catch (error) {
uni.showToast({
title: '无法加载商品',
});
}
},
},
onMounted() {
this.loadProducts();
},
};
</script>

<style scoped>
.circle-button {
width: 60px;
height: 60px;
background-color: #007bff;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: background-color 0.2s;
}

.circle-button:hover {
background-color: #0056b3;
}

.iconfont {
font-size: 24px;
}

.circle-button {
width: 60px;
height: 60px;
background-color: #39C5BB;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
position: fixed;
bottom: 20px;
right: 20px;
z-index: 9999;
transition: background-color 0.2s;
}

.circle-button:hover {
background-color: #39c5bb;
}

.iconfont {
font-size: 50px;
}

/* Custom styles for the white plus sign */
.circle-button i::before {
content: '+';
color: #fff;
}
</style>
Loading