切换导航条
此项目
正在载入...
登录
李忠强
/
temporaryfood
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
SHW\戥岁。。
3 years ago
提交
a55664bff11f2044cc4c87716e9701b7c9d264f2
1 个父辈
9147c54f
master
折扣变化
隐藏空白字符变更
内嵌
并排对比
正在显示
26 个修改的文件
包含
4792 行增加
和
26 行删除
application/admin/controller/activity_goods/ImportGoods.php
application/admin/controller/activity_goods/NewGoods.php
application/admin/controller/activity_goods/SeckillGoods.php
application/admin/controller/litestore/Litestoregoods.php
application/admin/lang/zh-cn/activity_goods/import_goods.php
application/admin/lang/zh-cn/activity_goods/new_goods.php
application/admin/lang/zh-cn/activity_goods/seckill_goods.php
application/admin/model/litestore/Litestoregoods.php
application/admin/model/litestore/Litestoregoodsspec.php
application/admin/view/activity_goods/import_goods/add.html
application/admin/view/activity_goods/import_goods/edit.html
application/admin/view/activity_goods/import_goods/index.html
application/admin/view/activity_goods/import_goods/spec_many_template.html
application/admin/view/activity_goods/new_goods/add.html
application/admin/view/activity_goods/new_goods/edit.html
application/admin/view/activity_goods/new_goods/index.html
application/admin/view/activity_goods/new_goods/spec_many_template.html
application/admin/view/activity_goods/seckill_goods/add.html
application/admin/view/activity_goods/seckill_goods/edit.html
application/admin/view/activity_goods/seckill_goods/index.html
application/admin/view/activity_goods/seckill_goods/spec_many_template.html
application/admin/view/litestore/litestoregoods/index.html
application/api/controller/Classification.php
application/api/controller/Goods.php
public/assets/js/backend/activity_goods/import_goods.js
public/assets/js/backend/activity_goods/new_goods.js
要显示太多修改。
重新载入完整差异
差异文件
邮件补丁
为保证性能只显示
26 of 26+
个文件。
application/admin/controller/activity_goods/ImportGoods.php
0 → 100644
查看文件 @
a55664b
<?php
namespace
app\admin\controller\activity_goods
;
use
app\admin\model\litestore\Litestoregoodsspec
;
use
app\common\controller\Backend
;
use
app\admin\model\litestore\Litestorespec
as
SpecModel
;
use
app\admin\model\litestore\Litestorespecvalue
as
SpecValueModel
;
use
PhpOffice\PhpSpreadsheet\Cell\Coordinate
;
use
PhpOffice\PhpSpreadsheet\Reader\Csv
;
use
PhpOffice\PhpSpreadsheet\Reader\Xls
;
use
PhpOffice\PhpSpreadsheet\Reader\Xlsx
;
use
think\Db
;
use
think\exception\PDOException
;
/**
*
*
* @icon fa fa-circle-o
*/
class
ImportGoods
extends
Backend
{
private
$SpecModel
;
private
$SpecValueModel
;
/**
* Litestoregoods模型对象
* @var \app\admin\model\litestore\Litestoregoods
*/
protected
$model
=
null
;
protected
$spec_model
=
null
;
// protected $searchFields = 'category.name';
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
SpecModel
=
new
SpecModel
;
$this
->
SpecValueModel
=
new
SpecValueModel
;
$this
->
model
=
new
\app\admin\model\litestore\Litestoregoods
;
$this
->
spec_model
=
new
\app\admin\model\litestore\Litestoregoodsspec
();
$this
->
view
->
assign
(
"specTypeList"
,
$this
->
model
->
getSpecTypeList
());
$this
->
view
->
assign
(
"deductStockTypeList"
,
$this
->
model
->
getDeductStockTypeList
());
$this
->
view
->
assign
(
"goodsStatusList"
,
$this
->
model
->
getGoodsStatusList
());
$this
->
view
->
assign
(
"isDeleteList"
,
$this
->
model
->
getIsDeleteList
());
$this
->
view
->
assign
(
"makeforList"
,
$this
->
model
->
getMakeforList
());
$this
->
view
->
assign
(
"isIndexList"
,
$this
->
model
->
getIsIndexList
());
$this
->
view
->
assign
(
"spec_attr"
,
''
);
$this
->
view
->
assign
(
"spec_list"
,
''
);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public
function
index
()
{
//当前是否为关联查询
$this
->
relationSearch
=
true
;
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
(
"category.name"
,
true
);
$total
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
->
where
(
'activity_id'
,
3
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
->
where
(
'activity_id'
,
3
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
foreach
(
$list
as
$row
)
{
$row
->
getRelation
(
'category'
)
->
visible
([
'name'
]);
$row
->
getRelation
(
'activity'
)
->
visible
([
'name'
]);
// $row->getRelation('freight')->visible(['name']);
$row
->
stock_num
=
Litestoregoodsspec
::
where
(
'goods_id'
,
$row
[
'goods_id'
])
->
sum
(
'stock_num'
);
}
$list
=
collection
(
$list
)
->
toArray
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
$this
->
assign
(
'template'
,
$this
->
request
->
domain
()
.
'/static/template/商品导入模板.xlsx'
);
return
$this
->
view
->
fetch
();
}
public
function
addSpec
(
$spec_name
,
$spec_value
)
{
// 判断规格组是否存在
if
(
!
$specId
=
$this
->
SpecModel
->
getSpecIdByName
(
$spec_name
))
{
// 新增规格组and规则值
if
(
$this
->
SpecModel
->
add
(
$spec_name
)
&&
$this
->
SpecValueModel
->
add
(
$this
->
SpecModel
[
'id'
],
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$this
->
SpecModel
[
'id'
],
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
//return ;
// 判断规格值是否存在
if
(
$specValueId
=
$this
->
SpecValueModel
->
getSpecValueIdByName
(
$specId
,
$spec_value
))
{
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$specId
,
'spec_value_id'
=>
(
int
)
$specValueId
,
]);
}
// 添加规则值
if
(
$this
->
SpecValueModel
->
add
(
$specId
,
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$specId
,
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
/**
* 添加规格值
*/
public
function
addSpecValue
(
$spec_id
,
$spec_value
)
{
// 判断规格值是否存在
if
(
$specValueId
=
$this
->
SpecValueModel
->
getSpecValueIdByName
(
$spec_id
,
$spec_value
))
{
return
$this
->
success
(
''
,
''
,
[
'spec_value_id'
=>
(
int
)
$specValueId
,
]);
}
// 添加规则值
if
(
$this
->
SpecValueModel
->
add
(
$spec_id
,
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
if
(
$params
[
'spec_type'
]
==
'20'
&&
!
$this
->
request
->
post
(
"spec_many/a"
))
{
$this
->
error
(
'请添加规格'
);
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
true
)
:
$this
->
modelValidate
;
$this
->
model
->
validate
(
$validate
);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
//成功之后 存储商品规格
$spec_many_params
=
$this
->
request
->
post
(
"spec_many/a"
);
$this
->
model
->
addGoodsSpec
(
$params
,
$spec_many_params
,
$this
->
request
->
post
(
"spec/a"
));
$this
->
success
();
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
catch
(
\think\Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$list
=
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
)
->
select
();
$count
=
0
;
foreach
(
$list
as
$k
=>
$v
)
{
// 删除商品sku
$v
->
removesku
();
$count
+=
$v
->
delete
();
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
NULL
)
{
$row
=
$this
->
model
->
get
(
$ids
,
[
'specRel'
,
'spec'
,
'spec_rel.spec'
]);
if
(
!
$row
)
$this
->
error
(
__
(
'No Results were found'
));
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
if
(
$params
[
'spec_type'
]
==
'20'
&&
!
$this
->
request
->
post
(
"spec_many/a"
))
{
$this
->
error
(
'请添加规格'
);
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
true
)
:
$this
->
modelValidate
;
$row
->
validate
(
$validate
);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
//成功之后 存储商品规格
$spec_many_params
=
$this
->
request
->
post
(
"spec_many/a"
);
$row
->
addGoodsSpec
(
$params
,
$spec_many_params
,
$this
->
request
->
post
(
"spec/a"
),
true
);
// 删除购物车
Db
::
name
(
'cart'
)
->
where
(
'goods_id'
,
$row
->
goods_id
)
->
delete
();
//删除我常买
Db
::
name
(
'user_buylist'
)
->
where
(
'goods_id'
,
$row
->
goods_id
)
->
delete
();
$this
->
success
();
}
else
{
$this
->
error
(
$row
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
catch
(
\think\Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
// 多规格信息
$specData
=
'null'
;
if
(
$row
[
'spec_type'
]
===
'20'
)
{
$specData
=
json_encode
(
$this
->
model
->
getManySpecData
(
$row
[
'spec_rel'
],
$row
[
'spec'
]));
}
$row
[
'specData'
]
=
$specData
;
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
/**
* 导出
*/
public
function
export
()
{
//1.从数据库中导出需要进行要导出的数据
$list
=
Db
::
name
(
'litestore_goods_spec'
)
->
alias
(
'c'
)
->
join
(
'fa_litestore_goods g'
,
'g.goods_id = c.goods_id'
,
'LEFT'
)
->
select
();
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
&
$item
)
{
$item
[
'category_name'
]
=
Db
::
name
(
'litestore_category'
)
->
where
(
'id'
,
$item
[
'category_id'
])
->
value
(
'name'
);
if
(
!
empty
(
$item
[
'spec_sku_id'
]))
{
$sku_value
=
explode
(
'_'
,
$item
[
'spec_sku_id'
]);
if
(
count
(
$sku_value
)
>
1
)
{
$key
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
0
])
->
value
(
'spec_value'
);
$value
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
1
])
->
value
(
'spec_value'
);
$item
[
'sku_value'
]
=
$key
.
'_'
.
$value
;
}
else
{
$key
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
0
])
->
value
(
'spec_value'
);
$item
[
'sku_value'
]
=
$key
;
}
}
else
{
$item
[
'sku_value'
]
=
''
;
}
}
if
(
empty
(
$list
))
{
$this
->
error
(
'没有可导出的数据'
);
}
//重要补助
//2.加载PHPExcle类库
vendor
(
'PHPExcel.PHPExcel'
);
//3.实例化PHPExcel类
$objPHPExcel
=
new
\PHPExcel
();
//4.激活当前的sheet表
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//5.设置表格头(即excel表格的第一行)
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
setCellValue
(
'A1'
,
'商品ID'
)
->
setCellValue
(
'B1'
,
'商品名称'
)
->
setCellValue
(
'C1'
,
'搜索关键词'
)
->
setCellValue
(
'D1'
,
'分类名称'
)
->
setCellValue
(
'E1'
,
'活动名称(新人用户=1,限时秒杀=2,进口商品=4)'
)
->
setCellValue
(
'F1'
,
'商品规格(10=单规格,20=多规格)'
)
->
setCellValue
(
'G1'
,
'库存'
)
->
setCellValue
(
'H1'
,
'商品规格'
)
->
setCellValue
(
'I1'
,
'商品原价'
)
->
setCellValue
(
'J1'
,
'折扣'
)
->
setCellValue
(
'K1'
,
'商品现价'
)
->
setCellValue
(
'L1'
,
'已销数量'
)
->
setCellValue
(
'M1'
,
'商品状态(10=上架,20=下架)'
)
->
setCellValue
(
'N1'
,
'首页展示(0=未展示,1=已展示)'
)
->
setCellValue
(
'O1'
,
'导出时间'
);
//设置A列水平居中
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getStyle
(
'A1'
)
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
);
//设置单元格宽度
//6.循环刚取出来的数组,将数据逐一添加到excel表格。
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'A'
)
->
setWidth
(
10
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'B'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'C'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'D'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'E'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'F'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'G'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'H'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'I'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'J'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'K'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'L'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'M'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'N'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'O'
)
->
setWidth
(
20
);
for
(
$i
=
0
;
$i
<
count
(
$list
);
$i
++
)
{
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'A'
.
(
$i
+
2
),
$list
[
$i
][
'goods_id'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'B'
.
(
$i
+
2
),
$list
[
$i
][
'goods_name'
]);
//商品名称
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'C'
.
(
$i
+
2
),
$list
[
$i
][
'keywords'
]);
//商品规格
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'D'
.
(
$i
+
2
),
$list
[
$i
][
'category_name'
]);
//原价
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'E'
.
(
$i
+
2
),
$list
[
$i
][
'activity_id'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'F'
.
(
$i
+
2
),
$list
[
$i
][
'spec_type'
]);
//标签码
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'G'
.
(
$i
+
2
),
$list
[
$i
][
'stock_num'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'H'
.
(
$i
+
2
),
$list
[
$i
][
'sku_value'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'I'
.
(
$i
+
2
),
$list
[
$i
][
'line_price'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'J'
.
(
$i
+
2
),
$list
[
$i
][
'discount'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'K'
.
(
$i
+
2
),
$list
[
$i
][
'goods_price'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'L'
.
(
$i
+
2
),
$list
[
$i
][
'goods_sales'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'M'
.
(
$i
+
2
),
$list
[
$i
][
'goods_status'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'N'
.
(
$i
+
2
),
$list
[
$i
][
'is_index'
]);
//标签码
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'O'
.
(
$i
+
2
),
datetime
(
time
()));
//标签码
}
ob_end_clean
();
ob_start
();
$title
=
'商品列表'
;
header
(
'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
header
(
'Content-Disposition:attachment;filename="'
.
$title
.
'.xlsx"'
);
header
(
'Cache-Control: max-age=0'
);
header
(
'Cache-Control: max-age=1'
);
header
(
'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
);
// Date in the past
header
(
'Last-Modified: '
.
gmdate
(
'D, d M Y H:i:s'
)
.
' GMT'
);
// always modified
header
(
'Cache-Control: cache, must-revalidate'
);
// HTTP/1.1
header
(
'Pragma: public'
);
// HTTP/1.0
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
$objWriter
->
save
(
'php://output'
);
//文件通过浏览器下载
exit
();
}
/**
*导入
*
* */
public
function
import
()
{
$file
=
$this
->
request
->
request
(
'file'
);
if
(
!
$file
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'file'
));
}
$filePath
=
ROOT_PATH
.
DS
.
'public'
.
DS
.
$file
;
if
(
!
is_file
(
$filePath
))
{
$this
->
error
(
__
(
'No results were found'
));
}
//实例化reader
$ext
=
pathinfo
(
$filePath
,
PATHINFO_EXTENSION
);
if
(
!
in_array
(
$ext
,
[
'csv'
,
'xls'
,
'xlsx'
]))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
if
(
$ext
===
'csv'
)
{
$file
=
fopen
(
$filePath
,
'r'
);
$filePath
=
tempnam
(
sys_get_temp_dir
(),
'import_csv'
);
$fp
=
fopen
(
$filePath
,
"w"
);
$n
=
0
;
while
(
$line
=
fgets
(
$file
))
{
$line
=
rtrim
(
$line
,
"
\n\r\0
"
);
$encoding
=
mb_detect_encoding
(
$line
,
[
'utf-8'
,
'gbk'
,
'latin1'
,
'big5'
]);
if
(
$encoding
!=
'utf-8'
)
{
$line
=
mb_convert_encoding
(
$line
,
'utf-8'
,
$encoding
);
}
if
(
$n
==
0
||
preg_match
(
'/^".*"$/'
,
$line
))
{
fwrite
(
$fp
,
$line
.
"
\n
"
);
}
else
{
fwrite
(
$fp
,
'"'
.
str_replace
([
'"'
,
','
],
[
'""'
,
'","'
],
$line
)
.
"
\"\n
"
);
}
$n
++
;
}
fclose
(
$file
)
||
fclose
(
$fp
);
$reader
=
new
Csv
();
}
elseif
(
$ext
===
'xls'
)
{
$reader
=
new
Xls
();
}
else
{
$reader
=
new
Xlsx
();
}
set_time_limit
(
0
);
//加载文件
$insert
=
[];
try
{
if
(
!
$PHPExcel
=
$reader
->
load
(
$filePath
))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
$currentSheet
=
$PHPExcel
->
getSheet
(
0
);
//读取文件中的第一个工作表
$allColumn
=
$currentSheet
->
getHighestDataColumn
();
//取得最大的列号
$allRow
=
$currentSheet
->
getHighestRow
();
//取得一共有多少行
$maxColumnNumber
=
Coordinate
::
columnIndexFromString
(
$allColumn
);
// 一共多少列
for
(
$i
=
2
;
$i
<=
$allRow
;
$i
++
)
{
if
(
!
empty
(
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"A"
.
$i
)
->
getValue
()))
{
$insert
[
$i
][
'goods_name'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"A"
.
$i
)
->
getValue
();
//商品名称
$insert
[
$i
][
'keywords'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"B"
.
$i
)
->
getValue
();
//关键词
$category
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"C"
.
$i
)
->
getValue
()
??
''
;
//类别
$insert
[
$i
][
'category_id'
]
=
Db
::
name
(
'litestore_category'
)
->
where
(
'name'
,
$category
)
->
value
(
'id'
)
??
''
;
$insert
[
$i
][
'activity_id'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"D"
.
$i
)
->
getValue
()
??
''
;
//活动类型
$insert
[
$i
][
'is_index'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"I"
.
$i
)
->
getValue
()
??
''
;
//是否首页
$insert
[
$i
][
'goods_status'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"H"
.
$i
)
->
getValue
()
??
''
;
//商品状态
$spec_insert
[
$i
][
'stock_num'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"E"
.
$i
)
->
getValue
()
??
''
;
//库存
$spec_insert
[
$i
][
'goods_price'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"G"
.
$i
)
->
getValue
()
??
''
;
//现价
$spec_insert
[
$i
][
'line_price'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"F"
.
$i
)
->
getValue
()
??
''
;
//原价
}
}
}
catch
(
\Exception
$exception
)
{
$this
->
error
(
$exception
->
getMessage
());
}
if
(
!
$insert
)
{
$this
->
error
(
__
(
'No rows were updated'
));
}
try
{
$res_goods
=
$this
->
model
->
saveAll
(
$insert
);
foreach
(
$spec_insert
as
$key
=>
&
$v
)
{
$v
[
'goods_id'
]
=
$res_goods
[
$key
][
'goods_id'
];
}
unset
(
$v
);
$this
->
spec_model
->
saveAll
(
$spec_insert
);
}
catch
(
PDOException
$exception
)
{
$msg
=
$exception
->
getMessage
();
if
(
preg_match
(
"/.+Integrity constraint violation: 1062 Duplicate entry '(.+)' for key '(.+)'/is"
,
$msg
,
$matches
))
{
$msg
=
"导入失败,包含【
{
$matches
[
1
]}
】的记录已存在
";
};
$this->error
(
$msg
);
} catch (\Exception
$e
) {
$this->error
(
$e->getMessage
());
}
$this->success
();
}
}
...
...
application/admin/controller/activity_goods/NewGoods.php
0 → 100644
查看文件 @
a55664b
<?php
namespace
app\admin\controller\activity_goods
;
use
app\admin\model\litestore\Litestoregoodsspec
;
use
app\common\controller\Backend
;
use
app\admin\model\litestore\Litestorespec
as
SpecModel
;
use
app\admin\model\litestore\Litestorespecvalue
as
SpecValueModel
;
use
PhpOffice\PhpSpreadsheet\Cell\Coordinate
;
use
PhpOffice\PhpSpreadsheet\Reader\Csv
;
use
PhpOffice\PhpSpreadsheet\Reader\Xls
;
use
PhpOffice\PhpSpreadsheet\Reader\Xlsx
;
use
think\Db
;
use
think\exception\PDOException
;
/**
*
*
* @icon fa fa-circle-o
*/
class
NewGoods
extends
Backend
{
private
$SpecModel
;
private
$SpecValueModel
;
/**
* Litestoregoods模型对象
* @var \app\admin\model\litestore\Litestoregoods
*/
protected
$model
=
null
;
protected
$spec_model
=
null
;
// protected $searchFields = 'category.name';
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
SpecModel
=
new
SpecModel
;
$this
->
SpecValueModel
=
new
SpecValueModel
;
$this
->
model
=
new
\app\admin\model\litestore\Litestoregoods
;
$this
->
spec_model
=
new
\app\admin\model\litestore\Litestoregoodsspec
();
$this
->
view
->
assign
(
"specTypeList"
,
$this
->
model
->
getSpecTypeList
());
$this
->
view
->
assign
(
"deductStockTypeList"
,
$this
->
model
->
getDeductStockTypeList
());
$this
->
view
->
assign
(
"goodsStatusList"
,
$this
->
model
->
getGoodsStatusList
());
$this
->
view
->
assign
(
"isDeleteList"
,
$this
->
model
->
getIsDeleteList
());
$this
->
view
->
assign
(
"makeforList"
,
$this
->
model
->
getMakeforList
());
$this
->
view
->
assign
(
"isIndexList"
,
$this
->
model
->
getIsIndexList
());
$this
->
view
->
assign
(
"spec_attr"
,
''
);
$this
->
view
->
assign
(
"spec_list"
,
''
);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public
function
index
()
{
//当前是否为关联查询
$this
->
relationSearch
=
true
;
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
(
"category.name"
,
true
);
$total
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
->
where
(
'activity_id'
,
1
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
->
where
(
'activity_id'
,
1
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
foreach
(
$list
as
$row
)
{
$row
->
getRelation
(
'category'
)
->
visible
([
'name'
]);
$row
->
getRelation
(
'activity'
)
->
visible
([
'name'
]);
// $row->getRelation('freight')->visible(['name']);
$row
->
stock_num
=
Litestoregoodsspec
::
where
(
'goods_id'
,
$row
[
'goods_id'
])
->
sum
(
'stock_num'
);
}
$list
=
collection
(
$list
)
->
toArray
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
$this
->
assign
(
'template'
,
$this
->
request
->
domain
()
.
'/static/template/商品导入模板.xlsx'
);
return
$this
->
view
->
fetch
();
}
public
function
addSpec
(
$spec_name
,
$spec_value
)
{
// 判断规格组是否存在
if
(
!
$specId
=
$this
->
SpecModel
->
getSpecIdByName
(
$spec_name
))
{
// 新增规格组and规则值
if
(
$this
->
SpecModel
->
add
(
$spec_name
)
&&
$this
->
SpecValueModel
->
add
(
$this
->
SpecModel
[
'id'
],
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$this
->
SpecModel
[
'id'
],
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
//return ;
// 判断规格值是否存在
if
(
$specValueId
=
$this
->
SpecValueModel
->
getSpecValueIdByName
(
$specId
,
$spec_value
))
{
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$specId
,
'spec_value_id'
=>
(
int
)
$specValueId
,
]);
}
// 添加规则值
if
(
$this
->
SpecValueModel
->
add
(
$specId
,
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$specId
,
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
/**
* 添加规格值
*/
public
function
addSpecValue
(
$spec_id
,
$spec_value
)
{
// 判断规格值是否存在
if
(
$specValueId
=
$this
->
SpecValueModel
->
getSpecValueIdByName
(
$spec_id
,
$spec_value
))
{
return
$this
->
success
(
''
,
''
,
[
'spec_value_id'
=>
(
int
)
$specValueId
,
]);
}
// 添加规则值
if
(
$this
->
SpecValueModel
->
add
(
$spec_id
,
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
if
(
$params
[
'spec_type'
]
==
'20'
&&
!
$this
->
request
->
post
(
"spec_many/a"
))
{
$this
->
error
(
'请添加规格'
);
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
true
)
:
$this
->
modelValidate
;
$this
->
model
->
validate
(
$validate
);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
//成功之后 存储商品规格
$spec_many_params
=
$this
->
request
->
post
(
"spec_many/a"
);
$this
->
model
->
addGoodsSpec
(
$params
,
$spec_many_params
,
$this
->
request
->
post
(
"spec/a"
));
$this
->
success
();
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
catch
(
\think\Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$list
=
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
)
->
select
();
$count
=
0
;
foreach
(
$list
as
$k
=>
$v
)
{
// 删除商品sku
$v
->
removesku
();
$count
+=
$v
->
delete
();
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
NULL
)
{
$row
=
$this
->
model
->
get
(
$ids
,
[
'specRel'
,
'spec'
,
'spec_rel.spec'
]);
if
(
!
$row
)
$this
->
error
(
__
(
'No Results were found'
));
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
if
(
$params
[
'spec_type'
]
==
'20'
&&
!
$this
->
request
->
post
(
"spec_many/a"
))
{
$this
->
error
(
'请添加规格'
);
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
true
)
:
$this
->
modelValidate
;
$row
->
validate
(
$validate
);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
//成功之后 存储商品规格
$spec_many_params
=
$this
->
request
->
post
(
"spec_many/a"
);
$row
->
addGoodsSpec
(
$params
,
$spec_many_params
,
$this
->
request
->
post
(
"spec/a"
),
true
);
// 删除购物车
Db
::
name
(
'cart'
)
->
where
(
'goods_id'
,
$row
->
goods_id
)
->
delete
();
//删除我常买
Db
::
name
(
'user_buylist'
)
->
where
(
'goods_id'
,
$row
->
goods_id
)
->
delete
();
$this
->
success
();
}
else
{
$this
->
error
(
$row
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
catch
(
\think\Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
// 多规格信息
$specData
=
'null'
;
if
(
$row
[
'spec_type'
]
===
'20'
)
{
$specData
=
json_encode
(
$this
->
model
->
getManySpecData
(
$row
[
'spec_rel'
],
$row
[
'spec'
]));
}
$row
[
'specData'
]
=
$specData
;
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
/**
* 导出
*/
public
function
export
()
{
//1.从数据库中导出需要进行要导出的数据
$list
=
Db
::
name
(
'litestore_goods_spec'
)
->
alias
(
'c'
)
->
join
(
'fa_litestore_goods g'
,
'g.goods_id = c.goods_id'
,
'LEFT'
)
->
select
();
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
&
$item
)
{
$item
[
'category_name'
]
=
Db
::
name
(
'litestore_category'
)
->
where
(
'id'
,
$item
[
'category_id'
])
->
value
(
'name'
);
if
(
!
empty
(
$item
[
'spec_sku_id'
]))
{
$sku_value
=
explode
(
'_'
,
$item
[
'spec_sku_id'
]);
if
(
count
(
$sku_value
)
>
1
)
{
$key
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
0
])
->
value
(
'spec_value'
);
$value
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
1
])
->
value
(
'spec_value'
);
$item
[
'sku_value'
]
=
$key
.
'_'
.
$value
;
}
else
{
$key
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
0
])
->
value
(
'spec_value'
);
$item
[
'sku_value'
]
=
$key
;
}
}
else
{
$item
[
'sku_value'
]
=
''
;
}
}
if
(
empty
(
$list
))
{
$this
->
error
(
'没有可导出的数据'
);
}
//重要补助
//2.加载PHPExcle类库
vendor
(
'PHPExcel.PHPExcel'
);
//3.实例化PHPExcel类
$objPHPExcel
=
new
\PHPExcel
();
//4.激活当前的sheet表
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//5.设置表格头(即excel表格的第一行)
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
setCellValue
(
'A1'
,
'商品ID'
)
->
setCellValue
(
'B1'
,
'商品名称'
)
->
setCellValue
(
'C1'
,
'搜索关键词'
)
->
setCellValue
(
'D1'
,
'分类名称'
)
->
setCellValue
(
'E1'
,
'活动名称(新人用户=1,限时秒杀=2,进口商品=4)'
)
->
setCellValue
(
'F1'
,
'商品规格(10=单规格,20=多规格)'
)
->
setCellValue
(
'G1'
,
'库存'
)
->
setCellValue
(
'H1'
,
'商品规格'
)
->
setCellValue
(
'I1'
,
'商品原价'
)
->
setCellValue
(
'J1'
,
'折扣'
)
->
setCellValue
(
'K1'
,
'商品现价'
)
->
setCellValue
(
'L1'
,
'已销数量'
)
->
setCellValue
(
'M1'
,
'商品状态(10=上架,20=下架)'
)
->
setCellValue
(
'N1'
,
'首页展示(0=未展示,1=已展示)'
)
->
setCellValue
(
'O1'
,
'导出时间'
);
//设置A列水平居中
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getStyle
(
'A1'
)
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
);
//设置单元格宽度
//6.循环刚取出来的数组,将数据逐一添加到excel表格。
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'A'
)
->
setWidth
(
10
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'B'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'C'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'D'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'E'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'F'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'G'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'H'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'I'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'J'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'K'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'L'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'M'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'N'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'O'
)
->
setWidth
(
20
);
for
(
$i
=
0
;
$i
<
count
(
$list
);
$i
++
)
{
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'A'
.
(
$i
+
2
),
$list
[
$i
][
'goods_id'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'B'
.
(
$i
+
2
),
$list
[
$i
][
'goods_name'
]);
//商品名称
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'C'
.
(
$i
+
2
),
$list
[
$i
][
'keywords'
]);
//商品规格
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'D'
.
(
$i
+
2
),
$list
[
$i
][
'category_name'
]);
//原价
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'E'
.
(
$i
+
2
),
$list
[
$i
][
'activity_id'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'F'
.
(
$i
+
2
),
$list
[
$i
][
'spec_type'
]);
//标签码
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'G'
.
(
$i
+
2
),
$list
[
$i
][
'stock_num'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'H'
.
(
$i
+
2
),
$list
[
$i
][
'sku_value'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'I'
.
(
$i
+
2
),
$list
[
$i
][
'line_price'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'J'
.
(
$i
+
2
),
$list
[
$i
][
'discount'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'K'
.
(
$i
+
2
),
$list
[
$i
][
'goods_price'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'L'
.
(
$i
+
2
),
$list
[
$i
][
'goods_sales'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'M'
.
(
$i
+
2
),
$list
[
$i
][
'goods_status'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'N'
.
(
$i
+
2
),
$list
[
$i
][
'is_index'
]);
//标签码
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'O'
.
(
$i
+
2
),
datetime
(
time
()));
//标签码
}
ob_end_clean
();
ob_start
();
$title
=
'商品列表'
;
header
(
'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
header
(
'Content-Disposition:attachment;filename="'
.
$title
.
'.xlsx"'
);
header
(
'Cache-Control: max-age=0'
);
header
(
'Cache-Control: max-age=1'
);
header
(
'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
);
// Date in the past
header
(
'Last-Modified: '
.
gmdate
(
'D, d M Y H:i:s'
)
.
' GMT'
);
// always modified
header
(
'Cache-Control: cache, must-revalidate'
);
// HTTP/1.1
header
(
'Pragma: public'
);
// HTTP/1.0
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
$objWriter
->
save
(
'php://output'
);
//文件通过浏览器下载
exit
();
}
/**
*导入
*
* */
public
function
import
()
{
$file
=
$this
->
request
->
request
(
'file'
);
if
(
!
$file
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'file'
));
}
$filePath
=
ROOT_PATH
.
DS
.
'public'
.
DS
.
$file
;
if
(
!
is_file
(
$filePath
))
{
$this
->
error
(
__
(
'No results were found'
));
}
//实例化reader
$ext
=
pathinfo
(
$filePath
,
PATHINFO_EXTENSION
);
if
(
!
in_array
(
$ext
,
[
'csv'
,
'xls'
,
'xlsx'
]))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
if
(
$ext
===
'csv'
)
{
$file
=
fopen
(
$filePath
,
'r'
);
$filePath
=
tempnam
(
sys_get_temp_dir
(),
'import_csv'
);
$fp
=
fopen
(
$filePath
,
"w"
);
$n
=
0
;
while
(
$line
=
fgets
(
$file
))
{
$line
=
rtrim
(
$line
,
"
\n\r\0
"
);
$encoding
=
mb_detect_encoding
(
$line
,
[
'utf-8'
,
'gbk'
,
'latin1'
,
'big5'
]);
if
(
$encoding
!=
'utf-8'
)
{
$line
=
mb_convert_encoding
(
$line
,
'utf-8'
,
$encoding
);
}
if
(
$n
==
0
||
preg_match
(
'/^".*"$/'
,
$line
))
{
fwrite
(
$fp
,
$line
.
"
\n
"
);
}
else
{
fwrite
(
$fp
,
'"'
.
str_replace
([
'"'
,
','
],
[
'""'
,
'","'
],
$line
)
.
"
\"\n
"
);
}
$n
++
;
}
fclose
(
$file
)
||
fclose
(
$fp
);
$reader
=
new
Csv
();
}
elseif
(
$ext
===
'xls'
)
{
$reader
=
new
Xls
();
}
else
{
$reader
=
new
Xlsx
();
}
set_time_limit
(
0
);
//加载文件
$insert
=
[];
try
{
if
(
!
$PHPExcel
=
$reader
->
load
(
$filePath
))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
$currentSheet
=
$PHPExcel
->
getSheet
(
0
);
//读取文件中的第一个工作表
$allColumn
=
$currentSheet
->
getHighestDataColumn
();
//取得最大的列号
$allRow
=
$currentSheet
->
getHighestRow
();
//取得一共有多少行
$maxColumnNumber
=
Coordinate
::
columnIndexFromString
(
$allColumn
);
// 一共多少列
for
(
$i
=
2
;
$i
<=
$allRow
;
$i
++
)
{
if
(
!
empty
(
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"A"
.
$i
)
->
getValue
()))
{
$insert
[
$i
][
'goods_name'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"A"
.
$i
)
->
getValue
();
//商品名称
$insert
[
$i
][
'keywords'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"B"
.
$i
)
->
getValue
();
//关键词
$category
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"C"
.
$i
)
->
getValue
()
??
''
;
//类别
$insert
[
$i
][
'category_id'
]
=
Db
::
name
(
'litestore_category'
)
->
where
(
'name'
,
$category
)
->
value
(
'id'
)
??
''
;
$insert
[
$i
][
'activity_id'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"D"
.
$i
)
->
getValue
()
??
''
;
//活动类型
$insert
[
$i
][
'is_index'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"I"
.
$i
)
->
getValue
()
??
''
;
//是否首页
$insert
[
$i
][
'goods_status'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"H"
.
$i
)
->
getValue
()
??
''
;
//商品状态
$spec_insert
[
$i
][
'stock_num'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"E"
.
$i
)
->
getValue
()
??
''
;
//库存
$spec_insert
[
$i
][
'goods_price'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"G"
.
$i
)
->
getValue
()
??
''
;
//现价
$spec_insert
[
$i
][
'line_price'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"F"
.
$i
)
->
getValue
()
??
''
;
//原价
}
}
}
catch
(
\Exception
$exception
)
{
$this
->
error
(
$exception
->
getMessage
());
}
if
(
!
$insert
)
{
$this
->
error
(
__
(
'No rows were updated'
));
}
try
{
$res_goods
=
$this
->
model
->
saveAll
(
$insert
);
foreach
(
$spec_insert
as
$key
=>
&
$v
)
{
$v
[
'goods_id'
]
=
$res_goods
[
$key
][
'goods_id'
];
}
unset
(
$v
);
$this
->
spec_model
->
saveAll
(
$spec_insert
);
}
catch
(
PDOException
$exception
)
{
$msg
=
$exception
->
getMessage
();
if
(
preg_match
(
"/.+Integrity constraint violation: 1062 Duplicate entry '(.+)' for key '(.+)'/is"
,
$msg
,
$matches
))
{
$msg
=
"导入失败,包含【
{
$matches
[
1
]}
】的记录已存在
";
};
$this->error
(
$msg
);
} catch (\Exception
$e
) {
$this->error
(
$e->getMessage
());
}
$this->success
();
}
}
...
...
application/admin/controller/activity_goods/SeckillGoods.php
0 → 100644
查看文件 @
a55664b
<?php
namespace
app\admin\controller\activity_goods
;
use
app\admin\model\litestore\Litestoregoodsspec
;
use
app\common\controller\Backend
;
use
app\admin\model\litestore\Litestorespec
as
SpecModel
;
use
app\admin\model\litestore\Litestorespecvalue
as
SpecValueModel
;
use
PhpOffice\PhpSpreadsheet\Cell\Coordinate
;
use
PhpOffice\PhpSpreadsheet\Reader\Csv
;
use
PhpOffice\PhpSpreadsheet\Reader\Xls
;
use
PhpOffice\PhpSpreadsheet\Reader\Xlsx
;
use
think\Db
;
use
think\exception\PDOException
;
/**
*
*
* @icon fa fa-circle-o
*/
class
SeckillGoods
extends
Backend
{
private
$SpecModel
;
private
$SpecValueModel
;
/**
* Litestoregoods模型对象
* @var \app\admin\model\litestore\Litestoregoods
*/
protected
$model
=
null
;
protected
$spec_model
=
null
;
// protected $searchFields = 'category.name';
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
SpecModel
=
new
SpecModel
;
$this
->
SpecValueModel
=
new
SpecValueModel
;
$this
->
model
=
new
\app\admin\model\litestore\Litestoregoods
;
$this
->
spec_model
=
new
\app\admin\model\litestore\Litestoregoodsspec
();
$this
->
view
->
assign
(
"specTypeList"
,
$this
->
model
->
getSpecTypeList
());
$this
->
view
->
assign
(
"deductStockTypeList"
,
$this
->
model
->
getDeductStockTypeList
());
$this
->
view
->
assign
(
"goodsStatusList"
,
$this
->
model
->
getGoodsStatusList
());
$this
->
view
->
assign
(
"isDeleteList"
,
$this
->
model
->
getIsDeleteList
());
$this
->
view
->
assign
(
"makeforList"
,
$this
->
model
->
getMakeforList
());
$this
->
view
->
assign
(
"isIndexList"
,
$this
->
model
->
getIsIndexList
());
$this
->
view
->
assign
(
"spec_attr"
,
''
);
$this
->
view
->
assign
(
"spec_list"
,
''
);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public
function
index
()
{
//当前是否为关联查询
$this
->
relationSearch
=
true
;
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
(
"category.name"
,
true
);
$total
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
->
where
(
'activity_id'
,
2
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
->
where
(
'activity_id'
,
2
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
foreach
(
$list
as
$row
)
{
$row
->
getRelation
(
'category'
)
->
visible
([
'name'
]);
$row
->
getRelation
(
'activity'
)
->
visible
([
'name'
]);
// $row->getRelation('freight')->visible(['name']);
$row
->
stock_num
=
Litestoregoodsspec
::
where
(
'goods_id'
,
$row
[
'goods_id'
])
->
sum
(
'stock_num'
);
}
$list
=
collection
(
$list
)
->
toArray
();
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
$this
->
assign
(
'template'
,
$this
->
request
->
domain
()
.
'/static/template/商品导入模板.xlsx'
);
return
$this
->
view
->
fetch
();
}
public
function
addSpec
(
$spec_name
,
$spec_value
)
{
// 判断规格组是否存在
if
(
!
$specId
=
$this
->
SpecModel
->
getSpecIdByName
(
$spec_name
))
{
// 新增规格组and规则值
if
(
$this
->
SpecModel
->
add
(
$spec_name
)
&&
$this
->
SpecValueModel
->
add
(
$this
->
SpecModel
[
'id'
],
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$this
->
SpecModel
[
'id'
],
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
//return ;
// 判断规格值是否存在
if
(
$specValueId
=
$this
->
SpecValueModel
->
getSpecValueIdByName
(
$specId
,
$spec_value
))
{
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$specId
,
'spec_value_id'
=>
(
int
)
$specValueId
,
]);
}
// 添加规则值
if
(
$this
->
SpecValueModel
->
add
(
$specId
,
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_id'
=>
(
int
)
$specId
,
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
/**
* 添加规格值
*/
public
function
addSpecValue
(
$spec_id
,
$spec_value
)
{
// 判断规格值是否存在
if
(
$specValueId
=
$this
->
SpecValueModel
->
getSpecValueIdByName
(
$spec_id
,
$spec_value
))
{
return
$this
->
success
(
''
,
''
,
[
'spec_value_id'
=>
(
int
)
$specValueId
,
]);
}
// 添加规则值
if
(
$this
->
SpecValueModel
->
add
(
$spec_id
,
$spec_value
))
return
$this
->
success
(
''
,
''
,
[
'spec_value_id'
=>
(
int
)
$this
->
SpecValueModel
[
'id'
],
]);
return
$this
->
error
();
}
/**
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
if
(
$params
[
'spec_type'
]
==
'20'
&&
!
$this
->
request
->
post
(
"spec_many/a"
))
{
$this
->
error
(
'请添加规格'
);
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
true
)
:
$this
->
modelValidate
;
$this
->
model
->
validate
(
$validate
);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
//成功之后 存储商品规格
$spec_many_params
=
$this
->
request
->
post
(
"spec_many/a"
);
$this
->
model
->
addGoodsSpec
(
$params
,
$spec_many_params
,
$this
->
request
->
post
(
"spec/a"
));
$this
->
success
();
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
catch
(
\think\Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
)
{
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$count
=
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$list
=
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
)
->
select
();
$count
=
0
;
foreach
(
$list
as
$k
=>
$v
)
{
// 删除商品sku
$v
->
removesku
();
$count
+=
$v
->
delete
();
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
NULL
)
{
$row
=
$this
->
model
->
get
(
$ids
,
[
'specRel'
,
'spec'
,
'spec_rel.spec'
]);
if
(
!
$row
)
$this
->
error
(
__
(
'No Results were found'
));
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
if
(
$params
[
'spec_type'
]
==
'20'
&&
!
$this
->
request
->
post
(
"spec_many/a"
))
{
$this
->
error
(
'请添加规格'
);
}
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
basename
(
str_replace
(
'\\'
,
'/'
,
get_class
(
$this
->
model
)));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
true
)
:
$this
->
modelValidate
;
$row
->
validate
(
$validate
);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
if
(
$result
!==
false
)
{
//成功之后 存储商品规格
$spec_many_params
=
$this
->
request
->
post
(
"spec_many/a"
);
$row
->
addGoodsSpec
(
$params
,
$spec_many_params
,
$this
->
request
->
post
(
"spec/a"
),
true
);
// 删除购物车
Db
::
name
(
'cart'
)
->
where
(
'goods_id'
,
$row
->
goods_id
)
->
delete
();
//删除我常买
Db
::
name
(
'user_buylist'
)
->
where
(
'goods_id'
,
$row
->
goods_id
)
->
delete
();
$this
->
success
();
}
else
{
$this
->
error
(
$row
->
getError
());
}
}
catch
(
\think\exception\PDOException
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
catch
(
\think\Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
// 多规格信息
$specData
=
'null'
;
if
(
$row
[
'spec_type'
]
===
'20'
)
{
$specData
=
json_encode
(
$this
->
model
->
getManySpecData
(
$row
[
'spec_rel'
],
$row
[
'spec'
]));
}
$row
[
'specData'
]
=
$specData
;
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
/**
* 导出
*/
public
function
export
()
{
//1.从数据库中导出需要进行要导出的数据
$list
=
Db
::
name
(
'litestore_goods_spec'
)
->
alias
(
'c'
)
->
join
(
'fa_litestore_goods g'
,
'g.goods_id = c.goods_id'
,
'LEFT'
)
->
select
();
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
&
$item
)
{
$item
[
'category_name'
]
=
Db
::
name
(
'litestore_category'
)
->
where
(
'id'
,
$item
[
'category_id'
])
->
value
(
'name'
);
if
(
!
empty
(
$item
[
'spec_sku_id'
]))
{
$sku_value
=
explode
(
'_'
,
$item
[
'spec_sku_id'
]);
if
(
count
(
$sku_value
)
>
1
)
{
$key
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
0
])
->
value
(
'spec_value'
);
$value
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
1
])
->
value
(
'spec_value'
);
$item
[
'sku_value'
]
=
$key
.
'_'
.
$value
;
}
else
{
$key
=
Db
::
name
(
'litestore_spec_value'
)
->
where
(
'id'
,
$sku_value
[
0
])
->
value
(
'spec_value'
);
$item
[
'sku_value'
]
=
$key
;
}
}
else
{
$item
[
'sku_value'
]
=
''
;
}
}
if
(
empty
(
$list
))
{
$this
->
error
(
'没有可导出的数据'
);
}
//重要补助
//2.加载PHPExcle类库
vendor
(
'PHPExcel.PHPExcel'
);
//3.实例化PHPExcel类
$objPHPExcel
=
new
\PHPExcel
();
//4.激活当前的sheet表
$objPHPExcel
->
setActiveSheetIndex
(
0
);
//5.设置表格头(即excel表格的第一行)
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
setCellValue
(
'A1'
,
'商品ID'
)
->
setCellValue
(
'B1'
,
'商品名称'
)
->
setCellValue
(
'C1'
,
'搜索关键词'
)
->
setCellValue
(
'D1'
,
'分类名称'
)
->
setCellValue
(
'E1'
,
'活动名称(新人用户=1,限时秒杀=2,进口商品=4)'
)
->
setCellValue
(
'F1'
,
'商品规格(10=单规格,20=多规格)'
)
->
setCellValue
(
'G1'
,
'库存'
)
->
setCellValue
(
'H1'
,
'商品规格'
)
->
setCellValue
(
'I1'
,
'商品原价'
)
->
setCellValue
(
'J1'
,
'折扣'
)
->
setCellValue
(
'K1'
,
'商品现价'
)
->
setCellValue
(
'L1'
,
'已销数量'
)
->
setCellValue
(
'M1'
,
'商品状态(10=上架,20=下架)'
)
->
setCellValue
(
'N1'
,
'首页展示(0=未展示,1=已展示)'
)
->
setCellValue
(
'O1'
,
'导出时间'
);
//设置A列水平居中
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getStyle
(
'A1'
)
->
getAlignment
()
->
setHorizontal
(
\PHPExcel_Style_Alignment
::
HORIZONTAL_CENTER
);
//设置单元格宽度
//6.循环刚取出来的数组,将数据逐一添加到excel表格。
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'A'
)
->
setWidth
(
10
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'B'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'C'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'D'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'E'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'F'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'G'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'H'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'I'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'J'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'K'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'L'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'M'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'N'
)
->
setWidth
(
20
);
$objPHPExcel
->
setActiveSheetIndex
(
0
)
->
getColumnDimension
(
'O'
)
->
setWidth
(
20
);
for
(
$i
=
0
;
$i
<
count
(
$list
);
$i
++
)
{
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'A'
.
(
$i
+
2
),
$list
[
$i
][
'goods_id'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'B'
.
(
$i
+
2
),
$list
[
$i
][
'goods_name'
]);
//商品名称
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'C'
.
(
$i
+
2
),
$list
[
$i
][
'keywords'
]);
//商品规格
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'D'
.
(
$i
+
2
),
$list
[
$i
][
'category_name'
]);
//原价
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'E'
.
(
$i
+
2
),
$list
[
$i
][
'activity_id'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'F'
.
(
$i
+
2
),
$list
[
$i
][
'spec_type'
]);
//标签码
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'G'
.
(
$i
+
2
),
$list
[
$i
][
'stock_num'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'H'
.
(
$i
+
2
),
$list
[
$i
][
'sku_value'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'I'
.
(
$i
+
2
),
$list
[
$i
][
'line_price'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'J'
.
(
$i
+
2
),
$list
[
$i
][
'discount'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'K'
.
(
$i
+
2
),
$list
[
$i
][
'goods_price'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'L'
.
(
$i
+
2
),
$list
[
$i
][
'goods_sales'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'M'
.
(
$i
+
2
),
$list
[
$i
][
'goods_status'
]);
//ID
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'N'
.
(
$i
+
2
),
$list
[
$i
][
'is_index'
]);
//标签码
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
'O'
.
(
$i
+
2
),
datetime
(
time
()));
//标签码
}
ob_end_clean
();
ob_start
();
$title
=
'商品列表'
;
header
(
'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
header
(
'Content-Disposition:attachment;filename="'
.
$title
.
'.xlsx"'
);
header
(
'Cache-Control: max-age=0'
);
header
(
'Cache-Control: max-age=1'
);
header
(
'Expires: Mon, 26 Jul 1997 05:00:00 GMT'
);
// Date in the past
header
(
'Last-Modified: '
.
gmdate
(
'D, d M Y H:i:s'
)
.
' GMT'
);
// always modified
header
(
'Cache-Control: cache, must-revalidate'
);
// HTTP/1.1
header
(
'Pragma: public'
);
// HTTP/1.0
$objWriter
=
\PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
'Excel5'
);
$objWriter
->
save
(
'php://output'
);
//文件通过浏览器下载
exit
();
}
/**
*导入
*
* */
public
function
import
()
{
$file
=
$this
->
request
->
request
(
'file'
);
if
(
!
$file
)
{
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'file'
));
}
$filePath
=
ROOT_PATH
.
DS
.
'public'
.
DS
.
$file
;
if
(
!
is_file
(
$filePath
))
{
$this
->
error
(
__
(
'No results were found'
));
}
//实例化reader
$ext
=
pathinfo
(
$filePath
,
PATHINFO_EXTENSION
);
if
(
!
in_array
(
$ext
,
[
'csv'
,
'xls'
,
'xlsx'
]))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
if
(
$ext
===
'csv'
)
{
$file
=
fopen
(
$filePath
,
'r'
);
$filePath
=
tempnam
(
sys_get_temp_dir
(),
'import_csv'
);
$fp
=
fopen
(
$filePath
,
"w"
);
$n
=
0
;
while
(
$line
=
fgets
(
$file
))
{
$line
=
rtrim
(
$line
,
"
\n\r\0
"
);
$encoding
=
mb_detect_encoding
(
$line
,
[
'utf-8'
,
'gbk'
,
'latin1'
,
'big5'
]);
if
(
$encoding
!=
'utf-8'
)
{
$line
=
mb_convert_encoding
(
$line
,
'utf-8'
,
$encoding
);
}
if
(
$n
==
0
||
preg_match
(
'/^".*"$/'
,
$line
))
{
fwrite
(
$fp
,
$line
.
"
\n
"
);
}
else
{
fwrite
(
$fp
,
'"'
.
str_replace
([
'"'
,
','
],
[
'""'
,
'","'
],
$line
)
.
"
\"\n
"
);
}
$n
++
;
}
fclose
(
$file
)
||
fclose
(
$fp
);
$reader
=
new
Csv
();
}
elseif
(
$ext
===
'xls'
)
{
$reader
=
new
Xls
();
}
else
{
$reader
=
new
Xlsx
();
}
set_time_limit
(
0
);
//加载文件
$insert
=
[];
try
{
if
(
!
$PHPExcel
=
$reader
->
load
(
$filePath
))
{
$this
->
error
(
__
(
'Unknown data format'
));
}
$currentSheet
=
$PHPExcel
->
getSheet
(
0
);
//读取文件中的第一个工作表
$allColumn
=
$currentSheet
->
getHighestDataColumn
();
//取得最大的列号
$allRow
=
$currentSheet
->
getHighestRow
();
//取得一共有多少行
$maxColumnNumber
=
Coordinate
::
columnIndexFromString
(
$allColumn
);
// 一共多少列
for
(
$i
=
2
;
$i
<=
$allRow
;
$i
++
)
{
if
(
!
empty
(
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"A"
.
$i
)
->
getValue
()))
{
$insert
[
$i
][
'goods_name'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"A"
.
$i
)
->
getValue
();
//商品名称
$insert
[
$i
][
'keywords'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"B"
.
$i
)
->
getValue
();
//关键词
$category
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"C"
.
$i
)
->
getValue
()
??
''
;
//类别
$insert
[
$i
][
'category_id'
]
=
Db
::
name
(
'litestore_category'
)
->
where
(
'name'
,
$category
)
->
value
(
'id'
)
??
''
;
$insert
[
$i
][
'activity_id'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"D"
.
$i
)
->
getValue
()
??
''
;
//活动类型
$insert
[
$i
][
'is_index'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"I"
.
$i
)
->
getValue
()
??
''
;
//是否首页
$insert
[
$i
][
'goods_status'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"H"
.
$i
)
->
getValue
()
??
''
;
//商品状态
$spec_insert
[
$i
][
'stock_num'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"E"
.
$i
)
->
getValue
()
??
''
;
//库存
$spec_insert
[
$i
][
'goods_price'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"G"
.
$i
)
->
getValue
()
??
''
;
//现价
$spec_insert
[
$i
][
'line_price'
]
=
$PHPExcel
->
getActiveSheet
()
->
getCell
(
"F"
.
$i
)
->
getValue
()
??
''
;
//原价
}
}
}
catch
(
\Exception
$exception
)
{
$this
->
error
(
$exception
->
getMessage
());
}
if
(
!
$insert
)
{
$this
->
error
(
__
(
'No rows were updated'
));
}
try
{
$res_goods
=
$this
->
model
->
saveAll
(
$insert
);
foreach
(
$spec_insert
as
$key
=>
&
$v
)
{
$v
[
'goods_id'
]
=
$res_goods
[
$key
][
'goods_id'
];
}
unset
(
$v
);
$this
->
spec_model
->
saveAll
(
$spec_insert
);
}
catch
(
PDOException
$exception
)
{
$msg
=
$exception
->
getMessage
();
if
(
preg_match
(
"/.+Integrity constraint violation: 1062 Duplicate entry '(.+)' for key '(.+)'/is"
,
$msg
,
$matches
))
{
$msg
=
"导入失败,包含【
{
$matches
[
1
]}
】的记录已存在
";
};
$this->error
(
$msg
);
} catch (\Exception
$e
) {
$this->error
(
$e->getMessage
());
}
$this->success
();
}
}
...
...
application/admin/controller/litestore/Litestoregoods.php
查看文件 @
a55664b
...
...
@@ -29,6 +29,7 @@ class Litestoregoods extends Backend
*/
protected
$model
=
null
;
protected
$spec_model
=
null
;
// protected $searchFields = 'category.name';
public
function
_initialize
()
...
...
@@ -71,7 +72,7 @@ class Litestoregoods extends Backend
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
(
"category.name"
,
true
);
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
(
"category.name"
,
true
);
$total
=
$this
->
model
->
with
([
'category'
,
'activity'
])
->
where
(
$where
)
...
...
@@ -483,5 +484,19 @@ class Litestoregoods extends Backend
$this->success
();
}
/**
* 批量设置折扣
*/
public function discount()
{
//接收所选商品id集
$goods_ids
=
$this->request
->get('id');
$goods_ids
= explode(',',
$goods_ids
);
//接收所设置的折扣
$discount
=
$this->request
->get('discount');
foreach (
$goods_ids
as &
$v
) {
Db::name('litestore_goods_spec')->where('goods_id',
$v
)->update(['discount' =>
$discount
]);
}
$this->success
('设置成功');
}
}
...
...
application/admin/lang/zh-cn/activity_goods/import_goods.php
0 → 100644
查看文件 @
a55664b
<?php
return
[
'Goods_id'
=>
'ID'
,
'Goods_name'
=>
'商品名称'
,
'Category_id'
=>
'商品类别'
,
'Image'
=>
'商品封面'
,
'Images'
=>
'商品轮播图片'
,
'Spec_type'
=>
'商品规格'
,
'Spec_type 10'
=>
'单规格'
,
'Spec_type 20'
=>
'多规格'
,
'Deduct_stock_type'
=>
'库存计算方式'
,
'Deduct_stock_type 10'
=>
'下单减库存'
,
'Deduct_stock_type 20'
=>
'付款减库存'
,
'Content'
=>
'描述详情'
,
'Sales_initial'
=>
'初始销量'
,
'Sales_actual'
=>
'实际销量'
,
'Goods_sort'
=>
'权重'
,
'Delivery_id'
=>
'运费模板ID'
,
'Goods_status'
=>
'商品状态'
,
'Goods_status 10'
=>
'上架'
,
'Goods_status 20'
=>
'下架'
,
'Is_delete'
=>
'是否删除'
,
'Is_delete 0'
=>
'未删除'
,
'Is_delete 1'
=>
'已删除'
,
'Createtime'
=>
'创建时间'
,
'Updatetime'
=>
'更新时间'
,
'Category.name'
=>
'分类名称'
,
'Activity.name'
=>
'活动名称'
,
'Freight.name'
=>
'运费模版名称'
,
'Makefor'
=>
'产地'
,
'Makefor 1'
=>
'国产'
,
'Makefor 2'
=>
'进口'
,
'Number'
=>
'编号'
,
'Keep'
=>
'保存条件'
,
'Packing'
=>
'包装方式'
,
'Brand'
=>
'品牌'
,
'Four_images'
=>
'四宫格图'
,
'Down_image'
=>
'底部图'
,
'Detail_images'
=>
'详情图'
,
'Is_index'
=>
'首页展示'
,
'Is_index 1'
=>
'已展示'
,
'Is_index 0'
=>
'未展示'
,
'Activity_id'
=>
'活动类型'
,
'Price_description'
=>
'价格说明'
,
'Keywords'
=>
'搜索关键词'
,
];
...
...
application/admin/lang/zh-cn/activity_goods/new_goods.php
0 → 100644
查看文件 @
a55664b
<?php
return
[
'Goods_id'
=>
'ID'
,
'Goods_name'
=>
'商品名称'
,
'Category_id'
=>
'商品类别'
,
'Image'
=>
'商品封面'
,
'Images'
=>
'商品轮播图片'
,
'Spec_type'
=>
'商品规格'
,
'Spec_type 10'
=>
'单规格'
,
'Spec_type 20'
=>
'多规格'
,
'Deduct_stock_type'
=>
'库存计算方式'
,
'Deduct_stock_type 10'
=>
'下单减库存'
,
'Deduct_stock_type 20'
=>
'付款减库存'
,
'Content'
=>
'描述详情'
,
'Sales_initial'
=>
'初始销量'
,
'Sales_actual'
=>
'实际销量'
,
'Goods_sort'
=>
'权重'
,
'Delivery_id'
=>
'运费模板ID'
,
'Goods_status'
=>
'商品状态'
,
'Goods_status 10'
=>
'上架'
,
'Goods_status 20'
=>
'下架'
,
'Is_delete'
=>
'是否删除'
,
'Is_delete 0'
=>
'未删除'
,
'Is_delete 1'
=>
'已删除'
,
'Createtime'
=>
'创建时间'
,
'Updatetime'
=>
'更新时间'
,
'Category.name'
=>
'分类名称'
,
'Activity.name'
=>
'活动名称'
,
'Freight.name'
=>
'运费模版名称'
,
'Makefor'
=>
'产地'
,
'Makefor 1'
=>
'国产'
,
'Makefor 2'
=>
'进口'
,
'Number'
=>
'编号'
,
'Keep'
=>
'保存条件'
,
'Packing'
=>
'包装方式'
,
'Brand'
=>
'品牌'
,
'Four_images'
=>
'四宫格图'
,
'Down_image'
=>
'底部图'
,
'Detail_images'
=>
'详情图'
,
'Is_index'
=>
'首页展示'
,
'Is_index 1'
=>
'已展示'
,
'Is_index 0'
=>
'未展示'
,
'Activity_id'
=>
'活动类型'
,
'Price_description'
=>
'价格说明'
,
'Keywords'
=>
'搜索关键词'
,
];
...
...
application/admin/lang/zh-cn/activity_goods/seckill_goods.php
0 → 100644
查看文件 @
a55664b
<?php
return
[
'Goods_id'
=>
'ID'
,
'Goods_name'
=>
'商品名称'
,
'Category_id'
=>
'商品类别'
,
'Image'
=>
'商品封面'
,
'Images'
=>
'商品轮播图片'
,
'Spec_type'
=>
'商品规格'
,
'Spec_type 10'
=>
'单规格'
,
'Spec_type 20'
=>
'多规格'
,
'Deduct_stock_type'
=>
'库存计算方式'
,
'Deduct_stock_type 10'
=>
'下单减库存'
,
'Deduct_stock_type 20'
=>
'付款减库存'
,
'Content'
=>
'描述详情'
,
'Sales_initial'
=>
'初始销量'
,
'Sales_actual'
=>
'实际销量'
,
'Goods_sort'
=>
'权重'
,
'Delivery_id'
=>
'运费模板ID'
,
'Goods_status'
=>
'商品状态'
,
'Goods_status 10'
=>
'上架'
,
'Goods_status 20'
=>
'下架'
,
'Is_delete'
=>
'是否删除'
,
'Is_delete 0'
=>
'未删除'
,
'Is_delete 1'
=>
'已删除'
,
'Createtime'
=>
'创建时间'
,
'Updatetime'
=>
'更新时间'
,
'Category.name'
=>
'分类名称'
,
'Activity.name'
=>
'活动名称'
,
'Freight.name'
=>
'运费模版名称'
,
'Makefor'
=>
'产地'
,
'Makefor 1'
=>
'国产'
,
'Makefor 2'
=>
'进口'
,
'Number'
=>
'编号'
,
'Keep'
=>
'保存条件'
,
'Packing'
=>
'包装方式'
,
'Brand'
=>
'品牌'
,
'Four_images'
=>
'四宫格图'
,
'Down_image'
=>
'底部图'
,
'Detail_images'
=>
'详情图'
,
'Is_index'
=>
'首页展示'
,
'Is_index 1'
=>
'已展示'
,
'Is_index 0'
=>
'未展示'
,
'Activity_id'
=>
'活动类型'
,
'Price_description'
=>
'价格说明'
,
'Keywords'
=>
'搜索关键词'
,
];
...
...
application/admin/model/litestore/Litestoregoods.php
查看文件 @
a55664b
...
...
@@ -153,8 +153,8 @@ class Litestoregoods extends Model
$isUpdate
&&
$model
->
removeAll
(
$this
[
'goods_id'
]);
// 添加规格数据
if
(
$data
[
'spec_type'
]
===
'10'
)
{
// 单规格
$specparams
[
'discount'
]
=
(
round
(
$specparams
[
'goods_price'
]
/
$specparams
[
'line_price'
],
2
)
*
10
)
.
'折'
;
// // 单规格
// $specparams['discount'] = (round($specparams['goods_price'] / $specparams['line_price'], 2) * 10) . '折';
$this
->
spec
()
->
save
(
$specparams
);
}
else
if
(
$data
[
'spec_type'
]
===
'20'
)
{
// 添加商品与规格关系记录
...
...
application/admin/model/litestore/Litestoregoodsspec.php
查看文件 @
a55664b
...
...
@@ -31,7 +31,7 @@ class Litestoregoodsspec extends Model
$data
[]
=
array_merge
(
$item
[
'form'
],
[
'spec_sku_id'
=>
$item
[
'spec_sku_id'
],
'goods_id'
=>
$goods_id
,
'discount'
=>
(
round
(
$item
[
'form'
][
'goods_price'
]
/
$item
[
'form'
][
'line_price'
],
2
)
*
10
)
.
'折'
,
//
'discount' => (round($item['form']['goods_price'] / $item['form']['line_price'], 2) * 10) . '折',
]);
}
...
...
application/admin/view/activity_goods/import_goods/add.html
0 → 100644
查看文件 @
a55664b
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_name"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[goods_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keywords')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keywords"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keywords]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Category_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-category_id"
data-rule=
"required"
data-source=
"litestore/litestorecategory/selectpage"
class=
"form-control selectpage form-control"
name=
"row[category_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Activity_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-activity_id"
data-source=
"activity/index"
class=
"form-control selectpage"
name=
"row[activity_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Image')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-image"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[image]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-image"
class=
"btn btn-danger plupload"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
data-preview-id=
"p-image"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-image"
class=
"btn btn-primary fachoose"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-image"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-image"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽110,高110
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[images]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-images"
class=
"btn btn-danger plupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽375,高375
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Spec_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-spec_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[spec_type]"
>
{foreach name="specTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"10"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- 商品规格属性 start -->
<div
class=
"goods-spec-many form-group"
>
<!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
<div
class=
"goods-spec-box col-xs-12 col-sm-11"
style=
"background-color: white;"
>
<!-- 规格属性 -->
<div
class=
"spec-attr"
></div>
<!-- 添加规格:按钮 -->
<div
class=
"spec-group-button"
>
<button
type=
"button"
class=
"btn-addSpecGroup btn btn-xs btn-success"
>
添加规格
</button>
</div>
<!-- 添加规格:表单 -->
<div
class=
"spec-group-add"
>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格名
</label>
<input
type=
"text"
class=
"input-specName tpl-form-input"
placeholder=
"请输入规格名称"
>
</div>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格值
</label>
<input
type=
"text"
class=
"input-specValue tpl-form-input"
placeholder=
"请输入规格值"
>
</div>
<div
class=
"spec-group-add-item margin-top"
>
<button
type=
"button"
class=
"btn-addSpecName btn btn-xs btn-success"
>
确定
</button>
<button
type=
"button"
class=
"btn-cancleAddSpecName btn btn-xs btn-default"
>
取消
</button>
</div>
</div>
<!-- 商品多规格sku信息 -->
<div
class=
"goods-sku scrollable-horizontal"
>
<!-- 分割线 -->
<div
class=
"goods-spec-line"
></div>
<!-- sku 批量设置 -->
<div
class=
"spec-batch form-inline"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
>
批量设置
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
data-type=
"goods_no"
placeholder=
"商家编码"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_price"
placeholder=
"销售价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"line_price"
placeholder=
"划线价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"stock_num"
placeholder=
"库存数量"
>
</div>
<!--<div class="form-group">
<input type="number" data-type="goods_weight" placeholder="重量">
</div>-->
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn-specBatchBtn btn btn-sm btn-secondary
radius"
>
确定
</button>
</div>
</div>
<!-- sku table -->
<table
class=
"spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"
></table>
</div>
</div>
</div>
<div
class=
"goods-spec-single"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品编码:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_no"
class=
"form-control form-control"
name=
"spec[goods_no]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品价格:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_price"
data-rule=
"required"
class=
"form-control form-control"
name=
"spec[goods_price]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品划线价:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-line_price"
class=
"form-control form-control"
name=
"spec[line_price]"
type=
"number"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
当前库存数量:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-stock_num"
class=
"form-control form-control"
name=
"spec[stock_num]"
type=
"number"
value=
"100"
>
</div>
</div>
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="1">
</div>
</div>-->
</div>
<!-- 商品规格属性 end -->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Deduct_stock_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-deduct_stock_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[deduct_stock_type]"
>
{foreach name="deductStockTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"20"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <textarea id="c-content" data-rule="required" class="form-control editor form-control" rows="5" name="row[content]" cols="50"></textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="100">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price_description')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<textarea
id=
"c-price_description"
data-rule=
"required"
class=
"form-control"
name=
"row[price_description]"
></textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Brand')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-brand"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[brand]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Makefor')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="makeforList" item="vo"}
<label
for=
"row[makefor]-{$key}"
><input
id=
"row[makefor]-{$key}"
name=
"row[makefor]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"1"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Packing')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-packing"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[packing]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keep')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keep"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keep]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-number"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[number]"
type=
"text"
value=
""
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Down_image')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-down_image" data-rule="required" class="form-control form-control" size="50" name="row[down_image]" type="text">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-down_image" class="btn btn-danger plupload" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-down_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-down_image" class="btn btn-primary fachoose" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-down_image"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-down_image"></ul>-->
<!-- <span class="help-block">建议尺寸:宽375,高267</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Four_images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-four_images" data-rule="required" class="form-control form-control" size="50" name="row[four_images]" type="text">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-four_images" class="btn btn-danger plupload" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-four_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-four_images" class="btn btn-primary fachoose" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-four_images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-four_images"></ul>-->
<!-- <span class="help-block">建议尺寸:宽185,高185</span>-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Detail_images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-detail_images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[detail_images]"
placeholder=
"图片最多添加十张"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-detail_images"
data-maxcount=
"10"
class=
"btn btn-danger plupload"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"true"
data-preview-id=
"p-detail_images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-detail_images"
data-maxcount=
"10"
class=
"btn btn-primary fachoose"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-detail_images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-detail_images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽185,高185
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="goodsStatusList" item="vo"}
<label
for=
"row[goods_status]-{$key}"
><input
id=
"row[goods_status]-{$key}"
name=
"row[goods_status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"10"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_delete')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_delete"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_delete]"
>
{foreach name="isDeleteList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"0"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_index')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_index"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_index]"
>
{foreach name="isIndexList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"0"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
{include file="litestore/litestoregoods/spec_many_template" /}
<link
rel=
"stylesheet"
href=
"__CDN__/assets/addons/litestore/css/litestoregoods.css"
>
\ No newline at end of file
...
...
application/admin/view/activity_goods/import_goods/edit.html
0 → 100644
查看文件 @
a55664b
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_name"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[goods_name]"
type=
"text"
value=
"{$row.goods_name}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keywords')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keywords"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keywords]"
type=
"text"
value=
"{$row.keywords}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Category_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-category_id"
data-rule=
"required"
data-source=
"litestore/litestorecategory/selectpage"
class=
"form-control selectpage form-control"
name=
"row[category_id]"
type=
"text"
value=
"{$row.category_id}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Activity_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-activity_id"
data-source=
"activity/index"
class=
"form-control selectpage"
name=
"row[activity_id]"
type=
"text"
value=
"{$row.activity_id}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Image')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-image"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[image]"
type=
"text"
value=
"{$row.image}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-image"
class=
"btn btn-danger plupload"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
data-preview-id=
"p-image"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-image"
class=
"btn btn-primary fachoose"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-image"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-image"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽110,高110
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[images]"
type=
"text"
value=
"{$row.images}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-images"
class=
"btn btn-danger plupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽375,高375
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Spec_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-spec_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[spec_type]"
>
{foreach name="specTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.spec_type"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- 商品规格属性 start -->
<div
class=
"goods-spec-many form-group"
style=
"display: <?= $row['spec_type'] === '20' ? 'block' : 'none' ?>;"
>
<!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
<div
class=
"goods-spec-box col-xs-12 col-sm-11"
style=
"background-color: white;"
>
<!-- 规格属性 -->
<div
class=
"spec-attr"
></div>
<!-- 添加规格:按钮 -->
<div
class=
"spec-group-button"
>
<button
type=
"button"
class=
"btn-addSpecGroup btn btn-xs btn-success"
>
添加规格
</button>
</div>
<!-- 添加规格:表单 -->
<div
class=
"spec-group-add"
>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格名
</label>
<input
type=
"text"
class=
"input-specName tpl-form-input"
placeholder=
"请输入规格名称"
>
</div>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格值
</label>
<input
type=
"text"
class=
"input-specValue tpl-form-input"
placeholder=
"请输入规格值"
>
</div>
<div
class=
"spec-group-add-item margin-top"
>
<button
type=
"button"
class=
"btn-addSpecName btn btn-xs btn-success"
>
确定
</button>
<button
type=
"button"
class=
"btn-cancleAddSpecName btn btn-xs btn-default"
>
取消
</button>
</div>
</div>
<!-- 商品多规格sku信息 -->
<div
class=
"goods-sku scrollable-horizontal"
>
<!-- 分割线 -->
<div
class=
"goods-spec-line"
></div>
<!-- sku 批量设置 -->
<div
class=
"spec-batch form-inline"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
>
批量设置
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
data-type=
"goods_no"
placeholder=
"商家编码"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_price"
placeholder=
"销售价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"line_price"
placeholder=
"划线价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"stock_num"
placeholder=
"库存数量"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_weight"
placeholder=
"重量"
>
</div>
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn-specBatchBtn btn btn-sm btn-secondary
radius"
>
确定
</button>
</div>
</div>
<!-- sku table -->
<table
class=
"spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"
></table>
</div>
</div>
</div>
<div
class=
"goods-spec-single"
style=
"display: <?= $row['spec_type'] === '10' ? 'block' : 'none' ?>;"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品编码:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_no"
class=
"form-control form-control"
name=
"spec[goods_no]"
type=
"text"
value=
"{$row.spec.0.goods_no}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品价格:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_price"
data-rule=
"required"
class=
"form-control form-control"
name=
"spec[goods_price]"
type=
"number"
value=
"{$row.spec.0.goods_price}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品划线价:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-line_price"
class=
"form-control form-control"
name=
"spec[line_price]"
type=
"number"
value=
"{$row.spec.0.line_price}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
当前库存数量:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-stock_num"
class=
"form-control form-control"
name=
"spec[stock_num]"
type=
"number"
value=
"{$row.spec.0.stock_num}"
>
</div>
</div>
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="{$row.spec.0.goods_weight}">
</div>
</div>-->
</div>
<!-- 商品规格属性 end -->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Deduct_stock_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-deduct_stock_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[deduct_stock_type]"
>
{foreach name="deductStockTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.deduct_stock_type"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <textarea id="c-content" data-rule="required" class="form-control editor form-control" rows="5" name="row[content]" cols="50">{$row.content}</textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="{$row.sales_initial}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="{$row.sales_actual}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="{$row.goods_sort}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="{$row.delivery_id}">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price_description')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<textarea
id=
"c-price_description"
data-rule=
"required"
class=
"form-control"
name=
"row[price_description]"
>
{$row.price_description}
</textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Brand')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-brand"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[brand]"
type=
"text"
value=
"{$row.brand}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Makefor')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="makeforList" item="vo"}
<label
for=
"row[makefor]-{$key}"
><input
id=
"row[makefor]-{$key}"
name=
"row[makefor]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.makefor"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Packing')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-packing"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[packing]"
type=
"text"
value=
"{$row.packing}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keep')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keep"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keep]"
type=
"text"
value=
"{$row.keep}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-number"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[number]"
type=
"text"
value=
"{$row.number}"
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Down_image')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-down_image" data-rule="required" class="form-control form-control" size="50" name="row[down_image]" type="text" value="{$row.down_image}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-down_image" class="btn btn-danger plupload" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-down_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-down_image" class="btn btn-primary fachoose" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-down_image"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-down_image"></ul>-->
<!-- <span class="help-block">建议尺寸:宽375,高267</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Four_images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-four_images" data-rule="required" class="form-control form-control" size="50" name="row[four_images]" type="text" value="{$row.four_images}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-four_images" class="btn btn-danger plupload" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-four_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-four_images" class="btn btn-primary fachoose" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-four_images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-four_images"></ul>-->
<!-- <span class="help-block">建议尺寸:宽185,高185</span>-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Detail_images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-detail_images"
data-rule=
"required"
placeholder=
"图片最多添加十张"
class=
"form-control form-control"
size=
"50"
name=
"row[detail_images]"
type=
"text"
value=
"{$row.detail_images}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-detail_images"
class=
"btn btn-danger plupload"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-maxcount=
"10"
data-multiple=
"true"
data-preview-id=
"p-detail_images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-detail_images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-maxcount=
"10"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-detail_images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-detail_images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽185,高185
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="goodsStatusList" item="vo"}
<label
for=
"row[goods_status]-{$key}"
><input
id=
"row[goods_status]-{$key}"
name=
"row[goods_status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.goods_status"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_delete')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_delete"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_delete]"
>
{foreach name="isDeleteList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.is_delete"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_index')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_index"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_index]"
>
{foreach name="isIndexList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.is_index"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
{include file="litestore/litestoregoods/spec_many_template" /}
<link
rel=
"stylesheet"
href=
"__CDN__/assets/addons/litestore/css/litestoregoods.css"
>
<script
type=
"text/javascript"
>
var
from_specData
=
<
?
=
$row
[
'specData'
]
?
>
;
</script>
\ No newline at end of file
...
...
application/admin/view/activity_goods/import_goods/index.html
0 → 100644
查看文件 @
a55664b
<div
class=
"panel panel-default panel-intro"
>
{:build_heading()}
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<a
href=
"javascript:;"
class=
"btn btn-primary btn-refresh"
title=
"{:__('Refresh')}"
><i
class=
"fa fa-refresh"
></i>
</a>
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-add {:$auth->check('litestore/litestoregoods/add')?'':'hide'}"-->
<!-- title="{:__('Add')}"><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('litestore/litestoregoods/edit')?'':'hide'}"-->
<!-- title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('litestore/litestoregoods/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<div
class=
"dropdown btn-group {:$auth->check('litestore/litestoregoods/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-check-square-o"
></i>
{:__('批量添加活动商品')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=1"
><i
class=
"fa fa-free-code-camp"
></i>
{:__('新人用户')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=2"
><i
class=
"fa fa-clock-o"
></i>
{:__('限时秒杀')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=3"
><i
class=
"fa fa-location-arrow"
></i>
{:__('进口商品')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=0"
><i
class=
"fa fa-eye-slash"
></i>
{:__('不参与活动')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('litestore/litestoregoods/edit')}"
data-operate-del=
"{:$auth->check('litestore/litestoregoods/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
...
...
application/admin/view/activity_goods/import_goods/spec_many_template.html
0 → 100644
查看文件 @
a55664b
<!-- 商品规格属性模板 -->
<script
id=
"tpl_spec_attr"
type=
"text/template"
>
<%
for
(
var
j
=
0
;
j
<
spec_attr
.
length
;
j
++
){
%>
<
div
class
=
"spec-group-item"
data
-
index
=
"<%=j%>"
data
-
group
-
id
=
"<%=spec_attr[j].group_id%>"
>
<
div
class
=
"spec-group-name"
>
<
span
><%=
spec_attr
[
j
].
group_name
%><
/span
>
<
i
class
=
"spec-group-delete fa fa-trash icon-shanchu1"
title
=
"点击删除"
><
/i
>
<
/div
>
<
div
class
=
"spec-list am-cf"
>
<%
for
(
var
k
=
0
;
k
<
spec_attr
[
j
].
spec_items
.
length
;
k
++
){
%>
<
div
class
=
"spec-item am-fl"
data
-
item
-
index
=
"<%=k%>"
>
<
span
><%=
spec_attr
[
j
].
spec_items
[
k
].
spec_value
%><
/span
>
<
i
class
=
"spec-item-delete fa fa-trash icon-shanchu1"
title
=
"点击删除"
><
/i
>
<
/div
>
<%
}
%>
<
div
class
=
"spec-item-add am-cf am-fl"
>
<
input
type
=
"text"
class
=
"ipt-specItem am-fl am-field-valid"
>
<
button
type
=
"button"
class
=
"btn-addSpecItem btn btn-xs btn-success am-fl"
>
添加
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<%
}
%>
</script>
<!-- 商品规格table模板 -->
<script
id=
"tpl_spec_table"
type=
"text/template"
>
<
tbody
>
<
tr
>
<
th
>
单
sku
隐藏
<
/th
>
<%
for
(
var
i
=
0
;
i
<
spec_attr
.
length
;
i
++
){
%>
<
th
><%=
spec_attr
[
i
].
group_name
%><
/th
>
<%
}
%>
<
th
>
商品编码
<
/th
>
<
th
>
销售价
<
/th
>
<
th
>
划线价
<
/th
>
<
th
>
库存
(
-
1
隐藏
)
<
/th
>
<!--
<
th
>
重量
(
kg
)
<
/th>--
>
<
th
>
规格封面
<
/th
>
<
th
>
封面编辑
<
/th
>
<
/tr
>
<%
for
(
var
i
=
0
;
i
<
spec_list
.
length
;
i
++
){
%>
<
tr
data
-
index
=
"<%=i%>"
data
-
sku
-
id
=
"<%=spec_list[i].spec_sku_id %>"
>
<
td
>
<
button
type
=
"button"
class
=
"am-text-middle btn delsku-bt"
><%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
显示
<%
}
else
{
%>
隐藏
<%
}
%><
/button
>
<
/td
>
<%
for
(
var
k
=
0
;
k
<
spec_list
[
i
].
rows
.
length
;
k
++
){
%>
<
td
class
=
"td-spec-value am-text-middle"
rowspan
=
"<%=spec_list[i].rows[k].rowspan%>"
>
<%=
spec_list
[
i
].
rows
[
k
].
spec_value
%>
<
/td
>
<%
}
%>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"text"
name
=
"goods_no"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_no%>"
class
=
"ipt-goods-no am-field-valid"
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"goods_price"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_price%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"line_price"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.line_price%>"
class
=
"am-field-valid ipt-w80"
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"stock_num"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.stock_num%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td
>
<!--
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"goods_weight"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_weight%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td>--
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
id
=
"c-image<%=i%>"
class
=
"form-control form-control"
style
=
"display: none!important;"
name
=
"spec_image"
type
=
"text"
value
=
"<%=spec_list[i].form.spec_image%>"
>
<
div
class
=
"row list-inline plupload-preview spe_img_one"
id
=
"p-image<%=i%>"
><
/div
>
<
/td
>
<
td
>
<
div
class
=
"input-group-addon no-border no-padding"
>
<
span
><
button
type
=
"button"
id
=
"plupload-image<%=i%>"
style
=
"display: none!important;"
class
=
"btn btn-danger plupload"
data
-
input
-
id
=
"c-image<%=i%>"
data
-
mimetype
=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data
-
multiple
=
"false"
data
-
preview
-
id
=
"p-image<%=i%>"
><
i
class
=
"fa fa-upload"
><
/i> {:__
(
'Upload'
)
}</
button
><
/span
>
<
span
><
button
type
=
"button"
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
id
=
"fachoose-image<%=i%>"
class
=
"btn btn-primary fachoose"
data
-
input
-
id
=
"c-image<%=i%>"
data
-
mimetype
=
"image/*"
data
-
preview
-
id
=
"p-image<%=i%>"
data
-
multiple
=
"false"
><
i
class
=
"fa fa-list"
><
/i> {:__
(
'Choose'
)
}</
button
><
/span
>
<
/div
>
<
/td
>
<
/tr
>
<%
}
%>
<
/tbody
>
</script>
...
...
application/admin/view/activity_goods/new_goods/add.html
0 → 100644
查看文件 @
a55664b
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_name"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[goods_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keywords')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keywords"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keywords]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Category_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-category_id"
data-rule=
"required"
data-source=
"litestore/litestorecategory/selectpage"
class=
"form-control selectpage form-control"
name=
"row[category_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Activity_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-activity_id"
data-source=
"activity/index"
class=
"form-control selectpage"
name=
"row[activity_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Image')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-image"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[image]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-image"
class=
"btn btn-danger plupload"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
data-preview-id=
"p-image"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-image"
class=
"btn btn-primary fachoose"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-image"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-image"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽110,高110
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[images]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-images"
class=
"btn btn-danger plupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽375,高375
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Spec_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-spec_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[spec_type]"
>
{foreach name="specTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"10"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- 商品规格属性 start -->
<div
class=
"goods-spec-many form-group"
>
<!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
<div
class=
"goods-spec-box col-xs-12 col-sm-11"
style=
"background-color: white;"
>
<!-- 规格属性 -->
<div
class=
"spec-attr"
></div>
<!-- 添加规格:按钮 -->
<div
class=
"spec-group-button"
>
<button
type=
"button"
class=
"btn-addSpecGroup btn btn-xs btn-success"
>
添加规格
</button>
</div>
<!-- 添加规格:表单 -->
<div
class=
"spec-group-add"
>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格名
</label>
<input
type=
"text"
class=
"input-specName tpl-form-input"
placeholder=
"请输入规格名称"
>
</div>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格值
</label>
<input
type=
"text"
class=
"input-specValue tpl-form-input"
placeholder=
"请输入规格值"
>
</div>
<div
class=
"spec-group-add-item margin-top"
>
<button
type=
"button"
class=
"btn-addSpecName btn btn-xs btn-success"
>
确定
</button>
<button
type=
"button"
class=
"btn-cancleAddSpecName btn btn-xs btn-default"
>
取消
</button>
</div>
</div>
<!-- 商品多规格sku信息 -->
<div
class=
"goods-sku scrollable-horizontal"
>
<!-- 分割线 -->
<div
class=
"goods-spec-line"
></div>
<!-- sku 批量设置 -->
<div
class=
"spec-batch form-inline"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
>
批量设置
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
data-type=
"goods_no"
placeholder=
"商家编码"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_price"
placeholder=
"销售价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"line_price"
placeholder=
"划线价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"stock_num"
placeholder=
"库存数量"
>
</div>
<!--<div class="form-group">
<input type="number" data-type="goods_weight" placeholder="重量">
</div>-->
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn-specBatchBtn btn btn-sm btn-secondary
radius"
>
确定
</button>
</div>
</div>
<!-- sku table -->
<table
class=
"spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"
></table>
</div>
</div>
</div>
<div
class=
"goods-spec-single"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品编码:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_no"
class=
"form-control form-control"
name=
"spec[goods_no]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品价格:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_price"
data-rule=
"required"
class=
"form-control form-control"
name=
"spec[goods_price]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品划线价:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-line_price"
class=
"form-control form-control"
name=
"spec[line_price]"
type=
"number"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
当前库存数量:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-stock_num"
class=
"form-control form-control"
name=
"spec[stock_num]"
type=
"number"
value=
"100"
>
</div>
</div>
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="1">
</div>
</div>-->
</div>
<!-- 商品规格属性 end -->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Deduct_stock_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-deduct_stock_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[deduct_stock_type]"
>
{foreach name="deductStockTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"20"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <textarea id="c-content" data-rule="required" class="form-control editor form-control" rows="5" name="row[content]" cols="50"></textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="100">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price_description')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<textarea
id=
"c-price_description"
data-rule=
"required"
class=
"form-control"
name=
"row[price_description]"
></textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Brand')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-brand"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[brand]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Makefor')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="makeforList" item="vo"}
<label
for=
"row[makefor]-{$key}"
><input
id=
"row[makefor]-{$key}"
name=
"row[makefor]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"1"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Packing')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-packing"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[packing]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keep')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keep"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keep]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-number"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[number]"
type=
"text"
value=
""
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Down_image')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-down_image" data-rule="required" class="form-control form-control" size="50" name="row[down_image]" type="text">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-down_image" class="btn btn-danger plupload" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-down_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-down_image" class="btn btn-primary fachoose" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-down_image"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-down_image"></ul>-->
<!-- <span class="help-block">建议尺寸:宽375,高267</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Four_images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-four_images" data-rule="required" class="form-control form-control" size="50" name="row[four_images]" type="text">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-four_images" class="btn btn-danger plupload" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-four_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-four_images" class="btn btn-primary fachoose" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-four_images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-four_images"></ul>-->
<!-- <span class="help-block">建议尺寸:宽185,高185</span>-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Detail_images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-detail_images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[detail_images]"
placeholder=
"图片最多添加十张"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-detail_images"
data-maxcount=
"10"
class=
"btn btn-danger plupload"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"true"
data-preview-id=
"p-detail_images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-detail_images"
data-maxcount=
"10"
class=
"btn btn-primary fachoose"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-detail_images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-detail_images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽185,高185
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="goodsStatusList" item="vo"}
<label
for=
"row[goods_status]-{$key}"
><input
id=
"row[goods_status]-{$key}"
name=
"row[goods_status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"10"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_delete')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_delete"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_delete]"
>
{foreach name="isDeleteList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"0"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_index')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_index"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_index]"
>
{foreach name="isIndexList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"0"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
{include file="litestore/litestoregoods/spec_many_template" /}
<link
rel=
"stylesheet"
href=
"__CDN__/assets/addons/litestore/css/litestoregoods.css"
>
\ No newline at end of file
...
...
application/admin/view/activity_goods/new_goods/edit.html
0 → 100644
查看文件 @
a55664b
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_name"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[goods_name]"
type=
"text"
value=
"{$row.goods_name}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keywords')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keywords"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keywords]"
type=
"text"
value=
"{$row.keywords}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Category_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-category_id"
data-rule=
"required"
data-source=
"litestore/litestorecategory/selectpage"
class=
"form-control selectpage form-control"
name=
"row[category_id]"
type=
"text"
value=
"{$row.category_id}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Activity_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-activity_id"
data-source=
"activity/index"
class=
"form-control selectpage"
name=
"row[activity_id]"
type=
"text"
value=
"{$row.activity_id}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Image')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-image"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[image]"
type=
"text"
value=
"{$row.image}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-image"
class=
"btn btn-danger plupload"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
data-preview-id=
"p-image"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-image"
class=
"btn btn-primary fachoose"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-image"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-image"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽110,高110
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[images]"
type=
"text"
value=
"{$row.images}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-images"
class=
"btn btn-danger plupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽375,高375
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Spec_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-spec_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[spec_type]"
>
{foreach name="specTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.spec_type"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- 商品规格属性 start -->
<div
class=
"goods-spec-many form-group"
style=
"display: <?= $row['spec_type'] === '20' ? 'block' : 'none' ?>;"
>
<!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
<div
class=
"goods-spec-box col-xs-12 col-sm-11"
style=
"background-color: white;"
>
<!-- 规格属性 -->
<div
class=
"spec-attr"
></div>
<!-- 添加规格:按钮 -->
<div
class=
"spec-group-button"
>
<button
type=
"button"
class=
"btn-addSpecGroup btn btn-xs btn-success"
>
添加规格
</button>
</div>
<!-- 添加规格:表单 -->
<div
class=
"spec-group-add"
>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格名
</label>
<input
type=
"text"
class=
"input-specName tpl-form-input"
placeholder=
"请输入规格名称"
>
</div>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格值
</label>
<input
type=
"text"
class=
"input-specValue tpl-form-input"
placeholder=
"请输入规格值"
>
</div>
<div
class=
"spec-group-add-item margin-top"
>
<button
type=
"button"
class=
"btn-addSpecName btn btn-xs btn-success"
>
确定
</button>
<button
type=
"button"
class=
"btn-cancleAddSpecName btn btn-xs btn-default"
>
取消
</button>
</div>
</div>
<!-- 商品多规格sku信息 -->
<div
class=
"goods-sku scrollable-horizontal"
>
<!-- 分割线 -->
<div
class=
"goods-spec-line"
></div>
<!-- sku 批量设置 -->
<div
class=
"spec-batch form-inline"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
>
批量设置
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
data-type=
"goods_no"
placeholder=
"商家编码"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_price"
placeholder=
"销售价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"line_price"
placeholder=
"划线价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"stock_num"
placeholder=
"库存数量"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_weight"
placeholder=
"重量"
>
</div>
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn-specBatchBtn btn btn-sm btn-secondary
radius"
>
确定
</button>
</div>
</div>
<!-- sku table -->
<table
class=
"spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"
></table>
</div>
</div>
</div>
<div
class=
"goods-spec-single"
style=
"display: <?= $row['spec_type'] === '10' ? 'block' : 'none' ?>;"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品编码:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_no"
class=
"form-control form-control"
name=
"spec[goods_no]"
type=
"text"
value=
"{$row.spec.0.goods_no}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品价格:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_price"
data-rule=
"required"
class=
"form-control form-control"
name=
"spec[goods_price]"
type=
"number"
value=
"{$row.spec.0.goods_price}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品划线价:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-line_price"
class=
"form-control form-control"
name=
"spec[line_price]"
type=
"number"
value=
"{$row.spec.0.line_price}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
当前库存数量:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-stock_num"
class=
"form-control form-control"
name=
"spec[stock_num]"
type=
"number"
value=
"{$row.spec.0.stock_num}"
>
</div>
</div>
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="{$row.spec.0.goods_weight}">
</div>
</div>-->
</div>
<!-- 商品规格属性 end -->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Deduct_stock_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-deduct_stock_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[deduct_stock_type]"
>
{foreach name="deductStockTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.deduct_stock_type"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <textarea id="c-content" data-rule="required" class="form-control editor form-control" rows="5" name="row[content]" cols="50">{$row.content}</textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="{$row.sales_initial}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="{$row.sales_actual}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="{$row.goods_sort}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="{$row.delivery_id}">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price_description')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<textarea
id=
"c-price_description"
data-rule=
"required"
class=
"form-control"
name=
"row[price_description]"
>
{$row.price_description}
</textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Brand')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-brand"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[brand]"
type=
"text"
value=
"{$row.brand}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Makefor')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="makeforList" item="vo"}
<label
for=
"row[makefor]-{$key}"
><input
id=
"row[makefor]-{$key}"
name=
"row[makefor]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.makefor"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Packing')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-packing"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[packing]"
type=
"text"
value=
"{$row.packing}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keep')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keep"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keep]"
type=
"text"
value=
"{$row.keep}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-number"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[number]"
type=
"text"
value=
"{$row.number}"
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Down_image')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-down_image" data-rule="required" class="form-control form-control" size="50" name="row[down_image]" type="text" value="{$row.down_image}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-down_image" class="btn btn-danger plupload" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-down_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-down_image" class="btn btn-primary fachoose" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-down_image"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-down_image"></ul>-->
<!-- <span class="help-block">建议尺寸:宽375,高267</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Four_images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-four_images" data-rule="required" class="form-control form-control" size="50" name="row[four_images]" type="text" value="{$row.four_images}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-four_images" class="btn btn-danger plupload" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-four_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-four_images" class="btn btn-primary fachoose" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-four_images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-four_images"></ul>-->
<!-- <span class="help-block">建议尺寸:宽185,高185</span>-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Detail_images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-detail_images"
data-rule=
"required"
placeholder=
"图片最多添加十张"
class=
"form-control form-control"
size=
"50"
name=
"row[detail_images]"
type=
"text"
value=
"{$row.detail_images}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-detail_images"
class=
"btn btn-danger plupload"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-maxcount=
"10"
data-multiple=
"true"
data-preview-id=
"p-detail_images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-detail_images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-maxcount=
"10"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-detail_images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-detail_images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽185,高185
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="goodsStatusList" item="vo"}
<label
for=
"row[goods_status]-{$key}"
><input
id=
"row[goods_status]-{$key}"
name=
"row[goods_status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.goods_status"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_delete')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_delete"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_delete]"
>
{foreach name="isDeleteList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.is_delete"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_index')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_index"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_index]"
>
{foreach name="isIndexList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.is_index"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
{include file="litestore/litestoregoods/spec_many_template" /}
<link
rel=
"stylesheet"
href=
"__CDN__/assets/addons/litestore/css/litestoregoods.css"
>
<script
type=
"text/javascript"
>
var
from_specData
=
<
?
=
$row
[
'specData'
]
?
>
;
</script>
\ No newline at end of file
...
...
application/admin/view/activity_goods/new_goods/index.html
0 → 100644
查看文件 @
a55664b
<div
class=
"panel panel-default panel-intro"
>
{:build_heading()}
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<a
href=
"javascript:;"
class=
"btn btn-primary btn-refresh"
title=
"{:__('Refresh')}"
><i
class=
"fa fa-refresh"
></i>
</a>
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-add {:$auth->check('litestore/litestoregoods/add')?'':'hide'}"-->
<!-- title="{:__('Add')}"><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('litestore/litestoregoods/edit')?'':'hide'}"-->
<!-- title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('litestore/litestoregoods/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<div
class=
"dropdown btn-group {:$auth->check('litestore/litestoregoods/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-check-square-o"
></i>
{:__('批量添加活动商品')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=1"
><i
class=
"fa fa-free-code-camp"
></i>
{:__('新人用户')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=2"
><i
class=
"fa fa-clock-o"
></i>
{:__('限时秒杀')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=3"
><i
class=
"fa fa-location-arrow"
></i>
{:__('进口商品')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=0"
><i
class=
"fa fa-eye-slash"
></i>
{:__('不参与活动')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('litestore/litestoregoods/edit')}"
data-operate-del=
"{:$auth->check('litestore/litestoregoods/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
...
...
application/admin/view/activity_goods/new_goods/spec_many_template.html
0 → 100644
查看文件 @
a55664b
<!-- 商品规格属性模板 -->
<script
id=
"tpl_spec_attr"
type=
"text/template"
>
<%
for
(
var
j
=
0
;
j
<
spec_attr
.
length
;
j
++
){
%>
<
div
class
=
"spec-group-item"
data
-
index
=
"<%=j%>"
data
-
group
-
id
=
"<%=spec_attr[j].group_id%>"
>
<
div
class
=
"spec-group-name"
>
<
span
><%=
spec_attr
[
j
].
group_name
%><
/span
>
<
i
class
=
"spec-group-delete fa fa-trash icon-shanchu1"
title
=
"点击删除"
><
/i
>
<
/div
>
<
div
class
=
"spec-list am-cf"
>
<%
for
(
var
k
=
0
;
k
<
spec_attr
[
j
].
spec_items
.
length
;
k
++
){
%>
<
div
class
=
"spec-item am-fl"
data
-
item
-
index
=
"<%=k%>"
>
<
span
><%=
spec_attr
[
j
].
spec_items
[
k
].
spec_value
%><
/span
>
<
i
class
=
"spec-item-delete fa fa-trash icon-shanchu1"
title
=
"点击删除"
><
/i
>
<
/div
>
<%
}
%>
<
div
class
=
"spec-item-add am-cf am-fl"
>
<
input
type
=
"text"
class
=
"ipt-specItem am-fl am-field-valid"
>
<
button
type
=
"button"
class
=
"btn-addSpecItem btn btn-xs btn-success am-fl"
>
添加
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<%
}
%>
</script>
<!-- 商品规格table模板 -->
<script
id=
"tpl_spec_table"
type=
"text/template"
>
<
tbody
>
<
tr
>
<
th
>
单
sku
隐藏
<
/th
>
<%
for
(
var
i
=
0
;
i
<
spec_attr
.
length
;
i
++
){
%>
<
th
><%=
spec_attr
[
i
].
group_name
%><
/th
>
<%
}
%>
<
th
>
商品编码
<
/th
>
<
th
>
销售价
<
/th
>
<
th
>
划线价
<
/th
>
<
th
>
库存
(
-
1
隐藏
)
<
/th
>
<!--
<
th
>
重量
(
kg
)
<
/th>--
>
<
th
>
规格封面
<
/th
>
<
th
>
封面编辑
<
/th
>
<
/tr
>
<%
for
(
var
i
=
0
;
i
<
spec_list
.
length
;
i
++
){
%>
<
tr
data
-
index
=
"<%=i%>"
data
-
sku
-
id
=
"<%=spec_list[i].spec_sku_id %>"
>
<
td
>
<
button
type
=
"button"
class
=
"am-text-middle btn delsku-bt"
><%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
显示
<%
}
else
{
%>
隐藏
<%
}
%><
/button
>
<
/td
>
<%
for
(
var
k
=
0
;
k
<
spec_list
[
i
].
rows
.
length
;
k
++
){
%>
<
td
class
=
"td-spec-value am-text-middle"
rowspan
=
"<%=spec_list[i].rows[k].rowspan%>"
>
<%=
spec_list
[
i
].
rows
[
k
].
spec_value
%>
<
/td
>
<%
}
%>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"text"
name
=
"goods_no"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_no%>"
class
=
"ipt-goods-no am-field-valid"
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"goods_price"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_price%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"line_price"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.line_price%>"
class
=
"am-field-valid ipt-w80"
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"stock_num"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.stock_num%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td
>
<!--
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"goods_weight"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_weight%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td>--
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
id
=
"c-image<%=i%>"
class
=
"form-control form-control"
style
=
"display: none!important;"
name
=
"spec_image"
type
=
"text"
value
=
"<%=spec_list[i].form.spec_image%>"
>
<
div
class
=
"row list-inline plupload-preview spe_img_one"
id
=
"p-image<%=i%>"
><
/div
>
<
/td
>
<
td
>
<
div
class
=
"input-group-addon no-border no-padding"
>
<
span
><
button
type
=
"button"
id
=
"plupload-image<%=i%>"
style
=
"display: none!important;"
class
=
"btn btn-danger plupload"
data
-
input
-
id
=
"c-image<%=i%>"
data
-
mimetype
=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data
-
multiple
=
"false"
data
-
preview
-
id
=
"p-image<%=i%>"
><
i
class
=
"fa fa-upload"
><
/i> {:__
(
'Upload'
)
}</
button
><
/span
>
<
span
><
button
type
=
"button"
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
id
=
"fachoose-image<%=i%>"
class
=
"btn btn-primary fachoose"
data
-
input
-
id
=
"c-image<%=i%>"
data
-
mimetype
=
"image/*"
data
-
preview
-
id
=
"p-image<%=i%>"
data
-
multiple
=
"false"
><
i
class
=
"fa fa-list"
><
/i> {:__
(
'Choose'
)
}</
button
><
/span
>
<
/div
>
<
/td
>
<
/tr
>
<%
}
%>
<
/tbody
>
</script>
...
...
application/admin/view/activity_goods/seckill_goods/add.html
0 → 100644
查看文件 @
a55664b
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_name"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[goods_name]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keywords')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keywords"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keywords]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Category_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-category_id"
data-rule=
"required"
data-source=
"litestore/litestorecategory/selectpage"
class=
"form-control selectpage form-control"
name=
"row[category_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Activity_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-activity_id"
data-source=
"activity/index"
class=
"form-control selectpage"
name=
"row[activity_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Image')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-image"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[image]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-image"
class=
"btn btn-danger plupload"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
data-preview-id=
"p-image"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-image"
class=
"btn btn-primary fachoose"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-image"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-image"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽110,高110
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[images]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-images"
class=
"btn btn-danger plupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽375,高375
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Spec_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-spec_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[spec_type]"
>
{foreach name="specTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"10"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- 商品规格属性 start -->
<div
class=
"goods-spec-many form-group"
>
<!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
<div
class=
"goods-spec-box col-xs-12 col-sm-11"
style=
"background-color: white;"
>
<!-- 规格属性 -->
<div
class=
"spec-attr"
></div>
<!-- 添加规格:按钮 -->
<div
class=
"spec-group-button"
>
<button
type=
"button"
class=
"btn-addSpecGroup btn btn-xs btn-success"
>
添加规格
</button>
</div>
<!-- 添加规格:表单 -->
<div
class=
"spec-group-add"
>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格名
</label>
<input
type=
"text"
class=
"input-specName tpl-form-input"
placeholder=
"请输入规格名称"
>
</div>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格值
</label>
<input
type=
"text"
class=
"input-specValue tpl-form-input"
placeholder=
"请输入规格值"
>
</div>
<div
class=
"spec-group-add-item margin-top"
>
<button
type=
"button"
class=
"btn-addSpecName btn btn-xs btn-success"
>
确定
</button>
<button
type=
"button"
class=
"btn-cancleAddSpecName btn btn-xs btn-default"
>
取消
</button>
</div>
</div>
<!-- 商品多规格sku信息 -->
<div
class=
"goods-sku scrollable-horizontal"
>
<!-- 分割线 -->
<div
class=
"goods-spec-line"
></div>
<!-- sku 批量设置 -->
<div
class=
"spec-batch form-inline"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
>
批量设置
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
data-type=
"goods_no"
placeholder=
"商家编码"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_price"
placeholder=
"销售价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"line_price"
placeholder=
"划线价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"stock_num"
placeholder=
"库存数量"
>
</div>
<!--<div class="form-group">
<input type="number" data-type="goods_weight" placeholder="重量">
</div>-->
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn-specBatchBtn btn btn-sm btn-secondary
radius"
>
确定
</button>
</div>
</div>
<!-- sku table -->
<table
class=
"spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"
></table>
</div>
</div>
</div>
<div
class=
"goods-spec-single"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品编码:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_no"
class=
"form-control form-control"
name=
"spec[goods_no]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品价格:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_price"
data-rule=
"required"
class=
"form-control form-control"
name=
"spec[goods_price]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品划线价:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-line_price"
class=
"form-control form-control"
name=
"spec[line_price]"
type=
"number"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
当前库存数量:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-stock_num"
class=
"form-control form-control"
name=
"spec[stock_num]"
type=
"number"
value=
"100"
>
</div>
</div>
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="1">
</div>
</div>-->
</div>
<!-- 商品规格属性 end -->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Deduct_stock_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-deduct_stock_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[deduct_stock_type]"
>
{foreach name="deductStockTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"20"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <textarea id="c-content" data-rule="required" class="form-control editor form-control" rows="5" name="row[content]" cols="50"></textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="100">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price_description')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<textarea
id=
"c-price_description"
data-rule=
"required"
class=
"form-control"
name=
"row[price_description]"
></textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Brand')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-brand"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[brand]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Makefor')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="makeforList" item="vo"}
<label
for=
"row[makefor]-{$key}"
><input
id=
"row[makefor]-{$key}"
name=
"row[makefor]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"1"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Packing')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-packing"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[packing]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keep')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keep"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keep]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-number"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[number]"
type=
"text"
value=
""
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Down_image')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-down_image" data-rule="required" class="form-control form-control" size="50" name="row[down_image]" type="text">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-down_image" class="btn btn-danger plupload" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-down_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-down_image" class="btn btn-primary fachoose" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-down_image"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-down_image"></ul>-->
<!-- <span class="help-block">建议尺寸:宽375,高267</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Four_images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-four_images" data-rule="required" class="form-control form-control" size="50" name="row[four_images]" type="text">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-four_images" class="btn btn-danger plupload" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-four_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-four_images" class="btn btn-primary fachoose" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-four_images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-four_images"></ul>-->
<!-- <span class="help-block">建议尺寸:宽185,高185</span>-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Detail_images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-detail_images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[detail_images]"
placeholder=
"图片最多添加十张"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-detail_images"
data-maxcount=
"10"
class=
"btn btn-danger plupload"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"true"
data-preview-id=
"p-detail_images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-detail_images"
data-maxcount=
"10"
class=
"btn btn-primary fachoose"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-detail_images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-detail_images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽185,高185
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="goodsStatusList" item="vo"}
<label
for=
"row[goods_status]-{$key}"
><input
id=
"row[goods_status]-{$key}"
name=
"row[goods_status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"10"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_delete')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_delete"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_delete]"
>
{foreach name="isDeleteList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"0"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_index')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_index"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_index]"
>
{foreach name="isIndexList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"0"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
{include file="litestore/litestoregoods/spec_many_template" /}
<link
rel=
"stylesheet"
href=
"__CDN__/assets/addons/litestore/css/litestoregoods.css"
>
\ No newline at end of file
...
...
application/admin/view/activity_goods/seckill_goods/edit.html
0 → 100644
查看文件 @
a55664b
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_name')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_name"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[goods_name]"
type=
"text"
value=
"{$row.goods_name}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keywords')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keywords"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keywords]"
type=
"text"
value=
"{$row.keywords}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Category_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-category_id"
data-rule=
"required"
data-source=
"litestore/litestorecategory/selectpage"
class=
"form-control selectpage form-control"
name=
"row[category_id]"
type=
"text"
value=
"{$row.category_id}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Activity_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-activity_id"
data-source=
"activity/index"
class=
"form-control selectpage"
name=
"row[activity_id]"
type=
"text"
value=
"{$row.activity_id}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Image')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-image"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[image]"
type=
"text"
value=
"{$row.image}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-image"
class=
"btn btn-danger plupload"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
data-preview-id=
"p-image"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-image"
class=
"btn btn-primary fachoose"
data-input-id=
"c-image"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-multiple=
"false"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-image"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-image"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽110,高110
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
data-rule=
"required"
class=
"form-control form-control"
size=
"50"
name=
"row[images]"
type=
"text"
value=
"{$row.images}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-images"
class=
"btn btn-danger plupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽375,高375
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Spec_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-spec_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[spec_type]"
>
{foreach name="specTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.spec_type"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- 商品规格属性 start -->
<div
class=
"goods-spec-many form-group"
style=
"display: <?= $row['spec_type'] === '20' ? 'block' : 'none' ?>;"
>
<!-- <label class="control-label col-xs-12 col-sm-2"></label>-->
<div
class=
"goods-spec-box col-xs-12 col-sm-11"
style=
"background-color: white;"
>
<!-- 规格属性 -->
<div
class=
"spec-attr"
></div>
<!-- 添加规格:按钮 -->
<div
class=
"spec-group-button"
>
<button
type=
"button"
class=
"btn-addSpecGroup btn btn-xs btn-success"
>
添加规格
</button>
</div>
<!-- 添加规格:表单 -->
<div
class=
"spec-group-add"
>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格名
</label>
<input
type=
"text"
class=
"input-specName tpl-form-input"
placeholder=
"请输入规格名称"
>
</div>
<div
class=
"spec-group-add-item form-group"
>
<label
class=
"control-label form-require"
>
规格值
</label>
<input
type=
"text"
class=
"input-specValue tpl-form-input"
placeholder=
"请输入规格值"
>
</div>
<div
class=
"spec-group-add-item margin-top"
>
<button
type=
"button"
class=
"btn-addSpecName btn btn-xs btn-success"
>
确定
</button>
<button
type=
"button"
class=
"btn-cancleAddSpecName btn btn-xs btn-default"
>
取消
</button>
</div>
</div>
<!-- 商品多规格sku信息 -->
<div
class=
"goods-sku scrollable-horizontal"
>
<!-- 分割线 -->
<div
class=
"goods-spec-line"
></div>
<!-- sku 批量设置 -->
<div
class=
"spec-batch form-inline"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
>
批量设置
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"text"
data-type=
"goods_no"
placeholder=
"商家编码"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_price"
placeholder=
"销售价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"line_price"
placeholder=
"划线价"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"stock_num"
placeholder=
"库存数量"
>
</div>
<div
class=
"form-group"
>
<input
type=
"number"
data-type=
"goods_weight"
placeholder=
"重量"
>
</div>
<div
class=
"form-group"
>
<button
type=
"button"
class=
"btn-specBatchBtn btn btn-sm btn-secondary
radius"
>
确定
</button>
</div>
</div>
<!-- sku table -->
<table
class=
"spec-sku-tabel table table-bordered table-centered margin-bottom-xs text-nowrap"
></table>
</div>
</div>
</div>
<div
class=
"goods-spec-single"
style=
"display: <?= $row['spec_type'] === '10' ? 'block' : 'none' ?>;"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品编码:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_no"
class=
"form-control form-control"
name=
"spec[goods_no]"
type=
"text"
value=
"{$row.spec.0.goods_no}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品价格:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_price"
data-rule=
"required"
class=
"form-control form-control"
name=
"spec[goods_price]"
type=
"number"
value=
"{$row.spec.0.goods_price}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
商品划线价:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-line_price"
class=
"form-control form-control"
name=
"spec[line_price]"
type=
"number"
value=
"{$row.spec.0.line_price}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
当前库存数量:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-stock_num"
class=
"form-control form-control"
name=
"spec[stock_num]"
type=
"number"
value=
"{$row.spec.0.stock_num}"
>
</div>
</div>
<!--<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">商品重量(Kg):</label>
<div class="col-xs-12 col-sm-8">
<input id="c-goods_weight" class="form-control form-control" name="spec[goods_weight]" type="number" value="{$row.spec.0.goods_weight}">
</div>
</div>-->
</div>
<!-- 商品规格属性 end -->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Deduct_stock_type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-deduct_stock_type"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[deduct_stock_type]"
>
{foreach name="deductStockTypeList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.deduct_stock_type"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <textarea id="c-content" data-rule="required" class="form-control editor form-control" rows="5" name="row[content]" cols="50">{$row.content}</textarea>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_initial')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_initial" data-rule="required" class="form-control form-control" name="row[sales_initial]" type="number" value="{$row.sales_initial}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sales_actual')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sales_actual" data-rule="required" class="form-control form-control" name="row[sales_actual]" type="number" value="{$row.sales_actual}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Goods_sort')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-goods_sort" data-rule="required" class="form-control form-control" name="row[goods_sort]" type="number" value="{$row.goods_sort}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Delivery_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-delivery_id" data-rule="required" data-source="litestore/litestorefreight/index" class="form-control selectpage form-control" name="row[delivery_id]" type="text" value="{$row.delivery_id}">-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Price_description')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<textarea
id=
"c-price_description"
data-rule=
"required"
class=
"form-control"
name=
"row[price_description]"
>
{$row.price_description}
</textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Brand')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-brand"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[brand]"
type=
"text"
value=
"{$row.brand}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Makefor')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="makeforList" item="vo"}
<label
for=
"row[makefor]-{$key}"
><input
id=
"row[makefor]-{$key}"
name=
"row[makefor]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.makefor"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Packing')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-packing"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[packing]"
type=
"text"
value=
"{$row.packing}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Keep')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-keep"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[keep]"
type=
"text"
value=
"{$row.keep}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Number')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-number"
data-rule=
"required"
class=
"form-control form-control"
name=
"row[number]"
type=
"text"
value=
"{$row.number}"
>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Down_image')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-down_image" data-rule="required" class="form-control form-control" size="50" name="row[down_image]" type="text" value="{$row.down_image}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-down_image" class="btn btn-danger plupload" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false" data-preview-id="p-down_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-down_image" class="btn btn-primary fachoose" data-input-id="c-down_image" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-down_image"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-down_image"></ul>-->
<!-- <span class="help-block">建议尺寸:宽375,高267</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Four_images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-four_images" data-rule="required" class="form-control form-control" size="50" name="row[four_images]" type="text" value="{$row.four_images}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="plupload-four_images" class="btn btn-danger plupload" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true" data-preview-id="p-four_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-four_images" class="btn btn-primary fachoose" data-input-id="c-four_images" data-mimetype="image/jpeg,image/png,image/jpg" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-four_images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline plupload-preview" id="p-four_images"></ul>-->
<!-- <span class="help-block">建议尺寸:宽185,高185</span>-->
<!-- </div>-->
<!-- </div>-->
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Detail_images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-detail_images"
data-rule=
"required"
placeholder=
"图片最多添加十张"
class=
"form-control form-control"
size=
"50"
name=
"row[detail_images]"
type=
"text"
value=
"{$row.detail_images}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"plupload-detail_images"
class=
"btn btn-danger plupload"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-maxcount=
"10"
data-multiple=
"true"
data-preview-id=
"p-detail_images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-detail_images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-detail_images"
data-mimetype=
"image/jpeg,image/png,image/jpg"
data-maxcount=
"10"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-detail_images"
></span>
</div>
<ul
class=
"row list-inline plupload-preview"
id=
"p-detail_images"
></ul>
<span
class=
"help-block"
>
建议尺寸:宽185,高185
</span>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="goodsStatusList" item="vo"}
<label
for=
"row[goods_status]-{$key}"
><input
id=
"row[goods_status]-{$key}"
name=
"row[goods_status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.goods_status"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_delete')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_delete"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_delete]"
>
{foreach name="isDeleteList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.is_delete"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Is_index')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-is_index"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[is_index]"
>
{foreach name="isIndexList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.is_index"
}
selected
{/
in
}
>
{$vo}
</option>
{/foreach}
</select>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
{include file="litestore/litestoregoods/spec_many_template" /}
<link
rel=
"stylesheet"
href=
"__CDN__/assets/addons/litestore/css/litestoregoods.css"
>
<script
type=
"text/javascript"
>
var
from_specData
=
<
?
=
$row
[
'specData'
]
?
>
;
</script>
\ No newline at end of file
...
...
application/admin/view/activity_goods/seckill_goods/index.html
0 → 100644
查看文件 @
a55664b
<div
class=
"panel panel-default panel-intro"
>
{:build_heading()}
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<a
href=
"javascript:;"
class=
"btn btn-primary btn-refresh"
title=
"{:__('Refresh')}"
><i
class=
"fa fa-refresh"
></i>
</a>
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-add {:$auth->check('litestore/litestoregoods/add')?'':'hide'}"-->
<!-- title="{:__('Add')}"><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('litestore/litestoregoods/edit')?'':'hide'}"-->
<!-- title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('litestore/litestoregoods/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<div
class=
"dropdown btn-group {:$auth->check('litestore/litestoregoods/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-check-square-o"
></i>
{:__('批量添加活动商品')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=1"
><i
class=
"fa fa-free-code-camp"
></i>
{:__('新人用户')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=2"
><i
class=
"fa fa-clock-o"
></i>
{:__('限时秒杀')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=3"
><i
class=
"fa fa-location-arrow"
></i>
{:__('进口商品')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=0"
><i
class=
"fa fa-eye-slash"
></i>
{:__('不参与活动')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('litestore/litestoregoods/edit')}"
data-operate-del=
"{:$auth->check('litestore/litestoregoods/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
...
...
application/admin/view/activity_goods/seckill_goods/spec_many_template.html
0 → 100644
查看文件 @
a55664b
<!-- 商品规格属性模板 -->
<script
id=
"tpl_spec_attr"
type=
"text/template"
>
<%
for
(
var
j
=
0
;
j
<
spec_attr
.
length
;
j
++
){
%>
<
div
class
=
"spec-group-item"
data
-
index
=
"<%=j%>"
data
-
group
-
id
=
"<%=spec_attr[j].group_id%>"
>
<
div
class
=
"spec-group-name"
>
<
span
><%=
spec_attr
[
j
].
group_name
%><
/span
>
<
i
class
=
"spec-group-delete fa fa-trash icon-shanchu1"
title
=
"点击删除"
><
/i
>
<
/div
>
<
div
class
=
"spec-list am-cf"
>
<%
for
(
var
k
=
0
;
k
<
spec_attr
[
j
].
spec_items
.
length
;
k
++
){
%>
<
div
class
=
"spec-item am-fl"
data
-
item
-
index
=
"<%=k%>"
>
<
span
><%=
spec_attr
[
j
].
spec_items
[
k
].
spec_value
%><
/span
>
<
i
class
=
"spec-item-delete fa fa-trash icon-shanchu1"
title
=
"点击删除"
><
/i
>
<
/div
>
<%
}
%>
<
div
class
=
"spec-item-add am-cf am-fl"
>
<
input
type
=
"text"
class
=
"ipt-specItem am-fl am-field-valid"
>
<
button
type
=
"button"
class
=
"btn-addSpecItem btn btn-xs btn-success am-fl"
>
添加
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<%
}
%>
</script>
<!-- 商品规格table模板 -->
<script
id=
"tpl_spec_table"
type=
"text/template"
>
<
tbody
>
<
tr
>
<
th
>
单
sku
隐藏
<
/th
>
<%
for
(
var
i
=
0
;
i
<
spec_attr
.
length
;
i
++
){
%>
<
th
><%=
spec_attr
[
i
].
group_name
%><
/th
>
<%
}
%>
<
th
>
商品编码
<
/th
>
<
th
>
销售价
<
/th
>
<
th
>
划线价
<
/th
>
<
th
>
库存
(
-
1
隐藏
)
<
/th
>
<!--
<
th
>
重量
(
kg
)
<
/th>--
>
<
th
>
规格封面
<
/th
>
<
th
>
封面编辑
<
/th
>
<
/tr
>
<%
for
(
var
i
=
0
;
i
<
spec_list
.
length
;
i
++
){
%>
<
tr
data
-
index
=
"<%=i%>"
data
-
sku
-
id
=
"<%=spec_list[i].spec_sku_id %>"
>
<
td
>
<
button
type
=
"button"
class
=
"am-text-middle btn delsku-bt"
><%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
显示
<%
}
else
{
%>
隐藏
<%
}
%><
/button
>
<
/td
>
<%
for
(
var
k
=
0
;
k
<
spec_list
[
i
].
rows
.
length
;
k
++
){
%>
<
td
class
=
"td-spec-value am-text-middle"
rowspan
=
"<%=spec_list[i].rows[k].rowspan%>"
>
<%=
spec_list
[
i
].
rows
[
k
].
spec_value
%>
<
/td
>
<%
}
%>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"text"
name
=
"goods_no"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_no%>"
class
=
"ipt-goods-no am-field-valid"
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"goods_price"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_price%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"line_price"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.line_price%>"
class
=
"am-field-valid ipt-w80"
>
<
/td
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"stock_num"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.stock_num%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td
>
<!--
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
type
=
"number"
name
=
"goods_weight"
data
-
rule
=
"required"
value
=
"<%=spec_list[i].form.goods_weight%>"
class
=
"am-field-valid ipt-w80"
required
>
<
/td>--
>
<
td
>
<
input
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
id
=
"c-image<%=i%>"
class
=
"form-control form-control"
style
=
"display: none!important;"
name
=
"spec_image"
type
=
"text"
value
=
"<%=spec_list[i].form.spec_image%>"
>
<
div
class
=
"row list-inline plupload-preview spe_img_one"
id
=
"p-image<%=i%>"
><
/div
>
<
/td
>
<
td
>
<
div
class
=
"input-group-addon no-border no-padding"
>
<
span
><
button
type
=
"button"
id
=
"plupload-image<%=i%>"
style
=
"display: none!important;"
class
=
"btn btn-danger plupload"
data
-
input
-
id
=
"c-image<%=i%>"
data
-
mimetype
=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data
-
multiple
=
"false"
data
-
preview
-
id
=
"p-image<%=i%>"
><
i
class
=
"fa fa-upload"
><
/i> {:__
(
'Upload'
)
}</
button
><
/span
>
<
span
><
button
type
=
"button"
<%
if
(
spec_list
[
i
].
form
.
stock_num
===-
1
)
{
%>
disabled
<%
}
else
{
%>
<%
}
%>
id
=
"fachoose-image<%=i%>"
class
=
"btn btn-primary fachoose"
data
-
input
-
id
=
"c-image<%=i%>"
data
-
mimetype
=
"image/*"
data
-
preview
-
id
=
"p-image<%=i%>"
data
-
multiple
=
"false"
><
i
class
=
"fa fa-list"
><
/i> {:__
(
'Choose'
)
}</
button
><
/span
>
<
/div
>
<
/td
>
<
/tr
>
<%
}
%>
<
/tbody
>
</script>
...
...
application/admin/view/litestore/litestoregoods/index.html
查看文件 @
a55664b
...
...
@@ -11,12 +11,15 @@
<a
href=
"javascript:;"
class=
"btn btn-success btn-add {:$auth->check('litestore/litestoregoods/add')?'':'hide'}"
title=
"{:__('Add')}"
><i
class=
"fa fa-plus"
></i>
{:__('Add')}
</a>
<!-- <a href="javascript:;"-->
<!-- class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('litestore/litestoregoods/edit')?'':'hide'}"-->
<!-- title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-success btn-edit btn-disabled disabled {:$auth->check('litestore/litestoregoods/edit')?'':'hide'}"
title=
"{:__('Edit')}"
><i
class=
"fa fa-pencil"
></i>
{:__('Edit')}
</a>
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('litestore/litestoregoods/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
class=
"btn btn-success btn-discount btn-disabled disabled {:$auth->check('litestore/litestoregoods/discount')?'':'hide'}"
title=
"{:__('设置折扣')}"
><i
class=
"fa fa-pencil"
></i>
{:__('批量设置折扣')}
</a>
<!-- <a href="javascript:;"-->
<!-- class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('litestore/litestoregoods/del')?'':'hide'}"-->
<!-- title="{:__('Delete')}"><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-danger btn-import {:$auth->check('litestore/litestoregoods/import')?'':'hide'}"
title=
"{:__('Import')}"
id=
"btn-import-file"
data-url=
"ajax/upload"
...
...
@@ -26,18 +29,18 @@
<!-- class="btn btn-info btn-change btn-export btn-disable" data-params="action=export"-->
<!-- data-url="litestore/litestoregoods/export"-->
<!-- title="{:__('批量导出')}"><i class="fa fa-download"></i>{:__('批量导出')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-info btn-export {:$auth->check('litestore/litestoregoods/export')?'':'hide'}"
title=
"{:__('Export')}"
id=
"btn-export-file"
><i
class=
"fa fa-download"
></i>
批量导出
</a>
<a
href=
"javascript:;"
class=
"btn btn-info btn-export {:$auth->check('litestore/litestoregoods/export')?'':'hide'}"
title=
"{:__('Export')}"
id=
"btn-export-file"
><i
class=
"fa fa-download"
></i>
批量导出
</a>
<a
href=
"{$template}"
class=
"btn btn-info"
><i
class=
"fa fa-folder-open"
></i>
{:__('导入模板下载')}
</a>
<!-- <div class="dropdown btn-group {:$auth->check('litestore/litestoregoods/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
<div
class=
"dropdown btn-group {:$auth->check('litestore/litestoregoods/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-check-square-o"
></i>
{:__('批量添加活动商品')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=1"
><i
class=
"fa fa-free-code-camp"
></i>
{:__('新人用户')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=2"
><i
class=
"fa fa-clock-o"
></i>
{:__('限时秒杀')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=3"
><i
class=
"fa fa-location-arrow"
></i>
{:__('进口商品')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"activity_id=0"
><i
class=
"fa fa-eye-slash"
></i>
{:__('不参与活动')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('litestore/litestoregoods/edit')}"
...
...
application/api/controller/Classification.php
查看文件 @
a55664b
...
...
@@ -418,7 +418,7 @@ class Classification extends Api
$item
[
'line_price'
]
=
round
(
$goods_spec
[
'line_price'
],
2
);
//判断是否打折
$item
[
'is_discount'
]
=
'is'
;
if
(
$goods_spec
[
'goods_price'
]
==
$goods_spec
[
'line_price'
]
)
{
if
(
empty
(
$goods_spec
[
'discount'
])
)
{
$item
[
'is_discount'
]
=
'no'
;
}
$item
[
'discount'
]
=
$goods_spec
[
'discount'
];
...
...
@@ -459,7 +459,7 @@ class Classification extends Api
$spec_value
[
'cart_number'
]
=
$number
??
0
;
//判断是否打折
$spec_value
[
'is_discount'
]
=
'is'
;
if
(
$spec_value
[
'goods_price'
]
==
$spec_value
[
'line_price'
]
)
{
if
(
empty
(
$spec_value
[
'discount'
])
)
{
$spec_value
[
'is_discount'
]
=
'no'
;
}
}
...
...
@@ -488,7 +488,7 @@ class Classification extends Api
$item
[
'line_price'
]
=
round
(
$goods_spec
[
'line_price'
],
2
);
//判断是否打折
$item
[
'is_discount'
]
=
'is'
;
if
(
$goods_spec
[
'goods_price'
]
==
$goods_spec
[
'line_price'
]
)
{
if
(
empty
(
$goods_spec
[
'discount'
])
)
{
$item
[
'is_discount'
]
=
'no'
;
}
$item
[
'discount'
]
=
$goods_spec
[
'discount'
];
...
...
@@ -530,7 +530,7 @@ class Classification extends Api
$spec_value
[
'cart_number'
]
=
$number
??
0
;
//判断是否打折
$spec_value
[
'is_discount'
]
=
'is'
;
if
(
$spec_value
[
'goods_price'
]
==
$spec_value
[
'line_price'
]
)
{
if
(
empty
(
$spec_value
[
'discount'
])
)
{
$spec_value
[
'is_discount'
]
=
'no'
;
}
}
...
...
application/api/controller/Goods.php
查看文件 @
a55664b
...
...
@@ -62,7 +62,7 @@ class Goods extends Api
$goods
[
'line_price'
]
=
$goods_spec
[
'line_price'
];
//判断是否打折
$goods
[
'is_discount'
]
=
'is'
;
if
(
$goods_spec
[
'goods_price'
]
==
$goods_spec
[
'line_price'
]
)
{
if
(
empty
(
$goods_spec
[
'discount'
])
)
{
$goods
[
'is_discount'
]
=
'no'
;
}
$goods
[
'discount'
]
=
$goods_spec
[
'discount'
];
...
...
@@ -161,7 +161,7 @@ class Goods extends Api
}
//判断是否打折
$value
[
'is_discount'
]
=
'is'
;
if
(
$value
[
'goods_price'
]
==
$value
[
'line_price'
]
)
{
if
(
empty
(
$value
[
'discount'
])
)
{
$value
[
'is_discount'
]
=
'no'
;
}
}
...
...
public/assets/js/backend/activity_goods/import_goods.js
0 → 100644
查看文件 @
a55664b
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"
]);
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'activity_goods/import_goods/index'
,
add_url
:
'litestore/litestoregoods/add'
,
edit_url
:
'litestore/litestoregoods/edit'
,
del_url
:
'litestore/litestoregoods/del'
,
discount_url
:
'litestore/litestoregoods/discount'
,
multi_url
:
'litestore/litestoregoods/multi'
,
import_url
:
'litestore/litestoregoods/import'
,
table
:
'litestore_goods'
,
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'goods_id'
,
sortName
:
'goods_sort'
,
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
:
'LIKE'
},
{
field
:
'activity.name'
,
title
:
__
(
'Activity.name'
),
operate
:
'LIKE'
},
// {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: '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
}
]
]
});
table
.
on
(
'.btn-discount'
,
function
(
e
,
settings
,
json
,
xhr
)
{
Fast
.
api
.
open
()
});
//*************************** 自定义export开始
var
submitForm
=
function
(
ids
,
layero
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
console
.
log
(
options
);
var
columns
=
[];
$
.
each
(
options
.
columns
[
0
],
function
(
i
,
j
)
{
if
(
j
.
field
&&
!
j
.
checkbox
&&
j
.
visible
&&
j
.
field
!=
'operate'
)
{
columns
.
push
(
j
.
field
);
}
});
var
search
=
options
.
queryParams
({});
$
(
"input[name=search]"
,
layero
).
val
(
options
.
searchText
);
$
(
"input[name=ids]"
,
layero
).
val
(
ids
);
$
(
"input[name=filter]"
,
layero
).
val
(
search
.
filter
);
$
(
"input[name=op]"
,
layero
).
val
(
search
.
op
);
$
(
"input[name=columns]"
,
layero
).
val
(
columns
.
join
(
','
));
$
(
"form"
,
layero
).
submit
();
};
$
(
document
).
on
(
"click"
,
".btn-export"
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
var
page
=
table
.
bootstrapTable
(
'getData'
);
var
all
=
table
.
bootstrapTable
(
'getOptions'
).
totalRows
;
console
.
log
(
ids
,
page
,
all
);
Layer
.
confirm
(
"请选择导出的选项<form action='"
+
Fast
.
api
.
fixurl
(
"litestore/litestoregoods/export"
)
+
"' method='post' target='_blank'><input type='hidden' name='ids' value='' /><input type='hidden' name='filter' ><input type='hidden' name='op'><input type='hidden' name='search'><input type='hidden' name='columns'></form>"
,
{
title
:
'导出数据'
,
btn
:
[
"导出("
+
all
+
"条)"
],
// btn: ["选中项(" + ids.length + "条)"],
success
:
function
(
layero
,
index
)
{
$
(
".layui-layer-btn a"
,
layero
).
addClass
(
"layui-layer-btn0"
);
}
,
yes
:
function
(
index
,
layero
)
{
submitForm
(
ids
.
join
(
","
),
layero
);
return
false
;
}
,
btn2
:
function
(
index
,
layero
)
{
var
ids
=
[];
$
.
each
(
page
,
function
(
i
,
j
)
{
ids
.
push
(
j
.
id
);
});
submitForm
(
ids
.
join
(
","
),
layero
);
return
false
;
}
,
btn3
:
function
(
index
,
layero
)
{
submitForm
(
"all"
,
layero
);
return
false
;
}
})
});
//*************************** 自定义export结束
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
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
)
{
Fast
.
api
.
close
(
data
);
Toastr
.
success
(
"商品提交成功"
);
},
function
(
data
,
ret
)
{
Toastr
.
success
(
"商品提交失败"
);
},
function
(
success
,
error
)
{
//注意如果我们需要阻止表单,可以在此使用return false;即可
//如果我们处理完成需要再次提交表单则可以使用submit提交,如下
console
.
log
(
this
);
var
form
=
this
;
if
(
form
.
size
()
===
0
)
{
Toastr
.
error
(
"表单未初始化完成,无法提交"
);
return
false
;
}
var
type
=
form
.
attr
(
"method"
)
?
form
.
attr
(
"method"
).
toUpperCase
()
:
'GET'
;
type
=
type
&&
(
type
===
'GET'
||
type
===
'POST'
)
?
type
:
'GET'
;
url
=
form
.
attr
(
"action"
);
url
=
url
?
url
:
location
.
href
;
//修复当存在多选项元素时提交的BUG
var
params
=
{};
var
multipleList
=
$
(
"[name$='[]']"
,
form
);
if
(
multipleList
.
size
()
>
0
)
{
var
postFields
=
form
.
serializeArray
().
map
(
function
(
obj
)
{
return
$
(
obj
).
prop
(
"name"
);
});
$
.
each
(
multipleList
,
function
(
i
,
j
)
{
if
(
postFields
.
indexOf
(
$
(
this
).
prop
(
"name"
))
<
0
)
{
params
[
$
(
this
).
prop
(
"name"
)]
=
''
;
}
});
}
var
dataParam
=
{
spec_many
:
specMany
.
getData
()};
console
.
log
(
dataParam
);
Fast
.
api
.
ajax
({
type
:
type
,
url
:
url
,
data
:
form
.
serialize
()
+
(
Object
.
keys
(
params
).
length
>
0
?
'&'
+
$
.
param
(
params
)
:
''
)
+
(
Object
.
keys
(
dataParam
).
length
>
0
?
'&'
+
$
.
param
(
dataParam
)
:
''
),
dataType
:
'json'
,
complete
:
function
(
xhr
)
{
var
token
=
xhr
.
getResponseHeader
(
'__token__'
);
if
(
token
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
token
);
}
if
(
xhr
.
responseJSON
.
code
==
1
)
{
//关闭弹窗
var
index
=
parent
.
Layer
.
getFrameIndex
(
window
.
name
);
var
callback
=
parent
.
$
(
"#layui-layer"
+
index
).
data
(
"callback"
);
parent
.
Layer
.
close
(
index
);
//刷新列表
parent
.
$
(
"#table"
).
bootstrapTable
(
'refresh'
);
}
}
},
function
(
data
,
ret
)
{
$
(
'.form-group'
,
form
).
removeClass
(
'has-feedback has-success has-error'
);
if
(
data
&&
typeof
data
===
'object'
)
{
if
(
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
if
(
typeof
data
.
callback
!==
'undefined'
&&
typeof
data
.
callback
===
'function'
)
{
data
.
callback
.
call
(
form
,
data
);
}
}
},
function
(
data
,
ret
)
{
if
(
data
&&
typeof
data
===
'object'
&&
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
});
return
false
;
});
// 注册商品多规格组件
var
specMany
=
new
GoodsSpec
({
container
:
'.goods-spec-many'
,
OutForm
:
Form
});
// 切换单/多规格
$
(
'select[name="row[spec_type]"'
).
change
(
function
(
e
)
{
var
$goodsSpecMany
=
$
(
'.goods-spec-many'
)
,
$goodsSpecSingle
=
$
(
'.goods-spec-single'
);
if
(
e
.
currentTarget
.
value
===
'10'
)
{
$goodsSpecMany
.
hide
()
&&
$goodsSpecSingle
.
show
();
}
else
{
$goodsSpecMany
.
show
()
&&
$goodsSpecSingle
.
hide
();
}
});
},
edit
:
function
()
{
//Controller.api.bindevent();
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
),
function
(
data
,
ret
)
{
//Fast.api.close(data);
Toastr
.
success
(
"商品提交成功"
);
},
function
(
data
,
ret
)
{
Toastr
.
success
(
"商品提交失败"
);
},
function
(
success
,
error
)
{
//注意如果我们需要阻止表单,可以在此使用return false;即可
//如果我们处理完成需要再次提交表单则可以使用submit提交,如下
console
.
log
(
this
);
var
form
=
this
;
if
(
form
.
size
()
===
0
)
{
Toastr
.
error
(
"表单未初始化完成,无法提交"
);
return
false
;
}
var
type
=
form
.
attr
(
"method"
)
?
form
.
attr
(
"method"
).
toUpperCase
()
:
'GET'
;
type
=
type
&&
(
type
===
'GET'
||
type
===
'POST'
)
?
type
:
'GET'
;
url
=
form
.
attr
(
"action"
);
url
=
url
?
url
:
location
.
href
;
//修复当存在多选项元素时提交的BUG
var
params
=
{};
var
multipleList
=
$
(
"[name$='[]']"
,
form
);
if
(
multipleList
.
size
()
>
0
)
{
var
postFields
=
form
.
serializeArray
().
map
(
function
(
obj
)
{
return
$
(
obj
).
prop
(
"name"
);
});
$
.
each
(
multipleList
,
function
(
i
,
j
)
{
if
(
postFields
.
indexOf
(
$
(
this
).
prop
(
"name"
))
<
0
)
{
params
[
$
(
this
).
prop
(
"name"
)]
=
''
;
}
});
}
var
dataParam
=
{
spec_many
:
specMany
.
getData
()};
console
.
log
(
dataParam
);
Fast
.
api
.
ajax
({
type
:
type
,
url
:
url
,
data
:
form
.
serialize
()
+
(
Object
.
keys
(
params
).
length
>
0
?
'&'
+
$
.
param
(
params
)
:
''
)
+
(
Object
.
keys
(
dataParam
).
length
>
0
?
'&'
+
$
.
param
(
dataParam
)
:
''
),
dataType
:
'json'
,
complete
:
function
(
xhr
)
{
var
token
=
xhr
.
getResponseHeader
(
'__token__'
);
if
(
token
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
token
);
}
if
(
xhr
.
responseJSON
.
code
==
1
)
{
//关闭弹窗
var
index
=
parent
.
Layer
.
getFrameIndex
(
window
.
name
);
var
callback
=
parent
.
$
(
"#layui-layer"
+
index
).
data
(
"callback"
);
parent
.
Layer
.
close
(
index
);
//刷新列表
parent
.
$
(
"#table"
).
bootstrapTable
(
'refresh'
);
}
}
},
function
(
data
,
ret
)
{
$
(
'.form-group'
,
form
).
removeClass
(
'has-feedback has-success has-error'
);
if
(
data
&&
typeof
data
===
'object'
)
{
if
(
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
if
(
typeof
data
.
callback
!==
'undefined'
&&
typeof
data
.
callback
===
'function'
)
{
data
.
callback
.
call
(
form
,
data
);
}
}
},
function
(
data
,
ret
)
{
if
(
data
&&
typeof
data
===
'object'
&&
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
});
return
false
;
});
// 注册商品多规格组件
var
specMany
=
new
GoodsSpec
({
container
:
'.goods-spec-many'
,
OutForm
:
Form
},
from_specData
);
// 切换单/多规格
$
(
'select[name="row[spec_type]"'
).
change
(
function
(
e
)
{
var
$goodsSpecMany
=
$
(
'.goods-spec-many'
)
,
$goodsSpecSingle
=
$
(
'.goods-spec-single'
);
if
(
e
.
currentTarget
.
value
===
'10'
)
{
$goodsSpecMany
.
hide
()
&&
$goodsSpecSingle
.
show
();
}
else
{
$goodsSpecMany
.
show
()
&&
$goodsSpecSingle
.
hide
();
}
});
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
}
}
};
return
Controller
;
});
\ No newline at end of file
...
...
public/assets/js/backend/activity_goods/new_goods.js
0 → 100644
查看文件 @
a55664b
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"
]);
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'activity_goods/new_goods/index'
,
add_url
:
'litestore/litestoregoods/add'
,
edit_url
:
'litestore/litestoregoods/edit'
,
del_url
:
'litestore/litestoregoods/del'
,
discount_url
:
'litestore/litestoregoods/discount'
,
multi_url
:
'litestore/litestoregoods/multi'
,
import_url
:
'litestore/litestoregoods/import'
,
table
:
'litestore_goods'
,
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'goods_id'
,
sortName
:
'goods_sort'
,
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
:
'LIKE'
},
{
field
:
'activity.name'
,
title
:
__
(
'Activity.name'
),
operate
:
'LIKE'
},
// {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: '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
}
]
]
});
table
.
on
(
'.btn-discount'
,
function
(
e
,
settings
,
json
,
xhr
)
{
Fast
.
api
.
open
()
});
//*************************** 自定义export开始
var
submitForm
=
function
(
ids
,
layero
)
{
var
options
=
table
.
bootstrapTable
(
'getOptions'
);
console
.
log
(
options
);
var
columns
=
[];
$
.
each
(
options
.
columns
[
0
],
function
(
i
,
j
)
{
if
(
j
.
field
&&
!
j
.
checkbox
&&
j
.
visible
&&
j
.
field
!=
'operate'
)
{
columns
.
push
(
j
.
field
);
}
});
var
search
=
options
.
queryParams
({});
$
(
"input[name=search]"
,
layero
).
val
(
options
.
searchText
);
$
(
"input[name=ids]"
,
layero
).
val
(
ids
);
$
(
"input[name=filter]"
,
layero
).
val
(
search
.
filter
);
$
(
"input[name=op]"
,
layero
).
val
(
search
.
op
);
$
(
"input[name=columns]"
,
layero
).
val
(
columns
.
join
(
','
));
$
(
"form"
,
layero
).
submit
();
};
$
(
document
).
on
(
"click"
,
".btn-export"
,
function
()
{
var
ids
=
Table
.
api
.
selectedids
(
table
);
var
page
=
table
.
bootstrapTable
(
'getData'
);
var
all
=
table
.
bootstrapTable
(
'getOptions'
).
totalRows
;
console
.
log
(
ids
,
page
,
all
);
Layer
.
confirm
(
"请选择导出的选项<form action='"
+
Fast
.
api
.
fixurl
(
"litestore/litestoregoods/export"
)
+
"' method='post' target='_blank'><input type='hidden' name='ids' value='' /><input type='hidden' name='filter' ><input type='hidden' name='op'><input type='hidden' name='search'><input type='hidden' name='columns'></form>"
,
{
title
:
'导出数据'
,
btn
:
[
"导出("
+
all
+
"条)"
],
// btn: ["选中项(" + ids.length + "条)"],
success
:
function
(
layero
,
index
)
{
$
(
".layui-layer-btn a"
,
layero
).
addClass
(
"layui-layer-btn0"
);
}
,
yes
:
function
(
index
,
layero
)
{
submitForm
(
ids
.
join
(
","
),
layero
);
return
false
;
}
,
btn2
:
function
(
index
,
layero
)
{
var
ids
=
[];
$
.
each
(
page
,
function
(
i
,
j
)
{
ids
.
push
(
j
.
id
);
});
submitForm
(
ids
.
join
(
","
),
layero
);
return
false
;
}
,
btn3
:
function
(
index
,
layero
)
{
submitForm
(
"all"
,
layero
);
return
false
;
}
})
});
//*************************** 自定义export结束
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
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
)
{
Fast
.
api
.
close
(
data
);
Toastr
.
success
(
"商品提交成功"
);
},
function
(
data
,
ret
)
{
Toastr
.
success
(
"商品提交失败"
);
},
function
(
success
,
error
)
{
//注意如果我们需要阻止表单,可以在此使用return false;即可
//如果我们处理完成需要再次提交表单则可以使用submit提交,如下
console
.
log
(
this
);
var
form
=
this
;
if
(
form
.
size
()
===
0
)
{
Toastr
.
error
(
"表单未初始化完成,无法提交"
);
return
false
;
}
var
type
=
form
.
attr
(
"method"
)
?
form
.
attr
(
"method"
).
toUpperCase
()
:
'GET'
;
type
=
type
&&
(
type
===
'GET'
||
type
===
'POST'
)
?
type
:
'GET'
;
url
=
form
.
attr
(
"action"
);
url
=
url
?
url
:
location
.
href
;
//修复当存在多选项元素时提交的BUG
var
params
=
{};
var
multipleList
=
$
(
"[name$='[]']"
,
form
);
if
(
multipleList
.
size
()
>
0
)
{
var
postFields
=
form
.
serializeArray
().
map
(
function
(
obj
)
{
return
$
(
obj
).
prop
(
"name"
);
});
$
.
each
(
multipleList
,
function
(
i
,
j
)
{
if
(
postFields
.
indexOf
(
$
(
this
).
prop
(
"name"
))
<
0
)
{
params
[
$
(
this
).
prop
(
"name"
)]
=
''
;
}
});
}
var
dataParam
=
{
spec_many
:
specMany
.
getData
()};
console
.
log
(
dataParam
);
Fast
.
api
.
ajax
({
type
:
type
,
url
:
url
,
data
:
form
.
serialize
()
+
(
Object
.
keys
(
params
).
length
>
0
?
'&'
+
$
.
param
(
params
)
:
''
)
+
(
Object
.
keys
(
dataParam
).
length
>
0
?
'&'
+
$
.
param
(
dataParam
)
:
''
),
dataType
:
'json'
,
complete
:
function
(
xhr
)
{
var
token
=
xhr
.
getResponseHeader
(
'__token__'
);
if
(
token
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
token
);
}
if
(
xhr
.
responseJSON
.
code
==
1
)
{
//关闭弹窗
var
index
=
parent
.
Layer
.
getFrameIndex
(
window
.
name
);
var
callback
=
parent
.
$
(
"#layui-layer"
+
index
).
data
(
"callback"
);
parent
.
Layer
.
close
(
index
);
//刷新列表
parent
.
$
(
"#table"
).
bootstrapTable
(
'refresh'
);
}
}
},
function
(
data
,
ret
)
{
$
(
'.form-group'
,
form
).
removeClass
(
'has-feedback has-success has-error'
);
if
(
data
&&
typeof
data
===
'object'
)
{
if
(
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
if
(
typeof
data
.
callback
!==
'undefined'
&&
typeof
data
.
callback
===
'function'
)
{
data
.
callback
.
call
(
form
,
data
);
}
}
},
function
(
data
,
ret
)
{
if
(
data
&&
typeof
data
===
'object'
&&
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
});
return
false
;
});
// 注册商品多规格组件
var
specMany
=
new
GoodsSpec
({
container
:
'.goods-spec-many'
,
OutForm
:
Form
});
// 切换单/多规格
$
(
'select[name="row[spec_type]"'
).
change
(
function
(
e
)
{
var
$goodsSpecMany
=
$
(
'.goods-spec-many'
)
,
$goodsSpecSingle
=
$
(
'.goods-spec-single'
);
if
(
e
.
currentTarget
.
value
===
'10'
)
{
$goodsSpecMany
.
hide
()
&&
$goodsSpecSingle
.
show
();
}
else
{
$goodsSpecMany
.
show
()
&&
$goodsSpecSingle
.
hide
();
}
});
},
edit
:
function
()
{
//Controller.api.bindevent();
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
),
function
(
data
,
ret
)
{
//Fast.api.close(data);
Toastr
.
success
(
"商品提交成功"
);
},
function
(
data
,
ret
)
{
Toastr
.
success
(
"商品提交失败"
);
},
function
(
success
,
error
)
{
//注意如果我们需要阻止表单,可以在此使用return false;即可
//如果我们处理完成需要再次提交表单则可以使用submit提交,如下
console
.
log
(
this
);
var
form
=
this
;
if
(
form
.
size
()
===
0
)
{
Toastr
.
error
(
"表单未初始化完成,无法提交"
);
return
false
;
}
var
type
=
form
.
attr
(
"method"
)
?
form
.
attr
(
"method"
).
toUpperCase
()
:
'GET'
;
type
=
type
&&
(
type
===
'GET'
||
type
===
'POST'
)
?
type
:
'GET'
;
url
=
form
.
attr
(
"action"
);
url
=
url
?
url
:
location
.
href
;
//修复当存在多选项元素时提交的BUG
var
params
=
{};
var
multipleList
=
$
(
"[name$='[]']"
,
form
);
if
(
multipleList
.
size
()
>
0
)
{
var
postFields
=
form
.
serializeArray
().
map
(
function
(
obj
)
{
return
$
(
obj
).
prop
(
"name"
);
});
$
.
each
(
multipleList
,
function
(
i
,
j
)
{
if
(
postFields
.
indexOf
(
$
(
this
).
prop
(
"name"
))
<
0
)
{
params
[
$
(
this
).
prop
(
"name"
)]
=
''
;
}
});
}
var
dataParam
=
{
spec_many
:
specMany
.
getData
()};
console
.
log
(
dataParam
);
Fast
.
api
.
ajax
({
type
:
type
,
url
:
url
,
data
:
form
.
serialize
()
+
(
Object
.
keys
(
params
).
length
>
0
?
'&'
+
$
.
param
(
params
)
:
''
)
+
(
Object
.
keys
(
dataParam
).
length
>
0
?
'&'
+
$
.
param
(
dataParam
)
:
''
),
dataType
:
'json'
,
complete
:
function
(
xhr
)
{
var
token
=
xhr
.
getResponseHeader
(
'__token__'
);
if
(
token
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
token
);
}
if
(
xhr
.
responseJSON
.
code
==
1
)
{
//关闭弹窗
var
index
=
parent
.
Layer
.
getFrameIndex
(
window
.
name
);
var
callback
=
parent
.
$
(
"#layui-layer"
+
index
).
data
(
"callback"
);
parent
.
Layer
.
close
(
index
);
//刷新列表
parent
.
$
(
"#table"
).
bootstrapTable
(
'refresh'
);
}
}
},
function
(
data
,
ret
)
{
$
(
'.form-group'
,
form
).
removeClass
(
'has-feedback has-success has-error'
);
if
(
data
&&
typeof
data
===
'object'
)
{
if
(
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
if
(
typeof
data
.
callback
!==
'undefined'
&&
typeof
data
.
callback
===
'function'
)
{
data
.
callback
.
call
(
form
,
data
);
}
}
},
function
(
data
,
ret
)
{
if
(
data
&&
typeof
data
===
'object'
&&
typeof
data
.
token
!==
'undefined'
)
{
$
(
"input[name='__token__']"
,
form
).
val
(
data
.
token
);
}
});
return
false
;
});
// 注册商品多规格组件
var
specMany
=
new
GoodsSpec
({
container
:
'.goods-spec-many'
,
OutForm
:
Form
},
from_specData
);
// 切换单/多规格
$
(
'select[name="row[spec_type]"'
).
change
(
function
(
e
)
{
var
$goodsSpecMany
=
$
(
'.goods-spec-many'
)
,
$goodsSpecSingle
=
$
(
'.goods-spec-single'
);
if
(
e
.
currentTarget
.
value
===
'10'
)
{
$goodsSpecMany
.
hide
()
&&
$goodsSpecSingle
.
show
();
}
else
{
$goodsSpecMany
.
show
()
&&
$goodsSpecSingle
.
hide
();
}
});
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
}
}
};
return
Controller
;
});
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论