浏览代码

shop fetch order add param refill_amount

xiaoyu 3 年之前
父节点
当前提交
90169bce95

+ 2 - 2
data/model/fetch_order.model.php

@@ -32,11 +32,11 @@ class fetch_orderModel extends Model
     }
     }
 
 
     //抢单
     //抢单
-    public function fetch($store_id, $member_id, $card_type, $count)
+    public function fetch($store_id, $member_id, $card_type, $count, $refill_amount)
     {
     {
         try {
         try {
             $trans = new trans_wapper($this,__METHOD__);
             $trans = new trans_wapper($this,__METHOD__);
-            $items = $this->where(['fetch_status' => self::FETCH_ORDER_AVALIABLE, 'card_type' => $card_type, 'store_id' => $store_id])
+            $items = $this->where(['fetch_status' => self::FETCH_ORDER_AVALIABLE, 'card_type' => $card_type, 'store_id' => $store_id, 'refill_amount' => $refill_amount])
                 ->limit($count)
                 ->limit($count)
                 ->lock(true)
                 ->lock(true)
                 ->master(true)
                 ->master(true)

+ 9 - 6
shop/control/store_refill_order.php

@@ -45,8 +45,9 @@ class store_refill_ordercontrol extends BaseSellerControl
     {
     {
         $num = intval($_GET['num']);
         $num = intval($_GET['num']);
         $card_type = intval($_GET['card_type']);
         $card_type = intval($_GET['card_type']);
-        if(empty($num) || empty($card_type)) {
-            showDialog('请选择卡类型或抢单数量','index.php?act=store_refill_order&op=index','error');
+        $refill_amount = intval($_GET['refill_amount']);
+        if(empty($num) || empty($card_type) || empty($refill_amount)) {
+            showDialog('请选择卡类型或面值或抢单数量','index.php?act=store_refill_order&op=index','error');
         }
         }
 
 
         $mod = Model('fetch_order');
         $mod = Model('fetch_order');
@@ -57,7 +58,7 @@ class store_refill_ordercontrol extends BaseSellerControl
             showDialog('请先处理未处理的订单','index.php?act=store_refill_order&op=index','error');
             showDialog('请先处理未处理的订单','index.php?act=store_refill_order&op=index','error');
         }
         }
 
 
-        $res = $mod->fetch($store_id, $member_id, $card_type, $num);
+        $res = $mod->fetch($store_id, $member_id, $card_type, $num, $refill_amount);
         if(!empty($res)) {
         if(!empty($res)) {
             showDialog('抢单成功',"index.php?act=store_refill_order&op=index&card_type={$card_type}&num={$num}",'succ');
             showDialog('抢单成功',"index.php?act=store_refill_order&op=index&card_type={$card_type}&num={$num}",'succ');
         } else {
         } else {
@@ -67,12 +68,14 @@ class store_refill_ordercontrol extends BaseSellerControl
 
 
     public function fetch_countOp()
     public function fetch_countOp()
     {
     {
-        $card_type = $_GET['card_type'];
         $mod = Model('fetch_order');
         $mod = Model('fetch_order');
         $condition['store_id'] = $_SESSION['store_id'];
         $condition['store_id'] = $_SESSION['store_id'];
         $condition['fetch_status'] = 1;
         $condition['fetch_status'] = 1;
-        if(!empty($card_type)) {
-            $condition['card_type'] = $card_type;
+        if(!empty($_GET['card_type'])) {
+            $condition['card_type'] = $_GET['card_type'];
+        }
+        if(!empty($_GET['refill_amount'])) {
+            $condition['refill_amount'] = $_GET['refill_amount'];
         }
         }
         $count = $mod->where($condition)->count();
         $count = $mod->where($condition)->count();
         if(empty($count)) {
         if(empty($count)) {

+ 65 - 9
shop/templates/default/seller/store_refill_order.index.php

@@ -57,6 +57,9 @@ a:nth-child(3) {
 .topmar {
 .topmar {
     margin-top: 10px;
     margin-top: 10px;
 }
 }
+#amountright {
+    margin-left: 20px
+}
 </style>
 </style>
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
 <?php defined('InShopNC') or exit('Access Invalid!'); ?>
 
 
@@ -82,6 +85,29 @@ a:nth-child(3) {
         <option value="<?php echo mtopcard\ChinaTelecomCard;?>" <?php if($_GET['card_type'] == mtopcard\ChinaTelecomCard){ echo 'selected';}?>>中国电信</option>
         <option value="<?php echo mtopcard\ChinaTelecomCard;?>" <?php if($_GET['card_type'] == mtopcard\ChinaTelecomCard){ echo 'selected';}?>>中国电信</option>
         </select>
         </select>
     <span>共有<span class="rob"></span>笔订单可抢</span>
     <span>共有<span class="rob"></span>笔订单可抢</span>
+    <select name="refill_amount" id="amountright" class="amountright">
+    <option value="0">面值</option>
+    <option value="10"
+            <?php if ($_GET['refill_amount'] == '10'){ ?>selected<?php } ?>>10</option>
+    <option value="20"
+            <?php if ($_GET['refill_amount'] == '20'){ ?>selected<?php } ?>>20</option>
+    <option value="30"
+            <?php if ($_GET['refill_amount'] == '30'){ ?>selected<?php } ?>>30</option>
+    <option value="50"
+            <?php if ($_GET['refill_amount'] == '50'){ ?>selected<?php } ?>>50</option>
+    <option value="100"
+            <?php if ($_GET['refill_amount'] == '100'){ ?>selected<?php } ?>>100</option>
+    <option value="200"
+            <?php if ($_GET['refill_amount'] == '200'){ ?>selected<?php } ?>>200</option>
+    <option value="300"
+            <?php if ($_GET['refill_amount'] == '300'){ ?>selected<?php } ?>>300</option>
+    <option value="500"
+            <?php if ($_GET['refill_amount'] == '500'){ ?>selected<?php } ?>>500</option>
+    <option value="1000"
+            <?php if ($_GET['refill_amount'] == '1000'){ ?>selected<?php } ?>>1000</option>
+    <option value="2000"
+            <?php if ($_GET['refill_amount'] == '2000'){ ?>selected<?php } ?>>2000</option>
+</select>
     </div>
     </div>
   <div class="flex">
   <div class="flex">
         <p class="flexleft">抢</p>
         <p class="flexleft">抢</p>
@@ -157,10 +183,14 @@ a:nth-child(3) {
 <script>
 <script>
     $(function () {
     $(function () {
         let value_robb = $('.tabmenuright').val()
         let value_robb = $('.tabmenuright').val()
-        
+        let face_val = $('.amountright').val()
+        // console.log("wo",value_robb);
+        // console.log(145, face_val);
+
 
 
     $.get('index.php?act=store_refill_order&op=fetch_count',{
     $.get('index.php?act=store_refill_order&op=fetch_count',{
-        card_type:value_robb
+        card_type:value_robb,
+        refill_amount:face_val
     },function(data) {
     },function(data) {
                data = JSON.parse(data)
                data = JSON.parse(data)
                 console.log("默认",data);
                 console.log("默认",data);
@@ -174,8 +204,32 @@ a:nth-child(3) {
             $('#tabmenuright').click(function() {
             $('#tabmenuright').click(function() {
                     let value_rob = $(this).val()
                     let value_rob = $(this).val()
                     let value_ro = $("#tabmenuright  option:selected").text()
                     let value_ro = $("#tabmenuright  option:selected").text()
+                    let face_val = $('#amountright').val()
+
             $.get('index.php?act=store_refill_order&op=fetch_count',{
             $.get('index.php?act=store_refill_order&op=fetch_count',{
-                card_type:value_rob
+                card_type:value_rob,
+                refill_amount:face_val
+
+            },function(data) {
+                    data = JSON.parse(data)
+                
+                if (data.code == 200) {
+                    const value_1 = data.count
+                    $('.rob').text(value_1)
+                } 
+                })
+        })
+        $('#amountright').click(function() {
+      
+                    let face_val = $(this).val()
+                    let value_rob = $('#tabmenuright').val()
+                    // console.log("wowo", face_val);
+                    // console.log("caca", value_rob);
+
+            $.get('index.php?act=store_refill_order&op=fetch_count',{
+                card_type:value_rob,
+                refill_amount:face_val
+
             },function(data) {
             },function(data) {
                     data = JSON.parse(data)
                     data = JSON.parse(data)
                 
                 
@@ -195,7 +249,7 @@ a:nth-child(3) {
             let num = 900 - (timestamp - datetime)
             let num = 900 - (timestamp - datetime)
        
        
              
              
-             console.log(num1.push(num));
+            //  console.log(num1.push(num));
             
             
             let timer = setInterval(function () {
             let timer = setInterval(function () {
                 num--;
                 num--;
@@ -209,7 +263,7 @@ a:nth-child(3) {
                     $(item).text(0);
                     $(item).text(0);
                     $(item).css('color', 'red')
                     $(item).css('color', 'red')
 
 
-                    console.log(111);
+                    // console.log(111);
 
 
                 }
                 }
             }, 1000) 
             }, 1000) 
@@ -223,7 +277,7 @@ a:nth-child(3) {
                 card_type:value_rob
                 card_type:value_rob
             },function(data) {
             },function(data) {
                     data = JSON.parse(data)
                     data = JSON.parse(data)
-                    console.log(data);
+                    // console.log(data);
                     if (data.count == 0)
                     if (data.count == 0)
                     layer.msg('该卡类型无单可抢');
                     layer.msg('该卡类型无单可抢');
                
                
@@ -233,6 +287,8 @@ a:nth-child(3) {
         $('#blockrob').click(() =>{
         $('#blockrob').click(() =>{
             let value_rob = $("#tabmenuright").val()
             let value_rob = $("#tabmenuright").val()
             let queryrob_val  = $("#queryrob").val()
             let queryrob_val  = $("#queryrob").val()
+            let face_val = $('#amountright').val()
+            console.log(face_val);
             $.get('index.php?act=store_refill_order&op=fetch_count',{
             $.get('index.php?act=store_refill_order&op=fetch_count',{
                 card_type:value_rob
                 card_type:value_rob
             },function(data) {
             },function(data) {
@@ -244,12 +300,12 @@ a:nth-child(3) {
                     console.log("dang3",data_ro);
                     console.log("dang3",data_ro);
                 if (data.count == 0) {
                 if (data.count == 0) {
                     layer.msg('暂无订单可抢');
                     layer.msg('暂无订单可抢');
-                } else if (value_rob != 0 && queryrob_val!= 0 && data.count!= 0) {
+                } else if (value_rob != 0 && queryrob_val!= 0 && data.count!= 0 && face_val !=0) {
                     $('.rob').text(data_ro)
                     $('.rob').text(data_ro)
-                    window.location.href = `index.php?act=store_refill_order&op=fetch_order&num= ${queryrob_val}&card_type= ${value_rob}`
+                    window.location.href = `index.php?act=store_refill_order&op=fetch_order&num= ${queryrob_val}&card_type= ${value_rob}&refill_amount= ${face_val}`
                     console.log("nian", data.cound);
                     console.log("nian", data.cound);
                 } else {
                 } else {
-                    layer.msg('请选择卡类型以及单数');
+                    layer.msg('请选择卡类型以及单数 面额');
                 }
                 }
                 })  
                 })  
             })
             })