@@ -14,15 +22,40 @@ use yii\bootstrap4\ActiveForm;
= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
- = $form->field($model, 'province')->textInput(['maxlength' => true]) ?>
+
- = $form->field($model, 'is_default')->textInput() ?>
+ = $form->field($model, 'address')->textarea(['rows' => 2]) ?>
= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
diff --git a/backend/views/taking-site/create.php b/backend/views/taking-site/create.php
index e3725b6..e29a8c0 100644
--- a/backend/views/taking-site/create.php
+++ b/backend/views/taking-site/create.php
@@ -1,6 +1,6 @@
params['breadcrumbs'][] = $this->title;
= $this->render('_form', [
'model' => $model,
+ 'cityList'=>[],
+ 'areaList'=>[]
]) ?>
diff --git a/backend/views/taking-site/index.php b/backend/views/taking-site/index.php
index 5efb74c..44af872 100644
--- a/backend/views/taking-site/index.php
+++ b/backend/views/taking-site/index.php
@@ -7,7 +7,7 @@ use iron\grid\GridView;
/* @var $searchModel common\models\searchs\TakingSiteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
-$this->title = 'Taking Sites';
+$this->title = '上门自提';
$this->params['breadcrumbs'][] = $this->title;
?>
diff --git a/backend/views/taking-site/update.php b/backend/views/taking-site/update.php
index 2940c34..7b0136a 100644
--- a/backend/views/taking-site/update.php
+++ b/backend/views/taking-site/update.php
@@ -1,19 +1,28 @@
title = '编辑 Taking Site: ' . $model->name;
+$this->title = '编辑: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Taking Sites', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update ';
+
+$cities = City::find()->select('city_id as id,name')->where(['province_id' => $model->province])->asArray()->all();
+$cityList = \yii\helpers\ArrayHelper::map($cities, 'id', 'name');
+$areas = Area::find()->select('area_id as id,name')->where(['city_id' => $model->city])->asArray()->all();
+$areaList = \yii\helpers\ArrayHelper::map($areas, 'id', 'name');
?>
= $this->render('_form', [
'model' => $model,
+ 'cityList' => $cityList,
+ 'areaList' => $areaList
]) ?>
diff --git a/backend/views/taking-site/view.php b/backend/views/taking-site/view.php
index 576709a..dd5add5 100644
--- a/backend/views/taking-site/view.php
+++ b/backend/views/taking-site/view.php
@@ -26,7 +26,6 @@ $this->params['breadcrumbs'][] = $this->title;
'city',
'area',
'address:ntext',
- 'is_default',
'updated_at',
'created_at',
],
diff --git a/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php
index e3e6b81..d21f833 100644
--- a/common/models/ars/ExpressTemplate.php
+++ b/common/models/ars/ExpressTemplate.php
@@ -13,19 +13,24 @@ use yii\behaviors\TimestampBehavior;
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
- * @property int $billing_type 账单类型
- * @property int $extra_weight_type 续重重量类型
- * @property int $exemption_type 包邮类型
+ * @property int $calculation 计算方式
* @property int $basic_price 基本运费
+ * @property int $basic_amount 基本数量
* @property int $extra_price 续重运费
- * @property int $exemption_amount 包邮金额
- * @property int $support_taking 是否支持自提,1为不支持
- * @property string $taking_site 自提地点
+ * @property int $extra_amount 续重运费
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class ExpressTemplate extends \yii\db\ActiveRecord
{
+ //计算方式calculation
+ const CALCULATION_WEIGHT = 1; //按重量
+ const CALCULATION_NUMBER = 2; //按件数
+
+ public static $calculation = [
+ self::CALCULATION_WEIGHT => '按重量',
+ self::CALCULATION_NUMBER => '按件数'
+ ];
/**
* {@inheritdoc}
*/
@@ -41,8 +46,8 @@ class ExpressTemplate extends \yii\db\ActiveRecord
{
return [
[['name'], 'required'],
- [['province', 'city', 'area', 'taking_site'], 'string'],
- [['billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking'], 'integer'],
+ [['province', 'city', 'area'], 'string'],
+ [['calculation', 'basic_price', 'basic_amount', 'extra_price', 'extra_amount'], 'integer'],
[['name'], 'string', 'max' => 255],
];
}
@@ -58,14 +63,11 @@ class ExpressTemplate extends \yii\db\ActiveRecord
'province' => '省份',
'city' => '城市',
'area' => '区域',
- 'billing_type' => '账单类型',
- 'extra_weight_type' => '续重重量类型',
- 'exemption_type' => '包邮类型',
+ 'calculation' => '计算方式',
'basic_price' => '基本运费',
+ 'basic_amount' => '基本数量',
'extra_price' => '续重运费',
- 'exemption_amount' => '包邮金额',
- 'support_taking' => '是否支持自提,1为不支持',
- 'taking_site' => '自提地点',
+ 'extra_amount' => '续重运费',
'updated_at' => '更新时间',
'created_at' => '创建时间',
];
diff --git a/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php
new file mode 100644
index 0000000..a4acf48
--- /dev/null
+++ b/common/models/ars/TakingSite.php
@@ -0,0 +1,81 @@
+ 120],
+ [['province', 'city', 'area'], 'string', 'max' => 64],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'id',
+ 'name' => '名称',
+ 'updated_at' => '更新时间',
+ 'created_at' => '创建时间',
+ 'province' => '省份',
+ 'city' => '城市',
+ 'area' => '区域',
+ 'address' => '地址',
+ ];
+ }
+
+
+ /**
+ * @author linyao
+ * @email 602604991@qq.com
+ * @created Nov 8, 2019
+ *
+ * 行为存储创建时间和更新时间
+ */
+ public function behaviors()
+ {
+ return [
+ [
+ 'class' => TimestampBehavior::className(),
+ 'createdAtAttribute' => 'created_at',
+ 'updatedAtAttribute' => 'updated_at',
+ 'value' => function() {
+ return time();
+ },
+ ],
+ ];
+ }
+}
diff --git a/common/models/searchs/ExpressTemplateSearch.php b/common/models/searchs/ExpressTemplateSearch.php
index 947d731..bd233d3 100644
--- a/common/models/searchs/ExpressTemplateSearch.php
+++ b/common/models/searchs/ExpressTemplateSearch.php
@@ -26,8 +26,8 @@ class ExpressTemplateSearch extends ExpressTemplate
public function rules()
{
return [
- [['id', 'billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking', 'updated_at', 'created_at'], 'integer'],
- [['name', 'province', 'city', 'area', 'taking_site'], 'safe'],
+ [['id', 'calculation', 'basic_price', 'basic_amount', 'extra_price', 'extra_amount', 'updated_at', 'created_at'], 'integer'],
+ [['name', 'province', 'city', 'area'], 'safe'],
['created_at_range','safe'],
];
}
@@ -54,19 +54,6 @@ class ExpressTemplateSearch extends ExpressTemplate
],
'id',
'name',
- 'province',
- 'city',
- 'area',
- //'billing_type',
- //'extra_weight_type',
- //'exemption_type',
- //'basic_price',
- //'extra_price',
- //'exemption_amount',
- //'support_taking',
- //'taking_site',
- //'updated_at',
- //'created_at',
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
@@ -134,13 +121,11 @@ class ExpressTemplateSearch extends ExpressTemplate
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
- 'billing_type' => $this->billing_type,
- 'extra_weight_type' => $this->extra_weight_type,
- 'exemption_type' => $this->exemption_type,
+ 'calculation' => $this->calculation,
'basic_price' => $this->basic_price,
+ 'basic_amount' => $this->basic_amount,
'extra_price' => $this->extra_price,
- 'exemption_amount' => $this->exemption_amount,
- 'support_taking' => $this->support_taking,
+ 'extra_amount' => $this->extra_amount,
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
]);
@@ -148,8 +133,7 @@ class ExpressTemplateSearch extends ExpressTemplate
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'province', $this->province])
->andFilterWhere(['like', 'city', $this->city])
- ->andFilterWhere(['like', 'area', $this->area])
- ->andFilterWhere(['like', 'taking_site', $this->taking_site]);
+ ->andFilterWhere(['like', 'area', $this->area]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
diff --git a/common/models/searchs/TakingSiteSearch.php b/common/models/searchs/TakingSiteSearch.php
index b41646f..ce91a75 100644
--- a/common/models/searchs/TakingSiteSearch.php
+++ b/common/models/searchs/TakingSiteSearch.php
@@ -26,7 +26,7 @@ class TakingSiteSearch extends TakingSite
public function rules()
{
return [
- [['id', 'is_default', 'updated_at', 'created_at'], 'integer'],
+ [['id', 'updated_at', 'created_at'], 'integer'],
[['name', 'province', 'city', 'area', 'address'], 'safe'],
['created_at_range','safe'],
];
@@ -58,7 +58,6 @@ class TakingSiteSearch extends TakingSite
'city',
'area',
//'address',
- //'is_default',
//'updated_at',
//'created_at',
[
@@ -128,7 +127,6 @@ class TakingSiteSearch extends TakingSite
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
- 'is_default' => $this->is_default,
'updated_at' => $this->updated_at,
'created_at' => $this->created_at,
]);
diff --git a/console/migrations/m191203_031446_drop_column_is_default_in_table_ats_taking_site.php b/console/migrations/m191203_031446_drop_column_is_default_in_table_ats_taking_site.php
new file mode 100644
index 0000000..7c43851
--- /dev/null
+++ b/console/migrations/m191203_031446_drop_column_is_default_in_table_ats_taking_site.php
@@ -0,0 +1,20 @@
+dropColumn('ats_taking_site', 'is_default');
+ }
+
+ public function down()
+ {
+ $this->addColumn('ats_taking_site', 'is_default', $this->tinyInteger(1)->defaultValue(0)->comment('是否为默认,1为默认'));
+ return true;
+ }
+}
From 4bdfbbac05aacb3d82377405faa6a7a56f02dc97 Mon Sep 17 00:00:00 2001
From: linyaostalker <602604991@qq.com>
Date: Tue, 3 Dec 2019 15:14:21 +0800
Subject: [PATCH 02/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?=
=?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../m191112_014508_create_table_express_template.php | 9 +++------
...lumns_province_city_area_in_table_ats_taking_site.php | 6 +++---
...11_update_column_address_in_table_ats_taking_site.php | 2 +-
vendor/antgoods/goods/src/views/goods/create.php | 6 ------
4 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/console/migrations/m191112_014508_create_table_express_template.php b/console/migrations/m191112_014508_create_table_express_template.php
index 4b788a5..4396c90 100755
--- a/console/migrations/m191112_014508_create_table_express_template.php
+++ b/console/migrations/m191112_014508_create_table_express_template.php
@@ -19,14 +19,11 @@ class m191112_014508_create_table_express_template extends Migration
'province'=>$this->text()->comment('省份'),
'city'=>$this->text()->comment('城市'),
'area'=>$this->text()->comment('区域'),
- 'billing_type'=>$this->tinyInteger(1)->defaultValue(0)->comment('账单类型'),
- 'extra_weight_type'=>$this->tinyInteger(2)->defaultValue(0)->comment('续重重量类型'),
- 'exemption_type'=>$this->tinyInteger(1)->defaultValue(0)->comment('包邮类型'),
+ 'calculation'=>$this->tinyInteger(2)->defaultValue(0)->comment('计算方式'),
'basic_price'=>$this->integer(20)->defaultValue(null)->comment('基本运费'),
+ 'basic_amount'=>$this->integer(20)->defaultValue(null)->comment('基本数量'),
'extra_price'=>$this->integer(20)->defaultValue(null)->comment('续重运费'),
- 'exemption_amount'=>$this->integer(20)->defaultValue(null)->comment('包邮金额'),
- 'support_taking'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否支持自提,1为不支持'),
- 'taking_site'=>$this->text()->comment('自提地点'),
+ 'extra_amount'=>$this->integer(20)->defaultValue(null)->comment('续重运费'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
],$tableOptions);
diff --git a/console/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php b/console/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php
index 7d0c87d..5fae9fa 100644
--- a/console/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php
+++ b/console/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php
@@ -10,11 +10,11 @@ class m191203_030210_update_columns_province_city_area_in_table_ats_taking_site
public function up()
{
$this->dropColumn('ats_taking_site', 'province');
- $this->addColumn('ats_taking_site', 'province', $this->string(10)->notNull()->defaultValue(null)->comment('省份'));
+ $this->addColumn('ats_taking_site', 'province', $this->string(64)->defaultValue('')->notNull()->comment('省份'));
$this->dropColumn('ats_taking_site', 'city');
- $this->addColumn('ats_taking_site', 'city', $this->string(10)->notNull()->defaultValue(null)->comment('城市'));
+ $this->addColumn('ats_taking_site', 'city', $this->string(64)->defaultValue('')->notNull()->comment('城市'));
$this->dropColumn('ats_taking_site', 'area');
- $this->addColumn('ats_taking_site', 'area', $this->string(10)->notNull()->defaultValue(null)->comment('区域'));
+ $this->addColumn('ats_taking_site', 'area', $this->string(64)->defaultValue('')->notNull()->comment('区域'));
}
public function down()
diff --git a/console/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php b/console/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php
index b5b623b..5574799 100644
--- a/console/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php
+++ b/console/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php
@@ -10,7 +10,7 @@ class m191203_030911_update_column_address_in_table_ats_taking_site extends Migr
public function up()
{
$this->dropColumn('ats_taking_site', 'address');
- $this->addColumn('ats_taking_site', 'address', $this->text()->notNull()->comment('地址'));
+ $this->addColumn('ats_taking_site', 'address', $this->text()->defaultValue('')->notNull()->comment('地址'));
}
public function down()
diff --git a/vendor/antgoods/goods/src/views/goods/create.php b/vendor/antgoods/goods/src/views/goods/create.php
index 608d117..ba38f73 100644
--- a/vendor/antgoods/goods/src/views/goods/create.php
+++ b/vendor/antgoods/goods/src/views/goods/create.php
@@ -68,11 +68,5 @@ Yii::$app->params['bsVersion'] = '4.x';
- render('_form', [
-// 'model' => $model,
-// ])
- ?>
-