Browse Source

antgoods模块品牌和分类增加数据键值对方法,商品完成部分表单改造

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
573af04275
  1. 5
      vendor/antgoods/goods/src/models/ars/Brand.php
  2. 5
      vendor/antgoods/goods/src/models/ars/Category.php
  3. 10
      vendor/antgoods/goods/src/views/goods/_form.php
  4. 6
      vendor/antgoods/goods/src/views/goods/update.php

5
vendor/antgoods/goods/src/models/ars/Brand.php

@ -74,4 +74,9 @@ class Brand extends \yii\db\ActiveRecord
], ],
]; ];
} }
public static function modelColumn()
{
return $column = Brand::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
} }

5
vendor/antgoods/goods/src/models/ars/Category.php

@ -96,4 +96,9 @@ class Category extends \yii\db\ActiveRecord
], ],
]; ];
} }
public static function modelColumn()
{
return $column = Category::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
} }

10
vendor/antgoods/goods/src/views/goods/_form.php

@ -2,6 +2,8 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use antgoods\goods\models\ars\Category;
use antgoods\goods\models\ars\Brand;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */ /* @var $model antgoods\goods\models\ars\Goods */
@ -12,11 +14,9 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?> <?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'pid')->textInput() ?>
<?= $form->field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'cat_id')->textInput() ?>
<?= $form->field($model, 'brand_id')->textInput() ?>
<?= $form->field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'shop_cat_id')->textInput() ?> <?= $form->field($model, 'shop_cat_id')->textInput() ?>
@ -68,8 +68,6 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'experience_points')->textInput() ?> <?= $form->field($model, 'experience_points')->textInput() ?>
<?= $form->field($model, 'is_delete')->textInput() ?>
<?= $form->field($model, 'express_template')->textInput() ?> <?= $form->field($model, 'express_template')->textInput() ?>
<div class="form-group"> <div class="form-group">

6
vendor/antgoods/goods/src/views/goods/update.php

@ -5,10 +5,10 @@ use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */ /* @var $model antgoods\goods\models\ars\Goods */
$this->title = '编辑 Goods: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']];
$this->title = '编辑商品: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '商品管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update ';
$this->params['breadcrumbs'][] = '编辑 ';
?> ?>
<div class="goods-update"> <div class="goods-update">

Loading…
Cancel
Save