예제 #1
0
파일: _form.php 프로젝트: CTaiDeng/funshop
echo $form->field($model, 'email')->textInput(['maxlength' => 32]);
?>

    <?php 
echo $form->field($model, 'remark')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'payment_method')->dropDownList(Order::getPaymentMethodLabels());
?>
-->
    <?php 
if ($model->payment_method == Order::PAYMENT_METHOD_COD) {
    ?>
    <?php 
    echo $form->field($model, 'payment_status')->dropDownList(Order::getPaymentStatusLabels());
    ?>

    <?php 
    echo $form->field($model, 'payment_id')->textInput();
    ?>

    <?php 
    echo $form->field($model, 'payment_name')->textInput(['maxlength' => 120]);
    ?>
    <?php 
}
?>

    <?php 
echo $form->field($model, 'payment_fee')->textInput(['maxlength' => 10]);
예제 #2
0
파일: view.php 프로젝트: CTaiDeng/funshop
use common\models\Order;
/* @var $this yii\web\View */
/* @var $model common\models\Order */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="order-view">

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['product_id', 'name', 'sku', 'price', 'number', ['attribute' => 'total', 'value' => function ($model) {
    return $model->number * $model->price;
}]]]);
?>


    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'user_id', 'value' => $model->user ? $model->user->username : '******'], 'sn', 'consignee', ['attribute' => 'address', 'value' => (isset($model->country0) ? $model->country0->name : '-') . (isset($model->province0) ? $model->province0->name : '-') . (isset($model->city0) ? $model->city0->name : '-') . (isset($model->district0) ? $model->district0->name : '-') . $model->address], 'zipcode', 'phone', 'mobile', 'email:email', 'remark', ['attribute' => 'payment_method', 'value' => Order::getPaymentMethodLabels($model->payment_method)], ['attribute' => 'payment_status', 'value' => $model->payment_status ? Order::getPaymentStatusLabels($model->payment_status) : '-'], 'payment_id', 'payment_name', 'payment_fee', ['attribute' => 'shipment_status', 'value' => $model->shipment_status ? Order::getShipmentStatusLabels($model->shipment_status) : '-'], 'shipment_id', 'shipment_name', 'shipment_fee', 'amount', 'tax', 'invoice', ['attribute' => 'status', 'value' => Order::getStatusLabels($model->status)], 'paid_at:datetime', 'shipped_at:datetime', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'created_by', 'value' => $model->createdBy->username], ['attribute' => 'updated_by', 'value' => $model->updatedBy->username]]]);
?>

</div>
예제 #3
0
파일: index.php 프로젝트: CTaiDeng/funshop
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'user_id', 'value' => function ($model) {
    return $model->user ? $model->user->username : '******';
}], 'sn', 'consignee', ['attribute' => 'address', 'value' => function ($model) {
    return (isset($model->country0) ? $model->country0->name : '-') . (isset($model->province0) ? $model->province0->name : '-') . (isset($model->city0) ? $model->city0->name : '-') . (isset($model->district0) ? $model->district0->name : '-');
}], 'mobile', ['attribute' => 'payment_status', 'format' => 'html', 'value' => function ($model) {
    if ($model->payment_status === Order::PAYMENT_STATUS_PAID) {
        $class = 'label-success';
    } elseif ($model->payment_status === Order::PAYMENT_STATUS_COD) {
        $class = 'label-warning';
    } elseif ($model->payment_status === Order::PAYMENT_STATUS_UNPAID) {
        $class = 'label-danger';
    } else {
        $class = 'label-info';
    }
    return '<span class="label ' . $class . '">' . ($model->payment_status ? Order::getPaymentStatusLabels($model->payment_status) : '-') . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'payment_status', Order::getPaymentStatusLabels(), ['class' => 'form-control', 'prompt' => Yii::t('app', 'PROMPT_STATUS')])], ['attribute' => 'shipment_status', 'format' => 'html', 'value' => function ($model) {
    if ($model->shipment_status === Order::SHIPMENT_STATUS_RECEIVED) {
        $class = 'label-success';
    } elseif ($model->shipment_status === Order::SHIPMENT_STATUS_SHIPPED) {
        $class = 'label-warning';
    } elseif ($model->shipment_status === Order::SHIPMENT_STATUS_PREPARING) {
        $class = 'label-danger';
    } else {
        $class = 'label-info';
    }
    return '<span class="label ' . $class . '">' . ($model->shipment_status ? Order::getShipmentStatusLabels($model->shipment_status) : '-') . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'shipment_status', Order::getShipmentStatusLabels(), ['class' => 'form-control', 'prompt' => Yii::t('app', 'PROMPT_STATUS')])], 'amount', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Order::SHIPMENT_STATUS_RECEIVED) {
        $class = 'label-success';
    } elseif ($model->status === Order::PAYMENT_STATUS_UNPAID) {
        $class = 'label-warning';