健康包列表
This commit is contained in:
parent
83932947f0
commit
a222ff2444
@ -42,8 +42,9 @@
|
||||
<a-row :gutter="24" >
|
||||
<a-col :span="12">
|
||||
<a-form-item field="service_rate" label="服务费率(%):">
|
||||
<a-input-number
|
||||
<a-input
|
||||
v-model="modalForm.service_rate"
|
||||
|
||||
:style="{ width: '320px' }"
|
||||
placeholder="请选择服务费率"
|
||||
class="input-demo"
|
||||
@ -54,7 +55,7 @@
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="effective_days" label="服务有效天数:">
|
||||
<a-input-number
|
||||
<a-input
|
||||
v-model="modalForm.effective_days"
|
||||
:style="{ width: '320px' }"
|
||||
placeholder="请输入服务有效天数"
|
||||
@ -67,9 +68,9 @@
|
||||
</a-row>
|
||||
<a-row :gutter="24" >
|
||||
<a-col :span="12">
|
||||
<a-form-item field="product_id" label="关联商品:" :rules="[{required: true,message:'请选择关联商品'}]">
|
||||
<a-select multiple v-model="modalForm.product_id" placeholder="请选择关联商品" allow-search
|
||||
:loading="loading" @search="handleGetProduct">
|
||||
<a-form-item field="my_package_product" label="关联商品:" >
|
||||
<a-select multiple v-model="modalForm.my_package_product" placeholder="请选择关联商品" allow-search
|
||||
:loading="loading" @search="handleGetProduct" @change="changeProduct" >
|
||||
<a-option v-for="item in productList" :key="item.product_id" :value="item.product_id" :label="item.product_name">
|
||||
{{ item.product_name }}
|
||||
</a-option>
|
||||
@ -77,6 +78,21 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24" >
|
||||
<a-col :span="12">
|
||||
<a-form-item field="" label="修改关联商品信息:" >
|
||||
<a-table :columns="product_columns" :data="product_data" style="width:100%;">
|
||||
<template #discount_product_price="{ record }">
|
||||
<a-input-number v-model="record.discount_product_price" :min="0"/>
|
||||
</template>
|
||||
<template #quantity="{ record }">
|
||||
<a-input-number v-model="record.quantity" :step="1" :precision="0" :min="1"/>
|
||||
</template>
|
||||
|
||||
</a-table>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-divider />
|
||||
</a-form>
|
||||
<div class="titlebox" >
|
||||
@ -98,8 +114,9 @@
|
||||
import { ref,toRefs,watch,getCurrentInstance,reactive,defineExpose} from 'vue';
|
||||
import { addHealth,updateHealth} from '@/api/inquiry/service';
|
||||
import { parseTime } from '@/utils/parseTime';
|
||||
import {getProduct} from '@/api/coupon/list';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let multi_point_status='';
|
||||
const product_data=ref([]);
|
||||
const props = defineProps({
|
||||
// 是否显示
|
||||
modalVisible: {
|
||||
@ -112,13 +129,17 @@
|
||||
},
|
||||
modalForm:{
|
||||
type:Object,
|
||||
default:{}
|
||||
default:{}
|
||||
}
|
||||
});
|
||||
|
||||
const title=ref('添加问诊配置');
|
||||
const title=ref('添加问诊配置');
|
||||
const productList=ref([]);
|
||||
const loading=ref(false);
|
||||
let initData=[];
|
||||
const reset=()=>{
|
||||
product_data.value=[];
|
||||
};
|
||||
const handleGetProduct=async(name='',id='')=>{
|
||||
loading.value=true;
|
||||
const {code,data}=await getProduct({
|
||||
@ -135,24 +156,65 @@ const handleGetProduct=async(name='',id='')=>{
|
||||
const {modalVisible,id,modalForm}=toRefs(props);
|
||||
const emits = defineEmits(['healthVisibleChange','freshList']);
|
||||
watch(()=>props.id,(newVal,oldValval)=>{
|
||||
if(newVal){
|
||||
title.value='修改健康包'
|
||||
|
||||
if(props.id){
|
||||
title.value='修改健康包';
|
||||
}else{
|
||||
//handleDoctorList();
|
||||
title.value='添加健康包';
|
||||
|
||||
}
|
||||
|
||||
},{immediate:true})
|
||||
watch(()=>props.modalForm,()=>{
|
||||
handleGetProduct();
|
||||
if(id.value){
|
||||
let product=modalForm.value.health_package_product;
|
||||
initData=modalForm.value.health_package_product;
|
||||
if(product && product.length>0){
|
||||
|
||||
modalForm.value.my_package_product=product.map((item)=>item.product_id);
|
||||
product_data.value=product;
|
||||
}
|
||||
}
|
||||
|
||||
},{immediate:true})
|
||||
const changeProduct=(val)=>{
|
||||
console.log(val);
|
||||
product_data.value=[];
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
if(initData.length>0){
|
||||
for (let j = 0; j < initData.length; j++) {
|
||||
if (val[i]=== initData[j].product_id){
|
||||
product_data.value.push({
|
||||
product_id:initData[j].product_id,
|
||||
product_name:initData[j].product_name,
|
||||
quantity:initData[j].quantity,
|
||||
discount_product_price:initData[j].discount_product_price
|
||||
})
|
||||
continue;
|
||||
}else{
|
||||
let arr=productList.value.filter((item)=>item.product_id==val[i]);
|
||||
product_data.value.push({
|
||||
product_id:arr[0].product_id,
|
||||
product_name:arr[0].product_name,
|
||||
quantity:1,
|
||||
discount_product_price:10
|
||||
})
|
||||
}
|
||||
}
|
||||
}else{
|
||||
let arr=productList.value.filter((item)=>item.product_id==val[i]);
|
||||
product_data.value.push({
|
||||
product_id:arr[0].product_id,
|
||||
product_name:arr[0].product_name,
|
||||
quantity:1,
|
||||
discount_product_price:10
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const reset=()=>{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -169,15 +231,17 @@ const handleGetProduct=async(name='',id='')=>{
|
||||
const handleSubmit=()=>{
|
||||
proxy.$refs.modalFormRefConfig.validate(async (valid) => {
|
||||
let data=null;
|
||||
let obj=Object.assign({},modalForm.value,{health_package_product:product_data.value});
|
||||
|
||||
if (!valid) {
|
||||
if(props.inquiry_config_id){
|
||||
data= await editInquiryconfig(modalForm,props.inquiry_config_id)
|
||||
if(props.id){
|
||||
data= await updateHealth(props.id,obj)
|
||||
}else{
|
||||
data= await addInquiryconfig(modalForm);
|
||||
data= await addHealth(obj);
|
||||
}
|
||||
if(data.code==200){
|
||||
props.inquiry_config_id?proxy.$message.success('修改成功'):proxy.$message.success('添加成功');
|
||||
emits('freshList', '');
|
||||
props.id?proxy.$message.success('修改成功'):proxy.$message.success('添加成功');
|
||||
//emits('freshList', '');
|
||||
}
|
||||
handleClose();
|
||||
}else {
|
||||
@ -192,8 +256,30 @@ const handleGetProduct=async(name='',id='')=>{
|
||||
monthly_frequency:[{ required: true, message: '请输入每月次数' }],
|
||||
effective_days: [{ required: true, message: '请输入服务有效天数' }],
|
||||
service_rate:[{ required: true, message: '请输入服务费率' }],
|
||||
health_package_product:[{ required: true, message: '请选关联商品' }],
|
||||
my_package_product: {type: 'array',required: true,message:'请选择关联商品'}
|
||||
|
||||
};
|
||||
const product_columns=[
|
||||
{
|
||||
title: '商品id',
|
||||
dataIndex: 'product_id',
|
||||
},
|
||||
{
|
||||
title: '商品名称',
|
||||
dataIndex: 'product_name',
|
||||
},
|
||||
{
|
||||
title: '商品数量',
|
||||
dataIndex: 'quantity',
|
||||
slotName: 'quantity'
|
||||
},
|
||||
{
|
||||
title: '商品打折后价格',
|
||||
dataIndex: 'discount_product_price',
|
||||
slotName: 'discount_product_price'
|
||||
}
|
||||
|
||||
]
|
||||
defineExpose({
|
||||
reset
|
||||
});
|
||||
|
||||
@ -345,7 +345,7 @@
|
||||
<a-space style="margin-right: 8px" v-if="modalForm.coupon_id && modalForm.coupon_status==1">
|
||||
<a-button
|
||||
type="primary"
|
||||
v-has="'admin:sysCouponList:edit'"
|
||||
v-has="'admin:sysCouponList:force'"
|
||||
status="danger"
|
||||
@click="showCoupon"
|
||||
>强制失效</a-button
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<addHealthModal :modalVisible="modalVisible" :id="package_id" :modalForm="modalForm" @freshList="getInquiryInfo(pager);" @healthVisibleChange="()=>{modalVisible=false;package_id='';}"></addHealthModal>
|
||||
<addHealthModal ref="addChild" :modalVisible="modalVisible" :id="package_id" :modalForm="modalForm" @freshList="getInquiryInfo(pager);" @healthVisibleChange="()=>{modalVisible=false;package_id='';}"></addHealthModal>
|
||||
<a-modal v-model:visible="okVisible" :modal-style="{width:'320px'}" body-class="okmodal"
|
||||
@cancel="()=>okVisible=false">
|
||||
<template #title>
|
||||
@ -74,7 +74,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
const file = ref();
|
||||
const addChild = ref(null);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const currentPage = ref(1);
|
||||
const family_data=ref([]);
|
||||
@ -138,6 +138,13 @@
|
||||
const handleAdd = () => {
|
||||
modalVisible.value = true;
|
||||
package_id.value='';
|
||||
modalForm.service_count=null;
|
||||
modalForm.monthly_frequency=null;
|
||||
modalForm.effective_days=null;
|
||||
modalForm.health_package_product=[];
|
||||
modalForm.my_package_product=[];
|
||||
addChild.value.reset();
|
||||
|
||||
};
|
||||
|
||||
//详情
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user