|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoregoods'], function ($, undefined, Backend, Table, Form,Template,litestoregoods) {
|
|
|
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'litestoregoods'], function ($, undefined, Backend, Table, Form, Template, litestoregoods) {
|
|
|
|
|
|
var Controller = {
|
|
|
index: function () {
|
|
|
$(".btn-add").data("area", ["1000px","800px"]);
|
|
|
$(".btn-add").data("area", ["1000px", "800px"]);
|
|
|
// 初始化表格参数配置
|
|
|
Table.api.init({
|
|
|
extend: {
|
...
|
...
|
@@ -22,51 +22,120 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg |
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
pk: 'goods_id',
|
|
|
sortName: 'goods_sort',
|
|
|
search:false,
|
|
|
showExport:false,
|
|
|
search: false,
|
|
|
showExport: false,
|
|
|
columns: [
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
{field: 'goods_id', title: __('Goods_id')},
|
|
|
{field: 'goods_name', title: __('Goods_name'),operate: 'LIKE'},
|
|
|
{field: 'keywords', title: __('Keywords'),operate: 'LIKE'},
|
|
|
{field: 'category.name', title: __('Category.name'),operate: false},
|
|
|
{field: 'activity.name', title: __('Activity.name'),operate: false},
|
|
|
{field: 'category_id', visible:false,title: __('Category_id')},
|
|
|
{field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'},
|
|
|
{field: 'keywords', title: __('Keywords'), operate: 'LIKE'},
|
|
|
{field: 'category.name', title: __('Category.name'), operate: false},
|
|
|
{field: 'activity.name', title: __('Activity.name'), operate: false},
|
|
|
{field: 'category_id', visible: false, title: __('Category_id')},
|
|
|
{field: 'image', title: __('Image'), formatter: Table.api.formatter.image},
|
|
|
{field: 'images', title: __('Images'), formatter: Table.api.formatter.images},
|
|
|
{field: 'spec_type', title: __('Spec_type'), searchList: {"10":__('Spec_type 10'),"20":__('Spec_type 20')}, formatter: Table.api.formatter.normal},
|
|
|
{field: 'stock_num', title: __('库存'),operate: false},
|
|
|
{
|
|
|
field: 'spec_type',
|
|
|
title: __('Spec_type'),
|
|
|
searchList: {"10": __('Spec_type 10'), "20": __('Spec_type 20')},
|
|
|
formatter: Table.api.formatter.normal
|
|
|
},
|
|
|
{field: 'stock_num', title: __('库存'), operate: false},
|
|
|
// {field: 'deduct_stock_type', title: __('Deduct_stock_type'), searchList: {"10":__('Deduct_stock_type 10'),"20":__('Deduct_stock_type 20')}, formatter: Table.api.formatter.normal},
|
|
|
// {field: 'freight.name', title: __('Freight.name')},
|
|
|
// {field: 'sales_initial', title: __('Sales_initial')},
|
|
|
{field: 'sales_actual', title: __('Sales_actual')},
|
|
|
// {field: 'goods_sort', title: __('Goods_sort')},
|
|
|
// {field: 'delivery_id', title: __('Delivery_id')},
|
|
|
{field: 'goods_status', title: __('Goods_status'), searchList: {"10":__('Goods_status 10'),"20":__('Goods_status 20')}, formatter: Table.api.formatter.status},
|
|
|
{field: 'is_delete', title: __('Is_delete'), searchList: {"0":__('Is_delete 0'),"1":__('Is_delete 1')}, formatter: Table.api.formatter.normal},
|
|
|
{field: 'is_index', title: __('Is_index'), searchList: {"0":__('Is_index 0'),"1":__('Is_index 1')}, formatter: Table.api.formatter.normal},
|
|
|
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
|
|
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
|
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
|
{
|
|
|
field: 'goods_status',
|
|
|
title: __('Goods_status'),
|
|
|
searchList: {"10": __('Goods_status 10'), "20": __('Goods_status 20')},
|
|
|
formatter: Table.api.formatter.status
|
|
|
},
|
|
|
{
|
|
|
field: 'is_delete',
|
|
|
title: __('Is_delete'),
|
|
|
searchList: {"0": __('Is_delete 0'), "1": __('Is_delete 1')},
|
|
|
formatter: Table.api.formatter.normal
|
|
|
},
|
|
|
{
|
|
|
field: 'is_index',
|
|
|
title: __('Is_index'),
|
|
|
searchList: {"0": __('Is_index 0'), "1": __('Is_index 1')},
|
|
|
formatter: Table.api.formatter.normal
|
|
|
},
|
|
|
{
|
|
|
field: 'createtime',
|
|
|
title: __('Createtime'),
|
|
|
operate: 'RANGE',
|
|
|
addclass: 'datetimerange',
|
|
|
formatter: Table.api.formatter.datetime
|
|
|
},
|
|
|
{
|
|
|
field: 'updatetime',
|
|
|
title: __('Updatetime'),
|
|
|
operate: 'RANGE',
|
|
|
addclass: 'datetimerange',
|
|
|
formatter: Table.api.formatter.datetime
|
|
|
},
|
|
|
{
|
|
|
field: 'operate',
|
|
|
title: __('Operate'),
|
|
|
table: table,
|
|
|
events: Table.api.events.operate,
|
|
|
formatter: Table.api.formatter.operate
|
|
|
}
|
|
|
]
|
|
|
]
|
|
|
});
|
|
|
|
|
|
// 为表格绑定事件
|
|
|
Table.api.bindevent(table);
|
|
|
table.on('load-success.bs.table',function(data){
|
|
|
$(".btn-editone").data("area", ["1000px","800px"]);
|
|
|
|
|
|
$('.btn-sync').click(function () {
|
|
|
var index = Layer.load();
|
|
|
$.ajax({
|
|
|
// type: "POST",
|
|
|
url: $.fn.bootstrapTable.defaults.extend.performTask,
|
|
|
confirm: '确认开始执行任务吗?(数据导出属高IO操作,若本任务数据量超过2万,请择服务器相对闲时执行!)',
|
|
|
refresh: true,
|
|
|
// url: "fastexport/zdyTask",
|
|
|
datatype: "json",
|
|
|
success: function (data, ret) {
|
|
|
if (ret.code == 1) {
|
|
|
if (data.direct_export) {
|
|
|
Fast.api.msg('任务已开始,请稍等片刻...')
|
|
|
window.location = 'fastexport/zdyTask';
|
|
|
} else {
|
|
|
window.open("fastexport/taskControl/task_id/" + data.id, "_blank");
|
|
|
}
|
|
|
} else {
|
|
|
Layer.alert(ret.msg);
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
},
|
|
|
error: function (data, ret) {
|
|
|
Layer.alert(ret.msg);
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
table.on('load-success.bs.table', function (data) {
|
|
|
$(".btn-editone").data("area", ["1000px", "800px"]);
|
|
|
});
|
|
|
|
|
|
},
|
|
|
add: function () {
|
|
|
Form.api.bindevent($("form[role=form]"), function(data, ret){
|
|
|
Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
|
|
Fast.api.close(data);
|
|
|
Toastr.success("商品提交成功");
|
|
|
}, function(data, ret){
|
|
|
}, function (data, ret) {
|
|
|
Toastr.success("商品提交失败");
|
|
|
}, function(success, error){
|
|
|
}, function (success, error) {
|
|
|
//注意如果我们需要阻止表单,可以在此使用return false;即可
|
|
|
//如果我们处理完成需要再次提交表单则可以使用submit提交,如下
|
|
|
console.log(this);
|
...
|
...
|
@@ -104,7 +173,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg |
|
|
if (token) {
|
|
|
$("input[name='__token__']", form).val(token);
|
|
|
}
|
|
|
if(xhr.responseJSON.code == 1){
|
|
|
if (xhr.responseJSON.code == 1) {
|
|
|
//关闭弹窗
|
|
|
var index = parent.Layer.getFrameIndex(window.name);
|
|
|
var callback = parent.$("#layui-layer" + index).data("callback");
|
...
|
...
|
@@ -134,7 +203,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg |
|
|
// 注册商品多规格组件
|
|
|
var specMany = new GoodsSpec({
|
|
|
container: '.goods-spec-many',
|
|
|
OutForm:Form
|
|
|
OutForm: Form
|
|
|
});
|
|
|
|
|
|
// 切换单/多规格
|
...
|
...
|
@@ -153,12 +222,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg |
|
|
edit: function () {
|
|
|
//Controller.api.bindevent();
|
|
|
|
|
|
Form.api.bindevent($("form[role=form]"), function(data, ret){
|
|
|
Form.api.bindevent($("form[role=form]"), function (data, ret) {
|
|
|
//Fast.api.close(data);
|
|
|
Toastr.success("商品提交成功");
|
|
|
}, function(data, ret){
|
|
|
}, function (data, ret) {
|
|
|
Toastr.success("商品提交失败");
|
|
|
}, function(success, error){
|
|
|
}, function (success, error) {
|
|
|
//注意如果我们需要阻止表单,可以在此使用return false;即可
|
|
|
//如果我们处理完成需要再次提交表单则可以使用submit提交,如下
|
|
|
console.log(this);
|
...
|
...
|
@@ -196,7 +265,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg |
|
|
if (token) {
|
|
|
$("input[name='__token__']", form).val(token);
|
|
|
}
|
|
|
if(xhr.responseJSON.code == 1){
|
|
|
if (xhr.responseJSON.code == 1) {
|
|
|
//关闭弹窗
|
|
|
var index = parent.Layer.getFrameIndex(window.name);
|
|
|
var callback = parent.$("#layui-layer" + index).data("callback");
|
...
|
...
|
@@ -225,7 +294,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','template','litestoreg |
|
|
// 注册商品多规格组件
|
|
|
var specMany = new GoodsSpec({
|
|
|
container: '.goods-spec-many',
|
|
|
OutForm:Form
|
|
|
OutForm: Form
|
|
|
}, from_specData);
|
|
|
|
|
|
// 切换单/多规格
|
...
|
...
|
|