|
@@ -26,20 +26,49 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
{field: 'id', title: __('Id')},
|
|
|
- {field: 'user_id', title: __('User_id'), formatter: Table.api.formatter.search},
|
|
|
- {field: 'user.nickname', title: __('Nickname')},
|
|
|
+ {
|
|
|
+ field: 'user.username',
|
|
|
+ title: __('User'),
|
|
|
+ operate: 'LIKE',
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ // 显示用户头像和用户名
|
|
|
+ var avatar = row.user && row.user.avatar ? row.user.avatar : '/assets/img/avatar.png';
|
|
|
+ var username = row.user && row.user.username ? row.user.username : '游客';
|
|
|
+ var userId = row.user_id || '';
|
|
|
+
|
|
|
+ // 处理头像URL
|
|
|
+ var avatarUrl = avatar;
|
|
|
+ if (avatar && !avatar.startsWith('http') && !avatar.startsWith('//')) {
|
|
|
+ avatarUrl = Fast.api.cdnurl ? Fast.api.cdnurl(avatar) : avatar;
|
|
|
+ }
|
|
|
+
|
|
|
+ return '<div style="display:flex;align-items:center;">' +
|
|
|
+ '<img src="' + avatarUrl + '" style="width:40px;height:40px;border-radius:50%;margin-right:10px;" />' +
|
|
|
+ '<div>' +
|
|
|
+ '<div style="color:#337ab7;font-weight:bold;">' + username + '</div>' +
|
|
|
+ '<div style="color:#999;font-size:12px;">ID: ' + userId + '</div>' +
|
|
|
+ '</div>' +
|
|
|
+ '</div>';
|
|
|
+ }
|
|
|
+ },
|
|
|
{field: 'province.name', title: __('Province')},
|
|
|
{field: 'city.name', title: __('City')},
|
|
|
{field: 'area.name', title: __('Area')},
|
|
|
{field: 'receiver', title: __('Receiver'), operate: 'LIKE'},
|
|
|
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
|
|
|
{field: 'address', title: __('Address'), operate: 'LIKE'},
|
|
|
- {field: 'zipcode', title: __('Zipcode'), operate: 'LIKE', visible: false},
|
|
|
- {field: 'usednums', title: __('Usednums')},
|
|
|
+ // {field: 'zipcode', title: __('Zipcode'), operate: 'LIKE', visible: false},
|
|
|
+ {field: 'used_nums', title: __('Usednums')},
|
|
|
{field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
|
|
|
{field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
|
|
|
- {field: 'isdefault', title: __('Isdefault'), searchList: {"1": __('Yes'), "0": __('No')}, table: table, formatter: Table.api.formatter.toggle},
|
|
|
- {field: 'status', title: __('Status'), operate: 'LIKE', formatter: Table.api.formatter.status},
|
|
|
+ {
|
|
|
+ field: 'is_default',
|
|
|
+ title: __('Isdefault'),
|
|
|
+ searchList: Controller.api.parseConfigJson('isdefaultList'),
|
|
|
+ table: table,
|
|
|
+ formatter: Table.api.formatter.toggle
|
|
|
+ },
|
|
|
+ {field: 'status', title: __('Status'), searchList: Controller.api.parseConfigJson('statusList'), formatter: Table.api.formatter.status},
|
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
|
]
|
|
|
]
|
|
@@ -115,6 +144,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
Controller.api.bindevent();
|
|
|
},
|
|
|
api: {
|
|
|
+ // 解析Config中的JSON字符串的辅助函数
|
|
|
+ parseConfigJson: function(configKey, defaultValue) {
|
|
|
+ var configValue = Config[configKey] || defaultValue || {};
|
|
|
+
|
|
|
+ // 如果是字符串,尝试解析JSON
|
|
|
+ if (typeof configValue === 'string') {
|
|
|
+ try {
|
|
|
+ return JSON.parse(configValue);
|
|
|
+ } catch (e) {
|
|
|
+ return defaultValue || {};
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return configValue;
|
|
|
+ },
|
|
|
bindevent: function () {
|
|
|
Form.api.bindevent($("form[role=form]"));
|
|
|
}
|