From 8d81766decf3cecca9dbc079aca85c59989a41aa Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Thu, 3 Jan 2019 17:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=9C=80=E6=B1=82=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.js | 1 + src/component/bottomNav/bottomNav.js | 12 +- src/pages/goods/goods.js | 68 ++-- src/pages/goods/goods.scss | 16 +- src/pages/goodsPublish/goodsPublish.js | 53 +++- src/pages/grabOrderPage/grabOrderPage.js | 62 +++- src/pages/grabOrderPage/grabOrderPage.scss | 5 + src/pages/home/home.js | 12 +- src/pages/index/index.js | 2 + src/pages/myGoodList/myGoodList.js | 97 +++++- src/pages/myGoodsEdit/myGoodsEdit.js | 24 +- src/pages/myNeeds/myNeeds.js | 308 +++++++++++++++++++ src/pages/myNeeds/myNeeds.scss | 127 ++++++++ src/pages/mySupplyDemand/mySupplyDemand.js | 9 +- src/pages/mySupplyDemand/mySupplyDemand.scss | 2 + src/serviceAPI.config.js | 7 +- 16 files changed, 713 insertions(+), 92 deletions(-) create mode 100644 src/pages/myNeeds/myNeeds.js create mode 100644 src/pages/myNeeds/myNeeds.scss diff --git a/src/app.js b/src/app.js index b9b33a2..622db56 100644 --- a/src/app.js +++ b/src/app.js @@ -31,6 +31,7 @@ class App extends Component { 'pages/myDemandSupplyEdit/myDemandSupplyEdit',// 我的供求编辑页面 'pages/supplyDemandView/supplyDemandView',// 查看单个供求页面 'pages/grabOrderPage/grabOrderPage',// 抢单页面 + 'pages/myNeeds/myNeeds',// 我的需求页面 // 'pages/shopDescription/shopDescription', ], window: { diff --git a/src/component/bottomNav/bottomNav.js b/src/component/bottomNav/bottomNav.js index b604d68..48a2789 100644 --- a/src/component/bottomNav/bottomNav.js +++ b/src/component/bottomNav/bottomNav.js @@ -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) => { diff --git a/src/pages/goods/goods.js b/src/pages/goods/goods.js index b27920a..11af96b 100644 --- a/src/pages/goods/goods.js +++ b/src/pages/goods/goods.js @@ -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 { {/* 详情和评论区 */} {/* 大类 */} - + @@ -277,15 +300,16 @@ class Goods extends Component { - + 收藏商品 - - 加入购物车 + + + + + + + 加入购物车 diff --git a/src/pages/goods/goods.scss b/src/pages/goods/goods.scss index 32d7782..1f6f741 100644 --- a/src/pages/goods/goods.scss +++ b/src/pages/goods/goods.scss @@ -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; + } } } } diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js index 20e8188..3185055 100644 --- a/src/pages/goodsPublish/goodsPublish.js +++ b/src/pages/goodsPublish/goodsPublish.js @@ -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.navigateTo({ - url: '/pages/goods/goods?id='+res.data.goods_id - }) - }, 1000); + 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 + }) + + } + 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', diff --git a/src/pages/grabOrderPage/grabOrderPage.js b/src/pages/grabOrderPage/grabOrderPage.js index ea27870..8438076 100644 --- a/src/pages/grabOrderPage/grabOrderPage.js +++ b/src/pages/grabOrderPage/grabOrderPage.js @@ -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 { 联系人: {this.state.contactName} - + 联系电话: {this.state.contactNumber} diff --git a/src/pages/grabOrderPage/grabOrderPage.scss b/src/pages/grabOrderPage/grabOrderPage.scss index 5ef7af1..9a07c19 100644 --- a/src/pages/grabOrderPage/grabOrderPage.scss +++ b/src/pages/grabOrderPage/grabOrderPage.scss @@ -7,6 +7,11 @@ .title{ font-weight: bold } + .phone-number{ + .content{ + color:#0579c6 + } + } } .button-box{ diff --git a/src/pages/home/home.js b/src/pages/home/home.js index 5fd4fcf..cdc81de 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -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 - + {item.class_name} diff --git a/src/pages/index/index.js b/src/pages/index/index.js index 18b7d28..2af43e8 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -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) { diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js index 6b20449..81140ca 100644 --- a/src/pages/myGoodList/myGoodList.js +++ b/src/pages/myGoodList/myGoodList.js @@ -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 @@ -437,7 +447,42 @@ class MyGoodList extends Component { url: '/pages/goods/goods?id='+goodId }) } - + + 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,11 +529,31 @@ class MyGoodList extends Component { {isTure ? : } }) + // 删除提示模态弹窗element + const modalMessageDeleteElement = + 提示 + + 确定要删除已选商品? + + + + // 下架提示模态弹窗element + const modalMessageOffStockElement = + 提示 + + 确定要下架已选商品? + + + return ( - + {/* 删除模态提示框 */} + {modalMessageDeleteElement} + {/* 下架模态框提示 */} + {modalMessageOffStockElement} + diff --git a/src/pages/myGoodsEdit/myGoodsEdit.js b/src/pages/myGoodsEdit/myGoodsEdit.js index 475f3d2..e2f154d 100644 --- a/src/pages/myGoodsEdit/myGoodsEdit.js +++ b/src/pages/myGoodsEdit/myGoodsEdit.js @@ -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() } diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js new file mode 100644 index 0000000..e98f141 --- /dev/null +++ b/src/pages/myNeeds/myNeeds.js @@ -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 + + 行业分类: + {item.sd_type} + + + + 需求标题: + {item.sd_title} + + + + 需求状态: + {item.state} + + + + 更新时间: + {item.update_date} + + + + + 查看 + + + + + }) + return ( + + {/* 需求标题 */} + + + + + {/* 开始和结束日期 */} + + + + + + 开始日期: {this.state.startDateSel} + + + + + + + + 结束日期: {this.state.endDateSel} + + + + + + + {/* 行业分类 */} + + + + + + + 行业分类: {this.state.demandSupplyCateSelected.name} + + + + + + {/* 需求类型 */} + + + + + + 需求类型: {this.state.needsTypeSelected.name} + + + + + + {/* 需求状态 */} + + + + + + + 需求状态: {this.state.needsStateSelected.name} + + + + + + + + + + + + + + 搜索 + + + + + 新增 + + + + 共{this.state.totalNeeds} 条记录 + + {/* 我的需求信息 */} + + {myNeedsListArrayElement} + + + + + + + + + + ) + } +} + +export default MyNeeds diff --git a/src/pages/myNeeds/myNeeds.scss b/src/pages/myNeeds/myNeeds.scss new file mode 100644 index 0000000..2602856 --- /dev/null +++ b/src/pages/myNeeds/myNeeds.scss @@ -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; + } + } + } + + +}} diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js index dedd263..7ec245c 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.js +++ b/src/pages/mySupplyDemand/mySupplyDemand.js @@ -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} - - {/* 供求类型 */} diff --git a/src/pages/mySupplyDemand/mySupplyDemand.scss b/src/pages/mySupplyDemand/mySupplyDemand.scss index e90ca1f..cebec17 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.scss +++ b/src/pages/mySupplyDemand/mySupplyDemand.scss @@ -88,8 +88,10 @@ $themeColor:#FF7142; } } } + .info-box{ font-size: 30px; + .info-container{ border: 1px solid #ddd; margin-bottom: 8px; diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js index 2bcfc0d..6f108f6 100644 --- a/src/serviceAPI.config.js +++ b/src/serviceAPI.config.js @@ -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'// 获取行业分类筛选列表 }