oil-station/pos-uni/pagesHome/orderList/orderList.vue

474 lines
10 KiB
Vue
Raw Normal View History

2024-05-22 09:39:54 +08:00
<template>
<view class="content">
<view class="container">
2024-05-29 15:15:33 +08:00
<headers :titles="titles" :type="titles" @chiledEvent="clickChild()">
<u-icon name="arrow-left" color="#fff" size="22">
</u-icon>
</headers>
2024-05-22 09:39:54 +08:00
<view class="tablist">
<view class="tabbox" v-for="(item,index) in tablist" :key="index" @click="getindex(index)">
<view class="">{{item}}</view>
<view class="gang" v-if="tabindex == index"></view>
</view>
</view>
2024-05-28 08:40:17 +08:00
<view class="box_" v-for="item,index in orderList" :key="index">
2024-05-22 09:39:54 +08:00
<view class="b-bx">
2024-05-28 08:40:17 +08:00
<!-- <view class="title_">京博加油站</view> -->
<view class="zt-size" v-if="item.orderStatus == 'paid'">已支付</view>
<view class="zt-size" v-if="item.orderStatus == 'refund'">已退款</view>
<view class="zt-size" v-if="item.orderStatus == 'unpaid'">未支付</view>
2024-05-22 09:39:54 +08:00
</view>
<view class="centne">
<view class="right-centne">
2024-05-29 15:34:23 +08:00
<view class="h_"> <text class="hao_">订单号:</text> <text>{{item.orderNo}}</text>
</view>
2024-06-06 17:16:22 +08:00
<view class="h_"><text class="hao_">消费类型:</text>{{item.content}}</view>
<template v-if="item.content == '储值卡充值'">
</template>
<template v-else>
<view class="h_"><text class="hao_">油号:</text>{{item.oilName}}</view>
<view class="h_"><text class="hao_">升数:</text>{{item.shengshu}}L</view>
</template>
2024-05-29 15:34:23 +08:00
<view class="h_"><text class="hao_">下单时间:</text>{{item.payTime}}</view>
2024-06-06 17:16:22 +08:00
<view class="b-bx" v-if="!item.content == '储值卡充值'">
2024-05-29 15:34:23 +08:00
<view class=""> <text class="hao_">应付:</text>{{item.goodsMoney}}</view>
2024-06-06 17:16:22 +08:00
<view class=""><text class="hao_">优惠:</text>{{item.discountAmount?item.discountAmount:0}}
</view>
2024-05-22 09:39:54 +08:00
</view>
</view>
</view>
2024-06-05 14:24:00 +08:00
<view class="end-box">
实付:{{item.payMoney}}
<u-button v-if="item.orderStatus == 'paid'" style="width: 60px;" type="primary"
@click="openRef(item)" text="退款"></u-button>
</view>
2024-05-22 09:39:54 +08:00
</view>
<view style="width: 100%; height: 20px; "></view>
2024-05-29 15:15:33 +08:00
<u-popup :show="showPop" mode="right" @close="closePop" @open="openPop" customStyle="width: 300px;">
<view style="margin-top: 100px;">
<view class="time-bs">
<view class="time-box" @click="showStartTime = true">{{form.startTime?form.startTime:'开始日期'}}
</view>
<view class="">-</view>
<view class="time-box" @click="showEndTime = true">{{form.endTime?form.endTime:'结束日期'}}</view>
</view>
<view class="time-bs2">
<view class="time-box2" @click="showType = true">{{payType?payType:'选择交易类型'}}
</view>
</view>
<!-- <u--input class="time-bs2" placeholder="选择交易类型" border="surround" v-model="form.type"
@click="showType = true" disabled></u--input> -->
<u-button style="width: 100px;" type="primary" text="确定" @click="clickBu"></u-button>
</view>
</u-popup>
2024-06-05 14:24:00 +08:00
<u-modal :show="showModal" showCancelButton content='是否确认退款' @confirm="ref()"
@cancel="showModal = false"></u-modal>
2024-05-29 15:15:33 +08:00
<u-datetime-picker :show="showStartTime" v-model="startTimeValue" mode="datetime" @confirm="clickStart"
@close="showStartTime = false" @cancel="showStartTime = false"></u-datetime-picker>
<u-datetime-picker :show="showEndTime" v-model="endTimeValue" mode="datetime" @confirm="clickEnd"
@close="showEndTime = false" @cancel="showEndTime = false"></u-datetime-picker>
<u-picker :show="showType" :columns="columns" keyName="label" @confirm="clickType"
@cancel="showType = false"></u-picker>
2024-05-22 09:39:54 +08:00
</view>
</view>
</template>
<script>
2024-05-29 15:15:33 +08:00
import config from '@/config'
2024-05-28 08:40:17 +08:00
import request from "../../utils/request";
2024-05-22 09:39:54 +08:00
import headers from '../../components/header/headers.vue'
export default {
data() {
return {
2024-06-05 14:24:00 +08:00
orderData: {},
2024-05-22 09:39:54 +08:00
titles: "订单列表",
tabindex: 0,
2024-05-29 15:15:33 +08:00
showPop: false,
2024-06-05 14:24:00 +08:00
showModal: false,
2024-05-22 09:39:54 +08:00
tablist: [
"全部",
"已完成",
2024-05-28 08:40:17 +08:00
"已退款",
"支付失败",
],
orderList: [],
2024-05-29 15:15:33 +08:00
baseUrl: config.baseUrl,
2024-05-28 08:40:17 +08:00
form: {
page: 1,
pageSize: 10,
2024-05-29 15:15:33 +08:00
status: '',
startTime: '',
endTime: '',
payType: ''
},
showType: false,
payType: '',
columns: [
[{
label: '无',
id: '0'
},
{
label: '支付宝',
id: 'ALIPAY'
}, {
label: '微信',
id: 'WECHAT'
}, {
label: '现金',
id: 'CASH'
}
]
],
startTime: "",
endTime: "",
startTimeValue: "",
endTimeValue: "",
showStartTime: false,
showEndTime: false,
2024-05-22 09:39:54 +08:00
}
},
onShow() {
// this.actList = ["1", "1", "1", "1", "1", ]
// this.status = "nomore" 底部刷新结束
2024-05-28 08:40:17 +08:00
this.getPageListByPos();
2024-05-22 09:39:54 +08:00
},
onPullDownRefresh() {
console.log("刷新");
uni.stopPullDownRefresh()
},
onReachBottom() {
// this.show = true
setTimeout(() => {
console.log("加载执行");
}, 2000)
},
components: {
headers
},
2024-05-28 08:40:17 +08:00
2024-05-22 09:39:54 +08:00
methods: {
getindex(index) {
2024-05-28 08:40:17 +08:00
this.orderList = []
this.tabindex = index
if (index == 0) {
this.form.status = ''
} else if (index == 1) {
this.form.status = 'paid'
} else if (index == 2) {
this.form.status = 'refund'
} else if (index == 3) {
this.form.status = 'unpaid'
}
this.getPageListByPos()
2024-06-05 14:24:00 +08:00
},
openRef(data) {
this.showModal = true
this.orderData = {}
this.orderData = data
},
ref() {
let form = {
orderNo: this.orderData.orderNo,
storeId: this.orderData.storeId,
refundRemark: "pos机退款",
type: "canRefund",
isOilVouchers: true,
isGoods: true,
isOil: true,
isOilCard: true, // 是否推掉油卡
isOilFuel: true, //是否推掉储值卡
refundAmt: this.orderData.oilPayAmount
}
request({
url: 'business/allOrderInfo/refund',
method: 'post',
data: form
}).then((res) => {
if (res.code == 200) {
} else {
uni.showToast({
title: res.data,
icon: "none"
})
}
this.showModal = false
})
2024-05-22 09:39:54 +08:00
},
goback() {
uni.navigateBack()
2024-05-28 08:40:17 +08:00
},
getPageListByPos() {
2024-05-29 15:15:33 +08:00
if (this.form.startTime && this.form.endTime) {
this.form.params = {
beginTime: this.form.startTime,
endTime: this.form.endTime
}
}
2024-05-28 08:40:17 +08:00
request({
url: 'business/allOrderInfo/getPageListByPos',
method: 'get',
params: this.form
}).then((res) => {
if (res.code == 200) {
this.orderList = res.data.records;
} else {
uni.showToast({
title: res.data,
icon: "none"
})
}
})
},
2024-05-29 15:15:33 +08:00
clickChild() {
this.showPop = true
},
clickBu() {
this.showPop = false
this.getPageListByPos()
},
closePop() {},
openPop() {},
clickType(e) {
this.showType = false
let data = e.value[0]
if (data.id == 0) {
this.payType = ''
this.form.payType = ''
} else {
this.payType = data.label
this.form.payType = data.id
}
console.log(data)
},
// changeType(e) {
// console.log(e)
// this.showType = false
// },
clickStartTime(e) {
this.showStartTime = true
console.log(123, e)
// const date = new Date(timestamp);
},
clickEndTime(e) {
this.showEndTime = true
},
clickStart(e) {
this.showStartTime = false
this.form.startTime = this.formatDateToYYMMDDHHMM(new Date(e.value));
this.getIndexData();
},
clickEnd(e) {
this.showEndTime = false
this.form.endTime = this.formatDateToYYMMDDHHMM(new Date(e.value));
this.getIndexData();
},
formatDateToYYMMDDHHMM(date) {
const year = String(date.getFullYear()); // 获取两位数的年份
const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份,并确保是两位数
const day = String(date.getDate()).padStart(2, '0'); // 获取日期,并确保是两位数
const hours = String(date.getHours()).padStart(2, '0'); // 获取小时,并确保是两位数
const minutes = String(date.getMinutes()).padStart(2, '0'); // 获取分钟,并确保是两位数
// return `${year}/${month}/${day} ${hours}:${minutes}`;
return `${year}/${month}/${day}`;
}
2024-05-22 09:39:54 +08:00
}
}
</script>
<style scoped lang="scss">
.content {
background: #f8f8f8;
// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
height: 100vh;
}
.container {
width: 100%;
background: #f8f8f8;
box-sizing: border-box;
padding-top: 88px;
}
.img-box {
image {
width: 100%;
height: 100%;
}
}
.tablist {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.tabbox {
width: 25%;
height: 40px;
text-align: center;
box-sizing: border-box;
padding-top: 15px;
}
.gang {
width: 36px;
height: 2px;
background: #0864E9;
margin: 5px auto;
}
.box_ {
width: 95%;
border-radius: 8px;
background: #fff;
box-sizing: border-box;
padding: 15px;
margin: 15px auto;
}
.b-bx {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.title_ {
font-weight: bold;
font-size: 16px;
color: #333333;
}
.zt-size {
font-weight: bold;
font-size: 16px;
color: #FD504E;
}
.centne {
display: flex;
}
.touxiang {
width: 60px;
height: 60px;
border-radius: 50%;
background: #D9D9D9;
margin-right: 15px;
}
.right-centne {
2024-05-29 15:34:23 +08:00
width: 100%;
2024-05-22 09:39:54 +08:00
font-size: 14px;
}
.h_ {
2024-05-29 15:34:23 +08:00
width: 100%;
2024-05-22 09:39:54 +08:00
margin-bottom: 5px;
}
.end-box {
width: 100%;
text-align: right;
font-weight: bold;
font-size: 16px;
color: #0864E9;
}
2024-05-29 15:15:33 +08:00
.time {
font-weight: 500;
font-size: 14px;
color: #333333;
margin: 0px auto;
margin-top: 15px;
}
.time-bs {
width: 100%;
box-sizing: border-box;
background: #FFFFFF;
padding: 15px;
display: flex;
align-items: center;
justify-content: space-around;
}
.time-bs2 {
width: 100%;
box-sizing: border-box;
background: #FFFFFF;
padding: 30px;
// display: flex;
align-items: center;
justify-content: space-around;
}
.time-box {
border: 1px solid #0864E9;
box-sizing: border-box;
padding: 5px 15px;
border-radius: 8px;
font-size: 14px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
}
.time-box2 {
border: 1px solid #0864E9;
box-sizing: border-box;
padding: 5px 15px;
border-radius: 8px;
font-size: 14px;
color: #333;
display: flex;
align-items: center;
justify-content: center;
}
2024-05-29 15:34:23 +08:00
.hao_ {
width: 30%;
font-weight: bold;
margin-right: 5px;
}
2024-05-22 09:39:54 +08:00
</style>