|
@@ -6,23 +6,22 @@
|
|
|
import Card from '@/components/card.vue'
|
|
|
import SectionHeading from '@/components/section-heading.vue'
|
|
|
import { abc, calculator } from '../../core/libs/pngs'
|
|
|
-import { getByDictType, getMaterials } from '../../core/libs/requests'
|
|
|
+import { getAppMaterials, getByDictType, getMaterials } from '../../core/libs/requests'
|
|
|
import { materialDealers, close, phone } from '../../core/libs/svgs'
|
|
|
-import { DictType, MaterialDealer } from '../../core/models/moment'
|
|
|
+import { DictType, MaterialDealer, MaterialsList } from '../../core/models/moment'
|
|
|
+import { router } from '@designer-hub/assets/src/svgs'
|
|
|
|
|
|
-const { data, run } = useRequest(() => getByDictType(DictType.memberMaterialsBrandLevel))
|
|
|
-const { data: materialOperationTypes, run: setMaterialOperationTypes } = useRequest(() =>
|
|
|
- getByDictType(DictType.memberMaterialsOperationType),
|
|
|
-)
|
|
|
-const { data: selfOperateds, run: setSelfOperateds } = useRequest(
|
|
|
- () => getMaterials({ brandLevel: 1 }),
|
|
|
- { initialData: { list: [] } },
|
|
|
+const { data: materialDealerData, run: setMaterialDealerData } = useRequest(
|
|
|
+ () => getAppMaterials(),
|
|
|
+ { initialData: [] },
|
|
|
)
|
|
|
-const { data: jointVenture, run: setJointVenture } = useRequest(
|
|
|
- () => getMaterials({ brandLevel: 2 }),
|
|
|
- { initialData: { list: [] } },
|
|
|
+const { data, run } = useRequest(() => getByDictType(DictType.memberMaterialsBrandLevel))
|
|
|
+const { data: materialOperationTypes, run: setMaterialOperationTypes } = useRequest(
|
|
|
+ () => getByDictType(DictType.memberMaterialsOperationType),
|
|
|
+ { initialData: [] },
|
|
|
)
|
|
|
const dealerPanelState = ref(false)
|
|
|
+const currentDeraler = ref<MaterialsList>()
|
|
|
const pieces = ref([
|
|
|
{
|
|
|
title: '材料小课堂',
|
|
@@ -56,15 +55,20 @@ const toDetail = () => {
|
|
|
url: '/pages/material/detail/index',
|
|
|
})
|
|
|
}
|
|
|
+const handleCall = (phone: string) => {
|
|
|
+ uni.makePhoneCall({ phoneNumber: phone })
|
|
|
+}
|
|
|
onMounted(async () => {
|
|
|
await run()
|
|
|
- console.log(data.value)
|
|
|
+ await setMaterialDealerData()
|
|
|
await setMaterialOperationTypes()
|
|
|
- const reqs = data.value.map((it) =>
|
|
|
- getMaterials({ brandLevel: it.value }).then(({ data }) => data),
|
|
|
- )
|
|
|
- materialsByBrandLevel.value = await Promise.all(reqs)
|
|
|
- console.log(materialsByBrandLevel.value)
|
|
|
+ // const reqs = data.value.map((it) =>
|
|
|
+ // getMaterials({ brandLevel: it.value }).then(({ data }) => data),
|
|
|
+ // )
|
|
|
+ // materialsByBrandLevel.value = await Promise.all(reqs)
|
|
|
+ // console.log(materialsByBrandLevel.value)
|
|
|
+ // const res = await getAppMaterials()
|
|
|
+ // console.log(res)
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
@@ -114,12 +118,12 @@ onMounted(async () => {
|
|
|
</template>
|
|
|
</div>
|
|
|
|
|
|
- <template v-for="({ label }, i) in data" :key="i">
|
|
|
- <SectionHeading :title="label" custom-class="mx-3.5"></SectionHeading>
|
|
|
+ <template v-for="({ brandLevelName, materialsList }, i) in materialDealerData" :key="i">
|
|
|
+ <SectionHeading :title="brandLevelName" custom-class="mx-3.5"></SectionHeading>
|
|
|
<div class="my-6 flex px-3.5 gap-3">
|
|
|
- <template v-for="(it, index) in materialsByBrandLevel[i]?.list" :key="index">
|
|
|
- <div :style="{ width: '50%' }">
|
|
|
- <Card @click="toDetail">
|
|
|
+ <template v-for="(it, index) in materialsList" :key="index">
|
|
|
+ <div :style="{ width: '50%' }" @click="toDetail">
|
|
|
+ <Card>
|
|
|
<div class="flex flex-col items-center">
|
|
|
<wd-img
|
|
|
width="78"
|
|
@@ -141,9 +145,15 @@ onMounted(async () => {
|
|
|
?.label
|
|
|
}}
|
|
|
</div>
|
|
|
- <wd-button size="small" custom-class="my-4" @click="dealerPanelState = true">
|
|
|
- 联系商家
|
|
|
- </wd-button>
|
|
|
+ <div @click.stop>
|
|
|
+ <wd-button
|
|
|
+ size="small"
|
|
|
+ custom-class="my-4"
|
|
|
+ @click.stop="() => ((dealerPanelState = true), (currentDeraler = it))"
|
|
|
+ >
|
|
|
+ 联系商家
|
|
|
+ </wd-button>
|
|
|
+ </div>
|
|
|
<div
|
|
|
class="text-black/30 text-xs font-normal font-['PingFang SC'] leading-[10.18px]"
|
|
|
>
|
|
@@ -174,28 +184,36 @@ onMounted(async () => {
|
|
|
</div>
|
|
|
<div class="bg-neutral-100 rounded-tl-2xl rounded-tr-2xl p-3.5" @click.stop="">
|
|
|
<div class="flex flex-col">
|
|
|
- <template v-for="(it, i) in [{}]" :key="i">
|
|
|
+ <template
|
|
|
+ v-for="({ shopAddr, shopName, shopContactPhone }, i) in currentDeraler?.shopList"
|
|
|
+ :key="i"
|
|
|
+ >
|
|
|
<div class="bg-white rounded-2.5 p-3.5 flex items-center">
|
|
|
<div class="text-black/40 flex-1 border-r-2 border-r-[#f6f6f6] border-r-solid">
|
|
|
<div
|
|
|
class="text-black/90 text-lg font-normal font-['PingFang SC'] leading-normal"
|
|
|
>
|
|
|
- 曲江新区店
|
|
|
+ {{ shopName }}
|
|
|
</div>
|
|
|
<div>
|
|
|
<wd-icon name="location" size="15"></wd-icon>
|
|
|
<span
|
|
|
class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal"
|
|
|
>
|
|
|
- 西安市曲江路精彩世家 387 号
|
|
|
+ {{ shopAddr }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <wd-button type="text" size="small" custom-class=" bg-[#f2f2f2]! p-0! ml-4">
|
|
|
+ <wd-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ custom-class=" bg-[#f2f2f2]! p-0! ml-4"
|
|
|
+ @click="handleCall(shopContactPhone)"
|
|
|
+ >
|
|
|
<wd-img width="28" height="28" :src="phone"></wd-img>
|
|
|
</wd-button>
|
|
|
<wd-button type="text" size="small" custom-class=" bg-[#f2f2f2]! p-0! ml-4">
|
|
|
- <wd-img width="28" height="28"></wd-img>
|
|
|
+ <wd-img width="28" height="28" :src="router"></wd-img>
|
|
|
</wd-button>
|
|
|
</div>
|
|
|
</template>
|