优惠卷6.5
This commit is contained in:
parent
0f6f973192
commit
6f02a10ed3
1
components.d.ts
vendored
1
components.d.ts
vendored
@ -21,6 +21,7 @@ declare module '@vue/runtime-core' {
|
||||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||
FamilyModal: typeof import('./src/components/familyModal.vue')['default']
|
||||
GiveCouponModal: typeof import('./src/components/giveCouponModal.vue')['default']
|
||||
InquiryDetailModal: typeof import('./src/components/inquiryDetailModal.vue')['default']
|
||||
InquiryDetailMoneyModal: typeof import('./src/components/inquiryDetailMoneyModal.vue')['default']
|
||||
IsOkCouponModal: typeof import('./src/components/isOkCouponModal.vue')['default']
|
||||
|
||||
@ -14,7 +14,7 @@ export function getCouponDetail(id){
|
||||
}
|
||||
export function addCoupon(data){//系统-新增系统优惠卷
|
||||
return request({
|
||||
url:'/admin/coupon/system/',
|
||||
url:'/admin/coupon/system',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@ -33,13 +33,21 @@ export function getCouponDetail(id){
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getUserCouponList(data){
|
||||
export function getUserCouponList(data){//用户优惠卷列表
|
||||
return request({
|
||||
url:'/admin/coupon/user/page',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getPatientList(params){
|
||||
return request({
|
||||
url:'/admin/patient/list',
|
||||
method:'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function giveCoupon(id,data){//系统-发放系统优惠卷
|
||||
return request({
|
||||
url:'/admin/coupon/system/grant/'+id,
|
||||
@ -47,9 +55,18 @@ export function getCouponDetail(id){
|
||||
data
|
||||
})
|
||||
}
|
||||
export function getProduct(){//系统-发放系统优惠卷
|
||||
export function getProduct(params){//系统-发放系统优惠卷
|
||||
return request({
|
||||
url:'admin/product/list',
|
||||
method: 'post'
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export function exportService(data){//导出
|
||||
return request({
|
||||
url:'/admin/export/order/service',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -156,14 +156,17 @@
|
||||
</a-row>
|
||||
<a-row :gutter="24" v-if="showTimeRange">
|
||||
<a-col :span="12">
|
||||
<a-form-item field="valid_start_time" label="有效时间:" :rules="[{required: true,message:'请选择有效时间'}]">
|
||||
<a-form-item field="valid_start_time" :validate-trigger="['input']" label="有效时间:" :rules="[{required: true,message:'请选择有效时间'}]">
|
||||
<a-range-picker
|
||||
style="width: 360px; margin: 0 24px 24px 0"
|
||||
v-model='rangeValue'
|
||||
style="width: 360px;"
|
||||
show-time
|
||||
:defaultValue="defaultValue"
|
||||
:disabled-date="disabledDate"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DD HH:mm"
|
||||
@ok="onOk"
|
||||
@clear="clearDate"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -207,7 +210,7 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-row :gutter="24" v-if="showDistributionDay">
|
||||
<a-col a-col :span="24">
|
||||
<a-form-item field="distribution_with_day" label="发放关联天数:">
|
||||
<a-input-number
|
||||
@ -230,8 +233,9 @@
|
||||
<a-row :gutter="24" v-if="showProduct">
|
||||
<a-col a-col :span="12">
|
||||
<a-form-item field="product_id" label="关联商品:" :rules="[{required: true,message:'请选择关联商品'}]">
|
||||
<a-select multiple v-model="modalForm.product_id" placeholder="请选择关联商品">
|
||||
<a-option v-for="item in productList" :key="item.product_platform_id" :value="item.product_platform_id" :label="item.product_name">
|
||||
<a-select multiple v-model="modalForm.product_id" placeholder="请选择关联商品" allow-search
|
||||
:loading="loading" @search="handleGetProduct">
|
||||
<a-option v-for="item in productList" :key="item.product_id" :value="item.product_id" :label="item.product_name">
|
||||
{{ item.product_name }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
@ -310,7 +314,7 @@
|
||||
<a-space style="margin-right: 8px" v-if="!modalForm.coupon_id">
|
||||
<a-button
|
||||
type="primary"
|
||||
v-has="'admin:sysProductList:report'"
|
||||
v-has="'admin:sysCouponList:add'"
|
||||
@click="handleAddCoupon"
|
||||
>添加</a-button
|
||||
>
|
||||
@ -319,7 +323,7 @@
|
||||
<a-space style="margin-right: 8px" v-else>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-has="'admin:sysProductList:cancel'"
|
||||
v-has="'admin:sysCouponList:edit'"
|
||||
status="danger"
|
||||
@click="handleUpdateCoupon"
|
||||
>修改</a-button
|
||||
@ -331,11 +335,12 @@
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, toRefs, watch,getCurrentInstance} from 'vue';
|
||||
import { ref, toRefs, watch,getCurrentInstance,defineExpose} from 'vue';
|
||||
import { addCoupon,updateCoupon,getProduct } from '@/api/coupon/list';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emits = defineEmits(['closeChange']);
|
||||
import dayjs from 'dayjs'
|
||||
const emits = defineEmits(['closeChange','changeTimeRange']);
|
||||
const props = defineProps({
|
||||
// 是否显示
|
||||
modalVisible: {
|
||||
@ -358,7 +363,23 @@ const showConnectType = ref(false);
|
||||
const showProduct = ref(false);
|
||||
const showTimeRange =ref(false);
|
||||
const showValidDay = ref(false);
|
||||
const showDistributionDay= ref(false);
|
||||
const defaultValue = ref([]);
|
||||
const rangeValue=ref([]);
|
||||
const productList=ref([]);
|
||||
const loading=ref(false);
|
||||
const handleGetProduct=async(name='',id='')=>{
|
||||
loading.value=true;
|
||||
const {code,data}=await getProduct({
|
||||
product_name:'',
|
||||
product_id:'',
|
||||
limit:100
|
||||
});
|
||||
if(code==200){
|
||||
productList.value=data;
|
||||
}
|
||||
loading.value=false;
|
||||
}
|
||||
const changeType = (val) => {
|
||||
showManjian.value = false;
|
||||
showMinNumber.value = false;
|
||||
@ -373,6 +394,9 @@ const changeValidType = (val) => {
|
||||
showValidDay.value=false;
|
||||
if (val == 1) {
|
||||
showTimeRange.value=true;
|
||||
if(modalForm.value.valid_start_time){
|
||||
rangeValue.value=[modalForm.value.valid_start_time,modalForm.value.valid_end_time]
|
||||
}
|
||||
}else{
|
||||
showValidDay.value=true;
|
||||
}
|
||||
@ -389,19 +413,20 @@ const changeScope = (val) => {
|
||||
showConnectType.value = true;
|
||||
} else if (val == 5) {
|
||||
showProduct.value = true;
|
||||
handleGetProduct('',modalForm.value.product_id);
|
||||
}
|
||||
};
|
||||
const changeObject = (val) => {
|
||||
showMinNumber.value = false;
|
||||
showDistributionDay.value = false;
|
||||
if(val==4){
|
||||
showMinNumber.value = true;
|
||||
showDistributionDay.value = true;
|
||||
};
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.modalForm,
|
||||
() => {
|
||||
console.log(props.modalForm);
|
||||
//console.log(props.modalForm);
|
||||
if(props.modalForm.coupon_id){
|
||||
changeType(props.modalForm.coupon_type);
|
||||
changeScope(props.modalForm.application_scope);
|
||||
@ -416,17 +441,41 @@ watch(
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
const onOk = (dateString, date) => {
|
||||
[valid_start_time.value, valid_end_time.value] = dateString;
|
||||
[valid_start_time.value,valid_end_time.value] = dateString;
|
||||
rangeValue.value=[valid_start_time.value,valid_end_time.value]
|
||||
emits('changeTimeRange',{
|
||||
valid_start_time:valid_start_time.value,
|
||||
valid_end_time:valid_end_time.value
|
||||
})
|
||||
proxy.$refs.modalFormRef.validateField('valid_start_time',(valid)=>{
|
||||
if(!valid){
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
const productList=ref([])
|
||||
const handleGetProduct=async()=>{
|
||||
const {code,data}=await getProduct();
|
||||
if(code==200){
|
||||
productList.value=data;
|
||||
}
|
||||
const clearDate=()=>{
|
||||
valid_start_time.value='';
|
||||
valid_end_time.value='';
|
||||
emits('changeTimeRange',{
|
||||
valid_start_time:'',
|
||||
valid_end_time:''
|
||||
})
|
||||
}
|
||||
|
||||
const changeStatus=()=>{
|
||||
showConnectType.value = false;
|
||||
showProduct.value = false;
|
||||
showManjian.value = false;
|
||||
showMinNumber.value = false;
|
||||
showDistributionDay.value = false;
|
||||
showTimeRange.value=false;
|
||||
showValidDay.value=false;
|
||||
|
||||
|
||||
};
|
||||
const handleClose = () => {
|
||||
emits('closeChange', (modalVisible.value = false));
|
||||
proxy.$refs.modalFormRef.resetFields();
|
||||
};
|
||||
const disabledDate = (time) => {
|
||||
return time.getTime() < Date.now() - 8.64e7;
|
||||
@ -437,33 +486,50 @@ const handleAddCoupon=()=>{
|
||||
let {coupon_name,coupon_client,coupon_type,distribution_object,application_scope,
|
||||
inquiry_type,is_mutex,is_display,distribution_with_day,min_usable_number,coupon_count,coupon_price,with_amount,valid_type,valid_days,valid_start_time,valid_end_time,product_id,reissue_interval_days,is_reissuable_after_expire,is_popup,coupon_desc}=props.modalForm;
|
||||
let product_id_arr=[];
|
||||
if(product_id){
|
||||
if(product_id && typeof product_id === 'string'){
|
||||
product_id_arr=product_id.split(',');
|
||||
}else if(product_id && product_id instanceof Array){
|
||||
product_id_arr=product_id;
|
||||
}
|
||||
const {code}=await addCoupon({
|
||||
coupon_name,
|
||||
coupon_client,
|
||||
coupon_type,
|
||||
distribution_object,
|
||||
application_scope,
|
||||
inquiry_type,
|
||||
is_mutex,
|
||||
is_display,
|
||||
distribution_with_day,
|
||||
min_usable_number,
|
||||
coupon_count,
|
||||
coupon_price,
|
||||
with_amount,
|
||||
valid_type,
|
||||
valid_days,
|
||||
valid_start_time,
|
||||
valid_end_time,
|
||||
product_id,
|
||||
reissue_interval_days,
|
||||
is_reissuable_after_expire,
|
||||
is_popup,
|
||||
coupon_desc
|
||||
})
|
||||
let basicObj={
|
||||
coupon_name,
|
||||
coupon_client,
|
||||
coupon_type,
|
||||
distribution_object,
|
||||
application_scope,
|
||||
coupon_count,
|
||||
coupon_price,
|
||||
reissue_interval_days,
|
||||
is_reissuable_after_expire,
|
||||
is_popup,
|
||||
coupon_desc,
|
||||
valid_type,
|
||||
is_mutex,
|
||||
is_display,
|
||||
};
|
||||
if(showManjian.value){
|
||||
basicObj.with_amount= with_amount
|
||||
};
|
||||
if(showMinNumber.value){
|
||||
basicObj.min_usable_number=min_usable_number;
|
||||
}
|
||||
if(showDistributionDay.value){
|
||||
basicObj.distribution_with_day=distribution_with_day;
|
||||
}
|
||||
if(showConnectType.value){
|
||||
basicObj.inquiry_type=inquiry_type;
|
||||
};
|
||||
if(showProduct.value){
|
||||
basicObj.product_id= product_id_arr
|
||||
};
|
||||
if(showValidDay.value){
|
||||
basicObj.valid_days=valid_days;
|
||||
}
|
||||
if(showTimeRange.value){
|
||||
basicObj.valid_start_time=dayjs(valid_start_time).format("YYYY-MM-DD HH:mm:ss");
|
||||
basicObj.valid_end_time=dayjs(valid_end_time).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
const {code}=await addCoupon(basicObj)
|
||||
if(code==200){
|
||||
Message.success("添加成功");
|
||||
handleClose();
|
||||
@ -480,35 +546,54 @@ const handleUpdateCoupon=async()=>{
|
||||
let {coupon_id,coupon_name,coupon_client,coupon_type,distribution_object,application_scope,
|
||||
inquiry_type,is_mutex,is_display,distribution_with_day,min_usable_number,coupon_count,coupon_price,with_amount,valid_type,valid_days,valid_start_time,valid_end_time,product_id,reissue_interval_days,is_reissuable_after_expire,is_popup,coupon_desc}=props.modalForm;
|
||||
let product_id_arr=[];
|
||||
if(product_id){
|
||||
console.log(product_id);
|
||||
if(product_id && typeof product_id === 'string'){
|
||||
product_id_arr=product_id.split(',');
|
||||
}else if(product_id && product_id instanceof Array){
|
||||
product_id_arr=product_id;
|
||||
}
|
||||
const {code}=await updateCoupon(coupon_id,{
|
||||
coupon_name,
|
||||
coupon_client,
|
||||
coupon_type,
|
||||
distribution_object,
|
||||
application_scope,
|
||||
inquiry_type,
|
||||
is_mutex,
|
||||
is_display,
|
||||
distribution_with_day,
|
||||
min_usable_number,
|
||||
coupon_count,
|
||||
coupon_price,
|
||||
with_amount,
|
||||
valid_type,
|
||||
valid_days,
|
||||
valid_start_time,
|
||||
valid_end_time,
|
||||
product_id:product_id_arr,
|
||||
reissue_interval_days,
|
||||
is_reissuable_after_expire,
|
||||
is_popup,
|
||||
coupon_desc
|
||||
})
|
||||
let basicObj={
|
||||
coupon_name,
|
||||
coupon_client,
|
||||
coupon_type,
|
||||
distribution_object,
|
||||
application_scope,
|
||||
coupon_count,
|
||||
coupon_price,
|
||||
reissue_interval_days,
|
||||
is_reissuable_after_expire,
|
||||
is_popup,
|
||||
coupon_desc,
|
||||
valid_type,
|
||||
is_mutex,
|
||||
is_display,
|
||||
};
|
||||
if(showManjian.value){
|
||||
basicObj.with_amount= with_amount
|
||||
};
|
||||
if(showMinNumber.value){
|
||||
basicObj.min_usable_number=min_usable_number;
|
||||
}
|
||||
if(showDistributionDay.value){
|
||||
basicObj.distribution_with_day=distribution_with_day;
|
||||
}
|
||||
if(showConnectType.value){
|
||||
basicObj.inquiry_type=inquiry_type;
|
||||
};
|
||||
if(showProduct.value){
|
||||
basicObj.product_id= product_id_arr
|
||||
};
|
||||
if(showValidDay.value){
|
||||
basicObj.valid_days=valid_days;
|
||||
}
|
||||
if(showTimeRange.value){
|
||||
basicObj.valid_start_time=valid_start_time;
|
||||
basicObj.valid_end_time=valid_end_time;
|
||||
}
|
||||
const {code}=await updateCoupon(coupon_id,basicObj)
|
||||
if(code==200){
|
||||
Message.success("修改成功");
|
||||
|
||||
handleClose();
|
||||
}else{
|
||||
proxy.$notification.error(response.message);
|
||||
@ -524,6 +609,9 @@ const rules = {
|
||||
distribution_object:[{ required: true, message: '请选择发放对象' }],
|
||||
valid_type:[{ required: true, message: '请选择有效类型' }],
|
||||
};
|
||||
defineExpose({
|
||||
changeStatus
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
|
||||
134
src/components/giveCouponModal.vue
Normal file
134
src/components/giveCouponModal.vue
Normal file
@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<a-modal v-model:visible="giveVisible" :modal-style="{width:'420px'}" body-class="okmodal" @ok="handleConfirm"
|
||||
@cancel="handleClose" >
|
||||
<template #title>
|
||||
发放优惠卷
|
||||
</template>
|
||||
<a-form :model="modalForm" :rules="rules" ref="modalFormRef" size="medium" label-align="left" auto-label-width>
|
||||
<a-form-item field="type" label="发放类型" >
|
||||
<!-- 1:具体用户 2:全部用户 -->
|
||||
<a-select
|
||||
placeholder="请选择发放类型"
|
||||
v-model="modalForm.type"
|
||||
@change="changeType"
|
||||
>
|
||||
<a-option :key="1" :value="1" label="具体用户">具体用户</a-option>
|
||||
<a-option :key="2" :value="2" label="全部用户">全部用户</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="user_id" label="选择用户" v-if="showType" :rules="[{required: true,message:'请选择用户'}]">
|
||||
<a-select
|
||||
allow-search
|
||||
:loading="loading" @search="handleList"
|
||||
placeholder="请选择选择用户"
|
||||
v-model="modalForm.user_id"
|
||||
>
|
||||
<a-option :key="item.user_id" :value="item.user_id" :label="item.user_name
|
||||
" v-for="item in patientList" >{{item.user_name}}</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="total_quantity" label="总发放数量" >
|
||||
<a-input-number v-model="modalForm.total_quantity" placeholder="请输入总发放数量" size="large" :min="0" />
|
||||
</a-form-item>
|
||||
<a-form-item field="single_quantity" label="个人可发放数量" >
|
||||
<a-input-number v-model="modalForm.single_quantity" placeholder="请输入个人可发放数量" size="large" :min="0" />
|
||||
</a-form-item>
|
||||
<a-form-item field="is_follow_rules" label="是否遵循优惠卷发放对象规则" >
|
||||
<a-switch v-model="modalForm.is_follow_rules" :checked-value="1" :unchecked-value="0"/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
<template #footer>
|
||||
<a-button @click="handleClose"><template #icon><icon-close /></template>取消</a-button>
|
||||
<a-button type="primary" @click="handleConfirm"><template #icon><icon-check /></template>确认</a-button>
|
||||
</template>
|
||||
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import {ref, reactive, toRefs, getCurrentInstance,defineExpose} from 'vue';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import{ giveCoupon ,getPatientList} from "@/api/coupon/list"
|
||||
const { proxy } = getCurrentInstance();
|
||||
const patientList=ref([]);
|
||||
const loading=ref(false);
|
||||
const modalForm = reactive({
|
||||
type: '',
|
||||
total_quantity:null,
|
||||
single_quantity:null,
|
||||
is_follow_rules:0
|
||||
});
|
||||
const props = defineProps({
|
||||
// 是否显示
|
||||
giveVisible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
id:{
|
||||
type: String,
|
||||
default:'',
|
||||
}
|
||||
});
|
||||
const emits = defineEmits(['closeGiVe']);
|
||||
const {giveVisible,id} = toRefs(props);
|
||||
const showType=ref(false);
|
||||
// Akiraka 20230210 关闭弹窗
|
||||
const handleClose = () => {
|
||||
emits('closeGiVe',false);
|
||||
|
||||
}
|
||||
const changeType=(val)=>{
|
||||
showType.value=false;
|
||||
if(val==1){
|
||||
showType.value=true;
|
||||
}
|
||||
};
|
||||
const handleList=async(name='')=>{
|
||||
loading.value=true;
|
||||
const {code,data}=await getPatientList({
|
||||
name:name
|
||||
})
|
||||
if(code==200){
|
||||
patientList.value=data;
|
||||
}
|
||||
loading.value=false;
|
||||
}
|
||||
const changeStatus=()=>{
|
||||
showType.value=false;
|
||||
handleList();
|
||||
proxy.$refs.modalFormRef.resetFields();
|
||||
};
|
||||
// Akiraka 20230210 删除数据校验
|
||||
const rules = reactive({
|
||||
type: [{ required: true, message: '请选择发放类型' }],
|
||||
total_quantity:[{ required: true, message: '请选择总发放数量' }],
|
||||
single_quantity:[{ required: true, message: '请选择个人可发放数量' }]
|
||||
});
|
||||
// Akiraka 20230210 确认按钮 => 开始数据检查
|
||||
const handleConfirm = () => {
|
||||
proxy.$refs.modalFormRef.validate(async(valid) => {
|
||||
if (!valid) {
|
||||
const {code}= await giveCoupon(id.value,modalForm);
|
||||
if(code==200){
|
||||
Message.success("发放成功");
|
||||
proxy.$refs.modalFormRef.resetFields();
|
||||
}else{
|
||||
proxy.$notification.error(response.message);
|
||||
}
|
||||
emits('closeGiVe',true);
|
||||
// api.value(id.value,form).then(response => {
|
||||
// // Akiraka 20230210 关闭弹窗
|
||||
// if(response.code==200){
|
||||
// Message.success("取消成功");
|
||||
// proxy.$refs.modalFormRef.resetFields();
|
||||
// }else{
|
||||
// proxy.$notification.error(response.message);
|
||||
// }
|
||||
// emits('closeGiVe',true);
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
changeStatus
|
||||
});
|
||||
</script>
|
||||
@ -2,11 +2,11 @@
|
||||
<div class="app-container">
|
||||
<a-form :model="queryForm" ref="queryFormRef" layout="inline">
|
||||
|
||||
<a-form-item field="user_name" label="优惠卷名称">
|
||||
<a-form-item field="coupon_name" label="优惠卷名称">
|
||||
<a-input :style="{ width: '182px' }" v-model="queryForm.coupon_name" placeholder="请输入患者名字" @press-enter="handleQuery" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item field="status" label="启用状态">
|
||||
<a-form-item field="coupon_status" label="启用状态">
|
||||
<a-select v-model="queryForm.coupon_status" placeholder="请选择启用状态" :style="{ width: '182px' }">
|
||||
<!-- 1:正常 2:强制失效 3:结束 4:删除 -->
|
||||
<a-option :value="1">正常</a-option>
|
||||
@ -15,7 +15,7 @@
|
||||
<a-option :value="3">删除</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="status" label="发放对象">
|
||||
<a-form-item field="distribution_object" label="发放对象">
|
||||
<a-select v-model="queryForm.distribution_object" placeholder="请选择发放对象" :style="{ width: '182px' }">
|
||||
<!-- 1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户 -->
|
||||
<a-option :value="1">全部用户</a-option>
|
||||
@ -27,7 +27,7 @@
|
||||
<a-option :value="7">健康包服务用户</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="status" label="适用范围">
|
||||
<a-form-item field="application_scope" label="适用范围">
|
||||
<a-select v-model="queryForm.application_scope" placeholder="请选择适用范围" :style="{ width: '182px' }">
|
||||
<!-- 1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品-->
|
||||
<a-option :value="1">全场通用</a-option>
|
||||
@ -59,15 +59,16 @@
|
||||
<!-- action -->
|
||||
<div class="action">
|
||||
<a-space>
|
||||
<a-button v-has="'admin:sysPatientList:selectExport'" type="primary" @click="handlExport(2)"><icon-export /> 选择数据导出 </a-button>
|
||||
<a-button v-has="'admin:sysCouponList:add'" type="primary" @click="showAdd"><icon-plus /> 创建优惠卷 </a-button>
|
||||
<!-- <a-button v-has="'admin:sysPatientList:selectExport'" type="primary" @click="handlExport(2)"><icon-export /> 选择数据导出 </a-button>
|
||||
<a-button v-has="'admin:sysPatientList:searchExport'" type="primary" @click="handlExport(1)"><icon-export /> 当前搜索全部导出</a-button>
|
||||
<a-button v-has="'admin:sysPatientList:allExport'" type="primary" @click="handlExport(3)"><icon-export /> 全部导出</a-button>
|
||||
<a-button v-has="'admin:sysPatientList:allExport'" type="primary" @click="handlExport(3)"><icon-export /> 全部导出</a-button> -->
|
||||
</a-space>
|
||||
</div>
|
||||
|
||||
<!-- table -->
|
||||
<a-table :columns="columns" :data="tableData"
|
||||
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
||||
|
||||
:pagination="{ 'show-total': true, 'show-jumper': true, 'show-page-size': true, total: pager.total, current: currentPage }"
|
||||
row-key="coupon_id" @selection-change="(selection) => {deleteData = selection;console.log(selection)}"
|
||||
@page-change="handlePageChange" @page-size-change="handlepage_sizeChange">
|
||||
@ -93,17 +94,22 @@
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-button v-has="'admin:sysPatientList:detail'" type="text"
|
||||
<a-button v-has="'admin:sysCouponList:detail'" type="text"
|
||||
@click="handleDetail(record)"><icon-book />详情</a-button>
|
||||
</a-space>
|
||||
<a-space>
|
||||
<a-button v-has="'admin:sysCouponList:give'" type="text"
|
||||
@click="handleGive(record)"><icon-pushpin />发放优惠卷</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<!-- Modal -->
|
||||
<couponDetail :modalVisible="modalVisible" :modalForm="modalForm" @closeChange="closeCouponDetail"></couponDetail>
|
||||
<couponDetail ref="couponChild" :modalVisible="modalVisible" :modalForm="modalForm" @closeChange="closeCouponDetail" @changeTimeRange="changeTimeRange"></couponDetail>
|
||||
|
||||
|
||||
|
||||
<!-- 发放弹窗giveVisible-->
|
||||
<giveCouponModal ref="giveCouponChild" :giveVisible="giveVisible" @closeGiVe="closeGiVe" :id="give_coupon_id"> </giveCouponModal>
|
||||
|
||||
<!-- Akiraka 20230223 删除与批量删除 结束 -->
|
||||
<a-modal v-model:visible="okVisible" :modal-style="{width:'420px'}" body-class="okmodal"
|
||||
@cancel="cancelOk" @ok="handleOk">
|
||||
@ -134,8 +140,6 @@
|
||||
<script setup>
|
||||
import { reactive, ref, getCurrentInstance, onMounted, nextTick, watch, computed } from 'vue';
|
||||
import { getSystemCouponList,getCouponDetail,updateCouponStatus} from '@/api/coupon/list';
|
||||
import {getFamilyDetail} from '@/api/patient/family';
|
||||
import {parseTime} from "@/utils/parseTime"
|
||||
import { formatCouponStatus,formatCouponType,formatCouponObject,formatCouponRange } from '@/utils/format';
|
||||
// Akiraka 20230210 删除数据
|
||||
const deleteData = ref([])
|
||||
@ -162,6 +166,9 @@ const isVisible=ref(false);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const currentPage = ref(1);
|
||||
const family_data=ref([]);
|
||||
const couponChild = ref(null);
|
||||
const giveCouponChild= ref(null);
|
||||
const giveVisible=ref(false);
|
||||
// Pager
|
||||
const pager = {
|
||||
total: 0,
|
||||
@ -231,7 +238,16 @@ const isVisible=ref(false);
|
||||
modalSatus.value = 'add';
|
||||
modalForm.coupon_id = null;
|
||||
};
|
||||
|
||||
const give_coupon_id=ref('');
|
||||
const closeGiVe=()=>{
|
||||
giveVisible.value=false;
|
||||
};
|
||||
const handleGive=(record)=>{
|
||||
|
||||
give_coupon_id.value=record.coupon_id;
|
||||
giveVisible.value=true;
|
||||
giveCouponChild.value.changeStatus();
|
||||
}
|
||||
//详情
|
||||
const handleDetail = async (record) => {
|
||||
modalVisible.value = true;
|
||||
@ -257,6 +273,27 @@ const isVisible=ref(false);
|
||||
proxy.$notification.error(message);
|
||||
}
|
||||
};
|
||||
const showAdd=()=>{
|
||||
|
||||
modalVisible.value=true;
|
||||
modalForm.coupon_id='';
|
||||
modalForm.valid_days=null;
|
||||
modalForm.coupon_status=1;
|
||||
modalForm.coupon_client=1;
|
||||
modalForm.is_mutex=0;
|
||||
modalForm.is_display=0;
|
||||
modalForm.is_popup=0;
|
||||
modalForm.valid_start_time='';
|
||||
modalForm.valid_end_time='';
|
||||
modalForm.valid_type='';
|
||||
if(couponChild.value){
|
||||
couponChild.value.changeStatus();
|
||||
}
|
||||
};
|
||||
const changeTimeRange=(data)=>{
|
||||
modalForm.valid_start_time=data.valid_start_time;
|
||||
modalForm.valid_end_time=data.valid_end_time;
|
||||
};
|
||||
const cancelOk=()=>{
|
||||
okVisible.value=false;
|
||||
}
|
||||
|
||||
265
src/views/coupon/userCoupon-list/index.vue
Normal file
265
src/views/coupon/userCoupon-list/index.vue
Normal file
@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<a-form :model="queryForm" ref="queryFormRef" layout="inline">
|
||||
|
||||
<a-form-item field="user_name" label="用户名称">
|
||||
<a-input :style="{ width: '182px' }" v-model="queryForm.user_name" placeholder="请输入用户名称" @press-enter="handleQuery" />
|
||||
</a-form-item>
|
||||
<a-form-item field="coupon_name" label="优惠卷名称">
|
||||
<a-input :style="{ width: '182px' }" v-model="queryForm.coupon_name" placeholder="请输入优惠卷名称" @press-enter="handleQuery" />
|
||||
</a-form-item>
|
||||
<a-form-item field="user_coupon_status" label="使用状态">
|
||||
<a-select v-model="queryForm.user_coupon_status" placeholder="使用状态" :style="{ width: '182px' }">
|
||||
<!-- 0:未使用 1:已使用 3:已过期 -->
|
||||
<a-option :value="0">未使用</a-option>
|
||||
<a-option :value="1">已使用</a-option>
|
||||
<a-option :value="2">已过期</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item field="create_range_time" label="创建时间范围">
|
||||
<a-range-picker
|
||||
style="width: 260px"
|
||||
v-model="queryForm.create_range_time"
|
||||
/>
|
||||
</a-form-item> -->
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="handleQuery"><icon-search /> 搜索</a-button>
|
||||
<a-button @click="handleResetQuery"><icon-loop /> 重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<a-divider />
|
||||
|
||||
<!-- action -->
|
||||
<!--<div class="action">
|
||||
<a-space>
|
||||
|
||||
<a-button v-has="'admin:sysPatientList:selectExport'" type="primary" @click="handlExport(2)"><icon-export /> 选择数据导出 </a-button>
|
||||
<a-button v-has="'admin:sysPatientList:searchExport'" type="primary" @click="handlExport(1)"><icon-export /> 当前搜索全部导出</a-button>
|
||||
<a-button v-has="'admin:sysPatientList:allExport'" type="primary" @click="handlExport(3)"><icon-export /> 全部导出</a-button>
|
||||
</a-space>
|
||||
</div> -->
|
||||
|
||||
<!-- table -->
|
||||
<a-table :columns="columns" :data="tableData"
|
||||
:scroll="{ x: 1400 }"
|
||||
:pagination="{ 'show-total': true, 'show-jumper': true, 'show-page-size': true, total: pager.total, current: currentPage }"
|
||||
row-key="user_coupon_id" @selection-change="(selection) => {deleteData = selection;console.log(selection)}"
|
||||
@page-change="handlePageChange" @page-size-change="handlepage_sizeChange">
|
||||
<template #code="{record,rowIndex}">
|
||||
<div>{{(rowIndex+1)+(pager.page-1)*pager.page_size}}</div>
|
||||
</template>
|
||||
|
||||
<template #coupon_use_date="{record}">
|
||||
<div v-if="parseTime(record.coupon_use_date)">{{parseTime(record.coupon_use_date)}}</div>
|
||||
<div v-else>-</div>
|
||||
</template>
|
||||
<template #valid_start_time="{record}">
|
||||
<div>{{parseTime(record.valid_start_time)+'——'+parseTime(record.valid_end_time)}}</div>
|
||||
</template>
|
||||
<template #coupon="{record}">
|
||||
<div>{{record.coupon.coupon_name}}</div>
|
||||
</template>
|
||||
|
||||
<template #created_at="{record}">
|
||||
<div>{{parseTime(record.created_at)}}</div>
|
||||
</template>
|
||||
<template #user_coupon_status="{ record }">
|
||||
<!-- 0:未使用 1:已使用 3:已过期 -->
|
||||
<div v-if="record.user_coupon_status==0">未使用</div>
|
||||
<div v-else-if="record.user_coupon_status==1">已使用</div>
|
||||
<div v-else>已过期</div>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, getCurrentInstance, onMounted, nextTick, watch, computed } from 'vue';
|
||||
import { getUserCouponList} from '@/api/coupon/list';
|
||||
import { parseTime } from '@/utils/parseTime';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const currentPage = ref(1);
|
||||
const tableData=ref([]);
|
||||
const loading=ref(false);
|
||||
// Pager
|
||||
const pager = {
|
||||
total: 0,
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
};
|
||||
// form
|
||||
const queryForm = reactive({
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Table Columns
|
||||
const columns = ref([{
|
||||
title: '编号',
|
||||
dataIndex: 'code',
|
||||
slotName:'code',
|
||||
width:80
|
||||
},{
|
||||
title: '用户名称',
|
||||
dataIndex: 'user_name',
|
||||
width:180
|
||||
},
|
||||
{
|
||||
title: '优惠卷名称',
|
||||
dataIndex: 'coupon',
|
||||
slotName:'coupon',
|
||||
width:200
|
||||
},
|
||||
{
|
||||
title: '优惠卷状态',
|
||||
dataIndex: 'user_coupon_status',
|
||||
slotName:'user_coupon_status',
|
||||
width:100
|
||||
},
|
||||
{
|
||||
title: '使用时间',
|
||||
dataIndex: 'coupon_use_date',
|
||||
slotName:'coupon_use_date',
|
||||
width:180
|
||||
},
|
||||
{
|
||||
title: '有效期',
|
||||
dataIndex: 'valid_start_time',
|
||||
slotName:'valid_start_time',
|
||||
width:300
|
||||
},{
|
||||
title: '创建时间',
|
||||
dataIndex: 'created_at',
|
||||
slotName:'created_at',
|
||||
width:180
|
||||
}])
|
||||
|
||||
/**
|
||||
* 分页改变
|
||||
* @param {Number} [page]
|
||||
*/
|
||||
const handlePageChange = (page) => {
|
||||
pager.page = page;
|
||||
|
||||
// 修改当前页码
|
||||
currentPage.value = page;
|
||||
getInfo({ ...pager, ...queryForm });
|
||||
};
|
||||
|
||||
// 每页数据量
|
||||
const handlepage_sizeChange = (page_size) => {
|
||||
pager.page_size = page_size;
|
||||
getInfo({ ...pager, ...queryForm });
|
||||
};
|
||||
|
||||
// 获取患者信息
|
||||
const getInfo = async (params = {}) => {
|
||||
loading.value=true;
|
||||
const { data, code, message } = await getUserCouponList(params);
|
||||
if (code == 200) {
|
||||
tableData.value = data.data;
|
||||
Object.assign(pager, { total: data.total, page: data.page, page_size: data.page_size });
|
||||
}
|
||||
loading.value=false;
|
||||
};
|
||||
|
||||
// 查询患者信息
|
||||
const handleQuery = async () => {
|
||||
pager.page = 1;
|
||||
const params = {
|
||||
page: pager.page,
|
||||
page_size: pager.page_size,
|
||||
...queryForm,
|
||||
};
|
||||
|
||||
getInfo(params);
|
||||
};
|
||||
|
||||
// 重置搜索
|
||||
const handleResetQuery = () => {
|
||||
proxy.$refs.queryFormRef.resetFields();
|
||||
getInfo(queryForm);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getInfo(pager);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.action {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.okmodal div {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hospital_name {
|
||||
width: 140px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.headImg {
|
||||
margin-right: 20px;
|
||||
border-radius: 50%;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
.arco-form-item-layout-horizontal:first-child,
|
||||
.arco-form-item-layout-horizontal:nth-child(2) {
|
||||
align-items: center;
|
||||
}
|
||||
.cellbox{
|
||||
margin-top: 35px;
|
||||
}
|
||||
.cellbox .cell{
|
||||
width:50%;
|
||||
border-bottom:1px dashed #efefef;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.cellbox .cell:first-child{
|
||||
border: none;
|
||||
}
|
||||
.cell{
|
||||
.arco-form-item{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
.box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cert .arco-form-item-label-col {
|
||||
flex: 0 0 8px !important;
|
||||
}
|
||||
|
||||
.red {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
font-size: 14px;
|
||||
color: red;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.cardNum {
|
||||
width: 148px;
|
||||
}
|
||||
.codbox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.reason{
|
||||
max-width:250px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
@ -1072,7 +1072,7 @@ import {
|
||||
watch,
|
||||
} from 'vue';
|
||||
import {
|
||||
exportInquiry,
|
||||
exportService,
|
||||
getServiceList,
|
||||
serviceDetail,
|
||||
serviceRightDetail,
|
||||
@ -1578,7 +1578,7 @@ const handlExport = async (type) => {
|
||||
type,
|
||||
};
|
||||
}
|
||||
const { code, data } = await exportInquiry(fromData);
|
||||
const { code, data } = await exportService(fromData);
|
||||
if (code == 200) {
|
||||
downloadFile(data, '问诊订单');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user