Merge remote-tracking branch 'refs/remotes/yudao/master'

# Conflicts:
#	pages/order/confirm.vue
pull/68/head
puhui999 2024-08-06 18:16:10 +08:00
commit aaad12c50e
11 changed files with 46 additions and 52 deletions

View File

@ -184,7 +184,7 @@
"versionCode": 100 "versionCode": 100
}, },
"mp-weixin": { "mp-weixin": {
"appid": "wx63c280fe3248a3e7", "appid": "wx66186af0759f47c9",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"minified": true, "minified": true,
@ -236,4 +236,4 @@
"_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639",
"locale": "zh-Hans", "locale": "zh-Hans",
"fallbackLocale": "zh-Hans" "fallbackLocale": "zh-Hans"
} }

View File

@ -2,7 +2,7 @@
"id": "shopro", "id": "shopro",
"name": "shopro", "name": "shopro",
"displayName": "芋道商城", "displayName": "芋道商城",
"version": "2.1.0", "version": "2.2.0",
"description": "芋道商城一套代码同时发行到iOS、Android、H5、微信小程序多个平台请使用手机扫码快速体验强大功能", "description": "芋道商城一套代码同时发行到iOS、Android、H5、微信小程序多个平台请使用手机扫码快速体验强大功能",
"scripts": { "scripts": {
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"" "prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""

View File

@ -130,7 +130,7 @@
import TradeConfigApi from '@/sheep/api/trade/config'; import TradeConfigApi from '@/sheep/api/trade/config';
import { fen2yuan } from '@/sheep/hooks/useGoods'; import { fen2yuan } from '@/sheep/hooks/useGoods';
import AfterSaleApi from '@/sheep/api/trade/afterSale'; import AfterSaleApi from '@/sheep/api/trade/afterSale';
import { SubscribeTemplate } from '@/sheep/util/const'; import { WxaSubscribeTemplate } from '@/sheep/util/const';
const form = ref(null); const form = ref(null);
const state = reactive({ const state = reactive({

View File

@ -47,7 +47,7 @@
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { fen2yuan } from '@/sheep/hooks/useGoods'; import { fen2yuan } from '@/sheep/hooks/useGoods';
import PayWalletApi from '@/sheep/api/pay/wallet'; 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 userWallet = computed(() => sheep.$store('user').userWallet);
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2; const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
@ -82,7 +82,7 @@
return; return;
} }
// #ifdef MP // #ifdef MP
sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.WALLET_RECHARGER_PAID); sheep.$platform.useProvider('wechat').subscribeMessage(WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS);
// #endif // #endif
sheep.$router.go('/pages/pay/index', { sheep.$router.go('/pages/pay/index', {
id: data.payOrderId, id: data.payOrderId,

View File

@ -49,9 +49,8 @@
</button> </button>
</view> </view>
<!-- TODO 芋艿订阅 -->
<!-- #ifdef MP --> <!-- #ifdef MP -->
<view class="subscribe-box ss-flex ss-m-t-44" v-if="showSubscribeBtn"> <view class="subscribe-box ss-flex ss-m-t-44" v-if="showSubscribeBtn && state.orderType === 'goods'">
<image class="subscribe-img" :src="sheep.$url.static('/static/img/shop/order/cargo.png')" /> <image class="subscribe-img" :src="sheep.$url.static('/static/img/shop/order/cargo.png')" />
<view class="subscribe-title ss-m-r-48 ss-m-l-16">获取实时发货信息与订单状态</view> <view class="subscribe-title ss-m-r-48 ss-m-l-16">获取实时发货信息与订单状态</view>
<view class="subscribe-start" @tap="subscribeMessage"></view> <view class="subscribe-start" @tap="subscribeMessage"></view>
@ -69,7 +68,7 @@
import PayOrderApi from '@/sheep/api/pay/order'; import PayOrderApi from '@/sheep/api/pay/order';
import { fen2yuan } from '@/sheep/hooks/useGoods'; import { fen2yuan } from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order'; import OrderApi from '@/sheep/api/trade/order';
import { SubscribeTemplate } from '@/sheep/util/const'; import { WxaSubscribeTemplate } from '@/sheep/util/const';
const state = reactive({ const state = reactive({
id: 0, // id: 0, //
@ -146,7 +145,6 @@
} }
function onOrder() { function onOrder() {
// TODO
if (state.orderType === 'recharge') { if (state.orderType === 'recharge') {
sheep.$router.redirect('/pages/pay/recharge-log'); sheep.$router.redirect('/pages/pay/recharge-log');
} else { } else {
@ -154,14 +152,16 @@
} }
} }
// TODO
// #ifdef MP // #ifdef MP
const showSubscribeBtn = ref(false) // const showSubscribeBtn = ref(false) //
const SUBSCRIBE_BTN_STATUS_STORAGE_KEY = "subscribe_btn_status" const SUBSCRIBE_BTN_STATUS_STORAGE_KEY = "subscribe_btn_status"
function subscribeMessage() { function subscribeMessage() {
let event = [SubscribeTemplate.DELIVERY_ORDER]; if (state.orderType !== 'goods') {
return;
}
const event = [WxaSubscribeTemplate.TRADE_ORDER_DELIVERY];
if (state.tradeOrder.type === 3) { if (state.tradeOrder.type === 3) {
event.push(SubscribeTemplate.COMBINATION_RESULT); event.push(WxaSubscribeTemplate.PROMOTION_COMBINATION_SUCCESS);
} }
sheep.$platform.useProvider('wechat').subscribeMessage(event, () => { sheep.$platform.useProvider('wechat').subscribeMessage(event, () => {
// //

View File

@ -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; export default SocialApi;

View File

@ -1,34 +1,6 @@
import request from '@/sheep/request'; import request from '@/sheep/request';
export default { 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: { apple: {
// 第三方登录 // 第三方登录

View File

@ -1,7 +1,7 @@
import user from './user'; import user from './user';
import goods from './goods'; import goods from './goods';
import groupon from './groupon'; import groupon from './groupon';
import third from '@/sheep/api/migration/third'; import SocialApi from '@/sheep/api/member/social';
export function getPosterData(options) { export function getPosterData(options) {
switch (options.shareInfo.poster.type) { switch (options.shareInfo.poster.type) {
@ -34,6 +34,6 @@ export function formatImageUrlProtocol(url) {
// 获得微信小程序码 Base64 image // 获得微信小程序码 Base64 image
export async function getWxaQrcode(path, query) { 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; return 'data:image/png;base64,' + res.data;
} }

View File

@ -1,4 +1,3 @@
import third from '@/sheep/api/migration/third';
import AuthUtil from '@/sheep/api/member/auth'; import AuthUtil from '@/sheep/api/member/auth';
import SocialApi from '@/sheep/api/member/social'; import SocialApi from '@/sheep/api/member/social';
import UserApi from '@/sheep/api/member/user'; import UserApi from '@/sheep/api/member/user';
@ -164,7 +163,7 @@ const checkUpdate = async (silence = true) => {
// 获取订阅消息模板 // 获取订阅消息模板
async function getSubscribeTemplate() { async function getSubscribeTemplate() {
const { code, data } = await third.wechat.getSubscribeTemplateList(); const { code, data } = await SocialApi.getSubscribeTemplateList();
if (code === 0) { if (code === 0) {
subscribeEventList = data; subscribeEventList = data;
} }

View File

@ -62,7 +62,7 @@ const app = defineStore({
this.info = { this.info = {
name: '芋道商城', name: '芋道商城',
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png', logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
version: '1.1.13', version: '2.2.0',
copyright: '全部开源,个人与企业可 100% 免费使用', copyright: '全部开源,个人与企业可 100% 免费使用',
copytime: 'Copyright© 2018-2024', copytime: 'Copyright© 2018-2024',

View File

@ -56,14 +56,15 @@ export const TimeStatusEnum = {
END: '已结束', END: '已结束',
} }
// TODO 订阅模版枚举 /**
export const SubscribeTemplate = { * 微信小程序的订阅模版
WALLET_RECHARGER_PAID: "充值成功通知", */
DELIVERY_ORDER: "订单发货通知", export const WxaSubscribeTemplate = {
COMBINATION_RESULT: "拼团结果通知" TRADE_ORDER_DELIVERY: "订单发货通知",
PROMOTION_COMBINATION_SUCCESS: "拼团结果通知",
PAY_WALLET_RECHARGER_SUCCESS: "充值成功通知",
} }
export const getTimeStatusEnum = (startTime, endTime) => { export const getTimeStatusEnum = (startTime, endTime) => {
const now = dayjs(); const now = dayjs();
if (now.isBefore(startTime)) { if (now.isBefore(startTime)) {