goodshistory.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. $(function () {
  2. $("#jqGrid").jqGrid({
  3. url: '../goods/historyList',
  4. datatype: "json",
  5. colModel: [
  6. {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
  7. {label: '商品类型', name: 'categoryName', index: 'category_id', width: 180},
  8. {label: '商品序列号', name: 'goodsSn', index: 'goods_sn', width: 180, hidden: true},
  9. {label: '名称', name: 'name', index: 'name', width: 400},
  10. // {label: '品牌', name: 'brandName', index: 'brand_id', width: 120},
  11. // {label: '关键字', name: 'keywords', index: 'keywords', width: 80, hidden: true},
  12. // {label: '简明介绍', name: 'goodsBrief', index: 'goods_brief', width: 80, hidden: true},
  13. {label: '商品描述', name: 'goodsDesc', index: 'goods_desc', width: 180, hidden: true},
  14. {
  15. label: '上架', name: 'isOnSale', index: 'is_on_sale', width: 100,align: 'center',
  16. formatter: function (value) {
  17. return transIsNot(value);
  18. }
  19. },
  20. {
  21. label: '添加时间', name: 'addTime', index: 'add_time', align: 'center',width: 160, formatter: function (value) {
  22. return transDate(value);
  23. }
  24. },
  25. {label: '删除状态', name: 'isDelete', index: 'is_delete', width: 80, hidden: true},
  26. // {label: '属性类别', name: 'attributeCategoryName', index: 'attribute_category', width: 80},
  27. {label: '是否新商品', name: 'isNew', index: 'is_new', width: 80, hidden: true},
  28. {label: '商品单位', name: 'goodsUnit', index: 'goods_unit', align: 'center',width: 100},
  29. {label: '商品主图', name: 'primaryPicUrl', index: 'primary_pic_url', width: 80, hidden: true},
  30. {label: '商品列表图', name: 'listPicUrl', index: 'list_pic_url', width: 80, hidden: true},
  31. // {label: '零售价格', name: 'retailPrice', index: 'retail_price', width: 80},
  32. // {label: '商品库存', name: 'goodsNumber', index: 'goods_number', width: 80},
  33. // {label: '销售量', name: 'sellVolume', index: 'sell_volume', width: 80},
  34. // {label: '主product_id', name: 'primaryProductId', index: 'primary_product_id', width: 80, hidden: true},
  35. // {label: '单价', name: 'unitPrice', index: 'unit_price', width: 80},
  36. {label: '推广描述', name: 'promotionDesc', index: 'promotion_desc', width: 80, hidden: true},
  37. {label: '推广标签', name: 'promotionTag', index: 'promotion_tag', width: 80, hidden: true},
  38. // {
  39. // label: '限购', name: 'isLimited', index: 'is_limited', width: 80, formatter: function (value) {
  40. // return transIsNot(value);
  41. // }
  42. // },
  43. {
  44. label: '热销', name: 'isHot', index: 'is_hot', align: 'center',width: 100, formatter: function (value) {
  45. return transIsNot(value);
  46. }
  47. }],
  48. viewrecords: true,
  49. height: 550,
  50. rowNum: 10,
  51. rowList: [10, 30, 50],
  52. rownumbers: true,
  53. rownumWidth: 25,
  54. autowidth: true,
  55. shrinkToFit: false,
  56. autoScroll: true, //开启水平滚动条
  57. width: 1500,
  58. multiselect: true,
  59. pager: "#jqGridPager",
  60. jsonReader: {
  61. root: "page.list",
  62. page: "page.currPage",
  63. total: "page.totalPage",
  64. records: "page.totalCount"
  65. },
  66. prmNames: {
  67. page: "page",
  68. rows: "limit",
  69. order: "order"
  70. },
  71. gridComplete: function () {
  72. $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
  73. }
  74. });
  75. });
  76. var vm = new Vue({
  77. el: '#rrapp',
  78. data: {
  79. showList: true,
  80. title: null,
  81. q: {
  82. name: ''
  83. }
  84. },
  85. methods: {
  86. query: function () {
  87. vm.reload();
  88. },
  89. back: function (event) {
  90. var ids = getSelectedRows();
  91. if (ids == null) {
  92. return;
  93. }
  94. confirm('确定要恢复选中的记录?', function () {
  95. $.ajax({
  96. type: "POST",
  97. url: "../goods/back",
  98. contentType: "application/json",
  99. data: JSON.stringify(ids),
  100. success: function (r) {
  101. if (r.code == 0) {
  102. alert('操作成功', function (index) {
  103. $("#jqGrid").trigger("reloadGrid");
  104. });
  105. } else {
  106. alert(r.msg);
  107. }
  108. }
  109. });
  110. });
  111. },
  112. getInfo: function (id) {
  113. $.get("../goods/info/" + id, function (r) {
  114. vm.goods = r.goods;
  115. $('#goodsDesc').editable('setHTML', vm.goods.goodsDesc);
  116. vm.getCategory();
  117. vm.getAttributes(vm.goods.attributeCategory);
  118. });
  119. },
  120. reload: function (event) {
  121. vm.showList = true;
  122. var page = $("#jqGrid").jqGrid('getGridParam', 'page');
  123. $("#jqGrid").jqGrid('setGridParam', {
  124. postData: {'name': vm.q.name},
  125. page: page
  126. }).trigger("reloadGrid");
  127. vm.handleReset('formValidate');
  128. }
  129. }
  130. });