处理微信登录和完成投放
This commit is contained in:
parent
bf9a74e60b
commit
d34d2ef6f4
@ -412,7 +412,7 @@
|
|||||||
content
|
content
|
||||||
} = data;
|
} = data;
|
||||||
if (index == 0) { //取消工单
|
if (index == 0) { //取消工单
|
||||||
api.callEbikeInfo("canCellWorkOrder?orderId=" + orderId.value, {}, "get").then((res) => {
|
api.callEbikeInfo("canCellWorkOrder?orderId=" + orderId.value+"&orderType=1", {}, "get").then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "取消成功!",
|
title: "取消成功!",
|
||||||
|
|||||||
@ -57,7 +57,7 @@
|
|||||||
const isAgreed = ref([]); // 用来控制复选框的选中状态
|
const isAgreed = ref([]); // 用来控制复选框的选中状态
|
||||||
const isloading = ref(false);
|
const isloading = ref(false);
|
||||||
const phone = ref("");
|
const phone = ref("");
|
||||||
const openid = ref("");
|
const openId = ref("");
|
||||||
const agreed = ref([{
|
const agreed = ref([{
|
||||||
value: true // true 表示选中
|
value: true // true 表示选中
|
||||||
}]);
|
}]);
|
||||||
@ -85,12 +85,12 @@
|
|||||||
api.callOrdereApi("ebikeUser/login?js_code=" + res.code, {}, "get").then(
|
api.callOrdereApi("ebikeUser/login?js_code=" + res.code, {}, "get").then(
|
||||||
(wx) => {
|
(wx) => {
|
||||||
if (wx.code == 200) {
|
if (wx.code == 200) {
|
||||||
|
openId.value = wx.data;
|
||||||
api.callOrdereApi("ebikeUser/getInfoByOpenId?openId=" + wx.data, {},
|
api.callOrdereApi("ebikeUser/getInfoByOpenId?openId=" + wx.data, {},
|
||||||
"get")
|
"get")
|
||||||
.then((info) => {
|
.then((info) => {
|
||||||
isloading.value = false;
|
isloading.value = false;
|
||||||
if (info.code == 200) {
|
if (info.code == 200) {
|
||||||
openid.value = wx.data;
|
|
||||||
uni.setStorageSync('wechat_user', info.data);
|
uni.setStorageSync('wechat_user', info.data);
|
||||||
phone.value = info.data.mobile;
|
phone.value = info.data.mobile;
|
||||||
if (!info.data.nickname) {
|
if (!info.data.nickname) {
|
||||||
@ -98,7 +98,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let params = {
|
let params = {
|
||||||
"openid": wx.data,
|
"openId": wx.data,
|
||||||
"status": 1,
|
"status": 1,
|
||||||
}
|
}
|
||||||
api.callOrdereApi("ebikeUser/save", params).then(
|
api.callOrdereApi("ebikeUser/save", params).then(
|
||||||
@ -142,7 +142,6 @@
|
|||||||
let wechat_user = uni.getStorageSync('wechat_user');
|
let wechat_user = uni.getStorageSync('wechat_user');
|
||||||
const params = {
|
const params = {
|
||||||
"userId": wechat_user.userId,
|
"userId": wechat_user.userId,
|
||||||
"openid": openid.value,
|
|
||||||
"nickname": res.userInfo.nickName,
|
"nickname": res.userInfo.nickName,
|
||||||
"avatar": res.userInfo.avatarUrl
|
"avatar": res.userInfo.avatarUrl
|
||||||
};
|
};
|
||||||
@ -185,7 +184,6 @@
|
|||||||
//更新手机号
|
//更新手机号
|
||||||
const params = {
|
const params = {
|
||||||
"userId": wechat_user.userId,
|
"userId": wechat_user.userId,
|
||||||
"openid": openid.value,
|
|
||||||
"mobile": info.data
|
"mobile": info.data
|
||||||
}
|
}
|
||||||
phone.value = info.data;
|
phone.value = info.data;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<z-paging ref="paging" v-model="listdata" @query="loadMoreData" :default-page-no="1" :default-page-size="4"
|
<z-paging ref="paging" v-model="listdata" @query="loadMoreData" :default-page-no="1" :default-page-size="5"
|
||||||
:auto-show-back-to-top="true">
|
:auto-show-back-to-top="true">
|
||||||
<template #top>
|
<template #top>
|
||||||
<view class="flex">
|
<view class="flex">
|
||||||
@ -16,17 +16,18 @@
|
|||||||
<checkbox-group @change="checkboxGroupChange">
|
<checkbox-group @change="checkboxGroupChange">
|
||||||
<view v-for="(item, index) in listdata" :key="index" class="list-item">
|
<view v-for="(item, index) in listdata" :key="index" class="list-item">
|
||||||
<view class="flex list-title" @click="opendetail(item.bikeId)">
|
<view class="flex list-title" @click="opendetail(item.bikeId)">
|
||||||
<view class="title-xz">
|
<view v-if="item.state==1 && item.stateName=='待投放'" class="title-xz">
|
||||||
<checkbox :value="item.bikeCode" @click.stop></checkbox>
|
<checkbox :value="item.bikeCode" @click.stop></checkbox>
|
||||||
</view>
|
</view>
|
||||||
<view class="title-wz">
|
<view class="title-wz">
|
||||||
{{item.bikeCode}}
|
{{item.bikeCode}}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="item.state==1" class="title-zt">
|
<view v-if="item.state==1" class="title-zt">
|
||||||
<view class="cu-tag bg-orange sm ">待投放</view>
|
<view v-if="item.stateName=='投放中'" class="cu-tag bg-blue sm ">{{item.stateName}}</view>
|
||||||
|
<view v-else class="cu-tag bg-orange sm ">{{item.stateName}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="item.state==2" class="title-zt">
|
<view v-else class="title-zt">
|
||||||
<view class="cu-tag bg-green sm ">已投放</view>
|
<view class="cu-tag bg-green sm ">{{item.stateName}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex row">
|
<view class="flex row">
|
||||||
@ -112,6 +113,9 @@
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
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 {
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
const imgPath = config.imgPath;
|
const imgPath = config.imgPath;
|
||||||
const listdata = ref([]);
|
const listdata = ref([]);
|
||||||
const popup = ref(null)
|
const popup = ref(null)
|
||||||
@ -130,6 +134,9 @@
|
|||||||
|
|
||||||
//运营区域下拉值 和列表
|
//运营区域下拉值 和列表
|
||||||
const regindata = ref([])
|
const regindata = ref([])
|
||||||
|
onShow(() => {
|
||||||
|
loadMoreData(1, 5)
|
||||||
|
})
|
||||||
|
|
||||||
//提交表单相关信息
|
//提交表单相关信息
|
||||||
const customForm = ref(null)
|
const customForm = ref(null)
|
||||||
@ -234,7 +241,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
api.callEbikeInfo("pageQueryEbikeList", params).then((res) => {
|
api.callEbikeInfo("getOperationalBikeList", params).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const records = res.data.records;
|
const records = res.data.records;
|
||||||
paging.value.complete(res.data.records);
|
paging.value.complete(res.data.records);
|
||||||
@ -249,11 +256,10 @@
|
|||||||
if (statusZT.value == 0) { // 下架
|
if (statusZT.value == 0) { // 下架
|
||||||
handleLeaveWarehouse();
|
handleLeaveWarehouse();
|
||||||
} else { // 投放
|
} else { // 投放
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url:"/pages/warehouse/vehicledispatch/vehicledispatch?orderId=272553556257517568"
|
|
||||||
})
|
|
||||||
// handleLaunch();
|
// handleLaunch();
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/warehouse/vehicledispatch/vehicledispatch?orderId=274372153543897088`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log('err', err);
|
console.log('err', err);
|
||||||
@ -290,21 +296,28 @@
|
|||||||
const handleLaunch = () => {
|
const handleLaunch = () => {
|
||||||
// 在这里编写投放的具体逻辑
|
// 在这里编写投放的具体逻辑
|
||||||
console.log('投放逻辑执行');
|
console.log('投放逻辑执行');
|
||||||
const params={
|
const params = {
|
||||||
"bikeCodes": customFormData.value.deviceValues, // 车辆编号
|
"bikeCodes": customFormData.value.deviceValues, // 车辆编号
|
||||||
"status": statusZT.value,
|
"status": statusZT.value,
|
||||||
"siteId": customFormData.value.reginvalue,
|
"siteId": customFormData.value.reginvalue,
|
||||||
"DispatchType":"仓库车调度"
|
"DispatchType": "仓库车调度"
|
||||||
}
|
}
|
||||||
// 例如,调用API处理投放
|
// 例如,调用API处理投放
|
||||||
api.callEbikeInfo("createWorkOrderDispatch",params).then((res) => {
|
api.callEbikeInfo("createWorkOrderDispatch", params).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
popup.value.close("center");
|
popup.value.close("center");
|
||||||
|
// 显示成功提示
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '操作成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000
|
duration: 1000
|
||||||
});
|
});
|
||||||
|
// 延时跳转,确保提示完毕后再跳转
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/warehouse/vehicledispatch/vehicledispatch?orderId=${res.data}`
|
||||||
|
});
|
||||||
|
}, 1000); // 跳转延迟与提示时长一致
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作失败',
|
title: '操作失败',
|
||||||
|
|||||||
@ -10,8 +10,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="button-container">
|
<view class="button-container">
|
||||||
<view class="button-group flex justify-between padding">
|
<view class="button-group flex justify-between padding">
|
||||||
<button class="cu-btn bg-blue margin-tb-sm lg">开锁</button>
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="unlockHandler">开锁</button>
|
||||||
<button class="cu-btn bg-blue margin-tb-sm lg"><strong>推车</strong></button>
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="unlockHandler"><strong>推车</strong></button>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="table-container">
|
<view class="table-container">
|
||||||
@ -29,7 +30,8 @@
|
|||||||
</uni-td>
|
</uni-td>
|
||||||
<uni-td align="center">
|
<uni-td align="center">
|
||||||
<view class="cu-tag line-blue">
|
<view class="cu-tag line-blue">
|
||||||
<uni-icons type="plus" color="rgb(102,179,255)" size="20"></uni-icons>
|
<uni-icons type="sound" @click="onRingClick(item.bikeCode)" color="rgb(102,179,255)"
|
||||||
|
size="20"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</uni-td>
|
</uni-td>
|
||||||
<uni-td align="center">
|
<uni-td align="center">
|
||||||
@ -39,20 +41,17 @@
|
|||||||
</uni-tr>
|
</uni-tr>
|
||||||
</uni-table>
|
</uni-table>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<view class="dispatch-btn-container">
|
<view class="nav-panel">
|
||||||
<view class="cu-btn bg-blue" @click="getInfoList">
|
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="navButtonGroup" @buttonClick="navButtonClick" />
|
||||||
调度
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
ref
|
ref,
|
||||||
|
onMounted
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import * as api from '@/utils/api.js';
|
import * as api from '@/utils/api.js';
|
||||||
import {
|
import {
|
||||||
@ -67,9 +66,20 @@
|
|||||||
const newbikeCode = ref("");
|
const newbikeCode = ref("");
|
||||||
|
|
||||||
const dispatchRecords = ref([]);
|
const dispatchRecords = ref([]);
|
||||||
|
const navButtonGroup = [{
|
||||||
|
text: '完成投放',
|
||||||
|
backgroundColor: 'rgb(0,120,212)',
|
||||||
|
color: '#fff'
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
orderId.value = options.orderId;;
|
orderId.value = options.orderId;
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
getInfoList();
|
||||||
})
|
})
|
||||||
const getInfoList = () => {
|
const getInfoList = () => {
|
||||||
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then(
|
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then(
|
||||||
@ -81,16 +91,56 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteDispatchRecord = (recordId,index) => {
|
const deleteDispatchRecord = (recordId, index) => {
|
||||||
|
if (dispatchRecords.value.length == 1) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '确认删除',
|
||||||
|
content: '删除将会取消工单,确认要删除吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
cancelWorkOrder(index);
|
||||||
|
} else {
|
||||||
|
// 用户取消删除,什么都不做
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
api.callEbikeInfo("deleteDispatchRecord?recordId=" + recordId, {}, "get").then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
dispatchRecords.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 使用 splice 删除指定索引的元素
|
}
|
||||||
dispatchRecords.value.splice(index, 1);
|
|
||||||
// api.callEbikeInfo("deleteDispatchRecord?recordId=" + recordId, {}, "get").then(res=>{
|
|
||||||
// if(res.code==200){
|
|
||||||
// dispatchRecords.value.slice(index,1)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
const cancelWorkOrder = (index) => {
|
||||||
|
api.callEbikeInfo("canCellWorkOrder?orderId=" + orderId.value + "&orderType=3", {}, "get").then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "成功!",
|
||||||
|
icon: "success",
|
||||||
|
duration: 1000,
|
||||||
|
mask: true,
|
||||||
|
success: () => {
|
||||||
|
dispatchRecords.value.splice(index, 1);
|
||||||
|
setTimeout(() => {
|
||||||
|
// 返回上一页
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1 // 返回上一页
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: "取消工单失败!",
|
||||||
|
icon: "error",
|
||||||
|
duration: 1000,
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const bikeCodeScanChange = (bikeCode) => {
|
const bikeCodeScanChange = (bikeCode) => {
|
||||||
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
|
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
|
||||||
@ -100,7 +150,6 @@
|
|||||||
"bikeCode": bikeCode,
|
"bikeCode": bikeCode,
|
||||||
"dispatchState": 0
|
"dispatchState": 0
|
||||||
}
|
}
|
||||||
debugger;
|
|
||||||
newbikeCode.value = bikeCode;
|
newbikeCode.value = bikeCode;
|
||||||
api.callEbikeInfo("createDispatchRecord", params)
|
api.callEbikeInfo("createDispatchRecord", params)
|
||||||
.then(re => {
|
.then(re => {
|
||||||
@ -116,6 +165,98 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//批量出库事件按钮
|
||||||
|
const navButtonClick = (res) => {
|
||||||
|
const {
|
||||||
|
index,
|
||||||
|
content
|
||||||
|
} = res;
|
||||||
|
if (index == 0) //完成投放
|
||||||
|
{
|
||||||
|
const params = {
|
||||||
|
"orderId": orderId.value
|
||||||
|
}
|
||||||
|
api.callEbikeInfo("completeDeployment", params).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
|
||||||
|
showModelMessage("已完成投放!").then(res => {
|
||||||
|
// 返回上一页
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1 // 返回上一页
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const unlockHandler = () => {
|
||||||
|
dispatchRecords.value.forEach(ebbikeinfo => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: "指令下发中...",
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
api.callEbikeInfo("getBikeINfoData?bikeCode=" + ebbikeinfo.bikeCode).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const ecuId = res.data.ecuId;
|
||||||
|
const bikeId = res.data.bikeId;
|
||||||
|
// 处理开锁逻辑
|
||||||
|
api.callCoreApi("unlock?ecuId=" + ecuId + "&bikeId=" + bikeId, {}, 'get').then((
|
||||||
|
res) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
var title = res.data.message;
|
||||||
|
var icon = "";
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
icon = "success"
|
||||||
|
} else {
|
||||||
|
icon = "error"
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: title,
|
||||||
|
icon: icon,
|
||||||
|
duration: 1000,
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const pushCarHandler = () => {
|
||||||
|
// 处理推车逻辑
|
||||||
|
console.log("推车操作");
|
||||||
|
}
|
||||||
|
const onRingClick=(bikeCode)=>{
|
||||||
|
uni.showLoading({
|
||||||
|
title: "指令下发中...",
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
const ecuId = res.data.ecuId;
|
||||||
|
const bikeId = res.data.bikeId;
|
||||||
|
// 处理开锁逻辑
|
||||||
|
api.callCoreApi("findEbike?ecuId=" + ecuId + "&bikeId=" + bikeId, {}, 'get').then((
|
||||||
|
res) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
var title = res.data.message;
|
||||||
|
var icon = "";
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
icon = "success"
|
||||||
|
} else {
|
||||||
|
icon = "error"
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: title,
|
||||||
|
icon: icon,
|
||||||
|
duration: 1000,
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -133,4 +274,13 @@
|
|||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-panel {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0rpx;
|
||||||
|
width: 100%;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
z-index: 999;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user