<template>
|
<PageLayoutWithBg class="mineHire-page-wrapper" :title="'服务名'" :need-auth="false">
|
<LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
|
<ContentScrollView style="background-color: transparent"> serciceDetail </ContentScrollView>
|
<PageFooter>
|
<!-- <PageFooterAction
|
:icon="IconShare"
|
text="分享"
|
:isFlex="false"
|
openType="share"
|
></PageFooterAction>
|
<PageFooterAction
|
:icon="userResumeInfo.isCollected ? IconAttentionActive : IconAttention"
|
text="收藏"
|
:isFlex="false"
|
@click="handleAttention"
|
></PageFooterAction> -->
|
<PageFooterBtn type="primary" @click="skuState.visible = true">预约下单</PageFooterBtn>
|
<PageFooterBtn type="primary" @click="pay">预约下单</PageFooterBtn>
|
</PageFooter>
|
<Sku
|
v-model:visible="skuState.visible"
|
:sku="skuState.sku"
|
v-model:goods="skuState.goods"
|
@clickBtnOperate="clickBtnOperate"
|
>
|
</Sku>
|
</LoadingLayout>
|
</PageLayoutWithBg>
|
</template>
|
|
<script setup lang="ts">
|
import { useStandardServiceDetail } from '@12333/hooks';
|
import Taro from '@tarojs/taro';
|
import * as standardOrderServices from '@12333/services/apiV2/standardOrder';
|
import { toThousand, setOSSLink } from '@12333/utils';
|
import { Sku, Goods, SkuItem } from '@12333/components';
|
|
defineOptions({
|
name: 'serciceDetail',
|
});
|
|
const router = Taro.useRouter();
|
const id = router.params?.id ?? '';
|
|
const { isLoading, isError, detail, refetch } = useStandardServiceDetail({
|
id,
|
onSuccess(res) {
|
skuState.sku = [
|
{
|
id: '1',
|
name: '规格',
|
list: res.specs.map((item, index) => ({
|
id: item.id,
|
name: item.name,
|
active: index === 0,
|
disable: false,
|
})),
|
},
|
];
|
skuState.goods = {
|
skuId: '1',
|
price: toThousand(res.specs[0].price),
|
imagePath: setOSSLink(res.files[0]),
|
name: res.name,
|
};
|
},
|
});
|
|
const skuState = reactive({
|
visible: false,
|
sku: [] as SkuItem[],
|
goods: {} as Goods,
|
});
|
|
// 底部操作按钮触发
|
const clickBtnOperate = (op) => {
|
console.log('点击了操作按钮', op);
|
};
|
|
async function addStandardOrder() {
|
try {
|
let params: API.AddStandardOrderCommand = {
|
serviceId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
|
serviceName: 'string',
|
specId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
|
specName: 'string',
|
specPrice: 0,
|
specNumber: 0,
|
addressId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
|
beginTime: '2025-12-24T06:44:24.840Z',
|
endTime: '2025-12-24T06:44:24.840Z',
|
supplierEnterpriseId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
|
enterpriseEmployeeIds: ['3fa85f64-5717-4562-b3fc-2c963f66afa6'],
|
remark: 'string',
|
payAccess: 1,
|
};
|
let res = await standardOrderServices.addStandardOrder(params);
|
} catch (error) {}
|
}
|
|
async function pay() {
|
try {
|
let params: API.PayStandardOrderCommand = {
|
id: '9e919af2-3d33-4eac-f6dc-08de429676b3',
|
};
|
let res = await standardOrderServices.payStandardOrder(params);
|
if (res) {
|
Taro.requestPayment({
|
timeStamp: res.timestamp,
|
nonceStr: res.nonceStr,
|
package: res.package,
|
signType: res.signType as any,
|
paySign: res.paySign,
|
});
|
}
|
} catch (error) {}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/styles/common.scss';
|
</style>
|