Commit 14d1849d authored by GuanHua's avatar GuanHua

feat:修改进货单下单模式参数

parent 6ba0ea85
export default {
'/api': {
'target': 'http://10.0.0.10:8100/',
'target': 'http://10.0.0.25:8100/',
'changeOrigin': true,
'pathRewrite': { '^/api': '' },
}
......
......@@ -50,7 +50,7 @@ const router = [
},
{
path: '/channel/template/preview',
component: '@/pages/preview/shopPreview',
component: '@/pages/preview/channelPreview',
},
{
path: '/shop/template/preview',
......
......@@ -45,7 +45,7 @@
"bizcharts": "^4.0.14",
"copy-to-clipboard": "^3.3.1",
"god": "0.1.28",
"lingxi-design": "^1.0.7",
"lingxi-design": "^1.0.8",
"lingxi-design-ui": "^1.1.9",
"lingxi-editor-core": "^1.0.6",
"lingxi-web": "^1.0.6",
......
......@@ -60,6 +60,11 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
// history.push(`/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
const handleLinkPreview = () => {
window.location.href = `/channel/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}`
}
return (
<DetailPage
title="查看模板"
......@@ -93,7 +98,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
</div>
</div>
</div>
<div className={styles.btn}>
<div className={styles.btn} onClick={() => handleLinkPreview()}>
<EyeOutlined />
<label>预览</label>
</div>
......
......@@ -11,7 +11,7 @@ import { menuData } from './defaultMenu'
import { PublicApi } from '@/services/api'
import styles from './index.less'
interface ChannelEditPropsType {
interface ChannelPreviewPropsType {
location: {
query: {
/**
......@@ -28,7 +28,7 @@ interface ChannelEditPropsType {
let TemplateList = ['science']
const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
const { query: { id, template } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-channel-science')
......@@ -279,4 +279,4 @@ const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
) : <Loading />
}
export default ChannelEdit
\ No newline at end of file
export default ChannelPreview
\ No newline at end of file
......@@ -20,7 +20,7 @@ import { numFormat, priceFormat } from '@/utils/numberFomat'
import jinhuodanIcon from '@/assets/imgs/jinhuodan.png'
import styles from './index.less'
import { isEmpty } from 'lodash'
import { LAYOUT_TYPE, COMMODITY_TYPE } from '@/constants'
import { LAYOUT_TYPE, COMMODITY_TYPE, OrderModalType } from '@/constants'
const Logistics_Type = {
1: '物流',
......@@ -415,6 +415,26 @@ const CommodityDetail = (props) => {
}
/**
* 获取下单模式
*/
const getOrderMode = () => {
let mode = OrderModalType.PURCHASE_ORDER
switch (layoutType) {
case LAYOUT_TYPE.channel:
mode = OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER
break
case LAYOUT_TYPE.ichannel:
mode = OrderModalType.CHANNEL_SPOT_PURCHASE_ORDER
break
default:
mode = OrderModalType.PURCHASE_ORDER
break
}
return mode
}
/**
* 立即购买
*/
const handleToBuy = (priceType: COMMODITY_TYPE = COMMODITY_TYPE.prompt) => {
......@@ -467,7 +487,7 @@ const CommodityDetail = (props) => {
if (res.data) {
window.location.href = getOrderLink(sessionKey, priceType)
} else {
window.location.href = `/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/add?modelType=5&spam_id=${sessionKey}`
window.location.href = `/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/add?modelType=${getOrderMode()}&spam_id=${sessionKey}`
}
})
} else {
......
export const mallLayoutConfig = {
key: "0",
"0": {
"componentName": "MallLayout",
"props": {
"style": {
"width": "100%",
"minHeight": "100%",
"background": "#FFF"
}
},
"childNodes": ["1", "3", "4", "5", "6"]
},
}
export const topBarConfig = {
key: "1",
"1": {
"componentName": "TopBar",
"props": {
linkdisable: true
},
}
}
export const topAdvertConfig = {
key: "2",
"2": {
"componentName": "Advert",
"props": {
"type": "top",
"linkdisable": true,
"advertList": []
},
},
}
export const headerConfig = {
key: "3",
"3": {
"componentName": "ChannelHeader",
"props": {},
},
}
export const mainNavConfig = {
key: "4",
"4": {
"componentName": "MainNav",
"props": {},
},
}
export const bannerAdvertConfig = {
key: "5",
"5": {
"componentName": "Advert",
"props": {
"type": "banner",
"linkdisable": true,
"advertList": []
}
},
}
export const CommonTitle1Config = {
key: "6",
"6": {
"componentName": "CommonTitle",
"props": {
"title": "热销商品",
"type": "primary"
},
},
}
export const serviceAdvertConfig = {
key: "16",
"16": {
"componentName": "Advert",
"props": {
"type": "service",
"linkdisable": true,
"advertList": []
}
},
}
export const CommonTitle2Config = {
key: "17",
"17": {
"componentName": "CommonTitle",
"props": {
"title": "关于我们",
"type": "primary"
},
},
}
export const AboutUsConfig = {
key: "18",
"18": {
"componentName": "AboutUs",
"props": {},
},
}
export const InformationConfig = {
key: '19',
"19": {
"componentName": "Information",
"props": {},
},
}
export const FooterConfig = {
key: '20',
"20": {
"componentName": "Footer",
"props": {},
},
}
export default {
"0": {
"componentName": "MallLayout",
"props": {
"style": {
"width": "100%",
"minHeight": "100%"
}
},
"childNodes": ["1", "2", "3", "4", "5", "7", "8", "18", "19", "20"]
},
"1": {
"componentName": "TopBar",
"props": {
linkdisable: true
},
},
"2": {
"componentName": "Advert",
"props": {
"type": "top",
"linkdisable": true,
"advertList": []
},
},
"3": {
"componentName": "Header",
"props": {},
},
"4": {
"componentName": "MainNav",
"props": {},
},
"5": {
"componentName": "Advert",
"props": {
"type": "banner",
"hasQuickNav": true,
"linkdisable": true,
"advertList": []
// "advertList": [
// {
// id: 1,
// templateId: 707,
// type: 2,
// name: '意大利进口荔枝纹牛皮会员价促销最低 9 折',
// picUrl: 'https://img.alicdn.com/imgextra/i4/81/O1CN01VT5ViO1CT8h4sY7qc_!!81-0-luban.jpg_q100.jpg_.webp',
// link: 'https://www.baidu.com',
// sort: 1,
// },
// {
// id: 2,
// templateId: 707,
// type: 2,
// name: '意大利进口荔枝纹牛皮会员价促销最低 9 折',
// picUrl: 'https://img.alicdn.com/tps/i4/TB1ICgYL.H1gK0jSZSySuttlpXa.jpg',
// link: 'https://www.baidu.com',
// sort: 2,
// }
// ]
}
},
"7": {
"componentName": "Advert",
"props": {
"type": "interact",
"linkdisable": true,
"advertList": []
},
},
"8": {
"componentName": "FloorLine",
"props": {},
"childNodes": ["9", "10"]
},
"9": {
"componentName": "FloorLine.Horizontal",
"props": {},
"childNodes": ["11", "12"]
},
"10": {
"componentName": "FloorLine.Brand",
"props": {},
},
"11": {
"componentName": "FloorLine.Category",
"props": {},
},
"12": {
"componentName": "FloorLine.Vertical",
"props": {},
"childNodes": ["13", "15"]
},
"13": {
"componentName": "FloorLine.FloorHeader",
"props": {},
"childNodes": ["14"]
},
"14": {
"componentName": "FloorLine.Banner",
"props": {
"type": "category",
},
},
"15": {
"componentName": "FloorLine.Horizontal",
"props": {},
"childNodes": ["16", "17"]
},
"16": {
"componentName": "FloorLine.Goods",
"props": {},
},
"17": {
"componentName": "FloorLine.Shops",
"props": {},
},
"18": {
"componentName": "FindMore",
"props": {},
},
"19": {
"componentName": "Information",
"props": {},
},
"20": {
"componentName": "Footer",
"props": {},
},
}
\ No newline at end of file
export const menuData = [
{
"path": "/shop",
"name": "首页",
"key": "shopHome",
},
{
"path": "/shop/commodity",
"name": "商品",
"key": "shopCommodity",
},
{
"path": "/shop/pointsMall",
"name": "积分兑换",
"key": "shopPointsMall",
},
{
"path": "/shop/infomation",
"name": "资讯",
"key": "shopInfomation",
},
{
"path": "/shop/about",
"name": "关于我们",
"key": "shopAbout",
},
]
\ No newline at end of file
@content-height: calc(100vh - 120px);
.wrapper {
background: white;
display: flex;
flex-direction: column;
box-shadow: 2px 0 4px 0 rgba(174, 174, 174, 0.50);
transition: all .3s;
}
.content {
display: flex;
flex: 1;
flex-direction: row;
}
.canvas-container {
display: flex;
flex: 1;
justify-content: center;
background-color: #F4F5F7;
height: calc(@content-height + 50px);
overflow: hidden;
}
.loading_wrap {
width: 100%;
height: 100vh;
justify-content: center;
flex-direction: column;
display: flex;
align-items: center;
.loading_text {
margin-top: 16px;
font-size: 14px;
font-weight: bold;
}
}
\ No newline at end of file
import React, { useEffect, useState } from 'react'
import { LegoProvider } from 'lingxi-editor-core'
import ToolBar from '../../editor/components/toolBar'
import PreviewPanel from '../../editor/components/PreviewPanel'
import config from '../../editor/configs'
import { LAYOUT_TYPE } from '@/constants'
import { topBarConfig, topAdvertConfig, headerConfig, mainNavConfig, bannerAdvertConfig, CommonTitle1Config, mallLayoutConfig, serviceAdvertConfig, CommonTitle2Config, AboutUsConfig, InformationConfig, FooterConfig } from './defaultData'
import Loading from '../../editor/components/Loading'
import { menuData } from './defaultMenu'
import { PublicApi } from '@/services/api'
import styles from './index.less'
interface ChannelEditPropsType {
location: {
query: {
/**
* 模板id
*/
id: number;
/**
* 模板名称
*/
template: string;
}
}
}
let TemplateList = ['science']
const ChannelEdit: React.FC<ChannelEditPropsType> = (props) => {
const { query: { id, template } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [theme, setTheme] = useState<string>('theme-channel-science')
const [componentConfigs, setComponentConfigs] = useState({})
useEffect(() => {
if (!TemplateList.includes(template)) {
setTheme(`theme-channel-${TemplateList[0]}`)
} else {
setTheme(`theme-channel-${template}`)
}
getComponentsConfig()
}, [])
const findFirstAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
templateId: id,
type: 1
}
//@ts-ignore
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
resolve([])
}
})
})
}
const findSecondAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
templateId: id,
type: 2
}
//@ts-ignore
PublicApi.getTemplateChannelFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
resolve([])
}
})
})
}
/**
* 获取所有一级品类信息
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplateChannelFindAllFirstCategory().then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
resolve([])
}
})
})
}
/**
* 获取一级品类详细信息
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
templateId: id,
categoryId
}
// @ts-ignore
PublicApi.getTemplateChannelFindFirstCategoryDetail(param).then(res => {
resolve(res.data)
})
})
}
/**
* 获取渠道信息
*/
const fetchShopInfo = () => {
return new Promise((resolve) => {
PublicApi.getTemplateChannelFindChannel().then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
/**
* 获取头条新闻
*/
const fetchLeadNews = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: 1 }).then(res => {
if (res.code === 1000) {
let leadNewsList: any = res.data || []
if (leadNewsList.length >= 2) {
let leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
let rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
resolve({
leadLeftNews: leftList,
leadRightNews: rightList
})
} else {
resolve({
leadLeftNews: leadNewsList,
leadRightNews: []
})
}
}
})
})
}
/**
* 获取全部栏目
*/
const fetchAllColumn = () => {
return new Promise((resolve) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
let result = ""
let allColumn = res.data
if (allColumn && allColumn.length > 0) {
let labelList = allColumn.map((item: any) => item.name)
let showCount = 4
if (labelList.length <= showCount) {
result = labelList.join(' | ')
} else {
labelList = labelList.slice(0, showCount)
result = labelList.join(' | ') + " ..."
}
}
resolve(result)
}
})
})
}
const getComponentsConfig = async () => {
// 导航栏
mainNavConfig[mainNavConfig.key].props.menuData = menuData
mainNavConfig[mainNavConfig.key].props.type = LAYOUT_TYPE.channel
mainNavConfig[mainNavConfig.key].props.categoryList = []
// 一号位广告
bannerAdvertConfig[bannerAdvertConfig.key].props.advertList = await findFirstAdvertsByType()
// 二号位广告
serviceAdvertConfig[serviceAdvertConfig.key].props.advertList = await findSecondAdvertsByType()
//店铺信息
const channelInfo: any = await fetchShopInfo()
AboutUsConfig[AboutUsConfig.key].props.shopInfo = channelInfo
headerConfig[headerConfig.key].props.logoUrl = channelInfo.logo || ""
topBarConfig[topBarConfig.key].props.shopname = channelInfo.company || ""
// 行情资讯
InformationConfig[InformationConfig.key].props.newsList = await fetchLeadNews()
InformationConfig[InformationConfig.key].props.allColumn = await fetchAllColumn()
let initIndex = 100
let floorLineConfig: any = {}
let floorLineKeys: any = []
let firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id)
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
let FloorLine = {
[String(initIndex + 1)]: {
"componentName": "ShopFloorLine",
"props": {
title: item.name
},
"childNodes": [String(initIndex + 2), String(initIndex + 3)]
}
}
let Category = {
[String(initIndex + 2)]: {
"componentName": "ShopFloorLine.Category",
"props": {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.id,
categoryList: categoryDetail.categoryBOList
},
},
}
let Goods = {
[String(initIndex + 3)]: {
"componentName": "ShopFloorLine.Goods",
"props": {
linkdisable: true,
categoryid: item.id,
goodsList: categoryDetail.goodsBOList
},
},
}
floorLineConfigItem = { ...FloorLine, ...Category, ...Goods }
floorLineConfig = { ...floorLineConfig, ...floorLineConfigItem }
initIndex += 100
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, serviceAdvertConfig.key, CommonTitle2Config.key, AboutUsConfig.key, InformationConfig.key, FooterConfig.key]
let config = {
...mallLayoutConfig,
...topBarConfig,
...topAdvertConfig,
...headerConfig,
...mainNavConfig,
...bannerAdvertConfig,
...CommonTitle1Config,
...floorLineConfig,
...serviceAdvertConfig,
...CommonTitle2Config,
...AboutUsConfig,
...InformationConfig,
...FooterConfig
}
setComponentConfigs(config)
setLoading(false)
}
return !loading ? (
<LegoProvider initState={{ componentConfigs: componentConfigs }} config={config}>
<div className={styles['wrapper']}>
<ToolBar type={2} title="首页" />
<div className={styles['content']}>
<div className={styles['canvas-container']}>
<PreviewPanel theme={theme} />
</div>
</div>
</div>
</LegoProvider>
) : <Loading />
}
export default ChannelEdit
\ No newline at end of file
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