$(function () { let flag = getQueryString("flag"); if(flag != null && flag == "false"){ vm.isMkactivitiesShow = false; } let mkCode = getQueryString("mkCode"); if(mkCode){ vm.mkCode = mkCode; } let storeId = getQueryString("storeId"); if(storeId){ vm.storeId = storeId; } let mkaId = getQueryString("mkaId"); if(mkaId){ vm.mkaId = mkaId; } $("#jqGrid").jqGrid({ url: '../mkactivitiespresentintegral/list', datatype: "json", colModel: [ {label: 'mapId', name: 'mapId', index: 'map_id', key: true, hidden: true}, {label: '产品中文名', name: 'productName', index: 'product_name', width: 80}, {label: '赠送方式- 1 :固定值 2:倍率', name: 'activityGiveType', index: 'activity_give_type', width: 80}, {label: '赠送数值', name: 'activityGiveNum', index: 'activity_give_num', width: 80}, {label: '门店编号', name: 'shopSn', index: 'shop_sn', width: 80}, {label: '商品sku', name: 'sku', index: 'sku', width: 80}, {label: '条形码', name: 'barcode', index: 'barcode', width: 80}, {label: '商品品牌', name: 'productBrand', index: 'product_brand', width: 80}, {label: '商品系列', name: 'productSeries', index: 'product_series', width: 80}, {label: '营销活动编号', name: 'mkaId', index: 'mka_id', width: 80}, {label: '是否与积分抵扣互斥,0:不互斥 1:互斥', name: 'rejectScore', index: 'reject_score', width: 80}, {label: '截止日期', name: 'deadline', index: 'deadline', width: 80}, {label: '创建时间', name: 'createTime', index: 'create_time', width: 80}, {label: '创建人编号', name: 'createrSn', index: 'creater_sn', width: 80}, {label: '修改人编号', name: 'moderSn', index: 'moder_sn', width: 80}, {label: '修改时间', name: 'updateTime', index: 'update_time', width: 80}], viewrecords: true, height: 550, rowNum: 10, rowList: [10, 30, 50], rownumbers: true, rownumWidth: 25, autowidth: true, 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": "hidden"}); } }); }); let vm = new Vue({ el: '#rrapp', data: { showList: true, title: null, mkActivitiesPresentIntegral: {}, ruleValidate: { name: [ {required: true, message: '名称不能为空', trigger: 'blur'} ] }, q: { name: '' }, isMkactivitiesShow: true, mkCode: '', uploadData:[], storeId : '', mkaId : '', activityGiveTypes:{} }, methods: { query: function () { vm.reload(); }, add: function () { vm.showList = false; vm.title = "新增"; vm.mkActivitiesPresentIntegral = {}; }, update: function (event) { let mapId = getSelectedRow(); if (mapId == null) { return; } vm.showList = false; vm.title = "修改"; vm.getInfo(mapId) }, saveOrUpdate: function (event) { let url = vm.mkActivitiesPresentIntegral.mapId == null ? "../mkactivitiespresentintegral/save" : "../mkactivitiespresentintegral/update"; $.ajax({ type: "POST", url: url, contentType: "application/json", data: JSON.stringify(vm.mkActivitiesPresentIntegral), success: function (r) { if (r.code === 0) { alert('操作成功', function (index) { vm.reload(); }); } else { alert(r.msg); } } }); }, del: function (event) { let mapIds = getSelectedRows(); if (mapIds == null){ return; } confirm('确定要删除选中的记录?', function () { $.ajax({ type: "POST", url: "../mkactivitiespresentintegral/delete", contentType: "application/json", data: JSON.stringify(mapIds), success: function (r) { if (r.code == 0) { alert('操作成功', function (index) { $("#jqGrid").trigger("reloadGrid"); }); } else { alert(r.msg); } } }); }); }, getInfo: function(mapId){ $.get("../mkactivitiespresentintegral/info/"+mapId, function (r) { vm.mkActivitiesPresentIntegral = r.mkActivitiesPresentIntegral; }); }, reloadSearch: function() { vm.q = { name: '' } vm.reload(); }, reload: function (event) { vm.showList = true; let page = $("#jqGrid").jqGrid('getGridParam', 'page'); $("#jqGrid").jqGrid('setGridParam', { postData: {'name': vm.q.name}, page: page }).trigger("reloadGrid"); vm.handleReset('formValidate'); }, handleSubmit: function (name) { handleSubmitValidate(this, name, function () { vm.saveOrUpdate() }); }, handleReset: function (name) { handleResetForm(this, name); }, //返回营销方式页 reloadMkactivities: function () { window.location.href = "/mk/mkactivityform.html?mkCode="+vm.mkCode; }, }, mounted() { $.get("../sys/macro/queryMacrosByValue?value=activityGiveType", function (r) { vm.activityGiveTypes = r.list; }); } });