| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- <template>
- <view class="content">
- <view class="tab-menu">
- <view :class="orderState==0?'tab-item active':'tab-item'" @click="orderStatus(0)">全部</view>
- <view :class="orderState==2?'tab-item active':'tab-item'" @click="orderStatus(2)">待使用</view>
- <view :class="orderState==3?'tab-item active':'tab-item'" @click="orderStatus(3)">已完成</view>
- <view :class="orderState==4?'tab-item active':'tab-item'" @click="orderStatus(4)">已退款</view>
- <view :class="orderState==8?'tab-item active':'tab-item'" @click="orderStatus(8)">履约中</view>
- </view>
- <scroll-view class="order-body" scroll-y scroll-with-animation @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower" upper-threshold="80">
- <view class="order-list" v-if="orderList.length == 0 && orderData.loading">
- <view class="order-item" v-for="(item,indx) in 3" :key="indx">
- <view class="item-header">
- <view class="item-store" style="flex: 1;"><view class="skeleton-line animate"></view></view>
- </view>
- <view class="item-goods">
- <view class="image">
- <view class="skeleton-line animate"></view>
- </view>
- <view class="info">
- <view class="title">
- <view class="skeleton-line animate"></view>
- </view>
- <view class="tags">
- <view class="skeleton-line animate"></view>
- </view>
- <view class="tags">
- <view class="skeleton-line animate"></view>
- </view>
- </view>
- </view>
- <view class="mt15">
- <view class="skeleton-line animate"></view>
- </view>
- <view class="item-footer mt15">
- <view class="footer-left" style="width: 30%;">
- <view class="skeleton-line animate"></view>
- </view>
- <view class="footer-group-btn" style="width: 30%;">
- <view class="skeleton-line animate"></view>
- </view>
- </view>
- </view>
- </view>
- <view class="order-list" v-else>
- <view class="empty-body" v-if="orderList.length == 0">
- <view class="imgs">
- <image src="/static/image/empty.png" mode="widthFix"></image>
- <view class="tip">没有更多数据啦~</view>
- <view class="re-btn" @click="toLogin" v-if="!isLogin">立即登录</view>
- </view>
- </view>
- <view class="order-item" v-for="(item,indx) in orderList" :key="item.id" v-else>
- <view class="item-header" @click="toDetail(item.out_order_no)">
- <view class="item-store">
- <image src="/static/image/store.svg"></image>
- <text>{{item.poi.poi_name}}</text>
- </view>
- <view class="item-status danger" v-if="item.status == 1">待使用</view>
- <view class="item-status success" v-if="item.status == 2">已完成</view>
- <view class="item-status fail" v-if="item.status == 3">已退款</view>
- <view class="item-status warn" v-if="item.status == 4">退款中</view>
- <view class="item-status fail" v-if="item.status == 5">已关闭</view>
- <view class="item-status warn" v-if="item.status == 6">部分退款</view>
- <view class="item-status success" v-if="item.status == 7">履约中</view>
- <view class="item-status warn" v-if="item.status == 8">退款审核中</view>
- <view class="item-status warn" v-if="item.status == 9">退款审核中</view>
- </view>
- <view class="item-goods" @click="toDetail(item.out_order_no)">
- <view class="image">
- <image :src="item.img"></image>
- </view>
- <view class="info">
- <view class="title">
- <view class="name" v-if="item.product.is_new == 1">{{item.product.price}}元代{{item.product.line_price}}元商场权益券{{ item.product.product_name }}</view>
- <view class="name" v-else>{{ item.product.product_name }}</view>
- <view class="num">x{{ item.number }}</view>
- </view>
- <view class="tags">
- {{item.sku_name?item.sku_name:'默认'}}
- <view class="price">{{ $dialog.formatMoney(item.price,true) }}</view>
- </view>
- </view>
- </view>
- <view class="item-time">
- <view class="time-list">订单编号:{{ item.order_sn }}</view>
- <view class="time-list">下单时间:{{item.create_at}}</view>
- </view>
- <view class="item-footer" @click="toDetail(item.out_order_no)">
- <view class="footer-left">实付 <text>{{ $dialog.formatMoney(item.pay_money,true) }}</text></view>
- <view class="footer-group-btn">
- <view v-if="item.status == 0" class="button warn">继续支付</view>
- <view v-if="item.status == 1" class="button success">立即预约</view>
- <view v-if="item.status == 1" class="button border">申请退款</view>
- <view v-if="item.status == 2" class="button warn">再来一单</view>
- <view v-if="item.status == 7" class="button warn">申请退款</view>
- <view v-if="item.status == 4||item.status == 3" class="button border">再次购买</view>
- <view v-if="item.status == 5||item.status == 6||item.status == 7||item.status == 8 ||item.status == 9" class="button fail">查看详情</view>
- </view>
- </view>
- </view>
- <uni-load-more status="loading" v-if="orderData.loading"></uni-load-more>
- <uni-load-more status="noMore" v-if="orderList.length > 0 && orderData.isDone"></uni-load-more>
- </view>
- <view class="line-height"></view>
- </scroll-view>
- <view class="float-kefu" @click="kfPop">
- <image src="/static/tabbar/kf.png"></image>
- </view>
- <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
- <kfService ref="kfService"></kfService>
- </view>
- </template>
- <script>
- var app;
- const pageSize = 10;
- export default {
- data() {
- return {
- orderState:0,
- orderData:{
- size:pageSize,
- page:1,
- loading:false,
- isDone:false
- },
- orderList:[],
- isLogin:true
- }
- },
- onLoad() {
- app = this;
- app.getOrder()
- },
- methods: {
- scrolltoupper(){},
- scrolltolower(e){
- if (app.orderData.isDone || app.orderList.length == 0) return ;
- app.getOrder()
- },
- toDetail(order){
- uni.navigateTo({
- url:"/pages/order/detail?order="+order
- })
- },
- loginSuccess(){
- app.getOrder()
- },
- toLogin(){
- app.$refs.loginCom.open();
- },
- async kfPop(){
- if (!app.isLogin) {
- app.$refs.loginCom.open();
- return ;
- }
- var resp = await app.$api.goods.check.get();
- if (resp.code == 0) {
- return app.$dialog.showSuccess(resp.msg);
- }
- if (resp.data.user == 0) {
- app.$refs.loginCom.open(2);
- return ;
- }
- const data = uni.getStorageSync("contact");
- app.$refs.kfService.open(data);
- },
- orderStatus(state) {
- app.orderState = state
- app.orderList = [];
- app.orderData = {
- size:pageSize,
- page:1,
- loading:false,
- isDone:false
- };
- app.getOrder()
- },
- async getOrder(){
- app.orderData.loading = true;
- var formData = {};
- const tokenPoi = uni.getStorageSync("contact");
- formData.poi = tokenPoi.poi_id;
- formData.page = app.orderData.page;
- formData.size = app.orderData.size;
- formData.status = app.orderState;
- var resp = await app.$api.order.list.get(formData)
- app.orderData.loading = false;
- if (resp.code == 401) {
- app.isLogin = false;
- return ;
- }
- if (resp.code == 0) {
- return app.$dialog.showSuccess(resp.msg)
- }
- app.isLogin = true;
- if (resp.data.rows.length > 0) {
- app.orderData.page ++;
- app.orderList = [...app.orderList,...resp.data.rows];
- } else {
- app.orderData.isDone = true;
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content{
- position: fixed;
- z-index: 1;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background-color: #ededed;
- display: flex;
- flex-direction: column;
- .line-height{
- height: 40rpx;
- width: 100%;
- }
- }
- .float-kefu{position: fixed;right: 20upx;bottom: 15%;width: 100upx;height: 100upx;background-color: #fff;border-radius: 100%;display: flex;align-items: center;justify-content: center;}
- .float-kefu image{width: 60upx;height: 60upx;}
- .empty-body{
- display: flex;align-items: center;justify-content: center;flex-direction: column;height: calc(100vh - 100upx);
- .imgs{
- text-align: center;font-size: 28upx;color: #666;
- image{height: 160upx;width: 160upx;}
- .tip{margin-top: 20upx;}
- }
- .re-btn{
- width: 180upx;
- height: 80upx;
- line-height: 80upx;
- text-align: center;
- font-size: 28upx;
- color: #fff;
- background-color: $main-color;
- border-radius: 10upx;
- margin-top: 60upx;
- }
- }
- .tab-menu{
- height: 80rpx;
- line-height: 80rpx;
- background-color: #fff;
- display: flex;
- align-items: center;
- font-size: 28rpx;
- color: #666;
- justify-content: space-around;
- .tab-item{
- position: relative;
- color: $main-text-color;
- &.active{
- color: $main-color;
- font-weight: 700;
- &::after{
- position: absolute;
- content: "";
- width: 30%;
- left: 35%;
- height: 4rpx;
- bottom: 0;
- background-color: $main-color;
- }
- }
- }
- }
- .order-body{
- height: 0;
- flex: 1;
- .order-list{
- .order-item{
- width: 95%;
- margin: 0 auto;
- background-color: #fff;
- padding: 20rpx;
- margin-top: 20rpx;
- border-radius: 10rpx;
- .item-footer{
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: $main-text-color;
- font-size: 28rpx;
- .footer-left{
- text {
- font-size: 30rpx;
- font-weight: bold;
- color: $main-color;
- }
- }
- .footer-group-btn{
- display: flex;
- align-items: center;
- gap: 20rpx;
- .button{
- font-size: 24rpx;
- padding: 10rpx 20rpx;
- border-radius: 40rpx;
- display: flex;
- align-items: center;
- &.border{
- background-color: #fff;
- border: 2rpx solid #fed7aa;
- color: #f26428;
- }
- &.success{
- background-color: #d1fae5;
- color: #059669;
- }
- &.fail{
- background-color: #f1f5f9;
- color: #64748b;
- }
- &.danger{
- background-color: #fef3c7;
- color: #b45309;
- }
- &.warn{
- background-color: #fef3c7;
- color: #b45309;
- }
- }
- }
- }
- .item-time{
- background-color: #fff8f1;
- border-radius: 10rpx;
- margin: 20rpx 0;
- padding: 20rpx;
- .time-list{
- line-height: 48rpx;
- font-size: 24rpx;
- color: #64748b;
- }
- }
- .item-goods{
- display: flex;
- align-items: center;
- gap: 20rpx;
- background-color: #fff;
- margin-top: 20rpx;
- border-radius: 20rpx;
- .stock{
- text-align: right;
- }
- .image {
- height: 180rpx;
- overflow: hidden;display: flex;align-items: center;min-width: 180rpx;
- position: relative;
- image {
- width: 180rpx;
- border-radius: 10upx;
- height: 100%;
- }
- }
- .info{
- flex: 1 1 0%;
- overflow: hidden;
- .title{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .name {
- overflow: hidden;
- text-overflow: ellipsis;
- font-size: 32rpx;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- color: #333;
- font-weight: 900;
- }
- }
- .tags {
- color: #94a3b8;
- font-size: 24rpx;
- margin: 10rpx 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .price {
- font-size: 28rpx;
- color: $main-text-color;
- font-weight: 600;
- }
- }
- }
- }
- .item-header{
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 2rpx solid #fff7ed;
- padding-bottom: 10rpx;
- .item-status{
- font-size: 24rpx;
- padding: 10rpx 20rpx;
- border-radius: 30rpx;
- &.success{
- background-color: #d1fae5;
- color: #059669;
- }
- &.fail{
- background-color: #f1f5f9;
- color: #64748b;
- }
- &.danger{
- background-color: #fef3c7;
- color: #b45309;
- }
- &.warn{
- background-color: #ffedd5;
- color: #e95b22;
- }
- }
- .item-store{
- display: flex;
- align-items: center;
- gap: 15rpx;
- image {
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- }
- }
- }
- </style>
|