diff --git a/src/common/http.api.js b/src/common/http.api.js
index 1ea818b..68d4423 100644
--- a/src/common/http.api.js
+++ b/src/common/http.api.js
@@ -29,6 +29,9 @@ const MY_ORDERS_REQ_UNIFIEDORDER = '/my/orders/req_unifiedorder'
// 查看支付状态
const MY_ORDERS_CHKORDER = '/my/orders/chkOrder'
+// 查询所有订单
+const MY_ORDERS_ALL = '/my/orders/all'
+
// 拿到token
const token = uni.getStorageSync('token') || ''
@@ -67,6 +70,9 @@ const install = (Vue, vm) => {
// 更新支付状态
checkOrder: (params = {}) => vm.$u.post(MY_ORDERS_CHKORDER, params,
{ Authorization: token}),
+ // 更新支付状态
+ getOrderList: (params = {}) => vm.$u.get(MY_ORDERS_ALL, params,
+ { Authorization: token}),
}
}
diff --git a/src/pages/order/order.vue b/src/pages/order/order.vue
index c6cc5c8..a80fa8c 100644
--- a/src/pages/order/order.vue
+++ b/src/pages/order/order.vue
@@ -1,7 +1,35 @@
-
-
+
+
+
+
+
+
+
+ 订单编号
+ {{ item.order_number }}
+
+
+ 订单金额
+ {{ item.order_price }}
+
+
+ 订单日期
+ {{item.update_time_format}}
+
+
+ 支付状态
+ {{ item.pay_status === "0" ? "未支付" : "已付款" }}
+
+
@@ -12,28 +40,55 @@ export default {
return{
tabs: [
{
- name: "全部",
+ name: "全部",type: 1
},
{
- name: "待支付",
+ name: "待支付",type: 2
},
{
- name: "待发货",
+ name: "待发货", type: 3
},
],
- tabsCurrent: 0
+ tabsCurrent: 0,
+ orders: [],
+ type: 1
}
},
methods: {
// 切换子页面
onTapsChange(index){
this.tabsCurrent = index
+ this.type = this.tabs[index].type
+ this.getOrderList()
+ },
+ // 获取支付信息
+ async getOrderList(){
+ const {message: { orders }} = await this.$u.api.getOrderList({ type: this.type })
+ this.orders = orders.map(item => ({...item, update_time_format: new Date(item.update_time * 1000).toLocaleString()}))
}
+ },
+
+ onLoad() {
+ this.getOrderList()
}
}
\ No newline at end of file