customer_318
This commit is contained in:
@@ -16,6 +16,33 @@ class Common extends CI_Controller
|
||||
|
||||
public $data = array();
|
||||
|
||||
/**
|
||||
* Notes:获取车系
|
||||
* Created on: 2022/3/18 17:09
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
public function auto_series()
|
||||
{
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$page = $this->input->post('page') ? intval($this->input->post('page')) : 1;
|
||||
$size = $this->input->post('size') ? intval($this->input->post('size')) : 10;
|
||||
$brand_id = intval($this->input->post('brand_id'));
|
||||
$name = $this->input->post('name');
|
||||
$where['status'] = 1;
|
||||
$brand_id && $where['brand_id'] = $brand_id;
|
||||
$name && $where['name like "%' . $name . '%"'] = null;
|
||||
$list = [];
|
||||
$count = $this->mdAutoSeries->count($where);
|
||||
if ($count) {
|
||||
$list = $this->mdAutoSeries->select($where, "id desc", $page, $size, 'id, name');
|
||||
}
|
||||
$this->data['list'] = $list;
|
||||
$hasNext = ceil($count / $size) > $page ? 1 : 0;
|
||||
$this->data['page'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
//获取素材模版
|
||||
public function material()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:车型介绍
|
||||
* Created on: 2022/3/18 10:31
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Introduce extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$statusAry = $this->mdAutoIntroduce->statusAry();
|
||||
$lists = array();
|
||||
$where = ["status<>-1" => null];
|
||||
if (strlen($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
$count = $this->mdAutoIntroduce->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdAutoIntroduce->select($where, "id desc", $params['page'], $params['size']);
|
||||
$map_brand = $map_series = [];
|
||||
$brand_ids = array_unique(array_column($res, 'brand_id'));
|
||||
if ($brand_ids) {
|
||||
$str_ids = implode(',', $brand_ids);
|
||||
$map_brand = $this->mdAutoBrand->map('id', 'name', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
$s_ids = array_unique(array_column($res, 's_id'));
|
||||
if ($s_ids) {
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$map_series = $this->mdAutoSeries->map('id', 'name', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
foreach ($res as $key => $value) {
|
||||
$brand_name = $map_brand[$value['brand_id']];
|
||||
$s_name = $map_series[$value['s_id']];
|
||||
$lists[] = [
|
||||
'id' => $value['id'],
|
||||
'title' => "{$brand_name}-{$s_name}",
|
||||
'status' => $value['status'],
|
||||
'status_name' => $statusAry[$value['status']],
|
||||
'c_time' => date('Y-m-d', $value['c_time']),
|
||||
];
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['showInfo'] = ['statusAry' => $statusAry];
|
||||
$this->data['_title'] = '车型介绍列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
return $this->show_view('/auto/introduce/lists', true);
|
||||
}
|
||||
|
||||
|
||||
//展示单条数据
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
$info = [];
|
||||
if ($id) {
|
||||
$re = $this->mdAutoIntroduce->get(['id' => $id]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车型不存在!');
|
||||
}
|
||||
$_title = '编辑车型介绍';
|
||||
$showInfo = ['title' => '请选择车型', 'url' => '/auto/introduce/edit'];
|
||||
} else {
|
||||
$_title = '新增车型介绍';
|
||||
$info = array(
|
||||
'brand_id' => 0,
|
||||
's_id' => 0,
|
||||
'video' => '',
|
||||
'video_cover' => '',
|
||||
'content' => '',
|
||||
);
|
||||
$showInfo = ['title' => '请选择车型', 'url' => '/auto/introduce/add'];
|
||||
}
|
||||
$showInfo['brandList'] = $this->mdAutoBrand->select(["status<>-1" => null], 'id desc', 0, 0, 'id, name');
|
||||
$this->data['_title'] = $_title;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['showInfo'] = $showInfo;
|
||||
return $this->show_view('/auto/introduce/edit',true);
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称不能为空!');
|
||||
}
|
||||
$re = $this->mdCustomerTag->get(array('name' => $params['name']));
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称已存在了!');
|
||||
}
|
||||
$this->mdCustomerTag->add(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$params['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入标签名称');
|
||||
}
|
||||
$re = $this->mdCustomerTag->get(array('name' => $params['name']));
|
||||
if ($re && $re['id'] != $params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称已存在了!');
|
||||
}
|
||||
$this->mdCustomerTag->update(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']]
|
||||
, ['id' => $params['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
function edit_status()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$stauts = intval($this->input->post('status'));
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$this->mdAutoIntroduce->update(['status' => $stauts], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$this->mdAutoIntroduce->update(['status' => '-1'], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
<div id="vue-edit" class="am-form am-form-horizontal">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">车型:</label>
|
||||
<div class="am-para-input wp60 w300" style="width: 20%">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
@click="seriesModal">{{showInfo.title}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">视频:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<input type="text" id="video-url" name="video" v-model="info.video" placeholder="视频地址"/>
|
||||
<div class="am-form-inline" style="margin-top: 15px;">
|
||||
<div class="am-form-group" style="margin-right: 10px;">
|
||||
<button id="upload-video" type="button" class="am-btn am-btn-default am-btn-sm" @click="btn_video">
|
||||
<i class="am-icon-cloud-upload"></i> 选择要上传的视频
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group" id="show-video">
|
||||
<a href="javascript:void(0)" :data-modal="'/common/show_video?video='+info.video"
|
||||
data-title="查看视频" v-if="info.video_cover">
|
||||
<img :src="info.video_cover" style="height:auto;max-height:32px;min-width:32px"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">内容:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<textarea id="id-content" name="content" style="min-height: 250px">{{info.content}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<button class="am-btn ml20 am-btn-sm am-btn-success w100" type="button" @click="saveEdit">保存</button>
|
||||
</div>
|
||||
|
||||
<div id="series-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="35%" style="font-weight: bold;padding-left: 8px;">车系</td>
|
||||
<td width="20%">
|
||||
<select id="id-brand_id" class="form-control" style="width:100px;font-size: 1.4rem;"
|
||||
@change='getSeries(1);'
|
||||
v-model="info.brand_id">
|
||||
<option value="0">选择品牌</option>
|
||||
<template v-for="(v,i) in showInfo.brandList">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</td>
|
||||
<td width="35%" style="padding-right: 8px;"><label class="sr-only" for="search">车系名称</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" style="font-size: 1.2rem;font-weight: bold;"
|
||||
v-model='seriesTitle' placeholder="车系名称">
|
||||
<div class="input-group-btn">
|
||||
<button type="button" @click='getSeries(1);' class="btn btn-default">搜</button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="border-bottom: 1px solid #ddd;height: 1px;margin-top: 8px;"></div>
|
||||
<table class="table table-middle">
|
||||
<colgroup>
|
||||
<col width="70%"/>
|
||||
<col width="10%"/>
|
||||
<col width="20%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in seriesList">
|
||||
<td>{{v.name}}</td>
|
||||
<td class="text-right">
|
||||
<a v-if="v.selected==0" href="javascript:void(0);" @click="setSeries(v,1)"
|
||||
class="btn btn-primary btn-sm">选择</a>
|
||||
<a v-else-if="v.selected==1" href="javascript:void(0);" @click="setSeries(v,0)"
|
||||
class="btn btn-default btn-sm">移除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{seriesPage.page}}页(每页{{seriesPage.pageLimit}}条,共{{seriesPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeSeriesPage();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="seriesPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterSeriesPage();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var loading = false;
|
||||
var vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: {},
|
||||
showInfo: {},
|
||||
seriesList: [],
|
||||
seriesPage: [],
|
||||
seriesTitle: '',
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.showInfo = <?=json_encode($showInfo)?>;
|
||||
},
|
||||
methods: {
|
||||
seriesModal: function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '50%'], //宽高
|
||||
content: $('#series-modal'),
|
||||
title: '选择车型',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
getSeries: function (page) {
|
||||
var vm = this;
|
||||
if (vm.info.brand_id == 0) {
|
||||
layer.msg('请选择品牌');
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/common/auto_series',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: page,
|
||||
brand_id: vm.info.brand_id,
|
||||
name: vm.seriesTitle,
|
||||
},
|
||||
success: function (re) {
|
||||
var seriesList = re.data.list;
|
||||
vm.seriesPage = re.data.page;
|
||||
seriesList.map(function (_item, _index) {
|
||||
if (vm.info.s_id == _item.id) {
|
||||
seriesList[_index].selected = 1;
|
||||
} else {
|
||||
seriesList[_index].selected = 0;
|
||||
}
|
||||
});
|
||||
vm.seriesList = seriesList;
|
||||
}
|
||||
});
|
||||
},
|
||||
setSeries: function (item, checked) {
|
||||
var vm = this;
|
||||
var seriesList = vm.seriesList;
|
||||
seriesList.map(function (_item, _index) {
|
||||
seriesList[_index].selected = 0;
|
||||
});
|
||||
vm.seriesList = seriesList;
|
||||
if (checked) {
|
||||
vm.info.s_id = item.id;
|
||||
vm.showInfo.title = $("#id-brand_id").find("option:selected").text() + '-' + item.name;
|
||||
item.selected = 1;
|
||||
} else {
|
||||
vm.info.s_id = 0;
|
||||
vm.showInfo.title = '请选择车型';
|
||||
}
|
||||
},
|
||||
beforeSeriesPage: function () {
|
||||
var vm = this;
|
||||
if (vm.seriesPage.page == 1) {
|
||||
layer.msg('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.seriesPage.page--;
|
||||
vm.getSeries(vm.seriesPage.page);
|
||||
},
|
||||
afterSeriesPage: function () {
|
||||
var vm = this;
|
||||
vm.seriesPage.page++;
|
||||
vm.getSeries(vm.seriesPage.page);
|
||||
},
|
||||
btn_video: function () {
|
||||
upvideo(this);
|
||||
},
|
||||
saveEdit: function () {
|
||||
var vm = this;
|
||||
vm.info.video = $('#video-url').val();
|
||||
vm.info.content = $('#id-content').val();
|
||||
$.ajax({
|
||||
url: vm.showInfo.url,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info,
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
if (vm.acto.length > 0) {
|
||||
$.form.href(vm.acto);
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param btn
|
||||
*/
|
||||
function upvideo(btn) {
|
||||
var show_video = $('#show-video');
|
||||
var _this = $(btn);
|
||||
var qiniu = new Qiniu.UploaderBuilder()
|
||||
.domain('https://upload-z2.qiniup.com')//配置参考https://developer.qiniu.com/kodo/manual/1671/region-endpoint
|
||||
.retry(0)//设置重传次数,默认0,不重传
|
||||
.size(1024 * 1024)//分片大小,最多为4MB,单位为字节,默认1MB
|
||||
.chunk(true)//是否分块上传,默认true,当chunk=true并且文件大于4MB才会进行分块上传
|
||||
.auto(true)//选中文件后立即上传,默认true
|
||||
.multiple(false)//是否支持多文件选中,默认true
|
||||
.accept(['video/*'])//过滤文件,默认无
|
||||
.tokenShare(true)//在一次上传队列中,是否分享token,如果为false每上传一个文件都需要请求一次Token,默认true
|
||||
.tokenFunc(function (setToken, task) {
|
||||
//token获取函数,token获取完成后,必须调用`setToken(token);`不然上传任务不会执行。
|
||||
var ret = $.ajax({
|
||||
url: "/common/qiniu_token",
|
||||
type: 'POST',
|
||||
data: {filename: task.key, type: "video"},
|
||||
async: false
|
||||
}).responseText;
|
||||
ret = JSON.parse(ret);
|
||||
setToken(ret.data);
|
||||
})
|
||||
.listener({
|
||||
onReady: function (tasks) {
|
||||
// write(tasks)
|
||||
}, onStart: function (tasks) {
|
||||
}, onTaskGetKey: function (task) {
|
||||
//为每一个上传的文件指定key,如果不指定则由七牛服务器自行处理
|
||||
var ret = $.ajax({
|
||||
url: "/common/qiniu_video",
|
||||
type: 'POST',
|
||||
data: {filename: task.file.name},
|
||||
async: false
|
||||
}).responseText;
|
||||
ret = JSON.parse(ret);
|
||||
if (ret.code == 0) {
|
||||
layer.msg(ret.msg, {icon: 2});
|
||||
return;
|
||||
}
|
||||
return ret.data;
|
||||
}, onTaskProgress: function (task) {
|
||||
show_video.empty();
|
||||
show_video.prepend("视频上传进度" + task.progress + "%");
|
||||
}, onTaskSuccess: function (task) {
|
||||
// console.log(task);
|
||||
show_video.empty();
|
||||
var res = task._result.data;
|
||||
vue_obj.info.video = res.site_url;
|
||||
vue_obj.info.video_cover = res.site_url + '?vframe/jpg/offset/1';
|
||||
var html = '<a href="javascript:void(0)" data-modal="/common/show_video?video=' + res.site_url + '" data-title="查看视频">' +
|
||||
'<img src="' + res.site_url + '?vframe/jpg/offset/1" ' +
|
||||
'style="height:auto;max-height:32px;min-width:32px"></a>';
|
||||
show_video.prepend(html);
|
||||
$('#video-url').val(res.site_url);
|
||||
}, onTaskFail: function (task) {
|
||||
show_video.empty();
|
||||
show_video.prepend("上传失败");
|
||||
}, onTaskRetry: function (task) {
|
||||
// write(task)
|
||||
}, onFinish: function (tasks) {
|
||||
// write(tasks)
|
||||
}
|
||||
}).build();
|
||||
qiniu.chooseFile();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,215 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="auto/introduce">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status">
|
||||
<option value="">选择状态</option>
|
||||
<? foreach ($showInfo['statusAry'] as $key => $value) { ?>
|
||||
<option value="<?= $key ?>" <?= strlen($params['status']) && $key == $params['status'] ? 'selected' : '' ?>
|
||||
><?= $value ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml30">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" data-open="/auto/introduce/get"
|
||||
class="am-btn am-btn-success am-btn-sm w100">新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100">生成物料</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd" id="vue-show">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="25%"><span>车型</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width="10%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><? if ($v['status'] == 1) { ?>
|
||||
<a data-ajax="post" data-action="/auto/introduce/edit_status"
|
||||
class="am-btn am-btn-danger am-btn-xs"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="0">关闭</a>
|
||||
<?
|
||||
} ?>
|
||||
<? if ($v['status'] == 0) { ?>
|
||||
<a data-ajax="post" data-action="/auto/introduce/edit_status"
|
||||
class="am-btn am-btn-success am-btn-xs"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="1">开启</a>
|
||||
<? } ?>
|
||||
<a data-ajax="post" data-action="/auto/introduce/del" class="am-btn am-btn-danger am-btn-xs"
|
||||
data-params-id="<?= $v['id'] ?>">删除</a></td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="options-modal" style="display: none;">
|
||||
<table class="table table-hover table-middle" style="table-layout:fixed">
|
||||
<colgroup>
|
||||
<col width="65%">
|
||||
<col width="15%">
|
||||
<col width="">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">标题</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th class="text-right">
|
||||
<a href="javascript:" style="margin-top: 2px;" class="btn btn-primary btn-sm"
|
||||
@click='addOptions()'>添加</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in optionsList">
|
||||
<tr v-if="item.status==1">
|
||||
<td class="text-center">
|
||||
<input :id="'name_'+index" @blur="editName(index)" class="form-control"
|
||||
v-model="item.name" placeholder="请输入标题"></td>
|
||||
<td class="text-center">
|
||||
<input :id="'group_name_'+index" @blur="editGroupName(index)" class="form-control"
|
||||
v-model="item.sort" type="number" placeholder="请输入排序值">
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<a href="javascript:void(0);" style="margin-top:2px;"
|
||||
class="btn btn-danger btn-sm" @click='delOptions(index)'>删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vue_obj;
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-show',
|
||||
data: {
|
||||
optionsList: [],
|
||||
},
|
||||
mounted: function () {
|
||||
},
|
||||
methods: {
|
||||
optionsModal: function (id, name) {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '50%'], //宽高
|
||||
content: $('#options-modal'),
|
||||
title: '编辑【' + name + '】选项',
|
||||
shade: false,
|
||||
btn: ['保存', '取消'],
|
||||
yes: function (index) {
|
||||
$.ajax({
|
||||
url: '/receiver/tag/edit_options',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id, options: that.optionsList},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url: '/receiver/tag/get_options',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (re) {
|
||||
if (re.code) {
|
||||
that.optionsList = re.data.lists;
|
||||
} else {
|
||||
layer.msg(re.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
}
|
||||
});
|
||||
},
|
||||
addOptions: function () {
|
||||
var that = this;
|
||||
that.optionsList.push({id: 0, name: '', status: 1, sort: 50});
|
||||
},
|
||||
delOptions: function (index) {
|
||||
var that = this;
|
||||
if (that.optionsList[index]['id'] > 0) {
|
||||
that.optionsList[index]['status'] = -1;
|
||||
} else {
|
||||
that.optionsList.splice(index, 1);
|
||||
}
|
||||
},
|
||||
editName: function (index) {
|
||||
var name = $("#name_" + index).val();
|
||||
if (name == '') {
|
||||
layer.msg("标题不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 修改排序
|
||||
editGroupName: function (index) {
|
||||
var order_view = $("#group_name_" + index).val();
|
||||
if (order_view == '') {
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
this.optionsList.sort(function (a, b) {
|
||||
return b.sort - a.sort;
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -574,10 +574,7 @@ class Customers extends Wxapp
|
||||
//车系车型
|
||||
//$series_arr = array_unique(array_column($rows, 's_id'));
|
||||
//$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
$allot = 0;
|
||||
if ($group_id == 2 || $group_id == 3) {//店长和老板可再分配用户
|
||||
$allot = 1;
|
||||
}
|
||||
$allot = $this->get_allot();
|
||||
foreach ($rows as $key => $val) {
|
||||
//$car_json = json_decode($val['car_json'], true);
|
||||
//$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
|
||||
@@ -609,6 +606,7 @@ class Customers extends Wxapp
|
||||
'other_data' => $other_data,
|
||||
'tags' => $tags,
|
||||
'defeat' => $defeat,
|
||||
'group_id' => $group_id,
|
||||
'allot' => $allot
|
||||
];
|
||||
}
|
||||
@@ -627,6 +625,10 @@ class Customers extends Wxapp
|
||||
$uid = $this->session['uid'];
|
||||
$id_arr = $this->input_param('ids');
|
||||
$admin_id = $this->input_param('admin_id');
|
||||
$allot = $this->get_allot();
|
||||
if ($allot == 0) {
|
||||
throw new Hd_exception('无权限分配', API_CODE_INVILD_PARAM);
|
||||
}
|
||||
$admin = $this->app_user_model->get(['id' => $admin_id, 'status' => 1]);
|
||||
if (!$id_arr || !$admin) {
|
||||
throw new Hd_exception('参数错误', API_CODE_INVILD_PARAM);
|
||||
@@ -685,11 +687,11 @@ class Customers extends Wxapp
|
||||
$admins = $this->app_user_model->map('id', '', ["id in ({$admin_ids})" => null], '', '', '', 'id,uname');
|
||||
}
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
//$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//车系车型
|
||||
$series_arr = array_unique(array_column($rows, 's_id'));
|
||||
$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
//$series_arr = array_unique(array_column($rows, 's_id'));
|
||||
//$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
foreach ($rows as $key => $val) {
|
||||
//$car_json = json_decode($val['car_json'], true);
|
||||
//$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
|
||||
@@ -861,4 +863,21 @@ class Customers extends Wxapp
|
||||
}
|
||||
return $mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:判断分配客户权限
|
||||
* Created on: 2022/3/18 10:02
|
||||
* Created by: dengbw
|
||||
* @return int
|
||||
*/
|
||||
private function get_allot()
|
||||
{
|
||||
$allot = 0;
|
||||
$group_id = $this->session['group_id'];
|
||||
if ($group_id == 2 || $group_id == 3) {//店长和老板可再分配用户
|
||||
$allot = 1;
|
||||
}
|
||||
return $allot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,18 +64,18 @@ class Biz extends Wxapp
|
||||
$lists = [
|
||||
[
|
||||
'brand_id' => 1, 'cms_id' => 0, 'sort' => 0,
|
||||
'title' => '东风EX1', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '45700 ~ 52700'],
|
||||
'title' => '东风 EX1 Pro', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '50700 ~ 57700'],
|
||||
'img' => 'https://img.liche.cn/EX1.png'
|
||||
],
|
||||
[
|
||||
'brand_id' => 2, 'cms_id' => 0, 'sort' => 0,
|
||||
'title' => '雷丁芒果', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '29800 ~ 54900'],
|
||||
'img' => 'https://img.liche.cn/LDMG.png'
|
||||
'brand_id' => 4, 'cms_id' => 0, 'sort' => 0,
|
||||
'title' => '哪吒V', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '68900 ~ 77900'],
|
||||
'img' => 'https://img.liche.cn/NZV.png'
|
||||
],
|
||||
[
|
||||
'brand_id' => 4, 'cms_id' => 0, 'sort' => 0,
|
||||
'title' => '哪吒V', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '65900 ~ 74900'],
|
||||
'img' => 'https://img.liche.cn/NZV.png'
|
||||
'title' => '哪吒U', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '105800 ~ 167800'],
|
||||
'img' => 'https://img.liche.cn/NZU.png'
|
||||
],
|
||||
[
|
||||
'brand_id' => 5, 'cms_id' => 0, 'sort' => 0,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:车型介绍
|
||||
* Created on: 2022/3/18 10:31
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Auto_introduce_model extends HD_Model
|
||||
{
|
||||
|
||||
private $table_name = 'lc_auto_introduce';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:状态
|
||||
* Created on: 2022/3/18 10:31
|
||||
* Created by: dengbw
|
||||
* @return array
|
||||
*/
|
||||
public function statusAry()
|
||||
{
|
||||
return array(1 => '正常', 0 => '禁用');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user