/**
|
* 用户详情对话框(可用于添加和修改对话框)
|
*/
|
var VipJurisdictionInfo = {
|
userInfoData: {}
|
};
|
|
|
/**
|
* 关闭此对话框
|
*/
|
VipJurisdictionInfo.close = function () {
|
parent.layer.close(window.parent.VipJurisdiction.layerIndex);
|
};
|
|
|
/**
|
* 提交添加vipJurisdiction
|
*/
|
VipJurisdictionInfo.addSubmit = function () {
|
const name = $('#name').val();
|
const imgUrl = $('#imgUrl').val();
|
const vipLevel = $('#vipLevel').val();
|
const explain = $('#explain').val();
|
const type = $('#type').val();
|
const jumpClassification = $('#jumpClassification').val();
|
const couponNumber = $('#couponNumber').val();
|
const jumpType = $('#jumpType').val();
|
let objecCode = $('#objecCode').val();
|
let appid = $('#appid').val();
|
let startTime = $('#startTime').val();
|
let content = ''
|
if(type == 1){
|
content = $('#integral #content').val();
|
}
|
if(type == 2){
|
content = $('#coupon #content').val();
|
}
|
if(type == 3){
|
content = $('#link #content').val();
|
}
|
const sort = $('#sort').val();
|
if(null == name || '' == name){
|
Feng.error("权益名称不能为空");
|
return
|
}
|
if(null == imgUrl || '' == imgUrl){
|
Feng.error("图片不能为空");
|
return
|
}
|
if(null == vipLevel || vipLevel.length == 0){
|
Feng.error("所属等级不能为空");
|
return
|
}
|
if(null == explain || '' == explain){
|
Feng.error("权益说明不能为空");
|
return
|
}
|
// if(null == startTime || '' == startTime){
|
// Feng.error("生效周期不能为空");
|
// return
|
// }
|
if(type == 1 && (null == content || '' == content)){
|
Feng.error("积分不能为空");
|
return
|
}
|
if(type == 2 && (null == content || '' == content)){
|
Feng.error("券模板ID不能为空");
|
return
|
}
|
if(type == 2){
|
if(null == couponNumber || '' == couponNumber){
|
Feng.error("发放数量不能为空");
|
return
|
}
|
if(couponNumber > 5){
|
Feng.error("发放数量不能大于5张")
|
return
|
}
|
}
|
if(type == 3){
|
if((jumpType == 11) && content == ''){
|
Feng.error("链接不能为空");
|
return
|
}
|
if((jumpType == 6 || jumpType == 7) && objecCode == ''){
|
Feng.error("数据ID不能为空");
|
return
|
}
|
if(jumpType == 12 && content == ''){
|
Feng.error("小程序链接不能为空");
|
return
|
}
|
if(jumpType == 12 && appid == ''){
|
Feng.error("小程序APPID不能为空");
|
return
|
}
|
}
|
|
if(null == sort || '' == sort){
|
Feng.error("排序不能为空");
|
return
|
}
|
// let times = startTime.split(" - ");
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/vipJurisdiction/addVipJurisdiction", function (data) {
|
if(data.code == 200){
|
Feng.success("添加成功!");
|
window.parent.VipJurisdiction.table.refresh();
|
VipJurisdictionInfo.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
}, function (data) {
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set({
|
name: name,
|
icon: imgUrl,
|
type: type,
|
jumpClassification: jumpClassification,
|
couponNumber: couponNumber,
|
jumpType: jumpType,
|
content: content,
|
explain: explain,
|
sort: sort,
|
vipLevel: vipLevel.toString(),
|
appid: appid,
|
dataInfoId: objecCode,
|
// startTime: times[0],
|
// endTime: times[1]
|
});
|
ajax.start();
|
};
|
|
/**
|
* 提交修改
|
*/
|
VipJurisdictionInfo.editSubmit = function () {
|
const name = $('#name').val();
|
const imgUrl = $('#imgUrl').val();
|
const vipLevel = $('#vipLevel').val();
|
const explain = $('#explain').val();
|
const type = $('#type').val();
|
const jumpClassification = $('#jumpClassification').val();
|
const couponNumber = $('#couponNumber').val();
|
const jumpType = $('#jumpType').val();
|
let objecCode = $('#objecCode').val();
|
let appid = $('#appid').val();
|
let startTime = $('#startTime').val();
|
let content = '';
|
if(type == 1){
|
content = $('#integral #content').val();
|
}
|
if(type == 2){
|
content = $('#coupon #content').val();
|
}
|
if(type == 3){
|
content = $('#link #content').val();
|
}
|
const sort = $('#sort').val();
|
if(null == name || '' == name){
|
Feng.error("权益名称不能为空");
|
return
|
}
|
if(null == imgUrl || '' == imgUrl){
|
Feng.error("图片不能为空");
|
return
|
}
|
if(null == vipLevel || vipLevel.length == 0){
|
Feng.error("所属等级不能为空");
|
return
|
}
|
if(null == explain || '' == explain){
|
Feng.error("权益说明不能为空");
|
return
|
}
|
// if(null == startTime || '' == startTime){
|
// Feng.error("生效周期不能为空");
|
// return
|
// }
|
if(type == 1 && (null == content || '' == content)){
|
Feng.error("积分不能为空");
|
return
|
}
|
if(type == 2 && (null == content || '' == content)){
|
Feng.error("券模板ID不能为空");
|
return
|
}
|
if(type == 3){
|
if((jumpType == 11) && content == ''){
|
Feng.error("链接不能为空");
|
return
|
}
|
if((jumpType == 6 || jumpType == 7) && objecCode == ''){
|
Feng.error("数据ID不能为空");
|
return
|
}
|
if(jumpType == 12 && content == ''){
|
Feng.error("小程序链接不能为空");
|
return
|
}
|
if(jumpType == 12 && appid == ''){
|
Feng.error("小程序APPID不能为空");
|
return
|
}
|
}
|
if(type == 2){
|
if(null == couponNumber || '' == couponNumber){
|
Feng.error("发放数量不能为空");
|
return
|
}
|
if(couponNumber > 5){
|
Feng.error("发放数量不能大于5张")
|
return
|
}
|
}
|
if(null == sort || '' == sort){
|
Feng.error("排序不能为空");
|
return
|
}
|
// let times = startTime.split(" - ");
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/vipJurisdiction/editVipJurisdiction", function (data) {
|
if(data.code == 200){
|
Feng.success("编辑成功!");
|
window.parent.VipJurisdiction.table.refresh();
|
VipJurisdictionInfo.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
}, function (data) {
|
Feng.error("编辑失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set({
|
id: $('#id').val(),
|
name: name,
|
icon: imgUrl,
|
type: type,
|
jumpClassification: jumpClassification,
|
couponNumber: couponNumber,
|
jumpType: jumpType,
|
content: content,
|
explain: explain,
|
sort: sort,
|
vipLevel: vipLevel.toString(),
|
appid: appid,
|
dataInfoId: objecCode,
|
// startTime: times[0],
|
// endTime: times[1]
|
});
|
ajax.start();
|
};
|
|
|
|
$(function () {
|
// 初始化头像上传
|
var avatarUp = new $WebUpload("imgUrl");
|
avatarUp.setUploadBarId("progressBar");
|
avatarUp.init();
|
|
$('#type').on('change', function () {
|
const v = $(this).val();
|
if(v == 0){
|
$('#integral').hide();
|
$('#coupon').hide();
|
$('#link').hide();
|
$('#dataCode').hide();
|
$('#appidDiv').hide();
|
$('#content').val('');
|
$('#dataCode #objecCode').val('');
|
$('#appidDiv #appid').val('')
|
$('#jump #jumpType').val(0);
|
$('#jump').hide();
|
}
|
if(v == 1){
|
$('#integral').show();
|
$('#coupon').hide();
|
$('#link').hide();
|
$('#dataCode').hide();
|
$('#appidDiv').hide()
|
$('#dataCode #objecCode').val('');
|
$('#appidDiv #appid').val('')
|
$('#jump #jumpType').val(0);
|
$('#jump').hide();
|
}
|
if(v == 2){
|
$('#integral').hide();
|
$('#coupon').show();
|
$('#link').hide();
|
$('#dataCode').hide();
|
$('#appidDiv').hide()
|
$('#dataCode #objecCode').val('');
|
$('#appidDiv #appid').val('')
|
$('#jump #jumpType').val(0);
|
$('#jump').hide();
|
}
|
if(v == 3){
|
$('#integral').hide();
|
$('#coupon').hide();
|
$('#link').hide();
|
$('#dataCode').hide();
|
$('#appidDiv').hide()
|
$('#content').val('');
|
$('#dataCode #objecCode').val('');
|
$('#appidDiv #appid').val('')
|
$('#jump #jumpType').val(1);
|
$('#jump').show();
|
var jumpClassificationInput = $("#jumpClassificationInput").val();
|
$("#jumpClassification option[value="+jumpClassificationInput+"]").prop("selected","selected");
|
$("#jumpClassification").trigger("change");
|
}
|
|
})
|
|
$('#jumpType').on('change', function () {
|
const v = $(this).val();
|
$('#dataCode').hide();
|
if(v == 1 || v == 2 || v == 3 || v == 4 || v == 9 || v == 10 || v == 13 || v == 14){
|
$('#integral').hide();
|
$('#link').hide();
|
$('#appidDiv').hide();
|
$('#dataCode').hide();
|
$('#integral #content').val('');
|
$('#coupon #content').val('');
|
$('#link #content').val('');
|
$('#dataCode input').val('');
|
$('#appidDiv input').val('');
|
}
|
if(v == 5 || v == 6 || v == 7 || v==15){
|
$('#integral').hide();
|
$('#link').hide();
|
$('#appidDiv').hide();
|
$('#dataCode').show();
|
var jumpType = $("#jumpTypeInput").val();
|
if(v == jumpType){
|
$("#objecCode").val($("#dataInfoId").val());
|
}else {
|
$('#dataCode #objecCode').val('');
|
}
|
$('#integral #content').val('');
|
$('#coupon #content').val('');
|
$('#link #content').val('');
|
$('#appidDiv input').val('');
|
if(v == 6 || v == 7){
|
$('#dataCode').find('label').empty().append('<span style="color: red">*</span>数据ID');
|
}else {
|
$('#dataCode').find('label').text('数据ID');
|
}
|
}
|
if(v == 11){
|
$('#integral').hide();
|
$('#link').show();
|
$('#appidDiv').hide();
|
$('#dataCode').hide();
|
$('#appidDiv input').val('');
|
$('#dataCode input').val('');
|
}
|
if(v == 12){
|
$('#integral').hide();
|
$('#link').show();
|
$('#appidDiv').show();
|
$('#dataCode').hide();
|
$('#dataCode input').val('');
|
}
|
if(v == 8){
|
$('#integral').hide();
|
$('#link').hide();
|
$('#appidDiv').hide();
|
$('#dataCode').show();
|
$('#integral #content').val('');
|
$('#coupon #content').val('');
|
$('#link #content').val('');
|
$('#appidDiv input').val('');
|
$('#dataCode').find('label').text('商品编码');
|
}
|
})
|
|
$('#jumpClassification').on('change', function () {
|
var jumpClassificationVal = $(this).val();
|
var jumpHtml = "";
|
var jumpTypeInput = $("#jumpTypeInput").val();
|
if(jumpClassificationVal==1){
|
jumpHtml =
|
' <option value="5">券包</option>\n' +
|
' <option value="6">促销活动</option>\n' +
|
' <option value="7">集点活动</option>\n' +
|
' <option value="15">领券活动</option>';
|
}else if(jumpClassificationVal==2){
|
jumpHtml =
|
' <option value="1">签到</option>\n' +
|
' <option value="2">会员权益</option>\n' +
|
' <option value="3">任务中心</option>\n' +
|
' <!--<option value="4">我的</option>-->\n' +
|
' <!--<option value="16">我的优惠券</option>-->\n' +
|
' <option value="17">我的任务</option>\n' +
|
' <option value="18">我的订单</option>';
|
}else if(jumpClassificationVal==3){
|
jumpHtml =
|
' <option value="8">积分商城</option>\n' +
|
' <option value="9">我的优惠券列表</option>\n' +
|
' <option value="10">加油站首页</option>\n' +
|
' <option value="13">一键加油</option>\n' +
|
' <option value="14">开发票</option>\n' +
|
' <option value="11">外部H5</option>\n' +
|
' <option value="12">外部小程序</option>';
|
}else if(jumpClassificationVal==4){
|
jumpHtml = '<option value="0">不跳转</option>';
|
$('#integral').hide();
|
$('#coupon').hide();
|
$('#link').hide();
|
$('#dataCode').hide();
|
$('#appidDiv').hide();
|
$('#content').val('');
|
$('#dataCode #objecCode').val('');
|
$('#appidDiv #appid').val('')
|
}
|
$("#jumpType").empty().append(jumpHtml);
|
$("#jumpType").trigger("change");
|
$("#jumpType option[value="+jumpTypeInput+"]").prop("selected","selected");
|
|
|
});
|
var type = $("#type").val();
|
if(type == 3){
|
//跳转类型切换
|
$("#type").trigger("change");
|
$("#jumpClassification").trigger("change");
|
$("#jumpType").trigger("change");
|
$("#objecCode").val($("#dataInfoId").val());
|
}
|
});
|