123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>新增库存盘点</title>
- <link href="/css/ims/base.css" rel="stylesheet">
- <link href="/css/ims/ims.css" rel="stylesheet">
- <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css" />
- <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css" />
- <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css" />
- <style>
- .ims-box {
- margin: 20px;
- }
- .screen {
- padding-left: 20px;
- height: 44px;
- line-height: 44px;
- background-color: #eff4fa;
- }
- .screen li {
- float: left;
- margin-right: 65px;
- }
- .bg-d9bf6e {
- margin-left: 5px;
- padding: 0 20px;
- color: #fff;
- background-color: #d9bf6e;
- }
- .list {
- padding: 0 40px;
- /*margin-top: 40px;*/
- overflow: hidden;
- }
- .list h2 {
- line-height: 30px;
- font-size: 14px;
- }
- .list .student-list_box {
- width: 300px;
- }
- .list .student-list_box>ul {
- height: 260px;
- overflow: auto;
- padding: 20px;
- background-color: #eef3ff;
- }
- .list .student-list_box li {
- line-height: 30px;
- cursor: pointer;
- }
- .list .student-selected_box {
- margin-left: 60px;
- }
- .list .student-list {
- display: none;
- margin-left: 20px;
- }
- .list .student-list li.active .btn-select_all {
- display: inline-block;
- }
- .list .student-list span {
- cursor: pointer;
- }
- .list .btn-select_all {
- margin-left: 84px;
- color: #2977ff;
- }
- .student-name_box li {
- position: relative;
- margin-left: 28px;
- line-height: 30px;
- }
- .student-name_box input {
- position: absolute;
- left: 155px;
- top: 8px;
- }
- .btn-select_all,
- .student-name_box {
- display: none;
- }
- .student-selected {
- width: 320px;
- height: 300px;
- overflow: auto;
- }
- .student-selected li {
- float: left;
- margin-right: 24px;
- margin-bottom: 12px;
- width: 280px;
- height: 26px;
- line-height: 26px;
- text-indent: 20px;
- background-color: #f2f2f2;
- }
- .student-selected .btn-delete {
- float: right;
- margin-right: 20px;
- color: red;
- cursor: pointer;
- }
- .btn-confirm_purchase {
- display: block;
- margin: 0 auto;
- margin-top: 100px;
- margin-bottom: 50px;
- width: 430px;
- line-height: 54px;
- color: #fff;
- font-family: PingFangSC-Regular, "PingFang SC";
- font-weight: 400;
- font-style: normal;
- font-size: 20px;
- text-align: center;
- background-color: #2977ff;
- cursor: pointer;
- }
- .sale-table input {
- border: 1px solid #ccc;
- border-radius: 4px;
- }
- #imgPreview {
- display: inline-block;
- margin-top: 12px;
- }
- #imgPreview > img {
- max-width: 100px;
- max-height: 100px;
- margin-right: 5px;
- }
- .layui-layer-btn .layui-layer-btn0 {
- border-color: #2977ff !important;
- background-color: #2977ff !important;
- color: #fff;
- }
- .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
- line-height: 140px;
- text-align: center;
- }
- .blue{
- color:blue;
- cursor: pointer;
- }
- .bg-green{
- background-color: #2977ff;
- }
- .bg-red{
- background-color: red;
- }
- .bg-yellow{
- background-color: #DAA520;
- }
-
- .title{
- padding: 0 10px;
- font-size: 16px;
- font-weight: 600;
- line-height: 28px;
- }
- .product{
- padding: 0 10px;
- margin-top: 10px;
-
- }
- .table-product{
- width: 100%;
- text-align: center;
- line-height: 30px;
- }
- .table-product tr:nth-child(odd) {
- background-color: #fafafa;
- }
- .product .table-product th,.product .table-product td{
- width: 15%;
- }
- .product .table-product th{
- text-align: center;
- }
- .product .plan-count-wrap-po{
- display: inline-block;
- height: 24px;
- font-size: 0;
- }
- .product .reduce-count,.product .add-count{
- display: inline-block;
- width: 24px;
- line-height: 24px;
- height: 24px;
- font-size: 14px;
- text-align: center;
- color: #fff;
- background-color: #666;
- cursor: pointer;
- }
- .product .product-contrast{
- text-align: left;
- padding-left: 6%;
- }
- .product .plan-count{
- width: 80px;
- height: 24px;
- line-height: 24px;
- font-size: 14px;
- text-align: center;
- box-sizing: border-box;
- }
- .tag-table-product{
- display: inline-block;
- margin-right: 10px;
- width: 24px;
- height: 24px;
- line-height: 24px;
- color: #fff;
- text-align: center;
- }
- .assets{
- width: 100%;
- margin-top: 10px;
- padding: 0 10px;
- }
- .assets .table-assets{
- width: 100%;
- text-align: center;
- line-height: 30px;
- }
- .table-assets tr:nth-child(odd) {
- background-color: #fafafa;
- }
- .assets .table-assets th{
- text-align: center;
- }
- .show-layer-assets-number{
- color: #169BD5;
- cursor: pointer;
- }
- /*弹窗开始*/
- .dialog-layer-assets-number{
- display: none;
- width: 360px;
- padding: 10px 20px;
- color: #666;
- }
- .dialog-layer-assets-number .pan-title{
- line-height: 32px;
- color: #333;
- font-weight: 600;
- }
- .assets-number-list{
- height: 60px;
- overflow: auto;
- }
- .assets-number-list label{
- display: inline-block;
- width: 150px;
- line-height: 30px;
- font-size: 13px;
- }
- .dialog-layer-assets-number .new-assets-number-box{
- line-height: 30px;
- }
- .dialog-layer-assets-number .input-new-assets-number{
- width: 120px;
- line-height: 24px;
- box-sizing: border-box;
- }
- .dialog-layer-assets-number .new-add-plan{
- line-height: 24px;
- margin-left: 14px;
- border-radius: 3px;
- padding: 0 4px;
- font-size: 12px;
- color: #fff;
- background-color: #2977ff;
- cursor: pointer;
- border: none;
- outline: none;
- }
- body .input-layer-new-assets-number{
- width: 137px;
- border: none;
- outline: none;
- background: #fff !important;
-
- }
- .dialog-btn-box{
- margin-top: 20px;
- text-align: center;
- }
- .dialog-btn-box button{
- width: 60px;
- height: 24px;
- line-height: 24px;
- text-align: center;
- cursor: pointer;
- border: none;
- outline: none;
- }
- .dialog-btn-box .btn-dialog-colse{
- color: #2977ff;
- background-color: #fff;
- border: 1px solid #2977ff;
- box-sizing: border-box;
- }
- .dialog-btn-box .btn-dialog-save{
- margin-left: 20px;
- color: #fff;
- background-color: #2977ff;
- }
- .now-hidden{display: none}
- /*在谷歌下移除input[number]的上下箭头*/
- .new-assets-number-box input[type='number']::-webkit-outer-spin-button,
- .new-assets-number-box input[type='number']::-webkit-inner-spin-button{
- -webkit-appearance: none !important;
- margin: 0;
- }
- /*在firefox下移除input[number]的上下箭头*/
- .new-assets-number-box input[type="number"]{-moz-appearance:textfield;}
- .btn-go-img{
- position: relative;
- top: 40px;
- color:#478fca!important;
- cursor:pointer;
- }
- //示例图片样式
- .top-bar{
- overflow: hidden;
- }
- .top-bar .msg{
- color: red;
- font-size: 14px;
- line-height: 29px;
- }
- .top-bar button{
- float: right;
- padding: 4px 8px;
- font-size: 14px;
- color: #2977ff;
- border: 1px solid #2977ff;
- border-radius: 5px;
- background-color: #fff;
- cursor: pointer;
- outline: none;
- }
- .img-example{
- border: 1px solid #333;
- margin-top: 20px;
- margin-bottom: 20px;
- padding: 0 20px 20px 20px;
- }
- .img-example h2{
- font-size: 18px;
- line-height: 1.5em;
- }
- .table-img-example {
- width: 100%;
- border-left: 1px solid #ccc;
- border-top: 1px solid #ccc;
- box-sizing: border-box;
- border-collapse: collapse;
- }
- .table-img-example td {
- width: 25%;
- padding: 4px;
- border-right: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- box-sizing: border-box;
- }
- .table-img-example .img-box{
- text-align: center;
- /*width: 24%;*/
- }
- .table-img-example .img-box img{
- max-width: 100%;
- }
- .table-img-example .text-box{
- text-indent:2em!important;
- text-align: left;
- }
- .dialog-img-big{
- display: none;
- padding: 20px;
- }
- .dialog-img-big img{
- width: 100%;
- }
- .show-tr{
- color:#2977ff;
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <div class="body-sale">
- <h3 class="sale-title">库存盘点单</h3>
- <input type="hidden" name="itemName">
- <input type="hidden" name="itemSpec">
- <input type="hidden" name="itemCode">
- <input type="hidden" name="unitId">
- <div class="sale-table">
- <table width="100%">
- <tr>
- <th><em class="red">*</em>标题</th>
- <td colspan="3">
- <input type="text" style="width:50%;" name="stockTitle" value="<?php echo $title;?>" readonly="readonly">
- </td>
- </tr>
- <tr>
- <th><em class="red">*</em>盘点日期</th>
- <td colspan="3">
- <input id="stocktakingDate" type="text" name="stocktakingDate" style="width:50%;" readonly>
- </td>
- </tr>
- <tr>
- <th><em class="red">*</em>盘点凭证</th>
- <td colspan="3">
- <label class="add-img">
- <span>+</span>
- <input type="file" id="fileImg" accept="image/*" style="display: none;" />
- </label>
- <span> 请上传货品盘点的照片</span>
- <div id="imgPreview"></div>
- <!--<span class="fr btn-go-img" onclick="window.location.href='<?php // echo Yii::app()->createUrl('imsStore/planExamples')."?planId=".$planId; ?>'">查看示例图片</span>-->
- <span class="fr btn-go-img">查看示例图片</span>
- </td>
- </tr>
- <tr>
- <!-- more less same-->
- <td colspan="4" class="sale-num get-status">
- </td>
- </tr>
- <tr>
- <th>盘点说明</th>
- <td colspan="3">
- <textarea name="remark" id="remark" rows="6" cols="60"></textarea>
- </td>
- </tr>
- </table>
- </div>
- <?php if(isset($list) && $list):?>
- <?php foreach($list as $k=>$v):?>
- <?php if($k == 'finishList'):?>
- <?php if($v):?>
- <?php $tr_show = "";?>
- <?php $tr_hide = "";?>
- <h4 class="title">产成品</h4>
- <div class="product">
- <table class="table-product" border="1px">
- <tr>
- <th>品目名称</th>
- <th class="now-hidden">理论数量</th>
- <th>总库存盘点</th>
- <th>不合格品盘点</th>
- <th>单位</th>
- <th>总库存盘点情况</th>
- <th>不合格品盘点情况</th>
- </tr>
-
- <?php foreach($v as $kk=>$vv):?>
- <?php
- if($vv['invNo'] == 0){
- $profit = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['invNo'] > 0){
- $profit = '<span class="tag-table-product bg-red">亏</span>-'.$vv['invNo'];
- }elseif($vv['invNo'] < 0){
- $profit = '<span class="tag-table-product bg-green">盈</span>+'.$vv['invNo'];
- }
- ?>
- <?php
- if($vv['scrapOld'] == 0){
- $scrapOld = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['scrapOld'] > 0){
- $scrapOld = '<span class="tag-table-product bg-red">亏</span>-'.$vv['scrapOld'];
- }elseif($vv['scrapOld'] < 0){
- $scrapOld = '<span class="tag-table-product bg-green">盈</span>+'.$vv['scrapOld'];
- }
- ?>
- <?php
- if($vv['invNo'] > 0){
- $tr_show .= '<tr class="no-fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrapOld.'</td></tr>';
- }else{
- $tr_hide .= '<tr class="no-fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrapOld.'</td></tr>';
- }
- ?>
- <!--<tr class="no-fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['invNo'];?></td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')"><span class="add-count">+</span></span></td><td class="now-hidden"><?php echo $vv['scrapOld'];?></td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')"><span class="add-count">+</span></span></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td><td class="product-contrast"><?php echo $scrapOld;?></td></tr>-->
- <?php endforeach;?>
- <?php echo $tr_show;?>
- <?php if($tr_hide):?>
- <?php echo $tr_hide;?>
- <?php endif;?>
- </table>
- <?php if($tr_hide):?>
- <div class="show-tr fr">展示更多</div>
- <?php endif;?>
- </div>
- <?php endif;?>
- <?php elseif($k == 'fixedList'):?>
- <?php if($v):?>
- <?php $tr_show = "";?>
- <?php $tr_hide = "";?>
- <h4 class="title">固定资产</h4>
- <div class="assets">
- <table class="table-assets" border="1">
- <tr>
- <th>品目名称</th>
- <th class="now-hidden">理论数量</th>
- <th>总库存盘点</th>
- <th>单位</th>
- <th>盘点情况</th>
- </tr>
- <?php foreach($v as $kk=>$vv):?>
- <?php
- if($vv['invNo'] == 0){
- $profit = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['invNo'] > 0){
- $profit = '<span class="tag-table-product bg-red">亏</span>-'.$vv['invNo'];
- }elseif($vv['invNo'] < 0){
- $profit = '<span class="tag-table-product bg-green">盈</span>+'.$vv['invNo'];
- }
- ?>
- <?php
- if($vv['invNo'] > 0){
- $tr_show .= '<tr class="fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td class="blue choose-pro" planId="'.$vv['itemId'].'" selectIds="" originIds="'.$vv['originIds'].'">0</td><td>'.$vv['unitName'].'</td><td class="product-contrast"><?php echo $profit;?></td></tr>';
- }else{
- $tr_hide .= '<tr class="fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td class="blue choose-pro" planId="'.$vv['itemId'].'" selectIds="" originIds="'.$vv['originIds'].'">0</td><td>'.$vv['unitName'].'</td><td class="product-contrast"><?php echo $profit;?></td></tr>';
- }
- ?>
- <!--<tr class="fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['invNo'];?></td><td class="blue choose-pro" planId="<?php echo $vv['itemId'];?>" selectIds="" originIds="<?php echo $vv['originIds'];?>">0</td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td></tr>-->
- <?php endforeach;?>
- <?php echo $tr_show;?>
- <?php if($tr_hide):?>
- <?php echo $tr_hide;?>
- <?php endif;?>
- </table>
- <?php if($tr_hide):?>
- <div class="show-tr fr">展示更多</div>
- <?php endif;?>
- </div>
- <?php endif;?>
- <?php elseif($k == 'lowList'):?>
- <?php if($v):?>
- <?php $tr_show = "";?>
- <?php $tr_hide = "";?>
- <h4 class="title">低值易耗品</h4>
- <div class="product">
- <table class="table-product" border="1px">
- <tr>
- <th>品目名称</th>
- <th class="now-hidden">理论数量</th>
- <th>总库存盘点</th>
- <th>不合格品盘点</th>
- <th>单位</th>
- <th>总库存盘点情况</th>
- <th>不合格品盘点情况</th>
- </tr>
- <?php foreach($v as $kk=>$vv):?>
- <?php
- if($vv['invNo'] == 0){
- $profit = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['invNo'] > 0){
- $profit = '<span class="tag-table-product bg-red">亏</span>-'.$vv['invNo'];
- }elseif($vv['invNo'] < 0){
- $profit = '<span class="tag-table-product bg-green">盈</span>+'.$vv['invNo'];
- }
- ?>
- <?php
- if($vv['scrapOld'] == 0){
- $scrapOld = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['scrapOld'] > 0){
- $scrapOld = '<span class="tag-table-product bg-red">亏</span>-'.$vv['scrapOld'];
- }elseif($vv['scrapOld'] < 0){
- $scrapOld = '<span class="tag-table-product bg-green">盈</span>+'.$vv['scrapOld'];
- }
- ?>
- <?php
- if($vv['invNo'] > 0){
- $tr_show .= '<tr class="no-fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrapOld.'</td></tr>';
- }else{
- $tr_hide .= '<tr class="no-fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrapOld.'</td></tr>';
- }
- ?>
- <!--<tr class="no-fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['invNo'];?></td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')"><span class="add-count">+</span></span></td><td class="now-hidden"><?php echo $vv['scrapOld'];?></td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')"><span class="add-count">+</span></span></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td><td class="product-contrast"><?php echo $scrapOld;?></td></tr>-->
- <?php endforeach;?>
- <?php echo $tr_show;?>
- <?php if($tr_hide):?>
- <?php echo $tr_hide;?>
- <?php endif;?>
- </table>
- <?php if($tr_hide):?>
- <div class="show-tr fr">展示更多</div>
- <?php endif;?>
- </div>
- <?php endif;?>
- <?php elseif($k == 'rawList'):?>
- <?php if($v):?>
- <?php $tr_show = "";?>
- <?php $tr_hide = "";?>
- <h4 class="title">原材料</h4>
- <div class="product">
- <table class="table-product" border="1px">
- <tr>
- <th>品目名称</th>
- <th class="now-hidden">理论数量</th>
- <th>总库存盘点</th>
- <th>不合格品盘点</th>
- <th>单位</th>
- <th>总库存盘点情况</th>
- <th>不合格品盘点情况</th>
- </tr>
- <?php foreach($v as $kk=>$vv):?>
- <?php
- if($vv['invNo'] == 0){
- $profit = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['invNo'] > 0){
- $profit = '<span class="tag-table-product bg-red">亏</span>-'.$vv['invNo'];
- }elseif($vv['invNo'] < 0){
- $profit = '<span class="tag-table-product bg-green">盈</span>+'.$vv['invNo'];
- }
- ?>
- <?php
- if($vv['scrapOld'] == 0){
- $scrapOld = '<span class="tag-table-product bg-yellow">平</span>';
- }elseif($vv['scrapOld'] > 0){
- $scrapOld = '<span class="tag-table-product bg-red">亏</span>-'.$vv['scrapOld'];
- }elseif($vv['scrapOld'] < 0){
- $scrapOld = '<span class="tag-table-product bg-green">盈</span>+'.$vv['scrapOld'];
- }
- ?>
- <?php
- if($vv['invNo'] > 0){
- $tr_show .= '<tr class="no-fixed" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrapOld.'</td></tr>';
- }else{
- $tr_hide .= '<tr class="no-fixed hide need-hide" itemId="'.$vv['itemId'].'"><td>'.$vv['itemName'].'</td><td class="now-hidden">'.$vv['invNo'].'</td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td class="now-hidden">'.$vv['scrapOld'].'</td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,\'\')"><span class="add-count">+</span></span></td><td>'.$vv['unitName'].'</td><td class="product-contrast">'.$profit.'</td><td class="product-contrast">'.$scrapOld.'</td></tr>';
- }
- ?>
- <!--<tr class="no-fixed" itemId="<?php echo $vv['itemId']?>"><td><?php echo $vv['itemName'];?></td><td class="now-hidden"><?php echo $vv['invNo'];?></td><td><span class="plan-count-wrap-po inv-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')"><span class="add-count">+</span></span></td><td class="now-hidden"><?php echo $vv['scrapOld'];?></td><td><span class="plan-count-wrap-po scrap-count"><span class="reduce-count">-</span><input type="text" value="0" name="plan-count" class="plan-count" oninput="value=value.replace(/[^\d]/g,'')"><span class="add-count">+</span></span></td><td><?php echo $vv['unitName'];?></td><td class="product-contrast"><?php echo $profit;?></td><td class="product-contrast"><?php echo $scrapOld;?></td></tr>-->
- <?php endforeach;?>
- <?php echo $tr_show;?>
- <?php if($tr_hide):?>
- <?php echo $tr_hide;?>
- <?php endif;?>
- </table>
- <?php if($tr_hide):?>
- <div class="show-tr fr">展示更多</div>
- <?php endif;?>
- </div>
- <?php endif;?>
- <?php endif;?>
- <?php endforeach;?>
- <?php endif;?>
- <div class="sale-submit" style="margin-top: 25px;">
- <button type="button" class="" onclick="javascript:history.back(-1);">返回</button>
- <button type="button" class=" label-primary-s bth-s" id="savebutton">提交</button>
- </div>
- <div class="dialog-layer-assets-number">
- <div class='pan-title'>盘点数量(<span class='pan-count'>0</span>)</div>
- <div class='assets-number-list-parent'></div>
- <div class='new-assets-number-box'>
- <input type='checkbox' name='need-plan' value=''><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号'>
- <button type='button' class='new-add-plan'>新盘点编号</button>
- </div>
- <div class='dialog-btn-box'>
- <button type="button" class="back-plan btn-dialog-colse">返回</button>
- <button type="button" class="btn-dialog-save" id="add-plan-identifier">提交</button>
- </div>
- </div>
- </div>
- <div class="pic-sale" style="display:none">
- <div class="top-bar">
- <span class="msg">上传的图片,用于新建盘点单时作图片参考</span>
- <!--<button type="button" onclick="window.location.href='<?php // echo Yii::app()->createUrl('imsStore/createPlanList')."?planId=".$planId; ?>'">返回</button>-->
- <button type="button">返回</button>
- </div>
- <?php if(isset($result) && $result):?>
- <div class="img-example">
- <h2>固定资产</h2>
- <?php if(isset($result['fixedList']) && $result['fixedList']):?>
- <table class="table-img-example">
- <?php foreach($result['fixedList'] as $k=>$v):?>
- <?php if($k%2 == 0):?>
- <tr>
- <td class="img-box">
- <img src="<?php echo isset($v["imgUrl"])?$v["imgUrl"]:"";?>" alt="">
- </td>
- <td class="text-box">
- <?php echo isset($v["description"])?$v["description"]:"";?>
- </td>
- <?php if(!isset($result['fixedList'][$k+1])):?>
- <td class="img-box"></td>
- <td class="text-box"></td>
- </tr>
- <?php endif;?>
- <?php else:?>
- <td class="img-box">
- <img src="<?php echo isset($v["imgUrl"])?$v["imgUrl"]:"";?>" alt="">
- </td>
- <td class="text-box">
- <?php echo isset($v["description"])?$v["description"]:"";?>
- </td>
- </tr>
- <?php endif;?>
- <?php endforeach;?>
- </table>
- <?php endif;?>
- </div>
- <div class="img-example">
- <h2>产成品</h2>
- <?php if(isset($result['finishList']) && $result['finishList']):?>
- <table class="table-img-example">
- <?php foreach($result['finishList'] as $k=>$v):?>
- <?php if($k%2 == 0):?>
- <tr>
- <td class="img-box">
- <img src="<?php echo isset($v["imgUrl"])?$v["imgUrl"]:"";?>" alt="">
- </td>
- <td class="text-box">
- <?php echo isset($v["description"])?$v["description"]:"";?>
- </td>
- <?php if(!isset($result['finishList'][$k+1])):?>
- <td class="img-box"></td>
- <td class="text-box"></td>
- </tr>
- <?php endif;?>
- <?php else:?>
- <td class="img-box">
- <img src="<?php echo isset($v["imgUrl"])?$v["imgUrl"]:"";?>" alt="">
- </td>
- <td class="text-box">
- <?php echo isset($v["description"])?$v["description"]:"";?>
- </td>
- </tr>
- <?php endif;?>
- <?php endforeach;?>
- </table>
- <?php endif;?>
- </div>
- <div class="img-example">
- <h2>低值易耗品</h2>
- <?php if(isset($result['lowList']) && $result['lowList']):?>
- <table class="table-img-example">
- <?php foreach($result['lowList'] as $k=>$v):?>
- <?php if($k%2 == 0):?>
- <tr>
- <td class="img-box">
- <img src="<?php echo isset($v["imgUrl"])?$v["imgUrl"]:"";?>" alt="">
- </td>
- <td class="text-box">
- <?php echo isset($v["description"])?$v["description"]:"";?>
- </td>
- <?php if(!isset($result['lowList'][$k+1])):?>
- <td class="img-box"></td>
- <td class="text-box"></td>
- </tr>
- <?php endif;?>
- <?php else:?>
- <td class="img-box">
- <img src="<?php echo isset($v["imgUrl"])?$v["imgUrl"]:"";?>" alt="">
- </td>
- <td class="text-box">
- <?php echo isset($v["description"])?$v["description"]:"";?>
- </td>
- </tr>
- <?php endif;?>
- <?php endforeach;?>
- </table>
- <?php endif;?>
- <!-- 图片放大弹窗 -->
- <div class="dialog-img-big">
- <img src="" alt="" id="imgBig">
- </div>
- </div>
-
-
- <?php endif;?>
- </div>
- <script src="/js/jquery-2.2.2.min.js" ></script>
- <script src="/js/jquery.datetimepicker.js"></script>
- <script src="/js/layer/layer.js"></script>
- <script src="/js/xsgl.js"></script>
- <?php // include_once '_stock.php'?>
- <script>
- $('body').delegate('.choose-pro','click', function(){
- var planId = $(this).attr("planId");
- var originIds = $(this).attr("originIds");
- var selectIds = $(this).attr("selectIds");
- if(selectIds){
- var selectIdsArr = selectIds.split(",");
- }else{
- var selectIdsArr = [];
- }
-
- // if(planId){
- // $.ajax({
- // url: "<?php // echo Yii::app()->createUrl('imsStore/ajaxGetIdentifier')?>",
- // type: "post",
- // data: {'planId':planId},
- // dataType: 'json',
- // success: function (res) {
- // console.log(res);
- var html = "";
- // html += "<div class='pan-title'>盘点数量(<span class='pan-count'>0</span>)</div>";
- if(originIds){
- originIdsArr = originIds.split(",");
- html += "<div class='assets-number-list'>";
- for(var a = 0;a<originIdsArr.length;a++){
- if($.inArray(originIdsArr[a],selectIdsArr) > -1){
- html += "<label><input type='checkbox' name='need-plan' value='' checked='checked'><input type='text' value='"+originIdsArr[a]+"' name='need-plan-name' class='input-layer-new-assets-number' readonly='readonly'></label>";
- }else{
- html += "<label><input type='checkbox' name='need-plan' value=''><input type='text' value='"+originIdsArr[a]+"' name='need-plan-name' class='input-layer-new-assets-number' readonly='readonly'></label>";
- }
-
- }
- html += "</div>";
- }
- // html += "<div class='new-assets-number-box'>";
- // html += " <input type='checkbox' name='need-plan' value=''><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号'>";
- // html += " <button type='button' class='new-add-plan'>新盘点编号</button>";
- // html += "</div>";
- // html += "<div class='dialog-btn-box'>";
- // html += ' <button type="button" class="back-plan btn-dialog-colse">返回</button>';
- // html +=' <button type="button" class="btn-dialog-save" id="add-plan-identifier" planId='+planId+'>提交</button>';
- // html += "</div>";
- $('.assets-number-list-parent').html(html);
- $('#add-plan-identifier').attr("planId",planId);
- var length = $('.dialog-layer-assets-number input:checked').length;
- $('.pan-count').html(length);
- layer.open({
- title: false,
- closeBtn: 0,
- type: 1,
- area: ['360px', '200px'],
- content: $(".dialog-layer-assets-number")
- });
-
- // }
- // })
- // }
-
- });
- $('body').delegate('.dialog-layer-assets-number input[type="checkbox"]','click', function(){
- var length = $('.dialog-layer-assets-number input:checked').length;
- $('.pan-count').html(length);
- });
- $('body').delegate('.btn-dialog-colse','click', function(){
- layer.close(layer.index);
- });
- $('body').delegate('.new-add-plan','click', function(){
- var html = "<div class='new-assets-number-box'><input type='checkbox' name='need-plan' value=''><input type='text' value='' name='need-plan-name' class='input-new-assets-number' placeholder='输入新编号'></div>";
- $(this).parent().after(html);
- });
- $('body').delegate('#add-plan-identifier','click', function(){
- var selectIdentifierIds = [];
- var originIdentifierIds = [];
- var planId = $(this).attr("planId");
- $('input[name="need-plan"]:checked').each(function(){
- if($(this).next().val()){
- selectIdentifierIds.push($(this).next().val());
- }
- });
- $('.assets-number-list input[name="need-plan-name"]').each(function(){
- originIdentifierIds.push($(this).val());
- })
- // if(selectIdentifierIds.length>0){
- $('.choose-pro[planId='+planId+']').html(selectIdentifierIds.length);
- // }
- $('.choose-pro[planId='+planId+']').attr("selectIds",selectIdentifierIds.join(","));
- $('.choose-pro[planId='+planId+']').attr("originIds",originIdentifierIds.join(","));
- layer.close(layer.index);
-
- console.log(selectIdentifierIds);
- })
- $('body').delegate('.add-count','click', function(){
- var count = parseInt($(this).prev().val());
- count += 1;
- $(this).prev().val(count);
- if($(this).parent().hasClass("inv-count")){
- var type = 6;
- }else{
- var type = 7;
- }
- var oldCount = parseInt($(this).parent().parent().prev().text());
- if(oldCount == count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-yellow">平</span>');
- }else if(oldCount > count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-red">亏</span>-'+(oldCount-count));
- }else if(oldCount < count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-green">盈</span>+'+(count-oldCount));
- }
- });
- $('body').delegate('.reduce-count','click', function(){
- var count = parseInt($(this).next().val());
- if($(this).parent().hasClass("inv-count")){
- var type = 6;
- }else{
- var type = 7;
- }
- if(count >= 1){
- count -= 1;
- $(this).next().val(count);
- var oldCount = parseInt($(this).parent().parent().prev().text());
- if(oldCount == count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-yellow">平</span>');
- }else if(oldCount > count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-red">亏</span>-'+(oldCount-count));
- }else if(oldCount < count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-green">盈</span>+'+(count-oldCount));
- }
-
- }
-
- });
- $('.plan-count').on('input propertychange', function() {
- var count = parseInt($(this).val());
- var oldCount = parseInt($(this).parent().parent().prev().text());
- if($(this).parent().hasClass("inv-count")){
- var type = 6;
- }else{
- var type = 7;
- }
- if(oldCount == count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-yellow">平</span>');
- }else if(oldCount > count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-red">亏</span>-'+(oldCount-count));
- }else if(oldCount < count){
- $(this).parent().parent().parent().find("td:eq("+type+")").html('<span class="tag-table-product bg-green">盈</span>+'+(count-oldCount));
- }
- });
- $('#stocktakingDate').datetimepicker({
- format: "Y-m-d", //格式化日期
- timepicker: false //关闭时间选项
- });
- //添加图片
- $("#fileImg").on("change", function () {
- //限制图片数量
- var imgObj = $('#imgPreview img');
- if(imgObj.length>=10){
- layer.msg("最多可上传10张图片");
- return false;
- }
- var formData = new FormData();
- formData.append('uploadFile', document.getElementById('fileImg').files[0]);
- if(document.getElementById('fileImg').files[0]==undefined){
- return false;
- }
- var basic = "<?php echo $basic;?>";
- $.ajax({
- url: "<?php echo $uploadUrl;?>",
- type: "post",
- data: formData,
- processData: false,
- contentType: false,
- beforeSend: function (req) {
- req.setRequestHeader("Authorization", basic);
- },
- success: function (data) {
- console.log(data);
- if (data.errCode == '00') {
- var html = "<img src='" + data.data.url + "'>";
- $('#imgPreview').append(html);
- $('#uploadImg').val('');
- } else {
- layer.msg(data.errMsg);
- }
- },
- error:function(data){
- console.log(data);
- }
- });
- });
- $("body").on("click", "#imgPreview img", function () {
- var obj = $(this);
- var imgUrl = $(this).attr('src');
- layer.confirm('您确定删除此图片吗?', {
- btn: ['确定', '取消'] //按钮
- }, function () {
- obj.remove();
- layer.closeAll();
- });
- });
- var flag = true;
- //提交
- $("#savebutton").click(function () {
- if (flag){
- flag = false;
- var stockTitle = $.trim($("input[name='stockTitle']").val());
- var stocktakingDate = $("input[name='stocktakingDate']").val();
- var remark = $('#remark').val();
- var details = [];
- var isZero = 0;
- var no = 0;
- if (stockTitle == '') {
- layer.msg('标题名称不能为空!');
- flag = true;
- return false;
- } else if (stockTitle.length > 49) {
- showMsg('标题名称不能超过50个字符!');
- flag = true;
- return false;
- }
- if (!stocktakingDate) {
- layer.msg('时间不能为空!');
- flag = true;
- return false;
- }
- var imgArr = [];
- $('#imgPreview img').each(function () {
- imgArr.push($(this).attr('src'));
- });
- if (imgArr.length < 1) {
- layer.msg('请上传图片!');
- flag = true;
- return false;
- }
- //其他
- $('.no-fixed').each(function(){
- var temp={};
- //details[no] = {};
- temp.fixedCodes = [];
- temp.invFixedCodes = [];
- temp.itemId = $(this).attr("itemId");
- temp.stockNo = parseFloat($(this).find("td:eq(2)").find("input").val());
- temp.theoreticalNo = parseFloat($(this).find("td:eq(1)").text());
- temp.lossNo = accSub(parseFloat($(this).find("td:eq(2)").find("input").val()),parseFloat($(this).find("td:eq(1)").text()));
- temp.scrapOld = parseFloat($(this).find("td:eq(3)").text());
- temp.scrapNo = parseFloat($(this).find("td:eq(4)").find("input").val());
- temp.scrapLoss = accSub(parseFloat($(this).find("td:eq(4)").find("input").val()),parseFloat($(this).find("td:eq(3)").text()));
- if(temp.lossNo == 0){
- temp.lossType = 2;
- }else if(temp.lossNo > 0){
- temp.lossType = 1;
- }else if(temp.lossNo < 0){
- temp.lossType = 0;
- }
- if(temp.stockNo!=0 || temp.theoreticalNo!=0 || temp.scrapOld!=0 || temp.scrapNo!=0){
- details[no]=temp;
- if(details[no].stockNo == 0){
- isZero = 1;
- }
- no++;
- }
- });
- $('.fixed').each(function(){
- var temp={};
- // details[no] = {};
- if($(this).find("td:eq(2)").attr("selectIds")){
- temp.fixedCodes = $(this).find("td:eq(2)").attr("selectIds").split(",");
- }else{
- temp.fixedCodes = [];
- }
- if($(this).find("td:eq(2)").attr("originIds")){
- temp.invFixedCodes = $(this).find("td:eq(2)").attr("originIds").split(",");
- }else{
- temp.invFixedCodes = [];
- }
- temp.itemId = $(this).attr("itemId");
- temp.stockNo = parseFloat($(this).find("td:eq(2)").text());
- temp.theoreticalNo = $(this).find("td:eq(1)").text();
- temp.lossNo = parseFloat(($(this).find("td:eq(2)").text()),$(this).find("td:eq(1)").text());
- if(temp.lossNo == 0){
- temp.lossType = 2;
- }else if(temp.lossNo > 0){
- temp.lossType = 1;
- }else if(temp.lossNo < 0){
- temp.lossType = 0;
- }
- if(temp.stockNo!=0 || temp.theoreticalNo!=0 ){
- details[no]=temp;
- if(details[no].stockNo == 0){
- isZero = 1;
- }
- no++;
- }
- });
- //固定资产
- // var fixedCodesArr = [];
- // var inFixedCodesArr = [];
- // if (itemType.val()==0){
- // var fixedObj = $('input[name="fixedCodes"]:checked');
- // fixedObj.each(function () {
- // fixedCodesArr.push($(this).val());
- // });
- // var infixedObj = $('input[name="fixedCodes"]');
- // infixedObj.each(function () {
- // inFixedCodesArr.push($(this).val());
- // });
- // }
- if(details.length==0){
- layer.msg('盘点品目不能为空!');
- flag = true;
- return false;
- }
- var data = {
- stockTitle: stockTitle,
- stocktakingDate: stocktakingDate,
- imgArr: imgArr,
- remark:remark,
- details:details,
- pId:'<?php echo $_GET['planId']?>'
- };
- console.log(data);
- if(isZero == 1){
- layer.confirm('盘点数量有0值项,确定提交吗?', {
- btn: ['提交', '返回'] //按钮
- }, function () {
- alertIndex=layer.msg('正在提交,请稍候。。。。。。');
- $.ajax({
- type: 'POST',
- url: "<?php echo $this->createUrl('imsStore/ajaxNewStockAdd');?>",
- data: data,
- async: false,
- dataType: 'json',
- success: function (result) {
- layer.close(alertIndex);
- if (result.status == 1) {
- layer.alert(result.msg, {icon: 1,closeBtn:0}, function () {
- window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
- })
- } else {
- flag = true;
- layer.alert(result.msg,{icon:2});
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- /*错误信息处理*/
- flag = true;
- layer.msg('提交失败');
- }
- });
- },function(){
- layer.closeAll();
- });
- }else{
- layer.confirm('确认提交盘点单吗?', {
- btn: ['提交', '返回'] //按钮
- }, function () {
- alertIndex=layer.msg('正在提交,请稍候。。。。。。');
- $.ajax({
- type: 'POST',
- url: "<?php echo $this->createUrl('imsStore/ajaxNewStockAdd');?>",
- data: data,
- async: false,
- dataType: 'json',
- success: function (result) {
- layer.close(alertIndex);
- if (result.status == 1) {
- layer.alert(result.msg, {icon: 1,closeBtn:0}, function () {
- window.location.href = "<?php echo $this->createUrl('imsStore/newStock');?>";
- })
- } else {
- flag = true;
- layer.alert(result.msg,{icon:2});
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- /*错误信息处理*/
- flag = true;
- layer.msg('提交失败');
- }
- });
- },function(){
- layer.closeAll();
- });
- }
-
- } else {
- layer.msg("稍安勿躁,正在处理中...");
- }
- });
- //查看示例图片
- $('body').delegate('.btn-go-img','click', function(){
- $(".pic-sale").show();
- $(".body-sale").hide();
- });
- //查看示例图片返回
- $('body').delegate('.top-bar button','click', function(){
- $(".pic-sale").hide();
- $(".body-sale").show();
- });
- //放大图片
- $(".img-example").on("click",".img-box img", function(){
- var imgUrl = $(this).attr('src');
- $('#imgBig').attr('src',imgUrl);
- layer.open({
- title: false,
- closeBtn: 1,
- type: 1,
- area: ['800px', '600px'],
- offset: '100px',
- content: $(".dialog-img-big")
- });
- });
- //展示更多或收起
- $("body").on("click",".show-tr", function(){
- if($(this).hasClass("hide-tr")){
- $(this).prev().find("tr.need-hide").addClass("hide");
- $(this).html("展开更多");
- $(this).removeClass("hide-tr");
- }else{
- $(this).html("收起");
- $(this).addClass("hide-tr");
- $(this).prev().find("tr.need-hide").removeClass("hide");
- }
-
- });
- var accSub = function(num1, num2) {
- num1 = Number(num1);
- num2 = Number(num2);
- var dec1, dec2, times;
- try { dec1 = countDecimals(num1)+1; } catch (e) { dec1 = 0; }
- try { dec2 = countDecimals(num2)+1; } catch (e) { dec2 = 0; }
- times = Math.pow(10, Math.max(dec1, dec2));
- // var result = Number(((num1 * times - num2 * times) / times);
- var result = Number((accMul(num1, times) - accMul(num2, times)) / times);
- return getCorrectResult("sub", num1, num2, result);
- // return result;
- };
- function accMul(arg1,arg2)
- {
- var m=0,s1=arg1.toString(),s2=arg2.toString();
- try{m+=s1.split(".")[1].length}catch(e){}
- try{m+=s2.split(".")[1].length}catch(e){}
- return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
- }
- var countDecimals = function(num) {
- var len = 0;
- try {
- num = Number(num);
- var str = num.toString().toUpperCase();
- if (str.split('E').length === 2) { // scientific notation
- var isDecimal = false;
- if (str.split('.').length === 2) {
- str = str.split('.')[1];
- if (parseInt(str.split('E')[0]) !== 0) {
- isDecimal = true;
- }
- }
- let x = str.split('E');
- if (isDecimal) {
- len = x[0].length;
- }
- len -= parseInt(x[1]);
- } else if (str.split('.').length === 2) { // decimal
- if (parseInt(str.split('.')[1]) !== 0) {
- len = str.split('.')[1].length;
- }
- }
- } catch(e) {
- throw e;
- } finally {
- if (isNaN(len) || len < 0) {
- len = 0;
- }
- return len;
- }
- };
- var convertToInt = function(num) {
- num = Number(num);
- var newNum = num;
- var times = countDecimals(num);
- var temp_num = num.toString().toUpperCase();
- if (temp_num.split('E').length === 2) {
- newNum = Math.round(num * Math.pow(10, times));
- } else {
- newNum = Number(temp_num.replace(".", ""));
- }
- return newNum;
- };
- var getCorrectResult = function(type, num1, num2, result) {
- var temp_result = 0;
- switch (type) {
- case "add":
- temp_result = num1 + num2;
- break;
- case "sub":
- temp_result = num1 - num2;
- break;
- case "div":
- temp_result = num1 / num2;
- break;
- case "mul":
- temp_result = num1 * num2;
- break;
- }
- if (Math.abs(result - temp_result) > 1) {
- return temp_result;
- }
- return result;
- };
- </script>
- </body>
- </html>
|