Forráskód Böngészése

Merge branch 'redesign‌-260706' into dev

shizhongqi 2 hete
szülő
commit
5be2fecc73

+ 56 - 0
app-hd/controllers/PsMethodController.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace hd\controllers;
+
+use bizHd\order\classes\PsMethodClass;
+use Yii;
+use common\components\util;
+
+/**
+ * 花店配送方式设置接口(xhPsMethod / xhPsExplain / xhPsReduceRule)
+ * 用途:hdApp 门店设置-配送方式页,与供货商 xhSh* 配置分离
+ */
+class PsMethodController extends BaseController
+{
+    /**
+     * 获取指定配送方式的配置
+     * GET style:0送货 1自取 2跑腿 3物流 4快递
+     */
+    public function actionGetConfig()
+    {
+        $style = Yii::$app->request->get('style', 0);
+        try {
+            $config = PsMethodClass::getConfig($this->shopId, $this->mainId, $style);
+            util::success($config);
+        } catch (\Exception $e) {
+            util::fail($e->getMessage());
+        }
+    }
+
+    /**
+     * 获取所有配送方式的排序与别名(底部预览用)
+     */
+    public function actionGetSorts()
+    {
+        try {
+            $sorts = PsMethodClass::getSorts($this->mainId);
+            util::success($sorts);
+        } catch (\Exception $e) {
+            util::fail($e->getMessage());
+        }
+    }
+
+    /**
+     * 保存指定配送方式配置
+     */
+    public function actionSaveConfig()
+    {
+        $post = Yii::$app->request->post();
+        try {
+            PsMethodClass::saveConfig($this->shopId, $this->mainId, $post);
+            util::complete('保存成功');
+        } catch (\Exception $e) {
+            util::fail($e->getMessage());
+        }
+    }
+}

+ 4 - 1
app-hd/controllers/ShMethodController.php

@@ -7,9 +7,12 @@ use bizHd\ghs\classes\GhsClass;
 use Yii;
 use common\components\util;
 
+/**
+ * 花店配送方式接口(供货商 xhSh* 表,供进货结算等场景)
+ * 用途:门店向供货商下单时读取配送配置;设置页请走 PsMethodController
+ */
 class ShMethodController extends BaseController
 {
-
     /**
      * 获取供货商所有的5种配送方式配置
      * 如果数据库里没有,则取默认配置进行初始化

+ 90 - 0
app-hd/controllers/WlController.php

@@ -0,0 +1,90 @@
+<?php
+/**
+ * 花店物流选项管理
+ * 用途:配送方式-物流(style=3)关联的物流名称维护,与 ghs 端 WlClass 共用主账号维度数据
+ */
+
+namespace hd\controllers;
+
+use bizGhs\merchant\classes\WlClass;
+use Yii;
+use common\components\util;
+
+class WlController extends BaseController
+{
+    /** 获取全部物流(下拉用) */
+    public function actionGetAllWl()
+    {
+        $list = WlClass::getAllByCondition(['mainId' => $this->mainId, 'delStatus' => 0], 'inTurn DESC', 'id,name');
+        util::success(['list' => $list]);
+    }
+
+    /** 物流列表(分页) */
+    public function actionList()
+    {
+        $where = ['mainId' => $this->mainId, 'delStatus' => 0];
+        $list = WlClass::getWlList($where);
+        util::success($list);
+    }
+
+    /** 删除物流 */
+    public function actionDelWl()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $wl = WlClass::getById($id, true);
+        if (empty($wl)) {
+            util::fail('没有物流信息');
+        }
+        if ($wl->mainId != $this->mainId) {
+            util::fail('无法操作');
+        }
+        $wl->delStatus = 1;
+        $wl->save();
+        util::complete();
+    }
+
+    /** 添加物流 */
+    public function actionAdd()
+    {
+        $post = Yii::$app->request->post();
+        $post['mainId'] = $this->mainId ?? 0;
+        $name = trim($post['name'] ?? '');
+        if (empty($name)) {
+            util::fail('请填写名称');
+        }
+        $has = WlClass::getByCondition(['mainId' => $this->mainId, 'name' => $name], true);
+        if (!empty($has)) {
+            $has->delStatus = 0;
+            $has->save();
+        } else {
+            WlClass::add($post);
+        }
+        util::complete('添加成功');
+    }
+
+    /** 更新物流 */
+    public function actionUpdate()
+    {
+        $post = Yii::$app->request->post();
+        $name = trim($post['name'] ?? '');
+        $inTurn = $post['inTurn'] ?? 100;
+        $id = $post['id'] ?? 0;
+        $pre = WlClass::getById($id, true);
+        if (empty($pre)) {
+            util::fail('修改失败');
+        }
+        if ($pre->mainId != $this->mainId) {
+            util::fail('没有权限修改');
+        }
+        if ($name != $pre->name) {
+            $repeat = WlClass::getByCondition(['mainId' => $this->mainId, 'name' => $name], true);
+            if (!empty($repeat)) {
+                util::fail('名称已经存在');
+            }
+        }
+        $pre->name = $name;
+        $pre->inTurn = $inTurn;
+        $pre->save();
+        util::complete();
+    }
+}

+ 188 - 0
app-mall/controllers/UserAddressController.php

@@ -0,0 +1,188 @@
+<?php
+
+namespace mall\controllers;
+
+use common\components\util;
+use common\models\xhUserAddress;
+use Yii;
+
+class UserAddressController extends BaseController
+{
+    public $guestAccess = [];
+
+    // 获取地址列表
+    public function actionList()
+    {
+        $user = $this->user;
+        if (empty($user)) {
+            util::fail('请先登录');
+        }
+
+        $list = xhUserAddress::find()
+            ->where(['userId' => $user->id])
+            ->orderBy(['default' => SORT_DESC, 'id' => SORT_DESC])
+            ->asArray()
+            ->all();
+
+        // 格式化数据,兼容前端需要的字段
+        foreach ($list as &$item) {
+            $item['name'] = $item['name'] ?? '';
+            $item['phone'] = $item['phone'] ?? '';
+            $item['tag'] = $item['tag'] ?? '';
+        }
+
+        util::success(['list' => $list]);
+    }
+
+    // 获取地址详情
+    public function actionDetail()
+    {
+        $user = $this->user;
+        if (empty($user)) {
+            util::fail('请先登录');
+        }
+
+        $id = Yii::$app->request->get('id');
+        if (empty($id)) {
+            util::fail('参数错误');
+        }
+
+        $info = xhUserAddress::find()
+            ->where(['id' => $id, 'userId' => $user->id])
+            ->asArray()
+            ->one();
+
+        if (empty($info)) {
+            util::fail('地址不存在');
+        }
+
+        util::success(['info' => $info]);
+    }
+
+    // 创建地址
+    public function actionCreate()
+    {
+        $user = $this->user;
+        if (empty($user)) {
+            util::fail('请先登录');
+        }
+
+        $post = Yii::$app->request->post();
+        
+        $model = new xhUserAddress();
+        $model->userId = $user->id;
+        $model->name = $post['name'] ?? '';
+        $model->phone = $post['phone'] ?? '';
+        $model->tag = $post['tag'] ?? '';
+        $model->lat = $post['lat'] ?? '';
+        $model->long = $post['long'] ?? '';
+        $model->province = $post['province'] ?? '';
+        $model->city = $post['city'] ?? '';
+        $model->dist = $post['dist'] ?? '';
+        $model->address = $post['address'] ?? '';
+        $model->floor = $post['floor'] ?? '';
+        $model->fullAddress = $post['fullAddress'] ?? '';
+        $model->showAddress = $post['showAddress'] ?? '';
+        $model->default = $post['default'] ?? 0;
+        
+        if ($model->default == 1) {
+            xhUserAddress::updateAll(['default' => 0], ['userId' => $user->id]);
+        }
+
+        if ($model->save()) {
+            util::complete();
+        } else {
+            util::fail('保存失败');
+        }
+    }
+
+    // 更新地址
+    public function actionUpdate()
+    {
+        $user = $this->user;
+        if (empty($user)) {
+            util::fail('请先登录');
+        }
+
+        $post = Yii::$app->request->post();
+        $id = $post['id'] ?? 0;
+
+        $model = xhUserAddress::findOne(['id' => $id, 'userId' => $user->id]);
+        if (empty($model)) {
+            util::fail('地址不存在');
+        }
+
+        $model->name = $post['name'] ?? $model->name;
+        $model->phone = $post['phone'] ?? $model->phone;
+        $model->tag = $post['tag'] ?? $model->tag;
+        $model->lat = $post['lat'] ?? $model->lat;
+        $model->long = $post['long'] ?? $model->long;
+        $model->province = $post['province'] ?? $model->province;
+        $model->city = $post['city'] ?? $model->city;
+        $model->dist = $post['dist'] ?? $model->dist;
+        $model->address = $post['address'] ?? $model->address;
+        $model->floor = $post['floor'] ?? $model->floor;
+        $model->fullAddress = $post['fullAddress'] ?? $model->fullAddress;
+        $model->showAddress = $post['showAddress'] ?? $model->showAddress;
+        $model->default = $post['default'] ?? $model->default;
+
+        if ($model->default == 1) {
+            xhUserAddress::updateAll(['default' => 0], ['userId' => $user->id]);
+        }
+
+        if ($model->save()) {
+            util::complete();
+        } else {
+            util::fail('保存失败');
+        }
+    }
+
+    // 删除地址
+    public function actionDelete()
+    {
+        $user = $this->user;
+        if (empty($user)) {
+            util::fail('请先登录');
+        }
+
+        $post = Yii::$app->request->post();
+        $id = $post['id'] ?? 0;
+
+        $model = xhUserAddress::findOne(['id' => $id, 'userId' => $user->id]);
+        if (empty($model)) {
+            util::fail('地址不存在');
+        }
+
+        if ($model->delete()) {
+            util::complete();
+        } else {
+            util::fail('删除失败');
+        }
+    }
+
+    // 设为默认地址
+    public function actionSetDefault()
+    {
+        $user = $this->user;
+        if (empty($user)) {
+            util::fail('请先登录');
+        }
+
+        $post = Yii::$app->request->post();
+        $id = $post['id'] ?? 0;
+
+        $model = xhUserAddress::findOne(['id' => $id, 'userId' => $user->id]);
+        if (empty($model)) {
+            util::fail('地址不存在');
+        }
+
+        xhUserAddress::updateAll(['default' => 0], ['userId' => $user->id]);
+        $model->default = 1;
+        
+        if ($model->save()) {
+            util::complete();
+        } else {
+            util::fail('设置失败');
+        }
+    }
+}

+ 2 - 1
biz-hd/homePageConfig/classes/HomePageModuleClass.php

@@ -578,8 +578,9 @@ class HomePageModuleClass
             // 商品类型:保留用户选择顺序
             $goodsIds = $ids;
         } elseif ($type === self::LINK_CATEGORY) {
+            // xhGoodsCategory 无 delStatus 字段;未删除/上架状态在下方按 xhGoods 过滤
             $rows = GoodsCategoryClass::getAllByCondition(
-                ['cId' => ['in', $ids], 'delStatus' => 0],
+                ['cId' => ['in', $ids]],
                 null,
                 'gId'
             );

+ 15 - 0
biz-hd/order/classes/PsExplainClass.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * 用途:花店配送方式说明项业务逻辑类
+ * 谁用:花店系统
+ * 解决什么问题:处理 xhPsExplain 说明项的增删改查
+ */
+
+namespace bizHd\order\classes;
+
+use bizHd\base\classes\BaseClass;
+
+class PsExplainClass extends BaseClass
+{
+    public static $baseFile = '\bizHd\order\models\PsExplain';
+}

+ 195 - 0
biz-hd/order/classes/PsMethodClass.php

@@ -0,0 +1,195 @@
+<?php
+/**
+ * 用途:花店配送方式配置业务逻辑类
+ * 谁用:花店系统 hdApp 配送方式设置页
+ * 解决什么问题:读写 xhPsMethod / xhPsExplain / xhPsReduceRule,与供货商 xhSh* 分离
+ */
+
+namespace bizHd\order\classes;
+
+use bizHd\base\classes\BaseClass;
+use common\components\dict;
+use Yii;
+
+class PsMethodClass extends BaseClass
+{
+    public static $baseFile = '\bizHd\order\models\PsMethod';
+
+    /**
+     * 获取所有配送方式的排序和别名信息
+     * @param int $mainId 商户ID
+     * @return array
+     */
+    public static function getSorts($mainId)
+    {
+        $list = [];
+        $aliases = [
+            0 => '送货',
+            1 => '自取',
+            2 => '跑腿',
+            3 => '物流',
+            4 => '快递'
+        ];
+        for ($style = 0; $style <= 4; $style++) {
+            $config = self::getByCondition(['mainId' => $mainId, 'style' => $style]);
+            $sort = 0;
+            $alias = $aliases[$style];
+            $status = 1;
+            if (!empty($config)) {
+                $sort = isset($config['sort']) ? (int)$config['sort'] : 0;
+                $alias = !empty($config['name']) ? $config['name'] : $aliases[$style];
+                $status = isset($config['status']) ? (int)$config['status'] : 1;
+            }
+            $list[] = [
+                'style' => $style,
+                'name' => $alias,
+                'sort' => $sort,
+                'status' => $status
+            ];
+        }
+        return $list;
+    }
+
+    /**
+     * 获取指定配送方式的配置(不存在则按字典默认初始化)
+     * @param int $shopId 门店ID
+     * @param int $mainId 商户ID
+     * @param int $style 配送类型 0-4
+     * @return array
+     */
+    public static function getConfig($shopId, $mainId, $style)
+    {
+        // 复杂分支/关键逻辑:按 mainId + style 查 xhPsMethod,无记录则写入默认配置
+        $config = self::getByCondition(['mainId' => $mainId, 'style' => $style]);
+        if (empty($config)) {
+            $defaultConfig = dict::getDict('shMethod', $style);
+
+            $initData = array_merge([
+                'shopId' => $shopId,
+                'mainId' => $mainId,
+                'style' => $style,
+            ], $defaultConfig);
+
+            $config = self::add($initData, true);
+            $config = $config->toArray();
+        }
+
+        // 关联说明项 xhPsExplain
+        $config['explains'] = PsExplainClass::getAllByCondition(
+            ['methodId' => $config['id']],
+            'sort ASC, id ASC'
+        );
+
+        // 跑腿 style=2 时加载满减规则 xhPsReduceRule
+        if ($style == 2) {
+            $config['reduceRules'] = PsReduceRuleClass::getAllByCondition(
+                ['methodId' => $config['id']],
+                'sort ASC, id ASC'
+            );
+        } else {
+            $config['reduceRules'] = [];
+        }
+
+        return $config;
+    }
+
+    /**
+     * 保存指定配送方式配置及关联说明项、满减规则
+     * @param int $shopId 门店ID
+     * @param int $mainId 商户ID
+     * @param array $data 配置数据
+     * @return bool
+     * @throws \Exception
+     */
+    public static function saveConfig($shopId, $mainId, $data)
+    {
+        $id = $data['id'] ?? 0;
+        $style = $data['style'] ?? 0;
+
+        $config = null;
+        if ($id > 0) {
+            $config = self::getByCondition(['id' => $id, 'mainId' => $mainId], true);
+        }
+
+        if (empty($config)) {
+            $config = self::getByCondition(['mainId' => $mainId, 'style' => $style], true);
+        }
+
+        $saveData = [
+            'name' => $data['name'] ?? '',
+            'status' => isset($data['status']) ? (int)$data['status'] : 1,
+            'sort' => isset($data['sort']) ? (int)$data['sort'] : 0,
+            'minAmount' => isset($data['minAmount']) ? (float)$data['minAmount'] : 0.00,
+            'minNum' => isset($data['minNum']) ? (int)$data['minNum'] : 0,
+            'unMeet' => isset($data['unMeet']) ? (int)$data['unMeet'] : 0,
+            'unMeetFee' => isset($data['unMeetFee']) ? (float)$data['unMeetFee'] : 0.00,
+            'startKm' => isset($data['startKm']) ? (float)$data['startKm'] : 0.00,
+            'startPrice' => isset($data['startPrice']) ? (float)$data['startPrice'] : 0.00,
+            'perKmPrice' => isset($data['perKmPrice']) ? (float)$data['perKmPrice'] : 0.00,
+            'changeRate' => isset($data['changeRate']) ? (float)$data['changeRate'] : 0.00,
+        ];
+
+        $transaction = Yii::$app->db->beginTransaction();
+        try {
+            if (empty($config)) {
+                $saveData['shopId'] = $shopId;
+                $saveData['mainId'] = $mainId;
+                $saveData['style'] = $style;
+                $defaultConfig = dict::getDict('shMethod', $style);
+                if (!empty($defaultConfig['originName'])) {
+                    $saveData['originName'] = $defaultConfig['originName'];
+                }
+                $config = self::add($saveData, true);
+            } else {
+                self::updateByCondition(['id' => $config->id], $saveData);
+            }
+
+            $methodId = $config->id;
+
+            // 1. 保存说明项 xhPsExplain
+            PsExplainClass::deleteByCondition(['methodId' => $methodId]);
+            if (!empty($data['explains']) && is_array($data['explains'])) {
+                $explainRows = [];
+                foreach ($data['explains'] as $index => $exp) {
+                    if (empty($exp['explain'])) {
+                        continue;
+                    }
+                    $explainRows[] = [
+                        'methodId' => $methodId,
+                        'explain' => $exp['explain'],
+                        'color' => isset($exp['color']) ? (int)$exp['color'] : 1,
+                        'fontWeight' => isset($exp['fontWeight']) ? (int)$exp['fontWeight'] : 1,
+                        'sort' => isset($exp['sort']) ? (int)$exp['sort'] : $index,
+                    ];
+                }
+                if (!empty($explainRows)) {
+                    PsExplainClass::batchAdd($explainRows);
+                }
+            }
+
+            // 2. 保存跑腿满减规则 xhPsReduceRule
+            PsReduceRuleClass::deleteByCondition(['methodId' => $methodId]);
+            if ($style == 2 && !empty($data['reduceRules']) && is_array($data['reduceRules'])) {
+                $ruleRows = [];
+                foreach ($data['reduceRules'] as $index => $rule) {
+                    $ruleRows[] = [
+                        'methodId' => $methodId,
+                        'meetNum' => isset($rule['meetNum']) ? (int)$rule['meetNum'] : 0,
+                        'meetAmount' => isset($rule['meetAmount']) ? (float)$rule['meetAmount'] : 0.00,
+                        'freeKm' => isset($rule['freeKm']) ? (float)$rule['freeKm'] : 0.00,
+                        'sort' => isset($rule['sort']) ? (int)$rule['sort'] : $index,
+                    ];
+                }
+                if (!empty($ruleRows)) {
+                    PsReduceRuleClass::batchAdd($ruleRows);
+                }
+            }
+
+            $transaction->commit();
+            return true;
+        } catch (\Exception $e) {
+            $transaction->rollBack();
+            throw $e;
+        }
+    }
+}

+ 15 - 0
biz-hd/order/classes/PsReduceRuleClass.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * 用途:花店跑腿满减规则业务逻辑类
+ * 谁用:花店系统
+ * 解决什么问题:处理 xhPsReduceRule 满减规则的增删改查
+ */
+
+namespace bizHd\order\classes;
+
+use bizHd\base\classes\BaseClass;
+
+class PsReduceRuleClass extends BaseClass
+{
+    public static $baseFile = '\bizHd\order\models\PsReduceRule';
+}

+ 22 - 0
biz-hd/order/models/PsExplain.php

@@ -0,0 +1,22 @@
+<?php
+/**
+ * 用途:花店配送方式说明项模型
+ * 谁用:花店系统(hdApp 配送方式设置页)
+ * 解决什么问题:存储每种配送方式下的说明文字、颜色、加粗等配置(xhPsExplain)
+ */
+
+namespace bizHd\order\models;
+
+use bizHd\base\models\Base;
+
+class PsExplain extends Base
+{
+    /**
+     * 返回对应的数据库表名
+     * @return string
+     */
+    public static function tableName()
+    {
+        return 'xhPsExplain';
+    }
+}

+ 22 - 0
biz-hd/order/models/PsMethod.php

@@ -0,0 +1,22 @@
+<?php
+/**
+ * 用途:花店配送方式配置主表模型
+ * 谁用:花店系统(hdApp 配送方式设置页)
+ * 解决什么问题:存储送货、自取、跑腿、快递、物流等配送方式的基础配置(xhPsMethod)
+ */
+
+namespace bizHd\order\models;
+
+use bizHd\base\models\Base;
+
+class PsMethod extends Base
+{
+    /**
+     * 返回对应的数据库表名
+     * @return string
+     */
+    public static function tableName()
+    {
+        return 'xhPsMethod';
+    }
+}

+ 22 - 0
biz-hd/order/models/PsReduceRule.php

@@ -0,0 +1,22 @@
+<?php
+/**
+ * 用途:花店跑腿满减规则模型
+ * 谁用:花店系统(hdApp 配送方式设置页)
+ * 解决什么问题:存储跑腿配送方式下的满减/免运费规则(xhPsReduceRule)
+ */
+
+namespace bizHd\order\models;
+
+use bizHd\base\models\Base;
+
+class PsReduceRule extends Base
+{
+    /**
+     * 返回对应的数据库表名
+     * @return string
+     */
+    public static function tableName()
+    {
+        return 'xhPsReduceRule';
+    }
+}

+ 1 - 1
common/components/delivery/services/DispatchService.php

@@ -1060,7 +1060,7 @@ class DispatchService
                 case 'didi':
                     if(!isset($item['estimateList'])){
                         Yii::error('didi 报价数据为空:' . json_encode($item));
-                        continue;
+                        break;
                     }
 
                     $serviceType = [0 => '拼送', 1 => '直送'];

+ 80 - 0
common/models/xhUserAddress.php

@@ -0,0 +1,80 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "xhUserAddress".
+ *
+ * @property string $id
+ * @property int $userId 商家id/用户id
+ * @property string $name 收货人姓名
+ * @property string $phone 手机号
+ * @property string $tag 标签
+ * @property string $lat 纬度
+ * @property string $long 经度
+ * @property string $province 省
+ * @property string $city 市
+ * @property string $dist 区县
+ * @property string $address 街道地址
+ * @property string $floor 楼号门牌号
+ * @property string $fullAddress 完整地址
+ * @property string $showAddress 地图接口显示的完整地址
+ * @property int $default 是否默认地址
+ * @property string $addTime 添加时间
+ * @property string $updateTime
+ */
+class xhUserAddress extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'xhUserAddress';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['userId', 'default'], 'integer'],
+            [['addTime', 'updateTime'], 'safe'],
+            [['lat', 'long'], 'string', 'max' => 20],
+            [['name', 'phone', 'tag'], 'string', 'max' => 50],
+            [['province', 'city', 'dist'], 'string', 'max' => 100],
+            [['address', 'fullAddress'], 'string', 'max' => 500],
+            [['floor'], 'string', 'max' => 50],
+            [['showAddress'], 'string', 'max' => 900],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'userId' => 'User ID',
+            'name' => 'Name',
+            'phone' => 'Phone',
+            'tag' => 'Tag',
+            'lat' => 'Lat',
+            'long' => 'Long',
+            'province' => 'Province',
+            'city' => 'City',
+            'dist' => 'Dist',
+            'address' => 'Address',
+            'floor' => 'Floor',
+            'fullAddress' => 'Full Address',
+            'showAddress' => 'Show Address',
+            'default' => 'Default',
+            'addTime' => 'Add Time',
+            'updateTime' => 'Update Time',
+        ];
+    }
+}

+ 50 - 0
sql/20260706_redesign.sql

@@ -26,3 +26,53 @@ CREATE TABLE `xhUserAddress` (
     PRIMARY KEY (`id`) USING BTREE,
     KEY `idx_userId` (`userId`) USING BTREE
 ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户地址列表';
+
+-- ouyang 2026-7-20 15:27:39
+CREATE TABLE `xhPsExplain` (
+   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+   `methodId` int(11) NOT NULL COMMENT '关联 PsMethod.id',
+   `explain` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '说明文字,最多50字',
+   `color` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '颜色:1黑 2红 3蓝',
+   `fontWeight` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '字重:1常规 2加粗',
+   `sort` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '显示顺序,越小越靠前',
+   `addTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+   PRIMARY KEY (`id`),
+   KEY `idx_method_sort` (`methodId`,`sort`)
+) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='花店配送方式说明条目';
+
+
+CREATE TABLE `xhPsMethod` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `shopId` int(11) NOT NULL DEFAULT '0' COMMENT '门店ID',
+  `mainId` int(11) NOT NULL DEFAULT '0' COMMENT 'mainId',
+  `style` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'sendType 0送货 1自取 2跑腿 3物流 4快递 transType 0德邦 1顺丰 2冷链 3航空 4送货 5自取',
+  `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '名称',
+  `originName` char(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '原名',
+  `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态:1启用 0禁用',
+  `sort` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '显示顺序',
+  `minAmount` decimal(10,2) DEFAULT '0.00' COMMENT '最低消费金额,0表示没有要求',
+  `minNum` smallint(5) DEFAULT '0' COMMENT '最低消费数量,0表示没有要求',
+  `unMeet` tinyint(3) unsigned DEFAULT '0' COMMENT '不满条件,0收运费 1收包装费 2不能下单',
+  `unMeetFee` decimal(10,2) DEFAULT '0.00' COMMENT '运费(送货) / 包装费(快递)',
+  `startKm` decimal(8,2) DEFAULT '0.00' COMMENT '起步公里数',
+  `startPrice` decimal(10,2) DEFAULT '0.00' COMMENT '起步公里内价格(元)',
+  `perKmPrice` decimal(10,2) DEFAULT '0.00' COMMENT '超出起步每公里加价(元)',
+  `changeRate` decimal(6,2) DEFAULT '0.00' COMMENT '临时涨价百分比,负数为降价',
+  `addTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `updateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `uk_main_type` (`mainId`,`style`)
+) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='花店送货方式配置表';
+
+
+CREATE TABLE `xhPsReduceRule` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `methodId` int(11) NOT NULL COMMENT '关联 PsMethod.id',
+  `meetNum` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '满数量',
+  `meetAmount` decimal(10,2) NOT NULL COMMENT '满金额',
+  `freeKm` decimal(8,2) NOT NULL COMMENT 'X公里内免配送费',
+  `sort` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '规则排序,越小越靠前',
+  `addTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  PRIMARY KEY (`id`),
+  KEY `idx_method_sort` (`methodId`,`sort`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='花店送货方式,跑腿,花材,满减规则';