我的需求 需求编辑,需求查看 需求发布 --完成

This commit is contained in:
郑茂强 2019-01-09 11:06:10 +08:00
parent 8f34d1416f
commit 85e2a028ad
9 changed files with 134 additions and 106 deletions

View File

@ -275,7 +275,6 @@ class GoodsTypeInteractionComp extends Component {
componentDidHide() { }
render() {
console.log('this.state.objectMultiArray[0]',this.state.objectMultiArray[0][this.state.multiIndex[0]].name)
return (
<View class='page-section'>
<Picker

View File

@ -36,7 +36,7 @@ class Interaction extends Component {
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
console.log('行业分类列表', res)
// console.log('行业分类列表', res)
this.formatIndustryType(res.data.data)
this.formatIndustTypeInit(res.data.data)
@ -48,7 +48,7 @@ class Interaction extends Component {
formatIndustryType(data) {
const newIndustryType = [{ name: '全部', id: '-1', child: [{ name: '', id: '' }] }]
for (let outter of data) {
let outterObject = { name: outter.class_name, id: outter.class_id, child: [] }
let outterObject = { name: outter.class_name, id: outter.class_id, child: [{name:'可选',id:''}] }
if (outter.child.length) {
for (let inner of outter.child) {
outterObject.child.push({ name: inner.class_name, id: inner.class_id })
@ -79,8 +79,7 @@ class Interaction extends Component {
//--------------------开始-行业分类picker
bindMultiPickerChange(e) {
//判断如果formatInWindow 的子类为空 那就取父类, 反之取子类
console.log('index', this.state.multiIndex)
console.log('formatInWindow', this.state.formatInWindow)
let industryTypeSelected
if (this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]].id === '') {
industryTypeSelected = this.state.formatInWindow[e.detail.value[0]]
@ -88,7 +87,7 @@ class Interaction extends Component {
industryTypeSelected = this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]]
}
console.log('picker发送选择改变携带值为', e.detail.value)
// console.log('picker发送选择改变携带值为', e.detail.value)
this.setState({
multiIndex: e.detail.value,
@ -98,12 +97,11 @@ class Interaction extends Component {
}
bindMulPickerColChge(e) {
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
// console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
const data = {
objectMultiArray: this.state.objectMultiArray,
multiIndex: this.state.multiIndex
}
console.log(' this.state.formatInWindow', this.state.formatInWindow)
data.multiIndex[e.detail.column] = e.detail.value
switch (e.detail.column) {
case 0:
@ -165,8 +163,8 @@ class Interaction extends Component {
break
}
console.log(data.multiIndex)
console.log('objectMultiArray', data.objectMultiArray)
// console.log(data.multiIndex)
// console.log('objectMultiArray', data.objectMultiArray)
this.setState({
multiIndex: data.multiIndex,
objectMultiArray: data.objectMultiArray

View File

@ -214,7 +214,6 @@ class ShopTypeInteractionComp extends Component {
componentDidHide() { }
render() {
console.log('tesst',this.state.objectMultiArray)
return (
<View class='page-section'>
<Picker

View File

@ -231,7 +231,6 @@ class GoodsPublish extends Component {
const imagePath = URL.Base + data.file_path
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
const newImageInfo = that.state.ImagesInfo.concat(data)
console.log('第一', newImageInfo)
that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo }, () => {
Taro.showToast({
title: '上传成功',
@ -253,13 +252,7 @@ class GoodsPublish extends Component {
})
}
}
// 图片上传失败
onFail(mes) {
console.log(mes)
}
// 删除图片
onImageClick(index) {
}
onClickUploadGoods() {
if (this.state.productName &&
this.state.productPrice &&
@ -318,11 +311,8 @@ class GoodsPublish extends Component {
render() {
console.log("this.state.productCategoryList", this.state.productCategoryList)
return (
<View className='goods-publish'>
<View className='goods-category'>
{/* 商品分类开始 */}
<GoodsTypeInteractionComp url={URL.GetProductCategoryList} onPassDataToChild={this.getDataFromGoodsChild.bind(this)}></GoodsTypeInteractionComp>

View File

@ -23,15 +23,15 @@ class MyNeeds extends Component {
startDateSel: '',
endDateSel: '',
industryType: '',
industryTypeSelected: { name: '全部', id: '-1' },
industryTypeSelected: { name: '全部', id: '' },
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
needsTypeSelected: { name: '业主需求', id: '4' },
needsState: [
{ name: '全部', id: '' },
{ name: '作废', id: '0' }
, { name: '在用', id: '1' },
{ name: '设计中', id: '2' },
{ name: '已设计', id: '3' }],
{ name: '已抢单', id: '2' },
{ name: '已抢光', id: '3' }],
needsStateSelected: { name: '全部', id: '' },
pageCount: 10,// 列表数量
allNeedsList: [],// 我的需求列表
@ -46,30 +46,39 @@ class MyNeeds extends Component {
//请求我的需求列表 api GetMyNeedsList
getMyNeedsList({ curr_page = 1,
page_count = 10,
sd_type = 4,
page_count = 20,
sd_type = '4',
sd_title = '',
update_dateL = '',
update_dateU = '',
class_id = '',
state = ""
state = ''
}) {
//由于后台返回的问题, 所有当state为空的时候不传state反之传state
const param=state?{param: JSON.stringify({
curr_page: curr_page,
page_count: page_count,
sd_type: sd_type,
sd_title: sd_title,
update_dateL: update_dateL,
update_dateU: update_dateU,
class_id: class_id,
state: state
})}:{param: JSON.stringify({
curr_page: curr_page,
page_count: page_count,
sd_type: sd_type,
sd_title: sd_title,
update_dateL: update_dateL,
update_dateU: update_dateU,
class_id: class_id,
})}
Taro.request({
url: URL.GetMyNeedsList,
method: 'POST',
dataType: 'json',
data: {
param: JSON.stringify({
curr_page: curr_page,
page_count: page_count,
sd_type: sd_type,
sd_title: sd_title,
update_dateL: update_dateL,
update_dateU: update_dateU,
class_id: class_id,
state: state
})
},
data: param,
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded',
@ -142,7 +151,7 @@ class MyNeeds extends Component {
sd_title: this.state.title,
update_dateL: this.state.startDateSel,
update_dateU: this.state.endDateSel,
class_id: this.state.industryTypeSelected.id,
class_id: this.state.industryTypeSelected.id==='-1'?'':this.state.industryTypeSelected.id,
state: this.state.needsStateSelected.id
})
this.setState({ currentPage: 1 })
@ -157,6 +166,21 @@ class MyNeeds extends Component {
url: '/pages/myNeedsPublish/myNeedsPublish'
})
}
//清空筛选项
emptyFilter(){
this.setState({
title:'',
endDateSel:'',
startDateSel:'',
})
Taro.showToast({
title:'已清空',
icon:'success',
duration:1000
})
}
titleChange(event) {
this.setState({ title: event })
}
@ -207,7 +231,9 @@ class MyNeeds extends Component {
// 翻页导航
paginationNav(type) {
console.log(type.current)
Taro.showLoading({
title:'加载中'
})
this.setState({ currentPage: type.current, }, () => {
this.getMyNeedsList({
curr_page: this.state.currentPage,
@ -247,12 +273,12 @@ class MyNeeds extends Component {
return <View className='needs-box' key={index}>
<View className='industy-type box'>
<Text className='title'>行业分类</Text>
<Text className='content'>{item.sd_type}</Text>
<Text className='content'>{item.class_name}</Text>
</View>
<View className='needs-title box'>
<Text className='title'>需求标题</Text>
<Text className='content'>{item.sd_title}</Text>
<Text className='content' onClick={this.state.goToMyNeedsViewPage.bind(this,item.sd_id)}>{item.sd_title}</Text>
</View>
<View className='needs-state box'>
<Text className='title'>需求状态</Text>
@ -262,7 +288,7 @@ class MyNeeds extends Component {
<Text className='title'>更新时间</Text>
<Text className='content'>{item.update_date}</Text>
</View>
{item.state === '1' ? <View className='info-button-box'>
{item.state === '0'||item.state === '1' ? <View className='info-button-box'>
<View className='button' onClick={this.goToMyNeedsViewPage.bind(this, item.sd_id)}>
<AtButton type='primary' size='small'>查看</AtButton>
</View>
@ -272,8 +298,7 @@ class MyNeeds extends Component {
<View className='button-a' onClick={this.deleteButton.bind(this, item)}>
<AtButton type='primary' size='small'>删除</AtButton>
</View>
</View > :
<View className='info-button-box'>
</View > : <View className='info-button-box'>
<View className='button' onClick={this.goToMyNeedsViewPage.bind(this, item.sd_id)}>
<AtButton type='primary' size='small'>查看</AtButton>
</View>
@ -368,6 +393,11 @@ class MyNeeds extends Component {
<AtIcon value='add' size='12' color='white'></AtIcon>
新增</AtButton>
</View>
<View className='button' onClick={this.emptyFilter.bind(this)}>
<AtButton type='primary' className='button-b' size='small'>
<AtIcon value='trash' size='12' color='white'></AtIcon>
清空</AtButton>
</View>
</View>
<View className='total'>
<Text className='count'>{this.state.totalNeeds}</Text>

View File

@ -99,6 +99,11 @@ $themeColor:#FF7142;
background-color:#5cb85c;
border:1PX solid #5cb85c;
}
.button-b{
background-color:#d9534f;
border:1PX solid #d9534f;
}
}
}
@ -116,7 +121,7 @@ $themeColor:#FF7142;
padding: 10px;
.box{
margin-top: 5px;
margin-top: 10px;
font-size: 28px;
}
.needs-title{
@ -135,7 +140,7 @@ $themeColor:#FF7142;
.button{
// flex:1;
text-align: right;
margin:1% 1% 0;
margin:2% 1% 0;
.at-button--primary{
background-color:#FF9500;
@ -145,7 +150,7 @@ $themeColor:#FF7142;
.button-a{
// flex:1;
text-align: right;
margin:1% 1% 0;
margin:2% 1% 0;
.at-button--primary{
background-color:#d9534f;

View File

@ -31,8 +31,8 @@ class MyNeedsEdit extends Component {
needsStateSelected: { name: '全部', id: '' },
title: '',
sd_id: '', //需求id
contactName: Taro.getStorageSync('user_identity').username,
contactNumber: Taro.getStorageSync('user_identity').userphone,
contactName: '',
contactNumber: '',
contactAddress: '',
content: '',//描述
pickerImageUrl: [],
@ -76,6 +76,12 @@ class MyNeedsEdit extends Component {
break
}
}
if(!Object.keys(industryType).length){
industryType.name = '全部'
industryType.id =''
}
const needsType = this.state.needsType.filter(item => {
return item.id === res.data.sdInfo.sd_type
@ -89,6 +95,8 @@ class MyNeedsEdit extends Component {
industryTypeSelected: industryType,
needsTypeSelected: needsType,
title: res.data.sdInfo.sd_title,
contactName:res.data.sdInfo.user_name,
contactNumber:res.data.sdInfo.user_phone,
contactAddress: res.data.sdInfo.user_address,
content: res.data.sdInfo.sd_desc,
needsStateSelected: needsState,
@ -231,14 +239,14 @@ class MyNeedsEdit extends Component {
})
}
}
// 修改求类型
demandingSupplyCate = e => {
// 修改求类型
needsTypeChange = e => {
this.setState({
demandingSupplyCateSelected: this.state.demandingSupplyCate[e.detail.value]
needsTypeSelected: this.state.needsType[e.detail.value]
})
}
// 修改供求状态
demSupplyStateChange = e => {
needsStateChange = e => {
this.setState({
needsStateSelected: this.state.needsState[e.detail.value]
})
@ -297,7 +305,7 @@ class MyNeedsEdit extends Component {
{/* 需求类型 */}
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.demandingSupplyCate.bind(this)}>
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
@ -380,7 +388,7 @@ class MyNeedsEdit extends Component {
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.demSupplyStateChange}>
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>

View File

@ -26,8 +26,8 @@ class MyNeedsPublish extends Component {
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
needsTypeSelected: { name: '业主需求', id: '4' },
title: '',
contactName: Taro.getStorageSync('userInfo').login_name,
contactNumber: Taro.getStorageSync('userInfo').user_phone,
contactName: Taro.getStorageSync('user_identity').username,
contactNumber: Taro.getStorageSync('user_identity').userphone,
contactAddress: '',
content: '',
pickerImageUrl: [], // 上传的图片
@ -105,11 +105,11 @@ class MyNeedsPublish extends Component {
icon: 'success',
duration: 1500
}).then(() => {
// setTimeout(() => {
// Taro.navigateTo({
// // url: '/pages/mySupplyDemand/mySupplyDemand'
// })
// }, 1500);
setTimeout(() => {
Taro.navigateTo({
url: '/pages/myNeeds/myNeeds'
})
}, 1500);
})
} else {
@ -228,7 +228,6 @@ class MyNeedsPublish extends Component {
componentDidHide() { }
render() {
return (
<View className='supply-demand'>

View File

@ -1,7 +1,7 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image,Button } from '@tarojs/components'
import { AtButton, AtIcon,AtModal,AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import { View, Text, Image, Button } from '@tarojs/components'
import { AtButton, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import URL from '../../serviceAPI.config'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
@ -18,7 +18,7 @@ class SupplyDemandView extends Component {
constructor() {
super(...arguments)
this.state = {
industryTypeSelected: '',
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
needsTypeSelected: { name: '业主需求', id: '4' },
@ -28,7 +28,7 @@ class SupplyDemandView extends Component {
],
needsStateSelected: { name: '全部', id: '' },
title: '',
browsing:'',
browsing: '',
sd_id: '', //需求id
contactName: '',
contactNumber: '',
@ -41,7 +41,7 @@ class SupplyDemandView extends Component {
//获取需求信息api
getSingleMyNeedInfo() {
Taro.request({
url: URL.ViewMyNeeds,//EditMyNeeds
url: URL.EditMyNeeds,
method: 'GET',
dataType: 'json',
data: {
@ -58,7 +58,7 @@ class SupplyDemandView extends Component {
// const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
// const selectedState = this.state.needsState.filter(item => item.id == res.data.sdInfo.state)[0]
Taro.hideLoading()
let industryType={}
let industryType = {}
const classId = res.data.sdInfo.class_id
for (let outter of res.data.supplyTree) {
if (outter.children) {
@ -72,7 +72,7 @@ class SupplyDemandView extends Component {
}
if (outter.class_id === classId) {
industryType.name = outter.class_name
industryType.id = outter.class_id
industryType.id = outter.class_id
break
}
}
@ -85,7 +85,7 @@ class SupplyDemandView extends Component {
return item.id === res.data.sdInfo.state
})[0]
this.setState({
sd_id:res.data.sdInfo.sd_id,
sd_id: res.data.sdInfo.sd_id,
industryTypeSelected: industryType,
needsTypeSelected: needsType,
title: res.data.sdInfo.sd_title,
@ -97,10 +97,10 @@ class SupplyDemandView extends Component {
needsStateSelected: needsState,
pickerImageUrl: imageFile,
ImagesInfo: res.data.sdInfo.file_path,
isDeleteModal:false,
isDeleteModal: false,
})
}
)
@ -145,7 +145,7 @@ class SupplyDemandView extends Component {
})
}
goMyNeedsPublishPage() {
Taro.navigateTo({
url: '/pages/myNeedsPublish/myNeedsPublish',
@ -153,33 +153,33 @@ class SupplyDemandView extends Component {
}
goMyNeedEditPage() {
console.log('edit page')
console.log('id',this.state.sd_id)
console.log('id', this.state.sd_id)
Taro.navigateTo({
url: '/pages/myNeedsEdit/myNeedsEdit?id='+this.state.sd_id
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + this.state.sd_id
})
}
goToMyNeedsPage() {
Taro.navigateTo({
url: '/pages/myNeeds/myNeeds'
})
})
}
deleteButton() {
this.setState({isDeleteModal:true})
this.setState({ isDeleteModal: true })
}
handleWindowModCancel(){
this.setState({isDeleteModal:false})
handleWindowModCancel() {
this.setState({ isDeleteModal: false })
}
handleWindowConfirm(){
this.setState({isDeleteModal:false})
handleWindowConfirm() {
this.setState({ isDeleteModal: false })
this.deleteMyNeeds({ demandId: this.state.sd_id })
}
componentDidMount() {
Taro.showLoading({title:'加载中'})
this.getSingleMyNeedInfo()
Taro.showLoading({ title: '加载中' })
this.getSingleMyNeedInfo()
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
@ -192,24 +192,24 @@ class SupplyDemandView extends Component {
componentDidHide() { }
render() {
const deleteModalWindowElement= <AtModal isOpened={this.state.isDeleteModal}>
<AtModalHeader>提示</AtModalHeader>
<AtModalContent>
确认删除{this.state.needsItem.sd_title}
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
<AtModalHeader>提示</AtModalHeader>
<AtModalContent>
确认删除{this.state.needsItem.sd_title}
</AtModalContent>
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}></Button> </AtModalAction>
</AtModal>
const imageArrayElement=this.state.ImagesInfo.map((item,index)=>{
return <Image key={index} className='image' mode='widthFix' src={URL.Base + item.file_path} style='max-width: 100%; max-height:100%;' />
})
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}></Button> </AtModalAction>
</AtModal>
const imageArrayElement = this.state.ImagesInfo.map((item, index) => {
return <Image key={index} className='image' mode='widthFix' src={URL.Base + item.file_path} style='max-width: 100%; max-height:100%;' />
})
return (
<View className='SupplyDemandItemView'>
{/* 删除模态框 */}
{deleteModalWindowElement}
{/* 删除模态框 */}
{deleteModalWindowElement}
<View className='type box'>
<Text className='title'>行业分类</Text>
<Text className='content'>{this.state.industryTypeSelected.name}</Text>
<Text className='content'>{this.state.industryTypeSelected.name?this.state.industryTypeSelected.name:'--'}</Text>
</View>
<View className='needed-title box'>
<Text className='title'>需求标题</Text>
@ -235,13 +235,13 @@ class SupplyDemandView extends Component {
<Text className='title'>业主需求内容</Text>
<Text className='content'>{this.state.content}</Text>
</View>
<View className='needed-image box'>
{this.state.ImagesInfo.length?<View className='needed-image box'>
<Text className='title'>业主需求图片</Text>
<View className='img-box'>
{imageArrayElement}
{imageArrayElement}
</View>
</View>
</View>:null
}
<View className='button-box'>
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
@ -259,7 +259,7 @@ class SupplyDemandView extends Component {
<AtIcon value='settings' size='12' color='white'></AtIcon>
修改</AtButton>
</View>
<View className='button' onClick={this.deleteButton.bind(this)}>
<AtButton type='primary' className='button-a' size='small'>
<AtIcon value='close' size='12' color='white'></AtIcon>