diff --git a/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js b/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js index e7b28a0..793ed60 100644 --- a/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js +++ b/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js @@ -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 { diff --git a/src/pages/allDemanding/allDemanding.js b/src/pages/allDemanding/allDemanding.js index e19c0ab..9b7fbba 100644 --- a/src/pages/allDemanding/allDemanding.js +++ b/src/pages/allDemanding/allDemanding.js @@ -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, @@ -98,9 +105,20 @@ 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 { - *供求状态: {this.state.demandingStateSelected.name} + 供求状态: {this.state.demandingStateSelected.name} @@ -277,14 +323,14 @@ class AllDemanding extends Component { - * + {/* 开始和结束日期选择 */} @@ -293,48 +339,50 @@ class AllDemanding extends Component { - *开始日期: {this.state.startDateSel} + 开始日期: {this.state.startDateSel} - *结束日期: {this.state.endDateSel} + 结束日期: {this.state.endDateSel} {/* 行业分类选择 */} - - - - - - *行业分类: {this.state.industryCateSelected} - - - - - - - + + + + + 搜索 + + + + + 清空 + {/* 供求页面的数据加载 */} {allDemandingElementArray} - + + + + + ) diff --git a/src/pages/allDemanding/allDemanding.scss b/src/pages/allDemanding/allDemanding.scss index 0f2cfef..702ea8a 100644 --- a/src/pages/allDemanding/allDemanding.scss +++ b/src/pages/allDemanding/allDemanding.scss @@ -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; +} \ No newline at end of file diff --git a/src/pages/index/index.js b/src/pages/index/index.js index f4f25dd..d4c031b 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -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' }) diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js index 928d9fe..4724a8a 100644 --- a/src/pages/myNeeds/myNeeds.js +++ b/src/pages/myNeeds/myNeeds.js @@ -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 }) }) diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js index 7ec245c..51d46cd 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.js +++ b/src/pages/mySupplyDemand/mySupplyDemand.js @@ -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,21 +233,21 @@ 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) { console.log(this.props, nextProps) } @@ -261,21 +274,21 @@ 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 + + return 需求类型: {item.type_name} 需求标题: - {item.sd_title} + {item.sd_title} 联系人: @@ -294,7 +307,7 @@ class MySupplyDemand extends Component { {item.update_date} - + 查看 @@ -360,7 +373,7 @@ class MySupplyDemand extends Component { - *开始日期: {this.state.startDateSel} + *开始日期: {this.state.startDateSel} @@ -368,7 +381,7 @@ class MySupplyDemand extends Component { - *结束日期: {this.state.endDateSel} + *结束日期: {this.state.endDateSel} @@ -387,6 +400,11 @@ class MySupplyDemand extends Component { 新增 + + + + 清空 + 一共{this.state.totalDemandSupply} 条记录 {/* 我的供求信息 */} @@ -394,15 +412,15 @@ class MySupplyDemand extends Component { {demandSupplyElementArray} - - + + - + diff --git a/src/pages/mySupplyDemand/mySupplyDemand.scss b/src/pages/mySupplyDemand/mySupplyDemand.scss index cebec17..1e54a07 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.scss +++ b/src/pages/mySupplyDemand/mySupplyDemand.scss @@ -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{ diff --git a/src/pages/supplyDemandPublish/supplyDemandPublish.js b/src/pages/supplyDemandPublish/supplyDemandPublish.js index 854c875..21f8c1a 100644 --- a/src/pages/supplyDemandPublish/supplyDemandPublish.js +++ b/src/pages/supplyDemandPublish/supplyDemandPublish.js @@ -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) diff --git a/src/pages/supplyDemandView/supplyDemandView.js b/src/pages/supplyDemandView/supplyDemandView.js index f021617..d8df34b 100644 --- a/src/pages/supplyDemandView/supplyDemandView.js +++ b/src/pages/supplyDemandView/supplyDemandView.js @@ -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,27 +69,88 @@ 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:'加载中'}) @@ -106,13 +169,21 @@ class SupplyDemandView extends Component { render() { const imageElementArray = this.state.images.map((item, index) => { return - }) + const deleteModalWindowElement = + 提示 + + 确认删除{this.state.needsItem.sd_title}? + + + return ( + {deleteModalWindowElement} 供求类型: {this.state.type} @@ -131,7 +202,7 @@ class SupplyDemandView extends Component { 联系电话: - {this.state.contactNumber} + {this.state.contactNumber} 联系地址: @@ -150,11 +221,11 @@ class SupplyDemandView extends Component { - + 新增 - + 修改 @@ -164,7 +235,7 @@ class SupplyDemandView extends Component { 我的供求 - + 删除 diff --git a/src/pages/supplyDemandView/supplyDemandView.scss b/src/pages/supplyDemandView/supplyDemandView.scss index 8896bfc..9c400cb 100644 --- a/src/pages/supplyDemandView/supplyDemandView.scss +++ b/src/pages/supplyDemandView/supplyDemandView.scss @@ -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 } \ No newline at end of file