Commit d1d458bc authored by 前端-许佳敏's avatar 前端-许佳敏
parents 8451a890 6db11ef2
import React, { useState, useEffect } from 'react' import React, { useState } from 'react'
import { Modal } from 'antd' import { Modal } from 'antd'
import { import {
SchemaForm, SchemaForm,
SchemaMarkupField as Field, SchemaMarkupField as Field,
createAsyncFormActions, createAsyncFormActions,
FormEffectHooks, FormEffectHooks
createFormActions
} from '@formily/antd' } from '@formily/antd'
import { Input, Switch, Select, FormMegaLayout, Radio } from '@formily/antd-components' import { Input, Switch, Select, FormMegaLayout, Radio } from '@formily/antd-components'
import styles from './index.less' import styles from './index.less'
...@@ -33,7 +32,7 @@ const actions = createAsyncFormActions() ...@@ -33,7 +32,7 @@ const actions = createAsyncFormActions()
const AddInvoice: React.FC<AddAddressPropsType> = (props) => { const AddInvoice: React.FC<AddAddressPropsType> = (props) => {
const { visible = false, title, onOk, onCancel, editItem, type } = props const { visible = false, title, onOk, onCancel, editItem, type } = props
const [state, setState] = useState({ editable: true }) const [state] = useState({ editable: true })
const [confirmLoading, setConfirmLoading] = useState<boolean>(false) const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [invoiceTitle, setInvoiceTitle] = useState<string>("发票抬头") const [invoiceTitle, setInvoiceTitle] = useState<string>("发票抬头")
const [invoiceTitleTip, setInvoiceTitleTip] = useState<string>("请输入发票抬头") const [invoiceTitleTip, setInvoiceTitleTip] = useState<string>("请输入发票抬头")
......
...@@ -12,6 +12,7 @@ import { GetTemplateShopFindShopResponse } from '@/services/TemplateApi' ...@@ -12,6 +12,7 @@ import { GetTemplateShopFindShopResponse } from '@/services/TemplateApi'
import copy from 'copy-to-clipboard' import copy from 'copy-to-clipboard'
import cx from 'classnames' import cx from 'classnames'
import styles from './index.less' import styles from './index.less'
import { getAuth } from '@/utils/auth'
import { isEmpty } from '@formily/antd/esm/shared' import { isEmpty } from '@formily/antd/esm/shared'
interface ShopInfoPropsType { interface ShopInfoPropsType {
...@@ -43,8 +44,11 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -43,8 +44,11 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
// 根据站点获取商城信息 // 根据站点获取商城信息
const fetchAllShop = () => { const fetchAllShop = () => {
//@ts-ignore const param: any = {
PublicApi.getManageShopFindShopsBySiteId({ siteId, type: 1 }).then(res => { siteId,
type: 1
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
setAllMallList(res.data) setAllMallList(res.data)
} }
...@@ -55,7 +59,13 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -55,7 +59,13 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
* 获取店铺信息 * 获取店铺信息
*/ */
const fetchShopInfo = () => { const fetchShopInfo = () => {
PublicApi.getTemplateShopFindShop().then(res => { const { memberId, memberRoleId } = getAuth() || {}
const param: any = {
memberId,
roleId: memberRoleId
}
PublicApi.getTemplateShopFindShop(param).then(res => {
const data = res.data const data = res.data
if (res.code === 1000) { if (res.code === 1000) {
setShopInfo(data) setShopInfo(data)
...@@ -91,7 +101,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -91,7 +101,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
} }
const handleAddNewCitySelect = (item: any) => { const handleAddNewCitySelect = (item: any) => {
let temp = [...selectCityData] const temp = [...selectCityData]
temp.push(item) temp.push(item)
setSelectCityData(temp) setSelectCityData(temp)
form.setFieldsValue({ form.setFieldsValue({
...@@ -135,8 +145,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -135,8 +145,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const handleSave = (e: any) => { const handleSave = (e: any) => {
e.preventDefault() e.preventDefault()
console.log(selectCityData) form.validateFields().then((value: any) => {
form.validateFields().then(value => {
if (!checkMemberShopAreas(value.memberShopAreas)) { if (!checkMemberShopAreas(value.memberShopAreas)) {
return return
} }
...@@ -146,7 +155,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -146,7 +155,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
} }
value.storeUrl = storeUrl || `${siteUrl}/shop` value.storeUrl = storeUrl || `${siteUrl}/shop`
value.shopId = shopId value.shopId = shopId
//@ts-ignore
PublicApi.postTemplateShopSaveShop(value).then(res => { PublicApi.postTemplateShopSaveShop(value).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
fetchShopInfo() fetchShopInfo()
...@@ -213,7 +222,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -213,7 +222,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
return null return null
} }
if (shopInfo.shopId && shopInfo.memberId) { if (shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(mallId) const resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl) setStoreUrl(resUrl)
} else { } else {
setStoreUrl(null) setStoreUrl(null)
...@@ -223,7 +232,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -223,7 +232,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const getMallItemAndSetUrl = (mallId) => { const getMallItemAndSetUrl = (mallId) => {
let result = "" let result = ""
console.log(mallId, allMallList, "mallId") console.log(mallId, allMallList, "mallId")
let mallItem = allMallList.filter(item => item.id === mallId)[0] const mallItem = allMallList.filter(item => item.id === mallId)[0]
if (!mallItem) { if (!mallItem) {
return "" return ""
} }
...@@ -259,7 +268,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -259,7 +268,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
return null return null
} }
if (shopId && shopInfo.shopId && shopInfo.memberId) { if (shopId && shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(shopId) const resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? ( return resUrl ? (
<div className={styles.shop_url}> <div className={styles.shop_url}>
<span>当前店铺链接:</span> <span>当前店铺链接:</span>
...@@ -394,7 +403,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -394,7 +403,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
labelAlign="left" labelAlign="left"
name="customerUrl" name="customerUrl"
label={<RequireItem label="客服链接" />} label={<RequireItem label="客服链接" />}
rules={[{ pattern: /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/, message: '请输入正确的客服链接' }]} rules={[{ pattern: /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?/, message: '请输入正确的客服链接' }]}
> >
<Input allowClear className={styles.form_item} /> <Input allowClear className={styles.form_item} />
</Form.Item> </Form.Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment