123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('修改商城')" />
- <th:block th:include="include :: bootstrap-fileinput-css"/>
- </head>
- <body class="white-bg">
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
- <form class="form-horizontal m" id="form-mall-edit" th:object="${qmjsShoppingMall}">
- <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">
- <input name="goodsName" th:field="*{goodsName}" class="form-control" type="text" maxlength="15" required>
- </div>
- </div>
- </div>
- <!-- <div class="col-xs-12">-->
- <!-- <div class="form-group">-->
- <!-- <label class="col-sm-3 control-label">商品条码:</label>-->
- <!-- <div class="col-sm-8">-->
- <!-- <input name="goodsCode" th:field="*{goodsCode}" class="form-control" type="text" required>-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- </div>-->
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">商品种类:</label>
- <div class="col-sm-8">
- <select name="goodsType" class="form-control" th:with="type=${@dict.getType('goods_type')}">
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsType}"></option>
- </select>
- </div>
- </div>
- </div>
- <!-- <div class="col-xs-12">-->
- <!-- <div class="form-group">-->
- <!-- <label class="col-sm-3 control-label">计量单位:</label>-->
- <!-- <div class="col-sm-8">-->
- <!-- <input name="goodsUnit" th:field="*{goodsUnit}" class="form-control" type="text" required>-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- </div>-->
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">时价商品:</label>
- <div class="col-sm-8">
- <select name="goodsCurrentPrice" class="form-control" th:with="type=${@dict.getType('sys_yes_no')}">
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsCurrentPrice}"></option>
- </select>
- </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">
- <input name="salePrice" th:field="*{salePrice}" class="form-control" type="text" maxlength="15" required>
- </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">
- <input name="suggestionPrice" th:field="*{suggestionPrice}" class="form-control" type="text" maxlength="15" required>
- </div>
- </div>
- </div>
- <!-- <div class="col-xs-12">-->
- <!-- <div class="form-group">-->
- <!-- <label class="col-sm-3 control-label">商品库存:</label>-->
- <!-- <div class="col-sm-8">-->
- <!-- <input name="goodsInventory" th:field="*{goodsInventory}" class="form-control" type="text" required>-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- <div class="col-xs-12">-->
- <!-- <div class="form-group">-->
- <!-- <label class="col-sm-3 control-label">库存成本:</label>-->
- <!-- <div class="col-sm-8">-->
- <!-- <input name="inventoryCost" th:field="*{inventoryCost}" class="form-control" type="text" required>-->
- <!-- </div>-->
- <!-- </div>-->
- <!-- </div>-->
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">商品状态:</label>
- <div class="col-sm-8">
- <select name="goodsState" class="form-control" th:with="type=${@dict.getType('goods_state')}" disabled>
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{goodsState}"></option>
- </select>
- </div>
- </div>
- </div>
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">商品图片:</label>
- <div class="col-sm-8">
- <input type="hidden" name="goodsImg" th:field="*{goodsImg}">
- <div class="file-loading">
- <input class="form-control file-upload" id="goodsImg" name="file" type="file" multiple>
- </div>
- </div>
- </div>
- </div>
- <div class="col-xs-12">
- <div class="form-group">
- <label class="col-sm-3 control-label">商品说明:</label>
- <div class="col-sm-8">
- <textarea name="goodsDescribe" class="form-control" type="text" maxlength="200">[[*{goodsDescribe}]]</textarea>
- </div>
- </div>
- </div>
- </form>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: bootstrap-fileinput-js"/>
- <script th:inline="javascript">
- var prefix = ctx + "system/mall";
- $("#form-mall-edit").validate({
- focusCleanup: true,
- rules:{
- salePrice:{
- double:true
- },
- suggestionPrice:{
- double:true
- },
- },
- });
- function submitHandler() {
- if ($.validate.form()) {
- $.operate.save(prefix + "/edit", $('#form-mall-edit').serialize());
- }
- }
- $(".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: 5,
- 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');
- });
- </script>
- </body>
- </html>
|