feat: 지오영 재고 조회 시 단가 표시
- geoyoung_api.py: include_price=True로 검색 - admin_rx_usage.html: 지오영 섹션에 단가 컬럼 추가
This commit is contained in:
parent
101dda2e41
commit
7dda385b7f
@ -35,18 +35,36 @@ def get_geo_session():
|
|||||||
return _geo_session
|
return _geo_session
|
||||||
|
|
||||||
|
|
||||||
def search_geoyoung_stock(keyword: str):
|
def search_geoyoung_stock(keyword: str, include_price: bool = True):
|
||||||
"""지오영 재고 검색 (동기, 빠름)"""
|
"""지오영 재고 검색 (동기, 단가 포함)"""
|
||||||
try:
|
try:
|
||||||
session = get_geo_session()
|
session = get_geo_session()
|
||||||
products = session.search_stock(keyword)
|
|
||||||
|
|
||||||
return {
|
# 새 API 사용 (단가 포함)
|
||||||
'success': True,
|
result = session.search_products(keyword, include_price=include_price)
|
||||||
'keyword': keyword,
|
|
||||||
'count': len(products),
|
if result.get('success'):
|
||||||
'items': products
|
# 기존 형식으로 변환
|
||||||
}
|
items = [{
|
||||||
|
'insurance_code': item['code'],
|
||||||
|
'internal_code': item.get('internal_code'),
|
||||||
|
'manufacturer': item['manufacturer'],
|
||||||
|
'product_name': item['name'],
|
||||||
|
'specification': item['spec'],
|
||||||
|
'stock': item['stock'],
|
||||||
|
'price': item.get('price', 0), # 단가 추가!
|
||||||
|
'box_qty': item.get('box_qty'),
|
||||||
|
'case_qty': item.get('case_qty')
|
||||||
|
} for item in result['items']]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'success': True,
|
||||||
|
'keyword': keyword,
|
||||||
|
'count': len(items),
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return {'success': False, 'error': result.get('error'), 'message': '검색 실패'}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"지오영 검색 오류: {e}")
|
logger.error(f"지오영 검색 오류: {e}")
|
||||||
|
|||||||
@ -1383,11 +1383,12 @@
|
|||||||
|
|
||||||
if (geoItems.length > 0) {
|
if (geoItems.length > 0) {
|
||||||
html += `<table class="geo-table">
|
html += `<table class="geo-table">
|
||||||
<thead><tr><th>제품명</th><th>규격</th><th>재고</th><th></th></tr></thead>
|
<thead><tr><th>제품명</th><th>규격</th><th>단가</th><th>재고</th><th></th></tr></thead>
|
||||||
<tbody>`;
|
<tbody>`;
|
||||||
|
|
||||||
geoItems.forEach((item, idx) => {
|
geoItems.forEach((item, idx) => {
|
||||||
const hasStock = item.stock > 0;
|
const hasStock = item.stock > 0;
|
||||||
|
const priceText = item.price ? item.price.toLocaleString() + '원' : '-';
|
||||||
html += `
|
html += `
|
||||||
<tr class="${hasStock ? '' : 'no-stock'}">
|
<tr class="${hasStock ? '' : 'no-stock'}">
|
||||||
<td>
|
<td>
|
||||||
@ -1397,6 +1398,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="geo-spec">${item.specification}</td>
|
<td class="geo-spec">${item.specification}</td>
|
||||||
|
<td class="geo-price">${priceText}</td>
|
||||||
<td class="geo-stock ${hasStock ? 'in-stock' : 'out-stock'}">${item.stock}</td>
|
<td class="geo-stock ${hasStock ? 'in-stock' : 'out-stock'}">${item.stock}</td>
|
||||||
<td>${hasStock ? `<button class="geo-add-btn" onclick="addToCartFromWholesale('geoyoung', ${idx})">담기</button>` : ''}</td>
|
<td>${hasStock ? `<button class="geo-add-btn" onclick="addToCartFromWholesale('geoyoung', ${idx})">담기</button>` : ''}</td>
|
||||||
</tr>`;
|
</tr>`;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user