变更
This commit is contained in:
parent
9ee59ba57d
commit
1204b77c7d
|
@ -22,8 +22,9 @@ onMounted(()=>{
|
|||
checkLoginState()
|
||||
})
|
||||
const checkLoginState = async ()=>{ //监测登陆状态
|
||||
console.log("start")
|
||||
const res = await myAxios.get('/user/get/login')
|
||||
console.log(res)
|
||||
console.log("end")
|
||||
if(res.data.code != 1) {
|
||||
router.push('/')
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import router from '../router'
|
|||
|
||||
const myAxios = axios.create({
|
||||
withCredentials:true,
|
||||
// baseURL: 'http://localhost:9092/api'
|
||||
baseURL: 'http://123.249.108.160:8888/api' //测试服务器
|
||||
baseURL: 'http://localhost:9092/api'
|
||||
// baseURL: 'http://123.249.108.160:8888/api' //测试服务器
|
||||
});
|
||||
// 添加请求拦截器
|
||||
axios.interceptors.request.use(function (config) {
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
<template>
|
||||
<el-form ref="resetFormData" :model="form" label-width="auto" style="width: 750px" size="large">
|
||||
<el-form-item label="添加优惠券图片">
|
||||
<el-upload
|
||||
action="#"
|
||||
list-type="picture-card"
|
||||
:auto-upload="false"
|
||||
multiple="true"
|
||||
:on-remove="handleRemove"
|
||||
@change="(event: any) => handleChange(event, 0)"
|
||||
limit="1" >
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :model="form" label-width="auto" style="max-width: 600px">
|
||||
<el-form-item label="优惠券名称">
|
||||
|
@ -22,11 +8,11 @@
|
|||
<el-form-item label="兑换积分">
|
||||
<el-input v-model="form.requirePoints" />
|
||||
</el-form-item>
|
||||
<el-form-item label="满减金额">
|
||||
<el-input v-model="form.conditionAmount" />
|
||||
<el-form-item label="满(元)">
|
||||
<el-input v-model="form.standardAmount" />
|
||||
</el-form-item>
|
||||
<el-form-item label="使用范围">
|
||||
<el-input v-model="form.useScope" />
|
||||
<el-form-item label="减(元)">
|
||||
<el-input v-model="form.conditionAmount" />
|
||||
</el-form-item>
|
||||
<el-form-item label="截至日期">
|
||||
<el-date-picker
|
||||
|
@ -37,6 +23,9 @@
|
|||
value-format="YYYY-MM-DD hh:mm:ss"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="简介">
|
||||
<el-input v-model="form.content" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="使用说明">
|
||||
<el-input v-model="form.description" type="textarea" />
|
||||
</el-form-item>
|
||||
|
@ -56,16 +45,12 @@ import myAxios from "@/api/myAxios";
|
|||
const fileSimple = ref()
|
||||
const form = ref({
|
||||
name: '',
|
||||
conditionAmount:0,//满减金额
|
||||
totalNum:0,
|
||||
requirePoints:0,//兑换积分
|
||||
residueNum:0,//剩余数量
|
||||
limitNum:0,//限量领取
|
||||
useScope:'',//使用范围
|
||||
startTime: '',
|
||||
standardAmount:0,//满
|
||||
conditionAmount:0,//减
|
||||
requirePoints:0,
|
||||
endTime: '',
|
||||
description:'',//使用说明
|
||||
image:''
|
||||
content:'',
|
||||
description:'',
|
||||
})
|
||||
onMounted(() => {
|
||||
|
||||
|
@ -88,39 +73,10 @@ const AddCoupon = async () => {
|
|||
} else {
|
||||
ElMessage.error("服务错误");
|
||||
}
|
||||
console.log(form.value.startTime)
|
||||
}
|
||||
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
console.log(uploadFile, uploadFiles)
|
||||
}
|
||||
//上传图片
|
||||
const handleChange = async (file: any, flag: number) => {
|
||||
fileSimple.value = file
|
||||
let formData = new FormData()
|
||||
formData.append("file", fileSimple.value.raw)
|
||||
const res = await myAxios({
|
||||
url: '/file/upload/server/not_login',
|
||||
method: 'post',
|
||||
headers: {
|
||||
'content-Type': 'multipart/form-data'
|
||||
},
|
||||
data: {
|
||||
biz: "test",
|
||||
file: formData.get("file")
|
||||
}
|
||||
})
|
||||
if (res.data.code === 1) {
|
||||
form.value.image = res.data.data
|
||||
}
|
||||
|
||||
}
|
||||
// const startDate = new Date(form.value.startTime)
|
||||
// const endDate = new Date(form.value.endTime)
|
||||
// if (startDate > endDate) {
|
||||
// ElMessage({
|
||||
// type: 'warning',
|
||||
// message: '截至日期不能小于开始日期,请重新选择日期'
|
||||
// })
|
||||
// }
|
||||
</script>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<!-- 搜索-->
|
||||
<div>
|
||||
<el-input style="width: 200px; height: 30px; margin-right: 10px;" suffix-icon="Search" placeholder="请输入优惠券名称"
|
||||
v-model="Couponsname"></el-input>
|
||||
<el-button class="ml-5" type="primary" @click="load" style="height: 25px;">搜索</el-button>
|
||||
v-model="name"></el-input>
|
||||
<el-button class="ml-5" type="primary" @click="load(name)" style="height: 25px;">搜索</el-button>
|
||||
<el-button type="warning" @click="reset" style="height:25px">重置</el-button>
|
||||
</div>
|
||||
<!-- 批量删除-->
|
||||
|
@ -22,24 +22,15 @@
|
|||
:cell-style="{ 'text-align': 'center', 'font-size': '16px' }" @selection-change="handleSelectionChange"
|
||||
:header-cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column prop="id" label="编号" width="80"></el-table-column>
|
||||
<el-table-column prop="goodImg" label="优惠券图片">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<img :src="scope.row.image" alt="" style="height: 50px;">
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="id" width="80"></el-table-column>
|
||||
<el-table-column prop="name" label="优惠券名称"></el-table-column>
|
||||
<el-table-column prop="conditionAmount" label="满减金额" width="180"></el-table-column>
|
||||
<el-table-column prop="totalNum" label="发放数量"></el-table-column>
|
||||
<el-table-column prop="standardAmount" label="满"></el-table-column>
|
||||
<el-table-column prop="conditionAmount" label="减"></el-table-column>
|
||||
<el-table-column prop="requirePoints" label="兑换积分"></el-table-column>
|
||||
<el-table-column prop="residueNum" label="剩余数量"></el-table-column>
|
||||
<el-table-column prop="limitNum" label="限量领取"></el-table-column>
|
||||
<el-table-column prop="useScope" label="使用范围"></el-table-column>
|
||||
<el-table-column prop="startTime" label="生效时间"></el-table-column>
|
||||
<el-table-column prop="endTime" label="截止时间"></el-table-column>
|
||||
<el-table-column label="操作" width="250px">
|
||||
<el-table-column prop="content" label="简介"></el-table-column>
|
||||
<el-table-column prop="description" label="使用说明"></el-table-column>
|
||||
<el-table-column label="操作" width="200px" >
|
||||
<template #default="scope">
|
||||
<el-button size="small" @click="ReviseOrView(scope.$index, scope.row , 0)">
|
||||
详情
|
||||
|
@ -69,26 +60,9 @@
|
|||
<!-- 详情,编辑-->
|
||||
<el-dialog v-model="DialogVisible" :title="title">
|
||||
<el-form label-width="100px" :disabled="disabled">
|
||||
<el-form-item label="优惠券编号">
|
||||
<el-input v-model="editForm.id" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券图片">
|
||||
<div v-if="editForm.image">
|
||||
<img :src="editForm.image" alt="优惠券图片" class="thumbnail" style="width: 100px; height: 100px;" />
|
||||
</div>
|
||||
<el-upload
|
||||
action="#"
|
||||
list-type="picture-card"
|
||||
:auto-upload="false"
|
||||
multiple="true"
|
||||
:on-remove=" handleRemove"
|
||||
@change="(event: any) => handleChange(event, 0)"
|
||||
limit="1" >
|
||||
<el-icon>
|
||||
<Plus/>
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="优惠券编号">-->
|
||||
<!-- <el-input v-model="editForm.id" disabled></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="优惠券名称">
|
||||
<el-input v-model="editForm.name"></el-input>
|
||||
</el-form-item>
|
||||
|
@ -119,14 +93,14 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, ref} from "vue";
|
||||
import {inject, onMounted, ref} from "vue";
|
||||
import myAxios from "@/api/myAxios";
|
||||
import {ElMessage, type UploadProps} from "element-plus";
|
||||
|
||||
onMounted(() => {
|
||||
getCouponsList()
|
||||
})
|
||||
|
||||
const name=ref('')
|
||||
const DialogVisible = ref(false)
|
||||
const idList = ref([])
|
||||
const total = ref(0)
|
||||
|
@ -142,10 +116,7 @@ const searchParams: any = ref({ //分页
|
|||
sortField: "id", //根据ID分类
|
||||
sortOrder: "descend" //降序
|
||||
})
|
||||
//删除图片
|
||||
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
||||
console.log(uploadFile, uploadFiles)
|
||||
}
|
||||
|
||||
//处理行数大小变化
|
||||
const handleSizeChange = (newSize: any) => {
|
||||
searchParams.value.pageSize = newSize //新的页面数
|
||||
|
@ -175,8 +146,9 @@ const delBatch = async ()=>{
|
|||
}
|
||||
}
|
||||
//重置搜索
|
||||
const reset = () => {
|
||||
Couponsname.value = '';
|
||||
const reload : any = inject("reload")
|
||||
const reset = ()=>{
|
||||
reload()
|
||||
}
|
||||
//搜索
|
||||
const load =(data:String)=>{
|
||||
|
|
Loading…
Reference in New Issue
Block a user