Files
Neo-ZQYY/scripts/ops/update_customer_detail.py

56 lines
2.8 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""customer-detail.html 改动:灰色字加深、商城订单加总金额、台桌详情改台桌名称"""
filepath = "docs/h5_ui/pages/customer-detail.html"
with open(filepath, "r", encoding="utf-8") as f:
c = f.read()
# 1. 灰色字颜色统一加深text-gray-5 → text-gray-7, text-gray-6 → text-gray-8
# 只在 body 内容中替换(不动 CSS 定义)
c = c.replace('text-gray-5 ', 'text-gray-7 ')
c = c.replace('text-gray-5"', 'text-gray-7"')
c = c.replace('text-gray-6 ', 'text-gray-8 ')
c = c.replace('text-gray-6"', 'text-gray-8"')
# 但保留 orig-price 的 color在 style 中定义的)
# text-gray-6 在 style 中是 #a6a6a6不受影响
# 2. "台桌详情" → 台桌名称
c = c.replace(
'<span class="text-xs font-semibold text-primary">台桌详情</span>\n </div>\n <span class="text-xs text-gray-8">2026-02-05</span>',
'<span class="text-xs font-semibold text-primary">A12号台</span>\n </div>\n <span class="text-xs text-gray-8">2026-02-05</span>'
)
c = c.replace(
'<span class="text-xs font-semibold text-primary">台桌详情</span>\n </div>\n <span class="text-xs text-gray-8">2026-02-01</span>',
'<span class="text-xs font-semibold text-primary">888号台</span>\n </div>\n <span class="text-xs text-gray-8">2026-02-01</span>'
)
# 3. 商城订单加总金额
old_mall = ''' <!-- 食品酒水 -->
<div class="flex items-center justify-between pt-2 border-t border-gray-100">
<span class="text-xs text-gray-8">🍷 食品酒水</span>
<span class="text-sm font-medium text-warning pv">¥180</span>
</div>
</div>
</div>
</div>'''
new_mall = ''' <!-- 食品酒水 -->
<div class="flex items-center justify-between pt-2 border-t border-gray-100">
<span class="text-xs text-gray-8">🍷 食品酒水</span>
<span class="text-sm font-medium text-warning pv">¥180</span>
</div>
<!-- 总金额 -->
<div class="flex items-center justify-between pt-2 border-t border-gray-200">
<span class="text-xs font-semibold text-gray-9">总金额</span>
<span class="text-base font-bold text-error pv">¥280</span>
</div>
</div>
</div>
</div>'''
c = c.replace(old_mall, new_mall)
with open(filepath, "w", encoding="utf-8") as f:
f.write(c)
print("✅ customer-detail.html 更新完成")