From 475d1d1ecbbf37d6ea2e327c41d9be8dddbd0966 Mon Sep 17 00:00:00 2001 From: xxb Date: Mon, 9 Aug 2021 17:21:00 +0800 Subject: [PATCH] liche update for admin auto car can edit at lists --- admin/controllers/auto/Cars.php | 23 +++-- admin/views/auto/cars/lists.php | 144 ++++++++++++++++++++++++++------ admin/views/sys/city/lists.php | 2 +- sql/auto.sql | 1 + 4 files changed, 136 insertions(+), 34 deletions(-) diff --git a/admin/controllers/auto/Cars.php b/admin/controllers/auto/Cars.php index 9c4366a6..70755a34 100644 --- a/admin/controllers/auto/Cars.php +++ b/admin/controllers/auto/Cars.php @@ -61,7 +61,7 @@ class Cars extends HD_Controller{ $lists = array(); if($total){ $orderby = 'id desc'; - $select = 'id,brand_id,s_id,attrs,status'; + $select = '*'; $rows = $this->auto_cars_model->select($where, $orderby, $page, $size, $select); if($rows){ $s_ids = array(); @@ -94,14 +94,21 @@ class Cars extends HD_Controller{ $attr = $map_attr[$attr_id]; $arr[$attr['type']] =$attr['title']; } - $attr_title = "{$arr[1]}-{$arr[0]}-{$arr[2]}"; + $attr_title = "{$arr[1]}-{$arr[0]}-内饰{$arr[2]}"; + $title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$attr_title}"; $lists[] = array( 'id' => $v['id'], - 'brand_name' => $map_brand[$v['brand_id']], - 'sery_name' => $map_sery[$v['s_id']], - 'attr_title' => $attr_title, + 'title' => $title, 'status' => $v['status'], - 'status_name' => $statusAry[$v['status']] + 'price_car' => $v['price_car'] > 0 ? $v['price_car'] : '0.00', + 'price_insure' => $v['price_insure'] > 0 ? $v['price_insure'] : '0.00', + 'price_fine' => $v['price_fine'] > 0 ? $v['price_fine'] : '0.00', + 'price_finance' => $v['price_finance'] > 0 ? $v['price_finance'] : '0.00', + 'first_pay' => $v['first_pay'] > 0 ? $v['first_pay'] : '0.00', + 'month_pay' => $v['month_pay'] > 0 ? $v['month_pay'] : '0.00', + 'price_coplus' => $v['price_coplus'] > 0 ? $v['price_coplus'] : '0.00', + 'brokerage_1' => $v['brokerage_1'] > 0 ? $v['brokerage_1'] : '0.00', + 'brokerage_2' => $v['brokerage_2'] > 0 ? $v['brokerage_2'] : '0.00', ); } } @@ -132,8 +139,6 @@ class Cars extends HD_Controller{ $str_ids = implode(',', $attr_ids); $where_attr = array("id in ({$str_ids})" => null); $map_attr = $this->auto_attr_model->map('type', 'title', $where_attr, 'id desc', 0 , 0, 'type, title'); - //属性分类 - $attr_types = $this->auto_attr_model->get_type(); $attr = "{$map_attr[1]}-{$map_attr[0]}-{$map_attr[2]}(内饰)"; //车系 $row_sery = $this->auto_series_model->get(array('id' => $row['s_id'])); @@ -148,6 +153,7 @@ class Cars extends HD_Controller{ 'price_fine' => $row['price_fine'] > 0 ? $row['price_fine'] : '', 'price_finance' => $row['price_finance'] > 0 ? $row['price_finance'] : '', 'first_pay' => $row['first_pay'] > 0 ? $row['first_pay'] : '', + 'month_pay' => $row['month_pay'] > 0 ? $row['month_pay'] : '0.00', 'price_coplus' => $row['price_coplus'] > 0 ? $row['price_coplus'] : '', 'brokerage_1' => $row['brokerage_1'] > 0 ? $row['brokerage_1'] : '', 'brokerage_2' => $row['brokerage_2'] > 0 ? $row['brokerage_2'] : '', @@ -252,6 +258,7 @@ class Cars extends HD_Controller{ 'price_fine' => floatval($info['price_fine']), 'price_finance' => floatval($info['price_finance']), 'first_pay' => floatval($info['first_pay']), + 'month_pay' => floatval($info['month_pay']), 'price_coplus' => floatval($info['price_coplus']), 'brokerage_1' => floatval($info['brokerage_1']), 'brokerage_2' => floatval($info['brokerage_2']), diff --git a/admin/views/auto/cars/lists.php b/admin/views/auto/cars/lists.php index 17cd0ad3..18be9543 100644 --- a/admin/views/auto/cars/lists.php +++ b/admin/views/auto/cars/lists.php @@ -45,32 +45,65 @@ ID - 品牌 - 车系 - 车型-车身颜色-内饰颜色 - 状态 + 裸车报价 + 保险报价 + 精品报价 + 金融报价 + 分期首付 + 月供金额 + 公司加价 + 一级分销佣金 + 二级分销佣金 操作 - - - - {{v.id}} - - {{v.brand_name}} - {{v.sery_name}} - {{v.attr_title}} - {{v.status_name}} - - 编辑 - 关闭 - 开启 - - + @@ -102,16 +135,77 @@ lists:[], statusAry:[], brandAry:[], - seryAry:[] + seryAry:[], + info_edit:{} }, mounted:function() { var vm = this; + var lists = []; + lists = ; vm.params = ; - vm.lists = ; vm.statusAry = ; vm.brandAry = ; + + for(var i in lists){ + lists[i].edit = 0; + } + + vm.lists = lists; + }, + methods:{ + set_edit:function(index, type){ + var vm = this; + var row = vm.lists[index]; + if(1 == type){ + if(undefined != vm.info_edit.index){ + //旧的编辑取消 + vm.lists[vm.info_edit.index].edit = 0; + } + row.edit = 1; + vm.info_edit = JSON.parse(JSON.stringify(row)); + vm.info_edit.index = index; + } else { + row.edit = 0; + vm.info_edit = {}; + } + }, + save_edit:function(){ + var vm = this; + if(1 == loading){ + return 0; + } + loading = 1; + + $.ajax({ + url: 'auto/cars/edit', + type: 'post', + dataType: 'json', + data: {info:vm.info_edit}, + beforeSend: function () { + layer.load(1, { + shade: [0.1, '#fff'] //0.1透明度的白色背景 + }); + }, + success: function (data) { + loading = 0; + if (data['code']) { + layer.msg(data.msg, { + icon: 1, + time: 2000 + }, function () { + $.form.reload(); + }); + } else { + layer.msg(data.msg, {icon: 2}); + } + }, + complete: function () { + loading = 0; + layer.closeAll('loading'); + } + }); + } }, - methods:{}, watch:{ 'params.brand_id':function(nv, ov){ var vm = this; diff --git a/admin/views/sys/city/lists.php b/admin/views/sys/city/lists.php index 53472ef3..47f3a980 100755 --- a/admin/views/sys/city/lists.php +++ b/admin/views/sys/city/lists.php @@ -35,7 +35,7 @@ {{v.city_id}} {{v.name}} - + 删除 diff --git a/sql/auto.sql b/sql/auto.sql index 9e04db10..3c8f5671 100644 --- a/sql/auto.sql +++ b/sql/auto.sql @@ -75,3 +75,4 @@ create table lc_auto_cars ( primary key (id), unique(attrs) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='车型库'; +alter table lc_auto_cars add column month_pay double(10,2) not null default 0.0 comment '月供' after first_pay;