fix(ui): 我的代金券状态/来源列显示中文——code视图取user_data[textField],API补status_text/source_text LEFT JOIN appcodes_kv

This commit is contained in:
yumoqing 2026-09-13 11:03:10 +08:00
parent fc57df0677
commit 9af312ccea
2 changed files with 6 additions and 3 deletions

View File

@ -125,9 +125,12 @@ async def my_vouchers_api(request, params_kw):
ns['st'] = status
sql = ("SELECT a.id, a.code, a.status, a.face_value, a.actual_deducted, "
"a.valid_from, a.valid_to, a.issued_at, a.used_at, a.source, a.remark, "
"b.name as template_name "
"b.name as template_name, "
"c.v as status_text, d.v as source_text "
"FROM voucher_instance a "
"LEFT JOIN voucher_template b ON a.template_id=b.id "
"LEFT JOIN appcodes_kv c ON c.k=a.status AND c.parentid='voucher_instance_status' "
"LEFT JOIN appcodes_kv d ON d.k=a.source AND d.parentid='vchr_source' "
+ where + " ORDER BY a.issued_at DESC")
recs = await sor.sqlExe(sql, ns)
rows = [_jsonable_instance(dict(r)) for r in (recs or [])]

View File

@ -36,10 +36,10 @@
"browserfields": {
"exclouded": ["id"],
"alters": {
"status": {"uitype": "code", "data": [
"status": {"uitype": "code", "textField": "status_text", "data": [
{"value": "unused", "text": "未使用"}, {"value": "used", "text": "已使用"},
{"value": "expired", "text": "已过期"}, {"value": "void", "text": "已作废"}]},
"source": {"uitype": "code", "data": [
"source": {"uitype": "code", "textField": "source_text", "data": [
{"value": "manual", "text": "手动发放"}, {"value": "register", "text": "注册赠券"},
{"value": "promo", "text": "促销活动"}]}
}