From 85e2a028adb3dbc6321c6282016353b42e0f1003 Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Wed, 9 Jan 2019 11:06:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=9C=80=E6=B1=82=20?= =?UTF-8?q?=E9=9C=80=E6=B1=82=E7=BC=96=E8=BE=91=EF=BC=8C=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=20=E9=9C=80=E6=B1=82=E5=8F=91=E5=B8=83=20=20?= =?UTF-8?q?--=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goodsTypeInteractionComp.js | 1 - .../interactionComponent.js | 16 ++-- .../shopTypeInteractionComp.js | 1 - src/pages/goodsPublish/goodsPublish.js | 12 +-- src/pages/myNeeds/myNeeds.js | 80 +++++++++++++------ src/pages/myNeeds/myNeeds.scss | 11 ++- src/pages/myNeedsEdit/myNeedsEdit.js | 24 ++++-- src/pages/myNeedsPublish/myNeedsPublish.js | 15 ++-- src/pages/myNeedsView/myNeedsView.js | 80 +++++++++---------- 9 files changed, 134 insertions(+), 106 deletions(-) diff --git a/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js b/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js index 397578b..08e3c8b 100644 --- a/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js +++ b/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js @@ -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 ( { - 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 diff --git a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js index 2a5a189..7e8c5f2 100644 --- a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js +++ b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js @@ -214,7 +214,6 @@ class ShopTypeInteractionComp extends Component { componentDidHide() { } render() { - console.log('tesst',this.state.objectMultiArray) return ( { 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 ( - - {/* 商品分类开始 */} diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js index bc351c7..928d9fe 100644 --- a/src/pages/myNeeds/myNeeds.js +++ b/src/pages/myNeeds/myNeeds.js @@ -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 行业分类: - {item.sd_type} + {item.class_name} 需求标题: - {item.sd_title} + {item.sd_title} 需求状态: @@ -262,7 +288,7 @@ class MyNeeds extends Component { 更新时间: {item.update_date} - {item.state === '1' ? + {item.state === '0'||item.state === '1' ? 查看 @@ -272,8 +298,7 @@ class MyNeeds extends Component { 删除 - : - + : 查看 @@ -368,6 +393,11 @@ class MyNeeds extends Component { 新增 + + + + 清空 + {this.state.totalNeeds} 条记录 diff --git a/src/pages/myNeeds/myNeeds.scss b/src/pages/myNeeds/myNeeds.scss index 22c62eb..98e9706 100644 --- a/src/pages/myNeeds/myNeeds.scss +++ b/src/pages/myNeeds/myNeeds.scss @@ -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; diff --git a/src/pages/myNeedsEdit/myNeedsEdit.js b/src/pages/myNeedsEdit/myNeedsEdit.js index 65b5cb6..5ee5f3a 100644 --- a/src/pages/myNeedsEdit/myNeedsEdit.js +++ b/src/pages/myNeedsEdit/myNeedsEdit.js @@ -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 { {/* 需求类型 */} - + *需求类型: {this.state.needsTypeSelected.name} @@ -380,7 +388,7 @@ class MyNeedsEdit extends Component { - + *状态: {this.state.needsStateSelected.name} diff --git a/src/pages/myNeedsPublish/myNeedsPublish.js b/src/pages/myNeedsPublish/myNeedsPublish.js index a98819d..7b5c9aa 100644 --- a/src/pages/myNeedsPublish/myNeedsPublish.js +++ b/src/pages/myNeedsPublish/myNeedsPublish.js @@ -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 ( diff --git a/src/pages/myNeedsView/myNeedsView.js b/src/pages/myNeedsView/myNeedsView.js index cda47bb..6ab667c 100644 --- a/src/pages/myNeedsView/myNeedsView.js +++ b/src/pages/myNeedsView/myNeedsView.js @@ -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= - 提示 - - 确认删除{this.state.needsItem.sd_title}? + const deleteModalWindowElement = + 提示 + + 确认删除{this.state.needsItem.sd_title}? - - - const imageArrayElement=this.state.ImagesInfo.map((item,index)=>{ - return - }) - + + + const imageArrayElement = this.state.ImagesInfo.map((item, index) => { + return + }) + return ( - {/* 删除模态框 */} - {deleteModalWindowElement} + {/* 删除模态框 */} + {deleteModalWindowElement} 行业分类: - {this.state.industryTypeSelected.name} + {this.state.industryTypeSelected.name?this.state.industryTypeSelected.name:'--'} 需求标题: @@ -235,13 +235,13 @@ class SupplyDemandView extends Component { 业主需求内容: {this.state.content} - + {this.state.ImagesInfo.length? 业主需求图片: - {imageArrayElement} + {imageArrayElement} - - + :null +} @@ -259,7 +259,7 @@ class SupplyDemandView extends Component { 修改 - +