import { ComponentClass } from 'react' import Taro, { Component } from '@tarojs/taro' import { View, Text, Image } from '@tarojs/components' import './index.scss' import SdFormid from '../sdFormid'; type PageOwnProps = { bargainId?: string className?: string state?: 'config' | 'unclaim' | 'claimed' | 'finish', // 卡片状态 money?: string, // 已坎额度 totalMoney?: string, // 配置总额 endDate?: string // 截至日期 showNum?: boolean // 显示数量 number?: number // 被点数 totalNumber?: number // 点击总数 avatar?: string userName?: string userId?: string app: 'wzs' | 'helper' position: 'list' | 'detail' onDelete?: any onSend?: any progress?: any } type IProps = PageOwnProps interface Index { props: IProps } class Index extends Component { static options = { addGlobalClass: true } handleDelete = e => { e.stopPropagation() this.props.onDelete(this.props.bargainId) } handleSend = e => { e.stopPropagation() this.props.onSend(this.props.bargainId) } render() { const { className, state, totalMoney, avatar, position, userId, app, progress, showNum } = this.props const number = this.props.number || 0 const totalNumber = this.props.totalNumber || 0 const money = this.props.money || '0.00' const endDate = this.props.endDate || '_ _ _' let userName = this.props.userName || '' if (userName.length > 10) { userName = userName.substr(0, 8) + '...' } return ( {totalMoney || '0.00'} { state === 'finish' ? '最终砍价金额' : ((state === 'config' || position === 'list') ? ('截止日期:' + endDate) : '优惠金额以砍价结果为准' ) } { (state !== 'finish' && position === 'list') && 已砍 {money} } { ((state === 'config' || position === 'list') && showNum) && 人数 {number}/ {totalNumber} } { position === "list" && } {/* 左侧 */} {/* 配置中 */} {state === 'config' && 配置完成后,将此卡发送给业主 } {/* 等待发送 */} {(state === 'unclaim' && position === 'list') && 删除 } {/* 砍价中 */} {(state === 'claimed' && position === 'list') && 砍价中} {/* 砍价结束 */} {(state === 'finish' && position === 'list') && 已结束} {/* 右侧 */} {/* 等待发送 */} {(state === 'unclaim' && position === 'list') && 点我发给业主 } {/* 装企准备发给屋主 */} {(state === 'unclaim' && position === 'detail') && 待领取 } {/* 活动中 && 已结束 */} {((state === 'claimed' || state === 'finish') && userId) && {userName} {app === 'helper' ? '领取' : '所属'} } ) } } export default Index as ComponentClass