升级弹窗以及交易申请优化

This commit is contained in:
jia 2023-09-20 14:58:51 +08:00
parent 3ae87e293a
commit d1366e2425
6 changed files with 359 additions and 341 deletions

View File

@ -291,6 +291,7 @@
this.getUniMp(data); this.getUniMp(data);
break; break;
case 2: case 2:
this.navigator(data); this.navigator(data);
break; break;
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="gather"> <view class="gather">
<block v-if="isShow"> <block v-if="isShow&&userInfoData.mer_info.mer_name">
<view class="" v-if="userInfoData.mer_info.business_status==2"> <view class="" v-if="userInfoData.mer_info.business_status==2">
<view class="special_work com" v-if="userInfoData.mer_info.type_code === 'TypeSupplyChain'"> <view class="special_work com" v-if="userInfoData.mer_info.type_code === 'TypeSupplyChain'">
<view class="special_work com" v-if="true"> <view class="special_work com" v-if="true">
@ -363,14 +363,7 @@
</view> </view>
</block> </block>
<!-- <m-tabbar native> <view class="" style="padding-top: 1px;" v-else>
<template v-slot:tabbar_index_2>
<view class="custom_style">
<view class="custom_style_icon"></view>
</view>
</template>
</m-tabbar> -->
<view class="" style="padding-top: 1px;" v-if='jurisdiction==false&&isShow==false'>
<emptyPage title="暂无信息"></emptyPage> <emptyPage title="暂无信息"></emptyPage>
</view> </view>

View File

@ -173,7 +173,7 @@
<script> <script>
import { import {
navigateBack,
Toast Toast
} from '@/libs/uniApi.js' } from '@/libs/uniApi.js'
import { import {
@ -396,15 +396,20 @@
merchantUpdateAPI(data).then(res => { merchantUpdateAPI(data).then(res => {
Toast(res.message) Toast(res.message)
setTimeout(() => { setTimeout(() => {
// uni.switchTab({
// url: '/pages/moreProject/moreProject',
// fail: (err) => {
// // console.log('err', err);
// }
// });
// uni.navigateTo({
// url:'/pages/moreProject/moreProject'
// })
uni.redirectTo({
url:'/pages/moreProject/moreProject'
})
uni.switchTab({ }, 1000)
url: '/pages/moreProject/moreProject',
fail: (err) => {
// console.log('err', err);
}
});
}, 2000)
}).catch(err => { }).catch(err => {
Toast(err) Toast(err)
}) })

View File

@ -11,15 +11,14 @@
</view> </view>
<view class="content_title_c" v-else-if="item.status==2"> <view class="content_title_c" v-else-if="item.status==2">
申请拒绝 拒绝
</view> </view>
<view class="content_title_b" v-else-if="item.status==0"> <view class="content_title_b" v-else-if="item.status==0">
审核中 审核中
</view> </view>
<view class="content_title_d"> <view class="content_title_d">
{{item.type_name}} {{item.mer_name}}
</view> </view>
</view> </view>
<view class="" v-if="item.fail_msg" style="margin-top: -50rpx;color: red;"> <view class="" v-if="item.fail_msg" style="margin-top: -50rpx;color: red;">

View File

@ -120,51 +120,38 @@ const actions = {
Appversion({ Appversion({
version: os.appWgtVersion, version: os.appWgtVersion,
type: apptype, type: apptype,
phone_brand: os.brand phone_brand:os.brand
}).then((res) => { }).then((res) => {
if (Object.keys(res.data.appInfo).length > 0) { if (Object.keys(res.data.appInfo).length > 0) {
// if(res.data.appInfo.version) uni.showLoading({
// if(res.data.appInfo.version) uni.showLoading({
// title: '检查更新中' // title: '检查更新中'
// }) // })
// 版本更新
if (res.data.appInfo.phone_brand.length > 0) { if (compareVersions(res.data.appInfo.version, os.appWgtVersion || wgt_v) == 1 &&
if (plus.os.name == "Android") { compareVersions(res.data.appInfo.version,
// 跳转安卓应用市场 wgt_v) == 1) {
let appurl = res.data.appInfo.dow_url //这个是通用应用市场如果想指定某个应用商店需要单独查这个应用商店的包名或scheme及参数 try {
plus.runtime.openURL(appurl) let info = res.data.appInfo || {};
} else { let version = {
// 跳转AppStore title: info.title || '发现新版本',
plus.runtime.launchApplication({ content: info.content || '修复了部分BUG',
action: res.data.appInfo.dow_url, versionName: info.version || '1.0.1',
})
} brand:res.data.appInfo.phone_brand,
} else { downUrl: info.dow_url || '',
force: info.force == 1 ? true : false, // 是否强制更新
// 版本更新 quiet: info.quiet == 1 ? true : false // 是否静默更新
if (compareVersions(res.data.appInfo.version, os.appWgtVersion || wgt_v) == 1 &&
compareVersions(res.data.appInfo.version,
wgt_v) == 1) {
try {
let info = res.data.appInfo || {};
let version = {
title: info.title || '发现新版本',
content: info.content || '修复了部分BUG',
versionName: info.version || '1.0.1',
downUrl: info.dow_url || '',
force: info.force == 1 ? true : false, // 是否强制更新
quiet: info.quiet == 1 ? true : false // 是否静默更新
}
Updater.update(version);
} catch (e) {
console.log(e);
} }
// uni.hideLoading();
Updater.update(version,res.data.appInfo);
} catch (e) {
console.log(e);
} }
// uni.hideLoading();
} }
} }
}).catch((err) => { }).catch((err) => {
// console.log(err) // console.log(err)

View File

@ -1,315 +1,348 @@
<template> <template>
<view class="container"> <view class="container">
<view class="main" @click.stop=""> <view class="main" @click.stop="">
<view class="header"> <view class="header">
<image src="../assets/bg1.png" class="bg1" /> <image src="../assets/bg1.png" class="bg1" />
<image src="../assets/bg2.png" class="bg2" /> <image src="../assets/bg2.png" class="bg2" />
<view class="version-title">{{ updateParams.title }}</view> <view class="version-title">{{ updateParams.title }}</view>
<view class="version-name" v-if="updateParams.versionName">V{{ updateParams.versionName }}</view> <view class="version-name" v-if="updateParams.versionName">V{{ updateParams.versionName }}</view>
</view> </view>
<view class="title">更新内容</view> <view class="title">更新内容</view>
<view class="content" > <view class="content">
<rich-text :nodes="content" /> <rich-text :nodes="content" />
</view> </view>
<view class="progress" v-if="downloading"> <view class="progress" v-if="downloading">
<view class="slider"> <view class="slider">
<view class="active-slider" :style="{ width: `${progress}%` }"> <view class="active-slider" :style="{ width: `${progress}%` }">
<view class="bar" /> <view class="bar" />
<view class="dot"> <view class="dot">
<view class="text">{{ progress }}%</view> <view class="text">{{ progress }}%</view>
<view class="circle" /> <view class="circle" />
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="button" :class="{'active': !downloading || downloadError}" @click="handleButton"> <view class="button" :class="{'active': !downloading || downloadError}" @click="handleButton">
{{ downloadText }} {{ downloadText }}
</view> </view>
</view> </view>
<view class="bottom" v-if="!updateParams.force" @click="back"> <view class="bottom" v-if="!updateParams.force" @click="back">
<view class="line"/> <view class="line" />
<image src="../assets/close.png" class="close" /> <image src="../assets/close.png" class="close" />
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { download, install } from "../updater"; import {
download,
install
} from "../updater";
export default { export default {
data() { data() {
const data = { const data = {
updateParams: {}, updateParams: {},
progress: 0, progress: 0,
downloading: false, downloading: false,
downloadSucc: false, downloadSucc: false,
downloadError: false, downloadError: false,
}; };
return data; return data;
}, },
computed: { computed: {
content() { content() {
return (this.updateParams.content || '').replace(/[\r\n]/gim, '<br/>'); return (this.updateParams.content || '').replace(/[\r\n]/gim, '<br/>');
}, },
downloadText () { downloadText() {
if (this.downloadSucc) { if (this.downloadSucc) {
return this.updateParams.downSucTip; return this.updateParams.downSucTip;
} }
if (this.downloadError) { if (this.downloadError) {
return this.updateParams.downErrorTip; return this.updateParams.downErrorTip;
} }
if (this.downloading) { if (this.downloading) {
return this.updateParams.downMsgTip; return this.updateParams.downMsgTip;
} }
return this.updateParams.updateBtnText; return this.updateParams.updateBtnText;
}, },
}, },
onLoad(params) { onLoad(params) {
const data = {
title: '发现新版本',
updateBtnText: '立即升级',
downMsgTip: '下载中,请稍后',
downSucTip: '下载完成,安装中',
downErrorTip: '下载失败,请重试',
quiet: false,
force: false,
...(JSON.parse(decodeURIComponent(params.data)))
};
this.updateParams = data;
},
onBackPress() {
return this.updateParams.force;
},
methods: {
back() {
if (!this.updateParams.force) {
uni.navigateBack();
}
},
//
start() {
if (!this.updateParams.downUrl) {
return;
}
// ios appstore.apk.wgt const data = {
const isResource = ['.apk', '.wgt'].some(ext => this.updateParams.downUrl.toLocaleLowerCase().includes(ext)); title: '发现新版本',
if (plus.os.name !== "Android" || !isResource) { updateBtnText: '立即升级',
plus.runtime.openURL(this.updateParams.downUrl); downMsgTip: '下载中,请稍后',
return; downSucTip: '下载完成,安装中',
} downErrorTip: '下载失败,请重试',
quiet: false,
force: false,
...(JSON.parse(decodeURIComponent(params.data)))
};
this.updateParams = data;
},
onBackPress() {
return this.updateParams.force;
},
methods: {
this.downloading = true; back() {
const self = this; if (!this.updateParams.force) {
uni.navigateBack();
}
},
//
start() {
if (!this.updateParams.downUrl) {
return;
}
download({ // ios appstore.apk.wgt
url: self.updateParams.downUrl, const isResource = ['.apk', '.wgt'].some(ext => this.updateParams.downUrl.toLocaleLowerCase().includes(
onProgress(progress) { ext));
self.progress = progress; if (plus.os.name !== "Android" || !isResource) {
}, plus.runtime.openURL(this.updateParams.downUrl);
onSuccess(filePath) { return;
self.downloadSucc = true; }
self.downloadError = false;
install(filePath, true); this.downloading = true;
}, const self = this;
onFail() {
self.downloading = false; download({
self.downloadSucc = false; url: self.updateParams.downUrl,
self.downloadError = true; onProgress(progress) {
}, self.progress = progress;
}); },
}, onSuccess(filePath) {
handleButton() { self.downloadSucc = true;
if (!this.downloading) { self.downloadError = false;
return this.start(); install(filePath, true);
} },
if (this.downloadError) { onFail() {
this.progress = 0; self.downloading = false;
this.downloading = false; self.downloadSucc = false;
this.downloadSucc = false; self.downloadError = true;
this.downloadError = true; },
return this.start(); });
} },
}, handleButton() {
},
}; if (this.updateParams.brand.length > 0) {
if (plus.os.name == "Android") {
//
let appurl = this.updateParams.downUrl //scheme
plus.runtime.openURL(appurl)
setTimeout((res) => {
this.back()
}, 1000)
} else {
// AppStore
plus.runtime.launchApplication({
action: this.updateParams.downUrl,
})
setTimeout((res) => {
this.back()
}, 1000)
}
} else {
if (!this.downloading) {
return this.start();
}
if (this.downloadError) {
this.progress = 0;
this.downloading = false;
this.downloadSucc = false;
this.downloadError = true;
return this.start();
}
}
},
},
};
</script> </script>
<style lang="less"> <style lang="less">
page { page {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background: transparent; background: transparent;
} }
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0.3);
} }
.main { .main {
width: 75%; width: 75%;
background-color: #fff; background-color: #fff;
border-radius: 8rpx; border-radius: 8rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.header { .header {
position: relative; position: relative;
.bg1 { .bg1 {
width: 100%; width: 100%;
height: calc(100vw * 0.375); height: calc(100vw * 0.375);
border-top-left-radius: 8rpx; border-top-left-radius: 8rpx;
border-top-right-radius: 8rpx; border-top-right-radius: 8rpx;
} }
.bg2 { .bg2 {
position: absolute; position: absolute;
top: -40%; top: -40%;
right: 13%; right: 13%;
width: 35.9%; width: 35.9%;
height: calc(100vw * 0.5441); height: calc(100vw * 0.5441);
} }
.version-title { .version-title {
position: absolute; position: absolute;
top: 13%; top: 13%;
left: 8%; left: 8%;
color: #961c00; color: #961c00;
font-size: 40rpx; font-size: 40rpx;
} }
.version-name { .version-name {
position: absolute; position: absolute;
top: 36%; top: 36%;
left: 24%; left: 24%;
background-color: #e54139; background-color: #e54139;
color: #fff; color: #fff;
font-size: 26rpx; font-size: 26rpx;
line-height: 26rpx; line-height: 26rpx;
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
border-radius: 20rpx; border-radius: 20rpx;
} }
} }
.title { .title {
background-color: #ff6d42; background-color: #ff6d42;
color: #fff; color: #fff;
display: inline-block; display: inline-block;
margin-top: 12rpx; margin-top: 12rpx;
margin-left: 30rpx; margin-left: 30rpx;
font-size: 26rpx; font-size: 26rpx;
line-height: 26rpx; line-height: 26rpx;
padding: 8rpx 20rpx; padding: 8rpx 20rpx;
border-radius: 8rpx; border-radius: 8rpx;
} }
.content { .content {
margin-top: 12rpx; margin-top: 12rpx;
margin-left: 30rpx; margin-left: 30rpx;
font-size: 28rpx; font-size: 28rpx;
line-height: 2; line-height: 2;
max-height: 240rpx; max-height: 240rpx;
overflow-y: auto; overflow-y: auto;
} }
.button { .button {
margin: 20rpx 30rpx; margin: 20rpx 30rpx;
background-color: #ffaa00; background-color: #ffaa00;
color: #fff; color: #fff;
font-size: 30rpx; font-size: 30rpx;
text-align: center; text-align: center;
padding: 20rpx 0; padding: 20rpx 0;
border-radius: 14rpx; border-radius: 14rpx;
opacity: 0.5; opacity: 0.5;
pointer-events: none; pointer-events: none;
&:active { &:active {
opacity: 0.6; opacity: 0.6;
} }
&.active {
opacity: 1;
pointer-events: initial;
}
}
.progress { &.active {
padding: 50rpx 50rpx 18rpx; opacity: 1;
pointer-events: initial;
}
}
.slider { .progress {
position: relative; padding: 50rpx 50rpx 18rpx;
width: 100%;
height: 10rpx;
border-radius: 5rpx;
background-color: #e2e2e2;
.active-slider { .slider {
display: flex; position: relative;
flex-direction: row; width: 100%;
align-items: center; height: 10rpx;
position: absolute; border-radius: 5rpx;
left: 0; background-color: #e2e2e2;
top: 0;
width: 0%;
height: 10rpx;
border-radius: 5rpx;
.bar { .active-slider {
flex: 1; display: flex;
height: 100%; flex-direction: row;
background-color: #e84116; align-items: center;
border-top-left-radius: 5rpx; position: absolute;
border-bottom-left-radius: 5rpx; left: 0;
} top: 0;
width: 0%;
height: 10rpx;
border-radius: 5rpx;
.dot { .bar {
position: relative; flex: 1;
margin-left: -12rpx; height: 100%;
background-color: #e84116;
border-top-left-radius: 5rpx;
border-bottom-left-radius: 5rpx;
}
.text { .dot {
position: absolute; position: relative;
top: -34rpx; margin-left: -12rpx;
left: -50%;
color: #e84116;
font-size: 24rpx;
font-weight: 500;
}
.circle { .text {
width: 12rpx; position: absolute;
height: 12rpx; top: -34rpx;
border: 6rpx solid #e84116; left: -50%;
border-radius: 50%; color: #e84116;
background-color: #fff; font-size: 24rpx;
} font-weight: 500;
} }
}
}
}
.bottom { .circle {
display: flex; width: 12rpx;
flex-direction: column; height: 12rpx;
align-items: center; border: 6rpx solid #e84116;
.line { border-radius: 50%;
width: 3rpx; background-color: #fff;
height: 50rpx; }
background-color: #fff; }
} }
.close { }
width: 64rpx; }
height: 64rpx;
margin-top: -4rpx; .bottom {
} display: flex;
} flex-direction: column;
</style> align-items: center;
.line {
width: 3rpx;
height: 50rpx;
background-color: #fff;
}
.close {
width: 64rpx;
height: 64rpx;
margin-top: -4rpx;
}
}
</style>