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

194 lines
5.0 KiB
Vue

<template>
<view class="card_order bg24 size34" @click="
utils.go('/pages/order/detail', { id: props.index != 5 ? props.data.id : props.data.orderId, type: props.data.type, source: props.data.__source })
">
<view class="flex-center ju-between createTime">
<view class="flex-center shrink">
<view class="size28">订单编号: {{ props.data.no }}</view>
<view class="copy flex-center" @tap.stop="onCopy(props.data.no)" style="margin-left: 10px">
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
</view>
</view>
<view class="stateText size28" style="margin-left: 10px" :class="formatOrderColor(props.data)"
v-if="props.index != 5">
{{ formatOrderStatus(props.data) }}
</view>
<view class="stateText size28" v-else>
{{ formatAfterSaleStatus(props.data) }}
</view>
</view>
<card_order :data="props.data" v-if="props.index != 5" type="3"></card_order>
<view v-else class="con_item flex-center ju-between al-flex-start">
<view class="order_img shrink">
<image :src="`${props.data.picUrl}`" mode="aspectFill" />
</view>
<view class="flex1 flex-column ju-between">
<view class="flex-row ju-between">
<view class="size28 spuName lineTwo c0">{{ props.data.spuName }}</view>
<view class="shrink price">
<span class="size24">¥</span><span class="size36"
style="font-weight: 600">{{ fen2yuan(props.data.refundPrice) }}</span>
</view>
</view>
<view class="flex-row ju-between m-t-10">
<view class="valueName size24">{{
props.data.properties.map((property) => property.valueName).join(' ')
}}</view>
<view class="shrink size24 c0">{{ `x${props.data.count}` }}</view>
</view>
<view class="btn flex-row ju-flex-end">
<button class="ss-reset-button btnItem btnItem1" @tap.stop="onApply"
v-if="statusChange(['10', '20', '30', '62', '63'], String(props.data.status))">取消售后</button>
<button class="ss-reset-button btnItem btnItem1" style="margin-left: 20rpx"
v-if="statusChange(['20'], String(props.data.status))" @tap.stop="
sheep.$router.go('/pages/order/aftersale/return-delivery', { id: props.data.id })
">
填写物流信息
</button>
</view>
</view>
</view>
<view class="flex-row ju-flex-end" v-if="props.index != 5">
<view class="size24 c32">已优惠¥{{ fen2yuan(props.data.randomDiscountPrice) }}</view>
</view>
<view class="flex-row ju-flex-end" v-if="props.index != 5">
<view class="flex-center size24">{{ `共${props.data.productCount}件商品 合计: `
}}
<!-- <view class="price">¥{{ fen2yuan(props.data.payPrice) }}</view> -->
<view class="shrink price"><span class="size24">¥</span><span class="size36"
style="font-weight: 600;">{{ fen2yuan(props.data.payPrice) }}</span></view>
</view>
</view>
<view class="" style="margin-top: 32rpx" v-if="props.index != 5">
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
</view>
</view>
</template>
<script setup>
import {
getCurrentInstance,
defineProps,
defineEmits,
} from 'vue';
import {
fen2yuan,
formatOrderColor,
formatOrderStatus,
formatAfterSaleStatus,
} from '@/sheep/hooks/useGoods';
import card_order from './card_order.vue';
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
import AfterSaleApi from '@/sheep/api/trade/afterSale';
let emit = defineEmits(['downData']);
let { proxy } = getCurrentInstance();
let props = defineProps({
data: {
type: Object,
default() {
return {};
},
},
index: {
type: Number,
default: 0,
},
});
const downData = () => {
emit('downData');
};
// 复制
const onCopy = (no) => {
proxy.$sheep.$helper.copyText(no);
};
const onApply = () => {
uni.showModal({
title: '提示',
content: '确定要取消此申请吗?',
confirmColor: '#FA7E31',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AfterSaleApi.cancelAfterSale(props.data.id);
if (code === 0) {
emit('downData');
}
},
});
};
const statusChange = (arr, status) => {
return arr.indexOf(status) != -1;
};
</script>
<style lang="scss" scoped>
.card_order {
padding: 24rpx;
box-sizing: border-box;
border-radius: 8rpx;
}
.createTime {
margin-bottom: 32rpx;
}
.price {
color: #ee0a24;
font-size: 24rpx;
}
.copy {
width: 24rpx;
height: 24rpx;
margin-left: 14rpx;
image {
width: 100%;
height: 100%;
}
}
.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: #323232;
}
.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>