xiaozy #2
@@ -1,12 +1,12 @@
|
||||
import request from '@/utils/request'
|
||||
const service_name = "oil-site"
|
||||
const group_name = "oilSiteOrderInfo"
|
||||
const service_name = 'oil-site'
|
||||
const group_name = 'oilSiteOrderInfo'
|
||||
const Img_name = 'oil-interfaces'
|
||||
export default {
|
||||
// 下单
|
||||
createOrder(data) {
|
||||
return request({
|
||||
url: `/oil-site/oilSiteOrderInfo/createH5Order`,
|
||||
url: `/oil-site/oilSiteOrderInfo/createOrder`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
@@ -35,7 +35,7 @@ export default {
|
||||
},
|
||||
getOrderPayInfo(id) {
|
||||
return request({
|
||||
url: `/${service_name}/${group_name}/getOrderPayInfoH5/${id}`,
|
||||
url: `/${service_name}/${group_name}/getOrderPayInfo/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
@@ -76,5 +76,5 @@ export default {
|
||||
url: `/oil-finance/xoilUreaOrderRelation/queryBarrelOrderDetails?orderId=${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import useStore from './store/piniaIndex'
|
||||
|
||||
import { obtainUrlPathParameterTarget } from '@/utils/index.js'
|
||||
|
||||
import { getToken, removeToken } from '@/utils/auth'
|
||||
import { setToken, getToken, removeToken } from '@/utils/auth'
|
||||
import { Notify } from 'vant'
|
||||
|
||||
let whiteList = ['/home']
|
||||
@@ -16,17 +16,25 @@ router.beforeEach(async (to, from, next) => {
|
||||
// removeToken()
|
||||
!whiteList.includes(to.path) && store.getPosition()
|
||||
|
||||
// store.login({ username: '15098826302', networkId: '1522478429548756992' })
|
||||
|
||||
if (!token) {
|
||||
// let paramsTarget = obtainUrlPathParameterTarget(location.href)
|
||||
// sessionStorage.setItem('paramsTarget', JSON.stringify(paramsTarget))
|
||||
// store.login(paramsTarget).then(
|
||||
// () => {
|
||||
// next()
|
||||
// },
|
||||
// () => {
|
||||
// Notify('登陆失败,请退出重试')
|
||||
// }
|
||||
// )
|
||||
let paramsTarget = obtainUrlPathParameterTarget(location.href)
|
||||
sessionStorage.setItem('paramsTarget', JSON.stringify(paramsTarget))
|
||||
store.login(paramsTarget).then(
|
||||
() => {
|
||||
if (paramsTarget.token) {
|
||||
setToken(paramsTarget.token)
|
||||
store.getUser()
|
||||
next()
|
||||
},
|
||||
() => {
|
||||
Notify('登陆失败,请退出重试')
|
||||
}
|
||||
)
|
||||
} else Notify('登陆失败,请退出重试')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -40,12 +48,13 @@ router.beforeEach(async (to, from, next) => {
|
||||
// }
|
||||
// }
|
||||
//拦截 如果不是去首页 还没有token直接去首页
|
||||
if (to.path !== '/' && !token) {
|
||||
Notify('请检查登陆状态')
|
||||
next({ path: '/' })
|
||||
} else {
|
||||
// if (to.path !== '/home' && !token) {
|
||||
// Notify('请检查登陆状态')
|
||||
// next({ path: '/' })
|
||||
// } else {
|
||||
|
||||
// }
|
||||
next()
|
||||
}
|
||||
}, 0)
|
||||
})
|
||||
|
||||
|
||||
@@ -119,13 +119,14 @@ const instance = defineStore('user', {
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code === 20000) {
|
||||
setToken(res.data.accessToken)
|
||||
this.getUser()
|
||||
// setToken(res.data.accessToken)
|
||||
// this.getUser()
|
||||
}
|
||||
})
|
||||
}
|
||||
return Promise.reject()
|
||||
},
|
||||
|
||||
clearToken() {
|
||||
removeToken()
|
||||
}
|
||||
|
||||
@@ -63,8 +63,14 @@ service.interceptors.response.use(
|
||||
// let paramsTargetJson = sessionStorage.getItem('paramsTarget')
|
||||
// let paramsTarget = JSON.parse(paramsTargetJson)
|
||||
// instance.login(paramsTarget).then(location.reload())
|
||||
// removeToken()
|
||||
// location.reload()
|
||||
Notify({
|
||||
message: '登陆失败,请退出重试',
|
||||
onClose: () => {
|
||||
removeToken()
|
||||
location.reload()
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (![20000].includes(res.code)) {
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
<template>
|
||||
<div class="cashier">
|
||||
<div class="payment-time">
|
||||
<div class="payment-number">¥{{Number(orderData.realAmount).toFixed(2)}}</div>
|
||||
<div v-if="time!==0" class="time flex jc ac">
|
||||
<div class="payment-number">¥{{ Number(orderData.realAmount).toFixed(2) }}</div>
|
||||
<div v-if="time !== 0" class="time flex jc ac">
|
||||
支付时间剩余:
|
||||
<van-count-down style="color:#999999" format="mm:ss" :time="time" />
|
||||
</div>
|
||||
<div style="color:#fe0505" class="time" v-else>
|
||||
支付已过期
|
||||
<van-count-down style="color: #999999" format="mm:ss" :time="time" />
|
||||
</div>
|
||||
<div style="color: #fe0505" class="time" v-else>支付已过期</div>
|
||||
</div>
|
||||
<div class="payment-method">
|
||||
<div @click="cardIndex = index" v-for="(item, index) in cardList" :key="index" class="payment-method-item flex bw ac">
|
||||
<span>企业{{item.cardType?'外请':'自营'}}油卡支付(余额:{{item.balance?item.balance:0}})</span>
|
||||
<van-icon :color="cardIndex==index? '#ff6700' : '#C9C7C7' " name="success" />
|
||||
<span>企业{{ item.cardType ? '外请' : '自营' }}油卡支付(余额:{{ item.balance ? item.balance : 0 }})</span>
|
||||
<van-icon :color="cardIndex == index ? '#ff6700' : '#C9C7C7'" name="success" />
|
||||
</div>
|
||||
</div>
|
||||
<detailsCard :title="'请提醒加油员使用 <span>“星油云站”</span> 进行订单核实'" :detailsList='detailsList'>
|
||||
</detailsCard>
|
||||
<div @click="goplay" :class="time==0?'debgcolor': '' " class="payment-footer flex ac jc">立即支付</div>
|
||||
<detailsCard :title="'请提醒加油员使用 <span>“星油云站”</span> 进行订单核实'" :detailsList="detailsList"> </detailsCard>
|
||||
<div @click="goplay" :class="time == 0 ? 'debgcolor' : ''" class="payment-footer flex ac jc">立即支付</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -31,10 +28,10 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cardIndex:0,
|
||||
cardList:[],
|
||||
cardIndex: 0,
|
||||
cardList: [],
|
||||
time: 600000,
|
||||
orderData:null,
|
||||
orderData: null,
|
||||
detailsCardTitle: {},
|
||||
detailsList: [
|
||||
[
|
||||
@@ -44,7 +41,7 @@ export default {
|
||||
valueStyle: {
|
||||
color: ''
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
@@ -58,7 +55,7 @@ export default {
|
||||
{
|
||||
lable: '加油升数:',
|
||||
value: '100L'
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
[
|
||||
@@ -79,8 +76,7 @@ export default {
|
||||
valueStyle: {
|
||||
color: '#FF0000'
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
@@ -89,76 +85,91 @@ export default {
|
||||
valueStyle: {
|
||||
color: '#FF0000'
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
]
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.orderData = JSON.parse(this.$route.query.order);
|
||||
this.time = this.getCountDownTime(this.orderData.createTime);
|
||||
this.updateDetails();
|
||||
this.cardListFn();
|
||||
created() {
|
||||
this.orderData = JSON.parse(this.$route.query.order)
|
||||
console.log('this.orderData', this.orderData)
|
||||
this.time = this.getCountDownTime(this.orderData.createTime)
|
||||
this.updateDetails()
|
||||
|
||||
this.cardListFn()
|
||||
},
|
||||
methods:{
|
||||
cardListFn(){
|
||||
let a = this.orderData.companyAccounts?this.orderData.companyAccounts.map(item=>{item['cardType'] = 0;return item}):[];
|
||||
let b = this.orderData.otherAccounts?this.orderData.otherAccounts.map(item=>{item['cardType'] = 1;return item}):[];
|
||||
this.cardList = [...a,...b];
|
||||
methods: {
|
||||
cardListFn() {
|
||||
let a = this.orderData.companyAccounts
|
||||
? this.orderData.companyAccounts.map(item => {
|
||||
item['cardType'] = 0
|
||||
return item
|
||||
})
|
||||
: []
|
||||
let b = this.orderData.otherAccounts
|
||||
? this.orderData.otherAccounts.map(item => {
|
||||
item['cardType'] = 1
|
||||
return item
|
||||
})
|
||||
: []
|
||||
this.cardList = [...a, ...b]
|
||||
},
|
||||
updateDetails(){
|
||||
this.detailsList[0][0].value = this.orderData.orderSerialNumber||'暂无数据';
|
||||
this.detailsList[1][0].value = this.orderData.siteName||'暂无数据';
|
||||
this.detailsList[1][1].value = this.orderData.oilsCode + ' '+ this.orderData.oilsBar+'号枪' ||'暂无数据';
|
||||
this.detailsList[1][2].value = Number(this.orderData.volume).toFixed(2) + 'L'||'暂无数据';
|
||||
this.detailsList[2][0].value = '¥'+Number(this.orderData.xoilAmountGun).toFixed(2)|| '¥'+Number(this.orderData.baseRealPriceAmount).toFixed(2)||'暂无数据';
|
||||
this.detailsList[2][1].value = '-¥'+Number(this.orderData.oilDiscountAmount).toFixed(2)||'-¥'+ Number(this.orderData.discountAmount).toFixed(2)||'暂无数据';
|
||||
this.detailsList[2][2].value = '-¥'+Number(this.orderData.couponDiscountAmount).toFixed(2)||'暂无数据';
|
||||
this.detailsList[3][0].value = '¥'+Number(this.orderData.realAmount).toFixed(2)||'暂无数据';
|
||||
updateDetails() {
|
||||
this.detailsList[0][0].value = this.orderData.orderSerialNumber || '暂无数据'
|
||||
this.detailsList[1][0].value = this.orderData.siteName || '暂无数据'
|
||||
this.detailsList[1][1].value = this.orderData.oilsCode + ' ' + this.orderData.oilsBar + '号枪' || '暂无数据'
|
||||
this.detailsList[1][2].value = Number(this.orderData.volume).toFixed(2) + 'L' || '暂无数据'
|
||||
this.detailsList[2][0].value =
|
||||
'¥' + Number(this.orderData.xoilAmountGun).toFixed(2) || '¥' + Number(this.orderData.baseRealPriceAmount).toFixed(2) || '暂无数据'
|
||||
this.detailsList[2][1].value =
|
||||
'-¥' + Number(this.orderData.oilDiscountAmount).toFixed(2) || '-¥' + Number(this.orderData.discountAmount).toFixed(2) || '暂无数据'
|
||||
this.detailsList[2][2].value = '-¥' + Number(this.orderData.couponDiscountAmount).toFixed(2) || '暂无数据'
|
||||
this.detailsList[3][0].value = '¥' + Number(this.orderData.realAmount).toFixed(2) || '暂无数据'
|
||||
},
|
||||
getCountDownTime(e){
|
||||
let createTime = new Date(e);
|
||||
let nowTime = new Date();
|
||||
let difference = Date.parse(nowTime)- Date.parse(createTime);
|
||||
let a = 600000;
|
||||
return difference>a?0:a-difference
|
||||
getCountDownTime(e) {
|
||||
let createTime = new Date(e)
|
||||
let nowTime = new Date()
|
||||
let difference = Date.parse(nowTime) - Date.parse(createTime)
|
||||
let a = 600000
|
||||
return difference > a ? 0 : a - difference
|
||||
},
|
||||
async goplay(){
|
||||
if(!this.time) {
|
||||
async goplay() {
|
||||
if (!this.time) {
|
||||
this.$notify('支付已过期')
|
||||
return
|
||||
}
|
||||
let payData = {
|
||||
...this.cardList[this.cardIndex],
|
||||
"orderSerialNumber": this.orderData.orderSerialNumber, //类型:String 必有字段 备注:订单编号
|
||||
"payChannel": "BALANCE_PAYMENT", //类型:String 必有字段 备注:支付渠道(BALANCE_PAYMENT:余额支付)
|
||||
"orderMethod": "CUSTOMER_ACTIVE", //类型:String 必有字段 备注:订单产生方式(CUSTOMER_ACTIVE:客户扫码支付:客户扫描油站二维码完成支付)
|
||||
"createSource": "XOIL_DRIVER_COMPANY_WECHAT_APPLET",
|
||||
oilCardType:-1
|
||||
orderSerialNumber: this.orderData.orderSerialNumber, //类型:String 必有字段 备注:订单编号
|
||||
payChannel: 'BALANCE_PAYMENT', //类型:String 必有字段 备注:支付渠道(BALANCE_PAYMENT:余额支付)
|
||||
orderMethod: 'CUSTOMER_ACTIVE', //类型:String 必有字段 备注:订单产生方式(CUSTOMER_ACTIVE:客户扫码支付:客户扫描油站二维码完成支付)
|
||||
createSource: 'XOIL_DRIVER_COMPANY_WECHAT_APPLET',
|
||||
oilCardType: -1
|
||||
}
|
||||
let orderType = false
|
||||
oilOrderApi.payOrder(payData).then(res=>{
|
||||
if(res.code==20000){
|
||||
oilOrderApi
|
||||
.payOrder(payData)
|
||||
.then(res => {
|
||||
if (res.code == 20000) {
|
||||
orderType = true
|
||||
}
|
||||
}).finally((e)=>{
|
||||
})
|
||||
.finally(e => {
|
||||
this.$router.push({
|
||||
name:'paymentl',
|
||||
query:{
|
||||
orderData:JSON.stringify(this.orderData),
|
||||
type:JSON.stringify(orderType)
|
||||
name: 'paymentl',
|
||||
query: {
|
||||
orderData: JSON.stringify(this.orderData),
|
||||
type: JSON.stringify(orderType)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.debgcolor{
|
||||
.debgcolor {
|
||||
background-color: #999999 !important;
|
||||
}
|
||||
.payment-time {
|
||||
@@ -166,7 +177,6 @@ export default {
|
||||
}
|
||||
|
||||
.payment-details-item-row-lable {
|
||||
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
@@ -175,17 +185,16 @@ export default {
|
||||
}
|
||||
|
||||
.payment-details-item:first-child {
|
||||
margin-top: 0q;
|
||||
margin-top: 0Q;
|
||||
}
|
||||
|
||||
.payment-details-item:last-child {
|
||||
border-bottom: dashed 0px #B9B9B9;
|
||||
|
||||
border-bottom: dashed 0px #b9b9b9;
|
||||
}
|
||||
|
||||
.payment-details-item {
|
||||
box-sizing: border-box;
|
||||
border-bottom: dashed 1px #B9B9B9;
|
||||
border-bottom: dashed 1px #b9b9b9;
|
||||
padding-bottom: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
@@ -198,13 +207,13 @@ export default {
|
||||
}
|
||||
|
||||
.payment-details-title span {
|
||||
color: #FF6700;
|
||||
color: #ff6700;
|
||||
}
|
||||
|
||||
.payment-details-title {
|
||||
width: 690px;
|
||||
height: 82px;
|
||||
background: #F6F6F6;
|
||||
background: #f6f6f6;
|
||||
box-shadow: 5px 5px 0px 1px rgba(0, 0, 0, 0.0118);
|
||||
border-radius: 10px 10px 0px 0px;
|
||||
opacity: 1;
|
||||
|
||||
Reference in New Issue
Block a user