zhengyiming
昨天 25708e3f81956c1517f495e3303a6c8d08bb730c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<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>