7e47ce238b
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
602 lines
34 KiB
HTML
602 lines
34 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="renderer" content="webkit">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||
<title>推演-e订通</title>
|
||
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico" />
|
||
<link rel="stylesheet" href="layuiadmin/layui/css/layui.css">
|
||
<link rel="stylesheet" href="index.css">
|
||
<style>
|
||
.pcki-page {overflow-x: hidden; overflow-y: scroll; -webkit-overflow-scrolling: touch;}
|
||
#content #info .info-row {display: inline-block; width: 50%; margin-top: 5px;}
|
||
#content #info .info-row span {display: inline-block; width: 50%;}
|
||
#content #info .text{font-weight: bold; text-align: left;}
|
||
#dhs table td {padding: 5px;}
|
||
/* 当前焦点搭配款 */
|
||
.tydp-active { box-shadow: inset 8px 8px 8px #ccc; }
|
||
.tydp-active img.-dpshow { border: solid 1px #01AAED; }
|
||
.tydp-active .-ico { display: block !important; }
|
||
</style>
|
||
<script src="layuiadmin/layui/layui.js"></script>
|
||
<script src="js/function.js"></script>
|
||
<!-- jquery -->
|
||
<script src="js/jquery.min.js"></script>
|
||
<!-- 引入 -->
|
||
<!-- universal -->
|
||
<script src="js/universal/universal.js"></script>
|
||
<link rel="stylesheet" href="js/universal/universal.css?v=1">
|
||
<!-- p_custom_keyboard js -->
|
||
<link rel="stylesheet" href="js/p_custom_keyboard/p_custom_keyboard.css">
|
||
<script src="js/p_custom_keyboard/p_custom_keyboard.js"></script>
|
||
<!-- viewer js -->
|
||
<script src="js/viewer/viewer.min.js"></script>
|
||
<link rel="stylesheet" href="js/viewer/viewer.min.css">
|
||
</head>
|
||
<body style="background-color: #f0f0f0;">
|
||
<div class="pcki-page">
|
||
<!-- 顶部标题栏 -->
|
||
<div class="state_bar">
|
||
<div class="text_title">推演详情</div>
|
||
<div class="btn_close" onclick="u_close_this_div();"><img src="images/close.png" width=30 height=30 border=0></div>
|
||
</div>
|
||
<!--头部 上下款 搜索-->
|
||
<div class="header">
|
||
<a id="btn-prev" class="-btn-into" style="position: absolute; top: 0; left: 20px;"><i class="layui-icon layui-icon-left"></i>上一组</a>
|
||
|
||
<a id="btn-next" class="-btn-into" style="position: absolute; top: 0; right: 20px;">下一组<i class="layui-icon layui-icon-right"></i></a>
|
||
</div>
|
||
<hr class="layui-bg-gray">
|
||
<!-- 展示架 -->
|
||
<div id="content" class="layui-row" style="padding: 0 10px;">
|
||
<div id="pic" style="margin-top: 10px; margin-bottom: 10px;"></div>
|
||
<div id="ydclpic" style="margin-top: 10px; margin-bottom: 10px; position: relative;"></div>
|
||
</div>
|
||
<hr class="layui-bg-gray">
|
||
<!-- 搭配 -->
|
||
<div style="position: relative;">
|
||
<div id="dps" style="overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; position: relative; white-space: nowrap;"></div>
|
||
<div id="dhs" style="width: 96%; margin: 0 2% 16px; position: absolute; top: 249px; left: 0; z-index: 10; display: none;"></div>
|
||
<!-- <div id="dhs-test"></div> -->
|
||
</div>
|
||
<hr class="layui-bg-gray">
|
||
|
||
</div>
|
||
<script>
|
||
var is_mobile="n"
|
||
,ty_data
|
||
,$
|
||
|
||
layui.config({
|
||
base: './layuiadmin/'
|
||
}).extend({
|
||
index: 'lib/index'
|
||
}).use(['index', 'user','rate'], function(){
|
||
$ = layui.$
|
||
var setter = layui.setter
|
||
,admin = layui.admin
|
||
,form = layui.form
|
||
,rate = layui.rate
|
||
|
||
var url="./?_m=ty&_a=single&zsh="+get_url_param("zsh");
|
||
$.ajax(
|
||
{
|
||
url:url,
|
||
contentType: "application/json",
|
||
method: 'POST',
|
||
success: function (res) {
|
||
var json_data=$.parseJSON(res);
|
||
ty_data = json_data
|
||
//alert(json_data.ver);
|
||
if(json_data.code==0){
|
||
//------------------本页返回的错误信息
|
||
layer.msg(json_data.msg);
|
||
}else if(json_data.code==1){
|
||
//------------------系统错误
|
||
var msg=json_data.msg;
|
||
var url1="error.htm?msg="+json_data.msg+"&btn_title="+json_data.btn_title+"&btn_url="+json_data.btn_url;
|
||
var obj1=window.parent.parent?window.parent.parent:window.parent; obj1.location.href=url1;
|
||
}else if(json_data.code==2){
|
||
//------------------重新登录
|
||
url1="login.htm?error_msg="+json_data.msg;
|
||
var obj1=window.parent.parent?window.parent.parent:window.parent; obj1.location.href=url1;
|
||
}else{
|
||
//------------------填充内容
|
||
console.log(["初始", json_data])
|
||
|
||
// safari中iframe内的页面宽度会莫名其妙多一点出来,此处强制将本页宽度修正
|
||
$(".pcki-page").width($(self.frameElement).parents(".layui-layer-iframe").width())
|
||
// 修复iphone端,点击按钮时自动滚到页面顶部以及附带的其他一些问题
|
||
$(".pcki-page").height($(self.frameElement).parents(".layui-layer-iframe").height())
|
||
|
||
//------------上一组
|
||
if (json_data.prev != "") {
|
||
$("#btn-prev").attr("href", "ty_single.htm?zsh="+json_data.prev)
|
||
} else {
|
||
$("#btn-prev").attr("href", "javascript:layui.layer.msg('已经是第一组了。')")
|
||
}
|
||
//------------下一组
|
||
if (json_data.next != "") {
|
||
$("#btn-next").attr("href", "ty_single.htm?zsh="+json_data.next)
|
||
} else {
|
||
$("#btn-next").attr("href", "javascript:layui.layer.msg('已经是最后一组了。')")
|
||
}
|
||
//------------陈列
|
||
$("#pic").append("<div style='width: 400px; height: 300px; line-height: 300px; box-shadow: rgb(208, 208, 208) 1px 1px 10px 3px; max-width: "+Math.min($("#content").width()-20, 400)+"px;'><img data-original='"+json_data.pic+"' src='"+json_data.pic+"' style='width: "+json_data.pic_w+"px; height: "+json_data.pic_h+"px; max-width: "+Math.min($("#content").width()-20, 400)+"px; max-height: 300px;' watermark></div>")
|
||
$("#ydclpic").append("<div class='-inline-box' style='width: 400px; height: 300px; line-height: 300px; box-shadow: rgb(208, 208, 208) 1px 1px 10px 3px; position: relative; max-width: "+Math.min($("#content").width()-20, 400)+"px;'><img src='"+json_data.ydclpic+"' class='-base' style='width: "+json_data.ydclpic_w+"px; height: "+json_data.ydclpic_h+"px; max-width: "+Math.min($("#content").width()-20, 400)+"px; max-height: 300px;' watermark></div>")
|
||
switch(json_data.clxs) {
|
||
case "h":
|
||
$("#pic").addClass("layui-col-lg6 layui-col-md6 layui-col-sm12 layui-col-xs12")
|
||
$("#ydclpic").addClass("layui-col-lg6 layui-col-md6 layui-col-sm12 layui-col-xs12")
|
||
break
|
||
case "s":
|
||
$("#pic").addClass("layui-col-lg12 layui-col-md12 layui-col-sm12 layui-col-xs12")
|
||
$("#ydclpic").addClass("layui-col-lg12 layui-col-md12 layui-col-sm12 layui-col-xs12")
|
||
break
|
||
case "n":
|
||
$("#pic").addClass("layui-col-lg12 layui-col-md12 layui-col-sm12 layui-col-xs12")
|
||
$("#ydclpic").hide()
|
||
break
|
||
}
|
||
for (var k = 0; k < json_data.ydcl.length; k++) {
|
||
var ydcl = json_data.ydcl[k]
|
||
$("#ydclpic .-inline-box").append("<img src='"+ydcl.pic+"' class='-content' style='width: "+json_data.ydclpic_w+"px; height: "+json_data.ydclpic_h+"px; max-width: "+Math.min($("#content").width()-20, 400)+"px; max-height: 300px; position: absolute; top: "+(($("#ydclpic .-inline-box").height() - parseInt(json_data.ydclpic_h ? json_data.ydclpic_h : '0')) / 2)+"px; left: "+(($("#ydclpic .-inline-box").width() - parseInt(json_data.ydclpic_w ? json_data.ydclpic_w : '0')) / 2)+"px;'>")
|
||
}
|
||
//------------查看大图
|
||
new Viewer(document.getElementById("pic"), {
|
||
url: 'data-original'
|
||
,toolbar: false
|
||
,title: false
|
||
,rotatable: false
|
||
,backdrop: false // 点击非图片层关闭
|
||
,viewed: function(event) {
|
||
USetWatermark({
|
||
el: $(event.detail.image),
|
||
is_sy: json_data.is_sy,
|
||
text: json_data.username,
|
||
font_size: 64
|
||
})
|
||
}
|
||
})
|
||
//------------搭配
|
||
$("#dps").width(window.innerWidth)
|
||
var dpsl = json_data.dps.length
|
||
,dp_html = "<div>"
|
||
for (var i = 0; i < dpsl; i++) {
|
||
var dp = json_data.dps[i]
|
||
if (dp.xszt === 'n') {
|
||
continue
|
||
} else {
|
||
dp_html += "<a id='tydp-"+dp.zsh+"' href='javascript:showDhs("+dp.zsh+")' style='display: inline-block; padding: 0 5px; vertical-align: top; max-width: 200px; position: relative;'>"
|
||
|
||
dp_html += "<div style='margin-top: 8px;'>"+dp.zsh+"</div>"
|
||
dp_html += "<div class='-intact' style='width: 200px; height: 200px; line-height: 200px; position: relative;'><img src='"+dp.pic+"' class='-dpshow' style='width: "+dp.pic_w+"px; height: "+dp.pic_h+"px;' watermark><div style='position: absolute; top: 0; right: 0; width: 20px; line-height: 16px; background: red; color: yellow; border-radius: 5px;'>"
|
||
// for (var j = 0; j < dp.zds.length; j++) {
|
||
// dp_html += dp.zds[j]
|
||
// }
|
||
if(json_data.is_xswz=="y"){
|
||
dp_html += "<div style=\"position:relative;float:right;z-index:1000;background:#F00;color:#FFF;width:20px;margin:0 auto;line-height:16px;font-size:13px;font-family:Microsoft Yahei;color:yellow;border-radius:6px;text-align :center;\"><strong>"+dp.xsdw+"</strong></div></div></div>"
|
||
}else{
|
||
dp_html += "</div></div>"
|
||
}
|
||
dp_html += '<div class="-ico" style="height: 20px; line-height: 20px; font-size: 24px; display: none;"><i class="layui-icon layui-icon-up" style="color: #01AAED;"></i></div>'
|
||
|
||
if (json_data.cldp == "y") {
|
||
dp_html += "<div style='height: 23px; line-height: 23px;'>"+(i+1)+"</div>"
|
||
dp_html += "<div class='-yddp' style='width: 200px; height: 200px; line-height: 200px; position: relative;'>"
|
||
dp_html += "<img src='"+dp.yddppic+"' style='width: "+dp.yddppic_w+"px; height: "+dp.yddppic_h+"px; position: absolute; top: "+((200 - parseInt(dp.yddppic_h ? dp.yddppic_h : '0')) / 2)+"px; left: "+((200 - parseInt(dp.yddppic_w ? dp.yddppic_w : '0')) / 2)+"px;' watermark>"
|
||
for (var m = 0; m < dp.yddp.length; m++) {
|
||
var yddp = dp.yddp[m]
|
||
dp_html += "<img src='"+yddp.pic+"' style='width: "+yddp.pic_w+"px; height: "+yddp.pic_h+"px; position: absolute; top: "+((200 - parseInt(dp.yddppic_h ? dp.yddppic_h : '0')) / 2)+"px; left: "+((200 - parseInt(yddp.pic_w ? yddp.pic_w : '0')) / 2)+"px;' watermark>"
|
||
}
|
||
dp_html += "</div>"
|
||
|
||
dp_html += "<div class='-ydwz' style='text-align: center; margin: 5px 0;'>"
|
||
for (var l = 0; l < dp.dhqk.length; l++) {
|
||
var dhqk = dp.dhqk[l]
|
||
dp_html += "<div>"+dhqk.wz+": "+dhqk.num+"件</div>"
|
||
}
|
||
dp_html += "</div>"
|
||
}
|
||
|
||
dp_html += "</a>"
|
||
}
|
||
}
|
||
dp_html += "</div>"
|
||
$("#dps").append(dp_html)
|
||
|
||
USetWatermark({
|
||
is_sy: json_data.is_sy
|
||
,text: json_data.username
|
||
})
|
||
}
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
}
|
||
)
|
||
|
||
// 保存订单
|
||
$(document).on("click", "#dh-save", function() {
|
||
var arr = ""
|
||
,dph = $(".tydp-active").attr("id").split("-")[1]
|
||
// ,dph = $(".ty-show-active").parents("a").attr("id").split("-")[1]
|
||
$("#dhs .-row .-size input").each(function(index) {
|
||
arr += (index == 0 ? "" : "|") + $(this).attr("id") + "-" + ($(this).val() ? $(this).val() : "0")
|
||
})
|
||
console.log(["save submit", arr])
|
||
$.ajax({
|
||
url: "./?_m=ty&_a=save&dph=" + dph + "&arr=" + arr
|
||
,success: function(res) {
|
||
var json_data = $.parseJSON(res)
|
||
console.log(["save callback", json_data])
|
||
if (json_data.code == 101) {
|
||
update_ydcl(get_url_param("zsh"))
|
||
update_yddp(dph)
|
||
update_ydwz(dph)
|
||
layui.layer.msg(json_data.msg ? json_data.msg : "操作成功。")
|
||
window.parent.frames["layadmin-iframe"].update_yd()
|
||
} else {
|
||
layui.layer.msg(json_data.msg ? json_data.msg : "操作失败。")
|
||
}
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
})
|
||
})
|
||
// 关闭列表
|
||
$(document).on("click", "#dhs .-close", function() {
|
||
$("#dhs").hide()
|
||
$(".tydp-active").removeClass("tydp-active")
|
||
// $(".ty-show-active").removeClass("ty-show-active")
|
||
$("#dps").height("auto")
|
||
})
|
||
|
||
// 搜索,款号,圆牌号
|
||
$("#btn-search").click(function() {
|
||
if (!$("#s-title input").val().replace(/ /g, "")) return true
|
||
var url="./?_m=cl&_a=single&s_title="+$("#s-title input").val()
|
||
console.log(url)
|
||
$.ajax({
|
||
url: url
|
||
,method: "POST"
|
||
,success: function(res) {
|
||
var json_data = $.parseJSON(res)
|
||
console.log(json_data)
|
||
if (json_data.code == 100) {
|
||
location.href = "dk_single"+(json_data.face == "2" ? "_qj" : "")+".htm?khid="+json_data.khid
|
||
} else if (json_data.code == 101) {
|
||
var content_html = "<div style='padding: 15px;'>找到以下符合条件的多项,请选择:</div>"
|
||
for (var i = 0; i < json_data.msg.length; i++) {
|
||
var msgl = json_data.msg[i]
|
||
content_html += '<a href="dk_single'+(json_data.face == "2" ? "_qj" : "")+'.htm?khid='+msgl.khid+'" style="display: block; float: left; width: 60px; padding: 10px; color: blue; text-decoration: underline;">'+msgl.title+'</a>'
|
||
}
|
||
layer.open({
|
||
type: 1
|
||
,title: false //不显示标题栏
|
||
,closeBtn: true
|
||
,area: '300px;'
|
||
,shade: 0.8
|
||
,id: 'dk-location' //设定一个id,防止重复弹出
|
||
// ,btn: ['火速围观', '残忍拒绝']
|
||
,btnAlign: 'c'
|
||
,moveType: 1 //拖拽模式,0或者1
|
||
,content: content_html
|
||
})
|
||
} else {
|
||
layui.layer.msg(json_data.msg ? json_data.msg : "操作失败。")
|
||
}
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
})
|
||
})
|
||
|
||
if(admin.screen()<2)
|
||
is_mobile="y";
|
||
$(window).on('resize', function(){
|
||
$("#dhs td.-size>div").css({"white-space": "", "width": ""})
|
||
$("#dhs td.-size>div").width($("#dhs td.-size").width() - 10).css("white-space", "nowrap")
|
||
//自动
|
||
if(admin.screen()<2)
|
||
is_mobile="y";
|
||
});
|
||
|
||
// 重置ydclpic的位置与dps的宽度
|
||
$(window).on("orientationchange",function(){ // 获取的window.innerWidth是转换前的
|
||
// $("#ydclpic img.-content").css("left", (($("#ydclpic").width() - $("#ydclpic img.-base").width()) / 2) + "px")
|
||
$("#dps").width(top.window.innerWidth)
|
||
// console.log(window.innerWidth)
|
||
})
|
||
|
||
$(self.frameElement).parents(".layui-layer-iframe").on("resize", function() {
|
||
// safari中iframe内的页面宽度会莫名其妙多一点出来,此处强制将本页宽度修正
|
||
$(".pcki-page").width($(self.frameElement).parents(".layui-layer-iframe").width())
|
||
// 修复iphone端,点击按钮时自动滚到页面顶部以及附带的其他一些问题
|
||
$(".pcki-page").height($(self.frameElement).parents(".layui-layer-iframe").height())
|
||
// 将iframe的高度同步为其父元素.layui-layer-iframe的高度
|
||
$(this).find("[name="+window.name+"]").height($(this).height())
|
||
// 重置dhs td的宽 --- 因为实测并不会变动,所以暂时不用
|
||
// $("#dhs td.-size").css({"white-space": "", "width": ""})
|
||
// console.log( $("#dhs td.-size").width())
|
||
// $("#dhs td.-size>div").width($("#dhs td.-size").width() - 10).css("white-space", "nowrap")
|
||
})
|
||
})
|
||
|
||
function openDkSingle(khid) {
|
||
layui.use('layer', function(){
|
||
var layer = parent.layer
|
||
,index = layer.open({
|
||
type: 2,
|
||
title: '',
|
||
content: "dk_single"+(ty_data.face == "2" ? "_qj" : "")+".htm?khid="+khid,
|
||
offset: 'b',
|
||
closeBtn: 0,
|
||
anim: 2
|
||
})
|
||
layer.full(index)
|
||
})
|
||
}
|
||
// 搭配下单
|
||
function showDhs(dph) {
|
||
layui.use("jquery", function() {
|
||
var $ = layui.$
|
||
$("#dhs").hide()
|
||
$.ajax({
|
||
url: "./?_m=ty&_a=show&dph="+dph
|
||
,success: function(res) {
|
||
$(".tydp-active").removeClass("tydp-active")
|
||
$("#dps #tydp-"+dph).addClass("tydp-active")
|
||
var json_data = $.parseJSON(res)
|
||
,decoration_rowspan = 1 // 用于设置td.-decoration的rowspan
|
||
for (var i = 0; i < json_data.dks.length; i++) {
|
||
var dk = json_data.dks[i]
|
||
dk.dses = [] // 单色
|
||
for (var k = 0; k < dk.dd.length; k++) {
|
||
decoration_rowspan++
|
||
var ds = {
|
||
pic: {}
|
||
,color: {}
|
||
,size: []
|
||
}
|
||
for (var l = 0; l < dk.dd[k].value.length; l++) {
|
||
var ddv = dk.dd[k].value[l]
|
||
switch(ddv.no) {
|
||
case "10": // 图片格
|
||
ds.pic = ddv
|
||
break
|
||
case "2": // 颜色格
|
||
ds.color = ddv
|
||
break
|
||
case "3": // 尺码格
|
||
ds.size.push(ddv)
|
||
break
|
||
}
|
||
}
|
||
dk.dses.push(ds)
|
||
}
|
||
}
|
||
console.log(["show", json_data])
|
||
var dks_html = ""
|
||
dks_html += "<table class='pck-input-wrapper layui-anim layui-anim-scaleSpring' border='1' style='width: 100%; margin: auto; background-color: white; box-shadow: 8px 8px 16px #ccc; border-color: #ccc;'>"
|
||
dks_html += "<tr class='-header' style='background-color: #F2F2F2;'><td class='-decoration' rowspan='"+(decoration_rowspan+2)+"' style='width: 1px; background-color: #E2E2E2;'></td><td style='width: 70px;'>单款信息</td><td>单款图片</td><td style='width: 60px;'>颜色</td><td class='-size'>尺码</td><td style='width: 60px; border-left: 1px solid #ccc;'>小计</td></tr>"
|
||
for (var i = 0; i < json_data.dks.length; i++) {
|
||
var dk = json_data.dks[i]
|
||
for (var j = 0; j < dk.dses.length; j++) {
|
||
var ds = dk.dses[j]
|
||
dks_html += "<tr pcki-mode='row' class='-row'>"
|
||
if (j == 0) { // 单款信息格
|
||
dks_html += "<td rowspan='"+dk.ggs+"'><div>"+dk.no+"</div><div>"+dk.category+"</div><div>"+dk.price+"</div></td>"
|
||
}
|
||
// 图片格
|
||
dks_html += "<td style='position: relative;'>"
|
||
dks_html += "<div style='width: 90px; height: 120px; line-height: 120px;'><img src='"+ds.pic.pic+"' style='width: "+ds.pic.pic_w+"px; height: "+ds.pic.pic_h+"px; max-width: 90px; max-height: 120px;' watermark></div>"
|
||
//---- 款式属性
|
||
if (json_data.bs_kh_dj == "word" && ds.pic.kh_dj) {
|
||
dks_html += "<span style='position: absolute; top: 2px; right: 2px; width: 18px; word-wrap: break-word; background-color: #F06054; color: white; padding: 4px 2px; border-radius: 4px; z-index: 9; line-height: 20px;'>"+ds.pic.kh_dj+"</span>"
|
||
} else if (json_data.bs_kh_dj == "pic" && ds.pic.kh_dj) {
|
||
dks_html += "<img src='../attachments/"+ds.pic.kh_dj+".png' style='position: absolute; top: 2px; right: 2px;' watermark>"
|
||
}
|
||
dks_html += "</td>"
|
||
// 颜色格
|
||
dks_html += "<td"+(ds.color.bgs=="y"?" style='color: red;'":"")+">"+(ds.color.ka=="y"?"<s class='del-color'>":"")+"<div>"+(ds.color.bgs=="y"?"★":"")+ds.color.color+"</div><div>"+ds.color.colort+(ds.color.bgs=="y"?"(本杆款色)":"")+"</div>"+(ds.color.ka=="y"?"</s>":"")+"</td>"
|
||
// 尺码格
|
||
dks_html += "<td class='-size'><div class='-scroll-box' style='overflow-x: auto; position: relative;'>"
|
||
var total = 0
|
||
// 手数
|
||
if (json_data.pm_ms === 'm2') {
|
||
dks_html += "<div class='-input-box -col-pm' style='display: inline-block; max-width: 60px; margin: 5px;'>手数<div style='height: 20px; margin: 5px 0; text-align: center;'></div><div ><input type='number' data-pm='"+dk.default_pm+"' pcki-nojpty pcki-move='pm' pcki-nocypm='nocypm' class='layui-input' style='text-align: center; min-width: 50px; padding: 0 8px;' pcki-change='changeSh' pcki-save='saveOrder'"+(ds.color.ka=='y'?" pcki-mode='disabled'":"")+"></div></div>"
|
||
}
|
||
for (var k = 0; k < ds.size.length; k++) {
|
||
var size = ds.size[k]
|
||
dks_html += "<div class='-input-box -col-cm' style='display: inline-block; max-width: 60px; margin: 5px;'><div style='height: 20px; margin: 5px 0; text-align: center;'>"+size.size+"</div><div ><input id='"+size.id+"' type='number' value='"+size.value+"' class='layui-input' style='text-align: center; min-width: 50px; padding: 0 8px;' pcki-change='changeOrder' pcki-save='saveOrder'"+(size.disable || json_data.pm_ms==='m2' ? " pcki-mode='disabled'" : "")+"></div></div>"
|
||
total += parseInt(size.value ? size.value : "0")
|
||
}
|
||
dks_html += "</div></td>"
|
||
// 小计格
|
||
dks_html += "<td class='-total' style='border-left: 1px solid #ccc;'><div style='height: 20px; margin: 5px 0;'></div><div class='-item' style='height: 38px; line-height: 38px;'>"+total+"</div></td>"
|
||
// end
|
||
dks_html += "</tr>"
|
||
}
|
||
}
|
||
dks_html += '<tr style="border: none; position: absolute; top: -16px; right: -16px; width: 36px; height: 36px; line-height: 36px; border-radius: 50%; padding: 0; color: white; border-color: rgb(177, 177, 177); background: #cecece; text-shadow: 0 -1px 0 rgba(0,0,0,.3); box-shadow: 0px 2px 0 rgb(177, 177, 177), 0 3px 10px rgba(0,0,0,0.3);"><td style="padding: 0; border: none;"><a class="-close layui-btn layui-btn-sm layui-btn-primary" style="width: 36px;height: 36px;line-height: 36px;border-radius: 50%;padding: 0;color: white;border-color: rgb(177, 177, 177);background: #cecece;text-shadow: 0 -1px 0 rgba(0,0,0,.3);box-shadow: 0px 2px 0 rgb(177, 177, 177), 0 3px 10px rgba(0,0,0,0.3);"><i class="layui-icon layui-icon-close" style="margin: auto; z-index: 99; font-size: 20px !important;"></i></a></td></tr>'
|
||
dks_html += '<tr><td colspan="5"><div style="margin: 16px auto;"><button id="dh-save" type="button" class="layui-btn layui-btn-sm" style="background-color: #F04122;">保存订单</button></div></td></tr>'
|
||
dks_html += "</table>"
|
||
|
||
$("#dhs").html(dks_html).show()
|
||
// 添加水印
|
||
USetWatermark({
|
||
el: $("#dhs"),
|
||
is_sy: json_data.is_sy
|
||
,text: json_data.username
|
||
})
|
||
// 设置尺码格宽度
|
||
$("#dhs td.-size>div").width($("#dhs td.-size").width() - 10).css("white-space", "nowrap")
|
||
pInitCustomKeyboard({
|
||
pck_enabled: ty_data.sys_ck_input,
|
||
pck_cypm: ty_data.cypm,
|
||
pck_jpty: json_data.jpty,
|
||
pck_uid: ty_data.uid,
|
||
pck_page: "ty",
|
||
success: function(elem) {
|
||
var elem_td = elem.parents("td") // td
|
||
,elem_scroll = elem_td.find(".-scroll-box") // 滚动盒子
|
||
|
||
var scroll_gdjl = elem_scroll.scrollLeft() // 滚动条滚动距离
|
||
,current_position_left = elem.position().left // 元素当前position.left
|
||
,elem_width = elem.width() + 10 + 2 // 当前元素总宽,包括元素本宽,padding,margin,border等
|
||
,scroll_width = elem_scroll.width() // 滚动盒子宽
|
||
,offset_min = 5 // 元素左边与滚动盒子左边界的该有的最小位移
|
||
,offset_max = scroll_width - elem_width - 5 // 元素左边与滚动盒子左边界的该有的最大位移
|
||
|
||
// 最终滚动
|
||
if (current_position_left - offset_min < 0) { // 右滚,即从左边界滚出
|
||
var last_scroll_left = scroll_gdjl + current_position_left - offset_min // 最终滚动距离
|
||
// console.log([current_position_left, scroll_gdjl, offset_max, last_scroll_left])
|
||
elem_scroll.scrollLeft(last_scroll_left)
|
||
} else if (current_position_left > offset_max) { // 左滚,即从右边界滚出
|
||
var last_scroll_left = current_position_left - offset_max + scroll_gdjl
|
||
// console.log([current_position_left, scroll_gdjl, offset_max, last_scroll_left])
|
||
elem_scroll.scrollLeft(last_scroll_left)
|
||
}
|
||
}
|
||
})
|
||
$('.del-color').on('click', function(){ // 设定删除款tip
|
||
layer.tips('已删除', this); //在元素的事件回调体中,follow直接赋予this即可
|
||
})
|
||
$("#dps").height($("#dhs").height() + 220 + 10)
|
||
|
||
// 滚动#dps至屏幕中央
|
||
var pckipage_gdjl = $(".pcki-page").scrollTop()
|
||
,dpsp_position_top = $("#dps").parent().position().top
|
||
,dps_offset = 10
|
||
if (0 < dpsp_position_top-dps_offset) $(".pcki-page").scrollTop(pckipage_gdjl + dpsp_position_top - dps_offset)
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
})
|
||
})
|
||
}
|
||
|
||
function saveOrder() {
|
||
layui.use('jquery', function(){
|
||
var $ = layui.jquery
|
||
$("#dh-save").click()
|
||
})
|
||
}
|
||
// 手数变化
|
||
function changeSh(elem) {
|
||
elem.val(parseInt(elem.val()))
|
||
if (parseInt(elem.val()) < 0) {
|
||
layui.layer.msg("数值无效。")
|
||
elem.val("")
|
||
}
|
||
var pm = elem.attr('data-pm').split(':')
|
||
var value = parseInt(elem.val() ? elem.val() : '0')
|
||
elem.parents('.-size').find('.-col-cm input').each(function(index) {
|
||
var pmv = pm.length > index ? pm[index] : ''
|
||
pmv = parseInt(pmv ? pmv : '0')
|
||
$(this).val(pmv * value)
|
||
$(this).change()
|
||
})
|
||
}
|
||
function changeOrder(elem) {
|
||
layui.use('jquery', function(){
|
||
var $ = layui.jquery
|
||
elem.val(parseInt(elem.val()))
|
||
if (parseInt(elem.val()) < 0) {
|
||
layui.layer.msg("数值无效。")
|
||
elem.val("")
|
||
}
|
||
var row_elem = elem.parents(".-row")
|
||
,row_total = 0
|
||
row_elem.find(".-size .-col-cm input").each(function() {
|
||
var val = parseInt($(this).val() ? $(this).val() : "0")
|
||
row_total += val
|
||
})
|
||
row_elem.find(".-total .-item").html(row_total)
|
||
})
|
||
}
|
||
// 陈列图更新
|
||
function update_ydcl(zsh) {
|
||
layui.use('jquery', function(){
|
||
var $ = layui.jquery
|
||
$.ajax({
|
||
url: "./?_m=ty&_a=update_ydcl&s_zsh=" + zsh
|
||
,success: function(res) {
|
||
var json_data = $.parseJSON(res)
|
||
console.log(["update ydcl", json_data])
|
||
var ydcl_html = ""
|
||
ydcl_html += "<div class='-inline-box' style='width: 400px; height: 300px; line-height: 300px; box-shadow: rgb(208, 208, 208) 1px 1px 10px 3px; position: relative; max-width: "+Math.min($("#content").width()-20, 400)+"px;'>"
|
||
ydcl_html += "<img src='"+json_data.ydclpic+"' class='-base' style='width: "+json_data.ydclpic_w+"px; height: "+json_data.ydclpic_h+"px; max-width: "+Math.min($("#content").width()-20, 400)+"px; max-height: 300px;' watermark>"
|
||
for (var k = 0; k < json_data.ydcl.length; k++) {
|
||
var ydcl = json_data.ydcl[k]
|
||
ydcl_html += "<img src='"+ydcl.pic+"' class='-content' style='width: "+json_data.ydclpic_w+"px; height: "+json_data.ydclpic_h+"px; max-width: "+Math.min($("#content").width()-20, 400)+"px; max-height: 300px; position: absolute; top: "+(($("#ydclpic .-inline-box").height() - parseInt(json_data.ydclpic_h ? json_data.ydclpic_h : '0')) / 2)+"px; left: "+(($("#ydclpic .-inline-box").width() - parseInt(json_data.ydclpic_w ? json_data.ydclpic_w : '0')) / 2)+"px;'>"
|
||
}
|
||
ydcl_html += "</div>"
|
||
$("#ydclpic").html(ydcl_html)
|
||
USetWatermark({
|
||
el: $("#ydclpic"),
|
||
is_sy: json_data.is_sy
|
||
,text: json_data.username
|
||
})
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
})
|
||
})
|
||
}
|
||
// 搭配图更新
|
||
function update_yddp(dph) {
|
||
layui.use('jquery', function(){
|
||
var $ = layui.jquery
|
||
$.ajax({
|
||
url: "./?_m=ty&_a=update_yddp&s_zsh=" + dph
|
||
,success: function(res) {
|
||
var json_data = $.parseJSON(res)
|
||
console.log(["update yddp", json_data])
|
||
var yddp_html = ""
|
||
yddp_html += "<img src='"+json_data.yddppic+"' style='width: "+json_data.yddppic_w+"px; height: "+json_data.yddppic_h+"px; position: absolute; top: "+((200 - parseInt(json_data.yddppic_h?json_data.yddppic_h:'0')) / 2)+"px; left: "+((200 - parseInt(json_data.yddppic_w?json_data.yddppic_w:'0')) / 2)+"px;' watermark>"
|
||
for (var m = 0; m < json_data.yddp.length; m++) {
|
||
var yddp = json_data.yddp[m]
|
||
yddp_html += "<img src='"+yddp.pic+"' style='width: "+json_data.yddppic_w+"px; height: "+json_data.yddppic_h+"px; position: absolute; top: "+((200 - parseInt(json_data.yddppic_h?json_data.yddppic_h:'0')) / 2)+"px; left: "+((200 - parseInt(json_data.yddppic_w?json_data.yddppic_w:'0')) / 2)+"px;'>"
|
||
}
|
||
$("#tydp-"+dph+" .-yddp").html(yddp_html)
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
})
|
||
})
|
||
}
|
||
// 搭配文字更新
|
||
function update_ydwz(dph) {
|
||
layui.use('jquery', function(){
|
||
var $ = layui.jquery
|
||
$.ajax({
|
||
url: "./?_m=ty&_a=update_ydwz&dph=" + dph
|
||
,success: function(res) {
|
||
var json_data = $.parseJSON(res)
|
||
console.log(["update ydwz", json_data])
|
||
var ydwz_html = ""
|
||
for (var i = 0; i < json_data.dhqk.length; i++) {
|
||
var dhqk = json_data.dhqk[i]
|
||
ydwz_html += "<div>"+dhqk.wz+": "+dhqk.num+"件</div>"
|
||
}
|
||
$("#tydp-"+dph+" .-ydwz").html(ydwz_html)
|
||
}
|
||
,beforeSend: function() { u_start_loading() }
|
||
,complete: function() { u_stop_loading() }
|
||
,error: function() { layui.layer.msg("与服务器通信失败!") }
|
||
})
|
||
})
|
||
}
|
||
</script>
|
||
</body>
|
||
</html> |