Browse Source

库存字典

afa 5 months ago
parent
commit
a5e033459f

+ 52 - 0
app/admin/controller/goods/ProductConfig.php

@@ -0,0 +1,52 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller\goods;
+
+use app\common\controller\Backend;
+use think\annotation\route\Group;
+use think\annotation\route\Route;
+use app\admin\traits\Actions;
+use app\common\model\StockConfig;
+use app\common\model\ProductConfig as ProductConfigModel;
+
+#[Group("goods/product_config")]
+class ProductConfig extends Backend
+{
+
+    use Actions;
+
+    protected function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new ProductConfigModel();
+
+        //
+        $this->assign('varietyList', StockConfig::where('type_id', 'variety_name')->column('field_name','id'));
+        $this->assign('packingList', StockConfig::where('type_id', 'packing_box')->column('field_name','id'));
+     
+    }
+
+
+
+    //删除
+    #[Route("GET","del")]
+    public function del()
+    {
+        return "删除";
+    }
+    
+    //导入
+    #[Route("GET","import")]
+    public function import()
+    {
+        return "导入";
+    }
+    
+    //下载
+    #[Route("GET","download")]
+    public function download()
+    {
+        return "下载";
+    }
+}

+ 32 - 0
app/admin/controller/goods/StockConfig.php

@@ -0,0 +1,32 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller\goods;
+
+use app\common\controller\Backend;
+use think\annotation\route\Group;
+use think\annotation\route\Route;
+use app\admin\traits\Actions;
+use app\common\model\StockConfig as StockConfigModel;
+
+#[Group("goods/stock_config")]
+class StockConfig extends Backend
+{
+    use Actions;
+
+    protected function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new StockConfigModel();
+    }
+
+
+
+    
+    //删除
+    #[Route("GET","del")]
+    public function del()
+    {
+        return "删除";
+    }
+}

+ 73 - 0
app/admin/controller/shop/ShopList.php

@@ -0,0 +1,73 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller\shop;
+
+use app\common\controller\Backend;
+use think\annotation\route\Group;
+use think\annotation\route\Route;
+use app\admin\traits\Actions;
+use app\common\model\Customer;
+use app\common\model\User;
+use app\common\model\ShopList as ShopListModel;
+
+#[Group("shop/shop_list")]
+class ShopList extends Backend
+{
+    use Actions{
+        add as protected _add;
+        edit as protected _edit;
+     }
+
+    protected function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new ShopListModel();
+
+        $this->assign('customerList', Customer::where('status',Customer::STATUS_NORMAL)->column('name','id'));
+        $this->assign('platformList', config("app.platform_list"));
+        $this->assign('userList', User::where('status',Customer::STATUS_NORMAL)->column('nickname','id'));
+        
+        $this->relationField=['customer','staff'];
+    }   
+
+ 
+    
+    #[Route('GET,POST','add')]
+    public function add()
+    {
+        if($this->request->isPost()){
+           
+        }
+        return $this->_add();
+    }
+
+    #[Route('GET,POST','edit')]
+    public function edit()
+    {
+        $ids = $this->request->get('ids');
+        $row = $this->model->find($ids);
+        //...可以对row进行一些前置的操作
+        if($this->request->isPost()){
+            //通过postParams属性可以增加或者覆盖前端row/a传过来的参数
+            //$this->postParams['属性名']='属性的值';
+        }
+        //注意这里传入已经修改过的$row
+        return $this->_edit($row);
+    }
+
+    
+    //删除
+    #[Route("GET","del")]
+    public function del()
+    {
+        return "删除";
+    }
+    
+    //导入
+    #[Route("GET","import")]
+    public function import()
+    {
+        return "导入";
+    }
+}

+ 32 - 0
app/admin/view/goods/product_config/add.html

@@ -0,0 +1,32 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+        <yun-form :data="row" :columns="columns">
+            {:token_field()}
+        </yun-form>
+    </el-card>
+</template>
+<script>
+    import form from "@components/Form.js";
+    export default{
+        components:{'YunForm':form},
+        data:{
+            row:Yunqi.data.row,
+            columns:[
+                {field: 'id',title: __('ID'),edit:'hidden'},
+                {field: 'type_id', title: __('类型'), edit: 'select',rules:"required",searchList: Yunqi.data.varietyList},
+                {field: 'title',title: __('名称'),edit:'text',rules:'required'},
+                {field: 'another_name',title: __('别名'),edit:'text',rules:'required'},
+                {field: 'weight',title: __('重量(斤)'),edit:'text',rules:'required'},
+                {field: 'type_box',title: __('包装箱'),edit:'select',rules:'required', searchList: Yunqi.data.packingList},
+                {field: 'sort',title: __('排序'),edit:'text'},
+                {field: 'status', title: __('状态'), edit:'switch',searchList: {1: __('正常'),2: __('隐藏')}},
+            ]
+        },
+        methods: {
+
+        }
+    }
+</script>
+<style>
+
+</style>

+ 1 - 0
app/admin/view/goods/product_config/edit.html

@@ -0,0 +1 @@
+{include vue="goods/product_config/add" /}

+ 60 - 0
app/admin/view/goods/product_config/index.html

@@ -0,0 +1,60 @@
+<template>
+    <el-card shadow="never">
+        <yun-table
+                :columns="columns"
+                search="name,phone"
+                toolbar="refresh,add,edit,del,more"
+                ref="yuntable"
+                :auth="auth"
+                :extend="extend">
+        </yun-table>
+    </el-card>
+</template>
+<script>
+    import table from "@components/Table.js";
+    export default{
+        components:{'YunTable':table},
+        data:{
+            auth:{
+                add:Yunqi.auth.check('app\\admin\\controller\\goods\\ProductConfig','add'),
+                edit:Yunqi.auth.check('app\\admin\\controller\\goods\\ProductConfig','edit'),
+                del:Yunqi.auth.check('app\\admin\\controller\\goods\\ProductConfig','del'),
+                multi:Yunqi.auth.check('app\\admin\\controller\\goods\\ProductConfig','multi'),
+                recyclebin:Yunqi.auth.check('app\\admin\\controller\\goods\\ProductConfig','recyclebin'),
+            },
+            extend:{
+                index_url: 'goods/product_config/index',
+                add_url: 'goods/product_config/add',
+                edit_url: 'goods/product_config/edit',
+                del_url: 'goods/product_config/del',
+                multi_url: 'goods/product_config/multi',
+                download_url: 'goods/product_config/download',
+                recyclebin_url: 'goods/product_config/recyclebin',
+            },
+            columns:[
+                {checkbox: true},
+                {field: 'id',title: __('ID'),width:80,sortable: true},
+                {field: 'type_id',title: __('品种'),operate:'LIKE', searchList: Yunqi.data.varietyList},
+                {field: 'title',title: __('标题'),operate: '='},
+                {field: 'another_name', title: __('别名'),operate:'LIKE'},
+                {field: 'weight', title: __('重量(斤)'),operate: false},
+                {field: 'type_box', title: __('包装箱'),operate: false, searchList: Yunqi.data.packingList},
+                {field: 'status', title: __('状态'),width:120,searchList: {1: __('正常'),2: __('停用')},formatter:Yunqi.formatter.switch},
+                {field: 'sort', title: __('排序'), operate:false,sortable: true},
+                {field: 'createtime', title: __('创建时间'), width:160,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},
+                {
+                    field: 'operate',
+                    title: __('操作'),
+                    width:150,
+                    action:{sort:true,edit:true,del:true}
+                }
+            ]
+        },
+        methods: {
+        
+        }
+    }
+</script>
+<style>
+
+</style>

+ 30 - 0
app/admin/view/goods/stock_config/add.html

@@ -0,0 +1,30 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+        <yun-form :data="row" :columns="columns">
+            {:token_field()}
+        </yun-form>
+    </el-card>
+</template>
+<script>
+    import form from "@components/Form.js";
+    export default{
+        components:{'YunForm':form},
+        data:{
+            row:Yunqi.data.row,
+            columns:[
+                {field: 'id',title: __('ID'),edit:'hidden'},
+                {field: 'type_id', title: __('类型'), edit: 'radio',rules:"required",searchList: {'variety_name': __('品种'), 'packing_box': __('包装箱'), 'material': __('耗材')}},
+                {field: 'title',title: __('标题'),edit:'text',rules:'required'},
+                {field: 'field_name',title: __('库存唯一属性'),edit:'text',rules:'required'},
+                {field: 'sort',title: __('排序'),edit:'text'},
+                {field: 'status', title: __('状态'), edit:'switch',searchList: {1: __('正常'),2: __('隐藏')}},
+            ]
+        },
+        methods: {
+
+        }
+    }
+</script>
+<style>
+
+</style>

+ 1 - 0
app/admin/view/goods/stock_config/edit.html

@@ -0,0 +1 @@
+{include vue="goods/stock_config/add" /}

+ 58 - 0
app/admin/view/goods/stock_config/index.html

@@ -0,0 +1,58 @@
+<template>
+    <el-card shadow="never">
+        <yun-table
+                :columns="columns"
+                search="name,phone"
+                toolbar="refresh,add,edit,del,more"
+                ref="yuntable"
+                :auth="auth"
+                :extend="extend">
+        </yun-table>
+    </el-card>
+</template>
+<script>
+    import table from "@components/Table.js";
+    export default{
+        components:{'YunTable':table},
+        data:{
+            auth:{
+                add:Yunqi.auth.check('app\\admin\\controller\\goods\\StockConfig','add'),
+                edit:Yunqi.auth.check('app\\admin\\controller\\goods\\StockConfig','edit'),
+                del:Yunqi.auth.check('app\\admin\\controller\\goods\\StockConfig','del'),
+                multi:Yunqi.auth.check('app\\admin\\controller\\goods\\StockConfig','multi'),
+                recyclebin:Yunqi.auth.check('app\\admin\\controller\\goods\\StockConfig','recyclebin'),
+            },
+            extend:{
+                index_url: 'goods/stock_config/index',
+                add_url: 'goods/stock_config/add',
+                edit_url: 'goods/stock_config/edit',
+                del_url: 'goods/stock_config/del',
+                multi_url: 'goods/stock_config/multi',
+                download_url: 'goods/stock_config/download',
+                recyclebin_url: 'goods/stock_config/recyclebin',
+            },
+            columns:[
+                {checkbox: true},
+                {field: 'id',title: __('ID'),width:80,sortable: true},
+                {field: 'type_id',title: __('类型'),operate:'=',searchList: {'variety_name': __('品种'), 'packing_box': __('包装箱'), 'material': __('耗材')}},
+                {field: 'title',title: __('标题'),operate: '='},
+                {field: 'field_name', title: __('唯一标识'),operate:'LIKE'},
+                {field: 'status', title: __('状态'),width:120,searchList: {1: __('正常'),2: __('停用')},formatter:Yunqi.formatter.switch},
+                {field: 'sort', title: __('排序'),operate: false},
+                {field: 'createtime', title: __('创建时间'), width:160,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},
+                {
+                    field: 'operate',
+                    title: __('操作'),
+                    width:150,
+                    action:{sort:true,edit:true,del:true}
+                }
+            ]
+        },
+        methods: {
+        
+        }
+    }
+</script>
+<style>
+
+</style>

+ 33 - 0
app/admin/view/shop/shop_list/add.html

@@ -0,0 +1,33 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+        <yun-form :data="row" :columns="columns">
+            {:token_field()}
+
+       
+        </yun-form>
+    </el-card>
+</template>
+<script>
+    import form from "@components/Form.js";
+    export default{
+        components:{'YunForm':form},
+        data:{
+            row:Yunqi.data.row,
+            columns:[
+                {field: 'id',title: __('ID'),edit:'hidden'},
+       
+                {field: 'customer_id', title: __('客户'),searchList:Yunqi.data.customerList,edit: 'select',rules:'required'},
+                {field: 'platform',title: __('平台'), edit: 'select', rules:'required',searchList:Yunqi.data.platformList},
+                {field: 'name',title: __('店铺名称'),edit:'text',rules:'required'},
+               {field: 'staff_id', title: __('员工'), edit: 'select',searchList: Yunqi.data.userList},
+                {field: 'status', title: __('状态'), edit:'switch',searchList: {1: __('正常'),2: __('隐藏')}},
+            ]
+        },
+        methods: {
+
+        }
+    }
+</script>
+<style>
+
+</style>

+ 1 - 0
app/admin/view/shop/shop_list/edit.html

@@ -0,0 +1 @@
+{include vue="shop/shop_list/add" /}

+ 58 - 0
app/admin/view/shop/shop_list/index.html

@@ -0,0 +1,58 @@
+<template>
+    <el-card shadow="never">
+        <yun-table
+                :columns="columns"
+                search="name,phone"
+                toolbar="refresh,add,edit,del,more"
+                ref="yuntable"
+                :auth="auth"
+                :extend="extend">
+        </yun-table>
+    </el-card>
+</template>
+<script>
+    import table from "@components/Table.js";
+    export default{
+        components:{'YunTable':table},
+        data:{
+            auth:{
+                add:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','add'),
+                edit:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','edit'),
+                del:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','del'),
+                multi:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','multi'),
+                recyclebin:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','recyclebin'),
+            },
+            extend:{
+                index_url: 'shop/shop_list/index',
+                add_url: 'shop/shop_list/add',
+                edit_url: 'shop/shop_list/edit',
+                del_url: 'shop/shop_list/del',
+                multi_url: 'shop/shop_list/multi',
+                download_url: 'shop/shop_list/download',
+                recyclebin_url: 'shop/shop_list/recyclebin',
+            },
+            columns:[
+                {checkbox: true},
+                {field: 'id',title: __('ID'),width:80,sortable: true},
+                {field: 'customer.name',title: __('客户'),operate:'LIKE'},
+                {field: 'platform',title: __('平台'),operate: '=', searchList: Yunqi.data.platformList},
+                {field: 'name', title: __('店铺名称'),operate: 'LIKE'},
+                {field: 'staff.nickname', title: __('员工'),searchList: {1: __('日结'), 2: __('周结'), 3: __('半月结')}},
+                {field: 'status', title: __('状态'),width:120,searchList: {1: __('正常'),2: __('停用')},formatter:Yunqi.formatter.switch},
+                {field: 'create_time', title: __('创建时间'), width:160,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},
+                {
+                    field: 'operate',
+                    title: __('操作'),
+                    width:150,
+                    action:{sort:true,edit:true,del:true}
+                }
+            ]
+        },
+        methods: {
+        
+        }
+    }
+</script>
+<style>
+
+</style>

+ 4 - 0
app/common/model/Customer.php

@@ -8,4 +8,8 @@ use app\common\model\base\BaseModel;
 class Customer extends BaseModel
 {
 
+
+
+      const STATUS_NORMAL = 1;
+      const STATUS_HIDDEN = 2;
 }

+ 11 - 0
app/common/model/ProductConfig.php

@@ -0,0 +1,11 @@
+<?php
+declare(strict_types=1);
+
+namespace app\common\model;
+
+use app\common\model\base\BaseModel;
+
+class ProductConfig extends BaseModel
+{
+
+}

+ 25 - 0
app/common/model/ShopList.php

@@ -0,0 +1,25 @@
+<?php
+declare(strict_types=1);
+
+namespace app\common\model;
+
+use think\Model;
+
+class ShopList Extends Model
+{
+
+
+
+      //客户
+      public function customer()
+      {
+            return $this->hasOne(Customer::class,'id','customer_id');
+      }
+
+
+      public function staff()
+      {
+            return $this->hasOne(User::class,'id','staff_id');
+      }
+
+}

+ 11 - 0
app/common/model/StockConfig.php

@@ -0,0 +1,11 @@
+<?php
+declare(strict_types=1);
+
+namespace app\common\model;
+
+use app\common\model\base\BaseModel;
+
+class StockConfig extends BaseModel
+{
+
+}

+ 12 - 0
config/app.php

@@ -30,4 +30,16 @@ return [
     'error_message'    => '页面错误!请稍后再试~',
     // 显示错误信息
     'show_error_msg'   => false,
+
+    //平台配置
+    'platform_list'              => [
+        '1' => '抖音',
+        '2' => '拼多多',
+        '3' => '快手',
+        '4' => '淘宝',
+        '5' => '小红书',
+        '6' => '京东',
+    ],
+
+
 ];

+ 0 - 1
runtime/admin/session/sess_cb1d7116643fabe74a7d37ff30e38750

@@ -1 +0,0 @@
-a:2:{s:9:"__token__";s:32:"3345b332835f6dcdcbcf071708ccc3a2";s:5:"admin";a:16:{s:2:"id";i:1;s:8:"username";s:5:"admin";s:8:"nickname";s:15:"超级管理员";s:8:"password";s:32:"be7a9564b9a078073a72cd2abc28136f";s:4:"salt";s:4:"Pdt0";s:6:"avatar";s:22:"/assets/img/avatar.jpg";s:6:"mobile";s:11:"18888888888";s:8:"groupids";s:1:"1";s:12:"loginfailure";i:0;s:9:"logintime";i:1750737129;s:7:"loginip";s:9:"127.0.0.1";s:5:"token";s:36:"8326fb31-b897-40c5-a869-3a8be49aeadd";s:10:"element_ui";s:0:"";s:6:"status";s:6:"normal";s:10:"createtime";s:16:"2025-06-24 11:51";s:10:"updatetime";s:16:"2025-06-24 11:52";}}

File diff suppressed because it is too large
+ 0 - 0
runtime/cache/7a/b2b683b6c3e8e0985917962d853b9c.php


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