oil-station/gasStation-uni/pagesMy/myorder/myorder.vue

582 lines
14 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<template>
<view class="content">
<view class="container">
<view class="my-header">
2023-12-05 17:18:27 +08:00
<view class="my-icons" @click="goBack"> <uni-icons type="left" size="16"></uni-icons> </view>
2023-11-27 09:24:16 +08:00
<view class="my-text">我的订单</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="top-box">
<view class="top-input">
<u-icon name="search" size="28"></u-icon>
2023-12-18 18:44:02 +08:00
<input type="text" placeholder="搜索我的订单" v-model="query" @confirm="queryOrder" />
2023-11-27 09:24:16 +08:00
</view>
2023-12-05 17:18:27 +08:00
<view class="" @click="queryOrder">搜索</view>
2023-11-27 09:24:16 +08:00
</view>
<!-- tap -->
<view class="tap-box">
<view class="box-fv" :class="{'actbox' : tapindex == index }" v-for="(item,index) in tapList"
2023-12-05 17:18:27 +08:00
:key="index" @click="getTapIndex(index)">
2023-11-27 09:24:16 +08:00
<view class="">{{item.text}}</view>
<view class="gang" :class="{'actg' : tapindex == index }"></view>
</view>
</view>
2023-12-06 09:20:25 +08:00
2023-12-05 17:18:27 +08:00
<view>
2023-12-06 18:36:10 +08:00
<scroll-view scroll-y="true" :scroll-top="scrollTop" id="scrollList" style="height: 78vh;"
2023-12-06 09:20:25 +08:00
@scrolltolower="scrolltolower">
2023-12-21 18:43:22 +08:00
<!-- 油品订单列表 -->
2023-12-06 09:20:25 +08:00
<view class="box-order" v-for="(item,index) in list" :key="index">
2024-02-06 18:10:15 +08:00
<view class="or-box-top" @click="goOrderInfo(item.orderNo)">
2023-12-05 17:18:27 +08:00
<view class="">{{getStoreName(storeList,item.storeId)}}</view>
2024-01-03 18:40:21 +08:00
<!-- <view class="chengg">{{getPayName(payList,item.orderStatus)}}</view> -->
<view class="chengg" v-if="item.orderStatus=='paid'">已支付</view>
<view class="chengg" v-else-if="item.orderStatus=='payFail'">支付失败</view>
2024-01-19 13:44:13 +08:00
<view class="chengg" v-else-if="item.orderStatus=='refund'">已退款</view>
<view class="chengg" v-else-if="item.orderStatus=='refunding'">退款中</view>
2024-01-03 18:40:21 +08:00
<view class="chengg" v-else>未支付</view>
2023-12-05 17:18:27 +08:00
</view>
2023-12-06 09:20:25 +08:00
2023-12-26 18:44:50 +08:00
<!-- <view class="but-box">
2023-12-23 18:17:19 +08:00
<view class="huis">订单类型</view>
<view class="">油品订单</view>
2023-12-26 18:44:50 +08:00
</view> -->
2024-02-06 18:10:15 +08:00
<view class="but-box" @click="goOrderInfo(item.orderNo)">
2023-12-05 17:18:27 +08:00
<view class="huis">订单金额</view>
<view class="">{{item.orderAmount}}</view>
</view>
2024-02-06 18:10:15 +08:00
<view class="but-box" @click="goOrderInfo(item.orderNo)">
2023-12-05 17:18:27 +08:00
<view class="huis">优惠合计</view>
<view class="reds">{{item.discountAmount}}</view>
</view>
2024-02-06 18:10:15 +08:00
<view class="but-box" @click="goOrderInfo(item.orderNo)">
2023-12-05 17:18:27 +08:00
<view class="huis">订单时间</view>
2024-01-24 17:10:37 +08:00
<view class="" v-if="item.orderStatus=='paid'">{{item.payTime}}</view>
2023-12-05 17:18:27 +08:00
<view class="" v-else>{{item.createTime}}</view>
</view>
2024-01-24 17:10:37 +08:00
<view v-if="item.orderStatus=='paid' && item.remark==null" class="end-box" @click="goComment(item.id)">
<view class="anniu">
<text>去评价</text>
</view>
</view>
<view v-if="item.orderStatus=='paid' && item.remark==''" class="end-box" @click="goComment(item.id)">
2023-12-05 17:18:27 +08:00
<view class="anniu">
2024-01-24 14:35:00 +08:00
<text>去评价</text>
2023-12-05 17:18:27 +08:00
</view>
</view>
2024-01-22 18:05:19 +08:00
<view v-else-if="item.orderStatus=='unpaid'" class="end-box" @click="goPayment(item.orderNo)">
2023-12-22 16:33:34 +08:00
<view class="anniu">
<text>去支付</text>
</view>
</view>
<view v-else class="end-box">
<!-- <view class="anniu">
<text>去支付</text>
</view> -->
</view>
2023-12-05 17:18:27 +08:00
</view>
2023-12-21 18:43:22 +08:00
<!-- 储值卡订单列表 -->
2023-12-26 18:44:50 +08:00
<!-- <view class="box-order" v-for="(item,index) in balanceList" :key="index">
2023-12-21 18:43:22 +08:00
<view class="or-box-top">
<view class="">{{getStoreName(storeList,item.storeId)}}</view>
2023-12-23 18:17:19 +08:00
<view class="chengg">{{getPayName(payList,item.status)}}</view>
2023-12-21 18:43:22 +08:00
</view>
2023-12-23 18:17:19 +08:00
<view class="but-box">
<view class="huis">订单类型</view>
<view class="">储值卡订单</view>
</view>
2023-12-21 18:43:22 +08:00
<view class="but-box">
<view class="huis">订单金额</view>
2023-12-23 18:17:19 +08:00
<view class="">{{item.amount}}</view>
2023-12-21 18:43:22 +08:00
</view>
<view class="but-box">
<view class="huis">优惠合计</view>
2023-12-23 18:17:19 +08:00
<view class="reds">{{item.discount}}</view>
2023-12-21 18:43:22 +08:00
</view>
<view class="but-box">
<view class="huis">订单时间</view>
2023-12-23 18:17:19 +08:00
<view class="" v-if="item.status=='paid'">{{parseTime(item.payTime)}}</view>
<view class="" v-else>{{parseTime(item.createTime)}}</view>
2023-12-21 18:43:22 +08:00
</view>
<view class="end-box" @click="goComment()">
<view class="anniu">
<text>评价有礼</text>
</view>
</view>
2023-12-26 18:44:50 +08:00
</view> -->
2023-12-05 17:18:27 +08:00
<!-- 状态加载更多没有更多了... -->
2024-01-08 18:26:49 +08:00
<!-- <u-load-more :status="status"></u-load-more> -->
<u-empty v-if="list.length == 0" mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty>
2023-12-05 17:18:27 +08:00
</scroll-view>
</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
</template>
<script>
2023-12-05 17:18:27 +08:00
import request from '../../utils/request'
2023-11-27 09:24:16 +08:00
export default {
data() {
return {
title: '',
tapindex: 0,
2023-12-06 09:20:25 +08:00
tapList: [{
text: '全部'
},
{
text: '待支付'
},
{
text: '已完成'
},
{
text: '待评价'
},
2023-12-05 17:18:27 +08:00
],
// 订单列表信息
2023-12-06 09:20:25 +08:00
orderList: [],
list: [],
2023-12-21 18:43:22 +08:00
// 储值卡订单列表信息
balanceList:[],
2023-12-23 18:17:19 +08:00
list1: [],
2023-12-06 09:20:25 +08:00
map: {
page: 1,
2023-12-22 16:33:34 +08:00
pageSize: 10,
2024-01-04 18:44:52 +08:00
storeId: uni.getStorageSync("storeId"),
2023-12-06 09:20:25 +08:00
orderStatus: "",
remark: "",
2024-01-19 13:44:13 +08:00
payType:uni.getStorageSync("appltType")
2023-12-05 17:18:27 +08:00
},
2023-12-23 18:17:19 +08:00
map1: {
page: 1,
pageSize: 10,
status: "",
},
2023-12-05 17:18:27 +08:00
// 总条数
2023-12-06 09:20:25 +08:00
total: 0,
2023-12-23 18:17:19 +08:00
total1: 0,
2023-12-05 17:18:27 +08:00
// 店铺列表信息
2023-12-06 09:20:25 +08:00
storeList: [],
2023-12-05 17:18:27 +08:00
// 支付状态列表
2023-12-06 09:20:25 +08:00
payList: [],
query: "",
2023-12-05 17:18:27 +08:00
status: 'more', // 状态-正在加载中
scrollTop: 0,
2023-11-27 09:24:16 +08:00
}
},
2023-12-06 09:41:19 +08:00
onLoad(option) {
this.tapindex = option.id
this.getTapIndex(option.id)
2023-12-22 16:33:34 +08:00
// this.getMyOrder()
2023-12-05 17:18:27 +08:00
this.getStores()
2024-01-03 18:40:21 +08:00
// this.getPayList()
2023-12-05 17:18:27 +08:00
},
2024-01-24 17:10:37 +08:00
onShow() {
2024-02-02 09:35:14 +08:00
// this.getTapIndex(0)
2024-01-24 17:10:37 +08:00
},
2023-11-27 09:24:16 +08:00
components: {
},
methods: {
2023-12-05 17:18:27 +08:00
// 搜索我的订单
2023-12-06 09:20:25 +08:00
queryOrder() {
2023-12-05 17:18:27 +08:00
let _this = this;
_this.list = [];
2023-12-23 18:17:19 +08:00
_this.list1 = [];
2023-12-06 09:20:25 +08:00
if (_this.query == "") {
2023-12-05 17:18:27 +08:00
_this.list = _this.orderList
2023-12-06 09:20:25 +08:00
} else {
2023-12-05 17:18:27 +08:00
_this.storeList.forEach(item => {
2023-12-06 09:20:25 +08:00
_this.orderList.forEach(item1 => {
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list.push(item1)
}
return
}
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list.push(item1)
}
}
})
2023-12-05 17:18:27 +08:00
})
2023-12-23 18:17:19 +08:00
_this.storeList.forEach(item => {
_this.balanceList.forEach(item1 => {
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list1.push(item1)
}
return
}
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list1.push(item1)
}
}
})
})
2023-12-05 17:18:27 +08:00
}
},
2023-12-06 09:20:25 +08:00
parseTime(dateTime) {
2023-12-05 17:18:27 +08:00
let date = new Date(dateTime);
let y = date.getFullYear() + "-";
2023-12-06 09:20:25 +08:00
let mon = ((date.getMonth() + 1 < 10) ? ('0' + date.getMonth()) : date.getMonth()) + "-";
2023-12-05 17:18:27 +08:00
let d = ((date.getDate() < 10) ? ('0' + date.getDate()) : date.getDate()) + " ";
let h = ((date.getHours() < 10) ? ('0' + date.getHours()) : date.getHours()) + ":";
let m = ((date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes()) + ":";
let s = ((date.getSeconds() < 10) ? ('0' + date.getSeconds()) : date.getSeconds());
2023-12-06 09:20:25 +08:00
return y + mon + d + h + m + s;
2023-12-05 17:18:27 +08:00
},
2023-12-06 09:20:25 +08:00
getStoreName(list, id) {
2023-12-05 17:18:27 +08:00
let name = "";
list.forEach(item => {
if (item.id == id) {
2023-12-06 09:20:25 +08:00
if (item.description != "" && item.description != null) {
name = item.name + "(" + item.description + ")"
} else {
2023-12-05 17:18:27 +08:00
name = item.name
}
}
})
return name;
},
2023-12-06 09:20:25 +08:00
getPayName(list, type) {
2023-12-05 17:18:27 +08:00
let name = "";
list.forEach(item => {
if (item.dictValue == type) {
name = item.dictLabel
}
})
return name;
},
// 查询支付状态列表信息
2023-12-06 09:20:25 +08:00
getPayList() {
2023-12-05 17:18:27 +08:00
let _this = this;
request({
url: "system/dict/data/type/pay_status",
method: 'get',
2023-12-06 09:20:25 +08:00
}).then((res) => {
2024-01-03 18:40:21 +08:00
console.log(res);
2023-12-05 17:18:27 +08:00
_this.payList = res.data
})
},
// 查询店铺列表信息
2023-12-06 09:20:25 +08:00
getStores() {
2023-12-05 17:18:27 +08:00
let _this = this;
request({
2023-12-22 16:33:34 +08:00
url: "business/storeInformation/store/list",
2023-12-05 17:18:27 +08:00
method: 'get',
2023-12-06 09:20:25 +08:00
}).then((res) => {
2023-12-05 17:18:27 +08:00
_this.storeList = res.data
})
},
// 滚动区域
2023-12-06 09:20:25 +08:00
scrolltolower() {
if (this.orderList.length < this.total) {
2023-12-05 17:18:27 +08:00
this.map.page++;
this.getMyOrder()
2023-12-06 09:20:25 +08:00
} else {
2023-12-05 17:18:27 +08:00
this.status = "no-more"
}
2024-01-27 14:10:02 +08:00
// if (this.balanceList.length < this.total1) {
// this.map1.page++;
// this.getBalanceOrder()
// } else {
// this.status = "no-more"
// }
2023-12-05 17:18:27 +08:00
},
2023-12-23 18:17:19 +08:00
// 查询我的油品订单信息
2023-12-06 09:20:25 +08:00
getMyOrder() {
2023-12-05 17:18:27 +08:00
let _this = this;
2024-01-06 13:37:21 +08:00
_this.map.storeId = uni.getStorageSync("storeId")
2023-12-05 17:18:27 +08:00
request({
url: "business/oilOrder/userOrders",
method: 'get',
params: _this.map,
2023-12-06 09:20:25 +08:00
}).then((res) => {
2023-12-06 09:41:19 +08:00
uni.showLoading({
title: '加载中'
});
if (res.code == 200) {
if (_this.map.page == 1) {
_this.orderList = res.data.records
_this.list = res.data.records
} else {
_this.orderList = _this.orderList.concat(res.data.records)
_this.list = _this.list.concat(res.data.records)
}
_this.total = res.data.total
uni.hideLoading();
2023-12-23 18:17:19 +08:00
}
})
},
// 查询我的储值卡订单信息
getBalanceOrder() {
let _this = this;
request({
url: "business/marketingActivity/activeExchange/cardValueOrders/list",
method: 'get',
params: _this.map1,
}).then((res) => {
console.log(res,uni.getStorageSync("userId"))
uni.showLoading({
title: '加载中'
});
if (res.code == 200) {
if (_this.map1.page == 1) {
_this.balanceList = res.data.records
_this.list1 = res.data.records
} else {
_this.balanceList = _this.balanceList.concat(res.data.records)
_this.list1 = _this.list.concat(res.data.records)
}
_this.total1 = res.data.total
uni.hideLoading();
2023-12-05 17:18:27 +08:00
}
2023-12-06 09:41:19 +08:00
2023-12-05 17:18:27 +08:00
})
},
getTapIndex(index) {
2024-01-24 17:10:37 +08:00
this.orderList = []
this.list = []
this.total = 0
2023-11-27 09:24:16 +08:00
this.tapindex = index
2023-12-06 09:20:25 +08:00
if (this.tapindex == 0) {
2023-12-05 17:18:27 +08:00
this.map = {
2023-12-22 16:33:34 +08:00
page: 1,
pageSize: 10,
2023-12-06 09:20:25 +08:00
storeId: "",
orderStatus: "",
remark: "",
2024-01-19 13:44:13 +08:00
payType:uni.getStorageSync("appltType")
2023-12-05 17:18:27 +08:00
}
this.getMyOrder()
2023-12-26 18:44:50 +08:00
// this.map1 = {
// page: 1,
// pageSize: 10,
// status: "",
// }
// this.getBalanceOrder()
2023-12-06 09:20:25 +08:00
} else if (this.tapindex == 1) {
2023-12-05 17:18:27 +08:00
this.map = {
2023-12-06 09:20:25 +08:00
page: 1,
2023-12-22 16:33:34 +08:00
pageSize: 10,
2023-12-06 09:20:25 +08:00
storeId: "",
orderStatus: "unpaid",
remark: "",
2024-01-19 13:44:13 +08:00
payType:uni.getStorageSync("appltType")
2023-12-05 17:18:27 +08:00
}
this.getMyOrder()
2023-12-26 18:44:50 +08:00
// this.map1 = {
// page: 1,
// pageSize: 10,
// status: "unpaid",
// }
// this.getBalanceOrder()
2023-12-06 09:20:25 +08:00
} else if (this.tapindex == 2) {
2023-12-05 17:18:27 +08:00
this.map = {
2023-12-06 09:20:25 +08:00
page: 1,
2023-12-22 16:33:34 +08:00
pageSize: 10,
2023-12-06 09:20:25 +08:00
storeId: "",
orderStatus: "paid",
remark: "",
2024-01-19 13:44:13 +08:00
payType:uni.getStorageSync("appltType")
2023-12-05 17:18:27 +08:00
}
this.getMyOrder()
2023-12-26 18:44:50 +08:00
// this.map1 = {
// page: 1,
// pageSize: 10,
// status: "paid",
// }
// this.getBalanceOrder()
2023-12-06 09:20:25 +08:00
} else {
2023-12-05 17:18:27 +08:00
this.map = {
2023-12-06 09:20:25 +08:00
page: 1,
2023-12-22 16:33:34 +08:00
pageSize: 10,
2023-12-06 09:20:25 +08:00
storeId: "",
2023-12-06 10:28:49 +08:00
orderStatus: "paid",
2024-01-24 14:35:00 +08:00
remark: "1",
2024-01-19 13:44:13 +08:00
payType:uni.getStorageSync("appltType")
2023-12-05 17:18:27 +08:00
}
this.getMyOrder()
2023-12-26 18:44:50 +08:00
// this.map1 = {
// page: 1,
// pageSize: 10,
// status: "paid",
// }
// this.getBalanceOrder()
2023-12-05 17:18:27 +08:00
}
2023-12-22 16:33:34 +08:00
},
2024-01-22 18:05:19 +08:00
goPayment(orderNo){
uni.navigateTo({
url: '/pagesRefuel/orderDetail/index?orderNo=' + orderNo,
})
2023-11-27 09:24:16 +08:00
},
2024-02-06 18:10:15 +08:00
goOrderInfo(orderNo){
2024-01-23 18:14:56 +08:00
uni.navigateTo({
2024-02-06 18:10:15 +08:00
url: '/pagesMy/details/details?orderNo=' + orderNo,
2024-01-23 18:14:56 +08:00
})
},
2024-01-24 17:10:37 +08:00
goComment(orderId) {
2023-12-06 09:41:19 +08:00
uni.navigateTo({
2024-01-24 17:10:37 +08:00
url: "/pagesMy/comment/comment?orderId=" + orderId,
2023-12-06 09:41:19 +08:00
})
},
2023-12-05 17:18:27 +08:00
goBack() {
2023-11-27 09:24:16 +08:00
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
.top-box {
background-color: #ffffff;
padding: 10px;
width: 100%;
display: flex;
align-items: center;
.top-input {
width: 80%;
height: 35px;
background: #F3F3F3;
border-radius: 33px;
margin-right: 15px;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0px 15px;
}
}
.tap-box {
width: 100%;
display: flex;
align-items: center;
background: #ffffff;
}
.box-fv {
color: #666666;
width: 25%;
text-align: center;
}
.gang {
width: 30px;
height: 5px;
margin: 5px auto;
// background: #339DFF;
border-radius: 5px;
}
.actg {
background: #339DFF;
}
.actbox {
font-weight: bold !important;
color: #000 !important;
}
.box-order {
width: 95%;
border-radius: 8px;
background: #ffffff;
box-sizing: border-box;
padding: 10px;
margin: 10px auto;
}
.or-box-top {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 0px;
border-bottom: 1px solid #e5e5e5;
}
.chengg {
color: #1678ff;
}
.but-box {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.reds {
color: red;
}
.huis {
color: #666666;
}
.end-box {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
}
.anniu {
width: 70px;
height: 25px;
background-color: #1678ff;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
border-radius: 15px;
}
</style>