处理微信登录和完成投放
This commit is contained in:
parent
bf9a74e60b
commit
d34d2ef6f4
@ -412,7 +412,7 @@
|
||||
content
|
||||
} = data;
|
||||
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) {
|
||||
uni.showToast({
|
||||
title: "取消成功!",
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
const isAgreed = ref([]); // 用来控制复选框的选中状态
|
||||
const isloading = ref(false);
|
||||
const phone = ref("");
|
||||
const openid = ref("");
|
||||
const openId = ref("");
|
||||
const agreed = ref([{
|
||||
value: true // true 表示选中
|
||||
}]);
|
||||
@ -85,12 +85,12 @@
|
||||
api.callOrdereApi("ebikeUser/login?js_code=" + res.code, {}, "get").then(
|
||||
(wx) => {
|
||||
if (wx.code == 200) {
|
||||
openId.value = wx.data;
|
||||
api.callOrdereApi("ebikeUser/getInfoByOpenId?openId=" + wx.data, {},
|
||||
"get")
|
||||
.then((info) => {
|
||||
isloading.value = false;
|
||||
if (info.code == 200) {
|
||||
openid.value = wx.data;
|
||||
uni.setStorageSync('wechat_user', info.data);
|
||||
phone.value = info.data.mobile;
|
||||
if (!info.data.nickname) {
|
||||
@ -98,12 +98,12 @@
|
||||
}
|
||||
} else {
|
||||
let params = {
|
||||
"openid": wx.data,
|
||||
"openId": wx.data,
|
||||
"status": 1,
|
||||
}
|
||||
api.callOrdereApi("ebikeUser/save", params).then(
|
||||
re => {
|
||||
if (re.code == 200) {
|
||||
if (re.code == 200) {
|
||||
params.userId = re.data;
|
||||
uni.setStorageSync('wechat_user',
|
||||
params);
|
||||
@ -142,7 +142,6 @@
|
||||
let wechat_user = uni.getStorageSync('wechat_user');
|
||||
const params = {
|
||||
"userId": wechat_user.userId,
|
||||
"openid": openid.value,
|
||||
"nickname": res.userInfo.nickName,
|
||||
"avatar": res.userInfo.avatarUrl
|
||||
};
|
||||
@ -172,7 +171,7 @@
|
||||
// 获取到手机号的加密数据
|
||||
wx.login({
|
||||
success: (res) => {
|
||||
let wechat_user = uni.getStorageSync('wechat_user');
|
||||
let wechat_user = uni.getStorageSync('wechat_user');
|
||||
const encryptedData = e.detail.encryptedData;
|
||||
const iv = e.detail.iv;
|
||||
const param = {
|
||||
@ -185,7 +184,6 @@
|
||||
//更新手机号
|
||||
const params = {
|
||||
"userId": wechat_user.userId,
|
||||
"openid": openid.value,
|
||||
"mobile": info.data
|
||||
}
|
||||
phone.value = info.data;
|
||||
@ -220,8 +218,8 @@
|
||||
showModelMessage("您的账户已经注销,请联系管理员!");
|
||||
} else {
|
||||
// 调用 wx.login 获取登录凭证 code
|
||||
login();
|
||||
setTimeout(() => {
|
||||
login();
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: "/pages/user/home/home"
|
||||
})
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<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">
|
||||
<template #top>
|
||||
<view class="flex">
|
||||
@ -16,17 +16,18 @@
|
||||
<checkbox-group @change="checkboxGroupChange">
|
||||
<view v-for="(item, index) in listdata" :key="index" class="list-item">
|
||||
<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>
|
||||
</view>
|
||||
<view class="title-wz">
|
||||
{{item.bikeCode}}
|
||||
</view>
|
||||
<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 v-else-if="item.state==2" class="title-zt">
|
||||
<view class="cu-tag bg-green sm ">已投放</view>
|
||||
<view v-else class="title-zt">
|
||||
<view class="cu-tag bg-green sm ">{{item.stateName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex row">
|
||||
@ -102,7 +103,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -112,10 +113,13 @@
|
||||
} from 'vue';
|
||||
import * as api from '@/utils/api.js';
|
||||
import config from '@/utils/config';
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
const imgPath = config.imgPath;
|
||||
const listdata = ref([]);
|
||||
const popup = ref(null)
|
||||
const typepopup = ref("center");
|
||||
const typepopup = ref("center");
|
||||
const navButtonGroup = [{
|
||||
text: '批量投放',
|
||||
backgroundColor: 'rgb(0,120,212)',
|
||||
@ -130,6 +134,9 @@
|
||||
|
||||
//运营区域下拉值 和列表
|
||||
const regindata = ref([])
|
||||
onShow(() => {
|
||||
loadMoreData(1, 5)
|
||||
})
|
||||
|
||||
//提交表单相关信息
|
||||
const customForm = ref(null)
|
||||
@ -222,7 +229,7 @@
|
||||
});
|
||||
}, 200); // 延迟100毫秒后执行
|
||||
}
|
||||
const loadMoreData = (pageNo, pageSize) => {
|
||||
const loadMoreData = (pageNo, pageSize) => {
|
||||
// 组装参数
|
||||
const params = {
|
||||
"bikeCode": bikeCodeValue.value, //车辆编号
|
||||
@ -234,13 +241,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
api.callEbikeInfo("pageQueryEbikeList", params).then((res) => {
|
||||
api.callEbikeInfo("getOperationalBikeList", params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
const records = res.data.records;
|
||||
paging.value.complete(res.data.records);
|
||||
} else {
|
||||
paging.value.complete(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -249,11 +256,10 @@
|
||||
if (statusZT.value == 0) { // 下架
|
||||
handleLeaveWarehouse();
|
||||
} else { // 投放
|
||||
|
||||
uni.navigateTo({
|
||||
url:"/pages/warehouse/vehicledispatch/vehicledispatch?orderId=272553556257517568"
|
||||
})
|
||||
// handleLaunch();
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehouse/vehicledispatch/vehicledispatch?orderId=274372153543897088`
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log('err', err);
|
||||
@ -290,21 +296,28 @@
|
||||
const handleLaunch = () => {
|
||||
// 在这里编写投放的具体逻辑
|
||||
console.log('投放逻辑执行');
|
||||
const params={
|
||||
const params = {
|
||||
"bikeCodes": customFormData.value.deviceValues, // 车辆编号
|
||||
"status": statusZT.value,
|
||||
"siteId": customFormData.value.reginvalue,
|
||||
"DispatchType":"仓库车调度"
|
||||
"DispatchType": "仓库车调度"
|
||||
}
|
||||
// 例如,调用API处理投放
|
||||
api.callEbikeInfo("createWorkOrderDispatch",params).then((res) => {
|
||||
api.callEbikeInfo("createWorkOrderDispatch", params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
popup.value.close("center");
|
||||
// 显示成功提示
|
||||
uni.showToast({
|
||||
title: '操作成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
duration: 1000
|
||||
});
|
||||
// 延时跳转,确保提示完毕后再跳转
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/warehouse/vehicledispatch/vehicledispatch?orderId=${res.data}`
|
||||
});
|
||||
}, 1000); // 跳转延迟与提示时长一致
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '操作失败',
|
||||
|
||||
@ -10,8 +10,9 @@
|
||||
</view>
|
||||
<view class="button-container">
|
||||
<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"><strong>推车</strong></button>
|
||||
<button class="cu-btn bg-blue margin-tb-sm lg" @click="unlockHandler">开锁</button>
|
||||
<button class="cu-btn bg-blue margin-tb-sm lg" @click="unlockHandler"><strong>推车</strong></button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="table-container">
|
||||
@ -29,7 +30,8 @@
|
||||
</uni-td>
|
||||
<uni-td align="center">
|
||||
<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>
|
||||
</uni-td>
|
||||
<uni-td align="center">
|
||||
@ -39,20 +41,17 @@
|
||||
</uni-tr>
|
||||
</uni-table>
|
||||
</view>
|
||||
|
||||
<view class="dispatch-btn-container">
|
||||
<view class="cu-btn bg-blue" @click="getInfoList">
|
||||
调度
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="nav-panel">
|
||||
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="navButtonGroup" @buttonClick="navButtonClick" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
ref,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import * as api from '@/utils/api.js';
|
||||
import {
|
||||
@ -67,9 +66,20 @@
|
||||
const newbikeCode = ref("");
|
||||
|
||||
const dispatchRecords = ref([]);
|
||||
const navButtonGroup = [{
|
||||
text: '完成投放',
|
||||
backgroundColor: 'rgb(0,120,212)',
|
||||
color: '#fff'
|
||||
}];
|
||||
|
||||
|
||||
onLoad((options) => {
|
||||
orderId.value = options.orderId;;
|
||||
orderId.value = options.orderId;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
getInfoList();
|
||||
})
|
||||
const getInfoList = () => {
|
||||
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then(
|
||||
@ -81,17 +91,57 @@
|
||||
})
|
||||
}
|
||||
|
||||
const deleteDispatchRecord = (recordId,index) => {
|
||||
|
||||
// 使用 splice 删除指定索引的元素
|
||||
dispatchRecords.value.splice(index, 1);
|
||||
// api.callEbikeInfo("deleteDispatchRecord?recordId=" + recordId, {}, "get").then(res=>{
|
||||
// if(res.code==200){
|
||||
// dispatchRecords.value.slice(index,1)
|
||||
// }
|
||||
// })
|
||||
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);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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) => {
|
||||
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
|
||||
if (res.code == 200) {
|
||||
@ -100,7 +150,6 @@
|
||||
"bikeCode": bikeCode,
|
||||
"dispatchState": 0
|
||||
}
|
||||
debugger;
|
||||
newbikeCode.value = bikeCode;
|
||||
api.callEbikeInfo("createDispatchRecord", params)
|
||||
.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>
|
||||
|
||||
<style scoped>
|
||||
@ -133,4 +274,13 @@
|
||||
padding: 5px;
|
||||
|
||||
}
|
||||
|
||||
.nav-panel {
|
||||
position: fixed;
|
||||
bottom: 0rpx;
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
z-index: 999;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user