登录获取头像增加头像上传接口
This commit is contained in:
parent
88be2b5c5a
commit
46acabc67b
@ -34,6 +34,7 @@
|
|||||||
</label>
|
</label>
|
||||||
支付
|
支付
|
||||||
</div>
|
</div>
|
||||||
|
<view class="cu-btn" @click="gotoRefundRequest">退款</view>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -93,6 +94,8 @@
|
|||||||
showModelMessage("支付失败")
|
showModelMessage("支付失败")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
showModelMessage("支付失败")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -117,6 +120,12 @@
|
|||||||
url: "/pages/user/home/home"
|
url: "/pages/user/home/home"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gotoRefundRequest=()=>{
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/user/views/PaymentFeedback?orderId="+props.orderId
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -86,6 +86,11 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "申请还车记录"
|
"navigationBarTitleText": "申请还车记录"
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"path": "userphtoinfo",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "设置头像"
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -114,6 +119,11 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "微信支付反馈"
|
"navigationBarTitleText": "微信支付反馈"
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"path": "RefundRequest",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "退款申请"
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,7 +128,7 @@
|
|||||||
else isScrollY.value = false
|
else isScrollY.value = false
|
||||||
}
|
}
|
||||||
const selectImg = (data) => {
|
const selectImg = (data) => {
|
||||||
const file = data.tempFiles[0];
|
const file = data.tempFiles[0];
|
||||||
api.fileUploadUser(file).then(res => {
|
api.fileUploadUser(file).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
fileLists.value.push(res.data)
|
fileLists.value.push(res.data)
|
||||||
|
|||||||
101
ebike-user/pages/user/login/userphtoinfo.vue
Normal file
101
ebike-user/pages/user/login/userphtoinfo.vue
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<template>
|
||||||
|
<view class="flex justify-center margin">
|
||||||
|
<button class="balanced" type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar">
|
||||||
|
<image class="avatar" :src="avatarUrl"></image>
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
<view class="cu-form-group boxtwo">
|
||||||
|
<view class="title">昵称</view>
|
||||||
|
<input class="weui-input" type='nickname' name='nickname' v-model="nickname" placeholder="请输入昵称">
|
||||||
|
</view>
|
||||||
|
<view class="padding flex flex-direction">
|
||||||
|
<button @click="gotoLogin" class="cu-btn bg-green lg">完成</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
onMounted
|
||||||
|
} from 'vue';
|
||||||
|
import * as api from '@/utils/api.js';
|
||||||
|
import config from '@/utils/config';
|
||||||
|
import {
|
||||||
|
showModelMessage,
|
||||||
|
jkcBaseEncode,
|
||||||
|
jkcBaseDecode
|
||||||
|
} from '@/utils/tools.js';
|
||||||
|
const imgPath = config.imgPath;
|
||||||
|
const nickname = ref("");
|
||||||
|
const avatarUrl = ref(`${imgPath}static/userui/wxtouxiang.png`);
|
||||||
|
// 选择头像
|
||||||
|
const onChooseavatar = (e) => {
|
||||||
|
console.log("微信头像信息:", e);
|
||||||
|
const paramsfile = {
|
||||||
|
"path": e.detail.avatarUrl
|
||||||
|
}
|
||||||
|
api.fileUploadUserPicture(paramsfile).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
avatarUrl.value = res.data.url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const gotoLogin = () => {
|
||||||
|
let wechat_user = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
|
||||||
|
if (!nickname.value) {
|
||||||
|
showModelMessage("请填写昵称!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const params = {
|
||||||
|
"userId": wechat_user.userId,
|
||||||
|
"avatar": avatarUrl.value,
|
||||||
|
"nickname": nickname.value,
|
||||||
|
}
|
||||||
|
api.callOrdereApi("ebikeUser/update", params);
|
||||||
|
api.callOrdereApi("ebikeUser/getInfo?id=" + wechat_user.userId, {},
|
||||||
|
"get")
|
||||||
|
.then((info) => {
|
||||||
|
if (info.code == 200) {
|
||||||
|
uni.setStorageSync('wechat_user', jkcBaseEncode(JSON
|
||||||
|
.stringify(info.data)));
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/user/home/home"
|
||||||
|
})
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.avatar-wrapper {
|
||||||
|
padding: 0;
|
||||||
|
width: 56px !important;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-top: 40px;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: block;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balanced {
|
||||||
|
background-color: rgba(0, 0, 0, 0);
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.boxtwo {
|
||||||
|
|
||||||
|
margin-top: 10px;
|
||||||
|
border-top: solid 1px #e6e6e6;
|
||||||
|
border-bottom: solid 1px #e6e6e6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -51,7 +51,9 @@
|
|||||||
import * as api from '@/utils/api.js';
|
import * as api from '@/utils/api.js';
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
import {
|
import {
|
||||||
showModelMessage,jkcBaseEncode,jkcBaseDecode
|
showModelMessage,
|
||||||
|
jkcBaseEncode,
|
||||||
|
jkcBaseDecode
|
||||||
} from '@/utils/tools.js';
|
} from '@/utils/tools.js';
|
||||||
const imgPath = config.imgPath;
|
const imgPath = config.imgPath;
|
||||||
const isAgreed = ref([]); // 用来控制复选框的选中状态
|
const isAgreed = ref([]); // 用来控制复选框的选中状态
|
||||||
@ -91,10 +93,11 @@
|
|||||||
.then((info) => {
|
.then((info) => {
|
||||||
isloading.value = false;
|
isloading.value = false;
|
||||||
if (info.code == 200) {
|
if (info.code == 200) {
|
||||||
uni.setStorageSync('wechat_user', jkcBaseEncode(JSON.stringify(info.data)));
|
uni.setStorageSync('wechat_user', jkcBaseEncode(JSON
|
||||||
|
.stringify(info.data)));
|
||||||
phone.value = info.data.mobile;
|
phone.value = info.data.mobile;
|
||||||
if (!info.data.nickname) {
|
if (!info.data.nickname) {
|
||||||
updateUserProfile();
|
// updateUserProfile();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let params = {
|
let params = {
|
||||||
@ -103,11 +106,12 @@
|
|||||||
}
|
}
|
||||||
api.callOrdereApi("ebikeUser/save", params).then(
|
api.callOrdereApi("ebikeUser/save", params).then(
|
||||||
re => {
|
re => {
|
||||||
if (re.code == 200) {
|
if (re.code == 200) {
|
||||||
params.userId = re.data;
|
params.userId = re.data;
|
||||||
uni.setStorageSync('wechat_user',
|
uni.setStorageSync('wechat_user',
|
||||||
jkcBaseEncode(JSON.stringify(params)));
|
jkcBaseEncode(JSON.stringify(
|
||||||
updateUserProfile();
|
params)));
|
||||||
|
// updateUserProfile();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -206,7 +210,7 @@
|
|||||||
|
|
||||||
// 判断账号是否已经注销
|
// 判断账号是否已经注销
|
||||||
const isAccountDeactivated = () => {
|
const isAccountDeactivated = () => {
|
||||||
let wechat_user =JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
|
let wechat_user = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
|
||||||
if (wechat_user && wechat_user.status == -1) {
|
if (wechat_user && wechat_user.status == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -219,12 +223,24 @@
|
|||||||
showModelMessage("您的账户已经注销,请联系管理员!");
|
showModelMessage("您的账户已经注销,请联系管理员!");
|
||||||
} else {
|
} else {
|
||||||
// 调用 wx.login 获取登录凭证 code
|
// 调用 wx.login 获取登录凭证 code
|
||||||
|
|
||||||
|
//如果头像为空 弹出设置头像页面
|
||||||
login();
|
login();
|
||||||
setTimeout(() => {
|
let wechat_user = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
|
||||||
uni.navigateTo({
|
if (!wechat_user.avatar) {
|
||||||
url: "/pages/user/home/home"
|
setTimeout(() => {
|
||||||
})
|
uni.navigateTo({
|
||||||
}, 500);
|
url: "/pages/user/login/userphtoinfo"
|
||||||
|
})
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/user/home/home"
|
||||||
|
})
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
<!-- 用户信息区域 -->
|
<!-- 用户信息区域 -->
|
||||||
<view class="user-info padding">
|
<view class="user-info padding">
|
||||||
<view class="user-avatar">
|
<view class="user-avatar">
|
||||||
<image :src="`${imgPath}static/userui/tx.png`" mode="aspectFill"></image><!-- 头像 -->
|
<image :src="wechat_user.avatar" mode="aspectFill"></image><!-- 头像 -->
|
||||||
</view>
|
</view>
|
||||||
<view class="user-details">
|
<view class="user-details">
|
||||||
<view class="nickname">昵称</view>
|
<view class="nickname">{{wechat_user.nickname}}</view>
|
||||||
<view class="phone-number">182****7183</view>
|
<view class="phone-number">{{ hidePhoneNumber(wechat_user.mobile) }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -34,8 +34,33 @@
|
|||||||
ref
|
ref
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
import {
|
||||||
|
showModelMessage,
|
||||||
|
jkcBaseEncode,
|
||||||
|
jkcBaseDecode
|
||||||
|
} from '@/utils/tools.js';
|
||||||
const imgPath = config.imgPath;
|
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")));
|
||||||
|
|
||||||
|
})
|
||||||
|
// 隐藏电话号码中间部分
|
||||||
|
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([{
|
const menuItems = ref([{
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
<view class="bike-fee-card">
|
<view class="bike-fee-card">
|
||||||
<view class="fee-row flex justify-between">
|
<view class="fee-row flex justify-between">
|
||||||
<view class="fee-label">
|
<view class="fee-label">
|
||||||
单车费用
|
订单编号
|
||||||
</view>
|
</view>
|
||||||
<view class="fee-amount">
|
<view class="fee-amount">
|
||||||
2025-04-14 19:26:15
|
{{orderId}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fee-row flex justify-between">
|
<view class="fee-row flex justify-between">
|
||||||
@ -14,7 +14,7 @@
|
|||||||
骑行费用
|
骑行费用
|
||||||
</view>
|
</view>
|
||||||
<view class="fee-amount">
|
<view class="fee-amount">
|
||||||
1.5元
|
{{data.totalAmount}}元
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -28,8 +28,8 @@
|
|||||||
骑行费问题
|
骑行费问题
|
||||||
</view>
|
</view>
|
||||||
<view class="button-group flex justify-between">
|
<view class="button-group flex justify-between">
|
||||||
<view class="button-with-border">
|
<view class="button-with-border" @click="gotoRefundRequest">
|
||||||
调度费申诉
|
申请退款
|
||||||
</view>
|
</view>
|
||||||
<view class="button-with-border">
|
<view class="button-with-border">
|
||||||
已关锁仍计费
|
已关锁仍计费
|
||||||
@ -42,7 +42,38 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
onMounted
|
||||||
|
} from 'vue';
|
||||||
|
import * as api from '@/utils/api.js';
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
|
||||||
|
const orderId = ref('');
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
orderId.value = options.orderId;
|
||||||
|
})
|
||||||
|
const data=ref({})
|
||||||
|
onMounted(() => {
|
||||||
|
getInfoOrderData();
|
||||||
|
})
|
||||||
|
const getInfoOrderData = () => {
|
||||||
|
api.callOrdereApi("userOrders/orderDetailsInfo?orderId=" + orderId.value, {}, "get").then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
data.value = res.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const gotoRefundRequest=()=>{
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/user/views/RefundRequest?orderId="+orderId.value
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
124
ebike-user/pages/user/views/RefundRequest.vue
Normal file
124
ebike-user/pages/user/views/RefundRequest.vue
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container">
|
||||||
|
<text class="title">退款申请</text>
|
||||||
|
<form>
|
||||||
|
<!-- 订单编号 -->
|
||||||
|
<view class="form-group">
|
||||||
|
<text class="label">订单编号</text>
|
||||||
|
<uni-easyinput v-model="orderId" :disabled="true" />
|
||||||
|
</view>
|
||||||
|
<!-- 退款原因 -->
|
||||||
|
<view class="form-group">
|
||||||
|
<text class="label">退款原因</text>
|
||||||
|
<textarea v-model="reason" placeholder="请输入退款原因" class="textarea" required />
|
||||||
|
</view>
|
||||||
|
<!-- 申请退款按钮 -->
|
||||||
|
<view class="padding flex flex-direction">
|
||||||
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="submitRefund">申请退款</button>
|
||||||
|
</view>
|
||||||
|
</form>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from "@dcloudio/uni-app";
|
||||||
|
import * as api from '@/utils/api.js';
|
||||||
|
import {
|
||||||
|
showModelMessage
|
||||||
|
} from "@/utils/tools.js";
|
||||||
|
|
||||||
|
const orderId = ref(''); // 假设订单编号是静态的
|
||||||
|
const reason = ref(''); // 退款原因
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
orderId.value = options.orderId;
|
||||||
|
})
|
||||||
|
|
||||||
|
// 处理表单提交
|
||||||
|
const submitRefund = () => {
|
||||||
|
if (!reason.value.trim()) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请填写退款原因',
|
||||||
|
icon: 'none',
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const params = {
|
||||||
|
"orderId": orderId.value,
|
||||||
|
"reason": reason.value
|
||||||
|
}
|
||||||
|
api.callPaymentApi("wxPayment/refund", params).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
// 显示退款成功的提示
|
||||||
|
uni.showToast({
|
||||||
|
title: '退款成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000 // 提示显示的时长
|
||||||
|
});
|
||||||
|
|
||||||
|
// 提示结束后,调整首页
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/user/home/home"
|
||||||
|
})
|
||||||
|
}, 2000); // 延迟时间与提示时间相同
|
||||||
|
} else {
|
||||||
|
showModelMessage("退款失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 20px;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input,
|
||||||
|
.textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.textarea {
|
||||||
|
height: 100px;
|
||||||
|
resize: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
background-color: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -31,3 +31,7 @@ export const callEbikeInfo = (url, parmas = {}, method = 'post') => {
|
|||||||
export const fileUploadUser = (file) => {
|
export const fileUploadUser = (file) => {
|
||||||
return HttpFileUpload(baseUrl + "order/ebikeOrdersSystem/fileUpload", file);
|
return HttpFileUpload(baseUrl + "order/ebikeOrdersSystem/fileUpload", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const fileUploadUserPicture = (file) => {
|
||||||
|
return HttpFileUpload(baseUrl + "order/ebikeOrdersSystem/fileUploadUserPicture", file);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user