From 09b93532f17375d15291f4a26aaa0c3128f8b70b Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 13 May 2025 16:55:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/server/mall.js | 39 ++++++++++++++ common/server/user.js | 18 +++++++ pages/user/recharge-page.vue | 100 ++++++++++++++++++++++++++--------- 3 files changed, 131 insertions(+), 26 deletions(-) create mode 100644 common/server/mall.js create mode 100644 common/server/user.js diff --git a/common/server/mall.js b/common/server/mall.js new file mode 100644 index 0000000..69bf151 --- /dev/null +++ b/common/server/mall.js @@ -0,0 +1,39 @@ + +import RequestManager from '../request'; +import common from '../common'; + +/** + * 获取钻石商品列表 + * @returns {Promise} + */ +export const getDiamondList = async () => { + const res = await RequestManager.get('/get_diamond_list'); + if (res.status == 1) { + return res.data; + } else { + + return null; + } +} +/** + * 创建钻石订单 + * @param {String} productId + * @returns + */ +export const createOrderProducts = async (productId) => { + const res = await RequestManager.get('/createOrderProducts', { product_id: productId }); + if (res.status == 1) { + return res.data; + } else { + return null; + } +} + +/** + * 获取订单状态 + * @returns + */ +export const getDiamondOrderLog = async (order_num) => { + const res = await RequestManager.get('/get_diamond_order_log', { order_num }); + return res; +} diff --git a/common/server/user.js b/common/server/user.js new file mode 100644 index 0000000..903f659 --- /dev/null +++ b/common/server/user.js @@ -0,0 +1,18 @@ + +import RequestManager from '../request'; +import common from '../common'; +/** + * 获取用户信息 + * @returns {Promise} + */ +export const getUserInfo = async () => { + const res = await RequestManager.get('/userInfo'); + if (res.status == 1) { + res.data.money = common.removeTrailingZeros(res.data.money); + res.data.integral = common.removeTrailingZeros(res.data.integral); + res.data.money2 = common.removeTrailingZeros(res.data.money2); + return res.data; + } else { + return null; + } +}; \ No newline at end of file diff --git a/pages/user/recharge-page.vue b/pages/user/recharge-page.vue index 4a3b244..154abcc 100644 --- a/pages/user/recharge-page.vue +++ b/pages/user/recharge-page.vue @@ -9,7 +9,7 @@ - 0 + {{userInfo.money}} 我的钻石 @@ -20,7 +20,9 @@ - + + + @@ -32,7 +34,7 @@ - + 确认支付 @@ -41,39 +43,85 @@