sync:订单结果页添加支付询问对话框,版本获取方法修改,更新README 024f311235
parent
9e96df4651
commit
e9ebe236e6
2
.env
2
.env
|
@ -24,7 +24,7 @@ SHOPRO_DEV_PORT=3000
|
||||||
SHOPRO_STATIC_URL=http://test.yudao.iocoder.cn
|
SHOPRO_STATIC_URL=http://test.yudao.iocoder.cn
|
||||||
### SHOPRO_STATIC_URL = https://file.sheepjs.com
|
### SHOPRO_STATIC_URL = https://file.sheepjs.com
|
||||||
|
|
||||||
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
|
# 是否开启直播 1 开启直播 | 0 关闭直播
|
||||||
SHOPRO_MPLIVE_ON=0
|
SHOPRO_MPLIVE_ON=0
|
||||||
|
|
||||||
# 租户ID 默认 1
|
# 租户ID 默认 1
|
||||||
|
|
12
App.vue
12
App.vue
|
@ -3,14 +3,10 @@
|
||||||
import { ShoproInit } from './sheep';
|
import { ShoproInit } from './sheep';
|
||||||
|
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
// 延时隐藏原生导航栏
|
// 隐藏原生导航栏 使用自定义底部导航
|
||||||
setTimeout(() => {
|
uni.hideTabBar({
|
||||||
try {
|
fail: () => {},
|
||||||
uni.hideNavigationBar();
|
});
|
||||||
} catch (error) {
|
|
||||||
// 忽略该 error,不一定存在
|
|
||||||
}
|
|
||||||
}, 200);
|
|
||||||
|
|
||||||
// 加载Shopro底层依赖
|
// 加载Shopro底层依赖
|
||||||
ShoproInit();
|
ShoproInit();
|
||||||
|
|
|
@ -90,9 +90,7 @@
|
||||||
"idfa": true
|
"idfa": true
|
||||||
},
|
},
|
||||||
"sdkConfigs": {
|
"sdkConfigs": {
|
||||||
"speech": {
|
"speech": {},
|
||||||
"ifly": {}
|
|
||||||
},
|
|
||||||
"ad": {},
|
"ad": {},
|
||||||
"oauth": {
|
"oauth": {
|
||||||
"apple": {},
|
"apple": {},
|
||||||
|
|
|
@ -1,88 +1,93 @@
|
||||||
<!-- 首页,支持店铺装修 -->
|
<!-- 首页,支持店铺装修 -->
|
||||||
<template>
|
<template>
|
||||||
<view v-if="template">
|
<view v-if="template">
|
||||||
<s-layout title="首页" navbar="custom" tabbar="/pages/index/index" :bgStyle="template.page"
|
<s-layout
|
||||||
:navbarStyle="template.navigationBar" onShareAppMessage>
|
title="首页"
|
||||||
<s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
|
navbar="custom"
|
||||||
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
|
tabbar="/pages/index/index"
|
||||||
</s-block>
|
:bgStyle="template.page"
|
||||||
</s-layout>
|
:navbarStyle="template.navigationBar"
|
||||||
</view>
|
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>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { computed } from 'vue';
|
||||||
computed
|
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
} from 'vue';
|
import sheep from '@/sheep';
|
||||||
import {
|
import $share from '@/sheep/platform/share';
|
||||||
onLoad,
|
// 隐藏原生tabBar
|
||||||
onPageScroll,
|
uni.hideTabBar({
|
||||||
onPullDownRefresh
|
fail: () => {},
|
||||||
} from '@dcloudio/uni-app';
|
});
|
||||||
import sheep from '@/sheep';
|
|
||||||
import $share from '@/sheep/platform/share';
|
|
||||||
// 隐藏原生tabBar
|
|
||||||
uni.hideTabBar();
|
|
||||||
|
|
||||||
const template = computed(() => sheep.$store('app').template?.home);
|
const template = computed(() => sheep.$store('app').template?.home);
|
||||||
// 在此处拦截改变一下首页轮播图 此处先写死后期复活 放到启动函数里
|
// 在此处拦截改变一下首页轮播图 此处先写死后期复活 放到启动函数里
|
||||||
// (async function() {
|
// (async function() {
|
||||||
// console.log('原代码首页定制化数据',template)
|
// console.log('原代码首页定制化数据',template)
|
||||||
// let {
|
// let {
|
||||||
// data
|
// data
|
||||||
// } = await index2Api.decorate();
|
// } = await index2Api.decorate();
|
||||||
// console.log('首页导航配置化过高无法兼容',JSON.parse(data[1].value))
|
// console.log('首页导航配置化过高无法兼容',JSON.parse(data[1].value))
|
||||||
// 改变首页底部数据 但是没有通过数组id获取商品数据接口
|
// 改变首页底部数据 但是没有通过数组id获取商品数据接口
|
||||||
// let {
|
// let {
|
||||||
// data: datas
|
// data: datas
|
||||||
// } = await index2Api.spids();
|
// } = await index2Api.spids();
|
||||||
// template.value.data[9].data.goodsIds = datas.list.map(item => item.id);
|
// 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 => {
|
// template.value.data[0].data.list = JSON.parse(data[0].value).map(item => {
|
||||||
// return {
|
// return {
|
||||||
// src: item.picUrl,
|
// src: item.picUrl,
|
||||||
// url: item.url,
|
// url: item.url,
|
||||||
// title: item.name,
|
// title: item.name,
|
||||||
// type: "image"
|
// 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.templateId) {
|
||||||
// 小程序识别二维码
|
sheep.$store('app').init(options.templateId);
|
||||||
if (options.scene) {
|
}
|
||||||
const sceneParams = decodeURIComponent(options.scene).split('=');
|
|
||||||
console.log("sceneParams=>",sceneParams);
|
|
||||||
options[sceneParams[0]] = sceneParams[1];
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// 预览模板
|
// 解析分享信息
|
||||||
if (options.templateId) {
|
if (options.spm) {
|
||||||
sheep.$store('app').init(options.templateId);
|
$share.decryptSpm(options.spm);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析分享信息
|
// 进入指定页面(完整页面路径)
|
||||||
if (options.spm) {
|
if (options.page) {
|
||||||
$share.decryptSpm(options.spm);
|
sheep.$router.go(decodeURIComponent(options.page));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 进入指定页面(完整页面路径)
|
// 下拉刷新
|
||||||
if (options.page) {
|
onPullDownRefresh(() => {
|
||||||
sheep.$router.go(decodeURIComponent(options.page));
|
sheep.$store('app').init();
|
||||||
}
|
setTimeout(function () {
|
||||||
});
|
uni.stopPullDownRefresh();
|
||||||
|
}, 800);
|
||||||
|
});
|
||||||
|
|
||||||
// 下拉刷新
|
onPageScroll(() => {});
|
||||||
onPullDownRefresh(() => {
|
|
||||||
sheep.$store('app').init();
|
|
||||||
setTimeout(function() {
|
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
}, 800);
|
|
||||||
});
|
|
||||||
|
|
||||||
onPageScroll(() => {});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
|
|
|
@ -8,7 +8,11 @@
|
||||||
:navbarStyle="template.navigationBar"
|
:navbarStyle="template.navigationBar"
|
||||||
onShareAppMessage
|
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-item :type="item.id" :data="item.property" :styles="item.property.style" />
|
||||||
</s-block>
|
</s-block>
|
||||||
</s-layout>
|
</s-layout>
|
||||||
|
@ -20,10 +24,11 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
|
|
||||||
// 隐藏原生tabBar
|
// 隐藏原生tabBar
|
||||||
uni.hideTabBar();
|
uni.hideTabBar({
|
||||||
|
fail: () => {},
|
||||||
|
});
|
||||||
|
|
||||||
const template = computed(() => sheep.$store('app').template.user);
|
const template = computed(() => sheep.$store('app').template.user);
|
||||||
const isLogin = computed(() => sheep.$store('user').isLogin);
|
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
sheep.$store('user').updateUserData();
|
sheep.$store('user').updateUserData();
|
||||||
|
|
|
@ -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) {
|
async function getOrderInfo(id) {
|
||||||
state.counter++;
|
state.counter++;
|
||||||
|
@ -137,15 +155,16 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 2.1 情况三一:未支付,且轮询次数小于三次,则继续轮询
|
// 2.1 情况三一:未支付,且轮询次数小于五次,则继续轮询
|
||||||
if (state.counter < 3 && state.result === 'unpaid') {
|
if (state.counter < 5 && state.result === 'unpaid') {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getOrderInfo(id);
|
getOrderInfo(id);
|
||||||
}, 1500);
|
}, 2000);
|
||||||
}
|
}
|
||||||
// 2.2 情况二:超过三次检测才判断为支付失败
|
// 2.2 情况二:超过五次检测才判断为支付失败
|
||||||
if (state.counter >= 3) {
|
if (state.counter >= 5) {
|
||||||
state.result = 'failed';
|
state.result = 'failed';
|
||||||
|
showRepayModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +222,7 @@
|
||||||
if (options.payState === 'fail') {
|
if (options.payState === 'fail') {
|
||||||
state.result = 'failed';
|
state.result = 'failed';
|
||||||
} else {
|
} else {
|
||||||
// 轮询三次检测订单支付结果
|
// 轮询五次检测订单支付结果
|
||||||
await getOrderInfo(state.id);
|
await getOrderInfo(state.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
import packageInfo from '@/package.json';
|
||||||
|
|
||||||
|
const { version } = packageInfo;
|
||||||
|
|
||||||
// 开发环境配置
|
// 开发环境配置
|
||||||
export let baseUrl;
|
export let baseUrl;
|
||||||
export let version;
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL;
|
baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL;
|
||||||
} else {
|
} else {
|
||||||
baseUrl = import.meta.env.SHOPRO_BASE_URL;
|
baseUrl = import.meta.env.SHOPRO_BASE_URL;
|
||||||
}
|
}
|
||||||
version = import.meta.env.SHOPRO_VERSION;
|
|
||||||
if (typeof baseUrl === 'undefined') {
|
if (typeof baseUrl === 'undefined') {
|
||||||
console.error('请检查.env配置文件是否存在');
|
console.error('请检查.env配置文件是否存在');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<!-- #ifdef APP-PLUS -->
|
<!-- #ifdef APP-PLUS -->
|
||||||
<dom-video
|
<dom-video
|
||||||
ref="domVideo"
|
ref="domVideo"
|
||||||
|
:id="`sVideo${uid}`"
|
||||||
class="radius"
|
class="radius"
|
||||||
:style="[{ height: height + 'rpx' }]"
|
:style="[{ height: height + 'rpx' }]"
|
||||||
object-fit="contain"
|
object-fit="contain"
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
@play="play"
|
@play="play"
|
||||||
@pause="pause"
|
@pause="pause"
|
||||||
@ended="end"
|
@ended="end"
|
||||||
|
:poster="poster"
|
||||||
/>
|
/>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- <view
|
<!-- <view
|
||||||
|
|
Loading…
Reference in New Issue