调整套餐排序和订单

main
yanzai 4 months ago
parent 35fb145b2b
commit 1722a9913f

@ -39,7 +39,7 @@ class ComboController extends Controller
}
}
foreach ($combos as $c_key => $combo) {
$sixin_combo_item_ids=[];//思信套餐内项目ids
$sixin_combo_item_ids = [];//思信套餐内项目ids
$item = [];
$comboDetail = $peis::Post('套餐详情查询', $hospital_id, ['套餐Id' => $combo['Id']], false);
@ -47,7 +47,7 @@ class ComboController extends Controller
$comboDetail_list = $comboDetail['data'][0]['包含项目'];
foreach ($comboDetail_list as $key => $v) {
$sixin_combo_item_ids[]=$v['Id'];
$sixin_combo_item_ids[] = $v['Id'];
//在独立表中缓存一份套餐对应的项目信息
$item_sex = null;
if (isset($v['性别限制'])) {
@ -55,16 +55,16 @@ class ComboController extends Controller
$item_sex = $item_sex_array[$combo['性别限制']] >= 0 ? $item_sex_array[$combo['性别限制']] : null;
}
$item_date = [
'combo_id'=>$combo['Id'],
'item_id'=>$v['Id'],
'name'=>$v['名称'],
'combo_id' => $combo['Id'],
'item_id' => $v['Id'],
'name' => $v['名称'],
'desc' => $v['简介'],
'keshi_id' => $v['科室Id'],
'keshi_name' => $v['科室名称'],
'price'=> $v['价格'],
'sex'=>$item_sex,
'can_qian_hou'=>$v['餐前餐后'],
'status'=>1
'price' => $v['价格'],
'sex' => $item_sex,
'can_qian_hou' => $v['餐前餐后'],
'status' => 1
];
$db_combo_item = DB::table('combo_items')->where(['item_id' => $v['Id'], 'combo_id' => $combo['Id']])->first();
if (!!$db_combo_item) {
@ -86,12 +86,12 @@ class ComboController extends Controller
//查询当前套餐缓存的套餐项目ids
$db_combo_item_ids=DB::table('combo_items')
$db_combo_item_ids = DB::table('combo_items')
->where(['combo_id' => $combo['Id']])->pluck('item_id')->toArray();
// 查询在库里缓存但思信已经没有的项目ids,标注为弃用0
$k_ids = array_diff($db_combo_item_ids, $sixin_combo_item_ids);
if(count($k_ids)>0){
DB::table('combo_items')->where(['combo_id'=>$combo['Id']])->whereIn('item_id',$k_ids)->delete();
if (count($k_ids) > 0) {
DB::table('combo_items')->where(['combo_id' => $combo['Id']])->whereIn('item_id', $k_ids)->delete();
}
@ -113,7 +113,7 @@ class ComboController extends Controller
'price' => $combo['价格'],
'items' => $item,
'item_count' => $comboDetail['data'][0]['项目数量'],
'duo_xuan_yi'=>json_encode($combo['包含多选一组'], JSON_UNESCAPED_UNICODE),
'duo_xuan_yi' => json_encode($combo['包含多选一组'], JSON_UNESCAPED_UNICODE),
'keyue_start_time' => $combo['可约开始时间'],
'keyue_end_time' => $combo['可约截止时间'],
'status' => 1,
@ -156,7 +156,7 @@ class ComboController extends Controller
$page = request('page');
$pageSize = request('pageSize');
$searchInfo = request('searchInfo');
$type=request('type');
$type = request('type');
$list = DB::table('combos')
->select('combos.*', 'hospitals.name as hospital_name', 'combo_type.name as combo_type_name', 'combo_crowd.name as combo_crowd_name')
->leftJoin('hospitals', 'hospitals.id', '=', 'combos.hospital_id')
@ -166,13 +166,13 @@ class ComboController extends Controller
$list = $list->where('combos.name', 'like', '%' . $searchInfo['name'] . '%');
}
$list=$list->where(['combos.status'=>1]);
$list = $list->where(['combos.status' => 1]);
$count = $list->count();
if(isset($type) and $type=='all'){
$list = $list->orderBy('combos.order','asc')->get();
}else{
$list = $list->orderBy('combos.order','asc')
if (isset($type) and $type == 'all') {
$list = $list->orderBy('combos.order', 'asc')->get();
} else {
$list = $list->orderBy('combos.order', 'asc')
->skip(($page - 1) * $pageSize) // 跳过前9999条记录
->take($pageSize)->get();
}
@ -180,11 +180,13 @@ class ComboController extends Controller
return \Yz::Return(true, "查询完成", ['list' => $list, 'count' => $count]);
}
public function GetAllList(){
public function GetAllList()
{
$status = request('status');
$list = DB::table('combos');
if(isset($status) and $status=='enable'){
$list = $list->where(['status'=>1]);
if (isset($status) and $status == 'enable') {
$list = $list->where(['status' => 1]);
}
$list = $list->get();
return \Yz::Return(true, "查询完成", ['list' => $list]);
@ -208,6 +210,7 @@ class ComboController extends Controller
public function Save()
{
$Info = request('Info');
$type = request('Type');
$combo = DB::table('combos')->where(['id' => $Info['id']])->first();
if (!$combo) {
@ -217,6 +220,7 @@ class ComboController extends Controller
$oldOrder = $combo->order;
$newOrder = $Info['order'];
// 如果排序发生了变化
if ($oldOrder != $newOrder) {
if ($newOrder > $oldOrder) {
@ -232,8 +236,9 @@ class ComboController extends Controller
->where('order', '<', $oldOrder)
->increment('order');
}
}
$u = DB::table('combos')->where(['id' => $Info['id']])->update([
$data=[
'checkup_type_id' => $Info['checkup_type_id'],
'type_id' => $Info['type_id'],
'crowd_id' => $Info['crowd_id'],
@ -243,22 +248,29 @@ class ComboController extends Controller
'intro' => $Info['intro'],
'sub_intro' => $Info['sub_intro'],
'desc' => $Info['desc'],
'order' =>$newOrder,
'order' => $newOrder,
'sale_count' => $Info['sale_count'],
'is_hot' => isset($Info['is_hot'])?$Info['is_hot']:0,
]);
'is_hot' => isset($Info['is_hot']) ? $Info['is_hot'] : 0,
];
if ($type === 'onlyPaixu') {
$data=['order' => $newOrder,];
}
$u = DB::table('combos')->where(['id' => $Info['id']])->update($data);
if ($u) {
return \Yz::Return(true, "更新完成", []);
} else {
return \Yz::echoError1("没有数据更新");
}
}
//保存排序
public function SaveOrder(){
public function SaveOrder()
{
$order_list = request('order_list');
$count=0;
$count = 0;
foreach ($order_list as $order) {
$u=DB::table('combos')->where(['id' => $order['id']])->update(['order' => $order['order']]);
$u = DB::table('combos')->where(['id' => $order['id']])->update(['order' => $order['order']]);
if ($u) {
$count++;
}

@ -34,7 +34,20 @@
<el-table-column prop="order" label="排序">
<template #default="scope">
<div v-if="!Is_PaiXv">{{scope.row.order}}</div>
<div v-if="!Is_PaiXv" @mouseenter="showPaixuInputId = scope.row.id" @mouseleave="showPaixuInputId = 0" style="cursor: pointer;" @click="PaiXuClick(scope.row)">
<div v-if="Info.id==scope.row.id">
<el-input v-model="Info.order" type="number" style="width: 60px;" />
<el-button size="small" @click="SaveFuc('onlyPaixu')"></el-button>
</div>
<span v-else>
<span >{{scope.row.order}}</span>
<el-icon v-if="showPaixuInputId==scope.row.id" size="20" >
<Edit />
</el-icon>
</span>
</div>
<div v-else>
<el-button type="primary" plain style="margin-left: 10px;" :disabled="scope.$index==0" @click="OptionUp(scope.$index)"
:icon="Top" />
@ -57,7 +70,7 @@
:page-sizes="[15, 50, 100, 200]" layout="total,sizes, prev, pager, next" :total="total"
@size-change="PageSizeChange" @current-change="PageCurrentChange" />
</div>
<el-dialog v-model="dialogVisible" title="套餐信息" width="60%">
<el-dialog v-model="dialogVisible" title="套餐信息" width="60%" @close="DialogClose()">
<el-form :model="Info" label-width="100px" v-loading="loading">
<el-form-item label="名称">
{{Info.name}}
@ -170,6 +183,7 @@
let pageSize = ref(15) //
let total = 0 //
let dialogVisible = ref(false)
let showPaixuInputId=ref(0)
const PageSizeChange = (e) => { //
pageSize.value = e
GetList()
@ -192,7 +206,11 @@
let searchInfo = ref({});
let Info = ref({});
let Is_PaiXv=ref(false);
const DialogClose=()=>{
Info.value={}
}
const GetList = (type='') => {
Info.value={}
if(type=='all'){
Is_PaiXv.value=true;
}
@ -212,6 +230,9 @@
}
})
}
const PaiXuClick=(row)=>{
Info.value=row
}
const Save = () => {
Info.value.desc = editorRef.value.getHtml()
if (!Array.isArray(Info.value.tags)) {
@ -221,9 +242,13 @@
Info.value.tags2 = toArray(Info.value.tags2)
}
SaveFuc()
}
const SaveFuc=(type=0)=>{
loading.value = true
ComboSave({
Info: Info.value
Info: Info.value,
Type:type
}).then(res => {
loading.value = false
if (res.status) {

@ -24,7 +24,7 @@
<el-table-column prop="phone" label="电话" />
<el-table-column prop="order_number" label="订单号" />
<el-table-column prop="title" label="订单名称" />
<el-table-column prop="type" label="类型">
<el-table-column prop="type" label="类型" width="80">
<template #default="scope">
<span v-if="scope.row.type==1" style="color: #409EFF;"></span>
<span v-if="scope.row.type==2" style="color: #E6A23C;"></span>
@ -41,6 +41,11 @@
<span v-if="scope.row.status==6" style="color: #3a8c7e;"></span>
</template>
</el-table-column>
<el-table-column prop="" label="预约时间" width="160">
<template #default="scope">
{{scope.row.appointment_date}} {{scope.row.appointment_time}}
</template>
</el-table-column>
<el-table-column prop="check_status" label="到检状态">
<template #default="scope">
<span v-if="scope.row.check_status==1" style="color: #ffb682;"></span>

Loading…
Cancel
Save