xiaoyu %!s(int64=3) %!d(string=hai) anos
pai
achega
7f8574fc72

+ 85 - 63
admin/templates/default/refill.task.php

@@ -125,6 +125,8 @@
     <form method="get" action="index.php" name="formSearch" id="formSearch">
         <input type="hidden" name="act" value="orderstats"/>
         <input type="hidden" name="op" value="refill_task"/>
+        <input type="hidden" name="cid_type" value=""/>
+        <input type="hidden" name="default_cid_type" value="<?php echo $_GET['cid_type']; ?>"/>
         <table class="tb-type1 noborder search">
             <tr>
                 <th><label>主体类型</label></th>
@@ -132,7 +134,7 @@
                     <select name="type" id="type" lay-filter="type">
                         <option value="">请选择</option>
                         <?php foreach ($output['type'] as $key => $value){?>
-                        <option value="<?php echo $key;?>" <?php if($_GET['type'] === $key) { echo 'selected'; }?>><?php echo $value;?></option>
+                            <option value="<?php echo $key;?>" <?php if($_GET['type'] === $key) { echo 'selected'; }?>><?php echo $value;?></option>
                         <?php }?>
                     </select>
                 </td>
@@ -164,6 +166,7 @@
             <th class="align-center">处理日期</th>
             <th class="align-center">完成日期</th>
             <th class="align-center">处理结果</th>
+            <th class="align-center">操作</th>
         </tr>
         </thead>
         <tbody id="tbody">
@@ -204,17 +207,20 @@
                             <a target="_blank" href="<?php echo UPLOAD_SITE_URL . '/' . ATTACH_TASK . DS . $value['task_result']; ?>">下载</a>
                         <?php }?>
                     </td>
+                    <td class="align-center">
+                        <a href="index.php?act=OrderStats&op=changeState&task_id=<?php echo $value['task_id'] ?>">删除</a>
+                    </td>
                 </tr>
             <?php } ?>
         <?php } else { ?>
             <tr class="no_data">
-                <td colspan="11"><?php echo $lang['nc_no_record']; ?></td>
+                <td colspan="13"><?php echo $lang['nc_no_record']; ?></td>
             </tr>
         <?php } ?>
         </tbody>
         <tfoot>
         <tr class="tfoot">
-            <td colspan="11" id="dataFuncs">
+            <td colspan="13" id="dataFuncs">
                 <div class="pagination"> <?php echo $output['show_page']; ?> </div>
             </td>
         </tr>
@@ -229,12 +235,19 @@
         charset="utf-8"></script>
 <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" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
 <script type="text/javascript">
+    let selectValue = ''
+    let Interface
+    let default_type = '<?php echo $_GET['type'];?>';
+    // console.log(default_type, 'type');
+    let default_cid_m = '<?php echo $_GET['cid'];?>';
+    // console.log(default_cid_m);
 
     $(function () {
         $('#ncsubmit').click(function () {
+            $('input[name="cid_type"]').val(selectValue);
             $('#formSearch').submit();
         });
         $('#query_start_time').datepicker({dateFormat: 'yy-mm-dd'});
@@ -266,32 +279,21 @@
                 $(this).css('color', 'red')
             }
         })
-            
-        let selectValue = ''
-        let selectRes = {}
-    
-        let selectNew = $("#cid").next().find("input")
-                    
-                    for (let i = 0; i < selectRes.length; i++) {
-                        if (selectRes[i].value == selectValue) {
-                            console.log(selectValue, 12333);
-                            $(selectNew).val(selectRes[i].value)
-                            selectRes[i].selected = true
-                    }
-                }
 
 
 
-        //主体选择 
+
+
+        //主体选择
         layui.use(['form'], function () {
             let form = layui.form;
             let default_type = $('select[name="type"]').val();
-                if (default_type === 'merchant') {
+            if (default_type === 'merchant') {
                 $.get('index.php?act=refill_order&op=merchant_data', function(res) {
-                    res = JSON.parse(res) 
+                    res = JSON.parse(res)
                     let html = '';
                     res.forEach(item => {
-                    html += `<option value="${item.value}">${item.name}</option>`;
+                        html += `<option value="${item.value}">${item.name}</option>`;
                     })
                     let select_type = `<select>${html}</select>`
                     $('#cid').html(select_type);
@@ -299,56 +301,76 @@
                 })
             } else if (default_type === 'provider'){
                 $.get('index.php?act=refill_order&op=provider_data', function(res) {
-                    res = JSON.parse(res) 
-                    let html = '';
-                    res.forEach(item => {
-                    html += `<option value="${item.value}">${item.name}</option>`;
-                    })
-                    let select_type = `<select>${html}</select>`
-                    $('#cid').html(select_type);
-                    form.render('select')
+                    selectRes = JSON.parse(res)
+                        let html = '';
+                        selectRes.forEach(item => {
+                            html += `<option value="${item.value}">${item.name}</option>`;
+                        })
+                        let select_type = `<select>${html}</select>`
+                        $('#cid').html(select_type);
+                        let default_cid_type = $('input[name="default_cid_type"]').val()
+                        console.log(default_cid_type, '隐藏');
+                        if (default_cid_type) {
+                            for (let i = 0; i < selectRes.length; i++) {
+                                // let html = '';
+                                 if(selectRes[i].value == default_cid_type) {
+                                    console.log(selectRes[i].value, '接口的valie');
+                                    selectRes[i].selected = true
+                                // html = `<option value="${selectRes[i].value }">${selectRes[i].name }</option>`;
+                                // let select_type = `<select>${html}</select>`
+                                // electRes[i].selected = true
+                                // var select = 'dd[lay-value=' + selectRes[i].value + ']';// 设置value
+                                // $("#cid").find("option[value="+selectRes[i].value+"]").prop("selected",true);
+                                // let as = $('#cid').siblings("div.layui-form-select").find('dl').find(select).click()
+                                form.render('select')
+                        }
+                    }
+                }
+                        form.render('select')
                 })
+                 form.on('select(cid)', function (data) {
+                        let form_type = data.value;
+                        selectValue = data.value
+                        form.render('select')
+
+                    })
             } else {
-                    $('#cid').html('');
-                    form.render('select')
-                }
+                $('#cid').html('');
+                form.render('select')
+            }
             form.on('select(type)', function (data) {
-            let form_type = data.value;
-            selectValue = data.value
-            form.render('select')
+                let form_type = data.value;
+                form.render('select')
                 if (form_type === 'merchant') {
-                $.get('index.php?act=refill_order&op=merchant_data', function(res) {
-                    res = JSON.parse(res) 
-                    let html = '';
-                    res.forEach(item => {
-                    html += `<option value="${item.value}">${item.name}</option>`;
+                    $.get('index.php?act=refill_order&op=merchant_data', function(res) {
+                        res = JSON.parse(res)
+                        let html = '';
+                        res.forEach(item => {
+                            html += `<option value="${item.value}">${item.name}</option>`;
+                        })
+                        let select_type = `<select>${html}</select>`
+                        $('#cid').html(select_type);
+                        form.render('select')
+
                     })
-                    let select_type = `<select>${html}</select>`
-                    $('#cid').html(select_type);
-                    form.render('select')
-                    
-                })
-            } else if (form_type === 'provider'){
-                $.get('index.php?act=refill_order&op=provider_data', function(res) {
-                    res = JSON.parse(res)
-                    selectRes = res 
-                    let html = '';
-                    res.forEach(item => {
-                    html += `<option value="${item.value}">${item.name}</option>`;
+                } else if (form_type === 'provider'){
+                    $.get('index.php?act=refill_order&op=provider_data', function(res) {
+                        res = JSON.parse(res)
+                        let html = '';
+                        res.forEach(item => {
+                            html += `<option value="${item.value}">${item.name}</option>`;
+                        })
+                        let select_type = `<select>${html}</select>`
+                        $('#cid').html(select_type);
+                        form.render('select')
                     })
-                    let select_type = `<select>${html}</select>`
-                    $('#cid').html(select_type);
                     form.on('select(cid)', function (data) {
-                    let form_type = data.value;
-                    console.log('xuang',form_type);
-                    $("#cid dl").find("dd[lay-value=" +form_type+"]").attr("selected",true);
-                    form.render('select')
-                    
-            })
-            form.render('select')
+                        let form_type = data.value;
+                        selectValue = data.value
+                        form.render('select')
 
-                })
-            } else {
+                    })
+                } else {
                     $('#cid').html('');
                     form.render('select')
                 }

+ 12 - 0
helper/refill/api/xyz/jumithird/RefillPhone.php

@@ -43,6 +43,17 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    private function getProductAmount($sys_pcode)
+    {
+        $thrid_refill = Model('thrid_refill');
+        $product = $thrid_refill->getProduct(['system_code' => $sys_pcode]);
+        if (empty($product)) {
+            return false;
+        } else {
+            return $product['refill_amount'];
+        }
+    }
+
     private function req_params(int $phone, int $amount, string $order_sn, string $product_code)
     {
         $params['mch_no'] = config::MCH_ID;
@@ -61,6 +72,7 @@ class RefillPhone extends refill\IRefillPhone
         $goods_id = intval($params['goods_id']);
         $product_code = $this->getProductCode($goods_id, $params['product_code']);
 
+        $amount = $this->getProductAmount($params['product_code']);
         $params = $this->req_params($card_no, $amount, $order_sn, $product_code);
         $sign = $this->sign($params);
         $params['sign'] = $sign;