diff --git a/voucher/init.py b/voucher/init.py index 9d1df3d..6e637d2 100644 --- a/voucher/init.py +++ b/voucher/init.py @@ -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 [])] diff --git a/wwwroot/my/index.ui b/wwwroot/my/index.ui index 6582743..381929d 100644 --- a/wwwroot/my/index.ui +++ b/wwwroot/my/index.ui @@ -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": "促销活动"}]} }