Browse Source

refactor: 处理冲突

antshop
root 5 years ago
parent
commit
e30db348c7
  1. 8
      backend/config/main.php
  2. 2
      backend/controllers/ConfigController.php
  3. 70
      backend/controllers/ExpressTemplateController.php
  4. 4
      backend/controllers/OrderController.php
  5. 4
      backend/controllers/SiteController.php
  6. 11
      backend/controllers/TakingSiteController.php
  7. 4
      backend/logic/file/FileManager.php
  8. 0
      backend/migrations/m130524_201442_init.php
  9. 0
      backend/migrations/m140506_102106_rbac_init.php
  10. 0
      backend/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php
  11. 0
      backend/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php
  12. 0
      backend/migrations/m190124_110200_add_verification_token_column_to_user_table.php
  13. 0
      backend/migrations/m190802_072830_add_category.php
  14. 0
      backend/migrations/m191111_101658_create_table_area.php
  15. 0
      backend/migrations/m191111_102644_create_table_province.php
  16. 0
      backend/migrations/m191111_102730_create_table_city.php
  17. 0
      backend/migrations/m191111_102925_create_table_cart.php
  18. 0
      backend/migrations/m191111_112559_create_table_address.php
  19. 0
      backend/migrations/m191111_113455_create_table_after_sale.php
  20. 0
      backend/migrations/m191112_005106_create_table_search_history.php
  21. 0
      backend/migrations/m191112_005545_create_table_collection.php
  22. 0
      backend/migrations/m191112_005702_create_table_comment.php
  23. 0
      backend/migrations/m191112_010421_create_table_order.php
  24. 0
      backend/migrations/m191112_011517_create_table_order_goods.php
  25. 0
      backend/migrations/m191112_012449_create_table_taking_site.php
  26. 9
      backend/migrations/m191112_014508_create_table_express_template.php
  27. 0
      backend/migrations/m191112_015939_create_table_delivery.php
  28. 0
      backend/migrations/m191112_020830_create_table_payment_log.php
  29. 0
      backend/migrations/m191112_021528_create_table_refund_log.php
  30. 0
      backend/migrations/m191112_022131_create_table_file.php
  31. 0
      backend/migrations/m191112_022532_create_table_tem_file.php
  32. 0
      backend/migrations/m191130_071623_add_column_weight_in_table_ats_order_goods.php
  33. 0
      backend/migrations/m191203_022720_add_column_sku_id_in_table_ats_order_goods.php
  34. 6
      backend/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php
  35. 2
      backend/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php
  36. 20
      backend/migrations/m191203_031446_drop_column_is_default_in_table_ats_taking_site.php
  37. 0
      backend/migrations/m191203_034004_add_column_address_in_table_ats_order.php
  38. 20
      backend/migrations/m191203_112307_add_data_to_table_city_and_area.php
  39. 20
      backend/migrations/m191203_114421_update_column_discount_description_in_table_order.php
  40. 22
      backend/migrations/m191204_004849_update_column_calculation_in_table_ats_express_template.php
  41. 26
      backend/migrations/m191204_012240_update_columns_basic_price_basic_amount_in_table_ats_express_template.php
  42. 0
      backend/migrations/schema-mysql.sql
  43. 0
      backend/migrations/sql/add_category.sql
  44. 8
      backend/migrations/sql/add_data.sql
  45. 0
      backend/migrations/sql/area.sql
  46. 0
      backend/migrations/sql/city.sql
  47. 0
      backend/migrations/sql/province.sql
  48. 2
      backend/models/Cat.php
  49. 2
      backend/models/Category.php
  50. 6
      backend/models/CategorySearch.php
  51. 2
      backend/models/LoginForm.php
  52. 2
      backend/models/User.php
  53. 2
      backend/models/ars/Address.php
  54. 2
      backend/models/ars/AfterSale.php
  55. 2
      backend/models/ars/Area.php
  56. 2
      backend/models/ars/Cart.php
  57. 2
      backend/models/ars/City.php
  58. 2
      backend/models/ars/Collection.php
  59. 2
      backend/models/ars/Comment.php
  60. 2
      backend/models/ars/Config.php
  61. 2
      backend/models/ars/Delivery.php
  62. 47
      backend/models/ars/ExpressTemplate.php
  63. 2
      backend/models/ars/File.php
  64. 10
      backend/models/ars/Order.php
  65. 2
      backend/models/ars/OrderGoods.php
  66. 2
      backend/models/ars/PaymentLog.php
  67. 2
      backend/models/ars/Province.php
  68. 2
      backend/models/ars/RefundLog.php
  69. 2
      backend/models/ars/SearchHistory.php
  70. 81
      backend/models/ars/TakingSite.php
  71. 2
      backend/models/ars/TemFile.php
  72. 34
      backend/models/searchs/ExpressTemplateSearch.php
  73. 12
      backend/models/searchs/OrderSearch.php
  74. 10
      backend/models/searchs/TakingSiteSearch.php
  75. 131
      backend/views/express-template/_form.php
  76. 2
      backend/views/express-template/_search.php
  77. 428
      backend/views/express-template/area.php
  78. 44
      backend/views/express-template/create.php
  79. 2
      backend/views/express-template/index.php
  80. 44
      backend/views/express-template/update.php
  81. 34
      backend/views/express-template/view.php
  82. 7
      backend/views/layouts/main.php
  83. 12
      backend/views/layouts/sidebar.php
  84. 2
      backend/views/order/_form.php
  85. 2
      backend/views/order/_search.php
  86. 2
      backend/views/order/create.php
  87. 2
      backend/views/order/index.php
  88. 2
      backend/views/order/update.php
  89. 4
      backend/views/order/view.php
  90. 2
      backend/views/site/login.php
  91. 2
      backend/views/site/test.php
  92. 49
      backend/views/taking-site/_form.php
  93. 2
      backend/views/taking-site/_search.php
  94. 6
      backend/views/taking-site/create.php
  95. 4
      backend/views/taking-site/index.php
  96. 13
      backend/views/taking-site/update.php
  97. 3
      backend/views/taking-site/view.php
  98. 0
      backend/web/js/jquery.js
  99. 2966
      backend/web/js/jquery.min.js
  100. 2
      common/config/bootstrap.php

8
backend/config/main.php

@ -10,8 +10,8 @@ return [
'controllerNamespace' => 'backend\controllers', 'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'], 'bootstrap' => ['log'],
'modules' => [ 'modules' => [
'antgoods' => [
'class' => 'antgoods\goods\Module',
'goods' => [
'class' => 'goods\Module',
], ],
], ],
'components' => [ 'components' => [
@ -22,7 +22,7 @@ return [
'csrfParam' => '_csrf-api', 'csrfParam' => '_csrf-api',
], ],
'user' => [ 'user' => [
'identityClass' => 'common\models\User',
'identityClass' => 'backend\models\User',
'enableAutoLogin' => true, 'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
], ],
@ -59,7 +59,7 @@ return [
], ],
], ],
'file' => ['class' => 'backend\logic\file\FileManager'], 'file' => ['class' => 'backend\logic\file\FileManager'],
'goods' => ['class' => 'antgoods\goods\logic\goods\GoodsManager'],
'goods' => ['class' => 'goods\goods\logic\goods\GoodsManager'],
], ],
'params' => $params, 'params' => $params,
]; ];

2
backend/controllers/ConfigController.php

@ -3,7 +3,7 @@
namespace backend\controllers; namespace backend\controllers;
use Yii; use Yii;
use common\models\ars\Category;
use backend\models\ars\Category;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;

70
backend/controllers/ExpressTemplateController.php

@ -2,12 +2,17 @@
namespace backend\controllers; namespace backend\controllers;
use backend\models\ars\City;
use backend\models\ars\Province;
use Yii; use Yii;
use common\models\ars\ExpressTemplate;
use common\models\searchs\ExpressTemplateSearch;
use backend\models\ars\ExpressTemplate;
use backend\models\searchs\ExpressTemplateSearch;
use yii\caching\Cache;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use yii\web\Response;
use yii\widgets\ActiveForm;
/** /**
* ExpressTemplateController implements the CRUD actions for ExpressTemplate model. * ExpressTemplateController implements the CRUD actions for ExpressTemplate model.
@ -66,13 +71,43 @@ class ExpressTemplateController extends Controller
public function actionCreate() public function actionCreate()
{ {
$model = new ExpressTemplate(); $model = new ExpressTemplate();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
$model->calculation = ExpressTemplate::CALCULATION_NUMBER;
$model->basic_amount = 1;
$model->basic_price = '0.00';
if (Yii::$app->request->isPost) {
$data = Yii::$app->request->post('ExpressTemplate');
if (Yii::$app->request->isAjax) {
$model->load($data, '');
Yii::$app->response->format = Response::FORMAT_JSON;
$data = ActiveForm::validate($model);
$data['status'] = 2;
return $data;
}
if (Yii::$app->request->post('area') == null) {
return $this->redirect(Yii::$app->request->referrer . '?status=1');
}
$cityIds = array_keys(Yii::$app->request->post('area'));
$data['city'] = implode(',', $cityIds);
$model->load($data, '');
$model->save();
return $this->redirect('index'); return $this->redirect('index');
} }
$data = [];
$provinces = Province::find()->cache(0)->all();
foreach ($provinces as $k => $v) {
$data[$k]['province'] = $v->name;
$cities = City::find()->cache(0)
->where(['province_id' => $v->province_id])
->all();
foreach ($cities as $city) {
$data[$k]['city'][] = ['id' => $city->city_id, 'name' => $city->name];
}
}
return $this->render('create', [ return $this->render('create', [
'model' => $model, 'model' => $model,
'data' => $data
]); ]);
} }
@ -86,13 +121,30 @@ class ExpressTemplateController extends Controller
public function actionUpdate($id) public function actionUpdate($id)
{ {
$model = $this->findModel($id); $model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
$data = Yii::$app->request->post('ExpressTemplate');
if ($data) {
if (Yii::$app->request->post('area') == null) {
return $this->redirect(Yii::$app->request->referrer . '&status=1');
}
$cityIds = array_keys(Yii::$app->request->post('area'));
$data['city'] = implode(',', $cityIds);
$model->load($data, '');
$model->save();
return $this->render('view', ['model' => ExpressTemplate::findOne($model->id)]);
}
$data = [];
$provinces = Province::find()->cache(0)->all();
foreach ($provinces as $k => $v) {
$data[$k]['province'] = $v->name;
$cities = City::find()->cache(0)
->where(['province_id' => $v->province_id])
->all();
foreach ($cities as $city) {
$data[$k]['city'][] = ['id' => $city->city_id, 'name' => $city->name];
}
} }
return $this->render('update', [ return $this->render('update', [
'model' => $model,
'model' => $model, 'data' => $data, 'cities' => explode(',', $model->city)
]); ]);
} }

4
backend/controllers/OrderController.php

@ -3,8 +3,8 @@
namespace backend\controllers; namespace backend\controllers;
use Yii; use Yii;
use common\models\ars\Order;
use common\models\searchs\OrderSearch;
use backend\models\ars\Order;
use backend\models\searchs\OrderSearch;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;

4
backend/controllers/SiteController.php

@ -6,8 +6,8 @@ use Yii;
use yii\web\Controller; use yii\web\Controller;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use yii\filters\AccessControl; use yii\filters\AccessControl;
use common\models\LoginForm;
use common\models\CategorySearch;
use backend\models\LoginForm;
use backend\models\CategorySearch;
/** /**
* Site controller * Site controller

11
backend/controllers/TakingSiteController.php

@ -2,11 +2,11 @@
namespace backend\controllers; namespace backend\controllers;
use common\models\ars\Area;
use common\models\ars\City;
use backend\models\ars\Area;
use backend\models\ars\City;
use Yii; use Yii;
use common\models\ars\TakingSite;
use common\models\searchs\TakingSiteSearch;
use backend\models\ars\TakingSite;
use backend\models\searchs\TakingSiteSearch;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
@ -68,7 +68,6 @@ class TakingSiteController extends Controller
public function actionCreate() public function actionCreate()
{ {
$model = new TakingSite(); $model = new TakingSite();
$model->is_default = TakingSite::IS_DEFAULT_NO;
if ($model->load(Yii::$app->request->post()) && $model->save()) { if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index'); return $this->redirect('index');
@ -161,7 +160,7 @@ class TakingSiteController extends Controller
if ($parents != null) { if ($parents != null) {
$provinceId = $parents[0]; $provinceId = $parents[0];
$data = City::find()->select('city_id as id,name')->where(['province_id' => $provinceId])->asArray()->all(); $data = City::find()->select('city_id as id,name')->where(['province_id' => $provinceId])->asArray()->all();
return ['output' => $data, 'selected' => '441904'];
return ['output' => $data, 'selected' => ''];
} else { } else {
return ['output' => '', 'selected' => '']; return ['output' => '', 'selected' => ''];
} }

4
backend/logic/file/FileManager.php

@ -3,8 +3,8 @@
namespace backend\logic\file; namespace backend\logic\file;
use common\models\ars\File;
use common\models\ars\TemFile;
use backend\models\ars\File;
use backend\models\ars\TemFile;
class FileManager class FileManager
{ {

console/migrations/m130524_201442_init.php → backend/migrations/m130524_201442_init.php

console/migrations/m140506_102106_rbac_init.php → backend/migrations/m140506_102106_rbac_init.php

console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php → backend/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php

console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php → backend/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php

console/migrations/m190124_110200_add_verification_token_column_to_user_table.php → backend/migrations/m190124_110200_add_verification_token_column_to_user_table.php

console/migrations/m190802_072830_add_category.php → backend/migrations/m190802_072830_add_category.php

console/migrations/m191111_101658_create_table_area.php → backend/migrations/m191111_101658_create_table_area.php

console/migrations/m191111_102644_create_table_province.php → backend/migrations/m191111_102644_create_table_province.php

console/migrations/m191111_102730_create_table_city.php → backend/migrations/m191111_102730_create_table_city.php

console/migrations/m191111_102925_create_table_cart.php → backend/migrations/m191111_102925_create_table_cart.php

console/migrations/m191111_112559_create_table_address.php → backend/migrations/m191111_112559_create_table_address.php

console/migrations/m191111_113455_create_table_after_sale.php → backend/migrations/m191111_113455_create_table_after_sale.php

console/migrations/m191112_005106_create_table_search_history.php → backend/migrations/m191112_005106_create_table_search_history.php

console/migrations/m191112_005545_create_table_collection.php → backend/migrations/m191112_005545_create_table_collection.php

console/migrations/m191112_005702_create_table_comment.php → backend/migrations/m191112_005702_create_table_comment.php

console/migrations/m191112_010421_create_table_order.php → backend/migrations/m191112_010421_create_table_order.php

console/migrations/m191112_011517_create_table_order_goods.php → backend/migrations/m191112_011517_create_table_order_goods.php

console/migrations/m191112_012449_create_table_taking_site.php → backend/migrations/m191112_012449_create_table_taking_site.php

console/migrations/m191112_014508_create_table_express_template.php → backend/migrations/m191112_014508_create_table_express_template.php

console/migrations/m191112_015939_create_table_delivery.php → backend/migrations/m191112_015939_create_table_delivery.php

console/migrations/m191112_020830_create_table_payment_log.php → backend/migrations/m191112_020830_create_table_payment_log.php

console/migrations/m191112_021528_create_table_refund_log.php → backend/migrations/m191112_021528_create_table_refund_log.php

console/migrations/m191112_022131_create_table_file.php → backend/migrations/m191112_022131_create_table_file.php

console/migrations/m191112_022532_create_table_tem_file.php → backend/migrations/m191112_022532_create_table_tem_file.php

console/migrations/m191130_071623_add_column_weight_in_table_ats_order_goods.php → backend/migrations/m191130_071623_add_column_weight_in_table_ats_order_goods.php

console/migrations/m191203_022720_add_column_sku_id_in_table_ats_order_goods.php → backend/migrations/m191203_022720_add_column_sku_id_in_table_ats_order_goods.php

console/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php → backend/migrations/m191203_030210_update_columns_province_city_area_in_table_ats_taking_site.php

console/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php → backend/migrations/m191203_030911_update_column_address_in_table_ats_taking_site.php

20
backend/migrations/m191203_031446_drop_column_is_default_in_table_ats_taking_site.php

@ -0,0 +1,20 @@
<?php
use yii\db\Migration;
/**
* Class m191203_031446_drop_column_is_default_in_table_ats_taking_site
*/
class m191203_031446_drop_column_is_default_in_table_ats_taking_site extends Migration
{
public function up()
{
$this->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;
}
}

console/migrations/m191203_034004_add_column_address_in_table_ats_order.php → backend/migrations/m191203_034004_add_column_address_in_table_ats_order.php

20
backend/migrations/m191203_112307_add_data_to_table_city_and_area.php

@ -0,0 +1,20 @@
<?php
use yii\db\Migration;
/**
* Class m191203_112307_add_data_to_table_city_and_area
*/
class m191203_112307_add_data_to_table_city_and_area extends Migration
{
public function up()
{
$sql = file_get_contents(__DIR__."/sql/add_data.sql");
$this->execute($sql);
}
public function down()
{
return true;
}
}

20
backend/migrations/m191203_114421_update_column_discount_description_in_table_order.php

@ -0,0 +1,20 @@
<?php
use yii\db\Migration;
/**
* Class m191203_114421_update_column_discount_description_in_table_order
*/
class m191203_114421_update_column_discount_description_in_table_order extends Migration
{
public function up()
{
$this->dropColumn('ats_order', 'discount_decription');
$this->addColumn('ats_order', 'discount_description', $this->text()->comment('折扣说明'));
}
public function down()
{
return true;
}
}

22
backend/migrations/m191204_004849_update_column_calculation_in_table_ats_express_template.php

@ -0,0 +1,22 @@
<?php
use yii\db\Migration;
/**
* Class m191204_004849_update_column_calculation_in_table_ats_express_template
*/
class m191204_004849_update_column_calculation_in_table_ats_express_template extends Migration
{
public function up()
{
$this->dropColumn('ats_express_template', 'calculation');
$this->addColumn('ats_express_template', 'calculation', $this->tinyInteger(2)->defaultValue(0)->notNull()->comment('计算方式'));
}
public function down()
{
$this->dropColumn('ats_express_template', 'calculation');
$this->addColumn('ats_express_template', 'calculation', $this->tinyInteger(2)->defaultValue(0)->comment('计算方式'));
return true;
}
}

26
backend/migrations/m191204_012240_update_columns_basic_price_basic_amount_in_table_ats_express_template.php

@ -0,0 +1,26 @@
<?php
use yii\db\Migration;
/**
* Class m191204_012240_update_columns_basic_price_basic_amount_in_table_ats_express_template
*/
class m191204_012240_update_columns_basic_price_basic_amount_in_table_ats_express_template extends Migration
{
public function up()
{
$this->dropColumn('ats_express_template', 'basic_price');
$this->dropColumn('ats_express_template', 'basic_amount');
$this->addColumn('ats_express_template', 'basic_price', $this->integer(20)->unsigned()->defaultValue(0)->notNull()->comment('基本运费'));
$this->addColumn('ats_express_template', 'basic_amount', $this->integer(20)->unsigned()->defaultValue(1)->notNull()->comment('基本数量'));
}
public function down()
{
$this->dropColumn('ats_express_template', 'basic_price');
$this->dropColumn('ats_express_template', 'basic_amount');
$this->addColumn('ats_express_template', 'basic_price', $this->integer(20)->defaultValue(0)->comment('基本运费'));
$this->addColumn('ats_express_template', 'basic_amount', $this->integer(20)->defaultValue(0)->comment('基本数量'));
return true;
}
}

console/migrations/schema-mysql.sql → backend/migrations/schema-mysql.sql

console/migrations/sql/add_category.sql → backend/migrations/sql/add_category.sql

8
backend/migrations/sql/add_data.sql

@ -0,0 +1,8 @@
INSERT INTO `city` VALUES ('348', '710000', '台湾', '710000');
INSERT INTO `city` VALUES ('349', '810000', '香港特别行政区', '810000');
INSERT INTO `city` VALUES ('350', '820000', '澳门特别行政区', '820000');
INSERT INTO `area` VALUES ('3193', '台湾', '710000', '710000');
INSERT INTO `area` VALUES ('3194', '香港特别行政区', '810000', '810000');
INSERT INTO `area` VALUES ('3195', '澳门特别行政区', '820000', '820000');

console/migrations/sql/area.sql → backend/migrations/sql/area.sql

console/migrations/sql/city.sql → backend/migrations/sql/city.sql

console/migrations/sql/province.sql → backend/migrations/sql/province.sql

common/models/Cat.php → backend/models/Cat.php

common/models/Category.php → backend/models/Category.php

common/models/CategorySearch.php → backend/models/CategorySearch.php

common/models/LoginForm.php → backend/models/LoginForm.php

common/models/User.php → backend/models/User.php

common/models/ars/Address.php → backend/models/ars/Address.php

common/models/ars/AfterSale.php → backend/models/ars/AfterSale.php

common/models/ars/Area.php → backend/models/ars/Area.php

common/models/ars/Cart.php → backend/models/ars/Cart.php

common/models/ars/City.php → backend/models/ars/City.php

common/models/ars/Collection.php → backend/models/ars/Collection.php

common/models/ars/Comment.php → backend/models/ars/Comment.php

common/models/ars/Config.php → backend/models/ars/Config.php

common/models/ars/Delivery.php → backend/models/ars/Delivery.php

common/models/ars/ExpressTemplate.php → backend/models/ars/ExpressTemplate.php

common/models/ars/File.php → backend/models/ars/File.php

common/models/ars/Order.php → backend/models/ars/Order.php

common/models/ars/OrderGoods.php → backend/models/ars/OrderGoods.php

common/models/ars/PaymentLog.php → backend/models/ars/PaymentLog.php

common/models/ars/Province.php → backend/models/ars/Province.php

common/models/ars/RefundLog.php → backend/models/ars/RefundLog.php

common/models/ars/SearchHistory.php → backend/models/ars/SearchHistory.php

81
backend/models/ars/TakingSite.php

@ -0,0 +1,81 @@
<?php
namespace backend\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_taking_site".
*
* @property int $id
* @property string $name 名称
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
* @property string $address 地址
*/
class TakingSite extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_taking_site';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name', 'province', 'city', 'area', 'address'], 'required'],
[['address'], 'string'],
[['name'], 'string', 'max' => 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();
},
],
];
}
}

common/models/ars/TemFile.php → backend/models/ars/TemFile.php

common/models/searchs/ExpressTemplateSearch.php → backend/models/searchs/ExpressTemplateSearch.php

common/models/searchs/OrderSearch.php → backend/models/searchs/OrderSearch.php

common/models/searchs/TakingSiteSearch.php → backend/models/searchs/TakingSiteSearch.php

131
backend/views/express-template/_form.php

@ -1,46 +1,113 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
use blobt\widgets\Icheck;
use backend\models\ars\ExpressTemplate;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\ExpressTemplate */
/* @var $model backend\models\ars\ExpressTemplate */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>
<div class="express-template-form">
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'calculation')->widget(Icheck::className(), ["items" => ExpressTemplate::$calculation, 'type' => "radio"]) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'basic_amount')->textInput() ?>
<?= $form->field($model, 'province')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'basic_price')->textInput() ?>
<?= $form->field($model, 'city')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'extra_amount')->textInput() ?>
<?= $form->field($model, 'area')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'extra_price')->textInput() ?>
<?= $form->field($model, 'billing_type')->textInput() ?>
<?= $form->field($model, 'extra_weight_type')->textInput() ?>
<?= $form->field($model, 'exemption_type')->textInput() ?>
<?= $form->field($model, 'basic_price')->textInput() ?>
<?= $form->field($model, 'extra_price')->textInput() ?>
<?= $form->field($model, 'exemption_amount')->textInput() ?>
<?= $form->field($model, 'support_taking')->textInput() ?>
<?= $form->field($model, 'taking_site')->textarea(['rows' => 6]) ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
<?php
$js=<<<JS
const formList = [//切换时,class对应的标题
{
"field-expresstemplate-basic_amount":"基本重量(KG)",
"field-expresstemplate-basic_price":"基本运费(元)",
"field-expresstemplate-extra_amount":"续重重量(KG)",
"field-expresstemplate-extra_price":"续重运费(元)"
},
{
"field-expresstemplate-basic_amount":"基本数量(件)",
"field-expresstemplate-basic_price":"基本运费(元)",
"field-expresstemplate-extra_amount":"续重数量(件)",
"field-expresstemplate-extra_price":"续重运费(元)"
}
]
const udfVal = [//初始值
[0.1,"0.00"],
[1,"0.00"]
]
var calType = 1;//初始的计算方式0:计重 1:计件
function changeCalType(type){//当切换计算方式
$.each(formList[type],function(index,value){ //更改文字标题
$("." + index).children("label").html(value)
});
$(".form-control").eq(1).val(udfVal[type][0])//重置初始值
$(".form-control").eq(2).val(udfVal[type][1])
calType = type;
}
$(document).ready(function(){
$(".form-control").eq(1).blur(function(){
if (calType == 0) {
if($(this).val() < 0.1){
$(this).val(0.1)
}
var basicAmount = $(this).val();
$(this).val(Math.floor(basicAmount * 10) / 10);
} else{
if($(this).val() < 1){
$(this).val(1)
}
var basicAmount = $(this).val();
$(this).val(Math.floor(basicAmount * 1) / 1);
}
})
$(".form-control").eq(2).blur(function(){
if($(this).val() < 0){
$(this).val("0.00")
}
var basicPrice = $(this).val();
$(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/));
})
$(".form-control").eq(3).blur(function(){
if (calType == 0) {
if($(this).val() < 0){
$(this).val(0)
}
var basicAmount = $(this).val();
$(this).val(Math.floor(basicAmount * 10) / 10);
} else{
if($(this).val() < 0){
$(this).val(0)
}
var basicAmount = $(this).val();
$(this).val(Math.floor(basicAmount * 1) / 1);
}
})
$(".form-control").eq(4).blur(function(){
if($(this).val() < 0){
$(this).val("0.00")
}
var basicPrice = $(this).val();
$(this).val(basicPrice.toString().match(/^\d+(?:\.\d{0,2})?/));
})
$("input:radio[name='ExpressTemplate[calculation]']").on('ifChecked', function(event){
changeCalType($(this).val()-1)
})
changeCalType(calType)
})
JS;
$this->registerJs($js)
</div>
?>

2
backend/views/express-template/_search.php

@ -5,7 +5,7 @@ use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker; use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\searchs\ExpressTemplateSearch */
/* @var $model backend\models\searchs\ExpressTemplateSearch */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>

428
backend/views/express-template/area.php

@ -0,0 +1,428 @@
<?php
use yii\helpers\Html;
use antkaz\vue\VueAsset;
use xj\babel\BrowserAsset;
VueAsset::register($this); // register VueAsset
xj\babel\BrowserAsset::register($this);
?>
<style>
.goods-create {
overflow: visible!important;
}
.city--list.popup {
top: 35px;
max-height: 480px;
overflow: auto;
}
#app label {
display: flex;
margin: 0;
}
#app label span {
flex-shrink: 0;
}
#app label input {
width: unset!important;
}
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
}
.list-complete-item {
transition: all 1s;
display: inline-block;
margin-right: 10px;
}
.list-complete-enter, .list-complete-leave-to
/* .list-complete-leave-active for below version 2.1.8 */ {
opacity: 0;
transform: translateY(30px);
}
.list-complete-leave-active {
position: absolute;
}
div,p{margin:0;padding:0; line-height:1.5;}
.checks{ padding-left:20px;}
.province--list, .city--list {
display: flex;
flex-wrap: wrap;
padding-left: 10px;
list-style-type: none;
}
.province--list > li {
display: inline-flex;
align-items: center;
flex-shrink: 0;
position: relative;
margin-right: 10px;
padding: 5px 10px;
}
.province--list > li .city--list {
position: absolute;
padding: 10px;
background: #fff;
z-index: 10000;
box-shadow: 0 0 40px 10px rgba(0, 0, 0, .1);
border-radius: 10px;
/*opacity: 0;*/
/*transition: all .2s;*/
}
/*.province--list > li.active {*/
/*box-shadow: 0 0 40px 10px rgba(0, 0, 0, .1);*/
/*}*/
.province--list > li.active {
color: #259c24;
}
.province--list > li.active .city--list {
opacity: 1;
}
.province--list > li ul li {
display: block;
width: 200px;
padding: 0;
}
input[type="checkbox"] {
margin-right: 5px;
}
.glyphicon {
padding: 5px;
transition: all .2s;
cursor: pointer;
}
.glyphicon.glyphicon-menu-down.switch--popup {
position: relative;
top: -1px;
}
.province--list > li.active .glyphicon {
transform: rotate(180deg);
}
.shade {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
}
label {
font-weight: normal;
}
.display-checked ul li {
position: relative;
display: inline-block;
padding: 5px 10px;
margin: 5px;
border-radius: 5px;
list-style-type: none;
background: #00a65a;
color: #fff;
}
.display-checked ul li ul {
position: absolute;
left: 50%;
width: 200px;
padding: 10px;
opacity: 0;
background: #fff;
z-index: 10000;
box-shadow: 0 0 40px 10px rgba(0, 0, 0, .1);
border-radius: 10px;
transform: translateX(-50%);
transition: all .2s;
}
.display-checked ul li:hover ul {
opacity: 1;
}
.display-checked .close {
float: none!important;
padding: 0;
font-size: 1em;
color: #fff;
opacity: 1;
transition: all .2s;
}
.display-checked .close:active {
transform: scale(.6);
}
</style>
<div id="app" class="vue">
<div class="display-checked">
<p>已选:</p>
<ul>
<li
v-for="province in area.filter(i => i.city.find(j => j.checked))"
:key="province.id"
class="list-complete-item"
>
<div
class="close glyphicon glyphicon-remove"
title="删除"
@click="province.checked = false; province.city.forEach(i => i.checked = false)"
></div>
<span>{{province.province}}</span>
<!-- <ul>-->
<!-- <li>-->
<!-- <div class="close glyphicon glyphicon-remove" title="删除"></div>-->
<!-- <span>广东省</span>-->
<!-- </li>-->
<!-- </ul>-->
</li>
</ul>
</div>
<div class="J_CheckWrap">
<div v-if="activeProvince >= 0" @click="activeProvince = -1" class="shade" id="shade-layer"></div>
<label class="check-all"><input type="checkbox" v-model="isCheckAll" /><span>全选</span></label>
<div class="checks">
<ul class="province--list">
<li data-role="province" v-for="(province, index) in area">
<label data-type="province">
<input
type="checkbox"
v-model="province.checked"
@change="province.city.forEach(i => i.checked = province.checked)"
/>
<span>{{province.province}}</span>
</label>
<div
class="fa fa-angle-down switch--popup"
@click="activeProvince = index"
></div>
<transition name="fade">
<ul v-show="activeProvince === index" class="city--list popup">
<li class="checks" v-for="city in province.city">
<label>
<input
type="checkbox"
:name="`area[${city.id}]`"
<?php // in_array($city->city_id,$cities)?'checked':'' ?>
value="city.id"
v-model="city.checked"
@change="province.id = area[area.length - 1].id + 1; province.checked = province.city.every(i => i.checked)"
/>{{city.name}}</label>
</li>
</ul>
</transition>
</li>
</ul>
</div>
</div>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
area: (<?= json_encode($data) ?>).map(i => {
return {
...i,
city: i.city.map(j => {return {...j, checked: false}}),
checked: false
}
}),
checkedAreaIds: (<?= json_encode($cities) ?>),
activeProvince: -1
},
computed: {
isCheckAll: {
get() {
return this.area.every(i => i.checked)
},
set(value) {
this.area.forEach(i => {
i.checked = value;
i.city.forEach(j => j.checked = value)
})
}
}
},
methods: {
clickProvince(index) {
for (let city in this.area[index].city) {
city.checked = this.area[index].checked
}
},
reverseMessage: function () {
this.message = this.message.split('').reverse().join('')
}
},
created() {
this.checkedAreaIds.length > 0 && this.area.forEach(province => {
let count = 0;
province.city.forEach(city => {
if (this.checkedAreaIds.indexOf(city.id.toString()) >= 0) {
city.checked = true;
count++;
}
});
if (count >= province.city.length) {
province.checked = true;
}
})
// document.body.addEventListener('click', e => {
// let isSwitch = e.target.classList.contains('switch--popup');
// let isCheckbox = e.target.type === 'checkbox';
// let isLabel = e.target.dataset.type === 'province';
//
// if (this.activeProvince >= 0 && !isCheckbox && !isSwitch && !isLabel) {
// this.activeProvince = -1;
// e.stopPropagation();
// }
// })
}
});
</script>
<div>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<!--<script >-->
<!--//-->
<!--// (function (win, doc, $) {-->
<!--// $.fn.extend({-->
<!--// checktree : function () {-->
<!--// this.click(function (evt) {-->
<!--// var evtEle = $(evt.target).closest("input:checkbox");-->
<!--// if (!evtEle[0]) {-->
<!--// return;-->
<!--// }-->
<!--// //check child all-->
<!--// evtEle.parent().next(".checks").find("input:checkbox").attr("checked", evtEle[0].checked);-->
<!--//-->
<!--// //check parent-->
<!--// if (evtEle.is("input:checked")) {-->
<!--// // evtEle.parents(".checks").each(function () {-->
<!--// // !$(this).children("p").children("input:checkbox").filter(function () {-->
<!--// // return !this.checked;-->
<!--// // })[0] && $(this).prev().children("input:checkbox").attr("checked", "checked");-->
<!--// // });-->
<!--// } else {-->
<!--// evtEle.parents(".checks").prev().children("input:checkbox").attr("checked", false);-->
<!--// }-->
<!--// });-->
<!--// }-->
<!--// });-->
<!--//// document.querySelector('.container-fluid.form-vertical').addEventListener('submit', function (e) {-->
<!--////-->
<!--//// alert('ggg');-->
<!--//// e.preventDefault();-->
<!--//// return false;-->
<!--//// })-->
<!--// })(window, document, jQuery);-->
<!---->
<!-- function $(query) {-->
<!-- return document.querySelector(query);-->
<!-- }-->
<!---->
<!-- function $$(query) {-->
<!-- return document.querySelectorAll(query);-->
<!-- }-->
<!---->
<!-- var activeProvince = null;-->
<!---->
<!-- window.addEventListener('click', function (e) {-->
<!-- function $(query) {-->
<!-- return document.querySelector(query);-->
<!-- }-->
<!---->
<!-- if (e.target.type === 'checkbox') {-->
<!-- var parent = e.target.parentElement;-->
<!---->
<!-- if (parent.dataset.type === 'province') {-->
<!-- // 点击省复选框-->
<!-- // parent.parentElement.className = e.target.checked ? 'active' : '';-->
<!---->
<!-- var ul = parent.nextElementSibling;-->
<!-- var inputList = ul.querySelectorAll('input[type="checkbox"]');-->
<!---->
<!-- for (var i = 0, input; input = inputList[i++];) {-->
<!-- input.checked = e.target.checked;-->
<!-- }-->
<!---->
<!-- var isCheckedAllProvince = Array.prototype.every.call($$('.checkbox-province'), i => i.checked);-->
<!---->
<!-- $('#check-all-province').checked = isCheckedAllProvince;-->
<!-- } else {-->
<!-- // 点击城市复选框-->
<!-- var parentUL = e.target.parentElement.parentElement.parentElement;-->
<!-- var inputList = parentUL.querySelectorAll('input');-->
<!-- var parentInput = parentUL.previousElementSibling.querySelector('input');-->
<!-- var isCheckedAllCity = Array.prototype.every.call(inputList, i => i.checked);-->
<!-- parentInput.checked = isCheckedAllCity;-->
<!-- var isCheckedAllProvince = Array.prototype.every.call($$('.checkbox-province'), i => i.checked);-->
<!-- $('#check-all-province').checked = isCheckedAllProvince;-->
<!-- }-->
<!-- }-->
<!-- if (e.target.className === 'glyphicon glyphicon-menu-down switch--popup') {-->
<!-- var parentLi = e.target.parentElement;-->
<!---->
<!-- if (parentLi.classList.contains('active')) {-->
<!-- parentLi.classList.remove('active');-->
<!-- activeProvince = null;-->
<!-- $('#shade-layer').className = ''-->
<!-- } else {-->
<!-- activeProvince && (activeProvince.className = '');-->
<!-- parentLi.classList.add('active');-->
<!-- activeProvince = parentLi;-->
<!-- // $('#shade-layer').className = 'shade'-->
<!-- }-->
<!-- } else {-->
<!-- function $(query) {-->
<!-- return document.querySelector(query);-->
<!-- }-->
<!-- activeProvince && (activeProvince.className = '');-->
<!-- activeProvince = null;-->
<!-- $('#shade-layer').className = '';-->
<!-- }-->
<!-- });-->
<!---->
<!-- $('#check-all-province').addEventListener('change', function (e) {-->
<!-- Array.prototype.forEach.call($$('.checkbox-province'), function (input) {-->
<!-- input.checked = e.target.checked;-->
<!-- var parent = input.parentElement;-->
<!---->
<!-- var ul = parent.nextElementSibling;-->
<!-- var inputList = ul.querySelectorAll('input[type="checkbox"]');-->
<!---->
<!-- for (var i = 0, item; item = inputList[i++];) {-->
<!-- item.checked = e.target.checked;-->
<!-- }-->
<!-- })-->
<!-- });-->
<!---->
<!-- // $('#shade-layer').addEventListener('click', function () {-->
<!-- // function $(query) {-->
<!-- // return document.querySelector(query);-->
<!-- // }-->
<!-- // activeProvince && (activeProvince.className = '');-->
<!-- // activeProvince = null;-->
<!-- // $('#shade-layer').className = '';-->
<!-- // });-->
<!---->
<!--</script>-->
<!--<script>-->
<!-- $(".J_CheckWrap").checktree();-->
<!--</script>-->
</div>

44
backend/views/express-template/create.php

@ -1,18 +1,50 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap4\Html;
use yii\bootstrap4\ActiveForm;
use kartik\tabs\TabsX;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\ExpressTemplate */
/* @var $model backend\models\ars\ExpressTemplate */
$this->title = '创建 Express Template';
$this->title = '创建运费模板';
$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
Yii::$app->params['bsVersion'] = '4.x';
?> ?>
<div class="express-template-create"> <div class="express-template-create">
<div class="express-template-form">
<?= $this->render('_form', [
'model' => $model,
]) ?>
<?php
$form = ActiveForm::begin(['options' => ['class' => 'container-fluid']]);
echo TabsX::widget([
'bordered' => true,
'items' => [
[
'label' => '<i class="fas fa-user"></i> 基本信息',
'content' => $this->render('_form', [
'model' => $model,
'form' => $form,
]),
],
[
'label' => '<i class="fas fa-globe"></i> 选择配送区域',
'content' => $this->render('area', ['data' => $data, 'form' => $form, 'cities' => []
]),
],
],
'position' => TabsX::POS_ABOVE,
'encodeLabels' => false
]);
?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div> </div>

2
backend/views/express-template/index.php

@ -4,7 +4,7 @@ use yii\helpers\Html;
use iron\grid\GridView; use iron\grid\GridView;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\ExpressTemplateSearch */
/* @var $searchModel backend\models\searchs\ExpressTemplateSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '运费模板'; $this->title = '运费模板';

44
backend/views/express-template/update.php

@ -1,19 +1,51 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap4\Html;
use yii\bootstrap4\ActiveForm;
use kartik\tabs\TabsX;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\ExpressTemplate */
/* @var $model backend\models\ars\ExpressTemplate */
$this->title = '编辑 Express Template: ' . $model->name;
$this->title = '编辑运费模板: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Express Templates', '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'][] = 'Update ';
Yii::$app->params['bsVersion'] = '4.x';
?> ?>
<div class="express-template-update"> <div class="express-template-update">
<div class="express-template-form">
<?= $this->render('_form', [
'model' => $model,
]) ?>
<?php
$form = ActiveForm::begin(['options' => ['class' => 'container-fluid']]);
echo TabsX::widget([
'bordered' => true,
'items' => [
[
'label' => '<i class="fas fa-user"></i> 基本信息',
'content' => $this->render('_form', [
'model' => $model,
'form' => $form,
]),
],
[
'label' => '<i class="fas fa-globe"></i> 选择配送区域',
'content' => $this->render('area', ['data' => $data, 'form' => $form, 'cities' => $cities
]),
],
],
'position' => TabsX::POS_ABOVE,
'encodeLabels' => false
]);
?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div> </div>

34
backend/views/express-template/view.php

@ -2,9 +2,10 @@
use yii\helpers\Html; use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
use backend\models\ars\ExpressTemplate;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\ExpressTemplate */
/* @var $model backend\models\ars\ExpressTemplate */
$this->title = $model->name; $this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Express Templates', 'url' => ['index']];
@ -22,19 +23,28 @@ $this->params['breadcrumbs'][] = $this->title;
'attributes' => [ 'attributes' => [
'id', 'id',
'name', 'name',
'province:ntext',
'city:ntext',
'area:ntext',
'billing_type',
'extra_weight_type',
'exemption_type',
[
'attribute' => 'calculation',
'value' => function ($model) {
return ExpressTemplate::$calculation[$model->calculation];
}
],
'basic_price', 'basic_price',
'basic_amount',
'extra_price', 'extra_price',
'exemption_amount',
'support_taking',
'taking_site:ntext',
'updated_at',
'created_at',
'extra_amount',
'updated_at:datetime',
'created_at:datetime',
['attribute' => 'city',
'value' => function ($model) {
$array = explode(',', $model->city);
$cities = [];
foreach (\backend\models\ars\City::find()->andWhere(['in', 'city_id', $array])->all() as $city) {
$cities[] = $city->name;
}
return implode(' // ', $cities);
},
],
], ],
]) ?> ]) ?>

7
backend/views/layouts/main.php

@ -19,6 +19,13 @@ AppAsset::register($this);
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<?php $this->registerCsrfMetaTags() ?> <?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title> <title><?= Html::encode($this->title) ?></title>
<?php if (YII_ENV == 'dev'){?>
<!-- 开发环境版本,包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<?php } else {?>
<!-- 生产环境版本,优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<?php } ?>
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>
<body class="hold-transition skin-blue-light sidebar-mini"> <body class="hold-transition skin-blue-light sidebar-mini">

12
backend/views/layouts/sidebar.php

@ -21,12 +21,12 @@ use iron\widgets\Menu;
] ]
], ],
['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-box', 'items' => [ ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-box', 'items' => [
['label' => '后台商品分类', 'url' => ['/antgoods/category/index']],
['label' => '规格管理', 'url' => ['/antgoods/attribute/index']],
['label' => '前端商品分类', 'url' => ['/antgoods/shop-category/index']],
['label' => '品牌管理', 'url' => ['/antgoods/brand/index']],
['label' => '供应商管理', 'url' => ['/antgoods/supplier/index']],
['label' => '商品列表', 'url' => ['/antgoods/goods/index']],
['label' => '后台商品分类', 'url' => ['/goods/category/index']],
['label' => '规格管理', 'url' => ['/goods/attribute/index']],
['label' => '前端商品分类', 'url' => ['/goods/shop-category/index']],
['label' => '品牌管理', 'url' => ['/goods/brand/index']],
['label' => '供应商管理', 'url' => ['/goods/supplier/index']],
['label' => '商品列表', 'url' => ['/goods/goods/index']],
] ]
], ],
['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [ ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [

2
backend/views/order/_form.php

@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\Order */
/* @var $model backend\models\ars\Order */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>

2
backend/views/order/_search.php

@ -5,7 +5,7 @@ use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker; use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\searchs\OrderSearch */
/* @var $model backend\models\searchs\OrderSearch */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>

2
backend/views/order/create.php

@ -3,7 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\Order */
/* @var $model backend\models\ars\Order */
$this->title = '创建 Order'; $this->title = '创建 Order';
$this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']];

2
backend/views/order/index.php

@ -4,7 +4,7 @@ use yii\helpers\Html;
use iron\grid\GridView; use iron\grid\GridView;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\OrderSearch */
/* @var $searchModel backend\models\searchs\OrderSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Orders'; $this->title = 'Orders';

2
backend/views/order/update.php

@ -3,7 +3,7 @@
use yii\helpers\Html; use yii\helpers\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\Order */
/* @var $model backend\models\ars\Order */
$this->title = '编辑 Order: ' . $model->id; $this->title = '编辑 Order: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']];

4
backend/views/order/view.php

@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\Order */
/* @var $model backend\models\ars\Order */
$this->title = $model->id; $this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Orders', 'url' => ['index']];
@ -43,7 +43,7 @@ $this->params['breadcrumbs'][] = $this->title;
'receivables', 'receivables',
'remarks', 'remarks',
'discount_amount', 'discount_amount',
'discount_decription:ntext',
'discount_description:ntext',
'updated_at', 'updated_at',
'created_at', 'created_at',
], ],

2
backend/views/site/login.php

@ -1,7 +1,7 @@
<?php <?php
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */ /* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */
/* @var $model \backend\models\LoginForm */
use yii\helpers\Html; use yii\helpers\Html;
use yii\bootstrap4\ActiveForm; use yii\bootstrap4\ActiveForm;

2
backend/views/site/test.php

@ -9,7 +9,7 @@ $this->params['subtitle'] = '这是一个小小的测试';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\CategorySearch */
/* @var $model backend\models\CategorySearch */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>

49
backend/views/taking-site/_form.php

@ -1,11 +1,19 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap4\Html;
use yii\bootstrap4\ActiveForm; use yii\bootstrap4\ActiveForm;
use blobt\widgets\Icheck;
use kartik\depdrop\DepDrop;
use backend\models\ars\Province;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\TakingSite */
/* @var $model backend\models\ars\TakingSite */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
$provinces = Province::find()->select('province_id as id,name')->asArray()->all();
$data = ArrayHelper::map($provinces, 'id', 'name');
Yii::$app->params['bsVersion'] = '4.x';
?> ?>
<div class="taking-site-form"> <div class="taking-site-form">
@ -14,15 +22,40 @@ use yii\bootstrap4\ActiveForm;
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'province')->textInput(['maxlength' => true]) ?>
<div class="row">
<div class="col-lg-4">
<?= $form->field($model, 'province')->dropDownList($data, ['id' => 'province-id', 'prompt' => '请选择']); ?>
</div>
<div class="col-lg-4">
<?= $form->field($model, 'city')->widget(DepDrop::classname(), [
'options' => ['id' => 'city-id', 'prompt' => $model->city],
'data' => $cityList,
'pluginOptions' => [
'depends' => ['province-id'],
'placeholder' => '请选择成市',
'url' => Url::to(['/taking-site/city'])
],
'pluginEvents' => [
"depdrop:change" => "function(event, id, value, count) { log(id); log(value); log(count); }",
]
<?= $form->field($model, 'city')->textInput(['maxlength' => true]) ?>
]) ?>
</div>
<div class="col-lg-4">
<?= $form->field($model, 'area')->widget(DepDrop::classname(), [
'options' => ['prompt' => $model->area],
'data' => $areaList,
'pluginOptions' => [
'depends' => ['city-id'],
'placeholder' => '请选择县区',
'url' => Url::to(['/taking-site/area'])
<?= $form->field($model, 'area')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'address')->textarea(['rows' => 6]) ?>
]
]) ?>
</div>
</div>
<?= $form->field($model, 'is_default')->textInput() ?>
<?= $form->field($model, 'address')->textarea(['rows' => 2]) ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?> <?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>

2
backend/views/taking-site/_search.php

@ -5,7 +5,7 @@ use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker; use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\searchs\TakingSiteSearch */
/* @var $model backend\models\searchs\TakingSiteSearch */
/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>

6
backend/views/taking-site/create.php

@ -1,9 +1,9 @@
<?php <?php
use yii\helpers\Html;
use yii\bootstrap4\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\TakingSite */
/* @var $model backend\models\ars\TakingSite */
$this->title = '创建 Taking Site'; $this->title = '创建 Taking Site';
$this->params['breadcrumbs'][] = ['label' => 'Taking Sites', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Taking Sites', 'url' => ['index']];
@ -13,6 +13,8 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
'cityList'=>[],
'areaList'=>[]
]) ?> ]) ?>
</div> </div>

4
backend/views/taking-site/index.php

@ -4,10 +4,10 @@ use yii\helpers\Html;
use iron\grid\GridView; use iron\grid\GridView;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\TakingSiteSearch */
/* @var $searchModel backend\models\searchs\TakingSiteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Taking Sites';
$this->title = '上门自提';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="row"> <div class="row">

13
backend/views/taking-site/update.php

@ -1,19 +1,28 @@
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use backend\models\ars\City;
use backend\models\ars\Area;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\TakingSite */
/* @var $model backend\models\ars\TakingSite */
$this->title = '编辑 Taking Site: ' . $model->name;
$this->title = '编辑: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Taking Sites', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Taking Sites', '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'][] = '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');
?> ?>
<div class="taking-site-update"> <div class="taking-site-update">
<?= $this->render('_form', [ <?= $this->render('_form', [
'model' => $model, 'model' => $model,
'cityList' => $cityList,
'areaList' => $areaList
]) ?> ]) ?>
</div> </div>

3
backend/views/taking-site/view.php

@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\ars\TakingSite */
/* @var $model backend\models\ars\TakingSite */
$this->title = $model->name; $this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Taking Sites', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Taking Sites', 'url' => ['index']];
@ -26,7 +26,6 @@ $this->params['breadcrumbs'][] = $this->title;
'city', 'city',
'area', 'area',
'address:ntext', 'address:ntext',
'is_default',
'updated_at', 'updated_at',
'created_at', 'created_at',
], ],

vendor/antgoods/goods/src/assets/js/jquery.js → backend/web/js/jquery.js

2966
backend/web/js/jquery.min.js
File diff suppressed because it is too large
View File

2
common/config/bootstrap.php

@ -2,4 +2,4 @@
Yii::setAlias('@common', dirname(__DIR__)); Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console'); Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend'); Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api');
Yii::setAlias('@antgoods', dirname(dirname(__DIR__)) . '/antgoods');

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save