记得上下班打卡 | git大法好,push需谨慎

Commit c1f03a35 authored by jiangxiulong's avatar jiangxiulong

快递模版 前端 模版和接口不支持api

parent e3037323
...@@ -10,12 +10,12 @@ import com.liquidnet.client.admin.common.enums.BusinessType; ...@@ -10,12 +10,12 @@ import com.liquidnet.client.admin.common.enums.BusinessType;
import com.liquidnet.client.admin.zhengzai.kylin.service.IKylinExpressModuleService; import com.liquidnet.client.admin.zhengzai.kylin.service.IKylinExpressModuleService;
import com.liquidnet.service.kylin.dto.param.admin.ExpressModuleFromParam; import com.liquidnet.service.kylin.dto.param.admin.ExpressModuleFromParam;
import com.liquidnet.service.kylin.entity.KylinExpressModule; import com.liquidnet.service.kylin.entity.KylinExpressModule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -33,9 +33,8 @@ import javax.validation.constraints.NotNull; ...@@ -33,9 +33,8 @@ import javax.validation.constraints.NotNull;
* @author jiangxiulong * @author jiangxiulong
* @since 2021-11-15 * @since 2021-11-15
*/ */
@Api(tags = "快递模板管理")
@Validated @Validated
@RestController @Controller
@RequestMapping("/kylin/expressModule") @RequestMapping("/kylin/expressModule")
public class KylinExpressModuleController extends BaseController { public class KylinExpressModuleController extends BaseController {
private String prefix = "zhengzai/kylin/expressModule"; private String prefix = "zhengzai/kylin/expressModule";
...@@ -46,9 +45,8 @@ public class KylinExpressModuleController extends BaseController { ...@@ -46,9 +45,8 @@ public class KylinExpressModuleController extends BaseController {
@Log(title = "快递模版创建", businessType = BusinessType.INSERT) @Log(title = "快递模版创建", businessType = BusinessType.INSERT)
@RequiresPermissions("kylin:expressModule:create") @RequiresPermissions("kylin:expressModule:create")
@PostMapping("create") @PostMapping("create")
@ApiOperation(value = "快递模版创建")
@ResponseBody @ResponseBody
public AjaxResult create(@Valid @RequestBody ExpressModuleFromParam param) { public AjaxResult create(ExpressModuleFromParam param) {
Integer result = expressModuleService.createForm(param); Integer result = expressModuleService.createForm(param);
if (result > 0) { if (result > 0) {
return success("操作成功"); return success("操作成功");
...@@ -59,10 +57,9 @@ public class KylinExpressModuleController extends BaseController { ...@@ -59,10 +57,9 @@ public class KylinExpressModuleController extends BaseController {
@Log(title = "快递模版编辑", businessType = BusinessType.UPDATE) @Log(title = "快递模版编辑", businessType = BusinessType.UPDATE)
@RequiresPermissions("kylin:expressModule:update") @RequiresPermissions("kylin:expressModule:update")
@PutMapping("update") @PostMapping("update")
@ApiOperation(value = "快递模版编辑")
@ResponseBody @ResponseBody
public AjaxResult update(@Valid @RequestBody ExpressModuleFromParam param) { public AjaxResult update(ExpressModuleFromParam param) {
Integer result = expressModuleService.updateForm(param); Integer result = expressModuleService.updateForm(param);
if (result > 0) { if (result > 0) {
return success("操作成功"); return success("操作成功");
...@@ -73,7 +70,6 @@ public class KylinExpressModuleController extends BaseController { ...@@ -73,7 +70,6 @@ public class KylinExpressModuleController extends BaseController {
@Log(title = "快递模版上下线", businessType = BusinessType.UPDATE) @Log(title = "快递模版上下线", businessType = BusinessType.UPDATE)
@RequiresPermissions("kylin:expressModule:isOnline") @RequiresPermissions("kylin:expressModule:isOnline")
@ApiOperation(value = "快递模版上下线")
@PutMapping("isOnline") @PutMapping("isOnline")
@ResponseBody @ResponseBody
@ApiImplicitParams({ @ApiImplicitParams({
...@@ -94,7 +90,6 @@ public class KylinExpressModuleController extends BaseController { ...@@ -94,7 +90,6 @@ public class KylinExpressModuleController extends BaseController {
@Log(title = "快递模版详情", businessType = BusinessType.DETAIL) @Log(title = "快递模版详情", businessType = BusinessType.DETAIL)
@GetMapping("details") @GetMapping("details")
@ApiOperation(value = "快递模版详情")
@ResponseBody @ResponseBody
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "query", required = true, dataType = "String", name = "moduleId", value = "快递模版id"), @ApiImplicitParam(type = "query", required = true, dataType = "String", name = "moduleId", value = "快递模版id"),
...@@ -106,7 +101,6 @@ public class KylinExpressModuleController extends BaseController { ...@@ -106,7 +101,6 @@ public class KylinExpressModuleController extends BaseController {
@Log(title = "快递模版列表数据", businessType = BusinessType.LIST) @Log(title = "快递模版列表数据", businessType = BusinessType.LIST)
@RequiresPermissions("kylin:expressModule:list") @RequiresPermissions("kylin:expressModule:list")
@ApiOperation(value = "快递模版列表数据")
@PostMapping("list") @PostMapping("list")
@ResponseBody @ResponseBody
public TableDataInfo list() { public TableDataInfo list() {
...@@ -114,15 +108,20 @@ public class KylinExpressModuleController extends BaseController { ...@@ -114,15 +108,20 @@ public class KylinExpressModuleController extends BaseController {
return getDataTable(result.getList()); return getDataTable(result.getList());
} }
@GetMapping("listView") @GetMapping()
@ApiOperation(value = "快递模版列表view")
public String listView() { public String listView() {
return prefix + "/list"; return prefix + "/listView";
} }
@GetMapping("formView") @GetMapping("/create")
@ApiOperation(value = "快递模版添加编辑view") public String createView() {
public String formView() { return prefix + "/create";
return prefix + "/form"; }
@GetMapping("/update/{moduleId}")
public String updateView(@PathVariable("moduleId") String moduleId, ModelMap mmap) {
KylinExpressModule result = expressModuleService.detail(moduleId);
mmap.put("KylinExpressModule", result);
return prefix + "/update";
} }
} }
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('添加快递模版')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-post-add">
<div class="form-group">
<label class="col-sm-2 control-label is-required">快件产品名称:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="title" id="title" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">产品编码:</label>
<div class="col-sm-10">
<input class="form-control" type="number" name="productCode" id="productCode">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">时效类型:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="agingType" id="agingType" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">快递预估价格小:</label>
<div class="col-sm-10">
<input class="form-control" type="number" name="estimatePriceMin" id="estimatePriceMin">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">快递预估价格大:</label>
<div class="col-sm-10">
<input class="form-control" type="number" name="estimatePriceMax" id="estimatePriceMax">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否上线</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="1" name="isOnline" checked=""> <i></i> 未上线
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="2" name="isOnline"> <i></i> 已上线
</label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
var prefix = ctx + "kylin/expressModule";
function submitHandler() {
if ($.validate.form()) {
var data = $('#form-post-add').serializeArray();
$.operate.save(prefix + "/create", data);
}
}
</script>
</body>
</html>
<!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" />
<style>
.layui-form {
padding: 20px;
}
.main_type, .money, .scope_application, .sendType,.phoneNumber,.playMethod {
margin-bottom: 20px;
}
.phoneNumber,.playMethod {
display: none;
}
.labelName {
display: inline-block;
width: 100px;
text-align: right;
}
input {
border: 1px solid #ddd;
border-radius: 4px;
background: transparent;
outline: none;
padding-left: 5px;
height: 30px;
}
.main_type .form-control.kv-fileinput-caption {
height: 42px !important;
}
.prompt {
margin-left: 100px !important;
}
.main_type input, .sendType input,.playMethod input {
margin-top: -2px;
margin-right: 5px;
}
.main_type span, .sendType span, .playMethod span {
margin-right: 12px;
line-height: 28px;
}
.layui-form .money input {
width: 60px;
}
.main_bottom .describe, .main_bottom .sendTime {
margin-bottom: 20px;
}
.describe,.main_type {
display: flex;
}
.sendTime {
display: flex;
}
.sendTime input {
margin-top: -6px;
margin-right: 5px;
}
.bottom_btn {
width: 25%;
text-align: center;
}
select {
border: 1px solid #ddd;
border-radius: 4px;
background: transparent;
outline: none;
height: 30px;
width: 200px;
}
.required {
font-style: normal;
color: red;
}
.ibox-content {
border-style: none;
border-width: 0px;
}
.main_type .file-footer-buttons .kv-file-remove {
display: none !important;
}
.selectScore {
display: flex;
align-items: center;
}
.selectScore p {
margin: 0;
}
.selectScore button {
margin: 0 12px;
}
.selectScore span {
color: #ccc;
}
.scoreTable {
margin-bottom: 12px;
}
</style>
</head>
<body class="white-bg">
<form id="form-user-add" class="layui-form">
<div>
基础信息
</div>
<div class="main_type">
<span class="labelName"><i class="required">*</i>活动名称:</span>
<div class="layui-input-block" style="display: flex">
<input type="text" id="ActivityName" autocomplete="off" class="layui-input" placeholder="请输入名称">
</div>
</div>
<div class="main_type">
<span class="labelName"><i class="required">*</i>活动类型:</span>
<div class="layui-input-block" style="display: flex">
<input type="text" id="ActivityType" autocomplete="off" class="layui-input" value="转盘" disabled placeholder="请输入类型">
</div>
</div>
<input id="ceshi" class="scoreFile" type="file" name="scoreFile" style="display: none;">
<input id="selectCeshi" class="scoreFile" type="file" name="scoreFile" style="display: none;">
<div class="main_type">
<span class="labelName"><i class="required">*</i>banner图:</span>
<div class="layui-input-block" style="display: flex;flex-direction: column;">
<img id="viewImg" src="" alt="" style="max-height:242px;">
<div class="ibox-content">
<div class="form-group">
<div class="file-loading">
<input id="fileinput" type="file" name="file" data-browse-on-zone-click="true" data-theme="fas">
</div>
</div>
</div>
</div>
</div>
<div class="main_type">
<span class="labelName"><i class="required">*</i>所需积分:</span>
<div class="layui-input-block" style="display: flex">
<input type="text" id="integral" autocomplete="off" class="layui-input" placeholder="请输入所需积分">
</div>
</div>
<div class="sendType">
<div style="display: flex;align-items: center;">
<span class="labelName"><i class="required">*</i>活动时间:</span>
<div class="layui-input-block" style="display: flex">
<input type="radio" value="1" name="sendType" checked><span>长期</span>
<input type="radio" value="2" name="sendType"><span>选择开始结束时间</span>
<div class="selectTime">
<input type="text" class="layui-input" id="startTime" autocomplete="off" placeholder="请选择起始时间">
<span>~</span>
<input type="text" class="layui-input" id="endTime" autocomplete="off" placeholder="请选择结束时间">
</div>
</div>
</div>
</div>
<div class="selectScore">
<p><i class="required">*</i>选择商品</p>
<!-- <button type="button" class="btn btn-primary" onclick="addColumn()">新增商品</button>
<span>最多可上传6个</span> -->
</div>
<!-- <img src="img/select.png" alt=""> -->
<div class="scoreTable">
<div class="row">
<div class="col-sm-12">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
<div class="main_bottom">
<div class="describe">
<span class="labelName">
<i class="required">*</i>活动规则:
</span>
<textarea id="activityRule" class="form-control" style="min-height: 160px;"></textarea>
</div>
<div class="sendTime">
<span class="labelName"><i class="required">*</i>是否上线:</span>
<div class="layui-input-block" style="display: flex">
<input type="radio" name="online" value="1" checked><span>未上线</span>
<input type="radio" name="online" value="2" style="margin-left: 12px;"><span>已上线</span>
</div>
</div>
<div class="sendTime">
<span class="labelName"><i class="required">*</i>快递费用:</span>
<div class="layui-input-block" style="display: flex">
<input type="radio" name="sex" value="1" checked><span>包邮</span>
<input type="radio" name="sex" value="2" style="margin-left: 12px;"><span>到付</span>
</div>
<!-- <span style="margin-right:12px;"><p>输入金额</p></span>
<input type="text" id="courierMoney" autocomplete="off" class="layui-input" placeholder="请输入金额"> -->
</div>
<div class="bottom_btn">
<!-- <button type="button" class="layui-btn btn btn-primary" lay-filter="formDemo" onclick="create()">创建代金券</button> -->
<button type="button" class="btn btn-primary" onclick="create()">确 定</button>
</div>
</div>
</form>
<th:block th:include="include :: footer"/>
<script th:src="@{/js/jquery.tmpl.js}"></script>
<th:block th:include="include :: bootstrap-fileinput-js" />
<script type="text/javascript">
var platformUrl = `[[${platformUrl}]]`
var prefix = ctx + "sweet/sweetIntegralActivity";
let showIndex = null;
// 初始化数据, 可以由后台传过来
var data = []; // 表格内数据集合
let activityName = ''; // 活动名称
let activityType = ''; // 活动类型
let timeType = '1'; // 活动时间类型
let startTime = ''; // 开始时间
let endTime = ''; // 结束时间
let activityRule = ''; // 活动规则
let courierType = '1'; // 快递类型
let courierMoney = ''; // 快递费用
let showPicture = ''; // banner
let online = '1'; // 是否上线
let itemId = '';
let activitySize = false;
var options = {
data: data,
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [
{
field: 'index',
align: 'center',
title: "序号",
formatter: function (value, row, index) {
return index+1;
}
},
{
field: 'prizeTitle',
align: 'center',
title: '奖品名称',
formatter: function(value, row, index) {
let str = '';
if (data[index].prizeTitle) {
str = "<input id='prizeTitle"+index+"' class='form-control' type='text' name='' value='"+data[index].prizeTitle+"'>"
} else {
str = "<input id='prizeTitle"+index+"' class='form-control' type='text' name='' value=''>"
}
var html = $.common.sprintf(str, index, value);
return html;
}
},
{
field: 'prizeImgInit',
align: 'center',
title: '商品图片',
formatter: function(value, row, index) { //
let str = '';
if (data[index].prizeImgInit) {
str = `<img id="showPic${index}" onclick=upFile(${index}) src="${data[index].prizeImgInit}" alt="" style="max-height:50px;">`
} else {
str = `<img id="showPic${index}" onclick=upFile(${index}) src="${value}" alt="点击上传" style="max-height:50px;">`
}
var html = $.common.sprintf(str, index, value);
return html;
}
},
{
field: 'prizeImgSelect',
align: 'center',
title: '选中图片',
formatter: function(value, row, index) { //
let str = '';
if (data[index].prizeImgSelect) {
str = `<img id="showPicSelect${index}" onclick=upFileSelect(${index}) src="${data[index].prizeImgSelect}" alt="" style="max-height:50px;">`
} else {
str = `<img id="showPicSelect${index}" onclick=upFileSelect(${index}) src="${value}" alt="点击上传" style="max-height:50px;">`
}
var html = $.common.sprintf(str, index, value);
return html;
}
},
{
field: 'prizeType',
align: 'center',
title: '奖品类型',
formatter: function(value, row, index) {
let arr = ['谢谢惠顾', '积分', '代金券', '满减券', '优先购买', '实物'];
let str = '';
arr.forEach((item,i)=> {
i++
if (i == data[index].prizeType) {
str += `<option value="${i}" selected>${item}</option>`
} else {
str += `<option value="${i}">${item}</option>`
}
})
let dom = `<select id='prizeType${index}' class='form-control' name=''>
${str}
</select>`
return dom;
}
},
{
field: 'winningProbability',
align: 'center',
title: '概率',
formatter: function(value, row, index) {
let str = '';
if (data[index].winningProbability) {
str = `<input id='winningProbability${index}' class='form-control' type='text' name='' value='${data[index].winningProbability}'>`
} else {
str = `<input id='winningProbability${index}' class='form-control' type='text' name='' value=''>`
}
var html = $.common.sprintf(str, index, value);
return html;
}
},
{
field: 'prizeNum',
align: 'center',
title: '数量',
formatter: function(value, row, index) {
let str = '';
if (data[index].prizeNum) {
str = `<input id='prizeNum${index}' class='form-control' type='text' name='' value='${data[index].prizeNum}'>`
} else {
str = `<input id='prizeNum${index}' class='form-control' type='text' name='' value=''>`
}
var html = $.common.sprintf(str, index, value);
return html;
}
},
{
field: 'winnersNum',
align: 'center',
title: '中奖人数',
formatter: function(value, row, index) {
let str = '';
if (data[index].winnersNum) {
str = `<input id='winnersNum${index}' class='form-control' type='text' name='' value='${data[index].winnersNum}'>`
} else {
str = `<input id='winnersNum${index}' class='form-control' type='text' name='' value=''>`
}
var html = $.common.sprintf(str, index, value);
return html;
}
},
{
field: 'WinPrizeNum',
align: 'center',
title: '已发出',
formatter: function(value, row, index) {
if (value) {
return value;
} else {
return '-'
}
}
},
{
field: 'residue',
align: 'center',
title: '奖品剩余',
formatter: function(value, row, index) {
if (itemId) {
return (row.prizeNum - row.WinPrizeNum) || '-'
} else {
return '-'
}
}
}
]
};
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#startTime', //指定元素
type: 'datetime'
});
laydate.render({
elem: '#endTime', //指定元素
type: 'datetime'
});
});
$("#ActivityName").blur(function(e) {
if (e.target.value.length > 20) {
activitySize = true;
layer.msg('活动名称限制在20个字符以内!')
return
} else {
activitySize = false;
}
})
$(function() {
itemId = getUrlParms('id')
function getUrlParms(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)
return unescape(r[2]);
return null;
}
if (itemId) {
$.ajax({
type: 'get',
url: '/sweet/integralActivity/details',
data: {integralActivityId: itemId},
success:function(e) {
if (e.code == 0) {
let res = e.data;
showPicture = res.activityImg;
$("#viewImg").attr('src', showPicture);
$("#integral").val(res.activityNum);
$("#activityRule").val(res.activityRules);
$("#ActivityName").val(res.activityTitle);
// activityType: 1,
courierType = res.expressFeeType;
if (courierType == 2) {
$("input[name='sex'][value='2']").attr('checked', true).siblings().removeAttr('checked');
}
integralActivityId = res.integralActivityId;
$("#endTime").val($.common.dateFormat(res.endTime, 'yyyy-MM-dd HH:mm:ss'));
online = res.isOnline;
if (online == 2) {
$("input[name='online'][value='2']").attr('checked', true).siblings().removeAttr('checked');
}
// prizeList: data,
$("#startTime").val($.common.dateFormat(res.startTime, 'yyyy-MM-dd HH:mm:ss'));
timeType = timeType;
if (timeType == 2) {
$("input[name='sendType'][value='2']").attr('checked', true).siblings().removeAttr('checked');
}
data = [...res.prizeList]
options.data = data;
setTimeout(()=>{
$.table.init(options);
}, 500)
}
}
})
} else {
let obj = {
prizeTitle: "",
prizeImgInit: "",
prizeImgSelect: "",
winnersNum: "",
WinPrizeNum: "",
prizeType: "",
winningProbability: "",
residue: "",
prizeNum: ""
};
for( var i = 0; i < 12; i++) {
data.push(obj)
}
$.table.init(options);
}
});
$("input[name=sendType]").change((e)=>{
timeType = e.target.value;
if (timeType == 1) {
$("#endTime").val("");
$("#startTime").val("");
}
})
$("input[name=sex]").change((e)=>{
courierType = e.target.value;
})
$("input[name=online]").change((e)=>{
online = e.target.value;
})
function upFile(e) {
showIndex = e;
$("#ceshi").click();
}
function upFileSelect(e) {
showIndex = e;
$("#selectCeshi").click();
}
$("#ceshi").change((e) => {
if (!e.target.files[0]) {
return
}
var formData = new FormData();
formData.append("file", e.target.files[0]);
$.ajax({
url: platformUrl + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法,下面controller里面我会写到
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function (res) {
$("#showPic"+showIndex).attr('src','https://img.zhengzai.tv/' + res.data.ossPath)
data[showIndex].prizeImgInit = 'https://img.zhengzai.tv/' + res.data.ossPath;
$("#ceshi").val("");
// $summernote.summernote('insertImage', 'https://img.zhengzai.tv/' + data.data.ossPath)
}
});
})
$("#selectCeshi").change((e) => {
if (!e.target.files[0]) {
return
}
var formData = new FormData();
formData.append("file", e.target.files[0]);
$.ajax({
url: platformUrl + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法,下面controller里面我会写到
data: formData,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function (res) {
$("#showPicSelect"+showIndex).attr('src','https://img.zhengzai.tv/' + res.data.ossPath)
data[showIndex].prizeImgInit = 'https://img.zhengzai.tv/' + res.data.ossPath;
$("#selectCeshi").val("");
// $summernote.summernote('insertImage', 'https://img.zhengzai.tv/' + data.data.ossPath)
}
});
})
$("#fileinput").fileinput({
'theme': 'explorer-fas',
'uploadUrl': platformUrl + "/platform/basicServices/alOss/upload",
"uploadExtraData": {
"pathName" : "banner",
"buckType" : 1
},
autoReplace: true,
showCaption: false,
showPreview: false,
showRemove: false,
showUpload: false,
showCancel: false,
showClose: false,
autoReplace: true,
dropZoneTitle: "请上传文件",
maxFileCount: 1
}).on("filebatchselected", function (event, files) { //默认上传
$(this).fileinput("upload");
})
.on("fileuploaded", function (event, data) { //上传回调事件
showPicture = 'https://img.zhengzai.tv/' + data.response.data.ossPath;
$("#viewImg").attr('src', showPicture)
})
function create() {
if (!$("#ActivityName").val() || !$("#ActivityType").val() || !showPicture || !$("#integral").val() || !$("#activityRule").val() || !$("#viewImg").attr('src')) {
return layer.msg('请将必填信息填写完整!')
}
if (timeType == 2) {
if (!$("#startTime").val() || !$("#endTime").val()) {
return layer.msg('请选择时间!')
}
} else {
$("#startTime").val("")
$("#endTime").val("")
}
if (activitySize) {
layer.msg("活动名称限制在20个字符以内!")
return
}
let flag = false;
data = data.map((item,index)=>{
if (!$("#prizeTitle"+index).val()||!$("#showPic"+index).attr('src')||!$("#showPicSelect"+index).attr('src')||!$("#winnersNum"+index).val()||!$("#prizeType"+index).val()||!$("#winningProbability"+index).val()||!$("#prizeNum"+index).val()) {
flag = true
} else {
item.prizeTitle = $("#prizeTitle"+index).val();
item.prizeImgInit = $("#showPic"+index).attr('src');
item.prizeImgSelect = $("#showPicSelect"+index).attr('src');
item.winnersNum = $("#winnersNum"+index).val();
item.prizeType = $("#prizeType"+index).val();
item.winningProbability = $("#winningProbability"+index).val();
item.prizeNum = $("#prizeNum"+index).val();
}
return {...item};
})
if (flag) {
return layer.msg('请将表格内容填写完整!')
}
let datas = {
activityImg: showPicture,
activityNum: $("#integral").val(),
activityRules: $("#activityRule").val(),
activityTitle: $("#ActivityName").val(),
activityType: 1,
expressFeeType: courierType,
integralActivityId: itemId || '',
endTime: $.common.dateFormat($("#endTime").val(), 'yyyy-MM-dd HH:mm:ss') , //
isOnline: online,
prizeList: data,
startTime: $.common.dateFormat($("#startTime").val(), 'yyyy-MM-dd HH:mm:ss'),
timeType: timeType
}
let url = '/sweet/integralActivity/create';
let type = 'post';
if (itemId) {
url = '/sweet/integralActivity/update'
type = 'put'
}
$.ajax({
type,
url,
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(datas),
success:function(res) {
layer.msg('' + res);
if (res.code != undefined && res.code != web_status.SUCCESS) {
$.modal.alertWarning(res.msg);
return [];
} else if (res.code == web_status.SUCCESS) {
$.operate.successTabCallback(res);
closeItem();
}
}
})
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('积分活动列表')"/> <th:block th:include="include :: header('快递模版列表')"/>
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>活动名称:</label>
<input type="text" name="activityTitle"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.addTab(1)" shiro:hasPermission="sweet:integralActivity:create"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="kylin:expressModule:create">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
</div> </div>
...@@ -37,73 +18,42 @@ ...@@ -37,73 +18,42 @@
</div> </div>
<th:block th:include="include :: footer"/> <th:block th:include="include :: footer"/>
<script th:inline="javascript"> <script th:inline="javascript">
var updateFlag = [[${@permission.hasPermi('sweet:integralActivity:create')}]]; var updateFlag = [[${@permission.hasPermi('kylin:expressModule:create')}]];
var isOnlineFlag = [[${@permission.hasPermi('sweet:integralActivity:isOnline')}]]; var isOnlineFlag = [[${@permission.hasPermi('kylin:expressModule:isOnline')}]];
var drawListFlag = [[${@permission.hasPermi('sweet:integralActivityDraw:list')}]];
var exportExcelFlag = [[${@permission.hasPermi('sweet:integralActivityDraw:export')}]];
var prefix = ctx + "sweet/integralActivity"; var prefix = ctx + "kylin/expressModule";
function exportExcel(integralActivityId) {
var data = {"ids": integralActivityId};
$.table.exportExcel("", data)
}
$(function () { $(function () {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
updateUrl: prefix + "/formView?id={id}", // /update/{id} updateUrl: prefix + "/update/{id}",
createUrl: prefix + "/formView", createUrl: prefix + "/create",
detailUrl: "/sweet/IntegralActivityDraw/listView/{id}", modalName: "快递模版",
exportUrl: "/sweet/IntegralActivityDraw/export",
modalName: "积分活动",
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
{ {
field: 'activityTitle', field: 'title',
title: '活动名称' title: '快件产品名称'
}, },
{ {
field: 'activityImg', field: 'productCode',
title: '活动图片', title: '产品编码'
formatter: function (value, row, index) {
return $.table.imageView(value, "300", "600");
}
}, },
{ {
field: 'activityType', field: 'agingType',
title: '活动类型', title: '时效类型'
formatter: function (value, row) {
var activityType = row.activityType;
if (row.activityType == 1) {
activityType = "转盘";
} else {
activityType = "未知";
}
return activityType;
}
},
{
field: 'prizeNum',
title: '奖品数量'
},
{
field: 'drawNum',
title: '已发出'
}, },
{ {
field: '', field: '',
title: '奖品剩余', title: '快递预估价',
formatter: function (value, row) { formatter: function (value, row, index) {
var prizeNum = row.prizeNum; return row.estimatePriceMin + ' ~ ' + row.estimatePriceMax;
var drawNum = row.drawNum;
return prizeNum - drawNum;
} }
}, },
{ {
field: 'isOnline', field: 'isOnline',
title: '活动状态', title: '状态',
formatter: function (value, row) { formatter: function (value, row) {
var isOnline = row.isOnline; var isOnline = row.isOnline;
if (row.isOnline == 1) { if (row.isOnline == 1) {
...@@ -123,20 +73,17 @@ ...@@ -123,20 +73,17 @@
align: 'center', align: 'center',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + drawListFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.integralActivityId + '\')"><i class="fa fa-edit"></i>查看抽奖名单</a> '); actions.push('<a class="btn btn-success btn-xs ' + updateFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.moduleId + '\')"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + updateFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.integralActivityId + '\')"></i>编辑</a> '); actions.push(`<a class="btn btn-danger btn-xs ${isOnlineFlag}" href="javascript:void(0)" onclick="openModal('${row.moduleId}','${row.isOnline}')"></i>上下线</a> `);
actions.push(`<a class="btn btn-danger btn-xs ${isOnlineFlag}" href="javascript:void(0)" onclick="openModal('${row.integralActivityId}','${row.isOnline}')"></i>上下线</a> `);
actions.push('<a class="btn btn-warning btn-xs ' + exportExcelFlag + '" href="javascript:void(0)" onclick="exportExcel(\'' + row.integralActivityId + '\')"></i>导出抽奖信息</a> ');
return actions.join(''); return actions.join('');
} }
}] }]
}; };
$.table.init(options); $.table.init(options);
}); });
function openModal(id, data) { function openModal(id, data) {
console.log(id, data, 'dhsa')
let title = ''; let title = '';
let lineId = null; let lineId = null;
if (data == 1) { if (data == 1) {
...@@ -149,10 +96,9 @@ ...@@ -149,10 +96,9 @@
$.modal.confirm(`确定要${title}此活动吗`, function() { $.modal.confirm(`确定要${title}此活动吗`, function() {
$.ajax({ $.ajax({
type: 'put', type: 'put',
url: '/sweet/integralActivity/isOnline', url: '/kylin/expressModule/isOnline',
data: {integralActivityId: id, isOnline: lineId}, data: {expressModuleId: id, isOnline: lineId},
success:function(e) { success:function(e) {
console.log(e)
$("button[name=refresh]").click(); $("button[name=refresh]").click();
} }
}) })
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('编辑快递模版')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-post-add">
<div class="form-group">
<label class="col-sm-2 control-label is-required">快件产品名称:</label>
<div class="col-sm-10">
<input th:value="${KylinExpressModule.title}" class="form-control" type="text" name="title"
id="title" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">快件产品名称:</label>
<div class="col-sm-10">
<input th:value="${KylinExpressModule.productCode}" class="form-control" type="number" name="productCode"
id="productCode" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">时效类型:</label>
<div class="col-sm-10">
<input th:value="${KylinExpressModule.agingType}" class="form-control" type="text" name="agingType"
id="agingType" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">快递预估价格小:</label>
<div class="col-sm-10">
<input th:value="${KylinExpressModule.estimatePriceMin}" class="form-control" type="number" name="estimatePriceMin"
id="estimatePriceMin" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">快递预估价格大:</label>
<div class="col-sm-10">
<input th:value="${KylinExpressModule.estimatePriceMax}" class="form-control" type="number" name="estimatePriceMax"
id="estimatePriceMax" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否上线</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="1" name="isOnline"
th:checked="${KylinExpressModule.isOnline==1 ? true : false}"> <i></i> 未上线
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="2" name="isOnline"
th:checked="${KylinExpressModule.isOnline==2 ? true : false}"> <i></i> 已上线
</label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
var prefix = ctx + "kylin/expressModule";
var moduleId = "[[${KylinExpressModule.moduleId}]]";
function submitHandler() {
if ($.validate.form()) {
var data = $('#form-post-add').serializeArray();
data.push({"name": "moduleId", "value": moduleId});
$.operate.save(prefix + "/update", data);
}
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment