diff --git a/package.json b/package.json index 74b7817..f3389e1 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@tarojs/taro-h5": "^1.2.0-beta.3", "@tarojs/taro-swan": "^1.2.0-beta.3", "@tarojs/taro-weapp": "^1.2.0-beta.3", + "@tarojs/webpack-runner": "^1.2.8", "nerv-devtools": "^1.3.9", "nervjs": "^1.3.9", "redux": "^4.0.0", diff --git a/src/app.js b/src/app.js index a66ee7d..5a3962b 100644 --- a/src/app.js +++ b/src/app.js @@ -1,7 +1,7 @@ import '@tarojs/async-await' import Taro, { Component } from '@tarojs/taro' import { Provider } from '@tarojs/redux' -import Index from './pages/index' +import Home from './pages/home' import configStore from './store' import './app.scss' @@ -18,7 +18,7 @@ class App extends Component { config = { pages: [ - 'pages/index/index', // index页面 + //'pages/index/index', // index页面 'pages/home/home',//首页 --------------------- 'pages/shop/shop',//店铺页面 --------------------- 'pages/goods/goods',// 商品页面 --------------------- @@ -42,10 +42,46 @@ class App extends Component { navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', navigationBarTextStyle: 'black', - // enablePullDownRefresh:true - onReachBottomDistance: 0 + // enablePullDownRefresh:true + onReachBottomDistance: 0 + }, + + tabBar: { + list: [{ + pagePath: "pages/home/home", + text: "首页", + iconPath: "./icons/home.png", + selectedIconPath: "./icons/home-actived.png" + }, { + pagePath: "pages/goodsPublish/goodsPublish", + text: "商品发布", + iconPath: "./icons/box.png", + selectedIconPath: "./icons/box-actived.png" + }, { + pagePath: "pages/supplyDemandPublish/supplyDemandPublish", + text: "供求发布", + iconPath: "./icons/publish.png", + selectedIconPath: "./icons/publish-actived.png" + } + , { + pagePath: "pages/mySupplyDemand/mySupplyDemand", + text: "我的供求", + iconPath: "./icons/menu.png", + selectedIconPath: "./icons/menu-actived.png" + } + , { + pagePath: "pages/myNeeds/myNeeds", + text: "我的需求", + iconPath: "./icons/user.png", + selectedIconPath: "./icons/user-actived.png" + } + ], + color: '#333', + selectedColor: '#333', + backgroundColor: '#fff', + borderStyle: '#ccc' } - , + } @@ -64,7 +100,7 @@ class App extends Component { render() { return ( - + ) } diff --git a/src/app.scss b/src/app.scss index 8fab76f..9551879 100644 --- a/src/app.scss +++ b/src/app.scss @@ -55,7 +55,7 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7); .button-no-margin{ margin:10px 0 } -.no_more_title{ +.no-more-title{ text-align: center; font-size: 25rpx; diff --git a/src/component/scrollToTopComponent/scrollToTopComponent.scss b/src/component/scrollToTopComponent/scrollToTopComponent.scss index 238460d..de817d3 100644 --- a/src/component/scrollToTopComponent/scrollToTopComponent.scss +++ b/src/component/scrollToTopComponent/scrollToTopComponent.scss @@ -6,7 +6,7 @@ border-radius:50%; text-align:center; position:fixed; - bottom:10%; + bottom:3%; right:5%; font-size:25rpx; .box{ diff --git a/src/icons/box-actived.png b/src/icons/box-actived.png new file mode 100644 index 0000000..0b56bbc Binary files /dev/null and b/src/icons/box-actived.png differ diff --git a/src/icons/box.png b/src/icons/box.png new file mode 100644 index 0000000..a9fe862 Binary files /dev/null and b/src/icons/box.png differ diff --git a/src/icons/home-actived.png b/src/icons/home-actived.png new file mode 100644 index 0000000..7324174 Binary files /dev/null and b/src/icons/home-actived.png differ diff --git a/src/icons/home.png b/src/icons/home.png new file mode 100644 index 0000000..92e23d9 Binary files /dev/null and b/src/icons/home.png differ diff --git a/src/icons/menu-actived.png b/src/icons/menu-actived.png new file mode 100644 index 0000000..8433eae Binary files /dev/null and b/src/icons/menu-actived.png differ diff --git a/src/icons/menu.png b/src/icons/menu.png new file mode 100644 index 0000000..b868396 Binary files /dev/null and b/src/icons/menu.png differ diff --git a/src/icons/publish-actived.png b/src/icons/publish-actived.png new file mode 100644 index 0000000..ae7574d Binary files /dev/null and b/src/icons/publish-actived.png differ diff --git a/src/icons/publish.png b/src/icons/publish.png new file mode 100644 index 0000000..d13163f Binary files /dev/null and b/src/icons/publish.png differ diff --git a/src/icons/setting-actived.png b/src/icons/setting-actived.png new file mode 100644 index 0000000..8c03a77 Binary files /dev/null and b/src/icons/setting-actived.png differ diff --git a/src/icons/setting.png b/src/icons/setting.png new file mode 100644 index 0000000..34a5b5c Binary files /dev/null and b/src/icons/setting.png differ diff --git a/src/icons/user-actived.png b/src/icons/user-actived.png new file mode 100644 index 0000000..08da33b Binary files /dev/null and b/src/icons/user-actived.png differ diff --git a/src/icons/user.png b/src/icons/user.png new file mode 100644 index 0000000..ef18f7c Binary files /dev/null and b/src/icons/user.png differ diff --git a/src/pages/allDemanding/allDemanding.js b/src/pages/allDemanding/allDemanding.js index 5f3440d..9944131 100644 --- a/src/pages/allDemanding/allDemanding.js +++ b/src/pages/allDemanding/allDemanding.js @@ -191,23 +191,12 @@ class AllDemanding extends Component { this.setState({ industryTypeSelected: value }) } - // 翻页导航 - paginationNav(type) { - Taro.showLoading({ - title: '加载中' + goToGrabOrderPage(orderId) { + Taro.navigateTo({ + + url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId }) - 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) @@ -277,7 +266,7 @@ class AllDemanding extends Component { - + @@ -298,7 +287,7 @@ class AllDemanding extends Component { - }) : 没有更多了 + }) : 没有更多了 return ( {/* 模态框 */} diff --git a/src/pages/allDemanding/allDemanding.scss b/src/pages/allDemanding/allDemanding.scss index ca1c551..954d087 100644 --- a/src/pages/allDemanding/allDemanding.scss +++ b/src/pages/allDemanding/allDemanding.scss @@ -110,7 +110,6 @@ $themeColor: #FF7142; .watch{ padding-left: 10px; } - } } .body{ diff --git a/src/pages/grabOrderPage/grabOrderPage.js b/src/pages/grabOrderPage/grabOrderPage.js index d0f35c7..b1a7206 100644 --- a/src/pages/grabOrderPage/grabOrderPage.js +++ b/src/pages/grabOrderPage/grabOrderPage.js @@ -1,6 +1,6 @@ //grabOrderPage import Taro, { Component } from '@tarojs/taro' -import { View, Text, Button } from '@tarojs/components' +import { View, Text, Button, Image } from '@tarojs/components' import { AtModal, AtModalHeader, AtModalContent, AtModalAction, AtIcon } from 'taro-ui' import URL from '../../serviceAPI.config' @@ -9,6 +9,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp import './grabOrderPage.scss' +import { SymbolDef } from '_terser@3.14.1@terser'; class GrabOrderPage extends Component { @@ -25,10 +26,12 @@ class GrabOrderPage extends Component { contactNumber: '', address: '', content: '', + images: [], isOpen: false, // 抢单消息提示 grabOrderId: this.$router.params.orderId, - stateId:'', - stateName:'' + stateId: '', + stateName: '', + userId: '' } } @@ -50,15 +53,17 @@ class GrabOrderPage extends Component { .then(res => { console.log('抢单详情获取成功', res) this.setState({ - type: res.data.sdInfo.sd_type, + type: res.data.sdInfo.class_name, 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, - stateId:res.data.sdInfo.state, - stateName:res.data.sdInfo.state_name, + images: res.data.sdInfo.file_path, + stateId: res.data.sdInfo.state, + stateName: res.data.sdInfo.state_name, + userId: res.data.sdInfo.user_id }) } @@ -144,7 +149,64 @@ class GrabOrderPage extends Component { componentDidHide() { } render() { - + const localStoageUserId = Taro.getStorageSync('userInfo').user_id + + + let ButtonElement + if (localStoageUserId === this.state.userId && this.state.stateId === '1') { + ButtonElement = + + + + + + + + + + + + + + + } else if (localStoageUserId === this.state.userId && this.state.stateId != '1') { + ButtonElement = + + + + + + + + } else if (this.state.stateId === '1') { + ButtonElement = + + + + } else if (this.state.stateId === '2') { + ButtonElement = + + + } else if (this.state.stateId === '3') { + ButtonElement = + + + } + + + // 提示模态弹窗element const modalMessageGrabElement = 提示 @@ -153,6 +215,11 @@ class GrabOrderPage extends Component { + const imageElementArray = this.state.images.map((item, index) => { + return + + + }) return ( @@ -185,20 +252,13 @@ class GrabOrderPage extends Component { 业主需求内容: {this.state.content} - - {/* - - */} - {this.state.stateId === '1' ? - - : null || this.state.stateId === '2' ? - - : null || this.state.stateId === '3' ? - - : null} - + + {this.state.images.length ? 业主需求图片: : null} + {imageElementArray} + + {ButtonElement} + + diff --git a/src/pages/grabOrderPage/grabOrderPage.scss b/src/pages/grabOrderPage/grabOrderPage.scss index ee693b8..499f07a 100644 --- a/src/pages/grabOrderPage/grabOrderPage.scss +++ b/src/pages/grabOrderPage/grabOrderPage.scss @@ -12,15 +12,27 @@ color:#0579c6 } } + .image-wrapper{ + border: 4rpx solid #ddd; + margin-top: 10px + } } +.button-box{ + display: flex; + flex-wrap: nowrap; + flex-direction: row; + margin: 40px 0 0; + justify-content: space-around; + + .button{ - margin-top: 20%; - text-align: center; - // margin:2%; - // justify-content:center; - + text-align: center; + .button-orange,.button-green,.button-dark-red{ + font-size: 27rpx + } } +} \ No newline at end of file diff --git a/src/pages/home/home.js b/src/pages/home/home.js index 23dff9f..81e0a08 100644 --- a/src/pages/home/home.js +++ b/src/pages/home/home.js @@ -14,7 +14,8 @@ import './home.scss' class Home extends Component { config = { - navigationBarTitleText: '首页' + navigationBarTitleText: '首页', + } constructor() { @@ -66,7 +67,7 @@ class Home extends Component { Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone }) this.setState({ ads: res.data.data.adsLb, - categories: [res.data.data.supplyClass[0],Object.values(res.data.data.supplyClass[1])], + categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])], demanding: res.data.data.demand.supplys, otherData: res.data.otherData, userName: res.data.otherData.userName, @@ -104,7 +105,7 @@ class Home extends Component { } }) .then(res => { - console.log('所有店铺的信息', res) + console.log('所有店铺的信息', res) Taro.hideLoading() if (res.data.err_msg === 'success') { if (this.state.isAddToList) { @@ -132,9 +133,10 @@ class Home extends Component { } ) } - + // 异步函数登入api async login() { + Taro.login({ success(res) { if (res.code) { @@ -153,22 +155,18 @@ class Home extends Component { }) .then(response => { if (response.data.err_msg === 'success') { + console.log('微信登入成功', response) - // Taro.showToast({ - // title:'登入成功', - // icon:'success', - // duration:1500 - // }) - //储存后台返回的session_id 到local Storage + Taro.setStorageSync('session_id', response.data.session_id) Taro.setStorageSync('shopInfo', response.data.shop_info) Taro.setStorageSync('userInfo', response.data.user_info) - + } else { Taro.showToast({ title: '登入失败' + response.data.err_msg, icon: 'none', - duration: 1500 + duration: 2000 }) } @@ -176,6 +174,8 @@ class Home extends Component { ).catch(err => { console.log('登入微信失败', err) + }).then(()=>{ + }) } else { @@ -303,14 +303,24 @@ class Home extends Component { }) } + + componentDidMount() { // 页面加载后 得到首页的基本信息和推荐店铺的信息 - Taro.showLoading({ title: '加载中' }) - - this.login().then(() => { + (async ()=>{ + Taro.showLoading({ title: '加载中' }) + await this.login() this.getShops({}) this.getHomeCategoriesInfo() - }).catch(err => console.log('微信登入失败:', err)) + })() + + + + + // this.login().then(() => { + // this.getShops({}) + // this.getHomeCategoriesInfo() + // }).catch(err => console.log('微信登入失败:', err)) } @@ -411,7 +421,7 @@ class Home extends Component { {item.class_name} }) : null - + const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => { return - }) : 没有更多了 + }) : 没有更多了 const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => { return {item.class_name} @@ -552,7 +562,7 @@ class Home extends Component { - + {/* */} diff --git a/src/pages/home/home.scss b/src/pages/home/home.scss index 7486f7b..149b9f3 100644 --- a/src/pages/home/home.scss +++ b/src/pages/home/home.scss @@ -6,11 +6,8 @@ $themeColor: #FF7142; height: 100%; width: 100%; } - } - } - .modalBox{ .at-modal-footer--simple{ .at-modal-action{ @@ -43,9 +40,8 @@ $themeColor: #FF7142; vertical-align: middle; } .more-link{ - // float: right; margin-left: 50%; - font-size: 30px; + font-size: 25px; color: #ccc; vertical-align: middle; } diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js index 518210e..4349a83 100644 --- a/src/pages/myGoodList/myGoodList.js +++ b/src/pages/myGoodList/myGoodList.js @@ -22,7 +22,8 @@ class MyGoodList extends Component { heightestPrice: '', minimumSold: '', maximumSold: '', - productId: '', + order: '',// 商品列表排序参数 + productId: '',// 商品编号参数 productCate: [], //宝贝类目 productCateSelected: { id: '', name: '全部类目' },// 已选宝贝类目 filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项 @@ -37,7 +38,7 @@ class MyGoodList extends Component { myGoodList: [],// 保存后台返回的商品列表 myGoodListTotal: '0',// 后台的商品总数 goodsStateParam: 1,//商品状态参数 - pageCountParam: 10,// 商品数量参数 + pageCountParam: 20,// 商品数量参数 currPageParam: 1,// 当前页面 参数 isCheckAll: false,// 是否checked goodsIdList: [],//商品Id 列表 @@ -108,17 +109,16 @@ class MyGoodList extends Component { // 获取我的商品列表接口api getMyGoodListApi({ goodsName = this.state.productName, - goodsSn = '', + goodsSn = this.state.productId, goodsClass = this.state.productCateSelected.id, goodsPriceL = this.state.lowestPrice, goodsPriceU = this.state.heightestPrice, goodsSalesL = this.state.minimumSold, goodsSalesU = this.state.maximumSold, - shopClassID = this.state.productId, goodsState = this.state.goodsStateParam, pageCount = this.state.pageCountParam, currPage = this.state.currPageParam, - order = '', + order = this.state.order, }) { Taro.request({ url: URL.MyGoodList, @@ -132,7 +132,6 @@ class MyGoodList extends Component { goodsPriceU: goodsPriceU, goodsSalesL: goodsSalesL, goodsSalesU: goodsSalesU, - shopClassID: shopClassID, goodsState: goodsState, pageCount: pageCount, currPage: currPage, @@ -329,7 +328,7 @@ class MyGoodList extends Component { Taro.showLoading({ title: '加载中', }) - this.setState({ currPageParam: 1, isCheckAll: false,loadMorePageIndex:1 }, () => { + this.setState({ currPageParam: 1, isCheckAll: false,order:'' }, () => { this.getMyGoodListApi({}) }) } @@ -339,7 +338,6 @@ class MyGoodList extends Component { emptyButtonHanlder() { this.setState({ isCheckAll: false, - loadMorePageIndex:1, currPageParam: 1, productName: '', lowestPrice: '', @@ -348,6 +346,7 @@ class MyGoodList extends Component { maximumSold: '', productId: '', productCateSelected: { id: '', name: '全部类目' }, + order:'', }, () => { this.getMyGoodListApi({}) Taro.showToast({ @@ -370,10 +369,15 @@ class MyGoodList extends Component { filterSold: false, filterPublishDate: false, } - } - ) - this.state.filterOptions.filterPrice ? this.getMyGoodListApi({ order: "goods_price desc" }) : this.getMyGoodListApi({ order: "goods_price" }) + }, () => { + this.state.filterOptions.filterPrice ? this.setState({ order: "goods_price" }, () => { + this.getMyGoodListApi({}) + }) : this.setState({ order: "goods_price desc" }, () => { + this.getMyGoodListApi({}) + }) + + }) } if (value == 1) { this.setState({ @@ -385,7 +389,11 @@ class MyGoodList extends Component { filterPublishDate: false, } }, () => { - this.state.filterOptions.filterStock ? this.getMyGoodListApi({ order: "goods_stock desc" }) : this.getMyGoodListApi({ order: "goods_stock" }) + this.state.filterOptions.filterStock ? this.setState({ order: "goods_stock" }, () => { + this.getMyGoodListApi({}) + }) : this.setState({ order: "goods_stock desc" }, () => { + this.getMyGoodListApi({}) + }) } ) } @@ -400,11 +408,14 @@ class MyGoodList extends Component { } }, () => { - this.state.filterOptions.filterSold ? this.getMyGoodListApi({ order: "sales_volume desc" }) : this.getMyGoodListApi({ order: "sales_volume" }) + this.state.filterOptions.filterSold ? this.setState({ order: "sales_volume " }, () => { + this.getMyGoodListApi({}) + }) : this.setState({ order: "sales_volume desc" }, () => { + this.getMyGoodListApi({}) + }) } ) - } if (value == 3) { this.setState({ @@ -417,7 +428,11 @@ class MyGoodList extends Component { } }, () => { - this.state.filterOptions.filterPublishDate ? this.getMyGoodListApi({ order: "update_date desc" }) : this.getMyGoodListApi({ order: "update_date" }) + this.state.filterOptions.filterPublishDate ? this.setState({ order: "update_date desc" }, () => { + this.getMyGoodListApi({}) + }) : this.setState({ order: "update_date" }, () => { + this.getMyGoodListApi({}) + }) } ) } @@ -581,8 +596,8 @@ class MyGoodList extends Component { Taro.showLoading({ title: '加载中' }) - this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => { - this.getMyGoodListApi({ currPage: this.state.loadMorePageIndex }) + this.setState({ isAddToList: true, currPageParam: this.state.currPageParam + 1 }, () => { + this.getMyGoodListApi({}) }) diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js index bc369f6..b4a2850 100644 --- a/src/pages/myNeeds/myNeeds.js +++ b/src/pages/myNeeds/myNeeds.js @@ -243,10 +243,11 @@ class MyNeeds extends Component { needsStateSelected: this.state.needsState[e.detail.value] }) } - goToMyNeedsViewPage(id) { - Taro.navigateTo({ - url: '/pages/myNeedsView/myNeedsView?id=' + id - }) + goToMyNeedsViewPage(Id) { + Taro.navigateTo({ + url: '/pages/grabOrderPage/grabOrderPage?orderId=' + Id + }) + } goToMyNeedsEditPage(id) { Taro.navigateTo({ @@ -446,7 +447,7 @@ class MyNeeds extends Component { {/* 我的需求信息 */} { - {this.state.allNeedsList.length?myNeedsListArrayElement:没有更多了} + {this.state.allNeedsList.length?myNeedsListArrayElement:没有更多了} } {this.state.isShowTopNav ? : null} diff --git a/src/pages/myNeedsView/myNeedsView.js b/src/pages/myNeedsView/myNeedsView.js index 1a87e72..2473925 100644 --- a/src/pages/myNeedsView/myNeedsView.js +++ b/src/pages/myNeedsView/myNeedsView.js @@ -18,7 +18,6 @@ class SupplyDemandView extends Component { constructor() { super(...arguments) this.state = { - industryTypeSelected: '', needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }], needsTypeSelected: { name: '业主需求', id: '4' }, @@ -35,14 +34,15 @@ class SupplyDemandView extends Component { contactAddress: '', content: '',//描述 pickerImageUrl: [], - ImagesInfo: '', + ImagesInfo: [], isShowAllButtons:true// 是否显示所有按钮 } } //获取需求信息api getSingleMyNeedInfo() { Taro.request({ - url: URL.EditMyNeeds, + // url: URL.EditMyNeeds, + url: URL.supplyDemandDetails, method: 'GET', dataType: 'json', data: { @@ -79,13 +79,13 @@ class SupplyDemandView extends Component { } } - const needsType = this.state.needsType.filter(item => { - return item.id === res.data.sdInfo.sd_type - })[0] - const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } }) - const needsState = this.state.needsState.filter(item => { - return item.id === res.data.sdInfo.state - })[0] + // const needsType = this.state.needsType.filter(item => { + // return item.id === res.data.sdInfo.sd_type + // })[0] + // const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } }) + // const needsState = this.state.needsState.filter(item => { + // return item.id === res.data.sdInfo.state + // })[0] this.setState({ sd_id: res.data.sdInfo.sd_id, industryTypeSelected: industryType, @@ -212,9 +212,15 @@ class SupplyDemandView extends Component { - const imageArrayElement = this.state.ImagesInfo.map((item, index) => { - return - }) + // const imageArrayElement = this.state.ImagesInfo.map((item, index) => { + // return + // }) + const imageArrayElement=this.state.ImagesInfo.map((item, index) => { + return + + + }) + return ( @@ -248,13 +254,21 @@ class SupplyDemandView extends Component { 业主需求内容: {this.state.content} - {this.state.ImagesInfo.length? + + {this.state.ImagesInfo.length?业主需求图片::null} + {imageArrayElement} + + + + + + {/* {this.state.ImagesInfo.length? 业主需求图片: {imageArrayElement} :null -} +} */} {this.state.isShowAllButtons? diff --git a/src/pages/myNeedsView/myNeedsView.scss b/src/pages/myNeedsView/myNeedsView.scss index bd465af..33d7c19 100644 --- a/src/pages/myNeedsView/myNeedsView.scss +++ b/src/pages/myNeedsView/myNeedsView.scss @@ -27,9 +27,7 @@ $themeColor:#FF7142; } } } -.img-box{ - padding:20px; - .image{ - font-size: 0px - } +.image-wrapper{ + border: 4rpx solid #ddd; + margin-top: 10px } diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js index 40ef8ab..09c95a1 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.js +++ b/src/pages/mySupplyDemand/mySupplyDemand.js @@ -340,7 +340,7 @@ class MySupplyDemand extends Component { - }) : + }) : 没有更多了.... return ( diff --git a/src/pages/mySupplyDemand/mySupplyDemand.scss b/src/pages/mySupplyDemand/mySupplyDemand.scss index 8a2d8a1..e05c612 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.scss +++ b/src/pages/mySupplyDemand/mySupplyDemand.scss @@ -95,7 +95,7 @@ $themeColor:#FF7142; border: 3rpx solid #ddd; margin-bottom: 8px; box-shadow: 0 8px 8px #ddd; - padding: 10px; + padding: 10px 10px 0; View{ margin-top: 5px; } @@ -108,12 +108,11 @@ $themeColor:#FF7142; flex-wrap: nowrap; justify-content:flex-end; margin: 20px 0 0 0; - padding: 0 20px; + border-top: 1px solid #ddd; .button{ - // flex:1; text-align: center; - margin:1% 1% 0; + margin:0 1% 0; .button-orange,.button-green,.button-dark-red{ font-size: 27rpx } diff --git a/src/pages/shop/shop.js b/src/pages/shop/shop.js index 5f029b4..a7df7b8 100644 --- a/src/pages/shop/shop.js +++ b/src/pages/shop/shop.js @@ -9,10 +9,10 @@ import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToT import './shop.scss' import ShopItem from '../../component/shopItemComponent/shopItemComponent' -import BottomNav from '../../component/bottomNav/bottomNav' +//import BottomNav from '../../component/bottomNav/bottomNav' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' -const locationIcon=require('../../assets/img/location.png') +const locationIcon = require('../../assets/img/location.png') class Shop extends Component { // 项目配置 @@ -47,7 +47,6 @@ class Shop extends Component { popularity: false, }, filterCondition: '',// 筛选条件 - mainType: [],// 侧边筛选分类 goodType: [],//侧边商品类型 otherType: [],//侧边其他类型 @@ -66,13 +65,15 @@ class Shop extends Component { shop_class_id: '', order: '', goods_class_id: '', + class_filter: '', + goods_type: '', goodsSpec: [], goodsParam: [], goodsParamExt: [], // 地图的经度和维度 longitude: '', latitude: '', - + } } @@ -117,13 +118,18 @@ class Shop extends Component { console.log('筛选项目成功', res) Taro.hideLoading() this.formatFilterData(res.data).then(data => { + console.log('data', data) + this.setState({ sideFilterdata: data, - mainType: data.mainType || [], - goodType: data.goodType || [], - otherType: data.otherType || [], - widthType: data.widthType || [], + mainType: data.mainType, + goodType: data.goodType, + otherType: data.otherType, + widthType: data.widthType, }) + + + console.log('formated data', data) }) } else { @@ -140,10 +146,26 @@ class Shop extends Component { //侧边筛选分类 if (data.goods_class) { let typeArray = [] - data.goods_class.forEach(item => { - typeArray.push({ id: item.class_id, name: item.class_name, checked: false }) - }); + // 如果后台返回的筛选项有和checkedFilterIdList重叠的 就不显示. + if (this.state.checkedFilterIdList.length) { + data.goods_class.forEach(item => { + this.state.checkedFilterIdList.forEach((checkedItem) => { + if (checkedItem.id !== item.class_id) { + typeArray.push({ id: item.class_id, name: item.class_name, checked: false }) + } + }) + }); + } else { + data.goods_class.forEach(item => { + typeArray.push({ id: item.class_id, name: item.class_name, checked: false }) + } + ) + } + + formatedFilterOptions.mainType = typeArray + } else { + formatedFilterOptions.mainType = [] } //侧边筛选商品类型 if (data.goods_type) { @@ -159,6 +181,9 @@ class Shop extends Component { } }); formatedFilterOptions.goodType = goodTypeArray + } else { + formatedFilterOptions.goodType = [] + } //侧边筛选其他类型 if (data.goodsParam) { @@ -177,6 +202,10 @@ class Shop extends Component { }); formatedFilterOptions.otherType = goodsParamArray } + else { + formatedFilterOptions.otherType = [] + + } //侧边筛选宽度类型 if (data.goodsParamExt) { let goodsParamExtArray = [] @@ -192,6 +221,8 @@ class Shop extends Component { }); formatedFilterOptions.widthType = goodsParamExtArray + } else { + formatedFilterOptions.widthType = [] } return formatedFilterOptions @@ -234,7 +265,10 @@ class Shop extends Component { goodsParamExt: JSON.stringify(goodsParamExt), }, header: { + // 'content-type': 'application/x-www-form-urlencoded', + // 'X-Requested-With': 'XMLHttpRequest' 'content-type': 'application/x-www-form-urlencoded', + 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'X-Requested-With': 'XMLHttpRequest' } }) @@ -502,7 +536,8 @@ class Shop extends Component { Taro.showLoading({ title: '加载中' }) this.setState({ - checkedFilterIdList: [], curr_page: 1, + checkedFilterIdList: [], + curr_page: 1, page_count: 10, shop_name: false, config_id: 4, @@ -510,6 +545,8 @@ class Shop extends Component { order: '', curr_page: 1, goods_class_id: '', + class_filter: '', + goods_type: '', goodsSpec: [], goodsParam: [], goodsParamExt: [], @@ -520,7 +557,14 @@ class Shop extends Component { } + openNavMap() { + Taro.openLocation({ + latitude: Number(this.state.latitude), + longitude: Number(this.state.longitude), + name: this.state.shopAddress, + }) + } componentDidMount() { Taro.showLoading({ title: '加载中' }) //页面加载之后 得到指定店铺的商品 和 筛选标签 @@ -552,7 +596,7 @@ class Shop extends Component { } } render() { - + const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => { return @@ -572,9 +616,9 @@ class Shop extends Component { // 侧边已选项 const checkedFilterElementsArray = this.state.checkedFilterIdList.map((item, index) => { return {item.name} }) @@ -584,19 +628,19 @@ class Shop extends Component { // 侧边筛选的分类项 const goodsClassElementsArray = this.state.mainType.map((item, index) => { return {item.name} }) // 侧边筛选的商品类型项 const goodsTypeElementsArray = this.state.goodType.map((item, index) => { return {item.name} }) @@ -610,10 +654,10 @@ class Shop extends Component { let isCheck = subItem.checked return {name} })} @@ -623,10 +667,10 @@ class Shop extends Component { // 侧边筛选宽度选项 const widthnessElementsArray = this.state.widthType.map((item, index) => { return {item.name} }) // 店铺页面/店铺主页 @@ -666,7 +710,7 @@ class Shop extends Component { {/* 店铺的商品列表 */} - {this.state.shopItem.length ? ShopItemElementsArray : 没有更多了} + {this.state.shopItem.length ? ShopItemElementsArray : 没有更多了} @@ -705,26 +749,30 @@ class Shop extends Component { */} {/* location.png */} + + + + {/* - - - - + + + + 店铺全部分类 @@ -786,7 +834,7 @@ class Shop extends Component { - + {/* */} ) diff --git a/src/pages/shop/shop.scss b/src/pages/shop/shop.scss index 9fd52cd..4577439 100644 --- a/src/pages/shop/shop.scss +++ b/src/pages/shop/shop.scss @@ -152,7 +152,7 @@ height:60rpx; padding:10px; } - .no_more_title{ + .no-more-title{ width:100%; margin-top:20%; diff --git a/src/todo list.txt b/src/todo list.txt index 6019384..204af61 100644 --- a/src/todo list.txt +++ b/src/todo list.txt @@ -20,236 +20,51 @@ bug: 商品编辑 增加图片后 图片顺序乱了 -// api -商品列表 --价格排序 --库存排序 --总销量 --发布时间 - - - -import Taro, { Component } from '@tarojs/taro' -import { View, Text } from '@tarojs/components' - -import { Picker } from 'taro-ui' - -import './interactionComponent.scss' - -class Interaction extends Component { - - config = { - navigationBarTitleText: 'interactionComponent' - } - constructor() { - super(...arguments); - - this.state = { - ///---行业分类 开始 - objectMultiArray: '', - multiIndex: [0, 0], - formatInWindow: [], - ///---行业分类 结束 - - } - - } - // 行业分类筛选列表GetIndustryTypeList - getIndustryTypeList(url) { - Taro.request({ - url: url, - 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.formatIndustryType(res.data.data) - this.formatIndustTypeInit(res.data.data) - - }).catch(err => { - console.log('行业分类列表获取失败', err) - }) - } - // 第一种formate 用于底部弹层滚动时的数据 - 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: [{name:'可选',id:''}] } - if (outter.child.length) { - for (let inner of outter.child) { - outterObject.child.push({ name: inner.class_name, id: inner.class_id }) - } - } else { - outterObject.child.push({ name: '', id: '' }) - } - newIndustryType.push(outterObject) - } - this.setState({ formatInWindow: newIndustryType }) - } - //第二种format 用于底部弹层的初始化数据 - formatIndustTypeInit(data) { - const firstArray = [{ name: '全部', id: '1' }] - const secondArray = [{ name: '', id: '' }] - for (let outter of data) { - firstArray.push({ name: outter.class_name, id: outter.class_id }) - if (outter.child.length) { - for (let inner of outter.child) { - secondArray.push({ name: inner.class_name, id: inner.class_id }) - } - } - } - this.setState({ objectMultiArray: [firstArray, secondArray] }, () => { - }) - - } - //--------------------开始-行业分类picker - bindMultiPickerChange(e) { - //判断如果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]] - } else { - industryTypeSelected = this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]] - } - - // console.log('picker发送选择改变,携带值为', e.detail.value) - - this.setState({ - multiIndex: e.detail.value, - }, () => { - this.passDataToParent(industryTypeSelected) - }) - - } - bindMulPickerColChge(e) { - // console.log('修改的列为', e.detail.column, ',值为', e.detail.value) - const data = { - objectMultiArray: this.state.objectMultiArray, - multiIndex: this.state.multiIndex - } - data.multiIndex[e.detail.column] = e.detail.value - switch (e.detail.column) { - case 0: - switch (data.multiIndex[0]) { - case 0: - data.objectMultiArray[1] = this.state.formatInWindow[0].child - break - case 1: - data.objectMultiArray[1] = this.state.formatInWindow[1].child - break - case 2: - data.objectMultiArray[1] = this.state.formatInWindow[2].child - break - case 3: - data.objectMultiArray[1] = this.state.formatInWindow[3].child - break - case 4: - data.objectMultiArray[1] = this.state.formatInWindow[4].child - break - case 5: - data.objectMultiArray[1] = this.state.formatInWindow[6].child - break - case 6: - data.objectMultiArray[1] = [{ name: '' }] - break - case 7: - data.objectMultiArray[1] = this.state.formatInWindow[7].child - break - case 8: - data.objectMultiArray[1] = this.state.formatInWindow[8].child - break - case 9: - data.objectMultiArray[1] = this.state.formatInWindow[9].child - break - case 10: - data.objectMultiArray[1] = this.state.formatInWindow[10].child - break - case 11: - data.objectMultiArray[1] = this.state.formatInWindow[11].child - break - case 12: - data.objectMultiArray[1] = this.state.formatInWindow[12].child - break - case 13: - data.objectMultiArray[1] = this.state.formatInWindow[13].child - break - case 14: - data.objectMultiArray[1] = this.state.formatInWindow[14].child - break - case 15: - data.objectMultiArray[1] = this.state.formatInWindow[15].child - break - case 15: - data.objectMultiArray[1] = this.state.formatInWindow[16].child - break - - } - data.multiIndex[1] = 0 - break - - } - // console.log(data.multiIndex) - // console.log('objectMultiArray', data.objectMultiArray) - this.setState({ - multiIndex: data.multiIndex, - objectMultiArray: data.objectMultiArray - }, () => { - - }) - } - - //--------------------结束-行业分类picker - passDataToParent(industryTypeSelected) { - this.props.onPassDataToChild(industryTypeSelected) - } - - - componentDidMount() { - - this.getIndustryTypeList(this.props.url) - } - // 当然父组件有新的props的 会从新渲染组件 - componentWillReceiveProps(nextProps) { - - } - componentWillUnmount() { } - - componentDidShow() { } - - componentDidHide() { } - - render() { - return ( - - - - - 行业分类: - - {this.props.selectedValue.name} - {/* {this.state.objectMultiArray[0] ? {this.state.objectMultiArray[0][this.state.multiIndex[0]].name} : null} - {this.state.objectMultiArray[1] ? {this.state.objectMultiArray[1][this.state.multiIndex[1]].name} : null} */} - - - + const selfAndAvailable = localStoageUserId === this.state.userId && this.state.stateId === '1' && + + + + + + + + + + + + - ) - } -} + const selfAndUnAvaialble = localStoageUserId === this.state.userId && this.state.stateId != '1' && + + + + + + + + const Avaialble = this.state.stateId === '1' && + + + const Unavailable = this.state.stateId === '2' && + + + const SoldOut = this.state.stateId === '3' && + + -export default Interaction + const ButtonElement = selfAndAvailable || selfAndUnAvaialble || Avaialble || Unavailable || SoldOut