powerbank/page_user/order/detailshop.vue

372 lines
9.9 KiB
Vue
Raw Normal View History

2024-05-14 18:15:41 +08:00
<template>
<view class="page">
2024-06-07 18:02:00 +08:00
<u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' back-icon-color="#000" title-size='36' height='50'></u-navbar>
2024-05-14 18:15:41 +08:00
<view class="box">
<view class="top">
2024-06-07 18:02:00 +08:00
<u-search placeholder="搜索" input-align="center" v-model="keyword" @custom="seach"></u-search>
2024-05-14 18:15:41 +08:00
</view>
<u-picker mode="time" v-model="show" :params="params" @confirm="confirm"></u-picker>
<view class="date">
<text @click="btnks(1)">{{selector}}</text> -- <text @click="btnks(2)">{{selectors}}</text>
</view>
2024-06-07 18:02:00 +08:00
<view class="list" @scrolltolower="onReachBottom" v-for="(item,index) in wateringList" :key="index">
2024-05-14 18:15:41 +08:00
<view class="tops">
2024-06-07 18:02:00 +08:00
<view class="" style="font-size: 32rpx;color: #3D3D3D;">{{item.orderNo}}
<u-icon @click="fuzhi(item.orderNo)" name="file-text" size="38"></u-icon></view>
<view class="" @click="btnxq(item.orderId)"><u-icon name="arrow-right"></u-icon></view>
2024-05-14 18:15:41 +08:00
</view>
<view class="list_val">
<view class="wz">
租借店铺
</view>
<view class="gl" style="color: #1DBE7B;">
2024-06-07 18:02:00 +08:00
{{item.startStoreName}}
2024-05-14 18:15:41 +08:00
</view>
</view>
<view class="list_val">
<view class="wz">
租借时间
</view>
<view class="gl">
2024-06-07 18:02:00 +08:00
{{item.startRentTime}}
2024-05-14 18:15:41 +08:00
</view>
</view>
<view class="list_val">
<view class="wz">
手机号码
</view>
<view class="gl">
2024-06-07 18:02:00 +08:00
{{item.mobile}}
2024-05-14 18:15:41 +08:00
</view>
</view>
<view class="list_val">
<view class="wz">
订单时长
</view>
<view class="gl">
2024-06-07 18:02:00 +08:00
{{item.remainingTime}}
2024-05-14 18:15:41 +08:00
</view>
</view>
<view class="list_val">
<view class="wz">
代理信息
</view>
<view class="gl">
2024-06-07 18:02:00 +08:00
{{item.userName}}{{item.startAgentId}}
2024-05-14 18:15:41 +08:00
</view>
</view>
<view class="je">
<view class="" style="font-size: 32rpx;color: #3D3D3D;">
2024-06-06 18:02:54 +08:00
订单金额 <text
2024-06-07 18:02:00 +08:00
style="font-size: 28rpx;color: #FF8157;display: inline-block;margin-left: 10rpx;">{{item.money}}</text>
2024-05-14 18:15:41 +08:00
</view>
<view class="" style="font-size: 28rpx;color: #FF8157;">
2024-06-07 18:02:00 +08:00
<text v-if="item.status == '1'">租借中</text>
<text v-if="item.status == '2'">待扣款</text>
<text v-if="item.status == '4'">已完成</text>
<text v-if="item.status == '6'">租转卖</text>
<text v-if="item.status == '7'">弹出失败</text>
2024-05-14 18:15:41 +08:00
</view>
</view>
</view>
2024-06-08 18:05:07 +08:00
<view class="" style="width: 448rpx;height: 448rpx;margin: auto;margin-top: 100rpx;text-align: center;"
v-if="showflag">
<image style="width: 448rpx;height: 448rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/ufLi6IZd5kh1MIEZFYTo" mode=""></image>
<view class="" style="font-size: 30rpx;color: #ccc;margin-top: 30rpx;">暂无更多代理人员...</view>
</view>
2024-05-14 18:15:41 +08:00
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: '',
bgc: {
background: '#25CE88'
},
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
show: false,
2024-06-07 18:02:00 +08:00
selector: '',
selectors: '',
2024-05-14 18:15:41 +08:00
num: '',
2024-06-06 18:02:54 +08:00
status: '',
pagenum: 1,
wateringList: [],
pagesize: 10, // 一页多少数据
isLoading: false, // 是否正在加载数据
noMoreData: false, // 是否没有更多数据
total: 0,
keyword: '',
showflag: false
2024-05-14 18:15:41 +08:00
}
},
onLoad(option) {
2024-06-07 18:02:00 +08:00
let today = new Date()
this.selector = this.formatDate(today)
this.selectors = this.formatDate(today)
2024-05-14 18:15:41 +08:00
this.title = option.title
2024-06-06 18:02:54 +08:00
this.status = option.status
2024-06-07 18:02:00 +08:00
this.getlist()
2024-05-14 18:15:41 +08:00
},
methods: {
2024-06-06 18:02:54 +08:00
getlist() {
2024-06-07 18:02:00 +08:00
this.$u.get('/agent/order/rent/list?pageNum=' + this.pagenum + '&pageSize=' + this.pagesize + '&keyword=' +
this.keyword + '&status=' + this.status + '&startDate=' + this.selector + '&endDate=' + this.selectors).then(res => {
2024-06-06 18:02:54 +08:00
if (res.code == 200) {
this.total = res.total
if (this.total > 0) {
this.showflag = false
} else {
this.showflag = true
}
if (res.rows.length > 0) {
// 有数据,追加到列表
2024-06-07 18:02:00 +08:00
res.rows.forEach(order => {
if (order.endRentTime == null) {
var targetDate = new Date(order.startRentTime)
var currentDate = new Date()
var diff = targetDate - currentDate
var absDiff = Math.abs(diff)
var hours = Math.floor(absDiff / (1000 * 60 * 60))
var minutes = Math.floor((absDiff % (1000 * 60 * 60)) / (1000 * 60))
let formattedMinutes = minutes < 10 ? '0' + minutes : minutes
order.remainingTime = hours + '时' + formattedMinutes + '分钟'
if (order.priceStandard.feeMode == 2) {
if (minutes >= order.priceStandard.feeFreeTime) {
order.money = (hours + 1) * order.priceStandard.feePrice
} else {
order.money = hours * order.priceStandard.feePrice
}
} else if (order.priceStandard.feeMode == 1) {
if (minutes >= order.priceStandard.feeFreeTime) {
order.money = (hours * 2 + 1) * order.priceStandard.feePrice
if (minutes >= 30) {
order.money = (hours * 2 + 2) * order.priceStandard.feePrice
}
} else {
order.money = hours * 2 * order.priceStandard.feePrice
}
}
} else {
var targetDate = new Date(order.endRentTime)
var currentDate = new Date()
var diff = targetDate - currentDate
var absDiff = Math.abs(diff)
var hours = Math.floor(absDiff / (1000 * 60 * 60))
var minutes = Math.floor((absDiff % (1000 * 60 * 60)) / (1000 * 60))
let formattedMinutes = minutes < 10 ? '0' + minutes : minutes
order.remainingTime = hours + '时' + formattedMinutes + '分钟'
if (order.priceStandard.feeMode == 2) {
if (minutes >= order.priceStandard.feeFreeTime) {
order.money = (hours + 1) * order.priceStandard.feePrice
} else {
order.money = hours * order.priceStandard.feePrice
}
} else if (order.priceStandard.feeMode == 1) {
if (minutes >= order.priceStandard.feeFreeTime) {
order.money = (hours * 2 + 1) * order.priceStandard.feePrice
if (minutes >= 30) {
order.money = (hours * 2 + 2) * order.priceStandard.feePrice
}
} else {
order.money = hours * 2 * order.priceStandard.feePrice
}
}
}
})
2024-06-06 18:02:54 +08:00
this.wateringList = this.wateringList.concat(res.rows)
this.pagenum++
} else {
// 没有更多数据
this.noMoreData = true;
}
this.isLoading = false;
}
})
},
onReachBottom() {
let sum = this.total / this.pagesize
if (this.pagenum - 1 < sum) {
this.getlist(); // 上拉加载更多
} else {
uni.showToast({
title: '没有更多记录了',
icon: 'none',
duration: 1000
});
}
},
2024-06-07 18:02:00 +08:00
formatDate(date) {
let year = date.getFullYear()
let month = String(date.getMonth() + 1).padStart(2, '0')
let day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
2024-05-14 18:15:41 +08:00
btnks(num) {
this.show = true
if (num == 1) {
this.num = 1
} else {
this.num = 2
}
},
confirm(e) {
if (this.num == 1) {
this.selector = e.year + '-' + e.month + '-' + e.day
2024-06-07 18:02:00 +08:00
this.pagenum = 1
this.wateringList = []
this.getlist()
2024-05-14 18:15:41 +08:00
} else {
this.selectors = e.year + '-' + e.month + '-' + e.day
2024-06-07 18:02:00 +08:00
this.pagenum = 1
this.wateringList = []
this.getlist()
2024-05-14 18:15:41 +08:00
}
},
2024-06-07 18:02:00 +08:00
btnxq(orderId) {
2024-05-14 18:15:41 +08:00
uni.navigateTo({
2024-06-07 18:02:00 +08:00
url: '/page_user/order/xiangqing?orderId=' + orderId
2024-05-14 18:15:41 +08:00
})
2024-06-07 18:02:00 +08:00
},
fuzhi(text) {
uni.setClipboardData({
data: text,
success: function(res) {
console.log('复制的信息:', text);
uni.showToast({
title: '复制成功',
});
}
});
},
seach(){
this.pagenum = 1
this.wateringList = []
this.getlist()
2024-05-14 18:15:41 +08:00
}
}
}
</script>
<style lang="scss">
2024-05-25 18:06:00 +08:00
/deep/ .u-title,
/deep/ .uicon-nav-back {
2024-06-07 18:02:00 +08:00
padding-bottom: 22rpx;
2024-05-25 18:06:00 +08:00
}
2024-06-06 18:02:54 +08:00
2024-06-08 18:05:07 +08:00
page {
background-color:#F4F5F7;
}
2024-05-14 18:15:41 +08:00
.page {
width: 750rpx;
2024-06-06 18:02:54 +08:00
2024-05-14 18:15:41 +08:00
.box {
width: 750rpx;
height: 100%;
padding-bottom: 200rpx;
background: #F4F5F7;
border-radius: 0rpx 0rpx 0rpx 0rpx;
2024-06-06 18:02:54 +08:00
.list {
2024-05-14 18:15:41 +08:00
width: 680rpx;
2024-06-07 18:02:00 +08:00
height: 500rpx;
2024-05-14 18:15:41 +08:00
background: #FFFFFF;
border-radius: 38rpx 38rpx 38rpx 38rpx;
padding: 32rpx 42rpx;
box-sizing: border-box;
margin: auto;
margin-bottom: 30rpx;
2024-06-06 18:02:54 +08:00
.je {
2024-05-14 18:15:41 +08:00
border-top: 1px solid #D8D8D8;
display: flex;
justify-content: space-between;
padding-top: 20rpx;
margin-top: 20rpx;
box-sizing: border-box;
}
2024-06-06 18:02:54 +08:00
.list_val {
2024-05-14 18:15:41 +08:00
display: flex;
justify-content: space-between;
margin-top: 28rpx;
2024-06-06 18:02:54 +08:00
.wz {
2024-05-14 18:15:41 +08:00
font-size: 24rpx;
color: #808080;
}
2024-06-06 18:02:54 +08:00
.gl {
2024-05-14 18:15:41 +08:00
font-size: 24rpx;
color: #3D3D3D;
}
}
2024-06-06 18:02:54 +08:00
.tops {
2024-05-14 18:15:41 +08:00
display: flex;
justify-content: space-between;
width: 100%;
border-bottom: 1px solid #D8D8D8;
padding-bottom: 20rpx;
}
}
2024-06-06 18:02:54 +08:00
2024-05-14 18:15:41 +08:00
.top {
padding: 28rpx 32rpx;
box-sizing: border-box;
background-color: #fff;
/deep/ .u-content {
border: 1px solid #ccc;
border-radius: 50rpx 0 0 50rpx !important;
}
/deep/ .u-action {
border-radius: 0 50rpx 50rpx 0 !important;
width: 112rpx;
height: 65rpx;
line-height: 65rpx;
border: 2rpx solid #ccc;
margin-left: 0;
color: #3D3D3D;
background-color: #f2f2f2;
}
}
.date {
padding-left: 80rpx;
padding-right: 80rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
background-color: #fff;
padding-bottom: 40rpx;
2024-06-06 18:02:54 +08:00
margin-bottom: 26rpx;
2024-05-14 18:15:41 +08:00
text {
padding: 6rpx 18rpx;
box-sizing: border-box;
background: #eee;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-size: 24rpx;
color: #808080;
}
}
}
}
</style>