Commit b0dedd51 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 1b2dbe82 46e3ee71
......@@ -29,7 +29,7 @@ export const environmentList = [
value: H5,
},
{
label: 'APPLETS',
label: '小程序',
value: APPLETS,
},
{
......
......@@ -140,22 +140,23 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
})
}
// const getCategoryTree = () => {
// return new Promise((resolve) => {
// const param: any = {
// templateId: id,
// categoryId,
// memberId,
// roleId: memberRoleId
// }
const getCategoryTree = () => {
return new Promise((resolve) => {
const param: any = {
memberId,
}
const headers: any = {
shopId
}
// PublicApi.getTemplateAdornWebSelfMemberCategoryAdorn(param).then(res => {
// if (res.code === 1000) {
// resolve(res.data)
// }
// })
// })
// }
PublicApi.getSearchShopSelfGetCustomerCategoryTree(param, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
const fetchNewByLabel = (label: string) => {
// 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读
......@@ -186,7 +187,7 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
mainNavConfig[mainNavConfig.key].props.menuData = getDefaultMenuData(mallPath, memberId);
}
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = []
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
// 一号位广告
oneBannerConfig[oneBannerConfig.key].props.advertList = await findAdvertsByType(1)
......
......@@ -139,22 +139,23 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
})
}
// const getCategoryTree = () => {
// return new Promise((resolve) => {
// const param: any = {
// templateId: id,
// categoryId,
// memberId,
// roleId: memberRoleId
// }
const getCategoryTree = () => {
return new Promise((resolve) => {
const param: any = {
memberId,
}
const headers: any = {
shopId
}
// PublicApi.getTemplateAdornWebSelfMemberCategoryAdorn(param).then(res => {
// if (res.code === 1000) {
// resolve(res.data)
// }
// })
// })
// }
PublicApi.getSearchShopSelfGetCustomerCategoryTree(param, { headers }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
const fetchNewByLabel = (label: string) => {
// 1-头条文章 2-轮播新闻 3-图片新闻 4-推荐阅读
......@@ -180,7 +181,7 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
mainNavConfig[mainNavConfig.key].props.menuData = menuData;
}
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.shop
mainNavConfig[mainNavConfig.key].props.categoryList = []
mainNavConfig[mainNavConfig.key].props.categoryList = await getCategoryTree()
// 一号位广告
oneBannerConfig[oneBannerConfig.key].props.advertList = await findAdvertsByType(1)
......
......@@ -51,10 +51,10 @@ const OwnMallAboutUs = () => {
const [saveLoading, setSaveLoading] = useState<boolean>(false)
const [isFormChange, setIsFormChange] = useState<boolean>(false)
const [albumUrls, setAlbumUrls] = useState<any[]>([])
const [albumUrls, setAlbumUrls] = useState<any[]>([])
const [allMallList, setAllMallList] = useState<any[]>([])
const [selectCityData, setSelectCityData] = useState<any>([defaultCityData])
const [mallUrl, setMallUrl] = useState<string>()
const [mallUrl, setMallUrl] = useState<string>()
const getAlbumUrls = (data) => {
setAlbumUrls(data);
......@@ -151,9 +151,9 @@ const OwnMallAboutUs = () => {
if (code === 1000 && data) {
const { albumName, albumUrl, honorPics, workshopPics, ...rest } = data
const newAlbumUrls = albumName && albumUrl ? [{ name: albumName, url: albumUrl }] : []
workshopImgRef.current.setData(workshopPics)
honorImgRef.current.setData(honorPics)
workshopImgRef.current?.setData(workshopPics)
honorImgRef.current?.setData(honorPics)
form.setFieldsValue({
...rest,
albumUrls: newAlbumUrls
......@@ -272,4 +272,4 @@ const OwnMallAboutUs = () => {
)
}
export default observer(OwnMallAboutUs)
\ No newline at end of file
export default observer(OwnMallAboutUs)
import React, {useState, useEffect, useRef} from 'react'
import React, { useState, useEffect, useRef } from 'react'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { ISchemaFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
......@@ -27,8 +27,8 @@ export interface PriceSettingProps {
formSubmit?(values),
}
const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const { addSchemaAction, schema, formSubmit, onFieldChange = () => {} } = props
const PriceSetting: React.FC<PriceSettingProps> = (props) => {
const { addSchemaAction, schema, formSubmit, onFieldChange = () => { } } = props
const priceRef = useRef<any>({})
const productRef = useRef<any>({})
const memberRef = useRef<any>({})
......@@ -48,8 +48,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
} = usePageStatus()
useEffect(() => {
if(id) {
PublicApi.getProductCommodityGetUnitPriceStrategy({id}).then(res => {
if (id) {
PublicApi.getProductCommodityGetUnitPriceStrategy({ id }).then(res => {
const { initValue } = transformDataForNiceForm(res.data, addSchemaAction)
setInitialFormValue(initValue)
dataRef.current = initValue
......@@ -68,7 +68,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
addSchemaAction.setFieldState('commodityMemberList', state => {
state.isDelete = true
})
if(pageStatus === PageStatus.EDIT) {
if (pageStatus === PageStatus.EDIT) {
let hasMember = memberRef.current.rowSelectionCtl.selectRow
memberRef.current.rowSelectionCtl.setSelectRow(hasMember.filter(item => item.memberId != reocrd.memberId))
}
......@@ -93,7 +93,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const handleSetProductPrice = (record: any) => {
console.log(record, 'record')
if(record?.id) {
if (record?.id) {
priceRef.current.setVisible(true)
priceRef.current.setCurrentSetPriceRow(record)
}
......@@ -125,27 +125,27 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
}
const searchMember = (value) => {
if(!value) {
if (!value) {
addSchemaAction.setFieldValue("commodityMemberList", addSchemaAction.getFieldState("commodityMemberList")["dataSource"])
return ;
return;
}
let commodityMemberList = addSchemaAction.getFieldValue("commodityMemberList").filter(item => item.name.indexOf(value) !== -1)
addSchemaAction.setFieldValue("commodityMemberList", commodityMemberList)
}
/**
* 生成价格设置 table 和会员 column
* @param pId 商品id
* @param ctx action
* @param priceType 价格类型(可选)1现货2询价
*/
/**
* 生成价格设置 table 和会员 column
* @param pId 商品id
* @param ctx action
* @param priceType 价格类型(可选)1现货2询价
*/
const producePriceTableMemerColumn = async (pId, ctx, priceType?) => {
const res = await PublicApi.getProductCommodityGetCommodityUnitPrice({ id: pId,})
const res = await PublicApi.getProductCommodityGetCommodityUnitPrice({ id: pId, })
// 填充价格设置table(编辑采用initValue数据)
let source = pageStatus === PageStatus.ADD ? res.data : dataRef.current["memberUnitPriceList"]
const { columsUnit, tableUnitData } = constructTableData(source, ctx, pageStatus)
const { columsUnit, tableUnitData } = constructTableData(source, ctx, pageStatus)
ctx.setFieldState("memberUnitPriceList", state => {
state.dataSource = source // 存源数据
priceType !== 2 ? columsUnit.push({
......@@ -154,8 +154,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
align: 'center',
render: (_i, _r) => <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleSetProductPrice(_r)}>设置价格</Button>
})
:
columsUnit.pop()
:
columsUnit.pop()
state.props["x-component-props"].columns = columsUnit
})
ctx.setFieldValue("memberUnitPriceList", priceType === 2 ? tableUnitData.map(item => { delete item["单价"]; return item }) : tableUnitData)
......@@ -164,7 +164,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// 填充适用会员table
ctx.setFieldState("commodityMemberList", state => {
memberColumns[memberColumns.length -1].render = (text, record) => {
memberColumns[memberColumns.length - 1].render = (text, record) => {
return <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleDeleteMemberTable(record)}>删除</Button>
}
state.props["x-component-props"].columns = memberColumns
......@@ -173,21 +173,21 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// 新增会员
const tableAddMemberButton = pageStatus !== PageStatus.PREVIEW && <>
<p style={{display: 'flex', justifyContent: 'flex-end', flexWrap: 'wrap'}}>
<p style={{ display: 'flex', justifyContent: 'flex-end', flexWrap: 'wrap' }}>
<Search
placeholder="会员名称"
onSearch={value => searchMember(value)}
style={{ width: 256 }}
/>
</p>
<Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} onClick={handleAddMemberBtn} type='dashed'>选择指定会员</Button>
<Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={handleAddMemberBtn} type='dashed'>选择指定会员</Button>
</>
// 批量设置价格按钮
const batchPriceButton = pageStatus!==PageStatus.PREVIEW && priceType!==2 && <Button type="text" onClick={clickBatchSetPrice} style={{marginBottom: 12, float: "right"}}><SettingOutlined /> 批量设置价格</Button>
const batchPriceButton = pageStatus !== PageStatus.PREVIEW && priceType !== 2 && <Button type="text" onClick={clickBatchSetPrice} style={{ marginBottom: 12, float: "right" }}><SettingOutlined /> 批量设置价格</Button>
// 选择商品
const connectProduct = pageStatus === PageStatus.ADD && <div className='connectBtn' onClick={handleAddProductBtn}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const connectProduct = pageStatus === PageStatus.ADD && <div className='connectBtn' onClick={handleAddProductBtn}><LinkOutlined style={{ marginRight: 4 }} />选择</div>
const questionNameLabel = <>
价格策略名称&nbsp;
......@@ -232,16 +232,16 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// state.dataSource = pageStatus === PageStatus.PREVIEW ?
// GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id))
// :
state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
if(pageStatus === PageStatus.EDIT) {
state.props['x-component-props'].disabled = true;
}
if (pageStatus === PageStatus.EDIT) {
state.props['x-component-props'].disabled = true;
}
})
ctx.setFieldState('priceType', state => {
if(pageStatus === PageStatus.EDIT) {
state.props['x-component-props'].disabled = true;
}
if (pageStatus === PageStatus.EDIT) {
state.props['x-component-props'].disabled = true;
}
});
}
})
......@@ -254,7 +254,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
$("onFieldValueChange", "priceType").subscribe(parentState => {
let pId = ctx.getFieldValue("productId")
if(pId) {
if (pId) {
producePriceTableMemerColumn(pId, ctx, parentState.value)
}
setPriceType(parentState.value)
......
......@@ -138,7 +138,7 @@ const Add = () => {
}, [initialValue]);
const fetchMallData = async (params: { siteId: string, environment: string}) => {
const { code, data } = await PublicApi.getManageShopFindShopsBySiteIdAndEnvironment(params);
const { code, data } = await PublicApi.postManageWebShopWebAll(params as any, { ctlType: 'none' });
if (code === 1000) {
return data.map((_item) => {
return {
......
......@@ -16,17 +16,36 @@ const ScanLoginWrap: React.FC = () => {
time -= 2;
console.log(time);
timer.current = setTimeout(() => {
loginInfo(authCode)
const code = getUrlParam(authCode, 'authCode');
loginInfo(code)
hanleCountdown(authCode);
}, 2000);
return;
} else {
AuthCode();
time = 60 * 5;
}
}
const getUrlParam = (url: string, name: string) => {
const paraString: any = url.substring(url.indexOf("?") + 1, url.length).split("&");
const paraObj: any = {};
let j: any;
// eslint-disable-next-line no-cond-assign
// eslint-disable-next-line no-plusplus
for (let i = 0; j = paraString[i]; i++) {
paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
}
const returnValue: any = paraObj[name.toLowerCase()];
if (typeof (returnValue) === "undefined") {
return "";
}
return returnValue;
}
const AuthCode = () => {
PublicApi.postMemberAuthCode({}, { ctlType: 'none' }).then(res => {
hanleCountdown(res.data.authCode);
QRCode.toDataURL(res.data.authCode).then((url: any) => {
// /member/login/authUrl
PublicApi.postMemberLoginAuthUrl({}, { ctlType: 'none' }).then(res => {
hanleCountdown(res.data.authUrl);
QRCode.toDataURL(res.data.authUrl).then((url: any) => {
setQrCode(url)
console.log(url)
})
......@@ -53,6 +72,9 @@ const ScanLoginWrap: React.FC = () => {
} else {
window.location.replace('/memberCenter/home')
}
console.log(redirect, 'redirect')
clearTimeout(timer.current)
timer.current = null
}
})
}
......
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