sync:订单结果页添加支付询问对话框,版本获取方法修改,更新README 024f311235

pull/132/MERGE
YunaiV 2025-04-28 00:01:33 +08:00
parent 9e96df4651
commit e9ebe236e6
8 changed files with 123 additions and 96 deletions

2
.env
View File

@ -24,7 +24,7 @@ SHOPRO_DEV_PORT=3000
SHOPRO_STATIC_URL=http://test.yudao.iocoder.cn
### SHOPRO_STATIC_URL = https://file.sheepjs.com
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
# 是否开启直播 1 开启直播 | 0 关闭直播
SHOPRO_MPLIVE_ON=0
# 租户ID 默认 1

12
App.vue
View File

@ -3,14 +3,10 @@
import { ShoproInit } from './sheep';
onLaunch(() => {
//
setTimeout(() => {
try {
uni.hideNavigationBar();
} catch (error) {
// error
}
}, 200);
// 使
uni.hideTabBar({
fail: () => {},
});
// Shopro
ShoproInit();

View File

@ -90,9 +90,7 @@
"idfa": true
},
"sdkConfigs": {
"speech": {
"ifly": {}
},
"speech": {},
"ad": {},
"oauth": {
"apple": {},

View File

@ -1,88 +1,93 @@
<!-- 首页支持店铺装修 -->
<template>
<view v-if="template">
<s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
:navbarStyle="template.navigationBar" onShareAppMessage>
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
</s-layout>
</view>
<view v-if="template">
<s-layout
title="首页"
navbar="custom"
tabbar="/pages/index/index"
:bgStyle="template.page"
:navbarStyle="template.navigationBar"
onShareAppMessage
>
<s-block
v-for="(item, index) in template.components"
:key="index"
:styles="item.property.style"
>
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
</s-layout>
</view>
</template>
<script setup>
import {
computed
} from 'vue';
import {
onLoad,
onPageScroll,
onPullDownRefresh
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import $share from '@/sheep/platform/share';
// tabBar
uni.hideTabBar();
import { computed } from 'vue';
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import $share from '@/sheep/platform/share';
// tabBar
uni.hideTabBar({
fail: () => {},
});
const template = computed(() => sheep.$store('app').template?.home);
//
// (async function() {
// console.log('',template)
// let {
// data
// } = await index2Api.decorate();
// console.log('',JSON.parse(data[1].value))
// id
// let {
// data: datas
// } = await index2Api.spids();
// template.value.data[9].data.goodsIds = datas.list.map(item => item.id);
// template.value.data[0].data.list = JSON.parse(data[0].value).map(item => {
// return {
// src: item.picUrl,
// url: item.url,
// title: item.name,
// type: "image"
// }
// })
// }())
const template = computed(() => sheep.$store('app').template?.home);
//
// (async function() {
// console.log('',template)
// let {
// data
// } = await index2Api.decorate();
// console.log('',JSON.parse(data[1].value))
// id
// let {
// data: datas
// } = await index2Api.spids();
// template.value.data[9].data.goodsIds = datas.list.map(item => item.id);
// template.value.data[0].data.list = JSON.parse(data[0].value).map(item => {
// return {
// src: item.picUrl,
// url: item.url,
// title: item.name,
// type: "image"
// }
// })
// }())
onLoad((options) => {
// #ifdef MP
//
if (options.scene) {
const sceneParams = decodeURIComponent(options.scene).split('=');
console.log('sceneParams=>', sceneParams);
options[sceneParams[0]] = sceneParams[1];
}
// #endif
onLoad((options) => {
// #ifdef MP
//
if (options.scene) {
const sceneParams = decodeURIComponent(options.scene).split('=');
console.log("sceneParams=>",sceneParams);
options[sceneParams[0]] = sceneParams[1];
}
// #endif
//
if (options.templateId) {
sheep.$store('app').init(options.templateId);
}
//
if (options.templateId) {
sheep.$store('app').init(options.templateId);
}
//
if (options.spm) {
$share.decryptSpm(options.spm);
}
//
if (options.spm) {
$share.decryptSpm(options.spm);
}
// ()
if (options.page) {
sheep.$router.go(decodeURIComponent(options.page));
}
});
// ()
if (options.page) {
sheep.$router.go(decodeURIComponent(options.page));
}
});
//
onPullDownRefresh(() => {
sheep.$store('app').init();
setTimeout(function () {
uni.stopPullDownRefresh();
}, 800);
});
//
onPullDownRefresh(() => {
sheep.$store('app').init();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 800);
});
onPageScroll(() => {});
onPageScroll(() => {});
</script>
<style></style>

View File

@ -8,7 +8,11 @@
:navbarStyle="template.navigationBar"
onShareAppMessage
>
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
<s-block
v-for="(item, index) in template.components"
:key="index"
:styles="item.property.style"
>
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
</s-layout>
@ -20,10 +24,11 @@
import sheep from '@/sheep';
// tabBar
uni.hideTabBar();
uni.hideTabBar({
fail: () => {},
});
const template = computed(() => sheep.$store('app').template.user);
const isLogin = computed(() => sheep.$store('user').isLogin);
onShow(() => {
sheep.$store('user').updateUserData();

View File

@ -97,6 +97,24 @@
}
});
function showRepayModal() {
if (state.result !== 'failed') return;
uni.showModal({
title: '确认支付',
content: '未检测到您的支付结果,请确认您是否已经支付完成?',
cancelText: '取消',
confirmText: '我已支付',
success: function (res) {
if (res.confirm) {
state.counter = 0;
setTimeout(() => {
getOrderInfo(state.orderId);
}, 100);
}
},
});
}
//
async function getOrderInfo(id) {
state.counter++;
@ -137,15 +155,16 @@
return;
}
}
// 2.1
if (state.counter < 3 && state.result === 'unpaid') {
// 2.1
if (state.counter < 5 && state.result === 'unpaid') {
setTimeout(() => {
getOrderInfo(id);
}, 1500);
}, 2000);
}
// 2.2
if (state.counter >= 3) {
// 2.2
if (state.counter >= 5) {
state.result = 'failed';
showRepayModal();
}
}
@ -203,7 +222,7 @@
if (options.payState === 'fail') {
state.result = 'failed';
} else {
//
//
await getOrderInfo(state.id);
}
});

View File

@ -1,12 +1,14 @@
import packageInfo from '@/package.json';
const { version } = packageInfo;
// 开发环境配置
export let baseUrl;
export let version;
if (process.env.NODE_ENV === 'development') {
baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL;
} else {
baseUrl = import.meta.env.SHOPRO_BASE_URL;
}
version = import.meta.env.SHOPRO_VERSION;
if (typeof baseUrl === 'undefined') {
console.error('请检查.env配置文件是否存在');
} else {

View File

@ -25,6 +25,7 @@
<!-- #ifdef APP-PLUS -->
<dom-video
ref="domVideo"
:id="`sVideo${uid}`"
class="radius"
:style="[{ height: height + 'rpx' }]"
object-fit="contain"
@ -38,6 +39,7 @@
@play="play"
@pause="pause"
@ended="end"
:poster="poster"
/>
<!-- #endif -->
<!-- <view