This commit is contained in:
xiaozhiyong
2023-04-03 08:51:10 +08:00
parent 33fbefdc14
commit 6967207669
20 changed files with 12866 additions and 1083 deletions

View File

@@ -3,9 +3,9 @@
<homeNavBar @getlist="onRefresh" v-model="page.params.oilProductCode" :productCodeList="productCodeList" @seach="seach" ref="homeNavBar" />
<div :style="{}" id="list" class="list">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list id = 'vanList' ref="vanList" @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多了">
<van-list id="vanList" ref="vanList" @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多了">
<van-cell v-for="(item, index) in list" :key="index">
<div @click="goDetails(item)" slot>
<div @click="toDetails(item)" slot>
<listItem ref="listItem" :index="index" :listItem="item" />
</div>
</van-cell>
@@ -25,12 +25,10 @@ export default {
listItem
},
name: 'HomeView',
props:{
},
props: {},
data() {
return {
productCodeList:[],
productCodeList: [],
refreshing: false,
homeNavBarStyle: null,
show: false,
@@ -42,7 +40,8 @@ export default {
page: {
pageSize: 10,
currentPage: 1,
params: { //类型Object 必有字段 备注:// 筛选对象
params: {
//类型Object 必有字段 备注:// 筛选对象
accuracy: '',
errMsg: '',
horizontalAccuracy: '',
@@ -50,7 +49,7 @@ export default {
longitude: '',
oilProductCode: '',
siteName: '',
sort: "",
sort: '',
speed: '',
verticalAccuracy: ''
}
@@ -58,113 +57,115 @@ export default {
}
},
created() {
console.log('created')
// console.log('created')
},
mounted() {
this.init();
console.log(this.$refs.vanList,'/////')
},
watch: {
'page.params.oilProductCode':function(n){},
this.init()
},
// watch: {
// 'page.params.oilProductCode': function (n) {}
// },
methods: {
listCheck(){
console.log(arguments,'listCheck')
},
getmenu(){
oilSiteApi.getCheckInfo().then(res=>{
this.productCodeList = [];
Object.keys(res.data.productCodeList).forEach(keys=>{
this.productCodeList.push({
text:keys,
children:res.data.productCodeList[keys].map(item=>{return {text:item,id:item} })
getmenu() {
return
oilSiteApi.getCheckInfo().then(res => {
this.productCodeList = []
Object.keys(res.data.productCodeList).forEach(key => {
this.productCodeList.push({
text: key,
children: res.data.productCodeList[key].map(item => {
return { text: item, id: item }
})
})
})
})
},
seach(e) {
this.page.params.siteName = e;
this.page.params.siteName = e
this.onRefresh()
},
onLoad() {
if(this.refreshing) return
this.page.currentPage += 1
this.getlist()
if (this.refreshing) return
this.page.currentPage += 1
this.getlist()
},
goDetails(item) {
toDetails(item) {
this.$router.push({
path:'/orderDetails',
query:{ seleItem:JSON.stringify(item)}
path: '/orderDetails',
query: { seleItem: JSON.stringify(item) }
})
},
onRefresh() {
this.loading = false;
this.finished = false;
this.page.currentPage = 1;
this.getlist();
this.loading = false
this.finished = false
this.page.currentPage = 1
this.getlist()
},
onscroll() {
let that = this
let container = document.getElementById('vanList');
let container = document.getElementById('vanList')
container.onscroll = function (e) {
console.log(e.currentTarget.scrollTop, '滚动到底部');
console.log(e.currentTarget.scrollTop, '滚动到底部')
if (Math.ceil(e.currentTarget.scrollTop + e.currentTarget.clientHeight) >= e.currentTarget.scrollHeight) { //容差20px
console.log(e.currentTarget.scrollTop, '滚动到底部');
if (Math.ceil(e.currentTarget.scrollTop + e.currentTarget.clientHeight) >= e.currentTarget.scrollHeight) {
//容差20px
console.log(e.currentTarget.scrollTop, '滚动到底部')
}
};
}
},
init() {
this.getlist();
this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight;
this.getmenu();
this.getmenu()
this.getlist()
this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight
// this.onscroll()
},
positionChenk(position){
return !position?.latitude&&!position?.longitude?true:false
positionChenk(position) {
return !position?.latitude && !position?.longitude ? true : false
},
getlist() {
let position = this.$pinia.state.value.user.position
console.log(Object.assign(this.page.params,position),position,'地理位置数据')
if(this.positionChenk(position)){
position = JSON.parse(localStorage.getItem("position"))
if(this.positionChenk(position)){
console.log(position,this.$pinia.state.value.user.position,'地理位置错误');
this.finished = true
return
console.log('position', position)
console.log(Object.assign(this.page.params, position), position, '地理位置数据')
if (this.positionChenk(position)) {
position = JSON.parse(localStorage.getItem('position'))
if (this.positionChenk(position)) {
console.log(position, this.$pinia.state.value.user.position, '地理位置错误')
this.finished = true
return
}
}
this.page.params = Object.assign(this.page.params,position)
this.page.params = Object.assign(this.page.params, position)
this.loading = true
oilSiteApi.getSiteList( this.page).then(res => {
if (res.code == 20000) {
if (res.data.list.length < 10) {
oilSiteApi
.getSiteList(this.page)
.then(res => {
if (res.code == 20000) {
if (res.data.list.length < 10) {
this.finished = true
}
if (this.page.currentPage == 1) {
this.list = res.data.list
} else {
this.list = this.list.concat(res.data.list);
if (this.page.currentPage == 1) {
this.list = res.data.list
} else {
this.list = this.list.concat(res.data.list)
}
this.loading = false
this.refreshing = false
}
this.loading = false
this.refreshing = false;
}
console.log(res)
}).catch(error => {
this.finished = true
})
console.log(res)
})
.catch(error => {
this.finished = true
})
},
getPosition() {
let that = this
navigator.geolocation.getCurrentPosition(function (position) {
that.position = position
},this.showError);
}, this.showError)
},
onClickLeft() {
},
onClickRight() {
},
},
onClickLeft() {},
onClickRight() {}
}
}
</script>
<style scoped>

View File

@@ -1,207 +1,207 @@
<template>
<div class="oilLable">
<div class="oilLable-sele flex ac jc">
请提醒加油员使用 <span style="color:red">星油云站</span> 进行订单核实
<div class="oilLable">
<div class="oilLable-sele flex ac jc">请提醒加油员使用 <span style="color: red">星油云站</span> 进行订单核实</div>
<div class="oilLableDetails">
<div @click="seleFn(index)" v-for="(itemx, index) in oilType.oilSitePriceDetailsVos" :key="index" class="oilLableDetails-item flex ac">
<div :class="seleIndex == index ? 'seleLable' : 'label'" class="flex ac jc">
<van-icon size="15" :color="seleIndex == index ? '#FFFFFF' : '#636262'" name="success" />
</div>
<div class="oilLableDetails">
<div @click="seleFn(index)" v-for="(itemx, index) in oilType.oilSitePriceDetailsVos" :key="index"
class="oilLableDetails-item flex ac">
<div :class="seleIndex == index ? 'seleLable' : 'label'" class=" flex ac jc">
<van-icon size="15" :color="seleIndex == index ? '#FFFFFF' : '#636262'" name="success" />
</div>
<div style=" overflow: hidden;" class="flex ac">
<span class="oilLableDetails-item-tip"></span>
<span class="oilLableDetails-item-oilNumber">{{ itemx.oilProductCode }}</span>
<span class="oilLableDetails-item-oilPrice">{{ itemx.sitePrice | moneyIntercept }}/L</span>
<span class="oilLableDetails-item-originalPrice">{{ itemx.oilSitePrice | moneyIntercept }}/L</span>
<span class="oilLableDetails-item-text ">预计每100L节省{{ (100 * (itemx.oilSitePrice - itemx.sitePrice))
| moneyFormat
}}</span>
</div>
</div>
<div style="overflow: hidden" class="flex ac">
<span class="oilLableDetails-item-tip"></span>
<span class="oilLableDetails-item-oilNumber">{{ itemx.oilProductCode }}</span>
<span class="oilLableDetails-item-oilPrice">{{ itemx.sitePrice | moneyIntercept }}/L</span>
<span class="oilLableDetails-item-originalPrice">{{ itemx.oilSitePrice | moneyIntercept }}/L</span>
<span class="oilLableDetails-item-text">预计每100L节省{{ (100 * (itemx.oilSitePrice - itemx.sitePrice)) | moneyFormat }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
value: {
type: Object,
default: null
},
oilType: {
type: Object,
default: () => null
}
props: {
value: {
type: Object,
default: null
},
data() {
return {
seleIndex: 0
}
},
created() {
this.seleFn(this.seleIndex);
},
methods: {
seleFn(index) {
console.log(11)
this.seleIndex = index;
this.$emit('input', Object.assign(Object.assign(JSON.parse(JSON.stringify(this.value)), this.oilType.oilSitePriceDetailsVos[index])))
},
},
filters: {
moneyIntercept(value) {
if (value != 'xxx.x') {
return String(value).split('.')[1] && String(value).split('.')[1].length > 2 ? Number(`${String(value).split('.')[0]}.${String(value).split('.')[1].substring(0, 1)}${Number(String(value).split('.')[1].substring(1, 2)) + 1}`) : Number(value).toFixed(2);
} else {
return Number(value).toFixed(2)
}
},
moneyFormat(value) {
if (value != 'xxx.x') {
console.log('old:', value)
let realAmount = Math.floor(value * 100) / 100
console.log('new:', realAmount)
// return realAmount
return Number(value).toFixed(2)
} else {
return Number(value).toFixed(2)
}
},
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 '一点加油(壳牌)'
}
}
}
oilType: {
type: Object,
default: () => null
}
},
data() {
return {
seleIndex: 0
}
},
created() {
this.seleFn(this.seleIndex)
},
methods: {
seleFn(index) {
this.seleIndex = index
this.$emit('input', Object.assign(Object.assign(JSON.parse(JSON.stringify(this.value)), this.oilType.oilSitePriceDetailsVos[index])))
}
},
filters: {
moneyIntercept(value) {
if (value != 'xxx.x') {
return String(value).split('.')[1] && String(value).split('.')[1].length > 2
? Number(
`${String(value).split('.')[0]}.${String(value).split('.')[1].substring(0, 1)}${
Number(String(value).split('.')[1].substring(1, 2)) + 1
}`
)
: Number(value).toFixed(2)
} else {
return Number(value).toFixed(2)
}
},
moneyFormat(value) {
if (value != 'xxx.x') {
console.log('old:', value)
let realAmount = Math.floor(value * 100) / 100
console.log('new:', realAmount)
// return realAmount
return Number(value).toFixed(2)
} else {
return Number(value).toFixed(2)
}
},
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>
.seleLable {
width: 31px;
height: 31px;
border: none;
border-radius: 50%;
background-color: #FF6700;
width: 31px;
height: 31px;
border: none;
border-radius: 50%;
background-color: #ff6700;
}
.label {
/* box-sizing: border-box; */
width: 31px;
height: 31px;
/* border: solid 1px #636262; */
border-radius: 50%;
/* box-sizing: border-box; */
width: 31px;
height: 31px;
/* border: solid 1px #636262; */
border-radius: 50%;
}
.oilLableDetails-item:last-child {
margin-bottom: 0px !important;
margin-bottom: 0px !important;
}
.oilLableDetails-item-text {
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
margin-left: 10px;
width: 300px;
flex: 1;
/* background-color: #999999; */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
margin-left: 10px;
width: 300px;
flex: 1;
/* background-color: #999999; */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.oilLableDetails-item-originalPrice {
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
text-decoration: line-through;
margin-left: 13px;
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
text-decoration: line-through;
margin-left: 13px;
}
.oilLableDetails-item-oilPrice {
font-size: 32px;
font-family: PingFang SC-特粗, PingFang SC;
font-weight: normal;
color: #FF6700;
margin-left: 10px;
font-size: 32px;
font-family: PingFang SC-特粗, PingFang SC;
font-weight: normal;
color: #ff6700;
margin-left: 10px;
}
.oilLableDetails-item-oilNumber {
color: #000000;
font-size: 34px;
margin-left: 17px;
min-width: 70px;
text-align: center;
color: #000000;
font-size: 34px;
margin-left: 17px;
min-width: 70px;
text-align: center;
}
.oilLableDetails-item-tip {
width: 35px;
/* height: 35px; */
box-sizing: border-box;
border: solid 1px #FF6700;
font-size: 25px;
color: #FF6700;
margin-left: 15px;
/* padding: 2px; */
width: 35px;
/* height: 35px; */
box-sizing: border-box;
border: solid 1px #ff6700;
font-size: 25px;
color: #ff6700;
margin-left: 15px;
/* padding: 2px; */
}
.oilLableDetails-item {
width: 100%;
/* overflow: hidden; */
margin-bottom: 15px;
width: 100%;
/* overflow: hidden; */
margin-bottom: 15px;
}
.oilLableDetails {
width: 100%;
margin-top: 37px;
width: 100%;
margin-top: 37px;
}
.oilLable-sele-item {
width: fit-content;
border-bottom: 4px solid #FF6700;
padding-bottom: 5px;
box-sizing: border-box;
width: fit-content;
border-bottom: 4px solid #ff6700;
padding-bottom: 5px;
box-sizing: border-box;
}
.oilLable-sele img {
width: 45px;
height: 45px;
margin-right: 10px;
width: 45px;
height: 45px;
margin-right: 10px;
}
.oilLable-sele {
width: 100%;
font-size: 28px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
width: 100%;
font-size: 28px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
}
.oilLable {
--pd: calc((100vw - 684px)/2);
width: 100%;
background-color: #ffffff;
margin-top: -62px;
box-sizing: border-box;
padding-top: 102px;
padding-left: var(--pd);
padding-right: var(--pd);
padding-bottom: 36px;
--pd: calc((100vw - 684px) / 2);
width: 100%;
background-color: #ffffff;
margin-top: -62px;
box-sizing: border-box;
padding-top: 102px;
padding-left: var(--pd);
padding-right: var(--pd);
padding-bottom: 36px;
}
</style>
</style>

View File

@@ -2,8 +2,8 @@
<div class="home">
<Input-box-search @seach="onRefresh" v-model="page.params.search" ref="homeNavBar" />
<div :style="{}" id="list" class="list">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多了">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list @load="onLoad" v-model="loading" :finished="finished" finished-text="没有更多了">
<van-cell v-for="(item, index) in list" :key="index">
<div style="height: 100%" slot>
<paymentlListItem @goPlay="goPlay" :listItem="item" />
@@ -16,17 +16,17 @@
</template>
<script>
import { addressResolution } from "../../utils/addressResolution";
import useStore from "../../store/piniaIndex";
import InputBoxSearch from "@/components/InputBoxSearch.vue";
import paymentlListItem from "@/components/paymentlListItem.vue";
import orderApi from "@/api/oil-order.js";
import useStore from '../../store/piniaIndex'
import InputBoxSearch from '@/components/InputBoxSearch.vue'
import paymentlListItem from '@/components/paymentlListItem.vue'
import orderApi from '@/api/oil-order.js'
export default {
components: {
InputBoxSearch,
paymentlListItem,
paymentlListItem
},
name: "HomeView",
name: 'HomeView',
data() {
return {
list: [],
@@ -34,23 +34,23 @@ export default {
currentPage: 0,
pageSize: 10,
params: {
orderStatus: "",
search: "",
},
orderStatus: '',
search: ''
}
},
refreshing: false,
homeNavBarStyle: null,
show: false,
loading: false,
finished: false,
msg: process.env.VUE_APP_ENV,
};
msg: process.env.VUE_APP_ENV
}
},
created() {
this.init();
this.init()
},
mounted() {
this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight;
this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight
},
methods: {
goPlay(e, type) {
@@ -60,54 +60,56 @@ export default {
this.$router.push({
path: '/cashier',
query: {
order: JSON.stringify( res.data)
order: JSON.stringify(res.data)
}
})
break;
break
default:
this.$router.push({
path: '/paymentl',
query: {
orderData:JSON.stringify( res.data),
type:type=='已支付'?'true':'false'
orderData: JSON.stringify(res.data),
type: type == '已支付' ? 'true' : 'false'
}
})
break;
break
}
console.log(res, '详情')
})
},
getList() {
orderApi.getOrderInfoByPage(this.page).then((res) => {
if (res.data.list.length < 10) {
this.finished = true
}else{
this.finished = false
}
if (res.code == 20000) {
console.log(this.page.currentPage,'+++++++++++++++')
if (this.page.currentPage == 1) {
this.list = res.data.list;
orderApi
.getOrderInfoByPage(this.page)
.then(res => {
if (res.data.list.length < 10) {
this.finished = true
} else {
this.list = this.list.concat(res.data.list);
this.finished = false
}
this.loading = false
this.refreshing = false;
}
}).catch(error => {
this.finished = true
})
if (res.code == 20000) {
console.log(this.page.currentPage, '+++++++++++++++')
if (this.page.currentPage == 1) {
this.list = res.data.list
} else {
this.list = this.list.concat(res.data.list)
}
this.loading = false
this.refreshing = false
}
})
.catch(error => {
this.finished = true
})
},
goDetails() {
this.$router.push("/orderDetails");
this.$router.push('/orderDetails')
},
onRefresh() {
this.loading = false;
this.finished = false;
this.page.currentPage = 1;
this.getList();
this.loading = false
this.finished = false
this.page.currentPage = 1
this.getList()
},
// onscroll() {
// let container = document.getElementById("list");
@@ -122,18 +124,18 @@ export default {
// };
// },
onLoad() {
if(this.refreshing) return
console.log('loding----------------')
if (this.refreshing) return
// console.log('loding----------------')
this.page.currentPage += 1
this.getList();
this.getList()
},
init() {
// this.getList();
},
onClickLeft() { },
onClickRight() { },
},
};
onClickLeft() {},
onClickRight() {}
}
}
</script>
<style scoped>
.van-cell {
@@ -158,4 +160,4 @@ export default {
overflow: auto;
box-sizing: border-box;
}
</style>
</style>