| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- <?php use common\widgets\UeditorWidget; ?>
- <?php
- use backend\widgets\TabWidget;
- echo TabWidget::widget(['list' => $this->context->menuList, 'currentMenu' => $this->context->id]);
- ?>
- <div class="panel panel-default">
- <?php
- use backend\widgets\SubTabWidget;
- echo SubTabWidget::widget(['list' => $this->context->subMenuList, 'currentMenu' => $this->context->action->id]);
- ?>
- <div class="panel-body">
- <form role="form" class="form-horizontal">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="field-4">*涨价方式</label>
- <div class="col-sm-10">
- <?php foreach ($riseTypeName as $riseKey => $riseVal) { ?>
- <div class="radio-inline">
- <label> <input type="radio" <?php if ($set['riseType'] == $riseKey) {
- echo 'checked';
- } ?> name="riseType" value="<?= $riseKey ?>">
- <?= $riseVal ?>
- </label>
- </div>
- <?php } ?>
- </div>
- </div>
- <div name="riseArea">
- <div class="form-group">
- <label class="col-sm-2 control-label">*涨价时段:</label>
- <div class="col-sm-10">
- <input type="text" id="startTime" <?php if (!empty($set['startRiseTime'])) {
- echo 'checkStatus="yes"';
- } ?> value="<?php if (!empty($set['startRiseTime'])) {
- echo date("Y-m-d H:i:s", $set['startRiseTime']);
- } ?>" style="width:40%;display:inline-block;" class="form-control" name="startTime" placeholder="请填写开始时间">
- <input type="text" id="endTime" <?php if (!empty($set['endRiseTime'])) {
- echo 'checkStatus="yes"';
- } ?> value="<?php if (!empty($set['endRiseTime'])) {
- echo date("Y-m-d H:i:s", $set['endRiseTime']);
- } ?>" style="width:40%;display:inline-block;" class="form-control" name="endTime" placeholder="请填写结束时间">
- <p></p>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">*涨价金额:</label>
- <div class="col-sm-10">
- <input type="text" class="form-control" value="<?= $set['riseAmount'] ?>" name="riseAmount" placeholder="全部商品上涨20%请填写20,上涨100元请填写100">
- <p></p>
- </div>
- </div>
- </div>
- <div class="form-group-separator"></div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="field-3">*商品简要说明:</label>
- <div class="col-sm-10">
- <?= UeditorWidget::widget(['name' => 'goodSIntroduce', 'content' => $set['goodSIntroduce']]); ?>
- <p></p>
- </div>
- </div>
- <div class="form-group-separator"></div>
- <div class="form-group" style="text-align:center;">
- <button type="button" onclick="setSubmit('click',this)" class="btn btn-info btn-single">确认</button>
- <button type="button" onclick="history.go(-1);" class="btn btn-info btn-single">返回</button>
- </div>
- </form>
- </div>
- </div>
- <!-- footer -->
- <?php
- use backend\widgets\FooterWidget;
- ?>
- <?= FooterWidget::widget() ?>
- <!-- footer -->
- <script>
- //验证流程
- var startTime = $("input[name=startTime]");
- var endTime = $("input[name=endTime]");
- var riseAmount = $("input[name=riseAmount]");
- var goodSIntroduce = $("textarea[name=goodSIntroduce]");
- var needValidate = [];
- var riseType = <?php echo isset($set['riseType']) && strlen($set['riseType']) > 0 ? $set['riseType'] : 0; ?>;//不涨价
- <?php if($set['riseType'] == $noRise){ ?>
- $("div[name=riseArea]").css("display", "none");
- <?php }else{ ?>
- needValidate = [riseAmount];
- $("div[name=riseArea]").css("display", "block");
- <?php } ?>
- $(":radio[name=riseType]").click(function () {
- riseType = $(":radio[name=riseType]:checked").val();
- needValidate = [];
- if (riseType == <?= $noRise ?>) {//如果涨价再开启验证
- $("div[name=riseArea]").css("display", "none");
- } else {
- needValidate = [riseAmount];
- $("div[name=riseArea]").css("display", "block");
- }
- });
- setStats(riseAmount, '请填写涨价金额或百分数', function (val, mess) {
- var info = [false, mess];
- if (getLength(val) > 0) {
- info[0] = true;
- info[1] = '填写正确';
- if (Math.floor(val) != val) {
- info[0] = false;
- info[1] = '请填写整数';
- }
- }
- return info;
- });
- UE.getEditor('goodSIntroduce').addListener("focus", function (type, event) {
- goodSIntroduce.removeAttr('checkStatus');
- goodSIntroduce.siblings('p').removeClass('help-error-mention').html('');
- goodSIntroduce.parent().parent().removeClass("has-success").removeClass('has-error');
- })
- UE.getEditor('goodSIntroduce').addListener("blur", function (type, event) {
- var goodSIntroduceVal = UE.getEditor('goodSIntroduce').getContent();
- if (getLength(goodSIntroduceVal) > 0) {
- goodSIntroduce.attr('checkStatus', 'yes');
- goodSIntroduce.siblings('p').removeClass('help-error-mention').html('');
- goodSIntroduce.parent().parent().addClass("has-success").removeClass("has-error");
- } else {
- goodSIntroduce.attr('checkStatus', 'no');
- goodSIntroduce.siblings('p').addClass('help-error-mention').html('简要说明不能为空');
- goodSIntroduce.parent().parent().addClass("has-error").removeClass("has-success");
- }
- });
- function setSubmit() {
- var verifyStatus = true;
- for (var m = 0; m < needValidate.length; m++) {
- var singleObj = needValidate[m];
- if (singleObj.attr('checkStatus') == undefined) {
- singleObj.blur();
- }
- if (singleObj.attr('checkStatus') == 'no') {
- verifyStatus = false;
- continue;
- }
- }
- if (riseType == <?= $noRise ?>) {//要涨价
- if (startTime.attr('checkStatus') == undefined || startTime.attr('checkStatus') == 'no') {
- verifyStatus = false;
- startTime.attr('checkStatus', 'no');
- startTime.siblings('p').addClass('help-error-mention').html('请填写开始时间');
- startTime.parent().parent().addClass("has-error").removeClass("has-success");
- }
- if (endTime.attr('checkStatus') == undefined || endTime.attr('checkStatus') == 'no') {
- verifyStatus = false;
- endTime.attr('checkStatus', 'no');
- endTime.siblings('p').addClass('help-error-mention').html('请填写结束时间');
- endTime.parent().parent().addClass("has-error").removeClass("has-success");
- }
- }
- <?php
- if(!empty($set['goodSIntroduce'])){
- ?>
- goodSIntroduce.attr('checkStatus', 'yes');
- <?php } ?>
- if (goodSIntroduce.attr('checkStatus') == undefined || goodSIntroduce.attr('checkStatus') == 'no') {
- goodSIntroduce.attr('checkStatus', 'no');
- goodSIntroduce.siblings('p').addClass('help-error-mention').html('简要说明不能为空');
- goodSIntroduce.parent().parent().addClass("has-error").removeClass("has-success");
- verifyStatus = false;
- }
- if (verifyStatus == false) {
- return;
- }
- var data = "&_csrf=<?= Yii::$app->request->csrfToken ?>&startRiseTime=" + startTime.val() + '&endRiseTime=' + endTime.val() + "&";
- data += "goodSIntroduce=" + goodSIntroduce.val() + "&riseType=" + riseType + "&riseAmount=" + riseAmount.val();
- $.ajax({
- type: "POST",
- url: '/goods/setting-replace',
- data: data,
- dataType: 'json',
- async: false,
- success: function (data) {
- xhPopMsg(data.msg, 1300);
- if (data.code == 'A0001') {
- }
- }
- });
- }
- function setStats(obj, mess, check) {
- obj.focus(function () {
- $(this).removeAttr('checkStatus');
- $(this).siblings('p').removeClass('help-error-mention').html('');
- $(this).parent().parent().removeClass("has-success").removeClass('has-error');
- });
- obj.blur(function () {
- var objVal = obj.val();
- var info = check(objVal, mess);
- if (info[0]) {
- $(this).attr('checkStatus', 'yes');
- $(this).siblings('p').removeClass('help-error-mention').html('');
- $(this).parent().parent().addClass("has-success").removeClass("has-error");
- } else {
- $(this).attr('checkStatus', 'no');
- $(this).siblings('p').addClass('help-error-mention').html(info[1]);
- $(this).parent().parent().addClass("has-error").removeClass("has-success");
- }
- });
- }
- //选择创建时间
- $(function () {
- var currYear = (new Date()).getFullYear();
- var opt = {};
- opt.date = {preset: 'date'};
- opt.datetime = {preset: 'datetime'};
- opt.time = {preset: 'time'};
- opt.default = {
- theme: 'android-ics light', //皮肤样式
- display: 'modal', //显示方式
- mode: 'scroller', //日期选择模式
- lang: 'zh',
- dateFormat: 'yy-mm-dd',
- showNow: true,
- nowText: "今天",
- startYear: currYear - 10, //开始年份
- endYear: currYear + 10 //结束年份
- };
- var optDateTime = $.extend(opt['datetime'], opt['default']);
- $("#startTime").mobiscroll(optDateTime).datetime(optDateTime).bind("change", function (e) {
- $("#startTime").attr('checkStatus', 'yes');
- $("#startTime").siblings('p').removeClass('help-error-mention').html('');
- $("#startTime").parent().parent().addClass("has-success").removeClass("has-error");
- });
- $("#endTime").mobiscroll(optDateTime).datetime(optDateTime).bind("change", function (e) {
- $("#endTime").attr('checkStatus', 'yes');
- $("#endTime").siblings('p').removeClass('help-error-mention').html('');
- $("#endTime").parent().parent().addClass("has-success").removeClass("has-error");
- });
- });
- </script>
|