44323
2023-11-17 e863d3485d077c90988c81a756b37ef21cf4962e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/**
 * 车辆管理管理初始化
 */
var TPointProducts = {
    id: "TPointProductsTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
var language =1
/**
 * 初始化表格的列
 */
TPointProducts.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {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',
            formatter: function (value, row, index) {
                return {1: "全国", 2: "指定城市", 3: "指定门店"}[value]
            }
        },
        {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: '已兑换数量', field: 'hasExchangeQty', visible: true, align: 'center', valign: 'middle'
        },
        {title: '排序', field: 'sort', visible: true, align: 'center', valign: 'middle'
        },
        {title: '审核状态', field: 'status', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row, index) {
                return { 2: "待审核", 3: "已拒绝"}[value]
            }
        },
 
    ];
};
function currentTime(timestamp){
    var time = timestamp + '';
    if(time.length != 13){
        timestamp = timestamp * 1000;
    }
    var date = new Date(timestamp);;
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
 
    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
    var strDate = Y + M + D + h + m + s;
    return strDate
}
 
function currentTime1(timestamp){
    var time = timestamp + '';
    if(time.length != 13){
        timestamp = timestamp * 1000;
    }
    var date = new Date(timestamp);;
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
 
    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
    var strDate = Y + M + D ;
    return strDate
}
/**
 * 检查是否选中
 */
TPointProducts.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
            Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        TPointProducts.seItem = selected[0];
        return true;
    }
};
 
/**
 * 添加
 */
TPointProducts.openAddTPointProducts = function () {
    var index = layer.open({
        type: 2,
        title: '添加',
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tGoods/tGoods_add'
    });
    this.layerIndex = index;
};
 
/**
 * 查看详情
 */
TPointProducts.detail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title:'详情',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tGoods/goods_info/' + TPointProducts.seItem.id
        });
        this.layerIndex = index;
    }
};
 
/**
 * 购买详情
 */
TPointProducts.payDetail = function () {
    if (this.check()) {
            layer.open({
                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" style="margin-top: 30px">' +
                    '                    <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' +
                    '                                <input type="radio" name="type1" value="1" checked>通过 <input type="radio" name="type1" value="3">拒绝\n' +
                    '                            </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 id="remark" style="height: 193px; width: 368px;"></textarea>\n' +
                    '                            </div>\n' +
                    '                        </div>\n' +
                    '                       </div>' +
                    '                   </div>' +
                    '</div>'
                , btn: ['保存', '取消']
                , btnAlign: 'c' //按钮居中
                , shade: 0.5 //不显示遮罩
                , yes: function () {
                    var state = TPointProducts.seItem.status;
                    if (state=="3"){
                        Feng.error("当前门票不能再次审核!")
                        return;
                    }
                    var OBJradio= $("input[name='type1']:checked").val();
                    console.log(OBJradio)
                   let remark =  $("#remark").val()
                    console.log(remark)
                    if(OBJradio==3){
                        if(remark==''){
                            Feng.info("请输入拒绝理由")
                            return;
                        }
                    }
 
                    var ajax = new $ax(Feng.ctxPath + "/tGoods/updateTypeOne", function (data) {
                        if (data.code == 200) {
                            Feng.success("操作成功!");
                            TPointProducts.table.refresh();
                            window.parent.layer.closeAll();
                        } else {
                            return  Feng.error(data.msg);
                        }
                    }, function (data) {
                        return   Feng.error("操作失败!");
                    });
                    ajax.set("id",TPointProducts.seItem.id)
                    ajax.set("type",OBJradio)
                    ajax.set("remark",remark)
                    ajax.start();
                    layer.closeAll();
                },
            });
 
        }
};
 
/**
 * 编辑页面
 */
TPointProducts.openEditPage = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title:'编辑',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tGoods/tGoods_update/' + TPointProducts.seItem.id
        });
        this.layerIndex = index;
    }
}
 
/**
 * 上下架处理
 * @param m
 */
TPointProducts.grounding = function (m) {
    console.log('m:',m);
    if (this.check()) {
        var ajax = new $ax(Feng.ctxPath + "/tGoods/grounding", function (data) {
            Feng.success("操作成功!");
            TPointProducts.table.refresh();
        }, function (data) {
            Feng.error("操作失败!" + data.responseJSON.message + "!");
        });
        ajax.set("id",this.seItem.id);
        ajax.set("type",m);
        ajax.start();
    }
};
 
 
 
/**
 * 查询车辆管理列表
 */
TPointProducts.search = function () {
    var queryData = {};
    queryData['name'] = $("#name").val();
    queryData['type'] = $("#type").val();
    queryData['redemptionMethod'] = $("#redemptionMethod").val();
    queryData['userPopulation'] = $("#userPopulation").val();
    queryData['activeStatus'] = $("#activeStatus").val();
    queryData['state'] = $("#state").val();
    TPointProducts.table.refresh({query: queryData});
};
 
TPointProducts.resetSearch = function () {
    $("#name").val("");
    $("#type").val("");
    $("#redemptionMethod").val("");
    $("#userPopulation").val("");
    $("#activeStatus").val("");
    $("#state").val("");
    TPointProducts.search();
};
 
$(function () {
    var defaultColunms = TPointProducts.initColumn();
    var table = new BSTable(TPointProducts.id, "/tGoods/listAudit", defaultColunms);
    table.setPaginationType("client");
    TPointProducts.table = table.init();
});