123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- <%@ page import="java.util.Date" %>
- <%@ page contentType="text/html;charset=UTF-8" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
- <html>
- <head>
- <title>优惠券管理</title>
- <meta name="decorator" content="default"/>
- <script type="text/javascript">
- $(document).ready(function () {
- //$("#name").focus();
- $("#inputForm").validate({
- submitHandler: function (form) {
- var couponAmount = $("#couponAmount").val();
- var touchPrice = $("#touchPrice").val();
- if (couponAmount >= touchPrice) {
- alertx("优惠券金额必须小于优惠条件金额");
- return false;
- }
- var startDate = $("#startDate").val();
- var endDate = $("#endDate").val();
- if (startDate >= endDate) {
- alertx("结束时间不能早于开始时间");
- return false;
- }
- var userId = $("#userId").val();
- if (userId == null || userId == "") {
- alertx("请选择机构");
- return false;
- }
- loading('正在提交,请稍等...');
- form.submit();
- },
- errorContainer: "#messageBox",
- errorPlacement: function (error, element) {
- $("#messageBox").text("输入有误,请先更正。");
- if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
- error.appendTo(element.parent().parent());
- } else {
- error.insertAfter(element);
- }
- }
- });
- });
- </script>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2">用户专享券</a></li>
- <li class="active"><a
- href="${ctx}/coupon/cmCoupon/form?couponType=2&id=${cmCoupon.id}">${not empty cmCoupon.id?'编辑':'添加'}</a>
- </li>
- </ul>
- <br/>
- <font style="color: red;margin-left: 20px">用户专享券适合在需要给特定客户返利时创建,并且适用于商城全部商品(不包括二手商品)。</font><br><br>
- <form:form id="inputForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/save" method="post" class="form-horizontal">
- <form:hidden path="id"/>
- <form:hidden path="productInfo" id="productInfo"/>
- <input type="hidden" name="couponType" value="2"/>
- <sys:message content="${message}"/>
- <div class="control-group">
- <label class="control-label"><font color="red">*</font>机构:</label>
- <div class="controls">
- <a href="javascript:void(0);" onclick="showSelect()" id="chooseClub">请选择机构</a>
- <input type="hidden" name="userId" id="userId" value="${cmCoupon.userId}">
- <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
- <thead>
- <tr>
- <th>机构名称</th>
- <th>机构简称</th>
- <th>联系人</th>
- <th>手机号</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody id="hotSearch"></tbody>
- </table>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label"><font color="red">*</font>优惠券金额:</label>
- <div class="controls">
- <input type="number" id="couponAmount" name="couponAmount" value="${cmCoupon.couponAmount}" min="0"
- required>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label"><font color="red">*</font>优惠条件:</label>
- <div class="controls">
- 订单商品总额满 <input type="number" name="touchPrice" id="touchPrice"
- value="${cmCoupon.touchPrice}" min="0" required>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label"><font color="red">*</font>开始时间:</label>
- <div class="controls">
- <input name="startDate" id="startDate" type="text" required readonly="readonly" maxlength="20"
- class="input-medium Wdate "
- value="<fmt:formatDate value="${cmCoupon.startDate}" pattern="yyyy-MM-dd 00:00:00"/>"
- onclick="WdatePicker({dateFmt:'yyyy-MM-dd 00:00:00',isShowClear:false});"/>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label"><font color="red">*</font>结束时间:</label>
- <div class="controls">
- <input name="endDate" id="endDate" type="text" required readonly="readonly" maxlength="20"
- class="input-medium Wdate "
- value="<fmt:formatDate value="${cmCoupon.endDate}" pattern="yyyy-MM-dd 23:59:59"/>"
- onclick="WdatePicker({dateFmt:'yyyy-MM-dd 23:59:59',isShowClear:false});"/>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label"><font color="red">*</font>优惠状态:</label>
- <div class="controls">
- <label id="initializeShow">
- <c:if test="${empty cmCoupon.status || cmCoupon.status eq 0}">
- <font color="#800080">未生效</font>
- </c:if>
- <c:if test="${cmCoupon.status eq 1}">
- <font color="#00CC66">已生效</font>
- </c:if>
- <c:if test="${cmCoupon.status eq 2}">
- <font color="red">已关闭</font>
- </c:if>
- <c:if test="${cmCoupon.status eq 3}">
- <font color="#FF6600">已失效</font>
- </c:if>
- </label>
- <label id="closeShow" style="display: none">
- <font color="red">已关闭</font>
- </label>
- <input type="hidden" id="hiddenStatus" name="status" value="">
- <input type="checkbox" id="status" name="status" value="2" ${cmCoupon.status eq "2" ? "checked" : ""}
- onclick="statusShow()"/>关闭
- </div>
- </div>
- <c:if test="${not empty cmCoupon.id}">
- <div class="control-group">
- <label class="control-label">领取状态:</label>
- <div class="controls">
- </div>
- </div>
- <div class="control-group">
- <label class="control-label">使用状态:</label>
- <div class="controls">
- </div>
- </div>
- </c:if>
- <div class="form-actions">
- <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
- <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
- </div>
- </form:form>
- <script>
- $(function () {
- if (${not empty cmUser}){
- var items = {
- "userID": "${cmUser.userID}",
- "name": "${cmUser.name}",
- "shortName": "${cmUser.shortName}",
- "linkMan": "${empty cmUser.userName ? '':cmUser.userName}",
- "contractMobile": "${empty cmUser.bindMobile ? '':cmUser.bindMobile}"
- };
- insertHtml(items);
- }
- });
- function insertHtml(data) {
- var html = '<tr>' +
- '<td>' +
- data.name +
- '</td>' +
- '<td>' +
- data.shortName +
- '</td>' +
- '<td>' +
- data.linkMan +
- '</td>' +
- '<td>' +
- data.contractMobile +
- '</td>' +
- '<td>' +
- '<a href="javascript:;" onclick="deleteClub()">删除</a>' +
- '</td>' +
- '</tr>';
- $("#contentTable").show();
- $("#chooseClub").hide();
- $("#hotSearch").html(html);
- $("#userId").val(data.userID);
- }
- function deleteClub() {
- $("#hotSearch").html("");
- $("#contentTable").hide();
- $("#chooseClub").show();
- $("#userId").val("");
- }
- function statusShow() {
- var status = $("input[name='status']:checked").val();
- if (status == 2) {
- $("#initializeShow").hide();
- $("#closeShow").show();
- } else {
- $("#initializeShow").show();
- $("#closeShow").hide();
- $("#hiddenStatus").val(0);
- }
- }
- //点击添加
- function showSelect() {
- var url = "${ctx}/coupon/cmCoupon/toAddClub";
- var title = '';
- title = "选择机构";
- top.$.jBox("iframe:" + url, {
- iframeScrolling: 'yes',
- width: $(top.document).width() - 400,
- height: $(top.document).height() - 160,
- persistent: true,
- title: title,
- buttons: {"确定": '1', "取消": '-1'},
- submit: function (v, h, f) {
- //确定
- var $jboxFrame = top.$('#jbox-iframe');
- var $mainFrame = top.$('#mainFrame');
- if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
- var items = $jboxFrame[0].contentWindow.getCheckedItems();
- console.log(items);
- insertHtml(items);
- }
- return true;
- }
- });
- }
- /**
- * @param obj
- * jquery控制input只能输入数字
- */
- function onlynum(obj) {
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
- }
- </script>
- </body>
- </html>
|