This commit is contained in:
caolc
2023-05-08 10:45:07 +08:00
parent 8fd25deedf
commit 1c3e0f9662
27 changed files with 388 additions and 297 deletions

View File

@@ -43,7 +43,6 @@
{{item.name}}
<view class="cu-tag sm round" :class="item.checked?'bg-white text-blues':'bg-blue'" v-if="item.hot">HOT</view>
</button>
</view>
<view class="padding-xs" style="width:40% ;" v-if="activeChannelCode!='TY'">
<input type="number" @input="onInputBar" v-model="inputBar" class="cu-btn red block" placeholder="其他油枪" value="" />
@@ -519,7 +518,8 @@
},
channelId() {
if (this.channelList.length && this.channelList[this.activeCur]) {
let channelId = this.channelList[this.activeCur].channelId
let channelId = this.channelList[this.activeCur].channelId;
console.log( this.channelList,'********')
this.getNewSitePrice(channelId)
this.activeChannelCode = this.channelList[this.activeCur].channelCode
return channelId
@@ -586,9 +586,9 @@
let number = {
payType : 'CUSTOMER_ACTIVE',
userType:'0',
xoilAmountGun:e ,
priceId:this.activeSitePrice,
clientBelong: "ZHONGPIN"
sitePriceAmount:e ,
sitePriceId:this.activeSitePrice,
targetApp: "SAAS"
}
this.xoilAmountGun = e
oilSiteApi.getOrderDiscountInfo(number).then( res=>{
@@ -635,9 +635,10 @@
let number = {
payType : 'CUSTOMER_ACTIVE',
userType:'0',
xoilAmountGun:e.detail.value,
priceId:this.activeSitePrice,
clientBelong: "ZHONGPIN"
sitePriceAmount:e.detail.value,
sitePriceId:this.activeSitePrice,
clientBelong: "ZHONGPIN",
targetApp: "SAAS"
}
this.xoilAmountGun = e.detail.value
oilSiteApi.getOrderDiscountInfo(number).then( res=>{
@@ -883,7 +884,7 @@
'clientBelong':'ZHONGPIN',
"amountGun": this.activeChannelCode == 'TY' ? this.ty.realMoney : '',
"shareCompanyQuota": 0, // 共享标识
"priceId": this.oilSitePriceDetailsVo[this.radio].priceId, //类型String 必有字段 备注:油价主键
"sitePriceId": this.oilSitePriceDetailsVo[this.radio].priceId, //类型String 必有字段 备注:油价主键
"orderType": "REAL_ORDER", //类型String 必有字段 备注订单类型REAL_ORDER真实订单 VIRTUAL_ORDER虚拟订单
"orderSource": "WECHAT_MINIAPPS", //类型String 必有字段 备注订单来源WECHAT_MINIAPPS
"plateNumber": this.plateNumber ? this.plateNumber : this.plateNumberSel, //类型String 必有字段 备注:车牌号
@@ -896,7 +897,12 @@
// "deviceImei": "mock", //类型String 可有字段 备注:设备唯一码
// "networkIp": "mock" //类型String 可有字段 备注ip地址,
'version':1,
'xoilAmountGun':this.vol
'sitePriceAmount':this.vol,
"orderMethod": "SITE_SCAN", // 订单支付方式
"targetApp": "SAAS", // 小程序来源
// "longitude": "1231.23", // 当前位置经度
// "latitude": "1321.23" // 当前位置纬度
...uni.getStorageSync('location'),
}
console.log(orderData,'orderDataorderDataorderDataorderDataorderDataorderDataorderDataorderData');
oilOrderApi.createOrder(orderData).then(res => {
@@ -908,7 +914,8 @@
})
}
}).finally(msg=>{
clearTimeout(this.timer)
clearTimeout(this.timer);
this.timer = null
})
},500)
}
@@ -923,8 +930,8 @@
getNewSitePrice(channelId) {
this.oilSitePriceDetailsVo = []
oilSiteApi.getNewSitePriceZp({
channelId:channelId,
clientBelong: "ZHONGPIN"
siteId:channelId,
// clientBelong: "ZHONGPIN"
}).then(res => {
if (res.code == 20000) {
this.plateNumbers = res.data.plateNumbers
@@ -968,6 +975,7 @@
for (let i = 0, lenI = items.length; i < lenI; ++i) {
if (items[i].value == values) {
items[i].checked = !items[i].checked;
this.oilBar =items[i].checked?items[i].value:''
} else {
items[i].checked = false
}

View File

@@ -1,24 +1,19 @@
<template>
<view class="padding-top">
<scroll-view scroll-x class=" nav text-center">
<view class="cu-item" v-for="(item,index) in channelList" :class="index==TabCur?'text-blues cur':''" :key="item.channelId"
@tap="tabSelect" :data-id="index">
<image class="site-icon margin-right-sm" :src="imgURL+'site-'+item.channelCode+'.png'" mode="widthFix">
</image>
{{item.channelCode|channelCodeFamt}}
<view class="cu-item" v-for="(item, index) in channelList" :class="index == TabCur ? 'text-blues cur' : ''" :key="item.channelId" @tap="tabSelect" :data-id="index">
<image class="site-icon margin-right-sm" :src="imgURL + 'site-' + item.channelCode + '.png'" mode="widthFix"></image>
{{ item.channelCode | channelCodeFamt }}
<!-- 少了壳牌 -->
</view>
</scroll-view>
<view class="cu-list menu padding-left padding-right">
<view class="cu-item" v-for="(itemx,index) in oilSitePriceDetailsVos" :key="index" v-if="itemx.sitePrice>0">
<text class="cu-tag my-tag line-red text-lg">
</text>
<text class="text-bold text-black text-lg">{{itemx.oilProductCode}}</text>
<text class="text-bold text-blues text-lg">{{itemx.sitePrice==0?'-.--':itemx.sitePrice}}/L</text>
<text class="text-delete">{{itemx.oilSitePrice}}/L</text>
<text class="text-xs ">预计每100L节省{{(100*(itemx.oilSitePrice - itemx.sitePrice))|moneyFormat}}</text>
<view class="cu-item" v-for="(itemx, index) in oilSitePriceDetailsVos" :key="index" v-if="itemx.sitePrice > 0">
<text class="cu-tag my-tag line-red text-lg"></text>
<text class="text-bold text-black text-lg">{{ itemx.oilProductCode }}</text>
<text class="text-bold text-blues text-lg">{{ itemx.sitePrice == 0 ? '-.--' : itemx.sitePrice }}/L</text>
<text class="text-delete">{{ itemx.oilSitePrice }}/L</text>
<text class="text-xs ">预计每100L节省{{ (100 * (itemx.oilSitePrice - itemx.sitePrice)) | moneyFormat }}</text>
<!-- <text class="text-gray text-delete">$市场价</text>
<text class="text-gray text-sm">
预计每100L节省581元
@@ -30,7 +25,7 @@
<view class="bg-white padding ">
<text>油站特色</text>
<view class="padding-top-sm">
<text class="cu-tag line-yellow margin-right-xs" v-for="(itemy,index) in tagList" :key="index">{{itemy}}</text>
<text class="cu-tag line-yellow margin-right-xs" v-for="(itemy, index) in tagList" :key="index">{{ itemy }}</text>
</view>
</view>
</view>
@@ -38,103 +33,101 @@
</template>
<script>
export default {
props: {
channelList: {
type: Array,
default () {}
export default {
props: {
channelList: {
type: Array,
default() {}
}
},
data() {
return {
TabCur: 0,
imgURL: this.global.imgURL,
scrollLeft: 0
};
},
computed: {
activeChannelCode() {
if (this.channelList.length && this.channelList[this.TabCur]) {
let channelCode = this.channelList[this.TabCur].channelCode;
let secondChannelCode = '';
if (this.channelList[this.TabCur].secondChannelCode) {
secondChannelCode = this.channelList[this.TabCur].secondChannelCode;
}
this.$emit('onChangeChannelCode', channelCode, secondChannelCode);
return channelCode;
}
},
data() {
return {
TabCur: 0,
imgURL: this.global.imgURL,
scrollLeft: 0
};
},
computed: {
activeChannelCode() {
if (this.channelList.length && this.channelList[this.TabCur]) {
let channelCode = this.channelList[this.TabCur].channelCode
let secondChannelCode = ''
if (this.channelList[this.TabCur].secondChannelCode) {
secondChannelCode = this.channelList[this.TabCur].secondChannelCode
}
this.$emit('onChangeChannelCode', channelCode, secondChannelCode)
return channelCode
}
},
tagList() {
if (this.channelList.length && this.channelList[this.TabCur].labelTag) {
let labelTag = this.channelList[this.TabCur].labelTag
let tagList = labelTag ? labelTag.split(',') : []
return tagList
}
},
activePay() {
if (this.channelList.length && this.channelList[this.TabCur]) {
let activePay = this.channelList[this.TabCur].activePay
this.$emit('onChangePay', activePay, this.TabCur)
}
},
qrcodePay() {
if (this.channelList.length && this.channelList[this.TabCur]) {
let qrcodePay = this.channelList[this.TabCur].qrcodePay
this.$emit('onChangePayQr', qrcodePay)
}
},
oilSitePriceDetailsVos() {
if (this.channelList[this.TabCur]) {
return this.channelList[this.TabCur].oilSitePriceDetailsVos
}
tagList() {
if (this.channelList.length && this.channelList[this.TabCur].labelTag) {
let labelTag = this.channelList[this.TabCur].labelTag;
let tagList = labelTag ? labelTag.split(',') : [];
return tagList;
}
},
created() {
},
methods: {
tabSelect(e) {
this.TabCur = e.currentTarget.dataset.id;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
activePay() {
if (this.channelList.length && this.channelList[this.TabCur]) {
let activePay = this.channelList[this.TabCur].activePay;
this.$emit('onChangePay', activePay, this.TabCur);
}
},
filters: {
moneyFormat(value) {
if (value != 'xxx.x') {
return "¥" + (parseInt(value * 100) / 100).toFixed(2)
} else {
return value
}
},
channelCodeFamt(value) {
if (value) {
// 渠道编码 ( XOIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌)
switch (value) {
case 'XOIL':
return '星油'
case 'WJY':
return '万金油'
case 'LV':
return '老吕(找油网)'
case 'TY':
return '团油'
case 'YDJY':
return '一点加油(壳牌)'
}
qrcodePay() {
if (this.channelList.length && this.channelList[this.TabCur]) {
let qrcodePay = this.channelList[this.TabCur].qrcodePay;
this.$emit('onChangePayQr', qrcodePay);
}
},
oilSitePriceDetailsVos() {
if (this.channelList[this.TabCur]) {
return this.channelList[this.TabCur].oilSitePriceDetailsVos;
}
}
},
created() {},
methods: {
tabSelect(e) {
this.TabCur = e.currentTarget.dataset.id;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
}
},
filters: {
moneyFormat(value) {
if (value != 'xxx.x') {
return '¥' + (parseInt(value * 100) / 100).toFixed(2);
} else {
return value;
}
},
channelCodeFamt(value) {
if (value) {
// 渠道编码 ( XOIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌)
switch (value) {
case 'XOIL':
return '星油';
case 'WJY':
return '万金油';
case 'LV':
return '老吕(找油网)';
case 'TY':
return '团油';
case 'YDJY':
return '一点加油(壳牌)';
}
}
}
}
};
</script>
<style scoped>
.site-icon {
width: 2rem;
vertical-align: middle;
}
.site-icon {
width: 2rem;
vertical-align: middle;
}
.my-tag {
padding: 0 12rpx;
}
.my-tag {
padding: 0 12rpx;
}
</style>

View File

@@ -15,7 +15,7 @@
{{siteInfo.siteName?siteInfo.siteName:'油站名称'}}
</view>
<view class="font-12 color-999 site-label text-cut">
{{siteInfo.address?siteInfo.siteName:'油站地址'}}
{{siteInfo.address?siteInfo.address:'暂无地址'}}
</view>
</view>
<view class="action " @tap="openMap">
@@ -112,12 +112,13 @@
getSiteInfo(id) {
let data2 = {
...uni.getStorageSync('location'),
siteId: id,
id: id,
clientBelong: "ZHONGPIN"
}
oilSiteApi.getSiteDetails(data2).then(res => {
if (res.code == 20000) {
this.siteInfo = res.data
this.siteInfo = res.data;
this.siteInfo.oilSiteChannelDetailsVos[0].channelId = res.data.id
}
})
},

View File

@@ -7,7 +7,7 @@
<view class="">
<view class="padding-xl text-center">
<text class="text-xxl text-bold oil-main-color">
{{order.realAmount>0?order.realAmount:'xxx.x'|moneyFormat}}
{{order.payRealAmount>0?order.payRealAmount:'xxx.x'}}
</text>
<view class="text-gray">
支付剩余时间 <time-down :is-day="false" :is-hour="false" :tip-text="' '" :day-text="' '" :hour-text="':'"
@@ -138,7 +138,7 @@
</view>
<view class="dashed-top margin-top-xs padding-top-sm">
<view class="padding-tb-xs text-left">
加油金额<text class="fr">{{moneyIntercept(order.xoilAmountGun) }}</text>
加油金额<text class="fr">{{moneyIntercept(order.sitePriceAmount) }}</text>
<!-- <text
class="fr">{{order.oilDiscountAmount>0?order.realAmount+order.oilDiscountAmount:order.realAmount|moneyFormat}}</text> -->
</view>
@@ -156,17 +156,17 @@
<view class="padding-tb-xs text-left">
合计
<text class="text-blues text-bold text-lg fr">
{{order.realAmount>0? moneyIntercept(order.realAmount) :'xxx.x' }}</text>
{{order.realAmount>0? order.payRealAmount:'xxx.x' }}</text>
</view>
</view>
</view>
<view class="padding placeholder-hidden">
<button class="cu-btn block lg bg-main-oil" @tap="payOrder">立即支付</button>
<button class="cu-btn margin-top block lg " @tap="cancelOrder(order.orderSerialNumber)">取消订单</button>
<button class="cu-btn margin-top block lg " @tap="cancelOrder(order.id)">取消订单</button>
</view>
<view class="padding fixed-bar-bottom">
<button class="cu-btn block lg bg-main-oil" @tap="payOrder">立即支付</button>
<button class="cu-btn margin-top block lg " @tap="cancelOrder(order.orderSerialNumber)">取消订单</button>
<button class="cu-btn margin-top block lg " @tap="cancelOrder(order.id)">取消订单</button>
</view>
</view>
</view>

View File

@@ -67,7 +67,7 @@
</view>
<view class="padding-tb-xs text-left">
加油员
<text class="fr">{{order.siteUserName}}</text>
<text class="fr">{{order.siteUserName||'---'}}</text>
</view>
<!-- <view class="padding-tb-xs flex text-left">
<view class="flex-sub">
@@ -80,7 +80,7 @@
</view> -->
<view class="dashed-top margin-top-xs padding-top-sm">
<view class="padding-tb-xs text-left">
加油金额<text class="fr">{{order.xoilAmountGun |moneyFormat}}</text>
加油金额<text class="fr">{{order.payRealAmount }}</text>
<!-- <text class="fr">{{order.oilDiscountAmount>0?order.realAmount+order.oilDiscountAmount:order.realAmount|moneyFormat}}</text> -->
</view>
</view>
@@ -95,7 +95,7 @@
<view class="padding-tb-xs text-left">
合计
<text class="text-red text-bold text-lg fr">{{order.realAmount>0?'¥'+order.realAmount:'xxx.x'}}</text>
<text class="text-red text-bold text-lg fr">{{order.payRealAmount>0?'¥'+order.payRealAmount:'xxx.x'}}</text>
</view>
<view class="dashed-top margin-top-xs padding-top-sm">
<view class="padding-tb-xs text-left">
@@ -105,7 +105,7 @@
</view>
<view class="padding-tb-xs text-left">
加油司机
<text class=" fr">{{user.customerCode}}</text>
<text class=" fr">{{user.name}}</text>
</view>
<view class="padding-tb-xs text-left">
油卡性质
@@ -128,6 +128,7 @@
<script>
import toilApi from '@/api/toil.js'
import oilSiteApi from '@/api/oil-site.js'
import orderApi from '@/api/oil-order.js'
import tkiQrcode from "../components/tki-qrcode/tki-qrcode.vue" //二维码生成器
import ThirdPartyVoucher from '../components/third-party-voucher/third-party-voucher.vue'
@@ -139,6 +140,7 @@
data() {
const now = new Date()
return {
statusTimer:null,
showtitles:"",
hour: now.getHours() < 10 ? '0' + now.getHours() : now.getHours(), //当小时为个为数时在在前加001以下同理
minutes: now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes(),
@@ -184,7 +186,7 @@
this.getOrderQrCode()
},
getOrderQrCode(){
oilSiteApi.getOrderQrCode(this.order.orderSerialNumber).then( (res)=>{
oilSiteApi.getOrderQrCode(this.order.id).then( (res)=>{
console.log(res)
if(res.code == 40000){
this.showQr = false
@@ -192,7 +194,12 @@
}else if(res.code == 20000){
this.showQr = true
this.showtext =false
this.val =res.data.codeStr
this.val =res.data.codeStr;
if(!this.timeinterval ){
this.timeinterval = setInterval(() => {
this.newQrString()
}, 1000 * 60 * 3);
}
}
} )
},
@@ -252,7 +259,6 @@
}
})
},
// 三方支付结果弹窗结束
backToIndex() {
this.innerAudioContext.stop()
@@ -270,12 +276,26 @@
})
}
})
}
},
getStatus(order,callBack){
this.statusTimer = setInterval(()=>{
orderApi.getOrderPayInfo(order.id,'hide').then(res=>{
if(res.code==20000){
if(Number(res.data.orderStatus)!==0){
callBack(res.data.orderStatus);
clearInterval(this.statusTimer);
this.statusTimer = null;
}
}
})
},2000)
},
},
onLoad(option) {
console.log(option)
console.log('支付进入onload')
let oilItem = uni.getStorageSync('oilItem')
let oilItem = uni.getStorageSync('oilItem');
let order = uni.getStorageSync('orderMade');
this.showtitles = oilItem.listTag
if(oilItem.listTag == '万金油'){
this.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
@@ -293,10 +313,10 @@
setInterval(() => {
this.getTime()
},1000) //设置定时器,时时间每隔一秒钟走一次(即每秒)
this.timeinterval = setInterval(() => {
console.log('1')
this.newQrString()
}, 1000 * 60 * 3);
setTimeout(()=>{
this.newQrString()
},5000)
if(option.payMethod == '1' && option.status == 'success'){
if(option.status == 'success') {
console.log('这里是支付成功')
@@ -323,6 +343,23 @@
this.queryOrderStatusSq()
return
}
this.getStatus(order,status=>{
switch (Number(status)) {
case 1:
this.textstatus = '支付成功';
break;
case -1:
this.textstatus ='支付失败';
break;
case 2:
this.textstatus = '订单已取消';
break;
case 3:
this.textstatus = '订单已退款';
break;
}
console.log(this.textstatus,status)
})
},
filters: {
moneyFormath(value) {
@@ -366,7 +403,8 @@
},
onUnload() {
console.log('这里是卸载页面')
this.innerAudioContext.stop()
this.innerAudioContext.stop();
if(this.timeinterval)clearInterval(this.timeinterval);
},
}
</script>

View File

@@ -17,7 +17,7 @@
{{siteInfo.address}}
</view>
<view class="font-12 color-999 site-label text-cut">
营业时间 00:00 23:59
营业时间 00:00 23:59
</view>
</view>
<view class="action " @tap="openMap">
@@ -88,12 +88,12 @@
<text class=" text-black "> {{itm.oilsCode}} {{itm.volume}}L 节省 <text class="text-red">
{{itm.discountAmount}}</text></text>
</view>
<view class="cu-item no-border" v-if="!siteInfo.oilSiteOrderInfoVos.length">
<view class="cu-item no-border" >
暂无
</view>
</view>
<!-- 底部去支付 -->
<view class="" v-if="activePay||qrcodePay">
<view class="btn bg-white placeholder-hidden">
<view class="flex bg-white padding flex-direction">
@@ -194,9 +194,9 @@
}else{
var oilItem = JSON.parse(decodeURIComponent(option.item))
}
uni.setStorageSync('oilItem',oilItem)
this.getSiteInfo(oilItem.siteId)
this.siteId = oilItem.siteId
uni.setStorageSync('oilItem',oilItem);
this.getSiteInfo(oilItem.id)
this.siteId = oilItem.id
if(oilItem.listTag == '万金油'){
this.audioUrl = 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/wanjinyou.mp3'
}else if(oilItem.listTag == '星油'){
@@ -252,13 +252,15 @@
console.log('进入获取油站信息')
let data2 = {
...uni.getStorageSync('location'),
siteId: id,
clientBelong: "ZHONGPIN"
id: id,
clientBelong: "ZHONGPIN",
"targetApp": "SAAS", // 小程序来源
}
oilSiteApi.getSiteDetails(data2).then(res => {
console.log('进入获取油站信息getSiteDetails',res)
if (res.code == 20000) {
this.siteInfo = res.data
this.siteInfo = res.data;
console.log(this.siteInfo,'*****')
}
})
},