| | |
| | | var couponInfoDlg = { |
| | | couponInfoData: {}, |
| | | goodsPicArray: [], //商品图片数组 |
| | | goodsCover: '' //商品封面图 |
| | | goodsCover: '', //商品封面图 |
| | | storeIds: [], |
| | | }; |
| | | |
| | | /** |
| | |
| | | |
| | | var 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" + |
| | |
| | | " </div>"; |
| | | $("#cityDemo").append($(a)); |
| | | getProvince(num); |
| | | num=num+1 |
| | | } |
| | | |
| | | |
| | | 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>'; |
| | | } |
| | | } |
| | | $("#coun").append(str); |
| | | console.log('storeIds',this.storeIds) |
| | | } |
| | | |
| | | function deleteSub(e) { |
| | | console.log(e); |
| | | var row = $(e).closest('tr'); |
| | | var idValue = row.find('#id').val(); |
| | | var index = this.storeIds.indexOf(idValue.toString()); |
| | | if (index !== -1) { |
| | | this.storeIds.splice(index, 1); |
| | | } |
| | | $(e).parent().parent().remove(); |
| | | console.log('storeIds',this.storeIds) |
| | | } |
| | | |
| | | |
| | | couponInfoDlg.delete = function (o) { |
| | |
| | | */ |
| | | couponInfoDlg.addSubmit = function () { |
| | | |
| | | var resultData = {}; |
| | | // 用户权限 |
| | | var userType = $('#userType').val(); |
| | | var cityIds = []; |
| | | // 优惠券名称 |
| | | var couponName = $('#name').val; |
| | | var couponName = $('#name').val(); |
| | | // 优惠券类型 |
| | | var prescription = $('#prescription').val(); |
| | | // 说明 |
| | |
| | | // 有效期 |
| | | var periodOfValidity = $('#periodOfValidity').val(); |
| | | |
| | | if (userType === '1'){ |
| | | // 平台管理员 |
| | | // 兑换方式:积分+现金 |
| | | let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val(); |
| | | let exchangeMethod = $(':radio[name="exchangeMethod"]:checked').val(); |
| | | |
| | | if (exchangeMethod === 1){ |
| | | var requiredCash = $('#requiredCash').val(); |
| | | |
| | | var company = $('#company').val(); |
| | | if (company === '2'){ |
| | | var myselect=document.getElementById('cityData'); |
| | | var seCity = myselect.options[myselect.selectedIndex].value; |
| | | if (seCity === null || seCity === undefined || seCity === ''){ |
| | | return Feng.error('请选中一个省市'); |
| | | } |
| | | if (exchangeMethod === 2){ |
| | | var requiredCash = $('#requiredCash').val; |
| | | |
| | | cityIds.push(seCity); |
| | | if (this.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); |
| | | } |
| | | } |
| | | } |
| | | if (exchangeMethod === 3){ |
| | | |
| | | } |
| | | var goodImg = this.goodsCover; |
| | | var goodImgs = this.goodsPicArray; |
| | | // 适用范围 全国+指定城市+指定门店 |
| | | let company = $(':radio[name="company"]:checked').val() |
| | | if (company === 2){ |
| | | |
| | | } |
| | | if (company === 3){ |
| | | |
| | | } |
| | | |
| | | commitAJAX(resultData); |
| | | } |
| | | if (userType === '2'){ |
| | | // 城市管理员 |
| | | |
| | | if (company === '3'){ |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | function commitAJAX(obj){ |
| | | console.log('11111111') |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/commitData", function (data) { |
| | |
| | | }, function (data) { |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("dataResult", JSON.parse(obj)); |
| | | ajax.set("userType",1); |
| | | ajax.set("cityManagerId",1); |
| | | ajax.set("couponName",couponName); |
| | | ajax.set("prescription",prescription); |
| | | ajax.set("condition",$('#conditionalAmount').val()); |
| | | ajax.set("subtraction",$('#deductionAmount').val()); |
| | | ajax.set("discount",$('#voucherAmount').val()); |
| | | ajax.set("experience",$('#experienceName').val()); |
| | | 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",this.goodsPicArray); |
| | | ajax.set("company",$('#company').val()); |
| | | ajax.set("cityIds",cityIds); |
| | | ajax.set("storeIds",this.storeIds); |
| | | 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'){ |
| | | // 兑换方式 |