商品列表,商品发布,商品编辑,--完成
This commit is contained in:
parent
85e2a028ad
commit
79f3634eb5
@ -48,10 +48,6 @@ class App extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
componentDidMount() { }
|
componentDidMount() { }
|
||||||
|
|
||||||
componentDidShow() { }
|
componentDidShow() { }
|
||||||
|
@ -14,7 +14,14 @@ class bottomNav extends Component {
|
|||||||
super(...arguments);
|
super(...arguments);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
current:0
|
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' },
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -23,20 +30,16 @@ class bottomNav extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
current: value
|
current: value
|
||||||
})
|
})
|
||||||
const otherData = [
|
|
||||||
{ name: '首页', url: '/pages/home/home' },
|
let path = this.state.otherData[value].url
|
||||||
{ name: '商品发布', url: '/pages/goodsPublish/goodsPublish' },
|
console.log('path',path)
|
||||||
{ name: '供求发布', url: '/pages/supplyDemandPublish/supplyDemandPublish' },
|
|
||||||
{ name: '我的供求', url: '/pages/mySupplyDemand/mySupplyDemand' },
|
|
||||||
{ name: '我的需求', url: '/pages/myNeeds/myNeeds' },
|
|
||||||
]
|
|
||||||
let path=otherData[value].url
|
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: path,
|
url: path,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
//console.log(this.props, nextProps)
|
//console.log(this.props, nextProps)
|
||||||
}
|
}
|
||||||
@ -48,15 +51,8 @@ class bottomNav extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const otherData=[
|
|
||||||
{ name: '首页', url: 'pages/home/home' },
|
const otherDataElementsArray = this.state.otherData.map((item) => {
|
||||||
{ 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) => {
|
|
||||||
return { title: item.name, iconType: 'clock' }
|
return { title: item.name, iconType: 'clock' }
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
|
@ -6,6 +6,7 @@ import { View, Text } from '@tarojs/components'
|
|||||||
import { AtTabBar, Picker, AtButton } from 'taro-ui'
|
import { AtTabBar, Picker, AtButton } from 'taro-ui'
|
||||||
|
|
||||||
import './goodsTypeInteractionComp.scss'
|
import './goodsTypeInteractionComp.scss'
|
||||||
|
import { throws } from 'assert';
|
||||||
|
|
||||||
class GoodsTypeInteractionComp extends Component {
|
class GoodsTypeInteractionComp extends Component {
|
||||||
|
|
||||||
@ -255,13 +256,9 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
this.props.onPassDataToChild(industryTypeSelected)
|
this.props.onPassDataToChild(industryTypeSelected)
|
||||||
}
|
}
|
||||||
|
|
||||||
goodTypeOnClick(){
|
|
||||||
console.log('clicked')
|
|
||||||
this.getProductCateList(this.props.url)
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.getProductCateList(this.props.url)
|
||||||
|
|
||||||
}
|
}
|
||||||
// 当然父组件有新的props的 会从新渲染组件
|
// 当然父组件有新的props的 会从新渲染组件
|
||||||
@ -284,16 +281,18 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
||||||
value={this.state.multiIndex}
|
value={this.state.multiIndex}
|
||||||
range={this.state.objectMultiArray}
|
range={this.state.objectMultiArray}
|
||||||
onClick={this.goodTypeOnClick.bind(this)}
|
|
||||||
>
|
>
|
||||||
<View class='picker type'>
|
<View class='picker type'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='require'>*</Text>
|
<Text className='require'>*</Text>
|
||||||
<Text className='title'>商品分类:</Text>
|
<Text className='title'>商品分类:</Text>
|
||||||
|
<Text className='first-col'>
|
||||||
|
{this.props.selectedValue.name}
|
||||||
|
</Text>
|
||||||
|
|
||||||
{this.state.objectMultiArray[0].length?<Text className='first-col'> {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}</Text>:null}
|
{/* {this.state.objectMultiArray[0].length?<Text className='first-col'> {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}</Text>:null}
|
||||||
{this.state.objectMultiArray[1].length?<Text className='second-col'>{this.state.objectMultiArray[1][this.state.multiIndex[1]].name}</Text>:null}
|
{this.state.objectMultiArray[1].length?<Text className='second-col'>{this.state.objectMultiArray[1][this.state.multiIndex[1]].name}</Text>:null}
|
||||||
{this.state.objectMultiArray[2].length?<Text className='third-col'>{this.state.objectMultiArray[2][this.state.multiIndex[2]].name}</Text>:null}
|
{this.state.objectMultiArray[2].length?<Text className='third-col'>{this.state.objectMultiArray[2][this.state.multiIndex[2]].name}</Text>:null} */}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -6,7 +6,6 @@ import { View, Text } from '@tarojs/components'
|
|||||||
import { AtTabBar, Picker, AtButton } from 'taro-ui'
|
import { AtTabBar, Picker, AtButton } from 'taro-ui'
|
||||||
|
|
||||||
import './shopTypeInteractionComp.scss'
|
import './shopTypeInteractionComp.scss'
|
||||||
import { throws } from 'assert';
|
|
||||||
|
|
||||||
class ShopTypeInteractionComp extends Component {
|
class ShopTypeInteractionComp extends Component {
|
||||||
|
|
||||||
@ -195,12 +194,10 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
passDataToParent(industryTypeSelected) {
|
passDataToParent(industryTypeSelected) {
|
||||||
this.props.onPassDataToChild(industryTypeSelected)
|
this.props.onPassDataToChild(industryTypeSelected)
|
||||||
}
|
}
|
||||||
shopTypeOnClick(){
|
|
||||||
this.getShopTypeList(this.props.url)
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.getShopTypeList(this.props.url)
|
||||||
|
|
||||||
}
|
}
|
||||||
// 当然父组件有新的props的 会从新渲染组件
|
// 当然父组件有新的props的 会从新渲染组件
|
||||||
@ -223,7 +220,6 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
onColumnchange={this.bindMulPickerColChge.bind(this)}
|
onColumnchange={this.bindMulPickerColChge.bind(this)}
|
||||||
value={this.state.multiIndex}
|
value={this.state.multiIndex}
|
||||||
range={this.state.objectMultiArray}
|
range={this.state.objectMultiArray}
|
||||||
onClick={this.shopTypeOnClick.bind(this)}
|
|
||||||
>
|
>
|
||||||
<View class='picker type'>
|
<View class='picker type'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
|
@ -8,7 +8,6 @@ import URL from '../../serviceAPI.config'
|
|||||||
|
|
||||||
|
|
||||||
import './goods.scss'
|
import './goods.scss'
|
||||||
//GetShopItemDetail
|
|
||||||
class Goods extends Component {
|
class Goods extends Component {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -19,8 +19,7 @@ class GoodsPublish extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments)
|
super(...arguments)
|
||||||
this.state = {
|
this.state = {
|
||||||
objectMultiArray: [
|
|
||||||
],
|
|
||||||
shopTypeSelected: { name: '选择店铺类型', id: '' },//已选的店铺分类
|
shopTypeSelected: { name: '选择店铺类型', id: '' },//已选的店铺分类
|
||||||
goodsTypeSelected: { name: '选择商品分类', id: '' },// 已选的商品分类
|
goodsTypeSelected: { name: '选择商品分类', id: '' },// 已选的商品分类
|
||||||
productName: '',
|
productName: '',
|
||||||
@ -35,30 +34,6 @@ 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) {
|
productNameChange(event) {
|
||||||
this.setState({
|
this.setState({
|
||||||
productName: event
|
productName: event
|
||||||
@ -315,7 +262,12 @@ class GoodsPublish extends Component {
|
|||||||
<View className='goods-publish'>
|
<View className='goods-publish'>
|
||||||
<View className='goods-category'>
|
<View className='goods-category'>
|
||||||
{/* 商品分类开始 */}
|
{/* 商品分类开始 */}
|
||||||
<GoodsTypeInteractionComp url={URL.GetProductCategoryList} onPassDataToChild={this.getDataFromGoodsChild.bind(this)}></GoodsTypeInteractionComp>
|
<GoodsTypeInteractionComp
|
||||||
|
url={URL.GetProductCategoryList}
|
||||||
|
onPassDataToChild={this.getDataFromGoodsChild.bind(this)}
|
||||||
|
selectedValue={this.state.goodsTypeSelected}
|
||||||
|
|
||||||
|
></GoodsTypeInteractionComp>
|
||||||
{/* 商品分类结束 */}
|
{/* 商品分类结束 */}
|
||||||
|
|
||||||
<View className='input-box'>
|
<View className='input-box'>
|
||||||
@ -367,7 +319,7 @@ class GoodsPublish extends Component {
|
|||||||
</View>
|
</View>
|
||||||
{/* 店铺分类 */}
|
{/* 店铺分类 */}
|
||||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||||
initialShopType={this.state.shopTypeSelected}
|
selectedValue={this.state.shopTypeSelected}
|
||||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||||
></ShopTypeInteractionComp>
|
></ShopTypeInteractionComp>
|
||||||
{/* 店铺分类结束 */}
|
{/* 店铺分类结束 */}
|
||||||
|
@ -33,10 +33,10 @@ class Index extends Component {
|
|||||||
// url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
|
// url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
|
||||||
// url: '/pages/mySupplyDemand/mySupplyDemand'
|
// url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||||
// url:'/pages/grabOrderPage/grabOrderPage'
|
// url:'/pages/grabOrderPage/grabOrderPage'
|
||||||
url:'/pages/home/home'
|
// url:'/pages/myGoodList/myGoodList'
|
||||||
// url:'/pages/myNeeds/myNeeds',
|
// url:'/pages/myNeeds/myNeeds',
|
||||||
//url:'/pages/myNeedsPublish/myNeedsPublish'
|
//url:'/pages/myNeedsPublish/myNeedsPublish'
|
||||||
// url:'/pages/goodsPublish/goodsPublish'
|
url:'/pages/goodsPublish/goodsPublish'
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -23,7 +23,7 @@ class MyGoodList extends Component {
|
|||||||
maximumSold: '',
|
maximumSold: '',
|
||||||
productId: '',
|
productId: '',
|
||||||
productCate: [], //宝贝类目
|
productCate: [], //宝贝类目
|
||||||
productCateSelected: { class_Id: '', class_name: '全部类目' },// 已选宝贝类目
|
productCateSelected: { id: '', name: '全部类目' },// 已选宝贝类目
|
||||||
filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项
|
filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项
|
||||||
filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值
|
filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值
|
||||||
filterOptions: {
|
filterOptions: {
|
||||||
@ -32,7 +32,7 @@ class MyGoodList extends Component {
|
|||||||
filterSold: false,
|
filterSold: false,
|
||||||
filterPublishDate: false,
|
filterPublishDate: false,
|
||||||
}, // 正反排序
|
}, // 正反排序
|
||||||
selectedFilterValue: 0, //筛选项
|
selectedFilterValue: 0, //
|
||||||
myGoodList: [],// 保存后台返回的商品列表
|
myGoodList: [],// 保存后台返回的商品列表
|
||||||
myGoodListTotal: 0,// 后台的商品总数
|
myGoodListTotal: 0,// 后台的商品总数
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@ -87,10 +87,20 @@ class MyGoodList extends Component {
|
|||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log('baobei', 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 => {
|
}).catch(err => {
|
||||||
console.log('获取宝贝类目失败', err)
|
Taro.showToast({
|
||||||
|
title: '获取宝贝类目失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500,
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -120,15 +130,16 @@ class MyGoodList extends Component {
|
|||||||
data.goods.forEach(item => {
|
data.goods.forEach(item => {
|
||||||
item.checked = false
|
item.checked = false
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const goodCount = Number(data.goodsCount)
|
const goodCount = Number(data.goodsCount)
|
||||||
this.setState({
|
this.setState({
|
||||||
myGoodList: data.goods,
|
myGoodList: data.goods,
|
||||||
myGoodListTotal: goodCount
|
myGoodListTotal: goodCount
|
||||||
})
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('我的商品列表获取失败')
|
console.log('我的商品列表获取失败')
|
||||||
}
|
}
|
||||||
@ -141,7 +152,7 @@ class MyGoodList extends Component {
|
|||||||
getGoodListResultApi({
|
getGoodListResultApi({
|
||||||
goodsName = this.state.productName,
|
goodsName = this.state.productName,
|
||||||
goodsSn = '',
|
goodsSn = '',
|
||||||
goodsClass = this.state.productCateSelected.class_Id,
|
goodsClass = this.state.productCateSelected.id,
|
||||||
goodsPriceL = this.state.lowestPrice,
|
goodsPriceL = this.state.lowestPrice,
|
||||||
goodsPriceU = this.state.heightestPrice,
|
goodsPriceU = this.state.heightestPrice,
|
||||||
goodsSalesL = this.state.minimumSold,
|
goodsSalesL = this.state.minimumSold,
|
||||||
@ -185,6 +196,7 @@ class MyGoodList extends Component {
|
|||||||
myGoodList: data.goods,
|
myGoodList: data.goods,
|
||||||
myGoodListTotal: goodCount
|
myGoodListTotal: goodCount
|
||||||
})
|
})
|
||||||
|
Taro.hideLoading()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('我的商品列表获取失败')
|
console.log('我的商品列表获取失败')
|
||||||
@ -218,10 +230,9 @@ class MyGoodList extends Component {
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({ isCheckAll: false })
|
this.setState({ isCheckAll: false })
|
||||||
this.getMyGoodListApi({})
|
this.getMyGoodListApi({})
|
||||||
}, 1500);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -262,14 +273,11 @@ class MyGoodList extends Component {
|
|||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
setTimeout(() => {
|
|
||||||
this.setState({ isCheckAll: false })
|
this.setState({ isCheckAll: false })
|
||||||
this.getMyGoodListApi({})
|
this.getMyGoodListApi({})
|
||||||
}, 1500);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '删除失败',
|
title: '删除失败',
|
||||||
@ -289,7 +297,10 @@ class MyGoodList extends Component {
|
|||||||
|
|
||||||
// 搜索
|
// 搜索
|
||||||
searchButtonHandler() {
|
searchButtonHandler() {
|
||||||
this.setState({ currentPage: 1 }, () => {
|
Taro.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
})
|
||||||
|
this.setState({ currentPage: 1 ,isCheckAll:false}, () => {
|
||||||
this.getGoodListResultApi({})
|
this.getGoodListResultApi({})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -304,8 +315,19 @@ class MyGoodList extends Component {
|
|||||||
minimumSold: '',
|
minimumSold: '',
|
||||||
maximumSold: '',
|
maximumSold: '',
|
||||||
productId: '',
|
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) {
|
accendingDescending(value) {
|
||||||
@ -381,6 +403,7 @@ class MyGoodList extends Component {
|
|||||||
}
|
}
|
||||||
// 商品全部选择
|
// 商品全部选择
|
||||||
checkAllHandler() {
|
checkAllHandler() {
|
||||||
|
if (this.state.myGoodList.length) {
|
||||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||||
item.checked = !this.state.isCheckAll
|
item.checked = !this.state.isCheckAll
|
||||||
return item
|
return item
|
||||||
@ -388,8 +411,22 @@ class MyGoodList extends Component {
|
|||||||
this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList }, () => {
|
this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList }, () => {
|
||||||
console.log('全选列表', this.state.myGoodList)
|
console.log('全选列表', this.state.myGoodList)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.setState({
|
||||||
|
isCheckAll:true
|
||||||
|
},()=>{
|
||||||
|
this.setState({isCheckAll:false})
|
||||||
|
})
|
||||||
|
Taro.showToast({
|
||||||
|
title: '全选无效',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
}).then(()=>{
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
// 单个商品选择
|
// 单个商品选择
|
||||||
@ -500,8 +537,7 @@ class MyGoodList extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
//等待接口数据
|
||||||
//等待接口数据 <Radio className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio>
|
|
||||||
const goodListElementArray = this.state.myGoodList.map((item, index) => {
|
const goodListElementArray = this.state.myGoodList.map((item, index) => {
|
||||||
return <View key={index} className='good-container'>
|
return <View key={index} className='good-container'>
|
||||||
<Radio className='radio' value={item.goods_id} checked={item.checked} onClick={this.handleCheckChange.bind(this, item.goods_id)} ></Radio>
|
<Radio className='radio' value={item.goods_id} checked={item.checked} onClick={this.handleCheckChange.bind(this, item.goods_id)} ></Radio>
|
||||||
@ -546,7 +582,6 @@ class MyGoodList extends Component {
|
|||||||
<AtModalAction> <Button onClick={this.offStockModalClose.bind(this)}>取消</Button> <Button className='orange' onClick={this.OffStockConfirm.bind(this)}>确定</Button> </AtModalAction>
|
<AtModalAction> <Button onClick={this.offStockModalClose.bind(this)}>取消</Button> <Button className='orange' onClick={this.OffStockConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
</AtModal>
|
</AtModal>
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='MyGoodList'>
|
<View className='MyGoodList'>
|
||||||
{/* 删除模态提示框 */}
|
{/* 删除模态提示框 */}
|
||||||
@ -611,12 +646,12 @@ class MyGoodList extends Component {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
<Picker mode='selector' rangeKey='class_name' range={this.state.productCate} onChange={this.productCateChange.bind(this)}>
|
<Picker mode='selector' rangeKey='name' range={this.state.productCate} onChange={this.productCateChange.bind(this)}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='title'>宝贝类目:</Text>
|
<Text className='title'>宝贝类目:</Text>
|
||||||
|
|
||||||
<Text className='selected'>{this.state.productCateSelected.class_name}</Text>
|
<Text className='selected'>{this.state.productCateSelected.name}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@ -659,10 +694,10 @@ class MyGoodList extends Component {
|
|||||||
|
|
||||||
|
|
||||||
<View className='mygoodlist-container'>
|
<View className='mygoodlist-container'>
|
||||||
{/* <RadioGroup onChange={this.handleCheckChange.bind(this)}> */}
|
|
||||||
|
|
||||||
{goodListElementArray}
|
{this.state.myGoodList.length ? goodListElementArray : <View className='nomore' >
|
||||||
{/* </RadioGroup> */}
|
没有更多了....
|
||||||
|
</View >}
|
||||||
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
@ -188,3 +188,8 @@ $themeColor:#FF7142;
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.nomore{
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user