From c3cc5d653d75dc621677c5c2ac50567a861ce827 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 28 Dec 2023 22:00:07 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=EF=BC=9A=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/pay/index.vue | 6 +- pages/pay/recharge.vue | 4 +- pages/user/wallet/money.vue | 7 +- sheep/api/member/user.js | 11 ++ sheep/api/pay/wallet.js | 11 ++ sheep/api/promotion/coupon.js | 11 ++ sheep/api/trade/order.js | 11 ++ sheep/api/user.js | 100 +--------------- .../components/s-order-card/s-order-card.vue | 9 +- .../s-wallet-card/s-wallet-card.vue | 15 +-- sheep/store/modal.js | 3 +- sheep/store/user.js | 108 +++++++++--------- 12 files changed, 125 insertions(+), 171 deletions(-) diff --git a/pages/pay/index.vue b/pages/pay/index.vue index 4afdf617..57b98036 100644 --- a/pages/pay/index.vue +++ b/pages/pay/index.vue @@ -38,7 +38,7 @@ - 余额: {{ fen2yuan(userInfo.money) }}元 + 余额: {{ fen2yuan(userWallet.money) }}元 sheep.$store('user').userInfo); + const userWallet = computed(() => sheep.$store('user').userWallet); // 检测支付环境 const state = reactive({ @@ -189,6 +189,8 @@ state.orderType = options.orderType; } setOrder(id); + // 刷新钱包的缓存 + sheep.$store('user').getWallet(); }); diff --git a/pages/pay/recharge.vue b/pages/pay/recharge.vue index 32c27232..9432886e 100644 --- a/pages/pay/recharge.vue +++ b/pages/pay/recharge.vue @@ -9,7 +9,7 @@ ]"> 当前余额(元) - {{ fen2yuan(userInfo.money) }} + {{ fen2yuan(userWallet.balance) }} @@ -122,7 +122,8 @@ value: '2', }, ]; - const userInfo = computed(() => sheep.$store('user').userInfo); + + const userWallet = computed(() => sheep.$store('user').userWallet); // 格式化时间段 const dateFilterText = computed(() => { @@ -167,6 +168,8 @@ state.date = [state.today, state.today]; getLogList(); getSummary(); + // 刷新钱包的缓存 + sheep.$store('user').getWallet(); }); // 处理 tab 切换 diff --git a/sheep/api/member/user.js b/sheep/api/member/user.js index 8db91439..a2316faf 100644 --- a/sheep/api/member/user.js +++ b/sheep/api/member/user.js @@ -1,6 +1,17 @@ import request from '@/sheep/request'; const UserApi = { + // 获得基本信息 + getUserInfo: () => { + return request({ + url: '/app-api/member/user/get', + method: 'GET', + custom: { + showLoading: false, + auth: true, + }, + }); + }, // 修改基本信息 updateUser: (data) => { return request({ diff --git a/sheep/api/pay/wallet.js b/sheep/api/pay/wallet.js index 9287fbe5..3a86b470 100644 --- a/sheep/api/pay/wallet.js +++ b/sheep/api/pay/wallet.js @@ -1,6 +1,17 @@ import request from '@/sheep/request'; const PayWalletApi = { + // 获取钱包 + getPayWallet() { + return request({ + url: '/app-api/pay/wallet/get', + method: 'GET', + custom: { + showLoading: false, + auth: true, + }, + }); + }, // 获得钱包流水分页 getWalletTransactionPage: (params) => { const queryString = Object.keys(params) diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js index be8364e7..38b5dcbb 100644 --- a/sheep/api/promotion/coupon.js +++ b/sheep/api/promotion/coupon.js @@ -57,6 +57,17 @@ const CouponApi = { params: { id }, }); }, + // 获得未使用的优惠劵数量 + getUnusedCouponCount: () => { + return request({ + url: '/app-api/promotion/coupon/get-unused-count', + method: 'GET', + custom: { + showLoading: false, + auth: true, + }, + }); + } }; export default CouponApi; \ No newline at end of file diff --git a/sheep/api/trade/order.js b/sheep/api/trade/order.js index f2a2b691..372c60c7 100644 --- a/sheep/api/trade/order.js +++ b/sheep/api/trade/order.js @@ -90,6 +90,17 @@ const OrderApi = { }, }); }, + // 获得交易订单数量 + getOrderCount: () => { + return request2({ + url: '/app-api/trade/order/get-count', + method: 'GET', + custom: { + showLoading: false, + auth: true, + }, + }); + }, // 创建单个评论 createOrderItemComment: (data) => { return request2({ diff --git a/sheep/api/user.js b/sheep/api/user.js index 4e8dadec..c8e61579 100644 --- a/sheep/api/user.js +++ b/sheep/api/user.js @@ -12,24 +12,6 @@ export default { auth: true, }, }), - profile: () => - request2({ - url: 'member/user/get', - method: 'GET', - custom: { - showLoading: false, - auth: true, - }, - }), - balance: () => - request2({ - url: '/app-api/pay/wallet/get', - method: 'GET', - custom: { - showLoading: false, - auth: true, - }, - }), // 账号登录 accountLogin: (data) => request({ @@ -41,28 +23,6 @@ export default { loadingMsg: '登录中', }, }), - // 短信登录 - smsLogin: (data) => - request({ - url: '/user/api/user/smsLogin', - method: 'POST', - data, - custom: { - showSuccess: true, - loadingMsg: '登录中', - }, - }), - // 短信注册 - smsRegister: (data) => - request({ - url: '/user/api/user/smsRegister', - method: 'POST', - data, - custom: { - showSuccess: true, - loadingMsg: '正在注册', - }, - }), // 绑定、更换手机号 changeMobile: (data) => @@ -76,28 +36,6 @@ export default { }, }), - // 更新小程序信息 - updateMpUserInfo: (data) => - request({ - url: '/user/api/user/updateMpUserInfo', - method: 'POST', - data, - }), - - // 第三方授权信息 - thirdOauthInfo: () => - request({ - url: '/user/api/user/thirdOauth', - method: 'GET', - params: { - provider: $platform.provider, - platform: $platform.platform, - }, - custom: { - showLoading: false, - }, - }), - // 添加分享记录 addShareLog: (data) => request({ @@ -132,14 +70,6 @@ export default { }), address: { - // default: () => - // request({ - // url: 'user/address/default', - // method: 'GET', - // custom: { - // showError: false, - // }, - // }), default: () => request2({ url: 'member/address/get-default', @@ -278,33 +208,5 @@ export default { auth: true, }, }), - }, - //数量接口 - // data: () => - // request({ - // url: 'user/user/data', - // method: 'GET', - // custom: { - // showLoading: false, - // auth: true, - // }, - // }), - data: () => - request2({ - url: 'trade/order/get-count', - method: 'GET', - custom: { - showLoading: false, - auth: true, - }, - }), - data2: () => - request2({ - url: 'trade/after-sale/get-applying-count', - method: 'GET', - custom: { - showLoading: false, - auth: true, - }, - }), + } }; \ No newline at end of file diff --git a/sheep/components/s-order-card/s-order-card.vue b/sheep/components/s-order-card/s-order-card.vue index a5f0eb08..095e6cfd 100644 --- a/sheep/components/s-order-card/s-order-card.vue +++ b/sheep/components/s-order-card/s-order-card.vue @@ -9,11 +9,11 @@ > - + {{ item.title }} @@ -34,6 +34,7 @@ icon: '/static/img/shop/order/no_pay.png', path: '/pages/order/list', type: 'unpaid', + count: 'unpaidCount', }, { title: '待收货', @@ -41,6 +42,7 @@ icon: '/static/img/shop/order/no_take.png', path: '/pages/order/list', type: 'noget', + count: 'deliveredCount', }, { title: '待评价', @@ -48,6 +50,7 @@ icon: '/static/img/shop/order/no_comment.png', path: '/pages/order/list', type: 'nocomment', + count: 'uncommentedCount', }, { title: '售后单', @@ -55,6 +58,7 @@ icon: '/static/img/shop/order/change_order.png', path: '/pages/order/aftersale/list', type: 'aftersale', + count: 'afterSaleCount', }, { title: '全部订单', @@ -65,7 +69,6 @@ ]; const numData = computed(() => sheep.$store('user').numData); - console.log('更换后的yuda订单数量',numData)