import React, { useState, useEffect } from 'react';
import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, notification, Modal } from 'antd';
import moment from 'moment';
import request from '../../../utils/request';
import apis from '../../../services/apis';
import Styles from './style.less';
import { router } from 'umi';
import AuthButton from '@/components/AuthButton';
import SelectCity from '../../../components/SelectButton/CitySelect'
const { Option } = Select;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { Meta } = Card;
const tempDate = [{ code: 's101' }]
function openNotificationWithIcon(type, message) {
notification[type]({
message,
description:
'',
});
}
/**
*卡片
*
* @returns
*/
function CartBody(props) {
const { data } = props
function toEdi(record) {
router.push({
pathname: '/building/list/add',
query: {
id: record.buildingId,
},
})
}
/**
*发布 取消 发布
*
* @param {*} record
*/
function pulicAndUnPulic(record) {
const modal = Modal.confirm();
const buidingStatus = record.status === 1 ? 2 : 1
const title = record.status === 1 ? '项目会在小程序端隐藏,后台可继续编辑重新发布?' : '确认发布此数据?'
modal.update({
content: title,
okText: '确认',
cancelText: '关闭',
onOk: () => {
request({ ...apis.building.updateStatus, data: { id: record.buildingId, status: buidingStatus } }).then(() => {
openNotificationWithIcon('success', '操作成功')
props.onSuccess()
}).catch(err => {
openNotificationWithIcon('error', err.message)
})
modal.destroy();
},
onCancel: () => {
modal.destroy();
},
});
}
/**
*删除楼盘
*
* @param {*} record
*/
function deleteBuilding(record) {
const modal = Modal.confirm();
modal.update({
content: '项目会被删除,小程序端和后台都无法再看到',
okText: '确认',
cancelText: '关闭',
onOk: () => {
request({ ...apis.building.deleteBuilding, urlData: { id: record.buildingId } }).then(() => {
openNotificationWithIcon('success', '操作成功')
props.onSuccess()
}).catch(err => {
// openNotificationWithIcon('error', err.message)
})
modal.destroy();
},
onCancel: () => {
modal.destroy();
},
});
}
const { buildingImg } = data
console.log("buildingImg: ", data.buildingImg, "data: ", data)
return (
楼盘编号
:{data.code}
楼盘名称
:{data.buildingName || data.name}
均价
:约 {data.price || '待定'} 元/m²
项目地址
:{data.address}
发布状态
:{data.status === 1 ? '已发布' : '未发布'}
录入时间
:{moment(data.createDate).format('YYYY-MM-DD HH:mm:ss')}