From 9e1f708f739a95f46556ee792d28d901b4980130 Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Wed, 9 Jan 2019 17:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E4=B8=BB=E5=85=A8=E9=83=A8=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.scss | 5 + src/pages/allDemanding/allDemanding.js | 117 ++++++++--------------- src/pages/allDemanding/allDemanding.scss | 2 +- src/pages/index/index.js | 4 +- src/pages/shop/shop.js | 1 + src/todo list.txt | 1 - 6 files changed, 47 insertions(+), 83 deletions(-) diff --git a/src/app.scss b/src/app.scss index dd215cb..74b6d80 100644 --- a/src/app.scss +++ b/src/app.scss @@ -3,6 +3,11 @@ $themeColor: #FF7142; .orange{ color:#FF7142, } +.blur{ + color:#FF7142; + opacity: .65; + +} .orange-bg{ background-color:#FF7142, } diff --git a/src/pages/allDemanding/allDemanding.js b/src/pages/allDemanding/allDemanding.js index 9b7fbba..e9bdaaa 100644 --- a/src/pages/allDemanding/allDemanding.js +++ b/src/pages/allDemanding/allDemanding.js @@ -1,6 +1,6 @@ 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, AtPagination } from 'taro-ui' +import { AtInput, AtButton, Picker, AtIcon, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction, AtPagination } from 'taro-ui' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import InteractionComponent from '../../component/interactionComponent/interactionComponent' @@ -20,61 +20,23 @@ class AllDemanding extends Component { super(...arguments) this.state = { supplys: [], // 需求列表 - isMore: 'more', // 加载状态 demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择 demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态 industryTypeSelected: { name: '全部', id: '' },// 当前行业分类 title: '', startDateSel: '', endDateSel: '', - classId: '', isOpenedGrabModal: false, grabOrderId: '',//抢到订单的id isGrabOrderSuccess: false,// 是否显示轻提示 grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段 - totalDemandings:0, - currentPage:1 - + totalDemandings: 0, + currentPage: 1 + } } - //加载更多业主需求函数 - loadMoreDemanding( - { curr_page = 1, page_count = 20, - state = this.state.demandingStateSelected.id, - update_dateL = this.state.startDateSel, - update_dateU = this.state.endDateSel, - class_id = this.state.industryTypeSelected.id - } - ) { - Taro.request({ - url: URL.GetAllDemanding, - method: 'POST', - dataType: 'json', - data: { - param: JSON.stringify({ - curr_page: curr_page, - page_count: page_count, - state: state, - update_dateL: update_dateL, - update_dateU: update_dateU, - class_id: class_id - }), - }, - header: { - 'content-type': 'application/x-www-form-urlencoded', - 'X-Requested-With': 'XMLHttpRequest' - } - }) - .then(res => { - if (res.data.supplys.length) { - Taro.hideLoading() - this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isMore: 'more' }) - } else { - this.setState({ isMore: 'noMore' }) - } - }) - } + // 搜索业主需求函数 searchDemanding({ curr_page = 1, page_count = 10, sd_title = this.state.title, @@ -105,31 +67,24 @@ class AllDemanding extends Component { } }) .then(res => { - - Taro.hideLoading() - if(res.data.err_msg==='success'){ - const total=Number(res.data.count) - this.setState({ supplys: res.data.supplys ,totalDemandings:total}) - }else{ + Taro.hideLoading() + 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 + title: res.data.err_msg, + icon: 'none', + duration: 1500 }) } - + }) } - // 向上拉升延迟一秒加载数据 - handleLoadMore() { - this.setState({ isMore: 'loading' }) - setTimeout(() => { - currentPage += 1 - this.loadMoreDemanding({ curr_page: currentPage }) - }, 1000); - } + // 改变需求选项 changeDemandingState = e => { this.setState({ @@ -221,20 +176,21 @@ class AllDemanding extends Component { } // 翻页导航 - 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 - }) - }) - } + 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) @@ -290,13 +246,16 @@ class AllDemanding extends Component { {item.sd_title} {item.sd_desc} - - {item.state_name === '在用' ? '抢单' : '已抢单'} - + {item.state_name === '在用' ? + 抢单 + : + 已抢单 + + } - 没有数据 + {item.user_address} 更新日期:{item.update_date} diff --git a/src/pages/allDemanding/allDemanding.scss b/src/pages/allDemanding/allDemanding.scss index 702ea8a..547c395 100644 --- a/src/pages/allDemanding/allDemanding.scss +++ b/src/pages/allDemanding/allDemanding.scss @@ -75,7 +75,7 @@ $themeColor: #FF7142; } .button-b{ - + background-color:#d9534f; border:1PX solid #d9534f; } diff --git a/src/pages/index/index.js b/src/pages/index/index.js index d4c031b..ec83824 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -37,8 +37,8 @@ class Index extends Component { // url:'/pages/myNeeds/myNeeds', //url:'/pages/myNeedsPublish/myNeedsPublish' // url:'/pages/mySupplyDemand/mySupplyDemand' - // url:'/pages/home/home' - url:'/pages/allDemanding/allDemanding' + url:'/pages/home/home' + // url:'/pages/allDemanding/allDemanding' }) diff --git a/src/pages/shop/shop.js b/src/pages/shop/shop.js index 4930fce..eef30d4 100644 --- a/src/pages/shop/shop.js +++ b/src/pages/shop/shop.js @@ -142,6 +142,7 @@ class Shop extends Component { } //侧边筛选商品类型 if (data.goods_type) { + // console.log('数据',data.goods_type) let goodTypeArray = [] Object.keys(data.goods_type).forEach(key => { goodTypeArray.push({ id: data.goods_type[key].goods_type_id, name: data.goods_type[key].goods_type_ch_name, checked: false }) diff --git a/src/todo list.txt b/src/todo list.txt index 007b61f..51c5b10 100644 --- a/src/todo list.txt +++ b/src/todo list.txt @@ -34,4 +34,3 @@ bug: 商品编辑 增加图片后 图片顺序乱了 等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口 -// switch ---- shopTypeInteractionComp \ No newline at end of file