|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <ay-container v-show="store.user.isLogined">
|
|
|
+ <ay-container v-show="store.user.isLogined" :title="data.title">
|
|
|
<div class="chunk">
|
|
|
<div class="center justify-between top">
|
|
|
<div class="center" @click="methods.goPerson">
|
|
|
@@ -18,7 +18,11 @@
|
|
|
></uni-icons>
|
|
|
</div>
|
|
|
<div class="center">
|
|
|
- <ay-flowLine class="mt-spac mb-spac" :loading="store.webapi.strategy.get_user_qrcode.ing">
|
|
|
+ <ay-flowLine
|
|
|
+ class="mt-spac mb-spac"
|
|
|
+ :lineWidth="4"
|
|
|
+ :loading="store.webapi.strategy.get_user_qrcode.ing"
|
|
|
+ >
|
|
|
<div class="qrcode">
|
|
|
<image
|
|
|
src="@img/qr@3x.png"
|
|
|
@@ -50,23 +54,33 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flex">
|
|
|
- <div class="chunk flex-1 s-fz mr-spac money-bg" @click="methods.goAccount">
|
|
|
- <div class="mb-spacd4">可用余额</div>
|
|
|
- <ay-numer :value="data.accountInfo.totalBalance" :unit="data.accountInfo.unit" />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="chunk flex-1 center justify-start s-fz cars" @click="methods.truckManage">
|
|
|
- <div class="p-color" v-if="data.truckInfo.length === 0">添加车辆</div>
|
|
|
- <div v-else>
|
|
|
- <div class="mb-spacd4">车辆管理</div>
|
|
|
+ <ay-flowLine class="flex-1 mr-spac" :loading="store.webapi.strategy.get_driver_balance.ing">
|
|
|
+ <div class="chunk m0 h-100% s-fz money-bg" @click="methods.goAccount">
|
|
|
+ <div class="mb-spacd4">
|
|
|
+ 可用余额
|
|
|
+ <div class="inline yellow-color ss-fz ml-spacd4" v-if="data.accountInfo.flag === 0">
|
|
|
+ [余额不足]
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ay-numer :value="data.accountInfo.showBalance" :unit="data.accountInfo.unit" />
|
|
|
+ </div>
|
|
|
+ </ay-flowLine>
|
|
|
+ <ay-flowLine class="flex-1" :loading="store.webapi.strategy.get_truck_info.ing">
|
|
|
+ <div class="chunk m0 h-100% s-fz cars" @click="methods.truckManage">
|
|
|
<div>
|
|
|
- <span class="font-bold b-fz">{{ data.truckInfo.length }}</span>
|
|
|
- 辆
|
|
|
+ <div class="mb-spacd4" v-show="showcm">车辆管理</div>
|
|
|
+ <div v-show="store.webapi.strategy.get_truck_info.firstSuccess">
|
|
|
+ <div class="p-color mt-spac" v-if="data.truckInfo.length === 0">添加车辆</div>
|
|
|
+ <div v-else>
|
|
|
+ <span class="font-bold b-fz">{{ data.truckInfo.length }}</span>
|
|
|
+ 辆
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </ay-flowLine>
|
|
|
</div>
|
|
|
- <div class="center justify-around mt-spac">
|
|
|
+ <div class="center justify-around mt-spacm2">
|
|
|
<div
|
|
|
class="text-center menu"
|
|
|
v-for="(m, i) in data.menus"
|
|
|
@@ -78,13 +92,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="chuck list-app">
|
|
|
- <ay-sticky relativeTo="#stations" targetSelector="#stationTop">
|
|
|
+ <ay-sticky :top="topHeightPX" relativeTo="#stations" targetSelector="#stationTop">
|
|
|
<div
|
|
|
class="center justify-between sticky"
|
|
|
id="stationTop"
|
|
|
:class="{ stickyed: data.station.stickyed }"
|
|
|
+ @click="methods.hiddenDoora"
|
|
|
>
|
|
|
- <div class="title">附近加气站</div>
|
|
|
+ <div class="title" @click.stop="methods.hiddenDoorb">附近加气站</div>
|
|
|
<div v-if="data.userLocation" @click="methods.drawerOpen">
|
|
|
{{ data.station.curCity }}
|
|
|
<uni-icons type="down" size="12" />
|
|
|
@@ -92,6 +107,9 @@
|
|
|
</div>
|
|
|
</ay-sticky>
|
|
|
<div v-show="data.userLocation" id="stations">
|
|
|
+ <ay-flowLine :minLoadTime="400" :loading="store.webapi.strategy.list_mini.ing">
|
|
|
+ <div style="height: 2rpx"></div>
|
|
|
+ </ay-flowLine>
|
|
|
<ayb-station
|
|
|
v-for="(la, i) in data.station.listApp"
|
|
|
:key="i"
|
|
|
@@ -100,8 +118,8 @@
|
|
|
</div>
|
|
|
<div
|
|
|
class="center p-color"
|
|
|
- v-show="!data.userLocation"
|
|
|
- @click="methods.getListApp({ first: true })"
|
|
|
+ v-show="!data.firstUnload && !data.userLocation"
|
|
|
+ @click="methods.getListApp({ activation: true })"
|
|
|
>
|
|
|
查看附近加气站
|
|
|
</div>
|
|
|
@@ -128,11 +146,12 @@
|
|
|
</uni-popup-dialog>
|
|
|
</uni-popup>
|
|
|
|
|
|
- <uni-drawer
|
|
|
+ <ay-drawer
|
|
|
ref="drawer"
|
|
|
mode="right"
|
|
|
:maskClick="true"
|
|
|
:width="320"
|
|
|
+ :top="topHeightPX"
|
|
|
@change="methods.drawerChange"
|
|
|
>
|
|
|
<uni-indexed-list
|
|
|
@@ -142,7 +161,7 @@
|
|
|
ref="indexedList"
|
|
|
v-if="data.station.indexedListShow"
|
|
|
/>
|
|
|
- </uni-drawer>
|
|
|
+ </ay-drawer>
|
|
|
<ayb-carNumber ref="carNumber" />
|
|
|
</ay-container>
|
|
|
</template>
|
|
|
@@ -173,13 +192,15 @@ const staticData = {
|
|
|
/** 页面滚动距离 */
|
|
|
scrollTop: 0,
|
|
|
}
|
|
|
-const data = reactive({
|
|
|
+
|
|
|
+const data = ay.initData({
|
|
|
+ /** 未load */
|
|
|
firstUnload: true,
|
|
|
/** 存在未支付完成订单 */
|
|
|
hasnopayfordriver: true,
|
|
|
invite: {} as 预添加司机详情,
|
|
|
truckInfo: [] as PersonDriver对象[],
|
|
|
- accountInfo: { showBalance: { balance: '', suffix: '' } } as IAccountInfo,
|
|
|
+ accountInfo: {} as IAccountInfo,
|
|
|
/** 用户已授权定位 */
|
|
|
userLocation: false,
|
|
|
/** 二维码相关 */
|
|
|
@@ -222,9 +243,36 @@ const data = reactive({
|
|
|
listApp: [],
|
|
|
indexedListShow: false,
|
|
|
},
|
|
|
+ hiddenDoor: [],
|
|
|
+})
|
|
|
+const topHeight = computed(() => config.common.SystemInfo.safeArea.top + 44)
|
|
|
+const topHeightPX = computed(() => `${topHeight.value}px`)
|
|
|
+const showcm = computed(() => {
|
|
|
+ return (
|
|
|
+ !store.webapi.strategy.get_truck_info.firstSuccess ||
|
|
|
+ (store.webapi.strategy.get_truck_info.firstSuccess && data.truckInfo.length)
|
|
|
+ )
|
|
|
})
|
|
|
const methods = ay.initMethods(
|
|
|
{
|
|
|
+ hiddenDoorb() {
|
|
|
+ data.hiddenDoor[data.hiddenDoor.length - 1]++
|
|
|
+ },
|
|
|
+ hiddenDoora() {
|
|
|
+ if (
|
|
|
+ data.hiddenDoor[0] === 3 &&
|
|
|
+ data.hiddenDoor[1] === 1 &&
|
|
|
+ data.hiddenDoor[2] === 2 &&
|
|
|
+ data.hiddenDoor[3] === 4
|
|
|
+ ) {
|
|
|
+ data.hiddenDoor = []
|
|
|
+ uni.setClipboardData({
|
|
|
+ data: JSON.stringify({ userInfo: store.user.userInfo }),
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ data.hiddenDoor.push(0)
|
|
|
+ }
|
|
|
+ },
|
|
|
phone(num) {
|
|
|
uni.makePhoneCall({
|
|
|
phoneNumber: num,
|
|
|
@@ -232,7 +280,7 @@ const methods = ay.initMethods(
|
|
|
},
|
|
|
|
|
|
getTruckInfo() {
|
|
|
- webapi.strategy.get_truck_info().then((res) => {
|
|
|
+ webapi.strategy.get_truck_info({}).then((res) => {
|
|
|
data.truckInfo = aop.request.AR.truckInfo(res)
|
|
|
})
|
|
|
},
|
|
|
@@ -241,6 +289,9 @@ const methods = ay.initMethods(
|
|
|
ay.goPage(config.pages.truckInfo_index)
|
|
|
} else {
|
|
|
carNumber.value.open().then((cn) => {
|
|
|
+ if (store.webapi.strategy.bind_person_truck.ing) {
|
|
|
+ return
|
|
|
+ }
|
|
|
webapi.strategy
|
|
|
.bind_person_truck<{ userId: string }>({
|
|
|
userId: store.user.userInfo.user_id,
|
|
|
@@ -269,7 +320,9 @@ const methods = ay.initMethods(
|
|
|
2() {
|
|
|
ay.goPage(config.pages.org_index)
|
|
|
},
|
|
|
- 3() {},
|
|
|
+ 3() {
|
|
|
+ ay.goPage(config.pages.cards_index)
|
|
|
+ },
|
|
|
}
|
|
|
maps[menu.id]()
|
|
|
},
|
|
|
@@ -287,7 +340,7 @@ const methods = ay.initMethods(
|
|
|
// 小程序环境-每次呈现组件后重新设置winOffsetY
|
|
|
// #ifdef MP
|
|
|
if (indexedList.value) {
|
|
|
- indexedList.value.$data.winOffsetY = staticData.scrollTop
|
|
|
+ indexedList.value.$data.winOffsetY = staticData.scrollTop + topHeight.value
|
|
|
}
|
|
|
// #endif
|
|
|
if (!staticData.indexedListWatcher) {
|
|
|
@@ -296,7 +349,7 @@ const methods = ay.initMethods(
|
|
|
(nv) => {
|
|
|
// 小程序环境仅首次呈现监听到, h5环境每次呈现都会监听到
|
|
|
if (indexedList.value) {
|
|
|
- indexedList.value.$data.winOffsetY = staticData.scrollTop
|
|
|
+ indexedList.value.$data.winOffsetY = staticData.scrollTop + topHeight.value
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -322,7 +375,7 @@ const methods = ay.initMethods(
|
|
|
initWS() {
|
|
|
stompSocket
|
|
|
.init(
|
|
|
- 'wss://dwx.auyen.com/websocket/sockjs',
|
|
|
+ ay.getWebsocketUrl('websocket/sockjs'),
|
|
|
// 传参
|
|
|
{
|
|
|
access_token: store.user.userInfo.token,
|
|
|
@@ -417,6 +470,7 @@ const methods = ay.initMethods(
|
|
|
const ret: { gasstationId?: string; cashierId?: string } = await func.native.scan()
|
|
|
if (!(ret.gasstationId && ret.cashierId)) {
|
|
|
func.native.showToast('二维码无效')
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
const user = await webapi.user.find_6({ userId: ret.cashierId })
|
|
|
@@ -444,8 +498,7 @@ const methods = ay.initMethods(
|
|
|
} else if (gasJudge === 2) {
|
|
|
func.native.showModal({
|
|
|
title: '错误提示',
|
|
|
- content:
|
|
|
- '该加气站未及时补充平台气源,已无法通过大象平台为您提供优质气源,给您带来的不便深感其歉意,如有疑问可以与加气站沟通,亦可拨打大象加气平台客服电话:"400-0165388"',
|
|
|
+ content: `该加气站未及时补充平台气源,已无法通过大象平台为您提供优质气源,给您带来的不便深感其歉意,如有疑问可以与加气站沟通,亦可拨打大象加气平台客服电话:"${store.common.data.phone}"`,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
@@ -496,9 +549,15 @@ const methods = ay.initMethods(
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- async getListApp({ cras = config.common.defAyContainerRefreshArgs, first = false } = {}) {
|
|
|
- // 非首次 && 未授权
|
|
|
- if (!first && !data.userLocation) {
|
|
|
+ async getListApp({
|
|
|
+ cras = config.common.defAyContainerRefreshArgs,
|
|
|
+ activation = false,
|
|
|
+ checkScope = false,
|
|
|
+ } = {}) {
|
|
|
+ if (checkScope) {
|
|
|
+ }
|
|
|
+ // 非激活 && 未授权
|
|
|
+ if (!activation && !data.userLocation) {
|
|
|
// 取消加载中效果
|
|
|
ay.containerLoaded({
|
|
|
reqState: enums.ReqState.cancel,
|
|
|
@@ -508,7 +567,8 @@ const methods = ay.initMethods(
|
|
|
let location = staticData.location
|
|
|
// 上拉不重新获取位置
|
|
|
if (!cras.isAdd) {
|
|
|
- location = await func.native.getLocation()
|
|
|
+ location = await func.native.getLocation(false)
|
|
|
+ if (!location) return
|
|
|
staticData.location = location
|
|
|
}
|
|
|
data.userLocation = true
|
|
|
@@ -523,7 +583,7 @@ const methods = ay.initMethods(
|
|
|
latitude: location.latitude.toString(),
|
|
|
},
|
|
|
},
|
|
|
- { showLoading: first }, // || !cras.isAdd },
|
|
|
+ { showLoading: activation }, // || !cras.isAdd },
|
|
|
)
|
|
|
.then((res) => {
|
|
|
if (cras.isAdd) {
|
|
|
@@ -538,7 +598,7 @@ const methods = ay.initMethods(
|
|
|
if (data.hasnopayfordriver || store.webapi.strategy.get_user_qrcode.ing) {
|
|
|
return
|
|
|
}
|
|
|
- return webapi.strategy.get_user_qrcode({}, { minRTime: 1000 }).then(async (res) => {
|
|
|
+ return webapi.strategy.get_user_qrcode({}, { minRTime: 1e3 }).then(async (res) => {
|
|
|
data.qrcode.img = res
|
|
|
data.qrcode.expire = false
|
|
|
})
|
|
|
@@ -552,13 +612,18 @@ ay.entrance(
|
|
|
async (args) => {
|
|
|
// staticData.entranceArgs = args
|
|
|
const init = async () => {
|
|
|
- webapi.strategy.get_driver_balance().then((res) => {
|
|
|
+ webapi.strategy.get_driver_balance({}).then((res) => {
|
|
|
data.accountInfo = {
|
|
|
...res,
|
|
|
...aop.request.AR.getAccountInfo(res),
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ data.hasnopayfordriver = await methods.checkNopayfordriver()
|
|
|
+ methods.getTruckInfo()
|
|
|
+ }
|
|
|
+ if (args.loadType === enums.LoadType.onLoad) {
|
|
|
+ // data.title = store.curPage?.pageConfig?.title
|
|
|
// #ifdef MP
|
|
|
// 用户是否授权了获取地理位置
|
|
|
await uni
|
|
|
@@ -569,16 +634,12 @@ ay.entrance(
|
|
|
}
|
|
|
})
|
|
|
.catch()
|
|
|
+
|
|
|
// #endif
|
|
|
- methods.getListApp({ cras: args.cras })
|
|
|
- methods.getTruckInfo()
|
|
|
- const nopayfordriver = await methods.checkNopayfordriver()
|
|
|
- data.hasnopayfordriver = nopayfordriver
|
|
|
- }
|
|
|
- if (args.loadType === enums.LoadType.onLoad) {
|
|
|
methods.initWS()
|
|
|
methods.getCityList()
|
|
|
data.station.curCity = uni.getStorageSync(staticData.cctkn) || staticData.defCity
|
|
|
+ methods.getListApp({ cras: args.cras, checkScope: true })
|
|
|
await init()
|
|
|
// 无未支付订单
|
|
|
if (!data.hasnopayfordriver) {
|
|
|
@@ -592,12 +653,10 @@ ay.entrance(
|
|
|
}
|
|
|
|
|
|
if (args.loadType === enums.LoadType.refresh) {
|
|
|
- if (args.cras.isAdd) {
|
|
|
- methods.getListApp({ cras: args.cras })
|
|
|
- } else {
|
|
|
- // 下拉更新
|
|
|
- init()
|
|
|
- }
|
|
|
+ methods.getListApp({ cras: args.cras })
|
|
|
+ // if (!args.cras.isAdd) {
|
|
|
+ // init()
|
|
|
+ // }
|
|
|
}
|
|
|
if (args.loadType === enums.LoadType.onShow) {
|
|
|
init()
|
|
|
@@ -614,6 +673,9 @@ onPageScroll((res) => {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.center-item {
|
|
|
+ min-height: 136rpx;
|
|
|
+}
|
|
|
.top {
|
|
|
padding-bottom: $p-spac;
|
|
|
border-bottom: 1px dashed;
|