Commit 57f52f00 authored by GuanHua's avatar GuanHua

Merge branch 'dev' into test

parents 3b99726b 90f46fa3
...@@ -32,13 +32,15 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => { ...@@ -32,13 +32,15 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
} }
}, [min, max]) }, [min, max])
const handleReduce = () => { const handleReduce = (e) => {
e.stopPropagation()
if (value > minCount) { if (value > minCount) {
onChange(Number(value) - 1) onChange(Number(value) - 1)
} }
} }
const handleAdd = () => { const handleAdd = (e) => {
e.stopPropagation()
if (value < maxCount) { if (value < maxCount) {
onChange(Number(value) + 1) onChange(Number(value) + 1)
} }
......
...@@ -31,6 +31,17 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -31,6 +31,17 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
} }
} }
const handleCollect = () => {
let param = {
shopId: shopInfo.shopId,
status: true
}
PublicApi.postTemplateShopCollect(param).then(res => {
if (res.code === 1000) {
}
})
}
return ( return (
<div className={styles.shop_info}> <div className={styles.shop_info}>
...@@ -72,7 +83,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => { ...@@ -72,7 +83,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<div className={styles.dashed_split}></div> <div className={styles.dashed_split}></div>
<div className={styles.shop_info_btn_group}> <div className={styles.shop_info_btn_group}>
<div className={styles.shop_info_btn}><Link to={`/shop?shopId=${shopUrlParam}`}>进入店铺</Link></div> <div className={styles.shop_info_btn}><Link to={`/shop?shopId=${shopUrlParam}`}>进入店铺</Link></div>
<div className={styles.shop_info_btn}>收藏本店</div> <div className={styles.shop_info_btn} onClick={() => handleCollect()}>收藏本店</div>
</div> </div>
<Button loading={applyLoading} className={styles.apply_member_btn} onClick={() => applyFroVip()}>申请成为本店会员</Button> <Button loading={applyLoading} className={styles.apply_member_btn} onClick={() => applyFroVip()}>申请成为本店会员</Button>
</div> </div>
......
...@@ -12,11 +12,12 @@ const { Dragger } = Upload ...@@ -12,11 +12,12 @@ const { Dragger } = Upload
interface TransferPayWayPropsType { interface TransferPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse payInfo: GetOrderOrderPayDetailsResponse
orderId: number orderId: number,
onChange: Function
} }
const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => { const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
const { payInfo, orderId } = props const { payInfo, orderId, onChange } = props
const [loading, setLoading] = useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const [payOrderUrl, setPayOrderUrls] = useState<string>() const [payOrderUrl, setPayOrderUrls] = useState<string>()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false) const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
...@@ -75,11 +76,13 @@ const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => { ...@@ -75,11 +76,13 @@ const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
if (res.code === 1000) { if (res.code === 1000) {
message.destroy() message.destroy()
message.success("支付成功") message.success("支付成功")
onChange(true)
} else { } else {
setConfirmLoading(false) setConfirmLoading(false)
onChange(false)
} }
}).catch(() => { }).catch(() => {
onChange(false)
setConfirmLoading(false) setConfirmLoading(false)
}) })
} }
......
...@@ -48,6 +48,7 @@ const getPayTypeTitle = (type) => { ...@@ -48,6 +48,7 @@ const getPayTypeTitle = (type) => {
const PayPage: React.FC<PayPagePropsType> = (props) => { const PayPage: React.FC<PayPagePropsType> = (props) => {
const { shopInfo, mallInfo, layoutType, } = props const { shopInfo, mallInfo, layoutType, } = props
const [payState, setPayState] = useState<boolean>(false)
const { orderId } = props.location.query const { orderId } = props.location.query
const [pageTitle, setPageTitle] = useState<string>() const [pageTitle, setPageTitle] = useState<string>()
const [payType] = useState<string | number>(PayWayType.bank) const [payType] = useState<string | number>(PayWayType.bank)
...@@ -72,6 +73,10 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -72,6 +73,10 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
}) })
} }
const handlePayChangge = (state) => {
setPayState(state)
}
const renderPayWay = () => { const renderPayWay = () => {
if (!payInfo) { if (!payInfo) {
return return
...@@ -89,7 +94,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -89,7 +94,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
case PayWayType.bank: case PayWayType.bank:
return <BankPayWay /> return <BankPayWay />
case PayWayType.transfer: case PayWayType.transfer:
return <TransferPayWay payInfo={payInfo} orderId={orderId} /> return <TransferPayWay payInfo={payInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} />
default: default:
return null return null
} }
...@@ -98,7 +103,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -98,7 +103,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
window.location.href = '/' window.location.href = '/'
} }
return payInfo ? ( return payInfo ? !payState ? (
<div className={styles.pay}> <div className={styles.pay}>
<CommonHeader <CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl} logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
...@@ -110,7 +115,16 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -110,7 +115,16 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
} }
</div> </div>
</div> </div>
) : <div> ) : (<div>
<CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
title="支付成功"
/>
<div className={styles.errmsg}>
<p>支付成功</p>
<Button type="primary" className={styles.backbtn} onClick={() => backHome()}>继续购物</Button>
</div>
</div>) : <div>
<CommonHeader <CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl} logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
title="支付错误" title="支付错误"
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
height: 130px; height: 130px;
align-items: center; align-items: center;
font-size: 12px; font-size: 12px;
user-select: none;
&_item { &_item {
display: flex; display: flex;
...@@ -85,6 +86,7 @@ ...@@ -85,6 +86,7 @@
text-align: center; text-align: center;
margin-top: 10px; margin-top: 10px;
white-space: nowrap; white-space: nowrap;
user-select: none;
} }
} }
......
...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react' ...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
import CommonHeader from '../components/CommonHeader' import CommonHeader from '../components/CommonHeader'
import InputNumber from '@/components/InputNumber' import InputNumber from '@/components/InputNumber'
import Recommand from '../components/Recommand' import Recommand from '../components/Recommand'
import { history } from 'umi'
import cx from 'classnames' import cx from 'classnames'
import { Checkbox, Affix, message, Modal, Button } from 'antd' import { Checkbox, Affix, message, Modal, Button } from 'antd'
import styles from './index.less' import styles from './index.less'
...@@ -475,12 +474,12 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -475,12 +474,12 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId) buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId)
PublicApi.postOrderIsWorkFlow({ productIds }).then(res => { PublicApi.postOrderIsWorkFlow({ productIds }).then(res => {
message.destroy()
setConfirmLoading(false) setConfirmLoading(false)
if (res.code === 1000) { if (res.code === 1000) {
PublicApi.postOrderDirectPayment({ productId: productIds[0] }).then(res => {
message.destroy() message.destroy()
PublicApi.postOrderDirectPayment({ productId: productIds[0] }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
message.destroy()
let sessionKey = `${selectItem.id}${new Date().getTime()}` let sessionKey = `${selectItem.id}${new Date().getTime()}`
updateOrderInfo(buyOrderInfo, sessionKey).then(() => { updateOrderInfo(buyOrderInfo, sessionKey).then(() => {
...@@ -604,7 +603,9 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -604,7 +603,9 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
</div> </div>
<div className={cx(styles.order_list_item_item, styles.count)}> <div className={cx(styles.order_list_item_item, styles.count)}>
<InputNumber disabled={true} max={childItem.stockCount || 0} min={childItem.commodityUnitPrice.commodity.minOrder || 1} value={childItem.count} onChange={(value) => handleCountChange(value, childItem.id)} /> <InputNumber disabled={true} max={childItem.stockCount || 0} min={childItem.commodityUnitPrice.commodity.minOrder || 1} value={childItem.count} onChange={(value) => handleCountChange(value, childItem.id)} />
<div className={styles.stock}>(库存{numFormat(childItem.stockCount)}{childItem.commodityUnitPrice.commodity.unitName})</div> <div className={styles.stock}>
<span>(库存{numFormat(childItem.stockCount)}{childItem.commodityUnitPrice.commodity.unitName})</span>
</div>
</div> </div>
<div className={cx(styles.order_list_item_item, styles.amount)}> <div className={cx(styles.order_list_item_item, styles.amount)}>
<span className={styles.order_list_item_item_price}>{priceFormat(computeItemPrice(childItem.commodityUnitPrice?.priceRange, childItem.count))}</span> <span className={styles.order_list_item_item_price}>{priceFormat(computeItemPrice(childItem.commodityUnitPrice?.priceRange, childItem.count))}</span>
......
...@@ -15,7 +15,7 @@ const Collection: React.FC = () => { ...@@ -15,7 +15,7 @@ const Collection: React.FC = () => {
return ( return (
<PageHeaderWrapper> <PageHeaderWrapper>
<div className={styles.collection_wrap}> <div className={styles.collection_wrap}>
<Tabs defaultActiveKey="commodity" className={styles.collection_tabs} > <Tabs defaultActiveKey="shops" className={styles.collection_tabs} >
<TabPane tab="商品收藏" key="commodity"> <TabPane tab="商品收藏" key="commodity">
<Commodity /> <Commodity />
</TabPane> </TabPane>
......
import React from 'react' import React, { useEffect, useState } from 'react'
import cx from 'classnames' import cx from 'classnames'
import { Rate, Pagination } from 'antd' import { Rate, Pagination } from 'antd'
import { StarFilled } from '@ant-design/icons' import { StarFilled } from '@ant-design/icons'
import shop_icon from '@/assets/imgs/shop_icon.png' import shop_icon from '@/assets/imgs/shop_icon.png'
import credit_icon from '@/assets/imgs/credit_icon.png' import credit_icon from '@/assets/imgs/credit_icon.png'
import { PublicApi } from '@/services/api'
import styles from './index.less' import styles from './index.less'
const Shops: React.FC = () => { const Shops: React.FC = () => {
const [list, setList] = useState([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
let shopList = Array.apply({}, new Array(7)) useEffect(() => {
fetchCollectShopList()
}, [current])
/**
* 获取收藏的店铺列表
*/
const fetchCollectShopList = () => {
let param = {
current,
pageSize
}
//@ts-ignore
PublicApi.getTemplateShopCollectList(param).then(res => {
if (res.code === 1000) {
setList(res.data.data)
setTotalCount(res.data.totalCount)
}
})
}
const handleChange = (page) => {
setCurrent(page)
}
return ( return (
<> <>
<div className={styles.shops_list}> <div className={styles.shops_list}>
{ {
shopList.map((item, index) => ( list && list.map((item, index) => (
<div className={styles.shops_list_item} key={`shops_list_item_${index}`}> <div className={styles.shops_list_item} key={`shops_list_item_${index}`}>
<div className={cx(styles.shops_list_item_item, styles.morehalf)}> <div className={cx(styles.shops_list_item_item, styles.morehalf)}>
<div className={styles.shop_header_info}> <div className={styles.shop_header_info}>
...@@ -61,9 +89,13 @@ const Shops: React.FC = () => { ...@@ -61,9 +89,13 @@ const Shops: React.FC = () => {
} }
</div> </div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}> <div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} defaultCurrent={1} total={100} /> <Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</div> </div>
)
}
</> </>
) )
} }
......
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