|
@@ -0,0 +1,214 @@
|
|
|
|
+$(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");
|
|
|
|
+ console.log(storeId);
|
|
|
|
+ if(storeId){
|
|
|
|
+ vm.storeId = storeId;
|
|
|
|
+ }
|
|
|
|
+ let mkaId = getQueryString("mkaId");
|
|
|
|
+ if(mkaId){
|
|
|
|
+ vm.mkaId = mkaId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $("#jqGrid").jqGrid({
|
|
|
|
+ url: '../mkactivitiesscore/list',
|
|
|
|
+ datatype: "json",
|
|
|
|
+ colModel: [
|
|
|
|
+ {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
|
|
|
|
+ {label: '商品条码', name: 'prodBarcode', index: 'prod_barcode', width: 80},
|
|
|
|
+ {label: 'sku', name: 'sku', index: 'sku', width: 80},
|
|
|
|
+ {label: '门店id', name: 'storeId', index: 'store_id', width: 80},
|
|
|
|
+ {label: '抵扣比例', name: 'scoreLimit', index: 'score_limit', width: 80},
|
|
|
|
+ {label: '营销活动编号', name: 'mkaId', index: 'mka_id', 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,
|
|
|
|
+ postData: {'mkaId': vm.mkaId},
|
|
|
|
+ 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,
|
|
|
|
+ mkActivitiesScore: {},
|
|
|
|
+ ruleValidate: {
|
|
|
|
+ name: [
|
|
|
|
+ {required: true, message: '名称不能为空', trigger: 'blur'}
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ q: {
|
|
|
|
+ name: ''
|
|
|
|
+ },
|
|
|
|
+ isMkactivitiesShow: true,
|
|
|
|
+ mkCode: '',
|
|
|
|
+ uploadData:[],
|
|
|
|
+ storeId : '',
|
|
|
|
+ mkaId : ''
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ query: function () {
|
|
|
|
+ vm.reload();
|
|
|
|
+ },
|
|
|
|
+ add: function () {
|
|
|
|
+ vm.showList = false;
|
|
|
|
+ vm.title = "新增";
|
|
|
|
+ vm.mkActivitiesScore = {};
|
|
|
|
+ },
|
|
|
|
+ update: function (event) {
|
|
|
|
+ let id = getSelectedRow();
|
|
|
|
+ if (id == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ vm.showList = false;
|
|
|
|
+ vm.title = "修改";
|
|
|
|
+
|
|
|
|
+ vm.getInfo(id)
|
|
|
|
+ },
|
|
|
|
+ saveOrUpdate: function (event) {
|
|
|
|
+ let url = vm.mkActivitiesScore.id == null ? "../mkactivitiesscore/save" : "../mkactivitiesscore/update";
|
|
|
|
+
|
|
|
|
+ //添加上层的门店编号与营销方式编号
|
|
|
|
+ vm.mkActivitiesHalfPrice.shopSn = vm.storeId;
|
|
|
|
+ vm.mkActivitiesHalfPrice.mkaId = vm.mkaId;
|
|
|
|
+
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: "POST",
|
|
|
|
+ url: url,
|
|
|
|
+ contentType: "application/json",
|
|
|
|
+ data: JSON.stringify(vm.mkActivitiesScore),
|
|
|
|
+ success: function (r) {
|
|
|
|
+ if (r.code === 0) {
|
|
|
|
+ alert('操作成功', function (index) {
|
|
|
|
+ vm.reload();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ alert(r.msg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ del: function (event) {
|
|
|
|
+ let ids = getSelectedRows();
|
|
|
|
+ if (ids == null){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ confirm('确定要删除选中的记录?', function () {
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: "POST",
|
|
|
|
+ url: "../mkactivitiesscore/delete",
|
|
|
|
+ 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("../mkactivitiesscore/info/"+id, function (r) {
|
|
|
|
+ vm.mkActivitiesScore = r.mkActivitiesScore;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ 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;
|
|
|
|
+ },
|
|
|
|
+ uploadExcelSuccess: function (data) {
|
|
|
|
+ // console.log(data);
|
|
|
|
+ if(data.code==0){
|
|
|
|
+ alert('导入成功', function (index) {
|
|
|
|
+ $("#jqGrid").trigger("reloadGrid");
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ alert(data.msg);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ uploadExcelError: function () {
|
|
|
|
+ alert('上传出现异常,请重试!');
|
|
|
|
+ },
|
|
|
|
+ uploadExcelFormatError: function (file) {
|
|
|
|
+ this.$Notice.warning({
|
|
|
|
+ title: '文件格式不正确',
|
|
|
|
+ desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
|
|
|
|
+ });
|
|
|
|
+ },beforeUpload(){
|
|
|
|
+ vm.uploadData = {
|
|
|
|
+ storeId: vm.storeId,
|
|
|
|
+ mkaId : vm.mkaId
|
|
|
|
+ }
|
|
|
|
+ let promise = new Promise((resolve) => {
|
|
|
|
+ this.$nextTick(function () {
|
|
|
|
+ resolve(true);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ return promise; //通过返回一个promis对象解决
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+});
|