Changeset View
Changeset View
Standalone View
Standalone View
src/pages/businessManagement/comDialog.jsx
- This file was added.
import Taro, { Component } from "@tarojs/taro" | |||||
import { View, Text, Textarea, Image } from "@tarojs/components" | |||||
import OrderAdjustTextarea from "./comOrderAdjustTextarea" | |||||
import shutIcon from "./images/shut.png" | |||||
import "./comDialog.scss" | |||||
class Dialog extends Component { | |||||
static defaultProps = { | |||||
dialogStatus: 0, | |||||
//弹窗展示 1-展示 0-不展示 | |||||
showStatus: 1, | |||||
onClick: () => { }, | |||||
onRefuse: () => { }, | |||||
onPass: () => { } | |||||
} | |||||
state = { | |||||
refuseReason: "", | |||||
//是否展示驳回原因红字提示 | |||||
showhint: false | |||||
} | |||||
closeDialog = () => { | |||||
this.props.onClick() | |||||
} | |||||
textareaChange = (event) => { | |||||
this.setState({ | |||||
refuseReason: event.detail.value.trim() | |||||
}) | |||||
} | |||||
//点击拒绝 | |||||
refuse = () => { | |||||
const len = this.state.refuseReason.length | |||||
if (len == 0) { | |||||
this.setState({ | |||||
showhint: true | |||||
}) | |||||
return | |||||
} else { | |||||
this.setState({ | |||||
showhint: false | |||||
}) | |||||
} | |||||
this.props.onRefuse(this.state.refuseReason) | |||||
this.setState({ | |||||
refuseReason: '' | |||||
}) | |||||
} | |||||
//点击启用账号 | |||||
pass = () => { | |||||
this.props.onPass() | |||||
} | |||||
render () { | |||||
const { dialogStatus, showStatus } = this.props | |||||
const { refuseReason, showhint } = this.state | |||||
return ( | |||||
<View> | |||||
{showStatus == 1 && dialogStatus !== 0 && <View className='dialog-wrapper'> | |||||
{dialogStatus == 2 && ( | |||||
<View className='dialog-detail'> | |||||
<View className='dialog-title'>通过</View> | |||||
<View className='dialog-content'>您确认通过?</View> | |||||
<View className='dialog-btn-wrapper'> | |||||
<View className='dialog-btn' onClick={this.pass.bind(this, 1)}>确认并启用账号</View> | |||||
</View> | |||||
</View> | |||||
)} | |||||
{dialogStatus == 1 && ( | |||||
<View className='dialog-detail'> | |||||
<View className='dialog-title'>驳回</View> | |||||
<View className='dialog-reason'> | |||||
<OrderAdjustTextarea | |||||
title='驳回原因' | |||||
value={refuseReason} | |||||
onHandleValue={this.textareaChange.bind(this)} | |||||
/> | |||||
{showhint == true && <View className='hint'>驳回原因将通知给申请人请填写清楚</View>} | |||||
</View> | |||||
<View className='dialog-btn-wrapper'> | |||||
<View className='dialog-btn' onClick={this.refuse.bind(this, 0)}>拒绝并通知商户</View> | |||||
</View> | |||||
</View> | |||||
)} | |||||
<Image | |||||
src={shutIcon} | |||||
className='dialog-close' | |||||
onClick={this.closeDialog.bind(this)} | |||||
></Image> | |||||
</View>} | |||||
</View> | |||||
) | |||||
} | |||||
} | |||||
export default Dialog |
Content licensed under Creative Commons Attribution-ShareAlike 3.0 (CC-BY-SA) unless otherwise noted; code licensed under GNU General Public License (GPL) or other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL