123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- $(function () {
- $("#jqGrid").jqGrid({
- url: '../goods/historyList',
- datatype: "json",
- colModel: [
- {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
- {label: '商品类型', name: 'categoryName', index: 'category_id', width: 180},
- {label: '商品序列号', name: 'goodsSn', index: 'goods_sn', width: 180, hidden: true},
- {label: '名称', name: 'name', index: 'name', width: 400},
- // {label: '品牌', name: 'brandName', index: 'brand_id', width: 120},
- // {label: '关键字', name: 'keywords', index: 'keywords', width: 80, hidden: true},
- // {label: '简明介绍', name: 'goodsBrief', index: 'goods_brief', width: 80, hidden: true},
- {label: '商品描述', name: 'goodsDesc', index: 'goods_desc', width: 180, hidden: true},
- {
- label: '上架', name: 'isOnSale', index: 'is_on_sale', width: 100,align: 'center',
- formatter: function (value) {
- return transIsNot(value);
- }
- },
- {
- label: '添加时间', name: 'addTime', index: 'add_time', align: 'center',width: 160, formatter: function (value) {
- return transDate(value);
- }
- },
- {label: '删除状态', name: 'isDelete', index: 'is_delete', width: 80, hidden: true},
- // {label: '属性类别', name: 'attributeCategoryName', index: 'attribute_category', width: 80},
- {label: '是否新商品', name: 'isNew', index: 'is_new', width: 80, hidden: true},
- {label: '商品单位', name: 'goodsUnit', index: 'goods_unit', align: 'center',width: 100},
- {label: '商品主图', name: 'primaryPicUrl', index: 'primary_pic_url', width: 80, hidden: true},
- {label: '商品列表图', name: 'listPicUrl', index: 'list_pic_url', width: 80, hidden: true},
- // {label: '零售价格', name: 'retailPrice', index: 'retail_price', width: 80},
- // {label: '商品库存', name: 'goodsNumber', index: 'goods_number', width: 80},
- // {label: '销售量', name: 'sellVolume', index: 'sell_volume', width: 80},
- // {label: '主product_id', name: 'primaryProductId', index: 'primary_product_id', width: 80, hidden: true},
- // {label: '单价', name: 'unitPrice', index: 'unit_price', width: 80},
- {label: '推广描述', name: 'promotionDesc', index: 'promotion_desc', width: 80, hidden: true},
- {label: '推广标签', name: 'promotionTag', index: 'promotion_tag', width: 80, hidden: true},
- // {
- // label: '限购', name: 'isLimited', index: 'is_limited', width: 80, formatter: function (value) {
- // return transIsNot(value);
- // }
- // },
- {
- label: '热销', name: 'isHot', index: 'is_hot', align: 'center',width: 100, formatter: function (value) {
- return transIsNot(value);
- }
- }],
- viewrecords: true,
- height: 550,
- rowNum: 10,
- rowList: [10, 30, 50],
- rownumbers: true,
- rownumWidth: 25,
- autowidth: true,
- shrinkToFit: false,
- autoScroll: true, //开启水平滚动条
- width: 1500,
- multiselect: true,
- pager: "#jqGridPager",
- jsonReader: {
- root: "page.list",
- page: "page.currPage",
- total: "page.totalPage",
- records: "page.totalCount"
- },
- prmNames: {
- page: "page",
- rows: "limit",
- order: "order"
- },
- gridComplete: function () {
- $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
- }
- });
- });
- var vm = new Vue({
- el: '#rrapp',
- data: {
- showList: true,
- title: null,
- q: {
- name: ''
- }
- },
- methods: {
- query: function () {
- vm.reload();
- },
- back: function (event) {
- var ids = getSelectedRows();
- if (ids == null) {
- return;
- }
- confirm('确定要恢复选中的记录?', function () {
- $.ajax({
- type: "POST",
- url: "../goods/back",
- contentType: "application/json",
- data: JSON.stringify(ids),
- success: function (r) {
- if (r.code == 0) {
- alert('操作成功', function (index) {
- $("#jqGrid").trigger("reloadGrid");
- });
- } else {
- alert(r.msg);
- }
- }
- });
- });
- },
- getInfo: function (id) {
- $.get("../goods/info/" + id, function (r) {
- vm.goods = r.goods;
- $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
- vm.getCategory();
- vm.getAttributes(vm.goods.attributeCategory);
- });
- },
- reload: function (event) {
- vm.showList = true;
- var page = $("#jqGrid").jqGrid('getGridParam', 'page');
- $("#jqGrid").jqGrid('setGridParam', {
- postData: {'name': vm.q.name},
- page: page
- }).trigger("reloadGrid");
- vm.handleReset('formValidate');
- }
- }
- });
|