generated from Leo_Ding/web-template
抽奖模块
This commit is contained in:
parent
65230a42e4
commit
29ec1c8c4b
14
src/apis/modules/companyProductOrders.js
Normal file
14
src/apis/modules/companyProductOrders.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/company-product-orders', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/company-product-orders/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/company-product-orders', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/company-product-orders/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/company-product-orders/${id}`)
|
||||
14
src/apis/modules/houseArticles.js
Normal file
14
src/apis/modules/houseArticles.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/house_articles', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/house_articles/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/house_articles', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/house_articles/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/house_articles/${id}`)
|
||||
14
src/apis/modules/houseProduct.js
Normal file
14
src/apis/modules/houseProduct.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/company-products', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/company-products/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/company-products', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/company-products/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/company-products/${id}`)
|
||||
14
src/apis/modules/productOrder.js
Normal file
14
src/apis/modules/productOrder.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/product-orders', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/product-orders/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/product-orders', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/product-orders/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/product-orders/${id}`)
|
||||
14
src/apis/modules/raffles.js
Normal file
14
src/apis/modules/raffles.js
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 区域模块接口
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
// 获取项目列表
|
||||
export const getProjectList = (params) => request.basic.get('/api/v1/raffles', params)
|
||||
// 获取单挑数据
|
||||
export const getItem = (id) => request.basic.get(`/api/v1/raffles/${id}`)
|
||||
// 添加条目
|
||||
export const createProject = (params) => request.basic.post('/api/v1/raffles', params)
|
||||
// 更新role
|
||||
export const updateItem = (id, params) => request.basic.put(`/api/v1/raffles/${id}`, params)
|
||||
// 删除数据
|
||||
export const delItem = (id) => request.basic.delete(`/api/v1/raffles/${id}`)
|
||||
@ -1,17 +1,9 @@
|
||||
<template>
|
||||
<div class="x-editor">
|
||||
<a-spin
|
||||
size="small"
|
||||
:spinning="spinning">
|
||||
<a-spin size="small" :spinning="spinning">
|
||||
<div class="x-editor__content">
|
||||
<tiny-editor
|
||||
v-model="content"
|
||||
v-bind="$attrs"
|
||||
api-key=""
|
||||
:init="opts"
|
||||
:disabled="disabled"
|
||||
:placeholder="placeholder"
|
||||
@init="onInit"></tiny-editor>
|
||||
<tiny-editor v-model="content" v-bind="$attrs" api-key="" :init="opts" :disabled="disabled"
|
||||
:placeholder="placeholder" @init="onInit"></tiny-editor>
|
||||
</div>
|
||||
</a-spin>
|
||||
</div>
|
||||
@ -56,6 +48,10 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
uploadHandler: {
|
||||
type: Function,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'ready'])
|
||||
@ -65,15 +61,40 @@ const content = ref('')
|
||||
const opts = deepMerge(
|
||||
{
|
||||
language: 'zh-Hans',
|
||||
height: 480,
|
||||
height: props.height,
|
||||
branding: false,
|
||||
resize: false,
|
||||
promotion: false,
|
||||
plugins: 'image', // 添加图片插件
|
||||
content_style: `
|
||||
* {margin: 0; padding: 0; hyphens: auto;text-rendering: optimizeLegibility;-webkit-font-smoothing: antialiased;}
|
||||
body {font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif}
|
||||
.mce-content-body {margin: 12px; font-size: 14px;}
|
||||
`,
|
||||
images_upload_handler: async (blobInfo, progress) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const file = blobInfo.blob();
|
||||
const imageUrl = await props.uploadHandler(file, progress);
|
||||
resolve(imageUrl);
|
||||
} catch (error) {
|
||||
reject('上传失败: ' + error.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
file_picker_callback: (callback, value, meta) => {
|
||||
// 模拟文件选择器
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('type', 'file');
|
||||
input.setAttribute('accept', 'image/*');
|
||||
|
||||
input.onchange = () => {
|
||||
const file = input.files[0];
|
||||
callback(URL.createObjectURL(file), { title: file.name });
|
||||
};
|
||||
|
||||
input.click();
|
||||
}
|
||||
},
|
||||
props.options
|
||||
)
|
||||
@ -89,6 +110,7 @@ watch(
|
||||
watch(
|
||||
() => content.value,
|
||||
(val) => {
|
||||
console.log(1111)
|
||||
emit('update:modelValue', val)
|
||||
onFieldChange()
|
||||
}
|
||||
@ -96,7 +118,7 @@ watch(
|
||||
|
||||
onMounted(() => {
|
||||
content.value = props.modelValue
|
||||
tinymce.init({})
|
||||
// tinymce.init({})
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@ -2,14 +2,14 @@
|
||||
<div class="clearfix">
|
||||
<a-upload list-type="picture-card" :multiple="multiple" v-model:file-list="fileList" @preview="handlePreview"
|
||||
@change="handleChange" :customRequest="handleCustomRequest" :beforeUpload="beforeUpload">
|
||||
<div v-if="fileList.length < fileNumber" >
|
||||
<div v-if="fileList.length < fileNumber">
|
||||
<plus-outlined />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
</div>
|
||||
</a-upload>
|
||||
<a-modal :open="previewVisible" :footer="null" @cancel="handleCancel">
|
||||
<img alt="example" v-if="fileType==='img'" style="width: 100%" :src="previewImage" />
|
||||
<video v-if="fileType==='video'" :src="previewImage" controls autoplay loop muted ></video>
|
||||
<img alt="example" v-if="fileType === 'img'" style="width: 100%" :src="previewImage" />
|
||||
<video v-if="fileType === 'video'" :src="previewImage" controls autoplay loop muted></video>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
@ -25,7 +25,7 @@ import apis from '@/apis'
|
||||
defineOptions({
|
||||
name: 'GxUpload',
|
||||
})
|
||||
const fileType=ref('img')
|
||||
const fileType = ref('img')
|
||||
const previewVisible = ref(false)
|
||||
const previewImage = ref('')
|
||||
const props = defineProps({
|
||||
@ -38,7 +38,7 @@ const props = defineProps({
|
||||
disabled: { type: Boolean, default: false },
|
||||
uploadText: { type: String },
|
||||
fileNumber: { type: Number, default: 6 },
|
||||
width: {
|
||||
width: {
|
||||
type: Number,
|
||||
default: 120,
|
||||
},
|
||||
@ -90,10 +90,10 @@ const getBase64 = (file) => {
|
||||
}
|
||||
const handlePreview = async (file) => {
|
||||
console.log(file.name)
|
||||
const list=['.avi','.mp4','.mov','.wmv','.mkv','.m4v']
|
||||
const fileSuffix=file.name.substring(file.name.lastIndexOf('.'))
|
||||
if(list.includes(fileSuffix)){
|
||||
fileType.value='video'
|
||||
const list = ['.avi', '.mp4', '.mov', '.wmv', '.mkv', '.m4v']
|
||||
const fileSuffix = file.name.substring(file.name.lastIndexOf('.'))
|
||||
if (list.includes(fileSuffix)) {
|
||||
fileType.value = 'video'
|
||||
}
|
||||
if (!file.url && !file.preview) {
|
||||
file.preview = await getBase64(file.originFileObj)
|
||||
@ -106,6 +106,9 @@ const handlePreview = async (file) => {
|
||||
|
||||
// 修改handleChange方法
|
||||
const handleChange = ({ file, fileList: updatedList }) => {
|
||||
console.log(111)
|
||||
console.log(file.status)
|
||||
console.log(updatedList)
|
||||
// 处理上传成功的情况
|
||||
if (file.status === 'done') {
|
||||
const response = file.response;
|
||||
@ -123,6 +126,12 @@ const handleChange = ({ file, fileList: updatedList }) => {
|
||||
.map(item => item.url);
|
||||
emit('update:modelValue', urls);
|
||||
}
|
||||
} else if (file.status === 'removed') {
|
||||
// 更新外部绑定值
|
||||
const urls = updatedList
|
||||
.filter(item => item.status === 'done')
|
||||
.map(item => item.url);
|
||||
emit('update:modelValue', urls);
|
||||
} else if (file.status === 'error') {
|
||||
message.error(`${file.name} 上传失败`);
|
||||
}
|
||||
|
||||
@ -19,8 +19,20 @@ const rightEnum = new EnumManager([
|
||||
{value: 'checking', name: '确认中'},
|
||||
{value: 'checked', name: '待使用'},
|
||||
]);
|
||||
// 创建权益类型
|
||||
const equiteEnum = new EnumManager([
|
||||
{value: 1, name: 'hotel'},
|
||||
{value:2,name:'parentchild'},
|
||||
{value:3,name:'jiazhuang'},
|
||||
{value:4,name:'life'},
|
||||
{value:5,name:'lvyou'},
|
||||
{value:6,name:'caizhai'},
|
||||
{value:7,name:'kangyang'},
|
||||
{value:8,name:'fangchan'},
|
||||
{value:9,name:'birth'},
|
||||
]);
|
||||
export {
|
||||
customersEnum,areaEnum,rightEnum
|
||||
customersEnum,areaEnum,rightEnum,equiteEnum
|
||||
|
||||
}
|
||||
// // 获取整个数组
|
||||
|
||||
@ -65,5 +65,21 @@ export default {
|
||||
erCodeList: '二维码列表',
|
||||
order:"权益订单",
|
||||
points:'积分列表',
|
||||
activity:'活动列表'
|
||||
activity:'活动列表',
|
||||
equite:'权益兑换',
|
||||
hotel:'酒店优惠',
|
||||
parentChild:'亲子礼遇',
|
||||
jiazhuang:'家装团购',
|
||||
life:'生活服务',
|
||||
lvyou:'旅游',
|
||||
caizhai:'采摘及拍卖',
|
||||
kangyang:'康养礼遇',
|
||||
fangchan:'房产礼遇',
|
||||
birth:'生日礼遇',
|
||||
productExChange:'产品兑换记录',
|
||||
houseProduct:'案场礼品',
|
||||
prizeDraw:'抽奖模块',
|
||||
lotteryRules:'抽奖规则',
|
||||
lotteryProduct:'抽奖产品',
|
||||
lotteryOrders:'抽奖记录',
|
||||
}
|
||||
|
||||
118
src/router/routes/equite.js
Normal file
118
src/router/routes/equite.js
Normal file
@ -0,0 +1,118 @@
|
||||
import { DollarOutlined } from '@ant-design/icons-vue'
|
||||
|
||||
export default [
|
||||
{
|
||||
path: 'equite',
|
||||
name: 'equite',
|
||||
component: 'RouteViewLayout',
|
||||
meta: {
|
||||
icon: DollarOutlined,
|
||||
title: '权益兑换',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'hotel',
|
||||
name: 'hotel',
|
||||
component: 'equite/hotel/index.vue',
|
||||
|
||||
meta: {
|
||||
title: '酒店优惠',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'parentChild',
|
||||
name: 'parentChild',
|
||||
component: 'equite/parentChild/index.vue',
|
||||
meta: {
|
||||
title: '亲子权益',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'jiazhuang',
|
||||
name: 'jiazhuang',
|
||||
component: 'equite/jiazhuang/index.vue',
|
||||
meta: {
|
||||
title: '家装团购',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'life',
|
||||
name: 'life',
|
||||
component: 'equite/life/index.vue',
|
||||
meta: {
|
||||
title: '生活服务',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'lvyou',
|
||||
name: 'lvyou',
|
||||
component: 'equite/lvyou/index.vue',
|
||||
meta: {
|
||||
title: '旅游待遇',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'caizhai',
|
||||
name: 'caizhai',
|
||||
component: 'equite/caizhai/index.vue',
|
||||
meta: {
|
||||
title: '采摘及拍卖',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'kangyang',
|
||||
name: 'kangyang',
|
||||
component: 'equite/kangyang/index.vue',
|
||||
meta: {
|
||||
title: '康养礼遇',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'fangchan',
|
||||
name: 'fangchan',
|
||||
component: 'equite/fangchan/index.vue',
|
||||
meta: {
|
||||
title: '房产礼遇',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'birth',
|
||||
name: 'birth',
|
||||
component: 'equite/birth/index.vue',
|
||||
meta: {
|
||||
title: '生日礼遇',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
@ -15,7 +15,8 @@ import regional from './regional'
|
||||
import announcement from './announcement'
|
||||
import order from './order'
|
||||
import activity from './activity'
|
||||
|
||||
import equite from './equite'
|
||||
import lottery from './lottery'
|
||||
export default [
|
||||
...home,
|
||||
...form,
|
||||
@ -33,5 +34,7 @@ export default [
|
||||
...regional,
|
||||
...announcement,
|
||||
...order,
|
||||
...activity
|
||||
...activity,
|
||||
...equite,
|
||||
...lottery
|
||||
]
|
||||
|
||||
53
src/router/routes/lottery.js
Normal file
53
src/router/routes/lottery.js
Normal file
@ -0,0 +1,53 @@
|
||||
import { DollarOutlined } from '@ant-design/icons-vue'
|
||||
|
||||
export default [
|
||||
{
|
||||
path: 'prizeDraw',
|
||||
name: 'prizeDraw',
|
||||
component: 'RouteViewLayout',
|
||||
meta: {
|
||||
icon: DollarOutlined,
|
||||
title: '抽奖模块',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'lotteryRules',
|
||||
name: 'lotteryRules',
|
||||
component: 'prizeDraw/lotteryRules/index.vue',
|
||||
|
||||
meta: {
|
||||
title: '抽奖规则',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'lotteryProduct',
|
||||
name: 'lotteryProduct',
|
||||
component: 'prizeDraw/lotteryProduct/index.vue',
|
||||
meta: {
|
||||
title: '抽奖产品',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'lotteryOrders',
|
||||
name: 'lotteryOrders',
|
||||
component: 'prizeDraw/lotteryOrders/index.vue',
|
||||
meta: {
|
||||
title: '抽奖记录',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
]
|
||||
@ -1,4 +1,4 @@
|
||||
import { AimOutlined} from '@ant-design/icons-vue'
|
||||
import { AimOutlined } from '@ant-design/icons-vue'
|
||||
|
||||
export default [
|
||||
{
|
||||
@ -25,6 +25,30 @@ export default [
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'houseProduct',
|
||||
name: 'houseProduct',
|
||||
component: 'regional/houseProduct/index.vue',
|
||||
|
||||
meta: {
|
||||
title: '案场产品',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'productExChange',
|
||||
name: 'productExChange',
|
||||
component: 'regional/productExChange/index.vue',
|
||||
meta: {
|
||||
title: '产品兑换记录',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
path: 'projectList',
|
||||
name: 'projectList',
|
||||
|
||||
200
src/views/equite/birth/index.vue
Normal file
200
src/views/equite/birth/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'birth',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('birth'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/caizhai/index.vue
Normal file
200
src/views/equite/caizhai/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'caizhai',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('caizhai'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/fangchan/index.vue
Normal file
200
src/views/equite/fangchan/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'fangchan',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('fangchan'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/hotel/index.vue
Normal file
200
src/views/equite/hotel/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'hotel',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('hotel'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/jiazhuang/index.vue
Normal file
200
src/views/equite/jiazhuang/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'jiazhuang',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('jiazhuang'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/kangyang/index.vue
Normal file
200
src/views/equite/kangyang/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'kangyang',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('kangyang'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/life/index.vue
Normal file
200
src/views/equite/life/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'life',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('life'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/lvyou/index.vue
Normal file
200
src/views/equite/lvyou/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'lvyou',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('lvyou'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
200
src/views/equite/parentChild/index.vue
Normal file
200
src/views/equite/parentChild/index.vue
Normal file
@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'expireAt'">
|
||||
<span>{{ dayjs(record.expireAt).format('YYYY-MM-DD HH:mm') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'status'">
|
||||
<a-tag color="green" v-if="record.status === 'success'">已核销</a-tag>
|
||||
<a-tag v-if="record.status === 'checked'">待核销</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button v-if="record.status==='checked'" @click="checkHandler(record)">
|
||||
<a-tooltip>
|
||||
<template #title>核销</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { equiteEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'parentChild',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '联系人电话', dataIndex: 'conCatPhone' },
|
||||
{ title: '联系人姓名', dataIndex: 'concatName' },
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 150, align: 'center' },
|
||||
{ title: '过期时间', dataIndex: 'expireAt', width: 150, align: 'center' },
|
||||
{ title: '状态', dataIndex: 'status', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.productOrder
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
channel: 'product',
|
||||
productId: equiteEnum.getValue('parentchild'),
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
/**核销 */
|
||||
const checkHandler = (record) => {
|
||||
Modal.confirm({
|
||||
title: '即将核销是否继续',
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk:async () => {
|
||||
const params = {
|
||||
...record,
|
||||
status: 'success'
|
||||
}
|
||||
const { success } = await apis.productOrder.updateItem(params.id, params).catch(() => {
|
||||
// throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
// resolve()
|
||||
message.success('核销成功')
|
||||
await getPageList()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.productOrder.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
612
src/views/prizeDraw/lotteryOrders/components/EditDialog.vue
Normal file
612
src/views/prizeDraw/lotteryOrders/components/EditDialog.vue
Normal file
@ -0,0 +1,612 @@
|
||||
<template>
|
||||
<a-modal :open="modal.open" :title="modal.title" :width="800" :confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||
<a-spin :spinning="spining">
|
||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-8-2">
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane key="1" tab="基本信息">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘名称'" name="name">
|
||||
<a-input :placeholder="'请输入楼盘名称'" v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘地址'" name="address">
|
||||
<a-input :placeholder="'请输入楼盘地址'" v-model:value="formData.address"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'主力户型'" name="masterType">
|
||||
<a-input :placeholder="'请输入主力户型'" v-model:value="formData.masterType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'开盘时间'" name="openAt">
|
||||
<a-input :placeholder="'请输入开盘时间'" v-model:value="formData.openAt"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘均价'" name="price">
|
||||
<a-input :placeholder="'请输入均价'" v-model:value="formData.price"
|
||||
style="width:100%"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘类型'" name="type">
|
||||
<a-input :placeholder="'请输入楼盘类型'" v-model:value="formData.type"
|
||||
style="width:100%"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'待售状态'" name="daiShowStatus">
|
||||
<a-input :placeholder="'请输入待售状态'" v-model:value="formData.daiShowStatus"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'所属区域'" name="areaId">
|
||||
<a-select ref="select" v-model:value="formData.areaId">
|
||||
<a-select-option v-for="item in areaEnum.getAll()" :value="item.value">{{
|
||||
item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘特点'" name="title">
|
||||
<a-input :placeholder="'请输入楼盘特点'" v-model:value="formData.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘经度'" name="longitude">
|
||||
<a-input-number :placeholder="'请输入经度'" style="width: 100%;" :precision="2"
|
||||
v-model:value="formData.longitude"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘纬度'" name="latitude">
|
||||
<a-input-number :placeholder="'请输入纬度'" style="width: 100%;" :precision="2"
|
||||
v-model:value="formData.latitude"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'展厅地址'" name="showAddress">
|
||||
<a-input :placeholder="'请输入展厅地址'"
|
||||
v-model:value="formData.showAddress"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'楼盘标签'" name="labels">
|
||||
<div
|
||||
style="display: flex;justify-content: space-around;gap:5px 20px;flex-wrap: wrap;">
|
||||
<div v-for="(item, index) in formData.labels" :key="index"
|
||||
style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;flex: 1; min-width: calc(50% - 10px);">
|
||||
<a-input :placeholder="'请输入标签'" :value="item"
|
||||
@change="(e) => updateLabel(index, e.target.value)">
|
||||
</a-input>
|
||||
<div
|
||||
style="width: 50px;display: flex;justify-content: flex-end;align-items: center;">
|
||||
<a-button v-if="index === formData.labels.length - 1" type="primary"
|
||||
:icon="h(PlusOutlined)" @click="addLabel" />
|
||||
<a-button v-else danger :icon="h(MinusOutlined)"
|
||||
@click="removeLabel(index)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘图片'">
|
||||
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp"
|
||||
:fileNumber="20" @uploadSuccess="uploadSuccess" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘视频'">
|
||||
<gx-upload v-model="formData.videos" accept-types=".avi,.mp4,.mov,.wmv,.mkv,.m4v"
|
||||
:fileNumber="20" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="户型信息">
|
||||
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
|
||||
<a-button type="primary" @click="addLayout">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
户型
|
||||
</a-button>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
|
||||
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
|
||||
v-for="(child, index) of formData.layOuts" :key="index">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'标题'" name="title">
|
||||
<a-input :placeholder="'请输入标题'" v-model:value="child.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'单价'">
|
||||
<a-input :placeholder="'请输入单价'" v-model:value="child.price"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'朝向'" name="direction">
|
||||
<a-input :placeholder="'请输入朝向'" v-model:value="child.direction"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'面积'" name="area">
|
||||
<a-input :placeholder="'请输入建筑面积'" v-model:value="child.area"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'图片'">
|
||||
<gx-upload v-model="child.layImgList" accept-types=".jpg,.png,.webp"
|
||||
:fileNumber="1" @uploadSuccess="uploadSuccess" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template #actions>
|
||||
<a-button type="text" @click="delLayOut(index)">删 除</a-button>
|
||||
</template>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="楼盘周边">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'公交'" name="busNum">
|
||||
<a-input-number :placeholder="'请输入公交个数'" v-model:value="formData.busNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'医院'" name="hospitalNum">
|
||||
<a-input-number :placeholder="'请输入医院个数'" v-model:value="formData.hospitalNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'生活'" name="lifeNum">
|
||||
<a-input-number :placeholder="'请输入公交个数'" v-model:value="formData.lifeNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'地铁'" name="metroNum">
|
||||
<a-input-number :placeholder="'请输入地铁个数'" v-model:value="formData.metroNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'学校'" name="schoolNum">
|
||||
<a-input-number :placeholder="'请输入学校个数'" v-model:value="formData.schoolNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="楼盘顾问">
|
||||
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
|
||||
<a-button type="primary" @click="addAdviser">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
顾问
|
||||
</a-button>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
|
||||
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
|
||||
v-for="(child, index) of formData.advisers" :key="index">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'姓名'" name="adviserName">
|
||||
<a-input :placeholder="'请输入顾问姓名'"
|
||||
v-model:value="child.adviserName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'手机号'">
|
||||
<a-input :placeholder="'请输入手机号'"
|
||||
v-model:value="child.adviserPhone"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'头像'">
|
||||
<gx-upload v-model="child.adviserImg" accept-types=".jpg,.png,.webp"
|
||||
:fileNumber="1" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template #actions>
|
||||
<a-button type="text" @click="delLayOut(index)">删 除</a-button>
|
||||
</template>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" tab="销售信息">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘状态'" name="louPanStatus">
|
||||
<a-input :placeholder="'请输入楼盘状态'"
|
||||
v-model:value="formData.louPanStatus"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'产权年限'" name="duration">
|
||||
<a-input :placeholder="'请输入产权年限'" v-model:value="formData.duration"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'在售户型'" name="salesType">
|
||||
<a-input :placeholder="'请输入在售户型'" v-model:value="formData.salesType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'售楼地址'" name="salesAddress">
|
||||
<a-input :placeholder="'请输入售楼地址'"
|
||||
v-model:value="formData.salesAddress"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'售楼电话'" name="salesPhone">
|
||||
<a-input :placeholder="'请输入售楼电话'" v-model:value="formData.salesPhone"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="6" tab="小区概况">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'车位数量'" name="packingNum">
|
||||
<a-input :placeholder="'请输入车位数量'" v-model:value="formData.packingNum"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'总户数'" name="roomNum">
|
||||
<a-input :placeholder="'请输入总户数'" v-model:value="formData.roomNum"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'绿化率'" name="greeningRate">
|
||||
<a-input :placeholder="'请输入绿化率'"
|
||||
v-model:value="formData.greeningRate"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'车位比'" name="carRatio">
|
||||
<a-input :placeholder="'请输入车位比'"
|
||||
v-model:value="formData.carRatio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'容积率'" name="ratio">
|
||||
<a-input :placeholder="'请输入容积率'"
|
||||
v-model:value="formData.ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19009容积率'" name="r19009Ratio">
|
||||
<a-input :placeholder="'请输入R19009容积率'"
|
||||
v-model:value="formData.r19009Ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19010容积率'" name="r19009Ratio">
|
||||
<a-input :placeholder="'请输入R19010容积率'"
|
||||
v-model:value="formData.r19010Ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19011容积率'" name="r19011Ratio">
|
||||
<a-input :placeholder="'请输入R19011容积率'"
|
||||
v-model:value="formData.r19011Ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'物业类型'" name="propertyType">
|
||||
<a-input :placeholder="'请输入物业类型'"
|
||||
v-model:value="formData.propertyType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'物业公司'" name="propertyName">
|
||||
<a-input :placeholder="'请输入物业公司'"
|
||||
v-model:value="formData.propertyName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'物业费用'" name="propertyPrice">
|
||||
<a-input :placeholder="'请输入物业费用'"
|
||||
v-model:value="formData.propertyPrice"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
</a-card>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, h, onBeforeMount } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import apis from '@/apis'
|
||||
import { useForm, useModal, useSpining } from '@/hooks'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||
import dayjs from 'dayjs'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
import {spliceUrl} from "@/utils/util.js"
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||
const { spining, showSpining, hideSpining } = useSpining()
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const layImgList = []
|
||||
const activeKey = ref('1')
|
||||
formRules.value = {
|
||||
name: { required: true, message: '请输入楼盘名称' },
|
||||
address: { required: true, message: '请输入楼盘地址' },
|
||||
masterType: { required: true, message: '请输入主力户型' },
|
||||
openAt: { required: true, message: '请输入开盘时间' },
|
||||
price: { required: true, message: '请输入楼盘均价' },
|
||||
status: [{ required: true, message: '请输入状态' }],
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增楼盘',
|
||||
})
|
||||
// initData()
|
||||
formData.value.labels = ['', '']
|
||||
formData.value.areaId = 1
|
||||
formData.value.layOuts = [
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
]
|
||||
formData.value.advisers = [
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: '编辑楼盘',
|
||||
})
|
||||
try {
|
||||
showSpining()
|
||||
const { data, success } = await apis.house.getItem(record.id).catch()
|
||||
if (!success) {
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
formData.value = {
|
||||
id:data.id,
|
||||
address: data.address,
|
||||
areaId: data.areaId,//所属区域
|
||||
imgList: data.images?data.images.map(item => config('http.apiBasic') + item):[],
|
||||
labels: data.labels,
|
||||
latitude: data.latitude,
|
||||
longitude: data.longitude,
|
||||
masterType: data.masterType,
|
||||
name: data.name,
|
||||
openAt: data.openAt,
|
||||
price: data.price,
|
||||
status: data.status,
|
||||
|
||||
title: data.title,
|
||||
videos: data.videos? data.videos.map(item => config('http.apiBasic') + item):[],
|
||||
advisers: data.advisers?data.advisers.map(item=>({adviserName:item.name,adviserPhone:item.phone,adviserImg:item.avatar?[config('http.apiBasic')+item.avatar]:[]})):[{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },],
|
||||
address: data.detail.basicInfo.address,
|
||||
houseArea: data.detail.basicInfo.area,
|
||||
buildingarea: data.detail.basicInfo.buildingarea,
|
||||
showAddress: data.detail.basicInfo.showAddress,
|
||||
daiShowStatus:data.detail.basicInfo.status,
|
||||
type: data.detail.basicInfo.type,
|
||||
louPanStatus: data.detail.salesInfo.status,
|
||||
duration: data.detail.salesInfo.duration,
|
||||
salesType: data.detail.salesInfo.salesType,
|
||||
salesPhone: data.detail.salesInfo.salesPhone,
|
||||
salesAddress:data.detail.salesInfo.salesAddress,
|
||||
greeningRate: data.detail.communityInfo.greeningRate,
|
||||
packingNum: data.detail.communityInfo.packingNum,
|
||||
propertyName: data.detail.communityInfo.propertyName,
|
||||
propertyPrice: data.detail.communityInfo.propertyPrice,
|
||||
propertyType: data.detail.communityInfo.propertyType,
|
||||
r19009Ratio: data.detail.communityInfo.r19009Ratio,
|
||||
r19010Ratio: data.detail.communityInfo.r19010Ratio,
|
||||
r19011Ratio: data.detail.communityInfo.r19011Ratio,
|
||||
roomNum: data.detail.communityInfo.roomNum,
|
||||
carRatio:data.detail.communityInfo.carRatio,
|
||||
ratio:data.detail.communityInfo.ratio,
|
||||
layOuts: data.layOuts ? data.layOuts.map(item => ({ area: item.area, direction: item.direction, layImgList: item.img?[config('http.apiBasic') + item.img]:[], price: item.price, title: item.title })):[{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },],
|
||||
busNum: data.surroundings&&data.surroundings.busNum,
|
||||
hospitalNum: data.surroundings&&data.surroundings.hospitalNum,
|
||||
lifeNum: data.surroundings&&data.surroundings.lifeNum,
|
||||
metroNum: data.surroundings&&data.surroundings.metroNum,
|
||||
schoolNum: data.surroundings&&data.surroundings.schoolNum,
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideSpining()
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 确定
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value.validateFields().then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
console.log(formData.value)
|
||||
const params = {
|
||||
address: formData.value.address,
|
||||
areaId: formData.value.areaId,//所属区域
|
||||
cover: formData.value.imgList && spliceUrl(formData.value.imgList[0]),
|
||||
images: formData.value.imgList && formData.value.imgList.map(item=>spliceUrl(item)),
|
||||
labels: formData.value.labels,
|
||||
latitude: formData.value.latitude,
|
||||
longitude: formData.value.longitude,
|
||||
masterType: formData.value.masterType,
|
||||
name: formData.value.name,
|
||||
openAt: formData.value.openAt,
|
||||
price: formData.value.price,
|
||||
status: formData.value.status,
|
||||
title: formData.value.title,
|
||||
videos: formData.value.videos&&formData.value.videos.map(item=>spliceUrl(item)),
|
||||
advisers: formData.value.advisers&&formData.value.advisers.map(item=>({name:item.adviserName,phone:item.adviserPhone,avatar:item.adviserImg[0]&&spliceUrl(item.adviserImg[0])})),
|
||||
detail: {
|
||||
basicInfo: {
|
||||
address: formData.value.address,//楼盘地址
|
||||
area: formData.value.houseArea,//占地面积
|
||||
buildingarea: formData.value.buildingarea,//建筑面积
|
||||
masterType: formData.value.masterType,//主力户型
|
||||
status: formData.value.daiShowStatus,//待售状态
|
||||
showAddress: formData.value.showAddress,//展厅位置
|
||||
type: formData.value.type,//楼盘类型
|
||||
},
|
||||
salesInfo: {
|
||||
status: formData.value.louPanStatus,//楼盘状态
|
||||
duration: formData.value.duration,//产权年限
|
||||
salesType: formData.value.salesType,//在售户型
|
||||
salesAddress: formData.value.salesAddress,//售楼地址
|
||||
salesPhone: formData.value.salesPhone//售楼电话
|
||||
},
|
||||
communityInfo: {
|
||||
greeningRate: formData.value.greeningRate,
|
||||
packingNum: formData.value.packingNum,
|
||||
propertyName: formData.value.propertyName,
|
||||
propertyPrice: formData.value.propertyPrice,
|
||||
propertyType: formData.value.propertyType,
|
||||
r19009Ratio: formData.value.r19009Ratio,
|
||||
r19010Ratio: formData.value.r19010Ratio,
|
||||
r19011Ratio: formData.value.r19011Ratio,
|
||||
roomNum: formData.value.roomNum,
|
||||
carRatio:formData.value.carRatio,
|
||||
ratio:formData.value.ratio
|
||||
}
|
||||
},
|
||||
layOuts: formData.value.layOuts && formData.value.layOuts.map(item => ({ area: item.area, direction: item.direction, img: item.layImgList[0]&&spliceUrl(item.layImgList[0]), price: item.price, title: item.title })),
|
||||
surroundings: {
|
||||
busNum: formData.value.busNum,
|
||||
hospitalNum: formData.value.hospitalNum,
|
||||
lifeNum: formData.value.lifeNum,
|
||||
metroNum: formData.value.metroNum,
|
||||
schoolNum: formData.value.schoolNum,
|
||||
}
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
result = await apis.house.createProject(params).catch((error) => {
|
||||
console.log(error.message)
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
|
||||
result = await apis.house.updateItem(formData.value.id, params).catch(() => {
|
||||
console.log(error.message)
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
}
|
||||
hideLoading()
|
||||
if (config('http.code.success') === result?.success) {
|
||||
hideModal()
|
||||
emit('ok')
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideLoading()
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
// 在 setup 中添加这些方法
|
||||
const updateLabel = (index, value) => {
|
||||
formData.value.labels[index] = value;
|
||||
};
|
||||
|
||||
const addLabel = () => {
|
||||
formData.value.labels.push('');
|
||||
};
|
||||
|
||||
const removeLabel = (index) => {
|
||||
formData.value.labels.splice(index, 1);
|
||||
};
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
function handleCancel() {
|
||||
|
||||
hideModal()
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭后
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleEdit,
|
||||
})
|
||||
//新增户型
|
||||
const addLayout = () => {
|
||||
const params = { layImgList: [], area: '', price: '', direction: '', title: '' }
|
||||
formData.value.layOuts.push(params)
|
||||
}
|
||||
//新增顾问
|
||||
const addAdviser=()=>{
|
||||
const params={ adviserName: '', adviserPhone: '', adviserImg: [] }
|
||||
formData.value.advisers.push(params)
|
||||
}
|
||||
//删除户型
|
||||
const delLayOut = (index) => {
|
||||
formData.value.layOuts.splice(index, 1)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
187
src/views/prizeDraw/lotteryOrders/index.vue
Normal file
187
src/views/prizeDraw/lotteryOrders/index.vue
Normal file
@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
新增楼盘
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'price'">
|
||||
<span>{{ record.price+'(元/平)' }}</span>
|
||||
</template>
|
||||
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
defineOptions({
|
||||
name: 'lotteryOrders',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '楼盘名称', dataIndex: 'name' },
|
||||
{ title: '主力户型', dataIndex: 'masterType', width: 120, align: 'center' },
|
||||
{ title: '开盘时间', dataIndex: 'openAt', width: 100, align: 'center' },
|
||||
{ title: '楼盘地址', dataIndex: 'address', align: 'center',ellipsis: true, },
|
||||
{ title: '楼盘均价', dataIndex: 'price', align: 'center', width: 110 },
|
||||
// { title: '待售状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.house
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.house.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
612
src/views/prizeDraw/lotteryProduct/components/EditDialog.vue
Normal file
612
src/views/prizeDraw/lotteryProduct/components/EditDialog.vue
Normal file
@ -0,0 +1,612 @@
|
||||
<template>
|
||||
<a-modal :open="modal.open" :title="modal.title" :width="800" :confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||
<a-spin :spinning="spining">
|
||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-8-2">
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane key="1" tab="基本信息">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘名称'" name="name">
|
||||
<a-input :placeholder="'请输入楼盘名称'" v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘地址'" name="address">
|
||||
<a-input :placeholder="'请输入楼盘地址'" v-model:value="formData.address"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'主力户型'" name="masterType">
|
||||
<a-input :placeholder="'请输入主力户型'" v-model:value="formData.masterType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'开盘时间'" name="openAt">
|
||||
<a-input :placeholder="'请输入开盘时间'" v-model:value="formData.openAt"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘均价'" name="price">
|
||||
<a-input :placeholder="'请输入均价'" v-model:value="formData.price"
|
||||
style="width:100%"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘类型'" name="type">
|
||||
<a-input :placeholder="'请输入楼盘类型'" v-model:value="formData.type"
|
||||
style="width:100%"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'待售状态'" name="daiShowStatus">
|
||||
<a-input :placeholder="'请输入待售状态'" v-model:value="formData.daiShowStatus"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'所属区域'" name="areaId">
|
||||
<a-select ref="select" v-model:value="formData.areaId">
|
||||
<a-select-option v-for="item in areaEnum.getAll()" :value="item.value">{{
|
||||
item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘特点'" name="title">
|
||||
<a-input :placeholder="'请输入楼盘特点'" v-model:value="formData.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘经度'" name="longitude">
|
||||
<a-input-number :placeholder="'请输入经度'" style="width: 100%;" :precision="2"
|
||||
v-model:value="formData.longitude"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘纬度'" name="latitude">
|
||||
<a-input-number :placeholder="'请输入纬度'" style="width: 100%;" :precision="2"
|
||||
v-model:value="formData.latitude"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'展厅地址'" name="showAddress">
|
||||
<a-input :placeholder="'请输入展厅地址'"
|
||||
v-model:value="formData.showAddress"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'楼盘标签'" name="labels">
|
||||
<div
|
||||
style="display: flex;justify-content: space-around;gap:5px 20px;flex-wrap: wrap;">
|
||||
<div v-for="(item, index) in formData.labels" :key="index"
|
||||
style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;flex: 1; min-width: calc(50% - 10px);">
|
||||
<a-input :placeholder="'请输入标签'" :value="item"
|
||||
@change="(e) => updateLabel(index, e.target.value)">
|
||||
</a-input>
|
||||
<div
|
||||
style="width: 50px;display: flex;justify-content: flex-end;align-items: center;">
|
||||
<a-button v-if="index === formData.labels.length - 1" type="primary"
|
||||
:icon="h(PlusOutlined)" @click="addLabel" />
|
||||
<a-button v-else danger :icon="h(MinusOutlined)"
|
||||
@click="removeLabel(index)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘图片'">
|
||||
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp"
|
||||
:fileNumber="20" @uploadSuccess="uploadSuccess" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘视频'">
|
||||
<gx-upload v-model="formData.videos" accept-types=".avi,.mp4,.mov,.wmv,.mkv,.m4v"
|
||||
:fileNumber="20" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="户型信息">
|
||||
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
|
||||
<a-button type="primary" @click="addLayout">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
户型
|
||||
</a-button>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
|
||||
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
|
||||
v-for="(child, index) of formData.layOuts" :key="index">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'标题'" name="title">
|
||||
<a-input :placeholder="'请输入标题'" v-model:value="child.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'单价'">
|
||||
<a-input :placeholder="'请输入单价'" v-model:value="child.price"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'朝向'" name="direction">
|
||||
<a-input :placeholder="'请输入朝向'" v-model:value="child.direction"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'面积'" name="area">
|
||||
<a-input :placeholder="'请输入建筑面积'" v-model:value="child.area"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'图片'">
|
||||
<gx-upload v-model="child.layImgList" accept-types=".jpg,.png,.webp"
|
||||
:fileNumber="1" @uploadSuccess="uploadSuccess" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template #actions>
|
||||
<a-button type="text" @click="delLayOut(index)">删 除</a-button>
|
||||
</template>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="楼盘周边">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'公交'" name="busNum">
|
||||
<a-input-number :placeholder="'请输入公交个数'" v-model:value="formData.busNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'医院'" name="hospitalNum">
|
||||
<a-input-number :placeholder="'请输入医院个数'" v-model:value="formData.hospitalNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'生活'" name="lifeNum">
|
||||
<a-input-number :placeholder="'请输入公交个数'" v-model:value="formData.lifeNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'地铁'" name="metroNum">
|
||||
<a-input-number :placeholder="'请输入地铁个数'" v-model:value="formData.metroNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'学校'" name="schoolNum">
|
||||
<a-input-number :placeholder="'请输入学校个数'" v-model:value="formData.schoolNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="楼盘顾问">
|
||||
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
|
||||
<a-button type="primary" @click="addAdviser">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
顾问
|
||||
</a-button>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
|
||||
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
|
||||
v-for="(child, index) of formData.advisers" :key="index">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'姓名'" name="adviserName">
|
||||
<a-input :placeholder="'请输入顾问姓名'"
|
||||
v-model:value="child.adviserName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'手机号'">
|
||||
<a-input :placeholder="'请输入手机号'"
|
||||
v-model:value="child.adviserPhone"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'头像'">
|
||||
<gx-upload v-model="child.adviserImg" accept-types=".jpg,.png,.webp"
|
||||
:fileNumber="1" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<template #actions>
|
||||
<a-button type="text" @click="delLayOut(index)">删 除</a-button>
|
||||
</template>
|
||||
</a-card>
|
||||
</div>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" tab="销售信息">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘状态'" name="louPanStatus">
|
||||
<a-input :placeholder="'请输入楼盘状态'"
|
||||
v-model:value="formData.louPanStatus"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'产权年限'" name="duration">
|
||||
<a-input :placeholder="'请输入产权年限'" v-model:value="formData.duration"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'在售户型'" name="salesType">
|
||||
<a-input :placeholder="'请输入在售户型'" v-model:value="formData.salesType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'售楼地址'" name="salesAddress">
|
||||
<a-input :placeholder="'请输入售楼地址'"
|
||||
v-model:value="formData.salesAddress"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'售楼电话'" name="salesPhone">
|
||||
<a-input :placeholder="'请输入售楼电话'" v-model:value="formData.salesPhone"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="6" tab="小区概况">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'车位数量'" name="packingNum">
|
||||
<a-input :placeholder="'请输入车位数量'" v-model:value="formData.packingNum"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'总户数'" name="roomNum">
|
||||
<a-input :placeholder="'请输入总户数'" v-model:value="formData.roomNum"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'绿化率'" name="greeningRate">
|
||||
<a-input :placeholder="'请输入绿化率'"
|
||||
v-model:value="formData.greeningRate"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'车位比'" name="carRatio">
|
||||
<a-input :placeholder="'请输入车位比'"
|
||||
v-model:value="formData.carRatio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'容积率'" name="ratio">
|
||||
<a-input :placeholder="'请输入容积率'"
|
||||
v-model:value="formData.ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19009容积率'" name="r19009Ratio">
|
||||
<a-input :placeholder="'请输入R19009容积率'"
|
||||
v-model:value="formData.r19009Ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19010容积率'" name="r19009Ratio">
|
||||
<a-input :placeholder="'请输入R19010容积率'"
|
||||
v-model:value="formData.r19010Ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19011容积率'" name="r19011Ratio">
|
||||
<a-input :placeholder="'请输入R19011容积率'"
|
||||
v-model:value="formData.r19011Ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'物业类型'" name="propertyType">
|
||||
<a-input :placeholder="'请输入物业类型'"
|
||||
v-model:value="formData.propertyType"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'物业公司'" name="propertyName">
|
||||
<a-input :placeholder="'请输入物业公司'"
|
||||
v-model:value="formData.propertyName"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'物业费用'" name="propertyPrice">
|
||||
<a-input :placeholder="'请输入物业费用'"
|
||||
v-model:value="formData.propertyPrice"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
</a-card>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, h, onBeforeMount } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import apis from '@/apis'
|
||||
import { useForm, useModal, useSpining } from '@/hooks'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||
import dayjs from 'dayjs'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
import {spliceUrl} from "@/utils/util.js"
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||
const { spining, showSpining, hideSpining } = useSpining()
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const layImgList = []
|
||||
const activeKey = ref('1')
|
||||
formRules.value = {
|
||||
name: { required: true, message: '请输入楼盘名称' },
|
||||
address: { required: true, message: '请输入楼盘地址' },
|
||||
masterType: { required: true, message: '请输入主力户型' },
|
||||
openAt: { required: true, message: '请输入开盘时间' },
|
||||
price: { required: true, message: '请输入楼盘均价' },
|
||||
status: [{ required: true, message: '请输入状态' }],
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增楼盘',
|
||||
})
|
||||
// initData()
|
||||
formData.value.labels = ['', '']
|
||||
formData.value.areaId = 1
|
||||
formData.value.layOuts = [
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
]
|
||||
formData.value.advisers = [
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: '编辑楼盘',
|
||||
})
|
||||
try {
|
||||
showSpining()
|
||||
const { data, success } = await apis.house.getItem(record.id).catch()
|
||||
if (!success) {
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
formData.value = {
|
||||
id:data.id,
|
||||
address: data.address,
|
||||
areaId: data.areaId,//所属区域
|
||||
imgList: data.images?data.images.map(item => config('http.apiBasic') + item):[],
|
||||
labels: data.labels,
|
||||
latitude: data.latitude,
|
||||
longitude: data.longitude,
|
||||
masterType: data.masterType,
|
||||
name: data.name,
|
||||
openAt: data.openAt,
|
||||
price: data.price,
|
||||
status: data.status,
|
||||
|
||||
title: data.title,
|
||||
videos: data.videos? data.videos.map(item => config('http.apiBasic') + item):[],
|
||||
advisers: data.advisers?data.advisers.map(item=>({adviserName:item.name,adviserPhone:item.phone,adviserImg:item.avatar?[config('http.apiBasic')+item.avatar]:[]})):[{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
{ adviserName: '', adviserPhone: '', adviserImg: [] },],
|
||||
address: data.detail.basicInfo.address,
|
||||
houseArea: data.detail.basicInfo.area,
|
||||
buildingarea: data.detail.basicInfo.buildingarea,
|
||||
showAddress: data.detail.basicInfo.showAddress,
|
||||
daiShowStatus:data.detail.basicInfo.status,
|
||||
type: data.detail.basicInfo.type,
|
||||
louPanStatus: data.detail.salesInfo.status,
|
||||
duration: data.detail.salesInfo.duration,
|
||||
salesType: data.detail.salesInfo.salesType,
|
||||
salesPhone: data.detail.salesInfo.salesPhone,
|
||||
salesAddress:data.detail.salesInfo.salesAddress,
|
||||
greeningRate: data.detail.communityInfo.greeningRate,
|
||||
packingNum: data.detail.communityInfo.packingNum,
|
||||
propertyName: data.detail.communityInfo.propertyName,
|
||||
propertyPrice: data.detail.communityInfo.propertyPrice,
|
||||
propertyType: data.detail.communityInfo.propertyType,
|
||||
r19009Ratio: data.detail.communityInfo.r19009Ratio,
|
||||
r19010Ratio: data.detail.communityInfo.r19010Ratio,
|
||||
r19011Ratio: data.detail.communityInfo.r19011Ratio,
|
||||
roomNum: data.detail.communityInfo.roomNum,
|
||||
carRatio:data.detail.communityInfo.carRatio,
|
||||
ratio:data.detail.communityInfo.ratio,
|
||||
layOuts: data.layOuts ? data.layOuts.map(item => ({ area: item.area, direction: item.direction, layImgList: item.img?[config('http.apiBasic') + item.img]:[], price: item.price, title: item.title })):[{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },],
|
||||
busNum: data.surroundings&&data.surroundings.busNum,
|
||||
hospitalNum: data.surroundings&&data.surroundings.hospitalNum,
|
||||
lifeNum: data.surroundings&&data.surroundings.lifeNum,
|
||||
metroNum: data.surroundings&&data.surroundings.metroNum,
|
||||
schoolNum: data.surroundings&&data.surroundings.schoolNum,
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideSpining()
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 确定
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value.validateFields().then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
console.log(formData.value)
|
||||
const params = {
|
||||
address: formData.value.address,
|
||||
areaId: formData.value.areaId,//所属区域
|
||||
cover: formData.value.imgList && spliceUrl(formData.value.imgList[0]),
|
||||
images: formData.value.imgList && formData.value.imgList.map(item=>spliceUrl(item)),
|
||||
labels: formData.value.labels,
|
||||
latitude: formData.value.latitude,
|
||||
longitude: formData.value.longitude,
|
||||
masterType: formData.value.masterType,
|
||||
name: formData.value.name,
|
||||
openAt: formData.value.openAt,
|
||||
price: formData.value.price,
|
||||
status: formData.value.status,
|
||||
title: formData.value.title,
|
||||
videos: formData.value.videos&&formData.value.videos.map(item=>spliceUrl(item)),
|
||||
advisers: formData.value.advisers&&formData.value.advisers.map(item=>({name:item.adviserName,phone:item.adviserPhone,avatar:item.adviserImg[0]&&spliceUrl(item.adviserImg[0])})),
|
||||
detail: {
|
||||
basicInfo: {
|
||||
address: formData.value.address,//楼盘地址
|
||||
area: formData.value.houseArea,//占地面积
|
||||
buildingarea: formData.value.buildingarea,//建筑面积
|
||||
masterType: formData.value.masterType,//主力户型
|
||||
status: formData.value.daiShowStatus,//待售状态
|
||||
showAddress: formData.value.showAddress,//展厅位置
|
||||
type: formData.value.type,//楼盘类型
|
||||
},
|
||||
salesInfo: {
|
||||
status: formData.value.louPanStatus,//楼盘状态
|
||||
duration: formData.value.duration,//产权年限
|
||||
salesType: formData.value.salesType,//在售户型
|
||||
salesAddress: formData.value.salesAddress,//售楼地址
|
||||
salesPhone: formData.value.salesPhone//售楼电话
|
||||
},
|
||||
communityInfo: {
|
||||
greeningRate: formData.value.greeningRate,
|
||||
packingNum: formData.value.packingNum,
|
||||
propertyName: formData.value.propertyName,
|
||||
propertyPrice: formData.value.propertyPrice,
|
||||
propertyType: formData.value.propertyType,
|
||||
r19009Ratio: formData.value.r19009Ratio,
|
||||
r19010Ratio: formData.value.r19010Ratio,
|
||||
r19011Ratio: formData.value.r19011Ratio,
|
||||
roomNum: formData.value.roomNum,
|
||||
carRatio:formData.value.carRatio,
|
||||
ratio:formData.value.ratio
|
||||
}
|
||||
},
|
||||
layOuts: formData.value.layOuts && formData.value.layOuts.map(item => ({ area: item.area, direction: item.direction, img: item.layImgList[0]&&spliceUrl(item.layImgList[0]), price: item.price, title: item.title })),
|
||||
surroundings: {
|
||||
busNum: formData.value.busNum,
|
||||
hospitalNum: formData.value.hospitalNum,
|
||||
lifeNum: formData.value.lifeNum,
|
||||
metroNum: formData.value.metroNum,
|
||||
schoolNum: formData.value.schoolNum,
|
||||
}
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
result = await apis.house.createProject(params).catch((error) => {
|
||||
console.log(error.message)
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
|
||||
result = await apis.house.updateItem(formData.value.id, params).catch(() => {
|
||||
console.log(error.message)
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
}
|
||||
hideLoading()
|
||||
if (config('http.code.success') === result?.success) {
|
||||
hideModal()
|
||||
emit('ok')
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideLoading()
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
// 在 setup 中添加这些方法
|
||||
const updateLabel = (index, value) => {
|
||||
formData.value.labels[index] = value;
|
||||
};
|
||||
|
||||
const addLabel = () => {
|
||||
formData.value.labels.push('');
|
||||
};
|
||||
|
||||
const removeLabel = (index) => {
|
||||
formData.value.labels.splice(index, 1);
|
||||
};
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
function handleCancel() {
|
||||
|
||||
hideModal()
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭后
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleEdit,
|
||||
})
|
||||
//新增户型
|
||||
const addLayout = () => {
|
||||
const params = { layImgList: [], area: '', price: '', direction: '', title: '' }
|
||||
formData.value.layOuts.push(params)
|
||||
}
|
||||
//新增顾问
|
||||
const addAdviser=()=>{
|
||||
const params={ adviserName: '', adviserPhone: '', adviserImg: [] }
|
||||
formData.value.advisers.push(params)
|
||||
}
|
||||
//删除户型
|
||||
const delLayOut = (index) => {
|
||||
formData.value.layOuts.splice(index, 1)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
187
src/views/prizeDraw/lotteryProduct/index.vue
Normal file
187
src/views/prizeDraw/lotteryProduct/index.vue
Normal file
@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
新增楼盘
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'price'">
|
||||
<span>{{ record.price+'(元/平)' }}</span>
|
||||
</template>
|
||||
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
defineOptions({
|
||||
name: 'lotteryProduct',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '楼盘名称', dataIndex: 'name' },
|
||||
{ title: '主力户型', dataIndex: 'masterType', width: 120, align: 'center' },
|
||||
{ title: '开盘时间', dataIndex: 'openAt', width: 100, align: 'center' },
|
||||
{ title: '楼盘地址', dataIndex: 'address', align: 'center',ellipsis: true, },
|
||||
{ title: '楼盘均价', dataIndex: 'price', align: 'center', width: 110 },
|
||||
// { title: '待售状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.house
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.house.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
292
src/views/prizeDraw/lotteryRules/components/EditDialog.vue
Normal file
292
src/views/prizeDraw/lotteryRules/components/EditDialog.vue
Normal file
@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<a-modal :open="modal.open" :title="modal.title" :width="800" :confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||
<a-spin :spinning="spining">
|
||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-8-2">
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane key="1" tab="基本信息">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'所属区域'" name="areaId">
|
||||
<a-select ref="select" v-model:value="formData.areaId">
|
||||
<a-select-option v-for="item in areaEnum.getAll()" :value="item.value">{{
|
||||
item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'规则名称'" name="title">
|
||||
<a-input :placeholder="'请输入规则名称'" v-model:value="formData.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'开始时间'" name="startAt">
|
||||
<a-date-picker :placeholder="'请选择开始时间'" v-model:value="formData.startAt"
|
||||
style="width: 100%;"></a-date-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'结束时间'" name="endAt">
|
||||
<a-date-picker :placeholder="'请选择结束时间'" v-model:value="formData.endAt"
|
||||
style="width: 100%;"></a-date-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'消耗积分'" name="price">
|
||||
<a-input-number :placeholder="'请输入消耗积分'" v-model:value="formData.price"
|
||||
style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'状态'" name="status">
|
||||
<a-radio-group v-model:value="formData.status" :options="[
|
||||
{ label: '启用', value: 'enabled' },
|
||||
{ label: '停用', value: 'disabled' },
|
||||
]"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'备注'" name="reason">
|
||||
<a-input :placeholder="'请输入备注'" v-model:value="formData.reason"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="规则设置">
|
||||
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
|
||||
<a-button type="primary" @click="addLayout">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
规则
|
||||
</a-button>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-around;gap:20px;flex-wrap: wrap;">
|
||||
<a-card hoverable style="flex: 1; min-width: calc(30% - 10px);"
|
||||
v-for="(child, index) of formData.roles" :key="index">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'每周几'" name="weekday">
|
||||
<a-select ref="select" v-model:value="formData.weekday">
|
||||
<a-select-option v-for="item in weekDays" :value="item.value">{{
|
||||
item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item :label="'开始时间'" name="startH">
|
||||
<a-select ref="select" v-model:value="formData.startH">
|
||||
<a-select-option v-for="item in hoursArray" :value="item">{{
|
||||
item }}</a-select-option>
|
||||
|
||||
</a-select>
|
||||
<a-select ref="select" v-model:value="formData.startM">
|
||||
<a-select-option v-for="item in minutesArray" :value="item">{{
|
||||
item }}</a-select-option>
|
||||
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item :label="'结束时间'" name="endTime">
|
||||
<a-select ref="select" v-model:value="formData.endH">
|
||||
<a-select-option v-for="item in hoursArray" :value="item">{{
|
||||
item }}</a-select-option>
|
||||
|
||||
</a-select>
|
||||
<a-select ref="select" v-model:value="formData.endM">
|
||||
<a-select-option v-for="item in minutesArray" :value="item">{{
|
||||
item }}</a-select-option>
|
||||
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item :label="'是否激活'" name="isActive">
|
||||
<a-radio-group v-model:value="formData.isActive" :options="[
|
||||
{ label: '激活', value: true },
|
||||
{ label: '停用', value: false },
|
||||
]"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-card>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, h, onBeforeMount } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import apis from '@/apis'
|
||||
import { useForm, useModal, useSpining } from '@/hooks'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||
import dayjs from 'dayjs'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
import { spliceUrl } from "@/utils/util.js"
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||
const { spining, showSpining, hideSpining } = useSpining()
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const layImgList = []
|
||||
const hoursArray = Array.from({ length: 24 }, (_, i) => ({
|
||||
value: i,
|
||||
name: i === 0 ? "24:00" : `${i}:00`
|
||||
}));
|
||||
const minutesArray = Array.from({ length: 60 }, (_, i) => ({
|
||||
value: i,
|
||||
name: `${i.toString().padStart(2, '0')}:00`
|
||||
}));
|
||||
const activeKey = ref('1')
|
||||
const weekDays = ref([
|
||||
{ value: 1, name: '每周一' },
|
||||
{ value: 2, name: '每周二' },
|
||||
{ value: 3, name: '每周三' },
|
||||
{ value: 4, name: '每周四' },
|
||||
{ value: 5, name: '每周五' },
|
||||
{ value: 6, name: '每周六' },
|
||||
{ value: 7, name: '每周日' },
|
||||
])
|
||||
formRules.value = {
|
||||
areaId: { required: true, message: '请选择区域' },
|
||||
title: { required: true, message: '请输入楼盘名称' },
|
||||
price: { required: true, message: '请输入消耗积分' },
|
||||
startAt: { required: true, message: '请选择开始时间', trigger: 'change' },
|
||||
endAt: { required: true, message: '请选择结束时间' , trigger: 'change'},
|
||||
status: [{ required: true, message: '请输入状态', trigger: 'change' }],
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增抽奖',
|
||||
})
|
||||
formData.value.areaId = 1
|
||||
formData.value.status='enabled'
|
||||
formData.value.roles = [{ weekday:1, isActive: true, startH:0, startM:0,endH:0, endM:0 }]
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: '编辑抽奖',
|
||||
})
|
||||
try {
|
||||
showSpining()
|
||||
const { data, success } = await apis.raffles.getItem(record.id).catch()
|
||||
if (!success) {
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
formData.value = {
|
||||
...data
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideSpining()
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 确定
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value.validateFields().then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
const params = {
|
||||
...values
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
result = await apis.raffles.createProject(params).catch((error) => {
|
||||
console.log(error.message)
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
|
||||
result = await apis.raffles.updateItem(formData.value.id, params).catch(() => {
|
||||
console.log(error.message)
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
}
|
||||
hideLoading()
|
||||
if (config('http.code.success') === result?.success) {
|
||||
hideModal()
|
||||
emit('ok')
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideLoading()
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
// 在 setup 中添加这些方法
|
||||
const updateLabel = (index, value) => {
|
||||
formData.value.labels[index] = value;
|
||||
};
|
||||
|
||||
const addLabel = () => {
|
||||
formData.value.labels.push('');
|
||||
};
|
||||
|
||||
const removeLabel = (index) => {
|
||||
formData.value.labels.splice(index, 1);
|
||||
};
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
function handleCancel() {
|
||||
|
||||
hideModal()
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭后
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleEdit,
|
||||
})
|
||||
//新增户型
|
||||
const addLayout = () => {
|
||||
const params = { weekday: '', isActive: true, startTime: '', endTime: '' }
|
||||
formData.value.roles.push(params)
|
||||
}
|
||||
//新增顾问
|
||||
const addAdviser = () => {
|
||||
const params = { adviserName: '', adviserPhone: '', adviserImg: [] }
|
||||
formData.value.advisers.push(params)
|
||||
}
|
||||
//删除户型
|
||||
const delLayOut = (index) => {
|
||||
formData.value.layOuts.splice(index, 1)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
198
src/views/prizeDraw/lotteryRules/index.vue
Normal file
198
src/views/prizeDraw/lotteryRules/index.vue
Normal file
@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
新增楼盘
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'areaId'">
|
||||
<span>{{ areaEnum.getName(record.areaId) }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'startAt'">
|
||||
<span>{{ dayjs(record.startAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'endAt'">
|
||||
<span>{{ dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
|
||||
<template v-if="'status' === column.dataIndex">
|
||||
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
|
||||
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { usePagination } from '@/hooks'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
defineOptions({
|
||||
name: 'lotteryRules',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '所属区域', dataIndex: 'areaId' },
|
||||
{ title: '规则名称', dataIndex: 'title', width: 120, align: 'center' },
|
||||
{ title: '开始时间', dataIndex: 'startAt', width: 180, align: 'center' },
|
||||
{ title: '结束时间', dataIndex: 'endAt', width: 180, align: 'center' },
|
||||
{ title: '消耗积分', dataIndex: 'price', align: 'center', width: 110 },
|
||||
{ title: '备注', dataIndex: 'reason', align: 'center', ellipsis: true, },
|
||||
{ title: '状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.house
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.house.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@ -6,11 +6,29 @@
|
||||
<a-card class="mb-8-2">
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'案场名称'" name="name">
|
||||
<a-input :placeholder="'请输入案场名称'" v-model:value="formData.name"></a-input>
|
||||
<a-form-item :label="'所属区域'" name="areaId">
|
||||
<a-select ref="select" v-model:value="formData.areaId">
|
||||
<a-select-option v-for="item in areaEnum.getAll()" :value="item.value">{{
|
||||
item.name }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'房刊标题'" name="title">
|
||||
<a-input :placeholder="'请输入房刊标题'" v-model:value="formData.title"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'楼盘名称'" name="name">
|
||||
<a-input :placeholder="'请输入楼盘名称'" v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'发布时间'" name="pushAt">
|
||||
<a-date-picker v-model:value="formData.pushAt" style="width: 100%;" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'状态'" name="status">
|
||||
<a-radio-group v-model:value="formData.status" :options="[
|
||||
{ label: '启用', value: 'enabled' },
|
||||
@ -19,8 +37,15 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'图片'">
|
||||
<gx-upload v-model="formData.fileList" accept-types=".jpg,.png,.webp" :fileNumber="1"
|
||||
<a-form-item :label="'内容'">
|
||||
<x-editor v-model="editorContent" :uploadHandler="uploadHandler"
|
||||
:height="300"></x-editor>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'封面'" name="imgList">
|
||||
<gx-upload v-model="formData.imgList" accept-types=".jpg,.png,.webp" :fileNumber="1"
|
||||
@uploadSuccess="uploadSuccess" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -41,6 +66,8 @@ import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import GxUpload from '@/components/GxUpload/index.vue'
|
||||
import { spliceUrl } from '@/utils/util'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
const areaFormRef = ref()
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
@ -52,14 +79,19 @@ const okText = ref(t('button.confirm'))
|
||||
const rolesValue = ref([])
|
||||
const roles = ref([])
|
||||
const ceshi = ref('1222')
|
||||
|
||||
const editorContent = ref('')
|
||||
const areaList = ref([])
|
||||
const childOpen = ref(false)
|
||||
const fileList = ref([])
|
||||
const formArea = ref({ name: '', status: 'enabled' })
|
||||
formRules.value = {
|
||||
name: { required: true, message: '请输入案场名称' },
|
||||
title: { required: true, message: '请输入房刊标题' },
|
||||
content: { required: true, message: '请输入内容' },
|
||||
imgList: { required: true, message: '请输入选择图片', trigger: 'change' },
|
||||
pushAt: { required: true, message: '请输入发布时间', trigger: 'change' },
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
areaId: [{ required: true, message: '请选择所属区域', trigger: 'change' }]
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +102,7 @@ formRules.value = {
|
||||
function handleCreate() {
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增案场',
|
||||
title: '新增房刊',
|
||||
})
|
||||
// initData()
|
||||
formData.value.status = 'enabled'
|
||||
@ -82,19 +114,27 @@ function handleCreate() {
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: '编辑案场',
|
||||
title: '编辑房刊',
|
||||
})
|
||||
try {
|
||||
showSpining()
|
||||
const { data, success } = await apis.project.getItem(record.id).catch()
|
||||
const { data, success } = await apis.houseArticles.getItem(record.id).catch()
|
||||
if (!success) {
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
formData.value = { ...data }
|
||||
if(data.img){
|
||||
formData.value.fileList = [config('http.apiBasic')+data.img]
|
||||
formData.value = {
|
||||
name: data.name,
|
||||
title: data.title,
|
||||
id:data.id,
|
||||
status: data.status,
|
||||
pushAt: dayjs(data.pushAt),
|
||||
imgList: [config('http.apiBasic') + data.cover]
|
||||
}
|
||||
editorContent.value = data.content
|
||||
if (data.cover) {
|
||||
formData.value.fileList = [config('http.apiBasic') + data.img]
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
@ -109,24 +149,28 @@ const uploadSuccess = (data) => {
|
||||
* 确定
|
||||
*/
|
||||
function handleOk() {
|
||||
if (fileList.value.length === 0) return message.error('请上传图片')
|
||||
// if (fileList.value.length === 0) return message.error('请上传图片')
|
||||
formRef.value.validateFields().then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
const params = {
|
||||
areaId:formData.value.areaId,
|
||||
name: formData.value.name,
|
||||
status: formData.value.status,
|
||||
img: fileList.value[0]
|
||||
title: formData.value.title,
|
||||
content: editorContent.value,
|
||||
pushAt: formData.value.pushAt,
|
||||
cover: formData.value.imgList && spliceUrl(formData.value.imgList[0])
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
result = await apis.project.createProject(params).catch((error) => {
|
||||
result = await apis.houseArticles.createProject(params).catch((error) => {
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
result = await apis.project.updateItem(formData.value.id, params).catch(() => {
|
||||
result = await apis.houseArticles.updateItem(formData.value.id, params).catch(() => {
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
@ -145,7 +189,12 @@ function handleOk() {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
const uploadHandler = async (file) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const { data } = await apis.common.uploadImg(formData);
|
||||
return config('http.apiBasic') + data
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消
|
||||
|
||||
@ -38,15 +38,20 @@
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
新增案场
|
||||
新增房刊
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'img'">
|
||||
<a-image :width="60" :src="config('http.apiBasic')+record.img || $imageErr.imgErr" />
|
||||
<template v-if="column.dataIndex === 'areaId'">
|
||||
<span>{{ areaEnum.getName(record.areaId) }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'cover'">
|
||||
<a-image :width="60" :src="config('http.apiBasic')+record.cover || $imageErr.imgErr" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'pushAt'">
|
||||
<span>{{ dayjs(record.pushAt).format('YYYY-MM-DD') }}</span>
|
||||
</template>
|
||||
<template v-if="'status' === column.dataIndex">
|
||||
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
|
||||
@ -57,11 +62,6 @@
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
<x-action-button @click="createQrcode(record)">
|
||||
<a-tooltip>
|
||||
<template #title>二维码</template>
|
||||
<QrcodeOutlined />
|
||||
</a-tooltip></x-action-button>
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
@ -87,22 +87,27 @@ import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import { statusUserTypeEnum } from '@/enums/system'
|
||||
import dayjs from 'dayjs'
|
||||
import { usePagination } from '@/hooks'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined,QrcodeOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import qrlogo from '@/assets/qrlogo.png'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
const content = ref('')
|
||||
const qrValue = ref('')
|
||||
const qropen = ref(false)
|
||||
defineOptions({
|
||||
name: 'projectList',
|
||||
name: 'hoseBookList',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '图片', dataIndex: 'img', width: 120,align:'center'},
|
||||
{ title: '项目名称', dataIndex: 'name', key: 'title' },
|
||||
{ title: '所属区域', dataIndex: 'areaId', width: 90, align: 'center' },
|
||||
{ title: '封面', dataIndex: 'cover', width: 120,align:'center'},
|
||||
{ title: '房刊标题', dataIndex: 'title', width: 120,align:'center', ellipsis: true},
|
||||
{ title: '楼盘名称', dataIndex: 'name', key: 'title', ellipsis: true },
|
||||
{ title: '发布时间', dataIndex: 'pushAt', key: 'pushAt' },
|
||||
{ title: '内容', dataIndex: 'content', key: 'title',ellipsis: true },
|
||||
{ title: '状态', dataIndex: 'status', key: 'introduce', width: 100,align:'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 150, align: 'center' },
|
||||
]
|
||||
@ -120,7 +125,7 @@ async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.project
|
||||
const { success, data, total } = await apis.houseArticles
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
@ -151,7 +156,7 @@ function handleDelete({ id }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.project.delItem(id).catch(() => {
|
||||
const { success } = await apis.houseArticles.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'楼盘均价'" name="price">
|
||||
<a-input-number :placeholder="'请输入均价'" v-model:value="formData.price"
|
||||
style="width:100%"></a-input-number>
|
||||
<a-input :placeholder="'请输入均价'" v-model:value="formData.price"
|
||||
style="width:100%"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
@ -42,8 +42,8 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'待售状态'" name="status">
|
||||
<a-input :placeholder="'请输入待售状态'" v-model:value="formData.status"></a-input>
|
||||
<a-form-item :label="'待售状态'" name="daiShowStatus">
|
||||
<a-input :placeholder="'请输入待售状态'" v-model:value="formData.daiShowStatus"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
@ -195,7 +195,7 @@
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="楼盘顾问">
|
||||
<div style="width: 100%;margin-bottom: 10px; display: flex;justify-content: flex-end;">
|
||||
<a-button type="primary" @click="addLayout">
|
||||
<a-button type="primary" @click="addAdviser">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
@ -267,21 +267,33 @@
|
||||
<a-row :gutter="12">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'车位数量'" name="packingNum">
|
||||
<a-input-number :placeholder="'请输入车位数量'" v-model:value="formData.packingNum"
|
||||
style="width: 100%;"></a-input-number>
|
||||
<a-input :placeholder="'请输入车位数量'" v-model:value="formData.packingNum"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'总户数'" name="roomNUM">
|
||||
<a-input-number :placeholder="'请输入总户数'" v-model:value="formData.roomNUM"
|
||||
style="width: 100%;"></a-input-number>
|
||||
<a-form-item :label="'总户数'" name="roomNum">
|
||||
<a-input :placeholder="'请输入总户数'" v-model:value="formData.roomNum"
|
||||
style="width: 100%;"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'绿地率'" name="greeningRate">
|
||||
<a-input :placeholder="'请输入绿地率'"
|
||||
<a-form-item :label="'绿化率'" name="greeningRate">
|
||||
<a-input :placeholder="'请输入绿化率'"
|
||||
v-model:value="formData.greeningRate"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'车位比'" name="carRatio">
|
||||
<a-input :placeholder="'请输入车位比'"
|
||||
v-model:value="formData.carRatio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'容积率'" name="ratio">
|
||||
<a-input :placeholder="'请输入容积率'"
|
||||
v-model:value="formData.ratio"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'R19009容积率'" name="r19009Ratio">
|
||||
@ -411,6 +423,7 @@ async function handleEdit(record = {}) {
|
||||
openAt: data.openAt,
|
||||
price: data.price,
|
||||
status: data.status,
|
||||
|
||||
title: data.title,
|
||||
videos: data.videos? data.videos.map(item => config('http.apiBasic') + item):[],
|
||||
advisers: data.advisers?data.advisers.map(item=>({adviserName:item.name,adviserPhone:item.phone,adviserImg:item.avatar?[config('http.apiBasic')+item.avatar]:[]})):[{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||
@ -420,6 +433,7 @@ async function handleEdit(record = {}) {
|
||||
houseArea: data.detail.basicInfo.area,
|
||||
buildingarea: data.detail.basicInfo.buildingarea,
|
||||
showAddress: data.detail.basicInfo.showAddress,
|
||||
daiShowStatus:data.detail.basicInfo.status,
|
||||
type: data.detail.basicInfo.type,
|
||||
louPanStatus: data.detail.salesInfo.status,
|
||||
duration: data.detail.salesInfo.duration,
|
||||
@ -434,7 +448,9 @@ async function handleEdit(record = {}) {
|
||||
r19009Ratio: data.detail.communityInfo.r19009Ratio,
|
||||
r19010Ratio: data.detail.communityInfo.r19010Ratio,
|
||||
r19011Ratio: data.detail.communityInfo.r19011Ratio,
|
||||
roomNUM: data.detail.communityInfo.roomNUM,
|
||||
roomNum: data.detail.communityInfo.roomNum,
|
||||
carRatio:data.detail.communityInfo.carRatio,
|
||||
ratio:data.detail.communityInfo.ratio,
|
||||
layOuts: data.layOuts ? data.layOuts.map(item => ({ area: item.area, direction: item.direction, layImgList: item.img?[config('http.apiBasic') + item.img]:[], price: item.price, title: item.title })):[{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },
|
||||
{ area: '', price: '', direction: '', title: '', layImgList: [] },],
|
||||
@ -457,6 +473,7 @@ function handleOk() {
|
||||
formRef.value.validateFields().then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
console.log(formData.value)
|
||||
const params = {
|
||||
address: formData.value.address,
|
||||
areaId: formData.value.areaId,//所属区域
|
||||
@ -468,7 +485,7 @@ function handleOk() {
|
||||
masterType: formData.value.masterType,
|
||||
name: formData.value.name,
|
||||
openAt: formData.value.openAt,
|
||||
price: formData.value.price.toString(),
|
||||
price: formData.value.price,
|
||||
status: formData.value.status,
|
||||
title: formData.value.title,
|
||||
videos: formData.value.videos&&formData.value.videos.map(item=>spliceUrl(item)),
|
||||
@ -479,7 +496,7 @@ function handleOk() {
|
||||
area: formData.value.houseArea,//占地面积
|
||||
buildingarea: formData.value.buildingarea,//建筑面积
|
||||
masterType: formData.value.masterType,//主力户型
|
||||
status: formData.value.status,//待售状态
|
||||
status: formData.value.daiShowStatus,//待售状态
|
||||
showAddress: formData.value.showAddress,//展厅位置
|
||||
type: formData.value.type,//楼盘类型
|
||||
},
|
||||
@ -492,14 +509,16 @@ function handleOk() {
|
||||
},
|
||||
communityInfo: {
|
||||
greeningRate: formData.value.greeningRate,
|
||||
packingNum: formData.value.packingNum.toString(),
|
||||
propertyName: formData.value.propertyName.toString(),
|
||||
packingNum: formData.value.packingNum,
|
||||
propertyName: formData.value.propertyName,
|
||||
propertyPrice: formData.value.propertyPrice,
|
||||
propertyType: formData.value.propertyType,
|
||||
r19009Ratio: formData.value.r19009Ratio,
|
||||
r19010Ratio: formData.value.r19010Ratio,
|
||||
r19011Ratio: formData.value.r19011Ratio,
|
||||
roomNUM: formData.value.roomNUM.toString(),
|
||||
roomNum: formData.value.roomNum,
|
||||
carRatio:formData.value.carRatio,
|
||||
ratio:formData.value.ratio
|
||||
}
|
||||
},
|
||||
layOuts: formData.value.layOuts && formData.value.layOuts.map(item => ({ area: item.area, direction: item.direction, img: item.layImgList[0]&&spliceUrl(item.layImgList[0]), price: item.price, title: item.title })),
|
||||
@ -508,7 +527,7 @@ function handleOk() {
|
||||
hospitalNum: formData.value.hospitalNum,
|
||||
lifeNum: formData.value.lifeNum,
|
||||
metroNum: formData.value.metroNum,
|
||||
schoolNum: formData.value.metroNum,
|
||||
schoolNum: formData.value.schoolNum,
|
||||
}
|
||||
}
|
||||
let result = null
|
||||
@ -576,9 +595,14 @@ defineExpose({
|
||||
})
|
||||
//新增户型
|
||||
const addLayout = () => {
|
||||
const params = { imgs: [], area: '', price: '', direction: '', title: '' }
|
||||
const params = { layImgList: [], area: '', price: '', direction: '', title: '' }
|
||||
formData.value.layOuts.push(params)
|
||||
}
|
||||
//新增顾问
|
||||
const addAdviser=()=>{
|
||||
const params={ adviserName: '', adviserPhone: '', adviserImg: [] }
|
||||
formData.value.advisers.push(params)
|
||||
}
|
||||
//删除户型
|
||||
const delLayOut = (index) => {
|
||||
formData.value.layOuts.splice(index, 1)
|
||||
|
||||
@ -89,7 +89,7 @@ const columns = [
|
||||
{ title: '开盘时间', dataIndex: 'openAt', width: 100, align: 'center' },
|
||||
{ title: '楼盘地址', dataIndex: 'address', align: 'center',ellipsis: true, },
|
||||
{ title: '楼盘均价', dataIndex: 'price', align: 'center', width: 110 },
|
||||
{ title: '待售状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
|
||||
// { title: '待售状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
||||
]
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||
@ -179,7 +179,6 @@ function handleResetSearch() {
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
|
||||
|
||||
232
src/views/regional/houseProduct/components/EditDialog.vue
Normal file
232
src/views/regional/houseProduct/components/EditDialog.vue
Normal file
@ -0,0 +1,232 @@
|
||||
<template>
|
||||
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||
<a-spin :spinning="spining">
|
||||
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-8-2">
|
||||
<a-row :gutter="12">
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'礼品名称'" name="name">
|
||||
<a-input :placeholder="'请输入礼品名称'" v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'案场名称'" name="companyId">
|
||||
<a-select v-model:value="formData.companyId" style="width: 100%">
|
||||
<a-select-option v-for="item of companyList" :value="item.id">{{ item.name
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'兑换数量'" name="maxNum">
|
||||
<a-input-number :placeholder="'请输入兑换数量'" v-model:value="formData.maxNum" style="width: 100%;"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'开始时间'" name="startAt">
|
||||
<a-date-picker :placeholder="'请选择开始时间'"
|
||||
v-model:value="formData.startAt" style="width: 100%;" ></a-date-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'结束时间'" name="endAt">
|
||||
<a-date-picker :placeholder="'请选择结束时间'" v-model:value="formData.endAt" style="width: 100%;"></a-date-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'是否每天'" name="isDaily">
|
||||
<a-radio-group v-model:value="formData.isDaily" :options="[
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
]"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'状态'" name="status">
|
||||
<a-radio-group v-model:value="formData.status" :options="[
|
||||
{ label: '启用', value: 'enabled' },
|
||||
{ label: '停用', value: 'disabled' },
|
||||
]"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'内容'">
|
||||
<x-editor v-model="editorContent" :uploadHandler="uploadHandler" :height="300"></x-editor>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'礼品图片'">
|
||||
<gx-upload v-model="formData.fileList" accept-types=".jpg,.png,.webp" :fileNumber="1" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { ref, onBeforeMount } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import apis from '@/apis'
|
||||
import { useForm, useModal, useSpining } from '@/hooks'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import GxUpload from '@/components/GxUpload/index.vue'
|
||||
import { spliceUrl } from '@/utils/util'
|
||||
const areaFormRef = ref()
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||
const { spining, showSpining, hideSpining } = useSpining()
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const fileList = ref([])
|
||||
const companyList = ref([])
|
||||
const editorContent=ref('')
|
||||
formRules.value = {
|
||||
name: { required: true, message: '请输入礼品名称' },
|
||||
maxNum: { required: true, message: '请输入最大数量' },
|
||||
companyId: { required: true, message: '请选择案场',trigger:'change' },
|
||||
startAt: { required: true, message: '请选择开始时间',trigger:'change' },
|
||||
endAt: { required: true, message: '请选择结束时间',trigger:'change' },
|
||||
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||
}
|
||||
onBeforeMount(async () => {
|
||||
const { success, data, total } = await apis.project
|
||||
.getProjectList({
|
||||
pageSize: 100,
|
||||
page: 1,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
companyList.value = data.map(item => ({ id: item.id, name: item.name }))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增礼品',
|
||||
})
|
||||
formData.value.status = 'enabled'
|
||||
formData.value.isDaily=true
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: '编辑礼品',
|
||||
})
|
||||
try {
|
||||
showSpining()
|
||||
const { data, success } = await apis.houseProduct.getItem(record.id).catch()
|
||||
if (!success) {
|
||||
hideModal()
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
editorContent.value=data.content
|
||||
formData.value = {
|
||||
...data,
|
||||
|
||||
startAt:dayjs(data.startAt),
|
||||
endAt:dayjs(data.endAt)
|
||||
}
|
||||
if (data.img) {
|
||||
formData.value.fileList = [config('http.apiBasic') + data.img]
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideSpining()
|
||||
}
|
||||
|
||||
}
|
||||
const uploadSuccess = (data) => {
|
||||
fileList.value.push(data)
|
||||
}
|
||||
/**
|
||||
* 确定
|
||||
*/
|
||||
function handleOk() {
|
||||
console.log(editorContent.value)
|
||||
formRef.value.validateFields().then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
const params = {
|
||||
...values,
|
||||
content:editorContent.value,
|
||||
img:formData.value.fileList?spliceUrl(formData.value.fileList[0]):''
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
result = await apis.houseProduct.createProject(params).catch((error) => {
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
result = await apis.houseProduct.updateItem(formData.value.id, params).catch(() => {
|
||||
throw new Error(error)
|
||||
})
|
||||
break
|
||||
}
|
||||
hideLoading()
|
||||
if (config('http.code.success') === result?.success) {
|
||||
hideModal()
|
||||
emit('ok')
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
hideLoading()
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
function handleCancel() {
|
||||
hideModal()
|
||||
}
|
||||
const uploadHandler = async (file) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const { data } = await apis.common.uploadImg(formData);
|
||||
return config('http.apiBasic') + data
|
||||
}
|
||||
/**
|
||||
* 关闭后
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleEdit,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
205
src/views/regional/houseProduct/index.vue
Normal file
205
src/views/regional/houseProduct/index.vue
Normal file
@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
新增礼品
|
||||
</a-button>
|
||||
</x-action-bar>
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'img'">
|
||||
<a-image :width="60" :src="config('http.apiBasic') + record.img || $imageErr.imgErr" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'startAt'">
|
||||
<span>{{ dayjs(record.startAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'endAt'">
|
||||
<span>{{ dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
<template v-if="'isDaily' === column.dataIndex">
|
||||
<a-tag v-if="record.isDaily" :color="'green'">是</a-tag>
|
||||
<a-tag v-if="!record.isDaily" :color="'red'">否</a-tag>
|
||||
</template>
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||
<edit-outlined /> </a-tooltip></x-action-button>
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" /> </a-tooltip></x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import { statusUserTypeEnum } from '@/enums/system'
|
||||
import { usePagination } from '@/hooks'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, QrcodeOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import qrlogo from '@/assets/qrlogo.png'
|
||||
import dayjs from 'dayjs'
|
||||
const content = ref('')
|
||||
const qrValue = ref('')
|
||||
const qropen = ref(false)
|
||||
defineOptions({
|
||||
name: 'houseProduct',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '礼品图片', dataIndex: 'img' },
|
||||
{ title: '案场名称', dataIndex: 'companyName' },
|
||||
{ title: '礼品名称', dataIndex: 'name' },
|
||||
{ title: '兑换数量', dataIndex: 'maxNum' },
|
||||
{ title: '开始时间', dataIndex: 'startAt',width:180,align:'center' },
|
||||
{ title: '结束时间', dataIndex: 'endAt',width:180,align:'center' },
|
||||
{ title: '是否每天', dataIndex: 'isDaily',width:120,align:'center' },
|
||||
// { title: '状态', dataIndex: 'status', key: 'introduce', width: 100, align: 'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 150, align: 'center' },
|
||||
]
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||
usePagination()
|
||||
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.houseProduct
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.houseProduct.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getPageList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
188
src/views/regional/productExChange/index.vue
Normal file
188
src/views/regional/productExChange/index.vue
Normal file
@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<!-- <x-search-bar class="mb-8-2">
|
||||
<template #default="{ gutter, colSpan }">
|
||||
<a-form :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="岗位名称" name="name">
|
||||
<a-input placeholder="请输入岗位名称" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-select v-model:value="searchFormData.status" allowClear>
|
||||
<a-select-option value="">全部</a-select-option>
|
||||
<a-select-option value="enabled">启用</a-select-option>
|
||||
<a-select-option value="disabled">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col class="align-right" v-bind="colSpan">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
{{ $t('button.search') }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar> -->
|
||||
<a-row :gutter="8" :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-card type="flex">
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'createdAt'">
|
||||
<span>{{ dayjs(record.createdAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import apis from '@/apis'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import { config } from '@/config'
|
||||
import { statusUserTypeEnum } from '@/enums/system'
|
||||
import { usePagination } from '@/hooks'
|
||||
import dayjs from 'dayjs'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined,QrcodeOutlined } from '@ant-design/icons-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import qrlogo from '@/assets/qrlogo.png'
|
||||
const content = ref('')
|
||||
const qrValue = ref('')
|
||||
const qropen = ref(false)
|
||||
defineOptions({
|
||||
name: 'productExChange',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '案场名称', dataIndex: 'companyName'},
|
||||
{ title: '客户名称', dataIndex: 'customerName'},
|
||||
{ title: '产品名称', dataIndex: 'productName'},
|
||||
{ title: '创建时间', dataIndex: 'createdAt', width: 180,align:'center' },
|
||||
]
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } =
|
||||
usePagination()
|
||||
|
||||
const editDialogRef = ref()
|
||||
getPageList()
|
||||
/**
|
||||
* 获取表格数据
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function getPageList() {
|
||||
try {
|
||||
showLoading()
|
||||
const { pageSize, current } = paginationState
|
||||
const { success, data, total } = await apis.companyProductOrders
|
||||
.getProjectList({
|
||||
pageSize,
|
||||
page: current,
|
||||
...searchFormData.value,
|
||||
})
|
||||
.catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
listData.value = data
|
||||
paginationState.total = total
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function handleDelete({ id }) {
|
||||
Modal.confirm({
|
||||
title: t('pages.system.user.delTip'),
|
||||
content: t('button.confirm'),
|
||||
okText: t('button.confirm'),
|
||||
onOk: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
; (async () => {
|
||||
try {
|
||||
const { success } = await apis.companyProductOrders.delItem(id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
if (config('http.code.success') === success) {
|
||||
resolve()
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})()
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
function onTableChange({ current, pageSize }) {
|
||||
paginationState.current = current
|
||||
paginationState.pageSize = pageSize
|
||||
getPageList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
function handleResetSearch() {
|
||||
searchFormData.value = {}
|
||||
resetPagination()
|
||||
getPageList()
|
||||
}
|
||||
const createQrcode = (params) => {
|
||||
const {name,areaId,id}=params
|
||||
const item={ title:name,
|
||||
typer:'activity',
|
||||
pathUrl:'/pages/sceneDetail/index.vue',
|
||||
areaId,
|
||||
relationId:id,
|
||||
kvalue1:'',
|
||||
kvalue2:'',
|
||||
kvalue3:'',
|
||||
kvalue4:'',
|
||||
kvalue5:'',}
|
||||
qrValue.value = JSON.stringify(item)
|
||||
console.log(qrValue.value)
|
||||
qropen.value = true
|
||||
}
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@ -102,7 +102,7 @@ defineOptions({
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '图片', dataIndex: 'img', width: 120,align:'center'},
|
||||
{ title: '项目名称', dataIndex: 'name', key: 'title' },
|
||||
{ title: '案场名称', dataIndex: 'name', key: 'title' },
|
||||
{ title: '状态', dataIndex: 'status', key: 'introduce', width: 100,align:'center' },
|
||||
{ title: t('button.action'), key: 'action', fixed: 'right', width: 150, align: 'center' },
|
||||
]
|
||||
@ -212,7 +212,6 @@ const createQrcode = (params) => {
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getPageList()
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -239,7 +239,6 @@ function handleDelete({ id }) {
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
message.success(t('component.message.success.delete'))
|
||||
await getMenuList()
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user