Browse Source

fetch order

xiaoyu 3 years ago
parent
commit
f2d2aa4485

+ 7 - 3
shop/control/store_refill_order.php

@@ -10,8 +10,9 @@
 defined('InShopNC') or exit('Access Invalid!');
 require_once(BASE_HELPER_PATH . '/vrorder_helper.php');
 require_once(BASE_CORE_PATH . '/framework/function/http.php');
+require_once(BASE_HELPER_PATH . '/refill/util.php');
 
-
+use refill\util;
 class store_refill_ordercontrol extends BaseSellerControl
 {
     public function __construct()
@@ -48,6 +49,9 @@ class store_refill_ordercontrol extends BaseSellerControl
     {
         $num = intval($_GET['num']);
         $card_type = intval($_GET['card_type']);
+        if(empty($num) || empty($card_type)) {
+            showDialog('请选择卡类型或抢单数量','index.php?act=store_refill_order&op=index','error');
+        }
         $mod = Model('fetch_order');
         $member_id = $_SESSION['member_id'];
         $store_id = $_SESSION['store_id'];
@@ -101,8 +105,8 @@ class store_refill_ordercontrol extends BaseSellerControl
             $params = ['state' => $state_type,
                 'order_sn' => $fetch_order['order_sn'],
                 'official_sn' => $official_sn];
-            Log::record("state: {$state_type}, order_sn: {$fetch_order['order_sn']}, official_sn: {$official_sn}");
-//            refill\util::push_notify($fetch_order['channel_name'],$params);
+            Log::record("state: {$state_type}, order_sn: {$fetch_order['order_sn']}, official_sn: {$official_sn}", Log::DEBUG);
+            refill\util::push_notify($fetch_order['channel_name'],$params);
             $mod->processed($fetch_id,$state_type,$official_sn);
             showDialog("成功", 'reload', 'js');
             exit();

+ 26 - 4
shop/templates/default/seller/store_refill_order.index.php

@@ -60,7 +60,7 @@ a:nth-child(3) {
 <div class="tabmenu">
     <div>
     <select name="" id="tabmenuright" class="tabmenuright">
-        <option value="0">请选择</option>
+        <option value="0">卡类型</option>
         <option value="<?php echo mtopcard\PetroChinaCard;?>">中石油</option>
         <option value="<?php echo mtopcard\SinopecCard;?>">中石化</option>
         <option value="<?php echo mtopcard\ChinaMobileCard;?>">中国移动</option>
@@ -151,14 +151,36 @@ a:nth-child(3) {
                 })
         })
         //抢单
+        $('#queryrob').click(() => {
+            let value_rob = $("#tabmenuright").val()
 
+            $.get('index.php?act=store_refill_order&op=fetch_count',{
+                card_type:value_rob
+            },function(data) {
+                    data = JSON.parse(data)
+                    console.log(data);
+                    if (data.count == 0)
+                    layer.msg('该卡类型无单可抢');
+               
+           
+                })
+        })
         $('#blockrob').click(() =>{
             let value_rob = $("#tabmenuright").val()
             let queryrob_val  = $("#queryrob").val()
+            $.get('index.php?act=store_refill_order&op=fetch_count',{
+                card_type:value_rob
+            },function(data) {
+                    data = JSON.parse(data)
                 
-                console.log("124",queryrob_val, value_rob);
-                window.location.href = `index.php?act=store_refill_order&op=fetch_order&num= ${queryrob_val}&card_type= ${value_rob}`
-                // window.location.href = "javascript:void(0)"
+                if (data.count == 0) {
+                    layer.msg('暂无订单可抢');
+                } else if (value_rob != 0 && queryrob_val!= 0 && data.count!= 0) {
+                    window.location.href = `index.php?act=store_refill_order&op=fetch_order&num= ${queryrob_val}&card_type= ${value_rob}`
+                } else {
+                    layer.msg('请选择卡类型以及单数');
+                }
+                })  
             })