liche update for admin auto car can edit at lists
This commit is contained in:
@@ -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']),
|
||||
|
||||
+119
-25
@@ -45,32 +45,65 @@
|
||||
<label><input type="checkbox" data-check-target=".ids"></label>
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="15%"><span>品牌</span></th>
|
||||
<th width="15%"><span>车系</span></th>
|
||||
<th width="25%"><span>车型-车身颜色-内饰颜色</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width="8%"><span>裸车报价</span></th>
|
||||
<th width="8%"><span>保险报价</span></th>
|
||||
<th width="8%"><span>精品报价</span></th>
|
||||
<th width="8%"><span>金融报价</span></th>
|
||||
<th width="8%"><span>分期首付</span></th>
|
||||
<th width="8%"><span>月供金额</span></th>
|
||||
<th width="8%"><span>公司加价</span></th>
|
||||
<th width="10%"><span>一级分销佣金</span></th>
|
||||
<th width="10%"><span>二级分销佣金</span></th>
|
||||
<th width=""><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in lists">
|
||||
<td>
|
||||
<label><input type="checkbox" name="ids[]" class="ids" :value="v.id"/></label>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.brand_name}}</td>
|
||||
<td>{{v.sery_name}}</td>
|
||||
<td>{{v.attr_title}}</td>
|
||||
<td>{{v.status_name}}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" :data-modal="'auto/cars/get?id='+v.id" data-width="" data-height=""
|
||||
class="am-btn am-btn-primary am-btn-xs">编辑</a>
|
||||
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-danger am-btn-xs"
|
||||
data-field="status" data-value="0" v-if="1==v.status">关闭</a>
|
||||
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-success am-btn-xs"
|
||||
data-field="status" data-value="1" v-if="0==v.status">开启</a>
|
||||
</td>
|
||||
</tr>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr class="tl">
|
||||
<td colspan="11">车型:<span style="font-weight: 600;color:#FF7F50;">{{v.title}}</span></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td>
|
||||
<label><input type="checkbox" name="ids[]" class="ids" :value="v.id"/></label>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<template v-if="1==v.edit">
|
||||
<td><input style="width: 100%" type="text" name="price_car" v-model="info_edit.price_car" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_insure" v-model="info_edit.price_insure" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_fine" v-model="info_edit.price_fine" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_finance" v-model="info_edit.price_finance" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="first_pay" v-model="info_edit.first_pay" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="month_pay" v-model="info_edit.month_pay" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_coplus" v-model="info_edit.price_coplus" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="brokerage_1" v-model="info_edit.brokerage_1" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="brokerage_2" v-model="info_edit.brokerage_2" placeholder=""></td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<td>{{v.price_car}}</td>
|
||||
<td>{{v.price_insure}}</td>
|
||||
<td>{{v.price_fine}}</td>
|
||||
<td>{{v.price_finance}}</td>
|
||||
<td>{{v.first_pay}}</td>
|
||||
<td>{{v.month_pay}}</td>
|
||||
<td>{{v.price_coplus}}</td>
|
||||
<td>{{v.brokerage_1}}</td>
|
||||
<td>{{v.brokerage_2}}</td>
|
||||
</template>
|
||||
<td>
|
||||
<template v-if="1==v.edit">
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs" @click="save_edit()">保存</a>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-default am-btn-xs" @click="set_edit(i,0)">取消</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs" @click="set_edit(i,1)">编辑</a>
|
||||
</template>
|
||||
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-danger am-btn-xs"
|
||||
data-field="status" data-value="0" v-if="1==v.status">关闭</a>
|
||||
<a :data-update="v.id" data-action="/auto/cars/edit_status" class="am-btn am-btn-success am-btn-xs"
|
||||
data-field="status" data-value="1" v-if="0==v.status">开启</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -102,16 +135,77 @@
|
||||
lists:[],
|
||||
statusAry:[],
|
||||
brandAry:[],
|
||||
seryAry:[]
|
||||
seryAry:[],
|
||||
info_edit:{}
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
var lists = [];
|
||||
lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.statusAry = <?=json_encode($statusAry)?>;
|
||||
vm.brandAry = <?=json_encode($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;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<td>{{v.city_id}}</td>
|
||||
<td>{{v.name}}</td>
|
||||
<td>
|
||||
<input style="width: 100%" type="text" name="fee_carno" v-model="v.fee_carno">
|
||||
<input style="width: 100%" type="text" name="fee_carno" v-model="v.fee_carno" placeholder="输入挂牌价">
|
||||
</td>
|
||||
<td>
|
||||
<a data-ajax="post" data-action="/sys/city/city/del" :data-params-id="v.id" class="am-btn am-btn-danger am-btn-xs">删除</a>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user