afa 5 ماه پیش
والد
کامیت
e4ed724f82

+ 4 - 3
app/admin/controller/Dashboard.php

@@ -16,7 +16,7 @@ use app\common\model\delivery\Text;
 use app\common\model\MoneyLog;
 use app\common\model\StockDetail;
 use app\common\model\StockConfig;
-use app\common\library\Date;
+use app\common\model\ShopDelivery;
 use app\common\controller\Backend;
 use think\annotation\route\Route;
 use think\facade\Db;
@@ -34,16 +34,17 @@ class Dashboard extends Backend
      * 查看
      */
     #[Route('GET','dashboard/index')]
-    public function index(StockConfig $stockConfig, StockDetail $stockDetail, MoneyLog $moneyLog)
+    public function index(StockConfig $stockConfig, StockDetail $stockDetail, MoneyLog $moneyLog, ShopDelivery $shopDelivery)
     {
         if($this->request->isAjax()){
             //顶部统计
             $moneyLog = $moneyLog::getCountBalance();
+
             $panel=[
                 rand(100,1000),
                 rand(100,1000),
                 $moneyLog['balance'], // 当前结余(所有收入-支出)
-                rand(100,1000),
+                $shopDelivery::getPendingSettlementAmount(),  //待结算金额
             ];
             $variety = [];
             $box = [];

+ 30 - 0
app/admin/controller/shop/ShopDelivery.php

@@ -19,7 +19,37 @@ class ShopDelivery extends Backend
         parent::_initialize();
         $this->model = new ShopDeliveryModel();
         $this->assign('platformList', site_config('addonsd.platform_list'));
+      
         $this->relationField=['customer','user','shops', 'variety', 'specs'];
     }
 
+
+    /**
+     * 查看
+     */
+    #[Route('GET,JSON','index')]
+    public function 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
+            ->withJoin($with,'left')
+            //如果没有使用operate filter过滤的情况下,推荐使用with关联,可以提高查询效率
+            //->with($with)
+            ->where($where)
+            ->order($order)
+            ->paginate($limit);
+
+        //表格底部要有汇总:发货数量汇总  重量汇总 总价汇总
+        $total_num = $this->model->sum('num');
+        $this->assign('total_weigh', $this->model->sum('weigh'));
+        $this->assign('total_price', $this->model->sum('total_price'));
+        $result = ['total' => $list->total(), 'rows' => $list->items(), 'total_num' => $total_num];
+        return json($result);
+    }
 }

+ 3 - 3
app/admin/view/dashboard/index.html

@@ -27,7 +27,7 @@
                                 <div class="style-1 bkcolor4">
                                     <div class="box">
                                         <div class="box-title">当前结余</div>
-                                        <div class="box-number">{{panel[3]}}</div>
+                                        <div class="box-number">{{panel[2]}}</div>
                                     </div>
                                     <i class="fa fa-exchange"></i>
                                 </div>
@@ -35,8 +35,8 @@
                             <el-col :md="6" :sm="12" :xs="12">
                                 <div class="style-1 bkcolor3">
                                     <div class="box">
-                                        <div class="box-title">月租用户</div>
-                                        <div class="box-number">{{panel[2]}}</div>
+                                        <div class="box-title">待结算金额</div>
+                                        <div class="box-number">{{panel[3]}}</div>
                                     </div>
                                     <i class="fa fa-dashcube"></i>
                                 </div>

+ 32 - 13
app/admin/view/shop/shop_delivery/index.html

@@ -1,12 +1,17 @@
 <template>
     <el-card shadow="never">
+        
         <yun-table
                 :columns="columns"
                 search="name,phone"
                 toolbar="refresh,add,edit,del,more"
                 ref="yuntable"
                 :auth="auth"
-                :extend="extend">
+                :extend="extend"
+                :show-summary="true"
+                :total-arr="totalArr"
+                :is-showtotal="true"
+                >
         </yun-table>
     </el-card>
 </template>
@@ -16,7 +21,6 @@
         components:{'YunTable':table},
         data:{
             auth:{
-               
                 recyclebin:Yunqi.auth.check('app\\admin\\controller\\shop\\ShopList','recyclebin'),
             },
             extend:{
@@ -26,30 +30,45 @@
             columns:[
                 {checkbox: true},
                 {field: 'id',title: __('ID'),width:80,sortable: true},
-                {field: 'user.nickname', title: __('录入人'),operate: 'LIKE'},
                 {field: 'customer.name',title: __('客户'),operate:'LIKE'},
-                {field: 'shops.name',title: __('店铺'),operate:'LIKE'},
                 {field: 'plat_id',title: __('平台'),operate: false, searchList: Yunqi.data.platformList},
+                {field: 'shops.name',title: __('店铺'),operate:'LIKE'},
                 {field: 'variety.title', title: __('品种'),operate: false},
                 {field: 'specs.title', title: __('规格'),operate: false},
                 {field: 'num', title: __('数量'),operate: false},
                 {field: 'weigh', title: __('重量'),operate: false},
-                {field: 'price', title: __('当前发货价'),operate: false},
+                {field: 'price', title: __('发货价'),operate: false},
                 {field: 'total_price', title: __('总价'),operate: false},
-                {field: 'status', title: __('状态'),width:120,searchList: {1: __('待结算'),2: __('已结算'), 3: __('驳回')},formatter:Yunqi.formatter.switch},
                 {field: 'settlement_data', title: __('结算时间'), width:160,formatter: Yunqi.formatter.datetime,operate:false,sortable: true},
+                {field: 'status', title: __('结算状态'),width:120,searchList: {1: __('待结算'),2: __('已结算'), 3: __('驳回')},formatter:Yunqi.formatter.switch},
                 {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}
-                // }
+                {field: 'user.nickname', title: __('录入人'),operate: 'LIKE'},
+           
+            ],
+            totalArr: [
+                {
+                    name:"发货数量汇总",
+                    value: Yunqi.data.total_num
+                },
+                {
+                    name:"发货重量汇总",
+                    value: Yunqi.data.total_weigh
+                },
+                {
+                    name:"发货总价汇总",
+                    value: Yunqi.data.total_price
+                },
             ]
         },
         methods: {
+            test(){
+                console.log(this.$refs['yuntable'], "==");
+            }
+        },
         
-        }
+        onLoad:function(query){
+            this.test()
+        },
     }
 </script>
 <style>

+ 2 - 5
app/api/controller/MoneyLog.php

@@ -14,16 +14,13 @@ use think\facade\Db;
 class MoneyLog extends Base
 {
 
-
-
       //记账记录
       public function moneylog(MonuyModel $monuyModel)
       {
 
-            $time = $this->request->post('time/d', date('Y-m'));
+            $time = $this->request->post('time/s', date('Y-m'));
             $result['count'] = $monuyModel::getCountBalance($this->userinfo['id'], $time);
-
-            $result['list']  = $monuyModel->where('user_id', $this->userinfo['id'])
+            $result['list']  = $monuyModel//->where('user_id', $this->userinfo['id'])
                               ->whereMonth('create_date', $time)
                               ->order('id desc')
                               //->group('create_date')

+ 10 - 0
app/common/model/ShopDelivery.php

@@ -17,6 +17,9 @@ class ShopDelivery Extends Model
         'updatetime'     =>  'timestamp:Y-m-d H:i',
     ];
 
+    const StatusNormal = 1;
+    const StatusSettlement = 2;
+    const StatusRefund = 3;
 
     public static function onAfterInsert($data)
     {
@@ -24,6 +27,13 @@ class ShopDelivery Extends Model
         $data->save();
     }
 
+
+    //待结算金额
+    public static function getPendingSettlementAmount()
+    {
+        return self::where('status', self::StatusNormal)->sum('total_price');
+    }
+
     //id,name
     public function user()
     {

+ 11 - 1
public/assets/js/components/Table.js

@@ -65,7 +65,8 @@ export default {
                 show:false,
                 success:0,
                 fail:[]
-            }
+            },
+            allData:{}
         }
     },
     template:tableTemp,
@@ -179,6 +180,14 @@ export default {
             type:Function,
             default:function(){}
         },
+        totalArr:{
+            type:Array,
+            default:[]
+        },
+        isShowtotal:{
+            type:Boolean,
+            default:false
+        }
     },
     mounted:function(){
         this.table_.searchFormVisible=this.searchFormVisible;
@@ -638,6 +647,7 @@ export default {
                 json.page=this.currentPage;
                 json.limit=this.pageSize;
                 Yunqi.ajax.json(this.extend.index_url,json).then(data=>{
+                    this.allData = data
                     this.total=data.total;
                     this.render(data.rows);
                     Vue.nextTick(()=>{

+ 4 - 3
public/assets/js/components/template/TableTemp.js

@@ -373,6 +373,9 @@ const template=`
             </el-row>
         </el-form>
     </el-card>
+    <el-card shadow="never" class="yunqi-filter" v-if="isShowtotal">
+        <span v-for="(it,ix) in totalArr" :key="ix" style="padding-right:20px">{{it.name+":"+it.value}}</span>
+    </el-card>
     <el-table
             :data="list"
             ref="table"
@@ -422,9 +425,7 @@ const template=`
                 </template>
             </template>
     </el-table>
-    <el-card shadow="never" :class="['table-footer',pageFont]" v-if="showSummary">
-        合计:<span v-html="summary"></span>
-    </el-card>
+
     <el-pagination
             v-if="pagination"
             style="margin: 15px 0"

+ 1 - 1
runtime/admin/temp/b353996ff73b3f877e532ecb62c627e6-js.php

@@ -1,4 +1,4 @@
-<?php /*a:2:{s:68:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\dashboard\index.html";i:1751875716;s:63:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\layout\vue.html";i:1751866917;}*/ ?>
+<?php /*a:2:{s:68:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\dashboard\index.html";i:1751886234;s:63:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\layout\vue.html";i:1751866917;}*/ ?>
 
     export default{
         data:{

+ 4 - 4
runtime/admin/temp/b353996ff73b3f877e532ecb62c627e6.php

@@ -1,4 +1,4 @@
-<?php /*a:2:{s:68:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\dashboard\index.html";i:1751875716;s:63:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\layout\vue.html";i:1751866917;}*/ ?>
+<?php /*a:2:{s:68:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\dashboard\index.html";i:1751886234;s:63:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\layout\vue.html";i:1751866917;}*/ ?>
 <!DOCTYPE html>
 <html <?php if($config['elementUi']['dark']): ?>class="dark"<?php endif; ?>>
 <head>
@@ -178,7 +178,7 @@
                                 <div class="style-1 bkcolor4">
                                     <div class="box">
                                         <div class="box-title">当前结余</div>
-                                        <div class="box-number">{{panel[3]}}</div>
+                                        <div class="box-number">{{panel[2]}}</div>
                                     </div>
                                     <i class="fa fa-exchange"></i>
                                 </div>
@@ -186,8 +186,8 @@
                             <el-col :md="6" :sm="12" :xs="12">
                                 <div class="style-1 bkcolor3">
                                     <div class="box">
-                                        <div class="box-title">月租用户</div>
-                                        <div class="box-number">{{panel[2]}}</div>
+                                        <div class="box-title">待结算金额</div>
+                                        <div class="box-number">{{panel[3]}}</div>
                                     </div>
                                     <i class="fa fa-dashcube"></i>
                                 </div>