update
This commit is contained in:
parent
41c7a9512e
commit
8628a6beab
62
src/main.js
62
src/main.js
@ -15,7 +15,37 @@ import {
|
|||||||
Pagination,
|
Pagination,
|
||||||
Spin,
|
Spin,
|
||||||
ConfigProvider,
|
ConfigProvider,
|
||||||
message
|
message,
|
||||||
|
Card,
|
||||||
|
Dropdown,
|
||||||
|
Checkbox,
|
||||||
|
Radio,
|
||||||
|
Switch,
|
||||||
|
DatePicker,
|
||||||
|
TimePicker,
|
||||||
|
InputNumber,
|
||||||
|
Upload,
|
||||||
|
Badge,
|
||||||
|
Avatar,
|
||||||
|
Drawer,
|
||||||
|
Divider,
|
||||||
|
List,
|
||||||
|
Popover,
|
||||||
|
Tooltip,
|
||||||
|
Tag,
|
||||||
|
Timeline,
|
||||||
|
Tree,
|
||||||
|
Alert,
|
||||||
|
Space,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Breadcrumb,
|
||||||
|
Steps,
|
||||||
|
Result,
|
||||||
|
Statistic,
|
||||||
|
Descriptions,
|
||||||
|
Empty,
|
||||||
|
AutoComplete
|
||||||
} from 'ant-design-vue'
|
} from 'ant-design-vue'
|
||||||
import 'ant-design-vue/dist/antd.css'
|
import 'ant-design-vue/dist/antd.css'
|
||||||
|
|
||||||
@ -35,6 +65,36 @@ const ANT_DESIGN = {
|
|||||||
app.use(Pagination)
|
app.use(Pagination)
|
||||||
app.use(Spin)
|
app.use(Spin)
|
||||||
app.use(ConfigProvider)
|
app.use(ConfigProvider)
|
||||||
|
app.use(Card)
|
||||||
|
app.use(Dropdown)
|
||||||
|
app.use(Checkbox)
|
||||||
|
app.use(Radio)
|
||||||
|
app.use(Switch)
|
||||||
|
app.use(DatePicker)
|
||||||
|
app.use(TimePicker)
|
||||||
|
app.use(InputNumber)
|
||||||
|
app.use(Upload)
|
||||||
|
app.use(Badge)
|
||||||
|
app.use(Avatar)
|
||||||
|
app.use(Drawer)
|
||||||
|
app.use(Divider)
|
||||||
|
app.use(List)
|
||||||
|
app.use(Popover)
|
||||||
|
app.use(Tooltip)
|
||||||
|
app.use(Tag)
|
||||||
|
app.use(Timeline)
|
||||||
|
app.use(Tree)
|
||||||
|
app.use(Alert)
|
||||||
|
app.use(Space)
|
||||||
|
app.use(Row)
|
||||||
|
app.use(Col)
|
||||||
|
app.use(Breadcrumb)
|
||||||
|
app.use(Steps)
|
||||||
|
app.use(Result)
|
||||||
|
app.use(Statistic)
|
||||||
|
app.use(Descriptions)
|
||||||
|
app.use(Empty)
|
||||||
|
app.use(AutoComplete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -181,26 +181,6 @@
|
|||||||
/>
|
/>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="产品描述" name="product_detail">
|
|
||||||
<md-editor
|
|
||||||
v-model:value="formState.product_detail"
|
|
||||||
:toolbars="toolbars"
|
|
||||||
language="zh-CN"
|
|
||||||
preview-theme="github"
|
|
||||||
:placeholder="'请输入产品描述'"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="购买须知" name="purchase_note">
|
|
||||||
<md-editor
|
|
||||||
v-model:value="formState.purchase_note"
|
|
||||||
:toolbars="toolbars"
|
|
||||||
language="zh-CN"
|
|
||||||
preview-theme="github"
|
|
||||||
:placeholder="'请输入购买须知'"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
@ -345,26 +325,6 @@
|
|||||||
/>
|
/>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="产品描述" name="product_detail">
|
|
||||||
<md-editor
|
|
||||||
v-model:value="editFormState.product_detail"
|
|
||||||
:toolbars="toolbars"
|
|
||||||
language="zh-CN"
|
|
||||||
preview-theme="github"
|
|
||||||
:placeholder="'请输入产品描述'"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="购买须知" name="purchase_note">
|
|
||||||
<md-editor
|
|
||||||
v-model:value="editFormState.purchase_note"
|
|
||||||
:toolbars="toolbars"
|
|
||||||
language="zh-CN"
|
|
||||||
preview-theme="github"
|
|
||||||
:placeholder="'请输入购买须知'"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
@ -439,8 +399,6 @@ import PageContainer from '@/components/PageContainer.vue'
|
|||||||
import { loadAMap, createMap, createAutoComplete, createGeocoder } from '@/utils/amap.js'
|
import { loadAMap, createMap, createAutoComplete, createGeocoder } from '@/utils/amap.js'
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import { PlusOutlined, SearchOutlined, EditOutlined, DownOutlined, GiftOutlined, AccountBookOutlined } from '@ant-design/icons-vue'
|
import { PlusOutlined, SearchOutlined, EditOutlined, DownOutlined, GiftOutlined, AccountBookOutlined } from '@ant-design/icons-vue'
|
||||||
import { MdEditor } from 'md-editor-v3'
|
|
||||||
import 'md-editor-v3/lib/style.css'
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@ -452,8 +410,7 @@ export default defineComponent({
|
|||||||
GiftOutlined,
|
GiftOutlined,
|
||||||
AccountBookOutlined,
|
AccountBookOutlined,
|
||||||
AUpload: Upload,
|
AUpload: Upload,
|
||||||
AModal: Modal,
|
AModal: Modal
|
||||||
MdEditor
|
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@ -462,27 +419,6 @@ export default defineComponent({
|
|||||||
const currentMap = ref(null)
|
const currentMap = ref(null)
|
||||||
const currentMarker = ref(null)
|
const currentMarker = ref(null)
|
||||||
|
|
||||||
// Markdown 编辑器工具栏配置
|
|
||||||
const toolbars = [
|
|
||||||
'bold',
|
|
||||||
'underline',
|
|
||||||
'italic',
|
|
||||||
'strikeThrough',
|
|
||||||
'title',
|
|
||||||
'sub',
|
|
||||||
'sup',
|
|
||||||
'quote',
|
|
||||||
'unorderedList',
|
|
||||||
'orderedList',
|
|
||||||
'codeRow',
|
|
||||||
'code',
|
|
||||||
'link',
|
|
||||||
'image',
|
|
||||||
'table',
|
|
||||||
'preview',
|
|
||||||
'fullscreen'
|
|
||||||
]
|
|
||||||
|
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
current: 1,
|
current: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -687,9 +623,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: '',
|
brand_image_url: ''
|
||||||
product_detail: '',
|
|
||||||
purchase_note: '',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
@ -699,9 +633,7 @@ export default defineComponent({
|
|||||||
name: [{ required: true, message: '请输入商家名称' }],
|
name: [{ required: true, message: '请输入商家名称' }],
|
||||||
business_hours: [{ required: true, message: '请输入营业时间' }],
|
business_hours: [{ required: true, message: '请输入营业时间' }],
|
||||||
address: [{ required: true, message: '请输入详细地址' }],
|
address: [{ required: true, message: '请输入详细地址' }],
|
||||||
phone: [{ required: true, message: '请输入联系电话' }],
|
phone: [{ required: true, message: '请输入联系电话' }]
|
||||||
product_detail: [{ required: false, message: '请输入产品描述' }],
|
|
||||||
purchase_note: [{ required: false, message: '请输入购买须知' }],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取商家分类
|
// 获取商家分类
|
||||||
@ -844,14 +776,7 @@ export default defineComponent({
|
|||||||
try {
|
try {
|
||||||
confirmLoading.value = true
|
confirmLoading.value = true
|
||||||
|
|
||||||
// 确保包含产品描述和购买须知字段
|
await request.post('/api/merchant', formState.value)
|
||||||
const postData = {
|
|
||||||
...formState.value,
|
|
||||||
product_detail: formState.value.product_detail || '',
|
|
||||||
purchase_note: formState.value.purchase_note || ''
|
|
||||||
}
|
|
||||||
|
|
||||||
await request.post('/api/merchant', postData)
|
|
||||||
message.success('添加成功')
|
message.success('添加成功')
|
||||||
addModalVisible.value = false
|
addModalVisible.value = false
|
||||||
fetchData()
|
fetchData()
|
||||||
@ -875,9 +800,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: '',
|
brand_image_url: ''
|
||||||
product_detail: '',
|
|
||||||
purchase_note: '',
|
|
||||||
}
|
}
|
||||||
searchAddress.value = ''
|
searchAddress.value = ''
|
||||||
searchOptions.value = []
|
searchOptions.value = []
|
||||||
@ -932,9 +855,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: '',
|
brand_image_url: ''
|
||||||
product_detail: '',
|
|
||||||
purchase_note: '',
|
|
||||||
})
|
})
|
||||||
const editSearchAddress = ref('')
|
const editSearchAddress = ref('')
|
||||||
const editMap = ref(null)
|
const editMap = ref(null)
|
||||||
@ -947,8 +868,14 @@ export default defineComponent({
|
|||||||
editFormState.value = {
|
editFormState.value = {
|
||||||
...record,
|
...record,
|
||||||
user_id: record.user_id,
|
user_id: record.user_id,
|
||||||
product_detail: record.product_detail || '',
|
name: record.name,
|
||||||
purchase_note: record.purchase_note || ''
|
category_id: record.category_id,
|
||||||
|
business_hours: record.business_hours,
|
||||||
|
address: record.address,
|
||||||
|
longitude: record.longitude,
|
||||||
|
latitude: record.latitude,
|
||||||
|
phone: record.phone,
|
||||||
|
brand_image_url: record.brand_image_url
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取分类数据
|
// 获取分类数据
|
||||||
@ -1058,12 +985,9 @@ export default defineComponent({
|
|||||||
try {
|
try {
|
||||||
editLoading.value = true
|
editLoading.value = true
|
||||||
|
|
||||||
// 确保包含 user_id、产品描述和购买须知字段在请求数据中
|
|
||||||
const updateData = {
|
const updateData = {
|
||||||
...editFormState.value,
|
...editFormState.value,
|
||||||
user_id: editFormState.value.user_id,
|
user_id: editFormState.value.user_id
|
||||||
product_detail: editFormState.value.product_detail || '',
|
|
||||||
purchase_note: editFormState.value.purchase_note || ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await request.put(`/api/merchant/${currentEditId.value}`, updateData)
|
const res = await request.put(`/api/merchant/${currentEditId.value}`, updateData)
|
||||||
@ -1095,9 +1019,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: '',
|
brand_image_url: ''
|
||||||
product_detail: '',
|
|
||||||
purchase_note: '',
|
|
||||||
}
|
}
|
||||||
editSearchAddress.value = ''
|
editSearchAddress.value = ''
|
||||||
userOptions.value = []
|
userOptions.value = []
|
||||||
@ -1335,8 +1257,7 @@ export default defineComponent({
|
|||||||
shareRateModalVisible,
|
shareRateModalVisible,
|
||||||
shareRateValue,
|
shareRateValue,
|
||||||
showShareRateModal,
|
showShareRateModal,
|
||||||
handleShareRateSubmit,
|
handleShareRateSubmit
|
||||||
toolbars
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1554,47 +1475,6 @@ export default defineComponent({
|
|||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Markdown 编辑器样式 */
|
|
||||||
:deep(.md-editor) {
|
|
||||||
height: 300px !important;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.md-editor-content) {
|
|
||||||
height: 300px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-modal-body) {
|
|
||||||
padding: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.md-editor-toolbar) {
|
|
||||||
border-radius: 2px 2px 0 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.md-editor-input, .md-editor-preview) {
|
|
||||||
border-radius: 0 0 2px 2px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.md-editor-preview-wrapper) {
|
|
||||||
padding: 8px 16px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-modal .ant-modal-content) {
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
||||||
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
||||||
0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.md-editor) {
|
|
||||||
width: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.md-editor-input) {
|
|
||||||
padding: 12px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 编辑和添加模态框中的内容样式 */
|
/* 编辑和添加模态框中的内容样式 */
|
||||||
:deep(.ant-modal-body:has(.ant-form)) {
|
:deep(.ant-modal-body:has(.ant-form)) {
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user