<extend name="Public/bases2" />
<block name="css">
<empty name="nologin">
		<link href="__CSS__/game.css" rel="stylesheet" > 
		<link href="__CSS__/trade.css" rel="stylesheet" > 
    <style>
			.header .xg-back {
    display: block;
    position: absolute;
    top: 0px;
    left: 0px;
    width: 4rem;
    height: 4rem;
    background: url(__IMG__/trade1/btn_left_n@3x.png) no-repeat center center / 3rem 3rem;
}
.xg_main{margin-top:9.1rem;}
.trade_caption {}
.trade-tab {border-top:1px solid #c2c2c2;position:fixed;z-index:3;line-height:4.2rem;width:100%;left:0;right:0;margin:0 auto;overflow:hidden;clear:both;background:#FFF;}
.trade-tab .trade-item {width:20%;float:left;text-align:center;    box-sizing: border-box;
    transition: all 0.3s linear;
    text-decoration: none;
    color: #5d5d5d;
    outline: none;}
.trade-tab .trade-item.active{    color: rgb(25,177,234);}
.trade-tab > .trade-item .text {
    position: relative;
    display: inline-block;
    padding: 1.62rem 0;
    line-height: 0.8rem;
    font-size: 1.66rem;
}
.trade-tab > .trade-item.active .text:after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0px;
    height: 2px;
    background-color: currentColor;
}
.good-info {
    margin-bottom: 0.2rem;
    box-shadow: 0 0.3rem 0.3rem 0 #eee;
    padding: 0px 1.25rem 1.32rem;
		background-color: #fff;
}
.clf {
    zoom: 1;
}.clf::before, .clf::after {
    content: '';
    display: table;
    clear: both;
}
.good-info h5 {
    margin-bottom: 0.12rem;
    color: rgb(151, 151, 151);
    font-size: 1.32rem;
    font-weight: normal;
}
.state-wrapper .btn-group {
    float: right;
	min-width:8.1rem;
}
.state-wrapper .btn-group .btn-text {
    height: 2rem;
    line-height: 2rem;
    color: #838383;
    border: 1px solid currentColor;
    white-space: nowrap;
    padding: 0 0.8rem;
    border-radius: 1rem;
    float: left;width:auto;
    background: none;
    outline: none;font-size:1.3rem;
	float: right;
    margin-left: 0.5rem;
}
.state-wrapper .btn-group .btn-text:first-child {
    margin-right: 0.14rem;
}
.state-wrapper .btn-group .btn-text.btn_modify {
    color: #f2a756;
}
.state-wrapper {
    padding: 0.74rem 0;
}
.good-info-container {
    border-top: 1px solid #f1f1f1;
    padding-top: 0.5rem;
}
.good-info-left {
    display: block;
    float: left;
    margin-right: 1.3rem;
}
.good-info-img-box {display:inline-block;border-radius: 6px;float:left;margin-right: 1.3rem;width: 11.2rem;height:6rem;overflow:hidden;}
.good-info-img {
    display: inline-block;
    /*width: 11.2rem;
	height:6rem;*/width:100%;height:auto;
	border-radius: 6px;
}
.good-info-right {
    overflow: hidden;
}
.good-info-desc {
    font-size: 1.63rem;
    color: rgb(51, 51, 51);
    margin-bottom: 2rem;
    margin-top: 0.5rem;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.good-info-tags {
    display: inline-block;
    color: rgb(151, 151, 151);
    padding: 0.04rem 0.2rem;
    border: 1px solid currentColor;
    border-radius: 20px;
    font-size: 1.3rem;
}
.good-info-price {
    color: rgb(217, 65, 50);
    float: right;
    font-size: 0.4rem;
}
.good-info-price > small {
    font-size: 0.2rem;
}
.good-info-price {
    color: rgb(217, 65, 50);
    float: right;
    font-size: 1.4rem;
}
.pop-window .pop-table {
	position:relative;height:100%;display:table;
}
.pop-window .pop-table .pop-wrap {display:table-cell;vertical-align:middle;}
.del_box {
width:58vw;
max-width:410px;
margin:0 auto;background:#FFF;border-radius:1.5vw;font-size:2rem;
font-weight: bold;
}
.del_box p{padding:2vw;text-align:center;margin:0;color:#000;}
.del_box .del_btn_box,.changeprice_btn_box {padding: 0.2rem 4rem 2rem;}
.changeprice_btn_box {padding:0.2rem 0 1rem;}
.del_box .del_btn_box a,.changeprice_btn_box span {width:50%;float:left;text-align:center;}
.del_box .del_btn_box a,.changeprice_btn_box a {
    height: 4rem;
	line-height: 4rem;
    border-top: 1px solid #e7e7e9;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 20px;
	color: #3478f7;
	background-color:#fff;
}
.changeprice_btn_box a {height:3.5rem;line-height:3.5rem;}
.del_box .del_btn_box a:last-child{
	border-left:1px solid #e7e7e9;
	border-bottom-left-radius: 0;
}
.changeprice_btn_box a{display:inline-block;width:72%;color:#fff;border-radius:20px;}
.changeprice_btn_box a.cancel_btn{
	background-color:#c1c1c1;
}
.changeprice_btn_box a.confirm_btn{
	    background-color: #18b1ea;
}
.changeprice_box {margin:0 auto;background:#FFF;font-size:2rem;width:58vw;max-width:410px;border-radius:6px;}
.changeprice_box_body{padding: 2.6rem 2rem 1.8rem;}
.changeprice_input_wrap {padding: 0.2rem 0 1rem;color: #5e5e5e;}
.changeprice_input {
    border: none;
    width: 63%;
    font-size: inherit;
    outline: none;
    padding: .1rem .5rem;
    box-sizing: border-box;
    height: 2rem;
    margin: 0 1rem;
    background-color: #f2f2f2;
    border-radius: 6px;
	color: #5f5f5f;margin-top:-.2rem;
}
.changeprice_box p {font-size:1.5rem;color:#bcbcbc;text-align:center;}
.del_btn_box.z_clearfix{
	padding:0;
}
@media screen and (min-width:640px) {
	.good-info {padding:0 1.5rem 1.6rem;}
	.good-info h5 {font-size:1.6rem;}
	.good-info-container{padding-top:.6rem;}
	.good-info-img-box {width:19rem;height:10rem;}
	.good-info-desc {font-size:1.83rem;margin-bottom:3rem;margin-top:1rem;}
	.good-info-tags {padding:0.1rem 0.3rem;font-size:1.5rem;}
	.good-info-price {font-size:1.8rem;}
	.state-wrapper {padding:1.4rem 0;}
	.state-wrapper .btn-group .btn-text {font-size:1.4rem;}
}
@media screen and (max-width:640px) {
	.del_box,.changeprice_box {font-size:1.4rem;}
	.del_box p {padding:3.5vw;}
	.changeprice_box p {font-size:1rem;}
	.changeprice_input {width:48%;padding: .1rem .5rem;}
	.good-info-desc {margin-top:0.1rem;margin-bottom:1.8rem;}
	.good-info-tags {padding:0.01rem 0.2rem;font-size: 1.3rem;}
	.del_box .del_btn_box a, .changeprice_btn_box a {line-height:2.6rem;height:2.6rem;}
	.trade-tab {line-height:3.2rem;}
	.trade-tab > .trade-item .text {font-size:1.36rem;padding:1.2rem 0;line-height:0.4rem;}
	.xg_main {margin-top:9rem;}
}


		</style>
</empty>
<script src="__JS__/lwx.js"></script>
</block>
<block name="body">
<notempty name="nologin">

{$nologin}

<else />
<div class="xg_main" style="">

<header class="header trade-header" style="border:none;box-shadow:0 0 0 0.4rem #eee">
    <a class="xg-back" href="javascript:;" onclick="window.location.href=&#39;{:U('Trade/index',array('is_app'=>I('is_app'),'token'=>I('token')))}&#39;"></a>
    <h1 class="trade_caption">交易记录</h1>
<div class="trade-tab">					
	<a class="trade-item <empty name='Think.get.type'>active</empty>" href="{:U('record',array('is_app'=>I('is_app'),'token'=>I('token')))}"><span class="text">全部</span></a>
	<a class="trade-item <eq name='Think.get.type' value='1'>active</eq>" href="{:U('record',array('type'=>1,'is_app'=>I('is_app'),'token'=>I('token')))}"><span class="text">已购买</span></a>
	<a class="trade-item <eq name='Think.get.type' value='2'>active</eq>" href="{:U('record',array('type'=>2,'is_app'=>I('is_app'),'token'=>I('token')))}"><span class="text">出售中</span></a>
	<a class="trade-item <eq name='Think.get.type' value='3'>active</eq>" href="{:U('record',array('type'=>3,'is_app'=>I('is_app'),'token'=>I('token')))}"><span class="text">已出售</span></a>
	<a class="trade-item" href="{:U('withdraw',array('is_app'=>I('is_app'),'token'=>I('token')))}"><span class="text">提现</span></a>
</div>
</header>

<div class="t-list ">

            <!-- If we need pagination -->
            <!-- Additional required wrapper -->

                <!-- Slides -->
								<empty name="Think.get.type">
                <!--全部部分 begin!-->
                <div class="content ">
								<div id="ajaxContainer" class="clearfix" currentpage="{$page}" maxpage="{$totalpage}">
                  <empty name="lists">
									<div class="no_data">
										<div class="nodata_content">
											<img class="nodata_img" src="__IMG__/trade/icon_shangpin@3x.png" alt="" height="" width="">
											<p class="nodata_txt">暂无记录,逛逛其他地方吧~</p>
										</div>
									</div>
									<else />
										<volist name="lists" id="vo">
										<div class="xg-module good-info jsgood_info">
											<switch name="vo.status">
												<case value="0">
													<h5 class="state-wrapper clf">
                            <span class="">待审核</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsoffline" data-id="{$vo.id}">下架</button>
                                <button type="button" class="btn-text btn_modify jsmodify" data-id="{$vo.id}">修改</button>
                            </div>
													</h5>
												</case>
												<case value="1">
													<h5 class="state-wrapper clf">
                            <span class="state col_red">已出售</span>
														<span class="state_time">({$vo.time})</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsdelete" data-id="{$vo.id}">删除</button>
                            </div>
													</h5>
												</case>
												<case value="2">
													<h5 class="state-wrapper clf">
                            <span class="state audit_failed">审核未通过</span>														
                            <div class="btn-group">
                                <button type="button" class="btn-text jsdelete" data-id="{$vo.id}">删除</button>
                                <button type="button" class="btn-text btn_modify jsmodify" data-id="{$vo.id}">修改</button>
                            </div>
													</h5>
													<span class="failed_tips" style="color:#999;">{$vo.remark}</span>
												</case>
												<case value="3">
													<h5 class="state-wrapper clf">
                            <span class="state">出售中</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsoffline" style="color: #19b1ea;" data-id="{$vo.id}">下架</button>
                                <button type="button" class="btn-text txt_blue jschangeprice" style="color: #19b1ea;" data-id="{$vo.id}" data-price="{$vo.price}">改价</button>
                            </div>
													</h5>
												</case>
												<case value="6">
													<switch name="vo.is_refund">
													<case value="1">
													<h5 class="state-wrapper clf">
                            <span class="state col_red">已退款</span>
														<span class="state_time">({$vo.time})</span>
                            <div class="btn-group">
                              <button type="button" class="btn-text jsdelete" data-id="{$vo.id}" data-buyer="1">删除</button> 
                            </div>
													</h5>
													</case>
													<case value="2">
													<h5 class="state-wrapper clf">
                            <span class="state col_red">待退款</span>
														<span class="state_time">({$vo.time})</span>
                            <div class="btn-group">
                            </div>
													</h5>
													</case>
													<default />
													<h5 class="state-wrapper clf">
                            <span class="state col_red">已购买</span>
														<span class="state_time">({$vo.time})</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsdelete" data-id="{$vo.id}" data-buyer="1">删除</button>
                                <button type="button" class="btn-text jsuseing" data-id="{$vo.id}" style="color: #19b1ea;">如何使用</button>
                            </div>
													</h5>
													</switch>
												</case>
												<case value="-1">
													<h5 class="state-wrapper clf">
                            <span class="state">已下架</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsdelete" data-id="{$vo.id}">删除</button>
                                <button type="button" class="btn-text btn_modify jsmodify" data-id="{$vo.id}">修改</button>
                            </div>
													</h5>
												</case>
											</switch>
                                            <php>$url = U('Trade/record_info',array('is_app'=>I('is_app'),'token'=>I('token'),'id'=>$vo['id']));</php>
                        <div class="good-info-container clf" onclick="window.location.href=&#39;{$url}&#39;">
														<div class="good-info-img-box">
                            <img class="good-info-left good-info-img" src="<notempty name='vo.icon'>{$vo.icon}<else />__IMG__/trade1/pic_zhanghao@3x.png</notempty>"
                                 width="160" alt="">
														</div>
                            <div class="good-info-right">
                                <div class="good-info-desc">{$vo.title}</div>
                                <span class="good-info-tags">{$vo.game_name}</span>
                                <strong class="good-info-price">
                                    <span class="jsgoodprice">¥{$vo.price}</span>
                                </strong>
                            </div>
                        </div>
                    </div>
										</volist>
									</empty>
                </div>
                </div>
                <!--end! 全部部分-->
								</empty>
								<eq name='Think.get.type' value='1'>
                <!--已购买部分 begin!-->
                <div class="content ">
								<div id="ajaxContainer" class="clearfix" currentpage="{$page}" maxpage="{$totalpage}">
                  <empty name="lists">
									<div class="no_data">
										<div class="nodata_content">
											<img class="nodata_img" src="__IMG__/trade/icon_shangpin@3x.png" alt="" height="" width="">
											<p class="nodata_txt">暂无记录,逛逛其他地方吧~</p>
										</div>
									</div>
									<else />
									<volist name="lists" id="vo">
                    <div class="xg-module good-info jsgood_info">
                        <h5 class="state-wrapper clf">
                            <span class="state col_red">已购买</span>
														<span class="state_time">({$vo.time})</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsdelete"  data-id="{$vo.id}" data-buyer="1">删除</button>
                                <button type="button" class="btn-text jsuseing"  data-id="{$vo.id}" style="color: #19b1ea;">如何使用</button>
                            </div>
                        </h5>
                        <div class="good-info-container clf" onclick="window.location.href=&#39;{$vo.url}&#39;">
                            <div class="good-info-img-box">
														<img class="good-info-left good-info-img" src="<notempty name='vo.icon'>{$vo.icon}<else />__IMG__/trade1/pic_zhanghao@3x.png</notempty>"
                                 width="160" alt=""></div>
                            <div class="good-info-right">
                                <div class="good-info-desc">{$vo.title}</div>
                                <span class="good-info-tags">{$vo.game_name}</span>
                                <strong class="good-info-price">
                                    <span class="jsgoodprice">¥{$vo.price}</span>
                                </strong>
                            </div>
                        </div>
                    </div>
									</volist>
									</empty>
                </div>
                </div>
                <!--end! 已购买部分-->
								</eq>
								<eq name='Think.get.type' value='2'>
                <!--出售中 begin!-->
                <div class="content ">
								<div id="ajaxContainer" class="clearfix" currentpage="{$page}" maxpage="{$totalpage}">
									<empty name="lists">
									<div class="no_data">
										<div class="nodata_content">
											<img class="nodata_img" src="__IMG__/trade/icon_shangpin@3x.png" alt="" height="" width="">
											<p class="nodata_txt">暂无记录,逛逛其他地方吧~</p>
										</div>
									</div>
									<else />
									<volist name="lists" id="vo">
                    <div class="xg-module good-info jsgood_info">
                        <h5 class="state-wrapper clf">
                            <span class="state">出售中</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text txt_blue jsoffline" style="color: #19b1ea;" data-id="{$vo.id}">下架</button>
                                <button type="button" class="btn-text txt_blue jschangeprice" style="color: #19b1ea;" data-id="{$vo.id}" data-price="{$vo.price}">改价</button>
                            </div>
                        </h5>
                        <div class="good-info-container clf" onclick="window.location.href=&#39;{$vo.url}&#39;">
                            <div class="good-info-img-box">
														<img class="good-info-left good-info-img" src="<notempty name='vo.icon'>{$vo.icon}<else />__IMG__/trade1/pic_zhanghao@3x.png</notempty>"
                                 width="160" alt=""></div>
                            <div class="good-info-right">
                                <div class="good-info-desc">{$vo.title}</div>
                                <span class="good-info-tags">{$vo.game_name}</span>
                                <strong class="good-info-price">
                                    <span class="jsgoodprice">¥{$vo.price}</span>
                                </strong>
                            </div>
                        </div>
                    </div>
									</volist>
									</empty>
									
                </div>
                </div>
                <!--end! 出售中-->
								</eq>
								<eq name='Think.get.type' value='3'>
                <!--已出售 begin!-->
                <div class="content ">
                <div id="ajaxContainer" class="clearfix" currentpage="{$page}" maxpage="{$totalpage}">
									<empty name="lists">
									<div class="no_data">
										<div class="nodata_content">
											<img class="nodata_img" src="__IMG__/trade/icon_shangpin@3x.png" alt="" height="" width="">
											<p class="nodata_txt">暂无记录,逛逛其他地方吧~</p>
										</div>
									</div>
									<else />
										<volist name="lists" id="vo">
                    <div class="xg-module good-info jsgood_info">
                        <h5 class="state-wrapper clf">
                            <span class="state col_red">已出售</span>
														<span class="state_time">({$vo.time})</span>
                            <div class="btn-group">
                                <button type="button" class="btn-text jsdelete" data-id="{$vo.id}">删除</button>
                            </div>
                        </h5>
                        <div class="good-info-container clf" onclick="window.location.href=&#39;{$vo.url}&#39;">
                            <div class="good-info-img-box">
														<img class="good-info-left good-info-img" src="<notempty name='vo.icon'>{$vo.icon}<else />__IMG__/trade1/pic_zhanghao@3x.png</notempty>"
                                 width="160" alt=""></div>
                            <div class="good-info-right">
                                <div class="good-info-desc">{$vo.title}</div>
                                <span class="good-info-tags">{$vo.game_name}</span>
                                <strong class="good-info-price">
                                    <span class="jsgoodprice">¥{$vo.price}</span>
                                </strong>
                            </div>
                        </div>
                    </div>
										</volist>
									</empty>
                </div>
                </div>
                <!--end! 已出售-->
                </eq>
            

</div>
</div>
<div id="store_data" data-rate="{:set_zero_on_number(C('withdraw.sell_rate'))}" data-sell-price="{:add_two_number(C('withdraw.sell'),C('withdraw.poundage'))}" data-low="{:set_zero_on_number(C('withdraw.poundage'))}"></div>
<div class="popmsg pop-dialog"></div>
    <div class="loading ms-none hidden" id="moreBtn"><a href="javascript:" class="link"></a></div>
    <div class="popwin pop-window"><div class="pop-table"><div class="pop-wrap"></div></div></div>
    <div class="popwin2 pop-window" style="background:#FFF;"><div class="pop-page"><div class="pop-wrap"></div></div></div>
		<script src="__JS__/ajaxload.js"></script>
    <script src="__JS__/pop.lwx.min.js"></script>
</notempty>
</block>
<block name="script">
<empty name="nologin">
<script>
		var pmsg = $('.popmsg').pop();
		var popwin = $('.popwin').pop();
		var popwin2 = $('.popwin2').pop();
    $(function () {
	       
			$('.footer').hide();
			$('.content').css({'min-height':($(window).height()-$(".header").height()-$(".swiper-tab").height()-50)});
			$(".no_data").css({'height':($('.content').height())});
			/*改价*/
      $('.jschangeprice').click(function() {
				jschangeprice(this);
				return false;
			});
			/*下架*/
			$('.jsoffline').click(function() {
				jsoffline(this);
				return false;
			});
			/*删除*/
			$('.jsdelete').click(function() {
				jsdelete(this);
				return false;
			});
			/*修改*/
			$('.jsmodify').click(function() {
				jsmodify(this);
				return false;
			});
			/*使用说明*/
			$('.jsuseing').click(function() {
				jsuseing(this);
				return false;
			});
			
			$("#ajaxContainer").scroll(function() {
				console.log('ddddd');
			});
			
			var ac = $('#ajaxContainer');
			var popmsg = $('.loading').pop();
			
			ajaxload('{:U("ajaxrecord",array("type"=>I("type")))}',{},function(data) {
				if(parseInt(data.status) == 1) {
					ac.attr('currentpage',data.current);
					var html = '',d = data.lists;
					for (var i in d) {
						var item = d[i];
						
						html += '<div class="xg-module good-info jsgood_info">';
						html += '<h5 class="state-wrapper clf">';
						
						switch(parseInt(item.status)) {
							case 0:{
								html += '	<span class="">待审核</span>';
								html += '	<div class="btn-group">';
								html += '			<button type="button" class="btn-text btn_modify jsmodify" data-id="'+item.id+'">修改</button>';
								html += '			<button type="button" class="btn-text txt_blue jsoffline" data-id="'+item.id+'">下架</button>';
								html += '	</div>';
							};break;
							case 1:{
								html += '	<span class="state col_red">已出售</span>';
								html += '	<span class="state_time">('+item.time+')</span>';
								html += '	<div class="btn-group">';
								html += '			<button type="button" class="btn-text jsdelete" data-id="'+item.id+'">删除</button>';
								html += '	</div>';
							};break;
							case 2:{
								html += '	<span class="state audit_failed">审核未通过</span>';
								html += '	<div class="btn-group">';
								html += '			<button type="button" class="btn-text btn_modify jsmodify" data-id="'+item.id+'">修改</button>';
								html += '			<button type="button" class="btn-text jsdelete" data-id="'+item.id+'">删除</button>';
								html += '	</div>';
							};break;
							case 3:{
								html += '	<span class="state">出售中</span>';
								html += '	<div class="btn-group">';
								html += '			<button type="button" class="btn-text txt_blue jschangeprice" data-id="'+item.id+'">改价</button>';
								html += '			<button type="button" class="btn-text txt_blue jsoffline" data-id="'+item.id+'">下架</button>';
								html += '	</div>';
							};break;
							case 6:{
								html += '	<span class="state col_red">已购买</span>';
								html += '	<span class="state_time">('+item.time+')</span>';
								html += '	<div class="btn-group">';
								html += '			<button type="button" class="btn-text jsuseing" data-id="'+item.id+'" style="color: #19b1ea;">如何使用</button>';
								html += '			<button type="button" class="btn-text jsdelete" data-id="'+item.id+'">删除</button>';
								html += '	</div>';
							};break;
							case -1:{
								html += '	<span class="state">已下架</span>';
								html += '	<div class="btn-group">';
								html += '			<button type="button" class="btn-text btn_modify jsmodify" data-id="'+item.id+'">修改</button>';
								html += '			<button type="button" class="btn-text jsdelete" data-id="'+item.id+'">删除</button>';
								html += '	</div>';
							};break;
						}
						html += '</h5>';

						if(parseInt(item.status)==2) {html += '<span style="color:#999;">{$vo.remark}</span>';}		
				
						html += '	<div class="good-info-container clf" onclick="window.location.href=&#39;'+item.url+'&#39;">';
						html += '		<div class="good-info-img-box">';
						html += '			<img class="good-info-left good-info-img" src="'+(item.icon?item.icon:'__IMG__/trade1/pic_zhanghao@3x.png')+'"';
						html += '					 width="160" alt=""></div>';
						html += '			<div class="good-info-right">';
						html += '					<div class="good-info-desc">'+item.title+'</div>';
						html += '					<span class="good-info-tags">'+item.game_name+'</span>';
						html += '					<strong class="good-info-price">';
						html += '							<small>¥</small>'+item.price;
						html += '					</strong>';
						html += '			</div>';
						html += '	</div>';
						html += '</div>';
						
					}
					
					ac.append(html);
					$('.loading').addClass('ms-none');
					$('#moreBtn').removeClass('ms-none');loads=false;
					
					/*改价*/
					$('.jschangeprice').click(function() {
						jschangeprice(this);
						return false;
					});
					/*下架*/
					$('.jsoffline').click(function() {
						jsoffline(this);
						return false;
					});
					/*删除*/
					$('.jsdelete').click(function() {
						jsdelete(this);
						return false;
					});
					/*修改*/
					$('.jsmodify').click(function() {
						jsmodify(this);
						return false;
					});
					/*使用说明*/
					$('.jsuseing').click(function() {
						jsuseing(this);
						return false;
					});
					
				} else {
					$('.loading').addClass('ms-none');
          popmsg.msg('已经到底了~');
				}
			});
			
			
    });
		
		function jschangeprice(ele) {
			var that = $(ele);var id = that.attr('data-id');
			if(that.hasClass('disabled')) {return false;}
			that.addClass('disabled');
			var price = that.attr('data-price');
			
			var store_data = $('#store_data');
			var rate = store_data.attr('data-rate');
			var poundage = store_data.attr('data-low');
			var sellprice = store_data.attr('data-sell-price');
			var get = (price*(100-rate)/100).toFixed(2);
			
			//popwin.find('.pop-wrap').css({'vertical-align':'bottom'})
			popwin.open(300,'<div class="changeprice_box"><div class="changeprice_box_body"><div class="changeprice_input_wrap"><span class="changeprice_prifix">修改价格</span><input type="text" class="changeprice_input" id="new_price" value="'+price+'">元</div><p>(手续费<span>'+(rate)+'</span>%,最低<span>'+(poundage)+'</span>元)出售可得<span style="color:rgb(217, 63, 48);" id="get_price">'+(get)+'</span>金币</p></div><div class="changeprice_btn_box z_clearfix"><span><a href="javascript:;" class="cancel_btn">取消</a></span><span><a href="javascript:;" class="confirm_btn">确定</a></span></div></div>');
			
			popwin.find('#new_price').keyup(function() {
				var val = $.trim($(this).val());
				if (!val) {pmsg.msg('请输入修改价格');return false;}
				if (!/^[1-9]\d*(\.(\d{0,2})?)?$/.test(val)) {$(this).val('');pmsg.msg('修改价格错误');return false;}
				var getprice = $('#get_price');
				if(val*rate <= poundage*100) {
					if(val>=sellprice && val >0) {
						var coin = (val*(100-rate)/100).toFixed(2);
						getprice.text(coin);
					} else {
						pmsg.msg('修改价格不低于'+sellprice+'元');return false;
					}
				} else {
					var coin = (val*(100-rate)/100).toFixed(2);
					getprice.text(coin);
				}
				return false;
			});
			
			popwin.find('.cancel_btn').click(function() {
				popwin.close(300);that.removeClass('disabled');
				setTimeout(function() {
				popwin.find('.pop-wrap').css({'vertical-align':'middle'});
				},310);
				return false;
			});
			popwin.find('.confirm_btn').click(function() {
				var val = $.trim($('#new_price').val());
				if(!val) {pmsg.msg('请输入修改价格');return false;}
				if (!/^[1-9]\d*(\.(\d{0,2})?)?$/.test(val)) {$(this).val('');pmsg.msg('修改价格错误');return false;}
				popwin.close(300);
				setTimeout(function() {
				popwin.find('.pop-wrap').css({'vertical-align':'middle'});
				},310);
				$.ajax({
					type:'post',
					dataType:'json',
					url:'{:U("change_price")}',
					data:{id:id,price:val},
					success:function(data){
						if(parseInt(data.status)==1) {
							pmsg.msg(data.info);
							
							var pa = that.closest('.jsgood_info');
							pa.find('.jsgoodprice').text(val);
							pa.find('.state').text('待审核');
							that.remove();
							pa.find('.btn-group').append('<button type="button" class="btn-text btn_modify jsmodify" data-id="'+id+'">修改</button>');
							pa.find('.jsmodify').click(function() {
								jsmodify(this);
								return false;
							});
							
						} else {
							pmsg.msg(data.info);
							that.removeClass('disabled');
						}
					},
					error:function(){pmsg.msg('服务器故障,请稍后再试');that.removeClass('disabled');},
				});
				return false;
			});
			
		}
		function jsdelete(ele) {
			var that = $(ele);var id = that.attr('data-id');
			
			popwin.open(300,'<div class="del_box"><p>删除后该记录无法恢复,是否确认删除?</p><div class="del_btn_box z_clearfix"><a href="javascript:;" class="cancel_btn">取消</a><a href="javascript:;" class="confirm_btn">确定</a></div></div>');
			
			popwin.find('.cancel_btn').click(function() {
				popwin.close();
				return false;
			});
			popwin.find('.confirm_btn').click(function() {
				if(that.hasClass('disabled')) {return false;}
				that.addClass('disabled');
				popwin.close();
				$.ajax({
					type:'post',
					dataType:'json',
					url:'{:U("del_record")}',
					data:{id:id,b:that.attr('data-buyer')},
					success:function(data){
						if(parseInt(data.status)==1) {
							pmsg.msg(data.info);
							setTimeout(function(){
							that.closest('.jsgood_info').remove();
							},2000);
						} else {
							pmsg.msg(data.info);
							that.removeClass('disabled');
						}
					},
					error:function(){pmsg.msg('服务器故障,请稍后再试');that.removeClass('disabled');},
				});
				return false;
			});
			
		}
		
		function jsoffline(ele) {
			var that = $(ele);var id = that.attr('data-id');
			
			popwin.open(300,'<div class="del_box"><p>确定下架商品吗?</p><div class="del_btn_box z_clearfix"><a href="javascript:;" class="cancel_btn">暂不下架</a><a href="javascript:;" class="confirm_btn">下架</a></div></div>');
			
			popwin.find('.cancel_btn').click(function() {
				popwin.close();
				return false;
			});
			popwin.find('.confirm_btn').click(function() {
				if(that.hasClass('disabled')) {return false;}
				that.addClass('disabled');
				popwin.close();
				$.ajax({
					type:'post',
					dataType:'json',
					url:'{:U("offline_record")}',
					data:{id:id},
					success:function(data){
						if(parseInt(data.status)==1) {
							pmsg.msg(data.info);
							setTimeout(function(){
							that.closest('.jsgood_info').remove();
							},2000);
						} else {
							pmsg.msg(data.info);
							that.removeClass('disabled');
						}
					},
					error:function(){pmsg.msg('服务器故障,请稍后再试');that.removeClass('disabled');},
				});
				return false;
			});
			
		}
		
		function jsuseing(ele) {
			var that = $(ele);var id = that.attr('data-id');
			
			$.ajax({
				type:'post',
				dataType:'json',
				url:'{:U("useing_record")}',
				data:{id:id},
				success:function(data){
					popwin2.open(800,data.html);
				},
				error:function(){pmsg.msg('服务器故障,请稍后再试');},
			});
		}
		
		function jsmodify(ele) {
			var that = $(ele);var id = that.attr('data-id');
			var url = '{:U("Trade/edit_good",array("is_app"=>I("is_app"),"token"=>I("token")),false)}';
			url = url.replace('.html','');
			window.location.href=url+'/id/'+id+'.html';
		}
		
</script>
</empty>
</block>