Commit 320b56c1 authored by Facius's avatar Facius

feat: 我的订单

parent d7d46b3a
Pipeline #7079 canceled with stages
import request from "@/utils/request.js"
export async function getList(data) {
return request({
url: `/rest/order/list`,
method: 'GET',
data
})
}
export async function getDetail(data) {
return request({
url: `/rest/order/detail`,
method: 'GET',
data
})
}
export async function cancelOrder(data) {
return request({
url: `/rest/order/cancel`,
method: 'POST',
data
})
}
export async function applyRefund(data) {
return request({
url: `/rest/order/refund/apply`,
method: 'POST',
data
})
}
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
"prompt" : "为获取当地天气信息,需要获取 位置信息 使用权限,请允许。" "prompt" : "为获取当地天气信息,需要获取 位置信息 使用权限,请允许。"
}, },
"schemes" : "com.shenjiying.jizhang", "schemes" : "com.shenjiying.jizhang",
"minSdkVersion" : 30, "minSdkVersion" : "",
"targetSdkVersion" : 30 "targetSdkVersion" : 30
}, },
/* ios打包配置 */ /* ios打包配置 */
......
...@@ -418,7 +418,15 @@ ...@@ -418,7 +418,15 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
} } ,{
"path" : "order/order",
"style" :
{
"navigationBarTitleText": "我的订单",
"enablePullDownRefresh": false,
"disableScroll": true
}
}
] ]
}, },
{ {
......
<template>
<view class="update-log-item">
<view class="head">
<view class="head-title">
<text>订单编号</text>
<text class="order-number">{{detail.orderNumber}}</text>
</view>
<view class="head-time" :style="{color:detail.orderStatus&&statusColor[detail.orderStatus.code]}">
{{detail.orderStatus&&detail.orderStatus.desc}}
</view>
</view>
<view class="content">
<view class="order-info">
<text class="order-name">
{{detail.businessName}}
</text>
<text class="order-price">
{{detail.amount}}
</text>
</view>
<view class="order-date">
{{detail.createTime}}
</view>
</view>
</view>
</template>
<script>
export default {
props: {
detail: {
type: Object,
default: () => {}
},
},
data() {
return {
parseTime,
statusColor: {
WAIT: '#fc524d',
FINISH: '#333333',
CANCEL: '#8d8d8d',
CLOSE: '#8d8d8d',
REFUNDING: '#df7922',
REFUND: '#8d8d8d',
},
};
},
methods: {
checkStatus(status) {
return this.detail.status && status.indexOf(this.detail.status.code) !== -1
},
}
};
</script>
<style lang="scss" scoped>
.update-log-item {
padding: 24rpx;
background-color: #ffffff;
margin-bottom: 24rpx;
border-radius: 16rpx;
.head {
padding: 16rpx 0 32rpx 0;
border-bottom: 2px solid #f6f7fa;
display: flex;
align-items: center;
justify-content: space-between;
.head-title {
line-height: 32rpx;
font-size: 32rpx;
font-weight: bold;
.order-number {
margin-left: 12rpx;
color: #8d8d8d;
line-height: 28rpx;
font-size: 24rpx;
}
}
.head-time {
color: #8d8d8d;
line-height: 28rpx;
font-size: 28rpx;
}
}
.content {
padding: 32rpx 0;
line-height: 40rpx;
font-size: 28rpx;
.order-info {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: bold;
font-size: 28rpx;
.order-name {}
.order-price {}
}
.order-date {
margin-top: 12rpx;
font-size: 24rpx;
color: #8d8d8d;
text-align: right;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="update-log">
<view class="content-view">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
refresher-background="#F6F7FA" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
enable-back-to-top>
<view class="scroll-view">
<NoData v-if="noData" :text="noDataText" customStyle="margin-top: 0rpx;" />
<view v-else>
<view class="bill-list"><order-item v-for="(item, index) in list" :key="index" :detail="item"></order-item></view>
<view class="load-more-view" v-show="(current == 1 && loaded) || current > 1"><u-loadmore
:status="loadStatus" bgColor="#F6F7FA"></u-loadmore></view>
</view>
<view class="loading-view" v-if="!loaded && !freshing"><u-loading mode="flower"></u-loading></view>
</view>
</scroll-view>
</view>
<PopInput title="提醒" type="text" sureText="确定" :content="popContent" :visible.sync="showPopup" @click="handleConfirm" />
</view>
</template>
<script>
import NoData from '@/components/no-data';
import PopInput from '@/components/pop-input-view';
import OrderItem from './components/order-item.vue';
import {getList,cancelOrder} from "@/api/mine/order.js"
export default {
components: {
NoData,
PopInput,
OrderItem
},
data() {
return {
list: [],
loaded: false,
current: 1,
size: 10,
loadStatus: 'loading',
triggered: true,
freshing: false,
noDataText: '当前暂无内容',
showPopup:false,
popContent:"确定取消订单",
detail:null,
notification: 'order-list'
};
},
computed: {
noData() {
return (this.list || []).length == 0 && this.loaded;
}
},
onLoad() {
this.reloadList();
this.freshing = false;
uni.$on(this.notification,()=>{
this.reloadList();
})
},
onUnload() {
uni.$off(this.notification);
},
methods: {
reloadList() {
this.current = 1;
this.loadStatus = 'loading';
this.getList();
},
async getList() {
if (this.current == 1) {
this.list = [];
this.loaded = false;
}
try {
let params = {
current: this.current,
size: this.size,
};
let res = await getList(params);
let {
records,
total
} = res.data;
if (records) {
this.list.push(...records);
// 更新底部加载状态
this.loadStatus = total > this.list.length ? 'loadmore' : 'nomore';
}
setTimeout(() => {
this.$nextTick(() => {
if (this.freshing) {
this.triggered = false;
this.freshing = false;
}
});
}, 500)
} catch (e) {
//TODO handle the exception
this.loadStatus = 'loadmore'
console.log('error', e);
this.$nextTick(() => {
if (this.freshing) {
this.triggered = false;
this.freshing = false;
}
});
}
this.loaded = true;
},
onRefresh() {
if (this.freshing) return;
this.freshing = true;
this.reloadList();
},
onRestore() {
this.triggered = 'restore'; // 需要重置
},
// 滚动底部
reachBottom(e) {
if (this.loadStatus != 'loadmore') return;
this.current += 1;
this.loadStatus == 'loading';
this.getList();
},
}
};
</script>
<style lang="scss" scoped>
.update-log {
padding: 32rpx 24rpx;
background-color: #F6F7FA;
width: 100%;
height: 100vh;
.content-view {
width: 100%;
height: 100%;
overflow: auto;
.scroll-view {
width: 100%;
height: 100%;
}
.load-more-view {
margin-top: 24rpx;
padding-bottom: 44rpx;
}
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
}
}
</style>
\ No newline at end of file
...@@ -43,11 +43,17 @@ export const packageOptions = [ ...@@ -43,11 +43,17 @@ export const packageOptions = [
title: '我的奖金', title: '我的奖金',
path: "/pages/bonus/index" path: "/pages/bonus/index"
}, },
{
id: 7,
title: '我的订单',
path: "/pages/mine/order/order"
},
{ {
id: 6, id: 6,
title: '使用帮助', title: '使用帮助',
path: "/pages/mine/help/index" path: "/pages/mine/help/index"
}, },
{ {
id: 0, id: 0,
title: '数据导出/导入', title: '数据导出/导入',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment