From c2d59caac4e8a874adf1488e4b1a6f417d168ceb Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 16 四月 2025 14:24:02 +0800
Subject: [PATCH] bug修改
---
cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCoupon.js | 188 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 165 insertions(+), 23 deletions(-)
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCoupon.js b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCoupon.js
index fe7d648..05e9891 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCoupon.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCoupon.js
@@ -14,18 +14,39 @@
TCoupon.initColumn = function () {
return [
{field: 'selectItem', radio: true},
- {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
+ {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '优惠券名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
- {title: '适用范围', field: 'useScope', visible: true, align: 'center', valign: 'middle'},
- {title: '优惠券类型', field: 'type', visible: true, align: 'center', valign: 'middle'},
- {title: '发放方式', field: 'distributionMethod', visible: true, align: 'center', valign: 'middle'},
+ {title: '适用范围', field: 'useScope', visible: true, align: 'center', valign: 'middle',
+ formatter: function (value, row, index) {
+ return {1: "全国", 2: "指定城市", 3: "指定门店"}[value]
+ }
+ },
+ {title: '优惠券类型', field: 'type', visible: true, align: 'center', valign: 'middle',
+ formatter: function (value, row, index) {
+ return {1: "满减券", 2: "代金券", 3: "体验券"}[value]
+ }},
+ {title: '发放方式', field: 'distributionMethod', visible: true, align: 'center', valign: 'middle',
+ formatter: function (value, row, index) {
+ return {1: "积分购买", 2: "注册赠送", 3: "自动发券",4:"课包赠送"}[value]
+ }},
{title: '有效期', field: 'timeValue', visible: true, align: 'center', valign: 'middle'},
- {title: '用户人群', field: 'userPopulation', visible: true, align: 'center', valign: 'middle'},
+ {title: '用户人群', field: 'userPopulation', visible: true, align: 'center', valign: 'middle',
+ formatter: function (value, row, index) {
+ return {1: "全部用户", 2: "年度会员", 3: "已有学员用户"}[value]
+ }},
{title: '发放数量', field: 'quantityIssued', visible: true, align: 'center', valign: 'middle'},
{title: '限领数量', field: 'pickUpQuantity', visible: true, align: 'center', valign: 'middle'},
{title: '已领数量', field: 'hasPickQty', visible: true, align: 'center', valign: 'middle'},
- {title: 'status', field: 'useTimes', visible: true, align: 'center', valign: 'middle'},
- {title: 'state', field: 'couponType', visible: true, align: 'center', valign: 'middle'},
+ {title: '可售状态', field: 'state', visible: true, align: 'center', valign: 'middle',
+ formatter: function (value, row, index) {
+ return {1: "上架", 2: "下架"}[value]
+ }},
+
+ {title: '发布类型', field: 'publisherType', visible: true, align: 'center', valign: 'middle',
+ formatter: function (value, row, index) {
+ return {1: "运营商", 2: "平台",3: "门店"}[value]
+ }
+ },
];
};
@@ -50,10 +71,10 @@
var index = layer.open({
type: 2,
title: '添加',
- area: ['800px', '420px'], //宽高
+ area: ['100%', '100%'], //宽高
fix: false, //不固定
maxmin: true,
- content: Feng.ctxPath + '/tCouponManage/tCouponManage_add'
+ content: Feng.ctxPath + '/tCouponManage/coupon_add'
});
this.layerIndex = index;
};
@@ -63,15 +84,119 @@
* 点击编辑
*/
TCoupon.openChange = function () {
- var index = layer.open({
- type: 2,
- title: '添加',
- area: ['800px', '420px'], //宽高
- fix: false, //不固定
- maxmin: true,
- content: Feng.ctxPath + '/tCouponManage/tCouponManage_add'
- });
- this.layerIndex = index;
+ if (this.check()){
+ let size = TCoupon.seItem.size
+
+ if(size>0){
+ Feng.info("没有该权限");
+ return;
+ }
+ let publisherType = TCoupon.seItem.publisherType;
+ if ($("#objectType").val()==2){
+ if(publisherType != 1){
+ Feng.info("不能操作平台添加的优惠券");
+ return;
+ }
+ }
+ let id = TCoupon.seItem.id
+ let name = TCoupon.seItem.name
+ let quantityIssued = TCoupon.seItem.quantityIssued
+ let pickUpQuantity = TCoupon.seItem.pickUpQuantity
+ let illustrate = TCoupon.seItem.illustrate
+ let hasPickQty = TCoupon.seItem.hasPickQty
+ var index = layer.load(1,{
+ type: 1
+ , title: '编辑优惠券'
+ , area: ['50%', '50%']
+ , offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
+ , id: 'layerDemo' //防止重复弹出cge
+ , content: '<div class="form-horizontal">' +
+ ' <div class="col-sm-11" >' +
+ ' <div class="col-sm-11">' +
+ ' <div class="form-group">\n' +
+ ' <label class="col-sm-3 control-label">优惠券名称:</label>\n' +
+ ' <div class="col-sm-9">\n' +
+ ' <label class="form-control" id="name" >'+name+'</label> '+
+ ' </div>\n' +
+ ' </div>\n'+
+ ' <div class="form-group">\n' +
+ ' <label class="col-sm-3 control-label">发放数量:</label>\n' +
+ ' <div class="col-sm-9">\n' +
+ ' <input class="form-control" id="num" value="'+quantityIssued+'" > '+
+ ' </div>\n' +
+ ' </div>\n' +
+ ' <div class="form-group">\n' +
+ ' <label class="col-sm-3 control-label">限领数量:</label>\n' +
+ ' <div class="col-sm-9">\n' +
+ ' <input class="form-control" id="num1" value="'+pickUpQuantity+'" > '+
+ ' </div>\n' +
+ ' </div>\n' +
+ ' <div class="form-group">\n' +
+ ' <label class="col-sm-3 control-label">优惠券说明:</label>\n' +
+ ' <div class="col-sm-9">\n' +
+ ' <textarea class="form-control" id="text" >'+illustrate+'</textarea> '+
+ ' </div>\n' +
+ ' </div>\n' +
+ ' </div>' +
+ ' </div>' +
+ '</div>'
+ , btn: ['关闭', '保存']
+ , btnAlign: 'c' //按钮居中
+ , shade: 0.5 //不显示遮罩
+ ,load:1
+ , yes: function () {
+ layer.closeAll();
+ },
+ btn2:function () {
+ let num = $("#num").val()
+ if(num==''){
+ Feng.info("请输入发放数量")
+ return false;
+ }
+ let num1 = $("#num1").val()
+ if(num1==''){
+ Feng.info("请输入限领数量")
+ return false;
+ }
+ let text = $("#text").val()
+ if(text==''){
+ Feng.info("请输入优惠券说明")
+ return false;
+ }
+
+ if(num<hasPickQty){
+ Feng.info("发放数量不能小于已领取数量")
+ return false;
+ }
+ var ajax = new $ax(Feng.ctxPath + "/tCouponManage/update", function (data) {
+ if (data.code == 200) {
+ Feng.success("操作成功!");
+ window.location.reload();
+ window.parent.layer.closeAll();
+ } else if(data=="repeat"){
+ window.location.reload();
+ window.parent.layer.closeAll();
+ Feng.error("请勿重复操作");
+ }else {
+ return Feng.error(data.msg);
+ }
+ }, function (data) {
+ Feng.error("操作失败!")
+ window.location.reload();
+ window.parent.layer.closeAll();
+ return Feng.error("操作失败!");
+ });
+ ajax.set("id", id);
+ ajax.set("num", num);
+ ajax.set("num1", num1);
+ ajax.set("text", text);
+ ajax.start();
+ layer.closeAll();
+ }
+ });
+
+ this.layerIndex = index;
+ }
};
@@ -79,10 +204,6 @@
/**
* 上架
*/
-TCoupon.onShelf = function () {
-
-
-};
/**
@@ -102,7 +223,7 @@
var index = layer.open({
type: 2,
title: '详情',
- area: ['800px', '420px'], //宽高
+ area: ['100%', '100%'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/tCouponManage/coupon_detail/' + TCoupon.seItem.id
@@ -128,6 +249,26 @@
content: Feng.ctxPath + '/tCouponManage/coupon_record/' + TCoupon.seItem.id
});
this.layerIndex = index;
+ }
+};
+TCoupon.onShelf = function (e) {
+ if (this.check()) {
+ let size = TCoupon.seItem.size
+ if(size>0){
+ Feng.info("没有该权限");
+ return;
+ }
+ var ajax = new $ax(Feng.ctxPath + "/tCouponManage/onShelf", function(data){
+ if(data.code==200){
+ Feng.success("操作成功!")
+ TCoupon.table.refresh();
+ }
+ },function(data){
+ Feng.error("操作失败!" + data.responseJSON.message + "!");
+ });
+ ajax.set("id",TCoupon.seItem.id)
+ ajax.set("type",e)
+ ajax.start();
}
};
@@ -166,4 +307,5 @@
var table = new BSTable(TCoupon.id, "/tCouponManage/list", defaultColunms);
table.setPaginationType("client");
TCoupon.table = table.init();
+
});
--
Gitblit v1.7.1