import React, { useMemo } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import Taro, { getCurrentInstance } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
import { SpPage, SpPrice, SpImage, SpPoint } from '@/components'
import './index.scss'
function SpOrderItem(props) {
const {
payType = '',
showExtra = true,
info = null,
isPointitemGood = false,
isShowPointTag = false,
onClick = () => {},
customFooter,
showDesc,
renderDesc,
renderFooter
} = props
const { pointName } = useSelector((state) => state.sys)
const { priceSetting } = useSelector((state) => state.sys)
const { order_page } = priceSetting
const { market_price: enMarketPrice } = order_page
if (!info) return null
const showExtraComp = () => {
if (showExtra) {
return (
{info.goods_props}
{info.num && 数量:{info.num}}
{info.item_spec_desc && (
{info.item_spec_desc}
)}
)
}
}
const img = info.pic_path ? info.pic_path : Array.isArray(info.pics) ? info.pics[0] : info.pics
console.log('order item info:', info)
return (
{/* {isShowPointTag && } */}
{info.order_item_type === 'plus_buy' && (
换购
)}
{info.order_item_type === 'gift' && (
赠品
)}
{info.title}
{showDesc && info.item_spec_desc && (
{info.item_spec_desc}
)}
{renderDesc}
{showExtraComp()}
{customFooter ? (
renderFooter
) : (
{isPointitemGood ? (
) : (
{/* {info.market_price > 0 && enMarketPrice && (
)} */}
)}
)}
)
}
SpOrderItem.option = {
addGlobalClass: true
}
export default SpOrderItem
// import React, { Component } from 'react'
// import { View, Text, Image } from '@tarojs/components'
// import { Price, SpImg, PointTag } from '@/components'
// import { connect } from 'react-redux'
// import './index.scss'
// @connect(({ colors, sys }) => ({
// colors: colors.current,
// pointName: sys.pointName
// }))
// export default class OrderItem extends Component {
// static defaultProps = {
// onClick: () => {},
// payType: '',
// showExtra: true,
// info: null,
// isShowNational: false,
// isPointitemGood: false,
// isShowPointTag: false
// }
// static options = {
// addGlobalClass: true
// }
// render () {
// const {
// info,
// onClick,
// isShowPointTag,
// showExtra,
// showDesc,
// customFooter,
// isShowNational,
// isPointitemGood
// } = this.props
// if (!info) return null
// const img = info.pic_path ? info.pic_path : Array.isArray(info.pics) ? info.pics[0] : info.pics
// return (
//
//
//
//
//
// {isShowNational && info.type == '1' && info.origincountry_name && (
//
//
// {info.origincountry_name}
//
// )}
// {isShowPointTag && }
//
// {info.order_item_type === 'plus_buy' && (
// 换购
// )}
// {info.title}
//
// {showDesc && info.item_spec_desc && (
// {info.item_spec_desc}
// )}
// {this.props.renderDesc}
// {showExtra && (
//
// {info.goods_props}
// {info.num && 数量:{info.num}}
// {info.item_spec_desc && (
// {info.item_spec_desc}
// )}
//
// )}
//
// {customFooter ? (
// this.props.renderFooter
// ) : (
//
// {isPointitemGood ? (
//
// ) : (
//
// )}
//
// )}
//
// )
// }
// }