登录获取头像增加头像上传接口
This commit is contained in:
parent
88be2b5c5a
commit
46acabc67b
@ -34,6 +34,7 @@
|
||||
</label>
|
||||
支付
|
||||
</div>
|
||||
<view class="cu-btn" @click="gotoRefundRequest">退款</view>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -93,6 +94,8 @@
|
||||
showModelMessage("支付失败")
|
||||
}
|
||||
})
|
||||
}else{
|
||||
showModelMessage("支付失败")
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -117,6 +120,12 @@
|
||||
url: "/pages/user/home/home"
|
||||
})
|
||||
}
|
||||
|
||||
const gotoRefundRequest=()=>{
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/views/PaymentFeedback?orderId="+props.orderId
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -86,6 +86,11 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "申请还车记录"
|
||||
}
|
||||
}, {
|
||||
"path": "userphtoinfo",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置头像"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -114,6 +119,11 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "微信支付反馈"
|
||||
}
|
||||
},{
|
||||
"path": "RefundRequest",
|
||||
"style": {
|
||||
"navigationBarTitleText": "退款申请"
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
||||
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 config from '@/utils/config';
|
||||
import {
|
||||
showModelMessage,jkcBaseEncode,jkcBaseDecode
|
||||
showModelMessage,
|
||||
jkcBaseEncode,
|
||||
jkcBaseDecode
|
||||
} from '@/utils/tools.js';
|
||||
const imgPath = config.imgPath;
|
||||
const isAgreed = ref([]); // 用来控制复选框的选中状态
|
||||
@ -91,10 +93,11 @@
|
||||
.then((info) => {
|
||||
isloading.value = false;
|
||||
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;
|
||||
if (!info.data.nickname) {
|
||||
updateUserProfile();
|
||||
// updateUserProfile();
|
||||
}
|
||||
} else {
|
||||
let params = {
|
||||
@ -106,8 +109,9 @@
|
||||
if (re.code == 200) {
|
||||
params.userId = re.data;
|
||||
uni.setStorageSync('wechat_user',
|
||||
jkcBaseEncode(JSON.stringify(params)));
|
||||
updateUserProfile();
|
||||
jkcBaseEncode(JSON.stringify(
|
||||
params)));
|
||||
// updateUserProfile();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -219,13 +223,25 @@
|
||||
showModelMessage("您的账户已经注销,请联系管理员!");
|
||||
} else {
|
||||
// 调用 wx.login 获取登录凭证 code
|
||||
|
||||
//如果头像为空 弹出设置头像页面
|
||||
login();
|
||||
let wechat_user = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
|
||||
if (!wechat_user.avatar) {
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
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-avatar">
|
||||
<image :src="`${imgPath}static/userui/tx.png`" mode="aspectFill"></image><!-- 头像 -->
|
||||
<image :src="wechat_user.avatar" mode="aspectFill"></image><!-- 头像 -->
|
||||
</view>
|
||||
<view class="user-details">
|
||||
<view class="nickname">昵称</view>
|
||||
<view class="phone-number">182****7183</view>
|
||||
<view class="nickname">{{wechat_user.nickname}}</view>
|
||||
<view class="phone-number">{{ hidePhoneNumber(wechat_user.mobile) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -34,8 +34,33 @@
|
||||
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")));
|
||||
|
||||
})
|
||||
// 隐藏电话号码中间部分
|
||||
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([{
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
<view class="bike-fee-card">
|
||||
<view class="fee-row flex justify-between">
|
||||
<view class="fee-label">
|
||||
单车费用
|
||||
订单编号
|
||||
</view>
|
||||
<view class="fee-amount">
|
||||
2025-04-14 19:26:15
|
||||
{{orderId}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="fee-row flex justify-between">
|
||||
@ -14,7 +14,7 @@
|
||||
骑行费用
|
||||
</view>
|
||||
<view class="fee-amount">
|
||||
1.5元
|
||||
{{data.totalAmount}}元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -28,8 +28,8 @@
|
||||
骑行费问题
|
||||
</view>
|
||||
<view class="button-group flex justify-between">
|
||||
<view class="button-with-border">
|
||||
调度费申诉
|
||||
<view class="button-with-border" @click="gotoRefundRequest">
|
||||
申请退款
|
||||
</view>
|
||||
<view class="button-with-border">
|
||||
已关锁仍计费
|
||||
@ -42,7 +42,38 @@
|
||||
|
||||
</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>
|
||||
|
||||
<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) => {
|
||||
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