You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
539 lines
20 KiB
539 lines
20 KiB
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.username = decodeURI(query.username);
|
|
|
|
let user_isli = null; //用户isli
|
|
let channel_organ = ""; //渠道机构
|
|
|
|
window.onload = function () {
|
|
$(".Shopcart").hide(); //隐藏div
|
|
$(".shopyear").hide(); //隐藏div
|
|
$(".talprice").hide(); //隐藏div
|
|
$(".purchase").hide(); //隐藏div
|
|
$("#resourceSet").text(query.goods_type == "1" ? "文化资源数据集" : "文化数字内容集")
|
|
$("#resourceName").text(query.goods_type == "1" ? "文化资源数据集名称" : "文化数字内容集名称")
|
|
$("#singleResource").text(query.goods_type == "1" ? "文化资源数据" : "文化数字内容")
|
|
$("#table").bootstrapTable('destroy');
|
|
user_isli = cookieHandler.get("isliCode");
|
|
$(".ipt").val(""); //输入年限
|
|
$("#addprice").html(0); //计算价格
|
|
getUserName(query.username);
|
|
//点击量
|
|
addClickPageView(query.list_isli);
|
|
}
|
|
|
|
let purchase = {}
|
|
|
|
let pricets = null;
|
|
let goods_islicode = null;
|
|
let ears_of = null; //判断转让
|
|
let title_Name = null; //标的名称
|
|
let type_status = null; //判断状态
|
|
|
|
var new_total = null;
|
|
|
|
let NewuserName = null;
|
|
|
|
//委托数据查询接口
|
|
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;
|
|
getListMsg(query.list_isli); //委托数据详情接口
|
|
}
|
|
}
|
|
|
|
//委托数据查询接口
|
|
function getListMsg(detils_isil) {
|
|
let data = {
|
|
goods_islicode: detils_isil
|
|
};
|
|
var ajaxSearchGoods = new AJAX_OBJ(AgencyAddress + "order/searchGoods", entrustSearchGoods, onUrlError);
|
|
ajaxSearchGoods.postRequestData(JSON.stringify(data));
|
|
}
|
|
|
|
function entrustSearchGoods(xmlHttp) {
|
|
var res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
//排行榜点击量数据
|
|
let leadList = [{
|
|
chargesType: 2, //1-免费 2-付费
|
|
clickCount: 1, //点击量
|
|
contractualPeriod: res.data.data[0].contractual_period, //1-永久性委托 2-阶段性委托 3-一次性委托
|
|
countType: 1, //统计类型 1-点击量 2-销售量
|
|
goodsEntrust: res.data.data[0].goods_entrust, //交易方式;1-转让;2-授权
|
|
goodsIsliCode: res.data.data[0].goods_islicode, //标的isli标识
|
|
goodsName: res.data.data[0].goods_name, //标的名称
|
|
goodsOwnershipStr: res.data.data[0].goods_ownership_str, //权益
|
|
goodsType: res.data.data[0].goods_type, //1-文化资源数据 2-文化数字内容
|
|
salesVolume: 0, //销售量
|
|
}]
|
|
addClickleaderboard(leadList);
|
|
searchGoodsdel(res.data.data[0].source, res.data.data[0].user_islicode, res.data.data[0].username);
|
|
let good_img = "";
|
|
let goos_img = res.data.data[0].goods_image;
|
|
if (goos_img) {
|
|
let reg = RegExp(/data:image\/.*;base64,/);
|
|
if (reg.test(goos_img)) { //判断图片数据是base64吗
|
|
good_img += '<img src=' + goos_img + '>'
|
|
} else {
|
|
good_img += '<img src=' + pathURL + '' + encodeURIComponent(goos_img) + '>'
|
|
}
|
|
} else {
|
|
good_img += '<img src=' + query.img + '>'
|
|
}
|
|
let prostr = '';
|
|
let str = '';
|
|
res.data.data.myForEach(function (item, index, arr) {
|
|
pricets = item.price;
|
|
goods_islicode = item.goods_islicode;
|
|
title_Name = item.goods_name;
|
|
type_status = item.goods_status;
|
|
NewuserName = item.username;
|
|
if (item.username != "中国数字文化集团有限公司" && item.username != "国家图书馆出版社有限公司" && item.username != "深圳国夏文化数字科技有限公司") {
|
|
ears_of = item.goods_entrust;
|
|
$(".Shopcart").show(); //显示div
|
|
$(".shopyear").show(); //显示div
|
|
$(".talprice").show(); //显示div
|
|
$(".purchase").show(); //显示div
|
|
} else {
|
|
ears_of = 3;
|
|
$(".Shopcart").css("margin-left", "1200px");
|
|
$(".Shopcart").show(); //显示div
|
|
}
|
|
transfer(item.goods_entrust); //转让
|
|
if (item.goods_type == '1') {
|
|
item.goods_type = "文化资源数据";
|
|
} else if (item.goods_type == '2') {
|
|
item.goods_type = "文化数字内容";
|
|
}
|
|
//交易方式;1:转让;2:授权'
|
|
if (item.goods_entrust == '1') {
|
|
item.goods_entrust = "转让";
|
|
} else if (item.goods_entrust == '2') {
|
|
item.goods_entrust = "授权";
|
|
}
|
|
//交易方式;(永久,单次,周期)
|
|
if (item.contractual_period == '1') {
|
|
item.contractual_period = "永久性委托";
|
|
} else if (item.contractual_period == '2') {
|
|
item.contractual_period = "一次性委托";
|
|
} else if (item.contractual_period == '3') {
|
|
item.contractual_period = "阶段性委托";
|
|
}
|
|
//付费类型;1:免费;2:付费
|
|
if (item.charges_type == '1') {
|
|
item.charges_type = "免费";
|
|
} else if (item.charges_type == '2') {
|
|
item.charges_type = "付费";
|
|
}
|
|
//权属类型(交易种类为权属时候是所有权,使用权等)1:所有权;2:使用权
|
|
// if (item.goods_ownership == '1') {
|
|
// item.goods_ownership = "所有权";
|
|
// } else if (item.goods_ownership == '2') {
|
|
// item.goods_ownership = "使用权";
|
|
// }
|
|
//认证类型 1:个人;2:机构
|
|
if (item.agency_type == '1') {
|
|
item.agency_type = "个人";
|
|
} else if (item.agency_type == '2') {
|
|
item.agency_type = "机构";
|
|
}
|
|
//认证状态 1:认证中;2:认证成功;3:认证失败
|
|
if (item.user.state == '0') {
|
|
item.user.state = "认证中";
|
|
} else if (item.user.state == '1') {
|
|
item.user.state = "认证成功";
|
|
} else if (item.user.state == '2') {
|
|
item.user.state = "认证失败";
|
|
}
|
|
let new_username = "";
|
|
if (item.username == "深圳国夏文化数字科技有限公司") {
|
|
new_username = "联合推荐方"
|
|
} else {
|
|
new_username = "卖方/授权方名称"
|
|
}
|
|
prostr += '<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '标的名称' + '</div>' +
|
|
'<div class="content">' + item.goods_name + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '标的ISLI标志码' + '</div>' +
|
|
'<div class="content">' + item.goods_islicode + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '标的类型' + '</div>' +
|
|
'<div class="content">' + item.goods_type + '</div>' +
|
|
'</div>' + '<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '交易方式' + '</div>' +
|
|
'<div class="content">' + item.goods_entrust + '</div>' +
|
|
'</div>' + '<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '权益' + '</div>' +
|
|
'<div class="content">' + item.goods_ownership_str + '</div>' +
|
|
'</div>' + '<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '委托类型' + '</div>' +
|
|
'<div class="content">' + item.contractual_period + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '收费类型' + '</div>' +
|
|
'<div class="content">' + item.charges_type + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title">' + '标的价款' + '</div>' +
|
|
'<div class="content">' + (item.username == "中国数字文化集团有限公司" || item.username == "国家图书馆出版社有限公司" || item.username == "深圳国夏文化数字科技有限公司" ?
|
|
"<span style='color:red'>" + "可议价" + "</span>" + " (如需议价请拨打电话:0755-88266899)" : '¥' + item
|
|
.price) + '</div>' +
|
|
'</div>'
|
|
|
|
str += '<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title_two">' + new_username + '</div>' +
|
|
'<div class="content_two" title="' + item.username + '">' + item.username + '</div>' +
|
|
'<div class="title1_two">' + '交易主体唯一标志码' + '</div>' +
|
|
'<div class="content1_two">' + item.user_islicode + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title_two">' + '认证类型' + '</div>' +
|
|
'<div class="content_two">' + item.user.authType + '</div>' +
|
|
'<div class="title1_two">' + '认证状态' + '</div>' +
|
|
'<div class="content1_two">' + item.user.state + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style="margin-top:-1px">' +
|
|
'<div class="title_two">' + '标的数量' + '</div>' +
|
|
'<div class="content_two">' + new_total + '</div>' +
|
|
'<div class="title1_two">' + '店铺详情' + '</div>' +
|
|
'<div class="content1_two" style="color: #337ab7;cursor:pointer" onclick="store_Detil(\'' +
|
|
item.username + '\')">' + '进入店铺' + '</div>' +
|
|
'</div>' +
|
|
'<div class="con_box" style=' + (item.username == "深圳国夏文化数字科技有限公司" ?
|
|
"dispaly:block;margin-top:-1px" : "display:none") + '>' +
|
|
'<div class="title_two">' + '渠道机构' + '</div>' +
|
|
'<div class="content_two" title="' + channel_organ + '">' + channel_organ + '</div>' +
|
|
'</div>'
|
|
});
|
|
$("#cen-ock").html(prostr);
|
|
$("#cen-ock_two").html(str);
|
|
$(".center_left").html(good_img);
|
|
}
|
|
}
|
|
|
|
//进入店铺详情
|
|
function store_Detil(username) {
|
|
setTimeout(function () {
|
|
$(location).prop('href', './Store_details.html?username=' + username + '&time=' + new Date().getTime());
|
|
}, 1000)
|
|
}
|
|
|
|
//大小
|
|
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];
|
|
};
|
|
|
|
let source_data = []; // 资源集
|
|
let source_data2 = []; // 资源集2
|
|
let target_data = []; // 单资源
|
|
|
|
// 委托数据查询资源
|
|
function searchGoodsdel(data, user_islicode, username) {
|
|
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) {
|
|
if (username == "深圳国夏文化数字科技有限公司") {
|
|
$(".channels").css({
|
|
"display": "block",
|
|
"height": "56px",
|
|
"line-height": "56px"
|
|
});
|
|
} else {
|
|
$(".channels").css({
|
|
"display": "none"
|
|
});
|
|
}
|
|
let str2 = "";
|
|
source_data.myForEach(function (item, index, arr) {
|
|
//渠道机构
|
|
if (index < target_data.length - 1) {
|
|
channel_organ += JSON.parse(item[0].source_data).copyrightOwner + ",";
|
|
} else {
|
|
channel_organ += JSON.parse(item[0].source_data).copyrightOwner + "";
|
|
}
|
|
str2 += '<tr><td class="text-center1"><span>' + JSON.parse(item[0].source_data).titleName +
|
|
'</span></td><td class="text-center1"><span>' + JSON.parse(item[0].source_data).classification +
|
|
'</span></td><td class="text-center1" style=' + (username == "深圳国夏文化数字科技有限公司" ?
|
|
"dispaly:block" : "display:none") + '><span>' + JSON.parse(item[0].source_data)
|
|
.copyrightOwner +
|
|
'</span></td><td class="text-center1"><span>' + JSON.parse(item[0].source_data).releaseTime
|
|
.split(" ")[0] +
|
|
'</span></td><td class="text-center1"><span>' + JSON.parse(item[0].source_data).isliCode +
|
|
'</span></td><td class="text-center1"><span>' + item.length +
|
|
'</span></td><td class="text-center1"><span class="details ' + index +
|
|
'">详情</span></td></tr>'
|
|
$("#text-body").html(str2);
|
|
});
|
|
} else {
|
|
$("#three1").hide()
|
|
}
|
|
$('.details').bind('click', function (data) {
|
|
localStorage.setItem("data", JSON.stringify(source_data[data.currentTarget.className.split(" ")[1]]));
|
|
$(location).prop('href', './tasetDetails.html?list_isli=' + query.list_isli + '&goods_type=' + query
|
|
.goods_type +
|
|
'&pricets=' + pricets + '&user_islicode=' + user_islicode + '&ears_of=' + ears_of +
|
|
'&title_Name=' + title_Name + '&type_status=' + type_status + '&NewuserName=' + NewuserName +
|
|
'&time=' + new Date().getTime());
|
|
});
|
|
if (target_data.length > 0) {
|
|
if (username == "深圳国夏文化数字科技有限公司") {
|
|
$(".channel").css({
|
|
"display": "block",
|
|
"height": "36px"
|
|
});
|
|
} else {
|
|
$(".channel").css({
|
|
"display": "none"
|
|
});
|
|
}
|
|
let str = "";
|
|
target_data.myForEach(function (item, index, arr) {
|
|
//渠道机构
|
|
if (source_data.length == 0) {
|
|
if (index < target_data.length - 1) {
|
|
channel_organ += item.copyrightOwner + ",";
|
|
} else {
|
|
channel_organ += item.copyrightOwner + "";
|
|
}
|
|
}
|
|
str += '<tr><td class="text-center1"><span>' + item.titleName +
|
|
'</span></td><td class="text-center1"><span>' + item.identifier +
|
|
'</span></td><td class="text-center1" style=' + (username == "深圳国夏文化数字科技有限公司" ?
|
|
"dispaly:block" : "display:none") + '><span>' + item.copyrightOwner +
|
|
'</span></td><td class="text-center1"><span>' + FileSize(item.metadataFileSize) +
|
|
'</span></td><td class="text-center1"><span>' + item.metadataFileFormat +
|
|
'</span></td><td class="text-center1"><span>' + item.releaseTime.split(" ")[0] +
|
|
'</span></td></tr>'
|
|
$("#text-bodys").html(str);
|
|
});
|
|
} else {
|
|
$("#three2").hide()
|
|
}
|
|
};
|
|
|
|
|
|
//判断数据是否是转让的
|
|
function transfer(pass_Num) {
|
|
if (pass_Num == "1") {
|
|
$(".shopyear").hide();
|
|
// let shopRice = Math.floor(parseFloat(pricets * 100 * 99)) / 100;
|
|
$("#addprice").html(pricets);
|
|
purchase = {
|
|
goods_islicode: goods_islicode,
|
|
use_years: 99,
|
|
is_car: 2, //1:购物车商品;2:不是购物车商品
|
|
}
|
|
}
|
|
}
|
|
|
|
let addprice = null;
|
|
// //输入年限获取价格
|
|
$('.ipt').bind('input propertychange', function (e) {
|
|
addprice = $(".ipt").val();
|
|
if (addprice == 0 || addprice == null) {
|
|
Dreamer.warning("购买年限只能输入整数");
|
|
$(".ipt").val("");
|
|
}
|
|
if (addprice) {
|
|
let shopRice = Math.round(parseFloat(pricets * 100 * e.delegateTarget.value)) / 100;
|
|
$("#addprice").html(shopRice);
|
|
purchase = {
|
|
goods_islicode: goods_islicode,
|
|
use_years: addprice,
|
|
is_car: 2, //1:购物车商品;2:不是购物车商品
|
|
}
|
|
} else {
|
|
$("#addprice").html(0);
|
|
}
|
|
});
|
|
|
|
|
|
function Shopp_Cart() {
|
|
if (cookieHandler.get("normal_login_token")) {
|
|
if (user_isli) {
|
|
if (cookieHandler.get("userType") === "0") {
|
|
Dreamer.error("个人认证账号不能加入购物车!");
|
|
} else {
|
|
if (ears_of == "2") {
|
|
if (addprice != null) {
|
|
$(".Shopcart").attr("disabled", true);
|
|
shop_goods();
|
|
} else {
|
|
Dreamer.warning("购买年限只能输入整数");
|
|
}
|
|
}
|
|
if (ears_of == "1") {
|
|
$(".Shopcart").attr("disabled", true);
|
|
shop_goods();
|
|
}
|
|
if (ears_of == "3") {
|
|
$(".Shopcart").attr("disabled", true);
|
|
shop_goods();
|
|
}
|
|
}
|
|
} else {
|
|
Dreamer.error("账号未认证,请进行认证!");
|
|
setTimeout(function () {
|
|
window.location.href = 'MyCetification.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
} else {
|
|
Dreamer.error("请先登录");
|
|
setTimeout(function () {
|
|
window.location.href = 'login.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
}
|
|
|
|
//加入购物车
|
|
function shop_goods() {
|
|
if (ears_of == "3") {
|
|
purchase.use_years = 1;
|
|
purchase.goods_islicode = goods_islicode
|
|
}
|
|
var ajaxaddShop = new AJAX_OBJ(AgencyAddress + "order/addShoppingCa?goods_isli=" + purchase.goods_islicode +
|
|
"&user_isli=" + user_isli + "&use_years=" + purchase.use_years, entrustaddShop, onUrlError);
|
|
ajaxaddShop.postRequestData();
|
|
}
|
|
|
|
function entrustaddShop(xmlHttp) {
|
|
var res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
Dreamer.success("加入购物车成功");
|
|
$(".Shopcart").val("已加入购物车");
|
|
// $(".ipt").val("");
|
|
// $("#addprice").html(0);
|
|
} else {
|
|
$(".Shopcart").attr("disabled", false);
|
|
Dreamer.error(res.resultMsg);
|
|
// $(".ipt").val("");
|
|
// $("#addprice").html(0);
|
|
}
|
|
}
|
|
|
|
//点击购物车将数据传到购物车
|
|
$(".Shopcart").click(Shopp_Cart);
|
|
|
|
|
|
function order() {
|
|
if (cookieHandler.get("normal_login_token")) {
|
|
if (user_isli) {
|
|
if (cookieHandler.get("userType") === "0") {
|
|
Dreamer.error("个人认证账号不能购买!");
|
|
} else {
|
|
if (type_status == 1 || type_status == 5) {
|
|
if (ears_of == "2") {
|
|
if (addprice) {
|
|
// if ($("#addprice").html() > 20000) {
|
|
// Dreamer.warning("单次购买金额不能高于2万");
|
|
// } else {
|
|
$(".purchase").attr("disabled", true);
|
|
Buy_now();
|
|
// }
|
|
} else {
|
|
Dreamer.warning("请输入购买年限");
|
|
}
|
|
}
|
|
if (ears_of == "1") {
|
|
// if (pricets > 20000) {
|
|
// Dreamer.warning("单次购买金额不能高于2万");
|
|
// } else {
|
|
$(".purchase").attr("disabled", true);
|
|
Buy_now();
|
|
// }
|
|
}
|
|
} else {
|
|
if (type_status == 5) {
|
|
Dreamer.warning(title_Name + "正在委托中,无法购买");
|
|
} else {
|
|
Dreamer.warning(title_Name + "无法购买");
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
Dreamer.error("账号未认证,请进行认证!");
|
|
setTimeout(function () {
|
|
window.location.href = 'MyCetification.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
} else {
|
|
Dreamer.error("请先登录");
|
|
setTimeout(function () {
|
|
window.location.href = 'login.html?time=' + new Date().getTime();
|
|
}, 1000)
|
|
}
|
|
}
|
|
|
|
//立即购买
|
|
function Buy_now() {
|
|
var ajaxAddress = new AJAX_OBJ(AgencyAddress + "order/createOrder?goods_isli=" + purchase.goods_islicode +
|
|
"&is_car=" + purchase.is_car + "&user_isli=" + user_isli + "&use_years=" + purchase.use_years,
|
|
entrustAddress, onUrlError);
|
|
ajaxAddress.postRequestData();
|
|
}
|
|
|
|
function entrustAddress(xmlHttp) {
|
|
var res = eval('(' + xmlHttp.responseText + ')');
|
|
if (res.resultCode === "00000000") {
|
|
$(location).prop('href', './payment.html?batchcode=' + res.data.batchcode + '&img=' + query.img + '&time=' +
|
|
new Date().getTime());
|
|
$(".ipt").val("");
|
|
$("#addprice").html(0);
|
|
} else {
|
|
$(".purchase").attr("disabled", false);
|
|
Dreamer.error(res.resultMsg);
|
|
$(".ipt").val("");
|
|
$("#addprice").html(0);
|
|
}
|
|
}
|
|
|
|
//点击立即购买,调下单推送接收接口
|
|
$(".purchase").click(order);
|
|
|