1.3.2
This commit is contained in:
@@ -4,12 +4,50 @@
|
||||
<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 class="fixed-t">
|
||||
<view class="flex bg-main-oil padding solid-bottom">
|
||||
<view class="flex-sub">
|
||||
订单来源
|
||||
</view>
|
||||
<view class="flex-treble text-right">
|
||||
<picker @change="pickSource" mode="selector" :value="indexSource" :range="sources">
|
||||
<view class="picker">
|
||||
{{activeSource}}
|
||||
<text class="cuIcon-right"></text>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<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>
|
||||
<view class="placeholder-hidden">
|
||||
<view class="flex bg-main-oil padding solid-bottom">
|
||||
<view class="flex-sub">
|
||||
订单来源
|
||||
</view>
|
||||
<view class="flex-treble text-right">
|
||||
<picker @change="pickSource" mode="selector" :value="indexSource" :range="sources">
|
||||
<view class="picker">
|
||||
{{sources[indexSource]}}
|
||||
<text class="cuIcon-right"></text>
|
||||
</view>
|
||||
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
<view class="padding padding-bottom-0">
|
||||
<view v-show="TabCur==0" class="order-list">
|
||||
<view v-for="item in allOrder" v-if="allOrder.length" :key="item.orderID">
|
||||
@@ -72,6 +110,9 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// activeSource: '网页版',
|
||||
indexSource: uni.getStorageSync('orderType') != null ? uni.getStorageSync('orderType') : 0,
|
||||
sources: ['网页版', '小程序'],
|
||||
tabList: [
|
||||
'全部', '待支付', '已支付', '退款'
|
||||
],
|
||||
@@ -113,43 +154,79 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.loadList(-3, this.pageNumber1)
|
||||
this.loadList(0, this.pageNumber2)
|
||||
this.loadList(1, this.pageNumber3)
|
||||
this.loadList(-2, this.pageNumber4)
|
||||
},
|
||||
|
||||
onReachBottom() { //上拉触底函数
|
||||
if (this.TabCur === 0) {
|
||||
if (!this.load.isLoadMore1) { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore1 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
}
|
||||
if (this.TabCur === 1) {
|
||||
if (!this.load.isLoadMore2) { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore2 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
}
|
||||
if (this.TabCur === 2) {
|
||||
if (!this.load.isLoadMore3) { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore3 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
}
|
||||
if (this.TabCur === 3) {
|
||||
if (!this.load.isLoadMore4) { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore4 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
computed: {
|
||||
createTime() {
|
||||
let today = new Date()
|
||||
let time = today.toISOString().slice(0, 10) + ' 00:00:00'
|
||||
return time
|
||||
},
|
||||
activeSource() {
|
||||
console.log(this.indexSource)
|
||||
return this.sources[this.indexSource]
|
||||
}
|
||||
},
|
||||
|
||||
onReachBottom() { //上拉触底函数
|
||||
this.loadMoreOrder('onReachBottom')
|
||||
|
||||
},
|
||||
methods: {
|
||||
loadMoreOrder() {
|
||||
if (this.TabCur === 0) {
|
||||
if (this.load.loadStatus1 != 'nomore') { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore1 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
} else if (this.TabCur === 1) {
|
||||
if (this.load.loadStatus2 != 'nomore') { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore2 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
} else if (this.TabCur === 2) {
|
||||
if (this.load.loadStatus3 != 'nomore') { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore3 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
} else if (this.TabCur === 3) {
|
||||
if (this.load.loadStatus4 != 'nomore') { //此处判断,上锁,防止重复请求
|
||||
this.load.isLoadMore4 = true
|
||||
this.calcIstate(this.TabCur)
|
||||
}
|
||||
}
|
||||
},
|
||||
pickSource(e) {
|
||||
this.indexSource = e.detail.value
|
||||
this.activeSource = this.sources[this.indexSource]
|
||||
uni.setStorageSync('orderType', this.indexSource)
|
||||
this.pageNumber1 = 1
|
||||
this.pageNumber2 = 1
|
||||
this.pageNumber3 = 1
|
||||
this.pageNumber4 = 1
|
||||
this.load.isLoadMore1 = false
|
||||
this.load.loadStatus1 = 'load'
|
||||
this.load.isLoadMore1 = false
|
||||
this.load.loadStatus1 = 'load'
|
||||
this.load.isLoadMore1 = false
|
||||
this.load.loadStatus1 = 'load'
|
||||
this.load.isLoadMore1 = false
|
||||
this.load.loadStatus1 = 'load'
|
||||
this.allOrder = []
|
||||
this.refundOrder = []
|
||||
this.finishedOrder = []
|
||||
this.payingOrder = []
|
||||
this.calcIstate(this.TabCur)
|
||||
},
|
||||
tabSelect(e) {
|
||||
this.TabCur = e.currentTarget.dataset.id;
|
||||
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
|
||||
this.loadMoreOrder()
|
||||
},
|
||||
|
||||
calcIstate(id) {
|
||||
@@ -173,58 +250,121 @@
|
||||
}
|
||||
},
|
||||
loadList(istate, pageNumber) {
|
||||
uni.setStorageSync('orderType', this.indexSource)
|
||||
const data2 = {
|
||||
istate: istate, //类型:Number 必有字段 备注:订单状态 0待支付 1支付成功 -3 查所有
|
||||
pageIndex: pageNumber //类型:Number 必有字段 备注:查询第几页,默认一页10条
|
||||
}
|
||||
cloudSiteApi.getSiteOrder(data2).then(res => {
|
||||
console.log(data2.istate, data2.pageIndex)
|
||||
if (res.code === 20000) {
|
||||
switch (istate) {
|
||||
case -3:
|
||||
this.allOrder = this.allOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore1 = true
|
||||
this.load.loadStatus1 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber1++
|
||||
this.load.isLoadMore1 = false
|
||||
}
|
||||
break
|
||||
case -2:
|
||||
this.refundOrder = this.refundOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore4 = true
|
||||
this.load.loadStatus4 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber4++
|
||||
this.load.isLoadMore4 = false
|
||||
}
|
||||
break
|
||||
case 0:
|
||||
this.payingOrder = this.payingOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore2 = true
|
||||
this.load.loadStatus2 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber2++
|
||||
this.load.isLoadMore2 = false
|
||||
}
|
||||
break
|
||||
case 1:
|
||||
this.finishedOrder = this.finishedOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore3 = true
|
||||
this.load.loadStatus3 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber3++
|
||||
this.load.isLoadMore3 = false
|
||||
}
|
||||
break
|
||||
if (this.indexSource == 0) {
|
||||
// 网页版
|
||||
|
||||
cloudSiteApi.getSiteOrder(data2).then(res => {
|
||||
console.log(data2.istate, data2.pageIndex)
|
||||
if (res.code === 20000) {
|
||||
switch (istate) {
|
||||
case -3:
|
||||
this.allOrder = this.allOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore1 = true
|
||||
this.load.loadStatus1 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber1++
|
||||
this.load.isLoadMore1 = false
|
||||
}
|
||||
break
|
||||
case -2:
|
||||
this.refundOrder = this.refundOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore4 = true
|
||||
this.load.loadStatus4 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber4++
|
||||
this.load.isLoadMore4 = false
|
||||
}
|
||||
break
|
||||
case 0:
|
||||
this.payingOrder = this.payingOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore2 = true
|
||||
this.load.loadStatus2 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber2++
|
||||
this.load.isLoadMore2 = false
|
||||
}
|
||||
break
|
||||
case 1:
|
||||
this.finishedOrder = this.finishedOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore3 = true
|
||||
this.load.loadStatus3 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber3++
|
||||
this.load.isLoadMore3 = false
|
||||
}
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (this.indexSource == 1) {
|
||||
// 0待支付 1支付成功 -3 查所有
|
||||
// 0:待支付, 1:已支付 ,-1:支付失败 ,2:已取消,3:已退款
|
||||
// 小程序
|
||||
if (data2.istate == -3) {
|
||||
data2.istate = ''
|
||||
} else if (data2.istate == -2) {
|
||||
data2.istate = 2
|
||||
}
|
||||
})
|
||||
data2.create_time = this.createTime
|
||||
cloudSiteApi.getNewItemSiteOrder(data2).then(res => {
|
||||
console.log(data2.istate, data2.pageIndex)
|
||||
if (res.code === 20000) {
|
||||
switch (istate) {
|
||||
case -3:
|
||||
this.allOrder = this.allOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore1 = true
|
||||
this.load.loadStatus1 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber1++
|
||||
this.load.isLoadMore1 = false
|
||||
}
|
||||
break
|
||||
case -2:
|
||||
this.refundOrder = this.refundOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore4 = true
|
||||
this.load.loadStatus4 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber4++
|
||||
this.load.isLoadMore4 = false
|
||||
}
|
||||
break
|
||||
case 0:
|
||||
this.payingOrder = this.payingOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore2 = true
|
||||
this.load.loadStatus2 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber2++
|
||||
this.load.isLoadMore2 = false
|
||||
}
|
||||
break
|
||||
case 1:
|
||||
this.finishedOrder = this.finishedOrder.concat(res.data)
|
||||
if (res.data.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.load.isLoadMore3 = true
|
||||
this.load.loadStatus3 = 'nomore'
|
||||
} else {
|
||||
this.pageNumber3++
|
||||
this.load.isLoadMore3 = false
|
||||
}
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,4 +378,14 @@
|
||||
.order-list .order-item:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.placeholder-hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fixed-t {
|
||||
position: fixed;
|
||||
width: 750upx;
|
||||
z-index: 3;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user