mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-11-04 19:38:21 +08:00
78 lines
3.7 KiB
PHP
78 lines
3.7 KiB
PHP
$(function () {
|
||
|
||
|
||
ua.table.render({
|
||
init: init,
|
||
totalRow: true,
|
||
// 多形态视图:table + 商品卡(Vue 自定义模板)+ 内置 card 三形态,
|
||
// 参照用户管理页官方示例(system/admin)。tplVueId 指向 index.html 中的
|
||
// <script type="text/x-template" id="goodscardTpl"> 节点(须位于渲染容器
|
||
// 之外),模板上下文契约见该节点处注释。layoutList 条目 >1 时工具栏自动
|
||
// 出现"视图"切换按钮;受控是默认数据流,controlled 缺省即受控,视图切换
|
||
// 经 store 当页数据完成,零网络请求。
|
||
layoutList: ['table', {name: 'goodscard', title: '商品', tplVueId: '#goodscardTpl'}, 'card'],
|
||
// 默认形态:字符串旧写法,双端同值(PC 与手机默认均为商品模板)
|
||
layoutDefault: 'goodscard',
|
||
cols: [[
|
||
{ type: "checkbox" },
|
||
{ field: 'id', width: 80, title: 'ID', totalRowText: '合计:' },
|
||
{ field: 'sort', width: 80, title: '排序', edit: 'text' },
|
||
{ field: 'cate_id', minWidth: 80, title: '商品分类', selectList: ua.getDataBrage('select_list_cate'), selectValue: 'id', selectLabel: 'title', defaultSearchValue: ua.getQueryVariable('cate_id', '') },
|
||
{ field: 'cate.image', minWidth: 80, title: '分类图片', search: false, templet: ua.table.image },
|
||
{ field: 'title', minWidth: 80, title: '商品名称', },
|
||
{ field: 'logo', minWidth: 80, title: '商品图片', search: false, templet: ua.table.image },
|
||
{ field: 'market_price', width: 100, title: '市场价', templet: ua.table.price },
|
||
{
|
||
field: 'discount_price', width: 120, title: '折扣价', templet: ua.table.price, totalRow: true,
|
||
templet: ua.table.copyText,
|
||
valueParser(value) {
|
||
return '¥' + value;
|
||
},
|
||
copyText(value, data) {
|
||
return data.discount_price;
|
||
}
|
||
},
|
||
{ field: 'total_stock', width: 100, title: '库存统计', totalRow: '{{= parseInt(d.TOTAL_NUMS) }} 个' },
|
||
{
|
||
field: 'stock',
|
||
width: 100,
|
||
title: '剩余库存',
|
||
valueParser(value, data) {
|
||
if (value >= 20) {
|
||
return value;
|
||
}
|
||
return value + '(缺货)';
|
||
}
|
||
},
|
||
{ field: 'virtual_sales', width: 100, title: '虚拟销量' },
|
||
{ field: 'sales', width: 80, title: '销量' },
|
||
{ field: 'status', title: '状态', width: 85, selectList: { 0: '禁用', 1: '启用' }, templet: ua.table.switch },
|
||
{ field: 'create_time', minWidth: 80, title: '创建时间', search: 'range' },
|
||
{
|
||
width: 250,
|
||
title: '操作',
|
||
templet: ua.table.tool,
|
||
fixed: 'right',
|
||
operat: [
|
||
'edit',
|
||
[{
|
||
text: '入库',
|
||
url: init.stock_url,
|
||
method: 'open',
|
||
auth: 'stock',
|
||
class: 'layui-btn layui-btn-xs layui-btn-normal',
|
||
}, {
|
||
text: '详情',
|
||
url: init.read_url,
|
||
method: 'open',
|
||
auth: 'edit',
|
||
extend: 'data-full="true"',
|
||
class: 'layui-btn layui-btn-xs layui-btn-primary',
|
||
},],
|
||
'delete']
|
||
}
|
||
]],
|
||
});
|
||
|
||
ua.listen();
|
||
}); |