diff --git a/pages/index/index.vue b/pages/index/index.vue index ee17f3d..38fb314 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -22,22 +22,22 @@ - {{ state.statistic.todayPaymentAmount || 0 }} + {{ fen2yuan(state.statistic.todayPaymentAmount || 0) }} - 总销售额 {{ state.statistic.totalSalesAmount }} 元 | 成功退款 {{ state.statistic.refundCount }} 笔 | - 退款金额 {{ state.statistic.refundAmount }} 元 + 总销售额 {{ fen2yuan(state.statistic.totalSalesAmount) }} 元 | 成功退款 + {{ state.statistic.refundCount }} 笔 | 退款金额 {{ fen2yuan(state.statistic.refundAmount) }} 元 基础数据 - + {{ item.name }} - {{ item.value }} + {{ index !== 0 ? item.value : fen2yuan(item.value) }} 昨日 {{ item.last }} @@ -51,7 +51,9 @@ import { ref, computed } from 'vue' import { onLoad, onShow } from '@dcloudio/uni-app' import peach from '@/peach' import $store from '@/peach/store' +import { fen2yuan } from '@/peach/hooks/useGoods' import UserUtil from '@/peach/api/member/user' +import OrderUtil from '@/peach/api/trade/order' import bg from '@/static/bg-page.png' const bgStyle = { @@ -121,7 +123,37 @@ async function getStatistic() { * @param {Type} - * @returns {Type} */ -function checkVerifi() {} +function checkVerifi() { + // 扫描二维码 + uni.scanCode({ + success: (res) => { + uni.showModal({ + title: '提示', + content: '是否核销该订单', + success: function (sres) { + if (sres.confirm) { + OrderUtil.orderVerification({ + verifyCode: res.result, + }).then((res) => { + uni.showToast({ + title: '订单核销成功', + icon: 'success', + }) + setTimeout(() => { + peach.$router.go('/pages/order/detail', { + id: res.data, + }) + }, 500) + }) + } + }, + }) + }, + fail: (err) => { + console.log(err) + }, + }) +} onShow(() => { getStatistic() diff --git a/pages/index/order.vue b/pages/index/order.vue index 68cd59d..e715ac9 100644 --- a/pages/index/order.vue +++ b/pages/index/order.vue @@ -151,19 +151,33 @@ const tabMaps = [ name: '全部', }, { - name: '待付款', - value: 0, + name: '已付款', + value: '50,60', }, { - name: '待核销', - value: 50, + name: '已评价', + value: '30', }, { - name: '待配送', - value: 60, + name: '已退货', + value: '10,20', }, ] +function onDelivery(id) { + OrderApi.orderComplete({ orderId: id }).then(() => { + uni.showToast({ + title: '配送成功', + icon: 'success', + }) + setTimeout(() => { + peach.$router.go('/pages/order/detail', { + id: id, + }) + }, 500) + }) +} + // 单个订单总商品数 function totalNumsPerOrder(order) { if (order.items.length) { @@ -206,14 +220,14 @@ async function getOrderList() { let { data } = await OrderApi.getOrderPage({ pageNo: state.value.pagination.pageNo, pageSize: state.value.pagination.pageSize, - status: tabMaps[state.value.currentTab].value, + status: state.value.currentTab !== 3 ? tabMaps[state.value.currentTab].value : undefined, + refundStatus: state.value.currentTab === 3 ? tabMaps[state.value.currentTab].value : undefined, }) data.list.forEach((item) => { handleOrderButtons(item) }) state.value.pagination.list = _.concat(state.value.pagination.list, data.list) - console.log(state.value.pagination.list) state.value.pagination.total = data.total let currentPageTotal = state.value.pagination.length state.value.loadStatus = currentPageTotal < state.value.pagination.total ? 'more' : 'noMore' diff --git a/pages/order/detail.vue b/pages/order/detail.vue index f5f0e81..c324762 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -77,7 +77,7 @@ :price="item.price" :num="item.count" > -