apply.jsx 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. import Taro, { Component } from '@tarojs/taro'
  2. import { View } from '@tarojs/components'
  3. import { AtTextarea } from 'taro-ui'
  4. import LFormGroup from '@/c/lform/formGroup'
  5. import './apply.scss'
  6. class Index extends Component {
  7. onShareAppMessage() {
  8. return {
  9. title: '南昌买房,来洪楼领取专属优惠',
  10. path: `/pagesPlan/apply`,
  11. }
  12. }
  13. onShareTimeline () {
  14. return {
  15. title: '南昌买房,来洪楼领取专属优惠',
  16. path: `/pagesPlan/apply`,
  17. }
  18. }
  19. constructor (props) {
  20. super(props)
  21. this.state = {
  22. formObj: {},
  23. isMoreShow: false,
  24. }
  25. }
  26. config = {
  27. navigationBarTitleText: '置业小助手',
  28. navigationStyle: 'custom',
  29. navigationBarTextStyle: 'white'
  30. }
  31. componentWillMount () {
  32. Taro.$AHU(this)
  33. // Taro.$msgConfirm('正在开发中~敬请期待', () => {
  34. // this.linkHome()
  35. // }, () => {
  36. // this.linkHome()
  37. // })
  38. }
  39. saveHandle () {
  40. const { formObj } = this.state
  41. if (formObj.name && formObj.phone) {
  42. const userInfo = Taro.getStorageSync('APP_userInfo')
  43. const {eId} = this.$router.params
  44. Taro.api.other.planadd({
  45. ...formObj,
  46. estate_id: eId || '',
  47. userinfo: userInfo ? JSON.stringify(userInfo) : ''
  48. }).then(res => {
  49. Taro.$msgConfirm('提交成功,洪楼将根据您的情况联系您', () => {
  50. if (eId) {
  51. Taro.navigateBack({
  52. delta: 1
  53. })
  54. } else {
  55. Taro.reLaunch({
  56. url: '/pages/index/index'
  57. })
  58. }
  59. }, () => {
  60. if (eId) {
  61. Taro.navigateBack({
  62. delta: 1
  63. })
  64. } else {
  65. Taro.reLaunch({
  66. url: '/pages/index/index'
  67. })
  68. }
  69. })
  70. })
  71. } else {
  72. Taro.$msg('请输入您的称呼和手机号~')
  73. }
  74. }
  75. baseFormChange (key, val) {
  76. let { formObj } = this.state
  77. formObj[key] = val
  78. this.setState({
  79. formObj
  80. })
  81. }
  82. renderGoHome () {
  83. const icon = require('@img/images/icon_go_home.png')
  84. return (
  85. <Image className="g-go-home" src={icon} onClick={this.linkHome.bind(this)}/>
  86. )
  87. }
  88. linkHome () {
  89. const pages = getCurrentPages()
  90. const pagesLength = pages.length
  91. if (pagesLength < 2) {
  92. Taro.reLaunch({
  93. url: '/pages/index/index'
  94. })
  95. } else {
  96. Taro.navigateBack({
  97. delta: 1
  98. })
  99. }
  100. }
  101. openMore () {
  102. this.setState({
  103. isMoreShow: true
  104. })
  105. }
  106. render () {
  107. const { formObj, isMoreShow } = this.state
  108. const dictData = Taro.getStorageSync('dictData') || {}
  109. const yesnoMoreOptions = {arr: [{key: '不限', val: '-1'}, ...dictData.sys_yesno]}
  110. const area_type = {arr: dictData.area_type}
  111. const house_type = {arr: dictData.house_type}
  112. const topBg = require('./img/apply/banner.jpg')
  113. const moreIcon = require('./img/apply/more.gif')
  114. const footerBg = require('./img/apply/slogan.jpg')
  115. return (
  116. <View className="l-box scoped-box">
  117. {this.renderGoHome()}
  118. <View className="sb-top">
  119. <Image src={topBg} className="img" />
  120. </View>
  121. <View className="sb-main">
  122. <LFormGroup
  123. val={formObj.name}
  124. valStr="name"
  125. keyStr="您的称呼*"
  126. keyStr2="请输入您的称呼"
  127. bc={this.baseFormChange.bind(this)}
  128. />
  129. <LFormGroup
  130. val={formObj.phone}
  131. valStr="phone"
  132. keyStr="手机号*"
  133. keyStr2="请输入联系方式"
  134. inputType="digit"
  135. bc={this.baseFormChange.bind(this)}
  136. />
  137. <LFormGroup
  138. val={formObj.sfk}
  139. valStr="sfk"
  140. keyStr="首付款"
  141. keyStr2="请输入"
  142. inputType="digit"
  143. typeStr="inputFont"
  144. inputFont="万"
  145. bc={this.baseFormChange.bind(this)}
  146. />
  147. <LFormGroup
  148. val={formObj.ygys}
  149. valStr="ygys"
  150. keyStr="月供预算"
  151. keyStr2="请输入"
  152. inputType="digit"
  153. typeStr="inputFont"
  154. inputFont="元"
  155. bc={this.baseFormChange.bind(this)}
  156. />
  157. {
  158. isMoreShow
  159. ?
  160. <View>
  161. <LFormGroup
  162. val={formObj.zjys}
  163. valStr="zjys"
  164. keyStr="总价预算"
  165. keyStr2="请输入"
  166. inputType="digit"
  167. typeStr="inputFont"
  168. inputFont="万"
  169. bc={this.baseFormChange.bind(this)}
  170. />
  171. <LFormGroup
  172. val={formObj.area_type}
  173. valStr="area_type"
  174. keyStr="区域偏好"
  175. keyStr2="请选择"
  176. typeStr="multiSelect"
  177. moreOptions={area_type}
  178. bc={this.baseFormChange.bind(this)}
  179. />
  180. <LFormGroup
  181. val={formObj.house_type}
  182. valStr="house_type"
  183. keyStr="户型偏好"
  184. keyStr2="请选择"
  185. typeStr="multiSelect"
  186. moreOptions={house_type}
  187. bc={this.baseFormChange.bind(this)}
  188. />
  189. <LFormGroup
  190. val={formObj.xg}
  191. valStr="xg"
  192. keyStr="是否限购"
  193. keyStr2="请选择"
  194. typeStr="select"
  195. moreOptions={yesnoMoreOptions}
  196. bc={this.baseFormChange.bind(this)}
  197. />
  198. <LFormGroup
  199. val={formObj.mxzb}
  200. valStr="mxzb"
  201. keyStr="想在名校周边"
  202. keyStr2="请选择"
  203. typeStr="select"
  204. moreOptions={yesnoMoreOptions}
  205. bc={this.baseFormChange.bind(this)}
  206. />
  207. <LFormGroup
  208. val={formObj.gjj}
  209. valStr="gjj"
  210. keyStr="用公积金贷款"
  211. keyStr2="请选择"
  212. typeStr="select"
  213. moreOptions={yesnoMoreOptions}
  214. bc={this.baseFormChange.bind(this)}
  215. />
  216. <LFormGroup
  217. val={formObj.mpjz}
  218. valStr="mpjz"
  219. keyStr="带装修精装"
  220. keyStr2="请选择"
  221. typeStr="select"
  222. moreOptions={yesnoMoreOptions}
  223. bc={this.baseFormChange.bind(this)}
  224. />
  225. <LFormGroup
  226. val={formObj.xf}
  227. valStr="xf"
  228. keyStr="是否新房"
  229. keyStr2="请选择"
  230. typeStr="select"
  231. moreOptions={yesnoMoreOptions}
  232. bc={this.baseFormChange.bind(this)}
  233. />
  234. <LFormGroup
  235. val={formObj.jfsj}
  236. valStr="jfsj"
  237. keyStr="交房时间"
  238. keyStr2="请选择"
  239. typeStr="date"
  240. bc={this.baseFormChange.bind(this)}
  241. />
  242. <LFormGroup
  243. val={formObj.zbpt}
  244. valStr="zbpt"
  245. moreRows={true}
  246. defineBoxClassName='noborder'
  247. defineContentClassName="border"
  248. pbShow="no"
  249. keyStr="周边配套要求"
  250. keyStr2="如地铁,商业,公园等"
  251. typeStr="textarea"
  252. bc={this.baseFormChange.bind(this)}
  253. />
  254. <LFormGroup
  255. val={formObj.remark}
  256. valStr="remark"
  257. moreRows={true}
  258. defineBoxClassName='noborder'
  259. defineContentClassName="border"
  260. keyStr="备注"
  261. keyStr2="更多想说的内容填这里"
  262. typeStr="textarea"
  263. bc={this.baseFormChange.bind(this)}
  264. />
  265. </View>
  266. :
  267. <View className="sb-more">
  268. <Image src={moreIcon} className="img" onClick={this.openMore.bind(this)}/>
  269. </View>
  270. }
  271. <View className="l-floor-footer t2">
  272. <View className="lff-flex">
  273. <View className="lff-btn full t6 b" onClick={this.saveHandle.bind(this)}>提交</View>
  274. </View>
  275. </View>
  276. </View>
  277. <View className="sb-footer">
  278. <Image src={footerBg} className="img" />
  279. </View>
  280. </View>
  281. )
  282. }
  283. }
  284. export default Index