Files
kangyuan-mobile/components/orderItem/card_order.vue
T
2026-08-05 10:51:29 +08:00

197 lines
5.5 KiB
Vue

<template>
<view class="order_con" :class="{ bg24: props.theme == 2 }">
<view
class="flex-center ju-between m-b-28"
v-if="(props.type == 2 || props.type == 4) && props.data.logisticsNo"
>
<view>{{ props.data.logisticsName }} {{ props.data.logisticsNo }}</view>
<view class="flex-center">
<view @click.stop="onCopy(props.data.logisticsNo)">复制</view>
<truckLine
:data="props.data"
:code="2"
v-if="props.data.deliveryTime && props.data.logisticsNo"
></truckLine>
</view>
</view>
<view
class="con_item flex-center ju-between"
v-for="(v, i) in props.data.items"
:key="i"
:class="{ 'al-flex-start': props.type == 3 || props.type == 4 }"
>
<view class="order_img shrink" :class="{ 'm-r-16': props.type == 3 }">
<image :src="`${v.picUrl}`" mode="aspectFill" />
</view>
<view class="flex1">
<view class="flex-row ju-between m-b-6">
<view
class="size28 spuName lineTwo"
:class="{ 'p-r-10': props.type == 3, c0: props.theme == 2 }"
>
{{ v.spuName }}
</view>
<view class="shrink price" v-if="props.type != 4"
><span class="size24">¥</span
><span class="size36" style="font-weight: 600">{{ fen2yuan(v.price) }}</span></view
>
</view>
<view v-if="props.type == 4">
<view class="m-b-12 size24 h_52" v-for="(item, i) in v.items" :key="i">
<view class="flex1 flex-center ju-between h_52 bg18 radius8 p-l-8 p-r-16">
<view class="lineOne c19">
{{ formatSkuProperties(item?.properties) }}
</view>
<view class="flex-center">
<view class="c19">x{{ item.count }}</view>
<view class="size28 m-l-12 weight900"
>¥<span class="">{{ fen2yuan(item.price) }}</span>
</view>
</view>
</view>
<view class="c13 size28 weight900">
¥<span class="size40">{{ fen2yuan(item.payPrice) }}</span>
</view>
</view>
</view>
<view class="flex-row ju-between" :class="{ 'm-t-8': props.type == 3 }" v-else>
<view class="valueName size28" :class="{ c19: props.theme == 2 }">{{
formatSkuProperties(v.properties)
}}</view>
<view class="shrink size28 c_333" :class="{ c0: props.theme == 2 }">{{
`x${v.count}`
}}</view>
</view>
<view class="btn flex-row ju-flex-end" v-if="props.type == 2">
<button
class="ss-reset-button btnItem btnItem1"
v-if="
[10, 20].includes(props.data.status) &&
v.afterSaleStatus === 0 &&
props.data.payChannelCode !== 'cash_payment'
"
@tap.stop="
sheep.$router.go('/pages/order/aftersale/apply', {
orderId: props.data.id,
itemId: v.id,
})
"
>
申请售后
</button>
<view
class="btnItem btnItem1"
v-if="v.afterSaleStatus === 10"
@click="cancelAfterSale(v)"
>
取消售后
</view>
<view class="btnItem" v-if="v.afterSaleStatus === 20"> 售后成功 </view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, reactive, getCurrentInstance, defineProps } from 'vue';
import { fen2yuan } from '@/sheep/hooks/useGoods';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any;
let emit = defineEmits(['getOrderDetail']);
const formatSkuProperties = (properties: any) => {
const list = Array.isArray(properties) ? properties : [];
return list
.map((property) => property?.valueName)
.filter(Boolean)
.join(' ');
};
const props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
type: {
type: String,
default: '0', //0列表2订单详情 3订单列表 4ai订单详情
},
theme: {
type: String,
default: '2', //1浅色 2深色
},
});
const cancelAfterSale = (v) => {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(v.afterSaleId);
if (code === 0) {
getOrderDetail();
}
},
});
};
const getOrderDetail = () => {
emit('getOrderDetail');
};
const onCopy = (text) => {
sheep.$helper.copyText(text);
};
</script>
<style scoped lang="scss">
.order_con {
.con_item {
margin-bottom: 24rpx;
.order_img {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
margin-right: 12rpx;
image {
width: 100%;
height: 100%;
}
}
.spuName {
color: #333333;
}
.valueName {
color: #777777;
}
}
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.btnItem {
line-height: 50rpx;
padding: 0 20rpx;
box-sizing: border-box;
border-radius: 94px 94px 94px 94px;
margin-top: 12rpx;
font-size: 24rpx;
border: none;
}
.btnItem1 {
background: #f2f2f2;
}
</style>