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