调整套餐排序和订单

main
yanzai 4 months ago
parent 35fb145b2b
commit 1722a9913f

@ -180,7 +180,9 @@ 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') {
@ -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'],
@ -246,15 +251,22 @@ class ComboController extends Controller
'order' => $newOrder,
'sale_count' => $Info['sale_count'],
'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;
foreach ($order_list as $order) {

@ -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