|
@@ -1,11 +1,98 @@
|
|
|
<template>
|
|
|
- <div>order-index</div>
|
|
|
+ <div>
|
|
|
+ <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#f7f8fa" @update:modelValue="getOrderPage">
|
|
|
+ <v-tab v-for="(val, i) in tabList" :key="i" :value="val.value">{{ val.title }}</v-tab>
|
|
|
+ </v-tabs>
|
|
|
+ <div v-if="orderList.length" class="mt-3">
|
|
|
+ <div v-for="val in orderList" :key="val.id" class="order-item mb-3">
|
|
|
+ <div class="order-item-header px-5">
|
|
|
+ <div style="width: 40%;">
|
|
|
+ <span>订单号:{{ val.no }}</span>
|
|
|
+ <span class="ml-5">{{ timesTampChange(val.createTime) }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="text-end color-warning" style="flex: 1">
|
|
|
+ 待发货
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-for="k in val.items" :key="k.id" class="order-item-goods px-3 pt-3">
|
|
|
+ <div class="d-flex">
|
|
|
+ <div style="width: 90px; height: 90px">
|
|
|
+ <v-img :src="k.picUrl"></v-img>
|
|
|
+ </div>
|
|
|
+ <div class="ml-5">
|
|
|
+ <p class="font-size-15">{{ k.spuName }}</p>
|
|
|
+ <p>
|
|
|
+ <span class="color-333">¥{{ fen2yuan(k.price) }}</span>
|
|
|
+ <span v-if="k.count" class="color-999 font-size-13 ml-1">x {{ k.count }}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <v-divider class="mt-3"></v-divider>
|
|
|
+ </div>
|
|
|
+ <div class="text-end pa-3 font-size-13 color-666">共{{ val.productCount }}件商品,合计:¥{{ fen2yuan(val.payPrice) }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Empty v-else :elevation="false" :message="tab === -1 ? '暂无订单' : '暂无' + tabList.find(e => e.value === tab).title + '订单'"></Empty>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
defineOptions({ name: 'mall-user-order-index'})
|
|
|
+import { ref } from 'vue'
|
|
|
+import { getMallOrderPage } from '@/api/mall/user'
|
|
|
+import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
+import { timesTampChange } from '@/utils/date'
|
|
|
+import { fen2yuan } from '@/hooks/web/useGoods'
|
|
|
+
|
|
|
+const tab = ref(-1)
|
|
|
+const tabList = [
|
|
|
+ { title: '全部', value: -1 },
|
|
|
+ { title: '待付款', value: 0 },
|
|
|
+ { title: '待发货', value: 10 },
|
|
|
+ { title: '待收货', value: 20 },
|
|
|
+ { title: '待评价', value: 30 }
|
|
|
+]
|
|
|
+const total = ref(0)
|
|
|
+const queryParams = ref({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10
|
|
|
+})
|
|
|
+
|
|
|
+// 获取订单列表
|
|
|
+const orderList = ref([])
|
|
|
+const getOrderPage = async () => {
|
|
|
+ queryParams.value.status = tab.value
|
|
|
+ if (tab.value === -1) delete queryParams.value.status
|
|
|
+ if (tab.value === 30) queryParams.value.commentStatus = false
|
|
|
+ const result = await getMallOrderPage(queryParams.value)
|
|
|
+ orderList.value = result.list
|
|
|
+ total.value = result.total
|
|
|
+}
|
|
|
+getOrderPage()
|
|
|
+
|
|
|
+const getDictData = async (dictType, value) => {
|
|
|
+ const { data } = await getDict(dictType)
|
|
|
+ console.log(data, 'dict-data')
|
|
|
+ const obj = data.find(e => e.value === value)
|
|
|
+ return obj.label
|
|
|
+}
|
|
|
+// console.log(getDictLabel('trade_order_status', 10), 'getDictLabel')
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-
|
|
|
+.order-item {
|
|
|
+ border: 1px solid #dbdbdb;
|
|
|
+ &-header {
|
|
|
+ display: flex;
|
|
|
+ background-color: #f2f4f7;
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ font-size: 13px;
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+ &-goods {
|
|
|
+ // border-bottom: 1px solid #dbdbdb;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|