From f7eaf5a7168424dc60a7139a7c37003c35892f23 Mon Sep 17 00:00:00 2001 From: yaosen <741606767@qq.com> Date: Thu, 27 Jun 2024 17:34:53 +0800 Subject: [PATCH] a --- admin/src/api/qa.js | 14 +- admin/src/layout/components/Navbar.vue | 42 +++-- admin/src/router/index.js | 33 +++- admin/src/views/qa/city.vue | 11 ++ admin/src/views/qa/qa.vue | 175 ++++++++++++++++++ .../app/admin/controller/IndexController.php | 9 +- .../app/admin/controller/OrderController.php | 10 +- service/app/admin/controller/QaController.php | 42 ++++- service/app/model/Orders.php | 107 ++++++----- service/app/model/{Citys.php => QaCitys.php} | 2 +- 10 files changed, 377 insertions(+), 68 deletions(-) create mode 100644 admin/src/views/qa/city.vue create mode 100644 admin/src/views/qa/qa.vue rename service/app/model/{Citys.php => QaCitys.php} (53%) diff --git a/admin/src/api/qa.js b/admin/src/api/qa.js index 2bbb11c4..13ae8182 100644 --- a/admin/src/api/qa.js +++ b/admin/src/api/qa.js @@ -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' + }) +} diff --git a/admin/src/layout/components/Navbar.vue b/admin/src/layout/components/Navbar.vue index 0d669797..cf8da149 100644 --- a/admin/src/layout/components/Navbar.vue +++ b/admin/src/layout/components/Navbar.vue @@ -129,13 +129,15 @@ 关 闭 返 回
- + {{ item.city_name }}
-
{{ QaInfo.title }}
-
{{ QaInfo.content }}
+
+
{{ getQaList.title }}
+
{{ getQaList.content }}
+
@@ -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 { diff --git a/admin/src/router/index.js b/admin/src/router/index.js index e977a038..ef638ee2 100644 --- a/admin/src/router/index.js +++ b/admin/src/router/index.js @@ -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, diff --git a/admin/src/views/qa/city.vue b/admin/src/views/qa/city.vue new file mode 100644 index 00000000..51760449 --- /dev/null +++ b/admin/src/views/qa/city.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/admin/src/views/qa/qa.vue b/admin/src/views/qa/qa.vue new file mode 100644 index 00000000..65d5cd40 --- /dev/null +++ b/admin/src/views/qa/qa.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/service/app/admin/controller/IndexController.php b/service/app/admin/controller/IndexController.php index ca01b3ee..3c6620e8 100644 --- a/service/app/admin/controller/IndexController.php +++ b/service/app/admin/controller/IndexController.php @@ -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); } } \ No newline at end of file diff --git a/service/app/admin/controller/OrderController.php b/service/app/admin/controller/OrderController.php index b4953007..c7163c60 100644 --- a/service/app/admin/controller/OrderController.php +++ b/service/app/admin/controller/OrderController.php @@ -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'; diff --git a/service/app/admin/controller/QaController.php b/service/app/admin/controller/QaController.php index 50b7a20b..3e607b57 100644 --- a/service/app/admin/controller/QaController.php +++ b/service/app/admin/controller/QaController.php @@ -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); + } } \ No newline at end of file diff --git a/service/app/model/Orders.php b/service/app/model/Orders.php index 7b4faa84..ee9bdab9 100644 --- a/service/app/model/Orders.php +++ b/service/app/model/Orders.php @@ -1,93 +1,102 @@ '未付款',2=>'已取消',3=>'待使用',4=>'已使用',5=>'已退款']; - const KuaishouStatus = [ 1=>'已取消', 2=> '待支付' , 3=> '订单确认中',4 => '待使用', 5=>'已完成', 6 => '已过期', 7=>'待分享']; + const OrderStatus = [1 => '未付款', 2 => '已取消', 3 => '待使用', 4 => '已使用', 5 => '已退款']; + const KuaishouStatus = [1 => '已取消', 2 => '待支付', 3 => '订单确认中', 4 => '待使用', 5 => '已完成', 6 => '已过期', 7 => '待分享']; - const DouyinReservationStatus = [ 1=>'未预约', 2=> '待接单' , 3=> '已预约', 4 => '已取消', 5=>'已完成', 6 => '取消/退款申请']; - const DouyinStatus = [ 1=>'未核销', 2=> '已核销' , 3=> '申请退款中', 4 => '已退款', 5=>'部分核销']; + const DouyinReservationStatus = [1 => '未预约', 2 => '待接单', 3 => '已预约', 4 => '已取消', 5 => '已完成', 6 => '取消/退款申请']; + const DouyinStatus = [1 => '未核销', 2 => '已核销', 3 => '申请退款中', 4 => '已退款', 5 => '部分核销']; - const StatusName = ['待跟进','跟进中','已核销','核销失败','放弃跟单']; - const OSS = [1 => '美团', 2=> '快手', 3=> '抖音']; + const AllPlatform = [1 => '待使用', 2 => '已核销', 3 => '已退款']; + + const StatusName = ['待跟进', '跟进中', '已核销', '核销失败', '放弃跟单']; + 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) + elseif ($this->os == 3) return self::DouyinStatus[$this->order_status] ?? '未知'; else 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() { - if($this->admin_id > 0) { + public function getAdminNameAttr() + { + if ($this->admin_id > 0) { return $this->admin->getData('name'); - }else{ - $aid = Redis::get('Travel:Order:'.$this->id); - if($aid) { + } else { + $aid = Redis::get('Travel:Order:' . $this->id); + if ($aid) { $a = Admins::where('id', $aid)->find(); - return $a->getData('name').'(电话中...)'; + return $a->getData('name') . '(电话中...)'; } } 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)) { + if (in_array($type, array_keys(self::timeType))) { + if (is_string($times)) { $times = explode(',', $times); - }else{ - if(empty($times[0])) $times[0] = ''; - if(empty($times[1])) $times[1] = ''; + } else { + if (empty($times[0])) $times[0] = ''; + if (empty($times[1])) $times[1] = ''; } } switch ($type) { case 'create_time': //添加记录时间 $query->whereBetween('create_time', [strtotime($times[0]), strtotime($times[1])]); - Log::warning("==Orders====:",['a'=>strtotime($times[0]),'b'=>strtotime($times[1])]); + Log::warning("==Orders====:", ['a' => strtotime($times[0]), 'b' => strtotime($times[1])]); break; case 'update_time': //修改记录时间 $query->whereBetween('update_time', [strtotime($times[0]), strtotime($times[1])]); break; - + case 'last_follow': //最后跟进时间 - $query->whereBetween('last_follow', [strtotime($times[0])*1000, strtotime($times[1])*1000+999]); + $query->whereBetween('last_follow', [strtotime($times[0]) * 1000, strtotime($times[1]) * 1000 + 999]); break; - + case 'next_follow': //下次跟进时间 - $query->whereBetween('next_follow', [strtotime($times[0])*1000, strtotime($times[1])*1000+999]); + $query->whereBetween('next_follow', [strtotime($times[0]) * 1000, strtotime($times[1]) * 1000 + 999]); break; case 'travel_date': //出行时间 - $query->whereBetween('travel_date', [date('Y-m-d H:i:s',strtotime($times[0])), date('Y-m-d H:i:s',strtotime($times[1]))]); + $query->whereBetween('travel_date', [date('Y-m-d H:i:s', strtotime($times[0])), date('Y-m-d H:i:s', strtotime($times[1]))]); break; - + case 'create_at': //下单时间 - $query->whereBetween('create_at', [strtotime($times[0])*1000, strtotime($times[1])*1000+999]); + $query->whereBetween('create_at', [strtotime($times[0]) * 1000, strtotime($times[1]) * 1000 + 999]); break; - + default: # code... break; @@ -95,30 +104,36 @@ class Orders extends base{ return $query; } - public function admin() { - return $this->belongsTo(Admins::class, 'admin_id')->visible(['name','username','avatar']); + public function admin() + { + return $this->belongsTo(Admins::class, 'admin_id')->visible(['name', 'username', 'avatar']); } - public function anchor() { - return $this->belongsTo(Admins::class, 'zhubo')->visible(['name','username','avatar']); + public function anchor() + { + return $this->belongsTo(Admins::class, 'zhubo')->visible(['name', 'username', 'avatar']); } - public function backs() { - return $this->hasOne(Backs::class, 'order_id')->where('status',0)->visible(['status','admin_id']); + public function backs() + { + return $this->hasOne(Backs::class, 'order_id')->where('status', 0)->visible(['status', 'admin_id']); } - public function follow() { - return $this->hasMany(Follows::class, 'order_id')->order('id','desc'); + public function follow() + { + return $this->hasMany(Follows::class, 'order_id')->order('id', 'desc'); } - public function finance() { - return $this->hasMany(Finances::class, 'order_id')->order('id','desc'); + public function finance() + { + return $this->hasMany(Finances::class, 'order_id')->order('id', 'desc'); } - public static function fish($id, $admin_id) { - return Db::transaction(function () use($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; + if (empty($order)) return false; $order->admin_id = $admin_id; $order->give_time = time(); $order->save(); diff --git a/service/app/model/Citys.php b/service/app/model/QaCitys.php similarity index 53% rename from service/app/model/Citys.php rename to service/app/model/QaCitys.php index 362e2669..5a84e6df 100644 --- a/service/app/model/Citys.php +++ b/service/app/model/QaCitys.php @@ -2,7 +2,7 @@ namespace app\model; -class Citys extends base +class QaCitys extends base { } \ No newline at end of file