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) => {
}
}, [min, max])
const handleReduce = () => {
const handleReduce = (e) => {
e.stopPropagation()
if (value > minCount) {
onChange(Number(value) - 1)
}
}
const handleAdd = () => {
const handleAdd = (e) => {
e.stopPropagation()
if (value < maxCount) {
onChange(Number(value) + 1)
}
......
......@@ -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 (
<div className={styles.shop_info}>
......@@ -72,7 +83,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<div className={styles.dashed_split}></div>
<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}>收藏本店</div>
<div className={styles.shop_info_btn} onClick={() => handleCollect()}>收藏本店</div>
</div>
<Button loading={applyLoading} className={styles.apply_member_btn} onClick={() => applyFroVip()}>申请成为本店会员</Button>
</div>
......
......@@ -12,11 +12,12 @@ const { Dragger } = Upload
interface TransferPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse
orderId: number
orderId: number,
onChange: Function
}
const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
const { payInfo, orderId } = props
const { payInfo, orderId, onChange } = props
const [loading, setLoading] = useState<boolean>(false)
const [payOrderUrl, setPayOrderUrls] = useState<string>()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
......@@ -75,11 +76,13 @@ const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
if (res.code === 1000) {
message.destroy()
message.success("支付成功")
onChange(true)
} else {
setConfirmLoading(false)
onChange(false)
}
}).catch(() => {
onChange(false)
setConfirmLoading(false)
})
}
......
......@@ -48,6 +48,7 @@ const getPayTypeTitle = (type) => {
const PayPage: React.FC<PayPagePropsType> = (props) => {
const { shopInfo, mallInfo, layoutType, } = props
const [payState, setPayState] = useState<boolean>(false)
const { orderId } = props.location.query
const [pageTitle, setPageTitle] = useState<string>()
const [payType] = useState<string | number>(PayWayType.bank)
......@@ -72,6 +73,10 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
})
}
const handlePayChangge = (state) => {
setPayState(state)
}
const renderPayWay = () => {
if (!payInfo) {
return
......@@ -89,7 +94,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
case PayWayType.bank:
return <BankPayWay />
case PayWayType.transfer:
return <TransferPayWay payInfo={payInfo} orderId={orderId} />
return <TransferPayWay payInfo={payInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} />
default:
return null
}
......@@ -98,7 +103,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
window.location.href = '/'
}
return payInfo ? (
return payInfo ? !payState ? (
<div className={styles.pay}>
<CommonHeader
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
......@@ -110,7 +115,16 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
}
</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
logoUrl={(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) ? shopInfo?.logo : mallInfo.logoUrl}
title="支付错误"
......
......@@ -51,6 +51,7 @@
height: 130px;
align-items: center;
font-size: 12px;
user-select: none;
&_item {
display: flex;
......@@ -85,6 +86,7 @@
text-align: center;
margin-top: 10px;
white-space: nowrap;
user-select: none;
}
}
......
......@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'
import CommonHeader from '../components/CommonHeader'
import InputNumber from '@/components/InputNumber'
import Recommand from '../components/Recommand'
import { history } from 'umi'
import cx from 'classnames'
import { Checkbox, Affix, message, Modal, Button } from 'antd'
import styles from './index.less'
......@@ -475,12 +474,12 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
buyOrderInfo.payWayList = await getPayWayListByMemberId(selectItem.memberId)
PublicApi.postOrderIsWorkFlow({ productIds }).then(res => {
message.destroy()
setConfirmLoading(false)
if (res.code === 1000) {
message.destroy()
PublicApi.postOrderDirectPayment({ productId: productIds[0] }).then(res => {
message.destroy()
if (res.code === 1000) {
message.destroy()
let sessionKey = `${selectItem.id}${new Date().getTime()}`
updateOrderInfo(buyOrderInfo, sessionKey).then(() => {
......@@ -604,7 +603,9 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
</div>
<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)} />
<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 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>
......
......@@ -15,7 +15,7 @@ const Collection: React.FC = () => {
return (
<PageHeaderWrapper>
<div className={styles.collection_wrap}>
<Tabs defaultActiveKey="commodity" className={styles.collection_tabs} >
<Tabs defaultActiveKey="shops" className={styles.collection_tabs} >
<TabPane tab="商品收藏" key="commodity">
<Commodity />
</TabPane>
......
import React from 'react'
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Rate, Pagination } from 'antd'
import { StarFilled } from '@ant-design/icons'
import shop_icon from '@/assets/imgs/shop_icon.png'
import credit_icon from '@/assets/imgs/credit_icon.png'
import { PublicApi } from '@/services/api'
import styles from './index.less'
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 (
<>
<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={cx(styles.shops_list_item_item, styles.morehalf)}>
<div className={styles.shop_header_info}>
......@@ -61,9 +89,13 @@ const Shops: React.FC = () => {
}
</div>
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} defaultCurrent={1} total={100} />
</div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</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