四级联动,上拉加载
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.state.interactionMultiArray)
|
||||||
|
console.log('初始化数据', this.state.initailMultiArray)
|
||||||
|
|
||||||
}) // 用递归来整理无限层次的数据
|
}) // 用递归来整理无限层次的数据
|
||||||
// console.log(this.recursion(res.data.data))
|
|
||||||
// this.setState({objectMultiArray:res.data.data})
|
|
||||||
} else {
|
} else {
|
||||||
console.log('商品分类请求没有成功', res)
|
console.log('商品分类请求没有成功', res)
|
||||||
}
|
}
|
||||||
@ -96,8 +100,8 @@ 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 用于底部弹层的初始化数据
|
||||||
@ -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;
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
@ -100,10 +99,7 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
}
|
}
|
||||||
//--------------------开始-行业分类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,
|
||||||
}, () => {
|
}, () => {
|
||||||
@ -119,7 +115,6 @@ class ShopTypeInteractionComp extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
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
|
||||||
|
@ -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 {
|
||||||
|
if (this.state.isAddToList) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '没有更多了',
|
title: '没有更多了',
|
||||||
icon: 'none'
|
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,11 +104,14 @@ 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 {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '没有更多了',
|
title: '没有更多了',
|
||||||
@ -112,62 +119,60 @@ class Home extends Component {
|
|||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
res.data.shops ? this.setState({ shops: res.data.shops }) : this.setState({ shops: [] })
|
||||||
|
}
|
||||||
} 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}
|
||||||
|
|
||||||
|
@ -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 = {
|
||||||
@ -57,7 +54,8 @@ 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 ? {
|
||||||
|
param: JSON.stringify({
|
||||||
curr_page: curr_page,
|
curr_page: curr_page,
|
||||||
page_count: page_count,
|
page_count: page_count,
|
||||||
sd_type: sd_type,
|
sd_type: sd_type,
|
||||||
@ -66,7 +64,9 @@ class MyNeeds extends Component {
|
|||||||
update_dateU: update_dateU,
|
update_dateU: update_dateU,
|
||||||
class_id: class_id,
|
class_id: class_id,
|
||||||
state: state
|
state: state
|
||||||
})}:{param: JSON.stringify({
|
})
|
||||||
|
} : {
|
||||||
|
param: JSON.stringify({
|
||||||
curr_page: curr_page,
|
curr_page: curr_page,
|
||||||
page_count: page_count,
|
page_count: page_count,
|
||||||
sd_type: sd_type,
|
sd_type: sd_type,
|
||||||
@ -74,7 +74,8 @@ class MyNeeds extends Component {
|
|||||||
update_dateL: update_dateL,
|
update_dateL: update_dateL,
|
||||||
update_dateU: update_dateU,
|
update_dateU: update_dateU,
|
||||||
class_id: class_id,
|
class_id: class_id,
|
||||||
})}
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.GetMyNeedsList,
|
url: URL.GetMyNeedsList,
|
||||||
@ -90,30 +91,31 @@ 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){
|
if (this.state.isAddToList) { // 如果是上拉
|
||||||
this.setState({
|
this.setState({
|
||||||
allNeedsList: this.state.allNeedsList.concat(res.data.supplys)
|
allNeedsList: this.state.allNeedsList.concat(res.data.supplys)
|
||||||
}, () => {
|
}, () => {
|
||||||
this.setState({ isAddToList: false })
|
this.setState({ isAddToList: false })
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.setState({ isAddToList: false })
|
this.setState({ isAddToList: false })
|
||||||
this.setState({
|
this.setState({
|
||||||
allNeedsList: res.data.supplys || [],
|
allNeedsList: res.data.supplys,
|
||||||
totalNeeds:Number(res.data.count)
|
totalNeeds:Number(res.data.count)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if(this.state.isAddToList){
|
||||||
this.setState({ isAddToList: false })
|
this.setState({ isAddToList: false })
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '没有更多了',
|
title: '没有更多了',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
this.setState({allNeedsList:[],totalNeeds:0})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@ -444,7 +446,7 @@ class MyNeeds extends Component {
|
|||||||
</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}
|
||||||
|
@ -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'
|
||||||
@ -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',
|
||||||
@ -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,8 +569,7 @@ 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 })
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -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