四级联动,上拉加载
This commit is contained in:
parent
401e237358
commit
6b8102feb6
10
src/app.scss
10
src/app.scss
@ -51,10 +51,12 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .button-blue-mini{
|
|
||||||
// color:white;
|
|
||||||
// background:$linearBlue;
|
|
||||||
// }
|
|
||||||
.button-no-margin{
|
.button-no-margin{
|
||||||
margin:10px 0
|
margin:10px 0
|
||||||
}
|
}
|
||||||
|
.no_more_title{
|
||||||
|
text-align: center;
|
||||||
|
font-size: 25rpx;
|
||||||
|
|
||||||
|
}
|
@ -7,7 +7,8 @@ import { Picker } from 'taro-ui'
|
|||||||
|
|
||||||
import './goodsTypeInteractionComp.scss'
|
import './goodsTypeInteractionComp.scss'
|
||||||
|
|
||||||
|
let maxDepth = 0
|
||||||
|
let initialDataArray = []
|
||||||
class GoodsTypeInteractionComp extends Component {
|
class GoodsTypeInteractionComp extends Component {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -18,9 +19,10 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
///---行业分类 开始
|
///---行业分类 开始
|
||||||
objectMultiArray: [[{ class_name: '选择商品分类', class_id: '' }], [], []],
|
initailMultiArray: [[{ class_name: '选择商品分类', class_id: '' }], [], []],
|
||||||
multiIndex: [0, 0, 0, 0],
|
multiIndex: [0, 0, 0, 0],// 默认联动列数为4个并且每一列都是第一行
|
||||||
formatInWindow: [],
|
interactionMultiArray: [],
|
||||||
|
|
||||||
|
|
||||||
///---行业分类 结束
|
///---行业分类 结束
|
||||||
}
|
}
|
||||||
@ -41,15 +43,17 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_msg === 'success') {
|
||||||
console.log('商品分类目录', res)
|
console.log('商品分类目录', res)
|
||||||
// this.formatIndustryType(res.data.data)
|
|
||||||
this.formatIndustTypeInit(res.data.data)
|
|
||||||
this.setState({
|
this.setState({
|
||||||
formatInWindow: this.recursion(res.data.data).multiObject,
|
interactionMultiArray: this.recursionInteraction(res.data.data),
|
||||||
DataDepth:this.recursion(res.data.data).depth },()=>{
|
multiIndex: this.recursionDepth(res.data.data),
|
||||||
console.log('depth',this.state.DataDepth)
|
initailMultiArray: this.recursionInitialized(res.data.data).reverse()
|
||||||
}) // 用递归来整理无限层次的数据
|
}, () => {
|
||||||
// console.log(this.recursion(res.data.data))
|
console.log('联动数据', this.state.interactionMultiArray)
|
||||||
// this.setState({objectMultiArray:res.data.data})
|
console.log('初始化数据', this.state.initailMultiArray)
|
||||||
|
|
||||||
|
}) // 用递归来整理无限层次的数据
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('商品分类请求没有成功', res)
|
console.log('商品分类请求没有成功', res)
|
||||||
}
|
}
|
||||||
@ -96,11 +100,11 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
} else {
|
} else {
|
||||||
console.log('店铺分类数据问题')
|
console.log('店铺分类数据问题')
|
||||||
}
|
}
|
||||||
this.setState({ formatInWindow: newIndustryType }, () => {
|
this.setState({ interactionMultiArray: newIndustryType }, () => {
|
||||||
console.log('滚动时的数据', this.state.formatInWindow)
|
console.log('滚动时的数据', this.state.interactionMultiArray)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//第二种format 用于底部弹层的初始化数据
|
// 第二种format 用于底部弹层的初始化数据
|
||||||
formatIndustTypeInit(data) {
|
formatIndustTypeInit(data) {
|
||||||
const firstArray = []
|
const firstArray = []
|
||||||
const secondArray = []
|
const secondArray = []
|
||||||
@ -119,63 +123,84 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 这里不能加入secondArray,和thirdArray 会有bug
|
// 这里不能加入secondArray,和thirdArray 会有bug
|
||||||
this.setState({ objectMultiArray: [firstArray, secondArray, thirdArray] }, () => {
|
this.setState({ initailMultiArray: [firstArray, secondArray, thirdArray] }, () => {
|
||||||
console.log('初始化数据', this.state.objectMultiArray)
|
console.log('初始化数据', this.state.initailMultiArray)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//--- 三级联动--------------
|
//联动确认
|
||||||
bindMultiPickerChange(e) {
|
bindMultiPickerChange(e) {
|
||||||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
console.log('e', e)
|
||||||
this.setState({
|
this.setState({
|
||||||
multiIndex: e.detail.value
|
multiIndex: e.detail.value.map(item => { if (item === null) { item = 0 } return item })
|
||||||
}, () => {
|
}, () => {
|
||||||
|
// console.log('picker发送选择改变,携带值为', this.state.multiIndex)
|
||||||
this.returnResultToParent()
|
this.returnResultToParent()
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
returnResultToParent() {
|
returnResultToParent() {
|
||||||
let result = ''
|
let selected = this.state.interactionMultiArray
|
||||||
let outter = this.state.formatInWindow[this.state.multiIndex[0]]
|
for (let index of this.state.multiIndex) {
|
||||||
let middler = outter.children[this.state.multiIndex[1]]
|
if (selected[index].children[0].id) {
|
||||||
let inner = middler.children[this.state.multiIndex[2]]
|
selected = selected[index].children
|
||||||
if (outter.id) {
|
} else {
|
||||||
result = outter
|
this.props.onPassDataToChild(selected[index])
|
||||||
if (middler.id) {
|
break
|
||||||
result = middler
|
|
||||||
if (inner.id) {
|
|
||||||
result = inner
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.passDataToParent(result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 递归整理无限层数据
|
|
||||||
recursion(data) {
|
// 递归整理无限层联动数据
|
||||||
|
recursionInteraction(data) {
|
||||||
let arrayTem = []
|
let arrayTem = []
|
||||||
let depth=0
|
|
||||||
const depthArray=[]
|
|
||||||
for (let items of data) {
|
for (let items of data) {
|
||||||
arrayTem.push({ name: items.class_name, id: items.class_id })
|
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||||
if (items.children) {
|
if (items.children) {
|
||||||
arrayTem[arrayTem.length - 1].children = this.recursion(items.children)
|
arrayTem[arrayTem.length - 1].children = this.recursionInteraction(items.children)
|
||||||
depth+=1
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
depthArray.push(depth)
|
|
||||||
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {multiObject:arrayTem,depth:depthArray}
|
return arrayTem // 返回联动数据
|
||||||
|
// return arrayTem
|
||||||
|
}
|
||||||
|
// 递归整理无限层初始数据
|
||||||
|
recursionInitialized(data) {
|
||||||
|
const arrayTem = []
|
||||||
|
const childrenHolderArray = []
|
||||||
|
if (data.length) {
|
||||||
|
for (let item of data) {
|
||||||
|
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||||
|
item.children ? childrenHolderArray.push(...item.children) : null
|
||||||
|
}
|
||||||
|
this.recursionInitialized(childrenHolderArray)
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
|
||||||
|
return initialDataArray
|
||||||
|
}
|
||||||
|
// 递归整理无限层初始数据
|
||||||
|
recursionDepth(data) {
|
||||||
|
const arrayTem = []
|
||||||
|
const childrenHolderArray = []
|
||||||
|
if (data.length) {
|
||||||
|
for (let item of data) {
|
||||||
|
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||||
|
item.children ? childrenHolderArray.push(...item.children) : null
|
||||||
|
}
|
||||||
|
this.recursionDepth(childrenHolderArray)
|
||||||
|
maxDepth += 1
|
||||||
|
}
|
||||||
|
return new Array(maxDepth).fill(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 触动联动筛选
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bindMultiPickerCol(e) {
|
bindMultiPickerCol(e) {
|
||||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||||
|
console.log(this.state.initailMultiArray)
|
||||||
const data = {
|
const data = {
|
||||||
multiArray: this.state.objectMultiArray,
|
multiArray: this.state.initailMultiArray,
|
||||||
multiIndex: this.state.multiIndex
|
multiIndex: this.state.multiIndex
|
||||||
}
|
}
|
||||||
data.multiIndex[e.detail.column] = e.detail.value
|
data.multiIndex[e.detail.column] = e.detail.value
|
||||||
@ -185,17 +210,19 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
for (let index in data.multiArray[0]) {
|
for (let index in data.multiArray[0]) {
|
||||||
const indexNumber = Number(index)
|
const indexNumber = Number(index)
|
||||||
if (indexNumber === data.multiIndex[0]) {
|
if (indexNumber === data.multiIndex[0]) {
|
||||||
data.multiArray[1] = this.state.formatInWindow[indexNumber].children
|
// data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||||
data.multiArray[2] = this.state.formatInWindow[indexNumber].children[0].children
|
// data.multiArray[2] = this.state.interactionMultiArray[indexNumber].children[0].children
|
||||||
data.multiArray[3] = this.state.formatInWindow[indexNumber].children[0].children[0].children
|
// data.multiArray[3] = this.state.interactionMultiArray[indexNumber].children[0].children[0].children
|
||||||
|
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||||
|
data.multiArray[2] = this.state.interactionMultiArray[indexNumber].children[data.multiIndex[1]].children
|
||||||
|
data.multiArray[3] = this.state.interactionMultiArray[indexNumber].children[data.multiIndex[1]].children[data.multiIndex[2]].children
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (e.detail.column == 1) {
|
} else if (e.detail.column == 1) {
|
||||||
for (let index in data.multiArray[1]) {
|
for (let index in data.multiArray[1]) {
|
||||||
const indexNumber = Number(index)
|
const indexNumber = Number(index)
|
||||||
if (indexNumber === data.multiIndex[1]) {
|
if (indexNumber === data.multiIndex[1]) {
|
||||||
data.multiArray[2] = this.state.formatInWindow[data.multiIndex[0]].children[indexNumber].children
|
data.multiArray[2] = this.state.interactionMultiArray[data.multiIndex[0]].children[indexNumber].children
|
||||||
data.multiArray[3] = this.state.formatInWindow[data.multiIndex[0]].children[indexNumber].children[0].children
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +230,7 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
for (let index in data.multiArray[2]) {
|
for (let index in data.multiArray[2]) {
|
||||||
const indexNumber = Number(index)
|
const indexNumber = Number(index)
|
||||||
if (indexNumber === data.multiIndex[2]) {
|
if (indexNumber === data.multiIndex[2]) {
|
||||||
data.multiArray[3] = this.state.formatInWindow[data.multiIndex[0]].children[data.multiIndex[1]].children[indexNumber].children
|
data.multiArray[3] = this.state.interactionMultiArray[data.multiIndex[0]].children[data.multiIndex[1]].children[indexNumber].children
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,20 +242,20 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
// case 0:
|
// case 0:
|
||||||
// switch (data.multiIndex[0]) { // 第一个index 是多少
|
// switch (data.multiIndex[0]) { // 第一个index 是多少
|
||||||
// case 0:
|
// case 0:
|
||||||
// data.multiArray[1] = this.state.formatInWindow[0].children
|
// data.multiArray[1] = this.state.interactionMultiArray[0].children
|
||||||
// data.multiArray[2]=this.state.formatInWindow[0].children[0].children
|
// data.multiArray[2]=this.state.interactionMultiArray[0].children[0].children
|
||||||
// break
|
// break
|
||||||
// case 1:
|
// case 1:
|
||||||
// data.multiArray[1] = this.state.formatInWindow[1].children
|
// data.multiArray[1] = this.state.interactionMultiArray[1].children
|
||||||
// break
|
// break
|
||||||
// case 2:
|
// case 2:
|
||||||
// data.multiArray[1] = this.state.formatInWindow[2].children
|
// data.multiArray[1] = this.state.interactionMultiArray[2].children
|
||||||
// break
|
// break
|
||||||
// case 3:
|
// case 3:
|
||||||
// data.multiArray[1] = this.state.formatInWindow[3].children
|
// data.multiArray[1] = this.state.interactionMultiArray[3].children
|
||||||
// break
|
// break
|
||||||
// case 4:
|
// case 4:
|
||||||
// data.multiArray[1] = this.state.formatInWindow[4].children
|
// data.multiArray[1] = this.state.interactionMultiArray[4].children
|
||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
// data.multiIndex[1] = 0
|
// data.multiIndex[1] = 0
|
||||||
@ -243,70 +270,70 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
// case 1:
|
// case 1:
|
||||||
// switch (data.multiIndex[1]) {
|
// switch (data.multiIndex[1]) {
|
||||||
// case 0:
|
// case 0:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[1].children[0].children
|
// data.multiArray[2] = this.state.interactionMultiArray[1].children[0].children
|
||||||
// break
|
// break
|
||||||
// case 1:
|
// case 1:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[1].children[1].children
|
// data.multiArray[2] = this.state.interactionMultiArray[1].children[1].children
|
||||||
// break
|
// break
|
||||||
// case 2:
|
// case 2:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[1].children[2].children
|
// data.multiArray[2] = this.state.interactionMultiArray[1].children[2].children
|
||||||
// break
|
// break
|
||||||
// case 3:
|
// case 3:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[1].children[3].children ? this.state.formatInWindow[1].children[3].children : [{ class_name: '' }]
|
// data.multiArray[2] = this.state.interactionMultiArray[1].children[3].children ? this.state.interactionMultiArray[1].children[3].children : [{ class_name: '' }]
|
||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
// break
|
// break
|
||||||
// case 2:
|
// case 2:
|
||||||
// switch (data.multiIndex[1]) {
|
// switch (data.multiIndex[1]) {
|
||||||
// case 0:
|
// case 0:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[2].children[0].children
|
// data.multiArray[2] = this.state.interactionMultiArray[2].children[0].children
|
||||||
// break
|
// break
|
||||||
// case 1:
|
// case 1:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[2].children[1].children
|
// data.multiArray[2] = this.state.interactionMultiArray[2].children[1].children
|
||||||
// break
|
// break
|
||||||
// case 2:
|
// case 2:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[2].children[2].children
|
// data.multiArray[2] = this.state.interactionMultiArray[2].children[2].children
|
||||||
// break
|
// break
|
||||||
// case 3:
|
// case 3:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[2].children[3].children
|
// data.multiArray[2] = this.state.interactionMultiArray[2].children[3].children
|
||||||
// break
|
// break
|
||||||
// case 4:
|
// case 4:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[2].children[4].children
|
// data.multiArray[2] = this.state.interactionMultiArray[2].children[4].children
|
||||||
// break
|
// break
|
||||||
// case 5:
|
// case 5:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[2].children[5].children
|
// data.multiArray[2] = this.state.interactionMultiArray[2].children[5].children
|
||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
// break
|
// break
|
||||||
// case 3:
|
// case 3:
|
||||||
// switch (data.multiIndex[1]) {
|
// switch (data.multiIndex[1]) {
|
||||||
// case 0:
|
// case 0:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[3].children[0].children
|
// data.multiArray[2] = this.state.interactionMultiArray[3].children[0].children
|
||||||
// break
|
// break
|
||||||
// case 1:
|
// case 1:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[3].children[1].children
|
// data.multiArray[2] = this.state.interactionMultiArray[3].children[1].children
|
||||||
// break
|
// break
|
||||||
// case 2:
|
// case 2:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[3].children[2].children
|
// data.multiArray[2] = this.state.interactionMultiArray[3].children[2].children
|
||||||
// break
|
// break
|
||||||
// case 3:
|
// case 3:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[3].children[3].children
|
// data.multiArray[2] = this.state.interactionMultiArray[3].children[3].children
|
||||||
// break
|
// break
|
||||||
// case 3:
|
// case 3:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[3].children[3].children
|
// data.multiArray[2] = this.state.interactionMultiArray[3].children[3].children
|
||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
// break
|
// break
|
||||||
// case 4:
|
// case 4:
|
||||||
// switch (data.multiIndex[1]) {
|
// switch (data.multiIndex[1]) {
|
||||||
// case 0:
|
// case 0:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[4].children[0].children
|
// data.multiArray[2] = this.state.interactionMultiArray[4].children[0].children
|
||||||
// break
|
// break
|
||||||
// case 1:
|
// case 1:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[4].children[1].children
|
// data.multiArray[2] = this.state.interactionMultiArray[4].children[1].children
|
||||||
// break
|
// break
|
||||||
// case 2:
|
// case 2:
|
||||||
// data.multiArray[2] = this.state.formatInWindow[4].children[2].children
|
// data.multiArray[2] = this.state.interactionMultiArray[4].children[2].children
|
||||||
// break
|
// break
|
||||||
|
|
||||||
// }
|
// }
|
||||||
@ -320,10 +347,7 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
this.setState({ multiIndex: data.multiIndex })
|
this.setState({ multiIndex: data.multiIndex })
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------结束-行业分类picker
|
|
||||||
passDataToParent(industryTypeSelected) {
|
|
||||||
this.props.onPassDataToChild(industryTypeSelected)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -344,12 +368,13 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
return (
|
return (
|
||||||
<View class='page-section'>
|
<View class='page-section'>
|
||||||
<Picker
|
<Picker
|
||||||
|
|
||||||
rangeKey='name'
|
rangeKey='name'
|
||||||
mode='multiSelector'
|
mode='multiSelector'
|
||||||
onChange={this.bindMultiPickerChange.bind(this)}
|
onChange={this.bindMultiPickerChange.bind(this)}
|
||||||
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.initailMultiArray}
|
||||||
>
|
>
|
||||||
<View class='picker type'>
|
<View class='picker type'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
@ -359,9 +384,9 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
{this.props.selectedValue.name}
|
{this.props.selectedValue.name}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{/* {this.state.objectMultiArray[0].length?<Text className='first-col'> {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}</Text>:null}
|
{/* {this.state.initailMultiArray[0].length?<Text className='first-col'> {this.state.initailMultiArray[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.initailMultiArray[1].length?<Text className='second-col'>{this.state.initailMultiArray[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.initailMultiArray[2].length?<Text className='third-col'>{this.state.initailMultiArray[2][this.state.multiIndex[2]].name}</Text>:null} */}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -55,7 +55,7 @@ class ShopItem extends Component {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View className='itemname-box'>
|
<View className='itemname-box'>
|
||||||
<View className='name'>{name}</View>
|
<Text className='name'>{name}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='addon-box'>
|
<View className='addon-box'>
|
||||||
|
@ -35,6 +35,9 @@
|
|||||||
.itemname-box{
|
.itemname-box{
|
||||||
border-bottom: 1px solid #DADADA;
|
border-bottom: 1px solid #DADADA;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
overflow:hidden;
|
||||||
|
white-space:nowrap;
|
||||||
|
margin:0 5%;
|
||||||
.name{
|
.name{
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
///---行业分类 开始
|
///---行业分类 开始
|
||||||
objectMultiArray: [[{}],[{name:'选择店铺分类',id:''}]],
|
objectMultiArray: [[{}], [{ name: '选择店铺分类', id: '' }]],
|
||||||
multiIndex: [0, 0],
|
multiIndex: [0, 0],
|
||||||
formatInWindow: [],
|
formatInWindow: [],
|
||||||
///---行业分类 结束
|
///---行业分类 结束
|
||||||
@ -42,7 +42,7 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('店铺分类目录', res)
|
console.log('店铺分类目录', res)
|
||||||
this.formatIndustryType(res.data.data)
|
this.formatIndustryType(res.data.data)
|
||||||
this.formatIndustTypeInit(res.data.data)
|
this.formatIndustTypeInit(res.data.data)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -70,8 +70,8 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
console.log('店铺分类数据问题')
|
console.log('店铺分类数据问题')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ formatInWindow: newIndustryType },()=>{
|
this.setState({ formatInWindow: newIndustryType }, () => {
|
||||||
console.log('滚动时的数据',this.state.formatInWindow)
|
console.log('滚动时的数据', this.state.formatInWindow)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//第二种format 用于底部弹层的初始化数据
|
//第二种format 用于底部弹层的初始化数据
|
||||||
@ -79,7 +79,6 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
const firstArray = []
|
const firstArray = []
|
||||||
const secondArray = []
|
const secondArray = []
|
||||||
if (Object.keys(data).length) {
|
if (Object.keys(data).length) {
|
||||||
|
|
||||||
for (let key in data) {
|
for (let key in data) {
|
||||||
firstArray.push({ name: data[key].n, id: '' })
|
firstArray.push({ name: data[key].n, id: '' })
|
||||||
if (data[key].c.length) {
|
if (data[key].c.length) {
|
||||||
@ -94,37 +93,33 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ objectMultiArray: [firstArray, secondArray] }, () => {
|
this.setState({ objectMultiArray: [firstArray, secondArray] }, () => {
|
||||||
// console.log('初始化数据', this.state.objectMultiArray)
|
// console.log('初始化数据', this.state.objectMultiArray)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
//--------------------开始-行业分类picker
|
//--------------------开始-行业分类picker
|
||||||
bindMultiPickerChange(e) {
|
bindMultiPickerChange(e) {
|
||||||
|
// console.log('picker发送选择改变,携带值为', e.detail.value)
|
||||||
|
|
||||||
// console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
multiIndex: e.detail.value,
|
multiIndex: e.detail.value,
|
||||||
}, () => {
|
}, () => {
|
||||||
//判断如果formatInWindow 的子类为空 那就取父类, 反之取子类
|
//判断如果formatInWindow 的子类为空 那就取父类, 反之取子类
|
||||||
let industryTypeSelected
|
let industryTypeSelected
|
||||||
if (this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]].id === '') {
|
if (this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]].id === '') {
|
||||||
industryTypeSelected = this.state.formatInWindow[e.detail.value[0]]
|
industryTypeSelected = this.state.formatInWindow[e.detail.value[0]]
|
||||||
} else {
|
} else {
|
||||||
industryTypeSelected = this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]]
|
industryTypeSelected = this.state.formatInWindow[e.detail.value[0]].child[e.detail.value[1]]
|
||||||
}
|
}
|
||||||
this.passDataToParent(industryTypeSelected)
|
this.passDataToParent(industryTypeSelected)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
bindMulPickerColChge(e) {
|
bindMulPickerColChge(e) {
|
||||||
//console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
|
||||||
const data = {
|
const data = {
|
||||||
objectMultiArray: this.state.objectMultiArray,
|
objectMultiArray: this.state.objectMultiArray,
|
||||||
multiIndex: this.state.multiIndex
|
multiIndex: this.state.multiIndex
|
||||||
}
|
}
|
||||||
// console.log(' this.state.formatInWindow', this.state.formatInWindow)
|
// console.log(' this.state.formatInWindow', this.state.formatInWindow)
|
||||||
data.multiIndex[e.detail.column] = e.detail.value
|
data.multiIndex[e.detail.column] = e.detail.value
|
||||||
|
|
||||||
switch (e.detail.column) {
|
switch (e.detail.column) {
|
||||||
@ -180,8 +175,8 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
break
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
// console.log(data.multiIndex)
|
// console.log(data.multiIndex)
|
||||||
// console.log('objectMultiArray', data.objectMultiArray)
|
// console.log('objectMultiArray', data.objectMultiArray)
|
||||||
this.setState({
|
this.setState({
|
||||||
multiIndex: data.multiIndex,
|
multiIndex: data.multiIndex,
|
||||||
objectMultiArray: data.objectMultiArray
|
objectMultiArray: data.objectMultiArray
|
||||||
@ -223,10 +218,10 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
>
|
>
|
||||||
<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'>
|
<Text className='first-col'>
|
||||||
{this.props.selectedValue.name}
|
{this.props.selectedValue.name}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -73,17 +73,22 @@ class AllDemanding extends Component {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_msg === 'success') {
|
||||||
if (res.data.supplys.length) {
|
if (res.data.supplys) {
|
||||||
if (this.state.isAddToList) {
|
if (this.state.isAddToList) {
|
||||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
||||||
} else {
|
} else {
|
||||||
this.setState({ supplys: res.data.supplys })
|
this.setState({ supplys: res.data.supplys })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
if (this.state.isAddToList) {
|
||||||
title: '没有更多了',
|
Taro.showToast({
|
||||||
icon: 'none'
|
title: '没有更多了',
|
||||||
})
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.setState({ supplys:[]})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -92,6 +97,7 @@ class AllDemanding extends Component {
|
|||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.setState({ isAddToList: false })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,8 +264,7 @@ class AllDemanding extends Component {
|
|||||||
text={this.state.grabOrderSuccess}
|
text={this.state.grabOrderSuccess}
|
||||||
duration={2000}
|
duration={2000}
|
||||||
></AtToast>
|
></AtToast>
|
||||||
|
const allDemandingElementArray = this.state.supplys.length ? this.state.supplys.map((item, index) => {
|
||||||
const allDemandingElementArray = this.state.supplys ? this.state.supplys.map((item, index) => {
|
|
||||||
return <View className='demanding-info' key={index}>
|
return <View className='demanding-info' key={index}>
|
||||||
<View className='header'>
|
<View className='header'>
|
||||||
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
|
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
|
||||||
@ -293,7 +298,7 @@ class AllDemanding extends Component {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
}) : null
|
}) : <View className='no_more_title'>没有更多了</View>
|
||||||
return (
|
return (
|
||||||
<View className='allDemanding'>
|
<View className='allDemanding'>
|
||||||
{/* 模态框 */}
|
{/* 模态框 */}
|
||||||
|
@ -32,6 +32,10 @@ class Home extends Component {
|
|||||||
userPhone: '',// 用户电话
|
userPhone: '',// 用户电话
|
||||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||||
loadMorePageIndex: 1,//下拉加载页面数
|
loadMorePageIndex: 1,//下拉加载页面数
|
||||||
|
isAddToList: false,
|
||||||
|
parentClass: '',// 大类的id
|
||||||
|
childClass: '-1',//小类的id
|
||||||
|
supplyLevel: 1,// 筛选1是小类或者2是大类
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +82,7 @@ class Home extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// api 得到推荐商店的信息
|
// api 得到推荐商店的信息
|
||||||
getShops({ parent_supply_class = 0, supply_class = '-1', supply_level = 1, curr_page = 1,
|
getShops({ parent_supply_class = this.state.parentClass, supply_class = this.state.childClass, supply_level = this.state.supplyLevel, curr_page = 1,
|
||||||
page_count = 5, action = "2" }) {
|
page_count = 5, action = "2" }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.ShopSupplyShops,
|
url: URL.ShopSupplyShops,
|
||||||
@ -100,74 +104,75 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('所有店铺的信息', res)
|
// console.log('所有店铺的信息', res)
|
||||||
|
|
||||||
|
console.log('我是res', res)
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_msg === 'success') {
|
||||||
if (res.data.shops.length) {
|
if (this.state.isAddToList) {
|
||||||
this.setState({ shops: this.state.shops.concat(res.data.shops) })
|
if (res.data.shops) {
|
||||||
|
this.setState({ shops: this.state.shops.concat(res.data.shops), isAddToList: false })
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: '没有更多了',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
res.data.shops ? this.setState({ shops: res.data.shops }) : this.setState({ shops: [] })
|
||||||
title: '没有更多了',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 1500
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setState({ isAddToList: false })
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
getShopsInfo({ parent_supply_class = 0, supply_class = '-1', supply_level = 1, curr_page = 1,
|
// getShops({ parent_supply_class = this.state.parentClass, supply_class = this.state.childClass, supply_level = 1, curr_page = 1,
|
||||||
page_count = 20, action = "2" }) {
|
// page_count = 20, action = "2" }) {
|
||||||
Taro.request({
|
// Taro.request({
|
||||||
url: URL.ShopSupplyShops,
|
// url: URL.ShopSupplyShops,
|
||||||
method: 'POST',
|
// method: 'POST',
|
||||||
dataType: 'json',
|
// dataType: 'json',
|
||||||
data: {
|
// data: {
|
||||||
param: JSON.stringify({
|
// param: JSON.stringify({
|
||||||
curr_page: curr_page,
|
// curr_page: curr_page,
|
||||||
page_count: page_count,
|
// page_count: page_count,
|
||||||
parent_supply_class: parent_supply_class, //父级class id
|
// parent_supply_class: parent_supply_class, //父级class id
|
||||||
supply_class: supply_class,// 子级class id
|
// supply_class: supply_class,// 子级class id
|
||||||
supply_level: supply_level,// 层级
|
// supply_level: supply_level,// 层级
|
||||||
action: action
|
// action: action
|
||||||
})
|
// })
|
||||||
},
|
// },
|
||||||
header: {
|
// header: {
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
// 'content-type': 'application/x-www-form-urlencoded',
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
.then(res => {
|
// .then(res => {
|
||||||
console.log('所有店铺的信息', res)
|
// console.log('所有店铺的信息', res)
|
||||||
Taro.hideLoading()
|
// Taro.hideLoading()
|
||||||
if (res.data.err_msg === 'success') {
|
// if (res.data.err_msg === 'success') {
|
||||||
|
|
||||||
this.setState({ shops: res.data.shops })
|
// this.setState({ shops: res.data.shops })
|
||||||
Taro.hideLoading()
|
// Taro.hideLoading()
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
Taro.showToast({
|
// Taro.showToast({
|
||||||
title: res.data.err_msg,
|
// title: res.data.err_msg,
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 1500
|
// duration: 1500
|
||||||
})
|
// })
|
||||||
|
// }
|
||||||
}
|
// }
|
||||||
|
// )
|
||||||
|
// }
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 异步函数登入api
|
// 异步函数登入api
|
||||||
async login() {
|
async login() {
|
||||||
@ -271,26 +276,31 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
// 点击大类icon
|
// 点击大类icon
|
||||||
onClickParentCate(item) {
|
onClickParentCate(item) {
|
||||||
const parentClass = item.parent_class_id
|
|
||||||
const childClass = item.class_id
|
|
||||||
this.setState({ subCate: item.children })
|
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
this.getShopsInfo({ parent_supply_class: parentClass, supply_class: childClass })
|
console.log('item', item)
|
||||||
|
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||||
|
console.log('parentClass', this.state.parentClass, this.state.childClass)
|
||||||
|
this.getShops({})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 点击子类
|
// 点击子类
|
||||||
onClickChildCate(item) {
|
onClickChildCate(item) {
|
||||||
const parentClass = item.parent_class_id
|
|
||||||
const childClass = item.class_id
|
|
||||||
// this.getShops(item.parent_class_id, item.class_id, 2)
|
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
this.getShopsInfo({ parent_supply_class: parentClass, supply_class: childClass, supply_level: 2 })
|
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||||
|
this.getShops({})
|
||||||
|
|
||||||
|
})
|
||||||
|
// this.getShops(item.parent_class_id, item.class_id, 2)
|
||||||
|
|
||||||
}
|
}
|
||||||
scrollToSubCate(item) {
|
scrollToSubCate(item) {
|
||||||
|
|
||||||
Taro.pageScrollTo({
|
Taro.pageScrollTo({
|
||||||
scrollTop: 410,
|
scrollTop: 410,
|
||||||
duration: 300
|
duration: 300
|
||||||
@ -375,16 +385,12 @@ class Home extends Component {
|
|||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||||
this.getShops({ curr_page: this.state.loadMorePageIndex })
|
this.getShops({ curr_page: this.state.loadMorePageIndex, })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
// 提示模态弹窗element
|
// 提示模态弹窗element
|
||||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||||
<AtModalHeader>提示</AtModalHeader>
|
<AtModalHeader>提示</AtModalHeader>
|
||||||
@ -446,21 +452,20 @@ class Home extends Component {
|
|||||||
<View>{item.class_name}</View>
|
<View>{item.class_name}</View>
|
||||||
</View>
|
</View>
|
||||||
}) : null
|
}) : null
|
||||||
const shopCollectionElementsArray = this.state.shops.map((item, index) => {
|
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
|
||||||
return <FilteredShopComponent
|
return <FilteredShopComponent
|
||||||
shop={item}
|
shop={item}
|
||||||
userName={this.state.userName}
|
userName={this.state.userName}
|
||||||
userPhone={this.state.userPhone}
|
userPhone={this.state.userPhone}
|
||||||
key={index}
|
key={index}
|
||||||
></FilteredShopComponent>
|
></FilteredShopComponent>
|
||||||
})
|
}) : <View className='no_more_title'> 没有更多了</View>
|
||||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||||
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
||||||
<View className='text'>{item.class_name}</View>
|
<View className='text'>{item.class_name}</View>
|
||||||
</SwiperItem>
|
</SwiperItem>
|
||||||
}) : null
|
}) : null
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='home'>
|
<View className='home'>
|
||||||
|
|
||||||
@ -574,6 +579,8 @@ class Home extends Component {
|
|||||||
|
|
||||||
<View className='shop-box'>
|
<View className='shop-box'>
|
||||||
{shopCollectionElementsArray}
|
{shopCollectionElementsArray}
|
||||||
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||||
|
|
||||||
|
@ -29,17 +29,17 @@ class Index extends Component {
|
|||||||
//http://ihome6.com/Shop-supplyShops
|
//http://ihome6.com/Shop-supplyShops
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
// url: '/pages/myGoodList/myGoodList'
|
// url: '/pages/myGoodList/myGoodList'
|
||||||
// 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/myGoodList/myGoodList'
|
// url:'/pages/myGoodList/myGoodList'
|
||||||
// url:'/pages/myNeeds/myNeeds',
|
// url:'/pages/myNeeds/myNeeds',
|
||||||
//url:'/pages/myNeedsPublish/myNeedsPublish'
|
//url:'/pages/myNeedsPublish/myNeedsPublish'
|
||||||
// url:'/pages/mySupplyDemand/mySupplyDemand'
|
// url:'/pages/mySupplyDemand/mySupplyDemand'
|
||||||
url:'/pages/home/home'
|
url: '/pages/home/home'
|
||||||
// url:'/pages/allDemanding/allDemanding'
|
// url:'/pages/allDemanding/allDemanding'
|
||||||
// url:'/pages/goodsPublish/goodsPublish'
|
// url:'/pages/goodsPublish/goodsPublish'
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -150,9 +150,10 @@ $themeColor:#FF7142;
|
|||||||
}
|
}
|
||||||
.img-box{
|
.img-box{
|
||||||
flex:1;
|
flex:1;
|
||||||
height:80%;
|
height:45%;
|
||||||
width:100%;
|
width:100%;
|
||||||
margin: 0 2%;
|
margin: 0 2%;
|
||||||
|
border: 2px solid #ddd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,11 +6,8 @@ import URL from '../../serviceAPI.config'
|
|||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
|
|
||||||
|
|
||||||
import './myNeeds.scss'
|
import './myNeeds.scss'
|
||||||
|
|
||||||
|
|
||||||
class MyNeeds extends Component {
|
class MyNeeds extends Component {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -37,10 +34,10 @@ class MyNeeds extends Component {
|
|||||||
totalNeeds: 0,// 我的需求数量
|
totalNeeds: 0,// 我的需求数量
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
needsItem: '',// 确认框提示时 使用的供求名
|
needsItem: '',// 确认框提示时 使用的供求名
|
||||||
isDeleteModal:false,// 删除提示框
|
isDeleteModal: false,// 删除提示框
|
||||||
isAddToList: false,// 请求需求的时候是否添加到旧列表里
|
isAddToList: false,// 请求需求的时候是否添加到旧列表里
|
||||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||||
loadMorePageIndex:1,// 上拉加载页面数
|
loadMorePageIndex: 1,// 上拉加载页面数
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,24 +54,28 @@ class MyNeeds extends Component {
|
|||||||
state = this.state.needsStateSelected.id
|
state = this.state.needsStateSelected.id
|
||||||
}) {
|
}) {
|
||||||
//由于后台返回的问题, 所有当state为空的时候不传state,反之传state
|
//由于后台返回的问题, 所有当state为空的时候不传state,反之传state
|
||||||
const param=state?{param: JSON.stringify({
|
const param = state ? {
|
||||||
curr_page: curr_page,
|
param: JSON.stringify({
|
||||||
page_count: page_count,
|
curr_page: curr_page,
|
||||||
sd_type: sd_type,
|
page_count: page_count,
|
||||||
sd_title: sd_title,
|
sd_type: sd_type,
|
||||||
update_dateL: update_dateL,
|
sd_title: sd_title,
|
||||||
update_dateU: update_dateU,
|
update_dateL: update_dateL,
|
||||||
class_id: class_id,
|
update_dateU: update_dateU,
|
||||||
state: state
|
class_id: class_id,
|
||||||
})}:{param: JSON.stringify({
|
state: state
|
||||||
curr_page: curr_page,
|
})
|
||||||
page_count: page_count,
|
} : {
|
||||||
sd_type: sd_type,
|
param: JSON.stringify({
|
||||||
sd_title: sd_title,
|
curr_page: curr_page,
|
||||||
update_dateL: update_dateL,
|
page_count: page_count,
|
||||||
update_dateU: update_dateU,
|
sd_type: sd_type,
|
||||||
class_id: class_id,
|
sd_title: sd_title,
|
||||||
})}
|
update_dateL: update_dateL,
|
||||||
|
update_dateU: update_dateU,
|
||||||
|
class_id: class_id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.GetMyNeedsList,
|
url: URL.GetMyNeedsList,
|
||||||
@ -90,36 +91,37 @@ class MyNeeds extends Component {
|
|||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
console.log('我的需求列表', res)
|
console.log('我的需求列表', res)
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_msg === "success") {
|
||||||
if(res.data.supplys.length){
|
if (res.data.supplys) { // 查看res.data 里面是否有supplys 这个key
|
||||||
|
if (this.state.isAddToList) { // 如果是上拉
|
||||||
|
this.setState({
|
||||||
|
allNeedsList: this.state.allNeedsList.concat(res.data.supplys)
|
||||||
|
}, () => {
|
||||||
|
this.setState({ isAddToList: false })
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.setState({ isAddToList: false })
|
||||||
|
this.setState({
|
||||||
|
allNeedsList: res.data.supplys,
|
||||||
|
totalNeeds:Number(res.data.count)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if(this.state.isAddToList){
|
if(this.state.isAddToList){
|
||||||
this.setState({
|
this.setState({ isAddToList: false })
|
||||||
allNeedsList:this.state.allNeedsList.concat(res.data.supplys)
|
Taro.showToast({
|
||||||
},()=>{
|
title: '没有更多了',
|
||||||
this.setState({isAddToList:false})
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
this.setState({isAddToList:false})
|
this.setState({allNeedsList:[],totalNeeds:0})
|
||||||
this.setState({
|
|
||||||
allNeedsList: res.data.supplys || [],
|
|
||||||
totalNeeds: Number(res.data.count)
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
this.setState({isAddToList:false})
|
|
||||||
Taro.showToast({
|
|
||||||
title: '没有更多了',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.data.err_msg,
|
title: res.data.err_msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -169,7 +171,7 @@ class MyNeeds extends Component {
|
|||||||
// 搜索按钮
|
// 搜索按钮
|
||||||
onSearchButtonHandler() {
|
onSearchButtonHandler() {
|
||||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||||
this.setState({ currentPage: 1,loadMorePageIndex:1 },()=>{
|
this.setState({ currentPage: 1, loadMorePageIndex: 1 }, () => {
|
||||||
this.getMyNeedsList({
|
this.getMyNeedsList({
|
||||||
curr_page: this.state.currentPage,
|
curr_page: this.state.currentPage,
|
||||||
page_count: this.state.pageCount,
|
page_count: this.state.pageCount,
|
||||||
@ -177,7 +179,7 @@ class MyNeeds extends Component {
|
|||||||
sd_title: this.state.title,
|
sd_title: this.state.title,
|
||||||
update_dateL: this.state.startDateSel,
|
update_dateL: this.state.startDateSel,
|
||||||
update_dateU: this.state.endDateSel,
|
update_dateU: this.state.endDateSel,
|
||||||
class_id: this.state.industryTypeSelected.id==='-1'?'':this.state.industryTypeSelected.id,
|
class_id: this.state.industryTypeSelected.id === '-1' ? '' : this.state.industryTypeSelected.id,
|
||||||
state: this.state.needsStateSelected.id
|
state: this.state.needsStateSelected.id
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -196,23 +198,23 @@ class MyNeeds extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
//清空筛选项
|
//清空筛选项
|
||||||
emptyFilter(){
|
emptyFilter() {
|
||||||
this.setState({
|
this.setState({
|
||||||
title:'',
|
title: '',
|
||||||
endDateSel:'',
|
endDateSel: '',
|
||||||
startDateSel:'',
|
startDateSel: '',
|
||||||
industryTypeSelected: { name: '全部', id: '' },
|
industryTypeSelected: { name: '全部', id: '' },
|
||||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||||
needsStateSelected: { name: '全部', id: '' },
|
needsStateSelected: { name: '全部', id: '' },
|
||||||
currentPage:1,
|
currentPage: 1,
|
||||||
loadMorePageIndex:1,
|
loadMorePageIndex: 1,
|
||||||
},()=>{
|
}, () => {
|
||||||
this.getMyNeedsList({})
|
this.getMyNeedsList({})
|
||||||
})
|
})
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title:'已清空',
|
title: '已清空',
|
||||||
icon:'success',
|
icon: 'success',
|
||||||
duration:1000
|
duration: 1000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
titleChange(event) {
|
titleChange(event) {
|
||||||
@ -243,22 +245,22 @@ class MyNeeds extends Component {
|
|||||||
}
|
}
|
||||||
goToMyNeedsViewPage(id) {
|
goToMyNeedsViewPage(id) {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/myNeedsView/myNeedsView?id='+id
|
url: '/pages/myNeedsView/myNeedsView?id=' + id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
goToMyNeedsEditPage(id) {
|
goToMyNeedsEditPage(id) {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/myNeedsEdit/myNeedsEdit?id='+id
|
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
deleteButton(item) {
|
deleteButton(item) {
|
||||||
this.setState({isDeleteModal:true,needsItem:item})
|
this.setState({ isDeleteModal: true, needsItem: item })
|
||||||
}
|
}
|
||||||
handleWindowModCancel(){
|
handleWindowModCancel() {
|
||||||
this.setState({isDeleteModal:false})
|
this.setState({ isDeleteModal: false })
|
||||||
}
|
}
|
||||||
handleWindowConfirm(){
|
handleWindowConfirm() {
|
||||||
this.setState({isDeleteModal:false})
|
this.setState({ isDeleteModal: false })
|
||||||
this.deleteMyNeeds({ demandId: this.state.needsItem.sd_id })
|
this.deleteMyNeeds({ demandId: this.state.needsItem.sd_id })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +270,7 @@ class MyNeeds extends Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title:'加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
this.getMyNeedsList({})
|
this.getMyNeedsList({})
|
||||||
|
|
||||||
@ -283,30 +285,30 @@ class MyNeeds extends Component {
|
|||||||
|
|
||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
// 页面位置
|
// 页面位置
|
||||||
onPageScroll(location) {
|
onPageScroll(location) {
|
||||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||||
this.setState({ isShowTopNav: false })
|
this.setState({ isShowTopNav: false })
|
||||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||||
this.setState({ isShowTopNav: true })
|
this.setState({ isShowTopNav: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// 底部加载
|
||||||
// 底部加载
|
onReachBottom() {
|
||||||
onReachBottom() {
|
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
|
|
||||||
this.setState({ isAddToList: true,loadMorePageIndex:this.state.loadMorePageIndex+1 }, () => {
|
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||||
this.getMyNeedsList({ curr_page: this.state.loadMorePageIndex })
|
this.getMyNeedsList({ curr_page: this.state.loadMorePageIndex })
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getDataFromChild(value){
|
getDataFromChild(value) {
|
||||||
console.log('从子组件传回来的值',value)
|
console.log('从子组件传回来的值', value)
|
||||||
this.setState({industryTypeSelected:value})
|
this.setState({ industryTypeSelected: value })
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const myNeedsListArrayElement = this.state.allNeedsList.map((item, index) => {
|
const myNeedsListArrayElement = this.state.allNeedsList.map((item, index) => {
|
||||||
@ -318,7 +320,7 @@ class MyNeeds extends Component {
|
|||||||
</View>
|
</View>
|
||||||
<View className='needs-title box'>
|
<View className='needs-title box'>
|
||||||
<Text className='title'>需求标题:</Text>
|
<Text className='title'>需求标题:</Text>
|
||||||
<Text className='content' onClick={this.state.goToMyNeedsViewPage.bind(this,item.sd_id)}>{item.sd_title}</Text>
|
<Text className='content' onClick={this.state.goToMyNeedsViewPage.bind(this, item.sd_id)}>{item.sd_title}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='needs-state box'>
|
<View className='needs-state box'>
|
||||||
<Text className='title'>需求状态:</Text>
|
<Text className='title'>需求状态:</Text>
|
||||||
@ -328,32 +330,32 @@ class MyNeeds extends Component {
|
|||||||
<Text className='title'>更新时间:</Text>
|
<Text className='title'>更新时间:</Text>
|
||||||
<Text className='content'>{item.update_date}</Text>
|
<Text className='content'>{item.update_date}</Text>
|
||||||
</View>
|
</View>
|
||||||
{item.state === '0'||item.state === '1' ? <View className='info-button-box'>
|
{item.state === '0' || item.state === '1' ? <View className='info-button-box'>
|
||||||
<View className='button' onClick={this.goToMyNeedsViewPage.bind(this, item.sd_id)}>
|
<View className='button' onClick={this.goToMyNeedsViewPage.bind(this, item.sd_id)}>
|
||||||
<Button size='mini' className='button-orange button-no-margin'>查看</Button>
|
<Button size='mini' className='button-orange button-no-margin'>查看</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className='button' onClick={this.goToMyNeedsEditPage.bind(this, item.sd_id)}>
|
<View className='button' onClick={this.goToMyNeedsEditPage.bind(this, item.sd_id)}>
|
||||||
<Button size='mini' className='button-orange button-no-margin'>编辑</Button>
|
<Button size='mini' className='button-orange button-no-margin'>编辑</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className='button' onClick={this.deleteButton.bind(this, item)}>
|
<View className='button' onClick={this.deleteButton.bind(this, item)}>
|
||||||
<Button size='mini' className='button-dark-red button-no-margin' >删除</Button>
|
<Button size='mini' className='button-dark-red button-no-margin' >删除</Button>
|
||||||
</View>
|
</View>
|
||||||
</View > : <View className='info-button-box'>
|
</View > : <View className='info-button-box'>
|
||||||
<View className='button' onClick={this.goToMyNeedsViewPage.bind(this, item.sd_id)}>
|
<View className='button' onClick={this.goToMyNeedsViewPage.bind(this, item.sd_id)}>
|
||||||
<Button size='mini' className='button-orange button-no-margin'>查看</Button>
|
<Button size='mini' className='button-orange button-no-margin'>查看</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
})
|
})
|
||||||
const deleteModalWindowElement= <AtModal isOpened={this.state.isDeleteModal}>
|
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
|
||||||
<AtModalHeader>提示</AtModalHeader>
|
<AtModalHeader>提示</AtModalHeader>
|
||||||
<AtModalContent>
|
<AtModalContent>
|
||||||
确认删除{this.state.needsItem.sd_title}?
|
确认删除{this.state.needsItem.sd_title}?
|
||||||
</AtModalContent>
|
</AtModalContent>
|
||||||
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}>确定</Button> </AtModalAction>
|
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
</AtModal>
|
</AtModal>
|
||||||
return (
|
return (
|
||||||
<View className='myNeeds'>
|
<View className='myNeeds'>
|
||||||
{/* 删除模态框 */}
|
{/* 删除模态框 */}
|
||||||
@ -375,7 +377,7 @@ class MyNeeds extends Component {
|
|||||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
开始日期:<Text className='selected date'>{this.state.startDateSel}</Text>
|
开始日期:<Text className='selected date'>{this.state.startDateSel}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@ -391,7 +393,7 @@ class MyNeeds extends Component {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{/* 行业分类开始 */}
|
{/* 行业分类开始 */}
|
||||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
||||||
{/* 行业分类结束 */}
|
{/* 行业分类结束 */}
|
||||||
{/* 需求类型 */}
|
{/* 需求类型 */}
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
@ -424,17 +426,17 @@ class MyNeeds extends Component {
|
|||||||
|
|
||||||
<View className='button-box'>
|
<View className='button-box'>
|
||||||
<View className='button' onClick={this.onSearchButtonHandler.bind(this)}>
|
<View className='button' onClick={this.onSearchButtonHandler.bind(this)}>
|
||||||
<Button size='mini' className='button-orange'>
|
<Button size='mini' className='button-orange'>
|
||||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||||
搜索</Button>
|
搜索</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className='button' onClick={this.addNeeds.bind(this)}>
|
<View className='button' onClick={this.addNeeds.bind(this)}>
|
||||||
<Button size='mini' className='button-green'>
|
<Button size='mini' className='button-green'>
|
||||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||||
新增</Button>
|
新增</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
||||||
<Button size='mini' className='button-dark-red'>
|
<Button size='mini' className='button-dark-red'>
|
||||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||||
清空</Button>
|
清空</Button>
|
||||||
</View>
|
</View>
|
||||||
@ -443,11 +445,11 @@ class MyNeeds extends Component {
|
|||||||
共<Text className='count'>{this.state.totalNeeds}</Text> 条记录
|
共<Text className='count'>{this.state.totalNeeds}</Text> 条记录
|
||||||
</View>
|
</View>
|
||||||
{/* 我的需求信息 */}
|
{/* 我的需求信息 */}
|
||||||
{ <View className='info-box'>
|
{<View className='info-box'>
|
||||||
{myNeedsListArrayElement}
|
{this.state.allNeedsList.length?myNeedsListArrayElement:<View>没有更多了</View>}
|
||||||
</View>}
|
</View>}
|
||||||
|
|
||||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||||
|
|
||||||
<CopyrightComponent ></CopyrightComponent>
|
<CopyrightComponent ></CopyrightComponent>
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ class MySupplyDemand extends Component {
|
|||||||
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
}) : <View className='title' >
|
}) : <View className='no_more_title' >
|
||||||
没有更多了....
|
没有更多了....
|
||||||
</View >
|
</View >
|
||||||
return (
|
return (
|
||||||
|
@ -125,11 +125,7 @@ $themeColor:#FF7142;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.title{
|
|
||||||
text-align: center;
|
|
||||||
font-size: 25rpx;
|
|
||||||
|
|
||||||
}
|
|
||||||
.pagination-box{
|
.pagination-box{
|
||||||
margin: 50px 0;
|
margin: 50px 0;
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ import { View, Button, Text, Image, Map } from '@tarojs/components'
|
|||||||
import { AtTag, AtIcon, } from 'taro-ui'
|
import { AtTag, AtIcon, } from 'taro-ui'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
|
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
||||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||||
|
|
||||||
import './shop.scss'
|
import './shop.scss'
|
||||||
@ -53,7 +54,7 @@ class Shop extends Component {
|
|||||||
widthType: [],// 侧边宽度类型
|
widthType: [],// 侧边宽度类型
|
||||||
checkedFilterIdList: [],//已选的筛选id
|
checkedFilterIdList: [],//已选的筛选id
|
||||||
isAddToList: false,// 请求店铺商品的时候是否添加到旧列表里
|
isAddToList: false,// 请求店铺商品的时候是否添加到旧列表里
|
||||||
loadMorePageIndex:1,//上拉加载页面数
|
loadMorePageIndex: 1,//上拉加载页面数
|
||||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||||
|
|
||||||
// 下面是函数的默认参数
|
// 下面是函数的默认参数
|
||||||
@ -254,13 +255,13 @@ class Shop extends Component {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.setState({ isAddToList: false })
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// api 得到店铺详情请求
|
// api 得到店铺详情请求
|
||||||
getShopDescription({ shopID = 808 }) {
|
getShopDescription({ shopID = this.state.shop_id }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.ShopDescription,
|
url: URL.ShopDescription,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -292,7 +293,7 @@ class Shop extends Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
// api 获取店铺内的店铺分类请求 GetShopCategoryList
|
// api 获取店铺内的店铺分类请求 GetShopCategoryList
|
||||||
getShopInnerCate({ id = 808 }) {
|
getShopInnerCate({ id = this.state.shop_id }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.GetShopCategoryList,
|
url: URL.GetShopCategoryList,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -483,7 +484,7 @@ class Shop extends Component {
|
|||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
this.setState({ mainType: newMainType, loadMorePageIndex:1,goodType: newGoodType, widthType: newWidthType, otherType: newOtherType }, () => {
|
this.setState({ mainType: newMainType, loadMorePageIndex: 1, goodType: newGoodType, widthType: newWidthType, otherType: newOtherType }, () => {
|
||||||
// console.log(this.state.mainType)
|
// console.log(this.state.mainType)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -524,7 +525,6 @@ class Shop extends Component {
|
|||||||
checkedFilterIdList: [], curr_page: 1,
|
checkedFilterIdList: [], curr_page: 1,
|
||||||
page_count: 10,
|
page_count: 10,
|
||||||
shop_name: false,
|
shop_name: false,
|
||||||
shop_id: 1305,
|
|
||||||
config_id: 4,
|
config_id: 4,
|
||||||
shop_class_id: '',
|
shop_class_id: '',
|
||||||
order: '',
|
order: '',
|
||||||
@ -554,11 +554,10 @@ class Shop extends Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
Taro.showLoading({ title: '加载中' })
|
Taro.showLoading({ title: '加载中' })
|
||||||
//页面加载之后 得到指定店铺的商品 和 筛选标签
|
//页面加载之后 得到指定店铺的商品 和 筛选标签
|
||||||
this.goodsSearch({ shop_id: this.$router.params.id }) // 加载店铺商品
|
this.goodsSearch({}) // 加载店铺商品
|
||||||
this.getSearchParams({})// 加载筛选项
|
this.getSearchParams({})// 加载筛选项
|
||||||
this.getShopDescription({ shopID: this.$router.params.id }) // 加载店铺说明
|
this.getShopDescription({}) // 加载店铺说明
|
||||||
// this.getSearchBarkeyWords()
|
this.getShopInnerCate({})
|
||||||
this.getShopInnerCate({ id: this.$router.params.id })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidShow() { }
|
componentDidShow() { }
|
||||||
@ -570,20 +569,19 @@ class Shop extends Component {
|
|||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
})
|
||||||
|
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||||
this.setState({ isAddToList: true,loadMorePageIndex:this.state.loadMorePageIndex }, () => {
|
|
||||||
this.goodsSearch({ curr_page: this.state.loadMorePageIndex })
|
this.goodsSearch({ curr_page: this.state.loadMorePageIndex })
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
// 页面位置
|
// 页面位置
|
||||||
onPageScroll(location) {
|
onPageScroll(location) {
|
||||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||||
this.setState({ isShowTopNav: false })
|
this.setState({ isShowTopNav: false })
|
||||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||||
this.setState({ isShowTopNav: true })
|
this.setState({ isShowTopNav: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
render() {
|
render() {
|
||||||
const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => {
|
const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => {
|
||||||
return <View key={index} className='shop-item' >
|
return <View key={index} className='shop-item' >
|
||||||
@ -763,8 +761,13 @@ class Shop extends Component {
|
|||||||
<View className='shop-name'>{this.state.shopName}</View>
|
<View className='shop-name'>{this.state.shopName}</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='nav-box'>
|
<View className='nav-box'>
|
||||||
|
|
||||||
<View className='nav'>
|
<View className='nav'>
|
||||||
<View className='shop-cate' onClick={this.isShowShopAllCate.bind(this)}>
|
<View className='shop-cate' onClick={this.isShowShopAllCate.bind(this)}>
|
||||||
|
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||||
|
selectedValue={this.state.shopTypeSelected}
|
||||||
|
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||||
|
></ShopTypeInteractionComp>
|
||||||
<Text className='text'>
|
<Text className='text'>
|
||||||
店铺全部分类
|
店铺全部分类
|
||||||
</Text>
|
</Text>
|
||||||
|
Loading…
Reference in New Issue
Block a user