let query = {}; //URL参数
let scr = $(location).prop('href').split("?")[1];
Array.prototype.myForEach = function myForEach(callback, context) {
context = context || window;
if (Array.prototype.forEach) {
// 调用forEach方法,不做任何处理
this.forEach(callback, context);
return;
}
}
if (scr) {
scr = scr.split("&").join("=").split("=")
scr.myForEach(function(item, index, arr) {
if (index % 2 === 0) {
query[item] = ""
} else {
query[scr[index - 1]] = item
}
});
}
// query.islicode = decodeURI(query.islicode);
query.username = decodeURI(query.username);
let newOrderisli = null;
let source_data = []; // 资源集
let source_data2 = []; // 资源集2
let target_data = []; // 单资源
let title_Name = null; //标的名称
let type_status = null; //判断状态
let disable = true
let listQuery = {
pay_type: 1, // 付费类型
// source_type: 8, // 资源类型
goods_islicode: query.list_isli, // 委托数据isli标识码
};
let listQuerys = {
goods_isli: query.list_isli, // 委托数据委托关联编码
use_years: 99, // 购买使用年限
user_isli: cookieHandler.get("isliCode"), // 用户isli编码
}
let new_total = null;
function entrust(data) {
if (data == "1") {
return "转让"
} else if (data == "2") {
return "授权"
} else {
return ""
}
};
function chargesType(data) {
if (data == "1") {
return "免费"
} else if (data == "2") {
return "付费"
} else {
return ""
}
};
function period(data) {
if (data == "1") {
return "永久性委托"
} else if (data == "2") {
return "一次性委托"
} else if (data == "3") {
return "阶段性委托"
} else {
return ""
}
};
function goodsType(data) {
if (data == "1") {
return "文化资源数据"
} else if (data == "2") {
return "文化数字内容"
} else {
return ""
}
};
function attestStatus(data) {
if (data == "0") {
return "认证中"
} else if (data == "1") {
return "认证成功"
} else if (data == "2") {
return "认证失败"
} else {
return ""
}
};
function FileSize(data) {
if (data === 0) {
return "0 B";
}
var k = 1024;
var sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
i = Math.floor(Math.log(data) / Math.log(k));
return (data / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
};
// AgencyAddress + 'order/queryRrder',
// 委托数据查询接口
// function searchGoods(data) {
// let postList = new AJAX_OBJ(AgencyAddress + "order/searchGoods", successGood, onUrlError);
// postList.postRequestData();
// }
//委托数据查询接口
function getUserName(UserName) {
let data = {
entrust_user_name: UserName,
goods_status: 1
};
var ajaxSearchUserName = new AJAX_OBJ(AgencyAddress + "order/searchGoods", entrustSearchUserName, onUrlError);
ajaxSearchUserName.postRequestData(JSON.stringify(data));
}
function entrustSearchUserName(xmlHttp) {
var res = eval('(' + xmlHttp.responseText + ')');
if (res.resultCode === "00000000") {
new_total = res.data.total;
searchGoods(listQuery);//委托数据详情接口
}
}
let Client_date = {
entrustingPartyName: "", //委托方名称
identityCode: "", //身份认证编码
entrustSignNumber: 0, //委托标的数
orderNumber: 1 //订单总数
}
// 委托数据查询接口
function searchGoods(data) {
let postList = new AJAX_OBJ(AgencyAddress + "order/searchGoods", successGood, onUrlError);
postList.postRequestData(JSON.stringify(data));
function successGood(xmlHttp) {
let res = eval('(' + xmlHttp.responseText + ')');
if (res.resultCode === "00000000") {
Client_date.entrustingPartyName = res.data.data[0].username; //委托方名称
Client_date.identityCode = res.data.data[0].user_islicode; //身份认证编码
type_status = res.data.data[0].goods_status;
title_Name = res.data.data[0].goods_name;
newOrderisli = res.data.data[0].goods_islicode;
if (cookieHandler.get("normal_login_token")) {
if (cookieHandler.get("isliCode") == "undefined" || cookieHandler.get("isliCode") == undefined ||
cookieHandler.get("isliCode") == "" || cookieHandler.get("isliCode") == null) {
$(".pingCart").hide(); //隐藏div
} else {
searchOrder();
$(".pingCart").show(); //显示div
if (res.data.data[0].username != "北京玖扬博文文化发展有限公司") {
$("#addCart").show(); //显示div
$("#employ").show(); //显示div
} else {
$("#employ").hide(); //显示div
$("#addCart").css("margin-right", "168px");
$("#addCart").show(); //显示div
}
}
}
$(".center_left").html(res.data.data[0].goods_image ? good_img(res.data.data[0].goods_image) :
'')
$(".content")[0].innerText = res.data.data[0].goods_name
$(".content")[1].innerText = res.data.data[0].goods_islicode
$(".content")[2].innerText = goodsType(res.data.data[0].goods_type)
$(".content")[3].innerText = entrust(res.data.data[0].goods_entrust)
$(".content")[4].innerText = res.data.data[0].goods_ownership_str
// $(".content")[5].innerText = res.data.data[0].goods_exceptions
$(".content")[6].innerText = period(res.data.data[0].contractual_period)
$(".content")[7].innerText = chargesType(res.data.data[0].charges_type)
// $(".content")[8].innerText = "¥" + res.data.data[0].earnest_money
$(".content")[8].innerText = "¥" + res.data.data[0].price
$(".content_two")[0].innerText = res.data.data[0].user.name
$(".content_two").attr("title", res.data.data[0].user.name);
// $(".content_two")[1].innerText = res.data.data[0].user.registerTime
$(".content_two")[1].innerText = res.data.data[0].user.userType
$(".content_two")[2].innerText = new_total
$(".content1_two")[0].innerText = res.data.data[0].user.islicode
// $(".content1_two")[1].innerText = res.data.data[0].user.authTime
$(".content1_two")[1].innerText = attestStatus(res.data.data[0].user.state)
$(".content1_two")[2].innerText = '进入店铺';
searchGoodsdel(res.data.data[0].source, res.data.data[0].user_islicode)
} else {
Dreamer.error(res.resultMsg);
}
};
};
//进入店铺详情
function store_Detil() {
setTimeout(function() {
$(location).prop('href', './Store_details.html?username=' + query.username + '&time=' + new Date()
.getTime());
}, 1000)
}
// 委托数据查询资源
function searchGoodsdel(data, user_islicode) {
data.myForEach(function(item, index, arr) {
if (item.target_data) {
if (source_data2.indexOf(JSON.parse(item.source_data).isliCode) == -1) {
source_data2.push(JSON.parse(item.source_data).isliCode);
source_data.push([]);
}
source_data[source_data2.indexOf(JSON.parse(item.source_data).isliCode)].push(item);
} else {
target_data.push(JSON.parse(item.source_data))
}
});
if (source_data.length > 0) {
let str2 = "";
source_data.myForEach(function(item, index, arr) {
str2 += '