我的需求页面

This commit is contained in:
郑茂强 2019-01-03 17:36:59 +08:00
parent e8931a05a3
commit 8d81766dec
16 changed files with 713 additions and 92 deletions

View File

@ -31,6 +31,7 @@ class App extends Component {
'pages/myDemandSupplyEdit/myDemandSupplyEdit',// 我的供求编辑页面
'pages/supplyDemandView/supplyDemandView',// 查看单个供求页面
'pages/grabOrderPage/grabOrderPage',// 抢单页面
'pages/myNeeds/myNeeds',// 我的需求页面
// 'pages/shopDescription/shopDescription',
],
window: {

View File

@ -28,7 +28,7 @@ class bottomNav extends Component {
{ name: '商品发布', url: '/pages/goodsPublish/goodsPublish' },
{ name: '供求发布', url: '/pages/supplyDemandPublish/supplyDemandPublish' },
{ name: '我的供求', url: '/pages/mySupplyDemand/mySupplyDemand' },
{ name: '更多', url: '' },
{ name: '我的需求', url: '/pages/myNeeds/myNeeds' },
]
let path=otherData[value].url
Taro.navigateTo({
@ -49,11 +49,11 @@ class bottomNav extends Component {
render() {
const otherData=[
{ name: '首页', url:'pages/home/home'},
{ name: '商品发布', url:'pages/shop/shop'},
{ name: '供求发布', url:'pages/supplyDemandPubish/supplyDemandPubish'},
{name:'我的供求',url:''},
{name:'更多',url:''},
{ name: '首页', url: 'pages/home/home' },
{ name: '商品发布', url: 'pages/goodsPublish/goodsPublish' },
{ name: '供求发布', url: 'pages/supplyDemandPublish/supplyDemandPublish' },
{ name: '我的供求', url: 'pages/mySupplyDemand/mySupplyDemand' },
{ name: '我的需求', url: 'pages/myNeeds/myNeeds' },
]
// const otherDataElementsArray = this.props.otherData? this.props.otherData.menu.map((item, index) => {
const otherDataElementsArray = otherData.map((item, index) => {

View File

@ -1,7 +1,7 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image , Swiper, SwiperItem} from '@tarojs/components'
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast, Picker } from 'taro-ui'
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, Picker } from 'taro-ui'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config'
@ -19,7 +19,6 @@ class Goods extends Component {
this.state = {
current: 0, // 当前大类评论区
subCurrent: 0, // 当前小类评论区
isOpened: false, // 是否显示轻提示
selector: ['0', '1', '2', '3'], // 数量或者规格选择
selectorChecked: '0', // 已选择的数量或规格
productImagesUrl: '', // 图片地址
@ -46,22 +45,33 @@ class Goods extends Component {
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {
console.log('商品详情:', res)
this.setState({
productImagesUrl: res.data.goods.goods_pic,
productName: res.data.goods.goods_name,
productDes: res.data.goods.goods_profiles,
oldPirce: res.data.goods.goods_org_price,
specialPrice: res.data.goods.goods_price,
productType: res.data.goods.goods_type_name,
serviceArea: res.data.goodsRegionName[0],
monthSold: res.data.goods.month_sales,
totalSold: res.data.goods.sales_volume,
browsingCount: res.data.goods.browse_times,
if(res.data.err_msg==="success"){
this.setState({
productImagesUrl: res.data.goods.goods_pic,
productName: res.data.goods.goods_name,
productDes: res.data.goods.goods_profiles,
oldPirce: res.data.goods.goods_org_price,
specialPrice: res.data.goods.goods_price,
productType: res.data.goods.goods_type_name,
serviceArea: res.data.goodsRegionName[0],
monthSold: res.data.goods.month_sales,
totalSold: res.data.goods.sales_volume,
browsingCount: res.data.goods.browse_times,
})
}else{
Taro.showToast({
title:res.data.err_msg,
icon:'none',
duration:1000
})
}
}
)
}
@ -86,7 +96,20 @@ class Goods extends Component {
}
// 收藏商品
saveItem() {
this.setState({ isOpened: true })
Taro.showToast({
title:'收藏成功',
icon:'success',
duration:1500
})
}
//添加到购物车
addToCart(){
Taro.showToast({
title:'添加成功',
icon:'success',
duration:1500
})
}
// 数量或者规格方法
onChange = e => {
@ -205,7 +228,7 @@ class Goods extends Component {
{/* 详情和评论区 */}
<View className='details-box'>
{/* 大类 */}
<AtTabs selectedColor='#FF7142' className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
<AtTabs className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
<AtTabsPane current={this.state.current} index={0} >
<View style='background-color: #FAFBFC;' >
@ -277,15 +300,16 @@ class Goods extends Component {
</View>
<View className='collection' onClick={this.saveItem.bind(this)}>
<AtIcon className='icon' value='heart' size='12' color='white'></AtIcon>
<AtToast
isOpened={this.state.isOpened}
duration={1000}
text='收藏成功'
></AtToast>
<Text className='title'>收藏商品</Text>
</View>
<View className='add-cart'>
加入购物车
<View className='add-cart' onClick={this.addToCart.bind(this)}>
<AtIcon className='icon' value='shopping-cart' size='12' color='white'></AtIcon>
<Text className='title'> 加入购物车</Text>
</View>
</View>

View File

@ -124,7 +124,7 @@ $themeColor:#FF7142;
.at-tabs{
.at-tabs__item--active{
color:$themeColor
// color:$themeColor
}
}
.description-title{
@ -176,6 +176,13 @@ $themeColor:#FF7142;
flex:1;
color: #333;
background-color: white;
.icon{
vertical-align: middle
}
.title{
display: inline-block;
margin-left: 10px;
}
}
.collection{
@ -195,6 +202,13 @@ $themeColor:#FF7142;
flex:1;
background-color:#F03726;
color: white;
.icon{
vertical-align: middle
}
.title{
display: inline-block;
margin-left: 10px;
}
}
}
}

View File

@ -1,12 +1,11 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui'
import { View, Text,Input } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, } from 'taro-ui'
import URL from '../../serviceAPI.config'
import './goodsPublish.scss'
import { throws } from 'assert';
class GoodsPublish extends Component {
@ -105,7 +104,8 @@ class GoodsPublish extends Component {
}
// 发布商品api
uploadGoods({ goods_name = "test2", goods_price = "1.00",
uploadGoods({ goods_name = "test2",
goods_price = "1.00",
goods_unit = "1", goods_profiles = "test2",
class_id = "10103",
shop_class_id = "1930" }) {
@ -126,14 +126,15 @@ class GoodsPublish extends Component {
file_id: this.state.ImagesInfo[i].file_id,
file_type: 1,
if_cover: 0,
file_sort: 1
file_sort: i+1
})
}
}
} else {
alert('图片为空')
}
console.log('页面图片列表',this.state.pickerImageUrl)
console.log('图片参数列表',uploadProductGoodFileParams)
Taro.request({
url: URL.UploadProduct,
method: 'POST',
@ -159,17 +160,30 @@ class GoodsPublish extends Component {
})
.then(res => {
Taro.hideLoading()
Taro.showToast({
title: '发布成功',
icon: 'success',
duration: 1000
})
setTimeout(() => {
if(res.data.err_msg==='success'){
Taro.showToast({
title: '发布成功',
icon: 'success',
duration: 1000
})
setTimeout(() => {
Taro.navigateTo({
url: '/pages/goods/goods?id='+res.data.goods_id
})
}, 1000);
}
else{
Taro.showToast({
title: res.data.err_msg,
icon: 'none',
duration: 1000
})
}
Taro.navigateTo({
url: '/pages/goods/goods?id='+res.data.goods_id
})
}, 1000);
console.log('上传商品', res)
}
@ -224,6 +238,9 @@ class GoodsPublish extends Component {
this.setState({
productPrice: event
})
}
productUnitChange(event) {
this.setState({
@ -256,6 +273,7 @@ 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: '上传成功',
@ -268,7 +286,8 @@ class GoodsPublish extends Component {
}
if (operationType === 'remove') {
this.state.pickerImageUrl.splice(index, 1);
this.setState({ files: this.state.pickerImageUrl });
this.state.ImagesInfo.splice(index, 1);
this.setState({ pickerImageUrl: this.state.pickerImageUrl,ImagesInfo:this.state.ImagesInfo });
Taro.showToast({
title: '删除成功',
icon: 'success',

View File

@ -3,6 +3,8 @@ 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'
@ -13,9 +15,65 @@ 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)
@ -46,7 +104,7 @@ class GrabOrderPage extends Component {
<Text className='title'>联系人</Text>
<Text className='content'>{this.state.contactName}</Text>
</View>
<View className='phone-number box'>
<View className='phone-number box' onClick={this.callPhoneNumber.bind(this)} >
<Text className='title'>联系电话</Text>
<Text className='content'>{this.state.contactNumber}</Text>
</View>

View File

@ -7,6 +7,11 @@
.title{
font-weight: bold
}
.phone-number{
.content{
color:#0579c6
}
}
}
.button-box{

View File

@ -24,7 +24,6 @@ class Home extends Component {
otherData: [], // 底部导航栏
isOpen: false, // 抢单消息提示
grabOrderId: '',//抢到订单的id
isMore: 'noMore',// 加载更多店铺
userName:'',//用户名字
userPhone:'',// 用户电话
@ -35,8 +34,9 @@ class Home extends Component {
//api 得到首页的信息
//api得到首页的信息
getHomeCategoriesInfo() {
Taro.request({
url: URL.ShopWxStore,
header: {
@ -170,7 +170,7 @@ class Home extends Component {
})
.then(res => {
Taro.showToast({
title: res.data.err_msg,
title: res.data.err_msg==='success'?'抢单成功':res.data.err_msg,
icon:'none',
duration:1500
})
@ -227,10 +227,10 @@ class Home extends Component {
}
// 导航去抢单页面
goToGrabOrderPage(){
goToGrabOrderPage(orderId){
Taro.navigateTo({
url:'/pages/grabOrderPage/grabOrderPage'
url:'/pages/grabOrderPage/grabOrderPage?orderId='+orderId
})
}
componentDidMount() {
@ -282,7 +282,7 @@ class Home extends Component {
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
return <SwiperItem key={index} >
<View className='demanding-item' >
<View onClick={this.goToGrabOrderPage.bind(this)}>
<View onClick={this.goToGrabOrderPage.bind(this,item.sd_id)}>
<View className='item-tag'>
<Text className='item-tag-text'> {item.class_name}</Text>
</View>

View File

@ -35,6 +35,8 @@ class Index extends Component {
// url: '/pages/mySupplyDemand/mySupplyDemand'
// url:'/pages/grabOrderPage/grabOrderPage'
url:'/pages/home/home'
//url:'/pages/myNeeds/myNeeds'
})
}
componentWillReceiveProps (nextProps) {

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Radio, } from '@tarojs/components'
import { AtInput, Text, AtButton, AtIcon, Picker, Image, AtPagination, } from 'taro-ui'
import { AtInput, Text, AtButton, AtIcon, Picker, Image, AtPagination,AtModal,AtModalHeader,AtModalContent,AtModalAction,Button } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config'
@ -37,10 +37,12 @@ class MyGoodList extends Component {
myGoodListTotal: 0,// 后台的商品总数
currentPage: 1,
goodsStateParam: 1,//商品状态参数
pageCountParam: 10,// 商品数量参数
pageCountParam: 5,// 商品数量参数
currPageParam: 1,// 当前页面 参数
isCheckAll: false,// 是否checked
goodsIdList: [],//商品Id 列表
isOpenDeleteModal:false,// 是否显示删除模态框
isOpenOffStockModal:false,// 是否显示下架模态框
@ -114,9 +116,13 @@ class MyGoodList extends Component {
if (res.statusCode === 200) {
console.log('我的商品列表', JSON.parse(res.data))
const data = JSON.parse(res.data)
data.goods.forEach(item => {
item.checked = false
});
if(data.goods){
data.goods.forEach(item => {
item.checked = false
});
}
const goodCount = Number(data.goodsCount)
this.setState({
myGoodList: data.goods,
@ -379,7 +385,9 @@ class MyGoodList extends Component {
item.checked = !this.state.isCheckAll
return item
})
this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList })
this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList },()=>{
console.log('全选列表',this.state.myGoodList)
})
}
@ -397,19 +405,20 @@ class MyGoodList extends Component {
}
// 删除商品
deleteGoodsHandler() {
const checkedGoodsId = []
this.state.myGoodList.forEach(item => {
if (item.checked) {
checkedGoodsId.push(item.goods_id)
}
});
checkedGoodsId.length ? this.deleteGood({ goodsID: checkedGoodsId }) : Taro.showToast({
checkedGoodsId.length ? this.setState({isOpenDeleteModal:true}): Taro.showToast({
title:'请选择要删除的商品',
icon:'none',
duration:1500
})
// // this.deleteGood({ goodsID: checkedGoodsId })
}
// 改变商品状态
@ -420,10 +429,11 @@ class MyGoodList extends Component {
checkedGoodsId.push(item.goods_id)
}
});
checkedGoodsId.length ? this.changeGoodState({ goodsID: checkedGoodsId }) : this.setState({ isToast: true, toastText: '请选择要下架的商品' }, () => {
setTimeout(() => {
this.setState({ isToast: false })
}, 2000);
//this.changeGoodState({ goodsID: checkedGoodsId })
checkedGoodsId.length ? this.setState({isOpenOffStockModal:true}) : Taro.showToast({
title:'请选择要下架的商品',
icon:'none',
duration:1500
})
}
// 导航到商品编辑页面myGoodsEdit
@ -438,6 +448,41 @@ class MyGoodList extends Component {
})
}
DeleteConfirm(){
this.setState({
isOpenDeleteModal:false
})
const checkedGoodsId = []
this.state.myGoodList.forEach(item => {
if (item.checked) {
checkedGoodsId.push(item.goods_id)
}
});
this.deleteGood({ goodsID: checkedGoodsId })
}
deleteModalClose(){
this.setState({
isOpenDeleteModal:false
})
}
OffStockConfirm(){
this.setState({
isOpenOffStockModal:false
})
const checkedGoodsId = []
this.state.myGoodList.forEach(item => {
if (item.checked) {
checkedGoodsId.push(item.goods_id)
}
});
this.changeGoodState({ goodsID: checkedGoodsId })
}
offStockModalClose(){
this.setState({
isOpenOffStockModal:false
})
}
componentDidMount() {
this.getMyGoodListApi({})
@ -484,10 +529,30 @@ class MyGoodList extends Component {
{isTure ? <AtIcon value='chevron-down' size='10' color='#F00'></AtIcon> : <AtIcon value='chevron-up' size='10' color='#F00'></AtIcon>}
</View>
})
// 删除提示模态弹窗element
const modalMessageDeleteElement = <AtModal isOpened={this.state.isOpenDeleteModal}>
<AtModalHeader>提示</AtModalHeader>
<AtModalContent>
确定要删除已选商品
</AtModalContent>
<AtModalAction> <Button onClick={this.deleteModalClose.bind(this)}>取消</Button> <Button className='orange' onClick={this.DeleteConfirm.bind(this)}></Button> </AtModalAction>
</AtModal>
// 下架提示模态弹窗element
const modalMessageOffStockElement = <AtModal isOpened={this.state.isOpenOffStockModal}>
<AtModalHeader>提示</AtModalHeader>
<AtModalContent>
确定要下架已选商品
</AtModalContent>
<AtModalAction> <Button onClick={this.offStockModalClose.bind(this)}>取消</Button> <Button className='orange' onClick={this.OffStockConfirm.bind(this)}></Button> </AtModalAction>
</AtModal>
return (
<View className='MyGoodList'>
{/* 删除模态提示框 */}
{modalMessageDeleteElement}
{/* 下架模态框提示 */}
{modalMessageOffStockElement}
<View className='border-box'>
<AtInput
@ -604,7 +669,7 @@ class MyGoodList extends Component {
<View className='pagination-box'>
<AtPagination
total={this.state.myGoodListTotal}
pageSize={10}
pageSize={5}
current={this.state.currentPage}
onPageChange={this.state.paginationNav.bind(this)}
>

View File

@ -24,9 +24,6 @@ class MyGoodsEdit extends Component {
ImagesInfo: [],// 后台传回来的图片信息
goodsTypeParam: '',//商品分类参数
goodId: '',//商品id
}
}
//获取商品信息api GetProductInfo
@ -75,7 +72,7 @@ class MyGoodsEdit extends Component {
}
// 店铺分类目录请求 api
async getShopCateList() {
getShopCateList() {
Taro.request({
url: URL.GetShopCategoryList,
method: 'POST',
@ -102,7 +99,7 @@ class MyGoodsEdit extends Component {
}
}
this.setState({ shopCategoryList: shopCategory }, () => {
this.getGoodsInfo()
})
console.log('店铺分类目录', res)
return
@ -139,7 +136,8 @@ class MyGoodsEdit extends Component {
file_id: this.state.ImagesInfo[i].file_id,
file_type: 1,
if_cover: 0,
file_sort: 1
file_sort: i+1
})
}
}
@ -152,7 +150,7 @@ class MyGoodsEdit extends Component {
method: 'POST',
dataType: 'json',
data: {
deployType: 1,
deployType: 2,
action: 2,
goods: JSON.stringify({
goods_name: goods_name,
@ -238,9 +236,11 @@ class MyGoodsEdit extends Component {
success(response) {
const data = JSON.parse(response.data)
console.log('imagedata',data)
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,
@ -272,10 +272,7 @@ class MyGoodsEdit extends Component {
}
}
// 图片上传失败
onFail(mes) {
console.log(mes)
}
onClickUploadGoods() {
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) {
@ -317,10 +314,7 @@ class MyGoodsEdit extends Component {
componentDidMount() {
this.getShopCateList().then(() => {
this.getGoodsInfo()
})
this.getShopCateList()
}

View File

@ -0,0 +1,308 @@
//myNeeds
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 URL from '../../serviceAPI.config'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './myNeeds.scss'
class MyNeeds extends Component {
config = {
navigationBarTitleText: '我的需求'
}
constructor() {
super(...arguments)
this.state = {
title: '',
startDateSel: '',
endDateSel: '',
industryType: '',
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' }],
needsStateSelected: { name: '全部', id: '' },
allNeedsList: [],// 我的需求列表
totalNeeds: 0,// 我的需求数量
}
}
//请求我的需求列表 api GetMyNeedsList
getGetMyNeedsList({ curr_page = 1, page_count = 10, sd_type = 4 }) {
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
})
},
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
if (res.data.err_msg === "success") {
// 判断是否有res.data.supplys 如果没有就是空数组[]
Taro.hideLoading()
console.log('我的需求列表', res)
this.setState({
allNeedsList: res.data.supplys || [],
totalNeeds: Number(res.data.count)
})
}
})
}
// 行业分类筛选列表GetIndustryTypeList
getGetMyNeedsList() {
Taro.request({
url: URL.GetIndustryTypeList,
method: 'GET',
dataType: 'json',
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
console.log('行业分类列表', res)
// this.setState({
// allNeedsList: res.data.supplys || [],
// totalNeeds: Number(res.data.count)
// })
})}
// 搜索按钮
onSearchButtonHandler() {
Taro.showLoading({ title: '加载中' }).then(() => {
setTimeout(() => {
this.searchDemandSupply({})
this.setState({ currentPage: 1 })
}, 1000);
})
}
// 新增我的需求
addDemandSupply() {
Taro.navigateTo({
url: '/pages/supplyDemandPublish/supplyDemandPublish'
})
}
titleChange(event) {
this.setState({ title: event })
}
// 修改开始日期
onStartDateChange = e => {
this.setState({
startDateSel: e.detail.value
})
}
// 修改结束日期
onEndDateChange = e => {
this.setState({
endDateSel: e.detail.value
})
}
// needsStateChange = e => {
// this.setState({
// needsStatesSelected: this.state.needsState[e.detail.value]
// })
// }
needsTypeChange = e => {
this.setState({
needsTypeSelected: this.state.needsType[e.detail.value]
})
}
needsStateChange = e => {
this.setState({
needsStateSelected: this.state.needsState[e.detail.value]
})
}
componentDidMount() {
this.getGetMyNeedsList({})
this.getGetMyNeedsList()
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
const myNeedsListArrayElement = this.allNeedsList.map((item, index) => {
return <View className='needs-box' key={index}>
<View className='industy-type box'>
<Text classname='title'>行业分类</Text>
<Text classname='content'>{item.sd_type}</Text>
</View>
<View className='needs-title box'>
<Text classname='title'>需求标题</Text>
<Text classname='content'>{item.sd_title}</Text>
</View>
<View className='needs-state box'>
<Text classname='title'>需求状态</Text>
<Text classname='content'>{item.state}</Text>
</View>
<View className='update-time box'>
<Text classname='title'>更新时间</Text>
<Text classname='content'>{item.update_date}</Text>
</View>
<View className='info-button-box'>
<View className='button' onClick={this.goToSupplyDemandPage.bind(this, item.sd_id)}>
<AtButton type='primary' size='small'>查看</AtButton>
</View>
</View>
</View>
})
return (
<View className='myNeeds'>
{/* 需求标题 */}
<View className='input-box'>
<AtInput
name='value'
title='需求标题:'
placeholder='需求标题·'
type='text'
value={this.state.title}
onChange={this.titleChange.bind(this)}
/>
</View>
{/* 开始和结束日期 */}
<View className='page-section'>
<View className='picker-box'>
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'>开始日期:</Text> <Text className='selected'>{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> <Text className='selected'>{this.state.endDateSel}</Text>
</View>
</View>
</Picker>
</View>
</View>
{/* 行业分类 */}
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.demandSupplyCate} onChange={this.demSupplyCateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'>行业分类:</Text> <Text className='selected'>{this.state.demandSupplyCateSelected.name}</Text>
</View>
</View>
</Picker>
</View>
</View>
{/* 需求类型 */}
<View className='page-section'>
<View>
<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> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
</View>
</View>
</Picker>
</View>
</View>
{/* 需求状态 */}
<View className='page-section'>
<View>
<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> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
</View>
</View>
</Picker>
</View>
</View>
<View className='button-box'>
<View className='button' onClick={this.onSearchButtonHandler.bind(this)}>
<AtButton type='primary' size='small'>
<AtIcon value='search' size='12' color='white'></AtIcon>
搜索</AtButton>
</View>
<View className='button' onClick={this.addDemandSupply.bind(this)}>
<AtButton type='primary' className='button-a' size='small'>
<AtIcon value='add' size='12' color='white'></AtIcon>
新增</AtButton>
</View>
</View>
<View className='total'>
<Text className='count'>{this.state.totalNeeds}</Text>
</View>
{/* 我的需求信息 */}
<View className='info-box'>
{myNeedsListArrayElement}
</View>
<View className='pagination-box'>
<AtPagination
total={this.state.totalDemandSupply}
pageSize={10}
current={this.state.currentPage}
onPageChange={this.state.paginationNav.bind(this)}
>
</AtPagination>
</View>
</View>
)
}
}
export default MyNeeds

View File

@ -0,0 +1,127 @@
$themeColor:#FF7142;
.myNeeds{
padding: 10px 20px;
font-size: 32rpx;
.require{
color:red;
line-height:100rpx;
}
.total{
text-align: right;
margin: 20px;
.count{
color:red;
}
}
.at-input__container{
color:black;
font-weight: bold;
.at-input__input{
font-weight: normal
}
}
.page-section{
border-bottom: 1Px solid #d6e4ef;
.picker{
// padding: 24rpx 0;
.selected{
display: inline-block;
margin-left: 20%;
font-size: 32rpx
}
.title-box{
.title{
//color: #333;
line-height:100rpx;
margin-right:16rpx;
width:172rpx;
font-size:32rpx;
vertical-align:middle;
text-align:left;
font-weight: bold;
}
}
}
}
.input-box{
display: flex;
border-bottom: 1Px solid #d6e4ef;
}
}
.picker-box{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
.picker-container{
flex:1
}
}
.button-box{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
margin: 40px 0;
padding: 0 120px;
.button{
flex:1;
text-align: center;
.at-button--primary{
background-color:$themeColor;
border:1PX solid $themeColor;
}
.button-a{
background-color:#5cb85c;
border:1PX solid #5cb85c;
}
}
}
.title{
text-align: center;
font-size: 35px;
}
.pagination-box{
margin: 50px 0;
}
.info-box{
font-size: 28px;
.needs-box{
margin-top: 10px;
border: 1px solid #ddd;
margin-bottom: 8px;
box-shadow: 0 8px 8px #ddd;
padding: 10px;
.box{
margin-top: 5px;
}
.info-button-box{
margin: 20px 0 0 0;
border-top: 1px solid #ddd;
.button{
// flex:1;
text-align: right;
margin:1% 1% 0;
.at-button--primary{
background-color:#FF9500;
border:1PX solid #FF9500;
}
}
}
}}

View File

@ -28,13 +28,13 @@ class MySupplyDemand extends Component {
isConfirmWindow: false, // 是否显示确认弹窗
demandSupplyItemName: '',// 确认框提示时 使用的供求名
demandSupplyId: '',// 删除我的供求时的供求id
totalDemandSupply:'',//所有供求
totalDemandSupply:0,//所有供求
currentPage:1 //当前页数
}
}
//获取我的供求API
//获取我的供求列表API
getMySupplyDemand({ curr_page = 1, page_count = 10 }) {
Taro.request({
url: URL.MySupplyDemand,
@ -56,7 +56,8 @@ class MySupplyDemand extends Component {
if (res.data.err_msg === "success") {
// 判断是否有res.data.supplys 如果没有就是空数组[]
Taro.hideLoading()
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: res.data.count })
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply:Number(res.data.count) })
}
})
@ -315,8 +316,6 @@ class MySupplyDemand extends Component {
{modalMessageConfirmElement}
{/* 供求类型 */}
<View className='page-section'>
<View>

View File

@ -88,8 +88,10 @@ $themeColor:#FF7142;
}
}
}
.info-box{
font-size: 30px;
.info-container{
border: 1px solid #ddd;
margin-bottom: 8px;

View File

@ -17,6 +17,8 @@ const URL = {
//所有业主供求
GetAllDemanding: LOCALURL + 'supply-allDemandList',// 获取所有业主需求
MySupplyDemand: LOCALURL + 'Supply-myList',// 我的供求
supplyDemandDetails: LOCALURL + 'supply-wxDemandDetail',// 单个供求详情
@ -47,8 +49,9 @@ const URL = {
// 商品编辑页面 Goods-wxEditPhoneDeploy
GetProductInfo: LOCALURL + 'Goods-wxEditPhoneDeploy',// 获取单个商品信息
//我的需求列表
GetMyNeedsList:LOCALURL+'Supply-userDemandList',// 获取我的需求列表
GetIndustryTypeList:LOCALURL+'shop-getIndustryClass'// 获取行业分类筛选列表
}