Authored by uedxwg

update

... ... @@ -4,7 +4,8 @@ var $=require('jquery');
var urlObj={
'supplier':'/supplier/supplier/getSupplierListByIdName',
'brand':'/brand/getBrandNames'
'brand':'/brand/getBrandNames',
'managerName':'/supplier/storeadmin/managerName'
};
var dropDown=function(option){
... ...
... ... @@ -285,7 +285,6 @@ edit.prototype={
if (__self.registerEvent[key]&&__self.registerEvent[key].length > 0) {
for (_e in __self.registerEvent[key]) {
var a=__self.registerEvent[key][_e](o);
console.log(a);
if(callback){
callback(a);
}
... ...
'use strict';
var $ = require('jquery'),
Handlebars = require('yoho.handlebars');
var dropDown=require('../common/dropDown');
var grid=require('../common/grid');
require('../util/jquery.gritter');
exports.init=function(){
new dropDown({el:"#store-name"});
new dropDown({el:"#store-name",ajax:"brand"});
new dropDown({el:"#identity-type"});
new dropDown({el:"#manager-name"});
function __ajax(options,callback){
$.ajax({
type: 'POST',
url: options.url,
dataType: 'json',
data:options.data||{},
success: function(res) {
res=res.data;
if (res.code === 200) {
$.gritter.add({
title: options.msg||"提交成功",
class_name: 'growl-success',
sticky: false,
time: '1000',
after_open: function() {
callback&&callback();
}
});
} else {
$.gritter.add({
title: '提交失败',
class_name: 'growl-danger',
sticky: false,
time: '1000'
});
}
}
});
}
if($('#storelsit').length>0){
$('#store-name option:selected').val($('#shopsId').text());
$('#identity-type option:selected').val($('#identity').text());
$('#manager-name option:selected').val($('#adminPid').text());
}
$('#identity-type').on('change',function(){
$.ajax({
url: '/supplier/storeadmin/managerName',
dataType: "json",
type: 'POST',
data: {
identity: $('#identity-type option:selected').val()
},
success: function(data) {
$.each(data.data.data,function(index){
console.log(data.data.data[index].truename);
$('#manager-name').append("<option value='"+data.data.data[index].pid+"'>"+data.data.data[index].truename+"</option>");
})
}
})
})
$('#amdinAdd').on('click',function(){
var that = this,
shopsId = $('#store-name').val(),
identityType = $('#identity-type').val(),
managerName = $('#manager-name').val();
__ajax({
url: "/supplier/storeadmin/addguanxi",
data:{
shopsId:shopsId,
adminPid:managerName,
identity:identityType
}
},function(){
g.reload();
});
})
}
\ No newline at end of file
... ...
... ... @@ -18,30 +18,13 @@ exports.init=function(){
{display:"更新时间",name:"updateTime"},
{display:"操作",name:"",render:function(item){
return '<a href="/supplier/storeadmin/adminEdit/'+item.id+'" class="btn btn-info btn-xs">编辑</a><button type="button" data-id="'+item.id+'" class="delete btn btn-danger btn-xs">删除</button>'
return '<a href="/supplier/store/adminupdate/'+item.id+'" class="btn btn-info btn-xs">编辑</a><button type="button" data-id="'+item.id+'" class="delete btn btn-danger btn-xs">删除</button>'
}}
]
})
console.log($('#url').val());
g.init($('#url').val());
// var otherUrl=$('#otherUrl').val().split(',');
// console.log(otherUrl);
// $.each(otherUrl,function(){
// $('#otherUrlValue').append('<p>'+this+'</p>')
// })
// var websiteUrl=$('#websiteUrl').val().split(',');
// $.each(websiteUrl,function(){
// $('#websiteUrlValue').append('<p>'+this+'</p>')
// })
// var shopAddress=$('#shopAddress').val().split(',');
// $.each(shopAddress,function(){
// $('#shopAddressValue').append('<p>'+this+'</p>')
// });
function __ajax(options,callback){
$.ajax({
type: 'POST',
... ...
... ... @@ -38,15 +38,69 @@ exports.init=function(){
{display:"更新时间",name:"updateTime"},
{display:"状态",name:"status"},
{display:"操作",name:"",render:function(item){
return '<a href="/supplier/store/info/'+item.shopsId+'" class="btn btn-info btn-xs">查看</a>'
+'<a href="/supplier/store/update/'+item.shopsId+'" class="btn btn-success btn-xs">编辑</a>'
+'<a href="/supplier/store/info/'+item.shopsId+'" class="btn btn-danger btn-xs">关店</a>'
var pushAll =[]
pushAll.push('<a href="/supplier/store/info/'+item.shopsId+'" class="btn btn-info btn-xs">查看</a>');
pushAll.push('<a href="/supplier/store/update/'+item.shopsId+'" class="btn btn-success btn-xs">编辑</a>');
pushAll.push('<input type="hidden" value="'+item.status+'" />');
if(item.status == 0){
pushAll.push('<button data-status="'+item.status+'" data-shopsid="'+item.shopsId+'" class="shopsstatus btn btn-warning btn-xs">开店</button>');
}else{
pushAll.push('<button data-status="'+item.status+'" data-shopsid="'+item.shopsId+'" class="shopsstatus btn btn-danger btn-xs">关店</button>');
}
return pushAll.join('');
}}
]
})
console.log($('#url').val());
g.init($('#url').val());
function __ajax(options,callback){
$.ajax({
type: 'POST',
url: options.url,
dataType: 'json',
data:options.data||{},
success: function(res) {
res=res.data;
if (res.code === 200) {
$.gritter.add({
title: options.msg||"提交成功",
class_name: 'growl-success',
sticky: false,
time: '1000',
after_open: function() {
callback&&callback();
}
});
} else {
$.gritter.add({
title: '提交失败',
class_name: 'growl-danger',
sticky: false,
time: '1000'
});
}
}
});
}
//提交操作
$(document).on('click', '.shopsstatus', function() {
var that = this,
url;
if($(that).data('status')==1){
url = "/supplier/store/closeShops";
}else{
url = "/supplier/store/openShops";
}
__ajax({
url: url,
data:{shopsId:$(that).data("shopsid")}
},function(){
g.reload();
});
});
}
... ...
//商家管理
'use strict';
var $ = require('jquery'),
Handlebars = require('yoho.handlebars');
Handlebars = require('yoho.handlebars');
var dropDown=require('../common/dropDown');
var dropDown = require('../common/dropDown');
require('../util/jquery.gritter');
var grid=require('../common/grid');
var edit=require('../common/edit');
var grid = require('../common/grid');
var edit = require('../common/edit');
exports.init=function(){
$('.urlAdd').on('click',function(){
var type = $(this).data('type'),
inputAdd = '';
switch(type)
{
case 0:
inputAdd = '<input type="text" name="homepage" class="form-control" style="margin-top:15px;" placeholder="官方网址">';
break;
case 1:
inputAdd = '<input type="text" name="homeurl" class="form-control" style="margin-top:15px;" placeholder="其他平台网址">';
break;
case 2:
inputAdd = '<input type="text" name="homeaddresslist" class="form-control" style="margin-top:15px;" placeholder="代表实体店">';
break;
}
$('.Add').eq(type).append(inputAdd);
});
new dropDown({el:"#store-type"});
new dropDown({el:"#store-model"});
new dropDown({el:"#brand-name",ajax:"brand"});
$('#addBrand').on('click',function(){
var storeModel = $('#store-model').val();
if(storeModel==1&&$('#updateBrand tbody tr').length<1){
$('#savebrand .checkbox').each(function(){
if($(this).prop('checked')){
var check = $(this).closest('tr').html();
var brand=check.split('<td>')[check.split('<td>').length-2];
var supplier=check.split('<td>')[check.split('<td>').length-1];
var table = '<tr><td>'+brand+'<td>'+supplier+'<td><button type="button" class="btn btn-danger btn-xs">删除</button></td></tr>'
$('#updateBrand tbody').append(table);
}
})
}else{
$('#savebrand .checkbox').each(function(){
if($(this).prop('checked')){
var check = $(this).closest('tr').html();
var brand=check.split('<td>')[check.split('<td>').length-2];
var supplier=check.split('<td>')[check.split('<td>').length-1];
var table = '<tr><td>'+brand+'<td>'+supplier+'<td><button type="button" class="btn btn-danger btn-xs">删除</button></td></tr>'
$('#updateBrand tbody').append(table);
}
})
}
});
var e=new edit("#storeForm");
e.on("validate",function(){
});
if($('#shopsId').val()>0){
var submit=function(callback){
e.submit('/store/update',function(option){
option.success=function(res){
console.log(res.data.code);
if(res.data.code=="200"){
// location.href="/supplier/store/index";
}else{
e.$tip("提交失败");
}
return false;
},
option.error=function(res){
e.$tip("提交失败");
}
callback&&callback(option.data);
});
}
exports.init = function() {
$('.urlAdd').on('click',
function() {
var type = $(this).data('type'),
inputAdd = '';
switch (type) {
case 0:
inputAdd = '<input type="text" name="homepage" class="form-control" style="margin-bottom:15px;" placeholder="官方网址">';
break;
case 1:
inputAdd = '<input type="text" name="homeurl" class="form-control" style="margin-bottom:15px;" placeholder="其他平台网址">';
break;
case 2:
inputAdd = '<input type="text" name="homeaddresslist" class="form-control" style="margin-bottom:15px;" placeholder="代表实体店">';
break;
}
$('.Add').eq(type).append(inputAdd);
});
new dropDown({
el: "#store-type"
});
new dropDown({
el: "#store-model"
});
new dropDown({
el: "#brand-name",
ajax: "brand"
});
$('#addBrand').on('click',function() {
var storeModel = $('#shopsType').val();
if (storeModel == 1 || $('#updateBrand tbody tr').length < 1) {
$('#savebrand .checkbox').each(function() {
if ($(this).prop('checked')) {
var check = $(this).closest('tr').html();
var brand = check.split('<td>')[check.split('<td>').length - 2];
var supplier = check.split('<td>')[check.split('<td>').length - 1];
var table = '<tr><td>' + brand + '<td>' + supplier + '<td><button type="button" class="btn btn-danger btn-xs">删除</button></td></tr>';
$('#updateBrand tbody').append(table);
}
})
} else {
$('#savebrand .checkbox').each(function() {
if ($(this).prop('checked')) {
var check = $(this).closest('tr').html();
var brand = check.split('<td>')[check.split('<td>').length - 2];
var supplier = check.split('<td>')[check.split('<td>').length - 1];
var table = '<tr><td>' + brand + '<td>' + supplier + '<td><button type="button" class="btn btn-danger btn-xs">删除</button></td></tr>';
$('#updateBrand tbody').append(table);
}
})
}
});
var e = new edit("#storeForm");
e.on("validate",
function() {});
if ($('#shopsId').val() > 0) {
var submit = function(callback) {
e.submit('/store/update',
function(option) {
option.success = function(res) {
if (res.data.code == "200") {
// location.href="/supplier/store/index";
} else {
e.$tip("提交失败");
}
return false;
},
option.error = function(res) {
e.$tip("提交失败");
}
callback && callback(option.data);
});
}
}else{
var submit=function(callback){
e.submit('/store/add',function(option){
option.success=function(res){
console.log(res.data.code);
if(res.data.code=="200"){
// location.href="/supplier/store/index";
}else{
e.$tip("提交失败");
}
return false;
},
option.error=function(res){
e.$tip("提交失败");
}
callback&&callback(option.data);
});
}
}
$("#btn1").click(function(){
var shopsId =$('#shopsId').val();
console.log(shopsId);
var homepage=$("input[name='homepage']");
var hplist=[];
homepage.each(function(index){
hplist.push(homepage[index].value);
})
var homeurl=$("input[name='homeurl']");
var homeurlist=[];
homeurl.each(function(index){
homeurlist.push(homepage[index].value);
})
var homeaddress=$("input[name='homeaddresslist']");
var homeaddresslist=[];
homeaddress.each(function(index){
homeaddresslist.push(homeaddress[index].value);
})
submit(function(data){
data.websiteUrl=hplist.toString();
data.otherUrl=homeurlist.toString();
data.shopAddress=homeaddresslist.toString();
data.onCheck=1;
data.shopsId=shopsId;
});
return false;
});
$(function(){
if($('#otherUrl').val().split(',').length>1){
var homepage=$('#otherUrl').val().split(',');
$.each(homepage,function(){
$('#homepage').append('<input value="'+this+'" type="text" name="homepage" class="form-control" style="margin-buttom:15px;">')
})
} else {
var submit = function(callback) {
e.submit('/store/add',
function(option) {
option.success = function(res) {
if (res.data.code == "200") {
// location.href="/supplier/store/index";
} else {
e.$tip("提交失败");
}
return false;
},
option.error = function(res) {
e.$tip("提交失败");
}
callback && callback(option.data);
});
}
}
if($('#websiteUrl').val().split(',').length>1){
var websiteUrl=$('#websiteUrl').val().split(',');
$.each(websiteUrl,function(){
$('#homeurl').append('<input value="'+this+'" type="text" name="homeurl" class="form-control" style="margin-buttom:15px;">')
})
}
$(".check").click(function() {
var shopsId = $('#shopsId').val();
var onCheck = $(this).data('oncheck');
var homepage = $("input[name='homepage']");
var hplist = [];
homepage.each(function(index) {
hplist.push(homepage[index].value);
});
var homeurl = $("input[name='homeurl']");
var homeurlist = [];
homeurl.each(function(index) {
homeurlist.push(homepage[index].value);
});
var homeaddress = $("input[name='homeaddresslist']");
var homeaddresslist = [];
homeaddress.each(function(index) {
homeaddresslist.push(homeaddress[index].value);
});
var updateBrand =$('#updateBrand tbody tr');
var shopRelation=[];
shopRelation.push('[')
$.each(updateBrand,function (index) {
shopRelation.push('{')
shopRelation.push('"agreementEndTime":'+$('#updateBrand tbody tr').eq(index).find('td').eq(1).find('.agreementendtime').val()+',');
shopRelation.push('"brandId":'+$('#updateBrand tbody tr').eq(index).find('td').eq(1).find('.brandid').val()+',');
shopRelation.push('"supplierId":'+$('#updateBrand tbody tr').eq(index).find('td').eq(1).find('.supplierid').val());
console.log(index,updateBrand.length-1);
if(index==updateBrand.length-1){
shopRelation.push('}')
}else{
shopRelation.push('},')
}
});
shopRelation.push(']')
console.log(shopRelation.join(''));
submit(function(data) {
data.websiteUrl = hplist.toString();
data.otherUrl = homeurlist.toString();
data.shopAddress = homeaddresslist.toString();
data.onCheck = onCheck;
data.shopsId = shopsId;
data.shopRelation = shopRelation.join('');
});
return false;
});
$(function() {
if ($('#otherUrl').val().split(',').length > 1) {
var homepage = $('#otherUrl').val().split(',');
$.each(homepage,
function() {
$('#homepage').append('<input value="' + this + '" type="text" name="homepage" class="form-control" style="margin-buttom:15px;">')
})
}
if ($('#websiteUrl').val().split(',').length > 1) {
var websiteUrl = $('#websiteUrl').val().split(',');
$.each(websiteUrl,
function() {
$('#homeurl').append('<input value="' + this + '" type="text" name="homeurl" class="form-control" style="margin-buttom:15px;">')
})
}
if($('#shopAddress').val().split(',').length>1){
var shopAddress=$('#shopAddress').val().split(',');
$.each(shopAddress,function(){
$('#homeaddress').append('<input value="'+this+'" type="text" name="homeaddresslist" class="form-control" style="margin-buttom:15px;">')
if ($('#shopAddress').val().split(',').length > 1) {
var shopAddress = $('#shopAddress').val().split(',');
$.each(shopAddress,
function() {
$('#homeaddress').append('<input value="' + this + '" type="text" name="homeaddresslist" class="form-control" style="margin-buttom:15px;">')
})
}
});
$('#brand-name').on('change',function() {
$.ajax({
url: '/supplier/storeadmin/supplierlist',
dataType: "json",
type: 'POST',
data: {
brandId: $('#brand-name').val()
},
success: function(data) {
var savebrandlist = [];
var brandselelt = $('#brand-name').find("option:selected").text();
$.each(data.data.data,function(index) {
savebrandlist.push('<tr>');
savebrandlist.push('<td><input class="checkbox" type="checkbox"></td>');
savebrandlist.push('<td>' + brandselelt + '</td>');
savebrandlist.push('<td>' + data.data.data[index].supplierName);
savebrandlist.push('<input type="hidden" class="agreementendtime" value="'+data.data.data[index].agreementEndTime+'">');
savebrandlist.push('<input type="hidden" class="brandid" value="'+data.data.data[index].brandId+'">');
savebrandlist.push('<input type="hidden" class="supplierid" value="'+data.data.data[index].supplierId+'">');
savebrandlist.push('</td>');
savebrandlist.push('</tr>')
});
$('#savebrand tbody').html(savebrandlist.join(''));
}
})
}
})
})
}
\ No newline at end of file
... ...
... ... @@ -4,8 +4,8 @@ var env = process.env.NODE_ENV || 'development';
var domain = {
// development:'http://localhost:30011',
// development:'http://172.16.6.236:8080',
development:'http://172.16.6.246:8081/platform',
// development:'http://172.16.6.246:8081/platform',
development:'http://192.168.102.215:8080/platform',
test:'http://192.168.102.205:18025/yoho-adminportal-web',
preview:'http://192.168.81.13:8189/yoho-admin-portal',
production:'http://192.168.81.6:8189/yoho-admin-portal'
... ... @@ -29,7 +29,7 @@ exports.res = [{
// 创建店铺页面数据获取
route: '/supplier/store/indexPage',
method: 'POST',
url:"/platform/ShopsRest/getShopList",
url:"/ShopsRest/getShopList",
isJsonRaw:true,
params:[
{name: 'supplierId', type: 'Number'},
... ... @@ -55,7 +55,7 @@ exports.res = [{
// 店铺信息页面数据获取
route: '/supplier/store/examinePage',
method: 'POST',
url:"/platform/ShopsRest/getShopList",
url:"/ShopsRest/getShopList",
isJsonRaw:true,
params:[
{name: 'supplierId', type: 'Number'},
... ... @@ -81,7 +81,7 @@ exports.res = [{
// 店铺审核页面数据获取
route: '/supplier/store/checkPage',
method: 'POST',
url:"/platform/ShopsRest/getShopList",
url:"/ShopsRest/getShopList",
isJsonRaw:true,
params:[
{name: 'supplierId', type: 'Number'},
... ... @@ -97,7 +97,7 @@ exports.res = [{
route: '/supplier/store/info/:shopsId',
method: 'GET',
view: 'pages/store/info',
url:"/platform/ShopsRest/getShopDetailById",
url:"/ShopsRest/getShopDetailById",
isJsonRaw:true,
params:[{
name:'shopsId',
... ... @@ -109,7 +109,7 @@ exports.res = [{
route: '/supplier/store/update/:shopsId',
method: 'GET',
view: 'pages/store/update',
url:"/platform/ShopsRest/getShopDetailById",
url:"/ShopsRest/getShopDetailById",
isJsonRaw:true,
params:[{
name:'shopsId',
... ... @@ -120,7 +120,7 @@ exports.res = [{
// 修改店铺页面提交
route: '/store/update',
method: 'POST',
url: '/platform/ShopsRest/updateShops',
url: '/ShopsRest/updateShops',
isJsonRaw: true,
params:[
{name:"shopsId",type:"Number"},
... ... @@ -152,7 +152,7 @@ exports.res = [{
}, {// 新增店铺数据
route: '/store/add',
method: 'POST',
url: '/platform/ShopsRest/addShops',
url: '/ShopsRest/addShops',
isJsonRaw: true,
params:[
{name:"shopName",type:"String"},
... ... @@ -189,6 +189,24 @@ exports.res = [{
{name: 'size', type: 'Number'}
]
},{
// 关店
route: '/supplier/store/closeShops',
method: 'POST',
url:"/ShopsRest/closeShops",
isJsonRaw:true,
params:[
{name:"shopsId",type:"Number"}
]
},{
// 开店
route: '/supplier/store/openShops',
method: 'POST',
url:"/ShopsRest/openShops",
isJsonRaw:true,
params:[
{name:"shopsId",type:"Number"}
]
},{
// 移除店铺管理员关系列表
route: '/supplier/storeadmin/delete',
method: 'POST',
... ... @@ -201,19 +219,47 @@ exports.res = [{
// 店铺管理员关系新增
route: '/supplier/storeadmin/adminAdd',
method: 'GET',
view: 'pages/store/adminAdd',
view: 'pages/store/adminedit',
src:'/store/adminedit'
},{
// 店铺管理员关系新增
route: '/supplier/storeadmin/addguanxi',
method: 'POST',
url:"/ShopsAdminRest/addAdminRelation",
isJsonRaw:true,
params:[
{name:"shopsId",type:"Number"},
{name:"adminPid",type:"Number"},
{name:"identity",type:"Number"}
]
},{
//修改
route: '/supplier/storeadmin/adminEdit/:id',
// 修改店铺页面渲染
route: '/supplier/store/adminupdate/:id',
method: 'GET',
view: 'pages/store/adminAdd',
url:'/ShopsAdminRest/getAdminRelationDetailById',
src:'/store/index',
src:'/store/adminedit',
view: 'pages/store/adminedit',
url:"/ShopsAdminRest/getAdminRelationDetailById",
isJsonRaw:true,
params:[{
name:'id',
type:'String'
}],
src:'/store/adminedit'
},{
// 根据身份选择管理员
route: '/supplier/storeadmin/managerName',
method: 'POST',
url:"/ShopsAdminRest/getUsersByIdentity",
isJsonRaw:true,
params:[
{name:"id",type:"Number"}
{name:"identity",type:"Number"}
]
}
]
\ No newline at end of file
},{
// 根据品牌选择供应商
route: '/supplier/storeadmin/supplierlist',
method: 'POST',
url:"/supplier/supplier/selectSupplierByBrandId",
isJsonRaw:true,
params:[
{name:"brandId",type:"Number"}
]
}]
\ No newline at end of file
... ...
... ... @@ -19,7 +19,13 @@
</div>
</div>
{{#data}}
<ul id="storelsit" style="display: none;">
<li id="shopsId">{{ shopsId}}</li>
<li id="adminPid">{{ adminPid}}</li>
<li id="identity">{{ identity}}</li>
</ul>
{{/data}}
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div class="panel-heading">
... ... @@ -34,13 +40,13 @@
<div style="margin-top: 20px;">
<span class="col-sm-1 control-label">管理员筛选 *</span>
<select name="store-type" id="identity-type" style="width: 280px;" tabindex="-1" title="" class="select2-offscreen brandBtn-group brandBtn-group-lg"><option value="-1" selected="selected">请选择身份</option>
<!-- <option value="1" data-valid="">品牌公司</option>
<option value="1" data-valid="">品牌公司</option>
<option value="2" data-valid="">品牌经销商</option>
<option value="3" data-valid="">品牌代运营商</option>
<option value="4" data-valid="">有货品牌经理</option>
<option value="5" data-valid="">有货店铺运营</option>
<option value="6" data-valid="">有货商品运营</option>
<option value="7" data-valid="">有货平台运营</option> -->
<option value="7" data-valid="">有货平台运营</option>
</select>
<select name="time-sort" id="manager-name" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
<option value="-1">选择管理员</option>
... ...
... ... @@ -153,8 +153,8 @@
</div>
</div>
<button type="button" id="btn1" class="btn btn-success">提交审核</button>
<button type="button" class="btn btn-info">暂存</button>
<button type="button" data-oncheck='1' class="check btn btn-success">提交审核</button>
<button type="button" data-oncheck='2' class="check btn btn-info">暂存</button>
<button onclick="history.go(-1);" type="button" class="btn btn-danger">取消</button>
</div>
</div>
... ...