|
|
<template> |
|
|
<view class="content my-bg"> |
|
|
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil"> |
|
|
<block slot="backText">返回</block> |
|
|
<block slot="content">加油记录</block> |
|
|
</cu-custom> |
|
|
<scroll-view scroll-x class="bg-white nav"> |
|
|
<view class="flex text-center"> |
|
|
<view class="cu-item flex-sub" :class="index==TabCur?'text-orange cur':''" v-for="(item,index) in tabList" :key="index" |
|
|
@tap="tabSelect" :data-id="index">{{item}}</view> |
|
|
</view> |
|
|
</scroll-view> |
|
|
<view class="padding padding-bottom-0"> |
|
|
<view v-show="TabCur==0" class="order-list"> |
|
|
<view v-for="item in allOrder" :key="item.orderID"> |
|
|
<OrderItem class="cu-list order-item menu-avatar comment" :item="item" /> |
|
|
</view> |
|
|
</view> |
|
|
<view v-show="TabCur==1" class="order-list"> |
|
|
<view v-for="item in payingOrder" :key="item.orderID"> |
|
|
<OrderItem class="cu-list order-item menu-avatar comment" :item="item" /> |
|
|
</view> |
|
|
</view> |
|
|
<view v-show="TabCur==2" class="order-list"> |
|
|
<view v-for="item in finishedOrder" :key="item.orderID"> |
|
|
<OrderItem class="cu-list order-item menu-avatar comment" :item="item" /> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
|
|
|
<script> |
|
|
import cloudSiteApi from '@/api/cloud-site.js' |
|
|
import OrderItem from '@/components/order-item' |
|
|
export default { |
|
|
components: { |
|
|
OrderItem |
|
|
}, |
|
|
data() { |
|
|
return { |
|
|
tabList: [ |
|
|
'全部', '待支付', '已支付' |
|
|
], |
|
|
TabCur: 0, |
|
|
pageNumber: 1, |
|
|
istate: -3, |
|
|
scrollLeft: 0, |
|
|
order: { |
|
|
istate: 0, |
|
|
vol: 3, |
|
|
oilName: '0#', |
|
|
orderID: '15979997825872', |
|
|
oilCode: '12396989', |
|
|
oilSiteName: '疯疯疯加油站', |
|
|
carNo: '皖A12354', |
|
|
sourceType: 3, |
|
|
realamount: 4.66, |
|
|
credateDatetime: '2020-10-12 12:30:10' |
|
|
}, |
|
|
allOrder: [], |
|
|
finishedOrder: [], |
|
|
payingOrder: [], |
|
|
} |
|
|
}, |
|
|
created() { |
|
|
this.calcIstate(this.TabCur) |
|
|
}, |
|
|
methods: { |
|
|
tabSelect(e) { |
|
|
this.TabCur = e.currentTarget.dataset.id; |
|
|
this.calcIstate(this.TabCur) |
|
|
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60 |
|
|
}, |
|
|
|
|
|
calcIstate(id) { |
|
|
|
|
|
switch (id) { |
|
|
case 0: |
|
|
this.istate = -3 |
|
|
this.loadList() |
|
|
break |
|
|
case 1: |
|
|
this.istate = 0 |
|
|
this.loadList() |
|
|
break |
|
|
case 2: |
|
|
this.istate = 1 |
|
|
this.loadList() |
|
|
break |
|
|
} |
|
|
}, |
|
|
loadList() { |
|
|
const data2 = { |
|
|
istate: this.istate, //类型:Number 必有字段 备注:订单状态 0待支付 1支付成功 -3 查所有 |
|
|
pageIndex: this.pageNumber //类型:Number 必有字段 备注:查询第几页,默认一页10条 |
|
|
} |
|
|
cloudSiteApi.getSiteOrder(data2).then(res => { |
|
|
if (res.code === 20000) { |
|
|
switch (this.istate) { |
|
|
case 0: |
|
|
this.payingOrder = res.data |
|
|
break |
|
|
case 1: |
|
|
this.finishedOrder = res.data |
|
|
break |
|
|
case -3: |
|
|
this.allOrder = res.data |
|
|
break |
|
|
} |
|
|
} |
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
|
|
|
<style scoped> |
|
|
.content { |
|
|
min-height: 100%; |
|
|
} |
|
|
|
|
|
.order-list .order-item:last-of-type { |
|
|
margin-bottom: 0; |
|
|
} |
|
|
</style>
|
|
|
|