Compare commits
13 Commits
6a07c0c711
...
e8ec9bdc47
| Author | SHA1 | Date | |
|---|---|---|---|
| e8ec9bdc47 | |||
|
|
6726bd7756 | ||
|
|
a8bf678f2e | ||
|
|
3ec039050f | ||
|
|
6baa78a94f | ||
|
|
770d700ba1 | ||
|
|
039ab28c15 | ||
|
|
f75140e135 | ||
|
|
467e1eceb7 | ||
|
|
47bac0315f | ||
|
|
ce0da69b5f | ||
|
|
0d99fbac80 | ||
|
|
06681658fc |
@@ -5,7 +5,13 @@ VITE_DEV=true
|
|||||||
|
|
||||||
# 请求路径
|
# 请求路径
|
||||||
VITE_BASE_URL='http://localhost:48080'
|
VITE_BASE_URL='http://localhost:48080'
|
||||||
#VITE_BASE_URL='http://114.55.169.15:48080'
|
# VITE_BASE_URL='http://47.98.161.246:48080'
|
||||||
|
#VITE_BASE_URL='http://114.215.207.150:48080'
|
||||||
|
|
||||||
|
# 小程序接口请求路劲
|
||||||
|
VITE_APPLET_URL='https://cloud.ahduima.com'
|
||||||
|
# 题库路径
|
||||||
|
VITE_TIKU_URL = 'http://47.98.161.246'
|
||||||
|
|
||||||
# 上传路径
|
# 上传路径
|
||||||
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'
|
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'
|
||||||
|
|||||||
48
src/api/xjapplet/discount.js
Normal file
48
src/api/xjapplet/discount.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export const getVipDiscountList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/member/discount/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addVipDiscount = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/member/discount/add',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateVipDiscount = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/member/discount/update',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteVipDiscount = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: '/admin-api/applet/xunjia/member/discount/delete?discountId=' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getVipDiscountOptions = async () => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/member/discount/simple-list'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getUserDiscountList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/user/discount/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const giveUserDiscount = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/user/discount/send',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
32
src/api/xjapplet/resell.js
Normal file
32
src/api/xjapplet/resell.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export const getResellList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/distribution/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addResell = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/distribution/add',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateResell = async (data) => {
|
||||||
|
return await request.put({
|
||||||
|
url: '/admin-api/applet/xunjia/distribution/update',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export const deleteResell = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: '/admin-api/applet/xunjia/distribution/delete?distributionId=' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export const getResellDetail = async (id) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/distribution/' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
49
src/api/xjapplet/vip.js
Normal file
49
src/api/xjapplet/vip.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export const getUserMemberList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/user/member/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const giveUserMember = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/user/member/add',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getVipTypeList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/member/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addVipType = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/member/add',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateVipType = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/member/update',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteVipType = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: '/admin-api/applet/xunjia/member/memberId?id=' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getVipTypeOptions = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/member/simple-list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
67
src/api/xjapplet/vipdatabase.js
Normal file
67
src/api/xjapplet/vipdatabase.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export const addJx = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/question/jx/add',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getJxQuestionList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/question/jx/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const delJxData = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: `/admin-api/applet/xunjia/question/jx/delete?id=${id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addMj = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/secret/add',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getMjList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/secret/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const delMj = async (secretId) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: `/admin-api/applet/xunjia/secret/delete?secretId=${secretId}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const clearMj = async (secretId) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: `/admin-api/applet/xunjia/secret/clear?secretId=${secretId}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getMjQuestionList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/secret/question/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addMjQuestion = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/secret/question/add',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const delMjQuestion = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: `/admin-api/applet/xunjia/secret/question/delete?id=${id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
48
src/api/xjapplet/xjdatabase.js
Normal file
48
src/api/xjapplet/xjdatabase.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
export const searchQuestion = async (param) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/question/list',
|
||||||
|
params: param
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const updateQuestion = async (data) => {
|
||||||
|
return await request.put({
|
||||||
|
url: '/admin-api/applet/xunjia/question/update',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addQuestion = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/question/add',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const deleteQuestion = async (id) => {
|
||||||
|
return await request.delete({
|
||||||
|
url: '/admin-api/applet/xunjia/question/delete?id=' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const uploadFile = async (data) => {
|
||||||
|
return await request.post({
|
||||||
|
url: '/admin-api/applet/xunjia/question/upload',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getQuestionSort = async (param) => {
|
||||||
|
return await request.get({
|
||||||
|
url: '/admin-api/applet/xunjia/question/sort/list',
|
||||||
|
params: param
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getMjList = async (params) => {
|
||||||
|
return await request.get({
|
||||||
|
url: 'http://localhost/tiku-api/tiku/xunjia/secret/list',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
v-model:page-size="pageSize"
|
v-model:page-size="pageSize"
|
||||||
:small="small"
|
:small="small"
|
||||||
:background="true"
|
:background="true"
|
||||||
:page-sizes="[10, 20, 30, 50, 100]"
|
:page-sizes="[10, 50, 100, 500, 1000]"
|
||||||
:pager-count="pagerCount"
|
:pager-count="pagerCount"
|
||||||
:total="total"
|
:total="total"
|
||||||
class="float-right mt-15px mb-15px"
|
class="float-right mt-15px mb-15px"
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ service.interceptors.response.use(
|
|||||||
throw new Error()
|
throw new Error()
|
||||||
}
|
}
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
// if (data.code === undefined) {
|
||||||
|
// return response
|
||||||
|
// }
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = data.code || result_code
|
const code = data.code || result_code
|
||||||
// 二进制数据则直接返回
|
// 二进制数据则直接返回
|
||||||
|
|||||||
@@ -82,3 +82,29 @@
|
|||||||
.el-table--default .cell {
|
.el-table--default .cell {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex-radio{
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 40px;
|
||||||
|
height: 40px;
|
||||||
|
.el-radio__label {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 去除 Chrome、Safari、Edge、Opera 中的指示器 */
|
||||||
|
.el-input__inner::-webkit-outer-spin-button,
|
||||||
|
.el-input__inner::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 去除 Firefox 中的指示器 */
|
||||||
|
.el-input__inner[type='number'] {
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ const form = ref({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
originFollowUserId: { required: true, message: '原跟进人不可为空', trigger: 'change' }
|
// originFollowUserId: { required: true, message: '原跟进人不可为空', trigger: 'change' }
|
||||||
// newFollowUserId: { required: true, message: '新跟进人不可为空', trigger: 'change' }
|
// newFollowUserId: { required: true, message: '新跟进人不可为空', trigger: 'change' }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
193
src/views/XjApplet/Resell/index.vue
Normal file
193
src/views/XjApplet/Resell/index.vue
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form :model="searchForm" label-width="0" inline @submit.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="searchForm.phone" placeholder="请输入手机号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="searchForm.name" placeholder="请输入姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="searchList" v-hasPermi="['xj-applet:resell:search']">查询</el-button>
|
||||||
|
<el-button type="primary" @click="handleAdd" v-hasPermi="['xj-applet:resell:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="tableData" max-height="calc(100vh - 200px)">
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column prop="phone" label="手机号" />
|
||||||
|
<el-table-column prop="name" label="姓名" />
|
||||||
|
<el-table-column prop="mark" label="标记" />
|
||||||
|
<el-table-column prop="memberName" label="赠送会员" />
|
||||||
|
<el-table-column prop="discountDiscription" label="赠送折扣" />
|
||||||
|
<el-table-column label="小程序码" align="center" width="120px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<img :src="row.appletUrl" style="width: 80px; height: 80px" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="120px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleEdit(row)"
|
||||||
|
v-hasPermi="['xj-applet:resell:update']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="searchForm.pageNo"
|
||||||
|
v-model:limit="searchForm.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog title="分销配置" v-model="showDialog" width="500px">
|
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="手机号" prop="phone">
|
||||||
|
<el-input v-model="form.phone" maxlength="11" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="姓名" prop="name">
|
||||||
|
<el-input v-model="form.name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="标记" prop="mark">
|
||||||
|
<el-input v-model="form.mark" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="赠送会员" prop="memberId">
|
||||||
|
<el-select v-model="form.memberId" clearable filterable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in vipOptions"
|
||||||
|
:key="item.memberId"
|
||||||
|
:label="item.memberName"
|
||||||
|
:value="item.memberId"
|
||||||
|
>
|
||||||
|
<span style="float: left">{{ item.memberName }}</span>
|
||||||
|
<span style="float: right; color: #aaa">{{ item.carName }}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="赠送折扣" prop="discountId">
|
||||||
|
<el-select v-model="form.discountId" clearable filterable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in discountOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.description"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span>
|
||||||
|
<el-button @click="showDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleSave">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Resell">
|
||||||
|
import { getResellList, addResell, updateResell } from '@/api/xjapplet/resell'
|
||||||
|
import { getVipDiscountOptions } from '@/api/xjapplet/discount'
|
||||||
|
import { getVipTypeOptions } from '@/api/xjapplet/vip'
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const searchForm = ref({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 50,
|
||||||
|
phone: '',
|
||||||
|
name: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const tableData = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const showDialog = ref(false)
|
||||||
|
|
||||||
|
const form = ref({
|
||||||
|
phone: '',
|
||||||
|
name: '',
|
||||||
|
mark: '',
|
||||||
|
discountId: undefined,
|
||||||
|
memberId: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
|
||||||
|
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
|
||||||
|
const vipOptions = ref([])
|
||||||
|
const discountOptions = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
searchList()
|
||||||
|
getVipDiscountOptions().then((response) => {
|
||||||
|
discountOptions.value = response
|
||||||
|
})
|
||||||
|
getVipTypeOptions({ carTypeId: searchForm.value.carTypeId }).then((response) => {
|
||||||
|
vipOptions.value = response
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function searchList() {
|
||||||
|
searchForm.value.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
getResellList(searchForm.value).then((response) => {
|
||||||
|
tableData.value = response.list
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
showDialog.value = true
|
||||||
|
form.value = {
|
||||||
|
phone: '',
|
||||||
|
name: '',
|
||||||
|
mark: '',
|
||||||
|
discountId: undefined,
|
||||||
|
memberId: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleEdit(row) {
|
||||||
|
form.value = { ...row }
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref(null)
|
||||||
|
async function handleSave() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
|
if (form.value.distributionId) {
|
||||||
|
updateResell(form.value).then(() => {
|
||||||
|
message.success('修改成功')
|
||||||
|
showDialog.value = false
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addResell(form.value).then(() => {
|
||||||
|
message.success('新增成功')
|
||||||
|
showDialog.value = false
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
144
src/views/XjApplet/Vip/components/UserDiscount.vue
Normal file
144
src/views/XjApplet/Vip/components/UserDiscount.vue
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form :model="searchForm" inline @submit.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="searchForm.phone" placeholder="学员手机号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="searchList" v-hasPermi="['xj-applet:vip:user-discount:search']"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="addVipUser"
|
||||||
|
v-hasPermi="['xj-applet:vip:user-discount:send']"
|
||||||
|
>赠送折扣</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="tableList">
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="手机号" align="left" prop="phone" width="140" />
|
||||||
|
<el-table-column label="折扣描述" align="left" prop="description" min-width="140" />
|
||||||
|
<el-table-column label="折后价格" align="center" prop="discount" width="100" />
|
||||||
|
<el-table-column
|
||||||
|
label="截止时间"
|
||||||
|
align="left"
|
||||||
|
prop="endTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="150"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作人" align="left" prop="operUser" width="100" />
|
||||||
|
<el-table-column label="操作时间" align="left" prop="operTime" width="150" />
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="searchForm.pageNo"
|
||||||
|
v-model:limit="searchForm.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog title="赠送折扣" v-model="showDialog" width="500px" :close-on-click-modal="false">
|
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="手机号" prop="phone">
|
||||||
|
<el-input v-model="form.phone" maxlength="11" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="折扣描述" prop="discountId">
|
||||||
|
<el-select v-model="form.discountId" clearable filterable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in discountOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.description"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span>
|
||||||
|
<el-button @click="showDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="UserDiscount">
|
||||||
|
import {
|
||||||
|
getUserDiscountList,
|
||||||
|
giveUserDiscount,
|
||||||
|
getVipDiscountOptions
|
||||||
|
} from '@/api/xjapplet/discount'
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const searchForm = ref({
|
||||||
|
phone: '',
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 50
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
|
const discountOptions = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
searchList()
|
||||||
|
getVipDiscountOptions().then((response) => {
|
||||||
|
discountOptions.value = response
|
||||||
|
})
|
||||||
|
})
|
||||||
|
function searchList() {
|
||||||
|
searchForm.value.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
getUserDiscountList(searchForm.value).then((response) => {
|
||||||
|
tableList.value = response.list
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const form = ref({
|
||||||
|
phone: '',
|
||||||
|
discountId: ''
|
||||||
|
})
|
||||||
|
const rules = ref({
|
||||||
|
phone: [{ required: true, message: '请输入用户手机号', trigger: 'blur' }],
|
||||||
|
discountId: [{ required: true, message: '请选择会员类型', trigger: 'change' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
function addVipUser() {
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref(null)
|
||||||
|
async function sureAdd() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
|
giveUserDiscount(form.value).then((response) => {
|
||||||
|
if (response) {
|
||||||
|
message.success('赠送成功')
|
||||||
|
showDialog.value = false
|
||||||
|
searchList()
|
||||||
|
} else {
|
||||||
|
message.error('赠送失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
286
src/views/XjApplet/Vip/components/VipDiscount.vue
Normal file
286
src/views/XjApplet/Vip/components/VipDiscount.vue
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row>
|
||||||
|
<el-button @click="searchList" v-hasPermi="['xj-applet:vip:vip-discount:search']"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="addDiscount" v-hasPermi="['xj-applet:vip:vip-discount:add']"
|
||||||
|
>新增折扣</el-button
|
||||||
|
>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="tableList">
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="折扣描述" align="center" prop="description" min-width="140" />
|
||||||
|
<el-table-column label="折扣价" align="center" prop="discount" />
|
||||||
|
<el-table-column label="有效期" align="center" prop="duration" />
|
||||||
|
<el-table-column label="单位" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.unit == 1">天</el-tag>
|
||||||
|
<el-tag v-else type="danger">年</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="editDiscount(row)"
|
||||||
|
v-hasPermi="['xj-applet:vip:vip-discount:update']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="deleteDiscount(row)"
|
||||||
|
v-hasPermi="['xj-applet:vip:vip-discount:delete']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="searchForm.pageNo"
|
||||||
|
v-model:limit="searchForm.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog title="折扣详情" v-model="showDialog" width="500px" :close-on-click-modal="false">
|
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="折扣类型" prop="discountType">
|
||||||
|
<el-select v-model="form.discountType" style="width: 100%" :disabled="!!form.id">
|
||||||
|
<el-option
|
||||||
|
v-for="item in discountTypeOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="折扣描述">
|
||||||
|
{{ discountDesc }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.discountType == 1" label="科目" prop="subject">
|
||||||
|
<el-select v-model="form.subject" style="width: 100%" :disabled="!!form.id">
|
||||||
|
<el-option
|
||||||
|
v-for="item in subjectOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="变量1" prop="param1">
|
||||||
|
<el-select v-model="form.param1" style="width: 100%" clearable :disabled="!!form.id">
|
||||||
|
<el-option
|
||||||
|
v-for="item in vipTypeOptions"
|
||||||
|
:key="item.memberId"
|
||||||
|
:label="item.memberName"
|
||||||
|
:value="item.memberId"
|
||||||
|
>
|
||||||
|
<span style="float: left">{{ item.memberName }}</span>
|
||||||
|
<span style="float: right; color: #aaa">{{ item.carName }}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="变量2" prop="param2">
|
||||||
|
<el-select v-model="form.param2" style="width: 100%" :disabled="!!form.id">
|
||||||
|
<el-option
|
||||||
|
v-for="item in vipTypeOptions"
|
||||||
|
:key="item.memberId"
|
||||||
|
:label="item.memberName"
|
||||||
|
:value="item.memberId"
|
||||||
|
>
|
||||||
|
<span style="float: left">{{ item.memberName }}</span>
|
||||||
|
<span style="float: right; color: #aaa">{{ item.carName }}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="折扣价" prop="discount">
|
||||||
|
<el-input v-model="form.discount" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="有效期" prop="duration">
|
||||||
|
<el-input v-model="form.duration" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单位" prop="unit">
|
||||||
|
<el-radio-group v-model="form.unit">
|
||||||
|
<el-radio v-for="(item, index) in unitOptions" :key="index" :label="item.value">{{
|
||||||
|
item.label
|
||||||
|
}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span>
|
||||||
|
<el-button @click="showDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="VipDiscount">
|
||||||
|
import {
|
||||||
|
getVipDiscountList,
|
||||||
|
addVipDiscount,
|
||||||
|
updateVipDiscount,
|
||||||
|
deleteVipDiscount
|
||||||
|
} from '@/api/xjapplet/discount'
|
||||||
|
|
||||||
|
import { getVipTypeOptions } from '@/api/xjapplet/vip'
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
|
||||||
|
const searchForm = ref({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 50
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
searchList()
|
||||||
|
|
||||||
|
getVipTypeOptions().then((response) => {
|
||||||
|
vipTypeOptions.value = response
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
|
const discountTypeOptions = [
|
||||||
|
{
|
||||||
|
label: '【$科目】模考首次通过后,在拥有【$会员名1】的情况下,购买【$会员名2】,享折扣价',
|
||||||
|
value: '1'
|
||||||
|
},
|
||||||
|
{ label: '之前拥有过【$会员名1】,购买【$会员名2】,享折扣价', value: '2' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const subjectOptions = [
|
||||||
|
{ label: '科一', value: '1' },
|
||||||
|
{ label: '科四', value: '4' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const unitOptions = [
|
||||||
|
{ label: '天', value: '1' },
|
||||||
|
{ label: '年', value: '3' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const discountDesc = computed(() => {
|
||||||
|
const vipTypeObj = {}
|
||||||
|
vipTypeOptions.value.forEach((item) => {
|
||||||
|
vipTypeObj[item.memberId] = `${item.memberName}(${item.carName})`
|
||||||
|
})
|
||||||
|
const { discountType, subject, param1, param2, discount, duration, unit } = form.value
|
||||||
|
let baseStr = discountTypeOptions.find((item) => item.value == discountType).label
|
||||||
|
const vip1 = param1 ? vipTypeObj[param1] : '无需会员'
|
||||||
|
const vip2 = param2 ? vipTypeObj[param2] : '会员名2'
|
||||||
|
return baseStr
|
||||||
|
.replace('$科目', subjectOptions.find((item) => item.value == subject).label)
|
||||||
|
.replace('$会员名1', vip1)
|
||||||
|
.replace('$会员名2', vip2)
|
||||||
|
.concat(
|
||||||
|
`${discount || ''},有效期${duration || 0}${
|
||||||
|
unitOptions.find((item) => item.value == unit).label
|
||||||
|
}`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
|
||||||
|
const vipTypeOptions = ref([])
|
||||||
|
function searchList() {
|
||||||
|
searchForm.value.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
getVipDiscountList(searchForm.value).then((response) => {
|
||||||
|
tableList.value = response.list
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const form = ref({
|
||||||
|
discountType: '1',
|
||||||
|
subject: '1',
|
||||||
|
param1: undefined,
|
||||||
|
param2: undefined,
|
||||||
|
discount: undefined,
|
||||||
|
duration: undefined,
|
||||||
|
unit: '1',
|
||||||
|
description: undefined
|
||||||
|
})
|
||||||
|
const rules = ref({
|
||||||
|
param2: [{ required: true, message: '请选择变量2', trigger: 'change' }],
|
||||||
|
discount: [{ required: true, message: '请输入折扣价', trigger: 'blur' }],
|
||||||
|
duration: [{ required: true, message: '请输入有效期', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
function addDiscount() {
|
||||||
|
showDialog.value = true
|
||||||
|
form.value = {
|
||||||
|
discountType: '1',
|
||||||
|
subject: '1',
|
||||||
|
param1: undefined,
|
||||||
|
param2: undefined,
|
||||||
|
discount: undefined,
|
||||||
|
duration: undefined,
|
||||||
|
unit: '1',
|
||||||
|
description: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function editDiscount(row) {
|
||||||
|
form.value = {
|
||||||
|
...row,
|
||||||
|
param1: row.param1 ? Number(row.param1) : undefined,
|
||||||
|
param2: row.param2 ? Number(row.param2) : undefined
|
||||||
|
}
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteDiscount(row) {
|
||||||
|
message.confirm('确定删除该折扣?').then(() => {
|
||||||
|
deleteVipDiscount(row.id).then(() => {
|
||||||
|
message.success('删除成功')
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref(null)
|
||||||
|
async function sureAdd() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
form.value.description = discountDesc.value
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
|
if (form.value.id) {
|
||||||
|
updateVipDiscount(form.value).then(() => {
|
||||||
|
showDialog.value = false
|
||||||
|
message.success('修改成功')
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addVipDiscount(form.value).then(() => {
|
||||||
|
showDialog.value = false
|
||||||
|
message.success('新增成功')
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
217
src/views/XjApplet/Vip/components/VipType.vue
Normal file
217
src/views/XjApplet/Vip/components/VipType.vue
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form :model="searchForm" inline @submit.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="searchForm.memberName" placeholder="会员名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio-group v-model="searchForm.carTypeId" @change="searchList">
|
||||||
|
<el-radio label="1001">小车</el-radio>
|
||||||
|
<el-radio label="1002">摩托车</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="searchList" v-hasPermi="['xj-applet:vip:vip-type:search']"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="addVip" v-hasPermi="['xj-applet:vip:vip-type:add']"
|
||||||
|
>新增会员类型</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="tableList" height="calc(100vh - 260px)">
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="会员名" align="center" prop="memberName" min-width="140" />
|
||||||
|
<el-table-column label="车型" align="center" prop="carName" />
|
||||||
|
<el-table-column label="科目" align="center" prop="subjects" />
|
||||||
|
<el-table-column label="原价" align="center" prop="price" />
|
||||||
|
<el-table-column label="折扣价" align="center" prop="discount" />
|
||||||
|
<el-table-column label="有效期" align="center" prop="duration" />
|
||||||
|
<el-table-column label="单位" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.unit == 1">天</el-tag>
|
||||||
|
<el-tag v-else type="danger">年</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="使用方式" align="center" prop="useTypeName" />
|
||||||
|
<el-table-column label="操作" width="160">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="editVip(row)"
|
||||||
|
v-hasPermi="['xj-applet:vip:vip-type:update']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleDelete(row.memberId)"
|
||||||
|
v-hasPermi="['xj-applet:vip:vip-type:delete']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="searchForm.pageNo"
|
||||||
|
v-model:limit="searchForm.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog title="会员详情" v-model="showDialog" width="500px" :close-on-click-modal="false">
|
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="会员名称" prop="memberName">
|
||||||
|
<el-input v-model="form.memberName" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="车型" prop="carTypeId">
|
||||||
|
<el-select v-model="form.carTypeId" style="width: 100%">
|
||||||
|
<el-option label="小车" value="1001" />
|
||||||
|
<el-option label="摩托车" value="1002" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="科目" prop="subjects">
|
||||||
|
<el-select v-model="form.subjects" placeholder="多选" multiple style="width: 100%">
|
||||||
|
<el-option label="科一" value="4" />
|
||||||
|
<el-option label="科四" value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="原价" prop="price">
|
||||||
|
<el-input v-model="form.price" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="折扣价" prop="discount">
|
||||||
|
<el-input v-model="form.discount" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="有效期" prop="duration">
|
||||||
|
<el-input v-model="form.duration" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="单位" prop="unit">
|
||||||
|
<el-radio-group v-model="form.unit">
|
||||||
|
<el-radio :label="1">天</el-radio>
|
||||||
|
<el-radio :label="3">年</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用方式" prop="useTypes">
|
||||||
|
<el-checkbox-group v-model="form.useTypes">
|
||||||
|
<el-checkbox :label="1"> 用户购买 </el-checkbox>
|
||||||
|
<el-checkbox :label="2"> 客服赠送 </el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span>
|
||||||
|
<el-button @click="showDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="VipType">
|
||||||
|
import { getVipTypeList, addVipType, updateVipType, deleteVipType } from '@/api/xjapplet/vip'
|
||||||
|
const message = useMessage()
|
||||||
|
const searchForm = ref({
|
||||||
|
memberName: undefined,
|
||||||
|
carTypeId: '1001',
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 50
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
function searchList() {
|
||||||
|
searchForm.value.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
getVipTypeList(searchForm.value).then((response) => {
|
||||||
|
tableList.value = response.list
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const form = ref({
|
||||||
|
memberName: '',
|
||||||
|
carTypeId: undefined,
|
||||||
|
subjects: [],
|
||||||
|
price: '',
|
||||||
|
discount: '',
|
||||||
|
duration: '',
|
||||||
|
unit: 1,
|
||||||
|
useTypes: [1]
|
||||||
|
})
|
||||||
|
const rules = ref({
|
||||||
|
memberName: [{ required: true, message: '请输入会员名称', trigger: 'blur' }],
|
||||||
|
carTypeId: [{ required: true, message: '请输入车型', trigger: 'change' }],
|
||||||
|
subjects: [{ required: true, message: '请输入科目', trigger: 'blur' }],
|
||||||
|
price: [{ required: true, message: '请输入价格', trigger: 'blur' }],
|
||||||
|
discount: [{ required: true, message: '请输入折扣价', trigger: 'blur' }],
|
||||||
|
duration: [{ required: true, message: '请输入有效期', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
function addVip() {
|
||||||
|
showDialog.value = true
|
||||||
|
|
||||||
|
form.value.carTypeId = {
|
||||||
|
memberName: '',
|
||||||
|
carTypeId: searchForm.value.carTypeId,
|
||||||
|
subjects: [],
|
||||||
|
price: '',
|
||||||
|
discount: '',
|
||||||
|
duration: '',
|
||||||
|
unit: 1,
|
||||||
|
useTypes: [1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function editVip(row) {
|
||||||
|
form.value = { ...row, subjects: row.subjects.split(','), unit: Number(row.unit) }
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref(null)
|
||||||
|
async function sureAdd() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
// 调用接口
|
||||||
|
if (form.value.memberId) {
|
||||||
|
updateVipType(form.value).then(() => {
|
||||||
|
message.success('修改成功')
|
||||||
|
showDialog.value = false
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addVipType(form.value).then(() => {
|
||||||
|
message.success('添加成功')
|
||||||
|
showDialog.value = false
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDelete(id) {
|
||||||
|
message.confirm('是否确认删除该会员?').then(() => {
|
||||||
|
deleteVipType(id).then(() => {
|
||||||
|
message.success('删除成功')
|
||||||
|
searchList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
159
src/views/XjApplet/Vip/components/VipUser.vue
Normal file
159
src/views/XjApplet/Vip/components/VipUser.vue
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form :model="searchForm" inline @submit.prevent>
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="searchForm.phone" placeholder="学员手机号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-radio-group v-model="searchForm.carTypeId" @change="changeCarType">
|
||||||
|
<el-radio label="1001">小车</el-radio>
|
||||||
|
<el-radio label="1002">摩托车</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item>
|
||||||
|
<el-select v-model="searchForm.memberId" placeholder="选择会员类型" clearable filterable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in vipOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="searchList" v-hasPermi="['xj-applet:vip:vip-user:search']"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="addVipUser" v-hasPermi="['xj-applet:vip:vip-user:send']"
|
||||||
|
>赠送会员</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="tableList" height="calc(100vh - 260px)">
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="手机号" align="left" prop="phone" min-width="140" />
|
||||||
|
<el-table-column label="会员名" align="left" prop="memberName" min-width="140" />
|
||||||
|
<el-table-column label="车型" align="left" min-width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.carTypeId == 1001 ? '小车' : '摩托车' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="科目" align="left" prop="subjects" min-width="100" />
|
||||||
|
<el-table-column label="来源" align="left" prop="useTypeName" min-width="100" />
|
||||||
|
<el-table-column label="截止日期" align="left" prop="endDate" min-width="120" />
|
||||||
|
<el-table-column label="操作人" align="left" prop="operUser" min-width="100" />
|
||||||
|
<el-table-column label="操作时间" align="left" prop="createTime" min-width="120" />
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="searchForm.pageNo"
|
||||||
|
v-model:limit="searchForm.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog title="赠送会员" v-model="showDialog" width="500px" :close-on-click-modal="false">
|
||||||
|
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="手机号" prop="phone">
|
||||||
|
<el-input v-model="form.phone" maxlength="11" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="会员类型" prop="memberId">
|
||||||
|
<el-select v-model="form.memberId" clearable filterable style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in vipOptions"
|
||||||
|
:key="item.memberId"
|
||||||
|
:label="item.memberName"
|
||||||
|
:value="item.memberId"
|
||||||
|
>
|
||||||
|
<span style="float: left">{{ item.memberName }}</span>
|
||||||
|
<span style="float: right; color: #aaa">{{ item.carName }}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<span>
|
||||||
|
<el-button @click="showDialog = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="sureAdd">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="VipUser">
|
||||||
|
import { getUserMemberList, giveUserMember, getVipTypeOptions } from '@/api/xjapplet/vip'
|
||||||
|
const message = useMessage()
|
||||||
|
const searchForm = ref({
|
||||||
|
carTypeId: '1001',
|
||||||
|
memberId: undefined,
|
||||||
|
phone: undefined,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 50
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableList = ref([])
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
|
const vipOptions = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
changeCarType()
|
||||||
|
})
|
||||||
|
|
||||||
|
function changeCarType() {
|
||||||
|
getVipTypeOptions({ carTypeId: searchForm.value.carTypeId }).then((response) => {
|
||||||
|
vipOptions.value = response
|
||||||
|
})
|
||||||
|
searchList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchList() {
|
||||||
|
searchForm.value.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
getUserMemberList(searchForm.value).then((response) => {
|
||||||
|
tableList.value = response.list
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const form = ref({
|
||||||
|
phone: '',
|
||||||
|
memberId: ''
|
||||||
|
})
|
||||||
|
const rules = ref({
|
||||||
|
phone: [{ required: true, message: '请输入用户手机号', trigger: 'blur' }],
|
||||||
|
memberId: [{ required: true, message: '请选择会员类型', trigger: 'change' }]
|
||||||
|
})
|
||||||
|
|
||||||
|
function addVipUser() {
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref(null)
|
||||||
|
async function sureAdd() {
|
||||||
|
if (!formRef.value) return
|
||||||
|
const valid = await formRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
giveUserMember(form.value).then((response) => {
|
||||||
|
if (response) {
|
||||||
|
message.success('赠送成功')
|
||||||
|
showDialog.value = false
|
||||||
|
searchList()
|
||||||
|
} else {
|
||||||
|
message.error('赠送失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
30
src/views/XjApplet/Vip/index.vue
Normal file
30
src/views/XjApplet/Vip/index.vue
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-tabs v-model="tabIndex">
|
||||||
|
<el-tab-pane label="会员用户" :name="1" v-if="checkPermi(['xj-applet:vip:vip-user'])">
|
||||||
|
<VipUser v-if="tabIndex == 1" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="会员类型" :name="2" v-if="checkPermi(['xj-applet:vip:vip-type'])">
|
||||||
|
<VipType v-if="tabIndex == 2" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="会员折扣" :name="3" v-if="checkPermi(['xj-applet:vip:vip-discount'])">
|
||||||
|
<VipDiscount v-if="tabIndex == 3" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="用户折扣" :name="4" v-if="checkPermi(['xj-applet:vip:user-discount'])">
|
||||||
|
<UserDiscount v-if="tabIndex == 4" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Vip">
|
||||||
|
import { checkPermi } from '@/utils/permission'
|
||||||
|
import UserDiscount from './components/UserDiscount.vue'
|
||||||
|
import VipDiscount from './components/VipDiscount.vue'
|
||||||
|
import VipType from './components/VipType.vue'
|
||||||
|
import VipUser from './components/VipUser.vue'
|
||||||
|
|
||||||
|
const tabIndex = ref(1)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
295
src/views/XjApplet/VipData/conponents/SecretData.vue
Normal file
295
src/views/XjApplet/VipData/conponents/SecretData.vue
Normal file
@@ -0,0 +1,295 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form inline label-width="68px" @submit.prevent>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-form-item label="车型" @change="searchMj">
|
||||||
|
<el-radio-group v-model="queryParams.carTypeId">
|
||||||
|
<el-radio label="1001">小车</el-radio>
|
||||||
|
<el-radio label="1002">摩托车</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="科目">
|
||||||
|
<el-radio-group v-model="queryParams.subject" @change="searchMj">
|
||||||
|
<el-radio label="1">科一</el-radio>
|
||||||
|
<el-radio label="4">科四</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div style="display: flex; padding: 10px; border: 1px solid #eee; height: calc(100vh - 80px)">
|
||||||
|
<div style="width: 300px; border-right: 1px solid #eee">
|
||||||
|
<div style="display: flex; justify-content: space-between; padding-right: 20px">
|
||||||
|
<div style="font-size: 18px; font-weight: bold">密卷</div>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="addMjItem"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:mj:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<el-radio-group
|
||||||
|
v-model="mjIndex"
|
||||||
|
style="width: 100%; display: block; margin-top: 20px"
|
||||||
|
@change="getQuestionList"
|
||||||
|
>
|
||||||
|
<el-radio v-for="(item, index) in mjList" :key="index" :label="index" class="flex-radio">
|
||||||
|
<div style="flex: 1; width: 100px">{{ getMjTitle(index) }}</div>
|
||||||
|
<div style="padding-right: 15px">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="removeMj(item)"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:mj:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="clearMjDetail(item)"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:mj:clear']"
|
||||||
|
>清空</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
<div style="flex: 1; padding-left: 20px; padding-right: 20px">
|
||||||
|
<div
|
||||||
|
v-if="mjList.length > 0"
|
||||||
|
style="display: flex; justify-content: space-between; align-items: center"
|
||||||
|
>
|
||||||
|
<div style="font-size: 20px; font-weight: bold">
|
||||||
|
当前密卷:{{ getMjTitle(mjIndex) }}
|
||||||
|
</div>
|
||||||
|
<div style="margin-left: 10px; margin-right: 10px"> 题目数:{{ tableList.length }} </div>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="addMjDetail"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:mj:add-question']"
|
||||||
|
>新增密卷试题</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableList"
|
||||||
|
style="margin-top: 10px"
|
||||||
|
max-height="calc(100vh - 280px)"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="题目" align="left" prop="question" min-width="140" />
|
||||||
|
<el-table-column label="选项" align="left" min-width="140">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<p v-if="row.chooseA">A:{{ row.chooseA }}</p>
|
||||||
|
<p v-if="row.chooseB">B:{{ row.chooseB }}</p>
|
||||||
|
<p v-if="row.chooseC">C:{{ row.chooseC }}</p>
|
||||||
|
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
|
||||||
|
<el-table-column label="科目" align="center" prop="subject" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.subject == '1'">科一</span>
|
||||||
|
<span v-if="row.subject == '4'">科四</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
||||||
|
<el-table-column label="图片" align="center" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-image
|
||||||
|
v-if="row.imageUrl"
|
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`"
|
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`]"
|
||||||
|
:lazy="true"
|
||||||
|
style="width: 80px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="100px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="takeoutMj(row)"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:mj:remove-question']"
|
||||||
|
>移出密卷</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-dialog v-model="showDialog" title="新增试题" width="80%">
|
||||||
|
<div style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<el-input v-model="quesName" placeholder="请输入题目" clearable @keyup.enter="searchQues" />
|
||||||
|
<el-button style="margin-left: 20px" type="primary" @click="searchQues">搜索</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="quesLit" highlight-current-row height="calc(100vh - 260px)">
|
||||||
|
<el-table-column label="题目" align="left" prop="question" min-width="140" />
|
||||||
|
<el-table-column label="选项" align="left" min-width="140">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<p v-if="row.chooseA">A:{{ row.chooseA }}</p>
|
||||||
|
<p v-if="row.chooseB">B:{{ row.chooseB }}</p>
|
||||||
|
<p v-if="row.chooseC">C:{{ row.chooseC }}</p>
|
||||||
|
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
|
||||||
|
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
||||||
|
<el-table-column label="图片" align="center" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-image
|
||||||
|
v-if="row.imageUrl"
|
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`"
|
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`]"
|
||||||
|
:lazy="true"
|
||||||
|
style="width: 80px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link @click="sureAddQues(row)">加入密卷</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="SimpleData">
|
||||||
|
import {
|
||||||
|
getMjList,
|
||||||
|
addMj,
|
||||||
|
delMj,
|
||||||
|
clearMj,
|
||||||
|
getMjQuestionList,
|
||||||
|
addMjQuestion,
|
||||||
|
delMjQuestion
|
||||||
|
} from '@/api/xjapplet/vipdatabase.js'
|
||||||
|
import { searchQuestion } from '@/api/xjapplet/xjdatabase.js'
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const queryParams = ref({
|
||||||
|
carTypeId: '1001',
|
||||||
|
subject: '1'
|
||||||
|
})
|
||||||
|
const mjIndex = ref(0)
|
||||||
|
const mjList = ref([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableList = ref([])
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const quesName = ref('')
|
||||||
|
const quesLit = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
searchMj()
|
||||||
|
})
|
||||||
|
|
||||||
|
function addMjItem() {
|
||||||
|
addMj(queryParams.value).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
searchMj()
|
||||||
|
message.success('添加成功')
|
||||||
|
} else {
|
||||||
|
message.error('添加失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function getMjTitle(idx) {
|
||||||
|
// const cjObj = {
|
||||||
|
// 1001: '小车',
|
||||||
|
// 1002: '摩托车'
|
||||||
|
// }
|
||||||
|
// const kmObj = {
|
||||||
|
// 1: '科一',
|
||||||
|
// 4: '科四'
|
||||||
|
// }
|
||||||
|
// return `${cjObj[queryParams.value.carTypeId]}${kmObj[queryParams.value.subject]}考前密卷 第${
|
||||||
|
// idx + 1
|
||||||
|
// }套`
|
||||||
|
return `考前密卷 第${idx + 1}套`
|
||||||
|
}
|
||||||
|
function removeMj(item) {
|
||||||
|
message
|
||||||
|
.confirm('是否确认删除密卷?')
|
||||||
|
.then(function () {
|
||||||
|
return delMj(item.secretId)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
searchMj()
|
||||||
|
message.success('删除成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
function clearMjDetail(item) {
|
||||||
|
message
|
||||||
|
.confirm('是否确认清空密卷题目?')
|
||||||
|
.then(function () {
|
||||||
|
return clearMj(item.secretId)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
getQuestionList()
|
||||||
|
message.success('清空题目成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
function searchMj() {
|
||||||
|
getMjList(queryParams.value).then((resp) => {
|
||||||
|
mjList.value = resp || []
|
||||||
|
if (mjList.value.length > 0) {
|
||||||
|
mjIndex.value = 0
|
||||||
|
getQuestionList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function addMjDetail() {
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
function searchQues() {
|
||||||
|
searchQuestion({
|
||||||
|
...queryParams.value,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
question: quesName.value
|
||||||
|
}).then((response) => {
|
||||||
|
quesLit.value = response.list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function takeoutMj(row) {
|
||||||
|
message
|
||||||
|
.confirm('是否确认将该题移出密卷?')
|
||||||
|
.then(function () {
|
||||||
|
return delMjQuestion(row.id)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
getQuestionList()
|
||||||
|
message.success('清空题目成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
function getQuestionList() {
|
||||||
|
getMjQuestionList({
|
||||||
|
secretId: mjList.value[mjIndex.value].secretId
|
||||||
|
}).then((resp) => {
|
||||||
|
tableList.value = resp
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function sureAddQues(row) {
|
||||||
|
addMjQuestion({
|
||||||
|
secretId: mjList.value[mjIndex.value].secretId,
|
||||||
|
subId: row.subId
|
||||||
|
})
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp) {
|
||||||
|
message.success('添加成功')
|
||||||
|
getQuestionList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
197
src/views/XjApplet/VipData/conponents/SimpleData.vue
Normal file
197
src/views/XjApplet/VipData/conponents/SimpleData.vue
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form inline label-width="68px" @submit.prevent>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-form-item label="车型">
|
||||||
|
<el-radio-group v-model="queryParams.carTypeId">
|
||||||
|
<el-radio label="1001">小车</el-radio>
|
||||||
|
<el-radio label="1002">摩托车</el-radio>
|
||||||
|
<!-- <el-radio label="B2">货车</el-radio> -->
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="科目">
|
||||||
|
<el-radio-group v-model="queryParams.subject">
|
||||||
|
<el-radio label="1">科一</el-radio>
|
||||||
|
<el-radio label="4">科四</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:jx:search']"
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getQuestionList()
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="addMjDetail" v-hasPermi="['xj-applet:vip-data:jx:add']">
|
||||||
|
新增精选试题
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="tableList" height="calc(100vh - 250px)">
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="题目" align="left" prop="question" min-width="140" />
|
||||||
|
<el-table-column label="选项" align="left" min-width="140">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<p v-if="row.chooseA">A:{{ row.chooseA }}</p>
|
||||||
|
<p v-if="row.chooseB">B:{{ row.chooseB }}</p>
|
||||||
|
<p v-if="row.chooseC">C:{{ row.chooseC }}</p>
|
||||||
|
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
|
||||||
|
<el-table-column label="科目" align="center" prop="subject" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.subject == '1'">科一</span>
|
||||||
|
<span v-if="row.subject == '4'">科四</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="图片" align="center" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-image
|
||||||
|
v-if="row.imageUrl"
|
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`"
|
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`]"
|
||||||
|
:lazy="true"
|
||||||
|
style="width: 80px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="100px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="takeoutMj(row)"
|
||||||
|
v-hasPermi="['xj-applet:vip-data:jx:remove']"
|
||||||
|
>
|
||||||
|
移出精选
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getQuestionList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-dialog v-model="showDialog" title="新增试题" width="80%">
|
||||||
|
<div style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<el-input v-model="quesName" placeholder="请输入题目" clearable @keyup.enter="searchQues" />
|
||||||
|
<el-button style="margin-left: 20px" type="primary" @click="searchQues">搜索</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="quesLit" highlight-current-row height="calc(100vh - 260px)">
|
||||||
|
<el-table-column label="题目" align="left" prop="question" min-width="140" />
|
||||||
|
<el-table-column label="选项" align="left" min-width="140">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<p v-if="row.chooseA">A:{{ row.chooseA }}</p>
|
||||||
|
<p v-if="row.chooseB">B:{{ row.chooseB }}</p>
|
||||||
|
<p v-if="row.chooseC">C:{{ row.chooseC }}</p>
|
||||||
|
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
|
||||||
|
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
||||||
|
<el-table-column label="图片" align="center" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-image
|
||||||
|
v-if="row.imageUrl"
|
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`"
|
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`]"
|
||||||
|
:lazy="true"
|
||||||
|
style="width: 80px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100px">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" link @click="sureAddQues(row)">加入精选</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="SimpleData">
|
||||||
|
import { getJxQuestionList, addJx, delJxData } from '@/api/xjapplet/vipdatabase.js'
|
||||||
|
import { searchQuestion } from '@/api/xjapplet/xjdatabase.js'
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const queryParams = ref({
|
||||||
|
carTypeId: '1001',
|
||||||
|
subject: '1',
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100
|
||||||
|
})
|
||||||
|
|
||||||
|
const total = ref(0)
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const tableList = ref([])
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const quesName = ref('')
|
||||||
|
const quesLit = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getQuestionList()
|
||||||
|
})
|
||||||
|
function addMjDetail() {
|
||||||
|
showDialog.value = true
|
||||||
|
}
|
||||||
|
function searchQues() {
|
||||||
|
searchQuestion({
|
||||||
|
...queryParams.value,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
question: quesName.value
|
||||||
|
}).then((response) => {
|
||||||
|
quesLit.value = response.list
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function takeoutMj(row) {
|
||||||
|
message
|
||||||
|
.confirm('是否确认将该题移出精选?')
|
||||||
|
.then(function () {
|
||||||
|
return delJxData(row.id)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
getQuestionList()
|
||||||
|
message.success('清空题目成功')
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
function getQuestionList() {
|
||||||
|
getJxQuestionList(queryParams.value).then((resp) => {
|
||||||
|
tableList.value = resp.list
|
||||||
|
total.value = resp.total
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function sureAddQues(row) {
|
||||||
|
addJx({
|
||||||
|
questionId: row.questionId,
|
||||||
|
carTypeId: queryParams.value.carTypeId,
|
||||||
|
subject: queryParams.value.subject
|
||||||
|
})
|
||||||
|
.then((resp) => {
|
||||||
|
if (resp) {
|
||||||
|
message.success('添加成功')
|
||||||
|
getQuestionList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
20
src/views/XjApplet/VipData/index.vue
Normal file
20
src/views/XjApplet/VipData/index.vue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<el-tabs v-model="tabIndex">
|
||||||
|
<el-tab-pane label="精选题" :name="1" v-if="checkPermi(['xj-applet:vip-data:jx'])">
|
||||||
|
<SimpleData v-if="tabIndex == 1" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="密卷" :name="2" v-if="checkPermi(['xj-applet:vip-data:mj'])">
|
||||||
|
<SecretData v-if="tabIndex == 2" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="VipData">
|
||||||
|
import { checkPermi } from '@/utils/permission'
|
||||||
|
import SimpleData from './conponents/SimpleData.vue'
|
||||||
|
import SecretData from './conponents/SecretData.vue'
|
||||||
|
|
||||||
|
const tabIndex = ref(1)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
341
src/views/XjApplet/XjDatabase/Components/QuestionAddForm.vue
Normal file
341
src/views/XjApplet/XjDatabase/Components/QuestionAddForm.vue
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="试题"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
append-to-body
|
||||||
|
v-model="visible"
|
||||||
|
width="900px"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<el-form
|
||||||
|
ref="dialogFormRef"
|
||||||
|
:model="dialogForm"
|
||||||
|
:rules="dataRule"
|
||||||
|
label-width="auto"
|
||||||
|
label-position="right"
|
||||||
|
@keyup.enter="dialogFormSubmit()"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="题目" prop="question">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.question"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入题目"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="题目关键字" prop="titleWords">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.titleWords"
|
||||||
|
maxlength="1000"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="专项" prop="categoryTitle">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.categoryTitle"
|
||||||
|
maxlength="1000"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="章节" prop="chapter">
|
||||||
|
<el-select v-model="dialogForm.chapter" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in chapterOptions"
|
||||||
|
:key="dict.chapterId"
|
||||||
|
:label="dict.chapterName"
|
||||||
|
:value="dict.chapterId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="题型" prop="type">
|
||||||
|
<el-radio-group v-model="dialogForm.type">
|
||||||
|
<el-radio label="1">判断题</el-radio>
|
||||||
|
<el-radio label="2">单选题</el-radio>
|
||||||
|
<el-radio label="3">多选题</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="排序" prop="showOrder">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.showOrder"
|
||||||
|
maxlength="20"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选项A" prop="chooseA">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.chooseA"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选项B" prop="chooseB">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.chooseB"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选项C" prop="chooseC">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.chooseC"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="选项D" prop="chooseD">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.chooseD"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="答案" prop="trueAnswer">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.trueAnswer"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="难点分析" prop="bestAnswer">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.bestAnswer"
|
||||||
|
maxlength="1000"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="答题技巧" prop="skillInfo">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.skillInfo"
|
||||||
|
maxlength="1000"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="技巧关键字" prop="skillWords">
|
||||||
|
<el-input
|
||||||
|
v-model="dialogForm.skillWords"
|
||||||
|
maxlength="1000"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="车型" prop="carTypeId">
|
||||||
|
<span v-if="dialogForm.carTypeId == '1001'">小车</span>
|
||||||
|
<span v-if="dialogForm.carTypeId == '1002'">摩托车</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="科目" prop="subject">
|
||||||
|
<span v-if="dialogForm.subject == '1'">科一</span>
|
||||||
|
<span v-if="dialogForm.subject == '4'">科四</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-form-item label="题目图片" prop="imageUrl">
|
||||||
|
<el-upload
|
||||||
|
action="#"
|
||||||
|
accept=".png,.jpg,.jpeg,.gif"
|
||||||
|
:limit="1"
|
||||||
|
:http-request="handleImport"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
:show-file-list="false"
|
||||||
|
>
|
||||||
|
<img v-if="imgUrl" :src="imgUrl" style="width: 200px" />
|
||||||
|
<i v-else class="el-icon-plus"></i>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button plain @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()"
|
||||||
|
>确定</el-button
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="QuesAddForm">
|
||||||
|
import { addQuestion, updateQuestion, uploadFile } from '@/api/xjapplet/xjdatabase'
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const emit = defineEmits(['update'])
|
||||||
|
|
||||||
|
const visible = ref(false)
|
||||||
|
const canSubmit = ref(true)
|
||||||
|
const imgUrl = ref(undefined)
|
||||||
|
const chapterOptions = ref([])
|
||||||
|
const dialogForm = ref({
|
||||||
|
id: undefined,
|
||||||
|
showOrder: 0,
|
||||||
|
categoryTitle: undefined,
|
||||||
|
question: undefined,
|
||||||
|
bestAnswer: undefined,
|
||||||
|
chooseA: undefined,
|
||||||
|
chooseB: undefined,
|
||||||
|
chooseC: undefined,
|
||||||
|
chooseD: undefined,
|
||||||
|
imageUrl: undefined,
|
||||||
|
type: undefined,
|
||||||
|
trueAnswer: undefined,
|
||||||
|
carTypeId: undefined,
|
||||||
|
skillInfoPic: undefined
|
||||||
|
})
|
||||||
|
|
||||||
|
const dataRule = {
|
||||||
|
schoolName: [{ required: true, message: '驾校名称不能为空', trigger: 'blur' }],
|
||||||
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
|
||||||
|
const open = (info = undefined, opts) => {
|
||||||
|
visible.value = true
|
||||||
|
chapterOptions.value = opts
|
||||||
|
resetDialogForm()
|
||||||
|
if (info) {
|
||||||
|
dialogForm.value = { ...info, chapter: parseInt(info.chapter) }
|
||||||
|
if (dialogForm.value.imageUrl) {
|
||||||
|
imgUrl.value = 'https://ss-cloud.ahduima.com/xjxc/pic/' + dialogForm.value.imageUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open
|
||||||
|
})
|
||||||
|
|
||||||
|
const resetDialogForm = () => {
|
||||||
|
dialogForm.value = {
|
||||||
|
id: undefined,
|
||||||
|
showOrder: 0,
|
||||||
|
question: undefined,
|
||||||
|
bestAnswer: undefined,
|
||||||
|
chooseA: undefined,
|
||||||
|
chooseB: undefined,
|
||||||
|
chooseC: undefined,
|
||||||
|
chooseD: undefined,
|
||||||
|
imageUrl: undefined,
|
||||||
|
type: undefined,
|
||||||
|
trueAnswer: undefined,
|
||||||
|
carTypeId: undefined,
|
||||||
|
skillInfoPic: undefined,
|
||||||
|
skillInfo: undefined,
|
||||||
|
jqtp: undefined,
|
||||||
|
biaoji: undefined,
|
||||||
|
titleWords: undefined,
|
||||||
|
skillWords: undefined,
|
||||||
|
optaWords: undefined,
|
||||||
|
optbWords: undefined,
|
||||||
|
optcWords: undefined,
|
||||||
|
optdWords: undefined,
|
||||||
|
carTypeId: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const dialogFormRef = ref(null)
|
||||||
|
// 表单提交
|
||||||
|
const dialogFormSubmit = async () => {
|
||||||
|
if (!dialogFormRef.value) return
|
||||||
|
const valid = await dialogFormRef.value.validate()
|
||||||
|
if (!valid) return
|
||||||
|
|
||||||
|
if (dialogForm.value.questionId) {
|
||||||
|
updateQuestion(dialogForm.value).then((response) => {
|
||||||
|
if (response) {
|
||||||
|
message.success('修改成功')
|
||||||
|
emit('update')
|
||||||
|
visible.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addQuestion(dialogForm.value).then((response) => {
|
||||||
|
if (response) {
|
||||||
|
message.success('新增成功')
|
||||||
|
visible.value = false
|
||||||
|
emit('update')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleImport = (opt) => {
|
||||||
|
const data = new FormData()
|
||||||
|
data.append('file', opt.file)
|
||||||
|
uploadFile(data).then((resp) => {
|
||||||
|
if (resp.code == 200) {
|
||||||
|
message.success('文件上传成功')
|
||||||
|
dialogForm.value.imageUrl = resp.data
|
||||||
|
imgUrl.value = 'https://ss-cloud.ahduima.com/xjxc/pic/' + dialogForm.value.imageUrl
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const handleExceed = (files) => {
|
||||||
|
handleImport({ file: files[0] })
|
||||||
|
}
|
||||||
|
</script>
|
||||||
183
src/views/XjApplet/XjDatabase/index.vue
Normal file
183
src/views/XjApplet/XjDatabase/index.vue
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container" style="text-align: center">
|
||||||
|
<el-form :inline="true" label-width="68px" @submit.prevent>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-form-item label="车型">
|
||||||
|
<el-radio-group v-model="queryParams.carTypeId" @change="getQuestionChapter">
|
||||||
|
<el-radio label="1001">小车</el-radio>
|
||||||
|
<el-radio label="1002">摩托车</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="科目">
|
||||||
|
<el-radio-group v-model="queryParams.subject" @change="getQuestionChapter">
|
||||||
|
<el-radio label="1">科一</el-radio>
|
||||||
|
<el-radio label="4">科四</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="有图片">
|
||||||
|
<el-radio-group v-model="queryParams.isPic">
|
||||||
|
<el-radio :label="true">有</el-radio>
|
||||||
|
<el-radio :label="false">无</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-form-item label="题目">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.question"
|
||||||
|
placeholder="请输入题目"
|
||||||
|
clearable
|
||||||
|
style="width: 400px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="handleQuery"
|
||||||
|
v-hasPermi="['xj-applet:xj-database:search']"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="handleAdd" v-hasPermi="['xj-applet:xj-database:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableList"
|
||||||
|
highlight-current-row
|
||||||
|
max-height="calc(100vh - 260px)"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="55" align="center" />
|
||||||
|
<el-table-column label="题目" align="left" prop="question" min-width="140" />
|
||||||
|
<el-table-column label="选项" align="left" min-width="140">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<p v-if="row.chooseA">A:{{ row.chooseA }}</p>
|
||||||
|
<p v-if="row.chooseB">B:{{ row.chooseB }}</p>
|
||||||
|
<p v-if="row.chooseC">C:{{ row.chooseC }}</p>
|
||||||
|
<p v-if="row.chooseD">D:{{ row.chooseD }}</p>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="答案" align="center" prop="trueAnswer" width="100" />
|
||||||
|
<el-table-column label="科目" align="center" prop="subject" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span v-if="row.subject == '1'">科一</span>
|
||||||
|
<span v-if="row.subject == '4'">科四</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="章节" align="center" prop="chapterName" min-width="100" />
|
||||||
|
<el-table-column label="图片" align="center" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-image
|
||||||
|
v-if="row.imageUrl"
|
||||||
|
:src="`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`"
|
||||||
|
:preview-src-list="[`https://ss-cloud.ahduima.com/xjxc/pic/${row.imageUrl}`]"
|
||||||
|
:lazy="true"
|
||||||
|
style="width: 80px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleEdit(scope.row)"
|
||||||
|
v-hasPermi="['xj-applet:xj-database:edit']"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['xj-applet:xj-database:remove']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
<QuestionAddForm ref="dialogAddForm" @update="getList" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="XjDatabase">
|
||||||
|
import { searchQuestion, deleteQuestion, getQuestionSort } from '@/api/xjapplet/xjdatabase'
|
||||||
|
import QuestionAddForm from './components/QuestionAddForm.vue'
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const total = ref(0)
|
||||||
|
const tableList = ref([])
|
||||||
|
const queryParams = ref({
|
||||||
|
question: '',
|
||||||
|
carTypeId: '1001',
|
||||||
|
subject: '1',
|
||||||
|
isPic: undefined,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getQuestionChapter()
|
||||||
|
})
|
||||||
|
|
||||||
|
const chapterOptions = ref([])
|
||||||
|
const getQuestionChapter = () => {
|
||||||
|
getQuestionSort({
|
||||||
|
carTypeId: queryParams.value.carTypeId,
|
||||||
|
subject: queryParams.value.subject
|
||||||
|
}).then((data) => {
|
||||||
|
chapterOptions.value = data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getList() {
|
||||||
|
loading.value = true
|
||||||
|
searchQuestion(queryParams.value).then((response) => {
|
||||||
|
tableList.value = response.list
|
||||||
|
total.value = response.total
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleQuery() {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
const dialogAddForm = ref(null)
|
||||||
|
function handleEdit(item) {
|
||||||
|
dialogAddForm.value.open(item, chapterOptions.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
dialogAddForm.value.open(
|
||||||
|
{
|
||||||
|
subject: queryParams.value.subject,
|
||||||
|
carTypeId: queryParams.value.carTypeId
|
||||||
|
},
|
||||||
|
chapterOptions.value
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDelete(id) {
|
||||||
|
deleteQuestion(id).then(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
@@ -45,6 +45,18 @@ export default ({ command, mode }) => {
|
|||||||
ws: false,
|
ws: false,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(new RegExp(`^/crm-api`), '')
|
rewrite: (path) => path.replace(new RegExp(`^/crm-api`), '')
|
||||||
|
},
|
||||||
|
['/applet-api']: {
|
||||||
|
target: env.VITE_APPLET_URL,
|
||||||
|
ws: false,
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(new RegExp(`^/applet-api`), '')
|
||||||
|
},
|
||||||
|
['/tiku-api']: {
|
||||||
|
target: env.VITE_TIKU_URL,
|
||||||
|
ws: false,
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(new RegExp(`^/tiku-api`), '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user