|
@@ -3,22 +3,10 @@
|
|
|
<div class="chunk">
|
|
<div class="chunk">
|
|
|
<div class="center justify-between top">
|
|
<div class="center justify-between top">
|
|
|
<div class="center" @click="methods.goPerson">
|
|
<div class="center" @click="methods.goPerson">
|
|
|
- <image
|
|
|
|
|
- class="personal"
|
|
|
|
|
- v-if="store.user.userInfo.head_url"
|
|
|
|
|
- :src="store.user.userInfo.head_url"
|
|
|
|
|
- mode="scaleToFill"
|
|
|
|
|
- />
|
|
|
|
|
- <image
|
|
|
|
|
- class="personal"
|
|
|
|
|
- v-else
|
|
|
|
|
- src="@img/icons/turnk_number_head.png"
|
|
|
|
|
- mode="scaleToFill"
|
|
|
|
|
- />
|
|
|
|
|
- <!-- <uni-icons type="contact" size="50" class="personal"></uni-icons> -->
|
|
|
|
|
|
|
+ <image class="personal" :src="store.user.userInfo.head_url" mode="scaleToFill" />
|
|
|
<div>
|
|
<div>
|
|
|
<div>{{ store.user.userInfo.user_name }}</div>
|
|
<div>{{ store.user.userInfo.user_name }}</div>
|
|
|
- <div class="mobile">{{ store.user.userInfo.mobile }}</div>
|
|
|
|
|
|
|
+ <div class="mobile">{{ store.user.userInfo.mobileDes }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<uni-icons
|
|
<uni-icons
|
|
@@ -30,30 +18,34 @@
|
|
|
></uni-icons>
|
|
></uni-icons>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="center">
|
|
<div class="center">
|
|
|
- <ay-flowLine class="mt-spac mb-spac">
|
|
|
|
|
|
|
+ <ay-flowLine class="mt-spac mb-spac" :loading="store.webapi.strategy.get_user_qrcode.ing">
|
|
|
<div class="qrcode">
|
|
<div class="qrcode">
|
|
|
<image
|
|
<image
|
|
|
src="@img/qr@3x.png"
|
|
src="@img/qr@3x.png"
|
|
|
class="image"
|
|
class="image"
|
|
|
mode="aspectFit"
|
|
mode="aspectFit"
|
|
|
- v-if="data.qrcode.expire"
|
|
|
|
|
|
|
+ v-if="data.hasnopayfordriver || data.qrcode.expire"
|
|
|
@click="methods.getQrcode"
|
|
@click="methods.getQrcode"
|
|
|
/>
|
|
/>
|
|
|
<image :src="data.qrcode.img" class="image" mode="aspectFit" v-else />
|
|
<image :src="data.qrcode.img" class="image" mode="aspectFit" v-else />
|
|
|
</div>
|
|
</div>
|
|
|
</ay-flowLine>
|
|
</ay-flowLine>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="center">
|
|
|
|
|
- <template v-if="data.qrcode.expire">
|
|
|
|
|
- 二维码已失效
|
|
|
|
|
- <div class="center p-color" @click="methods.getQrcode(true)">
|
|
|
|
|
- <uni-icons type="refresh" color="" size="24"></uni-icons>
|
|
|
|
|
- 刷新
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template v-else>
|
|
|
|
|
- 有效时间:
|
|
|
|
|
- <ay-countdown :seconds="300" @ender="data.qrcode.expire = true" />
|
|
|
|
|
|
|
+ <div class="center qrcode-text">
|
|
|
|
|
+ <template v-if="!data.firstUnload">
|
|
|
|
|
+ <template v-if="data.hasnopayfordriver">存在未支付完成订单</template>
|
|
|
|
|
+ <template v-else-if="data.qrcode.expire">
|
|
|
|
|
+ 二维码已失效
|
|
|
|
|
+ <ay-refresh
|
|
|
|
|
+ :iconSize="36"
|
|
|
|
|
+ :loading="store.webapi.strategy.get_user_qrcode.ing"
|
|
|
|
|
+ @refresh="methods.getQrcode"
|
|
|
|
|
+ ></ay-refresh>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ 有效时间:
|
|
|
|
|
+ <ay-countdown :seconds="data.qrcode.seconds" @ender="data.qrcode.expire = true" />
|
|
|
|
|
+ </template>
|
|
|
</template>
|
|
</template>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -116,6 +108,27 @@
|
|
|
查看附近加气站
|
|
查看附近加气站
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <uni-popup ref="inputDialog" type="dialog">
|
|
|
|
|
+ <uni-popup-dialog
|
|
|
|
|
+ mode="input"
|
|
|
|
|
+ title="邀请通知"
|
|
|
|
|
+ confirmText="加入"
|
|
|
|
|
+ cancelText="拒绝"
|
|
|
|
|
+ :beforeClose="true"
|
|
|
|
|
+ @confirm="methods.agree"
|
|
|
|
|
+ @close="methods.disagree"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="text-center w-100%">
|
|
|
|
|
+ <div class="mb-spacd2 text-center">
|
|
|
|
|
+ 【{{ data.invite?.org?.orgName }}】邀请您加入成为其司机
|
|
|
|
|
+ <span class="p-color" @click="methods.phone(data.invite?.org?.mobile)">
|
|
|
|
|
+ <uni-icons type="phone" color="" class="mr-spacd4" size="none"></uni-icons>
|
|
|
|
|
+ <span>{{ data.invite?.org?.mobile }}</span>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </uni-popup-dialog>
|
|
|
|
|
+ </uni-popup>
|
|
|
|
|
|
|
|
<uni-drawer
|
|
<uni-drawer
|
|
|
ref="drawer"
|
|
ref="drawer"
|
|
@@ -145,7 +158,7 @@ import card from '@img/icons/card.png'
|
|
|
const drawer = ref()
|
|
const drawer = ref()
|
|
|
const indexedList = ref()
|
|
const indexedList = ref()
|
|
|
const carNumber = ref()
|
|
const carNumber = ref()
|
|
|
-
|
|
|
|
|
|
|
+const inputDialog = ref()
|
|
|
const staticData = {
|
|
const staticData = {
|
|
|
/** 选择的城市 缓存key名 */
|
|
/** 选择的城市 缓存key名 */
|
|
|
cctkn: 'chooseCity',
|
|
cctkn: 'chooseCity',
|
|
@@ -163,12 +176,18 @@ const staticData = {
|
|
|
scrollTop: 0,
|
|
scrollTop: 0,
|
|
|
}
|
|
}
|
|
|
const data = reactive({
|
|
const data = reactive({
|
|
|
|
|
+ firstUnload: true,
|
|
|
|
|
+ // 存在未支付完成订单
|
|
|
|
|
+ hasnopayfordriver: true,
|
|
|
|
|
+ invite: {} as 预添加司机详情,
|
|
|
truckInfo: [] as PersonDriver对象[],
|
|
truckInfo: [] as PersonDriver对象[],
|
|
|
accountInfo: { showBalance: { balance: '', suffix: '' } } as IAccountInfo,
|
|
accountInfo: { showBalance: { balance: '', suffix: '' } } as IAccountInfo,
|
|
|
/** 用户已授权定位 */
|
|
/** 用户已授权定位 */
|
|
|
userLocation: false,
|
|
userLocation: false,
|
|
|
/** 二维码相关 */
|
|
/** 二维码相关 */
|
|
|
qrcode: {
|
|
qrcode: {
|
|
|
|
|
+ /** 有效时长 m */
|
|
|
|
|
+ seconds: 300, // 10,
|
|
|
/** 二维码 */
|
|
/** 二维码 */
|
|
|
img: null,
|
|
img: null,
|
|
|
/** 已过期 */
|
|
/** 已过期 */
|
|
@@ -206,9 +225,14 @@ const data = reactive({
|
|
|
indexedListShow: false,
|
|
indexedListShow: false,
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
-const methods =
|
|
|
|
|
- // ay.initMethods(
|
|
|
|
|
|
|
+const methods = ay.initMethods(
|
|
|
{
|
|
{
|
|
|
|
|
+ phone(num) {
|
|
|
|
|
+ uni.makePhoneCall({
|
|
|
|
|
+ phoneNumber: num,
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
getTruckInfo() {
|
|
getTruckInfo() {
|
|
|
webapi.strategy.get_truck_info().then((res) => {
|
|
webapi.strategy.get_truck_info().then((res) => {
|
|
|
data.truckInfo = aop.request.AR.truckInfo(res)
|
|
data.truckInfo = aop.request.AR.truckInfo(res)
|
|
@@ -239,7 +263,7 @@ const methods =
|
|
|
goPage(menu) {
|
|
goPage(menu) {
|
|
|
const maps = {
|
|
const maps = {
|
|
|
0() {
|
|
0() {
|
|
|
- methods.goPrePay()
|
|
|
|
|
|
|
+ methods.checkNopayfordriver(1)
|
|
|
},
|
|
},
|
|
|
1() {
|
|
1() {
|
|
|
ay.goPage(config.pages.order_index)
|
|
ay.goPage(config.pages.order_index)
|
|
@@ -344,50 +368,58 @@ const methods =
|
|
|
JSON.stringify({ content: '1212' }),
|
|
JSON.stringify({ content: '1212' }),
|
|
|
)
|
|
)
|
|
|
},
|
|
},
|
|
|
- async goPrePay(type: 0 | 1 = 0) {
|
|
|
|
|
|
|
+ /** 检查未支付
|
|
|
|
|
+ * type 0:仅检查 1:点击待支付订单 2:点击扫码
|
|
|
|
|
+ * */
|
|
|
|
|
+ async checkNopayfordriver(type: 0 | 1 | 2 = 0) {
|
|
|
const nopayfordriver = await webapi.pay.find_unpayfordriver()
|
|
const nopayfordriver = await webapi.pay.find_unpayfordriver()
|
|
|
|
|
+ // 存在 未支付(待支付、支付中、支付异常)
|
|
|
if (nopayfordriver) {
|
|
if (nopayfordriver) {
|
|
|
- // 跳未支付
|
|
|
|
|
- ay.goPage(config.pages.order_prePay, { params: { orderId: nopayfordriver.orderId } })
|
|
|
|
|
|
|
+ if (type === 1) {
|
|
|
|
|
+ if (nopayfordriver.settleStatus === 1) {
|
|
|
|
|
+ // 跳未支付
|
|
|
|
|
+ ay.goPage(config.pages.order_prePay, { params: { orderId: nopayfordriver.orderId } })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (type === 2) {
|
|
|
|
|
+ func.native
|
|
|
|
|
+ .showModal({
|
|
|
|
|
+ title: '温馨提示',
|
|
|
|
|
+ content: '存在未支付完成订单',
|
|
|
|
|
+ showCancel: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ if (nopayfordriver.settleStatus === 1) {
|
|
|
|
|
+ ay.goPage(config.pages.order_prePay, {
|
|
|
|
|
+ params: { orderId: nopayfordriver.orderId },
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ay.goPage(config.pages.order_orderDetail, {
|
|
|
|
|
+ params: { orderId: nopayfordriver.orderId },
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
return true
|
|
return true
|
|
|
} else {
|
|
} else {
|
|
|
- if (type === 0) {
|
|
|
|
|
|
|
+ if (type === 1) {
|
|
|
func.native.showToast('暂无待支付订单!')
|
|
func.native.showToast('暂无待支付订单!')
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
async scanCode() {
|
|
async scanCode() {
|
|
|
- if (await methods.goPrePay(1)) {
|
|
|
|
|
|
|
+ if (await methods.checkNopayfordriver(2)) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- const reqStr = await uni
|
|
|
|
|
- .scanCode({
|
|
|
|
|
- scanType: ['qrcode'],
|
|
|
|
|
- })
|
|
|
|
|
- .catch((err) => {
|
|
|
|
|
- // 二维码解析失败
|
|
|
|
|
- if (err.errMsg !== 'scanCode:fail cancel') {
|
|
|
|
|
- func.native.showToast('二维码无效')
|
|
|
|
|
- }
|
|
|
|
|
- return Promise.reject(err)
|
|
|
|
|
- })
|
|
|
|
|
- let ret = { gasstationId: '', cashierId: '' }
|
|
|
|
|
- try {
|
|
|
|
|
- ret = JSON.parse(reqStr.result)
|
|
|
|
|
- // 没有包含必要信息
|
|
|
|
|
- if (!(ret.gasstationId && ret.cashierId)) {
|
|
|
|
|
- func.native.showToast('二维码无效')
|
|
|
|
|
- }
|
|
|
|
|
- } catch {
|
|
|
|
|
- // 反序列化失败
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const ret: { gasstationId?: string; cashierId?: string } = await func.native.scan()
|
|
|
|
|
+ if (!(ret.gasstationId && ret.cashierId)) {
|
|
|
func.native.showToast('二维码无效')
|
|
func.native.showToast('二维码无效')
|
|
|
- return
|
|
|
|
|
}
|
|
}
|
|
|
- // const ret = {
|
|
|
|
|
- // cashierId: '710613333157822464',
|
|
|
|
|
- // gasstationId: '710613333157822464',
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+
|
|
|
const user = await webapi.user.find_6({ userId: ret.cashierId })
|
|
const user = await webapi.user.find_6({ userId: ret.cashierId })
|
|
|
if (ret.gasstationId === user.user.orgId) {
|
|
if (ret.gasstationId === user.user.orgId) {
|
|
|
const price = await webapi.strategy.find_price({
|
|
const price = await webapi.strategy.find_price({
|
|
@@ -425,8 +457,36 @@ const methods =
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- sdfsdf() {
|
|
|
|
|
- webapi.strategy.get_truck_info().then((res) => {})
|
|
|
|
|
|
|
+ /** 同意加入 */
|
|
|
|
|
+ agree() {
|
|
|
|
|
+ webapi.user.agree({ id: data.invite.driverWhiteList.id }).then((res) => {
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ func.native.showToast('加入成功,请重新登录').then(() => {
|
|
|
|
|
+ store.user.clearUserInfo()
|
|
|
|
|
+ })
|
|
|
|
|
+ inputDialog.value.close()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 拒绝加入 */
|
|
|
|
|
+ disagree() {
|
|
|
|
|
+ webapi.user.disagree({ id: data.invite.driverWhiteList.id }).then((res) => {
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ func.native.showToast('已拒绝')
|
|
|
|
|
+ inputDialog.value.close()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 获取邀请信息 */
|
|
|
|
|
+ getInvite() {
|
|
|
|
|
+ webapi.user
|
|
|
|
|
+ .find_by_driver_mobile({ driverMobile: store.user.userInfo.mobile })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ if (res.driverWhiteList && res.org) {
|
|
|
|
|
+ data.invite = res
|
|
|
|
|
+ inputDialog.value.open()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
getCityList() {
|
|
getCityList() {
|
|
|
webapi.strategy.city_list().then((res) => {
|
|
webapi.strategy.city_list().then((res) => {
|
|
@@ -477,20 +537,22 @@ const methods =
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- getQrcode(refresh = false) {
|
|
|
|
|
- return webapi.strategy.get_user_qrcode().then(async (res) => {
|
|
|
|
|
- // await func.awaiter()
|
|
|
|
|
|
|
+ getQrcode() {
|
|
|
|
|
+ if (data.hasnopayfordriver || store.webapi.strategy.get_user_qrcode.ing) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ return webapi.strategy.get_user_qrcode({}, { minRTime: 1000 }).then(async (res) => {
|
|
|
data.qrcode.img = res
|
|
data.qrcode.img = res
|
|
|
data.qrcode.expire = false
|
|
data.qrcode.expire = false
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- }
|
|
|
|
|
-// {
|
|
|
|
|
-// scanCode: { showLoading: true },
|
|
|
|
|
-// },
|
|
|
|
|
-// )
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ scanCode: { showLoading: true },
|
|
|
|
|
+ },
|
|
|
|
|
+)
|
|
|
ay.entrance(
|
|
ay.entrance(
|
|
|
- (args) => {
|
|
|
|
|
|
|
+ async (args) => {
|
|
|
// staticData.entranceArgs = args
|
|
// staticData.entranceArgs = args
|
|
|
const init = async () => {
|
|
const init = async () => {
|
|
|
webapi.strategy.get_driver_balance().then((res) => {
|
|
webapi.strategy.get_driver_balance().then((res) => {
|
|
@@ -513,19 +575,30 @@ ay.entrance(
|
|
|
// #endif
|
|
// #endif
|
|
|
methods.getListApp({ cras: args.cras })
|
|
methods.getListApp({ cras: args.cras })
|
|
|
methods.getTruckInfo()
|
|
methods.getTruckInfo()
|
|
|
|
|
+ const nopayfordriver = await methods.checkNopayfordriver()
|
|
|
|
|
+ data.hasnopayfordriver = nopayfordriver
|
|
|
}
|
|
}
|
|
|
if (args.loadType === enums.LoadType.onLoad) {
|
|
if (args.loadType === enums.LoadType.onLoad) {
|
|
|
methods.initWS()
|
|
methods.initWS()
|
|
|
- methods.getQrcode()
|
|
|
|
|
methods.getCityList()
|
|
methods.getCityList()
|
|
|
data.station.curCity = uni.getStorageSync(staticData.cctkn) || staticData.defCity
|
|
data.station.curCity = uni.getStorageSync(staticData.cctkn) || staticData.defCity
|
|
|
- init()
|
|
|
|
|
|
|
+ await init()
|
|
|
|
|
+ // 无未支付订单
|
|
|
|
|
+ if (!data.hasnopayfordriver) {
|
|
|
|
|
+ await methods.getQrcode()
|
|
|
|
|
+ }
|
|
|
|
|
+ data.firstUnload = false
|
|
|
|
|
+ // 小程序环境:时机过早会inputDialog.value为null
|
|
|
|
|
+ // h5环境:当页面data内的值改变时,弹框会消失
|
|
|
|
|
+ // 所有先放这里吧
|
|
|
|
|
+ methods.getInvite()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (args.loadType === enums.LoadType.refresh) {
|
|
if (args.loadType === enums.LoadType.refresh) {
|
|
|
if (args.cras.isAdd) {
|
|
if (args.cras.isAdd) {
|
|
|
methods.getListApp({ cras: args.cras })
|
|
methods.getListApp({ cras: args.cras })
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // 下拉更新
|
|
|
init()
|
|
init()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -591,6 +664,9 @@ onPageScroll((res) => {
|
|
|
margin: -40rpx;
|
|
margin: -40rpx;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+.qrcode-text {
|
|
|
|
|
+ height: $p-fz;
|
|
|
|
|
+}
|
|
|
.truck {
|
|
.truck {
|
|
|
width: 152rpx;
|
|
width: 152rpx;
|
|
|
height: 116rpx;
|
|
height: 116rpx;
|
|
@@ -661,4 +737,9 @@ $bgc: rgba($p-color, 0.4);
|
|
|
::v-deep .uni-indexed-list__menu-item {
|
|
::v-deep .uni-indexed-list__menu-item {
|
|
|
width: 20px;
|
|
width: 20px;
|
|
|
}
|
|
}
|
|
|
|
|
+::v-deep .uni-popup__info {
|
|
|
|
|
+ @apply: font-bold;
|
|
|
|
|
+ font-size: $bs-fz;
|
|
|
|
|
+ color: unset;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|