Bladeren bron

接口、计算今日工价平均值、后台员工管理、扫码记录、今日出工人员

dong025 4 dagen geleden
bovenliggende
commit
15acf298c7

+ 19 - 10
app/admin/common.php

@@ -1,5 +1,6 @@
 <?php
-declare (strict_types = 1);
+
+declare(strict_types=1);
 
 // 这是系统自动生成的公共文件
 
@@ -10,15 +11,15 @@ if (!function_exists('build_var_json')) {
      *
      * @return string
      */
-    function build_var_json(array $arr):string
+    function build_var_json(array $arr): string
     {
-        $keys=array_keys($arr['vars']);
-        $r=[];
-        foreach ($keys as $key){
-            if($key=='config' || $key=='auth' || $key=='upload'){
+        $keys = array_keys($arr['vars']);
+        $r = [];
+        foreach ($keys as $key) {
+            if ($key == 'config' || $key == 'auth' || $key == 'upload') {
                 continue;
             }
-            $r[$key]=$arr[$key];
+            $r[$key] = $arr[$key];
         }
         return json_encode($r);
     }
@@ -52,13 +53,21 @@ if (!function_exists('resp_json')) {
      */
     function resp_json($code, $msg = '', $data = null)
     {
-       
-        return json(['code' => $code,'msg' => $msg,'data' => $data]);
+
+        return json(['code' => $code, 'msg' => $msg, 'data' => $data]);
     }
 }
 
 
-function isEnglish($char) {
+function isEnglish($char)
+{
     $code = ord($char);
     return ($code >= 0x00 && $code <= 0x7F); // ASCII码范围
 }
+if (!function_exists('startsWithHttp')) {
+    function startsWithHttp($url)
+    {
+        return strpos($url, 'https://') === 0
+            || strpos($url, 'http://') === 0;
+    }
+}

+ 123 - 0
app/admin/controller/ScanLog.php

@@ -0,0 +1,123 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use app\admin\traits\Actions;
+use think\annotation\route\Group;
+use think\annotation\route\Route;
+use app\common\model\ScanLog as ScanLogModel;
+
+#[Group("scan_log")]
+class ScanLog extends Backend
+{
+    use Actions{
+        index as private _index;
+        add as private _add;
+        edit as private _edit;
+        del as private _del;
+        multi as private _multi;
+        import as private _import;
+        download as private _download;
+    }
+
+    protected function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new ScanLogModel();
+    }
+
+    //查看
+    #[Route("GET,JSON","index")]
+    public function index()
+    {
+        // return $this->_index();
+        if (false === $this->request->isAjax()) {
+            return $this->fetch();
+        }
+        if ($this->request->post('selectpage')) {
+            return $this->selectpage();
+        }
+
+
+        [$where, $order, $limit, $with] = $this->buildparams();
+        $list = $this->model->alias('s')
+            ->join("user u", "s.user_id = u.id", "LEFT")
+            // ->join("group_user g", "w.user_id = g.id", "LEFT")
+            ->where($where)
+            ->order($order)
+            ->field(['s.*','u.avatar','u.nickname' => 'manage_nickname'])
+            ->paginate($limit)->each(function ($item, $key) {
+                $item['avatar']= startsWithHttp($item['avatar'])?$item['avatar']:request()->domain().'/' . $item['avatar'];
+                return $item;
+            });
+
+       
+        
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
+
+    //添加
+    #[Route("GET,POST","add")]
+    public function add()
+    {
+        //通过定义postParams来增加或覆盖post提交的表单
+        $this->postParams=[];
+        //通过定义callback回调函数来执行添加后的操作
+        $this->callback=function ($model){};
+        return $this->_add();
+    }
+
+    //修改
+    #[Route("GET,POST","edit")]
+    public function edit()
+    {
+        //通过定义postParams来增加或覆盖post提交的表单
+        $this->postParams=[];
+        //通过定义callback回调函数来执行修改后的操作
+        $this->callback=function ($model){};
+        return $this->_edit();
+    }
+
+    //删除
+    #[Route("GET,POST","del")]
+    public function del()
+    {
+        //通过定义callback回调函数来执行删除后的操作
+        $this->callback=function ($ids){};
+        return $this->_del();
+    }
+
+    //更新
+    #[Route("GET,POST","multi")]
+    public function multi()
+    {
+        //通过定义callback回调函数来执行更新后的操作
+        $this->callback=function ($ids,$field,$value){};
+        return $this->_multi();
+    }
+
+    //导入
+    #[Route("GET,POST","import")]
+    public function import()
+    {
+        //通过定义callback回调函数来处理导入的数据
+        $this->callback=function ($inserData){
+            return $inserData;
+        };
+        return $this->_import();
+    }
+
+    //下载
+    #[Route("GET,POST","download")]
+    public function download()
+    {
+        //通过定义callback回调函数来处理下载的数据
+        $this->callback=function ($downloadData){
+            return $downloadData;
+        };
+        return $this->_download();
+    }
+}

+ 19 - 2
app/admin/controller/user/GroupUser.php

@@ -15,7 +15,15 @@ use think\facade\Db;
 class GroupUser extends Backend
 {
 
-    use Actions;
+    use Actions{
+        index as private _index;
+        add as private _add;
+        edit as private _edit;
+        del as private _del;
+        multi as private _multi;
+        import as private _import;
+        download as private _download;
+    }
 
     protected function _initialize()
     {
@@ -69,7 +77,7 @@ class GroupUser extends Backend
 
        
 
-        $result = ['total' => $list->total(), 'rows' => $list->items(), 'ceshi' => $type];
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
         return json($result);
     }
 
@@ -142,6 +150,7 @@ class GroupUser extends Backend
         }
         if (false === $this->request->isPost()) {
             $row['password'] = '';
+            $row['avatar']  = startsWithHttp($row['avatar'])?$row['avatar']:request()->domain().'/' . $row['avatar'];
             $this->assign('row', $row);
             return $this->fetch();
         }
@@ -224,4 +233,12 @@ class GroupUser extends Backend
         return strpos($url, 'https://') === 0
             || strpos($url, 'http://') === 0;
     }
+    //删除
+    #[Route("GET,POST","del")]
+    public function del()
+    {
+        //通过定义callback回调函数来执行删除后的操作
+        $this->callback=function ($ids){};
+        return $this->_del();
+    }
 }

+ 25 - 1
app/admin/controller/user/WorkerOut.php

@@ -32,7 +32,31 @@ class WorkerOut extends Backend
     #[Route("GET,JSON","index")]
     public function index()
     {
-        return $this->_index();
+        // return $this->_index();
+        if (false === $this->request->isAjax()) {
+            return $this->fetch();
+        }
+        if ($this->request->post('selectpage')) {
+            return $this->selectpage();
+        }
+
+
+        [$where, $order, $limit, $with] = $this->buildparams();
+        $list = $this->model->alias('w')
+            ->join("user u", "w.pid = u.id", "LEFT")
+            ->join("group_user g", "w.user_id = g.id", "LEFT")
+            ->where($where)
+            ->order($order)
+            ->field(['w.*','u.nickname' => 'manage_nickname','g.nickname' => 'worker_nickname','g.avatar'])
+            ->paginate($limit)->each(function ($item, $key) {
+                $item['avatar']= startsWithHttp($item['avatar'])?$item['avatar']:request()->domain().'/' . $item['avatar'];
+                return $item;
+            });
+
+       
+        
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
     }
 
     //添加

+ 1 - 0
app/admin/service/JuShuiTanService.php

@@ -233,6 +233,7 @@ class JuShuiTanService {
         $res=[
             'data'=>[
                 'id'=>0,
+                'title'=>'',
                 'labor_cost_money'=>0,
             ],
             'one_surcharge_money'=>0,

+ 10 - 15
app/admin/view/goods/import_list/index.html

@@ -1,10 +1,6 @@
 <template>
     <el-card shadow="never">
-        <yun-table :columns="columns" ref="yuntable" @render="onTableRender" toolbar="refresh,del" :auth="{
-               
-                    del:{:$auth->check('app\\admin\\controller\\goods\\ImportList','del')},
-         
-                }" :extend="extend" :total-arr="totalArr" :is-showtotal="true"
+        <yun-table :columns="columns" ref="yuntable" @render="onTableRender" toolbar="refresh" :auth="{}" :extend="extend" :total-arr="totalArr" :is-showtotal="true"
             @data-loaded="handleData">
         </yun-table>
     </el-card>
@@ -22,16 +18,16 @@
                 multi_url: 'goods/import_list/multi',
             },
             columns: [
-                {
-                    checkbox: true, selectable: function (row, index) {
-                        //可以根据业务需求返回false让某些行不可选中
-                        return true;
-                    }
-                },
+                // {
+                //     checkbox: true, selectable: function (row, index) {
+                //         //可以根据业务需求返回false让某些行不可选中
+                //         return true;
+                //     }
+                // },
                 { field: "id", title: "ID", operate: false },
                 { field: "shop_id", title: "店铺ID" },
                 {
-                    field: 'type_id', title: ('打单平台'), operate: "select", searchList: { 1: '风速', 2: '聚水潭', 0: '无' }, formatter: function (data, row) {
+                    field: 'type_id', title: ('打单平台'), operate: "select", searchList: { 1: '风速', 2: '聚水潭'}, formatter: function (data, row) {
                         let tag = Yunqi.formatter.tag;
                         if (row.type_id == 1) {
                             tag.value = '风速';
@@ -39,9 +35,6 @@
                         } else if (row.type_id == 2) {
                             tag.value = '聚水潭';
                             tag.type = 'primary';
-                        } else {
-                            tag.value = '无';
-                            tag.type = 'info';
                         }
                         return tag;
                     }
@@ -56,6 +49,8 @@
                 { field: "sku_id", title: "规格id" },
                 { field: "num", title: "件数", operate: false },
                 { field: "price", title: "实付价格", operate: false },
+                
+                { field: "specs_name", title: "打包规格", operate: false },
                 { field: "pack_specs_id", title: "打包规格id", operate: false },
                 { field: "labor_cost_money", title: "工价", operate: false },
                 { field: "one_surcharge_money", title: "单层保温金额", operate: false },

+ 80 - 0
app/admin/view/scan_log/add.html

@@ -0,0 +1,80 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+        <yun-form
+            ref="yunform"
+            @render="onFormRender"
+            @submit="onSubmit"
+            @success="onSuccess"
+            @fail="onFail"
+            :data="row"
+            :columns="columns">
+            <template #default>
+                {:token_field()}
+            </template>
+    
+        </yun-form>
+    </el-card>
+</template>
+<script>
+import form from "@components/Form.js";
+export default{
+    components:{
+        'YunForm':form
+    },
+    data:{
+        columns:[
+            {field:"id",title:"ID",edit:"hidden"},
+            {field:"user_id",title:"user_id",edit:"number"},
+            {field:"code",title:"扫描值",edit:"text",rules:"required"},
+            // {field:"order_status",title:"订单状态 0不存在 1存在",edit:"select",rules:"required",searchList:{1:"是",0:"否"}},
+            {field:"remark",title:"备注",edit:"text",rules:"required"},
+            {field:"spec_id",title:"规格id",edit:"number"},
+            {field:"createtime",title:"创建时间"},
+            {field:"updatetime",title:"变更时间"},
+        ],
+        row:Yunqi.data.row || {}
+    },
+    //页面加载完成时执行
+    onLoad:function(query){
+        console.log(query);
+    },
+    //页面初始显示或在框架内显示时执行
+    onShow:function(){
+
+    },
+    //页面在框架内隐藏时执行
+    onHide:function(){
+
+    },
+    //页面在框架内关闭时执行
+    onUnload:function(){
+
+    },
+    methods: {
+        onFormRender:function(rows){
+            //表单渲染完成后执行
+        },
+        onSubmit:function(rows){
+            //表单提交前执行,返回false可以阻止表单提交
+            /**
+             * form常用方法
+             * this.$refs.yunform.setError(field,message);//聚焦表单项并显示错误信息
+             * this.$refs.yunform.hideField(field);//隐藏表单项
+             * this.$refs.yunform.showField(field);//显示表单项
+             * this.$refs.yunform.setValue(field,value);//为表单项设置值
+             * this.$refs.yunform.getValue(field);//为获取表单项的值
+             * this.$refs.yunform.setField(field,key,value);//修改表单json的其他属性值,比如rules,title,searchList等
+             */
+            return true;
+        },
+        onSuccess:function(response){
+            //表单提交成功后执行
+        },
+        onFail:function(err){
+            //表单提交失败后执行
+        }
+    }
+}
+</script>
+<style>
+</style>

+ 1 - 0
app/admin/view/scan_log/edit.html

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

+ 85 - 0
app/admin/view/scan_log/index.html

@@ -0,0 +1,85 @@
+<template>
+    <el-card shadow="never">
+        <yun-table
+                :columns="columns"
+                ref="yuntable"
+                @render="onTableRender"
+                toolbar="refresh,download"
+                :auth="{
+                    add:{:$auth->check('app\\admin\\controller\\ScanLog','add')},
+                    edit:{:$auth->check('app\\admin\\controller\\ScanLog','edit')},
+                    del:{:$auth->check('app\\admin\\controller\\ScanLog','del')},
+                    multi:{:$auth->check('app\\admin\\controller\\ScanLog','multi')},
+                    import:{:$auth->check('app\\admin\\controller\\ScanLog','import')},
+                    download:{:$auth->check('app\\admin\\controller\\ScanLog','download')},
+                }"
+                :extend="extend">
+        </yun-table>
+    </el-card>
+</template>
+<script>
+import table from "@components/Table.js";
+export default{
+    components:{
+        'YunTable':table
+    },
+    data:{
+        extend:{
+            index_url: 'scan_log/index',
+            add_url: 'scan_log/add',
+            edit_url: 'scan_log/edit',
+            del_url: 'scan_log/del',
+            multi_url: 'scan_log/multi',
+            download_url: 'scan_log/download',
+            import_url: 'scan_log/import',
+        },
+        columns:[
+            // {checkbox: true,selectable:function (row,index){
+            //     //可以根据业务需求返回false让某些行不可选中
+            //     return true;
+            // }},
+            {field:"id",title:"ID",operate:false},
+            { field: 'avatar', title: __('头像'), formatter: Yunqi.formatter.image, operate: false },
+            {field:"manage_nickname",title:"用户"},
+            {field:"code",title:"快递单号"},
+            // {field:"order_status",title:"订单状态 0不存在 1存在",operate:"select",searchList:{1:"是",0:"否"},formatter:Yunqi.formatter.select},
+            {field:"remark",title:"备注"},
+            // {field:"spec_id",title:"规格id"},
+            {field:"createtime",title:"创建时间",operate:"daterange",formatter:Yunqi.formatter.datetime},
+            {field:"updatetime",title:"变更时间",visible:false,operate:"daterange",formatter:Yunqi.formatter.datetime}
+            
+        ]
+    },
+    //页面加载完成时执行
+    onLoad:function(query){
+        console.log(query);
+    },
+    //页面初始显示或在框架内显示时执行
+    onShow:function(){
+
+    },
+    //页面在框架内隐藏时执行
+    onHide:function(){
+
+    },
+    //页面在框架内关闭时执行
+    onUnload:function(){
+
+    },
+    methods: {
+        onTableRender:function(list){
+            //表格渲染完成后执行
+            /**
+             * table常用方法
+             * this.$refs.yuntable.reset();//重新渲染整个组件,当columns修改时,需要重新渲染表格才能生效,可以执行该方法。
+             * this.$refs.yuntable.reload();//保持当前的page,重新获取数据
+             * this.$refs.yuntable.submit();//返回第一页,重新获取数据
+             * this.$refs.yuntable.expandAllTree();//树形表格展开所有节点
+             * this.$refs.yuntable.expandTree(topid);//树形表格展开指定节点
+             */
+        }
+    }
+}
+</script>
+<style>
+</style>

+ 2 - 2
app/admin/view/user/group_user/edit.html

@@ -25,9 +25,9 @@
                 }},
                 { field: 'avatar', title: __('头像'), edit: 'image', rules: 'required' },
                 { field: 'mobile', title: __('手机号'), edit: 'text', rules: 'required;mobile' },
-                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管', 3:'记账'}},
+                // {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管', 3:'记账'}},
                 { field: 'sex', title: __('性别'), edit: { form: 'radio', value: 1 }, rules: 'required', searchList: { 1: '男', 2: '女' } },
-                { field: 'type', title: __('类型'), edit: { form: 'radio', value: 2 }, rules: 'required', searchList: { 1: '管理', 2: '普通员工' } },
+                // { field: 'type', title: __('类型'), edit: { form: 'radio', value: 2 }, rules: 'required', searchList: { 1: '管理', 2: '普通员工' } },
                 { field: 'group_name', title: __('组名'), edit: 'text' },
                 { field: 'status', title: __('状态'), edit: 'switch', searchList: { 'normal': __('正常'), 'hidden': __('隐藏') } },
             ]

+ 20 - 5
app/admin/view/user/group_user/group_list.html

@@ -1,9 +1,7 @@
 <template>
     <el-card shadow="never">
         <yun-table :columns="columns" ref="yuntable" @render="onTableRender"
-            toolbar="refresh,add,edit,del,more,import,download" :auth="{
-                    download:{:$auth->check('app\\admin\\controller\\user\\GroupUser','download')},
-                }" :extend="extend">
+            toolbar="refresh,edit,del,multi,download,recyclebin" :auth="auth" :extend="extend">
         </yun-table>
     </el-card>
 </template>
@@ -16,7 +14,18 @@
         data: {
             extend: {
                 index_url: 'user/group_user/index',
+                edit_url: 'user/group_user/edit',
+                del_url: 'user/group_user/del',
+                multi_url: 'user/group_user/multi',
                 download_url: 'user/group_user/download',
+                recyclebin_url: 'user/group_user/recyclebin'
+            },
+            auth:{
+                edit:Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser','edit'),
+                del:Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser','del'),
+                multi:Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser','multi'),
+                download:Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser','download'),
+                recyclebin:Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser','recyclebin'),
             },
             columns: [
                 {
@@ -33,8 +42,14 @@
                 { field: "id_card", title: "身份证号" },
                 { field: 'sex', title: __('性别'), width: 100, searchList: { 1: __('男'), 2: __('女') }, operate: false },
                 // { field: "jointime", title: "加入时间", operate: "daterange", formatter: Yunqi.formatter.datetime },
-                { field: "status", title: "状态", operate: "select", searchList: { normal: "正常", hidden: "隐藏" }},
-                { field: "createtime", title: "创建时间", operate: "daterange", formatter: Yunqi.formatter.datetime }
+                // {field: 'status', title: __('状态'),searchList: {'normal': __('正常'),'hidden': __('隐藏')},formatter:Yunqi.formatter.switch,operate:'select'},
+                { field: "createtime", title: "创建时间", operate: "daterange", formatter: Yunqi.formatter.datetime },
+                {
+                    field: 'operate',
+                    title: __('操作'),
+                    width:150,
+                    action:{edit:true, del:true}
+                }
                 
             ]
         },

+ 13 - 6
app/admin/view/user/group_user/index.html

@@ -12,7 +12,8 @@
                 </template>
             </el-tab-pane>
         </el-tabs>
-        <yun-table :columns="columns" ref="yuntable" @render="onTableRender" toolbar="refresh" :auth="" :extend="extend">
+        <yun-table :columns="columns" ref="yuntable" @render="onTableRender" toolbar="refresh,recyclebin" :auth="auth"
+            :extend="extend">
         </yun-table>
     </el-card>
 </template>
@@ -26,12 +27,18 @@
             extend: {
                 index_url: 'user/group_user/index',
                 // add_url: 'user/group_user/add?add_type=2',
-                // edit_url: 'user/group_user/edit',
-                // del_url: 'user/group_user/del',
+                edit_url: 'user/group_user/edit',
+                del_url: 'user/group_user/del',
                 // multi_url: 'user/group_user/multi',
                 download_url: 'user/group_user/download',
+                recyclebin_url: 'user/group_user/recyclebin',
                 // import_url: 'user/group_user/import',
             },
+            auth: {
+                edit: Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser', 'edit'),
+                del: Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser', 'del'),
+                recyclebin: Yunqi.auth.check('app\\admin\\controller\\user\\GroupUser', 'recyclebin')
+            },
             columns: [
                 {
                     checkbox: true, selectable: function (row, index) {
@@ -75,16 +82,16 @@
                             type: 'info',
                             text: __('小组成员'),
                             method: 'group_list'
-                        },
+                        }
                     },
-                    visible: false 
+                    visible: false
                 }
             ],
             tabs: 'all'
         },
         //页面加载完成时执行
         onLoad: function (query) {
-            
+
         },
         //页面初始显示或在框架内显示时执行
         onShow: function () {

+ 1 - 1
app/admin/view/user/index/add.html

@@ -17,7 +17,7 @@
                 {field: 'username',title: __('账户'),edit:'text',rules:'required'},
                 {field: 'password',title: __('密码'),edit:'text',rules:'required;length(6~30)'},
                 {field: 'avatar', title: __('头像'),edit:'image'},
-                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管', 3:'记账'}},
+                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管', 3:'记账', 4:'打包'}},
                 {field: 'remark',title: __('备注'),edit:'textarea'},
                 {field: 'status', title: __('状态'), edit:'switch',searchList: {'normal': __('正常'),'hidden': __('隐藏')}},
             ]

+ 1 - 1
app/admin/view/user/index/edit.html

@@ -26,7 +26,7 @@
                 {field: 'sex', title: __('性别'), edit: 'radio',rules:"required",searchList: {1: __('男'), 2: __('女')}},
                 {field: 'email',title: __('邮箱'),rules:'email',edit:'text'},
                 {field: 'mobile',title: __('手机'),edit:'text',rules:'mobile'},
-                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管',3:'记账'}},
+                {field: 'role',title: __('角色'),edit:'checkbox',searchList: {1:'录入员', 2:'库管',3:'记账',4:'打包'}},
                 {field: 'status', title: __('状态'), edit:'switch',searchList: {'normal': __('正常'),'hidden': __('隐藏')}},
             ]
         },

+ 1 - 0
app/admin/view/user/index/index.html

@@ -48,6 +48,7 @@
                     if(value.indexOf("1") > -1)  role =role+"录入员";
                     if(value.indexOf("2") > -1)  role =role+"-库管";
                     if(value.indexOf("3") > -1)  role =role+"-记账";
+                    if(value.indexOf("4") > -1)  role =role+"-打包";
                     return role;
                 }},
                 {field: 'status', title: __('状态'),searchList: {'normal': __('正常'),'hidden': __('隐藏')},formatter:Yunqi.formatter.switch,operate:'select'},

+ 5 - 15
app/admin/view/user/worker_out/index.html

@@ -4,7 +4,7 @@
                 :columns="columns"
                 ref="yuntable"
                 @render="onTableRender"
-                toolbar="refresh,add,edit,del,import,download"
+                toolbar="refresh,download"
                 :auth="{
                     add:{:$auth->check('app\\admin\\controller\\user\\WorkerOut','add')},
                     edit:{:$auth->check('app\\admin\\controller\\user\\WorkerOut','edit')},
@@ -39,21 +39,11 @@ export default{
                 return true;
             }},
             {field:"id",title:"ID",operate:false},
-            {field:"user_id",title:"工人id"},
-            {field:"pid",title:"管理id",operate:false},
+            { field: 'avatar', title: __('头像'), formatter: Yunqi.formatter.image, operate: false },
+            {field:"worker_nickname",title:"出工人员"},
+            {field:"manage_nickname",title:"管理",operate:false},
             {field:"createtime",title:"创建时间",operate:"daterange",formatter:Yunqi.formatter.datetime},
-            {
-                field: 'operate',
-                title: __('操作'),
-                width:130,
-                action:{
-                    edit:function(row){
-                        //可以根据业务需求返回false让按钮不显示
-                        return true
-                    },
-                    del:true,
-                }
-            }
+            
         ]
     },
     //页面加载完成时执行

+ 35 - 1
app/api/controller/GroupUser.php

@@ -11,11 +11,17 @@ use app\common\model\User as UserModel;
 use app\common\model\WorkerOut as WorkerOutModel;
 use \think\facade\Filesystem;
 use app\admin\controller\user\GroupUser as AdminGroupUser;
+use app\api\controller\Worker;
+use app\common\model\ScanLog;
 class GroupUser extends Base
 {
 
     protected $noNeedLogin = ['login'];
-
+    protected $today_worker_out_num=0;
+    protected function _initialize()
+    {
+        parent::_initialize();
+    }
 
     public function userinfo(GroupUserModel $userModel)
     {
@@ -252,6 +258,10 @@ class GroupUser extends Base
     {
         try {
             $workerOutModel=new WorkerOutModel();
+            $worker=new Worker();
+            $scanLog=new ScanLog();
+            $labor_cost_money_avg=empty($worker->quantity_labor_cost_money($scanLog))?0:$worker->quantity_labor_cost_money($scanLog);
+            
             $todayTime = strtotime('today');
             $pid=$this->userinfo['id'];
             $where=[];
@@ -260,10 +270,21 @@ class GroupUser extends Base
             ->select()->each(function ($item, $key) {
                 $state=$this->get_worker_out_state($item['id'],$this->userinfo['id']);
                 $state=$state==0?false:true;
+                if($state){
+                    $this->today_worker_out_num++;
+                }
                 $item['selected']=$state;
                 $item['avatar']= $this->startsWithHttp($item['avatar'])?$item['avatar']:request()->domain().'/' . $item['avatar'];
                 return $item;
             });
+            $num=$this->today_worker_out_num;
+            $labor_cost_money_avg=round(bcdiv(strval($labor_cost_money_avg['labor_cost_money_sum']),strval($this->today_worker_out_num),4),2);
+            foreach ($list as $item) {
+                if($item['selected']){
+                    $item['balance']=$labor_cost_money_avg;
+                }
+                
+            }
             return $this->success('出工人员列表',$list);
             
         } catch (ValidateException $e) {
@@ -389,4 +410,17 @@ class GroupUser extends Base
         return strpos($url, 'https://') === 0
             || strpos($url, 'http://') === 0;
     }
+    //今日出工人员打包汇总
+    public function worker_pack_sum(GroupUserModel $groupUserModel, UserModel $userModel, WorkerOutModel $workerOutModel)
+    {
+        $param = $this->request->post();
+        try {
+            
+            
+        } catch (ValidateException $e) {
+            return $this->error($e->getError());
+        }
+    }
+
+    
 }

+ 47 - 1
app/api/controller/Worker.php

@@ -18,6 +18,7 @@ use app\api\controller\GroupUser as GroupUserController;
 use app\common\model\ShopDelivery as ShopDeliveryModel;
 use app\common\model\WorkerOut as WorkerOutModel;
 use app\common\model\PackSpecs as PackSpecsModel;
+
 /**
  * 打包工人相关接口
  */
@@ -271,7 +272,8 @@ class Worker extends Base
             $spec_quantity_sum=$item['spec_quantity_sum'];
             $spec_labor_cost_money_sum=$item['spec_labor_cost_money_sum'];
             $this->quantity_sum=bcadd($this->quantity_sum, $spec_quantity_sum,0);
-            $this->labor_cost_money_sum=bcadd($this->labor_cost_money_sum, $spec_labor_cost_money_sum,2);
+            $this->labor_cost_money_sum=bcadd($this->labor_cost_money_sum, $spec_labor_cost_money_sum,4);
+            $this->labor_cost_money_sum = round((float)$this->labor_cost_money_sum, 2);
         }
 
         $data = [
@@ -283,6 +285,50 @@ class Worker extends Base
         ];
         $this->success('ok', $data);
     }
+    //获取数量、总价
+    public function quantity_labor_cost_money(ScanLog $scanLog){
+         $where = [];
+        $limit = $this->request->post('limit/d', 10);  //条数
+        $todayTime = date("Y-m-d");
+        $startTime = strtotime($todayTime . ' 00:00:00');
+        $startTime = date('Y-m-d H:i:s', $startTime);
+        $endTime = strtotime($todayTime . ' 23:59:59');
+        $endTime = date('Y-m-d H:i:s', $endTime);
+        $time=$startTime.','.$endTime;
+
+        $time = $this->request->post('create_time/s',$time); //日期
+        $this->time=$time;
+        if (!empty($time)) {
+            $arr = explode(',', $time);
+            $where[] = ['sl.createtime', '>=', strtotime($arr[0])];
+            $where[] = ['sl.createtime', '<=', strtotime($arr[1])];
+        }
+
+        $pid = $this->userinfo['id'];
+        $where[] = ['sl.user_id', '=', $pid];
+
+        $list_sum = $scanLog->alias('sl')
+            ->join("shop_delivery sd", "sl.code = sd.waybill_no", "INNER")
+            ->where('sl.order_status', 1)
+            ->where('sl.spec_id','<>', null)
+            ->where($where)
+            ->field("sl.code,sl.spec_id,SUM(COALESCE(sd.num,0) * 1) as spec_quantity_sum,SUM(COALESCE(sd.num,0) * COALESCE(sd.labor_cost_money,0)) as spec_labor_cost_money_sum")
+            ->group('sl.spec_id')
+            ->select();
+        foreach ($list_sum as $item) {
+            $spec_quantity_sum=$item['spec_quantity_sum'];
+            $spec_labor_cost_money_sum=$item['spec_labor_cost_money_sum'];
+            $this->quantity_sum=bcadd($this->quantity_sum, $spec_quantity_sum,0);
+            $this->labor_cost_money_sum=bcadd($this->labor_cost_money_sum, $spec_labor_cost_money_sum,4);
+            $this->labor_cost_money_sum = round((float)$this->labor_cost_money_sum, 2);
+        }
+
+        $data = [
+            'quantity_sum' => $this->quantity_sum,
+            'labor_cost_money_sum' => $this->labor_cost_money_sum
+        ];
+        return $data;
+    }
     //获取今天出工人员状态,0=未出个,1=出工
     public function get_worker_out_state($id, $pid,$time)
     {