代码优化
This commit is contained in:
@@ -53,24 +53,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
$indexStatistics,
|
||||
$memberInfoCount
|
||||
} from '@/http/apiManager.js';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
|
||||
import cal from '@/commons/utils/cal.js';
|
||||
import go from '@/commons/utils/go.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';
|
||||
|
||||
import { getTrade } from '@/http/api/summary.js'
|
||||
onMounted(() => {
|
||||
vdata.memberIsShow = ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt;
|
||||
if (ent.has('ENT_MCH_MEMBER') && storageManage.userInfo().isHasMemberEnt) {
|
||||
@@ -125,7 +117,7 @@
|
||||
startTime = start
|
||||
endTime = end
|
||||
}
|
||||
summaryTrade({
|
||||
getTrade({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
startTime,
|
||||
endTime,
|
||||
@@ -145,14 +137,14 @@
|
||||
// 根据选择请求数据
|
||||
function refData() {
|
||||
// 获取 统计数据
|
||||
$indexStatistics(vdata.timeSelected).then(({
|
||||
bizData
|
||||
}) => {
|
||||
vdata.payAmount = bizData.totalSuccAmt;
|
||||
vdata.payCount = bizData.totalSuccNum;
|
||||
vdata.refundAmount = bizData.totalRefundAmt;
|
||||
vdata.refundCount = bizData.totalRefundNum;
|
||||
});
|
||||
// $indexStatistics(vdata.timeSelected).then(({
|
||||
// bizData
|
||||
// }) => {
|
||||
// vdata.payAmount = bizData.totalSuccAmt;
|
||||
// vdata.payCount = bizData.totalSuccNum;
|
||||
// vdata.refundAmount = bizData.totalRefundAmt;
|
||||
// vdata.refundCount = bizData.totalRefundNum;
|
||||
// });
|
||||
}
|
||||
|
||||
// 扫码动作
|
||||
@@ -196,13 +188,13 @@
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
const getMemberData = () => {
|
||||
$memberInfoCount({
|
||||
queryDateRange: vdata.timeSelected
|
||||
}).then(({
|
||||
bizData
|
||||
}) => {
|
||||
Object.assign(memberData, bizData);
|
||||
});
|
||||
// $memberInfoCount({
|
||||
// queryDateRange: vdata.timeSelected
|
||||
// }).then(({
|
||||
// bizData
|
||||
// }) => {
|
||||
// Object.assign(memberData, bizData);
|
||||
// });
|
||||
};
|
||||
defineExpose({
|
||||
refData
|
||||
|
||||
@@ -65,44 +65,6 @@
|
||||
|
||||
</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>
|
||||
|
||||
@@ -121,19 +83,10 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { encrypt } from '@/commons/utils/rsaEncrypt.js'
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
$phoneCodeLogin,
|
||||
$sendSms
|
||||
} from '@/http/apiManager.js';
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
|
||||
import { login, authCaptcha } from '@/http/api/login.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'
|
||||
@@ -255,7 +208,7 @@
|
||||
// 表单验证
|
||||
formUtil.validate(loginFormRef.value).then(() => {
|
||||
if (!vdata.isSelectedAgreement) {
|
||||
infoBox.showToast('请勾选同意用户服务协议与隐私政策')
|
||||
uni.$utils.showToast('请勾选同意用户服务协议与隐私政策')
|
||||
return false
|
||||
}
|
||||
let loginPromise = null;
|
||||
@@ -274,8 +227,6 @@
|
||||
}
|
||||
loginPromise = login(params)
|
||||
|
||||
} else if (vdata.loginType == 'sms') { // 短信验证码登录
|
||||
loginPromise = $phoneCodeLogin(vdata.formData.loginPhone, vdata.formData.smsCode)
|
||||
}
|
||||
|
||||
if (loginPromise == null) {
|
||||
@@ -343,53 +294,7 @@
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击发送验证码的函数
|
||||
*/
|
||||
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">
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { $getTreaty } from '@/http/apiManager.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
@@ -17,9 +16,9 @@ let vdata = reactive({
|
||||
content: '',
|
||||
})
|
||||
onLoad(() => {
|
||||
$getTreaty().then(({ bizData }) => {
|
||||
vdata.content = bizData.privacyPolicy
|
||||
})
|
||||
// $getTreaty().then(({ bizData }) => {
|
||||
// vdata.content = bizData.privacyPolicy
|
||||
// })
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -9,16 +9,15 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { $getTreaty } from '@/http/apiManager.js'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
let vdata = reactive({
|
||||
content: '',
|
||||
})
|
||||
onLoad(() => {
|
||||
$getTreaty().then(({ bizData }) => {
|
||||
vdata.content = bizData.serviceAgreement
|
||||
})
|
||||
// $getTreaty().then(({ bizData }) => {
|
||||
// vdata.content = bizData.serviceAgreement
|
||||
// })
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
import { nextTick, reactive, ref } from 'vue';
|
||||
import { onReachBottom, onShow, onUnload } from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { getShopList } from '@/http/yskApi/shop.js'
|
||||
// import { getShopList } from '@/http/api/shop.js'
|
||||
|
||||
const vdata = reactive({
|
||||
shopList:[
|
||||
@@ -54,9 +54,9 @@ onShow(() => {
|
||||
})
|
||||
|
||||
let getshopList = () => {
|
||||
getShopList().then((res) => {
|
||||
console.log(res)
|
||||
})
|
||||
// getShopList().then((res) => {
|
||||
// console.log(res)
|
||||
// })
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user