922 lines
33 KiB
Plaintext
922 lines
33 KiB
Plaintext
<#---------------------------------------------------->
|
|
<#-- 以下为变量定义 ------------------------>
|
|
<#---------------------------------------------------->
|
|
|
|
<#--脚注标注-->
|
|
<#var zmr_copyname="2021 秒绘科技"/>
|
|
<#var zmr_copyright="Copyright © "+zmr_copyname+" All Rights Reserved"/>
|
|
${Styles.src(zhiqim.css)}
|
|
${Scripts.src(zhiqim.js)}
|
|
${Styles.src(context.getRootPath("/zinc/css/yangcai_question_main_v1.4.0R2018031701.css"))}
|
|
${Scripts.src(context.getRootPath("/zinc/css/zhiqim_search_auto_list_v1.4.0R2018031701.js"))}
|
|
|
|
<#--属性定义-->
|
|
<#var name="设计运营后台"/>
|
|
<#var version="V1.0"/>
|
|
<#var zhiqim_uploadlarge.js = new ZmrCdnRuntime(context, "/service/res/zhiqim_upload_large_v1.5.0.r2018111001.js")/>
|
|
|
|
|
|
<#--刷新左边区域自定义块-->
|
|
<#function zhiqim_manager_topnav_left_defined()>
|
|
<script>
|
|
Z.onload(function()
|
|
{
|
|
|
|
});
|
|
</script>
|
|
</#function>
|
|
|
|
<#-- 重写模板编辑版本号-->
|
|
<#var media_editor_js_version="v1.5.0_r2020121101"/>
|
|
|
|
<#-- 重写模板定稿、预览-->
|
|
<#function zhqim_media_edit_print(mediaId)>
|
|
<script>
|
|
|
|
//提交初稿设计订单
|
|
function doSubmitDraftOrderTempalte(mediaId)
|
|
{
|
|
var orderIsDzmpCardType = '${orderIsCardType}';
|
|
if (orderIsDzmpCardType == 'true') {
|
|
// 保存名片关联信息
|
|
doUpdateCardInfo('${cardId}','${designId}', false);
|
|
}
|
|
|
|
// 保存后的回调方法
|
|
function callbackAfterSave(mediaId)
|
|
{
|
|
var ajax2 = new Z.Ajax();
|
|
ajax2.setClassName("TemplateOrderPresenter");
|
|
ajax2.setMethodName("doSubmitDraftOrderTempalte");
|
|
ajax2.addParam("mediaId", mediaId);
|
|
ajax2.setFailure(function(){
|
|
setTimeout(function()
|
|
{
|
|
doDraftOrder_ajaxLoading.close()
|
|
Z.failure(ajax2.responseText);
|
|
},400);
|
|
});
|
|
ajax2.setSuccess(function(){
|
|
setTimeout(function()
|
|
{
|
|
doDraftOrder_ajaxLoading.close();
|
|
Z.success("初稿成功");
|
|
},400);
|
|
});
|
|
ajax2.execute();
|
|
}
|
|
|
|
// 1:定义加载框
|
|
window.doDraftOrder_ajaxLoading = Z.loading({text:"正在提交初稿文件,请稍后...", shadow:true , width:400});
|
|
|
|
if (hasSvg2pdfAPI)
|
|
{
|
|
doSubmitDraftLocalSave(callbackAfterSave, mediaId);
|
|
}
|
|
else
|
|
{
|
|
doAutoSaveMedia(callbackAfterSave, mediaId, true);
|
|
}
|
|
}
|
|
|
|
//完成定稿,预览设计稿
|
|
function doPreviewFinalOrderTempalte(mediaId)
|
|
{
|
|
//生成PDF文件并预览展示,保存后的回调方法
|
|
function callbackAfterSave(mediaId)
|
|
{
|
|
var doHandle = (hasSvg2pdfAPI) ? 0 : 1;
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doPreviewFinalOrderTempalte");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.addParam("doHandle", doHandle);
|
|
ajax.setFailure(function(){
|
|
previewFinal_ajaxLoading.close();
|
|
Z.failure(ajax.responseText);
|
|
});
|
|
ajax.setSuccess(function(){
|
|
doPreviewFinalOrderDialog(mediaId);
|
|
});
|
|
ajax.execute();
|
|
}
|
|
|
|
//检测订单模板的版面数
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doCheckTempatePage");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.setFailure(function(){
|
|
Z.failure(ajax.responseText);
|
|
});
|
|
ajax.setSuccess(function()
|
|
{
|
|
//加载框
|
|
window.previewFinal_ajaxLoading = Z.loading({shadow: true, text:"定稿预览处理中...", width:200});
|
|
if (hasSvg2pdfAPI)
|
|
{
|
|
callbackAfterSave(mediaId);
|
|
}
|
|
else
|
|
{
|
|
doAutoSaveMedia(callbackAfterSave, mediaId, true);
|
|
}
|
|
});
|
|
ajax.setLoading(document, true);
|
|
ajax.execute();
|
|
}
|
|
|
|
//预览定稿展示
|
|
function doPreviewFinalOrderDialog(mediaId)
|
|
{
|
|
if (hasSvg2pdfAPI)
|
|
{
|
|
ServiceAPI.mediaId = mediaId;
|
|
doPreviewFileLocalSave(previewFinal_ajaxLoading);
|
|
}
|
|
else
|
|
{
|
|
doPreviewDialogQuery(mediaId);
|
|
}
|
|
}
|
|
|
|
function previewPdfLocal()
|
|
{//重写pdfMaker,预览pdf方法
|
|
// ajax 查询订单金额
|
|
var amount = 0;
|
|
var ajax = new Z.Ajax();
|
|
ajax.setSync();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doQueryOrderAmount");
|
|
ajax.addParam("mediaId", media.canvas.mediaId);
|
|
ajax.setFailure(function(){
|
|
previewFinal_ajaxLoading.close();
|
|
});
|
|
ajax.setSuccess(function(){
|
|
amount = parseFloat(this.responseText || 0);
|
|
});
|
|
ajax.execute();
|
|
|
|
if (amount <= 0)
|
|
return doClearErrorLocalSave("订单金额查询有误!");
|
|
|
|
previewFinal_ajaxLoading.close();
|
|
|
|
var mediaId = ServiceAPI.mediaId;
|
|
var height = Z.D.clientHeight() - 200;
|
|
var html = '<div id="previewId" class="z-text-center" style="height:'+height+'px">';
|
|
//html += ' <object type="text/html" width="100%" height="100%" data="'+objUrl+'"></object>';
|
|
//html += ' <iframe width="100%" height="100%" src="'+objUrl.+'"></iframe>';
|
|
//html += '<embed src="'+objUrl+'" type="application/pdf" width="100%" height="100%">';
|
|
//html += '<embed src="'+objUrl+'" type="text/html" width="100%" height="100%">';
|
|
//html += ' <object type="application/pdf" width="100%" height="100%" data="'+objUrl+'"></object>';
|
|
html += '</div>';
|
|
html += '<div class="z-absolute z-w100p z-h60 z-text-center z-bg-gray z-pd10" style="bottom:0;left:0">';
|
|
html += ' <button id="save" type="button" class="z-button z-large z-w120 z-cyan"';
|
|
html += 'onclick="confirmSubmitFinalOrderTempalte('+mediaId+','+amount+')">完成定稿</button> ';
|
|
html += ' <button type="button" class="z-button z-large z-mg-l10" onclick="previewPdfDialogLocal.close();">关闭</button>';
|
|
html += '</div>';
|
|
top.previewPdfDialogLocal = new Z.Dialog();
|
|
previewPdfDialogLocal.title = "预览定稿文件";
|
|
previewPdfDialogLocal.text = html;
|
|
previewPdfDialogLocal.width = parseInt(Z.D.clientWidth()/2);
|
|
previewPdfDialogLocal.height = parseInt(height + 60);
|
|
previewPdfDialogLocal.fixed = true;
|
|
previewPdfDialogLocal.execute();
|
|
|
|
// 重写弹窗关闭方法
|
|
var closeFun = previewPdfDialogLocal.close;
|
|
previewPdfDialogLocal.close = function()
|
|
{
|
|
closeFun.call(previewPdfDialogLocal);
|
|
previewPdfDialogLocal = null;
|
|
doClearPreviewLocalSave();
|
|
}
|
|
previewPdfDialogLocal.$title.find(".z-font.z-error").hide();
|
|
Z('<i class="z-font z-error"></i>').appendTo(previewPdfDialogLocal.$title).on("click",previewPdfDialogLocal.close);
|
|
|
|
// pdfJs显示效果
|
|
pdfjsLib.renderAllFromData({node:"#previewId",scale:300/72},ServiceAPI.pdfFinaly.result).then(function()
|
|
{
|
|
// 样式校准
|
|
var previewWidth = Z.D.id("previewId").getBoundingClientRect().width - 30;
|
|
var $$canvas = Z("#previewId canvas");
|
|
|
|
$$canvas.each(function($canvas)
|
|
{
|
|
var canvasWidth = $canvas.width;
|
|
if (previewWidth > canvasWidth)
|
|
return;
|
|
|
|
var canvasHeight = $canvas.height;
|
|
$canvas.style.width = previewWidth + "px";
|
|
$canvas.style.height = previewWidth/canvasWidth*canvasHeight + "px";
|
|
});
|
|
});
|
|
}
|
|
|
|
//定稿预览显示
|
|
function doPreviewDialogQuery(mediaId)
|
|
{
|
|
//ajax查询处理状态
|
|
function doQueryPreviewProgressing(mediaId)
|
|
{
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doQueryPreviewFinalOrderTempalteProgressing");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.setFailure(function(){
|
|
previewFinal_ajaxLoading.close();
|
|
Z.failure(ajax.responseText);
|
|
});
|
|
ajax.setSuccess(function(){
|
|
var obj = Z.J.toObject(ajax.responseText);
|
|
var mediaHandlePdfModel = obj.mediaHandlePdfModel;
|
|
if (mediaHandlePdfModel)
|
|
{
|
|
console.log("预览处理状态:"+mediaHandlePdfModel.handleStatus)
|
|
if (mediaHandlePdfModel.handleStatus == 0 || mediaHandlePdfModel.handleStatus == 1)
|
|
{// 待处理 // 处理中
|
|
setTimeout(doQueryPreviewProgressing, 5000, mediaId);
|
|
}
|
|
else if (mediaHandlePdfModel.handleStatus == 3)
|
|
{//处理失败
|
|
previewFinal_ajaxLoading.close();
|
|
Z.failure(mediaHandlePdfModel.errorMsg);
|
|
}
|
|
else if (mediaHandlePdfModel.handleStatus == 2)
|
|
{// 处理完成
|
|
previewFinal_ajaxLoading.close();
|
|
var height = Z.D.clientHeight() - 200;
|
|
var amount = obj.amount;
|
|
var html = '<div id="previewId" style="height:'+height+'px">';
|
|
html += window.pdfjsLib?'':'<object type="text/html" width="100%" height="100%" data="'+obj.url+'"></object>';
|
|
html += '</div>';
|
|
html += '<div class="z-absolute z-w100p z-h60 z-text-center z-bg-gray z-pd10" style="bottom:0;left:0">';
|
|
html += ' <button id="save" type="button" class="z-button z-large z-w120 z-cyan" onclick="confirmSubmitFinalOrderTempalte('+mediaId+','+amount+')">完成定稿</button> ';
|
|
html += ' <button type="button" class="z-button z-large z-mg-l10" onclick="Z.Dialog.close(location.hash);">关闭</button>';
|
|
html += '</div>';
|
|
var dialog = new Z.Dialog();
|
|
dialog.title = "预览定稿文件";
|
|
dialog.text = html;
|
|
dialog.width = parseInt(Z.D.clientWidth()/2);
|
|
dialog.height = parseInt(height + 60);
|
|
dialog.fixed = true;
|
|
dialog.execute();
|
|
|
|
window.pdfjsLib && pdfjsLib.renderAll("#previewId", obj.url);
|
|
}
|
|
else
|
|
{
|
|
previewFinal_ajaxLoading.close();
|
|
console.log("定稿预览收到异常处理状态")
|
|
}
|
|
}
|
|
else
|
|
{//查不到处理对象
|
|
previewFinal_ajaxLoading.close();
|
|
console.log("定稿预览找不到处理对象")
|
|
Z.failure("预览处理失败");
|
|
}
|
|
});
|
|
ajax.execute();
|
|
}
|
|
|
|
//延时处理 查询
|
|
setTimeout(doQueryPreviewProgressing, 500, mediaId);
|
|
}
|
|
|
|
//确认定稿操作
|
|
function confirmSubmitFinalOrderTempalte(mediaId, amount)
|
|
{
|
|
//提交定稿确认弹窗
|
|
var tips = "确定完成对稿吗?定稿后该订单模板不再支持修改!";
|
|
if (amount >= 10000)
|
|
{
|
|
tips="此订单金额较大,请仔细核对无误再定稿,以免造成售后损失。定稿后该订单模板不再支持修改!"
|
|
}
|
|
|
|
Z.confirm(tips, function()
|
|
{
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doCheckTempatePage");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.setFailure(function(){
|
|
Z.failure(ajax.responseText);
|
|
});
|
|
ajax.setSuccess(function()
|
|
{
|
|
//加载筐
|
|
window.submitFinal_ajaxLoading = Z.loading({shadow: true, text:"定稿处理中...", width:180});
|
|
|
|
var doHandle = (hasSvg2pdfAPI) ? 0 : 1;
|
|
var ajax2 = new Z.Ajax();
|
|
ajax2.setClassName("TemplateOrderPresenter");
|
|
ajax2.setMethodName("doSubmitFinalOrderTempalte");
|
|
ajax2.addParam("mediaId", mediaId);
|
|
ajax2.addParam("doHandle", doHandle);
|
|
ajax2.setFailure(function(){
|
|
window.submitFinal_ajaxLoading.close();
|
|
Z.failure(ajax2.responseText);
|
|
});
|
|
ajax2.setSuccess(function()
|
|
{
|
|
//直接使用预览的pdf文件来定稿
|
|
var obj = Z.J.toObject(this.responseText ? this.responseText : "{}");
|
|
if(obj.success == "true")
|
|
{
|
|
submitFinal_ajaxLoading.close();
|
|
Z.success("定稿完成", function(){Z.L.reload()});
|
|
}
|
|
else
|
|
{
|
|
//重新生成pdf文件来定稿
|
|
if (hasSvg2pdfAPI)
|
|
{
|
|
doSubmitFinalLocalSave(this.responseText);
|
|
}
|
|
else
|
|
{
|
|
doSubmitFinalAjaxSave(mediaId);
|
|
}
|
|
}
|
|
});
|
|
ajax2.setLoading(document, true);
|
|
ajax2.execute();
|
|
|
|
});
|
|
ajax.setLoading("save", '正在提交', {disabled:true});
|
|
ajax.execute();
|
|
});
|
|
}
|
|
|
|
//客户端提交定稿,生成PDF
|
|
function doSubmitFinalLocalSave(responseText)
|
|
{
|
|
var fileData = Z.J.toObject(responseText);
|
|
// 上传完成,更新数据
|
|
var callback = function()
|
|
{
|
|
submitFinal_ajaxLoading.close();
|
|
Z.success("定稿完成", function(){Z.L.reload()});
|
|
}
|
|
//上传pdf
|
|
doUploadPdfLocal(fileData.fileName, fileData.uploadPath, callback, {
|
|
className: "TemplateOrderPresenter",
|
|
methodName: "doSubmitFinalLocalSave",
|
|
mediaId: mediaId, // mediaID
|
|
mediaUrl: ServiceAPI.imgPath, // 缩略图
|
|
pdfPath: fileData.pdfPath, // pdf成品
|
|
});
|
|
}
|
|
//ajax提交定稿,生成PDF
|
|
function doSubmitFinalAjaxSave(mediaId)
|
|
{//发送异步处理成功
|
|
|
|
function queryProgressing(mediaId)
|
|
{
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doQueryFinalOrderTemplateProgressing");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.setFailure(function(){
|
|
submitFinal_ajaxLoading.close();
|
|
Z.failure(ajax.responseText);
|
|
});
|
|
ajax.setSuccess(function()
|
|
{
|
|
var obj = Z.J.toObject(ajax.responseText);
|
|
var mediaHandlePdfModel = obj.mediaHandlePdfModel;
|
|
if (mediaHandlePdfModel)
|
|
{
|
|
var handleStatus = mediaHandlePdfModel.handleStatus;
|
|
console.log("定稿处理状态:"+handleStatus);
|
|
if (handleStatus == 0 || handleStatus == 1)
|
|
{//待处理 处理中
|
|
setTimeout(queryProgressing, 500, mediaId)
|
|
}
|
|
else if (handleStatus == 2)
|
|
{//处理完成
|
|
submitFinal_ajaxLoading.close();
|
|
Z.success("定稿完成", function(){Z.L.reload()});
|
|
}
|
|
else if (handleStatus == 3)
|
|
{//处理失败
|
|
submitFinajaxaxLoading.close();
|
|
Z.failure(mediaHandlePdfModel.errorMsg);
|
|
}
|
|
else
|
|
{
|
|
submitFinal_ajaxLoading.close();
|
|
console.log("定稿预览收到异常处理状态")
|
|
}
|
|
}
|
|
else
|
|
{//查不到处理对象
|
|
submitFinal_ajaxLoading.close();
|
|
console.log("定稿处理找不到处理对象");
|
|
Z.failure("定稿处理失败");
|
|
}
|
|
|
|
});
|
|
ajax.execute();
|
|
}
|
|
|
|
setTimeout(queryProgressing, 500, mediaId);
|
|
}
|
|
</script>
|
|
<#if !isTemplateEdit>
|
|
<style>
|
|
.topnav .topToolBar .topToolRight{flex-basis: 480px;}
|
|
.topnav .topToolRight #draftBtn{background-color:#009049;}
|
|
.topnav .topToolRight #finalBtn{background-color:#de1e08;}
|
|
</style>
|
|
<div id="draftBtn" class="nav topTool" onclick="doSubmitDraftOrderTempalte('${mediaId}');">提交初稿</div>
|
|
<div id="finalBtn" class="nav topTool" onclick="doPreviewFinalOrderTempalteCheckLabel('${mediaId}');">完成定稿</div>
|
|
</#if>
|
|
</#function>
|
|
|
|
<#-- 重写模板左边订单选项-->
|
|
<#function zhqim_media_edit_order_item_defined(mediaId)>
|
|
<script>
|
|
function openWangWang(buyerNick)
|
|
{//打开旺旺
|
|
Z("#openFrm").attr("src","http://amos.alicdn.com/msg.aw?v=2&uid="+buyerNick+"&site=cntaobao&s=2&charset=utz-8");
|
|
}
|
|
|
|
function openQQ(userQq)
|
|
{//打开QQ
|
|
if (!Z.V.isInteger(userQq))
|
|
{
|
|
Z.alert("客户未提供QQ号,请旺旺联系");
|
|
return;
|
|
}
|
|
|
|
Z("#openFrm").attr("src","tencent://message/?uin="+userQq);
|
|
}
|
|
|
|
function doTemplateOrderEdit(mediaId)
|
|
{//编辑
|
|
Z.l.href ="/zhiqimMediaEditor/mediaDesign.htm?mediaId=" + mediaId;
|
|
}
|
|
|
|
function doTemplateOrderDelete(mediaId, designId)
|
|
{//删除
|
|
if (Z.V.isEmpty(mediaId))
|
|
{
|
|
Z.alert("请选择模板");
|
|
return;
|
|
}
|
|
|
|
Z.confirm("你确定要删除该模板吗?", function(){
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplatePresenter");
|
|
ajax.setMethodName("doTemplateDelete");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.addParam("designId", designId);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function(){
|
|
Z.success("删除成功", function(){Z.L.reload();});
|
|
});
|
|
ajax.execute();
|
|
});
|
|
}
|
|
|
|
function doTabnavCss(value)
|
|
{
|
|
if (value == 1)
|
|
{
|
|
Z("#tabnav_user").addClass("z-active");
|
|
Z("#tabnav_template").removeClass("z-active");
|
|
Z("#tabnav_user_content").addClass("z-active");
|
|
Z("#tabnav_template_content").removeClass("z-active");
|
|
}
|
|
else if (value == 2)
|
|
{
|
|
Z("#tabnav_user").removeClass("z-active");
|
|
Z("#tabnav_template").addClass("z-active");
|
|
Z("#tabnav_user_content").removeClass("z-active");
|
|
Z("#tabnav_template_content").addClass("z-active");
|
|
}
|
|
else if (value == 3)
|
|
{
|
|
Z("#tabnav_userText").addClass("z-active");
|
|
Z("#tabnav_paramText").removeClass("z-active");
|
|
Z("#tabnav_userText_content").addClass("z-active");
|
|
Z("#tabnav_paramText_content").removeClass("z-active");
|
|
}
|
|
else if (value == 4)
|
|
{
|
|
Z("#tabnav_userText").removeClass("z-active");
|
|
Z("#tabnav_paramText").addClass("z-active");
|
|
Z("#tabnav_userText_content").removeClass("z-active");
|
|
Z("#tabnav_paramText_content").addClass("z-active");
|
|
}
|
|
}
|
|
|
|
function doQueryOrderInfo(mediaId)
|
|
{//订单API
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doTemplateOrderQuery");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.setCallback("side_order");
|
|
ajax.setLoading("side_order");
|
|
ajax.execute();
|
|
}
|
|
|
|
function doCopyOtherPage(mediaSrcId, bid, mediaId)
|
|
{//复制其它页
|
|
Z.confirm("你确定要复制该版面?", function()
|
|
{
|
|
// 新建 coverMaterial,字符串传参
|
|
var lastBgObj = media.bgList[media.bgList.length - 1];
|
|
var newBid = lastBgObj.bid + 1;
|
|
var bgObj = new Z.Bg();
|
|
bgObj.bid = newBid;
|
|
media.bgList.push(bgObj);
|
|
var newCMList = setCoverMaterial(bgObj, media.canvas.widthMm, media.canvas.heightMm);
|
|
|
|
// ajax调用
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("MediaPresenter");
|
|
ajax.setMethodName("doCopyOtherPage");
|
|
ajax.addParam("mediaSrcId", mediaSrcId);
|
|
ajax.addParam("bid", bid);
|
|
ajax.addParam("newBid", newBid);
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.addParam("coverMaterialList", Z.AR.toString(newCMList));
|
|
ajax.setFailure(media.bgList.pop);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function()
|
|
{
|
|
//定义 media
|
|
var newMedia = Z.J.toObject(this.responseText);
|
|
media = new Z.Media({canvas: newMedia.canvas, bgList: newMedia.bgList, materialList: newMedia.materialList, coverMaterialList: newMedia.coverMaterialList});
|
|
|
|
//刷新画布
|
|
loadCanvas();
|
|
|
|
//刷新版面
|
|
refreshPageList();
|
|
Z.tips("复制成功");
|
|
});
|
|
ajax.setLoading(document);
|
|
ajax.execute();
|
|
});
|
|
}
|
|
|
|
function doDownFile(attaId)
|
|
{//下载
|
|
Z.l.href ="/templateDownload.htm?attaId=" + attaId + "&type=orderFile";
|
|
}
|
|
|
|
//标签选择客户类型
|
|
function doSelectConsumerType(flag){
|
|
Z("#consumerType_"+flag).addClass("z-blue").siblings("button").removeClass("z-blue");
|
|
}
|
|
|
|
//通过关键词查主行业
|
|
function doQueryIndustryByKey(){
|
|
var industryKey=Z("#industryKey").val();
|
|
var labelOid = Z("#labelOid").val();
|
|
var unmatchkey=Z("#unmatchkey").val();
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doQueryIndustryByKey");
|
|
ajax.addParam("industryKey",industryKey);
|
|
ajax.addParam("labelOid",labelOid);
|
|
ajax.addParam("unmatchkey",unmatchkey);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function(){
|
|
var map=Z.J.toObject(this.responseText);
|
|
var industrys=map.industrys;
|
|
var newUnmatchkey=map.unmatchkey;
|
|
var htmlstr="";
|
|
Z.each(industrys, function(industry, i){
|
|
htmlstr+='<button id="industry_'+industry.industryId+'" type="button" class="z-button z-mg3 main-industry" value="'+industry.industryId+'" onclick="doQueryIndustryLabel('+industry.industryId+')">'+industry.industryName+'</button>';
|
|
});
|
|
Z("#mainIndustry").html(htmlstr);
|
|
Z("#subIndustry").html("");
|
|
Z("#applicationScenario").html("");
|
|
Z("#designStyle").html("");
|
|
Z("#unmatchkey").val(newUnmatchkey);
|
|
|
|
// 推荐行业页面元素遍历拼接
|
|
var recommendIndHtml = "";
|
|
var recommendIndustrys = map.recommendIndustryList;
|
|
Z.each(recommendIndustrys, function(industry, i){
|
|
recommendIndHtml += '<button id="recommend_industry_'+industry.industryId+'" type="button" class="z-button z-mg3 recommend-industry" value="'+industry.industryId+'" onclick="doQueryIndustryLabel('+industry.industryId+', 1)">'+industry.industryName+'</button>';
|
|
});
|
|
Z("#recommendIndustry").html(recommendIndHtml);
|
|
});
|
|
ajax.setLoading("queryIndustryByKey", '<i class="z-font z-return"></i>正在处理',{disabled:true});
|
|
ajax.execute();
|
|
}
|
|
|
|
function doQueryOrderLabel(mediaId){
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doTemplateOrderLabelQuery");
|
|
ajax.addParam("mediaId", mediaId);
|
|
ajax.setCallback("side_label");
|
|
ajax.setLoading("side_label");
|
|
ajax.execute();
|
|
}
|
|
|
|
//查询标签
|
|
function doQueryIndustryLabel(industryId, isRecommend){
|
|
if(isRecommend)
|
|
{
|
|
Z("#recommend_industry_"+industryId).addClass("z-blue").siblings("button").removeClass("z-blue");
|
|
Z(".main-industry").removeClass("z-blue");
|
|
}
|
|
else
|
|
{
|
|
Z("#industry_"+industryId).addClass("z-blue").siblings("button").removeClass("z-blue");
|
|
Z(".recommend-industry").removeClass("z-blue");
|
|
}
|
|
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doQueryIndustryLabel");
|
|
ajax.addParam("industryId",industryId);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function(){
|
|
var map=Z.J.toObject(this.responseText);
|
|
var htmlSI="";
|
|
var htmlAS="";
|
|
var htmlDS="";
|
|
var labelList=map.labelList;
|
|
var dimensionList=map.dimensionList;
|
|
var dimensionMap=new Map();
|
|
for (var i in dimensionList) {
|
|
dimensionMap.set(dimensionList[i].dimensionId,dimensionList[i].dimensionName);
|
|
}
|
|
|
|
Z.each(labelList, function(label, i){
|
|
if("子行业"==dimensionMap.get(label.dimensionId)){
|
|
htmlSI+='<button id="label_'+label.id+'" type="button" class="z-button z-mg3" value="'+label.id+'" onclick="doLabelSelected('+label.id+')">'+label.labelName+'</button>';
|
|
}
|
|
if("应用场景"==dimensionMap.get(label.dimensionId)){
|
|
htmlAS+='<button id="label_'+label.id+'" type="button" class="z-button z-mg3" value="'+label.id+'" onclick="doLabelSelected('+label.id+')">'+label.labelName+'</button>';
|
|
}
|
|
if("设计风格"==dimensionMap.get(label.dimensionId)){
|
|
htmlDS+='<button id="label_'+label.id+'" type="button" class="z-button z-mg3" value="'+label.id+'" onclick="doLabelSelected('+label.id+')">'+label.labelName+'</button>';
|
|
}
|
|
});
|
|
Z("#subIndustry").html(htmlSI);
|
|
Z("#applicationScenario").html(htmlAS);
|
|
Z("#designStyle").html(htmlDS);
|
|
});
|
|
ajax.execute();
|
|
}
|
|
|
|
//选择标签
|
|
function doLabelSelected(id){
|
|
Z("#label_"+id).addClass("z-blue").siblings("button").removeClass("z-blue");
|
|
}
|
|
|
|
//保存标签
|
|
function doSaveLabel(){
|
|
var unmatchkey=Z("#unmatchkey").val();
|
|
var labelOid = Z("#labelOid").val();
|
|
var consumerType=Z("button[id^='consumerType'][class*='z-blue']").val();//客户类型
|
|
var industryId=Z("div[id='mainIndustry'] button[class*='z-blue']").val();//主行业
|
|
|
|
// 如果选择了推荐行业则保存时替换为主行业id
|
|
var recommendIndustryId = Z("div[id='recommendIndustry'] button[class*='z-blue']").val();// 推荐行业
|
|
if (!industryId)
|
|
{
|
|
if (Z.V.isEmpty(recommendIndustryId))
|
|
{
|
|
Z.alert("请选择主行业或者推荐行业");
|
|
return;
|
|
}
|
|
industryId = recommendIndustryId;
|
|
}
|
|
|
|
var subIndustryId=Z("div[id='subIndustry'] button[class*='z-blue']").val();//子行业
|
|
var applicationScenarioId=Z("div[id='applicationScenario'] button[class*='z-blue']").val();//应用场景
|
|
var designStyleId=Z("div[id='designStyle'] button[class*='z-blue']").val();//设计风格
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doSaveIndustryLabel");
|
|
ajax.addParam("labelOid",labelOid);
|
|
ajax.addParam("consumerType",consumerType);
|
|
ajax.addParam("industryId",industryId);
|
|
ajax.addParam("subIndustryId",subIndustryId);
|
|
ajax.addParam("applicationScenarioId",applicationScenarioId);
|
|
ajax.addParam("designStyleId",designStyleId);
|
|
ajax.addParam("unmatchkey",unmatchkey);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function(){
|
|
Z("#unmatchkey").val("");
|
|
Z.alert("保存成功");
|
|
});
|
|
ajax.setLoading("saveLabel", '<i class="z-font z-return"></i>正在处理',{disabled:true});
|
|
ajax.execute();
|
|
}
|
|
|
|
function doCancelLabel(){
|
|
Z("button[id^='consumerType'][class*='z-blue']").removeClass("z-blue");
|
|
Z("div[id='mainIndustry'] button[class*='z-blue']").removeClass("z-blue");
|
|
Z("div[id='subIndustry'] button[class*='z-blue']").removeClass("z-blue");
|
|
Z("div[id='applicationScenario'] button[class*='z-blue']").removeClass("z-blue");
|
|
Z("div[id='designStyle'] button[class*='z-blue']").removeClass("z-blue");
|
|
Z("#subIndustry").html("");
|
|
Z("#applicationScenario").html("");
|
|
Z("#designStyle").html("");
|
|
}
|
|
|
|
function doPreviewFinalOrderTempalteCheckLabel(mediaId){
|
|
/*
|
|
if(orderIsCardType&&!curPageCardId){
|
|
Z.alert("在定稿前请先生成电子名片二维码并保存");
|
|
return;
|
|
}
|
|
*/
|
|
|
|
// 智能电子名片定稿时需要二次确认
|
|
var orderIsDzmpCardType = '${orderIsCardType}';
|
|
if (orderIsDzmpCardType == 'true') {
|
|
beforeShowDzmpQrcode("endDraft");
|
|
return;
|
|
}
|
|
|
|
doPreviewFinalOrderTempalte(mediaId);
|
|
/* var ajax = new Z.Ajax();
|
|
ajax.setClassName("TemplateOrderPresenter");
|
|
ajax.setMethodName("doPreviewFinalOrderTempalteCheckLabel");
|
|
ajax.addParam("mediaId",mediaId);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function(){
|
|
var map=Z.J.toObject(this.responseText);
|
|
if(map.flag==false){
|
|
var dialog = new Z.Dialog();
|
|
dialog.title = "补充订单【"+map.designId+"】的标签信息";
|
|
dialog.url = "/fillLabelInfo.htm?designId="+map.designId+"&mediaId="+mediaId;
|
|
dialog.width = 900;
|
|
dialog.height = 360;
|
|
dialog.execute();
|
|
}else{
|
|
|
|
}
|
|
});
|
|
ajax.setLoading("finalBtn", '<i class="z-font z-return"></i>正在处理',{disabled:true});
|
|
ajax.execute();
|
|
*/
|
|
}
|
|
</script>
|
|
|
|
<li onclick="doChangeSidebar(this,'order');doQueryOrderInfo('${mediaId}');"><i class="z-font z-text zi-px24"></i><br>订单</li>
|
|
<!-- <li id="label" onclick="doChangeSidebar(this,'label');doQueryOrderLabel('${mediaId}');"><i class="z-font z-add zi-px24"></i><br>标签</li> -->
|
|
</#function>
|
|
|
|
<!-- 重写我的素材选项-->
|
|
<#function zhqim_media_my_material_defined()>
|
|
<script>
|
|
var allMaterialCatList = Z.J.toObject('${Global.get(MaterialCatCache.class).list()}'); // 素材分类对象
|
|
Z.onload(function(){
|
|
doQueryUserMaterial("1");
|
|
});
|
|
function doQueryUserMaterial(page)
|
|
{//查询我的素材
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("UserMaterialPresenter");
|
|
ajax.setMethodName("doQueryUserMaterial");
|
|
ajax.addParam("page", page);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function()
|
|
{
|
|
var list = Z.J.toObject(this.responseText);
|
|
var ulHtml = "<ul>";
|
|
for(var i=0;i<list.length;i++)
|
|
{
|
|
var data = list[i];
|
|
ulHtml += '<li class="userMaterialListItem" onclick=addSvgCodeFromMine("' + data.svgId + '",' + 'doUseUserMaterial); oncontextmenu=\'tagMenuShowMine(event, "' + data.svgId + '");\'>' + data.svgCode;
|
|
ulHtml += '</li>';
|
|
}
|
|
ulHtml += "</ul>";
|
|
Z("#collection_result>.result-ul").html("").append(Z(ulHtml));
|
|
});
|
|
ajax.execute();
|
|
}
|
|
|
|
function doUseUserMaterial(svgId)
|
|
{//使用素材
|
|
// 主方法,ajax 调用
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("UserMaterialPresenter");
|
|
ajax.setMethodName("getUserMaterialSvg");
|
|
ajax.addParam(svgId);
|
|
ajax.setFailure(function(){Z.failure(this.responseText);});
|
|
ajax.setSuccess(function(){analysisOfResponseMine(this.responseText);});
|
|
ajax.execute();
|
|
}
|
|
|
|
function doAddUserMaterial(typeCode, catCode, keywords, svgCode)
|
|
{//添加素材
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("UserMaterialPresenter");
|
|
ajax.setMethodName("doAddUserMaterial");
|
|
ajax.addParam("typeCode", typeCode);
|
|
ajax.addParam("catCode", catCode);
|
|
ajax.addParam("keywords", keywords);
|
|
ajax.addParam("svgCode", svgCode);
|
|
ajax.setFailureAlert();
|
|
ajax.setSuccess(function()
|
|
{
|
|
Z.alert("添加成功", function(){doQueryUserMaterial("1");});
|
|
});
|
|
ajax.execute();
|
|
}
|
|
|
|
function doDelUserMaterial(elem)
|
|
{//删除个人素材
|
|
var svgId = Z(elem).attr("data-svgid");
|
|
var ajax = new Z.Ajax();
|
|
ajax.setClassName("UserMaterialPresenter");
|
|
ajax.setMethodName("doDelUserMaterial");
|
|
ajax.addParam(svgId);
|
|
ajax.setFailure(function(){Z.failure(this.responseText);});
|
|
ajax.setSuccess(function(){doQueryUserMaterial("1");});
|
|
ajax.execute();
|
|
}
|
|
|
|
/** 标签右键菜单 **/
|
|
function tagMenuShowMine(event, svgId)
|
|
{
|
|
Z.E.forbidden(event);
|
|
createContextMenu({
|
|
"event": event,
|
|
"elemId": "tagUserMaterialMenu",
|
|
"editItem": [
|
|
["删除素材","doDelUserMaterial(this)"]
|
|
]
|
|
});
|
|
|
|
Z("#tagUserMaterialMenu ul:nth-child(1)>li:first-child").attr("data-svgid",svgId);
|
|
}
|
|
|
|
</script>
|
|
<style>
|
|
.userMaterialListItem{padding:5px;}
|
|
.userMaterialListItem > svg{height:auto;}
|
|
.
|
|
</style>
|
|
<div class="side-btnList">
|
|
<span class="side-btnSelect active" data-type="0">全部</span>
|
|
<span class="side-btnSelect" data-type="1" style="pointer-events:none;opacity:.7;">文字</span>
|
|
<span class="side-btnSelect" data-type="2" style="pointer-events:none;opacity:.7;">图片</span>
|
|
<span class="side-btnSelect" data-type="3" style="pointer-events:none;opacity:.7;">形状</span>
|
|
<span class="side-btnSelect" data-type="4" style="pointer-events:none;opacity:.7;">二维码</span>
|
|
</div>
|
|
<div class="bjbox">
|
|
<div id="collection_result" class="bjimg materialListShow">
|
|
<div class="result-ul"></div>
|
|
<div class="result-page"><span></span></div>
|
|
<div class="result-tips z-text-center z-hide">已经到底了!!</div>
|
|
</div>
|
|
</div>
|
|
</#function>
|
|
|
|
<#--计算左侧宽高值-->
|
|
<#function yangcai_calc_Left_width_height(width, height)>
|
|
<script>
|
|
function calcLeftWidthHeight()
|
|
{
|
|
Z("#left").css("width", Z.D.clientWidth() - ${zmr_sidebar_width} - 20 - ${width} - 5);//左20PD,右5PD
|
|
Z("#left").css("height", Z.D.clientHeight() - ${zmr_topnav_height} - ${zmr_breadcrumb_height} - 20 - ${height} - 5);//上20PD,下5PD
|
|
}
|
|
|
|
Z.onload(calcLeftWidthHeight);
|
|
Z(window).resize(calcLeftWidthHeight);
|
|
</script>
|
|
</#function>
|
|
|
|
|
|
<#--计算指定元素的宽度-->
|
|
<#function yangcai_designer_calc_width(width, containerId)>
|
|
<script>
|
|
function calcLeftWidthHeight()
|
|
{
|
|
Z("#${containerId}").css("width", Z.D.clientWidth() - ${zmr_sidebar_width} - 20 - ${width} - 5);//左20PD,右5PD
|
|
}
|
|
|
|
Z.onload(calcLeftWidthHeight);
|
|
Z(window).resize(calcLeftWidthHeight);
|
|
</script>
|
|
</#function>
|
|
|
|
|
|
<#function sweet_alert_reuse_method()>
|
|
${Scripts.src("/zinc/js/sweetalert2.min.js")}
|
|
<link rel="stylesheet" href="/zinc/css/sweetalert2.min.css">
|
|
</#function>
|
|
|
|
<#function Mydome()>
|
|
<link rel="stylesheet" href="/zinc/css/dome.css">
|
|
</#function>
|