allocationView.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>查看物流</title>
  7. <meta name="description" content="">
  8. <meta name="keywords" content="">
  9. <link href="css/base.css" rel="stylesheet">
  10. <link href="/css/ims/ims.css" rel="stylesheet">
  11. <style>
  12. .red {
  13. color: red;
  14. }
  15. .add-receipt_img span {
  16. display: inline-block;
  17. width: 56px;
  18. line-height: 24px;
  19. color: #000;
  20. text-align: center;
  21. font-weight: normal;
  22. font-size: 14px;
  23. border: 1px solid #ccc;
  24. cursor: pointer;
  25. }
  26. .layer-receipt {
  27. display: none;
  28. padding-left: 30px;
  29. padding-right: 30px;
  30. }
  31. .layer-receipt>div {
  32. margin-top: 12px;
  33. padding-bottom: 12px;
  34. border-bottom: 3px solid rgba(121, 121, 121, 1);
  35. }
  36. .layer-receipt>div>p {
  37. margin-top: 12px;
  38. }
  39. .layer-receipt .number {
  40. margin-right: 30px;
  41. }
  42. .inputNum {
  43. margin: 0 4px;
  44. }
  45. .accountNum {
  46. margin-top: 12px;
  47. font-size: 16px;
  48. font-weight: 600;
  49. color: #000;
  50. }
  51. #imgPreview {
  52. display: inline-block;
  53. margin-top: 12px;
  54. }
  55. #imgPreview>img {
  56. max-width: 100px;
  57. max-height: 100px;
  58. margin-right: 5px;
  59. }
  60. #imgPreview_view {
  61. display: inline-block;
  62. margin-top: 12px;
  63. }
  64. #imgPreview_view>img {
  65. max-width: 100px;
  66. max-height: 100px;
  67. margin-right: 5px;
  68. }
  69. .receiptVoucherText{
  70. text-align: center;
  71. }
  72. .receiptVoucherText>p{
  73. line-height: 50px;
  74. }
  75. .more-show{
  76. width: 300px;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;cursor: pointer;
  77. }
  78. .layui-layer-btn .layui-layer-btn0 {
  79. border-color: #2977ff !important;
  80. background-color: #2977ff !important;
  81. color: #fff;
  82. }
  83. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  84. line-height: 140px;
  85. text-align: center;
  86. }
  87. .goods-status{
  88. position:relative;
  89. display:inline-block;
  90. }
  91. .goods-status span{
  92. padding-left:30px;
  93. position:absolute;
  94. left:50%;
  95. -webkit-transform:translateX(-50%);
  96. transform:translateX(-50%);
  97. top:50%;
  98. color:red;
  99. background:url(/images/warn-icon.png) no-repeat left center;
  100. background-size:30px;
  101. }
  102. </style>
  103. </head>
  104. <body>
  105. <div class="goods-status">
  106. <img src="/images/ims/goods-status.png" alt="">
  107. <?php if(isset($receiveData) && !$receiveData):?>
  108. <?php if(isset($logisticsTime) && $logisticsTime):?>
  109. <span>距离发货日期超过<?php echo $logisticsTime;?>天</span>
  110. <?php endif;?>
  111. <?php endif;?>
  112. </div>
  113. <p id="viewLog" style="width: 100%;text-align: right;padding-right:30px;color:#619aff;cursor:pointer;">查看日志</p>
  114. <?php foreach($sendData as $value):?>
  115. <div class="clearfix goods-info">
  116. <div class="fl send-goods">
  117. <ul>
  118. <li><?php echo isset($value['logisticsTime'])?$value['logisticsTime']:'';?>&nbsp;&nbsp;<?php echo $value['userName'];?>&nbsp;&nbsp;确认发货</li>
  119. <li>货物品目:<?php echo $value['itemName'];?></li>
  120. <li>规格:<?php echo $value['itemSpec'];?></li>
  121. <li>数量:<?php echo $value['no'];?></li>
  122. <li>单位:<?php echo $value['unitName'];?></li>
  123. <?php if (isset($value['storageUnit']) && isset($value['storageUnitName'])) :?>
  124. <li>存储单位:<?php echo $value['storageUnitName'];?></li>
  125. <li>存储数量:<?php echo $value['countUnit']*$value['no'];?></li>
  126. <?php endif;?>
  127. <?php if (isset($value['fixedCodes']) && $value['fixedCodes']) :?>
  128. <li title="<?php echo implode(',',$value['fixedCodes']);?>" class="more-show">固定资产编号:<?php echo implode(',',$value['fixedCodes']);?></li>
  129. <?php endif;?>
  130. <li>物流公司:<?php echo isset($value['logisticsName'])?$value['logisticsName']:'';?></li>
  131. <li>物流单号:<?php echo isset($value['logisticsCode'])?$value['logisticsCode']:'';?></li>
  132. </ul>
  133. </div>
  134. <div class="fl deliver-goods">
  135. <?php if(isset($receiveData[$value['atoId']]) && $receiveData[$value['atoId']]):?>
  136. <?php $receive = $receiveData[$value['atoId']];?>
  137. <ul atoId="<?php echo $value['atoId'];?>">
  138. <li><?php echo $receive['logisticsTime'];?>&nbsp;&nbsp;<?php echo $receive['userName'];?>&nbsp;&nbsp;
  139. <?php if(isset($receive['images']) && isset($receive['images'][0]) && $receive['images'][0]):?>
  140. 确认收货
  141. <?php else:?>
  142. 自动收货
  143. <?php endif;?>
  144. </li>
  145. <li>货物品目:<?php echo $receive['itemName'];?></li>
  146. <li>规格:<?php echo $receive['itemSpec'];?></li>
  147. <li class="arrive-num" arriveNo="<?php echo $receive['arriveNo'];?>">到货数量:<?php echo $receive['arriveNo'];?></li>
  148. <li class="qualified-num" qualifiedNo="<?php echo $receive['qualifiedNo'];?>">合格数量:<?php echo $receive['qualifiedNo'];?></li>
  149. <li class="tally-num" tallyNum="<?php echo $receive['tallyNo'];?>">记账数量:<?php echo $receive['tallyNo'];?></li>
  150. <li class="scrap-num" scrapNum="<?php echo $receive['scrapNo'];?>">报废数量:<?php echo $receive['scrapNo'];?></li>
  151. <?php if (isset($receive['fixedCodes']) && $receive['fixedCodes']) :?>
  152. <li title="<?php echo implode(',',$value['fixedCodes']);?>" class="more-show">固定资产编号:<?php echo implode(',',$receive['fixedCodes']);?></li>
  153. <?php endif;?>
  154. <?php if(isset($receive['images']) && $receive['images']):?>
  155. <li>收货凭证:
  156. <p id="receiveImg">
  157. <?php foreach($receive['images'] as $url):?>
  158. <img style="width: 150px;height: 100px;cursor: pointer" src="<?php echo $url;?>" alt="">
  159. <?php endforeach;?>
  160. </p>
  161. </li>
  162. <?php else:?>
  163. <li>收货凭证:无收货凭证</li>
  164. <?php endif;?>
  165. </ul>
  166. <?php else:?>
  167. <?php
  168. if($value['recVoucher']==1){
  169. if(isset($value['processInfoBO']['showUrge']) && $value['processInfoBO']['showUrge']){
  170. ?>
  171. <a href="javascript:;"
  172. businessKey="<?php echo $value['processInfoBO']['businessKey']?>"
  173. class="confim-goods suspended">取消凭据</a>
  174. <a href="javascript:;"
  175. atoId="<?php echo $value['atoId']?>"
  176. itemName="<?php echo $value['itemName']?>"
  177. allNum="<?php echo $value['no']?>"
  178. <?php if (isset($value['fixedCodes']) && $value['fixedCodes']) :?>
  179. has-fixedCode="<?php echo implode(',',$value['fixedCodes']);?>"
  180. <?php else:?>
  181. has-fixedCode=""
  182. <?php endif;?>
  183. <?php if (isset($value['images']) && $value['images']) :?>
  184. imgList="<?php echo implode(',',$value['images']);?>"
  185. <?php else:?>
  186. imgList=""
  187. <?php endif;?>
  188. class="confim-goods view-data">查看凭据</a>
  189. <?php
  190. }elseif(isset($value['processInfoBO']['showReset']) && $value['processInfoBO']['showReset']==1 ){
  191. ?>
  192. <a href="javascript:;"
  193. atoId="<?php echo $value['atoId']?>"
  194. itemId="<?php echo $value['itemId']?>"
  195. allNum="<?php echo $value['no']?>"
  196. <?php if (isset($value['fixedCodes']) && $value['fixedCodes']) :?>
  197. has-fixedCode="<?php echo implode(',',$value['fixedCodes']);?>"
  198. <?php else:?>
  199. has-fixedCode=""
  200. <?php endif;?>
  201. <?php if (isset($value['images']) && $value['images']) :?>
  202. imgList="<?php echo implode(',',$value['images']);?>"
  203. <?php else:?>
  204. imgList=""
  205. <?php endif;?>
  206. class="confim-goods repeat_submit">重新提交凭据</a>
  207. <a href="javascript:;"
  208. atoId="<?php echo $value['atoId']?>"
  209. itemName="<?php echo $value['itemName']?>"
  210. allNum="<?php echo $value['no']?>"
  211. <?php if (isset($value['fixedCodes']) && $value['fixedCodes']) :?>
  212. has-fixedCode="<?php echo implode(',',$value['fixedCodes']);?>"
  213. <?php else:?>
  214. has-fixedCode=""
  215. <?php endif;?>
  216. <?php if (isset($value['images']) && $value['images']) :?>
  217. imgList="<?php echo implode(',',$value['images']);?>"
  218. <?php else:?>
  219. imgList=""
  220. <?php endif;?>
  221. class="confim-goods view-data">查看凭据</a>
  222. <?php
  223. }
  224. }elseif(isset($_GET['showReceive'])){
  225. ?>
  226. <a href="javascript:;"
  227. atoId="<?php echo $value['atoId']?>"
  228. itemId="<?php echo $value['itemId']?>"
  229. allNum="<?php echo $value['no']?>"
  230. <?php if (isset($value['fixedCodes']) && $value['fixedCodes']) :?>
  231. has-fixedCode="<?php echo implode(',',$value['fixedCodes']);?>"
  232. <?php else:?>
  233. has-fixedCode=""
  234. <?php endif;?>
  235. class="confim-goods receipt">确认收货</a>
  236. <?php
  237. }
  238. endif;?>
  239. </div>
  240. </div>
  241. <?php endforeach;?>
  242. </div>
  243. <!-- 确认收货弹窗 -->
  244. <div class="layer-receipt edit-form">
  245. <div>
  246. <span class="number">
  247. 到货数量<span class="layer-tally-num"></span>册
  248. </span>
  249. <span>
  250. 合格数量<input type="number" class="inputNum" name="hege_num">册
  251. </span>
  252. </div>
  253. <div class="fixedCodes">
  254. </div>
  255. <div>
  256. <p>不合格数量:<span class="layer-scrap-num">0</span></spn>册</p>
  257. <p>收货凭证:
  258. <label class="add-receipt_img">
  259. <span>浏览</span>
  260. <input type="file" id="uploadImg" accept="image/*" style="display: none;" />
  261. </label>
  262. <span class="red">请拍照上传收货照片</span>
  263. <div id="imgPreview"></div>
  264. </p>
  265. </div>
  266. <p class="fr accountNum">记账数量:<span class="red hege_num"></span> 册</p>
  267. </div>
  268. <!-- 查看收货弹窗 -->
  269. <div class="layer-receipt view-form">
  270. <div>
  271. <span class="number">
  272. 到货数量<span class="layer-tally-num-view"></span>册
  273. </span>
  274. <span>
  275. 合格数量<span class="hege_num_view"></span>册
  276. </span>
  277. </div>
  278. <div class="fixedCodes-view">
  279. </div>
  280. <div>
  281. <p>不合格数量:<span class="layer-scrap-num">0</span></spn>册</p>
  282. <p>收货凭证:
  283. <span class="itemName"></span>
  284. <div id="imgPreview_view"></div>
  285. </p>
  286. </div>
  287. <p class="fr accountNum">记账数量:<span class="red hege_num_view"></span> 册</p>
  288. </div>
  289. <!--日志弹层-->
  290. <link rel="stylesheet" href="/css/cylet.css" />
  291. <style>
  292. .class-modal-body-1{overflow: auto;height:400px;}
  293. .class-modal-body-1 td{font-size:14px;line-height:200%;}
  294. </style>
  295. <div class="confirmbox-mask" style="display: none" id="classModal-1">
  296. <form name="table_set">
  297. <div class="class-modal-1">
  298. <i class="icon icon-close-1"></i><div class="class-modal-head-1">日志</div>
  299. <div class="class-modal-body-1">
  300. <table>
  301. <?php
  302. if($logList){
  303. foreach ($logList as $val){
  304. echo '<tr>';
  305. echo '<td><img src="/images/right_head.png"></td>';
  306. echo '<td width="40%">'.$val['createTime'].'</td>';
  307. echo '<td width="50%">【'.$val['userName'].'】'.$val['info'].'</td>';
  308. echo '</tr>';
  309. }
  310. }
  311. ?>
  312. </table>
  313. </div>
  314. </div>
  315. </form>
  316. </div>
  317. <script src="/js/productset/jquery.min.js"></script>
  318. <script src="/js/ims/xsgl.js"></script>
  319. <script src="/js/layer/layer.js"></script>
  320. <script>
  321. $('.icon-close-1').click(function(){
  322. $('#classModal-1').hide();
  323. });
  324. $('#viewLog').click(function(){
  325. $('#classModal-1').show();
  326. });
  327. //查看所有内容
  328. $('body').on('click','.more-show', function () {
  329. layer.open({
  330. type: 1,
  331. title: '查看全部固定资产编号',
  332. btn: ['关闭'],
  333. area: ['400px', '200px'], //宽高
  334. btnAlign: 'c',
  335. content: $(this).attr('title'),
  336. yes: function (index, layero) {
  337. layer.closeAll();
  338. }
  339. });
  340. })
  341. function showMsg(msg){
  342. layer.msg(msg);
  343. }
  344. //查看凭据
  345. $('.view-data').click(function(){
  346. var atoId=$(this).attr('atoId'),
  347. itemName=$(this).attr('itemName'),
  348. allNum=$(this).attr('allNum'),
  349. hasFixedCode=$(this).attr('has-fixedCode'),
  350. imgList=$(this).attr('imgList');
  351. $('.layer-tally-num-view').html(allNum);
  352. $('.hege_num_view').html(allNum);
  353. if(hasFixedCode!=''){
  354. $('.fixedCodes-view').html(hasFixedCode);
  355. }
  356. if(imgList!=''){
  357. imgArr=imgList.split(',');
  358. var htmlImg='';
  359. for(var i=0;i<imgArr.length;i++){
  360. htmlImg+='<img src="'+imgArr[i]+'">';
  361. }
  362. $('#imgPreview_view').html(htmlImg);
  363. console.log(htmlImg);
  364. }
  365. $('.itemName').html(itemName);
  366. layer.open({
  367. type: 1,
  368. title: '查看凭据',
  369. btn: ['确认'],
  370. area: ['450px', '350px'],
  371. btnAlign: 'c',
  372. content: $('.view-form'),
  373. yes: function(index, layero) {
  374. layer.closeAll();
  375. }
  376. });
  377. });
  378. //重新提交
  379. $('.repeat_submit').click(function(){
  380. var atoId=$(this).attr('atoId'),
  381. itemName=$(this).attr('itemName'),
  382. allNum=$(this).attr('allNum'),
  383. hasFixedCode=$(this).attr('has-fixedCode'),
  384. imgList=$(this).attr('imgList');
  385. $('.layer-tally-num').html(allNum);
  386. $('.hege_num').html(allNum);
  387. $("input[name=hege_num]").val(allNum);
  388. $("input[name=hege_num]").attr('readonly',true);
  389. if(imgList!=''){
  390. imgArr=imgList.split(',');
  391. var htmlImg='';
  392. for(var i=0;i<imgArr.length;i++){
  393. htmlImg+='<img src="'+imgArr[i]+'">';
  394. }
  395. $('#imgPreview').html(htmlImg);
  396. }
  397. var flag = true;
  398. var atoId = $(this).attr('atoId');
  399. if(hasFixedCode.length>0){
  400. var html = '<span>选择合格固定资产:</span>';
  401. var fixedCodes = hasFixedCode.split(',');
  402. for (var i=0;i<fixedCodes.length;i++){
  403. html+='<lable style="margin-right: 10px;display:inline-block;"><input name="fixedCodes" readonly type="checkbox" checked value="'+fixedCodes[i]+'"> '+fixedCodes[i]+'</lable>';
  404. }
  405. $('.fixedCodes').html(html);
  406. var hasFixed = true;
  407. }else {
  408. var hasFixed = false;
  409. }
  410. layer.open({
  411. type: 1,
  412. title: '确认收货',
  413. btn: ['确认'],
  414. area: ['680px', '350px'], //宽高
  415. btnAlign: 'c',
  416. content: $('.edit-form'),
  417. yes: function(index, layero) {
  418. //提交确认收货
  419. var imgArr = [];
  420. $('#imgPreview img').each(function () {
  421. imgArr.push($(this).attr('src'));
  422. });
  423. if(imgArr.length <= 0){
  424. showMsg('请上传收货凭证!');
  425. return false;
  426. }
  427. var data = {
  428. imgArr:imgArr,
  429. atoId:atoId,
  430. }
  431. //确认
  432. layer.open({
  433. type: 1,
  434. title: '确认收货',
  435. btn: ['确认收货', '取消'],
  436. area: ['400px', '250px'],
  437. btnAlign: 'c',
  438. content: '<div class="receiptVoucherText"><p>申明:确认后,收货人有责任保证物品安全。</p><p class="red">此操作不可撤销,确认收货吗?</p></div>',
  439. yes: function(index, layero) {
  440. if (flag){
  441. flag=false;
  442. $.ajax({
  443. type: 'POST',
  444. url: "<?php echo $this->createUrl('imsStore/repeatReceipt');?>",
  445. data: data,
  446. async: false,
  447. dataType: 'json',
  448. success: function(result){
  449. console.log(result);
  450. if(result.status == 1){
  451. layer.alert("确认成功",{icon:1,closeBtn:0},function () {
  452. window.location.href = "<?php echo $this->createUrl('imsStore/allocation');?>";
  453. })
  454. }else{
  455. showMsg(result.error);
  456. flag = true;
  457. }
  458. },
  459. error: function (jqXHR, textStatus, errorThrown) {
  460. /*错误信息处理*/
  461. showMsg('增加失败!');
  462. flag = true;
  463. }
  464. });
  465. }else{
  466. layer.msg("稍安勿躁,正在处理中...");
  467. }
  468. }
  469. });
  470. }
  471. });
  472. });
  473. //查看图片
  474. $('body').on('click', '#receiveImg img', function () {
  475. var src = $(this).attr('src');
  476. layer.open({
  477. type: 1,
  478. title: '查看图片',
  479. btn: ['关闭'],
  480. area: ['800px', '500px'], //宽高
  481. btnAlign: 'c',
  482. content: '<img src="'+src+'" alt="" style="margin-top:5px;width: 100%;height: 100%">',
  483. yes: function (index, layero) {
  484. layer.closeAll();
  485. }
  486. });
  487. })
  488. // 添加图片
  489. $("#uploadImg").on("change", function() {
  490. //限制图片数量
  491. var imgObj = $('#imgPreview img');
  492. if(imgObj.length>=3){
  493. layer.msg("最多可上传三张图片");
  494. return false;
  495. }
  496. var formData = new FormData();
  497. formData.append('uploadFile',document.getElementById('uploadImg').files[0]);
  498. if(document.getElementById('uploadImg').files[0]==undefined){
  499. return false;
  500. }
  501. var basic = "<?php echo $basic;?>";
  502. $.ajax({
  503. url: "<?php echo $uploadUrl;?>",
  504. type: "post",
  505. data: formData,
  506. processData: false,
  507. contentType: false,
  508. beforeSend: function(req){
  509. req.setRequestHeader("Authorization", basic);
  510. },
  511. success: function (data) {
  512. console.log(data);
  513. if(data.errCode=='00'){
  514. var html = "<img src='"+data.data.url+"'>";
  515. $('#imgPreview').append(html);
  516. $('#uploadImg').val('');
  517. }else{
  518. layer.msg(data.errMsg);
  519. }
  520. }
  521. });
  522. });
  523. //删除图片
  524. $("body").on("click","#imgPreview img",function () {
  525. var obj = $(this);
  526. var imgUrl = $(this).attr('src');
  527. var flag= layer.confirm('您确定删除此图片吗?', {
  528. btn: ['确定', '取消'] //按钮
  529. }, function () {
  530. obj.remove();
  531. layer.close(flag);
  532. });
  533. })
  534. //报废数量
  535. $('.inputNum').on('input', function () {
  536. var input = parseInt($(this).val());
  537. var all = parseInt($('.layer-tally-num').html());
  538. $('.layer-scrap-num').html(all-input);
  539. $('.hege_num').html(input);
  540. });
  541. $('body').on('click', 'input[name="fixedCodes"]',function () {
  542. return false;
  543. });
  544. //取消凭证
  545. $('.suspended').on("click",function(){
  546. var businessKey=$(this).attr('businessKey');
  547. var flag = true;
  548. //确认
  549. layer.open({
  550. type: 1,
  551. title: '取消凭据',
  552. btn: ['确认', '取消'],
  553. area: ['400px', '250px'],
  554. btnAlign: 'c',
  555. content: '<div class="receiptVoucherText"><p>确认取消吗?</p><p class="red">确认取消后,可重新提交</p></div>',
  556. yes: function(index, layero) {
  557. if (flag){
  558. flag=false;
  559. $.ajax({
  560. type: 'POST',
  561. url: "<?php echo $this->createUrl('imsStore/suspended');?>",
  562. data: {businessKey:businessKey},
  563. async: false,
  564. dataType: 'json',
  565. success: function(result){
  566. console.log(result);
  567. if(result.status == 1){
  568. layer.alert("取消成功",{icon:1,closeBtn:0},function () {
  569. window.location.href = "<?php echo $this->createUrl('imsStore/allocation');?>";
  570. })
  571. }else{
  572. showMsg(result.error);
  573. flag = true;
  574. }
  575. },
  576. error: function (jqXHR, textStatus, errorThrown) {
  577. /*错误信息处理*/
  578. showMsg('操作失败!');
  579. flag = true;
  580. }
  581. });
  582. }else{
  583. layer.msg("稍安勿躁,正在处理中...");
  584. }
  585. }
  586. });
  587. });
  588. //确认收货
  589. $(".receipt").on("click", function() {
  590. $('#imgPreview').empty();
  591. $('.fixedCodes').empty();
  592. var totalNum = $(this).attr('allNum');
  593. $(".layer-tally-num").html(totalNum);
  594. var flag = true;
  595. var atId = "<?php echo $atId;?>";
  596. var atoId = $(this).attr('atoId');
  597. var itemId = $(this).attr('itemId');
  598. var hasFixed = $(this).attr('has-fixedCode');
  599. if(hasFixed.length>0){
  600. var html = '<span>选择合格固定资产:</span>';
  601. var fixedCodes = hasFixed.split(',');
  602. for (var i=0;i<fixedCodes.length;i++){
  603. html+='<lable style="margin-right: 10px;display:inline-block;"><input name="fixedCodes" type="checkbox" checked value="'+fixedCodes[i]+'"> '+fixedCodes[i]+'</lable>';
  604. }
  605. $('.fixedCodes').html(html);
  606. var hasFixed = true;
  607. }else {
  608. var hasFixed = false;
  609. }
  610. layer.open({
  611. type: 1,
  612. title: '确认收货',
  613. btn: ['确认'],
  614. area: ['680px', '350px'], //宽高
  615. btnAlign: 'c',
  616. content: $('.edit-form'),
  617. yes: function(index, layero) {
  618. //提交确认收货
  619. var hegeNum = $("input[name='hege_num']").val(); //合格
  620. var badNum = $(".layer-scrap-num").html(); //报废
  621. var allNum = $(".layer-tally-num").html(); //到货
  622. if($.trim(hegeNum)==''){
  623. showMsg('合格数量必填!');
  624. return false;
  625. }
  626. var imgArr = [];
  627. $('#imgPreview img').each(function () {
  628. imgArr.push($(this).attr('src'));
  629. });
  630. if(imgArr.length <= 0){
  631. showMsg('请上传收货凭证!');
  632. return false;
  633. }
  634. //固定资产
  635. var fixedCodesArr = [];
  636. if (hasFixed){
  637. var fixedObj = $('input[name="fixedCodes"]:checked');
  638. fixedObj.each(function () {
  639. fixedCodesArr.push($(this).val());
  640. });
  641. }
  642. var data = {
  643. itemId:itemId,
  644. imgArr:imgArr,
  645. atoId:atoId,
  646. atId:atId,
  647. qualifiedNo:hegeNum,
  648. scrapNo:badNum,
  649. tallyNo:allNum,
  650. fixedCodes:fixedCodesArr
  651. }
  652. //确认
  653. layer.open({
  654. type: 1,
  655. title: '确认收货',
  656. btn: ['确认收货', '取消'],
  657. area: ['400px', '250px'],
  658. btnAlign: 'c',
  659. content: '<div class="receiptVoucherText"><p>申明:确认后,收货人有责任保证物品安全。</p><p class="red">此操作不可撤销,确认收货吗?</p></div>',
  660. yes: function(index, layero) {
  661. if (flag){
  662. flag=false;
  663. $.ajax({
  664. type: 'POST',
  665. url: "<?php echo $this->createUrl('imsStore/ajaxReceipt');?>",
  666. data: data,
  667. async: false,
  668. dataType: 'json',
  669. success: function(result){
  670. console.log(result);
  671. if(result.status == 1){
  672. layer.alert("确认成功",{icon:1,closeBtn:0},function () {
  673. window.location.href = "<?php echo $this->createUrl('imsStore/allocation');?>";
  674. })
  675. }else{
  676. showMsg(result.error);
  677. flag = true;
  678. }
  679. },
  680. error: function (jqXHR, textStatus, errorThrown) {
  681. /*错误信息处理*/
  682. showMsg('增加失败!');
  683. flag = true;
  684. }
  685. });
  686. }else{
  687. layer.msg("稍安勿躁,正在处理中...");
  688. }
  689. }
  690. });
  691. }
  692. });
  693. return false;
  694. });
  695. </script>
  696. </body>
  697. </html>