用户端代码修改

This commit is contained in:
小朱 2025-05-09 16:36:41 +08:00
parent edc9da84bc
commit c658905698
14 changed files with 190 additions and 60 deletions

View File

@ -7,7 +7,7 @@
</view> </view>
</view> </view>
<view class=""> <view class="">
<uni-search-bar @confirm="search" v-model="searchValue" @blur="blur" @clear="clearSearch" @cancel="cancel" <uni-search-bar v-model="searchValue" @blur="blur" @clear="clearSearch" @cancel="cancel"
placeholder="输入车辆编号" clearButton="always" cancelButton="always"> placeholder="输入车辆编号" clearButton="always" cancelButton="always">
</uni-search-bar> </uni-search-bar>
</view> </view>
@ -78,7 +78,7 @@
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 {
onLoad onLoad,onShow
} from '@dcloudio/uni-app'; } from '@dcloudio/uni-app';
const isCancelOrClear = ref(false); const isCancelOrClear = ref(false);
@ -142,19 +142,22 @@
selectedOption.value = option; selectedOption.value = option;
paging.value.reload(); paging.value.reload();
}; };
const blur = (value) => { const blur = (res) => {
if (value == searchValue.value) return; if (res.value != searchValue.value) {
paging.value.reload(); paging.value.reload();
};
}; };
onShow(() => {
searchValue.value = "";
loadMoreData(1,4)
})
const cancel = (value) => { const cancel = (value) => {
// api.callEbikeInfo("getVehicleDetailsByRegionId?regionId=275024268783185920",{},"get")
if (value == "") return;
searchValue.value = ""; searchValue.value = "";
paging.value.reload(); paging.value.reload();
} }
const clearSearch = (value) => { const clearSearch = (value) => {
if (value == "") return;
searchValue.value = ""; searchValue.value = "";
paging.value.reload(); paging.value.reload();
} }

View File

@ -195,8 +195,8 @@
let userOperation = uni.getStorageSync('userOperation'); let userOperation = uni.getStorageSync('userOperation');
userOperation.forEach(res => { userOperation.forEach(res => {
let quyuemap = { let quyuemap = {
"text": res.regionName, "text": res.operationRegionName,
"value": res.regionId "value": res.operationRegionId
}; };
regindata.value.push(quyuemap); regindata.value.push(quyuemap);
}); });

View File

@ -197,13 +197,13 @@
// getUserRegionInfo(); // getUserRegionInfo();
let userDefultOperation = uni.getStorageSync('userDefultOperation'); let userDefultOperation = uni.getStorageSync('userDefultOperation');
// //
api.callOperateApi("ebikeRegion/getRegion?regionId=" + userDefultOperation.regionId, {}, "get").then( api.callOperateApi("ebikeRegion/getRegion?regionId=" + userDefultOperation.operationRegionId, {}, "get").then(
res => { res => {
if (res.code == 200) { if (res.code == 200) {
res.data.forEach(res => { res.data.forEach(res => {
let quyuemap = { let quyuemap = {
"text": res.regionName, "text": res.siteName,
"value": res.regionId "value": res.siteRegionId
}; };
regindata.value.push(quyuemap); regindata.value.push(quyuemap);
}); });

View File

@ -3,6 +3,10 @@
<view> <view>
<uni-forms> <uni-forms>
<uni-forms-item label="站点">
<uni-data-select v-model="scheduleExtension.siteId" :localdata="regindata"
@change="changeZT"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="车辆编号"> <uni-forms-item label="车辆编号">
<bikeCodeScan ref="childComponent" @scan-change="bikeCodeScanChange" :codeValue="newbikeCode" /> <bikeCodeScan ref="childComponent" @scan-change="bikeCodeScanChange" :codeValue="newbikeCode" />
</uni-forms-item> </uni-forms-item>
@ -71,10 +75,12 @@
const orderId = ref(""); const orderId = ref("");
const fileLists = ref([]); const fileLists = ref([]);
const reginvalue = ref("");
const regindata = ref([]);
const newbikeCode = ref(""); const newbikeCode = ref("");
const dispatchRecords = ref([]); const dispatchRecords = ref([]);
const scheduleExtension = ref({})
const navButtonGroup = [{ const navButtonGroup = [{
text: '完成投放', text: '完成投放',
backgroundColor: 'rgb(0,120,212)', backgroundColor: 'rgb(0,120,212)',
@ -82,20 +88,37 @@
}]; }];
const changeZT = (e) => {
console.log("e:", e);
}
onLoad((options) => { onLoad((options) => {
orderId.value = options.orderId; orderId.value = options.orderId;
}); });
onMounted(() => { onMounted(() => {
let userDefultOperation = uni.getStorageSync('userDefultOperation');
//
api.callOperateApi("ebikeRegion/getRegion?regionId=" + userDefultOperation.operationRegionId, {}, "get")
.then(
res => {
if (res.code == 200) {
res.data.forEach(res => {
let quyuemap = {
"text": res.siteName,
"value": res.siteRegionId
};
regindata.value.push(quyuemap);
});
}
})
getInfoList(); getInfoList();
}) })
const getInfoList = () => { const getInfoList = () => {
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then( api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then(
res => { res => {
if (res.code == 200) { if (res.code == 200) {
dispatchRecords.value = res.data.dispatchRecords; dispatchRecords.value = res.data.dispatchRecords;
scheduleExtension.value = res.data.scheduleExtension
} }
}) })
} }
@ -188,8 +211,8 @@
"orderId": orderId.value, "orderId": orderId.value,
"bikeCode": bikeCode, "bikeCode": bikeCode,
"dispatchState": 0, "dispatchState": 0,
"startVehicleLat":latitude, "startVehicleLat": latitude,
"startVehicleLng":longitude "startVehicleLng": longitude
} }
newbikeCode.value = bikeCode; newbikeCode.value = bikeCode;
api.callEbikeInfo("createDispatchRecord", params) api.callEbikeInfo("createDispatchRecord", params)
@ -223,8 +246,23 @@
} = res; } = res;
if (index == 0) // if (index == 0) //
{ {
if (!scheduleExtension.value.siteId) {
uni.showToast({
title: '请选择站点',
icon: 'none'
});
return;
}
if(!fileLists.value.length){
uni.showToast({
title: '请上传投放的照片',
icon: 'none'
});
return;
}
const params = { const params = {
"orderId": orderId.value, "orderId": orderId.value,
"siteId": scheduleExtension.value.siteId,
"fileLists": fileLists.value "fileLists": fileLists.value
} }
api.callEbikeInfo("completeDeployment", params).then(res => { api.callEbikeInfo("completeDeployment", params).then(res => {

View File

@ -6,29 +6,29 @@
<image class="divImg" :src='imgPath+"static/userui/home/money.png"' /> <image class="divImg" :src='imgPath+"static/userui/home/money.png"' />
</label> </label>
<label>待支付</label> <label>待支付</label>
<label>{{data.hj}}</label> <label>{{data.totalAmount}}</label>
</div> </div>
<div class="divFont"> <div class="divFont">
{{data.sj}} {{data.createdAt}}
</div> </div>
<div class="divTitle2"> <div class="divTitle2">
费用明细 费用明细
</div> </div>
<div class="divRow divFont"> <div class="divRow divFont" v-for="(item,index) in data.details" :key="index">
<label>起步价</label> <label>{{item.itemName}}</label>
<label>{{data.qbj}}</label> <label>{{item.itemAmount}}</label>
</div> </div>
<div class="divRow divFont"> <!-- <div class="divRow divFont">
<label>时长费</label> <label>时长费</label>
<label>{{data.scf}}</label> <label>{{data.scf}}</label>
</div> </div> -->
<div class="divHJ"> <div class="divHJ">
<label>合计</label> <label>合计</label>
<label>{{data.hj}}</label> <label>{{data.totalAmount}}</label>
</div> </div>
</div> </div>
<div> <div>
<div class="divBtn"> <div class="divBtn" @click="handlePaymentClick">
<label> <label>
<uni-icons custom-prefix="iconfont" type="icon-ebikeweixin" color="white" size="25" /> <uni-icons custom-prefix="iconfont" type="icon-ebikeweixin" color="white" size="25" />
</label> </label>
@ -41,14 +41,16 @@
<script setup> <script setup>
import { import {
ref,onMounted ref,
onMounted
} from 'vue'; } from 'vue';
import config from '@/utils/config'; import config from '@/utils/config';
import * as api from '@/utils/api.js';
import { import {
showModelMessage showModelMessage
} from "@/utils/tools.js"; } from "@/utils/tools.js";
const imgPath = config.imgPath; const imgPath = config.imgPath;
const props = defineProps(["orderid"]); const props = defineProps(["orderId"]);
const data = ref({ const data = ref({
hj: "2.5", hj: "2.5",
sj: "2025-04-03 14:15:13", sj: "2025-04-03 14:15:13",
@ -56,9 +58,65 @@
scf: "0.5" scf: "0.5"
}) })
onMounted(()=>{ onMounted(() => {
showModelMessage("该功能暂未实现!") getInfoOrderData();
}) })
const getInfoOrderData = () => {
api.callOrdereApi("userOrders/orderDetailsInfo?orderId=" + props.orderId, {}, "get").then(res => {
if (res.code == 200) {
data.value = res.data;
}
})
}
const handlePaymentClick = () => {
console.log('支付按钮被点击');
const params = {
"orderId": props.orderId
}
api.callPaymentApi("wxPayment/prepay", params).then(res => {
if (res.code == 200) {
wx.requestPayment({
"timeStamp": res.data.timeStamp,
"nonceStr": res.data.nonceStr,
"package": res.data.package,
"signType": res.data.signType,
"paySign": res.data.paySign,
"success": function(res) {
//
checkPaymentStatus();
},
"fail": function(res) {
showModelMessage("支付失败")
},
"complete": function(res) {
showModelMessage("支付失败")
}
})
}
})
}
function checkPaymentStatus() {
api.callPaymentApi("wxPayment/queryOrderByOutTradeNo?outTradeNo=" + props.orderId, {}, "get")
.then(res => {
if (res.code == 200) {
gotoHome();
} else {
console.log("支付未成功,继续轮询");
checkPaymentStatus(); //
}
})
.catch(error => {
console.log("请求失败,继续轮询", error);
checkPaymentStatus(); //
});
}
const gotoHome = () => {
uni.navigateTo({
url: "/pages/user/home/home"
})
}
</script> </script>
<style scoped> <style scoped>

View File

@ -108,7 +108,7 @@
<bike-info :bikedata="bikeData" @close="closeBikeInfo" /> <bike-info :bikedata="bikeData" @close="closeBikeInfo" />
</div> </div>
<div v-if="showOrderPay" style="position: absolute;z-index: 2000;bottom: 0;width: 100vw;"> <div v-if="showOrderPay" style="position: absolute;z-index: 2000;bottom: 0;width: 100vw;">
<bike-pay :orderid="orderData.orderId" /> <bike-pay :orderId="orderData.orderId" />
</div> </div>
</template> </template>
@ -121,7 +121,7 @@
} from 'vue'; } from 'vue';
import { import {
showModelMessage, showModelMessage,
getUrlParams getUrlParams,jkcBaseDecode
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import { import {
callOrdereApi, callOrdereApi,
@ -591,7 +591,7 @@
getLoalcationData(); getLoalcationData();
}) })
onShow(() => { onShow(() => {
oUser = uni.getStorageSync("wechat_user"); oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
console.log("7777777777777777777777","oUser", oUser) console.log("7777777777777777777777","oUser", oUser)
const { const {

View File

@ -88,7 +88,7 @@
} from 'vue'; } from 'vue';
import * as api from '@/utils/api.js'; import * as api from '@/utils/api.js';
import { import {
showModelMessage showModelMessage,jkcBaseDecode
} from '@/utils/tools.js'; } from '@/utils/tools.js';
import { import {
onLoad onLoad
@ -359,7 +359,7 @@
const currentCoordinates = ref(null); const currentCoordinates = ref(null);
onLoad((options) => { onLoad((options) => {
userInfo.value = uni.getStorageSync('userInfo'); userInfo.value = uni.getStorageSync('userInfo');
wechat_user.value = uni.getStorageSync('wechat_user'); wechat_user.value = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
const screenHeight = systemInfo.screenHeight; const screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight; const statusBarHeight = systemInfo.statusBarHeight;

View File

@ -51,7 +51,7 @@
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 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,7 +91,7 @@
.then((info) => { .then((info) => {
isloading.value = false; isloading.value = false;
if (info.code == 200) { if (info.code == 200) {
uni.setStorageSync('wechat_user', 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();
@ -106,7 +106,7 @@
if (re.code == 200) { if (re.code == 200) {
params.userId = re.data; params.userId = re.data;
uni.setStorageSync('wechat_user', uni.setStorageSync('wechat_user',
params); jkcBaseEncode(JSON.stringify(params)));
updateUserProfile(); updateUserProfile();
} }
}); });
@ -139,7 +139,8 @@
success: function(res) { success: function(res) {
console.log(res.userInfo.nickName); // console.log(res.userInfo.nickName); //
console.log(res.userInfo.avatarUrl); // URL console.log(res.userInfo.avatarUrl); // URL
let wechat_user = uni.getStorageSync('wechat_user'); let wechat_user = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
debugger
const params = { const params = {
"userId": wechat_user.userId, "userId": wechat_user.userId,
"nickname": res.userInfo.nickName, "nickname": res.userInfo.nickName,
@ -171,7 +172,7 @@
// //
wx.login({ wx.login({
success: (res) => { success: (res) => {
let wechat_user = uni.getStorageSync('wechat_user'); let wechat_user = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
const encryptedData = e.detail.encryptedData; const encryptedData = e.detail.encryptedData;
const iv = e.detail.iv; const iv = e.detail.iv;
const param = { const param = {
@ -205,7 +206,7 @@
// //
const isAccountDeactivated = () => { const isAccountDeactivated = () => {
let wechat_user = 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;
} }

View File

@ -29,7 +29,7 @@
callOrdereApi callOrdereApi
} from '@/utils/api.js'; } from '@/utils/api.js';
import { import {
showModelMessage showModelMessage,jkcBaseDecode
} from "@/utils/tools.js"; } from "@/utils/tools.js";
var qqmapsdk = new QQMapWX({ var qqmapsdk = new QQMapWX({
@ -57,7 +57,7 @@
let scrollHeight = screenHeight - 330; let scrollHeight = screenHeight - 330;
onShow(() => { onShow(() => {
oUser = uni.getStorageSync("wechat_user"); oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
map.getLoalcation((res) => { map.getLoalcation((res) => {
const { const {
latitude, latitude,

View File

@ -28,7 +28,7 @@
} from 'vue'; } from 'vue';
import { import {
showModelMessage, showModelMessage,
getUrlParams getUrlParams,jkcBaseDecode
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import { import {
callOrdereApi callOrdereApi
@ -38,7 +38,7 @@
const imgPath = config.imgPath; const imgPath = config.imgPath;
const len = 6; const len = 6;
const oUser = uni.getStorageSync("wechat_user"); const oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
const inputData = ref(new Array(len).fill("")); const inputData = ref(new Array(len).fill(""));
const focus = ref(true); const focus = ref(true);
const btnDis = ref(true); const btnDis = ref(true);

View File

@ -46,7 +46,7 @@
} from "@dcloudio/uni-app"; } from "@dcloudio/uni-app";
import { import {
showModelMessage, showModelMessage,
getUrlParams getUrlParams,jkcBaseDecode
} from "@/utils/tools.js"; } from "@/utils/tools.js";
import { import {
@ -62,7 +62,7 @@
let bikeCode = null; let bikeCode = null;
const openLight = ref("off"); const openLight = ref("off");
const showWorn = ref(false); const showWorn = ref(false);
const oUser = uni.getStorageSync("wechat_user"); const oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
let type = null; let type = null;
let errdata=null; let errdata=null;

View File

@ -16,6 +16,9 @@ export const callOperateApi = (url, parmas = {}, method = 'post') => {
export const callOrdereApi = (url, parmas = {}, method = 'post') => { export const callOrdereApi = (url, parmas = {}, method = 'post') => {
return HttpRequest(baseUrl + "order/" + url, method, parmas); return HttpRequest(baseUrl + "order/" + url, method, parmas);
} }
export const callPaymentApi = (url, parmas = {}, method = 'post') => {
return HttpRequest(baseUrl + "payment/" + url, method, parmas);
}
export const callMaintenanceApi = (url, parmas = {}, method = 'post') => { export const callMaintenanceApi = (url, parmas = {}, method = 'post') => {
return HttpRequest(baseUrl + "maintenance/" + url, method, parmas); return HttpRequest(baseUrl + "maintenance/" + url, method, parmas);

View File

@ -1,5 +1,4 @@
import Base64 from './base64'; import Base64 from './base64';
export const formatTime = date => { export const formatTime = date => {
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
@ -91,6 +90,34 @@ export function longToDateFormatTime(value) {
return value ? dataFormat((new Date(value)), 'yyyy-MM-dd HH:mm:ss') : ""; return value ? dataFormat((new Date(value)), 'yyyy-MM-dd HH:mm:ss') : "";
}; };
export function jkcBaseEncode(text) { //加密
// 确保输入是字符串类型
if (typeof text !== 'string') {
throw new Error('Input must be a string');
}
const jkcBase = base64Encode("jkcBase")
// 第一次 Base64 编码
let firstEncode = Base64.encode(text);
// 将 "jkcBase" 插入到第一次编码结果的第二个字母后
let modifiedFirstEncode = firstEncode.slice(0, 2) + jkcBase + firstEncode.slice(2);
// 第二次 Base64 编码
let secondEncode = Base64.encode(modifiedFirstEncode);
return secondEncode;
}
export function jkcBaseDecode(text) { //解密
const jkcBase = base64Encode("jkcBase")
// 确保输入是字符串类型
if (typeof text !== 'string') {
throw new Error('Input must be a string');
}
// 第一次 Base64 解码
let firstDecode = Base64.decode(text);
// 移除 "jkcBase",它在第一次编码后的第二个字符后
let modifiedText = firstDecode.replace(jkcBase, '');
// 第二次 Base64 解码
let originalText = Base64.decode(modifiedText);
return originalText;
}
export function base64Encode(text) { export function base64Encode(text) {
return Base64.encode(text); return Base64.encode(text);
@ -110,8 +137,8 @@ export function getUrlParams(url) {
return params; return params;
} }
export function isNullOrEmpty(value){ export function isNullOrEmpty(value) {
if(typeof(value) == "undefined" || value == null || value == "") if (typeof(value) == "undefined" || value == null || value == "")
return true; return true;
else else
return false; return false;

View File

@ -1,6 +1,6 @@
import config from "./config.js"; import config from "./config.js";
import { import {
showModelMessage showModelMessage,jkcBaseDecode
} from "./tools.js"; } from "./tools.js";
import { import {
callOrdereApi callOrdereApi
@ -79,7 +79,7 @@ export function addLine(scolor, arrPoints) {
//创建订单 //创建订单
export function addOrder(bikeCode, callback) { export function addOrder(bikeCode, callback) {
const oUser = uni.getStorageSync("wechat_user"); const oUser =JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
if (!oUser) { if (!oUser) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/user/login/wx_login" url: "/pages/user/login/wx_login"