From 79f3634eb5a0b28462f1b168ebbe7bb0393a3d83 Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Wed, 9 Jan 2019 14:58:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=8F=91=E5=B8=83=EF=BC=8C=E5=95=86=E5=93=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=8C--=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.js | 20 +- src/component/bottomNav/bottomNav.js | 60 +- .../goodsTypeInteractionComp.js | 15 +- .../shopTypeInteractionComp.js | 8 +- src/pages/goods/goods.js | 3 +- src/pages/goodsPublish/goodsPublish.js | 70 +- src/pages/index/index.js | 4 +- src/pages/myGoodList/myGoodList.js | 681 +++++++++--------- src/pages/myGoodList/myGoodList.scss | 5 + 9 files changed, 422 insertions(+), 444 deletions(-) diff --git a/src/app.js b/src/app.js index 844ed9d..56c2ab2 100644 --- a/src/app.js +++ b/src/app.js @@ -42,29 +42,25 @@ class App extends Component { navigationBarBackgroundColor: '#fff', navigationBarTitleText: 'WeChat', navigationBarTextStyle: 'black' - + } , - + } - + componentDidMount() { } + componentDidShow() { } + componentDidHide() { } - componentDidMount () {} + componentCatchError() { } - componentDidShow () {} - - componentDidHide () {} - - componentCatchError () {} - - componentDidCatchError () {} + componentDidCatchError() { } // 在 App 类中的 render() 函数没有实际作用 // 请勿修改此函数 - render () { + render() { return ( diff --git a/src/component/bottomNav/bottomNav.js b/src/component/bottomNav/bottomNav.js index 48a2789..302939b 100644 --- a/src/component/bottomNav/bottomNav.js +++ b/src/component/bottomNav/bottomNav.js @@ -1,5 +1,5 @@ import Taro, { Component } from '@tarojs/taro' -import { View} from '@tarojs/components' +import { View } from '@tarojs/components' import { AtTabBar } from 'taro-ui' @@ -10,32 +10,35 @@ class bottomNav extends Component { config = { navigationBarTitleText: 'bottomNav' } - constructor(){ + constructor() { super(...arguments); - this.state={ - current:0 + this.state = { + current: 0, + otherData: [ + { 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' }, + ] } } - handleClick(value){ - + handleClick(value) { + this.setState({ current: value }) - const otherData = [ - { 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' }, - ] - let path=otherData[value].url + + let path = this.state.otherData[value].url + console.log('path',path) Taro.navigateTo({ url: path, }) } + componentWillReceiveProps(nextProps) { //console.log(this.props, nextProps) @@ -48,34 +51,27 @@ class bottomNav extends Component { componentDidHide() { } render() { - const otherData=[ - { 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) => { + + const otherDataElementsArray = this.state.otherData.map((item) => { return { title: item.name, iconType: 'clock' } }) return ( - + ) -} + } } export default bottomNav diff --git a/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js b/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js index 08e3c8b..e7b28a0 100644 --- a/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js +++ b/src/component/goodsTypeInteractionComp/goodsTypeInteractionComp.js @@ -6,6 +6,7 @@ import { View, Text } from '@tarojs/components' import { AtTabBar, Picker, AtButton } from 'taro-ui' import './goodsTypeInteractionComp.scss' +import { throws } from 'assert'; class GoodsTypeInteractionComp extends Component { @@ -255,13 +256,9 @@ class GoodsTypeInteractionComp extends Component { this.props.onPassDataToChild(industryTypeSelected) } - goodTypeOnClick(){ - console.log('clicked') - this.getProductCateList(this.props.url) - } componentDidMount() { - + this.getProductCateList(this.props.url) } // 当然父组件有新的props的 会从新渲染组件 @@ -284,16 +281,18 @@ class GoodsTypeInteractionComp extends Component { onColumnchange={this.bindMultiPickerCol.bind(this)} value={this.state.multiIndex} range={this.state.objectMultiArray} - onClick={this.goodTypeOnClick.bind(this)} > * 商品分类: + + {this.props.selectedValue.name} + - {this.state.objectMultiArray[0].length? {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}:null} + {/* {this.state.objectMultiArray[0].length? {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}:null} {this.state.objectMultiArray[1].length?{this.state.objectMultiArray[1][this.state.multiIndex[1]].name}:null} - {this.state.objectMultiArray[2].length?{this.state.objectMultiArray[2][this.state.multiIndex[2]].name}:null} + {this.state.objectMultiArray[2].length?{this.state.objectMultiArray[2][this.state.multiIndex[2]].name}:null} */} diff --git a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js index 7e8c5f2..1db057f 100644 --- a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js +++ b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js @@ -6,7 +6,6 @@ import { View, Text } from '@tarojs/components' import { AtTabBar, Picker, AtButton } from 'taro-ui' import './shopTypeInteractionComp.scss' -import { throws } from 'assert'; class ShopTypeInteractionComp extends Component { @@ -195,12 +194,10 @@ class ShopTypeInteractionComp extends Component { passDataToParent(industryTypeSelected) { this.props.onPassDataToChild(industryTypeSelected) } - shopTypeOnClick(){ - this.getShopTypeList(this.props.url) - } + componentDidMount() { - + this.getShopTypeList(this.props.url) } // 当然父组件有新的props的 会从新渲染组件 @@ -223,7 +220,6 @@ class ShopTypeInteractionComp extends Component { onColumnchange={this.bindMulPickerColChge.bind(this)} value={this.state.multiIndex} range={this.state.objectMultiArray} - onClick={this.shopTypeOnClick.bind(this)} > diff --git a/src/pages/goods/goods.js b/src/pages/goods/goods.js index 0dd12a8..ed927a9 100644 --- a/src/pages/goods/goods.js +++ b/src/pages/goods/goods.js @@ -8,7 +8,6 @@ import URL from '../../serviceAPI.config' import './goods.scss' -//GetShopItemDetail class Goods extends Component { config = { @@ -136,7 +135,7 @@ class Goods extends Component { const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }] // const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }] const itemPicsBannerElementArray = this.state.productImagesUrl.map((item, index) => { - return < SwiperItem key={index} > + return diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js index 5603dd3..7169c98 100644 --- a/src/pages/goodsPublish/goodsPublish.js +++ b/src/pages/goodsPublish/goodsPublish.js @@ -19,8 +19,7 @@ class GoodsPublish extends Component { constructor() { super(...arguments) this.state = { - objectMultiArray: [ - ], + shopTypeSelected: { name: '选择店铺类型', id: '' },//已选的店铺分类 goodsTypeSelected: { name: '选择商品分类', id: '' },// 已选的商品分类 productName: '', @@ -35,31 +34,7 @@ class GoodsPublish extends Component { } - //商品目录请求api GetShopCategoryList - getProductCateList() { - Taro.request({ - url: URL.GetProductCategoryList, - method: 'POST', - dataType: 'json', - 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') { - this.setState({ productCategoryList: res.data.data }) - console.log('商品分类目录', res) - this.sortShopCateToState(res.data.data) - } - } - ) - .catch(error => { - console.log('商品分类请求错误', error) - }) - } - + @@ -158,38 +133,10 @@ class GoodsPublish extends Component { }) } - // 整理后台传出来的店铺分类目录 - sortShopCateToState(shopData) { - const firstColumn = [] - const secondColumn = [] - const thirdColumn = [] - for (let outterItem of shopData) { - firstColumn.push({ id: outterItem.class_id, class_name: outterItem.class_name }) - if (outterItem.children.length) { - for (let middleItem of outterItem.children) { - secondColumn.push({ id: middleItem.class_id, class_name: middleItem.class_name }) - if (middleItem.children.length) { - for (let innerItem of middleItem.children) { - thirdColumn.push({ id: innerItem.class_id, class_name: innerItem.class_name }) - } - } - } - } - } - //------- 把新指传给objectMultiArray之后就不可以用了 to be continue - - this.setState({ objectMultiArray: [firstColumn, secondColumn, thirdColumn] }, () => { - console.log('new', this.state.objectMultiArray) - }) - } + - // 改变商品分类状态 - onChangeProductType(e) { - this.setState({ - selectorChecked: this.state.selector[e.detail.value] - }) - } + productNameChange(event) { this.setState({ productName: event @@ -315,7 +262,12 @@ class GoodsPublish extends Component { {/* 商品分类开始 */} - + {/* 商品分类结束 */} @@ -367,7 +319,7 @@ class GoodsPublish extends Component { {/* 店铺分类 */} {/* 店铺分类结束 */} diff --git a/src/pages/index/index.js b/src/pages/index/index.js index 7bbf80f..f4f25dd 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -33,10 +33,10 @@ class Index extends Component { // url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit' // url: '/pages/mySupplyDemand/mySupplyDemand' // url:'/pages/grabOrderPage/grabOrderPage' - url:'/pages/home/home' + // url:'/pages/myGoodList/myGoodList' // url:'/pages/myNeeds/myNeeds', //url:'/pages/myNeedsPublish/myNeedsPublish' - // url:'/pages/goodsPublish/goodsPublish' + url:'/pages/goodsPublish/goodsPublish' }) diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js index 81140ca..b986bd2 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,AtModal,AtModalHeader,AtModalContent,AtModalAction,Button } 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' @@ -23,7 +23,7 @@ class MyGoodList extends Component { maximumSold: '', productId: '', productCate: [], //宝贝类目 - productCateSelected: { class_Id: '', class_name: '全部类目' },// 已选宝贝类目 + productCateSelected: { id: '', name: '全部类目' },// 已选宝贝类目 filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项 filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值 filterOptions: { @@ -32,7 +32,7 @@ class MyGoodList extends Component { filterSold: false, filterPublishDate: false, }, // 正反排序 - selectedFilterValue: 0, //筛选项 + selectedFilterValue: 0, // myGoodList: [],// 保存后台返回的商品列表 myGoodListTotal: 0,// 后台的商品总数 currentPage: 1, @@ -41,9 +41,9 @@ class MyGoodList extends Component { currPageParam: 1,// 当前页面 参数 isCheckAll: false,// 是否checked goodsIdList: [],//商品Id 列表 - isOpenDeleteModal:false,// 是否显示删除模态框 - isOpenOffStockModal:false,// 是否显示下架模态框 - + isOpenDeleteModal: false,// 是否显示删除模态框 + isOpenOffStockModal: false,// 是否显示下架模态框 + } @@ -87,10 +87,20 @@ class MyGoodList extends Component { } }).then(res => { console.log('baobei', res) - this.setState({ productCate: res.data.goodsClass }) + const productCate = [{ name: '全部类目', id: '' }] + for (let item of res.data.goodsClass) { + productCate.push({ name: item.class_name, id: item.class_id }) + } + this.setState({ productCate: productCate }) }).catch(err => { - console.log('获取宝贝类目失败', err) + Taro.showToast({ + title: '获取宝贝类目失败', + icon: 'none', + duration: 1500, + + }) + }) } @@ -116,18 +126,19 @@ class MyGoodList extends Component { if (res.statusCode === 200) { console.log('我的商品列表', JSON.parse(res.data)) const data = JSON.parse(res.data) - if(data.goods){ + if (data.goods) { data.goods.forEach(item => { item.checked = false }); + const goodCount = Number(data.goodsCount) + this.setState({ + myGoodList: data.goods, + myGoodListTotal: goodCount + }) } - - const goodCount = Number(data.goodsCount) - this.setState({ - myGoodList: data.goods, - myGoodListTotal: goodCount - }) + + } else { console.log('我的商品列表获取失败') @@ -141,7 +152,7 @@ class MyGoodList extends Component { getGoodListResultApi({ goodsName = this.state.productName, goodsSn = '', - goodsClass = this.state.productCateSelected.class_Id, + goodsClass = this.state.productCateSelected.id, goodsPriceL = this.state.lowestPrice, goodsPriceU = this.state.heightestPrice, goodsSalesL = this.state.minimumSold, @@ -185,6 +196,7 @@ class MyGoodList extends Component { myGoodList: data.goods, myGoodListTotal: goodCount }) + Taro.hideLoading() } else { console.log('我的商品列表获取失败') @@ -214,24 +226,23 @@ class MyGoodList extends Component { }).then(res => { if (res.statusCode === 200) { Taro.showToast({ - title:'下架成功', - icon:'success', - duration:1500 - }).then(()=>{ - setTimeout(() => { - this.setState({isCheckAll:false}) - this.getMyGoodListApi({}) - }, 1500); + title: '下架成功', + icon: 'success', + duration: 1500 + }).then(() => { + this.setState({ isCheckAll: false }) + this.getMyGoodListApi({}) + }) } else { Taro.showToast({ - title:'下架失败', - icon:'none', - duration:1500 + title: '下架失败', + icon: 'none', + duration: 1500 }) - this.setState({isCheckAll:false}) + this.setState({ isCheckAll: false }) } @@ -258,25 +269,22 @@ class MyGoodList extends Component { if (res.statusCode === 200) { console.log('商品删除返回', res) Taro.showToast({ - title:'删除成功', - icon:'success', - duration:1500 - }).then(()=>{ - setTimeout(() => { - this.setState({isCheckAll:false}) - this.getMyGoodListApi({}) - }, 1500); - }) - - + title: '删除成功', + icon: 'success', + duration: 1500 + }).then(() => { + this.setState({ isCheckAll: false }) + this.getMyGoodListApi({}) + + }) } else { Taro.showToast({ - title:'删除失败', - icon:'none', - duration:1500 + title: '删除失败', + icon: 'none', + duration: 1500 }) - this.setState({isCheckAll:false}) + this.setState({ isCheckAll: false }) } @@ -289,7 +297,10 @@ class MyGoodList extends Component { // 搜索 searchButtonHandler() { - this.setState({ currentPage: 1 }, () => { + Taro.showLoading({ + title: '加载中', + }) + this.setState({ currentPage: 1 ,isCheckAll:false}, () => { this.getGoodListResultApi({}) }) } @@ -304,8 +315,19 @@ class MyGoodList extends Component { minimumSold: '', maximumSold: '', productId: '', - productCateSelected: { class_Id: '', class_name: '全部类目' }, + productCateSelected: { id: '', name: '全部类目' }, + }, () => { + + this.setState({isCheckAll:false,currentPage: 1},()=>{ + this.getMyGoodListApi({}) + }) + Taro.showToast({ + title: '已清空', + icon: 'success', + duration: 1000 + }) }) + } // 产品排序 accendingDescending(value) { @@ -381,306 +403,319 @@ class MyGoodList extends Component { } // 商品全部选择 checkAllHandler() { - const newMyGoodList = this.state.myGoodList.map((item) => { - item.checked = !this.state.isCheckAll - return item - }) - this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList },()=>{ - console.log('全选列表',this.state.myGoodList) - }) - - } + if (this.state.myGoodList.length) { + const newMyGoodList = this.state.myGoodList.map((item) => { + item.checked = !this.state.isCheckAll + return item + }) + this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList }, () => { + console.log('全选列表', this.state.myGoodList) + }) + } + else { + this.setState({ + isCheckAll:true + },()=>{ + this.setState({isCheckAll:false}) + }) + Taro.showToast({ + title: '全选无效', + icon: 'none', + duration: 1500 + }).then(()=>{ + + }) + + }} - // 单个商品选择 - handleCheckChange(Id) { - //如果goodid 一样的那么checked 就取反 - const newMyGoodList = this.state.myGoodList.map((item) => { - if (item.goods_id === Id) { - item.checked = !item.checked - } - return item - }) - this.setState({ myGoodList: newMyGoodList }) - } - // 删除商品 - deleteGoodsHandler() { - const checkedGoodsId = [] - this.state.myGoodList.forEach(item => { - if (item.checked) { - checkedGoodsId.push(item.goods_id) - } - }); - checkedGoodsId.length ? this.setState({isOpenDeleteModal:true}): Taro.showToast({ - title:'请选择要删除的商品', - icon:'none', - duration:1500 - }) - // // this.deleteGood({ goodsID: checkedGoodsId }) - - - - } - // 改变商品状态 - offStockGoodHandler() { - const checkedGoodsId = [] - this.state.myGoodList.forEach(item => { - if (item.checked) { - checkedGoodsId.push(item.goods_id) - } - }); - //this.changeGoodState({ goodsID: checkedGoodsId }) - checkedGoodsId.length ? this.setState({isOpenOffStockModal:true}) : Taro.showToast({ - title:'请选择要下架的商品', - icon:'none', - duration:1500 - }) - } - // 导航到商品编辑页面myGoodsEdit - goToGoodEditPage(goodId) { - Taro.navigateTo({ - url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId - }) - } - goToGoodspage(goodId){ - Taro.navigateTo({ - 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({}) - this.getBaoBeiCateList() - } - componentWillReceiveProps(nextProps) { - console.log(this.props, nextProps) - } - - componentWillUnmount() { } - - componentDidShow() { } - - componentDidHide() { } - - render() { - - - //等待接口数据 {item.text} - const goodListElementArray = this.state.myGoodList.map((item, index) => { - return - - {/* onClick={this.handleCheckChange.bind(this,item.goods_id)} */} - - - - {item.goods_name} - ¥{item.goods_price} - {item.sales_volume} - - - 编辑商品 - - - }) - // 筛选项目排序element - const filterElementsArray = this.state.filterBar.map((item, index) => { - let isTure = this.state.filterOptions[item] - - return - - {this.state.filterBarKeys[item]} - - {isTure ? : } - - }) - // 删除提示模态弹窗element - const modalMessageDeleteElement = - 提示 - - 确定要删除已选商品? - - - - // 下架提示模态弹窗element - const modalMessageOffStockElement = - 提示 - - 确定要下架已选商品? - - - + // 单个商品选择 + handleCheckChange(Id) { + //如果goodid 一样的那么checked 就取反 + const newMyGoodList = this.state.myGoodList.map((item) => { + if (item.goods_id === Id) { + item.checked = !item.checked + } + return item + }) + this.setState({ myGoodList: newMyGoodList }) + } + // 删除商品 + deleteGoodsHandler() { + const checkedGoodsId = [] + this.state.myGoodList.forEach(item => { + if (item.checked) { + checkedGoodsId.push(item.goods_id) + } + }); + checkedGoodsId.length ? this.setState({ isOpenDeleteModal: true }) : Taro.showToast({ + title: '请选择要删除的商品', + icon: 'none', + duration: 1500 + }) + // // this.deleteGood({ goodsID: checkedGoodsId }) - return ( - - {/* 删除模态提示框 */} - {modalMessageDeleteElement} - {/* 下架模态框提示 */} - {modalMessageOffStockElement} - - - - - - - - - - - + } + // 改变商品状态 + offStockGoodHandler() { + const checkedGoodsId = [] + this.state.myGoodList.forEach(item => { + if (item.checked) { + checkedGoodsId.push(item.goods_id) + } + }); + //this.changeGoodState({ goodsID: checkedGoodsId }) + checkedGoodsId.length ? this.setState({ isOpenOffStockModal: true }) : Taro.showToast({ + title: '请选择要下架的商品', + icon: 'none', + duration: 1500 + }) + } + // 导航到商品编辑页面myGoodsEdit + goToGoodEditPage(goodId) { + Taro.navigateTo({ + url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId + }) + } + goToGoodspage(goodId){ + Taro.navigateTo({ + 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.state.productCateSelected.class_name} - + 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({}) + this.getBaoBeiCateList() + } + componentWillReceiveProps(nextProps) { + console.log(this.props, nextProps) + } + + componentWillUnmount() { } + + componentDidShow() { } + + componentDidHide() { } + + render() { + + //等待接口数据 + const goodListElementArray = this.state.myGoodList.map((item, index) => { + return + + {/* onClick={this.handleCheckChange.bind(this,item.goods_id)} */} + + - + {item.goods_name} + ¥{item.goods_price} + {item.sales_volume} + - - 清空条件 + 编辑商品 + }) + // 筛选项目排序element + const filterElementsArray = this.state.filterBar.map((item, index) => { + let isTure = this.state.filterOptions[item] - - 出售中的宝贝{this.state.myGoodListTotal}条记录 + return + + {this.state.filterBarKeys[item]} + + {isTure ? : } - - - {filterElementsArray} + }) + // 删除提示模态弹窗element + const modalMessageDeleteElement = + 提示 + + 确定要删除已选商品? + + + + // 下架提示模态弹窗element + const modalMessageOffStockElement = + 提示 + + 确定要下架已选商品? + + + + return ( + + {/* 删除模态提示框 */} + {modalMessageDeleteElement} + {/* 下架模态框提示 */} + {modalMessageOffStockElement} + + + - - 全选 - + + + + + + + + + + + + + + + + + 宝贝类目: + + {this.state.productCateSelected.name} + + + + + + + - 删除 + + 搜索 - + - 下架 + 清空条件 + + + 出售中的宝贝{this.state.myGoodListTotal}条记录 + + + + {filterElementsArray} + + + + 全选 + + + 删除 + + + + + 下架 + + + + + + + + {this.state.myGoodList.length ? goodListElementArray : + 没有更多了.... + } + + + + + + + + + + - - - - {/* */} - - {goodListElementArray} - {/* */} - - - - - - - - - - - - ) + ) + } } -} -export default MyGoodList + export default MyGoodList diff --git a/src/pages/myGoodList/myGoodList.scss b/src/pages/myGoodList/myGoodList.scss index d1c059a..ca50a23 100644 --- a/src/pages/myGoodList/myGoodList.scss +++ b/src/pages/myGoodList/myGoodList.scss @@ -188,3 +188,8 @@ $themeColor:#FF7142; } } +.nomore{ + font-size: 32rpx; + margin-top: 40px; + text-align: center +}