netsale.js 2.78 KB
'use strict';
var $ = require('jquery'),
	common = require('../common/common');


var ENUM = {
	gender: {
		1: '男',
		2: '女',
		3: '通用'
	}
}
var g = new common.grid({
	el: "#basicTable",
	parms: function() {

		return {
			productSkn: common.util.__input("productSkn"),
			productSkc: common.util.__input("productSkc"),
			productSku: common.util.__input("productSku"),
			productName: common.util.__input("productName"),
			shopId: common.util.__input("shopId"),
			brandId: common.util.__input("brandId"),
			isJit: common.util.__input("isJit"),
			stock: common.util.__input("stock"),
			isScreen: common.util.__input("isScreen"),
			isMeasure: common.util.__input("isMeasure"),
			gender: common.util.__input("gender"),
			maxSortId: common.util.__input("maxSortId"),
			middleSortId: common.util.__input("middleSortId"),
			smallSortId: common.util.__input("smallSortId"),
			isOutLets: common.util.__input("isOutLets"),
			productStatus: common.util.__input("productStatus"),
			isScreen: common.util.__input("isScreen")
		};
	},
	columns: [{
		display: '',
		type: 'checkbox'
	}, {
		display: 'skn',
		name: 'productSkn'
	}, {
		display: '图片',
		name: 'picImgUrl',
		render: function(item) {
			return '<img src="' + item.picImgUrl + '">';
		}
	}, {
		display: '商品信息',
		render: function(item) {
			return '<p><strong>名称:</strong>' + item.productName + '</p>' +
				'<p><strong>品牌:</strong>' + item.brandName + '</p>' +
				'<p><strong>类目:</strong>' + item.maxSortName + '/' + item.middleSortName + '</p>';
		}
	}, {
		display: '售价',
		render: function(item) {
			return '<p><strong>吊牌价:</strong>' + item.retailPrice + '</p>' +
				'<p><strong>销售价:</strong>' + item.salesPrice + '</p>' +
				'<p><strong>是否VIP:</strong></p>' +
				'<p style="color: #ccc;"><strong>yoho币:</strong>' + item.returnCoin + '</p>';
		}
	}, {
		display: '库存',
		name: 'stock'
	}, {
		display: '年龄层/性别',
		name: 'vip_discount_type',
		render: function(item) {
			return ENUM.gender[item.gender];
		}
	}, {
		display: '商品类别',
		name: 'vip_price'
	}, {
		display: '操作信息',
		render: function(item) {
			var html = '';
			if (item.founder_name) {
				html += '<p>' + item.founder_name + '</p>';
			}

			if (item.updateTime) {
				html += '<p>' + item.updateTime + '</p>';
			}
			return html;
		}
	}, {
		display: '上架状态',
		name: 'vip2_price'
	}, {
		display: '操作',
		render: function(item) {
			return '<a href="/goods/netsale/edit/' + item.productSkn + '" class="btn btn-info btn-xs edit-btn">编辑</a>' +
				'<a href="javascript:;" class="btn btn-info btn-xs edit-btn">上架</a>' +
				'<a href="javascript:;" class="btn btn-info btn-xs info-btn">查看</a>';
		}
	}]
});

g.init($("#gridurl").val());

$("#filter-btn").click(function() {
	g.reload(1);
});