Authored by liuyue

网销

require('../util/select2');
var $=require('jquery');
var $ = require('jquery');
var urlObj={
'supplier':'/supplier/supplier/getSupplierListByIdName',
'brand':'/brand/getBrandNames',
'managerName':'/supplier/storeadmin/managerName',
'sortattribute':'/erpproduct/sortattribute/ajax/automatic', // 品类关联实物测量属性
'sortsize':'/erpproduct/sortsize/ajax/automatic',
var urlObj = {
'supplier': '/supplier/supplier/getSupplierListByIdName',
'brand': '/brand/getBrandNames',
'managerName': '/supplier/storeadmin/managerName',
'sortattribute': '/erpproduct/sortattribute/ajax/automatic', // 品类关联实物测量属性
'sortsize': '/erpproduct/sortsize/ajax/automatic',
'queryBrand': '/goods/query/brand',
'querySupplier': '/goods/query/supplier',
'queryShop': '/goods/query/shop',
'maxSort': '/goods/query/maxSort',
'shopsRest':'/ShopsRest/getShopsByName',
'sortlist':'/product/class/queryAllProductSortList',
'productPool':'/runManage/subjectManage/queryBaseProductPoolListByName',
'firstCategory':'/operations/helpcategory/getCategoryListByPid',
'getByCategoryId':'/operations/helpcontent/getSecondCategoryList',
'getAllHelpCategory':'/operations/helpcontent/getAllHelpCategory',
'getHelpCategory':'/operations/helpcontent/getHelpCategory',
'xiangouID':'/limit/xiangouID/selectActivityListForSelect'//限购ID
'shopsRest': '/ShopsRest/getShopsByName',
'sortlist': '/product/class/queryAllProductSortList',
'productPool': '/runManage/subjectManage/queryBaseProductPoolListByName',
'firstCategory': '/operations/helpcategory/getCategoryListByPid',
'getByCategoryId': '/operations/helpcontent/getSecondCategoryList',
'getAllHelpCategory': '/operations/helpcontent/getAllHelpCategory',
'getHelpCategory': '/operations/helpcontent/getHelpCategory',
'xiangouID': '/limit/xiangouID/selectActivityListForSelect', //限购ID
'queryAll4Select': '/goods/brandSeries/queryAll4Select' //品牌款型系列
};
var dropDown=function(option){
var dropDown = function(option) {
new dropDown.prototype.init(option);
}
dropDown.prototype={
constructor:dropDown,
init:function(_option){
var option={
el:'.select2-offscreen',
url:urlObj[_option.ajax]
dropDown.prototype = {
constructor: dropDown,
init: function(_option) {
var option = {
el: '.select2-offscreen',
url: urlObj[_option.ajax]
};
for(var i in _option){
if(_option.hasOwnProperty(i)){
option[i]=_option[i];
for (var i in _option) {
if (_option.hasOwnProperty(i)) {
option[i] = _option[i];
}
}
if(option.ajax){
if (option.ajax) {
$(option.el).select2({
ajax:{
ajax: {
url: option.url,
dataType: 'json',
type:'POST',
type: 'POST',
delay: 250,
data: function (params) {
var data=$.extend({},{
data: function(params) {
var data = $.extend({}, {
idName: params.term
},option.params||{});
}, option.params || {});
return data;
},
processResults: function (data, params) {
processResults: function(data, params) {
params.page = params.page || 1;
data.data.data.unshift({id:'-1',text:"请选择"});
return {
data.data.data.unshift({
id: '-1',
text: "请选择"
});
return {
results: data.data.data
}
}
},
cache: true
}
});
}else{
} else {
$(option.el).select2();
}
}
}
dropDown.prototype.init.prototype = dropDown.prototype;
module.exports=dropDown;
\ No newline at end of file
module.exports = dropDown;
\ No newline at end of file
... ...
var $ = require('jquery'),
common = require('../../common/common');
/*common.util.__ajax({
url: '/goods/product/getAfterSaleInfo'
}, function(res) {
alert(11);
var html = common.util.__template2($('#addInfoTemp').html(), res.data);
console.log($('#addInfoTemp').html(), html);
}, true);*/
console.log(NETSALEDATA.baseProductInfo.baseProduct.maxSortId);
var e = new common.edit('#addinfo-wrap'),
basicInfo = NETSALEDATA.baseProductInfo.baseProduct;
/*$.ajax({
type: 'POST',
url: '/goods/product/getAfterSaleInfo',
dataType: 'json',
common.util.__ajax({
url: '/goods/product/queryMakingProcess',
data: {
displayPosition: 2,
categoryId: NETSALEDATA.baseProductInfo.baseProduct.maxSortId
},
success: function(res) {
console.log(res.data);
var html = common.util.__template2($('#addInfoTemp').html(), res.data);
$('.addinfo-wrap').html(html);
//NETSALEEDIT.init();
//console.log(html);
categoryId: basicInfo.maxSortId
}
}, function(res) {
var obj = res.data;
obj.makeCrafts = NETSALEDATA.productExtBo.makeCrafts.replace(/,/g, "|");
var html = common.util.__template2($('#makingProcessTemp').html(), obj);
$('.making-process-wrap .col-sm-11').html(html);
e.init();
}, true);
var addInfoHtml = common.util.__template2($('#addInfoTemp').html(), NETSALEDATA.productExtBo);
$('.addinfo-wrap').append($(addInfoHtml));
basicInfo.style = basicInfo.style.replace(/,/g, "|");
basicInfo.pattern = basicInfo.pattern.replace(/,/g, "|");
$('#productStyleWrap').html(common.util.__template2($('#productStyleWrap').html(), basicInfo));
$('#productElementsWrap').html(common.util.__template2($('#productElementsWrap').html(), basicInfo));
$('#brandModelWrap').html(common.util.__template2($('#brandModelWrap').html(), NETSALEDATA.productExtBo));
$('#brandSeriesWrap').html(common.util.__template2($('#brandSeriesWrap').html(), NETSALEDATA.productExtBo));
//console.log(NETSALEDATA.wearSenses);
/*$('#wearSenseWrap').html(common.util.__template2($('#wearSenseWrap').html(), {
wearSenses: NETSALEDATA.wearSenses
}));
*/
new common.dropDown({
el: '#brandModelSelect',
ajax: 'queryAll4Select',
params: {
type: 1,
status: 1,
shopsId: basicInfo.shopId,
brandId: basicInfo.brandId
}
});
new common.dropDown({
el: '#brandSeriesSelect',
ajax: 'queryAll4Select',
params: {
type: 2,
status: 1,
shopsId: basicInfo.shopId,
brandId: basicInfo.brandId
}
});
/*e.on("render", function() {
if ($('#brandModel').val()) {
$('#brandModelSelect').val($('#brandModel').val());
}
});*/
\ No newline at end of file
if ($('#brandSeries').val()) {
$('#brandSeriesSelect').val($('#brandSeries').val());
}
})*/
e.on("bind", function() {
$('#brandModelSelect').on('change', function() {
$('#brandModel').val($(this).val());
});
$('#brandSeriesSelect').on('change', function() {
$('#brandSeries').val($(this).val());
});
});
$('#saveAddInfo').on('click', function() {
e.submit('/goods/product/saveAfterSaleInfo', function(option) {
option.data.productSkn = $('#productSkn').val();
option.data.style = option.data.style.split('|').join(',');
option.data.pattern = option.data.pattern.split('|').join(',');
option.data.makeCrafts = option.data.makeCrafts.split('|').join(',');
option.data.wearSense = function() {
var arr = [];
$('#wearSenseWrap').find('select').each(function() {
if ($(this).val()) {
arr.push({
wearSenseId: $(this).attr('name'),
value: $(this).val()
});
}
});
return JSON.stringify(arr);
}
option.success = function(res) {
res = res.data;
if (res.code == '200') {
NETSALEEDIT.$tip(res.message, function() {}, 'growl-success');
} else {
NETSALEEDIT.$tip(res.message);
}
return false;
}
});
});
\ No newline at end of file
... ...
... ... @@ -68,6 +68,7 @@ $('#goods-table').html(common.util.__template2($('#goodsList').html(), {
goodsList: NETSALEDATA.goodsList
}));
//上架必填
NETSALEDATA.productExtBo.sellChannels = NETSALEDATA.productExtBo.sellChannels.replace(/,/g, "|");
$('#product-ext').html(common.util.__template2($('#productExtBoTemp').html(), NETSALEDATA.productExtBo));
... ...
var $ = require('jquery'),
common = require('../../common/common');
common.util.__ajax({
/*common.util.__ajax({
url: '/goods/brands/queryBrandsByStatus'
}, function(res) {
//console.log(res);
... ... @@ -13,15 +13,68 @@ common.util.__ajax({
$.each(data, function(i, value) {
//console.log(aLif, value.brandAlif);
aLif = value.brandAlif;
/*if (aLif != value.brandAlif) {
if (aLif != value.brandAlif) {
aLif = value.brandAlif;
html += '<div class="col-sm-2">' + aLif + '</div>';
brandHtml += '<div class="col-sm-10"><label><input tyoe="checkbox" value="' + value.id + '">' + value.brandName + '</label>';
} else {
brandHtml += '<label><input tyoe="checkbox" value="' + value.id + '">' + value.brandName + '</label>';
}*/
}
});
//$('.brand-list').html(html + brandHtml);
}, true);
\ No newline at end of file
}, true);*/
var data = [{
brandName: 'aaa',
a: 'A',
id: 1
}, {
brandName: 'abb',
a: 'A',
id: 3
}, {
brandName: 'bbb',
a: 'B',
id: 2
}];
var firstName = null,
map = {},
rowHtml = '',
rowHtmlH = '',
rowHtmlB = '';
$.each(data, function(i, item) {
if (item.a) {
/*console.log(firstName, value.a);
if (firstName != value.a) {
firstName = value.a;
/*rowHtmlH = '';
rowHtmlB = '';
rowHtml += rowHtmlH + rowHtmlB + '</div>';
rowHtmlH += '<div class="col-sm-2">' + firstName + '</div>';
rowHtmlB += '<div class="col-sm-10><label><input tyoe="checkbox" value="' + value.id + '">' + value.brandName + '</label>'
} else {
rowHtmlB += '<label><input tyoe="checkbox" value="' + value.id + '">' + value.brandName + '</label>';
}*/
if (!map.hasOwnProperty(item.a)) {
map[item.a] = [];
}
map[item.a].push(item);
}
});
console.log(map);
$('.brand-list').html(common.util.__template2($('#brandTemp').html(), {
map: map
}));
\ No newline at end of file
... ...
var $ = require('jquery');
var edit=require('../common/edit');
var edit = require('../common/edit');
var e=new edit("#basicForm");
var e = new edit("#basicForm");
e.on("bind",function(){
e.on("bind", function() {
$("select").change(function() {
if ($(this).is($("#type1"))) {
$("#type").val($("#type1").val());
$("#type").val($("#type1").val());
}
});
});
e.on("bind",function(){
e.on("bind", function() {
$("select").change(function() {
if ($(this).is($("#num1"))) {
$("#num").val($("#num1").val());
$("#num").val($("#num1").val());
}
});
});
e.on("validate",function(){
var title=$.trim($("#title").val());
if(/[~#^$@%&!*]/gi.test(title)) {
e.on("validate", function() {
var title = $.trim($("#title").val());
if (/[~#^$@%&!*]/gi.test(title)) {
return "名称不能包含特殊字符";
}
return true;
});
e.on("validate",function(){
var beginOperateTime=$.trim($("#beginOperateTime").val());
var endOperateTime=$.trim($("#endOperateTime").val());
e.on("validate", function() {
var beginOperateTime = $.trim($("#beginOperateTime").val());
var endOperateTime = $.trim($("#endOperateTime").val());
if(new Date(endOperateTime)<=new Date(beginOperateTime)){
if (new Date(endOperateTime) <= new Date(beginOperateTime)) {
return "开始时间不能小于结束时间";
}
return true;
});
... ... @@ -48,39 +48,38 @@ e.init();
//提交
var submit=function(callback){
e.submit($("#basicForm").attr("action"),function(option){
option.success=function(res){
res=res.data;
if(res.code=="200"){
e.$tip('提交成功',function(){
location.href="/market/vipamount/index";
},'growl-success');
}else{
e.$tip(res.message);
var submit = function(callback) {
e.submit($("#basicForm").attr("action"), function(option) {
option.success = function(res) {
res = res.data;
if (res.code == "200") {
e.$tip('提交成功', function() {
location.href = "/market/vipamount/index";
}, 'growl-success');
} else {
e.$tip(res.message);
}
return false;
},
option.error = function(res) {
e.$tip("提交失败");
}
return false;
},
option.error=function(res){
e.$tip("提交失败");
}
option.data.startTime = new Date(option.data.startTime.replace(/-/g,'/')).getTime() / 1000;
option.data.endTime = new Date(option.data.endTime.replace(/-/g,'/')).getTime() / 1000;
option.data.startTime = new Date(option.data.startTime.replace(/-/g, '/')).getTime() / 1000;
option.data.endTime = new Date(option.data.endTime.replace(/-/g, '/')).getTime() / 1000;
console.log(option.data);
callback&&callback(option.data);
callback && callback(option.data);
});
};
$("#save_brand").click(function(){
$("#save_brand").click(function() {
submit(function(data){
submit(function(data) {
//修改数据
/*if(data.status=="2"){
data.status=0;
}*/
});
return false;
});
});
\ No newline at end of file
... ...
... ... @@ -216,17 +216,6 @@ exports.res = [
},
productElements: {
url: '/productElements/queryProductElements4Select'
},
makingProcess: {
url: '/product/queryMakingProcess',
params: [{
name: 'categoryId',
type: 'number'
}, {
name: 'displayPosition',
type: 'number'
}],
isJsonRaw: true
}
},
src: '/goods/netsale-edit',
... ... @@ -370,29 +359,47 @@ exports.res = [
type: 'string'
}]
}, {
//网销信息 -> 获取补全信息
route: '/goods/product/getAfterSaleInfo',
//网销信息 -> 查询制作工艺列表
route: '/goods/product/queryMakingProcess',
method: 'POST',
/*,
all4Select: {
url: '/brandSeries/queryAll4Select',
param: [{
name: 'type',
type: 'number'
}, {
name: 'status',
type: 'number'
}, {
name: 'shopsId',
type: 'number'
}, {
name: 'brandId',
type: 'number'
}]
}*/
url: '/product/queryMakingProcess',
params: [{
name: 'categoryId',
type: 'number'
}, {
name: 'displayPosition',
type: 'number'
}]
}, {
//网销信息 -> 查询品牌款型系列列表
route: '/goods/brandSeries/queryAll4Select',
method: 'POST',
url: '/brandSeries/queryAll4Select',
params: [{
name: 'type',
type: 'number'
}, {
name: 'status',
type: 'number'
}, {
name: 'shopsId',
type: 'number'
}, {
name: 'brandId',
type: 'number'
}]
}, {
//网销信息 -> 查询制作工艺列表
route: '/goods/product/queryMakingProcess',
method: 'POST',
url: '/product/queryMakingProcess',
params: [{
name: 'categoryId',
type: 'number'
}, {
name: 'displayPosition',
type: 'number'
}]
}, {
//网销信息 -> 保存视频接口
route: '/goods/product/saveNetSaleVideo',
... ...
... ... @@ -102,7 +102,6 @@
{{> netsale/model}}
{{> netsale/brand_relation}}
{{> netsale/close_match}}
{{> netsale/video}}
</div>
</div>
... ...
... ... @@ -5,8 +5,8 @@
</div>
<h2 class="panel-title">补全信息</h2>
</div>
<div class="panel-body addinfo-wrap">
<div class="form-group">
<div id="addinfo-wrap" class="panel-body addinfo-wrap">
<div id="productStyleWrap" class="form-group">
<div class="col-sm-1">商品风格:</div>
<div class="col-sm-11">
{{# productStyle}}
... ... @@ -14,10 +14,10 @@
<label style="cursor: pointer;"><input type="checkbox" name="style" value="{{id}}">{{text}}</label>
{{/ data}}
{{/ productStyle}}
<input id="style" type="hidden" for="checkbox">
<input id="style" type="hidden" for="checkbox" value="[[style]]">
</div>
</div>
<div class="form-group">
<div id="productElementsWrap" class="form-group">
<div class="col-sm-1">图案纹理:</div>
<div class="col-sm-11">
{{# productElements}}
... ... @@ -25,44 +25,40 @@
<label style="cursor: pointer;"><input type="checkbox" name="pattern" value="{{id}}">{{text}}</label>
{{/ data}}
{{/ productElements}}
<input id="pattern" type="hidden" for="checkbox">
<input id="pattern" type="hidden" for="checkbox" value="[[pattern]]">
</div>
</div>
<div class="form-group">
<div id="brandModelWrap" class="form-group">
<div class="col-sm-1">品牌款型:</div>
<div class="col-sm-2">
<select name="brandModel" id="brandModel" tabindex="-1" title="" class="form-control">
<option value="-1">请选择品牌款型</option>
</select>
<select name="brandModelSelect" id="brandModelSelect" tabindex="-1" title="" class="form-control">
<option value="">[[brandModelText]]</option>
</select>
<input type="hidden" id="brandModel" value="[[brandModel]]">
</div>
</div>
<div class="form-group">
<div id="brandSeriesWrap" class="form-group">
<div class="col-sm-1">品牌系列:</div>
<div class="col-sm-2">
<select name="brandSeries" id="brandSeries" tabindex="-1" title="" class="form-control">
<option value="-1">请选择品牌系列</option>
</select>
<select name="brandSeriesSelect" id="brandSeriesSelect" tabindex="-1" title="" class="form-control">
<option value="">[[brandSeriesText]]</option>
</select>
<input type="hidden" id="brandSeries" value="[[brandSeries]]">
</div>
</div>
<div class="form-group">
<div class="making-process-wrap form-group">
<div class="col-sm-1">制作工艺:</div>
<div class="col-sm-11">
{{# makingProcess}}
{{# data}}
<label style="cursor: pointer;"><input type="checkbox" name="makeCrafts" value="{{id}}">{{text}}</label>
{{/ data}}
{{/ makingProcess}}
<input id="makeCrafts" type="hidden" for="checkbox">
</div>
<div class="col-sm-11"></div>
</div>
<div class="form-group">
<div id="wearSenseWrap" class="form-group">
<div class="col-sm-1">舒适度:</div>
<div class="col-sm-11">
{{# productComfort}}
{{# data}}
<div class="col-sm-2">
<label>{{text}}</label>
<select name="{{id}}" id="{{id}}" class="form-control">
<select name="{{id}}" class="form-control">
<option value="">请选择</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
... ... @@ -74,26 +70,32 @@
{{/ productComfort}}
</div>
</div>
<div class="form-group">
<div class="col-sm-1">促销短语:</div>
<div class="col-sm-11">
<input id="salesPhrase" type="text">
</div>
</div>
<div class="form-group">
<div class="col-sm-1">是否促销:</div>
<div class="col-sm-11">
<label class="radio-inline"><input type="radio" name="isHostsell" value="Y"></label>
<label class="radio-inline"><input type="radio" name="isHostsell" value="N"></label>
<input id="isHostsell" type="hidden" for="radio">
</div>
</div>
</div>
<div class="panel-footer">
<a id="" href="javascript:;" class="btn btn-primary">保存</a>
<a id="saveAddInfo" href="javascript:;" class="btn btn-primary">保存</a>
</div>
</div>
<script type="text/template" id="makingProcessTemp">
[[each items as a index]]
<label style="cursor: pointer;"><input type="checkbox" name="makeCrafts" value="[[a]]">[[a]]</label>
[[/each]]
<input id="makeCrafts" type="hidden" for="checkbox" value="[[makeCrafts]]">
</script>
<script type="text/template" id="addInfoTemp">
<div class="form-group">
<div class="col-sm-1">促销短语:</div>
<div class="col-sm-11">
<input id="salesPhrase" class="form-control" type="text" value="[[salesPhrase]]">
</div>
</div>
<div class="form-group">
<div class="col-sm-1">是否促销:</div>
<div class="col-sm-11">
<label class="radio-inline"><input type="radio" name="isHostsell" value="Y"></label>
<label class="radio-inline"><input type="radio" name="isHostsell" value="N"></label>
<input id="isHostsell" type="hidden" for="radio" value="[[isHostsell]]">
</div>
</div>
</script>
\ No newline at end of file
... ...
... ... @@ -14,4 +14,17 @@
<div class="panel-footer">
<a id="saveBrandRelation" href="javascript:;" class="btn btn-primary">保存</a>
</div>
</div>
\ No newline at end of file
</div>
<script type="text/template" id="brandTemp">
[[each map as item index]]
<div class="form-group">
<div class="col-sm-1">[[index]]</div>
<div class="col-sm-10">
[[each item as a index]]
<label><input type="checkbox" value="[[a.id]]">[[a.brandName]]</label>
[[/each]]
</div>
</div>
[[/each]]
</script>
\ No newline at end of file
... ...