fix:部分功能增加loading效果

This commit is contained in:
5g0Wp7Zy 2025-07-10 10:13:42 +08:00
parent 09b73e1240
commit e24b20bd06
9 changed files with 2101 additions and 1970 deletions

View File

@ -1,219 +1,247 @@
<template>
<div style="padding: 15px;background-color: white;">
<div class="divPay">
<view class="flex justify-between">
<view class="width-65">
<div class="divTitle">
<label>
<image class="divImg" :src='imgPath+"static/userui/home/money.png"' />
</label>
<label>{{status==3 ? '已支付:' :'待支付:'}}</label>
<label>{{data.totalAmount}}</label>
</div>
<div class="divFont">
{{data.createdAt}}
</div>
</view>
<view class="width-35 flex justify-end"> <!--已支付 v-if="status==3"-->
<view v-if="status==3" @click="handleFeeAppealClick">
<view class="text-center">
<uni-icons type="help" size="20"></uni-icons>
</view>
<view class="text-center wzfysh">
费用申述
</view>
</view>
<view @click="handleFaultReportClick" style="margin-left: 10px;">
<view class="text-center">
<uni-icons custom-prefix="iconfont" color="rgb(102,102,102)" type="icon-ebikeweixiuoff" size="20"></uni-icons>
</view>
<view class="text-center wzfysh">
故障上报
</view>
</view>
<div style="padding: 15px; background-color: white">
<div class="divPay">
<view class="flex justify-between">
<view class="width-65">
<div class="divTitle">
<label>
<image
class="divImg"
:src="imgPath + 'static/userui/home/money.png'"
/>
</label>
<label>{{ status == 3 ? "已支付:" : "待支付:" }}</label>
<label>{{ data.totalAmount }}</label>
</div>
<div class="divFont">
{{ data.createdAt }}
</div>
</view>
<view class="width-35 flex justify-end">
<!--已支付 v-if="status==3"-->
<view v-if="status == 3" @click="handleFeeAppealClick">
<view class="text-center">
<uni-icons type="help" size="20"></uni-icons>
</view>
<view class="text-center wzfysh"> 费用申述 </view>
</view>
<view @click="handleFaultReportClick" style="margin-left: 10px">
<view class="text-center">
<uni-icons
custom-prefix="iconfont"
color="rgb(102,102,102)"
type="icon-ebikeweixiuoff"
size="20"
></uni-icons>
</view>
<view class="text-center wzfysh"> 故障上报 </view>
</view>
</view>
</view>
</view>
</view>
<div class="divTitle2">
费用明细
</div>
<div class="divRow divFont" v-for="(item,index) in data.details" :key="index">
<label>{{item.itemName}}</label>
<label>{{item.itemAmount}}</label>
</div>
<!-- <div class="divRow divFont">
<div class="divTitle2">费用明细</div>
<div
class="divRow divFont"
v-for="(item, index) in data.details"
:key="index"
>
<label>{{ item.itemName }}</label>
<label>{{ item.itemAmount }}</label>
</div>
<!-- <div class="divRow divFont">
<label>时长费</label>
<label>{{data.scf}}</label>
</div> -->
<div class="divHJ">
<label>合计</label>
<label>{{data.totalAmount}}</label>
</div>
</div>
<div>
<div v-if="status==2" class="divBtn" @click="handlePaymentClick">
<label>
<uni-icons custom-prefix="iconfont" type="icon-ebikeweixin" color="white" size="25" />
</label>
支付
</div>
</div>
</div>
<div class="divHJ">
<label>合计</label>
<label>{{ data.totalAmount }}</label>
</div>
</div>
<div>
<div v-if="status == 2" class="divBtn" @click="handlePaymentClick">
<label>
<uni-icons
custom-prefix="iconfont"
type="icon-ebikeweixin"
color="white"
size="25"
/>
</label>
支付
</div>
</div>
</div>
</template>
<script setup>
import {
ref,
onMounted
} from 'vue';
import config from '@/utils/config';
import * as api from '@/utils/api.js';
import {
showModelMessage
} from "@/utils/tools.js";
const imgPath = config.imgPath;
const props = defineProps(["orderId"]);
const status = ref("")
const data = ref({
hj: "2.5",
sj: "2025-04-03 14:15:13",
qbj: "2.0",
scf: "0.5"
})
import { ref, onMounted } from "vue";
import config from "@/utils/config";
import * as api from "@/utils/api.js";
import { showModelMessage } from "@/utils/tools.js";
const imgPath = config.imgPath;
const props = defineProps(["orderId"]);
const status = ref("");
const data = ref({
hj: "2.5",
sj: "2025-04-03 14:15:13",
qbj: "2.0",
scf: "0.5",
});
onMounted(() => {
getInfoOrderData();
})
const getInfoOrderData = () => {
api.callOrdereApi("userOrders/orderDetailsInfo?orderId=" + props.orderId, {}, "get").then(res => {
if (res.code == 200) {
data.value = res.data;
status.value = res.data.status;
}
onMounted(() => {
console.log("2222");
})
}
const handlePaymentClick = () => {
api.callPaymentApi("wxPayment/prepay?orderId=" + props.orderId, {}, "get").then(res => {
if (res.code == 200) {
wx.requestPayment({
"timeStamp": res.data.timeStamp,
"nonceStr": res.data.nonceStr,
"package": res.data.package,
"signType": res.data.signType,
"paySign": res.data.paySign,
"success": function(res) {
//
checkPaymentStatus();
},
"fail": function(res) {
console.log("fail", res)
},
"complete": function(res) {
console.log("complete", res)
}
})
} else {
showModelMessage("支付失败")
}
})
}
getInfoOrderData();
});
const getInfoOrderData = () => {
console.log(props.orderId, "props.orderId");
function checkPaymentStatus() {
api.callPaymentApi("wxPayment/queryOrderByOutTradeNo?outTradeNo=" + props.orderId, {}, "get")
.then(res => {
if (res.code == 200) {
gotoHome();
} else {
console.log("支付未成功,继续轮询");
checkPaymentStatus(); //
}
})
.catch(error => {
console.log("请求失败,继续轮询", error);
checkPaymentStatus(); //
});
}
const gotoHome = () => {
uni.navigateTo({
url: "/pages/user/home/home"
})
}
api
.callOrdereApi(
"userOrders/orderDetailsInfo?orderId=" + props.orderId,
{},
"get"
)
.then((res) => {
if (res.code == 200) {
data.value = res.data;
status.value = res.data.status;
}
});
};
const handlePaymentClick = () => {
uni.showLoading({
title: "正在支付...",
});
api
.callPaymentApi("wxPayment/prepay?orderId=" + props.orderId, {}, "get")
.then((res) => {
if (res.code == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success: function (res) {
uni.hideLoading();
//
checkPaymentStatus();
},
fail: function (res) {
uni.hideLoading();
console.log("fail", res);
},
complete: function (res) {
console.log("complete", res);
},
});
} else {
uni.hideLoading();
showModelMessage("支付失败");
}
});
};
const handleFeeAppealClick=()=>{//
uni.navigateTo({
url: "/pages/user/views/PaymentFeedback?orderId="+props.orderId
})
}
const handleFaultReportClick=()=>{//
uni.navigateTo({
url: "/pages/user/login/TroubleReportUser?bikeCode="+data.value.bikeCode+"&orderCode="+props.orderId
})
}
function checkPaymentStatus() {
api
.callPaymentApi("wxPayment/queryOrderStatus/" + props.orderId, {}, "get")
.then((res) => {
if (res.code == 200) {
gotoHome();
} else {
console.log("支付未成功,继续轮询");
checkPaymentStatus(); //
}
})
.catch((error) => {
console.log("请求失败,继续轮询", error);
checkPaymentStatus(); //
});
}
const gotoHome = () => {
uni.navigateTo({
url: "/pages/user/home/home",
});
};
const handleFeeAppealClick = () => {
//
uni.navigateTo({
url: "/pages/user/views/PaymentFeedback?orderId=" + props.orderId,
});
};
const handleFaultReportClick = () => {
//
uni.navigateTo({
url:
"/pages/user/login/TroubleReportUser?bikeCode=" +
data.value.bikeCode +
"&orderCode=" +
props.orderId,
});
};
</script>
<style scoped>
.divPay {
width: auto;
}
.divPay {
width: auto;
}
.divTitle {
line-height: 30px;
font-size: 14px;
color: #000;
font-weight: bold;
}
.divTitle {
line-height: 30px;
font-size: 14px;
color: #000;
font-weight: bold;
}
.divTitle2 {
font-size: 16px;
line-height: 35px;
}
.divTitle2 {
font-size: 16px;
line-height: 35px;
}
.divImg {
width: 15px;
height: 12px;
margin-right: 5px;
}
.divImg {
width: 15px;
height: 12px;
margin-right: 5px;
}
.divFont {
color: #000;
font-size: 12px;
opacity: 0.7;
}
.divFont {
color: #000;
font-size: 12px;
opacity: 0.7;
}
.divRow {
line-height: 20px;
display: flex;
justify-content: space-between;
}
.divRow {
line-height: 20px;
display: flex;
justify-content: space-between;
}
.divHJ {
text-align: right;
font-size: 14px;
color: red;
font-weight: bold;
}
.divHJ {
text-align: right;
font-size: 14px;
color: red;
font-weight: bold;
}
.divBtn {
text-align: center;
background: #61D145;
color: white;
line-height: 40px;
border-radius: 5px;
margin-top: 20px;
}
.divBtn {
text-align: center;
background: #61d145;
color: white;
line-height: 40px;
border-radius: 5px;
margin-top: 20px;
}
.width-65 {
width: 65%;
}
.width-65 {
width: 65%;
}
.width-35 {
width: 35%;
}
.wzfysh{
font-size: 10px;
}
</style>
.width-35 {
width: 35%;
}
.wzfysh {
font-size: 10px;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,221 +1,232 @@
<template>
<view class="container">
<!-- 用户信息区域 -->
<view class="user-info padding">
<view class="user-avatar">
<image :src="wechat_user.avatar" mode="aspectFill"></image><!-- 头像 -->
</view>
<view class="user-details">
<view class="nickname">{{wechat_user.nickname}}</view>
<view class="phone-number">{{ hidePhoneNumber(wechat_user.mobile) }}</view>
</view>
</view>
<view class="container">
<!-- 用户信息区域 -->
<view class="user-info padding">
<view class="user-avatar">
<image
:src="wechat_user.avatar || `${imgPath}static/userui/wxtouxiang.png`"
mode="aspectFill"
></image
><!-- 头像 -->
</view>
<view class="user-details">
<view class="nickname">{{ wechat_user.nickname || "微信用户" }}</view>
<view class="phone-number">{{
hidePhoneNumber(wechat_user.mobile)
}}</view>
</view>
</view>
<!-- 账户明细区域 -->
<view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius">
<view v-for="(item, index) in menuItems" :key="index" class="cu-item arrow" @click="navigateTo(item.link)">
<view class="content flex">
<view class="icon-container">
<image class="icon-size" :src="item.icon"></image>
</view>
<text class="text-black">{{ item.label }}</text>
</view>
</view>
<view class=" flex flex-direction">
<button @click="logout" style="height: 45px;"
class="cu-btn bg-white margin-tb-sm lg text-red text-bold">退出登录</button>
</view>
</view>
</view>
<!-- 账户明细区域 -->
<view
class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius"
>
<view
v-for="(item, index) in menuItems"
:key="index"
class="cu-item arrow"
@click="navigateTo(item.link)"
>
<view class="content flex">
<view class="icon-container">
<image class="icon-size" :src="item.icon"></image>
</view>
<text class="text-black">{{ item.label }}</text>
</view>
</view>
<view class="flex flex-direction">
<button
@click="logout"
style="height: 45px"
class="cu-btn bg-white margin-tb-sm lg text-red text-bold"
>
退出登录
</button>
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
import config from '@/utils/config';
import {
onLoad
} from '@dcloudio/uni-app';
import {
showModelMessage,
jkcBaseEncode,
jkcBaseDecode
} from '@/utils/tools.js';
const imgPath = config.imgPath;
const wechat_user = ref({
url: `${imgPath}static/userui/wxtouxiang.png`,
nickname: "",
mobile: ""
});
onLoad((options) => {
wechat_user.value = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
import { ref } from "vue";
import config from "@/utils/config";
import { onLoad } from "@dcloudio/uni-app";
import {
showModelMessage,
jkcBaseEncode,
jkcBaseDecode,
} from "@/utils/tools.js";
const imgPath = config.imgPath;
const wechat_user = ref({
url: `${imgPath}static/userui/wxtouxiang.png`,
nickname: "",
mobile: "",
});
onLoad((options) => {
wechat_user.value = JSON.parse(
jkcBaseDecode(uni.getStorageSync("wechat_user"))
);
console.log(wechat_user.value);
});
//
const hidePhoneNumber = (phoneNumber) => {
if (!phoneNumber || phoneNumber.length !== 11) {
return phoneNumber; //
}
const firstPart = phoneNumber.substring(0, 3); //
const lastPart = phoneNumber.substring(7); //
return `${firstPart}****${lastPart}`; //
};
})
//
const hidePhoneNumber = (phoneNumber) => {
if (!phoneNumber || phoneNumber.length !== 11) {
return phoneNumber; //
}
const firstPart = phoneNumber.substring(0, 3); //
const lastPart = phoneNumber.substring(7); //
return `${firstPart}****${lastPart}`; //
}
const menuItems = ref([
{
icon: `${imgPath}static/userui/icon/zhhanghu.png`,
label: "订单明细",
link: "/pages/user/login/AccountDetails",
},
{
icon: `${imgPath}static/userui/icon/baoxiujilu.png`,
label: "故障反馈",
link: "/pages/user/login/TroubleReportUser?bikeCode=250306001002&orderCode=12039219893712864",
},
{
icon: `${imgPath}static/userui/icon/baoxiujilu.png`,
label: "报修记录",
link: "/pages/user/login/RepairReport",
},
{
icon: `${imgPath}static/userui/icon/shiminrenzheng.png`,
label: "微信登录",
link: "/pages/user/login/wx_login",
},
{
icon: `${imgPath}static/userui/icon/jilu.png`,
label: "申请还车记录",
link: "/pages/user/login/return-point-records",
},
{
icon: `${imgPath}static/userui/icon/helpinfo.png`,
label: "帮助中心",
link: "/pages/user/HelpPage/HelpPage",
},
{
icon: `${imgPath}static/userui/icon/helpinfo.png`,
label: "微信支付反馈",
link: "/pages/user/views/PaymentFeedback",
},
{
icon: `${imgPath}static/userui/icon/loginout.png`,
label: "账号注销",
link: "/pages/user/login/userLogout",
},
]);
// 退
const logout = () => {
uni.showModal({
title: "退出登录",
content: "是否确认退出并清除缓存?",
success: function (res) {
if (res.confirm) {
//
uni.clearStorage("wechat_user");
//
uni.showToast({
title: "退出成功", //
icon: "success", //
duration: 2000, //
});
} else if (res.cancel) {
// 退
console.log("用户取消退出");
}
},
});
};
const menuItems = ref([{
icon: `${imgPath}static/userui/icon/zhhanghu.png`,
label: '订单明细',
link: '/pages/user/login/AccountDetails'
},
{
icon: `${imgPath}static/userui/icon/baoxiujilu.png`,
label: '故障反馈',
link: '/pages/user/login/TroubleReportUser?bikeCode=250306001002&orderCode=12039219893712864'
},
{
icon: `${imgPath}static/userui/icon/baoxiujilu.png`,
label: '报修记录',
link: '/pages/user/login/RepairReport'
},
{
icon: `${imgPath}static/userui/icon/shiminrenzheng.png`,
label: '微信登录',
link: '/pages/user/login/wx_login'
},
{
icon: `${imgPath}static/userui/icon/jilu.png`,
label: '申请还车记录',
link: '/pages/user/login/return-point-records'
},
{
icon: `${imgPath}static/userui/icon/helpinfo.png`,
label: '帮助中心',
link: '/pages/user/HelpPage/HelpPage'
},
{
icon: `${imgPath}static/userui/icon/helpinfo.png`,
label: '微信支付反馈',
link: '/pages/user/views/PaymentFeedback'
},
{
icon: `${imgPath}static/userui/icon/loginout.png`,
label: '账号注销',
link: '/pages/user/login/userLogout'
}
]);
// 退
const logout = () => {
uni.showModal({
title: '退出登录',
content: '是否确认退出并清除缓存?',
success: function(res) {
if (res.confirm) {
//
uni.clearStorage("wechat_user");
//
uni.showToast({
title: '退出成功', //
icon: 'success', //
duration: 2000 //
});
} else if (res.cancel) {
// 退
console.log('用户取消退出');
}
}
});
}
const navigateTo = (link) => {
if (link == "") return;
uni.navigateTo({
url: link
});
}
const navigateTo = (link) => {
if (link == "") return;
uni.navigateTo({
url: link,
});
};
</script>
<style>
/* 容器 */
.container {
background-color: rgb(248, 248, 248);
height: 100vh;
/* 给容器添加内边距 */
}
/* 容器 */
.container {
background-color: rgb(248, 248, 248);
height: 100vh;
/* 给容器添加内边距 */
}
/* 用户信息部分 */
.user-info {
display: flex;
margin-bottom: 20px;
/* 用户信息区域底部间距 */
align-items: center;
}
/* 用户信息部分 */
.user-info {
display: flex;
margin-bottom: 20px;
/* 用户信息区域底部间距 */
align-items: center;
}
/* 用户头像 */
.user-avatar {
margin-right: 15px;
/* 头像与其他信息之间的间距 */
}
/* 用户头像 */
.user-avatar {
margin-right: 15px;
/* 头像与其他信息之间的间距 */
}
.user-avatar image {
width: 50px;
height: 50px;
border-radius: 50%;
}
.user-avatar image {
width: 50px;
height: 50px;
border-radius: 50%;
}
/* 用户信息 */
.user-details {
display: flex;
flex-direction: column;
}
/* 用户信息 */
.user-details {
display: flex;
flex-direction: column;
}
.nickname {
font-weight: bold;
font-size: 16px;
}
.nickname {
font-weight: bold;
font-size: 16px;
}
.phone-number {
color: #888;
font-size: 14px;
}
.phone-number {
color: #888;
font-size: 14px;
}
/* 账户明细部分 */
.account-details {
background-color: #f5f5f5;
padding: 15px;
border-radius: 8px;
}
/* 账户明细部分 */
.account-details {
background-color: #f5f5f5;
padding: 15px;
border-radius: 8px;
}
.account-details .flex {
display: flex;
align-items: center;
}
.account-details .flex {
display: flex;
align-items: center;
}
.icon {
width: 30px;
height: 30px;
background-color: #ddd;
border-radius: 50%;
margin-right: 10px;
}
.icon {
width: 30px;
height: 30px;
background-color: #ddd;
border-radius: 50%;
margin-right: 10px;
}
.account-info {
font-size: 16px;
font-weight: bold;
}
.account-info {
font-size: 16px;
font-weight: bold;
}
.icon-container {
margin-right: 15px;
}
.icon-container {
margin-right: 15px;
}
.icon-size {
width: 15px;
height: 15px;
}
</style>
.icon-size {
width: 15px;
height: 15px;
}
</style>

View File

@ -15,6 +15,7 @@
:focus="focus"
@input="changeInput"
type="number"
@blur="focus = false"
maxlength="6"
style="height: 0; width: 0"
/>
@ -143,6 +144,8 @@ function onTorch() {
//
function createRide() {
console.log();
addOrder(data, (res) => {});
}
</script>

View File

@ -1,159 +1,175 @@
<template>
<view class="loginbox">
<view class="logintop flex justify-center align-center">
<image :src="`${imgPath}static/userui/kncxbj.png`" style="width: 100px; height: 100px;" />
</view>
<view class="input-fields padding">
<!-- 输入姓名 -->
<view class="input-item flex align-center">
<text class="cuIcon-peoplefill"
style="font-size: 20px; color: rgb(173,173,175);margin-right: 10px;"></text>
<input v-model="name" placeholder="请输入姓名" />
</view>
<!-- 输入身份证号 -->
<view class="input-item flex align-center">
<text class="cuIcon-card lg text-gray"
style="font-size: 20px; color: rgb(173,173,175);margin-right: 10px;"></text>
<input v-model="idCard" placeholder="请输入身份证号" />
</view>
<!-- 登录按钮 -->
<view class="flex flex-direction loginbotton">
<button @click="phonelogin" class="cu-btn lg bg-green text-white">
认证
</button>
</view>
</view>
</view>
<zero-loading v-if="isloading" color="#c1c1c0" type="wobble" mask="true"></zero-loading>
<view class="loginbox">
<view class="logintop flex justify-center align-center">
<image
:src="`${imgPath}static/userui/kncxbj.png`"
style="width: 100px; height: 100px"
/>
</view>
<view class="input-fields padding">
<!-- 输入姓名 -->
<view class="input-item flex align-center">
<text
class="cuIcon-peoplefill"
style="font-size: 20px; color: rgb(173, 173, 175); margin-right: 10px"
></text>
<input v-model="name" placeholder="请输入姓名" />
</view>
<!-- 输入身份证号 -->
<view class="input-item flex align-center">
<text
class="cuIcon-card lg text-gray"
style="font-size: 20px; color: rgb(173, 173, 175); margin-right: 10px"
></text>
<input v-model="idCard" placeholder="请输入身份证号" />
</view>
<!-- 登录按钮 -->
<view class="flex flex-direction loginbotton">
<button @click="phonelogin" class="cu-btn lg bg-green text-white">
认证
</button>
</view>
</view>
</view>
<zero-loading
v-if="isloading"
color="#c1c1c0"
type="wobble"
mask="true"
></zero-loading>
</template>
<script setup>
import {
ref
} from 'vue';
import * as api from '@/utils/api.js';
import {
showModelMessage,jkcBaseDecode,jkcBaseEncode
} from '@/utils/tools.js';
import config from '@/utils/config';
import {
onLoad
} from '@dcloudio/uni-app';
import { ref } from "vue";
import * as api from "@/utils/api.js";
import {
showModelMessage,
jkcBaseDecode,
jkcBaseEncode,
showMessage,
} from "@/utils/tools.js";
import config from "@/utils/config";
import { onLoad } from "@dcloudio/uni-app";
const imgPath = config.imgPath;
const imgPath = config.imgPath;
const isloading = ref(false);
const name = ref(''); //
const idCard = ref(''); //
const countdown = ref(60); // 60
const onLoadData = ref({});
const isloading = ref(false);
const name = ref(""); //
const idCard = ref(""); //
const countdown = ref(60); // 60
const onLoadData = ref({});
const oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
const oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
onLoad((options) => {
if (options['number']) {
onLoadData.value['number'] = options['number']
onLoadData.value['_tbScancodeApproach_'] = options['_tbScancodeApproach_']
};
onLoad((options) => {
if (options["number"]) {
onLoadData.value["number"] = options["number"];
onLoadData.value["_tbScancodeApproach_"] = options["_tbScancodeApproach_"];
}
});
const phonelogin = async () => {
if (!name.value || !idCard.value) {
showModelMessage("姓名和身份证号不能为空");
return;
}
const idCardRegex =
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))((0[1-9])|([12][0-9])|(3[01]))\d{3}(\d|X)$/; //
if (!idCardRegex.test(idCard.value)) {
showModelMessage("请输入有效的身份证号");
return;
}
//
isloading.value = true;
const { userId } = oUser;
const params = {
userId,
name: name.value,
idCard: idCard.value,
};
})
const phonelogin = async () => {
if (!name.value || !idCard.value) {
showModelMessage('姓名和身份证号不能为空');
return;
}
const idCardRegex =
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))((0[1-9])|([12][0-9])|(3[01]))\d{3}(\d|X)$/; //
if (!idCardRegex.test(idCard.value)) {
showModelMessage('请输入有效的身份证号');
return;
}
//
isloading.value = true;
const {
userId
} = oUser;
const params = {
userId,
name: name.value,
idCard: idCard.value
}
api.callOrdereApi("ebikeUser/verifyRealName",params,"post").then(res=>{
const{message,code,data}=res;
if(code!=200){
showModelMessage(message);
return;
}
else{
showModelMessage("认证成功!");
}
isloading.value = false;
oUser.realNameStatus=true;
uni.setStorageSync('wechat_user', jkcBaseEncode(JSON
.stringify(oUser)));
//
uni.navigateTo({
url: "/pages/user/home/home?number=" + onLoadData.value['number'] +
"&_tbScancodeApproach_=" + onLoadData.value[
'_tbScancodeApproach_']
});
})
};
api.callOrdereApi("ebikeUser/verifyRealName", params, "post").then((res) => {
console.log(res);
const { message, code, data } = res;
if (code != 200) {
showModelMessage(message);
return;
} else {
showMessage({
title: "认证成功",
icon: "success",
duration: 500,
});
}
isloading.value = false;
oUser.realNameStatus = true;
uni.setStorageSync("wechat_user", jkcBaseEncode(JSON.stringify(oUser)));
//
setTimeout(() => {
uni.navigateTo({
url:
"/pages/user/home/home?number=" +
onLoadData.value["number"] +
"&_tbScancodeApproach_=" +
onLoadData.value["_tbScancodeApproach_"],
});
}, 500);
});
};
</script>
<style scoped>
.loginbox {
height: 100vh;
background-color: #fff;
}
.loginbox {
height: 100vh;
background-color: #fff;
}
.logintop {
height: 280px;
}
.logintop {
height: 280px;
}
.input-fields {
margin-top: 20px;
}
.input-fields {
margin-top: 20px;
}
.input-item {
height: 45px;
margin-bottom: 30px;
position: relative;
background: rgb(246, 245, 248);
padding: 0px 15px;
border-radius: 20px;
}
.input-item {
height: 45px;
margin-bottom: 30px;
position: relative;
background: rgb(246, 245, 248);
padding: 0px 15px;
border-radius: 20px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.input-field {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.get-code-text {
margin-left: 10px;
color: #4caf50;
font-size: 14px;
width: 40%;
cursor: pointer;
line-height: 40px;
text-align: right;
}
.get-code-text {
margin-left: 10px;
color: #4caf50;
font-size: 14px;
width: 40%;
cursor: pointer;
line-height: 40px;
text-align: right;
}
.get-code-text:disabled {
color: #ccc;
}
.get-code-text:disabled {
color: #ccc;
}
.get-code-text {
cursor: pointer;
}
.get-code-text {
cursor: pointer;
}
.loginbotton {
font-size: 14px;
}
.loginbotton {
font-size: 14px;
}
.is-input-border {
border: none;
}
</style>
.is-input-border {
border: none;
}
</style>

View File

@ -1,168 +1,158 @@
<template>
<view >
<view style="height:60vh">
<map id="mapRef" ref="mapRef" style="width: 100%;height: 60vh;" show-location
:longitude="location.longitude" :latitude="location.latitude" :markers="markers" :scale="scale"
:polyline="polylines" />
</view>
<view v-if="showOrderPay" style="height:30vh">
<bike-pay :orderId="orderData.orderId" />
</view>
</view>
<view>
<view style="height: 60vh">
<map
id="mapRef"
ref="mapRef"
style="width: 100%; height: 60vh"
show-location
:longitude="location.longitude"
:latitude="location.latitude"
:markers="markers"
:scale="scale"
:polyline="polylines"
/>
</view>
<view v-if="showOrderPay" style="height: 30vh">
<bike-pay :orderId="orderData.orderId" />
</view>
</view>
</template>
<script setup>
import {
ref,
onMounted,
getCurrentInstance
} from 'vue';
import {
showModelMessage,
getUrlParams,
jkcBaseDecode
} from "@/utils/tools.js";
import {
callOrdereApi,
callOperateApi
} from "@/utils/api.js";
import { ref, onMounted, getCurrentInstance } from "vue";
import {
showModelMessage,
getUrlParams,
jkcBaseDecode,
} from "@/utils/tools.js";
import { callOrdereApi, callOperateApi } from "@/utils/api.js";
import {
findIndex
} from 'lodash';
import config from '@/utils/config';
import {
onShow,
onUnload,
onLoad
} from "@dcloudio/uni-app";
import * as map from "@/utils/usermap.js";
import { findIndex } from "lodash";
import config from "@/utils/config";
import { onShow, onUnload, onLoad } from "@dcloudio/uni-app";
import * as map from "@/utils/usermap.js";
import AMapWX from "@/utils/amap-wx.130.js";
const location = ref({
longitude: "",
latitude: ""
});
const scale = ref(15);
const markers = ref([]);
const polylines = ref([]); //线
const pointStart = 100000000000;
const pointEnd = 100000000001;
const location = ref({
longitude: "",
latitude: "",
});
const scale = ref(15);
const markers = ref([]);
const polylines = ref([]); //线
const pointStart = 100000000000;
const pointEnd = 100000000001;
let oMap = null;
let oUser = null;
const showOrder = ref(false);
const order = ref({});
onLoad((options) => {
if (options.orderId) {
orderData.orderId = options.orderId;
}
let oMap = null;
let oUser = null;
const showOrder = ref(false);
const order = ref({});
onLoad((options) => {
if (options.orderId) {
orderData.orderId = options.orderId;
}
});
//
let orderData = {
bikeCode: null,
status: null,
createdAt: null,
orderId: null,
};
const showOrderPay = ref(false);
//
let arrBikeData = [];
const bikeData = ref({});
const getInfoOrderData = () => {
callOrdereApi(
"userOrders/orderDetailsInfo?orderId=" + orderData.orderId,
{},
"get"
).then((res) => {
if (res.code == 200) {
orderData = res.data;
getTracking();
}
});
};
})
//
let orderData = {
bikeCode: null,
status: null,
createdAt: null,
orderId: null
};
const showOrderPay = ref(false);
//
let arrBikeData = [];
const bikeData = ref({});
const getInfoOrderData = () => {
callOrdereApi("userOrders/orderDetailsInfo?orderId=" + orderData.orderId, {}, "get").then(res => {
if (res.code == 200) {
orderData = res.data;
getTracking();
}
})
}
//
function openOrderPay() {
showOrderPay.value = true;
}
//
function openOrderPay() {
showOrderPay.value = true;
}
//
function getTracking() {
const { bikeCode, createdAt, ridePoint, returnPoint, endTime } = orderData;
let params = {
ebikeCode: bikeCode,
startTime: createdAt,
};
if (endTime)
params = {
...params,
endTime,
};
//
function getTracking() {
const {
bikeCode,
createdAt,
ridePoint,
returnPoint,
endTime
} = orderData;
let params = {
ebikeCode: bikeCode,
startTime: createdAt
}
if (endTime) params = {
...params,
endTime
}
callOperateApi("ebikeTracking/query", params, "post").then(res => {
const {
code,
data,
message
} = res;
if (code != 200) {
return;
}
const arrPoints = (!data || data.length == 0) ? [] : data.map(item => {
const {
lngGCJ02,
latGCJ02
} = item;
return {
longitude: lngGCJ02,
latitude: latGCJ02
}
});
console.log(params, "params");
const startPoint = ridePoint.split(",");
const lng = startPoint[0];
const lat = startPoint[1];
const start = {
longitude: lng,
latitude: lat
}
location.value.latitude = lat;
location.value.longitude = lng;
const arrMakers = markers.value || [];
arrPoints.splice(0, 0, start);
let indexStart = findIndex(arrMakers, {
pointStart
});
indexStart = indexStart == -1 ? arrMakers.length : indexStart;
arrMakers[indexStart] = map.addMarker(pointStart, lng, lat, "start.png");
if (data && data.length > 0) {
let {
lngGCJ02: endlng,
latGCJ02: endlat
} = data[data.length - 1];
arrMakers[indexStart + 1] = map.addMarker(pointEnd, endlng, endlat, "end.png");
}
markers.value = arrMakers;
if (arrPoints.length > 1) {
polylines.value = [map.addLine("#168DED", arrPoints)];
}
})
}
onMounted(() => {
const instance = getCurrentInstance();
oMap = uni.createMapContext("mapRef", {
this: instance.proxy
});
getInfoOrderData();
openOrderPay();
})
callOperateApi("ebikeTracking/query", params, "post").then((res) => {
const { code, data, message } = res;
if (code != 200) {
return;
}
const arrPoints =
!data || data.length == 0
? []
: data.map((item) => {
const { lngGCJ02, latGCJ02 } = item;
return {
longitude: lngGCJ02,
latitude: latGCJ02,
};
});
const startPoint = ridePoint.split(",");
const lng = startPoint[0];
const lat = startPoint[1];
const start = {
longitude: lng,
latitude: lat,
};
location.value.latitude = lat;
location.value.longitude = lng;
const arrMakers = markers.value || [];
arrPoints.splice(0, 0, start);
let indexStart = findIndex(arrMakers, {
pointStart,
});
indexStart = indexStart == -1 ? arrMakers.length : indexStart;
arrMakers[indexStart] = map.addMarker(pointStart, lng, lat, "start.png");
if (data && data.length > 0) {
let { lngGCJ02: endlng, latGCJ02: endlat } = data[data.length - 1];
arrMakers[indexStart + 1] = map.addMarker(
pointEnd,
endlng,
endlat,
"end.png"
);
}
markers.value = arrMakers;
if (arrPoints.length > 1) {
polylines.value = [map.addLine("#168DED", arrPoints)];
}
});
}
onMounted(() => {
const instance = getCurrentInstance();
oMap = uni.createMapContext("mapRef", {
this: instance.proxy,
});
getInfoOrderData();
openOrderPay();
});
</script>
<style scoped>
</style>
<style scoped></style>

View File

@ -7,9 +7,11 @@ import {
getUrlParams
} from './tools';
export const HttpRequest = function(url, method, data) {
export const HttpRequest = function (url, method, data) {
return new Promise((resolve, reject) => {
const token = getCache('token');
console.log(token, 'token');
let _header = {}
if (url.includes("/auth/loginByPwd") || url.includes("/auth/logout")) {
_header = {
@ -39,7 +41,7 @@ export const HttpRequest = function(url, method, data) {
url = nurl;
} else {
let nurl = url;
if(data){
if (data) {
if (Object.keys(data).length > 0) {
nurl = url + "?";
}
@ -95,25 +97,25 @@ export const HttpRequest = function(url, method, data) {
}
export const HttpFileUpload = function(url,file) {
export const HttpFileUpload = function (url, file) {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: url ,
filePath: file.path, // 选择的文件路径
name: 'multipartFile', // 后端接收文件时的字段名,通常是 'file'
formData: {
},
success: (res) => {
if (res.statusCode == 200) { //成功
resolve(JSON.parse(res.data));
} else { //失败
reject(res);
}
},
fail: (err) => {
console.log('上传失败:', err);
}
});
uni.uploadFile({
url: url,
filePath: file.path, // 选择的文件路径
name: 'multipartFile', // 后端接收文件时的字段名,通常是 'file'
formData: {
},
success: (res) => {
if (res.statusCode == 200) { //成功
resolve(JSON.parse(res.data));
} else { //失败
reject(res);
}
},
fail: (err) => {
console.log('上传失败:', err);
}
});
})
}

View File

@ -97,6 +97,11 @@ export function addOrder(bikeCode, jumpFlag, callback) {
}
function saveRide(params, icnt, jumpFlag, callback) {
if (icnt === 1) {
uni.showLoading({
title: '正在处理中...',
});
}
callOrdereApi("userOrders/saveRide", params, "post").then(res => {
const {
code,
@ -108,9 +113,11 @@ function saveRide(params, icnt, jumpFlag, callback) {
return;
}
showModelMessage(message);
uni.hideLoading()
if (callback) callback(false);
return;
}
uni.hideLoading()
if (callback) callback(true);
if (jumpFlag) {
setTimeout(() => {
@ -119,7 +126,11 @@ function saveRide(params, icnt, jumpFlag, callback) {
})
}, 1000)
}
})
}).catch(err => {
uni.hideLoading();
showModelMessage("服务异常,请稍后再试");
if (callback) callback(false);
});
}
//添加面