<template>
|
<LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
|
<ContentScrollView hasPaddingTop>
|
<ServiceDetailAddressCard
|
:name="defaultAddress?.name ?? ''"
|
:contactPhoneNumber="defaultAddress?.contactPhoneNumber ?? ''"
|
:addressDetail="defaultAddress?.addressDetail ?? ''"
|
/>
|
<div class="addStandardOrder-detail-card">
|
<nut-card
|
:img-url="'//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg'"
|
:title="detail?.name ?? ''"
|
:price="toThousand(spec?.price ?? 0)"
|
class="service-good-card"
|
>
|
<template #prolist>
|
<div class="card-tag-list">
|
<span class="tag">{{ spec?.name }}</span>
|
</div>
|
</template>
|
<template #origin>
|
<div></div>
|
</template>
|
<template #footer>
|
<div class="card-footer">x{{ specNumber }}</div>
|
</template>
|
</nut-card>
|
</div>
|
</ContentScrollView>
|
<PageFooter>
|
<PageFooterBtn type="primary" class="business-card-btn" @click="goConfirm"
|
>立即下单</PageFooterBtn
|
>
|
</PageFooter>
|
</LoadingLayout>
|
</template>
|
|
<script setup lang="ts">
|
import { ServiceDetailAddressCard } from '@12333/components';
|
import Taro from '@tarojs/taro';
|
import * as standardServiceServices from '@12333/services/apiV2/standardService';
|
import { RouterPath } from '@/constants';
|
import { useStandardServiceDetail } from '@12333/hooks';
|
import { toThousand } from '@12333/utils';
|
|
defineOptions({
|
name: 'InnerPage',
|
});
|
|
const route = Taro.useRouter();
|
const id = route.params?.id ?? '';
|
const specId = route.params?.specId ?? '';
|
const specNumber = Number(route.params?.specNumber);
|
|
const { isLoading, isError, detail, refetch } = useStandardServiceDetail({
|
id,
|
});
|
|
const spec = computed(() => {
|
if (detail.value.specs?.length > 0) {
|
return detail.value.specs.find((x) => x.id === specId);
|
}
|
return null;
|
});
|
|
const { infiniteLoadingProps } = useEnterpriseAddresses({
|
rows: 100,
|
});
|
|
const defaultAddress = computed(() => {
|
const address = infiniteLoadingProps.value.flattenListData.find((item) => item.isDefault);
|
return address || infiniteLoadingProps.value.flattenListData[0];
|
});
|
|
function goCancel() {
|
Taro.navigateTo({
|
url: `${RouterPath.mineReserveServiceCancel}?id=${id}`,
|
});
|
}
|
|
function goConfirm() {
|
Taro.navigateTo({
|
url: `${RouterPath.mineReserveServiceConfirm}?id=${id}`,
|
});
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/styles/common.scss';
|
</style>
|