123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <route lang="json5">
- { layout: 'tabbar', style: { navigationBarTitleText: '材料', navigationStyle: 'custom' } }
- </route>
- <script setup lang="ts">
- import Card from '@/components/card.vue'
- import SectionHeading from '@/components/section-heading.vue'
- import { abc, calculator } from '../../core/libs/pngs'
- import { getAppMaterials, getBanners, getByDictType } from '../../core/libs/requests'
- import { close, phone } from '../../core/libs/svgs'
- import { BannerMode, DictType, MaterialDealer, MaterialsList } from '../../core/models/moment'
- import router from '@designer-hub/assets/src/assets/svgs/router'
- import Banner from '../home/components/banner.vue'
- import materialDealers from '@designer-hub/assets/src/libs/assets/materialDealers'
- const { data: materialDealerData, run: setMaterialDealerData } = useRequest(
- () => getAppMaterials(),
- { initialData: [] },
- )
- const { data, run } = useRequest(() => getByDictType(DictType.memberMaterialsBrandLevel))
- const { data: materialOperationTypes, run: setMaterialOperationTypes } = useRequest(
- () => getByDictType(DictType.memberMaterialsOperationType),
- { initialData: [] },
- )
- const { data: materialBrandTypes, run: setMaterialBrandTypes } = useRequest(
- () => getByDictType(DictType.memberMaterialsBrandType),
- { initialData: [] },
- )
- const { data: banners, run: setBanners } = useRequest(
- () => getBanners({ mode: BannerMode.Material }),
- { initialData: [] },
- )
- const dealerPanelState = ref(false)
- const currentDeraler = ref<MaterialsList>()
- const pieces = ref([
- {
- title: '材料小课堂',
- desc: '全方位了解',
- icon: abc,
- gridItemClass: 'col-start-1 row-start-1',
- path: '/pages/material/mini-class/index',
- },
- {
- title: '积分计算机',
- desc: '积分小帮手',
- icon: calculator,
- gridItemClass: 'col-start-2 row-start-1',
- path: '/pages/material/calculator/index',
- },
- {
- title: '推荐材料商',
- desc: '我们将优先洽谈大家推荐的材料商',
- icon: materialDealers,
- gridItemClass: 'col-start-1 col-end-3 row-start-2',
- isMore: true,
- path: '/pages/material/recommend/index',
- },
- ])
- const current = ref<number>(0)
- const swiperList = computed(() => banners.value.map((it) => it.bannerImgUrl))
- const materialsByBrandLevel = ref<{ list: MaterialDealer[] }[]>([])
- const handleMenuItemClick = ({ path }: any) => {
- uni.navigateTo({ url: path })
- }
- const toDetail = (id: number) => {
- uni.navigateTo({
- url: `/pages/material/detail/index?id=${id}`,
- })
- }
- const handleCall = (phone: string) => {
- uni.makePhoneCall({ phoneNumber: phone })
- }
- function handleClick(e) {
- console.log(e)
- }
- function onChange(e) {
- console.log(e)
- }
- const handleGo = ({ name, address }) => {
- uni.openLocation({
- latitude: 34.2593042818515,
- longitude: 109.01031190070307,
- address,
- name,
- success: function () {
- console.log('success')
- },
- fail: (fail) => {
- console.log(fail)
- },
- })
- }
- onMounted(async () => {
- await run()
- await setMaterialDealerData()
- await Promise.all([setMaterialBrandTypes(), setMaterialOperationTypes(), setBanners()])
-
-
-
-
-
-
-
- })
- </script>
- <template>
- <view class="">
- <view class="bg-black w-full pos-relative aspect-[1.26/1]">
-
-
- <Banner :mode="BannerMode.Material" aspect="1.26/1"></Banner>
- </view>
- <view class="bg-[#f6f6f6] relative bottom-4 rounded-t-2xl py-1">
- <div class="my-6 grid grid-cols-2 grid-gap-3.5 mx-3.5">
- <template v-for="it of pieces" :key="it.title">
- <div :class="it.gridItemClass" @click="handleMenuItemClick(it)">
- <card custom-class="flex justify-between items-center gap-2">
- <view class="flex items-end justify-end">
- <wd-img :src="it.icon" :width="42" :height="42"></wd-img>
- </view>
- <div class="flex-1 flex flex-col justify-around h-full">
- <div
- class="text-black/80 text-base font-normal font-['PingFang_SC'] leading-[10.18px]"
- >
- {{ it.title }}
- </div>
- <div
- class="mt-1 text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal"
- >
- {{ it.desc }}
- </div>
- </div>
- <div v-if="it.isMore" class="mr--4">
- <wd-button
- custom-class="text-black/40!"
- type="icon"
- icon="arrow-right"
- icon-color=""
- ></wd-button>
- </div>
- </card>
- </div>
- </template>
- </div>
- <template
- v-for="({ brandLevelName, pointsRate, materialsList }, i) in materialDealerData"
- :key="i"
- >
- <SectionHeading
- :title="brandLevelName"
- :subtitle="`积分兑换比例 ${pointsRate}%`"
- custom-class="mx-3.5"
- ></SectionHeading>
- <div class="my-6 px-3.5 overflow-x-auto whitespace-nowrap space-x-3.5">
- <template v-for="(it, index) in materialsList" :key="index">
- <div
- class="inline-block"
- :style="{ width: 'calc(50% - 14rpx)' }"
- @click="toDetail(it.id)"
- >
- <Card>
- <div class="flex flex-col items-center">
- <wd-img
- width="78"
- height="78"
- custom-class="border border-[#f2f2f2] border-solid rounded-full overflow-hidden"
- :src="it.logoUrl"
- ></wd-img>
- <div
- class="my-4 text-black/90 text-base font-normal font-['PingFang_SC'] leading-[10.18px]"
- >
- {{ it.materialsName }}
- </div>
- <div
- class="mb-4 text-black/60 text-sm font-normal font-['PingFang_SC'] leading-[10.18px]"
- >
-
- {{
- (it.brandType,
- materialBrandTypes.find(({ value }) => value === String(it.brandType))?.label)
- }}
- |
- {{
- materialOperationTypes.find(({ value }) => value === String(it.manageType))
- ?.label
- }}
- </div>
- <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]"
- >
- {{ it.virtualArrival || 0 }}次到店打卡
- </div>
- </div>
- </Card>
- </div>
- </template>
- </div>
- </template>
- </view>
-
- <wd-overlay :show="dealerPanelState" @click="dealerPanelState = false">
- <view class="wrapper flex flex-col justify-end h-full">
- <div class="w-full flex justify-end mb-4">
- <div class="mr-3.5">
- <wd-button type="text" custom-class="w-8! h-8! p-0!" size="small">
- <wd-img :src="close" width="28" height="28" custom-class="vertical-bottom"></wd-img>
- </wd-button>
- </div>
- </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="({ 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"
- >
- {{ shopAddr }}
- </span>
- </div>
- </div>
- <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"
- @click="handleGo({ name: shopName, address: shopAddr })"
- >
- <wd-img width="28" height="28" :src="router"></wd-img>
- </wd-button>
- </div>
- </template>
- </div>
- </div>
- </view>
- </wd-overlay>
- </view>
- </template>
- <style scoped lang="scss"></style>
|