public function actionView($id)
 {
     $commodityOrderDetail = CommodityOrderDetail::findOne($id);
     if (empty($commodityOrderDetail)) {
         throw new HttpException(404, '查看失败,数据不存在!');
     }
     $commodityOrder = CommodityOrder::findOne($commodityOrderDetail->coid);
     if (empty($commodityOrder)) {
         throw new HttpException(404, '查看失败,数据不存在!');
     }
     return $this->render('view', ['model' => $commodityOrder]);
 }
Пример #2
0
 public function actionIndex()
 {
     $notice = null;
     $order_in = 0;
     $order_finish = 0;
     $order_pend = 0;
     if (!empty($this->user)) {
         $notice = Notice::find()->where('rids like :rids', [':rids' => '%,' . $this->user->rid . ',%'])->orderBy('create_time desc')->one();
         $order_in = CommodityOrder::find()->where('op_statu = :op_statu', [':op_statu' => CommodityOrder::$_OP_IN])->count();
         $order_finish = CommodityOrder::find()->where('op_statu = :op_statu', [':op_statu' => CommodityOrder::$_OP_FINISH])->count();
         $order_pend = CommodityOrder::find()->where('statu = :statu', [':statu' => CommodityOrder::$_AUDIT_PEND])->count();
     }
     return $this->render('index', ['notice' => $notice, 'order_in' => $order_in, 'order_finish' => $order_finish, 'order_pend' => $order_pend]);
 }
Пример #3
0
 public function validateEntrance($attribute, $params)
 {
     echo 'validateEntrance';
     $commodityOrderDetail = (new Query())->select(CommodityOrderDetail::tableName() . '.*')->from(CommodityOrder::tableName())->leftJoin(CommodityOrderDetail::tableName(), CommodityOrderDetail::tableName() . '.coid = ' . CommodityOrder::tableName() . '.id')->where('commodity_id = :commodity_id and entrance = :entrance', [':commodity_id' => $this->commodity, ':entrance' => $this->{$attribute}])->one();
     if (is_null($commodityOrderDetail)) {
         return $this->addError($attribute, '浏览入口不存在');
     }
 }
Пример #4
0
    </div>
<style>
    .gv-table{text-align:center;}
    .gv-table th{text-align:center;}
</style>
<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'summary' => false, 'emptyText' => false, 'tableOptions' => ['class' => 'table table-striped table-bordered gv-table'], 'columns' => [['attribute' => '买家', 'value' => function ($data) {
    return $data['buyer'];
}], ['attribute' => '店铺', 'value' => function ($data) {
    return $data['shop'];
}], ['attribute' => 'ID', 'value' => function ($data) {
    return $data['commodity'];
}], ['attribute' => '订单号', 'value' => function ($data) {
    return $data['order_no'];
}], ['class' => 'yii\\grid\\Column', 'header' => '金额', 'content' => function ($data) {
    $commodityOrderDetail = (new Query())->select(CommodityOrderDetail::tableName() . '.*')->from(CommodityOrder::tableName())->leftJoin(CommodityOrderDetail::tableName(), CommodityOrderDetail::tableName() . '.coid = ' . CommodityOrder::tableName() . '.id')->where('commodity_id = :commodity_id and entrance = :entrance', [':commodity_id' => $data['commodity'], ':entrance' => $data['entrance']])->one();
    $style = '';
    if (!is_null($commodityOrderDetail)) {
        if (floatval($commodityOrderDetail['price']) != floatval($data['money'])) {
            $style = 'style="color:red;"';
        }
    }
    return '<span ' . $style . '>' . $data['money'] . '</span>';
}], ['attribute' => '下单时间', 'value' => function ($data) {
    return $data['order_time'];
}], ['attribute' => '收货地址', 'value' => function ($data) {
    if (empty($data['address'])) {
        $data['address'] = '';
    }
    return $data['address'];
}], ['class' => 'yii\\grid\\Column', 'header' => '审核状态', 'content' => function ($data) {
Пример #5
0
 public function actionUpdate($id)
 {
     $model = Order::findOne($id);
     if (empty($model)) {
         throw new HttpException(404, '订单不存在!');
     }
     if ($model->uid != 0 && $model->uid != $model->uid && $this->user->rid == 4) {
         throw new MethodNotAllowedHttpException('权限不够,不能修改!');
     }
     if ($model->statu == Order::$_AUDIT_ACCESS) {
         throw new MethodNotAllowedHttpException('已审核订单,不能修改!');
     }
     if ($model->load(Yii::$app->request->post())) {
         $model->scenario = 'update';
         // 获取用户输入的数据,验证并保存
         $model->statu = Order::$_AUDIT_PEND;
         $commodityOrderDetail = (new Query())->select(CommodityOrderDetail::tableName() . '.*')->from(CommodityOrder::tableName())->leftJoin(CommodityOrderDetail::tableName(), CommodityOrderDetail::tableName() . '.coid = ' . CommodityOrder::tableName() . '.id')->where('commodity_id = :commodity_id and entrance = :entrance', [':commodity_id' => $model->commodity, ':entrance' => $model->entrance])->one();
         $model->fee = $commodityOrderDetail['fee'];
         if ($model->save()) {
             $this->redirect('/order/index');
         }
     }
     echo $model['commodity'];
     echo $model->shop;
     return $this->render('update', array('model' => $model));
 }
 public function actionAllot($id)
 {
     $model = CommodityOrder::findOne($id);
     if (empty($model)) {
         throw new HttpException(404, '操作失败,放单不存在!');
     }
     $dataProvider = new ActiveDataProvider(['query' => CommodityOrderDetail::find()->where('coid = :coid', [':coid' => $model->id])->orderBy('keyword'), 'pagination' => false]);
     $users = User::find()->where('rid = 4')->all();
     $users_json = array();
     $enarray = ['value' => '', 'text' => '未分配'];
     array_push($users_json, $enarray);
     foreach ($users as $user) {
         $enarray = ['value' => $user->id, 'text' => $user->username];
         array_push($users_json, $enarray);
     }
     $users_json = json_encode($users_json);
     $recommend_json = [['value' => '1', 'text' => '是'], ['value' => '0', 'text' => '否']];
     $recommend_json = json_encode($recommend_json);
     return $this->render('allot', array('dataProvider' => $dataProvider, 'users_json' => $users_json, 'recommend_json' => $recommend_json));
 }
Пример #7
0
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    return $commodityOrder->sku;
}], ['attribute' => '要求', 'value' => function ($data) {
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    if (empty($commodityOrder->rule)) {
        $commodityOrder->rule = '';
    }
    return $commodityOrder->rule;
}], ['class' => 'yii\\grid\\Column', 'header' => '买手信用', 'content' => function ($data) {
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    if (empty($commodityOrder->credit)) {
        $commodityOrder->credit = '';
    }
    return '<span id="credit' . $data['id'] . '">' . $commodityOrder->credit . '</span>';
}], ['attribute' => '最近30天交易不超', 'value' => function ($data) {
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    if (empty($commodityOrder->trade_num)) {
        $commodityOrder->trade_num = '';
    }
    return $commodityOrder->trade_num;
}], ['attribute' => '关键词', 'value' => function ($data) {
    return $data['keyword'];
}], ['attribute' => '浏览入口', 'value' => function ($data) {
    return $data['entrance'];
}], ['attribute' => '卡位条件', 'value' => function ($data) {
    if (empty($data['condition'])) {
        $data['condition'] = '';
    }
    return $data['condition'];
}], ['attribute' => '笔数', 'value' => function ($data) {
    return $data['num'];