Authored by dongjunjie

yoho币

//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>'
}
}]
});
*/
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")
};
},
columns: [{
display: '',
render: function(item){
var html = "";
if(item.__index == 0){
$("#yohoCoin_table").find("thead tr th").html($("#coinListHead").html());
}
item.genderName = ENUM.gender[item.gender];
html += common.util.__template2($("#coinList").html(),item);
return html;
}
}]
});
g.init($("#gridurl").val());
$(document).on('click', '.btn-modify', function() {
if($(this).hasClass("openEditor")){
$(this).text("修改").removeClass("openEditor");
$(this).parents(".dataForShow").find(".dataForEditor td").hide();
}else{
$(this).text("收起").addClass("openEditor");
$(this).parents(".dataForShow").find(".dataForEditor td").show();
}
});
... ...
... ... @@ -26,3 +26,4 @@
@import "module/shop-pc";
@import "module/shop-app";
@import "module/salecategory";
@import "module/yohocoin";
... ...
#yohoCoin_table tbody td, #yohoCoin_table thead th {
padding: 0;
}
#yohoCoin_table .coinListHead{
text-align: center;
font-weight: bold;
}
#yohoCoin_table .dataForShow table, #yohoCoin_table .dataForEditor table{
width: 100%;
table-layout:fixed;
}
#yohoCoin_table .dataForShow tr td, #yohoCoin_table .dataForEditor table tr td{
padding: 10px;
border-left: 1px solid #ddd;
}
#yohoCoin_table .center{
text-align: center;
}
#yohoCoin_table .dataForShow tr td:first-child{
border-left: none;
}
#yohoCoin_table .dataForEditor tr td{
padding: 0;
display: none;
border-bottom: none;
background: #d9edf7;
}
#yohoCoin_table .dataForEditor tr:first-child{
border-bottom: 1px solid #ddd;
border-top: 1px solid #ddd;
}
... ...
exports.domain = require('../config/common.js').domain;
exports.res = [
{
route: '/goods/yohoCoin/index',
method: 'GET',
view: 'pages/goods/yohoCoin',
src:'/goods/yohoCoin',
'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,
bulkImport: true
},
gridurl: '/goods/price/list'
}
}
]
... ...
<!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 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>
{{# bulkImport}}
<a id="import-btn" href="javascript:;" class="btn btn-info">批量导入</a>
{{/ bulkImport}}
</div>
</div>
</div>
{{/ filter}}
</div>
<div class="panel">
<div class="dataTables_wrapper no-footer" id="yohoCoin_table"></div>
<div class="panel bulk-import">
<div class="import-hd">
<span class="excel-upload-wrap">
<label>选择文件</label>
<input id="upload-input" name="file" class="btn btn-default excel-upload" type="file">
</span>
<a class="excel-model" href="/ajax/link/{{download}}">表头下载</a>
<input id="sure-change" class="btn btn-primary" type="button" value="确定变价">
</div>
<ol id="error-msg" class="error-msg" style="color: red"></ol>
<div class="priceTable-wrap">
<div class="panel panel-warning" style="margin: 0;">
<div class="panel-heading">SKN变价<a id="delete-all" class="btn btn-danger" style="margin-left: 50px;" href="javascript:;">全部删除</a></div>
</div>
<div class="dataTables_wrapper no-footer" id="priceTable"></div>
</div>
<div class="success-wrap" style="display: none;">
<a class="btn btn-info" href="">返回变价列表</a>
<a id="download-btn" class="btn btn-success" data-domain="{{domain}}" href="javascript:;">下载导入结果</a>
</div>
</div>
</div>
</div>
<input type="hidden" id="gridurl" value="{{gridurl}}">
<script id="coinListHead" type="text/template">
<div class="coinListHead dataForShow">
<table><tbody>
<tr>
<td style="width: 10%">SKN</td>
<td style="width: 25%">商品信息</td>
<td style="width: 20%">供应商 / 店铺</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>
</tr>
</tbody></table>
</div>
</script>
<script id="coinList" type="text/template">
<div class="dataForShow">
<table><tbody>
<tr>
<td rowspan="2" span="2" class="center" style="width: 10%">[[product_skn]]</td>
<td class="" style="width: 25%">
<p>名称:[[product_name]]</p>
<p>品牌:[[brand_name]]</p>
<div>类目:[[middle_sort_name]] <b>></b>[[small_sort_name]]</div>
</td>
<td style="width: 20%">
[[if supplier_name]]
[[supplier_name]]
[[/if]]
[[if shop_name]]
/[[shop_name]]
[[/if]]
</td>
<td class="center" style="width: 5%">[[genderName]]</td>
<td class="center" style="width: 5%">[[retail_price]]</td>
<td class="center" style="width: 5%">[[sales_price]]</td>
<td class="center" style="width: 5%">[[return_coin]]</td>
<td class="center" style="width: 5%">[[status]]</td>
<td style="width: 15%">
[[if founder_name]]
<p>[[founder_name]]</p>
[[/if]]
[[if updateTime]]
<p>[[updateTime]]</p>
[[/if]]
</td>
<td class="center" style="width: 5%"><button type="button" class="btn btn-info btn-sm btn-modify">修改</button></td>
</tr>
<tr class="dataForEditor">
<td colspan="9" style="padding: 0">
<table>
<tr class="center">
<td width="50%"><b>反币时间</b></td>
<td><b>返回金币</b></td>
<td><b>审核人</b></td>
<td><b>操作</b></td>
</tr>
<tr>
<td>
<div class="radio" style="margin-top: 0">
<label>
<input type="radio" name="returnCoinTime" value="option1" checked>
永久
</label>
</div>
<div class="radio" style="margin-bottom: 0">
<label>
<input type="radio" name="returnCoinTime" value="option1" checked>
<form class="form-inline">
<div class="form-group" style="margin-right: 0"><input type="text" class="form-control"></div> ~
<div class="form-group" style="margin-right: 0"><input type="text" class="form-control"></div>
</form>
</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>
</select>
</td>
<td class="center"><button type="submit" class="btn btn-primary btn-sm">保存</button></td>
</tr>
</table>
</td>
</tr>
</tbody></table>
</div>
</script>
</body>
</html>
\ No newline at end of file
... ...