From 05f49b22afa61ed9841619a844a3340dcb190b30 Mon Sep 17 00:00:00 2001
From: lisy <linlangsur163@163.com>
Date: 星期四, 27 七月 2023 10:28:35 +0800
Subject: [PATCH] 管理后台的优惠券管理的列表

---
 cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCoupon.js |  169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 169 insertions(+), 0 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 e69de29..fe7d648 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
@@ -0,0 +1,169 @@
+/**
+ * 管理初始化
+ */
+var TCoupon = {
+    id: "TCouponTable",	//表格id
+    seItem: null,		//选中的条目
+    table: null,
+    layerIndex: -1
+};
+
+/**
+ * 初始化表格的列
+ */
+TCoupon.initColumn = function () {
+    return [
+        {field: 'selectItem', radio: true},
+        {title: 'id', field: 'id', visible: false, 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: 'timeValue', visible: true, align: 'center', valign: 'middle'},
+        {title: '用户人群', field: 'userPopulation', visible: true, align: 'center', valign: 'middle'},
+        {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'},
+    ];
+};
+
+/**
+ * 检查是否选中
+ */
+TCoupon.check = function () {
+    var selected = $('#' + this.id).bootstrapTable('getSelections');
+    if(selected.length == 0){
+        Feng.info("请先选中表格中的某一记录!");
+        return false;
+    }else{
+        TCoupon.seItem = selected[0];
+        return true;
+    }
+};
+
+/**
+ * 点击添加
+ */
+TCoupon.openAdd = function () {
+    var index = layer.open({
+        type: 2,
+        title: '添加',
+        area: ['800px', '420px'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/tCouponManage/tCouponManage_add'
+    });
+    this.layerIndex = index;
+};
+
+
+/**
+ * 点击编辑
+ */
+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;
+};
+
+
+
+/**
+ * 上架
+ */
+TCoupon.onShelf = function () {
+
+
+};
+
+
+/**
+ * 下架
+ */
+TCoupon.offShelf = function () {
+
+
+};
+
+
+/**
+ * 打开查看详情
+ */
+TCoupon.openDetail = function () {
+    if (this.check()) {
+        var index = layer.open({
+            type: 2,
+            title: '详情',
+            area: ['800px', '420px'], //宽高
+            fix: false, //不固定
+            maxmin: true,
+            content: Feng.ctxPath + '/tCouponManage/coupon_detail/' + TCoupon.seItem.id
+        });
+        this.layerIndex = index;
+    }
+};
+
+
+
+
+/**
+ * 打开领取记录
+ */
+TCoupon.openCollectionRecord = function () {
+    if (this.check()) {
+        var index = layer.open({
+            type: 2,
+            title: '详情',
+            area: ['800px', '420px'], //宽高
+            fix: false, //不固定
+            maxmin: true,
+            content: Feng.ctxPath + '/tCouponManage/coupon_record/' + TCoupon.seItem.id
+        });
+        this.layerIndex = index;
+    }
+};
+
+
+
+/**
+ * 查询列表
+ */
+TCoupon.search = function () {
+    var queryData = {};
+    queryData['name'] = $("#name").val();
+    queryData['type'] = $("#type").val();
+    queryData['distributionMethod'] = $("#distributionMethod").val();
+    queryData['userPopulation'] = $("#userPopulation").val();
+    queryData['status'] = $("#status").val();
+    queryData['state'] = $("#state").val();
+    TCoupon.table.refresh({query: queryData});
+};
+
+
+/**
+ * 重置搜索
+ */
+TCoupon.resetSearch = function () {
+    $("#name").val('');
+    $("#type").val('');
+    $("#distributionMethod").val('');
+    $("#userPopulation").val('');
+    $("#status").val('');
+    $("#state").val('');
+    TCoupon.search();
+};
+
+$(function () {
+    var defaultColunms = TCoupon.initColumn();
+    var table = new BSTable(TCoupon.id, "/tCouponManage/list", defaultColunms);
+    table.setPaginationType("client");
+    TCoupon.table = table.init();
+});

--
Gitblit v1.7.1