Files
kangyuan-mobile/components/orderItem/AiOrderActionBar.vue
T

125 lines
3.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="flex-center ju-flex-end w100">
<view
class="ai-button3 w_144 m-r-10"
v-if="showDelay && !props.disableDelayShipment"
@tap.stop="emit('delay')"
>
延迟发货
</view>
<view
class="ai-button3 w_144 m-r-10"
v-if="showNow && !props.disableDelayShipment"
@tap.stop="emit('now')"
>
立即发货
</view>
<view
class="ai-button3 w_144 m-r-10"
v-if="hasExpress"
@tap.stop="emit('express')"
>
查看物流
</view>
<view
class="ai-button3 w_144"
v-if="props.showView && props.status !== 70"
@tap.stop="emit('view')"
>
{{ props.viewText }}
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 20 || props.status === 15" @tap.stop="emit('confirm')">
确认收货
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 0" @tap.stop="emit('pay')">
去支付
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 70" @tap.stop="emit('cancel')">
取消订单
</view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 70" @tap.stop="emit('pay')">
切换支付
</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({
status: {
type: Number,
default: -1,
},
disableDelayShipment: {
type: Boolean,
default: false,
},
showView: {
type: Boolean,
default: false,
},
viewText: {
type: String,
default: '查看订单',
},
hasDelayedItems: {
type: Boolean,
default: false,
},
canDelayItems: {
type: Boolean,
default: false,
},
canShipItems: {
type: Boolean,
default: false,
},
logisticsId: {
type: [Number, String],
default: 0,
},
logisticsNo: {
type: String,
default: '',
},
deliveryTime: {
type: [Number, String],
default: '',
},
hasLogistics: {
type: Boolean,
default: false,
},
});
// 延迟发货按钮:仅允许【待发货(10/伪50)、部分发货(15)】状态展示
// 伪状态 50 = 原生 status=10 + 有 status===1(延迟中)的商品,属于待发货分支
const showDelay = computed(() => {
const s = Number(props.status);
if (s === 20) return false; // 待收货:不展示
if (![10, 15, 50].includes(s)) return false;
return Boolean(props.canDelayItems);
});
// 立即发货按钮:仅允许【待发货(10/伪50)、部分发货(15)】状态,
// 且必须 delayRecords 里存在 status===1(延迟中)的商品(hasDelayedItems===true)
const showNow = computed(() => {
const s = Number(props.status);
if (s === 20) return false; // 待收货:不展示
if (![10, 15, 50].includes(s)) return false;
if (!Boolean(props.hasDelayedItems)) return false;
return Boolean(props.canShipItems);
});
const hasExpress = computed(() => {
if ([15, 20, 30].includes(props.status)) return true;
if (props.hasLogistics) return true;
if (Number(props.logisticsId) > 0) return true;
if (props.logisticsNo && String(props.logisticsNo).trim()) return true;
if (props.deliveryTime) return true;
return false;
});
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel', 'express']);
</script>