frontend_h5/treegitee/pages/order/index.vue

121 lines
3.0 KiB
Vue
Raw Permalink Normal View History

2024-06-17 15:25:46 +08:00
<template>
<view class="" v-if="istrue">
<view v-if="list.length!=0">
<view v-for="(item,index) in list" :key="index" class="mt30 bgwhite ptb30 plr50">
<view @click="bufagain(item.product_id)">
<view class="flex_between flex_items f26 pb30 bbe9s" style="color: #666;">
<text>订单号{{item.order_no}}</text>
<text v-if="item.statue==0" class="f28 bold">待支付</text>
<text v-if="item.statue==1" class="f28 bold">已支付</text>
<text v-if="item.statue==2" class="f28 bold">已过期</text>
<text v-if="item.statue==3" class="f28 bold">已取消</text>
</view>
<view class="flex_start flex_items mt30">
<image :src="item.product_main_image" style="width: 120rpx;height: 120rpx;boredr-radius:12rpx"
mode=""></image>
<view class="ml30 flex_column" style="width:440rpx;">
<view class="f30 bold three">{{item.product_name}}</view>
<text class="f30 mt30" style="color: #888;">充值账号{{item.phone}}</text>
</view>
</view>
<view class="mt40 flex_between flex_items">
<text class="f28" style="color: #4d4d4d;">
消耗积分{{item.price}}积分
</text>
<image :src="imgUrl+'again.png'" style="width: 168rpx;height: 64rpx;" mode=""></image>
</view>
</view>
</view>
</view>
<view v-else class="flex_center flex_items f24" style="color: #888;height:600rpx;width: 100%;">
<text>--暂无数据--</text>
</view>
<Ywatermark :info="'蓝色兄弟'"></Ywatermark>
</view>
</template>
<script>
export default {
data() {
return {
istrue: false,
form: {
page: 1,
pageSize: 10
},
list: [],
istrue: false,
imgUrl:""
}
},
onLoad() {
this.imgUrl = this.api.imgUrl
this.getData()
},
methods: {
getData() {
uni.showLoading({
title: "加载中..."
})
this.api.orderlist(this.form).then((res) => {
console.log(res)
if (res.data.code == 200) {
//数据请求完成之后停止下拉刷新
uni.stopPullDownRefresh();
uni.hideLoading()
if (res.data.data.data.length == 0) {
uni.showToast({
title: "暂无数据",
icon: "none"
})
this.istrue = true
return false
}
for (let i = 0; i < res.data.data.data.length; i++) {
this.list.push(res.data.data.data[i])
}
} else {
uni.hideLoading()
uni.showToast({
icon: "none",
title: res.data.message
})
}
this.istrue = true
})
},
bufagain(idx) {
uni.navigateTo({
url: "/pages/product/detail?id=" + idx
})
}
},
onReachBottom() {
uni.showLoading({
title: "加载中..."
})
this.form.page += 1
this.getData()
},
onPullDownRefresh() {
this.form.page = 1
this.list = []
this.getData()
}
}
</script>
<style>
page {
background: #f5f5f5 !important;
}
.three {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>