ソースを参照

transfer order buyback manuanl recharge

xiaoyu 2 年 前
コミット
f43a7c0bb4

+ 7 - 0
admin/control/refill_order_manual.php

@@ -535,6 +535,13 @@ class refill_order_manualControl extends SystemControl
             elseif ($type === 'canceled_order_retry_next') {
                 [$succ,$err] = refill\util::retry_canceled_order($order_id,true);
                 $this->log("预回调订单失败补快充,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}");
+            }
+            elseif ($type === 'buyback') {
+                $this->log("预回调订单返销操作,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}");
+            }
+            elseif ($type === 'manual_recharge') {
+                $manual_recharge_amount = $_GET['manual_recharge_amount'] ?? 0;
+                $this->log("预回调订单手动补充录入,订单号:{$order['order_sn']},商家单号:{$mch_order},机构编码:{$mchid} err:{$err}");
             } else {
                 continue;
             }

+ 12 - 20
admin/templates/default/transfer.order.php

@@ -117,9 +117,10 @@
                 <td class="layui-form">
                     <select name="mchid" class="querySelect" lay-verify="" lay-search>
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php if(!empty($output['merchant_list'])){?>
                         <?php foreach ($output['merchant_list'] as $merchant) { ?>
                             <option value="<?php echo $merchant['mchid'] ?>"<?php if ($_GET['mchid'] == $merchant['mchid']){ ?>selected<?php } ?>><?php echo $merchant['company_name'] == '' ? $merchant['name'] : $merchant['company_name']; ?></option>
-                        <?php } ?>
+                        <?php }} ?>
                     </select>
                 </td>
                 <th><label class="query_ors">充值卡号(多行查询)</label></th>
@@ -175,7 +176,7 @@
             </tr>
         </thead>
         <tbody id="tbody">
-            <?php if (count($output['list']) > 0) { ?>
+            <?php if (!empty($output['list']) && count($output['list']) > 0) { ?>
                 <?php
                 foreach ($output['list'] as $key => $order) { ?>
                     <tr class="hover trFlex">
@@ -207,8 +208,7 @@
                         <td class="align-center"><?php echo $order['quality_text']; ?></td>
                         <td class="align-center"><?php echo orderState($order); ?></td>
                         <td class="align-center">
-                            <input type="hidden" value="<?php echo $order['can_cancel']; ?>">
-                            <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=set_next_order&order_ids=<?php echo $order['order_id']; ?>" id="hdFail">
+                            <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=set_next_order&order_ids=<?php echo $order['order_id']; ?>">
                                 拦截转快充</a>
                         </td>
                     </tr>
@@ -237,10 +237,10 @@
 <link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css" />
 <script type="text/javascript">
     $(function() {
-        $('#hCopyCardNo').click(function() {
+        function copy_some(col) {
             let str = ''
-            $('#tbody tr').each(function () {
-                let res = $(this).find('td').eq(5).text()
+            $('#tbody tr').each(function() {
+                let res = $(this).find('td').eq(col).text()
                 str += res + '\n'
             })
             let oInput = document.createElement("textarea");
@@ -251,22 +251,14 @@
             oInput.select(); // 选择对象
             document.execCommand("Copy"); // 执行浏览器复制命令
             oInput.parentNode.removeChild(oInput)
+        }
+
+        $('#hCopyCardNo').click(function() {
+            copy_some(5)
         });
 
         $('#hCopyMchOrderNo').click(function() {
-            let str = ''
-            $('#tbody tr').each(function () {
-                let res = $(this).find('td').eq(4).text()
-                str += res + '\n'
-            })
-            let oInput = document.createElement("textarea");
-            oInput.style.border = "0 none";
-            oInput.style.color = "transparent";
-            oInput.value = str;
-            document.body.appendChild(oInput);
-            oInput.select(); // 选择对象
-            document.execCommand("Copy"); // 执行浏览器复制命令
-            oInput.parentNode.removeChild(oInput)
+            copy_some(4)
         });
 
         $('#ncsubmit').click(function() {

+ 101 - 61
admin/templates/default/transfer.order.recharge.php

@@ -117,9 +117,11 @@
                 <td class="layui-form">
                     <select name="mchid" class="querySelect" lay-verify="" lay-search>
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php if(!empty($output['merchant_list'])){?>
+
                         <?php foreach ($output['merchant_list'] as $merchant) { ?>
                             <option value="<?php echo $merchant['mchid'] ?>"<?php if ($_GET['mchid'] == $merchant['mchid']){ ?>selected<?php } ?>><?php echo $merchant['company_name'] == '' ? $merchant['name'] : $merchant['company_name']; ?></option>
-                        <?php } ?>
+                        <?php }} ?>
                     </select>
                 </td>
                 <th><label class="query_ors">充值卡号(多行查询)</label></th>
@@ -157,6 +159,13 @@
                     </a>
                 </td>
             </tr>
+            <tr>
+                <td>
+                    <a href="#" class="btns" id="buybacks">
+                        <span><i class="icon-edit"></i>批量返销处理</span>
+                    </a>
+                </td>
+            </tr>
         </table>
     </form>
     <table class="table tb-type2 nobdb">
@@ -167,7 +176,7 @@
             </th>
             <th class="align-center">编号</th>
             <th class="align-center">机构编号</th>
-            <th class="align-center">机构名称</th>
+            <th class="align-left">机构名称</th>
             <th class="align-center">商家单号</th>
             <th class="align-center">充值卡号</th>
             <th class="align-center">充值面值</th>
@@ -176,20 +185,21 @@
             <th class="align-left">供方名称</th>
             <th class="align-center">当前质量</th>
             <th class="align-center">订单状态</th>
+            <th class="align-center">返销/补充</th>
             <th class="align-center"><?php echo $lang['nc_handle']; ?></th>
         </tr>
         </thead>
         <tbody id="tbody">
-        <?php if (count($output['list']) > 0) { ?>
+        <?php if (!empty($output['list']) && count($output['list']) > 0) { ?>
             <?php
             foreach ($output['list'] as $key => $order) { ?>
                 <tr class="hover trFlex">
                     <td class="align-center">
                         <input type="checkbox" id="checkBoxList" name="checkbox" value="<?php echo $order['order_id']; ?>">
                     </td>
-                    <td class="align-center"><?php echo $key + 1; ?></td>
+                    <td class="align-center"><?php echo $order['order_id']; ?></td>
                     <td class="align-center"><?php echo $order['mchid']; ?></td>
-                    <td class="align-center"><?php echo $order['mch_name']; ?></td>
+                    <td class="align-left"><?php echo $order['mch_name']; ?></td>
                     <td class="align-center"><?php echo $order['mch_order']; ?></td>
                     <td class="align-center"><?php echo $order['card_no']; ?></td>
                     <td class="align-center"><?php echo $order['refill_amount']; ?></td>
@@ -217,11 +227,15 @@
                     <td class="align-center"><?php echo $order['quality_text']; ?></td>
                     <td class="align-center"><?php echo orderState($order); ?></td>
                     <td class="align-center">
-                        <input type="hidden" value="<?php echo $order['can_cancel']; ?>">
-                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids=<?php echo $order['order_id']; ?>" id="hdFail">
+                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=buyback&order_ids=<?php echo $order['order_id']; ?>">返销</a>
+                        |
+                        <a href="#" data-order_id="<?php echo $order['order_id']; ?>" id="manual_recharge">已手动补充</a>
+                    </td>
+                    <td class="align-center">
+                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids=<?php echo $order['order_id']; ?>">
                             补充</a>
                         |
-                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids=<?php echo $order['order_id']; ?>" id="hdFail">
+                        <a href="index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids=<?php echo $order['order_id']; ?>">
                             补快充</a>
                     </td>
                 </tr>
@@ -250,10 +264,10 @@
 <link rel="stylesheet" type="text/css" href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css" />
 <script type="text/javascript">
     $(function() {
-        $('#hCopyCardNo').click(function() {
+        function copy_some(col) {
             let str = ''
             $('#tbody tr').each(function () {
-                let res = $(this).find('td').eq(5).text()
+                let res = $(this).find('td').eq(col).text()
                 str += res + '\n'
             })
             let oInput = document.createElement("textarea");
@@ -264,25 +278,17 @@
             oInput.select(); // 选择对象
             document.execCommand("Copy"); // 执行浏览器复制命令
             oInput.parentNode.removeChild(oInput)
+        }
+
+        $('#hCopyCardNo').click(function () {
+            copy_some(5)
         });
 
-        $('#hCopyMchOrderNo').click(function() {
-            let str = ''
-            $('#tbody tr').each(function () {
-                let res = $(this).find('td').eq(4).text()
-                str += res + '\n'
-            })
-            let oInput = document.createElement("textarea");
-            oInput.style.border = "0 none";
-            oInput.style.color = "transparent";
-            oInput.value = str;
-            document.body.appendChild(oInput);
-            oInput.select(); // 选择对象
-            document.execCommand("Copy"); // 执行浏览器复制命令
-            oInput.parentNode.removeChild(oInput)
+        $('#hCopyMchOrderNo').click(function () {
+            copy_some(4)
         });
 
-        $('#ncsubmit').click(function() {
+        $('#ncsubmit').click(function () {
             $('#formSearch').submit();
         });
         $('#query_start_time').datepicker({
@@ -303,80 +309,114 @@
         });
 
         //全选
-        $('#selectAll').click(function() {
+        $('#selectAll').click(function () {
             if ($("input[name='chbox']").is(':checked')) {
-                $("input[name='checkbox']").each(function() {
+                $("input[name='checkbox']").each(function () {
                     this.checked = true;
                 })
             } else {
-                $("input[name='checkbox']").each(function() {
+                $("input[name='checkbox']").each(function () {
                     this.checked = false;
                 })
             }
         })
 
         //过滤
-        $("#mch_orders").blur(function() {
+        $("#mch_orders").blur(function () {
             let test_mch = $("#mch_orders").val();
             let result = test_mch.replace(/[\  \r\n\,]+/g, ",");
             $(this).val(result)
         })
 
         //过滤
-        $("#card_nos").blur(function() {
+        $("#card_nos").blur(function () {
             let test_mch = $("#card_nos").val();
             let result = test_mch.replace(/[\  \r\n\,]+/g, ",");
             $(this).val(result)
         })
 
+        $('#manual_recharge').on('click', function() {
+            let order_id = $(this).attr('data-order_id');
+            layui.use(['layer'], function() {
+                const manual_amountHTML = '<label class="createTaskDate"><span>手动补充金额:</span><input type="text" class="layui-input" id="manual_amount"></label>'
+                layer.confirm(manual_amountHTML, {
+                    title: '输入手动补充金额'
+                }, function(index) {
+                    console.log('确认')
+                    let manual_recharge_amount = $('#manual_amount').val();
+                    if (!manual_recharge_amount) {
+                        layer.msg('请输入手动补充金额');
+                        return;
+                    }
+                    console.log(manual_recharge_amount)
+                    console.log(order_id)
+                    index = layer.load();
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=manual_recharge&order_ids=${order_id}&manual_recharge_amount=${manual_recharge_amount}`
+                    layer.close(index);
+                }, function() {
+                    console.log('取消')
+                });
+            })
+        })
+
         //批量
-        $('#canceled_order_retry').click(function() {
+        $('#canceled_order_retry').click(function () {
             layer.confirm('您确定要批量补充吗', {
                 btn: ['确定', '取消'],
                 title: '批量补充'
-            }, function() {
-                let arr = [];
-                $("input:checkbox:checked").each(function(i) {
-                    arr[i] = $(this).val();
-                })
-                let str = arr.join(",");
-                let strr = str.substring(0, 1);
-                let number = Number(strr);
-                if (isNaN(number)) {
-                    let strrr = str.substring(1, str.length);
-                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids= ${strrr ? strrr : ''}`
-                } else if (!isNaN(number) && str !== '') {
-                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids= ${str ? str : ''}`
+            }, function () {
+                let order_ids = formatParams();
+                console.log(order_ids);
+                if (order_ids !== '') {
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry&order_ids= ${order_ids}`
                 } else {
-                    layer.msg('请还没有任何操作,请先选择');
+                    layer.msg('还没有任何操作,请先选择');
                 }
-            }, function() {});
+            }, function () {
+            });
         })
 
         //批量
-        $('#canceled_order_retry_next').click(function() {
+        $('#canceled_order_retry_next').click(function () {
             layer.confirm('您确定要批量补快充吗', {
                 btn: ['确定', '取消'],
                 title: '批量补快充'
-            }, function() {
-                let arr = [];
-                $("input:checkbox:checked").each(function(i) {
-                    arr[i] = $(this).val();
-                })
-                let str = arr.join(",");
-                let strr = str.substring(0, 1);
-                let number = Number(strr);
-                if (isNaN(number)) {
-                    let strrr = str.substring(1, str.length);
-                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids= ${strrr ? strrr : ''}`
-                } else if (!isNaN(number) && str !== '') {
-                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids= ${str ? str : ''}`
+            }, function () {
+                let order_ids = formatParams();
+                if (order_ids !== '') {
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=canceled_order_retry_next&order_ids= ${order_ids}`
+                } else {
+                    layer.msg('还没有任何操作,请先选择');
+                }
+            }, function () {
+            });
+        })
+
+        //批量
+        $('#buybacks').click(function () {
+            layer.confirm('您确定要批量返销处理吗', {
+                btn: ['确定', '取消'],
+                title: '批量补快充'
+            }, function () {
+                let order_ids = formatParams();
+                if (order_ids !== '') {
+                    window.location.href = `index.php?act=refill_order_manual&op=transfer_order_dispose&type=buyback&order_ids= ${order_ids}`
                 } else {
                     layer.msg('请还没有任何操作,请先选择');
                 }
-            }, function() {});
+            }, function () {
+            });
         })
 
+        function formatParams()
+        {
+            let arr = [];
+            $("input[name='checkbox']:checked").each(function (i) {
+                arr[i] = $(this).val();
+            })
+            return arr.join(",");
+        }
+
         //双击
         $('.doubleclick').dblclick(function() {
             let order_sn = $(this).attr('data-order')