/**
|
* 初始化车辆管理详情对话框
|
*/
|
var language=1;
|
var TGoodsInfoDlg = {
|
tGoodsInfoData : {},
|
validateFields: {
|
},
|
goodsPicArray:[],
|
goodsPicArray1:[],
|
storeIds: [],
|
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
TGoodsInfoDlg.validate = function () {
|
|
};
|
|
/**
|
* 清除数据
|
*/
|
TGoodsInfoDlg.clearData = function() {
|
this.tGoodsInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TGoodsInfoDlg.set = function(key, val) {
|
this.tGoodsInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TGoodsInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TGoodsInfoDlg.close = function() {
|
parent.layer.close(window.parent.TPointProducts.layerIndex);
|
}
|
|
|
/**
|
* 收集数据
|
*/
|
TGoodsInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('isPlatCar')
|
.set('companyId')
|
.set('franchiseeId')
|
.set('carColor')
|
.set('carModelId')
|
.set('carBrandId')
|
.set('carLicensePlate')
|
.set('carPhoto')
|
.set('drivingLicenseNumber')
|
.set('drivingLicensePhoto')
|
.set('annualInspectionTime')
|
.set('commercialInsuranceTime')
|
.set('createTime')
|
.set('state')
|
.set('addType')
|
.set('addObjectId')
|
.set('plateColor')
|
.set('vehicleType')
|
.set('ownerName')
|
.set('engineId')
|
.set('VIN')
|
.set('certifyDateA')
|
.set('fuelType')
|
.set('engineDisplace')
|
.set('certificate')
|
.set('transAgency')
|
.set('transArea')
|
.set('transDateStart')
|
.set('transDateStop')
|
.set('certifyDateB')
|
.set('fixState')
|
.set('nextFixDate')
|
.set('checkState')
|
.set('feePrintId')
|
.set('GPSBrand')
|
.set('GPSModel')
|
.set('GPSIMEI')
|
.set('GPSInstallDate')
|
.set('registerDate')
|
.set('commercialType');
|
}
|
function storeList1(){
|
var index = layer.open({
|
type: 2,
|
title: '门店列表',
|
area: ['80%', '80%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tGoods/storeList1'
|
});
|
this.layerIndex = index;
|
}
|
function storeList(){
|
var index = layer.open({
|
type: 2,
|
title: '门店列表',
|
area: ['80%', '80%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tGoods/storeList'
|
});
|
this.layerIndex = index;
|
}
|
TGoodsInfoDlg.selecUserOpt = function (arrays){
|
|
//获取所有的值
|
var subArr= this.storeIds;
|
console.log(subArr)
|
$(".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){
|
this.storeIds.push(arrays[i].id)
|
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><input type="hidden" id="ids" name="ids" value="'+arrays[i].ids+'">' + arrays[i].ids +
|
'</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
|
}
|
}
|
$("#coun").append(str);
|
}
|
function deleteSub(e) {
|
console.log(e);
|
var row = $(e).closest('tr');
|
var value = row.find('#id').val();
|
TGoodsInfoDlg.storeIds.splice(TGoodsInfoDlg.storeIds.indexOf(parseInt(value)), 1)
|
$(e).parent().parent().remove();
|
console.log('storeIds',TGoodsInfoDlg.storeIds)
|
}
|
TGoodsInfoDlg.delete = function (o) {
|
$(o).parent("div").remove()
|
}
|
|
var num = 0;
|
TGoodsInfoDlg.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=\"TGoodsInfoDlg.delete(this)\" style=\"border: 0px;cursor: pointer;margin-top: 1%\"><i class=\"fa fa-trash\"></i></label>"+
|
" </div>";
|
$("#cityDemo").append($(a));
|
getProvince(num);
|
}
|
function changeCity(n){
|
|
var provinceSelect = null;
|
if (n === undefined || n === null || n === ''){
|
provinceSelect = document.getElementById("provinceData");
|
}else {
|
provinceSelect = document.getElementById("provinceData"+n);
|
}
|
|
var citySelect = null;
|
if (n === undefined || n === null || n === ''){
|
citySelect = document.getElementById("cityData");
|
}else {
|
citySelect = document.getElementById("cityData"+n);
|
}
|
|
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();
|
}
|
function getProvince(n){
|
var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){
|
console.log(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();
|
}
|
/**
|
* 提交添加
|
*/
|
TGoodsInfoDlg.addSubmit = function() {
|
|
|
this.clearData();
|
this.collectData();
|
const quantityIssuedInput = document.getElementById('quantityIssued');
|
const pickUpQuantityInput = document.getElementById('pickUpQuantity');
|
|
const quantityIssued2 = Number(quantityIssuedInput.value);
|
const pickUpQuantity2 = Number(pickUpQuantityInput.value);
|
|
if (isNaN(quantityIssued2) || isNaN(pickUpQuantity2)) {
|
} else if (quantityIssued2 >= pickUpQuantity2) {
|
} else {
|
Feng.error("发放数量必须大于等于限领数量")
|
return
|
}
|
let typeAll = document.querySelector('input[name="type"]:checked').value;
|
if(typeAll==2){
|
let pCode = $("#pCode").val()
|
let cCode = $("#cCode").val()
|
if(pCode==''){
|
Feng.info("请选择省")
|
return;
|
}
|
if(cCode==''){
|
Feng.info("请选择市")
|
return;
|
}
|
let storeId = $("#storeId").val()
|
if(storeId==''){
|
Feng.info("请选择门店")
|
return;
|
}
|
let coursePackageTypeId = $("#coursePackageTypeId").val()
|
if(coursePackageTypeId==''){
|
Feng.info("请选择课包类型")
|
return;
|
}
|
let coursePackageId = $("#coursePackageId").val()
|
if(coursePackageId==''){
|
Feng.info("请选择课包")
|
return;
|
}
|
let coursePackageConfigId = $("#coursePackageConfigId").val()
|
if(coursePackageConfigId==''){
|
Feng.info("请选择课时数")
|
return;
|
}
|
let price = $("#price1").val()
|
if(price==''){
|
Feng.info("请填写原价")
|
return;
|
}
|
let type = document.querySelector('input[name="redemptionMethod"]:checked').value;
|
if(type==''){
|
Feng.info("请选择兑换方式")
|
return;
|
}
|
let integral='';
|
let cash='';
|
if(type==1){
|
integral = $("#integral1").val()
|
if(integral==''){
|
Feng.info("请填写所需积分")
|
return;
|
}
|
}
|
if(type==2){
|
integral = $("#integral1").val()
|
if(integral==''){
|
Feng.info("请填写所需积分")
|
return;
|
}
|
cash = $("#cash1").val()
|
if(cash==''){
|
Feng.info("请填写所需现金")
|
return;
|
}
|
}
|
|
let cover1 = $("#cover1").val()
|
// if(cover1==''){
|
// Feng.info("请上传封面")
|
// return;
|
// }
|
var goodImgs = this.goodsPicArray1;
|
var imgOne ="";
|
if(goodImgs.length==0){
|
}else {
|
for (let i = 0; i <goodImgs.length; i++) {
|
if(i==goodImgs.length-1){
|
imgOne += (goodImgs[i].response)
|
}else {
|
imgOne+=(goodImgs[i].response+",")
|
}
|
}
|
}
|
|
let userPopulation = document.querySelector('input[name="userPopulation"]:checked').value;
|
if(userPopulation==''){
|
Feng.info("请选择用户人群")
|
return;
|
}
|
|
let quantityIssued = $("#quantityIssued1").val()
|
if(quantityIssued==''){
|
Feng.info("请填写发放数量")
|
return;
|
}
|
let pickUpQuantity = $("#pickUpQuantity1").val()
|
if(pickUpQuantity==''){
|
Feng.info("请填写限领数量")
|
return;
|
}
|
let startTime = $("#startTime1").val()
|
if(startTime==''){
|
Feng.info("请选择有效期")
|
return;
|
}
|
let text = TGoodsInfoDlg.editor1.getContent();
|
console.log(text)
|
if(text==""){
|
Feng.info("请输入兑换说明")
|
return;
|
}
|
|
let sort = $("#sort1").val()
|
if(sort==''){
|
Feng.info("请填写排序")
|
return;
|
}
|
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tGoods/add", function(data){
|
if(data=="5001"){
|
Feng.info("改账号已经存在");
|
}else if(data=="5003"){
|
console.log("请选择相同运营商门店")
|
Feng.info("请选择相同运营商门店");
|
|
}else if (data==5009){
|
Feng.error("有效期开始时间不应小于假期课开始时间");
|
return;
|
}else if (data==5008){
|
Feng.error("有效期结束时间不应大于假期课结束时间");
|
return;
|
}
|
else if(data.code == 200){
|
if(language==1){
|
Feng.success("添加成功!");
|
}else if(language==2){
|
Feng.success("Successfully added!");
|
}else {
|
Feng.success("Sangat berhasil ditambah!");
|
}
|
window.parent.TPointProducts.table.refresh();
|
TGoodsInfoDlg.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
var selectElement = document.getElementById("coursePackageId");
|
var selectedText = selectElement.options[selectElement.selectedIndex].text;
|
|
ajax.set("name",selectedText);
|
|
ajax.set("typeAll",typeAll);
|
ajax.set("provinceCode",pCode);
|
ajax.set("cityCode",cCode);
|
ajax.set("storeId",storeId);
|
ajax.set("coursePackageTypeId",coursePackageTypeId);
|
ajax.set("coursePackageId",coursePackageId);
|
ajax.set("coursePackageConfigId",coursePackageConfigId);
|
ajax.set("price",price);
|
ajax.set("type",type);
|
ajax.set("integral",integral);
|
ajax.set("cash",cash);
|
ajax.set("cover",cover1);
|
ajax.set("imgOne",imgOne);
|
ajax.set("userPopulation",userPopulation);
|
ajax.set("quantityIssued",quantityIssued);
|
ajax.set("pickUpQuantity",pickUpQuantity);
|
ajax.set("startTime",startTime);
|
ajax.set("text",text);
|
ajax.set("sort",sort);
|
ajax.start();
|
|
}else {
|
let name = $("#name").val()
|
if(name==''){
|
Feng.info("请填写商品名称")
|
return;
|
}
|
let price = $("#price").val()
|
if(price==''){
|
Feng.info("请填写原价")
|
return;
|
}
|
let type = document.querySelector('input[name="redemptionMethod"]:checked').value;
|
if(type==''){
|
Feng.info("请选择兑换方式")
|
return;
|
}
|
|
let integral='';
|
let cash='';
|
if(type==1){
|
integral = $("#integral").val()
|
if(integral==''){
|
Feng.info("请填写所需积分")
|
return;
|
}
|
}
|
if(type==2){
|
integral = $("#integral").val()
|
if(integral==''){
|
Feng.info("请填写所需积分")
|
return;
|
}
|
cash = $("#cash").val()
|
if(cash==''){
|
Feng.info("请填写所需现金")
|
return;
|
}
|
}
|
if(type==3){
|
cash = $("#cash").val()
|
if(cash==''){
|
Feng.info("请填写所需现金")
|
return;
|
}
|
}
|
|
let cover1 = $("#cover").val()
|
var goodImgs = this.goodsPicArray;
|
var imgOne ="";
|
if(goodImgs.length==0){
|
}else {
|
for (let i = 0; i <goodImgs.length; i++) {
|
if(i==goodImgs.length-1){
|
imgOne += (goodImgs[i].response)
|
}else {
|
imgOne+=(goodImgs[i].response+",")
|
}
|
}
|
}
|
|
let userPopulation = document.querySelector('input[name="userPopulation"]:checked').value;
|
if(userPopulation==''){
|
Feng.info("请选择用户人群")
|
return;
|
}
|
|
let quantityIssued = $("#quantityIssued").val()
|
if(quantityIssued==''){
|
Feng.info("请填写发放数量")
|
return;
|
}
|
let pickUpQuantity = $("#pickUpQuantity").val()
|
if(pickUpQuantity==''){
|
Feng.info("请填写限领数量")
|
return;
|
}
|
let startTime = $("#startTime").val()
|
if(startTime==''){
|
Feng.info("请选择有效期")
|
return;
|
}
|
|
let company = document.querySelector('input[name="company"]:checked').value;
|
|
var cityIds = [];
|
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(',');
|
}else {
|
cts = cityIds
|
}
|
}
|
|
const commaSeparatedString = this.goodsPicArray.join(',');
|
|
var stores = "";
|
if (company === '3'){
|
console.log('3---this.storeIds',this.storeIds);
|
if (TGoodsInfoDlg.storeIds.length === 0 ){
|
return Feng.error('请至少选择一个门店');
|
}
|
stores = this.storeIds.join(',');
|
console.log('stores--===--',stores)
|
}
|
|
let text = TGoodsInfoDlg.editor.getContent();
|
console.log(text)
|
if(text==""){
|
Feng.info("请输入兑换说明")
|
return;
|
}
|
|
let sort = $("#sort").val()
|
if(sort==''){
|
Feng.info("请填写排序")
|
return;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tGoods/add", function(data){
|
console.log("看看返回参数")
|
console.log(data)
|
if(data=="5001"){
|
Feng.error("该账号已经存在");
|
return;
|
}else if(data=="5003"){
|
console.log("请选择相同运营商门店")
|
Feng.error("请选择相同运营商门店");
|
return;
|
}else if (data==5009){
|
Feng.error("有效期开始时间不应小于假期课开始时间");
|
return;
|
}else if (data==5008){
|
Feng.error("有效期结束时间不应大于假期课结束时间");
|
return;
|
} else if(data.code == 200){
|
if(language==1){
|
Feng.success("添加成功!");
|
}else if(language==2){
|
Feng.success("Successfully added!");
|
}else {
|
Feng.success("Sangat berhasil ditambah!");
|
}
|
window.parent.TPointProducts.table.refresh();
|
TGoodsInfoDlg.close();
|
}else{
|
console.log("走这里")
|
Feng.error(data.msg);
|
return;
|
}
|
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("typeAll",typeAll);
|
ajax.set("name",name);
|
ajax.set("price",price);
|
ajax.set("type",type);
|
ajax.set("integral",integral);
|
ajax.set("cash",cash);
|
ajax.set("cover",cover1);
|
ajax.set("imgOne",imgOne);
|
ajax.set("userPopulation",userPopulation);
|
ajax.set("quantityIssued",quantityIssued);
|
ajax.set("pickUpQuantity",pickUpQuantity);
|
ajax.set("startTime",startTime);
|
ajax.set("useScope",company);
|
ajax.set("cityIds",cts);
|
ajax.set("storeIds",stores);
|
ajax.set("text",text);
|
ajax.set("sort",sort);
|
ajax.set("cardType",document.querySelector('input[name="cardType"]:checked').value);
|
ajax.start();
|
|
}
|
|
|
}
|
TGoodsInfoDlg.addSubmit1 = function() {
|
let company = 3;
|
this.clearData();
|
this.collectData();
|
var cityIds = [];
|
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);
|
console.log("看看num")
|
console.log(num)
|
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);
|
}
|
}
|
|
|
}else {
|
// 如果只有一个城市,则将cts设置为字符串
|
if (cityIds.length === 1) {
|
cts = cityIds[0];
|
} else {
|
cts = cityIds.join(',');
|
}
|
}
|
}
|
|
let type = document.querySelector('input[name="redemptionMethod"]:checked').value;
|
let name = $("#name").val()
|
if(name==''){
|
Feng.info("请填写商品名称")
|
return;
|
}
|
let price = $("#price").val()
|
if(price==''){
|
Feng.info("请填写原价")
|
return;
|
}
|
if(type==''){
|
Feng.info("请选择兑换方式")
|
return;
|
}
|
|
let integral='';
|
let cash='';
|
if(type==1){
|
integral = $("#integral").val()
|
if(integral==''){
|
Feng.info("请填写所需积分")
|
return;
|
}
|
}
|
if(type==2){
|
integral = $("#integral").val()
|
if(integral==''){
|
Feng.info("请填写所需积分")
|
return;
|
}
|
cash = $("#cash").val()
|
if(cash==''){
|
Feng.info("请填写所需现金")
|
return;
|
}
|
}
|
if(type==3){
|
cash = $("#cash").val()
|
if(cash==''){
|
Feng.info("请填写所需现金")
|
return;
|
}
|
}
|
|
let cover1 = $("#cover").val()
|
var goodImgs = this.goodsPicArray;
|
var imgOne ="";
|
if(goodImgs.length==0){
|
}else {
|
for (let i = 0; i <goodImgs.length; i++) {
|
if(i==goodImgs.length-1){
|
imgOne += (goodImgs[i].response)
|
}else {
|
imgOne+=(goodImgs[i].response+",")
|
}
|
}
|
}
|
|
let userPopulation = document.querySelector('input[name="userPopulation"]:checked').value;
|
if(userPopulation==''){
|
Feng.info("请选择用户人群")
|
return;
|
}
|
|
let quantityIssued = $("#quantityIssued").val()
|
if(quantityIssued==''){
|
Feng.info("请填写发放数量")
|
return;
|
}
|
let pickUpQuantity = $("#pickUpQuantity").val()
|
if(pickUpQuantity==''){
|
Feng.info("请填写限领数量")
|
return;
|
}
|
let startTime = $("#startTime").val()
|
if(startTime==''){
|
Feng.info("请选择有效期")
|
return;
|
}
|
|
|
// 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(',');
|
// }else {
|
// cts = cityIds
|
// }
|
|
const commaSeparatedString = this.goodsPicArray.join(',');
|
|
|
var stores = "";
|
if (company === 3 && $("#userType").val()!="3"){
|
console.log('3---this.storeIds',this.storeIds);
|
if (TGoodsInfoDlg.storeIds.length === 0 ){
|
return Feng.error('请至少选择一个门店');
|
}
|
stores = this.storeIds.join(',');
|
console.log('stores--===--',stores)
|
}
|
let text = TGoodsInfoDlg.editor.getContent();
|
console.log(text)
|
if(text==""){
|
Feng.info("请输入兑换说明")
|
return;
|
}
|
|
let sort = $("#sort").val()
|
if(sort==''){
|
Feng.info("请填写排序")
|
return;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tGoods/add", function(data){
|
if(data=="5001"){
|
Feng.error("改账号已经存在");
|
}else if(data=="5003"){
|
Feng.info("请选择相同运营商门店");
|
|
}else
|
if(data.code == 200){
|
if(language==1){
|
Feng.success("添加成功!");
|
}else if(language==2){
|
Feng.success("Successfully added!");
|
}else {
|
Feng.success("Sangat berhasil ditambah!");
|
}
|
window.parent.TPointProducts.table.refresh();
|
TGoodsInfoDlg.close();
|
}else{
|
Feng.error(data.msg);
|
}
|
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
console.log("看看城市ids")
|
console.log(cts);
|
ajax.set("typeAll",3);
|
ajax.set("name",name);
|
ajax.set("price",price);
|
ajax.set("type",type);
|
ajax.set("integral",integral);
|
ajax.set("cash",cash);
|
ajax.set("cover",cover1);
|
ajax.set("imgOne",imgOne);
|
ajax.set("userPopulation",userPopulation);
|
ajax.set("quantityIssued",quantityIssued);
|
ajax.set("pickUpQuantity",pickUpQuantity);
|
ajax.set("startTime",startTime);
|
ajax.set("useScope",company);
|
ajax.set("cityIds",cts);
|
ajax.set("storeIds",stores);
|
ajax.set("text",text);
|
ajax.set("sort",sort);
|
ajax.set("cardType",document.querySelector('input[name="type"]:checked').value);
|
ajax.start();
|
}
|
/**
|
* 删除图片的函数
|
* @param e
|
*/
|
function delImg(e){
|
|
$(e).parent().remove();
|
}
|
|
|
/**
|
* 提交修改
|
*/
|
TGoodsInfoDlg.editSubmit = function() {
|
let cover = $("#cover").val();
|
let goodsId = $("#goodsId").val();
|
var goodImgs = TGoodsInfoDlg.goodsPicArray;
|
|
if(goodImgs.length==0){
|
Feng.info("请上传实景图")
|
return;
|
}
|
|
|
const quantityIssuedInput = document.getElementById('quantityIssued');
|
const pickUpQuantityInput = document.getElementById('pickUpQuantity');
|
|
const quantityIssued1 = Number(quantityIssuedInput.value);
|
const pickUpQuantity1 = Number(pickUpQuantityInput.value);
|
|
if (isNaN(quantityIssued1) || isNaN(pickUpQuantity1)) {
|
Feng.error("优惠卷数量必须为数字")
|
console.log('Both quantityIssued and pickUpQuantity must be numbers.');
|
return
|
} else if (quantityIssued1 >= pickUpQuantity1) {
|
|
console.log('quantityIssued is greater than pickUpQuantity.');
|
} else {
|
|
Feng.error("发放数量必须大于限领数量")
|
return
|
console.log('quantityIssued is not greater than pickUpQuantity.');
|
}
|
var imgOne ="";
|
console.log(goodImgs)
|
console.log(goodImgs.length)
|
for (let i = 0; i <goodImgs.length; i++) {
|
console.log(goodImgs[i].response,11)
|
if(i==goodImgs.length-1){
|
imgOne += (goodImgs[i].response)
|
}else {
|
imgOne+=(goodImgs[i].response+",")
|
}
|
}
|
console.log("结果图片")
|
console.log(imgOne)
|
let quantityIssued = $("#quantityIssued").val();
|
let pickUpQuantity = $("#pickUpQuantity").val();
|
let editor = jQuery.trim(TGoodsInfoDlg.editor.getContent());
|
console.log('editor:',editor)
|
|
let sort = $("#sort").val();
|
|
if (quantityIssued === undefined || quantityIssued === null || quantityIssued === ''){
|
return Feng.error('发放数量不能为空!');
|
}
|
if (pickUpQuantity === undefined || pickUpQuantity === null || pickUpQuantity === ''){
|
return Feng.error('限领数量不能为空!');
|
}
|
|
|
|
|
|
if (editor === undefined || editor === null || editor === ''){
|
return Feng.error('兑换说明不能为空!');
|
}
|
if (sort === undefined || sort === null || sort === ''){
|
return Feng.error('排序不能为空!');
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tGoods/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TPointProducts.table.refresh();
|
TGoodsInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("pointMerchandiseId",goodsId);
|
ajax.set("quantityIssued",quantityIssued);
|
ajax.set("pickUpQuantity",pickUpQuantity);
|
ajax.set("redemptionInstructions",editor);
|
ajax.set("cover",cover);
|
ajax.set("productImages",imgOne);
|
ajax.set("sort",sort);
|
ajax.start();
|
}
|
|
$(function() {
|
// 初始化图片上传
|
var carPhoto = new $WebUpload("cover1");
|
carPhoto.setUploadBarId("progressBar");
|
carPhoto.init();
|
// 初始化图片上传
|
var carPhoto = new $WebUpload("cover");
|
carPhoto.setUploadBarId("progressBar");
|
carPhoto.init();
|
TGoodsInfoDlg.editor = UE.getEditor('editor');
|
TGoodsInfoDlg.editor1 = UE.getEditor('editor1');
|
getProvince(null);
|
var drivingLicensePhoto = new $WebUpload("drivingLicensePhoto");
|
drivingLicensePhoto.setUploadBarId("progressBar");
|
drivingLicensePhoto.init();
|
var drivingLicensePhoto = new $WebUpload("drivingLicensePhoto");
|
drivingLicensePhoto.setUploadBarId("progressBar");
|
drivingLicensePhoto.init();
|
|
});
|
|
/**
|
* 选择分公司后执行
|
*/
|
TGoodsInfoDlg.oneChange = function (e) {
|
var oneId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCity/onChange", function(data){
|
if(data!=null){
|
if(language==1){
|
var content='<option value="">选择市</option>';
|
}else if(language==2){
|
var content='<option value="">Choose your franchisee</option>';
|
}else {
|
var content='<option value="">Pilih franchisee Anda</option>';
|
}
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.code+"'>"+v.name+"</option>";
|
});
|
$("#cCode").empty().append(content);
|
}
|
});
|
ajax.set("oneId",oneId);
|
ajax.start();
|
}
|
function UploadFileFn(){
|
$('#upFile').click();
|
}
|
TGoodsInfoDlg.storeChange = function (e) {
|
var oneId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/coursePackage/queryStore", function(data){
|
if(data!=null){
|
if(language==1){
|
var content='<option value="">选择门店</option>';
|
}else if(language==2){
|
var content='<option value="">Choose your franchisee</option>';
|
}else {
|
var content='<option value="">Pilih franchisee Anda</option>';
|
}
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#storeId").empty().append(content);
|
}
|
});
|
ajax.set("cityCode",oneId);
|
ajax.start();
|
}
|
TGoodsInfoDlg.packageChange = function (e) {
|
var oneId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/coursePackage/queryCoursePackageLists", function(data){
|
if(data!=null){
|
if(language==1){
|
var content='<option value="">选择课包</option>';
|
}else if(language==2){
|
var content='<option value="">Choose your franchisee</option>';
|
}else {
|
var content='<option value="">Pilih franchisee Anda</option>';
|
}
|
$.each(data.rows, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#coursePackageId").empty().append(content);
|
}
|
});
|
ajax.set("coursePackageTypeId",oneId);
|
ajax.set("order","desc");
|
ajax.set("offset",0);
|
ajax.set("limit",100);
|
ajax.start();
|
}
|
|
|
TGoodsInfoDlg.timeChange = function (e) {
|
var oneId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCity/timeChange", function(data){
|
if(data!=null){
|
if(language==1){
|
var content='<option value="">选择课时数</option>';
|
}else if(language==2){
|
var content='<option value="">Choose your franchisee</option>';
|
}else {
|
var content='<option value="">Pilih franchisee Anda</option>';
|
}
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.value+"</option>";
|
});
|
$("#coursePackageConfigId").empty().append(content);
|
}
|
});
|
ajax.set("oneId",oneId);
|
ajax.start();
|
}
|
|
/**
|
* 类型改变执行
|
* @param e
|
*/
|
TGoodsInfoDlg.companyTypeClick = function (e) {
|
if (1 == e){
|
$(".companyDiv").hide();
|
} else if (2 == e){
|
$(".companyDiv").show();
|
}
|
}
|
|
/**
|
* 车辆品牌改变时执行
|
*/
|
TGoodsInfoDlg.brandChange = function (e) {
|
var carBrandId=$(e).val();
|
var ajax = new $ax(Feng.ctxPath + "/tCar/brandChange", function(data){
|
if(data!=null){
|
if(language==1){
|
var content='<option value="">选择车辆类型</option>';
|
}else if(language==2){
|
var content='<option value="">Please select the vehicle type</option>';
|
}else {
|
var content='<option value="">Pilih Jenis Kendaraan</option>';
|
}
|
|
$.each(data, function(k,v) {
|
content += "<option value='"+v.id+"'>"+v.name+"</option>";
|
});
|
$("#carModelId").empty().append(content);
|
}
|
});
|
ajax.set("carBrandId",carBrandId);
|
ajax.start();
|
}
|
|
/**
|
* 专车服务被点击
|
*/
|
TGoodsInfoDlg.zcServerClick = function () {
|
var serverBox1 = $('#serverBox1').prop('checked');
|
if (serverBox1){
|
$("#zcModelDiv").show();
|
} else {
|
$("#zcModelDiv").hide();
|
}
|
}
|
|
/**
|
* 跨城服务被点击
|
*/
|
TGoodsInfoDlg.kcServerClick = function () {
|
var serverBox3 = $('#serverBox3').prop('checked');
|
if (serverBox3){
|
$("#kcModelDiv").show();
|
} else {
|
$("#kcModelDiv").hide();
|
}
|
}
|