first commit
This commit is contained in:
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<view style=" padding: 20rpx 40rpx; background-color: #fff; ">
|
||||
<up-form v-if="type!=='1'" labelPosition="left" labelWidth='90' :model="userData" ref="form1">
|
||||
<up-form-item label="姓名:" prop="userInfo.name" :borderBottom="true" ref="item1">
|
||||
<up-input inputAlign='right' v-model="userData.name" clearable='true' placeholder="请输入联系人姓名"
|
||||
border="none"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="手机号:" prop="userInfo.name" :borderBottom="true" ref="item1">
|
||||
<up-input inputAlign='right' v-model="userData.phone" clearable='true' placeholder="请输入手机号"
|
||||
border="none"></up-input>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
<up-form v-else labelPosition="left" labelWidth='90' :model="password" ref="form1">
|
||||
|
||||
<up-form-item label="手机号:" prop="userInfo.name" :borderBottom="true" ref="item1">
|
||||
<up-input clearable='true' v-model="password.phone" placeholder="请输入手机号" border="none"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="验证码:" prop="userInfo.name" :borderBottom="true" ref="item1">
|
||||
<up-input clearable='true' v-model="password.code" placeholder="请输入验证码" border="none">
|
||||
<template #suffix>
|
||||
<up-code :seconds="seconds" @end="end" @start="start" ref="uCodeRef"
|
||||
@change="codeChange"></up-code>
|
||||
<up-button @tap="getCode">{{tips}}</up-button>
|
||||
</template>
|
||||
</up-input>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
</view>
|
||||
<view class="" style=" position: fixed; bottom: 0; left: 0; width: 100%; padding: 20rpx; ">
|
||||
<button @click="save()" class="logout-btn">确认修改</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { ref } from "vue";
|
||||
import { Service } from "../../Service/Service";
|
||||
import { CNRiderDataService } from '@/Service/CN/CNRiderDataService'
|
||||
import { CNRiderLoginService } from '@/Service/CN/CNRiderLoginService'
|
||||
|
||||
const tips = ref('');
|
||||
const seconds = ref(60);
|
||||
const uCodeRef = ref(null);
|
||||
|
||||
let password = ref({
|
||||
phone: '',
|
||||
code: ''
|
||||
})
|
||||
|
||||
let userData = ref({
|
||||
name: '',
|
||||
phone: ''
|
||||
})
|
||||
|
||||
let type = ref('')
|
||||
onLoad((data : any) => {
|
||||
if (data.type === '1') {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '修改手机号'
|
||||
})
|
||||
}
|
||||
type.value = data.type
|
||||
console.log(type.value);
|
||||
getData()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
});
|
||||
|
||||
const getData = () => {
|
||||
CNRiderDataService.GetRiderExigency().then(res => {
|
||||
if (res.code == 0) {
|
||||
if (res.data.info) {
|
||||
userData.value = res.data.info
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const save = () => {
|
||||
if (type.value === '0') {
|
||||
if (!userData.value.name) {
|
||||
Service.Msg('请输入联系人姓名!')
|
||||
return
|
||||
}
|
||||
if (!userData.value.phone) {
|
||||
Service.Msg('请输入联系人手机号!')
|
||||
return
|
||||
}
|
||||
if (userData.value.phone.split('').length !== 11) {
|
||||
Service.Msg('请输入正确手机号!')
|
||||
return
|
||||
}
|
||||
|
||||
CNRiderDataService.AddRiderExigency(userData.value.name, userData.value.phone).then(res => {
|
||||
if (res.data) {
|
||||
Service.Msg('添加成功!')
|
||||
setTimeout(() => {
|
||||
Service.GoPageBack()
|
||||
}, 1000)
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (!password.value.phone) {
|
||||
Service.Msg('请输入手机号!')
|
||||
return
|
||||
}
|
||||
if (password.value.phone.split('').length !== 11) {
|
||||
Service.Msg('请输入正确手机号!')
|
||||
return
|
||||
}
|
||||
if (!password.value.code) {
|
||||
Service.Msg('请输入验证码!')
|
||||
return
|
||||
}
|
||||
CNRiderLoginService.UpdateRiderPhone(password.value.phone, password.value.code).then(res => {
|
||||
if (res.data) {
|
||||
Service.Msg('修改成功!')
|
||||
setTimeout(() => {
|
||||
Service.GoPageBack()
|
||||
}, 1000)
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
const codeChange = (text) => {
|
||||
tips.value = text;
|
||||
};
|
||||
|
||||
const getCode = () => {
|
||||
|
||||
if (uCodeRef.value.canGetCode) {
|
||||
// 模拟向后端请求验证码
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码',
|
||||
});
|
||||
CNRiderLoginService.SendUserSms(password.value.phone, 'RiderUpPhone').then(res => {
|
||||
if (res.code == 0) {
|
||||
uni.hideLoading();
|
||||
// 这里此提示会被start()方法中的提示覆盖
|
||||
Service.Msg('验证码已发送')
|
||||
uCodeRef.value.start();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Service.Msg('倒计时结束后再发送')
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
const end = () => {
|
||||
|
||||
};
|
||||
|
||||
const start = () => {
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
background-color: var(--nav-mian);
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
border-radius: 60rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
font-size: 30rpx;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<web-view ref="webviewRef" v-if="isshow" :src="url" @message="handleMessage" @logData = "logData"></web-view>
|
||||
|
||||
<!-- ✅ 新增:一个绝对定位的遮罩层,用于在刷新时覆盖 web-view -->
|
||||
<view v-else class="reloading-mask">
|
||||
<up-loading-icon text="正在获取订单状态..." v-if="orderOver" textSize="16"></up-loading-icon>
|
||||
|
||||
<up-loading-icon text="订单已完成" v-else textSize="16"></up-loading-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { Service } from "@/Service/Service";
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { CNRiderOrderService } from '@/Service/CN/CNRiderOrderService'
|
||||
|
||||
let orderId = ref<string>('')
|
||||
let url = ref<string>('')
|
||||
let isshow = ref<false>(false)
|
||||
|
||||
let orderInfo = ref<any>({
|
||||
isFood: 0
|
||||
})
|
||||
|
||||
let riderOrder = ref<any>({
|
||||
status:0
|
||||
})
|
||||
|
||||
let orderOver = ref<true>(false)
|
||||
|
||||
onLoad((data) => {
|
||||
if (data.orderId) {
|
||||
orderId.value = data.orderId
|
||||
getData()
|
||||
} else {
|
||||
Service.Msg('为获取到订单ID')
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化url
|
||||
const getUrl = () => {
|
||||
isshow.value = false
|
||||
url.value = 'https://hmjz.327gzs.top?orderId=' + orderId.value + '&isFood=' + riderOrder.value.status
|
||||
isshow.value = true
|
||||
}
|
||||
|
||||
|
||||
const getData = () => {
|
||||
CNRiderOrderService.GetUnitOrderInfo(orderId.value).then(res => {
|
||||
if (res.code==0) {
|
||||
orderInfo.value = res.data.orderInfo
|
||||
riderOrder.value = res.data.riderOrder
|
||||
getUrl()
|
||||
|
||||
}else{
|
||||
Service.Msg(res.mgs)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 点击完成送餐取餐调用
|
||||
const handleMessage = (data) => {
|
||||
|
||||
let preat = data.detail.data[0]
|
||||
if(preat.action =='message'){
|
||||
if (riderOrder.value.status == 0) {
|
||||
// 去商家、取餐
|
||||
pickFood(1)
|
||||
} else {
|
||||
// 去用户,送餐
|
||||
pickFood(2)
|
||||
}
|
||||
}else if(preat.action =='logData'){
|
||||
CNRiderOrderService.UpdateRiderLocation(preat.data[0],preat.data[1]).then(res=>{
|
||||
if(res.code==0){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
// 骑手定位
|
||||
const logData = (data) =>{
|
||||
console.log(data,'骑手定位')
|
||||
}
|
||||
|
||||
// 取餐
|
||||
const pickFood = ( type:number) => {
|
||||
CNRiderOrderService.UpdateRiderOrderTake(orderId.value, type).then(res => {
|
||||
if (res.data) {
|
||||
Service.Msg(type==1?'取餐成功':'订单完成')
|
||||
setTimeout(()=>{Service.GoPageTab('/pages/index/index')},500)
|
||||
getData()
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.reloading-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #f7f7f7; // 使用页面底色
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
10661
.svn/pristine/39/39b8e7d2b5fa559692b43fcaf6bcae3ac88317ea.svn-base
Normal file
10661
.svn/pristine/39/39b8e7d2b5fa559692b43fcaf6bcae3ac88317ea.svn-base
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,331 @@
|
||||
import { HttpRequest, StoreAssist, UploadAssist, ResultData } from '@/common/Common';
|
||||
import { BaseConfig } from './BaseConfig';
|
||||
export class Service extends BaseConfig {
|
||||
//获取API地址
|
||||
static ApiUrl(path : string) {
|
||||
return `${this.servesUrl}${path}`;
|
||||
}
|
||||
|
||||
//获取图片地址
|
||||
static GetpayImg(path : string) {
|
||||
if (path.startsWith('http') || path.startsWith('https')) {
|
||||
return path;
|
||||
} else {
|
||||
return `${this.payuploadUrl}${path}`;
|
||||
}
|
||||
}
|
||||
|
||||
//获取图标地址
|
||||
static GetIconImg(path : string) {
|
||||
return path
|
||||
if (path.startsWith('http') || path.startsWith('https')) {
|
||||
return path;
|
||||
} else {
|
||||
return `${this.imgUrl}${path}`;
|
||||
}
|
||||
}
|
||||
|
||||
//获取图片地址
|
||||
static GetMateUrlByImg(path : string) {
|
||||
return path
|
||||
if (path.startsWith('http') || path.startsWith('https')) {
|
||||
return path;
|
||||
} else {
|
||||
return `${this.imgUrl}${path}`;
|
||||
}
|
||||
}
|
||||
//获取音视频地址
|
||||
static GetMateUrlByMedia(path : string) {
|
||||
if (path.startsWith('http') || path.startsWith('https')) {
|
||||
return path;
|
||||
} else {
|
||||
return `${this.mediaUrl}${path}`;
|
||||
}
|
||||
}
|
||||
//获取登录账号token
|
||||
static GetUserToken() {
|
||||
return Service.GetStorageCache('token');
|
||||
}
|
||||
// 获取登录状态
|
||||
static GetUserIsLogin() {
|
||||
var token = this.GetUserToken();
|
||||
if (token == null || token == '') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//设置登录账户Token
|
||||
static SetUserToken(token : string) {
|
||||
this.SetStorageCache('token', token);
|
||||
}
|
||||
//清理登录账户Token
|
||||
static OffUserToken() {
|
||||
Service.DelStorageCache('token');
|
||||
uni.$emit('ImComOff', 'user');
|
||||
this.ClearUserStateData();
|
||||
}
|
||||
//获取登录账号状态信息
|
||||
static GetUserStateData() {
|
||||
return Service.GetStorageCache('StateDomain');
|
||||
}
|
||||
//设置当前登录账号状态信息
|
||||
static SetUserStateData() {
|
||||
return Service.GetStorageCache('StateDomain');
|
||||
}
|
||||
//清理当前登录账号状态信息
|
||||
static ClearUserStateData() {
|
||||
Service.DelStorageCache('StateDomain');
|
||||
}
|
||||
|
||||
//获取缓存
|
||||
static GetStorageCache(key : string) {
|
||||
return StoreAssist.Get(key);
|
||||
}
|
||||
//删除缓存
|
||||
static DelStorageCache(key : string) {
|
||||
StoreAssist.Delete(key);
|
||||
}
|
||||
//设置缓存
|
||||
static SetStorageCache(key : string, data : any) {
|
||||
StoreAssist.Set(key, data);
|
||||
}
|
||||
|
||||
/*****以下是基础方法调用与拦截器*****/
|
||||
|
||||
static Request(url : string, method : 'GET' | 'POST' | 'PUT' | undefined, data : object | any) {
|
||||
const token = Service.GetUserToken();
|
||||
|
||||
const _url = Service.ApiUrl(url);
|
||||
var result = HttpRequest.RequestWithToken(_url, method, token, data).then((retResult : any) => {
|
||||
if (retResult.statusCode == '200') {
|
||||
var obj = retResult.data;
|
||||
if (obj.code == 401) {
|
||||
//过期
|
||||
this.OffUserToken();
|
||||
this.Msg('登录过期,请重新登录')
|
||||
this.GoPage('/pages/login/login')
|
||||
return Promise.reject();
|
||||
} else if (obj.code == 40101) {
|
||||
//失效
|
||||
this.OffUserToken();
|
||||
this.GoPageDelse('/pages/mine/login/login');
|
||||
return Promise.reject();
|
||||
} else if (obj.code == 1004) {
|
||||
//资源不存在
|
||||
this.GoPageDelse('/pages/AppSet/404/404');
|
||||
return Promise.reject();
|
||||
// return new ResultData(-1, '', '');
|
||||
} else if (obj.code == 40188) {
|
||||
//无权限
|
||||
|
||||
this.GoPageDelse('/pages/AppSet/40188/40188');
|
||||
return Promise.reject();
|
||||
// return new ResultData(-1, '', '');
|
||||
} else if (obj.code == 1008) {
|
||||
//业务提示
|
||||
return new ResultData(obj.code, obj.msg, obj.data);
|
||||
} else {
|
||||
return new ResultData(obj.code, obj.msg, obj.data);
|
||||
}
|
||||
} else {
|
||||
return new ResultData(-1, '', '');
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/*****以下是腾讯云oss上传*****/
|
||||
static UpLoadMedia(code : string, fileName : string, desire : string, path : string) {
|
||||
var result = this.Request(this.uploadUrl, 'GET', { code, fileName, desire }).then((retResult) => {
|
||||
if (retResult.code == 0) {
|
||||
var upOk = UploadAssist.Upload(retResult.data.url, path, retResult.data.cosData).then((upRet : any) => {
|
||||
if (upRet.statusCode == 200) {
|
||||
const retData : any = { code: retResult.data.code, file: retResult.data.file, cache: retResult.data.cache };
|
||||
return new ResultData(0, '上传成功!', retData);
|
||||
} else {
|
||||
this.Msg('上传失败!');
|
||||
return new ResultData(-1, '', '');
|
||||
}
|
||||
});
|
||||
return upOk;
|
||||
} else {
|
||||
this.Msg('上传失败!');
|
||||
return new ResultData(-1, retResult.msg,retResult.data);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/***********消息操作**************/
|
||||
static Msg(message : any, icon ?: any) : void {
|
||||
if (icon != null) {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: icon
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static Alert(msg : string, cb ?: any) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: msg,
|
||||
showCancel: false,
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
cb && cb();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static LoadIng(text : any) : void {
|
||||
uni.showLoading({
|
||||
title: text,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
static LoadClose() : void {
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
||||
/**********跳转操作*********/
|
||||
|
||||
|
||||
static GoPageTab(path : string) : void {
|
||||
uni.switchTab({
|
||||
url: path
|
||||
});
|
||||
}
|
||||
|
||||
/**********跳转操作*********/
|
||||
static GoPage(path : string) : void {
|
||||
uni.navigateTo({
|
||||
url: path, //跳转的页面
|
||||
success: function (res) {
|
||||
// 通过eventChannel向被打开页面传送数据
|
||||
}
|
||||
});
|
||||
}
|
||||
/**********跳转并删除当前页面操作*********/
|
||||
static GoPageDelse(path : string) : void {
|
||||
uni.redirectTo({
|
||||
url: path //跳转的页面
|
||||
});
|
||||
}
|
||||
|
||||
/**********返回上一页*********/
|
||||
static GoPageBack() : void {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
}
|
||||
|
||||
/*****获取图片base64*****/
|
||||
static UpLoadMediaBase64(path : string) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
uni.uploadFile({
|
||||
url: 'http://cloud.pccsh.com/DefUp/UploadFileImgBase64', //仅为示例,非真实的接口地址
|
||||
filePath: path,
|
||||
name: 'file',
|
||||
success: (uploadFileRes) => {
|
||||
resolve(uploadFileRes);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/*****获取图片位置信息*****/
|
||||
//获取时间戳
|
||||
static GetTimeSpan(milliSecond : number) {
|
||||
return Date.now() + milliSecond;
|
||||
}
|
||||
|
||||
// 时间戳处理
|
||||
static formatDate(time : any, type : number) : string {
|
||||
const date = new Date(time);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1,并用0填充
|
||||
const day = String(date.getDate()).padStart(2, '0'); // 用0填充
|
||||
const hours = String(date.getHours()).padStart(2, '0'); // 用0填充
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0'); // 用0填充
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0'); // 用0填充
|
||||
if (type == 0) {
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
else if (type == 1) {
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
||||
} else if (type == 2) {
|
||||
return `${year}-${month}-${day}`;
|
||||
} else if (type == 3) {
|
||||
return `${hours}:${minutes}`;
|
||||
} else if (type == 4) {
|
||||
return `${year}${month}${day}`;
|
||||
}
|
||||
|
||||
else {
|
||||
return `${hours}:${minutes}`;
|
||||
}
|
||||
}
|
||||
|
||||
/*****节流*****/
|
||||
static throttle(fn: () => void, time: number) {
|
||||
let canRun: boolean = true;
|
||||
return function () {
|
||||
if (!canRun) return;
|
||||
canRun = false;
|
||||
setTimeout(() => {
|
||||
fn(); //可以不执行
|
||||
canRun = true;
|
||||
}, time);
|
||||
};
|
||||
}
|
||||
/*****防抖*****/
|
||||
static debounce<T extends (...args: any[]) => void>(fn: T, time: number): (...args: Parameters<T>) => void {
|
||||
let timerId: NodeJS.Timeout | null = null;
|
||||
|
||||
return (...args: Parameters<T>) => {
|
||||
if (timerId) {
|
||||
clearTimeout(timerId);
|
||||
}
|
||||
|
||||
timerId = setTimeout(() => {
|
||||
fn(...args); // 执行传入的函数
|
||||
timerId = null; // 清除定时器ID
|
||||
}, time);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 普通图片上传
|
||||
static uploadH5(path, dic, callback) {
|
||||
console.log(this.payuploadUrl,'xxx')
|
||||
uni.uploadFile({
|
||||
url: this.payuploadUrl+'/Upload/UploadFile',
|
||||
method: "POST",
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + Service.GetUserToken(),
|
||||
},
|
||||
formData: {
|
||||
"path": dic,
|
||||
},
|
||||
filePath: path,
|
||||
name: 'file',
|
||||
success: (data) => {
|
||||
let info = data.data
|
||||
callback(info)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user