init
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
<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">
|
||||
{{item?.properties.length > 1? item?.properties.reduce((items2, items) => items2.valueName + ' ' + items.valueName,): item?.properties[0].valueName}}
|
||||
</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 }">{{
|
||||
v.properties.map((property) => property.valueName).join(' ')
|
||||
}}</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" @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 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>
|
||||
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<view class="card_order bg24 size34" @click="
|
||||
utils.go('/pages/order/detail', { id: props.index != 5 ? props.data.id : props.data.orderId })
|
||||
">
|
||||
<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="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 lang="ts">
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
getCurrentInstance,
|
||||
watch,
|
||||
nextTick,
|
||||
defineProps,
|
||||
defineEmits,
|
||||
} from 'vue';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderColor,
|
||||
formatOrderStatus,
|
||||
handleOrderButtons,
|
||||
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';
|
||||
import sheep from '@/sheep/index';
|
||||
let emit = defineEmits(['downData']);
|
||||
let { proxy } = getCurrentInstance();
|
||||
let props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
let data = reactive({});
|
||||
watch(
|
||||
() => props.data,
|
||||
(val) => {
|
||||
data = val;
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
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;
|
||||
}
|
||||
|
||||
.stateText {}
|
||||
|
||||
.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>
|
||||
Reference in New Issue
Block a user