Commit 6db11ef2 authored by GuanHua's avatar GuanHua

feat:查询店铺信息接口添加参数

parent 4fc40375
......@@ -12,6 +12,7 @@ import { GetTemplateShopFindShopResponse } from '@/services/TemplateApi'
import copy from 'copy-to-clipboard'
import cx from 'classnames'
import styles from './index.less'
import { getAuth } from '@/utils/auth'
import { isEmpty } from '@formily/antd/esm/shared'
interface ShopInfoPropsType {
......@@ -43,8 +44,11 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
// 根据站点获取商城信息
const fetchAllShop = () => {
//@ts-ignore
PublicApi.getManageShopFindShopsBySiteId({ siteId, type: 1 }).then(res => {
const param: any = {
siteId,
type: 1
}
PublicApi.getManageShopFindShopsBySiteId(param).then(res => {
if (res.code === 1000) {
setAllMallList(res.data)
}
......@@ -55,7 +59,13 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
* 获取店铺信息
*/
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
if (res.code === 1000) {
setShopInfo(data)
......@@ -91,7 +101,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
}
const handleAddNewCitySelect = (item: any) => {
let temp = [...selectCityData]
const temp = [...selectCityData]
temp.push(item)
setSelectCityData(temp)
form.setFieldsValue({
......@@ -135,8 +145,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const handleSave = (e: any) => {
e.preventDefault()
console.log(selectCityData)
form.validateFields().then(value => {
form.validateFields().then((value: any) => {
if (!checkMemberShopAreas(value.memberShopAreas)) {
return
}
......@@ -146,7 +155,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
}
value.storeUrl = storeUrl || `${siteUrl}/shop`
value.shopId = shopId
//@ts-ignore
PublicApi.postTemplateShopSaveShop(value).then(res => {
if (res.code === 1000) {
fetchShopInfo()
......@@ -213,7 +222,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
return null
}
if (shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(mallId)
const resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl)
} else {
setStoreUrl(null)
......@@ -223,7 +232,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const getMallItemAndSetUrl = (mallId) => {
let result = ""
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) {
return ""
}
......@@ -259,7 +268,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
return null
}
if (shopId && shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(shopId)
const resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
......@@ -394,7 +403,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
labelAlign="left"
name="customerUrl"
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} />
</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