|
@@ -3,6 +3,7 @@
|
|
|
<head>
|
|
|
<th:block th:include="include :: header('修改卡种信息')" />
|
|
|
<th:block th:include="include :: datetimepicker-css" />
|
|
|
+ <th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
|
</head>
|
|
|
<body class="white-bg">
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
@@ -10,16 +11,12 @@
|
|
|
<input name="id" th:field="*{id}" type="hidden">
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">名称:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
+ <label class="col-sm-2 control-label is-required">名称:</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
<input name="name" th:field="*{name}" class="form-control" type="text" maxlength="20">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-xs-12">
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">类型:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
+ <label class="col-sm-2 control-label is-required">类型:</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
<select name="type" class="form-control" th:with="type=${@dict.getType('site_type')}">
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{type}"></option>
|
|
|
</select>
|
|
@@ -28,42 +25,45 @@
|
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">可用次数:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
+ <label class="col-sm-2 control-label is-required">可用次数:</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
<input name="totalNumber" th:field="*{totalNumber}" class="form-control" type="number" min="0" step="1" maxlength="8">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="col-xs-12">
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">原价格:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
+ <label class="col-sm-2 control-label is-required">原价格:</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
<input name="originalPrice" th:field="*{originalPrice}" class="form-control" type="number" min="0" step="0.01" maxlength="8">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">会员价格:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
+ <label class="col-sm-2 control-label is-required">会员价格:</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
<input name="memberPrice" th:field="*{memberPrice}" class="form-control" type="number" min="0" step="0.01" maxlength="8">
|
|
|
</div>
|
|
|
+ <label class="col-sm-2 control-label is-required">单次积分:</label>
|
|
|
+ <div class="col-sm-4">
|
|
|
+ <input name="point" th:field="*{point}" class="form-control" type="number" min="0" step="1" maxlength="8">
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">单次积分:</label>
|
|
|
+ <label class="col-sm-2 control-label is-required">使用规则:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <input name="point" th:field="*{point}" class="form-control" type="number" min="0" step="1" maxlength="8">
|
|
|
+ <input name="notes" th:field="*{notes}" class="form-control" type="hidden" maxlength="255">
|
|
|
+ <div class="summernote" id="notes"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">使用规则:</label>
|
|
|
+ <label class="col-sm-2 control-label">图片:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <input name="notes" th:field="*{notes}" class="form-control" type="hidden" maxlength="255">
|
|
|
- <div class="summernote" id="notes"></div>
|
|
|
+ <input type="hidden" name="file" th:field="*{file}">
|
|
|
+ <div class="file-loading">
|
|
|
+ <input class="form-control file-upload" id="file" name="file" type="file">
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -73,6 +73,7 @@
|
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
|
<th:block th:include="include :: summernote-js"/>
|
|
|
<th:block th:include="include :: summernote-css"/>
|
|
|
+ <th:block th:include="include :: bootstrap-fileinput-js"/>
|
|
|
<script th:inline="javascript">
|
|
|
var prefix = ctx + "information";
|
|
|
$("#form-information-edit").validate({
|
|
@@ -97,6 +98,47 @@
|
|
|
autoclose: true
|
|
|
});
|
|
|
|
|
|
+ $(".file-upload").each(function (i) {
|
|
|
+ var inputName = this.id;
|
|
|
+ var val = $("input[name='" + inputName + "']").val();
|
|
|
+
|
|
|
+ // 将已上传的图片路径分割成数组
|
|
|
+ var initialPreview = val ? val.split(',') : [];
|
|
|
+
|
|
|
+ $(this).fileinput({
|
|
|
+ 'uploadUrl': ctx + 'common/upload',
|
|
|
+ initialPreviewAsData: true,
|
|
|
+ initialPreview: initialPreview,
|
|
|
+ maxFileCount: 1,
|
|
|
+ allowedFileExtensions: ['jpg', 'png'],
|
|
|
+ maxFileSize: 10240,
|
|
|
+ multiple: true,
|
|
|
+ }).on('fileuploaded', function (event, data, previewId, index) {
|
|
|
+ var inputName = event.currentTarget.id;
|
|
|
+ var existingValue = $("input[name='" + inputName + "']").val();
|
|
|
+ var newValue = data.response.url;
|
|
|
+
|
|
|
+ // 如果已经存在值,则在后面加上逗号分隔的新值
|
|
|
+ if (existingValue) {
|
|
|
+ $("input[name='" + inputName + "']").val(existingValue + ',' + newValue);
|
|
|
+ } else {
|
|
|
+ $("input[name='" + inputName + "']").val(newValue);
|
|
|
+ }
|
|
|
+ }).on('fileremoved', function (event, id, index) {
|
|
|
+ var inputName = event.currentTarget.id;
|
|
|
+ var existingValue = $("input[name='" + inputName + "']").val();
|
|
|
+ var fileUrls = existingValue.split(',');
|
|
|
+
|
|
|
+ // 移除对应的文件路径
|
|
|
+ fileUrls.splice(index, 1);
|
|
|
+
|
|
|
+ // 重新拼接文件路径
|
|
|
+ $("input[name='" + inputName + "']").val(fileUrls.join(','));
|
|
|
+ });
|
|
|
+
|
|
|
+ $(this).fileinput('_initFileActions');
|
|
|
+ });
|
|
|
+
|
|
|
$(function() {
|
|
|
$('.summernote').each(function(i) {
|
|
|
console.log($('#' + this.id))
|