用户端代码修改

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 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">
</uni-search-bar>
</view>
@ -78,7 +78,7 @@
import * as api from '@/utils/api.js';
import config from '@/utils/config';
import {
onLoad
onLoad,onShow
} from '@dcloudio/uni-app';
const isCancelOrClear = ref(false);
@ -142,19 +142,22 @@
selectedOption.value = option;
paging.value.reload();
};
const blur = (value) => {
if (value == searchValue.value) return;
const blur = (res) => {
if (res.value != searchValue.value) {
paging.value.reload();
};
};
onShow(() => {
searchValue.value = "";
loadMoreData(1,4)
})
const cancel = (value) => {
if (value == "") return;
// api.callEbikeInfo("getVehicleDetailsByRegionId?regionId=275024268783185920",{},"get")
searchValue.value = "";
paging.value.reload();
}
const clearSearch = (value) => {
if (value == "") return;
searchValue.value = "";
paging.value.reload();
}

View File

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

View File

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

View File

@ -3,6 +3,10 @@
<view>
<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="车辆编号">
<bikeCodeScan ref="childComponent" @scan-change="bikeCodeScanChange" :codeValue="newbikeCode" />
</uni-forms-item>
@ -71,10 +75,12 @@
const orderId = ref("");
const fileLists = ref([]);
const reginvalue = ref("");
const regindata = ref([]);
const newbikeCode = ref("");
const dispatchRecords = ref([]);
const scheduleExtension = ref({})
const navButtonGroup = [{
text: '完成投放',
backgroundColor: 'rgb(0,120,212)',
@ -82,20 +88,37 @@
}];
const changeZT = (e) => {
console.log("e:", e);
}
onLoad((options) => {
orderId.value = options.orderId;
});
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();
})
const getInfoList = () => {
api.callEbikeInfo("getDispatchVehicleByOrderId?orderId=" + orderId.value, {}, "get").then(
res => {
if (res.code == 200) {
dispatchRecords.value = res.data.dispatchRecords;
scheduleExtension.value = res.data.scheduleExtension
}
})
}
@ -188,8 +211,8 @@
"orderId": orderId.value,
"bikeCode": bikeCode,
"dispatchState": 0,
"startVehicleLat":latitude,
"startVehicleLng":longitude
"startVehicleLat": latitude,
"startVehicleLng": longitude
}
newbikeCode.value = bikeCode;
api.callEbikeInfo("createDispatchRecord", params)
@ -223,8 +246,23 @@
} = res;
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 = {
"orderId": orderId.value,
"siteId": scheduleExtension.value.siteId,
"fileLists": fileLists.value
}
api.callEbikeInfo("completeDeployment", params).then(res => {

View File

@ -6,29 +6,29 @@
<image class="divImg" :src='imgPath+"static/userui/home/money.png"' />
</label>
<label>待支付</label>
<label>{{data.hj}}</label>
<label>{{data.totalAmount}}</label>
</div>
<div class="divFont">
{{data.sj}}
{{data.createdAt}}
</div>
<div class="divTitle2">
费用明细
</div>
<div class="divRow divFont">
<label>起步价</label>
<label>{{data.qbj}}</label>
<div class="divRow divFont" v-for="(item,index) in data.details" :key="index">
<label>{{item.itemName}}</label>
<label>{{item.itemAmount}}</label>
</div>
<div class="divRow divFont">
<!-- <div class="divRow divFont">
<label>时长费</label>
<label>{{data.scf}}</label>
</div>
</div> -->
<div class="divHJ">
<label>合计</label>
<label>{{data.hj}}</label>
<label>{{data.totalAmount}}</label>
</div>
</div>
<div>
<div class="divBtn">
<div class="divBtn" @click="handlePaymentClick">
<label>
<uni-icons custom-prefix="iconfont" type="icon-ebikeweixin" color="white" size="25" />
</label>
@ -41,14 +41,16 @@
<script setup>
import {
ref,onMounted
ref,
onMounted
} from 'vue';
import config from '@/utils/config';
import * as api from '@/utils/api.js';
import {
showModelMessage
} from "@/utils/tools.js";
const imgPath = config.imgPath;
const props = defineProps(["orderid"]);
const props = defineProps(["orderId"]);
const data = ref({
hj: "2.5",
sj: "2025-04-03 14:15:13",
@ -56,9 +58,65 @@
scf: "0.5"
})
onMounted(()=>{
showModelMessage("该功能暂未实现!")
onMounted(() => {
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>
<style scoped>

View File

@ -108,7 +108,7 @@
<bike-info :bikedata="bikeData" @close="closeBikeInfo" />
</div>
<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>
</template>
@ -121,7 +121,7 @@
} from 'vue';
import {
showModelMessage,
getUrlParams
getUrlParams,jkcBaseDecode
} from "@/utils/tools.js";
import {
callOrdereApi,
@ -591,7 +591,7 @@
getLoalcationData();
})
onShow(() => {
oUser = uni.getStorageSync("wechat_user");
oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
console.log("7777777777777777777777","oUser", oUser)
const {

View File

@ -88,7 +88,7 @@
} from 'vue';
import * as api from '@/utils/api.js';
import {
showModelMessage
showModelMessage,jkcBaseDecode
} from '@/utils/tools.js';
import {
onLoad
@ -359,7 +359,7 @@
const currentCoordinates = ref(null);
onLoad((options) => {
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 screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight;

View File

@ -51,7 +51,7 @@
import * as api from '@/utils/api.js';
import config from '@/utils/config';
import {
showModelMessage
showModelMessage,jkcBaseEncode,jkcBaseDecode
} from '@/utils/tools.js';
const imgPath = config.imgPath;
const isAgreed = ref([]); //
@ -91,7 +91,7 @@
.then((info) => {
isloading.value = false;
if (info.code == 200) {
uni.setStorageSync('wechat_user', info.data);
uni.setStorageSync('wechat_user', jkcBaseEncode(JSON.stringify(info.data)));
phone.value = info.data.mobile;
if (!info.data.nickname) {
updateUserProfile();
@ -106,7 +106,7 @@
if (re.code == 200) {
params.userId = re.data;
uni.setStorageSync('wechat_user',
params);
jkcBaseEncode(JSON.stringify(params)));
updateUserProfile();
}
});
@ -139,7 +139,8 @@
success: function(res) {
console.log(res.userInfo.nickName); //
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 = {
"userId": wechat_user.userId,
"nickname": res.userInfo.nickName,
@ -171,7 +172,7 @@
//
wx.login({
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 iv = e.detail.iv;
const param = {
@ -205,7 +206,7 @@
//
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) {
return false;
}

View File

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

View File

@ -28,7 +28,7 @@
} from 'vue';
import {
showModelMessage,
getUrlParams
getUrlParams,jkcBaseDecode
} from "@/utils/tools.js";
import {
callOrdereApi
@ -38,7 +38,7 @@
const imgPath = config.imgPath;
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 focus = ref(true);
const btnDis = ref(true);

View File

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

View File

@ -16,6 +16,9 @@ export const callOperateApi = (url, parmas = {}, method = 'post') => {
export const callOrdereApi = (url, parmas = {}, method = 'post') => {
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') => {
return HttpRequest(baseUrl + "maintenance/" + url, method, parmas);

View File

@ -1,5 +1,4 @@
import Base64 from './base64';
export const formatTime = date => {
const year = date.getFullYear()
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') : "";
};
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) {
return Base64.encode(text);
@ -110,8 +137,8 @@ export function getUrlParams(url) {
return params;
}
export function isNullOrEmpty(value){
if(typeof(value) == "undefined" || value == null || value == "")
export function isNullOrEmpty(value) {
if (typeof(value) == "undefined" || value == null || value == "")
return true;
else
return false;

View File

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