Jelajahi Sumber

Merge branch 'main' of https://github.com/omnia96/designer-hub

Jake 5 bulan lalu
induk
melakukan
afdbe45a77

+ 0 - 2
packages/app/src/components/card.vue

@@ -5,13 +5,11 @@ defineProps({
     default: () => '',
   },
 })
-const emits = defineEmits(['click'])
 </script>
 <template>
   <view
     class="rounded-2xl bg-white shadow-[0_16rpx_20rpx_-10rpx_rgba(0,0,0,0.05)] p-3.5 overflow-hidden box-border"
     :class="customClass"
-    @click="emits('click')"
   >
     <slot></slot>
   </view>

+ 5 - 38
packages/app/src/core/libs/requests.ts

@@ -1,8 +1,7 @@
-import { http, httpGet, httpPost } from '../../utils/http'
+import { httpGet, httpPost } from '../../utils/http'
 import { Schedule } from '../models/schedule'
-import { DictType, MaterialDealer, materialDealer, Moment } from '../models/moment'
+import { DictType, MaterialDealer, MaterialDealerRes, Moment } from '../models/moment'
 import dayjs from 'dayjs'
-import { getMaterialDealers } from './requests'
 
 export const getUserInfo = () =>
   httpGetMock<any>({
@@ -50,41 +49,7 @@ export const getMoment = () =>
     comments: 0,
     likes: 0,
     createdAt: dayjs('2024-07-15').toDate(),
-    commentList: [
-      {
-        id: 1,
-        author: {
-          avatar: 'https://via.placeholder.com/28x28',
-          nickname: '李一鸣设计师',
-          level: '',
-        },
-        content: '哇~你真的好厉害,棒棒棒',
-        createdAt: dayjs('2024-07-15').toDate(),
-        childrens: [
-          {
-            id: 3,
-            parentId: 1,
-            author: {
-              avatar: 'https://via.placeholder.com/28x28',
-              nickname: '李一鸣设计师',
-              level: '',
-            },
-            content: '这个是去参加了意大利游学活动',
-            createdAt: undefined,
-          },
-        ],
-      },
-      {
-        id: 2,
-        author: {
-          avatar: 'https://via.placeholder.com/28x28',
-          nickname: '王莉莎',
-          level: '',
-        },
-        content: '这个活动怎么参加呢?',
-        createdAt: undefined,
-      },
-    ],
+    commentList: [],
   })
 export const getClassmates = () =>
   httpGetMock<any[]>([
@@ -299,6 +264,8 @@ export const getMaterials = (query = {}) =>
   httpGet<{
     list: MaterialDealer[]
   }>('/app-api/member/materials/page', query)
+export const getAppMaterials = () =>
+  httpGet<MaterialDealerRes[]>('/app-api/member/materials/appMaterialsList')
 export const refreshToken = (refreshToken: string) =>
   httpPost<any>('/app-api/member/auth/refresh-token', {}, { refreshToken })
 export const httpGetMock = <T>(data: T) =>

+ 33 - 0
packages/app/src/core/models/moment.ts

@@ -76,6 +76,39 @@ export interface MaterialDealer {
   clockPoints: string
   orderCount: number
 }
+export interface ShopList {
+  id: number
+  materialsId: number
+  shopAddr: string
+  shopName: string
+  shopContactPerson: string
+  shopContactPhone: string
+}
+export interface MaterialsList {
+  id: number
+  logoUrl: string
+  materialsName: string
+  materialsType: number
+  brandLevel: number
+  manageType: number
+  manageBrand: number
+  brandType: number
+  invoiceTitle: string
+  taxpayerNumber: string
+  invoiceAddr: string
+  bankDeposit: string
+  virtualArrival: number
+  status: string
+  points: number
+  shopList: ShopList[]
+  clockCount: number
+}
+export interface MaterialDealerRes {
+  brandLevel: number
+  brandLevelName: string
+  pointsRate: number
+  materialsList: MaterialsList[]
+}
 export enum DictType {
   /**
    *  擅长空间类型

+ 15 - 2
packages/app/src/pages/material/detail/index.vue

@@ -6,10 +6,23 @@ style:
 import Card from '@/components/card.vue'
 import SectionHeading from '@/components/section-heading.vue'
 import StartMenuButton from '@/components/start-menu-button.vue'
+
+const handleBackClick = () => {
+  uni.navigateBack()
+}
 </script>
 <template>
-  <view class="w-full">
-    <div class="w-full aspect-[1.16/1] bg-amber"><StartMenuButton></StartMenuButton></div>
+  <view class="">
+    <div class="w-full aspect-[1.16/1] bg-amber">
+      <!-- <StartMenuButton></StartMenuButton> -->
+    </div>
+    <wd-navbar
+      fixed
+      left-arrow
+      safe-area-inset-top
+      custom-class="bg-transparent!"
+      @click-left="handleBackClick"
+    ></wd-navbar>
     <div class="relative top--8 px-3.5">
       <Card>
         <img

+ 49 - 31
packages/app/src/pages/material/index.vue

@@ -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>

+ 6 - 0
packages/assets/src/assets/svgs/router.svg

@@ -0,0 +1,6 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g id="Frame 79">
+<circle id="Ellipse 82" cx="15.8529" cy="15.8529" r="15.8529" fill="#F2F2F2"/>
+<path id="Vector" d="M23.3275 15.0873C20.688 15.0873 18.1773 16.1131 16.4207 17.8994V12.001H18.1773C18.3245 12.001 18.4716 11.9479 18.5728 11.8595C18.6831 11.7622 18.7475 11.6296 18.7475 11.4969C18.7475 11.3908 18.7107 11.2847 18.6464 11.1963L15.7402 7.46448C15.6574 7.34952 15.5103 7.26993 15.3631 7.25224C15.216 7.23456 15.0504 7.26109 14.9309 7.34952C14.8757 7.37605 14.8297 7.42911 14.8021 7.46448L11.8775 11.1963C11.7028 11.435 11.758 11.7446 12.0155 11.9126C12.1167 11.9833 12.227 12.0099 12.3466 12.001H14.1032V23.3114H16.4023C16.4207 21.6577 17.1657 20.0748 18.4624 18.9163C19.7592 17.7579 21.5158 17.1123 23.3275 17.1389C23.9529 17.1389 24.4587 16.679 24.4587 16.1042C24.4587 15.5294 23.9529 15.0873 23.3275 15.0873Z" fill="black"/>
+</g>
+</svg>

+ 2 - 0
packages/assets/src/svgs.ts

@@ -16,6 +16,7 @@ import yinyongIcon from "./assets/svgs/yinyong_icon.svg";
 import homepageBg from "./assets/svgs/homepage_bg.svg";
 import videoEyeIcon from "./assets/svgs/video_eye_icon.svg";
 import videoPlayIcon from "./assets/svgs/video_play_icon.svg";
+import router from "./assets/svgs/router.svg";
 
 export {
   ts,
@@ -36,4 +37,5 @@ export {
   homepageBg,
   videoEyeIcon,
   videoPlayIcon,
+  router,
 };