Explorar el Código

Merge branch 'master' of http://124.222.171.90:10880/Teapay/RWACha-API

* 'master' of http://124.222.171.90:10880/Teapay/RWACha-API:
  查看快递信息
  快递发货
  赠送判断
  订单
  资产信息
  赠送说明
  赠送
  地区选择
jason hace 10 meses
padre
commit
a067eb6e59

+ 62 - 3
application/admin/controller/offline/Order.php

@@ -3,7 +3,11 @@
 namespace app\admin\controller\offline;
 
 use app\common\controller\Backend;
-
+use Exception;
+use think\Db;
+use app\common\model\UserArea;
+use think\exception\DbException;
+use think\exception\ValidateException;
 /**
  * 订单管理
  *
@@ -22,7 +26,6 @@ class Order extends Backend
     {
         parent::_initialize();
         $this->model = new \app\common\model\ProductOrder();
-
     }
 
     /**
@@ -49,7 +52,7 @@ class Order extends Backend
             return $this->selectpage();
         }
         [$where, $sort, $order, $offset, $limit] = $this->buildparams();
-        $list = $this->model->with('users,products,areas')
+        $list = $this->model->with('users,products,areas,address')
             ->where($where)
             ->order($sort, $order)
             ->paginate($limit);
@@ -57,4 +60,60 @@ class Order extends Backend
         return json($result);
     }
 
+
+    /**
+     * 发货
+     * @param $ids
+     * @return string|void
+     * @throws \think\Exception
+     * @throws \think\exception\DbException
+     */
+    public function shipping($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+ 
+        if (false === $this->request->isPost()) {
+            
+            $area = UserArea::where('order_id', $ids)->find();
+            $this->view->assign('row', $row);
+            $this->view->assign('area', $area);
+            return $this->view->fetch();
+        }
+
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        try {
+            //是否采用模型验证
+            if ($this->modelValidate) {
+                $name     = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                $row->validateFailException()->validate($validate);
+            }
+            if(empty($params['tracking_no'])) throw new ValidateException('请添加快递单号');
+            $result = UserArea::where('id', $params['area_id'])->where('status', UserArea::Waiting)->update([
+                'status'        => UserArea::Shipped,
+                'tracking_no'   => $params['tracking_no']
+            ]);
+            Db::commit();
+        } catch (\Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
 }

+ 8 - 15
application/admin/controller/product/Lists.php

@@ -131,8 +131,7 @@ class Lists extends Backend
             $this->error(__('You have no permission'));
         }
         if (false === $this->request->isPost()) {
-
-            $area = $this->productArea::where('product_id', $ids)->select();
+            $area = $this->productArea::where('product_id', $ids)->where('status', 1)->select();
             $areaCode = array();
             $areaTxt = array();
             foreach ($area as $key =>$item) {
@@ -142,9 +141,6 @@ class Lists extends Backend
                 if($item->county > 0)   $areaCode[$key][3] = $item->county;
                 $areaTxt[]  = [$item->address];
             }
-
-
-    
             $areaCode = json_encode($areaCode);
             $this->assignconfig('areaCode', $areaCode);
             $this->view->assign('row', $row);
@@ -167,18 +163,15 @@ class Lists extends Backend
                 $row->validateFailException()->validate($validate);
             }
             
-            $areaArr = json_decode($params['product_area'], true);
-            if(empty($areaArr)) throw new ValidateException('请添加商品关联地区');
-            if(self::isEqualArea($areaArr) == false) throw new ValidateException('该商品地区存在重复');
-            unset($params['product_area']);
+            $areaArr    = json_decode($params['product_area'], true);
+            $areaArrTxt = json_decode($params['product_area_txt'], true);
+            if(empty($areaArr) || empty($areaArrTxt)) throw new ValidateException('请添加商品关联地区');
+            unset($params['product_area'], $params['product_area_txt']);
 
             $row->allowField(true)->save($params);
-            $this->productArea::where('product_id', $ids)->delete();
-            foreach ($areaArr as $row) {
-                $row = (array)$row;
-                $row['product_id'] = $ids;
-                $result = $this->productArea::create($row);
-            }
+            $this->productArea::where('product_id', $ids)->where('status', 1)->delete();
+           
+            $result= $this->setEqualArea($ids, $areaArr, $areaArrTxt);
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {
             Db::rollback();

+ 1 - 0
application/admin/lang/zh-cn/general/config.php

@@ -87,4 +87,5 @@ return [
     'Direct income'                        => '直推收益',
     'Withdraw min amount'                  => '最小提现额',
     'Convert rate'                         => '折合Cny率',
+    'Giveaway'                             => '赠送手续费'
 ];

+ 1 - 1
application/admin/lang/zh-cn/offline/order.php

@@ -2,7 +2,7 @@
 
 return [
     'Id'          => 'ID',
-    'Order_id'    => '来源ID',
+    'Order_id'    => '来源订单ID',
     'User_id'     => '用户',
     'Product_id'  => '关联产品',
     'Area_id'     => '区域',

+ 45 - 0
application/admin/view/offline/order/shipping.html

@@ -0,0 +1,45 @@
+<form id="edit-form"  role="form" data-toggle="validator" method="POST" action="">
+      <div class="form-horizontal">
+      <div class="form-group">
+            <label class="control-label col-xs-12 col-sm-2">用户ID:</label>
+            <div class="col-xs-12 col-sm-8">
+                  <label class="control-label col-xs-12 col-sm-2">{$row.user_id}</label>
+            </div>
+      </div>
+      <div class="form-group">
+            <label class="control-label col-xs-12 col-sm-2">姓名:</label>
+            <div class="col-xs-12 col-sm-8">
+                  <label class="control-label col-xs-12 col-sm-2" tyle="text-align: left">{$area.name}</label>
+            </div>
+      </div>
+      <div class="form-group">
+            <label class="control-label col-xs-12 col-sm-2">手机号:</label>
+            <div class="col-xs-12 col-sm-8">
+                  <label class="control-label col-xs-12 col-sm-2" tyle="text-align: left">{$area.phone}</label>
+            </div>
+      </div>
+      <div class="form-group">
+          <label class="control-label col-xs-12 col-sm-2">收货地址:</label>
+          <div class="col-xs-12 col-sm-8">
+              <label class="control-label col-xs-12 col-sm-8" style="text-align: left;">{$area.address}</label>
+          </div>
+      </div>
+  
+      <div class="form-group">
+          <label class="control-label col-xs-12 col-sm-2">物流单号:</label>
+          <div class="col-xs-12 col-sm-8">
+              <input id="c-tracking_no" data-rule="required" class="form-control"  name="row[tracking_no]" type="text" value="{$area.tracking_no|htmlentities}">
+              <input type="hidden" name="row[area_id]" value="{$area.id}"/>
+          </div>
+      </div>
+  
+      <div class="form-group layer-footer">
+          <label class="control-label col-xs-12 col-sm-2"></label>
+          <div class="col-xs-12 col-sm-8">
+              <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+              <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+          </div>
+      </div>
+    </div>
+</form>
+  

+ 2 - 2
application/admin/view/product/lists/edit.html

@@ -62,8 +62,8 @@
                 @change="handleChange"
                 ref="ca"
                 clearable></el-cascader-panel>
-                <input id="c-product_area" class="form-control" name="row[product_area]" type="hidden" value="{$row.details|htmlentities}">
-                <input id="c-product_area_txt" class="form-control" name="row[product_area_txt]" type="hidden" value="{$row.details|htmlentities}">
+                <input id="c-product_area" class="form-control" name="row[product_area]" type="hidden" value="{$areaCode|htmlentities}">
+                <input id="c-product_area_txt" class="form-control" name="row[product_area_txt]" type="hidden" value="{$areaTxt|htmlentities}">
             </div>
         </div>    
     </div>

+ 6 - 6
application/api/controller/Ledger.php

@@ -28,13 +28,14 @@ class Ledger extends Api
      */
     public function assets()
     {
-        
         $chabao = LedgerWalletModel::getWalletChaBao($this->auth->id);
         $res['assets']       = $chabao;
-        $res['chabao_rate']  = getConfig('chabao_rate'); //茶宝汇率
-        $res['withdrawal_fee']= getConfig('withdrawal_fee'); //提现收费
-        $res['transfes_fee']  = getConfig('transfer_fee'); //转让手续费比例
-        $res['transfes_txt']  = config('transfes_txt'); //转让文字表述
+        $res['chabao_rate']  = getConfig('chabao_rate');    //茶宝汇率
+        $res['withdrawal_fee']= getConfig('withdrawal_fee');//提现收费
+        $res['transfes_fee']  = getConfig('transfer_fee');  //转让手续费比例
+        $res['transfes_txt']  = config('transfes_txt');     //转让文字表述
+        $res['giveaway']      = getConfig('giveaway');      //赠送手续费比例
+        $res['giveaway_txt']  = getConfig('giveaway_txt');  //赠送文字表述
         $res['coin_list'] = [
             [
                 'coin_name' => '茶宝',
@@ -104,7 +105,6 @@ class Ledger extends Api
             }
         }
         $res = $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items());
-
         $this->success('',$res);
     }
     /**

+ 71 - 8
application/api/controller/Order.php

@@ -50,14 +50,13 @@ class Order extends Api
             if(bccomp($order_info['price'], $amount, 2) > 0) throw new Exception(__("余额不足请前往充值"));
             if($order_info->stock == 0 || time() >= $order_info->end_time) throw new Exception(__("抢购已结束"));
             // 生成订单
-            $order =$productOrder->create($order_data);
+            $productOrder->create($order_data);
 
             //修改区域状态
             $productLists->where('id', $order_data['area_id'])->update(['status'=> $productLists::STOP]);
 
             //余额记录
             $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info['price'], $ledgerWalletModel::Popular, $this->auth->id);
-
             //扣除库存
             if($order_info->stock == 1 || time() >= $order_info->end_time) $order_info->status= $productPopular::STOP;
             $order_info->num  += 1;
@@ -82,7 +81,6 @@ class Order extends Api
         $params = $this->request->post();
         $validate = \think\Loader::validate('Order');
         if(!$validate->scene('pick')->check($params)) $this->error($validate->getError());
-        
         $order_info = $productOrder->where('id', $params['order_id'])->find();
         if(empty($order_info)) $this->error( __("参数有误,无可用产品"));
         $order_data['name']     = $params['name'];
@@ -94,7 +92,6 @@ class Order extends Api
         try {
             // 生成订单
             $userArea->create($order_data);
-
             $order_info->status= $productOrder::Shipped; 
             $order_info->save();
             // 提交事务
@@ -135,7 +132,6 @@ class Order extends Api
             
             // 生成订单
             $productTransfer->create($order_data);
-           
             //修改状态
             $order_info->status = $productOrder::Transferred;
             $order_info->save();
@@ -172,11 +168,13 @@ class Order extends Api
             $order_data['area_id']   = $order_info['area_id'];
             $order_data['order_no']  = getOrderSN('Z');
             $order_data['user_id']   = $this->auth->id;
+            $order_data['from_user'] = $order_info['user_id'];
             $order_data['price']     = $order_info['price'];
+            $order_data['fees']      = $order_info['fees'];
             $order_data['num']       = 1;
             
             // 生成订单
-            $order = $productOrder->create($order_data);
+            $productOrder->create($order_data);
             //扣除余额记录 
             $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$order_info['price'], $ledgerWalletModel::Payment, $order_info['user_id']);
           
@@ -186,7 +184,7 @@ class Order extends Api
             $ledgerWalletModel->changeWalletAccount($order_info['user_id'], Asset::TOKEN, $amount, $ledgerWalletModel::Receive, $this->auth->id);
 
             //修改原订单状态
-            $productOrder->where('id', $order_info['order_id'])->setField('status', $productOrder::Complete);    
+            $productOrder->where('id', $order_info['order_id'])->setField('status', $productOrder::Closure);    
             //修改状态
             $order_info->status = $productTransfer::STOP;
             $order_info->save();
@@ -198,6 +196,59 @@ class Order extends Api
         $this->success('ok');
     }
 
+    //赠送
+    public function giveaway(ProductOrder $productOrder, UserModel $userModel, LedgerWalletModel $ledgerWalletModel)
+    {
+        $params = $this->request->post();
+        $validate = \think\Loader::validate('Order');
+        if(!$validate->scene('giv')->check($params)) $this->error($validate->getError());
+
+        // 启动事务
+        Db::startTrans();
+         try {
+            $order_info = $productOrder->where('id', $params['order_id'])->where('status', $productOrder::Paid)->find();
+            if(empty($order_info)) throw new Exception(__("参数有误,无可用产品"));
+
+            $user = $userModel->getByAddress($params['address']);
+            if(empty($user)) throw new Exception(__("赠送用户不存在"));    
+            if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));  
+
+            $chabao = $ledgerWalletModel::getWalletChaBao($this->auth->id);
+            $fees   = bcmul($order_info['price'], getConfig('giveaway'), 2);   
+            if(bccomp($fees, $chabao, 2) > 0) throw new Exception(__("余额不足请前往充值"));
+     
+            //添加记录
+            $order_data['order_id']  = $params['order_id'];
+            $order_data['product_id']= $order_info['product_id'];
+            $order_data['type_id']   = $productOrder::Giveaway;
+            $order_data['status']    = $productOrder::Paid;
+            $order_data['area_id']   = $order_info['area_id'];
+            $order_data['order_no']  = getOrderSN('G');
+            $order_data['user_id']   = $user['id'];
+            $order_data['from_user'] = $this->auth->id;
+            $order_data['price']     = $order_info['price'];
+            $order_data['fees']      = $fees;
+            $order_data['num']       = 1;
+
+            $productOrder::create($order_data);
+
+            //扣除手续费
+            $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$fees, $ledgerWalletModel::Giveaway, $user['id']);
+
+            $order_info->status= $productOrder::Closure; 
+            $order_info->save();
+
+            // 提交事务
+            Db::commit();
+        } catch (Exception $e) {
+            // 回滚事务
+            Db::rollback();
+            $this->error( $e->getMessage());
+        }
+        $this->success('ok');
+    }
+
+
     //取消转让 
     public function cancel(ProductOrder $productOrder, ProductTransfer $productTransfer)
     {
@@ -209,7 +260,7 @@ class Order extends Api
         Db::startTrans();
         try {
             $order_info = $productOrder->where('id', $params['order_id'])->find();
-            if(empty($order_info)) throw new Exception( __("参数有误,无可用产品"));
+            if(empty($order_info)) throw new Exception(__("参数有误,无可用产品"));
 
             //转让列表取消
             $productTransfer::where('order_id',$params['order_id'])->setField('status', $productTransfer::STOP);
@@ -225,6 +276,18 @@ class Order extends Api
         $this->success('ok');
     }
 
+    //查看快递信息
+    public function getTracking(UserArea $userArea)
+    {
+        $order_id    = $this->request->post('order_id'); // 订单id
+        if(empty($order_id)) $this->error(__("参数有误,无可用产品"));
+
+        $tracking_no = $userArea->where('order_id', $order_id)->value('tracking_no');
+        if(empty($tracking_no)) $this->error(__("暂无物流信息"));
+
+        $this->success('ok', $tracking_no);
+    }
+
 
     /**
      * 更新订单hash

+ 1 - 0
application/api/controller/Product.php

@@ -70,5 +70,6 @@ class Product extends Api
     }
 
 
+
 }
 

+ 5 - 1
application/api/lang/en/order.php

@@ -12,7 +12,11 @@ return [
       '已转让'                                => 'Transferred',
       '已发货'                                => 'Shipped',
       '已取消'                                => 'Cancelled',
-      '已完成'                                => 'Completed',
+      '赠送'                                  => 'Giveaway',
+      '关闭'                                  => 'Closure',
+      '赠送用户不存在'                         => 'The gift user does not exist',
+      '赠送用户不能是自己'                     => 'The user who sends the gift cannot be yourself',
+      '暂无物流信息'                           => 'No logistics information',
 
 
 

+ 1 - 0
application/api/lang/en/user.php

@@ -43,4 +43,5 @@ return [
     '提现'                                   => 'Withdraw',
     '分享'                                   => 'Share',
     '退回'                                   => 'Return',
+    '赠送'                                   => 'Gift fee',
 ];

+ 6 - 2
application/api/lang/zh-cn/order.php

@@ -10,8 +10,12 @@ return [
       '已下单'                => '已下单',
       '已付款'                => '已付款',
       '已转让'                => '已转让',
-      '已发货'                => '已发货',
+      '提货'                  => '提货',
       '已取消'                => '已取消',
-      '已完成'                => '已完成'
+      '赠送'                  => '赠送',
+      '关闭'                  => '关闭',
+      '赠送用户不存在'         => '赠送用户不存在',
+      '赠送用户不能是自己'      => '赠送用户不能是自己',
+      '暂无物流信息'             => '暂无物流信息',
       
 ];

+ 1 - 0
application/api/lang/zh-cn/user.php

@@ -43,4 +43,5 @@ return [
     '提现'                                  => '提现',
     '分享'                                  => '分享',
     '退回'                                  => '退回',
+    '赠送'                                  => '赠送手续费',
 ];

+ 2 - 1
application/api/validate/Order.php

@@ -40,7 +40,8 @@ class Order extends Validate
         'add'  => ['order_id', 'product_id', 'area_id'],
         'pick' => ['order_id'],
         'tran' => ['price', 'order_id'],
-        'out'  => ['order_id']
+        'out'  => ['order_id'],
+        'giv'  => ['order_id', 'address'],
     ];
   
 }

+ 4 - 3
application/common/model/LedgerWalletModel.php

@@ -24,7 +24,7 @@ class LedgerWalletModel extends Model
     protected $updateTime = 'update_time';
     protected $deleteTime = false;
 
-    //0支付 1转让支付 2 转让收款 3 充值 4 提现
+    //0支付 1转让支付 2 转让收款 3 充值 4 提现 5扣除书续费
     const Popular           = 0;
     const Payment           = 1;
     const Receive           = 2;
@@ -32,7 +32,7 @@ class LedgerWalletModel extends Model
     const Withdraw          = 4;
     const Share             = 5;
     const Return            = 6;
-
+    const Giveaway          = 7;
     /*
      * 支付状态
      * 0未支付 100支付中 200支付成功 400支付失败
@@ -46,6 +46,7 @@ class LedgerWalletModel extends Model
         self::Withdraw          => '提现',
         self::Share             => '分享',
         self::Return            => '退回',
+        self::Giveaway          => '赠送手续费',
     ];
 
 
@@ -75,7 +76,7 @@ class LedgerWalletModel extends Model
     public static function getStatusList()
     {
         return [self::Popular => __('热销支付'), self::Payment  => __('转让支付'), self::Receive => __('转让收款'), self::Recharge => __('充值'), 
-        self::Withdraw  => __('提现'), self::Share => __('分享'), self::Return => __('退回')];
+        self::Withdraw  => __('提现'), self::Share => __('分享'), self::Return => __('退回'), self::Giveaway => __('赠送')];
     }
 
     /**

+ 14 - 6
application/common/model/ProductOrder.php

@@ -31,27 +31,28 @@ class ProductOrder extends Model
     const Transferred       = 2;
     const Shipped           = 3;
     const Cancelled         = 4;
-    const Complete          = 5;
+    const Closure           = 5;
 
     const Popular           = 0;
     const Transfer          = 1;
-
+    const Giveaway          = 2;
     /* 
-     *  订单状态 '已下单', 1=>'已付款', 2=>'已转让', 3=>'已发货', 4=>'已取消', 5=>'完成'];
+     *  订单状态 '已下单', 1=>'已付款', 2=>'已转让', 3=>'货', 4=>'已取消', 5=>'完成'];
      */
     public $order_status = [
         '-1'                    => '全部',
         self::Ordered           => '已下单',
         self::Paid              => '已付款',
         self::Transferred       => '已转让',
-        self::Shipped           => '已发货',
+        self::Shipped           => '货',
         self::Cancelled         => '已取消',
-        self::Complete          => '完成',
+        self::Closure           => '关闭',
     ];
 
     public static function getStatusList()
     {
-        return [self::Ordered => __('已下单'), self::Paid  => __('已付款'), self::Transferred => __('已转让'), self::Shipped => __('已发货'), self::Cancelled  => __('已取消'), self::Complete => __('已完成')];
+        return [self::Ordered => __('已下单'), self::Paid  => __('已付款'), self::Transferred => __('已转让'), 
+        self::Shipped => __('提货'), self::Cancelled  => __('已取消'), self::Closure => __('关闭')];
     }
 
     //产品
@@ -73,6 +74,13 @@ class ProductOrder extends Model
         return $this->hasOne('ProductArea', 'id', 'area_id', [], 'LEFT')->setEagerlyType(0);
     }
     
+   
+    //提货地址
+    public function address()
+    {
+        return $this->hasOne('UserArea', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 13 - 2
application/common/model/UserArea.php

@@ -23,9 +23,20 @@ class UserArea  extends Model
     ];
 
 
-     
-
+    const Waiting           = 0;
+    const Shipped           = 1;
+    const Finish            = 2;
+    /* 
+     *  订单状态  0代发货  1已发货 2完成
+     */
+    public $order_status = [
+        '-1'                    => '全部',
+        self::Waiting           => '待发货',
+        self::Shipped           => '已发货',
+        self::Finish            => '完成'
+    ];
 
+    
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 1 - 0
public/assets/js/backend/ledger/ledger_token_change.js

@@ -41,6 +41,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                 4: '充值',
                                 5: '分享',
                                 6: '提现退回',
+                                7: '赠送手续费',
                             }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
                         },
                     ]

+ 28 - 4
public/assets/js/backend/offline/order.js

@@ -30,12 +30,32 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'order_id', title: __('Order_id'), operate: false},
                         {field: 'products.zh_name', title: __('Product_id'),operate:'LIKE'},
                         {field: 'areas.address', title: __('Area_id')},
-                        {field: 'type_id', title: __('Type_id'), searchList: {0:__('热销'), 1:__('转让')}, formatter: Table.api.formatter.status},
+                        {field: 'type_id', title: __('Type_id'), searchList: {0:__('热销'), 1:__('转让'), 2:__('赠送')}, formatter: Table.api.formatter.label},
+                        {field: 'from_user', title: __('来源用户Id'), operate:false},
                         {field: 'price', title: __('Price'), operate:false},
-                        {field: 'status', title: __('Status'), searchList: {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('发货'), 4:__('取消'), 5:__('完成')}, formatter: Table.api.formatter.status},
+                        {field: 'fees', title: __('手续费'), operate:false},
+                        {field: 'status', title: __('Status'), searchList: {0:__('已下单'), 1:__('支付'), 2:__('转让'), 3:__('提货'), 4:__('取消'), 5:__('关闭')},formatter: Table.api.formatter.status},
+                        {field: 'address.address', title: __('提货地址'), operate:false},
+                        {field: 'address.status', title: __('发货状态'), searchList: {0:__('待发货'), 1:__('已发货'), 2:__('已完成')}, formatter: Table.api.formatter.flag},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {
+                            field: 'operate', title: __('Operate'), table: table,
+                            events: Table.api.events.operate,
+                            buttons: [{
+                                name: 'shipping',
+                                text: '发货',
+                                title: '发货',
+                                classname: 'btn btn-xs btn-primary btn-dialog btn-receivable',
+                                icon: 'fa fa-keyboard-o',
+                                url: 'offline/order/shipping',
+                                //extend: 'data-area=\'["50%", "50%"]\'',
+                                visible: function (row) {
+                                    if(row.status == 3)  return true;
+                                    return false;
+                                }
+                            },],
+                            formatter: Table.api.formatter.operate
+                        }
                     ]
                 ]
             });
@@ -43,6 +63,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
+
+        shipping: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));

+ 0 - 49
public/assets/js/backend/product/json/area.js

@@ -1,49 +0,0 @@
-export let area= [
-      {
-      value: 1,
-      label: '东南',
-      children: [{
-  value: 2,
-  label: '上海',
-  children: [
-    { value: 3, label: '普陀' },
-    { value: 4, label: '黄埔' },
-    { value: 5, label: '徐汇' }
-  ]
-}, {
-  value: 7,
-  label: '江苏',
-  children: [
-    { value: 8, label: '南京' },
-    { value: 9, label: '苏州' },
-    { value: 10, label: '无锡' }
-  ]
-}, {
-  value: 12,
-  label: '浙江',
-  children: [
-    { value: 13, label: '杭州'},
-    { value: 14, label: '宁波' },
-    { value: 15, label: '嘉兴' }
-  ]
-}]
-},
-{
-value: 17,
-label: '西北',
-children: [{
-  value: 18,
-  label: '陕西',
-  children: [
-    { value: 19, label: '西安' },
-    { value: 20, label: '延安' }
-  ]
-}, {
-  value: 21,
-  label: '新疆维吾尔族自治区',
-  children: [
-    { value: 22, label: '乌鲁木齐' },
-    { value: 23, label: '克拉玛依' }
-  ]
-}]
-}]

+ 0 - 4
public/assets/js/backend/product/lists.js

@@ -1,7 +1,3 @@
-
-//public\assets\json\area.js
-//import {area } from "./json/area.js"
-
 define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'area','vue', 'ELEMENT'], function ($, undefined, Backend, Table, Form, Area, Vue, ELEMENT) {
     ELEMENT.install(Vue)
     Vue.use(ELEMENT)

+ 0 - 49
public/assets/libs/area/area1.js

@@ -1,49 +0,0 @@
- let area= [
-      {
-      value: 1,
-      label: '东南1',
-      children: [{
-  value: 2,
-  label: '上海',
-  children: [
-    { value: 3, label: '普陀' },
-    { value: 4, label: '黄埔' },
-    { value: 5, label: '徐汇' }
-  ]
-}, {
-  value: 7,
-  label: '江苏',
-  children: [
-    { value: 8, label: '南京' },
-    { value: 9, label: '苏州' },
-    { value: 10, label: '无锡' }
-  ]
-}, {
-  value: 12,
-  label: '浙江',
-  children: [
-    { value: 13, label: '杭州'},
-    { value: 14, label: '宁波' },
-    { value: 15, label: '嘉兴' }
-  ]
-}]
-},
-{
-value: 17,
-label: '西北',
-children: [{
-  value: 18,
-  label: '陕西',
-  children: [
-    { value: 19, label: '西安' },
-    { value: 20, label: '延安' }
-  ]
-}, {
-  value: 21,
-  label: '新疆维吾尔族自治区',
-  children: [
-    { value: 22, label: '乌鲁木齐' },
-    { value: 23, label: '克拉玛依' }
-  ]
-}]
-}]