vendors.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <div>
  3. <div class="inner--headers">
  4. <h2>{{ pageId }}</h2>
  5. <div class="bread--crumbs--wrap">
  6. <span>홈</span>
  7. <span @click="goBack" class="breadcrumb-link">벤더사 관리</span>
  8. <span>{{ currentVendor?.name || "벤더사 상세" }}</span>
  9. </div>
  10. </div>
  11. <!-- 로딩 상태 -->
  12. <div v-if="isLoading" class="loading-wrap">
  13. <v-progress-circular indeterminate color="primary" size="64"></v-progress-circular>
  14. <p>벤더사 정보를 불러오고 있습니다...</p>
  15. </div>
  16. <!-- 에러 상태 -->
  17. <div v-else-if="errorMessage" class="error-wrap">
  18. <v-alert type="error" dismissible @click:close="vendorsStore.clearError()">
  19. {{ errorMessage }}
  20. </v-alert>
  21. <v-btn @click="goBack" class="custom-btn btn-blue">목록으로 돌아가기</v-btn>
  22. </div>
  23. <!-- 벤더사 상세 정보 -->
  24. <div v-else-if="currentVendor" class="vendor-detail-wrap">
  25. <!-- 벤더사 기본 정보 -->
  26. <v-card class="vendor-header-card" elevation="2">
  27. <v-card-text>
  28. <div class="vendor-header">
  29. <div class="vendor-logo-section">
  30. <v-avatar size="80" class="vendor-logo-large">
  31. <v-img
  32. v-if="currentVendor.logo"
  33. :src="currentVendor.logo"
  34. :alt="currentVendor.name + ' 로고'"
  35. ></v-img>
  36. <div v-else class="no-logo-large">{{ currentVendor.name.charAt(0) }}</div>
  37. </v-avatar>
  38. </div>
  39. <div class="vendor-info-section">
  40. <h1 class="vendor-name">{{ currentVendor.name }}</h1>
  41. <div class="vendor-meta">
  42. <v-chip
  43. :color="getCategoryColor(currentVendor.category)"
  44. size="large"
  45. variant="outlined"
  46. class="mr-2"
  47. >
  48. {{ getCategoryName(currentVendor.category) }}
  49. </v-chip>
  50. <v-chip
  51. :color="currentVendor.status === 'ACTIVE' ? 'success' : 'error'"
  52. size="large"
  53. >
  54. {{ currentVendor.status === "ACTIVE" ? "활성" : "비활성" }}
  55. </v-chip>
  56. </div>
  57. <p v-if="currentVendor.description" class="vendor-description">
  58. {{ currentVendor.description }}
  59. </p>
  60. </div>
  61. <div class="vendor-actions">
  62. <v-btn
  63. v-if="currentVendor.website"
  64. :href="currentVendor.website"
  65. target="_blank"
  66. class="custom-btn btn-white mr-2"
  67. prepend-icon="mdi-web"
  68. >
  69. 웹사이트
  70. </v-btn>
  71. <v-btn
  72. @click="goBack"
  73. class="custom-btn btn-blue"
  74. prepend-icon="mdi-arrow-left"
  75. >
  76. 목록으로
  77. </v-btn>
  78. </div>
  79. </div>
  80. </v-card-text>
  81. </v-card>
  82. <!-- 상세 정보 탭 -->
  83. <v-card class="detail-tabs-card" elevation="2">
  84. <v-tabs v-model="activeTab" class="custom-tabs">
  85. <v-tab value="info">기업 정보</v-tab>
  86. <v-tab value="contact">연락처</v-tab>
  87. <v-tab value="products">제품 정보</v-tab>
  88. <v-tab value="partnership">파트너십</v-tab>
  89. </v-tabs>
  90. <v-card-text>
  91. <v-tabs-window v-model="activeTab">
  92. <!-- 기업 정보 탭 -->
  93. <v-tabs-window-item value="info">
  94. <div class="info-section">
  95. <v-row>
  96. <v-col cols="12" md="6">
  97. <div class="info-item">
  98. <h3>사업자등록번호</h3>
  99. <p>{{ currentVendor.businessNumber || "-" }}</p>
  100. </div>
  101. </v-col>
  102. <v-col cols="12" md="6">
  103. <div class="info-item">
  104. <h3>설립일</h3>
  105. <p>{{ formatDate(currentVendor.establishedDate) || "-" }}</p>
  106. </div>
  107. </v-col>
  108. <v-col cols="12" md="6">
  109. <div class="info-item">
  110. <h3>직원 수</h3>
  111. <p>
  112. {{
  113. currentVendor.employeeCount
  114. ? currentVendor.employeeCount + "명"
  115. : "-"
  116. }}
  117. </p>
  118. </div>
  119. </v-col>
  120. <v-col cols="12" md="6">
  121. <div class="info-item">
  122. <h3>연매출</h3>
  123. <p>{{ formatCurrency(currentVendor.annualRevenue) || "-" }}</p>
  124. </div>
  125. </v-col>
  126. <v-col cols="12">
  127. <div class="info-item">
  128. <h3>사업 분야</h3>
  129. <div class="business-areas">
  130. <v-chip
  131. v-for="area in currentVendor.businessAreas || []"
  132. :key="area"
  133. size="small"
  134. variant="outlined"
  135. class="mr-2 mb-2"
  136. >
  137. {{ area }}
  138. </v-chip>
  139. </div>
  140. </div>
  141. </v-col>
  142. </v-row>
  143. </div>
  144. </v-tabs-window-item>
  145. <!-- 연락처 탭 -->
  146. <v-tabs-window-item value="contact">
  147. <div class="contact-section">
  148. <v-row>
  149. <v-col cols="12" md="6">
  150. <v-card variant="outlined" class="contact-card">
  151. <v-card-title>
  152. <v-icon class="mr-2">mdi-account</v-icon>
  153. 주요 담당자
  154. </v-card-title>
  155. <v-card-text>
  156. <div class="contact-item">
  157. <strong>이름:</strong> {{ currentVendor.contactName || "-" }}
  158. </div>
  159. <div class="contact-item">
  160. <strong>직책:</strong>
  161. {{ currentVendor.contactPosition || "-" }}
  162. </div>
  163. <div class="contact-item">
  164. <strong>전화:</strong>
  165. <a
  166. v-if="currentVendor.contactPhone"
  167. :href="`tel:${currentVendor.contactPhone}`"
  168. >
  169. {{ currentVendor.contactPhone }}
  170. </a>
  171. <span v-else>-</span>
  172. </div>
  173. <div class="contact-item">
  174. <strong>이메일:</strong>
  175. <a
  176. v-if="currentVendor.contactEmail"
  177. :href="`mailto:${currentVendor.contactEmail}`"
  178. >
  179. {{ currentVendor.contactEmail }}
  180. </a>
  181. <span v-else>-</span>
  182. </div>
  183. </v-card-text>
  184. </v-card>
  185. </v-col>
  186. <v-col cols="12" md="6">
  187. <v-card variant="outlined" class="contact-card">
  188. <v-card-title>
  189. <v-icon class="mr-2">mdi-map-marker</v-icon>
  190. 주소 정보
  191. </v-card-title>
  192. <v-card-text>
  193. <div class="contact-item">
  194. <strong>주소:</strong>
  195. <p>{{ currentVendor.address || "-" }}</p>
  196. </div>
  197. <div class="contact-item">
  198. <strong>상세주소:</strong>
  199. <p>{{ currentVendor.detailAddress || "-" }}</p>
  200. </div>
  201. <div class="contact-item">
  202. <strong>우편번호:</strong> {{ currentVendor.zipCode || "-" }}
  203. </div>
  204. </v-card-text>
  205. </v-card>
  206. </v-col>
  207. </v-row>
  208. </div>
  209. </v-tabs-window-item>
  210. <!-- 제품 정보 탭 -->
  211. <v-tabs-window-item value="products">
  212. <div class="products-section">
  213. <div class="section-header">
  214. <h3>주요 제품/서비스</h3>
  215. </div>
  216. <v-row v-if="currentVendor.products && currentVendor.products.length > 0">
  217. <v-col
  218. v-for="product in currentVendor.products"
  219. :key="product.id"
  220. cols="12"
  221. md="6"
  222. lg="4"
  223. >
  224. <v-card class="product-card" variant="outlined">
  225. <v-img
  226. v-if="product.image"
  227. :src="product.image"
  228. height="150"
  229. cover
  230. ></v-img>
  231. <v-card-title>{{ product.name }}</v-card-title>
  232. <v-card-text>
  233. <p>{{ product.description }}</p>
  234. <div class="product-price" v-if="product.price">
  235. {{ formatCurrency(product.price) }}
  236. </div>
  237. </v-card-text>
  238. </v-card>
  239. </v-col>
  240. </v-row>
  241. <div v-else class="no-data">
  242. <v-icon size="48" color="grey-lighten-1">mdi-package-variant</v-icon>
  243. <p>등록된 제품 정보가 없습니다</p>
  244. </div>
  245. </div>
  246. </v-tabs-window-item>
  247. <!-- 파트너십 탭 -->
  248. <v-tabs-window-item value="partnership">
  249. <div class="partnership-section">
  250. <v-row>
  251. <v-col cols="12" md="6">
  252. <div class="info-item">
  253. <h3>파트너십 등급</h3>
  254. <v-chip
  255. :color="getPartnershipColor(currentVendor.partnershipLevel)"
  256. size="large"
  257. >
  258. {{ getPartnershipName(currentVendor.partnershipLevel) }}
  259. </v-chip>
  260. </div>
  261. </v-col>
  262. <v-col cols="12" md="6">
  263. <div class="info-item">
  264. <h3>협력 시작일</h3>
  265. <p>{{ formatDate(currentVendor.partnershipStartDate) || "-" }}</p>
  266. </div>
  267. </v-col>
  268. <v-col cols="12" md="6">
  269. <div class="info-item">
  270. <h3>협력 프로젝트 수</h3>
  271. <p>{{ currentVendor.projectCount || 0 }}개</p>
  272. </div>
  273. </v-col>
  274. <v-col cols="12" md="6">
  275. <div class="info-item">
  276. <h3>평점</h3>
  277. <div class="rating">
  278. <v-rating
  279. v-model="currentVendor.rating"
  280. readonly
  281. size="small"
  282. density="compact"
  283. ></v-rating>
  284. <span class="rating-text">{{ currentVendor.rating || 0 }}/5</span>
  285. </div>
  286. </div>
  287. </v-col>
  288. <v-col cols="12">
  289. <div class="info-item">
  290. <h3>특이사항</h3>
  291. <p>{{ currentVendor.notes || "특이사항이 없습니다." }}</p>
  292. </div>
  293. </v-col>
  294. </v-row>
  295. </div>
  296. </v-tabs-window-item>
  297. </v-tabs-window>
  298. </v-card-text>
  299. </v-card>
  300. </div>
  301. <!-- 데이터가 없을 때 -->
  302. <div v-else class="no-data-wrap">
  303. <div class="no-data">
  304. <v-icon size="64" color="grey-lighten-1">mdi-store-alert</v-icon>
  305. <h3>벤더사 정보를 찾을 수 없습니다</h3>
  306. <p>요청하신 벤더사가 존재하지 않거나 삭제되었을 수 있습니다</p>
  307. <v-btn @click="goBack" class="custom-btn btn-blue">목록으로 돌아가기</v-btn>
  308. </div>
  309. </div>
  310. </div>
  311. </template>
  312. <script setup>
  313. import { ref, onMounted, computed } from "vue";
  314. import { useRoute, useRouter } from "vue-router";
  315. import { useVendorsStore } from "@/stores/vendors";
  316. /************************************************************************
  317. | 레이아웃
  318. ************************************************************************/
  319. definePageMeta({
  320. layout: "default",
  321. });
  322. /************************************************************************
  323. | 스토어, 라우터, 라우트
  324. ************************************************************************/
  325. const vendorsStore = useVendorsStore();
  326. const router = useRouter();
  327. const route = useRoute();
  328. /************************************************************************
  329. | 반응형 데이터
  330. ************************************************************************/
  331. const pageId = ref("벤더사 상세");
  332. const activeTab = ref("info");
  333. /************************************************************************
  334. | computed - .value 제거!
  335. ************************************************************************/
  336. const currentVendor = computed(() => vendorsStore.getCurrentVendor);
  337. const isLoading = computed(() => vendorsStore.getLoading);
  338. const errorMessage = computed(() => vendorsStore.getError);
  339. /************************************************************************
  340. | 메서드
  341. ************************************************************************/
  342. const goBack = () => {
  343. router.push("/view/vendor/vendors");
  344. };
  345. const getCategoryColor = (category) => {
  346. const colors = {
  347. FASHION_BEAUTY: "pink",
  348. FOOD_HEALTH: "green",
  349. LIFESTYLE: "blue",
  350. TECH_ELECTRONICS: "purple",
  351. SPORTS_LEISURE: "orange",
  352. CULTURE_ENTERTAINMENT: "red",
  353. };
  354. return colors[category] || "grey";
  355. };
  356. const getCategoryName = (category) => {
  357. const names = {
  358. FASHION_BEAUTY: "패션·뷰티",
  359. FOOD_HEALTH: "식품·건강",
  360. LIFESTYLE: "라이프스타일",
  361. TECH_ELECTRONICS: "테크·가전",
  362. SPORTS_LEISURE: "스포츠·레저",
  363. CULTURE_ENTERTAINMENT: "문화·엔터테인먼트",
  364. };
  365. return names[category] || category;
  366. };
  367. const getPartnershipColor = (level) => {
  368. const colors = {
  369. PLATINUM: "purple",
  370. GOLD: "amber",
  371. SILVER: "grey",
  372. BRONZE: "brown",
  373. BASIC: "blue-grey",
  374. };
  375. return colors[level] || "grey";
  376. };
  377. const getPartnershipName = (level) => {
  378. const names = {
  379. PLATINUM: "플래티넘",
  380. GOLD: "골드",
  381. SILVER: "실버",
  382. BRONZE: "브론즈",
  383. BASIC: "베이직",
  384. };
  385. return names[level] || level;
  386. };
  387. const formatDate = (dateString) => {
  388. if (!dateString) return null;
  389. return new Date(dateString).toLocaleDateString("ko-KR");
  390. };
  391. const formatCurrency = (amount) => {
  392. if (!amount) return null;
  393. return new Intl.NumberFormat("ko-KR", {
  394. style: "currency",
  395. currency: "KRW",
  396. }).format(amount);
  397. };
  398. /************************************************************************
  399. | 라이프사이클
  400. ************************************************************************/
  401. onMounted(async () => {
  402. const vendorId = route.params.id;
  403. if (vendorId) {
  404. try {
  405. await vendorsStore.getVendorById(vendorId);
  406. } catch (error) {
  407. console.error("벤더사 정보 로드 실패:", error);
  408. }
  409. }
  410. });
  411. </script>
  412. <style scoped>
  413. .vendor-detail-wrap {
  414. display: flex;
  415. flex-direction: column;
  416. gap: 20px;
  417. }
  418. .vendor-header-card {
  419. margin-bottom: 20px;
  420. }
  421. .vendor-header {
  422. display: flex;
  423. align-items: flex-start;
  424. gap: 20px;
  425. }
  426. .vendor-logo-section {
  427. flex-shrink: 0;
  428. }
  429. .vendor-logo-large {
  430. border: 1px solid #e0e0e0;
  431. }
  432. .no-logo-large {
  433. background: #f5f5f5;
  434. color: #666;
  435. font-weight: bold;
  436. font-size: 32px;
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. width: 100%;
  441. height: 100%;
  442. }
  443. .vendor-info-section {
  444. flex: 1;
  445. }
  446. .vendor-name {
  447. font-size: 28px;
  448. font-weight: bold;
  449. margin-bottom: 12px;
  450. }
  451. .vendor-meta {
  452. margin-bottom: 16px;
  453. }
  454. .vendor-description {
  455. color: #666;
  456. line-height: 1.6;
  457. margin: 0;
  458. }
  459. .vendor-actions {
  460. flex-shrink: 0;
  461. }
  462. .breadcrumb-link {
  463. cursor: pointer;
  464. color: #1976d2;
  465. }
  466. .breadcrumb-link:hover {
  467. text-decoration: underline;
  468. }
  469. .detail-tabs-card {
  470. margin-top: 20px;
  471. }
  472. .info-section,
  473. .contact-section,
  474. .products-section,
  475. .partnership-section {
  476. padding: 20px 0;
  477. }
  478. .info-item {
  479. margin-bottom: 24px;
  480. }
  481. .info-item h3 {
  482. font-size: 16px;
  483. font-weight: 600;
  484. margin-bottom: 8px;
  485. color: #333;
  486. }
  487. .info-item p {
  488. font-size: 14px;
  489. color: #666;
  490. margin: 0;
  491. }
  492. .contact-card {
  493. height: 100%;
  494. }
  495. .contact-item {
  496. margin-bottom: 12px;
  497. }
  498. .contact-item strong {
  499. display: inline-block;
  500. width: 80px;
  501. color: #333;
  502. }
  503. .contact-item a {
  504. color: #1976d2;
  505. text-decoration: none;
  506. }
  507. .contact-item a:hover {
  508. text-decoration: underline;
  509. }
  510. .section-header {
  511. margin-bottom: 20px;
  512. padding-bottom: 10px;
  513. border-bottom: 1px solid #e0e0e0;
  514. }
  515. .section-header h3 {
  516. font-size: 18px;
  517. font-weight: 600;
  518. margin: 0;
  519. }
  520. .product-card {
  521. height: 100%;
  522. }
  523. .product-price {
  524. font-weight: bold;
  525. color: #1976d2;
  526. margin-top: 8px;
  527. }
  528. .rating {
  529. display: flex;
  530. align-items: center;
  531. gap: 8px;
  532. }
  533. .rating-text {
  534. font-size: 14px;
  535. color: #666;
  536. }
  537. .business-areas {
  538. display: flex;
  539. flex-wrap: wrap;
  540. gap: 8px;
  541. }
  542. .loading-wrap,
  543. .error-wrap,
  544. .no-data-wrap {
  545. display: flex;
  546. flex-direction: column;
  547. align-items: center;
  548. justify-content: center;
  549. padding: 60px 20px;
  550. }
  551. .no-data {
  552. text-align: center;
  553. }
  554. .no-data h3 {
  555. margin: 16px 0 8px;
  556. color: #666;
  557. }
  558. .no-data p {
  559. color: #999;
  560. margin-bottom: 20px;
  561. }
  562. @media (max-width: 768px) {
  563. .vendor-header {
  564. flex-direction: column;
  565. }
  566. .vendor-actions {
  567. width: 100%;
  568. }
  569. }
  570. </style>