业主全部需求完成

This commit is contained in:
郑茂强 2019-01-09 17:35:32 +08:00
parent aa3eaccf8e
commit 9e1f708f73
6 changed files with 47 additions and 83 deletions

View File

@ -3,6 +3,11 @@ $themeColor: #FF7142;
.orange{
color:#FF7142,
}
.blur{
color:#FF7142;
opacity: .65;
}
.orange-bg{
background-color:#FF7142,
}

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Button } from '@tarojs/components'
import { AtInput, AtButton, Picker, AtIcon, AtLoadMore, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction, AtPagination } from 'taro-ui'
import { AtInput, AtButton, Picker, AtIcon, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction, AtPagination } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
@ -20,61 +20,23 @@ class AllDemanding extends Component {
super(...arguments)
this.state = {
supplys: [], // 需求列表
isMore: 'more', // 加载状态
demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
industryTypeSelected: { name: '全部', id: '' },// 当前行业分类
title: '',
startDateSel: '',
endDateSel: '',
classId: '',
isOpenedGrabModal: false,
grabOrderId: '',//抢到订单的id
isGrabOrderSuccess: false,// 是否显示轻提示
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
totalDemandings:0,
currentPage:1
totalDemandings: 0,
currentPage: 1
}
}
//加载更多业主需求函数
loadMoreDemanding(
{ curr_page = 1, page_count = 20,
state = this.state.demandingStateSelected.id,
update_dateL = this.state.startDateSel,
update_dateU = this.state.endDateSel,
class_id = this.state.industryTypeSelected.id
}
) {
Taro.request({
url: URL.GetAllDemanding,
method: 'POST',
dataType: 'json',
data: {
param: JSON.stringify({
curr_page: curr_page,
page_count: page_count,
state: state,
update_dateL: update_dateL,
update_dateU: update_dateU,
class_id: class_id
}),
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(res => {
if (res.data.supplys.length) {
Taro.hideLoading()
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isMore: 'more' })
} else {
this.setState({ isMore: 'noMore' })
}
})
}
// 搜索业主需求函数
searchDemanding({ curr_page = 1, page_count = 10,
sd_title = this.state.title,
@ -107,29 +69,22 @@ class AllDemanding extends Component {
.then(res => {
Taro.hideLoading()
if(res.data.err_msg==='success'){
const total=Number(res.data.count)
this.setState({ supplys: res.data.supplys ,totalDemandings:total})
if (res.data.err_msg === 'success') {
const total = Number(res.data.count)
this.setState({ supplys: res.data.supplys, totalDemandings: total })
}else{
} else {
Taro.showToast({
title:res.data.err_msg,
icon:'none',
duration:1500
title: res.data.err_msg,
icon: 'none',
duration: 1500
})
}
})
}
// 向上拉升延迟一秒加载数据
handleLoadMore() {
this.setState({ isMore: 'loading' })
setTimeout(() => {
currentPage += 1
this.loadMoreDemanding({ curr_page: currentPage })
}, 1000);
}
// 改变需求选项
changeDemandingState = e => {
this.setState({
@ -223,15 +178,16 @@ class AllDemanding extends Component {
// 翻页导航
paginationNav(type) {
Taro.showLoading({
title:'加载中'
title: '加载中'
})
this.setState({ currentPage: type.current, }, () => {
this.searchDemanding({ curr_page :this.state.currentPage, page_count : 10,
sd_title : this.state.title,
state : this.state.demandingStateSelected.id,
update_dateL : this.state.startDateSel,
update_dateU : this.state.endDateSel,
class_id : this.state.industryTypeSelected.id
this.searchDemanding({
curr_page: this.state.currentPage, page_count: 10,
sd_title: this.state.title,
state: this.state.demandingStateSelected.id,
update_dateL: this.state.startDateSel,
update_dateU: this.state.endDateSel,
class_id: this.state.industryTypeSelected.id
})
})
}
@ -290,13 +246,16 @@ class AllDemanding extends Component {
<View className='detail'>
<View className='title'>{item.sd_title}</View>
<View className='para'>{item.sd_desc}</View>
<View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
<AtButton type='primary' size='small' className='orange'> {item.state_name === '在用' ? '抢单' : '已抢单'}</AtButton>
{item.state_name === '在用' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
<AtButton type='primary' size='small' className='orange'>抢单</AtButton>
</View> : <View className='button' >
<AtButton type='primary' size='small' className='blur'> 已抢单</AtButton>
</View>
}
</View>
</View>
<View className='footer'>
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon></View>
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon>{item.user_address}</View>
<View className='time'>更新日期:{item.update_date}</View>
</View>

View File

@ -37,8 +37,8 @@ class Index extends Component {
// url:'/pages/myNeeds/myNeeds',
//url:'/pages/myNeedsPublish/myNeedsPublish'
// url:'/pages/mySupplyDemand/mySupplyDemand'
// url:'/pages/home/home'
url:'/pages/allDemanding/allDemanding'
url:'/pages/home/home'
// url:'/pages/allDemanding/allDemanding'
})

View File

@ -142,6 +142,7 @@ class Shop extends Component {
}
//侧边筛选商品类型
if (data.goods_type) {
// console.log('数据',data.goods_type)
let goodTypeArray = []
Object.keys(data.goods_type).forEach(key => {
goodTypeArray.push({ id: data.goods_type[key].goods_type_id, name: data.goods_type[key].goods_type_ch_name, checked: false })

View File

@ -34,4 +34,3 @@ bug 商品编辑 增加图片后 图片顺序乱了
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
// switch ---- shopTypeInteractionComp