remindCust.jsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import Taro, { Component } from '@tarojs/taro'
  2. import { View, Image } from '@tarojs/components'
  3. import './remindCust.scss'
  4. export default class Popup extends Component {
  5. constructor (props) {
  6. super(props)
  7. this.state = {
  8. dataList: [],
  9. isPopupShow: false,
  10. total: 0,
  11. }
  12. }
  13. componentWillMount () {
  14. this.getData()
  15. }
  16. getData () {
  17. const uoObj = Taro.getStorageSync('APP_userInfo')
  18. if (uoObj) {
  19. Taro.api.base.apiuserhouselist().then(res => {
  20. const dataList = res.list || []
  21. this.setState({
  22. dataList,
  23. total: res.total || 0,
  24. isPopupShow: dataList.length > 0 ? true : false
  25. })
  26. })
  27. }
  28. }
  29. openPopup () {
  30. this.setState({
  31. isPopupShow: true
  32. })
  33. }
  34. closePopup () {
  35. this.setState({
  36. isPopupShow: false
  37. })
  38. }
  39. linkRoomDtl (item) {
  40. Taro.navigateTo({
  41. url: `/pagesMore/center/uploadRoom2?cid=${item.id}`
  42. })
  43. }
  44. callHandle (phone) {
  45. Taro.makePhoneCall({
  46. phoneNumber: phone
  47. })
  48. }
  49. previewImageHandle (item) {
  50. const imgArr = item.images && item.images.length > 0 ? item.images.split(',') : []
  51. const urls = [item.house_cert, ...imgArr]
  52. Taro.previewImage({
  53. current: item.house_cert,
  54. urls
  55. })
  56. }
  57. verifyHandle (item) {
  58. let that = this
  59. Taro.$msgConfirm('确定已上传该房源吗,确定后将隐藏该条记录?', () => {
  60. Taro.api.base.apiuserhouseverify({id: item.id}).then(res => {
  61. Taro.$msg('已隐藏!')
  62. that.getData()
  63. })
  64. })
  65. }
  66. render () {
  67. const { isPopupShow, dataList, total } = this.state
  68. const bgClose = require('@img/icon_g_close2.png')
  69. return (
  70. <View className={isPopupShow ? 'l-modal-box' : 'l-modal-box hide'}>
  71. <View className='lmb-bg'></View>
  72. <View className='lmb-body'>
  73. <View className="scoped-box">
  74. <View className="sb-main">
  75. <View className="title">已分配房源({total})</View>
  76. {
  77. dataList.map(item => {
  78. return(
  79. <View key={item.id} className="op">
  80. <View className="p1">
  81. <View onClick={this.callHandle.bind(this, item.phone)} className="text">[{item.id}]挂价{item.price}w,电:{item.phone}</View>
  82. <Image src={item.house_cert} className="img" onClick={this.previewImageHandle.bind(this, item)} />
  83. </View>
  84. <View onClick={this.callHandle.bind(this, item.phone)} className="p3">{item.remark}</View>
  85. <View className="p2">
  86. <View onClick={this.linkRoomDtl.bind(this, item)} className="t">去上传房源</View>
  87. <View onClick={this.verifyHandle.bind(this, item)} className="t t2">已上传</View>
  88. </View>
  89. </View>
  90. )
  91. })
  92. }
  93. </View>
  94. <Image src={bgClose} className="close" onClick={this.closePopup.bind(this)} />
  95. </View>
  96. </View>
  97. </View>
  98. )
  99. }
  100. }