This commit is contained in:
faiz 2024-06-27 17:35:30 +08:00
commit 1aa4e11e50
10 changed files with 377 additions and 68 deletions

View File

@ -9,12 +9,16 @@ export function login(data) {
}
// 获取子集列表
export function getQaList() {
export function getQaList(city_id) {
return request({
url: '/admin/qa/getQaList',
method: 'get',
params: {
city_id
}
})
}
// 获取qa详情
export function getQaDetail(city_id) {
return request({
@ -25,3 +29,11 @@ export function getQaDetail(city_id) {
}
})
}
//获取城市列表
export function getQaCityList(city_id) {
return request({
url: '/admin/qa/getQaCityList',
method: 'get'
})
}

View File

@ -129,13 +129,15 @@
<el-button v-if="QaShow" type="success" @click="drawer = false"> </el-button>
<el-button v-if="!QaShow" type="success" @click="QaShow = true"> </el-button>
<div v-if="QaShow" class="mod">
<el-button v-for="item in getQaList" style="width: 150px;" size="medium" type="primary" @click="getQaDetail(item)">
<el-button v-for="item in getQaCityList" style="width: 150px;" size="medium" type="primary" @click="clickQaList(item)">
{{ item.city_name }}
</el-button>
</div>
<div v-if="QaInfo && !QaShow" class="ver">
<div class="ver_title">{{ QaInfo.title }}</div>
<div class="ver_content">{{ QaInfo.content }}</div>
<div v-for="getQaList in getQaLists">
<div class="ver_title">{{ getQaList.title }}</div>
<div class="ver_content">{{ getQaList.content }}</div>
</div>
</div>
</div>
</el-drawer>
@ -152,7 +154,7 @@ import Search from '@/components/HeaderSearch'
import { color } from 'echarts/lib/export'
import sidebar from '@/layout/components/Sidebar/index.vue'
import avatar from 'element-ui/packages/avatar'
import { getQaList } from '@/api/qa'
import {getQaCityList, getQaList} from '@/api/qa'
import clickoutside from 'element-ui/src/utils/clickoutside'
export default {
directives: { clickoutside },
@ -189,7 +191,8 @@ export default {
imageUrl: false,
QaShow: true,
os: [],
getQaList: [],
getQaCityList: [],
getQaLists: [],
times: [],
form: {
oldpwd: '',
@ -213,8 +216,8 @@ export default {
},
created() {
this.getworkstatus()
getQaList().then(res => {
this.getQaList = res.data
getQaCityList().then(res => {
this.getQaCityList = res.data
})
},
methods: {
@ -226,9 +229,12 @@ export default {
this.drawer = false
this.QaShow = true
},
getQaDetail(data) {
this.QaInfo = data
if (!this.QaInfo) {
clickQaList(data) {
getQaList(data.city_id).then(res => {
this.getQaLists = res.data
})
console.log(JSON.stringify(this.getQaLists))
if (!this.getQaLists) {
return this.$message({
message: '暂无QA问题',
type: 'warning',
@ -322,11 +328,19 @@ export default {
margin-top: 50px;
}
.ver{
margin-top: 20px;
margin-top: 30px;
color: #6c6f71;
&_title{
font-size: 24px;
color: #1890ff;
margin-bottom: 20px;
font-size: 16px;
font-weight: bold;
margin-bottom: 12px;
}
&_content{
line-height: 26px;
font-size: 15px;
padding-bottom: 10px;
margin: 0 40px 26px 0;
border-bottom: 1px dashed #d3dcdc;
}
}
.navbar {

View File

@ -122,7 +122,6 @@ export const asyncRoutes = [
}*/
]
},
{
path: '/order',
component: Layout,
@ -173,6 +172,38 @@ export const asyncRoutes = [
},
]
},
{
path: '/qa',
component: Layout,
redirect: '/qa/qa',
alwaysShow: true,
name: 'Qa',
meta: {
title: 'QA管理',
icon: 'el-icon-question',
roles: ['order_index', 'editor']
},
children: [
{
path: 'qa',
component: () => import('@/views/qa/qa.vue'),
name: 'qa',
meta: {
title: 'QA列表',
roles: ['admin']
}
},
{
path: 'city',
component: () => import('@/views/qa/city.vue'),
name: 'city',
meta: {
title: '城市列表',
roles: ['admin']
}
}
]
},
{
path: '/log',
component: Layout,

View File

@ -0,0 +1,11 @@
<script setup>
</script>
<template>
</template>
<style scoped>
</style>

175
admin/src/views/qa/qa.vue Normal file
View File

@ -0,0 +1,175 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input v-model="listQuery.title" placeholder="标题" style="width: 200px;" class="filter-item" />
<el-select v-model="listQuery.status" filterable placeholder="状态" class="filter-item" style="width: 120px;">
<el-option key="" label="请选择" value="" />
<el-option v-for="(v, k) in statusArr" :key="k" :label="v" :value="k" />
</el-select>
<el-button class="filter-item search" type="primary" icon="el-icon-search" @click="getQa">搜索</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-circle-plus" @click="onAdd">添加</el-button>
</div>
<el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
<el-table-column align="center" fixed label="ID" width="80" prop="id" />
<el-table-column align="center" fixed label="城市" width="80" prop="city_name" />
<el-table-column align="center" fixed label="标题" width="280" prop="title" />
<el-table-column align="center" fixed label="内容" width="380" prop="content" />
<el-table-column align="center" label="状态" width="100">
<template #default="scope">
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="updateStatus(scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" width="220" label="操作">
<template #default="scope">
<el-button type="primary" size="small" icon="el-icon-edit" @click="onEdit(scope.row)">编辑</el-button>
<el-button type="danger" size="small" icon="el-icon-delete" @click="onDel(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getShortcutContent" />
<el-dialog title="添加QA" :visible.sync="dialogCreate">
<el-form label-width="120px" :model="anchors">
<el-form-item label="城市">
<el-input v-model="anchors.city_name" type="text" placeholder="请输入城市" />
</el-form-item>
<el-form-item label="旅游路线">
<el-input v-model="anchors.title" type="text" placeholder="请输入旅游路线" />
</el-form-item>
<el-form-item label="QA内容">
<el-input v-model="anchors.content" :rows="6" style="height: 120px" type="textarea" placeholder="QA内容" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="anchors.status" :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="onSave"> </el-button>
</div>
</el-dialog>
<el-dialog title="编辑内容" :visible.sync="dialogEdit">
<el-form label-width="120px" :model="anchors">
<el-form-item label="城市">
<el-input v-model="anchors.city_name" type="text" placeholder="请输入城市" />
</el-form-item>
<el-form-item label="旅游路线">
<el-input v-model="anchors.title" type="text" placeholder="请输入旅游路线" />
</el-form-item>
<el-form-item label="QA内容">
<el-input v-model="anchors.content" :rows="6" style="height: 120px" type="textarea" placeholder="QA内容" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="anchors.status" :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="onSave"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import Pagination from '@/components/PaginationFixed'
export default {
name: 'GetQa',
components: { Pagination },
data() {
return {
statusArr: { 0: '禁用', 1: '启用' },
list: [],
total: 0,
loading: false,
listLoading: true,
listQuery: {
page: 1,
limit: 10,
status: null,
city_name: '',
title: '',
content: ''
},
dialogCreate: false,
dialogEdit: false,
item: {},
anchors: {}
}
},
created() {
this.listQuery.status = this.$route.query.status || null
this.listQuery.content = this.$route.query.content || null
this.getQa()
},
methods: {
getQa() {
this.listLoading = true
this.$axios.get('/admin/qa/getQa', { params: this.listQuery }).then(response => {
this.list = response.data.data
this.total = response.data.total
this.listLoading = false
}).catch(() => {
this.listLoading = false
})
},
onAdd() {
this.anchors = { sort: 0 } // 0
this.dialogCreate = true
},
onEdit(item) {
this.anchors = { ...item }
this.dialogEdit = true
},
onSave() {
if (this.loading) return
this.loading = true
const api = this.dialogCreate ? '/admin/qa/addQa' : '/admin/qa/editQa'
this.$axios.post(api, this.anchors).then(() => {
this.dialogCreate = false
this.dialogEdit = false
this.loading = false
this.getQa()
}).catch(() => {
this.loading = false
})
},
onDel(item) {
this.$axios.post('/admin/qa/delQa', { id: item.id }).then(() => {
this.getQa()
}).catch(() => {
})
},
updateSort(item) {
this.$axios.post('/admin/qa/editQa', { id: item.id, sort: item.sort }).then(() => {
this.getQa()
}).catch(() => {
})
},
updateStatus(item) {
this.$axios.post('/admin/qa/editQa', { id: item.id, status: item.status }).then(() => {
this.getQa()
}).catch(() => {
})
}
}
}
</script>
<style scoped>
.app-container {
position: relative;
padding-bottom: 60px; /* 分页条的高度 */
}
.filter-container,
.el-table {
padding-bottom: 52px; /* 分页条的高度,以避免内容重叠 */
}
.search {
margin-left: 10px;
}
</style>

View File

@ -122,7 +122,13 @@ class IndexController extends base
'asset' => $order->asset ?? 0,
'asset_price' => $order->asset_price ?? 0,
'refund' => $order->refund ?? 0,
'refund_price' => $order->refund_price ?? 0
'refund_price' => $order->refund_price ?? 0,
'refund_30' => $list->refund_30 ?? 0,
'refund_price_30' => $list->refund_price_30 ?? 0.00,
'refund_60' => $list->refund_60 ?? 0,
'refund_price_60' => $list->refund_price_60 ?? 0.00,
'refund_80' => $list->refund_80 ?? 0,
'refund_price_80' => $list->refund_price_80 ?? 0.00
]);
}
@ -233,6 +239,7 @@ class IndexController extends base
}
$list = $list->paginate($limit);
return $this->success($list);
}
}

View File

@ -114,6 +114,8 @@ class OrderController extends base
$statss = Orders::KuaishouStatus;
}elseif($key ==3) {
$statss = Orders::DouyinStatus;
}elseif ($key == 4) {
$statss = Orders::AllPlatform;
}
$_ch = [];
@ -200,8 +202,14 @@ class OrderController extends base
if(empty($desc) || empty($status)) return $this->error(2004, '跟进说明需要填写!');
if(empty($personnel)) return $this->error(2004, '人员情况需要填写!');
if(empty($travel_date)) return $this->error(2004, '出游时间需要填写!');
if ($status != 2){
if ($status == 1){
if(empty($next_follow)) return $this->error(2004, '下次跟进时间需要填写!');
}
if ($status == 2){
$next_follow = '';
if(empty($travel_end)) return $this->error(2004, '返回日期需要填写!');
if(empty($check_sn)) return $this->error(2004, '核销码需要填写!');
}
$lock = 'Travel:Order:'.$id.':lock';

View File

@ -2,6 +2,7 @@
namespace app\admin\controller;
use app\model\QaCitys;
use app\model\Qas;
use support\Request;
@ -9,7 +10,34 @@ class QaController extends base
{
public function getQaList(Request $request)
{
$list = Qas::fieldRaw('city_name,title,content')->select();
$city_id = $request->get('city_id');
if (empty($city_id)) return $this->error(2001, 'city_id data cannot be empty!');
$list = Qas::where(['status'=>1,'city_id'=>$city_id])->fieldRaw('title,content')->select();
return $this->success($list);
}
/**
* cms list
* @param Request $request
* @return \support\Response
* @throws \think\db\exception\DbException
*/
public function getQa(Request $request)
{
$title = $request->get('title');
$status = $request->get('status');
$list = Qas::order('create_time desc');
if (!empty($title)){
$list = $list->where('title','like','%'.$title.'%');
}
if (!empty($status)){
$list = $list->where('status',$status);
}
$list = $list->paginate($request->get('limit',10));
return $this->success($list);
}
@ -19,7 +47,7 @@ class QaController extends base
$id = $request->get('id');
if (empty($id)) return $this->error(2001, 'id data cannot be empty!');
$data = Qas::fieldRaw('id,city_name,title,content')->find();
$data = Qas::where('status',1)->fieldRaw('id,city_name,title,content')->find();
return $this->success($data);
}
@ -43,6 +71,8 @@ class QaController extends base
{
$post = $request->post();
if (empty($post['id'])) return $this->error(2001, 'id data cannot be empty!');
unset($post['create_time']);
unset($post['update_time']);
try {
$data = Qas::update($post);
@ -54,7 +84,7 @@ class QaController extends base
public function delQa(Request $request)
{
$id = $request->get('id');
$id = $request->post('id');
if (empty($id)) return $this->error(2001, 'id data cannot be empty!');
try {
$data = Qas::destroy($id);
@ -63,4 +93,10 @@ class QaController extends base
}
return $this->success($data);
}
public function getQaCityList()
{
$list = QaCitys::order('city_id desc')->select();
return $this->success($list);
}
}

View File

@ -1,11 +1,13 @@
<?php
namespace app\model;
use support\Log;
use think\facade\Db;
use support\Redis;
class Orders extends base{
class Orders extends base
{
//orderStatus 1, 未付款 2 已取消 3 , 待使用 4, 已使用 5, 已退款
const OrderStatus = [1 => '未付款', 2 => '已取消', 3 => '待使用', 4 => '已使用', 5 => '已退款'];
@ -14,14 +16,17 @@ class Orders extends base{
const DouyinReservationStatus = [1 => '未预约', 2 => '待接单', 3 => '已预约', 4 => '已取消', 5 => '已完成', 6 => '取消/退款申请'];
const DouyinStatus = [1 => '未核销', 2 => '已核销', 3 => '申请退款中', 4 => '已退款', 5 => '部分核销'];
const AllPlatform = [1 => '待使用', 2 => '已核销', 3 => '已退款'];
const StatusName = ['待跟进', '跟进中', '已核销', '核销失败', '放弃跟单'];
const OSS = [1 => '美团', 2=> '快手', 3=> '抖音'];
const OSS = [1 => '美团', 2 => '快手', 3 => '抖音', 4 => '全平台'];
const timeType = ['create_time' => '添加记录时间', 'update_time' => '修改记录时间', 'last_follow' => '最后跟进时间', 'next_follow' => '下次跟进时间', 'travel_date' => '出行时间', 'create_at' => '下单时间'];
protected $json = ['personnel'];
public function getOrderStatusNameAttr($val) {
public function getOrderStatusNameAttr($val)
{
if ($this->os == 1)
return self::OrderStatus[$this->order_status] ?? '未知';
elseif ($this->os == 3)
@ -30,15 +35,18 @@ class Orders extends base{
return self::KuaishouStatus[$this->order_status] ?? '未知';
}
public function getStatusNameAttr($val) {
public function getStatusNameAttr($val)
{
return self::StatusName[$this->status] ?? '未知';
}
public function getOsNameAttr($val) {
public function getOsNameAttr($val)
{
return self::OSS[$this->os] ?? '未知';
}
public function getAdminNameAttr() {
public function getAdminNameAttr()
{
if ($this->admin_id > 0) {
return $this->admin->getData('name');
} else {
@ -51,7 +59,8 @@ class Orders extends base{
return '';
}
public static function attimes($type, $times){
public static function attimes($type, $times)
{
$query = self::where([]);
if (in_array($type, array_keys(self::timeType))) {
if (is_string($times)) {
@ -95,27 +104,33 @@ class Orders extends base{
return $query;
}
public function admin() {
public function admin()
{
return $this->belongsTo(Admins::class, 'admin_id')->visible(['name', 'username', 'avatar']);
}
public function anchor() {
public function anchor()
{
return $this->belongsTo(Admins::class, 'zhubo')->visible(['name', 'username', 'avatar']);
}
public function backs() {
public function backs()
{
return $this->hasOne(Backs::class, 'order_id')->where('status', 0)->visible(['status', 'admin_id']);
}
public function follow() {
public function follow()
{
return $this->hasMany(Follows::class, 'order_id')->order('id', 'desc');
}
public function finance() {
public function finance()
{
return $this->hasMany(Finances::class, 'order_id')->order('id', 'desc');
}
public static function fish($id, $admin_id) {
public static function fish($id, $admin_id)
{
return Db::transaction(function () use ($id, $admin_id) {
$order = Orders::where('id', $id)->where('admin_id', 0)->lock(true)->find();
if (empty($order)) return false;

View File

@ -2,7 +2,7 @@
namespace app\model;
class Citys extends base
class QaCitys extends base
{
}