feat: ai店铺订单按钮展示

This commit is contained in:
2026-06-08 10:29:25 +08:00
parent 2449d67e53
commit eba95941e2
6 changed files with 203 additions and 39 deletions
+27 -18
View File
@@ -5,8 +5,14 @@
}"> }">
<view class="more size24" v-if="props.type != 2"></view> <view class="more size24" v-if="props.type != 2"></view>
<view class="flex-center ju-flex-end"> <view class="flex-center ju-flex-end">
<view v-for="(item, index) in btns" :key="index"> <view v-for="(item, index) in btns" :key="index">
<view v-if="item.value.split(',').indexOf(String(props?.data?.status)) !== -1" class="btn size28 f500" <view
v-if="
item.value.split(',').indexOf(String(props?.data?.status)) !== -1 &&
!(item.id === 3 && Number(props?.data?.type) === 5)
"
class="btn size28 f500"
@click.stop="btnClick(item.id)" @click.stop="btnClick(item.id)"
:style="{ color: item.color, background: item.background, border: item.border }" :style="{ color: item.color, background: item.background, border: item.border }"
:class="{btn1: props.type == 2}"> :class="{btn1: props.type == 2}">
@@ -56,11 +62,11 @@
background: 'rgba(238,10,36,0.2)', background: 'rgba(238,10,36,0.2)',
border: 'none' border: 'none'
}, },
// { //在订单详情退货 { //在订单详情退货
// id: 3, id: 3,
// name: '申请售后', name: '申请售后',
// value: '10,20', value: '10,20',
// }, },
{ {
id: 4, id: 4,
name: '确认收货', name: '确认收货',
@@ -69,12 +75,12 @@
background: 'rgba(238,10,36,0.2)', background: 'rgba(238,10,36,0.2)',
border: 'none' border: 'none'
}, },
// { {
// id: 5, id: 5,
// name: '再次购买', name: '再次购买',
// value: '30,50,40', value: '30,50,40',
// color: '#FA9C31', color: '#FA9C31',
// }, },
{ {
id: 6, id: 6,
name: '取消售后', name: '取消售后',
@@ -91,6 +97,9 @@
}); });
return; return;
} }
if (index === 3 && Number(props?.data?.type) === 5) {
return;
}
let id = props.data?.id; let id = props.data?.id;
switch (index) { switch (index) {
case 1: case 1:
@@ -197,17 +206,17 @@
.more {} .more {}
.btn { .btn {
line-height: 54rpx; line-height: 24rpx;
padding: 0 24rpx; padding: 10rpx 24rpx;
box-sizing: border-box; box-sizing: border-box;
border: 2rpx solid #999999; border: 2rpx solid #999999;
border-radius: 94px 94px 94px 94px; border-radius: 10rpx;
margin-left: 12rpx; margin-left: 12rpx;
color: #999999; color: #999999;
} }
.btn1 { .btn1 {
line-height: 74rpx; // line-height: 74rpx;
padding: 0 30rpx; // padding: 0 30rpx;
} }
</style> </style>
+135 -1
View File
@@ -59,7 +59,38 @@
style="font-weight: 600;">{{ fen2yuan(props.data.payPrice) }}</span></view> style="font-weight: 600;">{{ fen2yuan(props.data.payPrice) }}</span></view>
</view> </view>
</view> </view>
<view class="" style="margin-top: 32rpx" v-if="props.index != 5"> <view class="flex-center ju-flex-end m-t-12" v-if="props.index != 5 && isAiActionOrder">
<view
class="ai-button3 w_144 m-r-10"
@tap.stop="delayShipment(props.data)"
v-if="Number(props.data.status) === 10"
>
延迟发货
</view>
<view
class="ai-button3 w_144 m-r-10"
@tap.stop="nowShipment(props.data)"
v-if="Number(props.data.status) === 50"
>
立即发货
</view>
<view class="ai-button3 w_144" @tap.stop="goAiOrderInfo">查看订单</view>
<view
class="ai-button1 w_144 m-l-16"
v-if="Number(props.data.status) === 20"
@tap.stop="confirmReceiveOrder"
>
确认收货
</view>
<view
class="ai-button1 w_144 m-l-16"
v-if="Number(props.data.status) === 0"
@tap.stop="goPay"
>
去支付
</view>
</view>
<view class="" style="margin-top: 32rpx" v-else-if="props.index != 5">
<card_orderBan :data="props.data" @downData="downData"></card_orderBan> <card_orderBan :data="props.data" @downData="downData"></card_orderBan>
</view> </view>
</view> </view>
@@ -79,6 +110,12 @@
import card_order from './card_order.vue'; import card_order from './card_order.vue';
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue'; import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
import AfterSaleApi from '@/sheep/api/trade/afterSale'; import AfterSaleApi from '@/sheep/api/trade/afterSale';
import {
aiDelayedShipment,
aiPendingShipment,
confirmReceive as aiConfirmReceive,
giftConfirmReceive,
} from '@/sheep/api/ai';
let emit = defineEmits(['downData']); let emit = defineEmits(['downData']);
let { proxy } = getCurrentInstance(); let { proxy } = getCurrentInstance();
let props = defineProps({ let props = defineProps({
@@ -119,6 +156,103 @@
const statusChange = (arr, status) => { const statusChange = (arr, status) => {
return arr.indexOf(status) != -1; return arr.indexOf(status) != -1;
}; };
const isAiActionOrder =
String(props.data?.__source) === 'aishop' || Number(props.data?.type) === 5;
const resolveAiOrderId = (data) => {
return data?.id || data?.orderId;
};
function delayShipment(data) {
const id = resolveAiOrderId(data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
uni.showModal({
title: '延迟发货',
content: '请您确认是否暂时不需要发货,确认后该产品将为您安排延迟发货',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) return;
const { code } = await aiDelayedShipment({
id,
status: 50,
});
if (code === 0) {
emit('downData');
}
},
});
}
function nowShipment(data) {
const id = resolveAiOrderId(data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
uni.showModal({
title: '立即发货',
content: '请您确认是否需要立即发货,确认后将尽快为您安排发货',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) return;
const { code } = await aiPendingShipment({
id,
status: 10,
});
if (code === 0) {
emit('downData');
}
},
});
}
const goAiOrderInfo = () => {
if (Number(props.data?.type) === 5) {
const id = props.data?.id;
if (!id) return;
proxy.utils.go('/pages/order/detail', { id, type: props.data?.type });
return;
}
const id = resolveAiOrderId(props.data);
if (!id) return;
proxy.utils.go('/pages/AI/orderInfo', { id });
};
const confirmReceiveOrder = async () => {
const id = resolveAiOrderId(props.data);
if (!id) return;
const req = Number(props.data?.type) === 5 ? giftConfirmReceive : aiConfirmReceive;
const { code } = await req({ id });
if (code === 0) {
emit('downData');
}
};
const goPay = () => {
const id = resolveAiOrderId(props.data);
const payOrderId = props.data?.payOrderId;
if (!id || !payOrderId) {
uni.showToast({
title: '支付信息异常',
icon: 'none',
});
return;
}
proxy.utils.go('/pages/AI/cashierDesk', {
id,
payOrderId,
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card_order { .card_order {
+13 -2
View File
@@ -22,7 +22,7 @@
<view class="search-wrap flex-center" v-if="index === 0"> <view class="search-wrap flex-center" v-if="index === 0">
<view class="search-input flex1 flex-center"> <view class="search-input flex1 flex-center">
<uni-icons class="m-r-16" type="search" color="#9AA7C7" size="18" /> <image class="search-icon-grey m-r-16" src="/static/icon/search.svg" mode="aspectFit" />
<uni-easyinput <uni-easyinput
class="flex1" class="flex1"
v-model="searchText" v-model="searchText"
@@ -36,7 +36,7 @@
/> />
</view> </view>
<view class="search-btn flex-center" @click="search"> <view class="search-btn flex-center" @click="search">
<uni-icons type="search" color="#FFFFFF" size="18" /> <image class="search-icon-white" src="/static/icon/search.svg" mode="aspectFit" />
</view> </view>
</view> </view>
<view class="notice-card" v-if="mesArr.length && index === 0"> <view class="notice-card" v-if="mesArr.length && index === 0">
@@ -444,6 +444,17 @@
background: linear-gradient(to bottom right, #2c8cfa 0%, #3d5efb 100%); background: linear-gradient(to bottom right, #2c8cfa 0%, #3d5efb 100%);
} }
.search-icon-grey {
width: 36rpx;
height: 36rpx;
}
.search-icon-white {
width: 36rpx;
height: 36rpx;
filter: brightness(0) invert(1);
}
.notice-card { .notice-card {
margin-top: 18rpx; margin-top: 18rpx;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
+22 -13
View File
@@ -13,16 +13,24 @@
<view class="floating-search-wrap"> <view class="floating-search-wrap">
<view class="floating-search" @click="goSearch"> <view class="floating-search" @click="goSearch">
<view class="floating-search-left"> <view class="floating-search-left">
<image class="floating-search-icon_333" src="/static/icon/search1.png" mode="scaleToFill" /> <image
class="floating-search-icon_333"
src="/static/icon/search1.png"
mode="scaleToFill"
/>
<view class="floating-search-placeholder">搜索想要的商品</view> <view class="floating-search-placeholder">搜索想要的商品</view>
</view> </view>
<view class="floating-search-btn"> <view class="floating-search-btn">
<image class="floating-search-icon_fff" src="/static/icon/search1.png" mode="scaleToFill" /> <image
class="floating-search-icon_fff"
src="/static/icon/search1.png"
mode="scaleToFill"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="pages"> <view class="pages">
<!-- <s-custom-navbarIndex /> --> <!-- <s-custom-navbarIndex /> -->
<s-banner <s-banner
v-if="template?.components[0]?.property.items?.length" v-if="template?.components[0]?.property.items?.length"
:data="template.components[0].property" :data="template.components[0].property"
@@ -41,6 +49,7 @@
<view class="size26 f500">{{ v.title }}</view> <view class="size26 f500">{{ v.title }}</view>
</view> </view>
</view> --> </view> -->
<!-- 暂时废弃 -->
<view class="activeList flex-row wrap ju-between" v-if="activeList?.length"> <view class="activeList flex-row wrap ju-between" v-if="activeList?.length">
<view <view
class="activeItem" class="activeItem"
@@ -349,18 +358,18 @@
} }
.pagesIndex { .pagesIndex {
position: relative; position: relative;
padding-top: 480rpx; padding-top: 480rpx;
// background: linear-gradient(135deg, #2c8cfa 0%, #3d5efb 100%); // background: linear-gradient(135deg, #2c8cfa 0%, #3d5efb 100%);
background-image: url("../../static/index/index_bg.jpeg"); background-image: url('../../static/index/index_bg.jpeg');
background-size: 100% auto; background-size: 100% auto;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center -20rpx; background-position: center -20rpx;
.pageContent{ .pageContent {
border-radius: 20rpx 20rpx 0 0; border-radius: 20rpx 20rpx 0 0;
position: relative; position: relative;
padding-top: 50rpx; padding-top: 50rpx;
background: #fff; background: #fff;
} }
} }
.index-header { .index-header {
@@ -451,7 +460,7 @@
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
border-radius: 64rpx; border-radius: 64rpx;
padding: 0 20rpx; padding: 0 20rpx;
background: linear-gradient(135deg, var(--primary-grad-start) 0%, var(--primary-grad-end) 100%); background: linear-gradient(135deg, var(--primary-grad-start) 0%, var(--primary-grad-end) 100%);
display: flex; display: flex;
align-items: center; align-items: center;
@@ -463,7 +472,7 @@
height: 42rpx; height: 42rpx;
filter: brightness(0) invert(1); filter: brightness(0) invert(1);
} }
.floating-search-icon_333 { .floating-search-icon_333 {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
} }
+2 -2
View File
@@ -211,11 +211,11 @@
onLoad(async (options) => { onLoad(async (options) => {
// 解析参数 // 解析参数
if (!options.orderId || !options.itemId) { if (!options.id || !options.id) {
sheep.$helper.toast(`缺少订单信息,请检查`); sheep.$helper.toast(`缺少订单信息,请检查`);
return; return;
} }
state.orderId = options.orderId; state.orderId = options.id;
state.itemId = parseInt(options.itemId); state.itemId = parseInt(options.itemId);
// 读取订单信息 // 读取订单信息
+4 -3
View File
@@ -83,7 +83,7 @@
</view> </view>
</view> </view>
</view> </view>
<su-fixed bottom placeholder bg="bg24" v-if="state.orderInfo.status != 30"> <su-fixed bottom placeholder bg="bg24">
<view class="orderBan flex-column ju-center"> <view class="orderBan flex-column ju-center">
<card_orderBan :data="state.orderInfo" @downData="getOrderDetail" type="2"></card_orderBan> <card_orderBan :data="state.orderInfo" @downData="getOrderDetail" type="2"></card_orderBan>
</view> </view>
@@ -94,7 +94,7 @@
<script setup> <script setup>
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 { computed, reactive, ref } from 'vue';
import { import {
fen2yuan, fen2yuan,
handleOrderButtons, handleOrderButtons,
@@ -115,6 +115,7 @@
source: '', source: '',
}); });
// ========== 门店自提(核销) ========== // ========== 门店自提(核销) ==========
const systemStore = ref({}); // 门店信息 const systemStore = ref({}); // 门店信息
@@ -465,7 +466,7 @@
} }
.orderBan { .orderBan {
height: 140rpx; height: 100rpx;
width: 100%; width: 100%;
padding: 0 24rpx; padding: 0 24rpx;
box-sizing: border-box; box-sizing: border-box;