Authored by 王钱钧

Merge branch 'develop' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into develop

... ... @@ -10,100 +10,36 @@ var ENUM = {
3: '通用'
},
status: {
0: '未设置',
1: '<font color="#428bca">待审核</font>',
2: '<font color="#5cb85c">通过</font>',
3: '<font color="#d9534f">驳回</font>'
}
}
/*
var g = new common.grid({
el: "#yohoCoin_table1",
parms: function() {
return {
product_skn: common.util.__input("skn"),
shop_id: common.util.__input("shop"),
brand_id: common.util.__input("brand"),
supplier_id: common.util.__input("supplier"),
gender: common.util.__input("gender")
};
},
columns: [{
display: 'SKN',
name: 'product_skn'
}, {
display: '商品信息',
name: 'info',
render: function(item) {
return '<div>名称:' + item.product_name + '</div>' +
'<div>品牌:' + item.brand_name + '</div>' +
'<div>类目:' + item.middle_sort_name + '<b> ></b> ' + item.small_sort_name + '</div>';
}
}, {
display: '供应商 / 店铺',
name: 'supplier_name',
render: function(item) {
var html = '';
if (item.supplier_name) {
html += item.supplier_name;
}
if (item.shop_name) {
html += '/' + item.shop_name;
}
return html;
}
}, {
display: '性别',
name: 'gender',
render: function(item) {
return ENUM.gender[item.gender];
}
}, {
display: '吊牌价',
name: 'retail_price'
}, {
display: '销售价',
name: 'sales_price'
}, {
display: '返币金额',
name: 'return_coin'
}, {
display: '状态',
name: 'status',
render: function(item) {
return ENUM.status[item.status];
}
},{
display: '操作信息',
name: 'operateInfo',
render: function(item) {
var html = '';
if (item.founder_name) {
html += '<div>' + item.founder_name + '</div>';
}
if (item.updateTime) {
html += '<div>' + item.updateTime + '</div>';
}
return html;
}
}, {
display: '操作',
render: function(item) {
return '<a href="javascript:;" class="btn btn-info btn-xs btn-modify" data-skn="' + item.product_skn + '">修改</a>'
}
}]
new common.dropDown({
el: '#shop',
ajax: 'shopsRest'
});
new common.dropDown({
el: '#brand',
ajax: 'brand'
});
new common.dropDown({
el: '#supplier',
ajax: 'querySupplier'
});
*/
var g = new common.grid({
el: "#yohoCoin_table",
parms: function() {
return {
product_skn: common.util.__input("skn"),
shop_id: common.util.__input("shop"),
brand_id: common.util.__input("brand"),
supplier_id: common.util.__input("supplier"),
gender: common.util.__input("gender")
productSkn: common.util.__input("skn"),
shopId: common.util.__input("shop"),
brandId: common.util.__input("brand"),
supplierId: common.util.__input("supplier"),
gender: common.util.__input("gender"),
auditStatus: common.util.__input("auditStatus")
};
},
columns: [{
... ... @@ -114,6 +50,8 @@ var g = new common.grid({
$("#yohoCoin_table").find("thead tr th").html($("#coinListHead").html());
}
item.genderName = ENUM.gender[item.gender];
item.statusName = ENUM.status[item.productPrice.coinStatus];
html += common.util.__template2($("#coinList").html(),item);
return html;
}
... ... @@ -121,6 +59,101 @@ var g = new common.grid({
});
g.init($("#gridurl").val());
//上传Excel
var loadModal = null;
common.edit.ajaxfileupload('#yohoCoinUpload',{
params: {
type: "price",
__type: "batch-import"
},
onStart: function() {
loadModal = common.dialog.load();
$('.file-name').text($('#upload-input').val().replace("C:\\fakepath\\", ""));
},
onComplete: function(response) {
console.log(response);
if (loadModal) {
loadModal.close();
}
if (response.code == 200) {
} else {
common.util.__tip(response.message, 'warning');
}
}
});
//吊牌价跟销售价校验
function checkPrice(retailPrice, salesPrice){
if(retailPrice == salesPrice){
return true;
}else{
common.util.__tip("销售价与吊牌价不同,YOHO币只能为0!");
return false;
}
}
//yoho币金额校验
var pricePercent = 0.2;
function checkYohoCoin(yohoCoin, auditor, price){
if(yohoCoin.val()){
if(!isNaN(yohoCoin.val())){
if(yohoCoin.val() < 0){
yohoCoin.focus().select().addClass("error");
common.util.__tip("YOHO币金额不能小于0!");
return false;
}
//yoho币大于等于销售额的20%需要校验审核人
if(yohoCoin.val() >= (price * pricePercent)){
return checkAuditor(auditor);
}
}else{
yohoCoin.focus().select().addClass("error");
common.util.__tip("YOHO币金额必须为数字!");
return false;
}
}else{
yohoCoin.focus().addClass("error");
common.util.__tip("YOHO币金额不能为空!");
return false;
}
return true;
}
//审核人校验
function checkAuditor(auditor){
if(auditor.val() == -1){
auditor.focus().addClass("error");
common.util.__tip("审核人不能为空!");
return false;
}
return true;
}
//保存
$(document).on('click', '.btn-save', function() {
var productSkn = $(this).data('productskn');
var retailPrice = $(this).parents('.dataForEditor').find('.retailPrice').val(); //吊牌价
var salesPrice = $(this).parents('.dataForEditor').find('.salesPrice').val(); //销售价
if(checkPrice(retailPrice, salesPrice)){
var yohoCoinInput = $(this).parents('.dataForEditor').find('.editor-yohoCoin');
var auditorInput = $(this).parents('.dataForEditor').find('.editor-auditor');
if(checkYohoCoin(yohoCoinInput, auditorInput, salesPrice)){
common.util.__ajax({
url:'/good/yohoCoin/set',
data: {
"productSkn": productSkn,
"returnCoin": yohoCoinInput.val(),
"auditorId": auditorInput.val()
}
},function(rs){
//common.util.__tip("YOHO币编辑成功!","success");
});
}
}
});
//显示修改
$(document).on('click', '.btn-modify', function() {
if($(this).hasClass("openEditor")){
$(this).text("修改").removeClass("openEditor");
... ... @@ -130,11 +163,27 @@ $(document).on('click', '.btn-modify', function() {
$(this).parents(".dataForShow").find(".dataForEditor td").show();
}
});
//批量导入按钮点击事件
//显示批量导入
$(document).on('click', '#import-btn', function() {
$('.dataTables_wrapper').hide();
$('#yohoCoinSearch').hide();
$('.bulk-import').show();
});
//返回列表
$(document).on('click', '#return-btn', function() {
$('.bulk-import').hide();
$('#yohoCoinSearch').show();
$('.dataTables_wrapper').show();
});
//删选
$(document).on('click', '#filter-btn', function() {
g.reload(1);
});
//全部
$(document).on('click', '#all-btn', function() {
location.href = '';
});
//校验失败编辑
$(document).on('change', '#yohoCoin_table .error', function() {
$(this).removeClass('error');
});
\ No newline at end of file
... ...
//yoho币
'use strict';
var $ = require('jquery'),
common=require('../common/common');
var ENUM = {
gender: {
1: '男',
2: '女',
3: '通用'
},
status: {
1: '<font color="#428bca">待审核</font>',
2: '<font color="#5cb85c">通过</font>',
3: '<font color="#d9534f">驳回</font>'
}
}
var g = new common.grid({
el: "#yohoCoin_table1",
parms: function() {
return {
product_skn: common.util.__input("skn"),
shop_id: common.util.__input("shop"),
brand_id: common.util.__input("brand"),
supplier_id: common.util.__input("supplier"),
gender: common.util.__input("gender")
};
},
columns: [{
display: 'SKN',
name: 'product_skn'
}, {
display: '商品信息',
name: 'info',
render: function(item) {
return '<div>名称:' + item.product_name + '</div>' +
'<div>品牌:' + item.brand_name + '</div>' +
'<div>类目:' + item.middle_sort_name + '<b> ></b> ' + item.small_sort_name + '</div>';
}
}, {
display: '供应商 / 店铺',
name: 'supplier_name',
render: function(item) {
var html = '';
if (item.supplier_name) {
html += item.supplier_name;
}
if (item.shop_name) {
html += '/' + item.shop_name;
}
return html;
}
}, {
display: '性别',
name: 'gender',
render: function(item) {
return ENUM.gender[item.gender];
}
}, {
display: '吊牌价',
name: 'retail_price'
}, {
display: '销售价',
name: 'sales_price'
}, {
display: '反币数',
name: 'return_coin'
}, {
display: '状态',
name: 'status',
render: function(item) {
return ENUM.status[item.status];
}
},{
display: '操作信息',
name: 'operateInfo',
render: function(item) {
var html = '';
if (item.founder_name) {
html += '<div>' + item.founder_name + '</div>';
}
if (item.updateTime) {
html += '<div>' + item.updateTime + '</div>';
}
return html;
}
}, {
display: '操作',
render: function(item) {
return '<a href="javascript:;" class="btn btn-info btn-xs btn-modify" data-skn="' + item.product_skn + '">修改</a>'
}
}]
});
g.init($("#gridurl").val());
//审核通过
$(document).on('click', '.btn-modify', function() {
});
... ...
... ... @@ -28,11 +28,19 @@
padding: 0;
display: none;
border-bottom: none;
background: #d9edf7;
background1: #d9edf7;
}
#yohoCoin_table .dataForEditor tr:first-child{
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
#yohoCoin_table .dataForEditor tr td .form-control{
display: inline-block;
}
#yohoCoin_table .dataForEditor tr td.editorTip{
color: #ff0000;
border-top: 1px solid #ddd
}
#yohoCoin_table .error{ border: 2px solid #ff0000}
... ...
... ... @@ -2,7 +2,10 @@
exports.domain = 'http://172.16.6.214:8088/platform';
exports.res = [
{
/*************************yoho币管理页面接口*******************************/
{//yoho币管理页面渲染
route: '/goods/yohoCoin/index',
method: 'GET',
view: 'pages/goods/yohoCoin',
... ... @@ -11,7 +14,7 @@ exports.res = [
pagetitle: {
level1title: '商品管理',
level2title: '价格管理',
level3title: 'yoho币管理'
level3title: 'YOHO币管理'
},
filter: {
skn: true,
... ... @@ -25,24 +28,63 @@ exports.res = [
returnCoinTime: false,
bulkImport: true
},
gridurl: '/yohoCoin/queryPageList'
gridurl: '/good/yohoCoin/queryPageList'
}
},
{//查询yoho币页面
route: "/yohoCoin/queryPageList",
route: "/good/yohoCoin/queryPageList",
method: "POST",
url: "/yohoCoin/queryPageList",
params:[
{name: 'supplierId', type: 'Number'},
{name: 'productSkn', type: 'Number'},
{name: 'shopId', type: 'Number'},
{name: 'brandId', type: 'Number'},
{name: 'supplierId', type: 'Number'},
{name: 'gender', type: 'String'},
{name: 'auditStatus', type: 'Number'},
{name: 'maxSortId', type: 'Number'},
{name: 'middleSortId', type: 'Number'},
{name: 'smallSortId', type: 'Number'},
{name: 'sortId', type: 'Number'},
{name: 'gender', type: 'String'},
{name: 'auditStatus', type: 'Number'},
{name: 'productSkn', type: 'Number'}
{name: 'sortId', type: 'Number'}
]
},
{//编辑保存yoho币
route: "/good/yohoCoin/set",
method: "POST",
url: "/yohoCoin/set",
params:[
{name: 'productSkn', type: 'Number'},
{name: 'returnCoin', type: 'Number'}
]
},
/*************************yoho币审核页面接口*******************************/
{//yoho币审核页面渲染
route: '/goods/yohoCoin/Audit',
method: 'GET',
view: 'pages/goods/yohoCoinAudit',
src:'/goods/yohoCoinAudit',
'data': {
pagetitle: {
level1title: '商品管理',
level2title: '价格管理',
level3title: 'YOHO币审核'
},
filter: {
skn: true,
store: true,
brand: true,
supplier: true,
gender: true,
cate_1: true,
cate_2: true,
cate_3: true,
returnCoinTime: false
},
gridurl: ''
}
}
]
... ...
... ... @@ -29,12 +29,12 @@
</div>
<div class="contentpanel">
<div class="panel panel-default" style="margin-bottom:10px;">
<div id="yohoCoinSearch" class="panel panel-default" style="margin-bottom:10px;">
{{# filter}}
<div class="panel-body">
<div class="row">
{{# skn}}
<div class="panel-col2">
<div class="panel-col">
<input id="skn" class="form-control panel-input height40" type="text" placeholder="请输入SKN" onkeyup="this.value=this.value.replace(/\D/gi,'')">
</div>
{{/ skn}}
... ... @@ -74,29 +74,26 @@
</div>
{{/ gender}}
{{# cate_1}}
{{# gender}}
<div class="panel-col">
<select name="cate_1" id="cate_1" tabindex="-1" title="" class="form-control">
<option value="-1">请选择一级类目</option>
<select name="auditStatus" id="auditStatus" tabindex="-1" title="" class="form-control">
<option value="-1">选择审核状态</option>
<option value="0">未设置</option>
<option value="1">待审核</option>
<option value="2">通过</option>
<option value="3">驳回</option>
</select>
</div>
{{/ cate_1}}
{{/ gender}}
{{# cate_2}}
{{# cate_1}}
<div class="panel-col">
<select name="cate_2" id="cate_2" tabindex="-1" title="" class="form-control">
<option value="-1">请选择二级类目</option>
<select name="cate_1" id="cate_1" tabindex="-1" title="" class="form-control">
<option value="-1">请选择一级类目</option>
</select>
</div>
{{/ cate_2}}
{{/ cate_1}}
{{# cate_3}}
<div class="panel-col">
<select name="cate_3" id="cate_3" tabindex="-1" title="" class="form-control">
<option value="-1">请选择三级类目</option>
</select>
</div>
{{/ cate_3}}
{{# returnCoinTime}}
<div class="panel-col form-inline" style="width: auto">
... ... @@ -127,7 +124,27 @@
<div class="dataTables_wrapper no-footer" id="yohoCoin_table"></div>
<div class="panel bulk-import">
<input type="file">
<a id="return-btn" href="javascript:;" class="btn btn-info">返回列表</a>
<table class="table table-bordered" style="border:1px solid #ddd; margin-top: 10px">
<tr>
<td width="120px" style="line-height: 37px"><b>上传EXCEL:</b></td>
<td style="position: relative;">
<input id="yohoCoinUpload" name="file" type="file" style="cursor: pointer; height: 37px; top: 8px;">
<div class="file-name btn btn-primary">请选择文件</div>
</td>
</tr>
<tr>
<td width="120px"><b>说明:</b></td>
<td>
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2、Excel表头为:<span style="color: #67D267;">SKN、品牌、吊牌价、返币金额(大于零,最多俩位小数)</span><br>
3、第一行为表头内容,第二行开始为正式内容<br>
4、每个文件控制在2500行以内<br>
5、<a href="">下载样例</a>
</td>
</tr>
</table>
</div>
</div>
</div>
... ... @@ -144,7 +161,7 @@
<td style="width: 5%">性别</td>
<td style="width: 5%">吊牌价</td>
<td style="width: 5%">销售价</td>
<td style="width: 5%">还金额</td>
<td style="width: 5%">币数</td>
<td style="width: 5%">状态</td>
<td style="width: 15%">操作信息</td>
<td style="width: 5%">操作</td>
... ... @@ -160,34 +177,25 @@
<td rowspan="2" span="2" class="center" style="width: 10%">[[productSkn]]</td>
<td class="" style="width: 25%">
<p>名称:[[productName]]</p>
<p>品牌:[[brand_name]]</p>
<div>类目:[[middle_sort_name]]
[[if small_sort_name]]
&nbsp;&nbsp;>&nbsp;&nbsp;
[[small_sort_name]]
[[/if]]
<p>品牌:[[brandName]]</p>
<div>
类目:[[if maxSortName]][[maxSortName]][[/if]]
[[if middleSortName]]&nbsp;>&nbsp;[[middleSortName]][[/if]]
[[if smallSortName]]&nbsp;>&nbsp;[[smallSortName]][[/if]]
</div>
</td>
<td style="width: 20%">
[[if supplier_name]]
[[supplier_name]]
[[/if]]
[[if shop_name]]
/[[shop_name]]
[[/if]]
[[if supplierName]][[supplierName]][[/if]]
[[if shopName]]&nbsp;/&nbsp;[[shopName]][[/if]]
</td>
<td class="center" style="width: 5%">[[genderName]]</td>
<td class="center" style="width: 5%">[[retailPrice]]</td>
<td class="center" style="width: 5%">[[salesPrice]]</td>
<td class="center" style="width: 5%">[[yohoCoin]]</td>
<td class="center" style="width: 5%">[[status]]</td>
<td class="center" style="width: 5%">[[productPrice.returnCoin]]</td>
<td class="center" style="width: 5%">[[statusName]]</td>
<td style="width: 15%">
[[if founder_name]]
<p>[[founder_name]]</p>
[[/if]]
[[if updateTime]]
<p>[[updateTime]]</p>
[[/if]]
[[if productPrice.founder]][[productPrice.founder]][[/if]]
[[if productPrice.updateTime]]<br>[[productPrice.updateTime]][[/if]]
</td>
<td class="center" style="width: 5%"><button type="button" class="btn btn-info btn-sm btn-modify">修改</button></td>
</tr>
... ... @@ -197,7 +205,7 @@
<table>
<tr class="center">
<!--td width="50%"><b>反币时间</b></td-->
<td width="40%"><b>返回</b></td>
<td width="40%"><b>返回YOHO</b></td>
<td width="40%"><b>审核人</b></td>
<td width="20%"><b>操作</b></td>
</tr>
... ... @@ -216,17 +224,24 @@
</label>
</div>
</td-->
<td class="center"><input type="text" class="form-control" placeholder="返回yoho币" value="[[return_coin]]"></td>
<td class="center">
<select class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<input type="text" class="form-control center editor-yohoCoin" placeholder="YOHO币数量" value="[[productPrice.returnCoin]]" style="width: 100px">
</td>
<td class="center">
<select class="form-control center editor-auditor" tabindex="-1" style="width: 150px">
<option value="-1">-- 请选择审核人 --</option>
<option value="2965">Tracy</option>
<option value="10235">David Wong</option>
</select>
</td>
<td class="center"><button type="submit" class="btn btn-primary btn-sm">保存</button></td>
<td class="center">
<input type="hidden" class="retailPrice" value="[[productPrice.retailPrice]]">
<input type="hidden" class="salesPrice" value="[[productPrice.salesPrice]]">
<button type="submit" class="btn btn-primary btn-sm btn-save" data-productskn="[[productSkn]]">保存</button>
</td>
</tr>
<tr>
<td class="editorTip" colspan="3">* 提示:若返币YOHO币金额&nbsp;&nbsp;<b>大于等于</b>&nbsp;&nbsp;销售价的20%,审核人必须填写,审核通过后才能进入该状态。</td>
</tr>
</table>
</td>
... ...
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
{{#pagetitle}}
<div class="media-body">
<ul class="breadcrumb">
<li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="">{{level1title}}</a></li>
<li>{{level2title}}</li>
</ul>
<div>
<div style="width: 30%;float: left;">
<h4>{{level3title}}</h4>
</div>
</div>
</div>
{{/pagetitle}}
</div>
</div>
<div class="contentpanel">
<div id="yohoCoinSearch" class="panel panel-default" style="margin-bottom:10px;">
{{# filter}}
<div class="panel-body">
<div class="row">
{{# skn}}
<div class="panel-col2">
<input id="skn" class="form-control panel-input height40" type="text" placeholder="请输入SKN" onkeyup="this.value=this.value.replace(/\D/gi,'')">
</div>
{{/ skn}}
{{# store}}
<div class="panel-col">
<select name="shop" id="shop" tabindex="-1" title="" class="form-control">
<option value="-1">请选择店铺</option>
</select>
</div>
{{/ store}}
{{# brand}}
<div class="panel-col">
<select name="brand" id="brand" tabindex="-1" title="" class="form-control">
<option value="-1">请选择品牌</option>
</select>
</div>
{{/ brand}}
{{# supplier}}
<div class="panel-col">
<select name="supplier" id="supplier" tabindex="-1" title="" class="form-control">
<option value="-1">请选择供应商</option>
</select>
</div>
{{/ supplier}}
{{# gender}}
<div class="panel-col">
<select name="gender" id="gender" tabindex="-1" title="" class="form-control">
<option value="-1">选择性别</option>
<option value="1"></option>
<option value="2"></option>
<option value="3">通用</option>
</select>
</div>
{{/ gender}}
{{# cate_1}}
<div class="panel-col">
<select name="cate_1" id="cate_1" tabindex="-1" title="" class="form-control">
<option value="-1">请选择一级类目</option>
</select>
</div>
{{/ cate_1}}
{{# cate_2}}
<div class="panel-col">
<select name="cate_2" id="cate_2" tabindex="-1" title="" class="form-control">
<option value="-1">请选择二级类目</option>
</select>
</div>
{{/ cate_2}}
{{# cate_3}}
<div class="panel-col">
<select name="cate_3" id="cate_3" tabindex="-1" title="" class="form-control">
<option value="-1">请选择三级类目</option>
</select>
</div>
{{/ cate_3}}
{{# returnCoinTime}}
<div class="panel-col form-inline" style="width: auto">
<div class="form-group" style="margin-right: 0">
<label>反币时间:</label>
<input type="text" class="form-control" jsaction="date:end:endDate" id="startDate" placeholder="开始时间">
</div>
<label>~</label>
<div class="form-group">
<input type="text" class="form-control" jsaction="date:start:startDate" id="endDate" placeholder="结束时间">
</div>
</div>
{{/ returnCoinTime}}
<div class="panel-col" style="width: auto">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="javascript:;" class="btn btn-info">全部</a>
</div>
</div>
</div>
{{/ filter}}
</div>
<div class="panel">
<div class="dataTables_wrapper no-footer"></div>
</div>
</div>
<input type="hidden" id="gridurl" value="{{gridurl}}">
</body>
</html>
\ No newline at end of file
... ...