diff --git a/src/pages.json b/src/pages.json index 1ef1ca2d..62dc3d7f 100644 --- a/src/pages.json +++ b/src/pages.json @@ -165,6 +165,23 @@ "path": "pages/users/me/comments", "style": {} }, + /*product区*/ + { + "path": "pages/products/index", + "style": {} + }, + { + "path": "pages/products/upload", + "style": {} + }, + { + "path": "pages/products/details", + "style": {} + }, + { + "path": "pages/products/history", + "style": {} + }, { "path": "pages/users/settings/telephone", "style": {} diff --git a/src/pages/products/details.vue b/src/pages/products/details.vue new file mode 100644 index 00000000..92f5f099 --- /dev/null +++ b/src/pages/products/details.vue @@ -0,0 +1,166 @@ + + + + + + + + + + {{ product.name }} + + + 所需积分: {{ product.points }} + + + 剩余数量: {{ product.quantity }} + + + + + + + + {{ product.details }} + + + + + + + + + diff --git a/src/pages/products/history.vue b/src/pages/products/history.vue new file mode 100644 index 00000000..c51f4864 --- /dev/null +++ b/src/pages/products/history.vue @@ -0,0 +1,187 @@ + + + + + + 总积分: {{ points.amount }} + + + + 暂时没有积分历史哦 + + + + + + + {{ point.user.nickname }} + + + {{ point.reason }} + + + {{ point.points }}积分 + + + {{ point.action }} + + + {{ point.action }} + + + + + + 积分商城 + + + + + + diff --git a/src/pages/products/index.vue b/src/pages/products/index.vue new file mode 100644 index 00000000..b9de81d4 --- /dev/null +++ b/src/pages/products/index.vue @@ -0,0 +1,248 @@ + + + + + + 可用积分:{{ amount }} + + + + + + + + {{ product.name }} + + + 所需积分: {{ product.points }} + + + 剩余数量: {{ product.quantity }} + + + + + + + + {{ page }} + + + + + + + + diff --git a/src/pages/products/upload.vue b/src/pages/products/upload.vue new file mode 100644 index 00000000..5e07ae51 --- /dev/null +++ b/src/pages/products/upload.vue @@ -0,0 +1,285 @@ + + + + + + + + 商品名称: + + + + + + 消耗积分: + + + + + + 库存数量: + + + + + + + 商品图片: + + + + 点击上传图片 + + + + + + + 商品详情: + + + + 提交商品 + + + + + + + + diff --git a/src/pages/users/me.vue b/src/pages/users/me.vue index 748ee5c9..f2a825b8 100644 --- a/src/pages/users/me.vue +++ b/src/pages/users/me.vue @@ -95,6 +95,18 @@ + + + + + 我的积分 + + + @@ -193,6 +205,7 @@ export default { visitTotal: 0, }; }, + beforeMount() { this.getInfo(); }, @@ -307,21 +320,21 @@ export default { } .bg-info .avatar { - width: 190rpx; - height: 190rpx; + width: 190 rpx; + height: 190 rpx; } .bg-info .text { position: absolute; top: 22vh; - font-size: 36rpx; + font-size: 36 rpx; font-weight: 700; color: white; } .bg-info image { - width: 180rpx; - height: 180rpx; - margin-left: 6rpx; + width: 180 rpx; + height: 180 rpx; + margin-left: 6 rpx; } diff --git a/src/routers/points.js b/src/routers/points.js new file mode 100644 index 00000000..003bee88 --- /dev/null +++ b/src/routers/points.js @@ -0,0 +1,28 @@ +/** + * 前往积分页面 + * @param id 文章id + */ +// eslint-disable-next-line import/prefer-default-export +export function toPointsPage(id) { + uni.navigateTo({ + url: `/pages/users/me/points?id=${id}`, + }); +} + +/** + * 前往积分商城页面 + */ +export function toPointMall() { + uni.navigateTo({ + url: '/pages/users/me/pointmall', + }); +} + +/** + * 前往商品发布页面 + */ +export function toUploadGoods() { + uni.navigateTo({ + url: '/pages/users/me/uploadgoods', + }); +} diff --git a/src/routers/product.js b/src/routers/product.js new file mode 100644 index 00000000..2ef1dd05 --- /dev/null +++ b/src/routers/product.js @@ -0,0 +1,17 @@ +/** + * 跳转到上传商品页面 + */ +export function toUploadProductsPage() { + uni.navigateTo({ + url: '/pages/products/upload', + }); +} + +/** + * 跳转到商城页面 + */ +export function toProductsPage() { + uni.navigateTo({ + url: '/pages/products/index', + }); +} diff --git a/src/services/point.js b/src/services/point.js new file mode 100644 index 00000000..048dec24 --- /dev/null +++ b/src/services/point.js @@ -0,0 +1,30 @@ +import request from '@/utils/request'; +/** + * 获取所有的商品 + */ +export function getGoods(page) { + return request.get(`/products?min=&max=&pageSize=8&page=${page}&stock=`); +} + +/** + * 获取单个商品信息 + */ +export function getGoodDetail(id) { + return request.get(`/products/${id}`); +} + +/** + * 上传商品信息 + */ +export async function uploadGoods(good) { + return request.post('/products', good); +} + +/** + * 获取个人积分增减信息 + */ +export async function getMyPoints(id) { + return request.get(`/transactions?user=${id}&page=1&pageSize=10&action=earn,redeem&start_date=&end_date=`); +} + +/* 订单相关 */ diff --git a/src/services/user.js b/src/services/user.js index 57649969..3eba50c8 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -206,3 +206,20 @@ export function resetPassword(username, password, email, code) { username, password, email, code, }); } + +/** + * 获取所有产品信息 + * @returns {Promise} + */ +export async function getProductInfo(config) { + return request.get('/products', config); +} + +/** + * 获取指定产品信息 + * @param id 产品id + * @returns {Promise} + */ +export async function getProductInfoWithId(id) { + return request.get(`/products/${id}`); +}
+ {{ product.details }} +
点击上传图片