Authored by 姜敏

拍摄管理和测量管理功能(初步完成功能)

'use strict';
var $ = require('jquery');
var common = require('../common/common');
function batchExport(el, type) {
var loadModal = null;
return {
params: {
type: type,
__type: "batch-import"
},
onStart: function (params) {
console.log("params", params);
loadModal = common.dialog.load();
},
onComplete: function (response) {
console.log("response",response);
if (loadModal) {
loadModal.close();
}
if (response.code == 200 && response.data.failFileReason.length == 0) {
common.util.__tip(response.message, 'success');
return;
}
if (response.data && response.data.failFileReason.length) {
$("#message").html(response.data.failFileReason.join('/n'));
return false;
}
common.util.__tip(response.message, 'warning');
}
}
}
common.edit.ajaxfileupload('#productModelTry', batchExport('#productModelTry', 'productModelTry'));
... ...
/**
* Created by JiangMin on 2016/3/24
* 试穿详情.
*/
var $ = require('jquery');
var common = require('../common/common');
var param = location.href.match(/(info)\/(\d+)/);
//尺码列表
var modelLists = [];
common.util.__ajax({url: '/meterManage/tryInfo/info1', data: {productSkn: param[2]}}, function (data) {
var feelIds = {
1: "合适",
2: "偏大",
3: "偏小"
};
var infoLists = data.data || {};
modelLists = infoLists.tryModelList || [];
//如果存在试穿信息
if (infoLists.tryInfoBoMap) {
var tryInfo = infoLists.tryInfoBoMap;
for (var i = 0; i < modelLists.length; i++) {
if (tryInfo[modelLists[i].id]) {
modelLists[i].tryInfo = {};
tryInfo[modelLists[i].id].feel_id = feelIds[tryInfo[modelLists[i].id].feel_id];
modelLists[i].tryInfo = tryInfo[modelLists[i].id];
}
else {
modelLists[i].tryInfo = {};
modelLists[i].tryInfo.fit_size = "";
modelLists[i].tryInfo.feel_id = "";
modelLists[i].tryInfo.fit_remark = "";
}
}
}
//不存在
else {
for (var j = 0; j < modelLists.length; j++) {
modelLists[j].tryInfo = {};
}
}
var a = common.util.__template2($("#template").html(), {modelLists: modelLists});
$(".contentpanel1").html(a);
new common.dropDown({
el: '.fit_size',
ajax: 'sortsize'
});
}, true);
$(document).on("change", ".tryInfo1", function () {
var _index = $(this).data("index");
var item = modelLists[_index].tryInfo;
var name = $(this).data('name');
item[name] = $(this).val();
console.log("item", item);
});
$(document).on("click", "#addInfo", function () {
console.log("modelLists", modelLists);
//var newList = [];
//for (var i = 0; i < modelLists.length; i++) {
// console.log("modelLists");
// console.log(modelLists[i]);
// newList[i]={};
// newList[i].model_id = modelLists[i].id;
// newList[i].feel_id = modelLists[i].tryInfo.feel_id;
// newList[i].fit_size = modelLists[i].tryInfo.fit_size;
// newList[i].fit_remark = modelLists[i].tryInfo.fit_remark;
//}
//console.log("newList");
//console.log(newList);
common.util.__ajax({
url: '/meterManage/tryInfo/add',
data: {
productSkn: param[2],
productModelTry: JSON.stringify(modelLists)
}
}, function () {
console.log("成功")
});
})
... ...
... ... @@ -31,8 +31,10 @@ var g = new common.grid({
{display: "品牌", name: "brandName"},
{
display: "操作", name: "", render: function (item) {
console.log("item");
console.log(item);
var arr = [];
arr.push('<a class="btn btn-info info" data-index="' + item.__index + '">试穿信息</a>');
arr.push('<a data-index="' + item.__index + '" href="/meterManage/tryInfo/info/' + item.productSkn + '" class="btn btn-info ">试穿信息</a>');
return arr.join('');
}
}
... ... @@ -45,3 +47,20 @@ $(document).on('click', '#filter-btn', function () {
g.reload(1);
});
//new common.dialog({
// title:"",
// content:"",
// width:"80%",
// botton:[
// {
// value: "xxx",
// callback: function(){
//
// },
// css: "btn-primary"
// }
// ]
//});
... ...
... ... @@ -17,15 +17,17 @@ var g = new common.grid({
modelName: common.util.__input('content-filter1'),
englishName: common.util.__input('content-filter2'),
status: common.util.__input('status-filter'),
modelType: parseInt($("#aa").val())
modelType: $("#aa").val()
};
},
//列表显示
columns: [
{display: "姓名", name: "modelName"},
{display: "英文名", name: "englishName"},
{
display: "头像", name: "avatar", render: function (item) {
console.log(item);
return '<img src="' + item.avatar + '" width="100" height="60"/>'
}
},//图片显示
... ... @@ -81,7 +83,8 @@ g.init("/shotManage/model/getAllModels");
var Bll = {
toast: function (url, item, hint) {
var e = new common.edit("#baseform", {
bucket: "modelCard"
bucket: "modelCard"//真实的
//bucket: "goodsimg"//测试
});
//验证英文名
e.on("validate", function () {
... ...
... ... @@ -4,6 +4,10 @@
*/
var $ = require('jquery');
var common = require('../common/common');
//日期插件
$('.hasDatepicker').fdatepicker({
format: 'yyyy-mm-dd'
});
/**
* 列表显示数据
* @type {common.grid}
... ... @@ -17,18 +21,18 @@ var g = new common.grid({
productSkn: common.util.__input('content-filter1'),
productSkc: common.util.__input('content-filter2'),
productSku: common.util.__input('content-filter3'),
startTime: common.util.__input('startTime'),
endTime: common.util.__input('endTime')
startTime: common.util.__input('starttime'),
endTime: common.util.__input('endtime')
};
},
//列表显示
columns: [
{display: "SKN", name: "productSkn"},
{
display: "最后上传时间", name: "lastAddTime",
display: "最后上传时间", name: "updateTime",
render: function (item) {
var t = new Date(item.lastAddTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
var t = new Date(item.updateTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd ");
return "<p>" + formatted + "</p>";
}
},
... ... @@ -50,8 +54,7 @@ var g = new common.grid({
{
display: "操作", name: "", render: function (item) {
var arr = [];
arr.push('<a class="btn btn-info update" data-index="' + item.__index + '">修改</a>');
arr.push('<a class="btn btn-danger delete" data-index="' + item.__index + '">删除</a>');
arr.push('<a class="btn btn-info update" data-index="' + item.__index + '">编辑</a>');
return arr.join('');
}
}
... ... @@ -64,16 +67,18 @@ var Bll = {
var a = common.dialog.confirm(hint,
common.util.__template2($("#template1").html(), item),
function () {
console.log("JSON.stringify(pictureBoList)", typeof(JSON.stringify(pictureBoList)));
common.util.__ajax({
url: url,
data: {
productSku: parseInt($("#Sku").val()),
productPhotoAddBoList: JSON.stringify(pictureBoList)
productPhotoAddStrList: JSON.stringify(pictureBoList)
}
}, function (res) {
g.reload();
//a.close();
if(res.code=='200'){
g.reload();
a.close();
}
});
return false;
});
... ... @@ -85,15 +90,15 @@ var Bll = {
valid_extensions: ['png', 'jpg', 'jpeg'],
onComplete: function (response) {
if (response.status && response.code == 200) {
var item = pictureBoList || [];
console.log("response",response);
var data = {
"fileName": response.data
"fileName": response.data,
"originalName": "1035027.jpg"
};
item.push(data);
console.log(JSON.stringify(pictureBoList))
pictureBoList.push(data);
$("#addPic").html(common.util.__template2($("#template2").html(),
{
pictureBoList: item
pictureBoList: pictureBoList
}
));
}
... ... @@ -102,6 +107,13 @@ var Bll = {
}
}
});
$(document).on('click', '.remove-item-btn', function () {
var index = $(this).parents(".cover-image-item").index();
//界面删除
$(this).parents('.cover-image-item').remove();
//数组中删除
pictureBoList.splice(index, 1);
});
}
};
//上传图片--点击事件
... ... @@ -115,12 +127,36 @@ $('#upload-btn').on('click', function () {
$(document).on('click', '#filter-btn', function () {
g.reload(1);
});
//封面图删除
$(document).on('click', '.remove-item-btn', function() {
//界面删除
$(this).parents('.cover-image-item').remove();
//TODO 数组中删除
////删除单张图
//编辑
$(document).on('click', '.update', function () {
var ids = [];
var item = g.rows[$(this).data("index")];
var pics = item.pictureBoList || [];
$(document).on('click', '.remove-item-btn', function () {
var index = $(this).parents(".cover-image-item").index();
//界面删除
$(this).parents('.cover-image-item').remove();
ids.push(pics[index].id);
pics.splice(index, 1);
console.log("ids",ids);
});
var b = common.dialog.confirm("编辑", common.util.__template2($("#template3").html(), item),
function () {
common.util.__ajax({
url: "/shotManage/proPhoto/update",
data: {
productSkn: item.productSkn,
ids: JSON.stringify(ids)
}
}, function (res) {
ids=[];
g.reload();
});
})
});
... ...
... ... @@ -3,8 +3,8 @@
* 模特管理
*/
//exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.162:8080/platform'; //李建
exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
exports.domain = 'http://172.16.6.162:8088/platform'; //李建
//exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
exports.res = [
//主界面
... ... @@ -26,6 +26,7 @@ exports.res = [
{name: 'englishName', type: 'string'},//英文名
{name: 'modelName', type: 'string'},//名称
{name: 'status', type: 'Number'},//模特状态:0 禁用 1 启用
{name: 'modelType', type: 'Number'},//模特类型:1拍摄模特 2试穿模特
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
... ...
... ... @@ -3,7 +3,7 @@
* 产品图片管理
*/
//exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.162:8080/platform'; //李建
//exports.domain = 'http://172.16.6.162:8088/platform'; //李建
exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
exports.res = [
... ... @@ -40,7 +40,17 @@ exports.res = [
{name: 'productSkn', type: 'Number'},
{name: 'productSkc', type: 'Number'},
{name: 'productSku', type: 'Number'},
{name: 'productPhotoAddBoList', type: 'string'}
{name: 'productPhotoAddStrList', type: 'string'}
]
},
//编辑图片
{
route: '/shotManage/proPhoto/update',
method: 'POST',
url: '/productPhoto/updateProductPhoto',
params: [
{name: 'productSkn', type: 'Number'},
{name: 'ids', type: 'string'}
]
}
];
\ No newline at end of file
... ...
... ... @@ -3,11 +3,10 @@
* 试穿信息管理
*/
//exports.domain = require('../config/common.js').domain;
//exports.domain = 'http://172.16.6.162:8080/platform'; //李建
//exports.domain = 'http://172.16.6.162:8088/platform'; //李建
exports.domain = 'http://192.168.102.216:8180/platform'; //测试环境
exports.res = [
//主界面
{
route: '/meterManage/tryInfo/index',//访问路由
... ... @@ -27,5 +26,38 @@ exports.res = [
{name: 'page', type: 'Number'},
{name: 'size', type: 'Number'}
]
},
//查看具体试穿信息
{
route: '/meterManage/tryInfo/info/:productSkn',
method: 'GET',
view: 'pages/meterManage/info',
src: '/meterManage/info'
},
{
// 获取商品详情数据
route: '/meterManage/tryInfo/info1',
method: 'POST',
url: '/productExtraInfo/queryProdExtraInfo',
params: [
{name: 'productSkn', type: 'Number'}
]
},
//保存试穿信息
{
route: '/meterManage/tryInfo/add',
method: 'POST',
url: '/productExtraInfo/saveProdExtraInfo',
params: [
{name: 'productSkn', type: 'Number'},
{name: 'productModelTry', type: 'String'}
]
},
//上传excel文件
{
route: '/meterManage/tryInfo/batch',
method: 'GET',
view: 'pages/meterManage/batch',
src: '/meterManage/batch'
}
];
\ No newline at end of file
... ...
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">试穿信息管理</a></li>
<li>
试穿信息
</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>文件上传</h4>
</div>
</div>
</div>
</div>
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-body">
<table class="table table-bordered">
<tr>
<td rowspan="2">试穿信息</td>
<td>上传EXCEL:</td>
<td>
<div class="panel-col" style="position: relative;">
<input id="productModelTry" name="file" data-type="productModelTry" type="file"
style="cursor: pointer; height: 37px; top: 8px;">
<div class="file-name btn btn-default">上传本地文件</div>
</div>
</td>
</tr>
<tr>
<td>说明:</td>
<td colspan="2">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、第一行标题栏:<span style="color: red;">试穿模特ID|sku|试穿描述|试穿备注</span><br>
3、<a href="{{domain}}/common/productModelTry.xlsx">下载样例</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-primary-head">
<div class="panel-body red" id="message">
</div>
</div>
\ No newline at end of file
... ...
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href="#"><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="#">试穿管理</a></li>
<li>试穿信息</li>
</ul>
<h4>试穿详情</h4>
</div>
</div>
</div>
<div class="contentpanel">
<div class="contentpanel1">
</div>
<div class="col-sm-4">
<a class="btn btn-info addInfo" id="addInfo">保存</a>
<!--<a class="btn btn-primary back" >返回</a>-->
</div>
</div>
<script type="text/template" id="template">
<div>
<h4>SKN</h4>
</div>
<table class="table table-bordered">
<tbody>
[[each modelLists as item index]]
<tr>
<th>
<span>[[item.modelName]]</span>
</th>
<th>
<select name="fit_size" data-name="fit_size" data-index="[[index]]" title="" class="select2-offscreen brandBtn-group fit_size tryInfo1">
<option value='[[item.tryInfo.fit_size]]'>[[item.tryInfo.fit_size||'请选择试穿尺码']]</option>
</select>
</th>
<th>
<select name="status" value="[[item.tryInfo.feel_id]]" data-name="feel_id" data-index="[[index]]" title="" class="select2-offscreen brandBtn-group tryInfo1">
<option value="-1">[['请选择试穿描述']]</option>
</select>
</th>
<th>
<input type="text" data-name="fit_remark" data-index="[[index]]" value="[[item.tryInfo.fit_remark]]" name="fit_remark" id="fit_remark" class="tryInfo1 "
placeholder="添加备注,不超过12字">
</th>
</tr>
[[/each]]
</tbody>
</table>
</script>
... ...
... ... @@ -22,17 +22,17 @@
<div class="contentpanel">
<div class="panel panel-default" style="...">
<div class="panel-heading">
<a class="btn btn-success " id="add-content"><i class="fa fa-plus"></i> excel导入</a>
<a class="btn btn-success " id="add-content" href="/meterManage/tryInfo/batch"><i class="fa fa-plus"></i> 上传excel文件</a>
</div>
<div class="panel-body">
<div class="row">
<div class="panel-col">
<input type="text" value="" name="productSku" id="content-filter1" placeholder="SKU"
class="form-control">
class="form-control">
</div>
<div class="panel-col">
<input type="text" value="" name="productSkn" id="content-filter2" placeholder="SKN"
class="form-control">
class="form-control">
</div>
<div class="panel-col">
<input type="text" value="" name="productName" id="content-filter3" placeholder="产品名称"
... ... @@ -48,3 +48,5 @@
<div id="content-list"></div>
</div>
... ...
... ... @@ -52,13 +52,13 @@
</div>
<script type="text/template" id="template">
<div class="rows" id="baseform" >
<div class="rows" id="baseform" style="height: 400px;overflow: auto">
<div class="form-group">
<label class="col-sm-2 control-label" for="avatar">头像</label>
<input type="hidden" value="[[id]]" id="id"/>
<div class="col-sm-6">
<input type="file" value="[[avatar]]" class="form-control" id="avatar" />
<input type="file" value="[[avatar]]" class="form-control avatar" id="avatar" name="avatar" />
</div>
</div>
<div class="form-group">
... ... @@ -130,7 +130,7 @@
<label class="col-sm-2 control-label" for="modelCard">模特卡</label>
<div class="col-sm-10">
<input type="file" value="[[modelCard]]" class="form-control" id="modelCard" />
<input type="file" value="[[modelCard]]" class="form-control modelCard" id="modelCard" name="modelCard"/>
</div>
</div>
</div>
... ...
... ... @@ -24,11 +24,11 @@
<div class="panel-body">
<div class="row">
<div class="panel-col2">
<input type="text" id="startTime" class="form-control panel-input hasDatepicker" name="start_time"
<input type="text" id="starttime" class="form-control panel-input hasDatepicker" name="start_time"
placeholder="开始时间" value="">
</div>
<div class="panel-col2">
<input type="text" id="endTime" class="form-control panel-input hasDatepicker" name="end_time"
<input type="text" id="endtime" class="form-control panel-input hasDatepicker" name="end_time"
placeholder="结束时间" value="">
</div>
<div class="panel-col">
... ... @@ -56,19 +56,22 @@
<!--上传图片-->
<script type="text/template" id="template1">
<div class="rows" style="height: 400px;overflow: auto">
<div class="form-group">
<label class="col-sm-2 control-label" for="Sku">SKU</label>
<div class="col-sm-6">
<input type="text" value="[[productSku]]" class="form-control" id="Sku" />
<input type="text" value="[[productSku]]" class="form-control" id="Sku"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">图片</label>
<div class="cover-image-list col-sm-10" id="addPic">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">图片</label>
<label class="col-sm-2 control-label"></label>
<ul class="cover-image-list col-sm-10" style="padding: 0;margin: 0;">
<li class="cover-image-item fileinput-button">
<div class="goods-img">
... ... @@ -83,14 +86,43 @@
<script type="text/template" id="template2">
<ul class="cover-image-list col-sm-10" style="padding: 0;margin: 0;">
[[each pictureBoList as _item _index]]
<li class="cover-image-item" data-index=[[_index]]>
<li class="cover-image-item" data-index=[[_index]] >
<div class="goods-img">
<a class="fileinput-button-icon" href="javascript:void(0);">
<img src="[[_item.fileName]]">
</a>
<i class="remove-item-btn glyphicon glyphicon-remove-circle"></i>
<i class="remove-item-btn glyphicon glyphicon-remove-circle" ></i>
</div>
</li>
[[/each]]
</ul>
</script>
<script type="text/template" id="template3">
<div class="row" style="height: 400px;overflow: auto">
<div class="form-group">
<label class="col-sm-2">SKN</label>
<div class="col-sm-6">
<input type="text" value=[[productSkn]] disabled="disabled">
</div>
</div>
<div class="form-group">
<label class="col-sm-2">图片</label>
<div class="col-sm-10">
<ul class="cover-image-list col-sm-10" style="padding: 0;margin: 0;">
[[each pictureBoList as _item _index]]
<li class="cover-image-item" data-index=[[_index]]>
<div class="goods-img">
<a class="fileinput-button-icon" href="javascript:void(0);">
<img src="[[_item.fileName]]">
</a>
<i class="remove-item-btn glyphicon glyphicon-remove-circle"></i>
</div>
</li>
[[/each]]
</ul>
</div>
</div>
</div>
</script>
... ...