我的供求,供求编辑,供求查看,供求发布--完成
This commit is contained in:
parent
79f3634eb5
commit
aa3eaccf8e
@ -3,10 +3,9 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
|
||||
import { AtTabBar, Picker, AtButton } from 'taro-ui'
|
||||
import { Picker } from 'taro-ui'
|
||||
|
||||
import './goodsTypeInteractionComp.scss'
|
||||
import { throws } from 'assert';
|
||||
|
||||
class GoodsTypeInteractionComp extends Component {
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
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 } from 'taro-ui'
|
||||
import { AtInput, AtButton, Picker, AtIcon, AtLoadMore, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction, AtPagination } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './allDemanding.scss'
|
||||
|
||||
@ -21,8 +23,8 @@ class AllDemanding extends Component {
|
||||
isMore: 'more', // 加载状态
|
||||
demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
|
||||
demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
|
||||
industryCate: ['全部', '制定家具', '成品家具', '办公家具', '设计'], // 行业分类状态选择
|
||||
industryCateSelected: '全部', // 当前行业分类状态
|
||||
industryTypeSelected: { name: '全部', id: '' },// 当前行业分类
|
||||
title: '',
|
||||
startDateSel: '',
|
||||
endDateSel: '',
|
||||
classId: '',
|
||||
@ -30,6 +32,9 @@ class AllDemanding extends Component {
|
||||
grabOrderId: '',//抢到订单的id
|
||||
isGrabOrderSuccess: false,// 是否显示轻提示
|
||||
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
||||
totalDemandings:0,
|
||||
currentPage:1
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -39,7 +44,7 @@ class AllDemanding extends Component {
|
||||
state = this.state.demandingStateSelected.id,
|
||||
update_dateL = this.state.startDateSel,
|
||||
update_dateU = this.state.endDateSel,
|
||||
class_id = this.state.classId
|
||||
class_id = this.state.industryTypeSelected.id
|
||||
}
|
||||
) {
|
||||
Taro.request({
|
||||
@ -71,11 +76,12 @@ class AllDemanding extends Component {
|
||||
})
|
||||
}
|
||||
// 搜索业主需求函数
|
||||
searchDemanding({ curr_page = 1, page_count = 20,
|
||||
searchDemanding({ curr_page = 1, 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.classId
|
||||
class_id = this.state.industryTypeSelected.id
|
||||
}) {
|
||||
Taro.request({
|
||||
url: URL.GetAllDemanding,
|
||||
@ -85,6 +91,7 @@ class AllDemanding extends Component {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
sd_title: sd_title,
|
||||
state: state,
|
||||
update_dateL: update_dateL,
|
||||
update_dateU: update_dateU,
|
||||
@ -100,7 +107,18 @@ class AllDemanding extends Component {
|
||||
.then(res => {
|
||||
|
||||
Taro.hideLoading()
|
||||
this.setState({ supplys: res.data.supplys })
|
||||
if(res.data.err_msg==='success'){
|
||||
const total=Number(res.data.count)
|
||||
this.setState({ supplys: res.data.supplys ,totalDemandings:total})
|
||||
|
||||
}else{
|
||||
Taro.showToast({
|
||||
title:res.data.err_msg,
|
||||
icon:'none',
|
||||
duration:1500
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
@ -118,12 +136,10 @@ class AllDemanding extends Component {
|
||||
demandingStateSelected: this.state.demandingState[e.detail.value]
|
||||
})
|
||||
}
|
||||
// 改变行业类别选项
|
||||
changeIndustryCate = e => {
|
||||
this.setState({
|
||||
industryCateSelected: this.state.industryCate[e.detail.value]
|
||||
})
|
||||
titleChange(event) {
|
||||
this.setState({ title: event })
|
||||
}
|
||||
|
||||
//改变开始日期
|
||||
onStartDateChange = e => {
|
||||
this.setState({
|
||||
@ -180,15 +196,45 @@ class AllDemanding extends Component {
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
searchHanlder() {
|
||||
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
setTimeout(() => {
|
||||
this.searchDemanding({})
|
||||
}, 1000);
|
||||
|
||||
})
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.searchDemanding({})
|
||||
}
|
||||
//清空筛选项
|
||||
emptyFilter() {
|
||||
this.setState({
|
||||
title: '',
|
||||
endDateSel: '',
|
||||
startDateSel: '',
|
||||
demandingStateSelected: { name: '全部', id: '' },
|
||||
industryTypeSelected: { name: '全部', id: '' },
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
|
||||
getDataFromChild(value) {
|
||||
console.log('从子组件传回来的值', value)
|
||||
this.setState({ industryTypeSelected: value })
|
||||
}
|
||||
|
||||
// 翻页导航
|
||||
paginationNav(type) {
|
||||
Taro.showLoading({
|
||||
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
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
@ -268,7 +314,7 @@ class AllDemanding extends Component {
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.demandingState} onChange={this.changeDemandingState}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> <Text className='require'>*</Text>供求状态:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
|
||||
<Text className='title'> 供求状态:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
@ -277,14 +323,14 @@ class AllDemanding extends Component {
|
||||
</View>
|
||||
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
|
||||
<AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
placeholder='需求标题'
|
||||
value={this.state.value}
|
||||
onChange={this.handleChange.bind(this)}
|
||||
value={this.state.title}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
{/* 开始和结束日期选择 */}
|
||||
@ -293,48 +339,50 @@ class AllDemanding extends Component {
|
||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>开始日期:</Text> <Text className='selected'>{this.state.startDateSel}</Text>
|
||||
<Text className='title'>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
|
||||
<Text className='title'>结束日期:</Text> <Text className='date'>{this.state.endDateSel}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
{/* 行业分类选择 */}
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
<Picker mode='selector' range={this.state.industryCate} onChange={this.changeIndustryCate}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> <Text className='require'>*</Text>行业分类:</Text> <Text className='selected'>{this.state.industryCateSelected}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
<View className='button-box' onClick={this.searchHanlder.bind(this)}>
|
||||
<View className='button'>
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
||||
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.searchHanlder.bind(this)}>
|
||||
<AtButton type='primary' size='small'>
|
||||
<AtIcon value='search' 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='demanding-box'>
|
||||
{allDemandingElementArray}
|
||||
</View>
|
||||
<AtLoadMore
|
||||
onClick={this.handleLoadMore.bind(this)}
|
||||
status={this.state.isMore}
|
||||
loadingText='加载中'
|
||||
noMoreText='没有更多了'
|
||||
/>
|
||||
<View className='pagination-box'>
|
||||
<AtPagination
|
||||
total={this.state.totalDemandings}
|
||||
pageSize={10}
|
||||
current={this.state.currentPage}
|
||||
onPageChange={this.state.paginationNav.bind(this)}
|
||||
>
|
||||
</AtPagination>
|
||||
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
)
|
||||
|
@ -22,6 +22,11 @@ $themeColor: #FF7142;
|
||||
.selected{
|
||||
display: inline-block;
|
||||
margin-left: 20%;
|
||||
font-size: 32rpx
|
||||
}
|
||||
.date{
|
||||
display: inline-block;
|
||||
|
||||
font-size: 32rpx
|
||||
}
|
||||
.title-box{
|
||||
@ -30,7 +35,7 @@ $themeColor: #FF7142;
|
||||
margin-right:16rpx;
|
||||
width:172rpx;
|
||||
font-size:32rpx;
|
||||
line-height:1.5;
|
||||
line-height:100px;
|
||||
// vertical-align:middle;
|
||||
text-align:left;
|
||||
font-weight: bold;
|
||||
@ -53,17 +58,28 @@ $themeColor: #FF7142;
|
||||
}
|
||||
}
|
||||
.button-box{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0;
|
||||
padding: 0 120px;
|
||||
|
||||
.button{
|
||||
margin-top: 50px;
|
||||
margin-bottom: 50px;
|
||||
text-align: center;
|
||||
flex:1;
|
||||
text-align: center;
|
||||
|
||||
|
||||
.at-button--primary{
|
||||
background-color:$themeColor;
|
||||
border:1PX solid $themeColor;
|
||||
}
|
||||
}
|
||||
|
||||
.button-b{
|
||||
|
||||
background-color:#d9534f;
|
||||
border:1PX solid #d9534f;
|
||||
}
|
||||
}
|
||||
}
|
||||
.demanding-box{
|
||||
.demanding-info{
|
||||
@ -153,3 +169,6 @@ $themeColor: #FF7142;
|
||||
}
|
||||
|
||||
}
|
||||
.pagination-box{
|
||||
margin: 50px 0;
|
||||
}
|
@ -36,7 +36,9 @@ class Index extends Component {
|
||||
// url:'/pages/myGoodList/myGoodList'
|
||||
// url:'/pages/myNeeds/myNeeds',
|
||||
//url:'/pages/myNeedsPublish/myNeedsPublish'
|
||||
url:'/pages/goodsPublish/goodsPublish'
|
||||
// url:'/pages/mySupplyDemand/mySupplyDemand'
|
||||
// url:'/pages/home/home'
|
||||
url:'/pages/allDemanding/allDemanding'
|
||||
|
||||
|
||||
})
|
||||
|
@ -22,7 +22,6 @@ class MyNeeds extends Component {
|
||||
title: '',
|
||||
startDateSel: '',
|
||||
endDateSel: '',
|
||||
industryType: '',
|
||||
industryTypeSelected: { name: '全部', id: '' },
|
||||
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
@ -242,7 +241,7 @@ class MyNeeds extends Component {
|
||||
sd_title: this.state.title,
|
||||
update_dateL: this.state.startDateSel,
|
||||
update_dateU: this.state.endDateSel,
|
||||
class_id: this.state.industryType,
|
||||
class_id: this.state.industryTypeSelected.id,
|
||||
state: this.state.needsStateSelected.id
|
||||
})
|
||||
})
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, AtButton, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction,AtPagination } from 'taro-ui'
|
||||
import { AtInput, AtButton, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtPagination } from 'taro-ui'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
@ -28,8 +28,8 @@ class MySupplyDemand extends Component {
|
||||
isConfirmWindow: false, // 是否显示确认弹窗
|
||||
demandSupplyItemName: '',// 确认框提示时 使用的供求名
|
||||
demandSupplyId: '',// 删除我的供求时的供求id
|
||||
totalDemandSupply:0,//所有供求
|
||||
currentPage:1 //当前页数
|
||||
totalDemandSupply: 0,//所有供求
|
||||
currentPage: 1 //当前页数
|
||||
|
||||
|
||||
}
|
||||
@ -56,8 +56,8 @@ class MySupplyDemand extends Component {
|
||||
if (res.data.err_msg === "success") {
|
||||
// 判断是否有res.data.supplys , 如果没有就是空数组[]
|
||||
Taro.hideLoading()
|
||||
|
||||
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply:Number(res.data.count) })
|
||||
const totalCount = Number(res.data.count)
|
||||
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: totalCount })
|
||||
}
|
||||
})
|
||||
|
||||
@ -97,12 +97,10 @@ class MySupplyDemand extends Component {
|
||||
|
||||
}
|
||||
onSearchButtonHandler() {
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
setTimeout(() => {
|
||||
this.searchDemandSupply({})
|
||||
this.setState({currentPage:1})
|
||||
}, 1000);
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
|
||||
this.setState({ currentPage: 1 }, () => {
|
||||
this.searchDemandSupply({})
|
||||
})
|
||||
|
||||
}
|
||||
@ -160,6 +158,22 @@ class MySupplyDemand extends Component {
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
//清空筛选项
|
||||
emptyFilter() {
|
||||
|
||||
this.setState({
|
||||
title: '',
|
||||
endDateSel: '',
|
||||
startDateSel: '',
|
||||
demandSupplyCateSelected: { name: '全部', id: '' },
|
||||
demandSupplyStatesSelected: { name: '全部', id: '' },
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//修改供求类型
|
||||
@ -205,11 +219,10 @@ class MySupplyDemand extends Component {
|
||||
|
||||
// 删除我的供求
|
||||
handleOnDelete(id, itemName) {
|
||||
|
||||
this.setState({ isConfirmWindow: true, demandSupplyItemName: itemName, demandSupplyId: id })
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 编辑我的供求
|
||||
|
||||
// 跳转到我的供求编辑页面
|
||||
@ -220,19 +233,19 @@ class MySupplyDemand extends Component {
|
||||
|
||||
}
|
||||
// 转到供求查看页面
|
||||
goToSupplyDemandPage(sdId) {
|
||||
goSupplyDemandView(sdId) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
|
||||
// url: '/pages/goods/goods?sdId='+goodId// 虚拟地址
|
||||
})
|
||||
}
|
||||
// 翻页导航
|
||||
paginationNav(type) {
|
||||
this.setState({ currentPage: type.current, }, () => {
|
||||
this. getMySupplyDemand({ curr_page :this.state.currentPage})
|
||||
})
|
||||
// 翻页导航
|
||||
paginationNav(type) {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.setState({ currentPage: type.current, }, () => {
|
||||
this.getMySupplyDemand({ curr_page: this.state.currentPage })
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -264,18 +277,18 @@ class MySupplyDemand extends Component {
|
||||
|
||||
|
||||
const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => {
|
||||
const SDState=this.state.demandSupplyState.filter(stateItem=>{
|
||||
return stateItem.id==item.state
|
||||
const SDState = this.state.demandSupplyState.filter(stateItem => {
|
||||
return stateItem.id == item.state
|
||||
})[0].name
|
||||
|
||||
return <View key={index} className='info-container'>
|
||||
return <View key={index} className='info-container'>
|
||||
<View className='type'>
|
||||
<Text className='title'>需求类型:</Text>
|
||||
<Text className='info'>{item.type_name}</Text>
|
||||
</View>
|
||||
<View className='demand-title'>
|
||||
<Text className='title'>需求标题:</Text>
|
||||
<Text className='info'>{item.sd_title}</Text>
|
||||
<Text className='info' onClick={this.goSupplyDemandView.bind(this, item.sd_id)}>{item.sd_title}</Text>
|
||||
</View>
|
||||
<View className='contact-name'>
|
||||
<Text className='title'>联系人:</Text>
|
||||
@ -294,7 +307,7 @@ class MySupplyDemand extends Component {
|
||||
<Text className='info'>{item.update_date}</Text>
|
||||
</View>
|
||||
<View className='info-button-box'>
|
||||
<View className='button' onClick={this.goToSupplyDemandPage.bind(this, item.sd_id)}>
|
||||
<View className='button' onClick={this.goSupplyDemandView.bind(this, item.sd_id)}>
|
||||
<AtButton type='primary' size='small'>查看</AtButton>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyDSEditPage.bind(this, item.sd_id)} >
|
||||
@ -360,7 +373,7 @@ class MySupplyDemand extends Component {
|
||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>开始日期:</Text> <Text className='selected'>{this.state.startDateSel}</Text>
|
||||
<Text className='title'><Text className='require'>*</Text>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
@ -368,7 +381,7 @@ class MySupplyDemand extends Component {
|
||||
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
|
||||
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='date'>{this.state.endDateSel}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
@ -387,6 +400,11 @@ class MySupplyDemand 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-count'>一共<Text className='number'>{this.state.totalDemandSupply}</Text> 条记录</View>
|
||||
{/* 我的供求信息 */}
|
||||
@ -394,15 +412,15 @@ class MySupplyDemand extends Component {
|
||||
{demandSupplyElementArray}
|
||||
</View>
|
||||
<View className='pagination-box'>
|
||||
<AtPagination
|
||||
total={this.state.totalDemandSupply}
|
||||
pageSize={10}
|
||||
current={this.state.currentPage}
|
||||
onPageChange={this.state.paginationNav.bind(this)}
|
||||
>
|
||||
</AtPagination>
|
||||
<AtPagination
|
||||
total={this.state.totalDemandSupply}
|
||||
pageSize={10}
|
||||
current={this.state.currentPage}
|
||||
onPageChange={this.state.paginationNav.bind(this)}
|
||||
>
|
||||
</AtPagination>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
|
@ -32,9 +32,14 @@ $themeColor:#FF7142;
|
||||
// padding: 24rpx 0;
|
||||
.selected{
|
||||
display: inline-block;
|
||||
margin-left: 20%;
|
||||
margin-left: 20%;
|
||||
font-size: 32rpx
|
||||
}
|
||||
.date{
|
||||
display: inline-block;
|
||||
font-size: 32rpx
|
||||
|
||||
}
|
||||
.title-box{
|
||||
.title{
|
||||
//color: #333;
|
||||
@ -42,7 +47,6 @@ $themeColor:#FF7142;
|
||||
width:172rpx;
|
||||
font-size:32rpx;
|
||||
line-height:1.5;
|
||||
vertical-align:middle;
|
||||
text-align:left;
|
||||
font-weight: bold;
|
||||
}
|
||||
@ -86,6 +90,11 @@ $themeColor:#FF7142;
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
}
|
||||
.button-b{
|
||||
|
||||
background-color:#d9534f;
|
||||
border:1PX solid #d9534f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,8 +107,9 @@ $themeColor:#FF7142;
|
||||
box-shadow: 0 8px 8px #ddd;
|
||||
padding: 10px;
|
||||
View{
|
||||
margin:10px
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.demand-title{
|
||||
.info{color:#337ab7; }
|
||||
}
|
||||
@ -132,7 +142,7 @@ $themeColor:#FF7142;
|
||||
|
||||
.title{
|
||||
text-align: center;
|
||||
font-size: 35px;
|
||||
font-size: 30px;
|
||||
|
||||
}
|
||||
.pagination-box{
|
||||
|
@ -24,14 +24,13 @@ class SupplyDemand extends Component {
|
||||
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
|
||||
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
|
||||
title: '',
|
||||
contactName: '',
|
||||
contactNumber: '',
|
||||
contactName: Taro.getStorageSync('user_identity').username,
|
||||
contactNumber: Taro.getStorageSync('user_identity').userphone,
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
|
||||
isFormCompleted: false,
|
||||
|
||||
}
|
||||
}
|
||||
@ -200,7 +199,7 @@ class SupplyDemand extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
// this.uploadSupplyDemand()
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image } from '@tarojs/components'
|
||||
import { AtButton, AtIcon } from 'taro-ui'
|
||||
import { AtButton, AtIcon,AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
@ -28,6 +28,7 @@ class SupplyDemandView extends Component {
|
||||
address: '',
|
||||
content: '',
|
||||
images: [],
|
||||
isDeleteModal:false
|
||||
}
|
||||
}
|
||||
//获取商品信息api GetProductInfo
|
||||
@ -59,6 +60,7 @@ class SupplyDemandView extends Component {
|
||||
address: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
images: res.data.sdInfo.file_path,
|
||||
itemId:res.data.sdInfo.sd_id
|
||||
})
|
||||
Taro.hideLoading()
|
||||
}
|
||||
@ -67,28 +69,89 @@ class SupplyDemandView extends Component {
|
||||
console.log('供求详情获取失败', error)
|
||||
})
|
||||
}
|
||||
// 删除我的供求api
|
||||
onDelete({ sdID = 0 }) {
|
||||
Taro.request({
|
||||
url: URL.DeleteDemandSupply,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
sdID: sdID
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_msg == 'success') {
|
||||
console.log('删除成功')
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon:'success',
|
||||
duration:1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
this.goToMySDPage()
|
||||
}, 1500);
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
|
||||
Taro.showToast({
|
||||
title: '删除失败',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
goToSDPublishPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
||||
})
|
||||
}
|
||||
goToSDEditPage() {
|
||||
console.log('edit page')
|
||||
// Taro.navigateTo({
|
||||
// url: 'pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面
|
||||
// })
|
||||
// 跳转到我的供求编辑页面
|
||||
goToMyDSEditPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + this.state.itemId
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
goToMySDPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
|
||||
}
|
||||
deleteSD() {
|
||||
console.log('删除供求')
|
||||
makeAPhoneCall(){
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: this.state.contactNumber
|
||||
})
|
||||
}
|
||||
|
||||
deleteButton() {
|
||||
this.setState({ isDeleteModal: true })
|
||||
}
|
||||
handleWindowModCancel() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
this.onDelete({ sdID: this.state.itemId })
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({title:'加载中'})
|
||||
this.getSupplyDemandInfo()
|
||||
@ -106,13 +169,21 @@ class SupplyDemandView extends Component {
|
||||
render() {
|
||||
const imageElementArray = this.state.images.map((item, index) => {
|
||||
return <View key={index} className='image-box'>
|
||||
<Image mode='aspectFit' style='width: 100%;'
|
||||
<Image mode='widthFix' style='width: 100%;'
|
||||
src={URL.Base + item.file_path}
|
||||
/>
|
||||
</View>
|
||||
})
|
||||
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>
|
||||
return (
|
||||
<View className='SupplyDemandItemView'>
|
||||
{deleteModalWindowElement}
|
||||
<View className='type box'>
|
||||
<Text className='title'>供求类型:</Text>
|
||||
<Text className='content'>{this.state.type}</Text>
|
||||
@ -131,7 +202,7 @@ class SupplyDemandView extends Component {
|
||||
</View>
|
||||
<View className='phone-number box'>
|
||||
<Text className='title'>联系电话:</Text>
|
||||
<Text className='content'>{this.state.contactNumber}</Text>
|
||||
<Text className='content highlight' onClick={this.state.makeAPhoneCall.bind(this)}>{this.state.contactNumber}</Text>
|
||||
</View>
|
||||
<View className='address box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
@ -150,11 +221,11 @@ class SupplyDemandView extends Component {
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.goToSDPublishPage.bind(this)}>
|
||||
<AtButton type='primary' size='small'>
|
||||
<AtButton type='primary' className='button-g' size='small'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</AtButton>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToSDEditPage.bind(this)}>
|
||||
<View className='button' onClick={this.goToMyDSEditPage.bind(this)}>
|
||||
<AtButton type='primary' className='button' size='small'>
|
||||
<AtIcon value='settings' size='12' color='white'></AtIcon>
|
||||
修改</AtButton>
|
||||
@ -164,7 +235,7 @@ class SupplyDemandView extends Component {
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的供求</AtButton>
|
||||
</View>
|
||||
<View className='button' onClick={this.deleteSD.bind(this)}>
|
||||
<View className='button' onClick={this.deleteButton.bind(this)}>
|
||||
<AtButton type='primary' className='button-a' size='small'>
|
||||
<AtIcon value='close' size='12' color='white'></AtIcon>
|
||||
删除</AtButton>
|
||||
|
@ -9,6 +9,9 @@ $themeColor:#FF7142;
|
||||
.title{
|
||||
font-weight: bold
|
||||
}
|
||||
.highlight{
|
||||
color:#337ab7
|
||||
}
|
||||
|
||||
}
|
||||
.button-box{
|
||||
@ -28,9 +31,16 @@ $themeColor:#FF7142;
|
||||
background-color:$themeColor;
|
||||
border:1PX solid $themeColor;
|
||||
}
|
||||
.button-g{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#d9534f;
|
||||
border:1PX solid #d9534f;
|
||||
}
|
||||
}
|
||||
}
|
||||
.image-container{
|
||||
padding: 20px
|
||||
}
|
Loading…
Reference in New Issue
Block a user