puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
@layout("/common/_container.html"){
<style>
    .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        height: 100px;
        width: 100px;
        overflow: hidden;
    }
 
    .avatar-uploader .el-upload:hover {
        border-color: #409eff;
    }
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 100px;
        height: 100px;
        line-height: 100px;
        margin-top: 34px;
        text-align: center;
    }
    .avatar {
        width: 100px;
        height: 100px;
        display: block;
    }
 
    .col-sm-12 {
        margin-top: 20px;
    }
 
    .col-sm-12 select {
        height: 33px;
    }
</style>
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <input hidden id="userType" value="${userType}">
        <div class="form-horizontal" id="carInfoForm">
            <#input id="name" name="门票名称" type="text"/>
            <div class="form-group">
                <label class="col-sm-3 control-label">商品类型:</label>
                <div class="col-sm-9">
                    <input type="radio" name="type" value="1" checked onclick="updateType(1)"> 日卡
                    <input type="radio" name="type" value="2" > 月卡
                    <input type="radio" name="type" value="3" > 季卡
                    <input type="radio" name="type" value="4" > 年卡
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">原价:</label>
                <div class="col-sm-9">
                    <input class="form-control" id="price" name="price" type="number">
 
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">兑换方式:</label>
                <div class="col-sm-9">
                    <input type="radio" name="redemptionMethod" value="1"  onclick="updateMethod(3)" checked> 积分
                    <input type="radio" name="redemptionMethod" value="2" onclick="updateMethod(4)"> 现金+积分
                    <input type="radio" name="redemptionMethod" value="3" onclick="updateMethod(5)"> 现金
                </div>
            </div>
            <div class="form-group" id="y1" hidden>
                <label class="col-sm-3 control-label">所需现金:</label>
                <div class="col-sm-9">
                    <input class="form-control" id="cash" name="cash" oninput="validateNumber(this)" type="text">
 
                </div>
            </div>
            <div class="form-group" id="y2">
                <label class="col-sm-3 control-label">所需积分:</label>
                <div class="col-sm-9">
                    <input class="form-control" id="integral" name="integral"  type="number">
 
                </div>
            </div>
            <#avatar id="cover" name="*门票封面(推荐像素350x350px)" />
 
            <div class="row" id="app" >
                <div class="col-sm-6" style="width: 100%;margin-left: 7%">
                    <div class="form-group">
                        <label class="col-sm-3 control-label" style="width: 15%;margin-left: 7%">*门票图片(请上传不超过五张图片,推荐像素780x440px): </label>
                        <div class="col-sm-2" style="width: 100%;margin-left: 12%;margin-top: 1%">
                            <el-upload
                                    :limit="5"
                                    class="avatar-uploader"
                                    action="/tCouponManage/uploadPic"
                                    list-type="picture-card"
                                    accept=".jpg,.jpeg,.png,.JPG,.JPEG"
                                    :on-success="handleAvatarSuccess"
                                    :on-remove="handleRemove">
                                <i class="el-icon-plus"></i>
                            </el-upload>
                            <el-dialog :visible.sync="dialogVisible">
                                <img width="100%" :src="imageUrl1" alt=""></el-dialog>
                        </div>
                    </div>
 
                </div>
            </div>
 
 
 
            <div class="form-group">
                <label class="col-sm-3 control-label">用户人群:</label>
                <div class="col-sm-9">
                    <input type="radio" name="userPopulation" value="1" checked> 全部用户
                    <input type="radio" name="userPopulation" value="2" > 年度会员
                    <input type="radio" name="userPopulation" value="3" > 已有学员用户
                </div>
            </div>
 
            <div class="form-group">
                <label class="col-sm-3 control-label">发放数量:</label>
                <div class="col-sm-9">
                    <input class="form-control" id="quantityIssued" name="quantityIssued" type="number">
                </div>
            </div>
 
            <div class="form-group">
                <label class="col-sm-3 control-label">限领数量:</label>
                <div class="col-sm-9">
                    <input class="form-control" id="pickUpQuantity" name="pickUpQuantity" type="number">
                </div>
            </div>
            <#input id="startTime" name="有效期" type="text"/>
            @if(userType!=3){
            <div class="row" id="belongsCon" >
                <div class="form-group">
                    <div class="form-group">
                        <div class="initialLevel col-sm-12 control-label form-group">
                            <label class="col-sm-3">*兑换地点: </label>
                            <div class="col-sm-2" id="belongsNationwide" hidden >
                                <input class="col-sm-1" onclick="scopeOfApplication1()" name="company" type="radio"
                                       value="1"  style="margin-top: 10px"/>
                                <label class="col-sm-1" style="width: 38%;margin-top: 7px">全国通用</label>
                            </div>
                            <div class="col-sm-2" id="belongsCity" hidden >
                                <input class="col-sm-1" name="company" onclick="scopeOfApplication2()" type="radio"
                                       value="2"  style="margin-top: 10px"/>
                                <label class="col-sm-1" style="width: 38%;margin-top: 7px">指定城市</label>
                            </div>
                            <div class="col-sm-2" id="belongsStore"  >
                                <input class="col-sm-1" name="company" onclick="scopeOfApplication3()" type="radio" checked
                                       value="3" style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/>
                                <label class="col-sm-1" style="width: 38%;margin-top: 6px;">指定门店</label>
                            </div>
                        </div>
                    </div>
 
                </div>
            </div>
            @}
 
            <div class="row" id="citySelect" hidden="hidden">
                <div class="form-group">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">*指定城市: </label>
                        <div class="col-sm-9 control-label">
                            <select class="col-sm-1"  id="provinceData" style="margin-top: 1%;width: 25%" onchange="changeCity(null)">
                                <option value="">请选择</option>
                            </select>
                            <label class="col-sm-1"  style="width: 9%;margin-top: 7px">省</label>
                            <select  class="col-sm-1" style="margin-top: 1%;width: 25%" id="cityData">
                                <option value="">请选择</option>
                            </select>
                            <label class="col-sm-1" style="width: 7%;margin-top: 7px">市</label>
                            <label name="addBranch" class="col-sm-1" onclick="TGoodsInfoDlg.addBranch()" style="border: 0px;cursor: pointer;margin-top: 1%"><i class="fa fa-plus-circle"></i></label>
                        </div>
                        <div id="cityDemo"></div>
                    </div>
 
                </div>
            </div>
 
            @if(userType!=3){
             <div class="row" id="storeSelect" >
                <div class="form-group">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <label class="col-sm-3 control-label">*指定门店: </label>
                            <button onclick="storeList1()"
                                    style="height: 22px;width: 82px;background-color: #4a8ff1;color: white;z-index: 15;position:relative;border: none;margin-top: 1%">
                                选择门店
                            </button>
                        </div>
                        <div class="col-sm-12" style="margin-left: -57px;margin-top: 20px">
                            <table class="table table-bordered" style="width: 70%;margin-left: 228px;" id="storeTable">
                                <thead>
                                <tr>
                                    <td>所在省市</td>
                                    <td>所属账号</td>
                                    <td>门店名称</td>
                                    <td>闸机id</td>
                                    <td>操作</td>
                                </tr>
                                </thead>
                                <tbody id="coun"></tbody>
                            </table>
                        </div>
                    </div>
 
                </div>
            </div>
            @}
            <div class="form-group" style="margin-left:262px">
                <label class="col-sm-1 control-label">兑换说明:</label>
                <div class="col-sm-5">
                    <textarea type="text/plain" id="editor"  style="height: 300px;width: 800px;"></textarea>
                </div>
            </div>
 
            <div class="form-group">
                <label class="col-sm-3 control-label">排序:</label>
                <div class="col-sm-9">
                    <input class="form-control" id="sort" name="sort" type="number">
 
                </div>
            </div>
            </div>
 
            <div id="b2" hidden>
 
                <div class="form-group" id="provinceCode">
                    <label class="col-sm-3 control-label">所在省:</label>
                    <div class="col-sm-9">
                        <select class="form-control" id="pCode" name="pCode" onchange="TCarInfoDlg.oneChange(this)">
                            <option value="">选择省</option>
                            @for(obj in list){
                            <option value="${obj.code}">${obj.name}</option>
                            @}
                        </select>
                    </div>
                </div>
                <div class="form-group" id="cityCode">
                    <label class="col-sm-3 control-label">所在市:</label>
                    <div class="col-sm-9">
                        <select class="form-control" id="cCode" name="cCode">
                            <option value="">选择市</option>
                        </select>
                    </div>
                </div>
 
            </div>
 
 
        </div>
</div>
 
<div class="row btn-group-m-t">
    <div class="col-sm-10 col-sm-offset-5">
        <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TGoodsInfoDlg.addSubmit1()"/>
        <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TGoodsInfoDlg.close()"/>
    </div>
</div>
        </div>
    </div>
</div>
<script src="${ctxPath}/js/vue/vue.js"></script>
<script src="${ctxPath}/js/elementui/index.js"></script>
<link rel="stylesheet" href="${ctxPath}/js/elementui/index.css">
<script src="${ctxPath}/modular/system/tGoods/tGoods_info.js"></script>
<script src="${ctxPath}/modular/system/tGoods/TStoreInfo.js"></script>
<script>
    laydate.render({
        elem: '#startTime',
        range: true
    });
    function updateType(e) {
        if(e==2){
            $("#b1").hide()
            $("#b2").show()
        }else {
            $("#b2  ").hide()
            $("#b1").show()
        }
    }
 
    function validateNumber(input) {
// 获取输入的值
        var value = input.value;
 
        // 使用正则表达式匹配数字和最多两位小数
        var regex = /^\d*\.?\d{0,2}/;
        var match = value.match(regex);
 
        // 更新输入框的值为匹配的结果(最多两位小数)
        input.value = match
    }
 
    function changeCity(n){
 
        var provinceSelect = null;
        if (n === undefined || n === null || n === ''){
            provinceSelect = document.getElementById("provinceData");
        }else {
            provinceSelect = document.getElementById("provinceData"+n);
        }
 
        var citySelect = null;
        if (n === undefined || n === null || n === ''){
            citySelect = document.getElementById("cityData");
        }else {
            citySelect = document.getElementById("cityData"+n);
        }
 
        var selectedProvince = provinceSelect.value;
        // 清空城市下拉框
        citySelect.innerHTML = '<option value="">请选择</option>';
        if (selectedProvince === "") {
            return;
        }
        var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity", function(data){
            data.forEach(province => {
                var option = document.createElement("option");
                option.value = province.id;  // 根据你的数据结构确定省份的id字段
                option.text = province.name;  // 根据你的数据结构确定省份的name字段
                citySelect.appendChild(option);
            });
        },function(data){
            console.log('data:',data)
            Feng.error("获取失败!" + data.responseJSON.message + "!");
        });
        ajax.set('province',selectedProvince);
        ajax.start();
    }
 
    /**
     * 全国通用
     */
    function scopeOfApplication1() {
        $("#storeSelect").hide();
        $("#citySelect").hide();
    }
    /**
     * 指定城市
     */
    function scopeOfApplication2() {
        $("#storeSelect").hide();
        $("#citySelect").show();
    }
    /**
     * 指定门店
     */
    function scopeOfApplication3() {
        $("#storeSelect").show();
        $("#citySelect").hide();
    }
 
    function updateMethod(e) {
        console.log(e)
        if(e==1){
            $("#y3").hide()
            $("#y4").show()
        }else if(e==2){
            $("#y4").show()
            $("#y3").show()
        }else if(e==3){
            $("#y1").hide()
            $("#y2").show()
        }else if(e==4){
            $("#y1").show()
            $("#y2").show()
        }else if(e==5) {
            $("#y2").hide()
            $("#y1").show()
        }
 
    }
    let i =1;
    function updateType(e) {
 
        if(e==2){
            $("#b1").hide()
            $("#b2").show()
            if(i==1){
                var drivingLicensePhoto = new $WebUpload("cover1");
                drivingLicensePhoto.setUploadBarId("progressBar");
                drivingLicensePhoto.init();
                i++;
            }
            $("#ticket").hide()
        }else {
            $("#b2").hide()
            $("#b1").show()
            $("#ticket").show()
        }
    }
 
 
    var vue2 = new Vue({
        el: '#app',
        data: {
            autoUpload: true,//自动上传
            imageUrl1: '',//模型数据,用于上传图片完成后图片预览
            dialogVisible: false
        },
        methods: {
            handleAvatarSuccess(res, file) {
                TGoodsInfoDlg.goodsPicArray.push(file);
            },
            beforeAvatarUpload(file) {
                const isLt2M = file.size / 1024 / 1024 < 10;
                if (!isLt2M) {
                    this.$message.error('上传图片大小不能超过 10MB!');
                }
                return isLt2M;
            },
            handleRemove(file, fileList) {
                couponInfoDlg.goodsPicArray = couponInfoDlg.goodsPicArray.filter(item => {
                    return item.uid != file.uid;
                });
            },
        },
        created() {
        },
    });
</script>
@}