feat:添加开通ai店铺订单接口、添加分类(店铺订单)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="card_order bg24 size34" @click="
|
<view class="card_order bg24 size34" @click="
|
||||||
utils.go('/pages/order/detail', { id: props.index != 5 ? props.data.id : props.data.orderId })
|
utils.go('/pages/order/detail', { id: props.index != 5 ? props.data.id : props.data.orderId, type: props.data.type })
|
||||||
">
|
">
|
||||||
<view class="flex-center ju-between createTime">
|
<view class="flex-center ju-between createTime">
|
||||||
<view class="flex-center shrink">
|
<view class="flex-center shrink">
|
||||||
|
|||||||
@@ -89,6 +89,12 @@
|
|||||||
const titleText = firstItem?.spuName || order?.no || '-';
|
const titleText = firstItem?.spuName || order?.no || '-';
|
||||||
const qty = Number(order?.productCount ?? 0) || 0;
|
const qty = Number(order?.productCount ?? 0) || 0;
|
||||||
const statusText = formatOrderStatus(order || {});
|
const statusText = formatOrderStatus(order || {});
|
||||||
|
const totalPrice = Number(order?.totalPrice ?? 0) || 0;
|
||||||
|
const totalRevenue = Number(order?.totalRevenue ?? 0) || 0;
|
||||||
|
const progress =
|
||||||
|
totalPrice > 0
|
||||||
|
? Math.max(0, Math.min(100, (totalRevenue / totalPrice) * 100))
|
||||||
|
: 0;
|
||||||
const timeText = sheep.$helper?.timeFormat
|
const timeText = sheep.$helper?.timeFormat
|
||||||
? sheep.$helper.timeFormat(order?.createTime, 'yy-mm-dd hh:MM:ss')
|
? sheep.$helper.timeFormat(order?.createTime, 'yy-mm-dd hh:MM:ss')
|
||||||
: String(order?.createTime || '');
|
: String(order?.createTime || '');
|
||||||
@@ -98,7 +104,7 @@
|
|||||||
id: order?.id,
|
id: order?.id,
|
||||||
title: titleText,
|
title: titleText,
|
||||||
statusText,
|
statusText,
|
||||||
progress: 80,
|
progress,
|
||||||
qty,
|
qty,
|
||||||
time: timeText,
|
time: timeText,
|
||||||
total: totalYuan,
|
total: totalYuan,
|
||||||
|
|||||||
+10
-6
@@ -95,26 +95,23 @@
|
|||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { isEmpty } from 'lodash-es';
|
|
||||||
import {
|
import {
|
||||||
fen2yuan,
|
fen2yuan,
|
||||||
formatOrderStatus,
|
|
||||||
formatOrderStatusDescription,
|
|
||||||
handleOrderButtons,
|
handleOrderButtons,
|
||||||
} from '@/sheep/hooks/useGoods';
|
} from '@/sheep/hooks/useGoods';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
|
import { getOpenOrderDetail } from '@/sheep/api/ai';
|
||||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
|
||||||
import card_order from '@/components/orderItem/card_order.vue';
|
import card_order from '@/components/orderItem/card_order.vue';
|
||||||
import truckLine from '@/components/truckLine/truckLine.vue'
|
import truckLine from '@/components/truckLine/truckLine.vue'
|
||||||
|
|
||||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
|
||||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
merchantTradeNo: '', // 商户订单号
|
merchantTradeNo: '', // 商户订单号
|
||||||
comeinType: '', // 进入订单详情的来源类型
|
comeinType: '', // 进入订单详情的来源类型
|
||||||
|
orderType: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========== 门店自提(核销) ==========
|
// ========== 门店自提(核销) ==========
|
||||||
@@ -137,7 +134,11 @@
|
|||||||
merchant_trade_no: state.merchantTradeNo,
|
merchant_trade_no: state.merchantTradeNo,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res = await OrderApi.getOrderDetail(id);
|
if (String(state.orderType) === '5') {
|
||||||
|
res = await getOpenOrderDetail({ id });
|
||||||
|
} else {
|
||||||
|
res = await OrderApi.getOrderDetail(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
state.orderInfo = res.data;
|
state.orderInfo = res.data;
|
||||||
@@ -170,6 +171,9 @@
|
|||||||
if (state.comeinType === 'wechat') {
|
if (state.comeinType === 'wechat') {
|
||||||
state.merchantTradeNo = options.merchant_trade_no;
|
state.merchantTradeNo = options.merchant_trade_no;
|
||||||
}
|
}
|
||||||
|
if (options.type !== undefined) {
|
||||||
|
state.orderType = options.type;
|
||||||
|
}
|
||||||
state.orderInfo.id = id;
|
state.orderInfo.id = id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+102
-57
@@ -12,6 +12,23 @@
|
|||||||
>
|
>
|
||||||
<template #nav>
|
<template #nav>
|
||||||
<view class="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">
|
<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 class="flex-center ju-flex-start nowrap" style="width: auto">
|
||||||
<view
|
<view
|
||||||
@@ -57,28 +74,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { onLoad, onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||||
import orderItem from '@/components/orderItem/orderItem.vue';
|
import orderItem from '@/components/orderItem/orderItem.vue';
|
||||||
import {
|
import { handleOrderButtons } from '@/sheep/hooks/useGoods';
|
||||||
fen2yuan,
|
|
||||||
formatOrderColor,
|
|
||||||
formatOrderStatus,
|
|
||||||
handleOrderButtons,
|
|
||||||
} from '@/sheep/hooks/useGoods';
|
|
||||||
import sheep from '@/sheep';
|
|
||||||
import _ from 'lodash-es';
|
|
||||||
import { isEmpty } from 'lodash-es';
|
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||||
import { resetPagination } from '@/sheep/helper/utils';
|
import { getOrderPage as getAiOrderPage } from '@/sheep/api/ai';
|
||||||
const instance = getCurrentInstance();
|
|
||||||
|
|
||||||
let cardPages = ref(null);
|
let cardPages = ref(null);
|
||||||
|
|
||||||
// 数据
|
// 数据
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
currentTab: 0, // 选中的 tabMaps 下标
|
currentTab: 0, // 选中的 tabMaps 下标
|
||||||
|
currentType: 0, // 选中的 typeArr 下标
|
||||||
list: {},
|
list: {},
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
loadStatus: '',
|
loadStatus: '',
|
||||||
@@ -87,6 +96,11 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const typeArr = [
|
||||||
|
{ id: 0, name: '商城订单' },
|
||||||
|
{ id: 1, name: '店铺订单' },
|
||||||
|
];
|
||||||
|
|
||||||
const tabMaps = [
|
const tabMaps = [
|
||||||
{
|
{
|
||||||
id: 0,
|
id: 0,
|
||||||
@@ -121,22 +135,28 @@
|
|||||||
let dataList = ref([]);
|
let dataList = ref([]);
|
||||||
async function getData(mescroll) {
|
async function getData(mescroll) {
|
||||||
let code = null;
|
let code = null;
|
||||||
let data = null;
|
|
||||||
dataList.value = [];
|
dataList.value = [];
|
||||||
if (mescroll.dataObj.status != '50,60') {
|
const status = tabMaps?.[mescroll?.dataObj?.i]?.value;
|
||||||
let res = await OrderApi.getOrderPage({
|
const obj = {
|
||||||
pageNo: mescroll.num,
|
pageNo: mescroll.num,
|
||||||
pageSize: mescroll.size,
|
pageSize: mescroll.size,
|
||||||
status: mescroll.dataObj.status,
|
status,
|
||||||
...state.obj,
|
...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;
|
code = res.code;
|
||||||
dataList.value[mescroll.dataObj.i] = res.data;
|
dataList.value[mescroll.dataObj.i] = res.data;
|
||||||
} else {
|
} else {
|
||||||
let res = await AfterSaleApi.getAfterSalePage({
|
const res = await OrderApi.getOrderPage(obj);
|
||||||
pageNo: mescroll.num,
|
|
||||||
pageSize: mescroll.size,
|
|
||||||
});
|
|
||||||
code = res.code;
|
code = res.code;
|
||||||
dataList.value[mescroll.dataObj.i] = res.data;
|
dataList.value[mescroll.dataObj.i] = res.data;
|
||||||
}
|
}
|
||||||
@@ -147,13 +167,13 @@
|
|||||||
|
|
||||||
return;
|
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] = [];
|
if (mescroll.num == 1) state.list[mescroll.dataObj.i] = [];
|
||||||
state.list[mescroll.dataObj.i] = state.list[mescroll.dataObj.i].concat(
|
state.list[mescroll.dataObj.i] = state.list[mescroll.dataObj.i].concat(list);
|
||||||
dataList.value[mescroll.dataObj.i].list,
|
|
||||||
);
|
|
||||||
if (cardPages.value) {
|
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) {
|
if (options.type) {
|
||||||
state.currentTab = Number(options.type);
|
state.currentTab = Number(options.type);
|
||||||
}
|
}
|
||||||
// await getOrderList();
|
if (options.currentType !== undefined) {
|
||||||
|
state.currentType = Number(options.currentType);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let sysInfo = uni.getSystemInfoSync();
|
let sysInfo = uni.getSystemInfoSync();
|
||||||
let height =
|
let height =
|
||||||
sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(100) - uni.upx2px(200) + 'px';
|
sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(100) - uni.upx2px(320) + 'px';
|
||||||
onMounted(() => {});
|
|
||||||
|
|
||||||
// 加载更多
|
|
||||||
function loadMore() {
|
|
||||||
if (state.loadStatus === 'noMore') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
state.pagination.pageNo++;
|
|
||||||
getOrderList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上拉加载更多
|
|
||||||
// onReachBottom(() => {
|
|
||||||
// loadMore();
|
|
||||||
// });
|
|
||||||
|
|
||||||
const navChange = (i) => {
|
const navChange = (i) => {
|
||||||
state.currentTab = i;
|
state.currentTab = i;
|
||||||
console.log(state);
|
if (cardPages.value) {
|
||||||
// if(cardPages.value){
|
cardPages.value.downCallback();
|
||||||
// cardPages.value.downCallback()
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
const downCallback = (i) => {
|
|
||||||
if (i && i === 0) {
|
|
||||||
navChange(i);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
const navChangeType = (i) => {
|
||||||
|
state.currentType = i;
|
||||||
|
state.currentTab = 0;
|
||||||
|
downCallback(state.currentTab);
|
||||||
|
};
|
||||||
|
const downCallback = () => {
|
||||||
if (cardPages.value) {
|
if (cardPages.value) {
|
||||||
cardPages.value.downCallback();
|
cardPages.value.downCallback();
|
||||||
}
|
}
|
||||||
@@ -227,10 +234,48 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
height: 200rpx;
|
height: 320rpx;
|
||||||
background-color: #fff;
|
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 {
|
.search {
|
||||||
padding: 0 32rpx;
|
padding: 0 32rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ export function getAiShopPage(params: any) {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消订单 aishop/order/cancel
|
// 取消订单 aishop/order/cancel
|
||||||
export function cancelOrder(params: any) {
|
export function cancelOrder(params: any) {
|
||||||
return request({
|
return request({
|
||||||
@@ -213,6 +214,8 @@ export function getGiftOrderDetail(params : any) {
|
|||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getOpenOrderDetail = getGiftOrderDetail;
|
||||||
// 获取开通ai店铺商品订单结算信息
|
// 获取开通ai店铺商品订单结算信息
|
||||||
export function getGiftSettlementInfo(params : any) {
|
export function getGiftSettlementInfo(params : any) {
|
||||||
return request({
|
return request({
|
||||||
@@ -286,6 +289,3 @@ export function aiPendingShipment(params : any) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user