From ea64e9bf449efa309eae0bdf95e7dbdbc6aeaee0 Mon Sep 17 00:00:00 2001 From: "jqtmviyu@gmail.com" Date: Sun, 7 Mar 2021 05:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=A1=B5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/http.api.js | 6 ++++ src/pages/order/order.vue | 69 +++++++++++++++++++++++++++++++++++---- 2 files changed, 68 insertions(+), 7 deletions(-) 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 @@ @@ -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