|
@@ -0,0 +1,383 @@
|
|
|
+<link href="<?php echo ADMIN_TEMPLATES_URL;?>/css/recharge.css?4" rel="stylesheet" type="text/css" id="cssfile2" />
|
|
|
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
|
|
|
+<div class="page">
|
|
|
+ <div class="fixed-bar">
|
|
|
+ <div class="item-title">
|
|
|
+ <h3>库存管理</h3>
|
|
|
+ <ul class="tab-base">
|
|
|
+ <li><a href="JavaScript:void(0);" class="current"><span>机构库存</span></a></li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="fixed-empty"></div>
|
|
|
+ <form id="price_form" enctype="multipart/form-data" method="post">
|
|
|
+ <input type="hidden" name="form_submit" value="ok"/>
|
|
|
+ <table class="table tb-type2 tableFixed">
|
|
|
+ <tbody style="display:block;width:830px">
|
|
|
+ <tr>
|
|
|
+ <td colspan="2" class="required"><label>机构库存:</label></td>
|
|
|
+ </tr>
|
|
|
+ <tr class="noborder">
|
|
|
+ <?php foreach ($output['refill_oil_specs'] as $amount) {?>
|
|
|
+ <td class="moneySum w160">
|
|
|
+ <div class="align-center"><?php echo $amount;?></div>
|
|
|
+ <div style="position: relative;">
|
|
|
+ <div style="width:50%;">
|
|
|
+ <span>
|
|
|
+ 剩余(张)
|
|
|
+ <div style="width:50%">
|
|
|
+ <input type="number" readonly class="w50 surplus" value="<?php echo $output['total_stock']['amount_stock'][$amount]?>" style="background-color: #eaeaea;">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div style="width:50%;position: absolute;top: 0;right: 0;">
|
|
|
+ <span>
|
|
|
+ 变动(张)
|
|
|
+ <div style="width:50%">
|
|
|
+ <input type="number" name="total-<?php echo $amount;?>-amount" data-money="<?php echo $amount;?>" class="w50 money amountInput" value="0">
|
|
|
+ </div>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <?php }?>
|
|
|
+ </tr>
|
|
|
+ <tr class="noborder w500">
|
|
|
+ <td>
|
|
|
+ 余额:<span id="total"><?php echo $output['total_stock']['total'];?></span>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ 变动总额:<span id="changeTotal">0</span>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ 变动后总额:<span id="sumTotal"><?php echo $output['total_stock']['total'];?></span>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr class="noborder">
|
|
|
+ <table class="table tb-type2" style="margin-top:180px">
|
|
|
+ <thead class="flex_thead" style="top:200px" id="tableHread">
|
|
|
+
|
|
|
+ <tr class="w500">
|
|
|
+ <th class="align-center w96 mw96" rowspan="2">机构名称</th>
|
|
|
+ <th class="align-center w60 mw60" colspan="3">机构金额</th>
|
|
|
+ <th class="align-center w24 mw24"></th>
|
|
|
+ <?php foreach ($output['refill_oil_specs'] as $amount) {?>
|
|
|
+ <th class="align-center w60 tbNum mw60" colspan="3"><?php echo $amount;?></th>
|
|
|
+ <th class="align-center w24 mw24"></th>
|
|
|
+ <?php }?>
|
|
|
+ </tr>
|
|
|
+ <tr class="w500">
|
|
|
+ <th class="align-center w60 mw60">剩余金额</th>
|
|
|
+ <th class="align-center w60 mw60">变动金额</th>
|
|
|
+ <th class="align-center w60 mw60">是否开启</th>
|
|
|
+ <th class="align-center w24 mw24"></th>
|
|
|
+ <?php foreach ($output['refill_oil_specs'] as $amount) {?>
|
|
|
+ <th class="align-center w60 mw60">剩余张数</th>
|
|
|
+ <th class="align-center w60 mw60">变动张数</th>
|
|
|
+ <th class="align-center w60 mw60">是否开启</th>
|
|
|
+ <th class="align-center w24 mw24"></th>
|
|
|
+ <?php }?>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody class="tbody" style="display: block;padding-top: 37px;">
|
|
|
+ <?php foreach ($output['merchant_list'] as $merchant) {?>
|
|
|
+ <tr class="w500 trFlex">
|
|
|
+ <td class="w96 align-center" style="min-width:96px">
|
|
|
+ <?php echo $merchant['company_name'];?>
|
|
|
+
|
|
|
+ </td>
|
|
|
+ <td class="w50 align-center">
|
|
|
+ <input type="number" readonly class="w50"
|
|
|
+ value="<?php echo $output['total_stock']['mtactics']["{$merchant['mchid']}-amount"];?>" style="background-color: #eaeaea;">
|
|
|
+ </td>
|
|
|
+ <td class="w50 align-center">
|
|
|
+ <input type="number" class="w50 mecChange" name="mtotal_amount[<?php echo $merchant['mchid'];?>-amount]" value="0">
|
|
|
+ </td>
|
|
|
+ <td class="w60 align-center">
|
|
|
+ <select class="select1" name="mtotal_turn[<?php echo $merchant['mchid'];?>-turn]" class="w60">
|
|
|
+ <option value="1" <?php if($output['total_stock']['mtactics']["{$merchant['mchid']}-turn"] == 1){ echo 'selected';}?>>关闭</option>
|
|
|
+ <option value="2" <?php if($output['total_stock']['mtactics']["{$merchant['mchid']}-turn"] == 2){ echo 'selected';}?>>预留</option>
|
|
|
+ <option value="3" <?php if($output['total_stock']['mtactics']["{$merchant['mchid']}-turn"] == 3){ echo 'selected';}?>>分配</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td class="align-center w24 mw24"></td>
|
|
|
+ <?php foreach ($output['refill_oil_specs'] as $amount) {?>
|
|
|
+ <input type="hidden" name="mchid[]" value="<?php echo $merchant['mchid'];?>">
|
|
|
+ <input type="hidden" name="amount[]" value="<?php echo $amount;?>">
|
|
|
+ <td class="w50 align-center">
|
|
|
+ <input type="number" readonly class="w50 tbSurplus"
|
|
|
+ value="<?php echo $output['total_stock']['mtactics']["{$merchant['mchid']}-{$amount}"]['default_count'];?>" style="background-color: #eaeaea;">
|
|
|
+ </td>
|
|
|
+ <td class="w50 align-center">
|
|
|
+ <input type="number" class="w50 tbChange amountInput" name="mtotal[]" value="0" data-tbMoney="<?php echo $amount;?>">
|
|
|
+ </td>
|
|
|
+ <td class="w60 align-center tbSelect">
|
|
|
+ <select class="select2" name="mturn[]">
|
|
|
+ <option value="1" <?php if($output['total_stock']['mtactics']["{$merchant['mchid']}-{$amount}"]['turn'] == 1){ echo 'selected';}?>>关闭</option>
|
|
|
+ <option value="2" <?php if($output['total_stock']['mtactics']["{$merchant['mchid']}-{$amount}"]['turn'] == 2){ echo 'selected';}?>>预留</option>
|
|
|
+ <option value="3" <?php if($output['total_stock']['mtactics']["{$merchant['mchid']}-{$amount}"]['turn'] == 3){ echo 'selected';}?>>分配</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td class="align-center w24 mw24"></td>
|
|
|
+ <?php }?>
|
|
|
+ </tr>
|
|
|
+ <?php }?>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ <tfoot>
|
|
|
+ <tr class="tfoot">
|
|
|
+ <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
|
|
|
+ </tr>
|
|
|
+ </tfoot>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
+</div>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/dialog/dialog.js" id="dialog_js"
|
|
|
+ charset="utf-8"></script>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/ajaxfileupload/ajaxfileupload.js"></script>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
|
|
|
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
|
|
|
+<link href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css"
|
|
|
+ id="cssfile2"/>
|
|
|
+<script type="text/javascript">
|
|
|
+ $(function () {
|
|
|
+ let isSubmit = true
|
|
|
+ let isOk = true
|
|
|
+ let isMoney = true
|
|
|
+ $(window).scroll(function() {
|
|
|
+ let toLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
|
|
+ if (toLeft>0) {
|
|
|
+ let headLeft = toLeft - 16
|
|
|
+ $('#tableHread')[0].style.left = '-'+headLeft+'px'
|
|
|
+ } else if (toLeft == 0) {
|
|
|
+ $('#tableHread')[0].style.left = 20+'px'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $(".money").change(function(){
|
|
|
+ // 剩余张数
|
|
|
+ let surplusArr = []
|
|
|
+ // 变动
|
|
|
+ let changeArr = []
|
|
|
+ // 金额
|
|
|
+ let numArr = []
|
|
|
+ // 变动后总额
|
|
|
+ let img_url_Sum = 0;
|
|
|
+ let change_img_url = 0;
|
|
|
+ $(".surplus").each(function(){
|
|
|
+ surplusArr.push(Number($(this).val()));
|
|
|
+ })
|
|
|
+ $(".money").each(function(){
|
|
|
+ changeArr.push(Number($(this).val()));
|
|
|
+ numArr.push(Number($(this).attr('data-money')));
|
|
|
+ })
|
|
|
+ for (let i = 0; i < surplusArr.length; i++) {
|
|
|
+ // img_url += (surplusArr[i] * numArr[i])
|
|
|
+ change_img_url += ( changeArr[i] * numArr[i])
|
|
|
+ }
|
|
|
+ img_url_Sum = change_img_url + Number($('#total').text())
|
|
|
+ // console.log('surplusArr', surplusArr, changeArr, numArr, change_img_url);
|
|
|
+ $('#changeTotal').text(change_img_url)
|
|
|
+ $('#sumTotal').text(img_url_Sum)
|
|
|
+ $('.tbChange').change()
|
|
|
+ })
|
|
|
+
|
|
|
+ $('.tbChange').change(function () {
|
|
|
+ // 剩余张数
|
|
|
+ let surplusArr = []
|
|
|
+ // 变动
|
|
|
+ let changeArr = []
|
|
|
+ // 金额
|
|
|
+ let numArr = []
|
|
|
+ $(".surplus").each(function(){
|
|
|
+ surplusArr.push(Number($(this).val()));
|
|
|
+ })
|
|
|
+ $(".money").each(function(){
|
|
|
+ changeArr.push(Number($(this).val()));
|
|
|
+ numArr.push(Number($(this).attr('data-money')));
|
|
|
+ })
|
|
|
+ // 金额tb
|
|
|
+ let tbNumArr_Change = []
|
|
|
+ let tbNumArr_Surplus = []
|
|
|
+ let tbChangeSum_2000 = 0
|
|
|
+ let tbChangeSum_1000 = 0
|
|
|
+ let tbChangeSum_500 = 0
|
|
|
+ let tbChangeSum_200 = 0
|
|
|
+ let tbChangeSum_100 = 0
|
|
|
+ let tbchangeArr_2000 = []
|
|
|
+ let tbchangeArr_1000 = []
|
|
|
+ let tbchangeArr_500 = []
|
|
|
+ let tbchangeArr_200 = []
|
|
|
+ let tbchangeArr_100 = []
|
|
|
+ let tbSurplusSum_2000 = 0
|
|
|
+ let tbSurplusSum_1000 = 0
|
|
|
+ let tbSurplusSum_500 = 0
|
|
|
+ let tbSurplusSum_200 = 0
|
|
|
+ let tbSurplusSum_100 = 0
|
|
|
+ let tbSurplusArr_2000 = []
|
|
|
+ let tbSurplusArr_1000 = []
|
|
|
+ let tbSurplusArr_500 = []
|
|
|
+ let tbSurplusArr_200 = []
|
|
|
+ let tbSurplusArr_100 = []
|
|
|
+ let isFalse = []
|
|
|
+ let moneyArr = []
|
|
|
+ $(".tbChange").each(function(){
|
|
|
+ let isTrue = $(this).parent().next().children().val()
|
|
|
+ if (isTrue != 1) {
|
|
|
+ if (Number($(this).attr('data-tbMoney')) == 2000 ) {
|
|
|
+ tbchangeArr_2000.push(Number($(this).val()));
|
|
|
+ tbSurplusArr_2000.push(Number($(this).parent().prev().children().val()));
|
|
|
+
|
|
|
+ } else if(Number($(this).attr('data-tbMoney')) == 1000 ) {
|
|
|
+ tbchangeArr_1000.push(Number($(this).val()));
|
|
|
+ tbSurplusArr_1000.push(Number($(this).parent().prev().children().val()));
|
|
|
+
|
|
|
+ } else if(Number($(this).attr('data-tbMoney')) == 1000 ) {
|
|
|
+ tbchangeArr_1000.push(Number($(this).val()));
|
|
|
+ tbSurplusArr_1000.push(Number($(this).parent().prev().children().val()));
|
|
|
+
|
|
|
+ }else if(Number($(this).attr('data-tbMoney')) == 500 ) {
|
|
|
+ tbchangeArr_500.push(Number($(this).val()));
|
|
|
+ tbSurplusArr_500.push(Number($(this).parent().prev().children().val()));
|
|
|
+
|
|
|
+ }else if(Number($(this).attr('data-tbMoney')) == 200 ) {
|
|
|
+ tbchangeArr_200.push(Number($(this).val()));
|
|
|
+ tbSurplusArr_200.push(Number($(this).parent().prev().children().val()));
|
|
|
+
|
|
|
+ }else if(Number($(this).attr('data-tbMoney')) == 100 ) {
|
|
|
+ tbchangeArr_100.push(Number($(this).val()));
|
|
|
+ tbSurplusArr_100.push(Number($(this).parent().prev().children().val()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ for (let i = 0; i < tbSurplusArr_2000.length; i++) {
|
|
|
+ tbChangeSum_2000 += tbchangeArr_2000[i]
|
|
|
+ tbSurplusSum_2000 += tbSurplusArr_2000[i]
|
|
|
+ }
|
|
|
+ for (let i = 0; i < tbSurplusArr_1000.length; i++) {
|
|
|
+ tbChangeSum_1000 += tbchangeArr_1000[i]
|
|
|
+ tbSurplusSum_1000 += tbSurplusArr_1000[i]
|
|
|
+ }
|
|
|
+ for (let i = 0; i < tbSurplusArr_500.length; i++) {
|
|
|
+ tbChangeSum_500 += tbchangeArr_500[i]
|
|
|
+ tbSurplusSum_500 += tbSurplusArr_500[i]
|
|
|
+ }
|
|
|
+ for (let i = 0; i < tbSurplusArr_200.length; i++) {
|
|
|
+ tbChangeSum_200 += tbchangeArr_200[i]
|
|
|
+ tbSurplusSum_200 += tbSurplusArr_200[i]
|
|
|
+ }
|
|
|
+ for (let i = 0; i < tbSurplusArr_100.length; i++) {
|
|
|
+ tbChangeSum_100 += tbchangeArr_100[i]
|
|
|
+ tbSurplusSum_100 += tbSurplusArr_100[i]
|
|
|
+ }
|
|
|
+ tbNumArr_Change.push(tbChangeSum_2000)
|
|
|
+ tbNumArr_Change.push(tbChangeSum_1000)
|
|
|
+ tbNumArr_Change.push(tbChangeSum_500)
|
|
|
+ tbNumArr_Change.push(tbChangeSum_200)
|
|
|
+ tbNumArr_Change.push(tbChangeSum_100)
|
|
|
+ tbNumArr_Surplus.push(tbSurplusSum_2000)
|
|
|
+ tbNumArr_Surplus.push(tbSurplusSum_1000)
|
|
|
+ tbNumArr_Surplus.push(tbSurplusSum_500)
|
|
|
+ tbNumArr_Surplus.push(tbSurplusSum_200)
|
|
|
+ tbNumArr_Surplus.push(tbSurplusSum_100)
|
|
|
+ // console.log('变',tbChangeSum_2000,tbChangeSum_1000, tbChangeSum_500, tbChangeSum_200, tbChangeSum_100 );
|
|
|
+ // console.log('剩余',tbSurplusSum_2000,tbSurplusSum_1000, tbSurplusSum_500, tbSurplusSum_200, tbSurplusSum_100 );
|
|
|
+ $(".money").each(function(){
|
|
|
+ moneyArr.push($(this));
|
|
|
+ })
|
|
|
+ for (let index = 0; index < tbNumArr_Change.length; index++) {
|
|
|
+ if ((tbNumArr_Change[index] + tbNumArr_Surplus[index]) > (surplusArr[index] + changeArr[index])) {
|
|
|
+ isFalse.push(false)
|
|
|
+ layer.msg('变动后张数不可以超过变动后总张数');
|
|
|
+ moneyArr[index][0].style['borderColor'] = '#e64444'
|
|
|
+ } else {
|
|
|
+ isFalse.push(true)
|
|
|
+ moneyArr[index][0].style['borderColor'] = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($.inArray(false, isFalse) == -1) {
|
|
|
+ isOk = true
|
|
|
+ } else {
|
|
|
+ isOk = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let get_macsum = function() {
|
|
|
+ let surplusArr = []
|
|
|
+ let changeArr = []
|
|
|
+ let sum = 0
|
|
|
+ $(".mecChange").each(function(){
|
|
|
+ let isTrue = $(this).parent().next().children().val()
|
|
|
+ if (isTrue != 1) {
|
|
|
+ changeArr.push(Number($(this).val()));
|
|
|
+ surplusArr.push(Number($(this).parent().prev().children().val()));
|
|
|
+ }
|
|
|
+ })
|
|
|
+ for (let index = 0; index < changeArr.length; index++) {
|
|
|
+ sum += (surplusArr[index] + changeArr[index])
|
|
|
+ }
|
|
|
+ console.log('surplusArr', surplusArr);
|
|
|
+ return sum;
|
|
|
+ }
|
|
|
+ $('.mecChange').change(function () {
|
|
|
+ let value = $(this)[0].value
|
|
|
+ if (!value) {
|
|
|
+ isSubmit = false
|
|
|
+ $(this)[0].style['borderColor'] = '#e64444'
|
|
|
+ } else {
|
|
|
+ isSubmit = true;
|
|
|
+ let img_url_Sum = Number($('#sumTotal').text())
|
|
|
+ let macSum = get_macsum();
|
|
|
+ if($(this).parent().next().children().val() == 1) {
|
|
|
+ $(this)[0].style['borderColor'] = ''
|
|
|
+ } else {
|
|
|
+ if (macSum > img_url_Sum) {
|
|
|
+ isMoney = false
|
|
|
+ layer.msg('变动后金额不可以超过变动后总额');
|
|
|
+ $(this)[0].style['borderColor'] = '#e64444'
|
|
|
+ } else {
|
|
|
+ isMoney = true
|
|
|
+ $('.mecChange').each(function() {
|
|
|
+ $(this)[0].style['borderColor'] = ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log('机构', macSum, img_url_Sum,$(this)[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ $('.select1').change(function () {
|
|
|
+ $('.mecChange').change()
|
|
|
+ })
|
|
|
+ $('.select2').change(function () {
|
|
|
+ $(".money").change()
|
|
|
+ })
|
|
|
+
|
|
|
+ $('.amountInput').change(function () {
|
|
|
+ let value = $(this)[0].value
|
|
|
+ if (!value) {
|
|
|
+ isSubmit = false
|
|
|
+ $(this)[0].style['borderColor'] = '#e64444'
|
|
|
+ } else {
|
|
|
+ isSubmit = true;
|
|
|
+ $(this)[0].style['borderColor'] = ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ $("#submitBtn").click(function () {
|
|
|
+ // console.log('isSubmit', isSubmit, isOk, isMoney);
|
|
|
+ if (isSubmit && isOk && isMoney) {
|
|
|
+ $("#price_form").submit();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 表格hover时背景
|
|
|
+ $('.trFlex').each(function () {
|
|
|
+ $(this).hover(function () {
|
|
|
+ $(this)[0].style.backgroundColor = '#cbe9f3'
|
|
|
+ },function() {
|
|
|
+ $(this)[0].style.backgroundColor = '#fff'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ });
|
|
|
+</script>
|