Преглед изворни кода

Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev

From-wh пре 2 година
родитељ
комит
4b49dc68b5

+ 24 - 4
crmeb/app/services/agent/AgentLevelServices.php

@@ -66,6 +66,10 @@ class AgentLevelServices extends BaseServices
             $query->field('count(*) as sum');
         }], $page, $limit);
         $count = $this->dao->count($where);
+        foreach ($list as &$item) {
+            $item['one_brokerage_ratio'] = bcdiv(bcmul((string)sys_config('store_brokerage_ratio'), bcadd('100', (string)$item['one_brokerage'], 2), 2), '100', 2);
+            $item['two_brokerage_ratio'] = bcdiv(bcmul((string)sys_config('store_brokerage_two'), bcadd('100', (string)$item['two_brokerage'], 2), 2), '100', 2);
+        }
         return compact('count', 'list');
     }
 
@@ -259,8 +263,16 @@ class AgentLevelServices extends BaseServices
         $field[] = Form::input('name', '等级名称')->maxlength(8)->col(24);
         $field[] = Form::number('grade', '等级', 0)->min(0)->precision(0);
         $field[] = Form::frameImage('image', '背景图', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
-        $field[] = Form::number('one_brokerage', '一级上浮', 0)->info('在分销一级佣金基础上浮(0-1000之间整数)百分比')->min(0)->max(1000)->precision(0);
-        $field[] = Form::number('two_brokerage', '二级上浮', 0)->info('在分销二级佣金基础上浮(0-1000之间整数)百分比')->min(0)->max(1000)->precision(0);
+        $field[] = Form::number('one_brokerage', '一级上浮', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '在分销一级佣金基础上浮(0-1000之间整数)百分比,目前一级返佣比率:10%,上浮5%,则返佣比率:一级返佣比率 * (1 + 一级上浮比率) = 10.50%']
+        ])->max(1000)->precision(0);
+        $field[] = Form::number('two_brokerage', '二级上浮', 0)->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '在分销二级佣金基础上浮(0-1000之间整数)百分比,目前二级返佣比率:10%,上浮2%,则返佣比率:二级返佣比率 * (1 + 二级上浮比率) = 5.10%']
+        ])->min(0)->max(1000)->precision(0);
         $field[] = Form::radio('status', '是否显示', 1)->options([['value' => 1, 'label' => '显示'], ['value' => 0, 'label' => '隐藏']]);
         return create_form('添加分销员等级', $field, Url::buildUrl('/agent/level'), 'POST');
     }
@@ -281,8 +293,16 @@ class AgentLevelServices extends BaseServices
         $field[] = Form::input('name', '等级名称', $levelInfo['name'])->maxlength(8)->col(24);
         $field[] = Form::number('grade', '等级', $levelInfo['grade'])->min(0)->precision(0);
         $field[] = Form::frameImage('image', '背景图', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $levelInfo['image'])->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
-        $field[] = Form::number('one_brokerage', '一级上浮', $levelInfo['one_brokerage'])->info('在分销一级佣金基础上浮(0-1000之间整数)百分比')->min(0)->max(1000)->precision(0);
-        $field[] = Form::number('two_brokerage', '二级上浮', $levelInfo['two_brokerage'])->info('在分销二级佣金基础上浮(0-1000之间整数)百分比')->min(0)->max(1000)->precision(0);
+        $field[] = Form::number('one_brokerage', '一级上浮', $levelInfo['one_brokerage'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '在分销一级佣金基础上浮(0-1000之间整数)百分比,目前一级返佣比率:10%,上浮5%,则返佣比率:一级返佣比率 * (1 + 一级上浮比率) = 10.50%']
+        ])->min(0)->max(1000)->precision(0);
+        $field[] = Form::number('two_brokerage', '二级上浮', $levelInfo['two_brokerage'])->appendRule('suffix', [
+            'type' => 'div',
+            'class' => 'tips-info',
+            'domProps' => ['innerHTML' => '在分销二级佣金基础上浮(0-1000之间整数)百分比,目前二级返佣比率:10%,上浮2%,则返佣比率:二级返佣比率 * (1 + 二级上浮比率) = 5.10%']
+        ])->min(0)->max(1000)->precision(0);
         $field[] = Form::radio('status', '是否显示', $levelInfo['status'])->options([['value' => 1, 'label' => '显示'], ['value' => 0, 'label' => '隐藏']]);
 
         return create_form('编辑分销员等级', $field, Url::buildUrl('/agent/level/' . $id), 'PUT');

+ 3 - 2
crmeb/config/console.php

@@ -14,13 +14,14 @@
 // +----------------------------------------------------------------------
 return [
     // 执行用户(Windows下无效)
-    'user'     => null,
+    'user' => null,
     // 指令定义
     'commands' => [
         'workerman' => \crmeb\command\Workerman::class,
         'timer' => \crmeb\command\Timer::class,
         'make:business' => \crmeb\command\Business::class,
         'make:dao' => \crmeb\command\Dao::class,
-        'make:service'=>\crmeb\command\Service::class,
+        'make:service' => \crmeb\command\Service::class,
+        'util' => \crmeb\command\Util::class
     ],
 ];

+ 78 - 0
crmeb/crmeb/command/Util.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace crmeb\command;
+
+
+use crmeb\exceptions\AdminException;
+use think\console\Command;
+use think\console\Input;
+use think\console\input\Argument;
+use think\console\input\Option;
+use think\console\Output;
+use think\facade\Config;
+use think\facade\Db;
+
+class Util extends Command
+{
+    protected function configure()
+    {
+        $this->setName('util')
+            ->addArgument('type', Argument::REQUIRED, '类型replace')
+            ->addOption('h', null, Option::VALUE_REQUIRED, '替换成当前域名')
+            ->addOption('u', null, Option::VALUE_REQUIRED, '替换的域名')
+            ->setDescription('工具类');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        $type = $input->getArgument('type');
+
+        switch ($type) {
+            case 'replace':
+                $host = $input->getOption('h');
+                $url = $input->getOption('u');
+                if (!$host) {
+                    return $output->error('缺少替换域名');
+                }
+                if (!$url) {
+                    return $output->error('缺少替换的域名');
+                }
+                $this->replaceSiteUrl($host, $url);
+                break;
+        }
+
+        $output->info('执行成功');
+    }
+
+    protected function replaceSiteUrl(string $url, string $siteUrl)
+    {
+        $siteUrlJosn = str_replace('http://', 'http:\\\/\\\/', $siteUrl);
+        $valueJosn = str_replace('http://', 'http:\\\/\\\/', $url);
+        $prefix = Config::get('database.connections.' . Config::get('database.default') . '.prefix');
+        $sql = [
+            "UPDATE `{$prefix}system_attachment` SET `att_dir` = replace(att_dir ,'{$siteUrl}','{$url}'),`satt_dir` = replace(satt_dir ,'{$siteUrl}','{$url}')",
+            "UPDATE `{$prefix}store_product` SET `image` = replace(image ,'{$siteUrl}','{$url}'),`slider_image` = replace(slider_image ,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}store_product_attr_value` SET `image` = replace(image ,'{$siteUrl}','{$url}')",
+            "UPDATE `{$prefix}store_seckill` SET `image` = replace(image ,'{$siteUrl}','{$url}'),`images` = replace(images,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}store_combination` SET `image` = replace(image ,'{$siteUrl}','{$url}'),`images` = replace(images,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}store_bargain` SET `image` = replace(image ,'{$siteUrl}','{$url}'),`images` = replace(images,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}system_config` SET `value` = replace(value ,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}article_category` SET `image` = replace(`image` ,'{$siteUrl}','{$url}')",
+            "UPDATE `{$prefix}article` SET `image_input` = replace(`image_input` ,'{$siteUrl}','{$url}')",
+            "UPDATE `{$prefix}article_content` SET `content` = replace(`content` ,'{$siteUrl}','{$url}')",
+            "UPDATE `{$prefix}store_category` SET `pic` = replace(`pic` ,'{$siteUrl}','{$url}')",
+            "UPDATE `{$prefix}system_group_data` SET `value` = replace(value ,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}eb_diy` SET `value` = replace(value ,'{$siteUrlJosn}','{$valueJosn}')",
+            "UPDATE `{$prefix}store_product_description` SET `description`= replace(description,'{$siteUrl}','{$url}')"
+        ];
+        return Db::transaction(function () use ($sql) {
+            try {
+                foreach ($sql as $item) {
+                    Db::execute($item);
+                }
+            } catch (\Throwable $e) {
+                throw new AdminException(400612, ['msg' => $e->getMessage()]);
+            }
+        });
+    }
+}

+ 1 - 1
crmeb/public/install/crmeb.sql

@@ -33849,7 +33849,7 @@ INSERT INTO `eb_system_menus` (`id`, `pid`, `icon`, `menu_name`, `module`, `cont
 (26, 0, 'ios-people', '分销', 'admin', 'agent', '', '', '', '[]', 104, 1, 0, 1, '/agent', '', 1, 'user', 1, 'admin-agent', 0),
 (27, 0, 'ios-paper-plane', '营销', 'admin', 'marketing', '', '', '', '[]', 110, 1, 0, 1, '/marketing', '', 1, 'home', 1, 'admin-marketing', 0),
 (28, 26, '', '分销设置', 'admin', 'setting.system_config', '', '', '', '[]', 1, 1, 0, 1, '/setting/system_config_retail/2/9', '', 1, 'setting', 0, 'setting-system-config', 0),
-(29, 26, '', '分销员管理', 'admin', 'agent.agent_manage', 'index', '', '', '[]', 1, 1, 0, 1, '/agent/agent_manage/index', '', 1, 'user', 0, 'agent-agent-manage', 0),
+(29, 26, '', '分销员管理', 'admin', 'agent.agent_manage', 'index', '', '', '[]', 99, 1, 0, 1, '/agent/agent_manage/index', '', 1, 'user', 0, 'agent-agent-manage', 0),
 (30, 27, '', '优惠券', 'admin', 'marketing.store_coupon', '', '', '', '[]', 100, 1, 0, 1, '/marketing/store_coupon', '27', 1, 'marketing', 0, 'marketing-store_coupon-index', 0),
 (31, 27, '', '砍价管理', 'admin', 'marketing.store_bargain', '', '', '', '[]', 85, 1, 0, 1, '/marketing/store_bargain', '27', 1, 'marketing', 0, 'marketing-store_bargain-index', 0),
 (32, 27, '', '拼团管理', 'admin', 'marketing.store_combination', '', '', '', '[]', 80, 1, 0, 1, '/marketing/store_combination', '27', 1, 'marketing', 0, 'marketing-store_combination-index', 0),

+ 1 - 1
template/admin/src/pages/marketing/point_statistic/index.vue

@@ -374,6 +374,6 @@ export default {
 .num {
   white-space: nowrap;
   margin: 0 10px;
-  width: 17px;
+  width: 30px;
 }
 </style>

+ 27 - 5
template/admin/src/pages/setting/membershipLevel/index.vue

@@ -38,6 +38,18 @@
             </div>
           </viewer>
         </template>
+        <template slot-scope="{ row }" slot="one_brokerage">
+          <span>{{row.one_brokerage}}%</span>
+        </template>
+        <template slot-scope="{ row }" slot="one_brokerage_ratio">
+           <span>{{row.one_brokerage_ratio}}%</span>
+        </template>
+        <template slot-scope="{ row }" slot="two_brokerage">
+           <span>{{row.two_brokerage}}%</span>
+        </template>
+        <template slot-scope="{ row }" slot="two_brokerage_ratio">
+           <span>{{row.two_brokerage_ratio}}%</span>
+        </template>
         <template slot-scope="{ row }" slot="status">
           <i-switch
             v-model="row.status"
@@ -204,14 +216,24 @@ export default {
           title: '等级',
         },
         {
-          key: 'one_brokerage',
+          slot: 'one_brokerage',
+          minWidth: 35,
+          title: '一级上浮比例',
+        },
+        {
+          slot: 'one_brokerage_ratio',
+          minWidth: 35,
+          title: '一级分佣比例(上浮后)',
+        },
+        {
+          slot: 'two_brokerage',
           minWidth: 35,
-          title: '一级返佣上浮比例(%)',
+          title: '二级上浮比例',
         },
         {
-          key: 'two_brokerage',
+          slot: 'two_brokerage_ratio',
           minWidth: 35,
-          title: '二级返佣上浮比例(%)',
+          title: '二级分佣比例(上浮后)',
         },
         {
           slot: 'status',
@@ -523,7 +545,7 @@ export default {
 
 .headers {
   background-color: #fff;
-  margin-bottom 20px
+  margin-bottom: 20px;
 }
 
 /deep/ .ivu-modal-mask {