first
This commit is contained in:
268
pages/index/components/Stats.vue
Normal file
268
pages/index/components/Stats.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<view class="index-header" @tap="go.to('PAGES_STAT')">
|
||||
<view class="index-selected">
|
||||
<view class="index-time">
|
||||
<block v-for="v in timeList" :key="v.value">
|
||||
<view class="time-item flex-center" :class="{ 'time-active': vdata.timeSelected == v.value }" @tap.stop="changeTimeFunc(v.value)">
|
||||
{{ v.title }}
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="index-scan flex-center" @click.stop="scanFunc">
|
||||
<image src="/static/iconImg/icon-scan-index.svg" mode="scaleToFill" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="receipts-money">
|
||||
<text class="money-title">成交金额 (元)</text>
|
||||
<view class="money-num">{{ list.sale.incomeAmountAll}}</view>
|
||||
</view>
|
||||
<view class="money-list">
|
||||
<view class="money-item">
|
||||
<text class="money-title">消费笔数</text>
|
||||
<view class="money-num">{{ list.vip.useNum }}</view>
|
||||
</view>
|
||||
<view class="money-item">
|
||||
<text class="money-title">退款金额 (元)</text>
|
||||
<view class="money-num">{{ list.sale.outAmount}}</view>
|
||||
</view>
|
||||
<view class="money-item">
|
||||
<text class="money-title">消费笔数</text>
|
||||
<view class="money-num">{{ list.count.useNum }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="money-list" v-if="vdata.memberIsShow">
|
||||
<view class="money-item">
|
||||
<text class="money-title">会员充值(元)</text>
|
||||
<view class="money-num">{{ cal.cert2Dollar(memberData.payAmount) }}</view>
|
||||
</view>
|
||||
<view class="money-item">
|
||||
<text class="money-title">会员消费(元)</text>
|
||||
<view class="money-num">{{ cal.cert2Dollar(Math.abs(memberData.changeAmount)) }}</view>
|
||||
</view>
|
||||
|
||||
<view class="money-item">
|
||||
<text class="money-title">会员消费笔数</text>
|
||||
<view class="money-num">{{ memberData.changeCount }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <text class="money-title">展开全部</text> -->
|
||||
</view>
|
||||
<!-- <button v-if="ak.ent.has('ENT_C_QUICKCASHIER')" class="quick-money flex-center" @tap.stop="go.to('PAGES_QUICK_PAY')">快捷收银</button> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import cal from '@/commons/utils/cal.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import ak from '@/commons/utils/ak.js';
|
||||
import ent from '@/commons/utils/ent.js';
|
||||
import unionScan from '@/commons/utils/unionScan.js';
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
import dayjs from 'dayjs' //时间格式库
|
||||
import {
|
||||
summaryTrade,
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
onMounted(() => {
|
||||
vdata.memberIsShow = ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt;
|
||||
if (ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt) {
|
||||
getMemberData();
|
||||
}
|
||||
getList()
|
||||
});
|
||||
const emits = defineEmits(['click']);
|
||||
const timeList = [
|
||||
{ title: '今天', value: 'today' },
|
||||
{ title: '昨天', value: 'yesterday' },
|
||||
{ title: '近7天', value: 'circumference' },
|
||||
{ title: '近30天', value: 'moon' }
|
||||
];
|
||||
let list = ref()
|
||||
const vdata = reactive({
|
||||
timeSelected: 'today', // 当前时间选择器的
|
||||
payAmount: -1, // 实收金额
|
||||
payCount: -1, // 交易笔数
|
||||
refundAmount: -1, // 退款金额
|
||||
refundCount: -1, // 退款笔数
|
||||
memberIsShow: false //是否开启会员模块
|
||||
});
|
||||
const memberData = reactive({});
|
||||
function getList(){
|
||||
let startTime, endTime;
|
||||
if (vdata.timeSelected == 'today') {
|
||||
startTime = dayjs().format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endTime = dayjs().format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (vdata.timeSelected == 'yesterday') {
|
||||
startTime = formatTime() + ' 00:00:00'
|
||||
endTime = formatTime() + ' 23:59:59'
|
||||
} else if (vdata.timeSelected == 'circumference') {
|
||||
startTime = dayjs().add(-7, 'day').format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
||||
} else if (vdata.timeSelected == 'moon') {
|
||||
startTime = dayjs().add(-30, 'day').format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
||||
} else if (vdata.timeSelected == 'custom') {
|
||||
startTime = start
|
||||
endTime = end
|
||||
}
|
||||
summaryTrade({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
startTime,
|
||||
endTime,
|
||||
}).then((res) => {
|
||||
list.value = res
|
||||
})
|
||||
}
|
||||
// 切换 时间卡片
|
||||
function changeTimeFunc(val) {
|
||||
vdata.timeSelected = val;
|
||||
getList()
|
||||
// console.log(vdata.timeSelected,'调试121')
|
||||
// refData();
|
||||
// if (vdata.memberIsShow) {
|
||||
// getMemberData();
|
||||
// }
|
||||
}
|
||||
// 根据选择请求数据
|
||||
function refData() {
|
||||
// 获取 统计数据
|
||||
$indexStatistics(vdata.timeSelected).then(({ bizData }) => {
|
||||
vdata.payAmount = bizData.totalSuccAmt;
|
||||
vdata.payCount = bizData.totalSuccNum;
|
||||
vdata.refundAmount = bizData.totalRefundAmt;
|
||||
vdata.refundCount = bizData.totalRefundNum;
|
||||
});
|
||||
}
|
||||
|
||||
// 扫码动作
|
||||
function scanFunc() {
|
||||
unionScan.scan(true).then((res) => {
|
||||
// 登录类型
|
||||
if (res.type == unionScan.QR_TYPE_LOGIN) {
|
||||
return go.to('PAGES_SCAN_LOGIN', { qrcodeNo: res.originQrVal });
|
||||
}
|
||||
|
||||
// 二维码
|
||||
if (res.type == unionScan.QR_TYPE_QRC) {
|
||||
return go.to('PAGES_APP_CODE_BIND', { qrcId: res.bizValue });
|
||||
}
|
||||
});
|
||||
}
|
||||
// 获取当前时间
|
||||
function getdate() {
|
||||
const dt = new Date();
|
||||
const y = dt.getFullYear();
|
||||
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
|
||||
const d = (dt.getDate() + "").padStart(2, "0");
|
||||
const hh = (dt.getHours() + "").padStart(2, "0");
|
||||
const mm = (dt.getMinutes() + "").padStart(2, "0");
|
||||
const ss = (dt.getSeconds() + "").padStart(2, "0");
|
||||
return `${y}-${m}-${d}`;
|
||||
}
|
||||
// 获取昨天时间
|
||||
const formatTime = () => {
|
||||
let strDate = getdate()
|
||||
let dateFormat = new Date(strDate);
|
||||
dateFormat = dateFormat.setDate(dateFormat.getDate() - 1);
|
||||
dateFormat = new Date(dateFormat);
|
||||
let y = dateFormat.getFullYear()
|
||||
let m = (dateFormat.getMonth() + 1).toString().padStart(2, '0')
|
||||
let d = dateFormat.getDate().toString().padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
const getMemberData = () => {
|
||||
$memberInfoCount({ queryDateRange: vdata.timeSelected }).then(({ bizData }) => {
|
||||
Object.assign(memberData, bizData);
|
||||
});
|
||||
};
|
||||
defineExpose({ refData });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.index-header {
|
||||
width: 680rpx;
|
||||
margin: 0 auto;
|
||||
transform: translateY(30rpx);
|
||||
margin-bottom: 25rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: $J-b-r32;
|
||||
background: $jeepay-bg-primary;
|
||||
backdrop-filter: blur(20rpx);
|
||||
box-shadow: 0 50rpx 70rpx -60rpx rgba(0, 65, 164, 0.5);
|
||||
.index-selected {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.index-time {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 490rpx;
|
||||
height: 90rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 10rpx;
|
||||
background-color: rgba($color: #fff, $alpha: 0.1);
|
||||
.time-item {
|
||||
flex: 1;
|
||||
// width: 120rpx;
|
||||
height: 100%;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
}
|
||||
.time-active {
|
||||
background-color: $J-bg-ff;
|
||||
color: $J-color-t21;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
}
|
||||
.index-scan {
|
||||
width: 110rpx;
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
background-color: rgba($color: #fff, $alpha: 0.1);
|
||||
image {
|
||||
width: 41rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.receipts-money {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 30rpx 0;
|
||||
color: $J-color-tff;
|
||||
.money-num {
|
||||
font-size: 70rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
.money-list {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 72rpx;
|
||||
margin-bottom: 50rpx;
|
||||
text-align: center;
|
||||
color: $J-color-tff;
|
||||
.money-item {
|
||||
.money-num {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
.money-title {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $J-color-tSff;
|
||||
}
|
||||
.quick-money {
|
||||
height: 110rpx;
|
||||
border-radius: 20rpx;
|
||||
color: $J-color-t29;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
3
pages/index/index.vue
Normal file
3
pages/index/index.vue
Normal file
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<view></view>
|
||||
</template>
|
||||
191
pages/index/indexCopy.vue
Normal file
191
pages/index/indexCopy.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<!-- 首页 -->
|
||||
<template>
|
||||
<view class="" @click="tologin">
|
||||
<JeepayBackground :bgColorStyle="{}">
|
||||
<!-- 导航条 -->
|
||||
<JeepayCustomNavbar title="首页" textColor="#fff" bgDefaultColor="linear-gradient(270deg, rgba(72, 192, 255, 1) 0%, rgba(51, 157, 255, 1) 100%)" />
|
||||
|
||||
<!-- 统计 or 快捷扫码 -->
|
||||
<view class="code-box">
|
||||
<view class="today-box">
|
||||
<view class="today">
|
||||
<view class="today-title">今天</view>
|
||||
<view class="jing-box">
|
||||
<text>昨天</text>
|
||||
<text>近7天</text>
|
||||
<text>近30天</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="saoma">扫码</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; flex-direction: column; justify-content: space-around; align-items: center; height: 400rpx; color: #fff; font-size: 28rpx">
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">成交金额(元)</view>
|
||||
<view class="">0.00</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; justify-content: space-around; width: 100%; align-items: center">
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">成交笔数</view>
|
||||
<view class="">0</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">退款金额(元)</view>
|
||||
<view class="" style="font-size: 60rpx">0.00</view>
|
||||
</view>
|
||||
<view class="" style="display: flex; flex-direction: column; align-items: center">
|
||||
<view class="">退款笔数</view>
|
||||
<view class="">0</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="width: 100%">
|
||||
<button>快捷收银</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 导航栅格 -->
|
||||
<view class="" style="margin-top: 85%; display: flex; flex-wrap: wrap; padding: 0 40rpx; justify-content: space-around">
|
||||
<view class="" v-for="item in navList" style="width: 30%; margin: 10rpx 0; background: #fff; padding: 10rpx 0; border-radius: 30rpx">
|
||||
<view class="" style="display: flex; flex-direction: column; justify-content: center; align-items: center">
|
||||
<image :src="item.icon" mode="" style="width: 100rpx; height: 100rpx"></image>
|
||||
{{ item.title }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</JeepayBackground>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import storageManage from '@/commons/utils/storageManage.js';
|
||||
// 导航列表
|
||||
const navList = [
|
||||
{
|
||||
title: '商户进件',
|
||||
icon: '/static/indexImg/icon-passage.svg',
|
||||
pageUrl: 'PAGES_APPLYMENT',
|
||||
entId: 'ENT_MCH_APPLYMENT_LIST'
|
||||
},
|
||||
{
|
||||
title: '商户管理',
|
||||
icon: '/static/indexImg/business.svg',
|
||||
pageUrl: 'PAGES_APPLYMENT_BUSINESS',
|
||||
entId: 'ENT_MCH_APPLYMENT_LIST'
|
||||
},
|
||||
{
|
||||
title: '我的门店',
|
||||
icon: '/static/indexImg/icon-store.svg',
|
||||
pageUrl: 'PAGES_STORE',
|
||||
entId: 'ENT_MCH_STORE'
|
||||
},
|
||||
{
|
||||
title: '我的设备',
|
||||
icon: '/static/indexImg/icon-calc.svg',
|
||||
pageUrl: 'PAGES_DEVICE_MAIN',
|
||||
entId: 'ENT_DEVICE'
|
||||
},
|
||||
{
|
||||
title: '员工管理',
|
||||
icon: '/static/indexImg/icon-staff.svg',
|
||||
pageUrl: 'PAGES_USER',
|
||||
entId: 'ENT_UR_USER_LIST'
|
||||
},
|
||||
{
|
||||
title: '统计报表',
|
||||
icon: '/static/indexImg/icon-pro.svg',
|
||||
pageUrl: 'PAGES_STAT',
|
||||
entId: 'ENT_ORDER_STATISTIC'
|
||||
},
|
||||
{
|
||||
title: '商户应用',
|
||||
icon: '/static/indexImg/icon-app.svg',
|
||||
pageUrl: 'PAGES_APP',
|
||||
entId: 'ENT_MCH_APP_LIST'
|
||||
},
|
||||
{
|
||||
title: '会员中心',
|
||||
icon: '/static/indexImg/icon-member.svg',
|
||||
pageUrl: 'PAGES_MEMBER_CENTER',
|
||||
entId: 'ENT_MCH_MEMBER'
|
||||
},
|
||||
{
|
||||
title: '广告管理',
|
||||
icon: '/static/indexImg/icon-ad.svg',
|
||||
pageUrl: 'PAGES_AD_LIST',
|
||||
entId: 'ENT_ADVERT_CONTROL'
|
||||
},
|
||||
{
|
||||
title: '营销红包',
|
||||
icon: '/static/indexImg/red-envelope.svg',
|
||||
pageUrl: 'PAGES_RED_INDEX',
|
||||
entId: 'ENT_MCH_MEMBER'
|
||||
}
|
||||
];
|
||||
|
||||
// 如果不是超管 删除 刷脸广告菜单
|
||||
if (storageManage.userInfo().userType != 1) {
|
||||
const index = navList.findIndex((v) => v.entId == 'ENT_ADVERT_CONTROL');
|
||||
if (index != -1) {
|
||||
navList.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
const tologin = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/index'
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.code-box {
|
||||
background: #1c72fe;
|
||||
position: fixed;
|
||||
width: 90%;
|
||||
right: 5%;
|
||||
height: 500rpx;
|
||||
border-radius: 20rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
top: 15%;
|
||||
|
||||
.today-box {
|
||||
display: flex;
|
||||
color: #fff;
|
||||
.today {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
margin-right: 10rpx;
|
||||
background: #368bfd;
|
||||
padding: 10rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.today-title {
|
||||
height: 70rpx;
|
||||
background: #fff;
|
||||
width: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10rpx;
|
||||
color: #1b6dfe;
|
||||
}
|
||||
.saoma {
|
||||
width: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10rpx;
|
||||
color: #fff;
|
||||
background: #368bfd;
|
||||
}
|
||||
|
||||
.jing-box {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
531
pages/login/index.vue
Normal file
531
pages/login/index.vue
Normal file
@@ -0,0 +1,531 @@
|
||||
<template>
|
||||
<view class="login-wrapper">
|
||||
|
||||
|
||||
<view class="login-top">
|
||||
<text>欢迎回来,请登录</text>
|
||||
<image @tap="envChangeTipsRef.tapFunc()" style="width: 320rpx; height: 76rpx"
|
||||
:src="vdata.siteInfos.appTopImgUrl" />
|
||||
</view>
|
||||
<view class="login-bottom jeepay-form">
|
||||
|
||||
<!-- 不需要label, 需要修改: label-width="0" -->
|
||||
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
|
||||
<view class="u-p-b-30">
|
||||
<my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list"
|
||||
textKey="label"></my-tabs>
|
||||
</view>
|
||||
<view v-if="vdata.loginType == 'pwd' ">
|
||||
<template v-if="accountType.sel==1">
|
||||
<uni-forms-item name="merchantName">
|
||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入商户号"
|
||||
v-model="vdata.formData.merchantName" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<uni-forms-item name="username">
|
||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
|
||||
v-model="vdata.formData.username" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-user.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item name="pwd">
|
||||
<uni-easyinput class='jeepay-easyinput' :type="vdata.isShowPwd ? 'text' : 'password'"
|
||||
v-model="vdata.formData.pwd" :clearable="false" placeholder="请输入登录密码">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-pw.svg" class="input-icon" />
|
||||
</template>
|
||||
<template #suffixIcon>
|
||||
<view class='show-tips' @tap="vdata.isShowPwd = !vdata.isShowPwd ">
|
||||
{{ vdata.isShowPwd ? '隐藏' : '显示' }}
|
||||
</view>
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item name="code">
|
||||
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
||||
<view style="display: flex;" class="u-flex u-flex-y-center">
|
||||
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入验证码"
|
||||
v-model="vdata.formData.code" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
<image :src="vdata.formData.img" class=" u-m-b-50"
|
||||
style="width: 200rpx; height: 80rpx;margin-left: 10rpx;" @click="getCode" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
|
||||
<view v-if="vdata.loginType == 'sms' ">
|
||||
<uni-forms-item name="loginPhone">
|
||||
<uni-easyinput class='jeepay-easyinput' v-model="vdata.formData.loginPhone" type="number"
|
||||
:maxlength="11" :disabled="!vdata.allowSendMsgFlag" placeholder="请输入手机号" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-phone.svg" class="input-icon" />
|
||||
</template>
|
||||
<template #suffixIcon>
|
||||
<view class='show-tips' @tap="sendSmscodeFunc">{{ vdata.sendMsgText }}</view>
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item>
|
||||
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
||||
<view style="display: flex;">
|
||||
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入验证码"
|
||||
v-model="vdata.formData.vercode" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
<image :src="vdata.formData.imgCodeUrl"
|
||||
style="width: 200rpx; height: 110rpx;margin-left: 10rpx;" @click="getCode" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
|
||||
<uni-forms-item name="smsCode">
|
||||
<!-- 手机验证码, 不限制数字还是本文, 如果发送为文本则无需app升级。 -->
|
||||
<uni-easyinput class='jeepay-easyinput' :maxlength="6" placeholder="请输入手机验证码"
|
||||
v-model="vdata.formData.smsCode" :clearable="false">
|
||||
<template #prefixIcon>
|
||||
<image src="@/static/login/icon-sms-code.svg" class="input-icon" />
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
|
||||
</view>
|
||||
|
||||
</uni-forms>
|
||||
|
||||
<!-- <view class="agreement-policy">
|
||||
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
||||
同意
|
||||
<text class="agreement" @click="toPrivacy">《用户服务协议》</text>
|
||||
<text>与</text>
|
||||
<text class="policy" @click="toPrivacy">《隐私政策》</text>
|
||||
</view> -->
|
||||
|
||||
|
||||
<!-- <view class="agreement-policy">
|
||||
<JeepayCheckbox v-model:checked="vdata.isSelectedAgreement" />
|
||||
同意
|
||||
<text class="agreement" @click="go.to('PAGES_STATIC_AGREEMENT')">《用户服务协议》</text>
|
||||
<text>与</text>
|
||||
<text class="policy" @click="toPrivacy">《隐私政策》</text>
|
||||
<text class="policy" @click="go.to('PAGES_STATIC_POLICY')">《隐私政策》</text>
|
||||
</view> -->
|
||||
|
||||
|
||||
<Button @tap="loginFunc">登录</Button>
|
||||
|
||||
<!-- <view class="register-box">
|
||||
<view class="register">
|
||||
<text>还没有账号?</text> <text @tap="go.to('PAGES_REGISTER')">去注册></text>
|
||||
</view>
|
||||
<view class="forget" @tap="go.to('PAGES_FORGET_PASSWORD')">忘记密码</view>
|
||||
</view>
|
||||
<view class="swidth-login" @click="changeLoginType">
|
||||
{{ vdata.loginType == 'pwd' ? '短信验证码登录' : '账号密码登录' }}
|
||||
<image src="@/static/login/icon-arrow-left.svg"></image>
|
||||
</view> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<JAgree service="PAGES_STATIC_AGREEMENT" privacy="PAGES_FORGET_PASSWORD" ref="refAgr"
|
||||
@agree="vdata.isSelectedAgreement = true" />
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
encrypt
|
||||
} from '@/commons/utils/rsaEncrypt.js'
|
||||
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
$loginByPwd,
|
||||
$phoneCodeLogin,
|
||||
$userInfo,
|
||||
$sendSms,
|
||||
$getSiteInfos,
|
||||
$getUploadImgSize,
|
||||
$isCode
|
||||
} from '@/http/apiManager.js';
|
||||
import storageManage from '@/commons/utils/storageManage.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import timer from '@/commons/utils/timer.js'
|
||||
import formUtil from '@/commons/utils/formUtil.js'
|
||||
import Button from '@/components/Button/Button.vue'
|
||||
import {
|
||||
getExtStoreId
|
||||
} from "@/commons/utils/versionManage.js"
|
||||
import {
|
||||
$login
|
||||
} from '@/http/newApi/login.js';
|
||||
import {
|
||||
login,
|
||||
getCodeImg
|
||||
} from '@/http/yskApi/login.js';
|
||||
|
||||
const accountType = reactive({
|
||||
list: [{
|
||||
label: '商户',
|
||||
value: 'merchant'
|
||||
},
|
||||
{
|
||||
label: '员工',
|
||||
value: 'staff'
|
||||
},
|
||||
],
|
||||
sel: 0
|
||||
})
|
||||
|
||||
const loginFormRef = ref()
|
||||
const envChangeTipsRef = ref()
|
||||
const refAgr = ref()
|
||||
const rules = {
|
||||
merchantName: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('商户号')],
|
||||
},
|
||||
username: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('用户名')],
|
||||
},
|
||||
pwd: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('密码')],
|
||||
},
|
||||
safetyCode: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('安全码')],
|
||||
},
|
||||
code: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('验证码')],
|
||||
},
|
||||
loginPhone: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('手机号')],
|
||||
},
|
||||
|
||||
smsCode: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('短信验证码')],
|
||||
},
|
||||
}
|
||||
|
||||
const vdata = reactive({
|
||||
|
||||
isShowPwd: false, // 是否显示密码
|
||||
loginType: 'pwd', // 类型切换: pwd or sms
|
||||
isShowSafetyCode: false, // 是否显示安全码输入框
|
||||
allowSendMsgFlag: true, // 是否可发送短信验证码
|
||||
sendMsgText: '发送验证码',
|
||||
isSelectedAgreement: false, // 勾选隐私协议
|
||||
|
||||
siteInfos: storageManage.siteInfos() || {},
|
||||
|
||||
formData: {
|
||||
username: '', // 账密登录: 用户名
|
||||
pwd: '', // 账密登录: 密码
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
uuid: '',
|
||||
merchantName: '',
|
||||
loginType: 'merchant'
|
||||
},
|
||||
|
||||
})
|
||||
// #ifdef H5
|
||||
vdata.formData.username = '17792050546'
|
||||
vdata.formData.pwd = 'sy666888'
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
// vdata.formData.username = '15699991111'
|
||||
// vdata.formData.pwd = 'qwer1234'
|
||||
// #endif
|
||||
|
||||
function accountTypeChange(e) {
|
||||
// #ifdef H5
|
||||
if(e==1){
|
||||
vdata.formData.merchantName = '18049104914'
|
||||
vdata.formData.username = '13666666666'
|
||||
vdata.formData.pwd = '123456'
|
||||
}else{
|
||||
vdata.formData.pwd = 'qwer1234'
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
const getCode = () => {
|
||||
getCodeImg().then(res => {
|
||||
vdata.formData.img = res.img
|
||||
vdata.formData.uuid = res.uuid
|
||||
})
|
||||
}
|
||||
|
||||
getCode()
|
||||
|
||||
onMounted(() => {
|
||||
// getExtStoreId()
|
||||
|
||||
// 查询是否包含网站信息, 否则更新
|
||||
|
||||
// if(!vdata.siteInfos || Object.keys(vdata.siteInfos) <= 0){
|
||||
// $getSiteInfos().then( ( { bizData } ) => {
|
||||
// vdata.siteInfos = storageManage.siteInfos(bizData)
|
||||
// })
|
||||
// }
|
||||
// 获取商户信息,有就回显
|
||||
let info = uni.getStorageSync('MerchantId')
|
||||
if (info.merchantName) {
|
||||
vdata.formData.merchantName = info.merchantName
|
||||
vdata.formData.username = info.username
|
||||
}
|
||||
})
|
||||
|
||||
// 切换登录方式
|
||||
function changeLoginType() {
|
||||
vdata.loginType = vdata.loginType == 'pwd' ? 'sms' : 'pwd';
|
||||
}
|
||||
|
||||
function loginFunc() {
|
||||
// 表单验证
|
||||
formUtil.validate(loginFormRef.value).then(() => {
|
||||
// if (!vdata.isSelectedAgreement) {
|
||||
// infoBox.showToast('请勾选同意用户服务协议与隐私政策')
|
||||
// return false
|
||||
// }
|
||||
let loginPromise = null;
|
||||
if (vdata.loginType == 'pwd') { // 用户名密码登录
|
||||
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
|
||||
loginPromise = login({
|
||||
username: vdata.formData.username,
|
||||
password: encrypt(vdata.formData.pwd),
|
||||
rememberMe: false,
|
||||
code: vdata.formData.code,
|
||||
uuid: vdata.formData.uuid,
|
||||
merchantName: vdata.formData.merchantName,
|
||||
loginType: accountType.list[accountType.sel].value
|
||||
})
|
||||
|
||||
} else if (vdata.loginType == 'sms') { // 短信验证码登录
|
||||
loginPromise = $phoneCodeLogin(vdata.formData.loginPhone, vdata.formData.smsCode)
|
||||
}
|
||||
|
||||
if (loginPromise == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 请求后的操作
|
||||
loginPromise.then(res => {
|
||||
// 登录成功
|
||||
loginFinishFunc(res)
|
||||
// 保存商户号
|
||||
uni.setStorageSync('MerchantId', {
|
||||
merchantName: vdata.formData.merchantName,
|
||||
username: vdata.formData.username,
|
||||
})
|
||||
}).catch(e => {
|
||||
getCode()
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
const toPrivacy = () => {
|
||||
// #ifdef APP-PLUS
|
||||
go.to('PAGES_STATIC_POLICY')
|
||||
// #endif
|
||||
// 打开小程序隐私政策
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.openPrivacyContract({
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '打开失败请稍后重试', // 打开失败
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
watch(() => accountType.sel, (newval) => {
|
||||
if (newval == 1) {
|
||||
vdata.formData.merchantName = uni.getStorageSync('merchantName') || ''
|
||||
} else {
|
||||
vdata.formData.username = ''
|
||||
}
|
||||
})
|
||||
// 封装登录成功后的操作
|
||||
async function loginFinishFunc(loginBizData) {
|
||||
// 保存 token
|
||||
storageManage.setLogin(loginBizData)
|
||||
storageManage.token(loginBizData.token)
|
||||
storageManage.shopId(loginBizData.shopId)
|
||||
storageManage.shopUserId(loginBizData.user.user.id)
|
||||
storageManage.userInfo(loginBizData)
|
||||
|
||||
// 跳转到首页
|
||||
go.to("PAGES_CREATE_ORDER")
|
||||
}
|
||||
|
||||
// 点击发送验证码的函数
|
||||
function sendSmscodeFunc() {
|
||||
// 按钮禁用
|
||||
if (!vdata.allowSendMsgFlag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 验证失败
|
||||
if (!formUtil.regexp.mobile.test(vdata.formData.loginPhone)) {
|
||||
return infoBox.showToast("请输入正确的手机号")
|
||||
}
|
||||
|
||||
if (!vdata.formData.vercode) {
|
||||
return infoBox.showToast("请输入图像验证码");
|
||||
}
|
||||
|
||||
vdata.allowSendMsgFlag = false; // 按钮禁用
|
||||
|
||||
|
||||
let data = {
|
||||
phone: vdata.formData.loginPhone,
|
||||
vercode: vdata.formData.vercode,
|
||||
vercodeToken: vdata.formData.vercodeToken,
|
||||
}
|
||||
|
||||
// 发送短信验证码
|
||||
$sendSms(data, 'auth').then(({
|
||||
bizData
|
||||
}) => {
|
||||
infoBox.showSuccessToast('验证码发送成功')
|
||||
timer.startTimeoutTask(1, 60, (subTime) => {
|
||||
|
||||
if (subTime <= 0) { // 任务结束
|
||||
vdata.sendMsgText = '发送验证码'
|
||||
vdata.allowSendMsgFlag = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
vdata.sendMsgText = `${subTime}s后可重新发送`
|
||||
})
|
||||
}).catch(() => {
|
||||
vdata.allowSendMsgFlag = true;
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@/commons/style/global.scss';
|
||||
.login-wrapper {
|
||||
min-height: 100vh;
|
||||
background-color: $v-color-bgrey;
|
||||
|
||||
.login-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 376rpx;
|
||||
padding: 176rpx 70rpx 0;
|
||||
box-sizing: border-box;
|
||||
background: url("/static/indexImg/user-bg.svg") center center no-repeat;
|
||||
background-size: cover;
|
||||
|
||||
text:first-child {
|
||||
margin-bottom: 30rpx;
|
||||
font-size: 38rpx;
|
||||
font-weight: 500;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
text:last-child {
|
||||
font-size: 50rpx;
|
||||
font-weight: 600;
|
||||
color: #48C0FF;
|
||||
}
|
||||
}
|
||||
|
||||
.login-bottom {
|
||||
height: calc(100vh - 376rpx);
|
||||
padding: 50rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 60rpx 60rpx 0 0;
|
||||
background-color: #fff;
|
||||
|
||||
.show-tips {
|
||||
color: rgba(88, 132, 204, 1);
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.agreement-policy {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 30rpx;
|
||||
margin-top: 10rpx;
|
||||
margin-bottom: 50rpx;
|
||||
font-size: 26rpx;
|
||||
color: #8C8C8C;
|
||||
|
||||
.select-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.select-img {
|
||||
width: 46rpx;
|
||||
height: 46rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.agreement,
|
||||
.policy {
|
||||
color: #1D79FD;
|
||||
}
|
||||
}
|
||||
|
||||
.register-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 30rpx;
|
||||
margin-top: 50rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
|
||||
.register {
|
||||
text:last-child {
|
||||
color: #1D79FD;
|
||||
}
|
||||
}
|
||||
|
||||
.forget {
|
||||
color: #1D79FD;
|
||||
}
|
||||
}
|
||||
|
||||
.swidth-login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 212rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(77, 77, 77, 1);
|
||||
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
21
pages/webview/webview.vue
Normal file
21
pages/webview/webview.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<web-view class="view" :src="webUrl"></web-view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const webUrl = ref('');
|
||||
|
||||
onLoad((options) => {
|
||||
webUrl.value = options.url;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.view {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user