import { ComponentClass } from 'react'
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
import './index.scss'
import SdAvatarTitle from '../sdAvatarTitle'
import { AtProgress } from 'taro-ui';
import SdFormid from '../sdFormid';
type PageOwnProps = {
className?: string
app: 'wzs' | 'helper'
redpacketId?: string // 红包id
projectType?: 'case' | 'building' // 工地|案例
projectId?: string // 工地|案例 id
projectName?: string // 工地|案例 名称
projectCover?: string // 工地|案例 封面
state?: 'unclaim' | 'claimed' | 'finish' | 'withdraw' | 'withdrawed' | 'unwithdraw', // 卡片状态
money?: string, // 已抢额度
totalMoney?: string, // 配置总额
endDate?: string // 截至日期
number?: number // 被抢数
totalNumber?: number // 可抢总数
avatar?: string // 屋主头像
userName?: string // 屋主名字
userId?: string // 屋主id
progress?: any // 进度
getMoney?: string // 抢的钱
duration?: string // 有效期
onDelete?: any // 删除
onSend?: any // 发送
onWithdraw?: any // 提现
children?: any
theme?: string, // 主题
}
type IProps = PageOwnProps
interface Index {
props: IProps
}
class Index extends Component {
static options = {
addGlobalClass: true
}
handleDelete = e => {
e.stopPropagation()
this.props.onDelete(this.props.redpacketId)
}
handleSend = e => {
e.stopPropagation()
this.props.onSend(this.props.redpacketId)
}
handleWithdraw = () => {
this.props.onWithdraw(this.props.redpacketId)
}
render() {
const { className, projectCover, state, money, totalMoney, endDate, userName, number, totalNumber, getMoney, app, progress, duration, theme } = this.props
let avatar = this.props.avatar || 'http://ft-image.oss-cn-beijing.aliyuncs.com/162.png'
return (
{
theme
?
{theme}
:
}
{app === 'helper' && {endDate}}
{
app === 'helper'
?
{number}人已领
共{totalNumber}人
{totalMoney}
总额(元)
{money}
已领(元)
:
¥
{getMoney}
提现截止:{duration}
}
{/* 左侧 */}
{/* 配置中 */}
{/* 等待发送 */}
{(state === 'unclaim') && 删除 }
{/* 砍价中 */}
{(state === 'claimed') && 活动中}
{/* 砍价结束 */}
{(state === 'finish') && 已结束}
{/* 砍价结束 */}
{(state === 'withdraw') &&
{this.props.children}
}
{/* {(state === 'withdraw') && 可提现} */}
{/* 砍价结束 */}
{(state === 'withdrawed') && 已提现}
{/* 砍价结束 */}
{(state === 'unwithdraw') && 已过期}
{/* 右侧 */}
{
state !== 'unclaim' && {app === 'helper' ? '领取' : '的红包'}
}
)
}
}
export default Index as ComponentClass