//grabOrderPage import Taro, { Component } from '@tarojs/taro' import { View, Text } from '@tarojs/components' import { AtButton, AtIcon } from 'taro-ui' import URL from '../../serviceAPI.config' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import './grabOrderPage.scss' class GrabOrderPage extends Component { config = { navigationBarTitleText: '抢单页面' } constructor() { super(...arguments); this.state = { type: '', title: '', browsing: '', contactName: '', contactNumber: '', address: '', content: '', } } //获取抢单信息api supplyDemandDetails getGrabOrderInfo() { Taro.request({ url: URL.supplyDemandDetails, method: 'GET', dataType: 'json', data: { demandId: this.$router.params.orderId, }, header: { 'content-type': 'application/x-www-form-urlencoded', 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'X-Requested-With': 'XMLHttpRequest' } }) .then(res => { console.log('抢单详情获取成功', res) this.setState({ type: res.data.sdInfo.sd_type, title: res.data.sdInfo.sd_title, browsing: res.data.sdInfo.browse_times, contactName: res.data.sdInfo.user_name, contactNumber: res.data.sdInfo.user_phone, address: res.data.sdInfo.user_address, content: res.data.sdInfo.sd_desc, }) } ) .catch(error => { console.log('抢单详情获取失败', error) }) } callPhoneNumber(){ Taro.makePhoneCall({ phoneNumber: this.state.contactNumber }) } componentDidMount() { console.log(this.$router.params.orderId) this.getGrabOrderInfo() } componentWillReceiveProps(nextProps) { console.log(this.props, nextProps) } componentWillUnmount() { } componentDidShow() { } componentDidHide() { } render() { return ( 行业分类: {this.state.type} 业主需求标题: {this.state.title} 浏览量: {this.state.browsing} 联系人: {this.state.contactName} 联系电话: {this.state.contactNumber} 联系地址: {this.state.address} 业主需求内容: {this.state.content} 抢单 ) } } export default GrabOrderPage