first
This commit is contained in:
137
pages/userSetUp/accountPwd.vue
Normal file
137
pages/userSetUp/accountPwd.vue
Normal file
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<view class="account-pwd">
|
||||
<uni-forms ref="formRef" label-align="left" :model="vdata.formData" :rules="rules">
|
||||
<uni-forms-item label="原密码" name="originalPwd">
|
||||
<uni-easyinput class='jeepay-easyinput' :inputBorder="false" :type="vdata.isShowOriginalPwd ? 'text' : 'password'" v-model="vdata.formData.originalPwd" :clearable="false" placeholder="请输入登录密码" >
|
||||
<template #suffixIcon> <view class='show-tips' style="color: rgba(88,132,204,1);font-weight: 400;font-size: 32rpx;" @tap="vdata.isShowOriginalPwd = !vdata.isShowOriginalPwd ">{{ vdata.isShowOriginalPwd ? '隐藏' : '显示' }}</view> </template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<view class="forget-pwd" @tap="phone.open({
|
||||
tips: '为了您的账户安全,您需要使用短信验证码重置密码,是否发送验证码到:',
|
||||
phone: vdata.userInfo.telphone,
|
||||
confirmText: '发送短信验证码'
|
||||
})">
|
||||
<text>忘记原密码?去找回 ></text>
|
||||
</view>
|
||||
<uni-forms-item label="新密码" name="newPwd">
|
||||
<uni-easyinput class='jeepay-easyinput' :inputBorder="false" :type="vdata.isShowNewPwd ? 'text' : 'password'" v-model="vdata.formData.newPwd" :clearable="false" placeholder="请输入登录密码" >
|
||||
<template #suffixIcon> <view class='show-tips' style="color: rgba(88,132,204,1);font-weight: 400;font-size: 32rpx;" @tap="vdata.isShowNewPwd = !vdata.isShowNewPwd ">{{ vdata.isShowNewPwd ? '隐藏' : '显示' }}</view> </template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="确认新密码" name="confirmPwd">
|
||||
<uni-easyinput class='jeepay-easyinput' :inputBorder="false" :type="vdata.isShowConfirmPwd ? 'text' : 'password'" v-model="vdata.formData.confirmPwd" :clearable="false" placeholder="请输入登录密码" >
|
||||
<template #suffixIcon> <view class='show-tips' style="color: rgba(88,132,204,1);font-weight: 400;font-size: 32rpx;" @tap="vdata.isShowConfirmPwd = !vdata.isShowConfirmPwd ">{{ vdata.isShowConfirmPwd ? '隐藏' : '显示' }}</view> </template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<button class="confirm flex-center" hover-class="touch-button" @click="modifyPwd">确认修改</button>
|
||||
</view>
|
||||
<CallPhone ref="phone" @callPhone="callPhone" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { $modifyPwd, $getPasswordRules } from "@/http/apiManager.js"
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import formUtil from '@/commons/utils/formUtil.js'
|
||||
import CallPhone from './components/CallPhone.vue'
|
||||
|
||||
const rules = {
|
||||
originalPwd: {
|
||||
rules:[ formUtil.rules.requiredInputShowToast('原密码') ],
|
||||
},
|
||||
newPwd: {
|
||||
rules:[ formUtil.rules.requiredInputShowToast('新密码') ],
|
||||
},
|
||||
confirmPwd: {
|
||||
rules:[ formUtil.rules.requiredInputShowToast('确认新密码') ],
|
||||
}
|
||||
}
|
||||
|
||||
const formRef = ref()
|
||||
const phone = ref()
|
||||
const vdata = reactive({
|
||||
formData: {
|
||||
originalPwd: '',
|
||||
newPwd: '',
|
||||
confirmPwd: ''
|
||||
},
|
||||
userInfo: storageManage.userInfo(),
|
||||
passwordRules: /^$/, //密码规则
|
||||
passwordRulesText: '',//密码规则提示文字
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getPasswordRules()
|
||||
})
|
||||
|
||||
const getPasswordRules = () => {
|
||||
$getPasswordRules().then(({bizData}) => {
|
||||
vdata.passwordRules = new RegExp(bizData.regexpRules)
|
||||
vdata.passwordRulesText = bizData.errTips
|
||||
})
|
||||
}
|
||||
|
||||
const modifyPwd = () => {
|
||||
formUtil.validate(formRef.value).then(() => {
|
||||
let { newPwd, confirmPwd } = vdata.formData;
|
||||
if(!vdata.passwordRules.test(newPwd) || !vdata.passwordRules.test(confirmPwd)) {
|
||||
return infoBox.showToast(vdata.passwordRulesText)
|
||||
}
|
||||
if (newPwd !== confirmPwd) {
|
||||
return infoBox.showToast('两次密码输入不一致')
|
||||
}
|
||||
$modifyPwd(vdata.formData).then(() => {
|
||||
infoBox.showToast('修改成功')
|
||||
storageManage.token() && storageManage.token(null, true)
|
||||
go.to('PAGES_LOGIN', {}, 'redirect')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const callPhone = () => {
|
||||
go.to('PAGES_FORGET_PASSWORD', {isRetrieve: 1 })
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.account-pwd {
|
||||
min-height: 100vh;
|
||||
background-color: $v-color-bgrey;
|
||||
::v-deep.uni-forms-item.is-direction-left {
|
||||
padding: 0 40rpx;
|
||||
.uni-forms-item__label {
|
||||
width: 190rpx !important;
|
||||
font-size: 32rpx !important;
|
||||
font-weight: 400;
|
||||
white-space: nowrap;
|
||||
color: rgba(102,102,102,1);
|
||||
text-indent: 0 !important;
|
||||
|
||||
}
|
||||
.uni-easyinput__placeholder-class {
|
||||
font-size: 32rpx !important;
|
||||
font-weight: 400 !important;
|
||||
}
|
||||
}
|
||||
.forget-pwd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 90rpx;
|
||||
text-indent: 30rpx;
|
||||
color: #2980fd;
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
.confirm {
|
||||
margin: 30rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
color: #fff;
|
||||
background: $jeepay-bg-primary;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
116
pages/userSetUp/accountSetUp.vue
Normal file
116
pages/userSetUp/accountSetUp.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<JeepayCustomNavbar bgDefaultColor="#fff" title="账号设置" backCtrl="back" />
|
||||
<view class="user-photo">
|
||||
<view class="title">用户头像</view>
|
||||
<view class="right" @tap="uploadImg.preview()">
|
||||
<JeepayUploadImg ref="uploadImg" v-model:src="vdata.userInfo.avatarUrl" bizType="applyment" mode="viewbtn" @change="modifyUser" />
|
||||
<!-- <image class="user-img" src="/static/orderImg/ysf.svg" mode="scaleToFill" /> -->
|
||||
<image style="width: 100rpx; height: 120rpx" src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-name-wrapper" @tap="go.to('PAGES_EDIT_FORM', { realname: vdata.userInfo.realname })">
|
||||
<view class="title">用户姓名</view>
|
||||
<view class="right">
|
||||
<view>{{ vdata.userInfo.realname }}</view>
|
||||
<image style="width: 100rpx; height: 120rpx" src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-name-wrapper remover" @tap="phone.open(vdata.callPhone)">
|
||||
<view class="title">注销账号</view>
|
||||
<view class="right">
|
||||
<image style="width: 100rpx; height: 120rpx" src="/static/iconImg/icon-arrow-small.svg" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<CallPhone ref="phone" @callPhone="callPhone" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { $modifyUser, $userInfo } from '@/http/apiManager.js'
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import CallPhone from './components/CallPhone.vue'
|
||||
|
||||
const uploadImg = ref()
|
||||
const phone = ref(null)
|
||||
const vdata = reactive({
|
||||
userInfo: storageManage.userInfo(),
|
||||
siteInfos: storageManage.siteInfos(),
|
||||
callPhone: {
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
vdata.callPhone = {
|
||||
tips: '为了您的账户安全,请联系客服进行账号注销处理,客服电话:',
|
||||
phone: vdata.siteInfos.siteInfo.companyTel,
|
||||
confirmText: '拨打电话'
|
||||
}
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
userInfo()
|
||||
})
|
||||
|
||||
const userInfo = () => {
|
||||
$userInfo().then(({bizData}) => {
|
||||
vdata.userInfo = bizData
|
||||
// 保存用户数据
|
||||
storageManage.userInfo(bizData)
|
||||
})
|
||||
}
|
||||
|
||||
const modifyUser = (ossFileUrl) => {
|
||||
$modifyUser({
|
||||
avatarUrl: ossFileUrl
|
||||
}).then(() => {
|
||||
return infoBox.showToast("保存成功")
|
||||
})
|
||||
}
|
||||
|
||||
const callPhone = () => {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: vdata.siteInfos.companyTel
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
margin-left: 40rpx;
|
||||
color: #666666;
|
||||
}
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.user-photo {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 240rpx;
|
||||
background-color: #fff;
|
||||
font-size: 32rpx;
|
||||
|
||||
.user-img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 26rpx;
|
||||
}
|
||||
}
|
||||
.user-name-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
.remover {
|
||||
margin-top: 30rpx;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
81
pages/userSetUp/components/CallPhone.vue
Normal file
81
pages/userSetUp/components/CallPhone.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<uni-popup ref="popup" type="bottom" mask-background-color="rgba(0,0,0,.5)" :safe-area="false">
|
||||
<view class="tips-wrapper">
|
||||
<view class="tips-text call-phone">
|
||||
{{ vdata.tips }}
|
||||
<view class="phone-number">{{ vdata.phone }}</view>
|
||||
</view>
|
||||
<view class="single-text flex-center" hover-class="u-cell-hover" hover-stay-time="150" style="color: #2980fd" @tap="emits('callPhone')">{{ vdata.confirmText }}</view>
|
||||
<view class="line"></view>
|
||||
<view class="tips-text tips-cancel flex-center" hover-class="u-cell-hover" hover-stay-time="150" @tap="popup.close()"> 取消 </view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
const vdata = reactive({
|
||||
phone: '',
|
||||
tips: '',
|
||||
confirmText: ''
|
||||
})
|
||||
const emits = defineEmits(['callPhone'])
|
||||
|
||||
const selected = ref(undefined)
|
||||
const popup = ref(null)
|
||||
// 打开弹窗 val 选中数据的key
|
||||
const open = (val) => {
|
||||
console.log(val)
|
||||
Object.assign(vdata, val)
|
||||
popup.value.open()
|
||||
}
|
||||
|
||||
const close = () => popup.value.close()
|
||||
defineExpose({ open, close })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tips-wrapper {
|
||||
// overflow: hidden;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
padding-top: 20rpx;
|
||||
padding-bottom: 60rpx;
|
||||
background-color: #fff;
|
||||
.tips-text {
|
||||
text-align: center;
|
||||
min-height: 90rpx;
|
||||
font-size: 30rpx;
|
||||
border-bottom: 1rpx solid rgba(0, 0, 0, 0.07);
|
||||
}
|
||||
.single-text {
|
||||
height: 120rpx;
|
||||
}
|
||||
.line {
|
||||
height: 20rpx;
|
||||
background-color: rgba(0, 0, 0, 0.07);
|
||||
}
|
||||
.tips-cancel {
|
||||
height: 110rpx;
|
||||
color: $J-color-t80;
|
||||
font-size: 33rpx;
|
||||
border: none;
|
||||
}
|
||||
.u-cell-hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
}
|
||||
.call-phone {
|
||||
padding: 0 60rpx;
|
||||
padding-top: 40rpx;
|
||||
font-size: 30rpx;
|
||||
color: #808080;
|
||||
.phone-number {
|
||||
margin-top: 25rpx;
|
||||
margin-bottom: 40rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
66
pages/userSetUp/editForm.vue
Normal file
66
pages/userSetUp/editForm.vue
Normal file
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<view class="edit-wrapper">
|
||||
<view class="edit-input flex-center">
|
||||
<uni-easyinput :inputBorder="false" clearable maxlength="12" v-model="vdata.formData.realname" type="text" :styles="styles" />
|
||||
</view>
|
||||
<view class="confirm-button flex-center" hover-class="touch-button" @tap="updateState">确认修改</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { $modifyUser } from '@/http/apiManager.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
onLoad((options) => {
|
||||
Object.assign(vdata.formData, options)
|
||||
})
|
||||
const styles = reactive({
|
||||
backgroundColor: 'transparent',
|
||||
color: '#000',
|
||||
fontSize: '32rpx',
|
||||
})
|
||||
const vdata = reactive({
|
||||
formData: {}
|
||||
})
|
||||
|
||||
function updateState() {
|
||||
if (!vdata.formData.realname) {
|
||||
return infoBox.showToast("请输入用户姓名")
|
||||
}
|
||||
$modifyUser(vdata.formData).then(() => {
|
||||
infoBox.showToast("保存成功").then(() => {
|
||||
go.back()
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.edit-input {
|
||||
padding: 0 20rpx;
|
||||
margin: 0 35rpx;
|
||||
margin-top: 150rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 32rpx;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.tips {
|
||||
margin-top: 30rpx;
|
||||
text-align: center;
|
||||
font-size: 27rpx;
|
||||
color: #808080;
|
||||
}
|
||||
.confirm-button {
|
||||
margin: 0 auto;
|
||||
margin-top: 90rpx;
|
||||
width: 400rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 33rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
background: $jeepay-bg-primary;
|
||||
}
|
||||
</style>
|
||||
160
pages/userSetUp/payPassword.vue
Normal file
160
pages/userSetUp/payPassword.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<view class="pay-wrapper">
|
||||
<view class="title">{{ vdata.steps[vdata.current].title }}</view>
|
||||
<view class="tips">{{ vdata.steps[vdata.current].subTitle }}</view>
|
||||
<JPasswordInput focus @inputChange="inputChange" ref="input" />
|
||||
<view class="confirm flex-center">
|
||||
<button
|
||||
v-if="vdata.current == 2"
|
||||
class="confirm-button flex-center"
|
||||
hover-class="touch-button"
|
||||
:style="{
|
||||
background: vdata.allowChange && (vdata.steps[vdata.current].pwd.length >= 6) ? 'linear-gradient(270deg, rgba(35,143,252,1) 0%, rgba(26,102,255,1) 100%)' : '',
|
||||
}"
|
||||
@click="confirm"
|
||||
>
|
||||
确认修改
|
||||
</button>
|
||||
</view>
|
||||
<view v-if="vdata.current != 0" class="back" @click="back">
|
||||
<image src="@/static/iconImg/icon-arrow-left.svg" class="arrow"></image>
|
||||
<text style="margin-left: 10rpx">返回上一步</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
import { onLoad, onBackPress } from "@dcloudio/uni-app"
|
||||
import { $isSipw, $isMchSipw, $updateMchSipw } from "@/http/apiManager.js"
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import go from '@/commons/utils/go.js'
|
||||
const input = ref(null) //输入框实例
|
||||
const vdata = reactive({
|
||||
allowChange: false,
|
||||
current: 0,
|
||||
steps: [
|
||||
{
|
||||
title: '验证身份',
|
||||
subTitle: '请输入原支付密码以验证您的身份',
|
||||
pwd: ''
|
||||
},
|
||||
{
|
||||
title: '设置密码',
|
||||
subTitle: '请设置新的支付密码,用于退款验证',
|
||||
pwd: ''
|
||||
},
|
||||
{
|
||||
title: '确认密码',
|
||||
subTitle: '请再次输入支付密码确认',
|
||||
pwd: ''
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
$isSipw().then(({ bizData }) => {
|
||||
!bizData && (vdata.current = 1)
|
||||
})
|
||||
})
|
||||
|
||||
const getInputVerification1 = (originalPwd) => {
|
||||
$isMchSipw(originalPwd).then(({ bizData }) => {
|
||||
if (bizData) {
|
||||
vdata.current = 1
|
||||
clearInput()
|
||||
} else {
|
||||
return infoBox.showToast('密码验证错误')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getInputVerification2 = () => {
|
||||
vdata.current = 2
|
||||
clearInput()
|
||||
}
|
||||
|
||||
const getInputVerification3 = (pwd, confirmPwd) => {
|
||||
if (pwd != confirmPwd) {
|
||||
vdata.allowChange = false
|
||||
return infoBox.showToast('两次输入的密码不一致')
|
||||
} else {
|
||||
vdata.allowChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
const inputChange = (e) => {
|
||||
let currentStep = vdata.steps[vdata.current];
|
||||
currentStep.pwd = e
|
||||
if (vdata.current === 0 && currentStep.pwd.length == 6) {
|
||||
getInputVerification1(currentStep.pwd)
|
||||
}
|
||||
if (vdata.current === 1 && currentStep.pwd.length == 6) {
|
||||
getInputVerification2(currentStep.pwd)
|
||||
}
|
||||
if (vdata.current === 2 && currentStep.pwd.length == 6) {
|
||||
getInputVerification3(vdata.steps[1].pwd, currentStep.pwd)
|
||||
}
|
||||
}
|
||||
|
||||
const confirm = () => {
|
||||
if (vdata.allowChange) {
|
||||
let steps = vdata.steps;
|
||||
$updateMchSipw({
|
||||
originalPwd: steps[0].pwd,
|
||||
confirmPwd: steps[2].pwd
|
||||
}).then(() => {
|
||||
infoBox.showSuccessToast('修改成功')
|
||||
return go.back()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const back = () => {
|
||||
vdata.current = vdata.current - 1
|
||||
}
|
||||
|
||||
// 清空输入框事件
|
||||
const clearInput = () => input.value.clearInput()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
margin-top: 200rpx;
|
||||
text-align: center;
|
||||
font-size: 50rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.tips {
|
||||
margin: 30rpx 0 90rpx 0;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
color: $J-color-t80;
|
||||
}
|
||||
.back {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #808080;
|
||||
font-size: 30rpx;
|
||||
margin-top: 53rpx;
|
||||
.arrow {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
}
|
||||
.confirm {
|
||||
margin-top: 90rpx;
|
||||
height: 110rpx;
|
||||
.confirm-button {
|
||||
width: 400rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 33rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
12
pages/userSetUp/safeSetUp.vue
Normal file
12
pages/userSetUp/safeSetUp.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<JCell title="账号密码" :mT="20" @tap="jumpPage('accountPwd')" />
|
||||
<JCell title="支付密码" @tap="jumpPage('payPassword')" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const jumpPage = (url) => uni.navigateTo({ url: `/pages/userSetUp/${url}` })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
95
pages/userSetUp/systemSetUp.vue
Normal file
95
pages/userSetUp/systemSetUp.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<JCell v-for="(item, index) in vdata.defaultConfig" :key="item.configKey" :title="item.configName" color="#4D4D4D" borderWidth="40rpx" :isTouch="false">
|
||||
<template #right>
|
||||
<JSwitch
|
||||
:bol="item.configVal === '1' ? true : false"
|
||||
:tips="item.tips || `是否${item.configVal === '1' ? '关闭' : '开启'}${item.configName}`"
|
||||
margin="0 35rpx 0 0"
|
||||
@confirm="confirm($event, item)"
|
||||
/>
|
||||
</template>
|
||||
</JCell>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, computed } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { $mchConfig, $orderConfig } from '@/http/apiManager.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
// #ifdef MP-WEIXIN
|
||||
// 控制 音乐播放 和暂停
|
||||
import { startOrEndMusice } from '@/commons/utils/pushmsg/wxTextToSpeach.js';
|
||||
// #endif
|
||||
onLoad((options) => {
|
||||
mchConfig();
|
||||
});
|
||||
const vdata = reactive({
|
||||
defaultConfig: [
|
||||
{
|
||||
configKey: 'appVoice',
|
||||
configName: 'app订单语音播报',
|
||||
configVal: '0',
|
||||
type: 'radio'
|
||||
},
|
||||
{
|
||||
configKey: 'qrcEscaping',
|
||||
configName: '码牌防逃单功能',
|
||||
configVal: '0',
|
||||
type: 'radio'
|
||||
},
|
||||
{
|
||||
configKey: 'weChatVoice',
|
||||
configName: '小程序语音推送',
|
||||
configVal: '0',
|
||||
type: 'radio'
|
||||
}
|
||||
] // 默认配置项
|
||||
});
|
||||
// 计算属性 用于计算 开关状态 提供不同提示语
|
||||
const pushTips = computed(() => {
|
||||
return vdata.isPush ? '是否确认关闭小程序语音推送?' : '注意“小程序语音推送功能会占用音乐播放器请勿关闭播放器, 请开启小程序浮窗以保证小程序正常播放订单消息”。';
|
||||
});
|
||||
const mchConfig = () => {
|
||||
$mchConfig('orderConfig').then(({ bizData = [] }) => {
|
||||
Object.assign(vdata.defaultConfig, bizData);
|
||||
// 如果是app 则删除 微信推送开关
|
||||
// #ifdef APP-PLUS
|
||||
const index = vdata.defaultConfig.findIndex((v) => v.configKey == 'weChatVoice');
|
||||
spliceIndex(index);
|
||||
// #endif
|
||||
// 如果是微信则删除 app 推送开关
|
||||
// #ifdef MP-WEIXIN
|
||||
const index = vdata.defaultConfig.findIndex((v) => v.configKey == 'appVoice');
|
||||
const weChat = vdata.defaultConfig.find((v) => v.configKey == 'weChatVoice'); //获取 小程序数据实例
|
||||
calcTips(weChat);
|
||||
spliceIndex(index);
|
||||
// #endif
|
||||
});
|
||||
};
|
||||
const confirm = (e, item) => {
|
||||
item.configVal = e ? 1 : 0;
|
||||
$orderConfig(JSON.stringify(vdata.defaultConfig), vdata.defaultConfig[0].mchNo).then(() => {
|
||||
if (item.configKey == 'weChatVoice') calcTips(item);
|
||||
infoBox.showToast('设置成功');
|
||||
// #ifdef MP-WEIXIN
|
||||
if (item.configKey == 'weChatVoice') {
|
||||
// 添加语音播报的消息推送
|
||||
startOrEndMusice(item.configVal);
|
||||
}
|
||||
// #endif
|
||||
});
|
||||
};
|
||||
function spliceIndex(i) {
|
||||
if (i != '-1') vdata.defaultConfig.splice(i, 1);
|
||||
}
|
||||
// 用于计算 合适的提示用语
|
||||
function calcTips(v) {
|
||||
if (v != '-1')
|
||||
v.tips = v.configVal == 1 ? '是否确认关闭小程序语音推送?' : '注意“小程序语音推送功能会占用音乐播放器请勿关闭播放器, 请开启小程序浮窗以保证小程序正常播放订单消息”。';
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
48
pages/userSetUp/userSetup.vue
Normal file
48
pages/userSetUp/userSetup.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<view class="page-wrapper">
|
||||
<JCell title="安全设置" :mT="20" @tap="jumpPage('safeSetUp')" />
|
||||
<JCell title="账号设置" :mT="20" @tap="jumpPage('accountSetUp')" />
|
||||
<JCell v-if="ak.ent.has('ENT_MCH_CONFIG_EDIT')" title="系统设置" @tap="jumpPage('systemSetUp')" />
|
||||
<button hover-class="touch-hover" class="login-out flex-center" @tap="logout">退出登录</button>
|
||||
</view>
|
||||
|
||||
<!-- 通用提示 -->
|
||||
<JeepayPopupConfirm ref="jeepayPopupConfirm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import ak from '@/commons/utils/ak.js'
|
||||
// #ifdef MP-WEIXIN
|
||||
// 控制 音乐播放 和暂停
|
||||
import { startOrEndMusice } from "@/commons/utils/pushmsg/wxTextToSpeach.js"
|
||||
// #endif
|
||||
const jeepayPopupConfirm = ref()
|
||||
|
||||
function logout() {
|
||||
|
||||
jeepayPopupConfirm.value.open('确认退出?').then(() => {
|
||||
storageManage.cleanByLogout()
|
||||
// #ifdef MP-WEIXIN
|
||||
startOrEndMusice(false)
|
||||
// #endif
|
||||
go.to('PAGES_LOGIN', {}, go.GO_TYPE_RELAUNCH)
|
||||
})
|
||||
}
|
||||
|
||||
const jumpPage = (url) => uni.navigateTo({ url: `/pages/userSetUp/${url}` })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.login-out {
|
||||
margin-top: 20rpx;
|
||||
height: 120rpx;
|
||||
background-color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 400;
|
||||
color: #ff5b4c;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user