|
|
'use strict';
|
|
|
var $ = require('jquery'),
|
|
|
common = require('../../../common/common');
|
|
|
|
|
|
/***********************变价列表***********************/
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: '#shop',
|
|
|
ajax: 'shopsRest'
|
|
|
});
|
|
|
|
|
|
new common.dropDown({
|
|
|
el: '#brand',
|
|
|
ajax: 'brand',
|
|
|
params:function(){
|
|
|
return {userLimitFlag:true};
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
var ENUM = {
|
|
|
gender: {
|
|
|
1: '男',
|
|
|
2: '女',
|
|
|
3: '通用'
|
|
|
},
|
|
|
vipType: {
|
|
|
1: '正常折扣',
|
|
|
2: '统一折扣',
|
|
|
3: '无折扣',
|
|
|
4: '固定折扣',
|
|
|
5: '自定义折扣'
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 对float数字进行精度控制,保留小数点后4位
|
|
|
// 暂只支持字符串
|
|
|
var formatFloat = function(num) {
|
|
|
var number = parseFloat(num);
|
|
|
if (isNaN(number))
|
|
|
return "";
|
|
|
return Math.round(number * 10000) / 10000;
|
|
|
}
|
|
|
var tabTree = new common.tabTree("#sortTree");
|
|
|
tabTree.init();
|
|
|
|
|
|
|
|
|
var g = new common.grid({
|
|
|
el: "#basicTable",
|
|
|
usepagesize:true,
|
|
|
parms: function() {
|
|
|
var studentPriceValScope = $("#studentPriceValScope").val();
|
|
|
return {
|
|
|
product_skn: common.util.__input("skn"),
|
|
|
max_sort_id: tabTree.selected[0] ? tabTree.selected[0].id : "",
|
|
|
middle_sort_id: tabTree.selected[1] ? tabTree.selected[1].id : "",
|
|
|
small_sort_id: tabTree.selected[2] ? tabTree.selected[2].id : "",
|
|
|
shop_id: common.util.__input("shop"),
|
|
|
brand_id: common.util.__input("brand"),
|
|
|
studentPriceValScope: studentPriceValScope
|
|
|
}
|
|
|
},
|
|
|
columns: [
|
|
|
{display: '商品信息', render: function(item) {
|
|
|
var html = '<p>SKN:'+item.product_skn +'</p><p>名称:' + item.product_name + '</p><p>品牌:' + item.brand_name + '</p>' +
|
|
|
'<div>类目:'+'<br>'+ item.max_sort_name;
|
|
|
if(item.middle_sort_name) {html += ' > ' + item.middle_sort_name;}
|
|
|
if(item.small_sort_name) {html += ' > ' + item.small_sort_name;}
|
|
|
html += "</div><p>";
|
|
|
html += '<p>性别:'+ENUM.gender[item.gender]+'</p>';
|
|
|
return html;
|
|
|
}},
|
|
|
{display: '供应商/店铺', render: function(item) {
|
|
|
var html = '';
|
|
|
if (item.supplier_name) {
|
|
|
html += item.supplier_name;
|
|
|
if (item.shop_name) {html += '/';}
|
|
|
}
|
|
|
if (item.shop_name) {html += item.shop_name;}
|
|
|
return html;
|
|
|
}},
|
|
|
{display: '当前售价', render: function(item) {
|
|
|
var html = '<p>吊牌价:'+item.retail_price +'</p>';
|
|
|
html += '<p>销售价:'+item.sales_price +'</p>';
|
|
|
if (item.student_price) {html += '<p>学生价:'+item.student_price +'</p>';}
|
|
|
return html;
|
|
|
}},
|
|
|
{display: 'VIP折扣类型', render: function(item) {
|
|
|
return ENUM.vipType[item.vip_discount_type];
|
|
|
}},
|
|
|
{display: '会员价', render: function(item) {
|
|
|
var html = '<p>VIP价:';
|
|
|
if(item.vip_price) html += item.vip_price +'</p>';
|
|
|
else html += '</p>';
|
|
|
html += '<p>白金:'+'<br>';
|
|
|
if(item.vip3_price) html += item.vip3_price +'</p>';
|
|
|
else html += '</p>';
|
|
|
html += '<p>金卡:'+'<br>';
|
|
|
if(item.vip2_price) html += item.vip2_price +'</p>';
|
|
|
else html += '</p>';
|
|
|
html += '<p>银卡:'+'<br>';
|
|
|
if(item.vip1_price) html += item.vip1_price +'</p>';
|
|
|
else html += '</p>';
|
|
|
return html;
|
|
|
}}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
g.init('/goods/studentPrice/list');
|
|
|
|
|
|
|
|
|
|
|
|
//筛选
|
|
|
$(document).on('click', '#filter-btn', function () {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
//回车筛选
|
|
|
$(document).on('keyup', 'body', function (event) {
|
|
|
if (event.keyCode == 13) {
|
|
|
$("#filter-btn").trigger('click');
|
|
|
}
|
|
|
});
|
|
|
//全部
|
|
|
$(document).on('click', '#all-btn', function () {
|
|
|
location.href = '';
|
|
|
});
|
|
|
|
|
|
|
|
|
/***********************批量功能***********************/
|
|
|
//批量导入按钮点击事件
|
|
|
$(document).ready(function() {
|
|
|
$("#import-btn").attr('target', '_blank');
|
|
|
});
|
|
|
//$(document).on('click', '#import-btn', function () {
|
|
|
//location.href="/supplier/baseproduct/batchUpdateStudentPrice";
|
|
|
//}); |
|
|
\ No newline at end of file |
...
|
...
|
|