| | |
| | | /** |
| | | * 惠民卡管理初始化 |
| | | * 玩湃惠民卡管理初始化 |
| | | */ |
| | | var TPayHuimin = { |
| | | id: "TPayHuiminTable", //表格id |
| | |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '主键id', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '惠民卡名称', field: 'huiMinName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '惠民卡类型', field: 'huiMinType', visible: true, align: 'center', valign: 'middle', |
| | | {title: '玩湃惠民卡名称', field: 'huiMinName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '玩湃惠民卡类型', field: 'huiMinType', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function(value,row,index){ |
| | | return {1: '年度卡', 2: '年内卡'}[value]; |
| | | }}, |
| | | {title: '售卖金额', field: 'salesMoney', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所属运营商', field: 'operatorName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '可用门店', field: 'storeName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '可用门店', field: 'storeName', visible: true, align: 'center', valign: 'middle', |
| | | cellStyle:formatTableUnit, |
| | | formatter :paramsMatter |
| | | }, |
| | | {title: '购买用户', field: 'userName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '购买时间', field: 'paymentTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '绑定人员', field: 'studentName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '已用次数', field: 'useTimes', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效期', field: 'endTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '有效期', field: 'endTime', visible: true, align: 'center', valign: 'middle',formatter:function(value,row,index){ |
| | | if (!value){ |
| | | return "永久"; |
| | | }else { |
| | | return value; |
| | | } |
| | | }}, |
| | | {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function(value,row,index){ |
| | | return {1: '使用中', 2: '已退款'}[value]; |
| | | return {2: '使用中', 3: '已退款'}[value]; |
| | | }} |
| | | ]; |
| | | }; |
| | | |
| | | //表格超出宽度鼠标悬停显示td内容 |
| | | function paramsMatter(value,row,index) { |
| | | var span=document.createElement("span"); |
| | | span.setAttribute("title",value); |
| | | span.innerHTML = value; |
| | | return span.outerHTML; |
| | | } |
| | | //td宽度以及内容超过宽度隐藏 |
| | | function formatTableUnit(value, row, index) { |
| | | return { |
| | | css: { |
| | | "white-space": "nowrap", |
| | | "text-overflow": "ellipsis", |
| | | "overflow": "hidden", |
| | | "max-width":"150px" |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加惠民卡 |
| | | * 点击添加玩湃惠民卡 |
| | | */ |
| | | TPayHuimin.openAddTPayHuimin = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加惠民卡', |
| | | title: '添加玩湃惠民卡', |
| | | area: ['800px', '420px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看惠民卡详情 |
| | | * 打开查看玩湃惠民卡详情 |
| | | */ |
| | | TPayHuimin.openTPayHuiminDetail = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '惠民卡详情', |
| | | title: '玩湃惠民卡详情', |
| | | area: ['800px', '420px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | |
| | | }; |
| | | |
| | | /** |
| | | * 删除惠民卡 |
| | | * 删除玩湃惠民卡 |
| | | */ |
| | | TPayHuimin.delete = function () { |
| | | if (this.check()) { |
| | |
| | | } |
| | | TPayHuimin.refund = function (){ |
| | | if (this.check()) { |
| | | if (TPayHuimin.seItem.refundStatus != 1){ |
| | | if (TPayHuimin.seItem.status == 3){ |
| | | Feng.error("该商品已退款"); |
| | | return; |
| | | } |
| | | let operation = function(){ |
| | | let ajax = new $ax(Feng.ctxPath + "/tPayHuimin/refund", function () { |
| | | Feng.success("退款成功!"); |
| | | TPayHuimin.table.refresh(); |
| | | $('#TPayHuiminTable').bootstrapTable('destroy'); |
| | | TPayHuimin.initTable(); |
| | | }, function (data) { |
| | | Feng.error("退款失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("id", TPayHuimin.seItem.id); |
| | | ajax.start(); |
| | | }; |
| | | Feng.confirm("确认退款所选惠民卡吗?",operation); |
| | | Feng.confirm("确认退款所选玩湃惠民卡吗?",operation); |
| | | } |
| | | } |
| | | TPayHuimin.export = function (){ |
| | |
| | | queryData['phone'] = $("#phone").val(); |
| | | let paymentTimeStr = $("#paymentTimeStr").val(); |
| | | if (paymentTimeStr){ |
| | | queryData['paymentTimeStart'] = paymentTimeStr.split('~')[0]+' 00:00:00'; |
| | | queryData['paymentTimeStart'] = paymentTimeStr.split('~')[0]+'00:00:00'; |
| | | queryData['paymentTimeEnd'] = paymentTimeStr.split('~')[1]+' 23:59:59'; |
| | | } |
| | | let endTimeStr = $("#endTimeStr").val(); |
| | | if (endTimeStr){ |
| | | queryData['endTimeStart'] = endTimeStr.split('~')[0]+' 00:00:00'; |
| | | queryData['endTimeStart'] = endTimeStr.split('~')[0]+'00:00:00'; |
| | | queryData['endTimeEnd'] = endTimeStr.split('~')[1]+' 23:59:59'; |
| | | } |
| | | queryData['status'] = $("#status").val(); |
| | |
| | | return queryData; |
| | | } |
| | | /** |
| | | * 查询惠民卡列表 |
| | | * 查询玩湃惠民卡列表 |
| | | */ |
| | | TPayHuimin.search = function () { |
| | | var queryData = TPayHuimin.getQueryParam(); |
| | |
| | | TPayHuimin.getStaticsData(); |
| | | }; |
| | | TPayHuimin.resetSearch = function () { |
| | | var queryData = {}; |
| | | $("#huiMinName").val(''); |
| | | $("#huiMinType option:first").prop("selected", true); |
| | | $("#operatorId option:first").prop("selected", true); |
| | | $("#useId option:first").prop("selected", true); |
| | | $("#status option:first").prop("selected", true); |
| | | $("#userName").val(''); |
| | | $("#phone").val(''); |
| | | $("#paymentTimeStr").val(''); |
| | | $("#endTimeStr").val(''); |
| | | $("#status option:first").prop("selected", true); |
| | | TPayHuimin.search(); |
| | | $('#TPayHuiminTable').bootstrapTable('destroy'); |
| | | TPayHuimin.initTable(); |
| | | TPayHuimin.getStaticsData(); |
| | | }; |
| | | $(function () { |
| | | TPayHuimin.initTable = function () { |
| | | var defaultColunms = TPayHuimin.initColumn(); |
| | | var table = new BSTable(TPayHuimin.id, "/tPayHuimin/list", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | TPayHuimin.table = table.init(); |
| | | TPayHuimin.getStaticsData(); |
| | | }; |
| | | $(function () { |
| | | TPayHuimin.initTable(); |
| | | }); |