From ececc6f67c5d8f2b4405f8a5aceba033fa11c42e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 31 Jul 2024 19:48:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91SYSTEM=EF=BC=9A=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/aftersale/apply.vue | 2 +- pages/order/confirm.vue | 2 +- pages/pay/recharge.vue | 4 ++-- pages/pay/result.vue | 6 +++--- sheep/util/const.js | 13 +++++++------ 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pages/order/aftersale/apply.vue b/pages/order/aftersale/apply.vue index 9e8ee254..8c9752ed 100644 --- a/pages/order/aftersale/apply.vue +++ b/pages/order/aftersale/apply.vue @@ -130,7 +130,7 @@ import TradeConfigApi from '@/sheep/api/trade/config'; import { fen2yuan } from '@/sheep/hooks/useGoods'; import AfterSaleApi from '@/sheep/api/trade/afterSale'; - import { SubscribeTemplate } from '@/sheep/util/const'; + import { WxaSubscribeTemplate } from '@/sheep/util/const'; const form = ref(null); const state = reactive({ diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue index 5892a239..834ad04a 100644 --- a/pages/order/confirm.vue +++ b/pages/order/confirm.vue @@ -166,7 +166,7 @@ import OrderApi from '@/sheep/api/trade/order'; import CouponApi from '@/sheep/api/promotion/coupon'; import { fen2yuan } from '@/sheep/hooks/useGoods'; - import { SubscribeTemplate } from '@/sheep/util/const'; + import { WxaSubscribeTemplate } from '@/sheep/util/const'; const state = reactive({ orderPayload: {}, diff --git a/pages/pay/recharge.vue b/pages/pay/recharge.vue index e79016d2..aa364139 100644 --- a/pages/pay/recharge.vue +++ b/pages/pay/recharge.vue @@ -47,7 +47,7 @@ import { onLoad } from '@dcloudio/uni-app'; import { fen2yuan } from '@/sheep/hooks/useGoods'; import PayWalletApi from '@/sheep/api/pay/wallet'; - import { SubscribeTemplate } from '@/sheep/util/const'; + import { WxaSubscribeTemplate } from '@/sheep/util/const'; const userWallet = computed(() => sheep.$store('user').userWallet); const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; @@ -82,7 +82,7 @@ return; } // #ifdef MP - sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.WALLET_RECHARGER_PAID); + sheep.$platform.useProvider('wechat').subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS); // #endif sheep.$router.go('/pages/pay/index', { id: data.payOrderId, diff --git a/pages/pay/result.vue b/pages/pay/result.vue index 96bbea3a..52b8d16a 100644 --- a/pages/pay/result.vue +++ b/pages/pay/result.vue @@ -69,7 +69,7 @@ import PayOrderApi from '@/sheep/api/pay/order'; import { fen2yuan } from '@/sheep/hooks/useGoods'; import OrderApi from '@/sheep/api/trade/order'; - import { SubscribeTemplate } from '@/sheep/util/const'; + import { WxaSubscribeTemplate } from '@/sheep/util/const'; const state = reactive({ id: 0, // 支付单号 @@ -159,9 +159,9 @@ const showSubscribeBtn = ref(false) // 默认隐藏 const SUBSCRIBE_BTN_STATUS_STORAGE_KEY = "subscribe_btn_status" function subscribeMessage() { - let event = [SubscribeTemplate.DELIVERY_ORDER]; + let event = [WxaSubscribeTemplate.TRADE_ORDER_DELIVERY]; if (state.tradeOrder.type === 3) { - event.push(SubscribeTemplate.COMBINATION_RESULT); + event.push(WxaSubscribeTemplate.PROMOTION_COMBINATION_SUCCESS); } sheep.$platform.useProvider('wechat').subscribeMessage(event, () => { // 订阅后记录一下订阅状态 diff --git a/sheep/util/const.js b/sheep/util/const.js index 01eec4fb..e1d3ee08 100644 --- a/sheep/util/const.js +++ b/sheep/util/const.js @@ -56,14 +56,15 @@ export const TimeStatusEnum = { END: '已结束', } -// TODO 订阅模版枚举 -export const SubscribeTemplate = { - WALLET_RECHARGER_PAID: "充值成功通知", - DELIVERY_ORDER: "订单发货通知", - COMBINATION_RESULT: "拼团结果通知" +/** + * 微信小程序的订阅模版 + */ +export const WxaSubscribeTemplate = { + TRADE_ORDER_DELIVERY: "订单发货通知", + PROMOTION_COMBINATION_SUCCESS: "拼团结果通知", + PAY_WALLET_RECHARGER_SUCCESS: "充值成功通知", } - export const getTimeStatusEnum = (startTime, endTime) => { const now = dayjs(); if (now.isBefore(startTime)) { From 7f5970d741b44e3784f685ac72a1c540332ff15e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 31 Jul 2024 23:46:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91SYSTEM=EF=BC=9A=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 4 +-- pages/pay/result.vue | 7 +++-- sheep/api/member/social.js | 22 +++++++++++++++ sheep/api/migration/third.js | 28 ------------------- .../canvas-poster/poster/index.js | 4 +-- sheep/platform/provider/wechat/miniProgram.js | 3 +- 6 files changed, 31 insertions(+), 37 deletions(-) diff --git a/manifest.json b/manifest.json index 66674c1c..2dfab7c7 100644 --- a/manifest.json +++ b/manifest.json @@ -184,7 +184,7 @@ "versionCode": 100 }, "mp-weixin": { - "appid": "wx63c280fe3248a3e7", + "appid": "wx66186af0759f47c9", "setting": { "urlCheck": false, "minified": true, @@ -236,4 +236,4 @@ "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", "locale": "zh-Hans", "fallbackLocale": "zh-Hans" -} +} \ No newline at end of file diff --git a/pages/pay/result.vue b/pages/pay/result.vue index 52b8d16a..43a24141 100644 --- a/pages/pay/result.vue +++ b/pages/pay/result.vue @@ -146,7 +146,6 @@ } function onOrder() { - // TODO 芋艿:待测试 if (state.orderType === 'recharge') { sheep.$router.redirect('/pages/pay/recharge-log'); } else { @@ -154,12 +153,14 @@ } } - // TODO 芋艿:待测试 // #ifdef MP const showSubscribeBtn = ref(false) // 默认隐藏 const SUBSCRIBE_BTN_STATUS_STORAGE_KEY = "subscribe_btn_status" function subscribeMessage() { - let event = [WxaSubscribeTemplate.TRADE_ORDER_DELIVERY]; + if (state.orderType !== 'goods') { + return; + } + const event = [WxaSubscribeTemplate.TRADE_ORDER_DELIVERY]; if (state.tradeOrder.type === 3) { event.push(WxaSubscribeTemplate.PROMOTION_COMBINATION_SUCCESS); } diff --git a/sheep/api/member/social.js b/sheep/api/member/social.js index f7ab2599..14e6edfa 100644 --- a/sheep/api/member/social.js +++ b/sheep/api/member/social.js @@ -49,6 +49,28 @@ const SocialApi = { }, }); }, + // 获取订阅消息模板列表 + getSubscribeTemplateList: () => + request({ + url: '/member/social-user/get-subscribe-template-list', + method: 'GET', + custom: { + showError: false, + showLoading: false, + }, + }), + // 获取微信小程序码 + getWxaQrcode: async (path, query) => { + return await request({ + url: '/member/social-user/wxa-qrcode', + method: 'POST', + data: { + scene: query, + path, + checkPath: false, // TODO 开发环境暂不检查 path 是否存在 + }, + }); + }, }; export default SocialApi; \ No newline at end of file diff --git a/sheep/api/migration/third.js b/sheep/api/migration/third.js index d6e6f306..325638cc 100644 --- a/sheep/api/migration/third.js +++ b/sheep/api/migration/third.js @@ -1,34 +1,6 @@ import request from '@/sheep/request'; export default { - // 微信相关 - wechat: { - // 小程序订阅消息 - getSubscribeTemplateList: () => - request({ - url: '/member/social-user/get-subscribe-template-list', - method: 'GET', - custom: { - showError: false, - showLoading: false, - }, - }), - - // 获取微信小程序码 - // TODO @puhui999:这个接口,挪到 /Users/yunai/Java/yudao-mall-uniapp/sheep/api/member/social.js - getWxacode: async (path, query) => { - return await request({ - url: '/member/social-user/wxa-qrcode', - method: 'POST', - data: { - scene: query, - path, - checkPath: false, // TODO 开发环境暂不检查 path 是否存在 - }, - }); - }, - }, - // 苹果相关 apple: { // 第三方登录 diff --git a/sheep/components/s-share-modal/canvas-poster/poster/index.js b/sheep/components/s-share-modal/canvas-poster/poster/index.js index 55d79c99..0724e7f7 100644 --- a/sheep/components/s-share-modal/canvas-poster/poster/index.js +++ b/sheep/components/s-share-modal/canvas-poster/poster/index.js @@ -1,7 +1,7 @@ import user from './user'; import goods from './goods'; import groupon from './groupon'; -import third from '@/sheep/api/migration/third'; +import SocialApi from '@/sheep/api/member/social'; export function getPosterData(options) { switch (options.shareInfo.poster.type) { @@ -34,6 +34,6 @@ export function formatImageUrlProtocol(url) { // 获得微信小程序码 (Base64 image) export async function getWxaQrcode(path, query) { - const res = await third.wechat.getWxacode(path, query); + const res = await SocialApi.getWxaQrcode(path, query); return 'data:image/png;base64,' + res.data; } diff --git a/sheep/platform/provider/wechat/miniProgram.js b/sheep/platform/provider/wechat/miniProgram.js index 2d8a9e81..26d42d42 100644 --- a/sheep/platform/provider/wechat/miniProgram.js +++ b/sheep/platform/provider/wechat/miniProgram.js @@ -1,4 +1,3 @@ -import third from '@/sheep/api/migration/third'; import AuthUtil from '@/sheep/api/member/auth'; import SocialApi from '@/sheep/api/member/social'; import UserApi from '@/sheep/api/member/user'; @@ -164,7 +163,7 @@ const checkUpdate = async (silence = true) => { // 获取订阅消息模板 async function getSubscribeTemplate() { - const { code, data } = await third.wechat.getSubscribeTemplateList(); + const { code, data } = await SocialApi.getSubscribeTemplateList(); if (code === 0) { subscribeEventList = data; } From eae8f3c1749addd04be0a3306d6aaa77c6d5bf30 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 1 Aug 2024 13:08:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91SYSTEM=EF=BC=9A=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/pay/result.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pages/pay/result.vue b/pages/pay/result.vue index 43a24141..d680a95c 100644 --- a/pages/pay/result.vue +++ b/pages/pay/result.vue @@ -49,9 +49,8 @@ - -