From 8c55ab2701c99cec16eff92a26fefdf77fcdd28f Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期一, 25 九月 2023 16:17:44 +0800
Subject: [PATCH] app接口修改

---
 cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js |  738 ++++++++++++++++++++++++++++++--------------------------
 1 files changed, 396 insertions(+), 342 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
index d4f5247..467b12e 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js
@@ -4,7 +4,8 @@
 var couponInfoDlg = {
     couponInfoData: {},
     goodsPicArray: [], //商品图片数组
-    goodsCover: '' //商品封面图
+    goodsCover: '', //商品封面图
+    storeIds: [],
 };
 
 /**
@@ -42,22 +43,6 @@
     parent.layer.close(window.parent.TCoupon.layerIndex);
 }
 
-function ajax(serverCouponId, value, remark) {
-    var ajax = new $ax(Feng.ctxPath + "/couponServer/examine", function (data) {
-        Feng.success("审核成功!");
-        window.parent.TCoupon.table.refresh();
-        couponInfoDlg.close();
-    }, function (data) {
-        Feng.error("审核失败!" + data.responseJSON.message + "!");
-    });
-    ajax.setData({
-        couponServerId: serverCouponId,
-        state: value,
-        remark: remark
-    });
-    ajax.start();
-}
-
 
 /**
  * 兑换方式1
@@ -90,31 +75,32 @@
 }
 
 /**
- * 全部用户
- */
-function userGroup1() {
-    $("#demo2").show()
-}
-
-/**
- * 年度会员
- */
-function userGroup2() {
-    $("#demo2").show()
-}
-
-/**
- * 已有学员用户
- */
-function userGroup3() {
-    $("#demo2").show()
-}
-/**
  * 全国通用
  */
 function scopeOfApplication1() {
     $("#storeSelect").hide();
     $("#citySelect").hide();
+
+    //移除指定门店的数据:
+    // 找到 tbody 元素
+    var tbody = document.getElementById("coun");
+
+    // 移除所有子元素(即行)
+    while (tbody.firstChild) {
+        tbody.removeChild(tbody.firstChild);
+    }
+    couponInfoDlg.storeIds = [];
+
+    //移除指城市的数据:
+    num = 0;
+    var cityDemoDiv = document.getElementById("cityDemo");
+
+    cityDemoDiv.innerHTML = ""; // 将内容置为空字符串
+    var provinceSelect = document.getElementById("provinceData");
+    var cityDataSelect = document.getElementById("cityData");
+    provinceSelect.innerHTML = '<option value="">请选择</option>';
+    cityDataSelect.innerHTML = '<option value="">请选择</option>';
+    getProvince(null);
 }
 /**
  * 指定城市
@@ -122,6 +108,18 @@
 function scopeOfApplication2() {
     $("#storeSelect").hide();
     $("#citySelect").show();
+
+    //移除指定门店的数据:
+    // 找到 tbody 元素
+    var tbody = document.getElementById("coun");
+    // 移除所有子元素(即行)
+    while (tbody.firstChild) {
+        tbody.removeChild(tbody.firstChild);
+    }
+    couponInfoDlg.storeIds = [];
+
+
+
 }
 /**
  * 指定门店
@@ -129,6 +127,19 @@
 function scopeOfApplication3() {
     $("#storeSelect").show();
     $("#citySelect").hide();
+
+    //移除指城市的数据:
+    num = 0;
+    var cityDemoDiv = document.getElementById("cityDemo");
+
+    cityDemoDiv.innerHTML = ""; // 将内容置为空字符串
+    var provinceSelect = document.getElementById("provinceData");
+    var cityDataSelect = document.getElementById("cityData");
+    provinceSelect.innerHTML = '<option value="">请选择</option>';
+    cityDataSelect.innerHTML = '<option value="">请选择</option>';
+    getProvince(null);
+
+
 }
 
 /**
@@ -178,84 +189,295 @@
 }
 
 
+function changeCity(n){
 
+    var provinceSelect = null;
+    if (n === undefined || n === null || n === ''){
+        provinceSelect = document.getElementById("provinceData");
+    }else {
+        provinceSelect = document.getElementById("provinceData"+n);
+    }
 
-couponInfoDlg.addBranch = function () {
+    var citySelect = null;
+    if (n === undefined || n === null || n === ''){
+        citySelect = document.getElementById("cityData");
+    }else {
+        citySelect = document.getElementById("cityData"+n);
+    }
 
-    let companies = [];
-    let brands = [];
-    $.ajax({
-        url : Feng.ctxPath + "/tbMemberTag/getCompanyAndBranch",
-        method:'POST',
-        success:function (res) {
-            companies = res.companies;
-            brands = res.brands;
+    var selectedProvince = provinceSelect.value;
+    // 清空城市下拉框
+    citySelect.innerHTML = '<option value="">请选择</option>';
+    if (selectedProvince === "") {
+        return;
+    }
+    var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity", function(data){
+        data.forEach(province => {
+            var option = document.createElement("option");
+            option.value = province.id;  // 根据你的数据结构确定省份的id字段
+            option.text = province.name;  // 根据你的数据结构确定省份的name字段
+            citySelect.appendChild(option);
+        });
+    },function(data){
+        console.log('data:',data)
+        Feng.error("获取失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set('province',selectedProvince);
+    ajax.start();
+}
 
-            var str = "                            <div class=\"col-sm-12\">\n" +
-                "                                <label class=\"col-sm-1\">公司</label>\n" +
-                "                                <select class=\"col-sm-2\" id=\"brandCompany\" name='brandCompany' style=\"width: 88px\">\n" +
-                "                                    <option value=\"\">全部公司</option>\n";
-            if (companies.length > 0) {
-                for (let i = 0; i < companies.length; i++) {
-                    str += '<option value="'+companies[i].id+'">'+companies[i].name+'</option>'
-                }
-            }
-            str+= "                                </select>\n" +
-                "                                <label class=\"col-sm-1\">品牌</label>\n" +
-                "                                <select class=\"col-sm-2\" id=\"brandName\" name='brandName' style=\"width: 88px\">\n" +
-                "                                    <option value=\"\">全部品牌</option>\n";
-            if (brands.length > 0) {
-                for (let i = 0; i < brands.length; i++) {
-                    str += '<option value="' + brands[i].id + '">' + brands[i].name + '</option>';
-                }
-            }
-            str += "                                </select>\n" +
-                "                                <div class=\"col-sm-2\">\n" +
-                "                                    <input class=\"form-control\" id=\"brandDays\" name='brandDays' placeholder=\"近30天\" type=\"number\" min=\"1\"\n" +
-                "                                           max=\"31\">\n" +
-                "                                </div>\n" +
-                "                                <select class=\"col-sm-2\" id=\"brandSymbol\" name='brandSymbol' style=\"width: 88px\">\n" +
-                "                                    <option value=\"1\"> =</option>\n" +
-                "                                    <option value=\"2\"> ></option>\n" +
-                "                                    <option value=\"3\"> <</option>\n" +
-                "                                </select>\n" +
-                "                                <div class=\"col-sm-2\">\n" +
-                "                                    <input class=\"form-control\" id=\"brandCount\" name='brandCount' placeholder=\"次\">\n" +
-                "                                </div>\n" +
-                "                                <div class=\"col-sm-1\">\n" +
-                "                                    <label id=\"addBranch\" onclick='TbMemberTagInfoDlg.addBranch()' class=\"form-control\" style=\"border: 0px;cursor: pointer\"><i class=\"fa fa-plus\"></i></label>\n" +
-                "                                </div>\n" +
-                "                                <div class=\"col-sm-1\">\n" +
-                "                                    <label id=\"addBranch\" onclick='TbMemberTagInfoDlg.subtract(this)' class=\"form-control\" style=\"border: 0px;cursor: pointer\"><i class=\"fa fa-minus\"></i></label>\n" +
-                "                                </div>\n" +
-                "                            </div>";
-            $("#branch").append($(str));
+function getProvince(n){
+    var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){
+        var provinceSelect = null;
+        if (n === undefined || n === null || ''){
+            provinceSelect = document.getElementById("provinceData");
+        }else {
+            provinceSelect = document.getElementById("provinceData"+n);
         }
-    })
+        data.forEach(province => {
+            var option = document.createElement("option");
+            option.value = province.id;  // 根据你的数据结构确定省份的id字段
+            option.text = province.name;  // 根据你的数据结构确定省份的name字段
+            provinceSelect.appendChild(option);
+        });
+    },function(data){
+        Feng.error("下拉失败!" + data.responseJSON.message + "!");
+    });
+    ajax.start();
+}
+
+function storeList(){
+    var index = layer.open({
+        type: 2,
+        title: '门店列表',
+        area: ['80%', '80%'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/tCouponManage/storeList'
+    });
+    this.layerIndex = index;
 }
 
 
-couponInfoDlg.delete = function () {
+let num = 0;
+couponInfoDlg.addBranch = function () {
+    num = num+1;
+    var a= "";
+    a = "<div style=\'margin-left: 25%\' class=\"col-sm-9 control-label\">\n" +
+        "                            <select class=\"col-sm-1\"  id=\'provinceData"+num+"\' style=\"margin-top: 1%;width: 25%\" onchange=\'changeCity("+num+")\'>\n" +
+        "                                <option value=\"\">请选择</option>\n" +
+        "                            </select>\n" +
+        "                            <label class=\"col-sm-1\"  style=\"width: 9%;margin-top: 7px\">省</label>\n" +
+        "                            <select  class=\"col-sm-1\" style=\"margin-top: 1%;width: 25%\" id=\'cityData"+num+"\'>\n" +
+        "                                <option value=\"\">请选择</option>\n" +
+        "                            </select>\n" +
+        "                            <label class=\"col-sm-1\" style=\"width: 7%;margin-top: 7px\">市</label>\n" +
+        "                            <label name=\"addBranch\" class=\"col-sm-1\" onclick=\"couponInfoDlg.delete(this)\" style=\"border: 0px;cursor: pointer;margin-top: 1%\"><i class=\"fa fa-trash\"></i></label>"+
+        "                        </div>";
+    $("#cityDemo").append($(a));
+    getProvince(num);
+}
 
+
+couponInfoDlg.selecUserOpt = function (arrays){
+    //获取所有的值
+    var subArr= this.storeIds;
+    $(".timeClass").each(function () {
+        subArr.push($(this).find("input[name*='id']").val());
+    });
+    var str = '';
+    for(var i in arrays){
+        var b = true;
+        for(var j in subArr){
+            if(arrays[i].id === Number(subArr[j])){
+                b = false;
+                break
+            }
+        }
+        if(b){
+            str += '<tr class="timeClass">' +
+                '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="provinceCity" name="provinceCity" value="'+arrays[i].provinceCity+'">' + arrays[i].provinceCity + '</td>' +
+                '<td><input type="hidden" id="accountName" name="accountName" value="'+arrays[i].accountName+'">' + arrays[i].accountName + '</td>' +
+                '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
+            this.storeIds.push(arrays[i].id);
+        }
+    }
+    $("#coun").append(str);
+}
+
+function deleteSub(e) {
+    var row = $(e).closest('tr');
+    var value = row.find('#id').val();
+    couponInfoDlg.storeIds.splice(couponInfoDlg.storeIds.indexOf(parseInt(value)), 1)
+    $(e).parent().parent().remove();
+}
+
+
+couponInfoDlg.delete = function (o) {
+    $(o).parent("div").remove()
 }
 
 /**
- * 关闭此对话框
+ * 提交
  */
-couponInfoDlg.addSubmitCoupon = function () {
-    var value = $('input:radio:checked').val();
-    let couponServerId = $("#serverCouponId").val();
-    let remark = $('#detail').val()
-    if (value == 1) {
-        //提交信息
-        ajax(couponServerId, value, remark)
-    } else {
-        if (!remark) {
-            Feng.error("请输入拒绝理由!");
-            return;
-        }
-        ajax(couponServerId, value, remark)
+couponInfoDlg.addSubmit = function () {
+
+    var cityIds = [];
+    // 优惠券名称
+    var couponName = $('#name').val();
+    if (couponName === undefined || couponName === '' || couponName === null){
+        return Feng.error('优惠券名称不能为空');
     }
+    // 优惠券类型
+    let prescription = $(":radio[name='prescription']:checked").val();
+    // 满xx金额
+    let conditionalAmount = $('#conditionalAmount').val();
+    // 减xx金额
+    let deductionAmount = $('#deductionAmount').val();
+    // 可抵扣xx金额
+    let voucherAmount = $('#voucherAmount').val();
+    // 体验券名称
+    let experienceName = $('#experienceName').val();
+    if (prescription === '1'){
+        if (conditionalAmount === undefined || conditionalAmount === '' || conditionalAmount === null){
+            return Feng.error('条件金额不能为空');
+        }
+        if (deductionAmount === undefined || deductionAmount === '' || deductionAmount === null){
+            return Feng.error('减扣金额不能为空');
+        }
+    }
+    if (prescription === '2'){
+        if (voucherAmount === undefined || voucherAmount === '' || voucherAmount === null){
+            return Feng.error('抵扣金额不能为空');
+        }
+    }
+    if (prescription === '3'){
+        if (experienceName === undefined || experienceName === '' || experienceName === null){
+            return Feng.error('体验券名称不能为空');
+        }
+    }
+
+
+    // 说明
+    var illustrate = $('#illustrate').val();
+    if (illustrate === undefined || illustrate === '' || illustrate === null){
+        return Feng.error('优惠券说明不能为空');
+    }
+    // 发放方式
+    let distributionMethod = $(":radio[name='distributionMethod']:checked").val();
+    if (distributionMethod === undefined || distributionMethod === '' || distributionMethod === null){
+        return Feng.error('发放方式不能为空');
+    }
+    // 所需积分
+    var requiredPoints = $('#requiredPoints').val();
+    // 所需现金
+    var requiredCash = $('#requiredCash').val();
+    // 用户人群
+    let userGroup = $(':radio[name="userGroup"]:checked').val();
+
+    // 发放数量
+    var quantityIssued = $('#quantityIssued').val();
+    if (quantityIssued === undefined || quantityIssued === '' || quantityIssued === null){
+        return Feng.error('发放数量不能为空');
+    }
+    // 限领数量
+    var pickUpQuantity = $('#pickUpQuantity').val();
+    if (pickUpQuantity === undefined || pickUpQuantity === '' || pickUpQuantity === null){
+        return Feng.error('限领数量不能为空');
+    }
+    // 有效期
+    var periodOfValidity = $('#periodOfValidity').val();
+    if (periodOfValidity === undefined || periodOfValidity === '' || periodOfValidity === null){
+        return Feng.error('有效期不能为空');
+    }
+    // 兑换方式
+    let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val();
+    if (exchangeMethod === '' || exchangeMethod === undefined || exchangeMethod === null){
+        return Feng.error('兑换方式不能为空');
+    }
+    if (exchangeMethod === '1'){
+        if (requiredPoints === undefined || requiredPoints === '' || requiredPoints === null){
+            return Feng.error('所需积分不能为空');
+        }
+    }
+    if (exchangeMethod === '2'){
+        if (requiredPoints === undefined || requiredPoints === '' || requiredPoints === null){
+            return Feng.error('所需积分不能为空');
+        }
+        if (requiredCash === undefined || requiredCash === '' || requiredCash === null){
+            return Feng.error('所需现金不能为空');
+        }
+    }
+    if (exchangeMethod === '3'){
+        if (requiredCash === undefined || requiredCash === '' || requiredCash === null){
+            return Feng.error('所需现金不能为空');
+        }
+    }
+
+    let company = $(':radio[name="company"]:checked').val();
+    var cts = "";
+    if (company === '2'){
+        var myselect=document.getElementById('cityData');
+        var seCity = myselect.options[myselect.selectedIndex].value;
+        if (seCity === null || seCity === undefined || seCity === ''){
+            return Feng.error('请选中一个省市');
+        }
+        cityIds.push(seCity);
+        if (num > 0){
+            for (let i = 1; i <= num; i++) {
+                var insSelect=document.getElementById('cityData'+i);
+                var inData = insSelect.options[insSelect.selectedIndex].value;
+                if (inData !== undefined || inData !== null ||  inData !== ''){
+                    cityIds.push(inData);
+                }
+            }
+            cts = cityIds.join(',');
+        }
+    }
+
+    const commaSeparatedString = this.goodsPicArray.join(',');
+
+    var stores = "";
+    if (company === '3'){
+        console.log('3---this.storeIds',this.storeIds);
+        if (couponInfoDlg.storeIds.length === 0 ){
+            return Feng.error('请至少选择一个门店');
+        }
+        stores = this.storeIds.join(',');
+        console.log('stores--===--',stores)
+    }
+    //提交信息
+    var ajax = new $ax(Feng.ctxPath + "/tCouponManage/commitData", function (data) {
+        Feng.success("添加成功!");
+        window.parent.TCoupon.table.refresh();
+        couponInfoDlg.close();
+    }, function (data) {
+        Feng.error("添加失败!" + data.responseJSON.message + "!");
+    });
+    ajax.set("userType",1);
+    ajax.set("cityManagerId",1);
+    ajax.set("couponName",couponName);
+    ajax.set("prescription",prescription);
+    ajax.set("condition",conditionalAmount);
+    ajax.set("subtraction",deductionAmount);
+    ajax.set("discount",voucherAmount);
+    ajax.set("experience",experienceName);
+    ajax.set("illustrate",illustrate);
+    ajax.set("distributionMethod",distributionMethod);
+    ajax.set("requiredPoints",requiredPoints);
+    ajax.set("requiredCash",requiredCash);
+    ajax.set("userGroup",userGroup);
+    ajax.set("quantityIssued",quantityIssued);
+    ajax.set("pickUpQuantity",pickUpQuantity);
+    ajax.set("periodOfValidity",periodOfValidity);
+    ajax.set("exchangeMethod",exchangeMethod);
+    ajax.set("goodImg",this.goodsCover);
+    ajax.set("goodImgs",commaSeparatedString);
+    ajax.set("company",company);
+    ajax.set("cityIds",cts);
+    ajax.set("storeIds",stores);
+    ajax.start();
+
 }
 
 /**
@@ -285,248 +507,80 @@
         .set('useTimes');
 }
 
-function couponCheck() {
-    if ($("#couponType").val() == 6) {
-        $("#couponName1").show()
-    } else {
-        $("#couponName1").hide()
-    }
-}
-
-function checkCouponTimes() {
-    if ($("#inlineCheckbox").prop('checked')) {
-        $("#couponTimes").prop("disabled", true)
-        $("#couponTimes").val('')
-    } else {
-        $("#couponTimes").prop("disabled", false)
-    }
-}
-
-/**
- * 提交添加
- */
-couponInfoDlg.addSubmit = function () {
-    this.clearData();
-    this.collectData();
-
-    let times = 1;
-    if ($("#inlineCheckbox").get(0).checked) {
-        times = 0
-    } else {
-        let times1 = $("#couponTimes").val();
-        times = times1 != '' ? times1 : 1;
-        if (times > 100) {
-            Feng.error("服务次数最多为100次!")
-            return;
-        }
-        if (times < 1) {
-            Feng.error("服务次数至少为1次!")
-            return;
-        }
-    }
-    console.log(times);
-    var val2 = $("#number").val();
-    if (!val2) {
-        Feng.error("请输入服务券张数!")
-        return;
-    }
-    if (val2 <= 0) {
-        Feng.error("请输入正确的服务券张数!")
-        return;
-    }
-    let timeType = $(':radio[name="prescription"]:checked').val()
-    let expDay = 0
-    if (timeType == 2) {
-        expDay = $("#time").val()
-        if (expDay == null || expDay == '') {
-            Feng.info("请输入领取后有效天数")
-            return
-        }
-        if (expDay <= 0) {
-            Feng.info("请输入正确的天数")
-            return
-        }
-    }
-    var split = $('#createTime').val().split(" - ");
-    if (timeType == 1) {
-        if (split == null || split == '' || split == "-") {
-            Feng.info("请输入有效期")
-            return
-        }
-    }
-    if ($("#couponType").val() == 6) {
-        var val2 = $("#couponName1").val();
-        if (!val2) {
-            Feng.info("请输入服务卷名称")
-            return
-        }
-        if (val2.length > 4) {
-            Feng.info("请输入4个字以内券名称")
-            return
-        }
-    }
-
-    //分公司直接就默认自己
-    var val1 = $("#type_").val();
-    var val = xmSelect.get('#demo2', true).getValue('valueStr')
-    if (val1 == 1) {
-        if ($(':radio[name="company"]:checked').val() == 1) {
-            if (val == "") {
-                Feng.error("指定公司未选择!")
-                return;
-            }
-        }
-        if (val == "" || $(':radio[name="company"]:checked').val() == 0) {
-            val = 0;
-        }
-    } else {
-        val = $("#companyId_").val();
-    }
-    if (!$("#detail").val()) {
-        Feng.error("请输入服务描述")
-        return;
-    }
-    if (!$("#couponName").val()) {
-        Feng.error("请输入服务券名称!")
-        return;
-    }
-    //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/couponServer/add", function (data) {
-        Feng.success("添加成功!");
-        window.parent.CouponServer.table.refresh();
-        couponInfoDlg.close();
-    }, function (data) {
-        Feng.error("添加失败!" + data.responseJSON.message + "!");
-    });
-    ajax.setData({
-        name: $("#couponName").val(),
-        type: $("#couponType").val(),
-        typeName: $("#couponName1").val(),
-        times: times,
-        sheetsNum: $("#number").val(),
-        remark: $("#detail").val(),
-        startTime: split[0],
-        endTime: split[1],
-        timeType: $(':radio[name="prescription"]:checked').val(),
-        expDay: $("#time").val(),
-        belongs: val,
-    });
-    ajax.start();
-}
-
-/**
- * 提交修改
- */
-couponInfoDlg.editSubmit = function () {
-
-    this.clearData();
-    this.collectData();
-
-    if (!$("#couponName").val()) {
-        Feng.error("请输入服务券名称!")
-        return;
-    }
-    let times = 1;
-    if ($("#inlineCheckbox").get(0).checked) {
-        times = 0
-    } else {
-        times = $("#couponTimes").val()
-        if (times > 100) {
-            Feng.error("服务次数最多为100次!")
-            return;
-        }
-        if (times < 1) {
-            Feng.error("服务次数至少为1次!")
-            return;
-        }
-    }
-    var val3 = $("#number").val();
-    if (!val3) {
-        Feng.error("请输入服务券张数!")
-        return;
-    }
-    if (val3 <= 0) {
-        Feng.error("请输入正确的服务券张数!")
-        return;
-    }
-    if ($("#couponType").val() == 6) {
-        var val2 = $("#couponName1").val();
-        if (!val2) {
-            Feng.info("请输入服务卷名称")
-            return
-        }
-        if (val2.length > 4) {
-            Feng.info("请输入4个字以内券名称")
-            return
-        }
-    }
-    let timeType = $(':radio[name="prescription"]:checked').val()
-    let expDay = 0
-    if (timeType == 2) {
-        expDay = $("#time").val()
-        if (expDay == null || expDay == '') {
-            Feng.info("请输入领取后有效天数")
-            return
-        }
-        if (expDay <= 0) {
-            Feng.info("请输入正确的天数")
-            return
-        }
-    }
-    var split = $('#createTime').val().split(" - ");
-    if (timeType == 1) {
-        if (split == null || split == '' || split == "-") {
-            Feng.info("请输入有效期")
-            return
-        }
-    }
-
-    //分公司直接就默认自己
-    var val1 = $("#type_").val();
-    var val = xmSelect.get('#demo2', true).getValue('valueStr')
-    if (val1 == 1) {
-        if ($(':radio[name="company"]:checked').val() == 1) {
-            if (val == "") {
-                Feng.error("指定公司未选择!")
-                return;
-            }
-        }
-        if (val == "" || $(':radio[name="company"]:checked').val() == 0) {
-            val = 0;
-        }
-    } else {
-        val = $("#companyId_").val();
-    }
-    if (!$("#detail").val()) {
-        Feng.error("请输入服务描述")
-        return;
-    }
-
-    //提交信息
-    var ajax = new $ax(Feng.ctxPath + "/couponServer/update", function (data) {
-        Feng.success("修改成功!");
-        window.parent.CouponServer.table.refresh();
-        couponInfoDlg.close();
-    }, function (data) {
-        Feng.error("修改失败!" + data.responseJSON.message + "!");
-    });
-    ajax.setData({
-        couponId: $("#couponId_").val(),
-        name: $("#couponName").val(),
-        type: $("#couponType").val(),
-        typeName: $("#couponName1").val(),
-        times: times,
-        sheetsNum: $("#number").val(),
-        remark: $("#detail").val(),
-        timeType: $(':radio[name="prescription"]:checked').val(),
-        expDay: $("#time").val(),
-        belongs: val,
-    });
-    ajax.set("startTimeStr", split[0]);
-    ajax.set("endTimeStr", split[1]);
-    ajax.start();
-}
 
 $(function () {
+    getProvince(null);
+    radio1();
+    var OBJradio = document.getElementsByName("prescription")
+    for (i = 0; i < OBJradio.length; i++) {//循环查找这个radio
+        if ($("#t1").val() == OBJradio[i].value) {//判断是否与radio的值相同
+            OBJradio[i].checked = true//修改选中状态
+        }
+    }
 
+    var OBJradio = document.getElementsByName("distributionMethod")
+    for (i = 0; i < OBJradio.length; i++) {//循环查找这个radio
+        if ($("#t2").val() == OBJradio[i].value) {//判断是否与radio的值相同
+            OBJradio[i].checked = true//修改选中状态
+        }
+    }
+    var OBJradio = document.getElementsByName("exchangeMethod")
+    for (i = 0; i < OBJradio.length; i++) {//循环查找这个radio
+        if ($("#t3").val() == OBJradio[i].value) {//判断是否与radio的值相同
+            OBJradio[i].checked = true//修改选中状态
+        }
+    }
+    var OBJradio = document.getElementsByName("userGroup")
+    for (i = 0; i < OBJradio.length; i++) {//循环查找这个radio
+        if ($("#t4").val() == OBJradio[i].value) {//判断是否与radio的值相同
+            OBJradio[i].checked = true//修改选中状态
+        }
+    }
+    var OBJradio = document.getElementsByName("company")
+    for (i = 0; i < OBJradio.length; i++) {//循环查找这个radio
+        if ($("#t5").val() == OBJradio[i].value) {//判断是否与radio的值相同
+            OBJradio[i].checked = true//修改选中状态
+        }
+    }
+    if($("#t5").val() ==2){
+        $("#citySelect").show();
+    }
+    if($("#t5").val() ==3){
+        $("#storeSelect").show();
+    }
+    if($("#t1").val()==1){
+        console.log(1)
+        $("#conditionalAmount").val($("#one").val())
+        $("#deductionAmount").val($("#two").val())
+    }
+    if($("#t1").val()==2){
+        radio2()
+        $("#voucherAmount").val($("#one").val())
+    }
+    if($("#t1").val()==3){
+        console.log(3)
+        $("#experienceName").val($("#three").val())
+    }
+
+    var userType = $('#userType').val();
+    if (userType === '1'){
+        // 兑换方式
+        $('#exchangeType').show();
+        $('#needAmount').show();
+        $('#needIntegral').show();
+        // 图片
+        $('#app').show();
+        $('#app1').show();
+        // 适用范围
+        $('#belongsCon').show();
+        $('#belongsNationwide').show();
+        $('#belongsCity').show();
+        $('#belongsStore').show();
+    }
+    if (userType === '2'){
+        $('#needIntegral').show();
+        $('#belongsCon').show();
+        $('#belongsStore').show();
+        $('#storeSelect').show();
+    }
 });

--
Gitblit v1.7.1