鹿和sa0ChunLuyu 1 year ago
commit d07d12f452

@ -36,7 +36,7 @@ class PlanController extends Controller
// $planType = DB::table('plan_type as a')->where(['a.id' => $model->plan_type, 'a.is_del' => 0, 'a.status' => 1])->first();
// if (!$planType) return \Yz::echoError1('号源类型不可用');
//查询此时间段内是否有已经生成的号源
$cha = DB::table('plans')->whereBetween('date', $Info['dateRange'])->get();
$cha = DB::table('plans')->whereBetween('date', $Info['dateRange'])->where(['is_del'=>0])->get();
if (count($cha) > 0) {
return \Yz::return(false, '号源重复', ['list' => $cha]);
}
@ -133,7 +133,7 @@ class PlanController extends Controller
public function GetDetail()
{
$id = request('id');
$info = DB::table('plans')->where(['id' => $id])->first();
$info = DB::table('plans')->where(['id' => $id,'is_del'=>0])->first();
if (!!$info) {
if(empty($info->checkup_type_id)){
$info->checkup_type_id='[]';
@ -209,4 +209,15 @@ class PlanController extends Controller
}
}
public function Del()
{
$ids = request('ids');
$del=DB::table('plans')->whereIn('id', $ids)->where(['status'=>1])->update(['is_del'=>1]);
if($del){
return \Yz::Return(true, '操作成功', []);
}else{
return \Yz::echoError1('操作失败');
}
}
}

@ -599,10 +599,10 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
$ids= "'" . implode("','", $topTwoIndexes) . "'";
$sex=$person->sex;
$combos = DB::select("select * from combos as a LEFT JOIN (
select combo_id as c_id,count(*) as count from orders where status in(2,4) group by combo_id
) as b on a.combo_id=b.c_id where a.status=1 and a.combo_id in (".$ids.")");
) as b on a.combo_id=b.c_id where a.status=1 and a.combo_id in (".$ids.") and a.sex in(".$sex.",0)");
foreach ($combos as $key => $combo) {

@ -90,6 +90,7 @@ Route::group(['middleware' => ['checktoken', 'log'], 'prefix' => 'v1'], function
Route::post('admin/PlanGetList', 'App\Http\Controllers\API\Admin\YeWu\PlanController@GetList');//号源列表
Route::post('admin/PlanGetDetail', 'App\Http\Controllers\API\Admin\YeWu\PlanController@GetDetail');//号源详情
Route::post('admin/PlanSave', 'App\Http\Controllers\API\Admin\YeWu\PlanController@Save');//保存号源详情
Route::post('admin/PlanDel', 'App\Http\Controllers\API\Admin\YeWu\PlanController@Del');//
Route::post('admin/PlanBatchUpdatePlanType', 'App\Http\Controllers\API\Admin\YeWu\PlanController@BatchUpdatePlanType');//保存号源详情
Route::post('admin/ComboGetList', 'App\Http\Controllers\API\Admin\YeWu\ComboController@GetList');//获取套餐列表

@ -171,6 +171,10 @@ export const PlanGetDetail = (data = {}) => {
export const PlanSave = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanSave', data: data })
}
//号源del
export const PlanDel = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanDel', data: data })
}
//号源批量更新
export const PlanBatchUpdatePlanType = (data = {}) => {
return axios({ url: import.meta.env.VITE_APP_API + 'v1/admin/PlanBatchUpdatePlanType', data: data })

@ -105,7 +105,12 @@
ElMessageBox
} from 'element-plus'
import {
PlanGetList,PlanGetDetail,CheckUpTypeGetEnableList,PlanSave,PlanBatchUpdatePlanType
PlanGetList,
PlanGetDetail,
CheckUpTypeGetEnableList,
PlanSave,
PlanBatchUpdatePlanType,
PlanDel
} from '@/api/api.js'
let loading = ref(false)
let searchInfo = ref({})
@ -215,6 +220,36 @@
BatchUpdateFunc(type)
}
}
const Del=()=>{
ElMessageBox.confirm(
'确认删除所选号源吗(已被占用号源不会删除)?',
'提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
}
)
.then(() => {
loading.value = true
let selected_list=[]
list.value.forEach((v,i)=>{
if(v.selected!=undefined && v.selected==true){
selected_list.push(v.id)
}
})
PlanDel({
ids: selected_list
}).then(res => {
loading.value = false
if (res.status) {
GetList()
} else {
ElMessage.error(res.msg)
}
})
})
}
const BatchUpdateFunc=(type,info=null)=>{
loading.value = true

Loading…
Cancel
Save