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.
802 lines
28 KiB
802 lines
28 KiB
{template 'header', 'member'}
|
|
<div id="head-bar">
|
|
<div class="head-bar">
|
|
<div class="head-bar-back"><a href="{if $back_link}{$back_link}{else}javascript:Dback();" id="back-{$js_pageid}{/if}" data-direction="reverse"><img src="{DT_MOB}static/img/icon-back.png" width="24" height="24"/></a></div>
|
|
<div class="head-bar-title">商品{if $action=='add'}发布{elseif $action=='edit'}修改{else}管理{/if}</div>
|
|
<div class="head-bar-right">
|
|
{if $action=='add' || $action=='edit'}
|
|
<a href="?mid={$mid}&status=3"><img src="{DT_MOB}static/img/icon-cancel.png" width="24" height="24"/></a>
|
|
{else}
|
|
<a href="?mid={$mid}&action=add"><img src="{DT_MOB}static/img/icon-add.png" width="24" height="24"/></a>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
<div class="head-bar-fix" id="load-fix-{$js_pageid}" style="height:0;"></div>
|
|
<div class="head-bar-fix" id="head-fix-{$js_pageid}"></div>
|
|
</div>
|
|
{if $action=='add' || $action=='edit'}
|
|
<script type="text/javascript" src="{DT_MOB}static/lib/webuploader.min.js?v={if DT_DEBUG}{DT_TIME}{else}{DT_REFRESH}{/if}"></script>
|
|
<div class="ui-form">
|
|
<iframe src="" name="send" id="send" style="display:none;"></iframe>
|
|
<form method="post" action="?" id="dform" target="send" data-ajax="false" onsubmit="return check();">
|
|
<input type="hidden" name="action" value="{$action}"/>
|
|
<input type="hidden" name="mid" value="{$mid}"/>
|
|
<input type="hidden" name="itemid" value="{$itemid}"/>
|
|
<input type="hidden" name="forward" value="{$forward}"/>
|
|
<input type="hidden" name="post[linkurl]" value="{$linkurl}"/>
|
|
<p>所属分类<em>*</em><b id="dcatid"></b></p>
|
|
<div>{ajax_category_select('post[catid]', '选择分类', $catid, $moduleid)}</div>
|
|
<p>商品名称<em>*</em><b id="dtitle"></b></p>
|
|
<div><input name="post[title]" type="text" id="title" value="{$title}"/></div>
|
|
<p>商品卖点</p>
|
|
<div><input name="post[subtitle]" type="text" id="subtitle" value="{$subtitle}"/></div>
|
|
<p>卖点链接</p>
|
|
<div><input name="post[sublink]" type="text" id="sublink" value="{$sublink}" placeholder="链接网址" style="width:50%;"/> <input name="post[subtext]" type="text" id="subtext" value="{$subtext}" placeholder="链接文字" style="width:45%;"/></div>
|
|
<p>商品品牌</p>
|
|
<div><input name="post[brand]" type="text" id="brand" value="{$brand}"/></div>
|
|
<p>价格模式<em>*</em><b id="dmode"></b></p>
|
|
<div>
|
|
<input type="radio" name="post[mode]" value="0"{if $mode==0} checked{/if} id="mode_0" onclick="Dmode(0);"/><label for="mode_0"> 单售价</label><br/>
|
|
<input type="radio" name="post[mode]" value="1"{if $mode==1} checked{/if} id="mode_1" onclick="Dmode(1);"/><label for="mode_1"> 多售价</label><br/>
|
|
<input type="radio" name="post[mode]" value="2"{if $mode==2} checked{/if} id="mode_2" onclick="Dmode(2);"/><label for="mode_2"> 阶梯价(混批)</label><br/>
|
|
<input type="radio" name="post[mode]" value="3"{if $mode==3} checked{/if} id="mode_3" onclick="Dmode(3);"/><label for="mode_3"> 属性价</label>
|
|
</div>
|
|
<section id="tr_price">
|
|
<p>商品单价<em>*</em><b id="dprice"></b></p>
|
|
<div><input name="post[price]" type="text" value="{$price}" id="price" style="width:40%;"></div>
|
|
</section>
|
|
<section id="tr_step">
|
|
<p>商品价格<em>*</em><b id="dstep"></b></p>
|
|
<div>
|
|
<table cellspacing="1">
|
|
<tr>
|
|
<th style="width:45%;">数量</th>
|
|
<th style="width:45%;">价格</th>
|
|
<th style="display:none;"></th>
|
|
<th style="display:none;"></th>
|
|
</tr>
|
|
<tr>
|
|
<td><input name="post[step][a1]" type="text" value="{$a1}" id="a1"/></td>
|
|
<td><input name="post[step][p1]" type="text" value="{$p1}" id="p1"/></td>
|
|
<td style="display:none;" id="p_a_1"></td>
|
|
<td style="display:none;" id="p_p_1"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input name="post[step][a2]" type="text" value="{$a2}" id="a2"/></td>
|
|
<td><input name="post[step][p2]" type="text" value="{$p2}" id="p2"/></td>
|
|
<td style="display:none;" id="p_a_2"></td>
|
|
<td style="display:none;" id="p_p_2"></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input name="post[step][a3]" type="text" value="{$a3}" id="a3"/></td>
|
|
<td><input name="post[step][p3]" type="text" value="{$p3}" id="p3"/></td>
|
|
<td style="display:none;" id="p_a_3"></td>
|
|
<td style="display:none;" id="p_p_3"></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="f_gray" colspan="4" onclick="if(confirm('示例数据将覆盖当前数据,确定继续吗?')){Dd('a1').value=1;Dd('p1').value='1000.00';Dd('a2').value=100;Dd('p2').value='900.00';Dd('a3').value=500;Dd('p3').value='800.00';}">填写示例</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
<section id="tr_amount">
|
|
<p>商品库存<em>*</em><b id="damount"></b></p>
|
|
<div><input name="post[amount]" type="text" value="{$amount}" id="amount" style="width:40%;"> <input name="post[unit]" type="text" value="{if $unit}{$unit}{else}件{/if}" id="unit" title="计量单位" style="width:20%;text-align:center;"/></div>
|
|
</section>
|
|
<section id="tr_nv">
|
|
<p>商品属性</p>
|
|
<div>
|
|
<table cellspacing="1">
|
|
<tr>
|
|
<th style="width:30%;">属性名称</th>
|
|
<th style="width:65%;">属性值</th>
|
|
</tr>
|
|
<tr>
|
|
<td><input name="post[n1]" type="text" value="{$n1}" id="n1"/></td>
|
|
<td><input name="post[v1]" type="text" value="{$v1}" id="v1" onblur="Dmuti();"/></td>
|
|
</tr>
|
|
<tr data-prices="1">
|
|
<td align="center">属性价格</td>
|
|
<td><input name="post[prices]" type="text" value="{$prices}" id="prices" placeholder="一个属性对应一个价格,用|分隔"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input name="post[n2]" type="text" value="{$n2}" id="n2"/></td>
|
|
<td><input name="post[v2]" type="text" value="{$v2}" id="v2" onblur="Dmuti();"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td><input name="post[n3]" type="text" value="{$n3}" id="n3"/></td>
|
|
<td><input name="post[v3]" type="text" value="{$v3}" id="v3" onblur="Dmuti();"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="px12">例如:<span class="c_p" onclick="if(Dd('n1').value.length<1){Dd('n1').value=this.innerHTML;}">颜色</span></td>
|
|
<td class="px12">例如:<span class="c_p" onclick="if(Dd('v1').value.length<1){Dd('v1').value=this.innerHTML;}">黑色|白色|红色</span> 多个属性用|分隔</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
<section id="tr_muti">
|
|
<p>销售属性</p>
|
|
<div id="tb_muti"><span onclick="Dmuti();">点击设置</span></div>
|
|
</section>
|
|
<section id="tr_skuid">
|
|
<p>商品条码</p>
|
|
<div><input name="post[skuid]" type="text" id="skuid" value="{$skuid}"/></div>
|
|
</section>
|
|
<p>商品图片<em>*</em><b id="dthumb"></b></p>
|
|
<div>
|
|
<script type="text/javascript">
|
|
var album_max = parseInt({$DT[thumb_max]});
|
|
if(album_max < 5 || album_max > 99) album_max = 9;
|
|
for(var i = 0;i < album_max; i++) {
|
|
document.write('<input type="hidden" name="post[thumbs][]" id="thumb'+i+'"/>');
|
|
document.write('<div class="ui-form-album-show" id="album'+i+'" onclick="album_action('+i+');"></div>');
|
|
}
|
|
</script>
|
|
<div class="ui-form-album-upload"><div id="album-picker"></div></div>
|
|
<script type="text/javascript">
|
|
function album_action(id) {
|
|
Dsheet('{$js_pageid}','<a href="javascript:album_delete('+id+');void(0);"><span style="color:red;">删除图片</span></a>', '取消', '确定要删除图片吗?');
|
|
}
|
|
function album_delete(id) {
|
|
$('#thumb'+id).val('');
|
|
$('#album'+id).html('');
|
|
$('#album'+id).hide();
|
|
$('.ui-form-album-upload').show();
|
|
}
|
|
function album_show(id, url) {
|
|
if($('#thumb'+id).length == 0) return false;
|
|
$('#thumb'+id).val(url);
|
|
$('#album'+id).html('<img src="'+url+'"/>');
|
|
$('#album'+id).show();
|
|
}
|
|
function album_hide() {
|
|
var j = 1;
|
|
for(var i = 0; i < album_max; i++) {
|
|
if($('#thumb'+i).val() == '') {
|
|
j = 0;
|
|
break;
|
|
}
|
|
}
|
|
if(j) $('.ui-form-album-upload').hide();
|
|
}
|
|
var albumu = WebUploader.create({
|
|
auto: true,
|
|
server: UPPath+'?moduleid={$moduleid}&action=webuploader&from=album&width={$MOD[thumb_width]}&height={$MOD[thumb_height]}',
|
|
pick: '#album-picker',
|
|
accept: {
|
|
title: 'Images',
|
|
extensions: 'gif,jpg,jpeg,bmp,png',
|
|
mimeTypes: 'image/*'
|
|
},
|
|
resize: false
|
|
});
|
|
albumu.on('fileQueued', function(file) {
|
|
Dtoast('{$js_pageid}',L['uploading'], '', 30);
|
|
});
|
|
albumu.on('uploadProgress', function(file, percentage) {
|
|
var p = parseInt(percentage * 100);
|
|
$('#toast-{$js_pageid}').html(p > 99 ? L['processing'] : L['uploading']+p+'%');
|
|
});
|
|
albumu.on( 'uploadSuccess', function(file, data) {
|
|
if(data.error) {
|
|
Dtoast('{$js_pageid}',data.message, '', 5);
|
|
} else {
|
|
for(var i = 0; i < album_max; i++) {
|
|
if($('#thumb'+i).val() == '') {
|
|
album_show(i, data.url);
|
|
break;
|
|
}
|
|
}
|
|
album_hide();
|
|
}
|
|
});
|
|
albumu.on( 'uploadError', function(file, data) {
|
|
Dtoast('{$js_pageid}',data.message, '', 5);
|
|
});
|
|
albumu.on('uploadComplete', function(file) {
|
|
$('#toast-{$js_pageid}').hide();
|
|
});
|
|
{if $thumbs}
|
|
$(function(){
|
|
{loop $thumbs $k $v}
|
|
{if $v}album_show({$k}, '{$v}');{/if}
|
|
{/loop}
|
|
album_hide();
|
|
});
|
|
{/if}
|
|
</script>
|
|
</div>
|
|
<p>宣传视频</p>
|
|
<div>
|
|
<input type="text" name="post[video]" value="{$video}" id="video"/>
|
|
<div class="ui-form-file-upload"><div id="video-picker"></div></div>
|
|
<script type="text/javascript">
|
|
var fileu = WebUploader.create({
|
|
auto: true,
|
|
server: UPPath+'?moduleid={$moduleid}&action=webuploader&from=file',
|
|
pick: '#video-picker',
|
|
accept: {
|
|
title: 'video',
|
|
extensions: 'mp4',
|
|
mimeTypes: 'video/*'
|
|
},
|
|
resize: false
|
|
});
|
|
fileu.on('fileQueued', function(file) {
|
|
Dtoast('{$js_pageid}',L['uploading'], '', 30);
|
|
});
|
|
fileu.on('uploadProgress', function(file, percentage) {
|
|
var p = parseInt(percentage * 100);
|
|
$('#toast-{$js_pageid}').html(p > 99 ? L['processing'] : L['uploading']+p+'%');
|
|
});
|
|
fileu.on( 'uploadSuccess', function(file, data) {
|
|
if(data.error) {
|
|
Dtoast('{$js_pageid}',data.message, '', 5);
|
|
} else {
|
|
$('#video').val(data.url);
|
|
}
|
|
});
|
|
fileu.on( 'uploadError', function(file, data) {
|
|
Dtoast('{$js_pageid}',data.message, '', 5);
|
|
});
|
|
fileu.on('uploadComplete', function(file) {
|
|
$('#toast-{$js_pageid}').hide();
|
|
});
|
|
</script>
|
|
</div>
|
|
{if $CP}
|
|
<script type="text/javascript">
|
|
var property_catid = {$catid};
|
|
var property_itemid = {$itemid};
|
|
var property_admin = 0;
|
|
</script>
|
|
<script type="text/javascript" src="{DT_STATIC}file/script/property.js?v={if DT_DEBUG}{DT_TIME}{else}{DT_REFRESH}{/if}"></script>
|
|
<section id="load_property" style="display:none;"></section>
|
|
{/if}
|
|
{if $FD}{fields_html('', '', $item)}{/if}
|
|
<p>详细内容<em>*</em><b id="dcontent"></b></p>
|
|
</div>
|
|
<input type="hidden" name="post[content]" id="content"/>
|
|
<ul class="ui-editor-toolbar">
|
|
<li class="ui-editor-img"><div id="editor-picker"></div></li>
|
|
<li class="ui-editor-bold" id="editor-bold" editor-action="bold">B</li>
|
|
<li class="ui-editor-italic" id="editor-italic" editor-action="italic">I</li>
|
|
<li class="ui-editor-underline" id="editor-underline" editor-action="underline">U</li>
|
|
</ul>
|
|
<div class="ui-editor-content" id="editor">{$content}</div>
|
|
<script type="text/javascript" src="{DT_MOB}static/js/editor.js?v={if DT_DEBUG}{DT_TIME}{else}{DT_REFRESH}{/if}"></script>
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
$('#editor').DEditor({
|
|
editorid: 'editor',
|
|
textareaid: 'content',
|
|
server: UPPath+'?moduleid={$moduleid}&action=webuploader&from=editor'
|
|
});
|
|
});
|
|
</script>
|
|
<div class="ui-form">
|
|
<p>运费设置</p>
|
|
<div>
|
|
<table cellspacing="1">
|
|
<tr>
|
|
<th>快递</th>
|
|
<th>默认运费</th>
|
|
<th>每件增加</th>
|
|
</tr>
|
|
<tr>
|
|
<td style="width:40%;"><input name="post[express_name_1]" type="text" value="{$express_name_1}" id="express_name_1"/></td>
|
|
<td style="width:20%;"><input name="post[fee_start_1]" type="text" value="{$fee_start_1}" id="fee_start_1"/></td>
|
|
<td style="width:20%;"><input name="post[fee_step_1]" type="text" value="{$fee_step_1}" id="fee_step_1"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="width:40%;"><input name="post[express_name_2]" type="text" value="{$express_name_2}" id="express_name_2"/></td>
|
|
<td style="width:20%;"><input name="post[fee_start_2]" type="text" value="{$fee_start_2}" id="fee_start_2"/></td>
|
|
<td style="width:20%;"><input name="post[fee_step_2]" type="text" value="{$fee_step_2}" id="fee_step_2"/></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="width:40%;"><input name="post[express_name_3]" type="text" value="{$express_name_3}" id="express_name_3"/></td>
|
|
<td style="width:20%;"><input name="post[fee_start_3]" type="text" value="{$fee_start_3}" id="fee_start_3"/></td>
|
|
<td style="width:20%;"><input name="post[fee_step_3]" type="text" value="{$fee_step_3}" id="fee_step_3"/></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<p>我的推荐</p>
|
|
<div>
|
|
<input type="radio" name="post[elite]" value="1" id="elite_1" {if $elite} checked{/if}><label for="elite_1">是</label>
|
|
<input type="radio" name="post[elite]" value="0" id="elite_0" {if !$elite} checked{/if}><label for="elite_0">否</label>
|
|
</div>
|
|
{if $fee_add}
|
|
<p>发布此信息需消费</p>
|
|
<div><span class="f_b f_red">{$fee_add}</span> {$fee_unit}</div>
|
|
{if $fee_currency == 'money'}
|
|
<p>{$DT[money_name]}余额</p>
|
|
<div><span class="f_blue f_b">{$_money}{$fee_unit}</span> <a href="charge.php?action=pay" class="b">[充值]</a></div>
|
|
{else}
|
|
<p>{$DT[credit_name]}余额</p>
|
|
<div><span class="f_blue f_b">{$_credit}{$fee_unit}</span> <a href="credit.php?action=buy" class="b">[购买]</a></div>
|
|
{/if}
|
|
{/if}
|
|
{if $need_password}
|
|
<p>支付密码<em>*</em><b id="dpassword"></b></p>
|
|
<div><input type="password" name="password" value="" id="password" autocomplete="off"/></div>
|
|
{/if}
|
|
{if $need_question}
|
|
<p>验证问题<em>*</em><b id="danswer"></b></p>
|
|
<div>{template 'question', 'chip'}</div>
|
|
{/if}
|
|
{if $need_captcha}
|
|
<p>验证码<em>*</em><b id="dcaptcha"></b></p>
|
|
<div>{template 'captcha', 'chip'}</div>
|
|
{/if}
|
|
<div class="blank-16"></div>
|
|
<input type="submit" name="submit" value="{if $action == 'edit'}修改{else}发布{/if}" class="btn-blue"/>
|
|
<div class="blank-32"></div>
|
|
</div>
|
|
</form>
|
|
{load('clear.js')}
|
|
{else}
|
|
<div class="ui-form">
|
|
<form action="?">
|
|
<input type="hidden" name="mid" value="{$mid}"/>
|
|
<input type="hidden" name="status" value="{$status}"/>
|
|
<div><input type="search" name="kw" value="{$kw}" placeholder="{$L[kw]}"/></div>
|
|
</form>
|
|
</div>
|
|
{if $_userid}
|
|
<script type="text/javascript">$(function(){Stabs('{$js_pageid}');});</script>
|
|
<div class="list-menu" id="tabs-{$js_pageid}">
|
|
<ul>
|
|
<a href="?mid={$mid}&status=3"><li{if $status==3} class="on"{/if} id="s3">已发布{if !$kw} {$nums[3]}{/if}</li></a>
|
|
<a href="?mid={$mid}&status=2"><li{if $status==2} class="on"{/if} id="s2">审核中{if !$kw} {$nums[2]}{/if}</li></a>
|
|
<a href="?mid={$mid}&status=1"><li{if $status==1} class="on"{/if} id="s1">未通过{if !$kw} {$nums[1]}{/if}</li></a>
|
|
<a href="?mid={$mid}&status=4"><li{if $status==4} class="on"{/if} id="s4">已下架{if !$kw} {$nums[4]}{/if}</li></a>
|
|
</ul>
|
|
</div>
|
|
{/if}
|
|
<form method="post">
|
|
{if $lists}
|
|
{loop $lists $v}
|
|
<div class="list-img">
|
|
<input type="checkbox" name="itemid[]" value="{$v[itemid]}" class="dsn" id="checkbox-{$v[itemid]}"/>
|
|
<a href="{$v[linkurl]}"><img src="{if $v[thumb]}{$v[thumb]}{else}{DT_MOB}static/img/80x60.png{/if}" width="80" height="60" alt="" onerror="this.src='{DT_MOB}static/img/80x60.png';"/></a>
|
|
<ul>
|
|
<li><em class="check" id="check-{$v[itemid]}"></em><a href="?mid={$mid}&action=edit&itemid={$v[itemid]}" rel="external"><strong>{$v[title]}</strong></a></li>
|
|
<li><em class="sheet" id="sheet-{$v[itemid]}"></em><span>{$v[date]}</span></li>
|
|
</ul>
|
|
</div>
|
|
{/loop}
|
|
{/if}
|
|
{if $mod_limit || (!$MG[fee_mode] && $MOD[fee_add])}
|
|
<div class="limit">
|
|
{if $mod_limit}
|
|
总共可发 <span class="f_b f_red">{$mod_limit}</span> 条
|
|
当前已发 <span class="f_b">{$limit_used}</span> 条
|
|
还可以发 <span class="f_b f_blue">{$limit_free}</span> 条
|
|
{/if}
|
|
{if !$MG[fee_mode] && $MOD[fee_add]}
|
|
发布信息收费 <span class="f_b f_red">{$MOD[fee_add]}</span> {if $MOD[fee_currency] == 'money'}{$DT[money_unit]}{else}{$DT[credit_unit]}{/if}/条
|
|
可免费发布 <span class="f_b">{if $mod_free_limit<0}无限{else}{$mod_free_limit}{/if}</span> 条
|
|
{/if}
|
|
</div>
|
|
{/if}
|
|
{if $pages}<div class="pages" id="pages-{$js_pageid}">{$pages}</div>{/if}
|
|
<div id="foot-bar" class="dsn">
|
|
<div class="foot-bar-fix"></div>
|
|
<div class="foot-bar btns">
|
|
{if $timetype!='add'}<input type="submit" value="刷新选中" class="btn-green" onclick="this.form.action='?mid={$mid}&status={$status}&action=refresh';"/>{/if}
|
|
{if $status==3}<input type="submit" value="批量下架" class="btn-green" onclick="this.form.action='?mid={$mid}&status={$status}&action=unsale';"/>{/if}
|
|
{if $status==4}<input type="submit" value="批量上架" class="btn-green" onclick="this.form.action='?mid={$mid}&status={$status}&action=onsale';"/>{/if}
|
|
{if $MG[delete]}<input type="submit" name="submit" value="删除选中" class="btn-red" onclick="if(confirm('确定要删除选中{$MOD[name]}吗?')){this.form.action='?mid={$mid}&status={$status}&action=delete'}else{return false;}"/>{/if}
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<script type="text/javascript">
|
|
$(function(){
|
|
if($('#foot-bar input').length == 0) $('.check').hide();
|
|
$('.list-img em').click(function() {
|
|
if($(this).attr('class') == 'sheet') {
|
|
var id = $(this).attr('id').replace('sheet-', '');
|
|
Dsheet('{$js_pageid}','<a href="?mid={$mid}&action=edit&itemid='+id+'"><span>修改</span></a>|<a href="?mid={$mid}&action=relate&itemid='+id+'"><span>关联</span></a>{if $MG[copy]}|<a href="?mid={$mid}&action=add&itemid='+id+'"><span>复制</span></a>{/if}{if $MG[delete]}|<a href="?mid={$mid}&action=delete&itemid='+id+'" onclick="return _delete();"><span style="color:red;">删除</span></a>{/if}', '取消');
|
|
} else {
|
|
var id = $(this).attr('id').replace('check-', '');
|
|
if($('#checkbox-'+id).attr('checked')) {
|
|
$('#checkbox-'+id).attr('checked', false);
|
|
$(this).attr('class', 'check');
|
|
} else {
|
|
$('#checkbox-'+id).attr('checked', true);
|
|
$(this).attr('class', 'checked');
|
|
}
|
|
if($('.checked').length > 0) {
|
|
$('#foot-bar').fadeIn(300);
|
|
} else {
|
|
$('#foot-bar').fadeOut(300);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{/if}
|
|
{if $action == 'add' || $action == 'edit'}
|
|
<script type="text/javascript">
|
|
var stocks = {if $stocks}$.parseJSON('{$stocks}'){else}[]{/if};
|
|
function _p() {
|
|
if(Dd('tag').value) {
|
|
Ds('reccate');
|
|
}
|
|
}
|
|
function check() {
|
|
var l;
|
|
var f;
|
|
f = 'catid_1';
|
|
if(Dd(f).value == 0) {
|
|
Dmsg('请选择商品分类', 'catid', 1);
|
|
return false;
|
|
}
|
|
f = 'title';
|
|
l = Dd(f).value.length;
|
|
if(l < 2) {
|
|
Dmsg('商品名称最少2字,当前已输入'+l+'字', f);
|
|
return false;
|
|
}
|
|
f = 'amount';
|
|
l = Dd(f).value;
|
|
if(l < 1) {
|
|
Dmsg('请填写库存', f);
|
|
return false;
|
|
}
|
|
if(Dd('mode_0').checked) {
|
|
var price = parseFloat(Dd('price').value);
|
|
if(price < 0.01) {
|
|
Dmsg('请填写商品单价', 'price');
|
|
return false;
|
|
}
|
|
$('#p1').val(price);
|
|
} else if(Dd('mode_1').checked) {
|
|
var prices = $('#prices').val();
|
|
if(prices.length < 1) {
|
|
Dmsg('请填写'+Dd('n1').value+'对应价格', 'nv', 1);
|
|
return false;
|
|
}
|
|
if(prices.indexOf('|') == -1) {
|
|
$('#price').val(prices);
|
|
$('#p1').val(prices);
|
|
} else {
|
|
var tmp = prices.split('|');
|
|
$('#price').val(tmp[0]);
|
|
$('#p1').val(tmp[0]);
|
|
}
|
|
} else if(Dd('mode_2').checked) {
|
|
if(!Dstep()) return false;
|
|
} else if(Dd('mode_3').checked) {
|
|
if($('#tb_muti').html().indexOf('<td>') == -1) {
|
|
Dmuti();
|
|
Dmsg('第一行库存商品必须填写', 'nv', 1);
|
|
return false;
|
|
} else {
|
|
if($('#stockid-0-0-0').val() < 1) {
|
|
Dmsg('第一行库存商品必须填写', 'nv', 1);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
f = 'thumb0';
|
|
l = Dd(f).value.length;
|
|
if(l < 10) {
|
|
Dmsg('请上传第一张商品图片', f);
|
|
return false;
|
|
}
|
|
f = 'content';
|
|
l = Dd(f).value.length;
|
|
if(l < 15 || l > 50000) {
|
|
Dmsg('详细内容应为15-50000字,当前已输入'+l+'字', f);
|
|
return false;
|
|
}
|
|
if(Dd('v1').value) {
|
|
if(!Dd('n1').value) {
|
|
Dmsg('请填写属性名称', 'nv');
|
|
Dd('n1').focus();
|
|
return false;
|
|
}
|
|
if(Dd('v1').value.indexOf('|') == -1) {
|
|
Dmsg(Dd('n1').value+'至少需要两个属性', 'nv');
|
|
Dd('v1').focus();
|
|
return false;
|
|
}
|
|
}
|
|
if(Dd('v2').value) {
|
|
if(!Dd('n2').value) {
|
|
Dmsg('请填写属性名称');
|
|
Dd('n2').focus();
|
|
return false;
|
|
}
|
|
if(Dd('v2').value.indexOf('|') == -1) {
|
|
Dmsg(Dd('n2').value+'至少需要两个属性', 'nv');
|
|
Dd('v2').focus();
|
|
return false;
|
|
}
|
|
}
|
|
if(Dd('v3').value) {
|
|
if(!Dd('n3').value) {
|
|
Dmsg('请填写属性名称', 'nv');
|
|
Dd('n3').focus();
|
|
return false;
|
|
}
|
|
if(Dd('v3').value.indexOf('|') == -1) {
|
|
Dmsg(Dd('n3').value+'至少需要两个属性', 'nv');
|
|
Dd('v3').focus();
|
|
return false;
|
|
}
|
|
}
|
|
if(Dd('n1').value && (Dd('n1').value == Dd('n2').value || Dd('n1').value == Dd('n3').value)) {
|
|
Dmsg('属性名称不能重复', 'nv');
|
|
return false;
|
|
}
|
|
if(Dd('n2').value && (Dd('n2').value == Dd('n1').value || Dd('n2').value == Dd('n3').value)) {
|
|
Dmsg('属性名称不能重复', 'nv');
|
|
return false;
|
|
}
|
|
if(Dd('n3').value && (Dd('n3').value == Dd('n1').value || Dd('n3').value == Dd('n2').value)) {
|
|
Dmsg('属性名称不能重复', 'nv');
|
|
return false;
|
|
}
|
|
if(Dd('express_name_1').value && (Dd('express_name_1').value == Dd('express_name_2').value || Dd('express_name_1').value == Dd('express_name_3').value)) {
|
|
Dmsg('快递名称不能重复', 'express');
|
|
return false;
|
|
}
|
|
if(Dd('express_name_2').value && (Dd('express_name_2').value == Dd('express_name_1').value || Dd('express_name_2').value == Dd('express_name_3').value)) {
|
|
Dmsg('快递名称不能重复', 'express');
|
|
return false;
|
|
}
|
|
if(Dd('express_name_3').value && (Dd('express_name_3').value == Dd('express_name_1').value || Dd('express_name_3').value == Dd('express_name_2').value)) {
|
|
Dmsg('快递名称不能重复', 'express');
|
|
return false;
|
|
}
|
|
{if $FD}{fields_js()}{/if}
|
|
{if $CP}{property_js()}{/if}
|
|
{if $need_password}
|
|
f = 'password';
|
|
l = Dd(f).value.length;
|
|
if(l < 6) {
|
|
Dmsg('请填写支付密码', f);
|
|
return false;
|
|
}
|
|
{/if}
|
|
{if $need_question}
|
|
f = 'answer';
|
|
if($('#c'+f).html().indexOf('ok.png') == -1) {
|
|
Dmsg('请填写正确的验证问题', f);
|
|
return false;
|
|
}
|
|
{/if}
|
|
{if $need_captcha}
|
|
f = 'captcha';
|
|
if($('#c'+f).html().indexOf('ok.png') == -1) {
|
|
Dmsg('请填写正确的验证码', f);
|
|
return false;
|
|
}
|
|
{/if}
|
|
return true;
|
|
}
|
|
function Dexpress(i, s) {
|
|
if(Dd('express_'+i).value > 0) {
|
|
var t1 = s.split('[');
|
|
var t2 = t1[1].split(',');
|
|
Dd('express_name_'+i).value = t2[0];
|
|
Dd('fee_start_'+i).value = t2[1];
|
|
Dd('fee_step_'+i).value = t2[2];
|
|
} else {
|
|
Dd('express_name_'+i).value = '';
|
|
Dd('fee_start_'+i).value = '';
|
|
Dd('fee_step_'+i).value = '';
|
|
}
|
|
}
|
|
function Nexpress(i, s) {
|
|
Dd('express_name_1').value = s;
|
|
Dd('fee_start_1').value = i;
|
|
Dd('fee_step_1').value = '0.00';
|
|
$('#express_1').val(0);
|
|
Dd('express_name_2').value = '';
|
|
Dd('fee_start_2').value = '0.00';
|
|
Dd('fee_step_2').value = '0.00';
|
|
$('#express_2').val(0);
|
|
Dd('express_name_3').value = '';
|
|
Dd('fee_start_3').value = '0.00';
|
|
Dd('fee_step_3').value = '0.00';
|
|
$('#express_3').val(0);
|
|
}
|
|
function Dstep() {
|
|
Dd('p_a_1').innerHTML=Dd('p_p_1').innerHTML=Dd('p_a_2').innerHTML=Dd('p_p_2').innerHTML=Dd('p_a_3').innerHTML=Dd('p_p_3').innerHTML='';
|
|
var a1 = parseInt(Dd('a1').value);
|
|
var p1 = parseFloat(Dd('p1').value);
|
|
var a2 = parseInt(Dd('a2').value);
|
|
var p2 = parseFloat(Dd('p2').value);
|
|
var a3 = parseInt(Dd('a3').value);
|
|
var p3 = parseFloat(Dd('p3').value);
|
|
var u = Dd('unit').value;
|
|
if(u.length < 1) Dd('unit').value = u = '件';
|
|
var m = '{$DT[money_unit]}';
|
|
if(!a1 || a1 < 1) {
|
|
Dmsg('起订量必须大于0');
|
|
Dd('a1').value = '1';
|
|
Dd('a1').focus();
|
|
return false;
|
|
}
|
|
if(!p1 || p1 < 0.01) {
|
|
Dmsg('请填写商品价格');
|
|
Dd('p1').value = '';
|
|
Dd('p1').focus();
|
|
return false;
|
|
}
|
|
Dd('p_a_1').innerHTML = a1+u+'以上';
|
|
Dd('p_p_1').innerHTML = p1+m+'/'+u;
|
|
if(a2 > 1 && p2 > 0.01) {
|
|
if(a2 <= a1) {
|
|
Dmsg('数量必须大于'+a1);
|
|
Dd('a2').value = '';
|
|
Dd('a2').focus();
|
|
return false;
|
|
}
|
|
if(p2 >= p1) {
|
|
Dmsg('价格必须小于'+p1);
|
|
Dd('p2').value = '';
|
|
Dd('p2').focus();
|
|
return false;
|
|
}
|
|
Dd('p_a_1').innerHTML = a1+'-'+a2+u;
|
|
Dd('p_p_1').innerHTML = p1+m+'/'+u;
|
|
Dd('p_a_2').innerHTML = '>'+a2+u;
|
|
Dd('p_p_2').innerHTML = p2+m+'/'+u;
|
|
}
|
|
if(a3 > 1 && p3 > 0.01) {
|
|
if(a3 <= a2) {
|
|
Dmsg('数量必须大于'+a2);
|
|
Dd('a3').value = '';
|
|
Dd('a3').focus();
|
|
return false;
|
|
}
|
|
if(p3 >= p2) {
|
|
Dmsg('价格必须小于'+p2);
|
|
Dd('p3').value = '';
|
|
Dd('p3').focus();
|
|
return false;
|
|
}
|
|
Dd('p_a_2').innerHTML = (a2+1)+'-'+a3+u;
|
|
Dd('p_p_2').innerHTML = p2+m+'/'+u;
|
|
Dd('p_a_3').innerHTML = '>'+a3+u;
|
|
Dd('p_p_3').innerHTML = p3+m+'/'+u;
|
|
}
|
|
return true;
|
|
}
|
|
function Dmode(k) {
|
|
if(k == 3) {
|
|
$('#tr_step').hide();$('#tr_price').hide();$('#tr_amount').hide();$('#tr_skuid').hide();$('#tr_muti').show();$('[data-prices]').hide();
|
|
} else if(k == 2) {
|
|
$('#tr_step').show();$('#tr_price').hide();$('#tr_amount').show();$('#tr_skuid').show();$('#tr_muti').hide();$('[data-prices]').hide();
|
|
} else if(k == 1) {
|
|
$('#tr_step').hide();$('#tr_price').hide();$('#tr_amount').show();$('#tr_skuid').show();$('#tr_muti').hide();$('[data-prices]').show();
|
|
} else {
|
|
$('#tr_step').hide();$('#tr_price').show();$('#tr_amount').show();$('#tr_skuid').show();$('#tr_muti').hide();$('[data-prices]').hide();
|
|
}
|
|
}
|
|
function Dmuti() {
|
|
var n1 = Dd('n1').value;
|
|
var n2 = Dd('n2').value;
|
|
var n3 = Dd('n3').value;
|
|
var v1 = Dd('v1').value;
|
|
var v2 = Dd('v2').value;
|
|
var v3 = Dd('v3').value;
|
|
if(n1.length < 1) {
|
|
Dmsg('请填写属性名称', 'nv');
|
|
Dd('n1').focus();
|
|
return false;
|
|
}
|
|
if(v1.length < 1) {
|
|
Dmsg('请填写'+n1+'属性值', 'nv');
|
|
Dd('v1').focus();
|
|
return false;
|
|
}
|
|
if(v2) {
|
|
if(n2.length < 1) {
|
|
Dmsg('请填写属性名称');
|
|
Dd('n2').focus();
|
|
return false;
|
|
}
|
|
}
|
|
if(v3) {
|
|
if(n2.length < 1) {
|
|
Dmsg('请填写属性名称');
|
|
Dd('n2').focus();
|
|
return false;
|
|
}
|
|
if(v2.length < 1) {
|
|
Dmsg('请填写'+n2+'属性值', 'nv');
|
|
Dd('v2').focus();
|
|
return false;
|
|
}
|
|
if(n3.length < 1) {
|
|
Dmsg('请填写属性名称', 'nv');
|
|
Dd('n3').focus();
|
|
return false;
|
|
}
|
|
if(v3.length < 1) {
|
|
Dmsg('请填写'+n3+'属性值', 'nv');
|
|
Dd('v3').focus();
|
|
return false;
|
|
}
|
|
}
|
|
if((n1 && (n1 == n2 || n1 == n3)) || (n2 && (n2 == n1 || n2 == n3)) || (n3 && (n3 == n1 || n3 == n2))) {
|
|
Dmsg('属性名称不能重复', 'nv');
|
|
return false;
|
|
}
|
|
var a1 = v1 ? v1.split('|') : new Array();
|
|
var a2 = v2 ? v2.split('|') : new Array();
|
|
var a3 = v3 ? v3.split('|') : new Array();
|
|
var htm = '<table cellspacing="1">';
|
|
htm += '<tr align="center">';
|
|
htm += '<td> '+n1+' </td>';
|
|
if(v2) htm += '<td> '+n2+' </td>';
|
|
if(v3) htm += '<td> '+n3+' </td>';
|
|
htm += '<td> <span class="f_red">*</span> 条形编码 </td>';
|
|
htm += '</tr>';
|
|
if(v3) {
|
|
for(var i = 0; i < a1.length; i++) {
|
|
for(var j = 0; j < a2.length; j++) {
|
|
for(var k = 0; k < a3.length; k++) {
|
|
var key = i+'-'+j+'-'+k;
|
|
var obj = typeof stocks[key] == 'undefined' ? '' : stocks[key];
|
|
htm += '<tr align="center">';
|
|
htm += '<td>'+a1[i]+'</td>';
|
|
htm += '<td>'+a2[j]+'</td>';
|
|
htm += '<td>'+a3[k]+'</td>';
|
|
htm += '<td><input type="text" name="post[stock]['+key+']" id="stockid-'+key+'" value="'+(obj ? obj.skuid : '')+'"/></td>';
|
|
htm += '</tr>';
|
|
}
|
|
}
|
|
}
|
|
} else if(v2) {
|
|
for(var i = 0; i < a1.length; i++) {
|
|
for(var j = 0; j < a2.length; j++) {
|
|
var key = i+'-'+j+'-0';
|
|
var obj = typeof stocks[key] == 'undefined' ? '' : stocks[key];
|
|
htm += '<tr align="center">';
|
|
htm += '<td>'+a1[i]+'</td>';
|
|
htm += '<td>'+a2[j]+'</td>';
|
|
htm += '<td><input type="text" name="post[stock]['+key+']" id="stockid-'+key+'" value="'+(obj ? obj.skuid : '')+'"/></td>';
|
|
htm += '</tr>';
|
|
}
|
|
}
|
|
} else {
|
|
for(var i = 0; i < a1.length; i++) {
|
|
var key = i+'-0-0';
|
|
var obj = typeof stocks[key] == 'undefined' ? '' : stocks[key];
|
|
htm += '<tr align="center">';
|
|
htm += '<td>'+a1[i]+'</td>';
|
|
htm += '<td><input type="text" name="post[stock]['+key+']" id="stockid-'+key+'" value="'+(obj ? obj.skuid : '')+'"/></td>';
|
|
htm += '</tr>';
|
|
}
|
|
}
|
|
htm += '</table>';
|
|
Dd('tb_muti').innerHTML = htm;
|
|
}
|
|
function select_stock(k) {
|
|
Dwidget(AJPath+'?action=choose&mid={$moduleid}&job=stock&key='+k, '选择库存商品');
|
|
}
|
|
$(function(){
|
|
Dmode({$mode});
|
|
if(Dd('v1').value) {Dmuti();}
|
|
if(Dd('mode_2').checked) {Dstep();}
|
|
$('#tr_step input').on('input blur',function(e){
|
|
if(Dd('mode_2').checked) {
|
|
Dstep();
|
|
}
|
|
});
|
|
$('#tr_nv input').on('input blur',function(e){
|
|
if(Dd('mode_3').checked) {
|
|
Dmuti();
|
|
}
|
|
});
|
|
});
|
|
var destoon_oauth = '{$EXT[oauth]}';
|
|
</script>
|
|
{/if}
|
|
{template 'footer', 'member'}
|