rabin 2 years ago
parent
commit
dbf85c9de0
2 changed files with 28 additions and 1 deletions
  1. 19 0
      app/shop/database/info.php
  2. 9 1
      service/agent/src/My.php

+ 19 - 0
app/shop/database/info.php

@@ -20,6 +20,12 @@ $invoice = array
     2 => '不可以开发票',
 );
 
+$is_agent = array
+(
+    1 => '代理商可以归店',
+    2 => '代理商不可以归店',
+);
+
 $col = 'id,name,`desc`,ps_cash,free_ps_cash,truename,mobile,lng,lat,address,open,worktime,method,gotime,city,area,province,county,town,coupon_city,pdesc,license,food_license,jy_license,license_number,company_name,coord_address,invoice,type,mid,sid';
 
 $act = function()
@@ -499,6 +505,18 @@ return array
             'option'    => $invoice,
         ),
 
+        'is_agent'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '是否可以归店',
+            'default'   => '1',
+            'desc'      => '是否可以归店',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'value'     => '2',
+            'option'    => $is_agent,
+        ),
+
         'coupon_city'        => array
         (
             'type'      => 'int-11',
@@ -773,6 +791,7 @@ return array
             'option' => array
             (
                 'town' => 'yes',
+                'is_agent' => 'yes',
                 'area' => array('yes', 'like'),
                 'state' => 1,
             ),

+ 9 - 1
service/agent/src/My.php

@@ -133,6 +133,7 @@ class My extends Core
     {
         $where['type'] = 10;
         $where['area'] = Dever::input('area');
+        $where['is_agent'] = 1;
         $this->data['shop'] = Dever::db('shop/info')->getAllByType($where);
 
         //$this->data['pshop'] = Dever::db('shop/info')->getInfo(array('type' => 10));
@@ -155,6 +156,13 @@ class My extends Core
     {
         $id = Dever::input('id', $this->uid);
         $shop_id = Dever::input('shop_id');
+        $shop = Dever::db('shop/info')->find($shop_id);
+        if (!$shop) {
+            Dever::alert('该门店无法归店');
+        }
+        if ($shop && $shop['is_agent'] == 2) {
+            Dever::alert('该门店无法归店');
+        }
         $this->data['info'] = Dever::db('agent/member')->find($id);
         if ($this->data['info'] && $this->data['info']['idcard'] == $this->user['idcard']) {
             Dever::db('agent/member')->update(array('where_id' => $id, 'shop_id' => $shop_id, 'is_shop' => 1));
@@ -412,7 +420,7 @@ class My extends Core
                 $update['area'] = $area;
             }
 
-            $update += Dever::load('agent/lib/order')->getPrice($this->user);
+            //$update += Dever::load('agent/lib/order')->getPrice($this->user);
 
             if ($info['pay_type'] == 2) {
                 $update['pay_pic'] = Dever::input('pay_pic');