Commit 5a3d043c authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents e98846d9 583c7861
......@@ -4,19 +4,19 @@ import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import TemplateItem from '../components/templateItem'
import { PublicApi } from '@/services/api'
import { GetTemplateShopFindAllShelfShopTemplateResponse } from '@/services'
import { GetTemplateWebPageTemplateWebFindAllShelfChannelTemplateResponse } from '@/services/TemplateApi'
import styles from './index.less'
const ShopTemplate: React.FC = () => {
const [templateList, setTemplateList] = useState<GetTemplateShopFindAllShelfShopTemplateResponse>([])
const [templateList, setTemplateList] = useState<GetTemplateWebPageTemplateWebFindAllShelfChannelTemplateResponse>([])
useEffect(() => {
fetchAllShelfShopTemplate()
}, [])
const fetchAllShelfShopTemplate = () => {
PublicApi.getTemplateChannelFindAllShelfChannelTemplate().then(res => {
PublicApi.getTemplateWebPageTemplateWebFindAllShelfChannelTemplate().then(res => {
if (res.code === 1000) {
setTemplateList(res.data)
} else if (res.code === 47001) {
......
......@@ -6,7 +6,7 @@ import DetailPage from '@/components/DetailPage'
import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants'
import { GetTemplateShopFindShopTemplateDetailsResponse } from '@/services'
import { GetTemplateWebPageTemplateWebFindChannelTemplateDetailsResponse } from '@/services/TemplateApi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less'
......@@ -21,7 +21,7 @@ interface TemplateDetailPropsType {
const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const { query: { type, id } } = props.location
const [detailInfo, setDetailInfo] = useState<GetTemplateShopFindShopTemplateDetailsResponse>()
const [detailInfo, setDetailInfo] = useState<GetTemplateWebPageTemplateWebFindChannelTemplateDetailsResponse>()
const [useModalVisible, setUseModalVisible] = useState<boolean>(false)
const [confirmLoading, setConfirmLoading] = useState(false)
......@@ -30,8 +30,10 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
}, [])
const fetchDetail = () => {
//@ts-ignore
PublicApi.getTemplateChannelFindChannelTemplateDetails({ id }).then(res => {
const param: any = {
id
}
PublicApi.getTemplateWebPageTemplateWebFindChannelTemplateDetails(param).then(res => {
if (res.code === 1000) {
setDetailInfo(res.data)
}
......@@ -43,8 +45,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
*/
const handleConfirmUse = () => {
setConfirmLoading(true)
//@ts-ignore
PublicApi.postTemplateChannelUseChannelTemplate({ id }).then(res => {
PublicApi.postTemplateWebPageTemplateWebUseChannelTemplate({ id }).then(res => {
if (res.code === 1000) {
setUseModalVisible(false)
fetchDetail()
......
......@@ -486,7 +486,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
}} />
)
}
<PayWay supplyMembersId={orderInfo.supplyMembersId} supplyMembersRoleId={orderInfo.supplyMembersRoleId} selectItem={selectPayWay} payWayList={orderInfo.payWayList} onChange={(val) => setSelectPayWay(val)} />
<PayWay supplyMembersId={orderInfo.supplyMembersId} deliveryType={orderInfo.logistics.deliveryType} supplyMembersRoleId={orderInfo.supplyMembersRoleId} selectItem={selectPayWay} payWayList={orderInfo.payWayList} onChange={(val) => setSelectPayWay(val)} />
{/* <Delivery /> */}
{
orderInfo.isInvoice && <Invoice state={needTheInvoice} onChange={(val) => setNeedTheInvoice(val)} onSelect={(val) => setSelectInvoiceInfo(val)} />
......
......@@ -14,15 +14,16 @@ interface PayWayProps {
selectItem: any;
supplyMembersId: number;
supplyMembersRoleId: number;
deliveryType?: number;
}
const PayWay: React.FC<PayWayProps> = (props) => {
const { payWayList = [], onChange, selectItem = {}, supplyMembersId, supplyMembersRoleId } = props
const { payWayList = [], onChange, selectItem = {}, supplyMembersId, deliveryType = 1, supplyMembersRoleId } = props
const [expand, setExpand] = useState<boolean>(false)
const [creditInfo, setCreditInfo] = useState<GetPayCreditGetCreditResponse>()
const handleSelectWay = (item) => {
if (item.payType === 3) {
if (item.payType === 3 || item.payType === 4) {
if (!getCreditState(item)) {
return
}
......@@ -41,11 +42,11 @@ const PayWay: React.FC<PayWayProps> = (props) => {
}, [payWayList])
const fetchCreditInfo = () => {
let param = {
const param: any = {
parentMemberId: supplyMembersId,
parentMemberRoleId: supplyMembersRoleId
}
//@ts-ignore
PublicApi.getPayCreditGetCredit(param).then(res => {
if(res.code === 1000) {
setCreditInfo(res.data)
......@@ -62,6 +63,12 @@ const PayWay: React.FC<PayWayProps> = (props) => {
} else if (creditInfo.isUsable === 0) {
result = false
}
} else if(info.payType === 4) {
if(deliveryType !== 1) {
result = false
} else {
result = true
}
}
return result
}
......
import React, { useEffect, useState } from 'react'
import { Row, Col, message } from 'antd'
import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import TemplateItem from '../components/templateItem'
import { PublicApi } from '@/services/api'
import { GetTemplateShopFindAllShelfShopTemplateResponse } from '@/services'
import styles from './index.less'
const ShopTemplate: React.FC = () => {
const [templateList, setTemplateList] = useState<GetTemplateShopFindAllShelfShopTemplateResponse>([])
useEffect(() => {
fetchAllShelfShopTemplate()
}, [])
const fetchAllShelfShopTemplate = () => {
PublicApi.getTemplateShopFindAllShelfShopTemplate().then(res => {
if (res.code === 1000) {
setTemplateList(res.data)
} else if (res.code === 47001) {
message.destroy()
message.info("您还未创建店铺,请先创建店铺")
setTimeout(() => {
history.push('/memberCenter/shopAbility/infoManage')
}, 2000);
}
})
}
return (
<PageHeaderWrapper>
<div className={styles.shop_center_template}>
<Row gutter={24} className={styles.template_list}>
{
templateList.map(item => (
<Col xxl={6} xl={8} lg={12} key={item.id}>
<TemplateItem templateInfo={item} type="shop" />
</Col>
))
}
</Row>
</div>
</PageHeaderWrapper>
)
}
export default ShopTemplate
import React, { useEffect, useState } from 'react'
import { Row, Col, message } from 'antd'
import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import TemplateItem from '../components/templateItem'
import { PublicApi } from '@/services/api'
import { GetTemplateWebPageTemplateWebFindAllShelfShopTemplateResponse } from '@/services/TemplateApi'
import styles from './index.less'
const ShopTemplate: React.FC = () => {
const [templateList, setTemplateList] = useState<GetTemplateWebPageTemplateWebFindAllShelfShopTemplateResponse>([])
useEffect(() => {
fetchAllShelfShopTemplate()
}, [])
const fetchAllShelfShopTemplate = () => {
PublicApi.getTemplateWebPageTemplateWebFindAllShelfShopTemplate().then(res => {
if (res.code === 1000) {
setTemplateList(res.data)
} else if (res.code === 47001) {
message.destroy()
message.info("您还未创建店铺,请先创建店铺")
setTimeout(() => {
history.push('/memberCenter/shopAbility/infoManage')
}, 2000);
}
})
}
return (
<PageHeaderWrapper>
<div className={styles.shop_center_template}>
<Row gutter={24} className={styles.template_list}>
{
templateList.map(item => (
<Col xxl={6} xl={8} lg={12} key={item.id}>
<TemplateItem templateInfo={item} type="shop" />
</Col>
))
}
</Row>
</div>
</PageHeaderWrapper>
)
}
export default ShopTemplate
import React, { useState, useEffect } from 'react'
import { LayoutOutlined, EyeOutlined, PushpinOutlined } from '@ant-design/icons'
import cx from 'classnames'
import DetailPage from '@/components/DetailPage'
import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants'
import { GetTemplateShopFindShopTemplateDetailsResponse } from '@/services'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less'
interface TemplateDetailPropsType {
location: {
query: {
id: number;
type: string; // 商城模板:shopCenter ;店铺模板:shop; 商品描述模板: goods
}
}
}
const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const { query: { type, id } } = props.location
const [detailInfo, setDetailInfo] = useState<GetTemplateShopFindShopTemplateDetailsResponse>()
const [useModalVisible, setUseModalVisible] = useState<boolean>(false)
const [confirmLoading, setConfirmLoading] = useState(false)
useEffect(() => {
fetchDetail()
}, [])
const fetchDetail = () => {
//@ts-ignore
PublicApi.getTemplateShopFindShopTemplateDetails({ id }).then(res => {
if (res.code === 1000) {
setDetailInfo(res.data)
}
})
}
/**
* 使用模板
*/
const handleConfirmUse = () => {
setConfirmLoading(true)
//@ts-ignore
PublicApi.postTemplateShopUseShopTemplate({ id }).then(res => {
if (res.code === 1000) {
setUseModalVisible(false)
fetchDetail()
}
setConfirmLoading(false)
}).catch(() => {
setConfirmLoading(false)
})
}
const handleLinkEdit = () => {
window.location.href = `/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
// history.push(`/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
const handleLinkPreview = () => {
window.location.href = `/shop/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}`
}
return (
<DetailPage
title="查看模板"
>
<div className={styles.template_detail}>
<div className={styles.template_info_wrap}>
<div className={styles.template_img_box}>
<div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div>
<img src={default_img} />
</div>
<div className={styles.template_info}>
<div className={styles.template_info_line}>
<label>模板名称:</label>
<span>{detailInfo?.templateName}</span>
</div>
<div className={styles.template_info_line}>
<label>适用环境:</label>
<span>{Environment_Status[detailInfo?.environment]}</span>
</div>
<div className={styles.template_info_line}>
<label>模板描述:</label>
<span>{detailInfo?.templateDescribe}</span>
</div>
<div className={styles.template_info_line}>
<label>使用站点:</label>
<span>{detailInfo?.siteName}</span>
</div>
<div className={styles.template_info_line}>
<label>使用商城:</label>
<span>{detailInfo?.shopName}</span>
</div>
</div>
</div>
<div className={styles.btn} onClick={() => handleLinkPreview()}>
<EyeOutlined />
<label>预览</label>
</div>
<div className={cx(styles.btn, styles.fit)} onClick={() => handleLinkEdit()}>
<LayoutOutlined />
<label>店铺装修</label>
</div>
<div className={cx(styles.btn, detailInfo?.use === 1 ? styles.use : '')} onClick={() => detailInfo?.use !== 1 ? setUseModalVisible(true) : {}}>
<PushpinOutlined />
<label>{detailInfo?.use === 1 ? '使用中' : '使用'}</label>
</div>
<UseModal
title="使用店铺模板"
visible={useModalVisible}
dataInfo={detailInfo}
confirmLoading={confirmLoading}
onOk={() => handleConfirmUse()}
onCancel={() => setUseModalVisible(false)}
/>
</div>
</DetailPage>
)
}
export default TemplateDetail
import React, { useState, useEffect } from 'react'
import { LayoutOutlined, EyeOutlined, PushpinOutlined } from '@ant-design/icons'
import cx from 'classnames'
import DetailPage from '@/components/DetailPage'
import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants'
import { GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse } from '@/services/TemplateApi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less'
interface TemplateDetailPropsType {
location: {
query: {
id: number;
type: string; // 商城模板:shopCenter ;店铺模板:shop; 商品描述模板: goods
}
}
}
const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const { query: { type, id } } = props.location
const [detailInfo, setDetailInfo] = useState<GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse>()
const [useModalVisible, setUseModalVisible] = useState<boolean>(false)
const [confirmLoading, setConfirmLoading] = useState(false)
useEffect(() => {
fetchDetail()
}, [])
const fetchDetail = () => {
const param: any = {
id
}
PublicApi.getTemplateWebPageTemplateWebFindShopTemplateDetails(param).then(res => {
if (res.code === 1000) {
setDetailInfo(res.data)
}
})
}
/**
* 使用模板
*/
const handleConfirmUse = () => {
setConfirmLoading(true)
PublicApi.postTemplateWebPageTemplateWebUseShopTemplate({ id }).then(res => {
if (res.code === 1000) {
setUseModalVisible(false)
fetchDetail()
}
setConfirmLoading(false)
}).catch(() => {
setConfirmLoading(false)
})
}
const handleLinkEdit = () => {
window.location.href = `/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
// history.push(`/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
const handleLinkPreview = () => {
window.location.href = `/shop/template/preview?id=${detailInfo.id}&template=${detailInfo.fileName}`
}
return (
<DetailPage
title="查看模板"
>
<div className={styles.template_detail}>
<div className={styles.template_info_wrap}>
<div className={styles.template_img_box}>
<div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div>
<img src={default_img} />
</div>
<div className={styles.template_info}>
<div className={styles.template_info_line}>
<label>模板名称:</label>
<span>{detailInfo?.templateName}</span>
</div>
<div className={styles.template_info_line}>
<label>适用环境:</label>
<span>{Environment_Status[detailInfo?.environment]}</span>
</div>
<div className={styles.template_info_line}>
<label>模板描述:</label>
<span>{detailInfo?.templateDescribe}</span>
</div>
<div className={styles.template_info_line}>
<label>使用站点:</label>
<span>{detailInfo?.siteName}</span>
</div>
<div className={styles.template_info_line}>
<label>使用商城:</label>
<span>{detailInfo?.shopName}</span>
</div>
</div>
</div>
<div className={styles.btn} onClick={() => handleLinkPreview()}>
<EyeOutlined />
<label>预览</label>
</div>
<div className={cx(styles.btn, styles.fit)} onClick={() => handleLinkEdit()}>
<LayoutOutlined />
<label>店铺装修</label>
</div>
<div className={cx(styles.btn, detailInfo?.use === 1 ? styles.use : '')} onClick={() => detailInfo?.use !== 1 ? setUseModalVisible(true) : {}}>
<PushpinOutlined />
<label>{detailInfo?.use === 1 ? '使用中' : '使用'}</label>
</div>
<UseModal
title="使用店铺模板"
visible={useModalVisible}
dataInfo={detailInfo}
confirmLoading={confirmLoading}
onOk={() => handleConfirmUse()}
onCancel={() => setUseModalVisible(false)}
/>
</div>
</DetailPage>
)
}
export default TemplateDetail
import { action, computed, observable, runInAction } from 'mobx'
import { ISiteModule } from '@/module/siteModule'
import { GlobalConfig } from '@/global/config'
import { PublicApi } from '@/services/api'
class SiteStore implements ISiteModule {
// 可在根目录下的demo.js修改数据
@observable public siteId: number = GlobalConfig.global.siteInfo.id; // 站点id
@observable public siteUrl: string = GlobalConfig.global.siteInfo.siteUrl; // 站点域名
@observable public mallTemplateId: number = null; // 企业商城模板id
@observable public mallTemplateInfo: any = {}; // 企业商城模板id
@observable public shopTemplateId: number = null; // 店铺模板id
@observable public channelTemplateId: number = null; // 渠道模板id
@observable public commodityTemplateInfo: any = {}
/**
* 根据站点查询正在使用的商城模板
*/
@action.bound
public findUseMallTemplate = async () => {
const tempMallTemplateInfo = sessionStorage.getItem("mallTemplateInfo")
if (tempMallTemplateInfo) {
this.mallTemplateInfo = JSON.parse(tempMallTemplateInfo)
this.mallTemplateId = this.mallTemplateInfo.id
return
}
const param: any = {
siteId: this.siteId
}
const res = await PublicApi.getTemplatePlatformFindUseTemplateBySite(param)
runInAction(() => {
this.mallTemplateInfo = res.data || {}
this.mallTemplateId = this.mallTemplateInfo.id
sessionStorage.setItem("mallTemplateInfo", JSON.stringify(this.mallTemplateInfo))
})
}
/**
* 根据站点查询正在使用的商品描述模板
*/
@action.bound
public findUseGoodsTemplate = async () => {
const tempCommodityTemplateInfo = sessionStorage.getItem("commodityTemplateInfo")
if (tempCommodityTemplateInfo) {
this.commodityTemplateInfo = JSON.parse(tempCommodityTemplateInfo)
return
}
const param: any = {
siteId: this.siteId
}
const res = await PublicApi.getTemplateGoodsFindUseGoodsTemplate(param)
runInAction(() => {
if(res.code === 1000) {
this.commodityTemplateInfo = res.data
sessionStorage.setItem("commodityTemplateInfo", JSON.stringify(this.commodityTemplateInfo))
}
})
}
}
export default SiteStore
import { action, computed, observable, runInAction } from 'mobx'
import { ISiteModule } from '@/module/siteModule'
import { GlobalConfig } from '@/global/config'
import { PublicApi } from '@/services/api'
class SiteStore implements ISiteModule {
// 可在根目录下的demo.js修改数据
@observable public siteId: number = GlobalConfig.global.siteInfo.id; // 站点id
@observable public siteUrl: string = GlobalConfig.global.siteInfo.siteUrl; // 站点域名
@observable public mallTemplateId: number = null; // 企业商城模板id
@observable public mallTemplateInfo: any = {}; // 企业商城模板id
@observable public shopTemplateId: number = null; // 店铺模板id
@observable public channelTemplateId: number = null; // 渠道模板id
@observable public commodityTemplateInfo: any = {}
/**
* 根据站点查询正在使用的商城模板
*/
@action.bound
public findUseMallTemplate = async () => {
const tempMallTemplateInfo = sessionStorage.getItem("mallTemplateInfo")
if (tempMallTemplateInfo) {
this.mallTemplateInfo = JSON.parse(tempMallTemplateInfo)
this.mallTemplateId = this.mallTemplateInfo.id
return
}
const param: any = {
siteId: this.siteId
}
const res = await PublicApi.getTemplatePlatformFindUseTemplateBySite(param)
runInAction(() => {
this.mallTemplateInfo = res.data || {}
this.mallTemplateId = this.mallTemplateInfo.id
sessionStorage.setItem("mallTemplateInfo", JSON.stringify(this.mallTemplateInfo))
})
}
/**
* 根据站点查询正在使用的商品描述模板
*/
@action.bound
public findUseGoodsTemplate = async () => {
const tempCommodityTemplateInfo = sessionStorage.getItem("commodityTemplateInfo")
if (tempCommodityTemplateInfo) {
this.commodityTemplateInfo = JSON.parse(tempCommodityTemplateInfo)
return
}
const param: any = {
siteId: this.siteId
}
const res = await PublicApi.getTemplateWebPageTemplateWebFindGoodsDescribeTemplate(param)
runInAction(() => {
if(res.code === 1000) {
this.commodityTemplateInfo = res.data
sessionStorage.setItem("commodityTemplateInfo", JSON.stringify(this.commodityTemplateInfo))
}
})
}
}
export default SiteStore
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