feat:添加开通ai店铺订单接口、添加分类(店铺订单)

This commit is contained in:
2026-06-05 12:32:40 +08:00
parent e8f59cc6c5
commit 620712828e
5 changed files with 123 additions and 68 deletions
+102 -57
View File
@@ -12,6 +12,23 @@
>
<template #nav>
<view class="nav">
<view class="order-list-nav-top">
<view class="type-tabs p-x-32">
<view
class="type-tab-item center"
v-for="(v, i) in typeArr"
:key="i"
@click="navChangeType(i)"
>
<view
class="type-tab-text size32"
:class="{ activeTypeItem: state.currentType === i, activeTypeUnderline: state.currentType === i }"
>
{{ v.name }}
</view>
</view>
</view>
</view>
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper w100 nowrap p-x-32">
<view class="flex-center ju-flex-start nowrap" style="width: auto">
<view
@@ -57,28 +74,20 @@
</template>
<script setup>
import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { ref, reactive } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import orderItem from '@/components/orderItem/orderItem.vue';
import {
fen2yuan,
formatOrderColor,
formatOrderStatus,
handleOrderButtons,
} from '@/sheep/hooks/useGoods';
import sheep from '@/sheep';
import _ from 'lodash-es';
import { isEmpty } from 'lodash-es';
import { handleOrderButtons } from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import { resetPagination } from '@/sheep/helper/utils';
const instance = getCurrentInstance();
import { getOrderPage as getAiOrderPage } from '@/sheep/api/ai';
let cardPages = ref(null);
// 数据
const state = reactive({
currentTab: 0, // 选中的 tabMaps 下标
currentType: 0, // 选中的 typeArr 下标
list: {},
pageSize: 10,
loadStatus: '',
@@ -87,6 +96,11 @@
},
});
const typeArr = [
{ id: 0, name: '商城订单' },
{ id: 1, name: '店铺订单' },
];
const tabMaps = [
{
id: 0,
@@ -121,22 +135,28 @@
let dataList = ref([]);
async function getData(mescroll) {
let code = null;
let data = null;
dataList.value = [];
if (mescroll.dataObj.status != '50,60') {
let res = await OrderApi.getOrderPage({
pageNo: mescroll.num,
pageSize: mescroll.size,
status: mescroll.dataObj.status,
...state.obj,
});
const status = tabMaps?.[mescroll?.dataObj?.i]?.value;
const obj = {
pageNo: mescroll.num,
pageSize: mescroll.size,
status,
...state.obj,
};
if (!obj.status && obj.status !== 0) delete obj.status;
if (!obj.keyWord) delete obj.keyWord;
const isAfterSaleTab = String(mescroll?.dataObj?.status) === '50,60';
if (state.currentType === 0 && isAfterSaleTab) {
const res = await AfterSaleApi.getAfterSalePage(obj);
code = res.code;
dataList.value[mescroll.dataObj.i] = res.data;
} else if (state.currentType === 1) {
const res = await getAiOrderPage(obj);
code = res.code;
dataList.value[mescroll.dataObj.i] = res.data;
} else {
let res = await AfterSaleApi.getAfterSalePage({
pageNo: mescroll.num,
pageSize: mescroll.size,
});
const res = await OrderApi.getOrderPage(obj);
code = res.code;
dataList.value[mescroll.dataObj.i] = res.data;
}
@@ -147,13 +167,13 @@
return;
}
dataList.value[mescroll.dataObj.i].list.forEach((order) => handleOrderButtons(order));
const pageData = dataList.value?.[mescroll.dataObj.i] || {};
const list = Array.isArray(pageData?.list) ? pageData.list : Array.isArray(pageData) ? pageData : [];
list.forEach((order) => handleOrderButtons(order));
if (mescroll.num == 1) state.list[mescroll.dataObj.i] = [];
state.list[mescroll.dataObj.i] = state.list[mescroll.dataObj.i].concat(
dataList.value[mescroll.dataObj.i].list,
);
state.list[mescroll.dataObj.i] = state.list[mescroll.dataObj.i].concat(list);
if (cardPages.value) {
cardPages.value.getState(true, dataList.value[mescroll.dataObj.i].list.length);
cardPages.value.getState(true, list.length);
}
}
@@ -161,39 +181,26 @@
if (options.type) {
state.currentTab = Number(options.type);
}
// await getOrderList();
if (options.currentType !== undefined) {
state.currentType = Number(options.currentType);
}
});
let sysInfo = uni.getSystemInfoSync();
let height =
sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(100) - uni.upx2px(200) + 'px';
onMounted(() => {});
// 加载更多
function loadMore() {
if (state.loadStatus === 'noMore') {
return;
}
state.pagination.pageNo++;
getOrderList();
}
// 上拉加载更多
// onReachBottom(() => {
// loadMore();
// });
sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(100) - uni.upx2px(320) + 'px';
const navChange = (i) => {
state.currentTab = i;
console.log(state);
// if(cardPages.value){
// cardPages.value.downCallback()
// }
};
const downCallback = (i) => {
if (i && i === 0) {
navChange(i);
if (cardPages.value) {
cardPages.value.downCallback();
}
};
const navChangeType = (i) => {
state.currentType = i;
state.currentTab = 0;
downCallback(state.currentTab);
};
const downCallback = () => {
if (cardPages.value) {
cardPages.value.downCallback();
}
@@ -227,10 +234,48 @@
}
.nav {
height: 200rpx;
height: 320rpx;
background-color: #fff;
}
.order-list-nav-top {
height: 100rpx;
display: flex;
align-items: center;
border-bottom: 1rpx solid #ffe1d9;
background-color: #fff5f2;
}
.type-tabs {
width: 100%;
display: flex;
align-items: center;
box-sizing: border-box;
}
.type-tab-item {
flex: 1;
height: 120rpx;
display: flex;
align-items: center;
justify-content: center;
}
.type-tab-text {
position: relative;
padding: 18rpx 0;
font-weight: 500;
color: #333;
}
.activeTypeItem {
color: #ff3c48;
}
.activeTypeUnderline {
border-bottom: 6rpx solid #ff3c48;
}
.search {
padding: 0 32rpx;
box-sizing: border-box;