商品分类递归
This commit is contained in:
parent
156abaf917
commit
401e237358
@ -122,19 +122,18 @@ class VoucherPoster extends Component {
|
|||||||
<View className='modal myModal' style={this.props.isVoucherPoster ? 'display:block' : 'display:none'}>
|
<View className='modal myModal' style={this.props.isVoucherPoster ? 'display:block' : 'display:none'}>
|
||||||
<View className='modal-content' >
|
<View className='modal-content' >
|
||||||
<View className=' absolute container' style={this.state.voucherPosterImage} >
|
<View className=' absolute container' style={this.state.voucherPosterImage} >
|
||||||
<View className='close-icon ' onClick={this.passDataToParent.bind(this)}>
|
<View className='close-icon' onClick={this.passDataToParent.bind(this)}>
|
||||||
<AtIcon value='close-circle' size='30' color='#3F536E'></AtIcon>
|
<AtIcon value='close-circle' size='30' color='#3F536E'></AtIcon>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='voucher-left '>
|
<View className='voucher-left'>
|
||||||
当前优惠卷<Text class='left-amount'>{this.props.voucherLeft}</Text>张
|
当前优惠卷<Text class='left-amount'>{this.props.voucherLeft}</Text>张
|
||||||
</View>
|
</View>
|
||||||
<View className='input-name ' >
|
<View className='input-name' >
|
||||||
|
|
||||||
<View className='title'> <Text>联系人:</Text></View>
|
<View className='title'> <Text>联系人:</Text></View>
|
||||||
<Input class='input-info' type='text' value={this.state.voucherName} onInput={this.handleNameChange.bind(this)} />
|
<Input class='input-info' type='text' value={this.state.voucherName} onInput={this.handleNameChange.bind(this)} />
|
||||||
</View>
|
</View>
|
||||||
<View className='input-number ' >
|
<View className='input-number' >
|
||||||
|
|
||||||
<View className='title'> <Text>联系电话:</Text></View>
|
<View className='title'> <Text>联系电话:</Text></View>
|
||||||
<Input class='input-info' type='text' maxLength='11' value={this.state.voucherPhone} onInput={this.handlePhoneChange.bind(this)} />
|
<Input class='input-info' type='text' maxLength='11' value={this.state.voucherPhone} onInput={this.handlePhoneChange.bind(this)} />
|
||||||
@ -149,10 +148,10 @@ class VoucherPoster extends Component {
|
|||||||
{this.props.voucherResponseMsg}
|
{this.props.voucherResponseMsg}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='button ' >
|
<View className='button' >
|
||||||
<Button size='default' className='button-orange' onClick={this.voucherModalConfirm.bind(this)}>预约领取</Button>
|
<Button size='default' className='button-orange' onClick={this.voucherModalConfirm.bind(this)}>预约领取</Button>
|
||||||
</View>
|
</View>
|
||||||
<View className='declare '>
|
<View className='declare'>
|
||||||
|
|
||||||
<Text className='title'>领取须知:</Text>
|
<Text className='title'>领取须知:</Text>
|
||||||
|
|
||||||
|
@ -56,26 +56,26 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
|||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// .input-name,.input-number{
|
.input-name,.input-number{
|
||||||
// margin-top:2%;
|
margin-top:2%;
|
||||||
// margin-left:10%;
|
margin-left:10%;
|
||||||
|
|
||||||
// overflow: hidden;
|
overflow: hidden;
|
||||||
// width: 80%;
|
width: 80%;
|
||||||
|
|
||||||
// border-radius:50rpx;
|
border-radius:50rpx;
|
||||||
// background-color: white;
|
background-color: white;
|
||||||
|
|
||||||
// height:80px;
|
height:80px;
|
||||||
// font-size:25px;
|
font-size:25px;
|
||||||
// display:flex;
|
display:flex;
|
||||||
// align-items:center;
|
align-items:center;
|
||||||
// .title{
|
.title{
|
||||||
// margin-left:7%;
|
margin-left:7%;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
.tips{
|
.tips{
|
||||||
|
@ -7,6 +7,7 @@ import { Picker } from 'taro-ui'
|
|||||||
|
|
||||||
import './goodsTypeInteractionComp.scss'
|
import './goodsTypeInteractionComp.scss'
|
||||||
|
|
||||||
|
|
||||||
class GoodsTypeInteractionComp extends Component {
|
class GoodsTypeInteractionComp extends Component {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -17,9 +18,10 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
///---行业分类 开始
|
///---行业分类 开始
|
||||||
objectMultiArray: [[{name:'选择商品分类',id:''}],[],[]],
|
objectMultiArray: [[{ class_name: '选择商品分类', class_id: '' }], [], []],
|
||||||
multiIndex: [0, 0, 0],
|
multiIndex: [0, 0, 0, 0],
|
||||||
formatInWindow: [],
|
formatInWindow: [],
|
||||||
|
|
||||||
///---行业分类 结束
|
///---行业分类 结束
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,8 +41,15 @@ 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.formatIndustryType(res.data.data)
|
||||||
this.formatIndustTypeInit(res.data.data)
|
this.formatIndustTypeInit(res.data.data)
|
||||||
|
this.setState({
|
||||||
|
formatInWindow: this.recursion(res.data.data).multiObject,
|
||||||
|
DataDepth:this.recursion(res.data.data).depth },()=>{
|
||||||
|
console.log('depth',this.state.DataDepth)
|
||||||
|
}) // 用递归来整理无限层次的数据
|
||||||
|
// console.log(this.recursion(res.data.data))
|
||||||
|
// this.setState({objectMultiArray:res.data.data})
|
||||||
} else {
|
} else {
|
||||||
console.log('商品分类请求没有成功', res)
|
console.log('商品分类请求没有成功', res)
|
||||||
}
|
}
|
||||||
@ -50,6 +59,9 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
console.log('商品分类请求错误', error)
|
console.log('商品分类请求错误', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 第一种formate 用于底部弹层滚动时的数据
|
// 第一种formate 用于底部弹层滚动时的数据
|
||||||
formatIndustryType(data) {
|
formatIndustryType(data) {
|
||||||
const newIndustryType = []
|
const newIndustryType = []
|
||||||
@ -62,7 +74,15 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
outterObject.children.push(middleObject)
|
outterObject.children.push(middleObject)
|
||||||
if (middler.children) {
|
if (middler.children) {
|
||||||
for (let inner of middler.children) {
|
for (let inner of middler.children) {
|
||||||
middleObject.children.push({ name: inner.class_name, id: inner.class_id })
|
const innerObject = { name: inner.class_name, id: inner.class_id, children: [] }
|
||||||
|
middleObject.children.push(innerObject)
|
||||||
|
if (inner.children) {
|
||||||
|
for (let final of inner.children) {
|
||||||
|
innerObject.children.push({ name: final.class_name, id: final.class_id })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
innerObject.children.push({ name: '', id: '' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
middleObject.children.push({ name: '', id: '' })
|
middleObject.children.push({ name: '', id: '' })
|
||||||
@ -76,7 +96,6 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
} else {
|
} else {
|
||||||
console.log('店铺分类数据问题')
|
console.log('店铺分类数据问题')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ formatInWindow: newIndustryType }, () => {
|
this.setState({ formatInWindow: newIndustryType }, () => {
|
||||||
console.log('滚动时的数据', this.state.formatInWindow)
|
console.log('滚动时的数据', this.state.formatInWindow)
|
||||||
})
|
})
|
||||||
@ -100,10 +119,9 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 这里不能加入secondArray,和thirdArray 会有bug
|
// 这里不能加入secondArray,和thirdArray 会有bug
|
||||||
this.setState({ objectMultiArray: [firstArray, [{ name: '', id: '' }], [{ name: '', id: '' }]] }, () => {
|
this.setState({ objectMultiArray: [firstArray, secondArray, thirdArray] }, () => {
|
||||||
console.log('初始化数据', this.state.objectMultiArray)
|
console.log('初始化数据', this.state.objectMultiArray)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
//--- 三级联动--------------
|
//--- 三级联动--------------
|
||||||
bindMultiPickerChange(e) {
|
bindMultiPickerChange(e) {
|
||||||
@ -112,10 +130,6 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
multiIndex: e.detail.value
|
multiIndex: e.detail.value
|
||||||
}, () => {
|
}, () => {
|
||||||
this.returnResultToParent()
|
this.returnResultToParent()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
returnResultToParent() {
|
returnResultToParent() {
|
||||||
@ -123,7 +137,6 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
let outter = this.state.formatInWindow[this.state.multiIndex[0]]
|
let outter = this.state.formatInWindow[this.state.multiIndex[0]]
|
||||||
let middler = outter.children[this.state.multiIndex[1]]
|
let middler = outter.children[this.state.multiIndex[1]]
|
||||||
let inner = middler.children[this.state.multiIndex[2]]
|
let inner = middler.children[this.state.multiIndex[2]]
|
||||||
|
|
||||||
if (outter.id) {
|
if (outter.id) {
|
||||||
result = outter
|
result = outter
|
||||||
if (middler.id) {
|
if (middler.id) {
|
||||||
@ -131,11 +144,34 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
if (inner.id) {
|
if (inner.id) {
|
||||||
result = inner
|
result = inner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.passDataToParent(result)
|
this.passDataToParent(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 递归整理无限层数据
|
||||||
|
recursion(data) {
|
||||||
|
let arrayTem = []
|
||||||
|
let depth=0
|
||||||
|
const depthArray=[]
|
||||||
|
for (let items of data) {
|
||||||
|
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||||
|
if (items.children) {
|
||||||
|
arrayTem[arrayTem.length - 1].children = this.recursion(items.children)
|
||||||
|
depth+=1
|
||||||
|
} else {
|
||||||
|
|
||||||
|
depthArray.push(depth)
|
||||||
|
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {multiObject:arrayTem,depth:depthArray}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bindMultiPickerCol(e) {
|
bindMultiPickerCol(e) {
|
||||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||||
const data = {
|
const data = {
|
||||||
@ -143,110 +179,144 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
multiIndex: this.state.multiIndex
|
multiIndex: this.state.multiIndex
|
||||||
}
|
}
|
||||||
data.multiIndex[e.detail.column] = e.detail.value
|
data.multiIndex[e.detail.column] = e.detail.value
|
||||||
switch (e.detail.column) {
|
|
||||||
case 0:
|
|
||||||
switch (data.multiIndex[0]) {
|
if (e.detail.column == 0) {
|
||||||
case 0:
|
for (let index in data.multiArray[0]) {
|
||||||
data.multiArray[1] = this.state.formatInWindow[0].children
|
const indexNumber = Number(index)
|
||||||
data.multiArray[2] = this.state.formatInWindow[0].children
|
if (indexNumber === data.multiIndex[0]) {
|
||||||
break
|
data.multiArray[1] = this.state.formatInWindow[indexNumber].children
|
||||||
case 1:
|
data.multiArray[2] = this.state.formatInWindow[indexNumber].children[0].children
|
||||||
data.multiArray[1] = this.state.formatInWindow[1].children
|
data.multiArray[3] = this.state.formatInWindow[indexNumber].children[0].children[0].children
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[1] = this.state.formatInWindow[2].children
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
data.multiArray[1] = this.state.formatInWindow[3].children
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
data.multiArray[1] = this.state.formatInWindow[4].children
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
data.multiIndex[1] = 0
|
}
|
||||||
data.multiIndex[2] = 0
|
} else if (e.detail.column == 1) {
|
||||||
break
|
for (let index in data.multiArray[1]) {
|
||||||
case 1:
|
const indexNumber = Number(index)
|
||||||
switch (data.multiIndex[0]) {
|
if (indexNumber === data.multiIndex[1]) {
|
||||||
case 0:
|
data.multiArray[2] = this.state.formatInWindow[data.multiIndex[0]].children[indexNumber].children
|
||||||
|
data.multiArray[3] = this.state.formatInWindow[data.multiIndex[0]].children[indexNumber].children[0].children
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[1].children[0].children
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[1].children[1].children
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[1].children[2].children
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[1].children[3].children ? this.state.formatInWindow[1].children[3].children : [{ class_name: '' }]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[2].children[0].children
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[2].children[1].children
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[2].children[2].children
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[2].children[3].children
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[2].children[4].children
|
|
||||||
break
|
|
||||||
case 5:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[2].children[5].children
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[3].children[0].children
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[3].children[1].children
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[3].children[2].children
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[3].children[3].children
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[3].children[3].children
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[4].children[0].children
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[4].children[1].children
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[2] = this.state.formatInWindow[4].children[2].children
|
|
||||||
break
|
|
||||||
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
}
|
}
|
||||||
data.multiIndex[2] = 0
|
}
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
else if (e.detail.column == 2) {
|
||||||
|
for (let index in data.multiArray[2]) {
|
||||||
|
const indexNumber = Number(index)
|
||||||
|
if (indexNumber === data.multiIndex[2]) {
|
||||||
|
data.multiArray[3] = this.state.formatInWindow[data.multiIndex[0]].children[data.multiIndex[1]].children[indexNumber].children
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// switch (e.detail.column) {// 移动了第几列
|
||||||
|
// case 0:
|
||||||
|
// switch (data.multiIndex[0]) { // 第一个index 是多少
|
||||||
|
// case 0:
|
||||||
|
// data.multiArray[1] = this.state.formatInWindow[0].children
|
||||||
|
// data.multiArray[2]=this.state.formatInWindow[0].children[0].children
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// data.multiArray[1] = this.state.formatInWindow[1].children
|
||||||
|
// break
|
||||||
|
// case 2:
|
||||||
|
// data.multiArray[1] = this.state.formatInWindow[2].children
|
||||||
|
// break
|
||||||
|
// case 3:
|
||||||
|
// data.multiArray[1] = this.state.formatInWindow[3].children
|
||||||
|
// break
|
||||||
|
// case 4:
|
||||||
|
// data.multiArray[1] = this.state.formatInWindow[4].children
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// data.multiIndex[1] = 0
|
||||||
|
// data.multiIndex[2] = 0
|
||||||
|
// data.multiIndex[3] = 0
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// switch (data.multiIndex[0]) {
|
||||||
|
// case 0:
|
||||||
|
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// switch (data.multiIndex[1]) {
|
||||||
|
// case 0:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[1].children[0].children
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[1].children[1].children
|
||||||
|
// break
|
||||||
|
// case 2:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[1].children[2].children
|
||||||
|
// break
|
||||||
|
// case 3:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[1].children[3].children ? this.state.formatInWindow[1].children[3].children : [{ class_name: '' }]
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
// case 2:
|
||||||
|
// switch (data.multiIndex[1]) {
|
||||||
|
// case 0:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[2].children[0].children
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[2].children[1].children
|
||||||
|
// break
|
||||||
|
// case 2:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[2].children[2].children
|
||||||
|
// break
|
||||||
|
// case 3:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[2].children[3].children
|
||||||
|
// break
|
||||||
|
// case 4:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[2].children[4].children
|
||||||
|
// break
|
||||||
|
// case 5:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[2].children[5].children
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
// case 3:
|
||||||
|
// switch (data.multiIndex[1]) {
|
||||||
|
// case 0:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[3].children[0].children
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[3].children[1].children
|
||||||
|
// break
|
||||||
|
// case 2:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[3].children[2].children
|
||||||
|
// break
|
||||||
|
// case 3:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[3].children[3].children
|
||||||
|
// break
|
||||||
|
// case 3:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[3].children[3].children
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
// case 4:
|
||||||
|
// switch (data.multiIndex[1]) {
|
||||||
|
// case 0:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[4].children[0].children
|
||||||
|
// break
|
||||||
|
// case 1:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[4].children[1].children
|
||||||
|
// break
|
||||||
|
// case 2:
|
||||||
|
// data.multiArray[2] = this.state.formatInWindow[4].children[2].children
|
||||||
|
// break
|
||||||
|
|
||||||
|
// }
|
||||||
|
// break
|
||||||
|
|
||||||
|
// }
|
||||||
|
// data.multiIndex[2] = 0
|
||||||
|
// data.multiIndex[3] = 0
|
||||||
|
// break
|
||||||
|
// }
|
||||||
this.setState({ multiIndex: data.multiIndex })
|
this.setState({ multiIndex: data.multiIndex })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,13 +356,13 @@ class GoodsTypeInteractionComp extends Component {
|
|||||||
<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>
|
||||||
|
|
||||||
{/* {this.state.objectMultiArray[0].length?<Text className='first-col'> {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}</Text>:null}
|
{/* {this.state.objectMultiArray[0].length?<Text className='first-col'> {this.state.objectMultiArray[0][this.state.multiIndex[0]].name}</Text>:null}
|
||||||
{this.state.objectMultiArray[1].length?<Text className='second-col'>{this.state.objectMultiArray[1][this.state.multiIndex[1]].name}</Text>:null}
|
{this.state.objectMultiArray[1].length?<Text className='second-col'>{this.state.objectMultiArray[1][this.state.multiIndex[1]].name}</Text>:null}
|
||||||
{this.state.objectMultiArray[2].length?<Text className='third-col'>{this.state.objectMultiArray[2][this.state.multiIndex[2]].name}</Text>:null} */}
|
{this.state.objectMultiArray[2].length?<Text className='third-col'>{this.state.objectMultiArray[2][this.state.multiIndex[2]].name}</Text>:null} */}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Picker>
|
</Picker>
|
||||||
|
@ -75,7 +75,7 @@ class AllDemanding extends Component {
|
|||||||
if (res.data.err_msg === 'success') {
|
if (res.data.err_msg === 'success') {
|
||||||
if (res.data.supplys.length) {
|
if (res.data.supplys.length) {
|
||||||
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 })
|
||||||
}
|
}
|
||||||
@ -258,6 +258,7 @@ class AllDemanding extends Component {
|
|||||||
text={this.state.grabOrderSuccess}
|
text={this.state.grabOrderSuccess}
|
||||||
duration={2000}
|
duration={2000}
|
||||||
></AtToast>
|
></AtToast>
|
||||||
|
|
||||||
const allDemandingElementArray = this.state.supplys ? 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'>
|
||||||
@ -277,12 +278,13 @@ class AllDemanding extends Component {
|
|||||||
<View className='detail'>
|
<View className='detail'>
|
||||||
<View className='title'>{item.sd_title}</View>
|
<View className='title'>{item.sd_title}</View>
|
||||||
<View className='para'>{item.sd_desc}</View>
|
<View className='para'>{item.sd_desc}</View>
|
||||||
{item.state_name === '在用' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
{item.state === '1' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
||||||
<Button size='mini' className='button-orange'>抢单</Button>
|
<Button size='mini' className='button-orange'>抢单</Button>
|
||||||
</View> : <View className='button' >
|
</View> : null || item.state === '2' ? <View className='button'>
|
||||||
<Button size='mini' className='button-orange blur'> 已抢光</Button>
|
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||||
</View>
|
</View> : null || item.state === '3' ? <View className='button'>
|
||||||
}
|
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||||
|
</View> : null}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='footer'>
|
<View className='footer'>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text, Button } from '@tarojs/components'
|
import { View, Text, Button } from '@tarojs/components'
|
||||||
import { AtInput, AtImagePicker, AtTextarea, AtForm } from 'taro-ui'
|
import { AtInput, AtImagePicker, AtTextarea, } from 'taro-ui'
|
||||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
|
|
||||||
|
|
||||||
@ -36,11 +36,6 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 发布商品api
|
// 发布商品api
|
||||||
uploadGoods({ goods_name = "test2",
|
uploadGoods({ goods_name = "test2",
|
||||||
goods_price = "1.00",
|
goods_price = "1.00",
|
||||||
|
@ -26,7 +26,9 @@ class GrabOrderPage extends Component {
|
|||||||
address: '',
|
address: '',
|
||||||
content: '',
|
content: '',
|
||||||
isOpen: false, // 抢单消息提示
|
isOpen: false, // 抢单消息提示
|
||||||
grabOrderId:this.$router.params.orderId
|
grabOrderId: this.$router.params.orderId,
|
||||||
|
stateId:'',
|
||||||
|
stateName:''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +57,8 @@ class GrabOrderPage extends Component {
|
|||||||
contactNumber: res.data.sdInfo.user_phone,
|
contactNumber: res.data.sdInfo.user_phone,
|
||||||
address: res.data.sdInfo.user_address,
|
address: res.data.sdInfo.user_address,
|
||||||
content: res.data.sdInfo.sd_desc,
|
content: res.data.sdInfo.sd_desc,
|
||||||
|
stateId:res.data.sdInfo.state,
|
||||||
|
stateName:res.data.sdInfo.state_name,
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -79,26 +83,26 @@ class GrabOrderPage extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if(res.data.err_msg === 'success'){
|
if (res.data.err_msg === 'success') {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '抢单成功' ,
|
title: '抢单成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 1500
|
duration: 1500
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url:'/pages/home/home'
|
url: '/pages/home/home'
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log('抢单请求:', res)
|
console.log('抢单请求:', res)
|
||||||
|
|
||||||
@ -112,7 +116,7 @@ class GrabOrderPage extends Component {
|
|||||||
}
|
}
|
||||||
grabButtonHandler() {
|
grabButtonHandler() {
|
||||||
this.setState({ isOpen: true })
|
this.setState({ isOpen: true })
|
||||||
}
|
}
|
||||||
handleGrabModalClose() {
|
handleGrabModalClose() {
|
||||||
this.setState({ isOpen: false })
|
this.setState({ isOpen: false })
|
||||||
}
|
}
|
||||||
@ -126,7 +130,7 @@ class GrabOrderPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
||||||
this.getGrabOrderInfo()
|
this.getGrabOrderInfo()
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
@ -140,12 +144,13 @@ class GrabOrderPage extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
// 提示模态弹窗element
|
// 提示模态弹窗element
|
||||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||||
<AtModalHeader>提示</AtModalHeader>
|
<AtModalHeader>提示</AtModalHeader>
|
||||||
<AtModalContent>
|
<AtModalContent>
|
||||||
确认抢单?
|
确认抢单?
|
||||||
</AtModalContent>
|
</AtModalContent>
|
||||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
</AtModal>
|
</AtModal>
|
||||||
|
|
||||||
@ -180,13 +185,20 @@ class GrabOrderPage extends Component {
|
|||||||
<Text className='title'>业主需求内容:</Text>
|
<Text className='title'>业主需求内容:</Text>
|
||||||
<Text className='content'>{this.state.content}</Text>
|
<Text className='content'>{this.state.content}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='button-box'>
|
|
||||||
<View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
{/* <View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
||||||
<Button size='mini' className='button-orange'>
|
<Button size='mini' className='button-orange'>
|
||||||
<AtIcon value='close' size='12' color='white'></AtIcon>
|
<AtIcon value='close' size='12' color='white'></AtIcon>
|
||||||
抢单</Button>
|
抢单</Button>
|
||||||
</View>
|
</View> */}
|
||||||
</View>
|
{this.state.stateId === '1' ? <View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
||||||
|
<Button size='mini' className='button-orange'>抢单</Button>
|
||||||
|
</View> : null || this.state.stateId === '2' ? <View className='button'>
|
||||||
|
<Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||||
|
</View> : null || this.state.stateId === '3' ? <View className='button'>
|
||||||
|
<Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||||
|
</View> : null}
|
||||||
|
|
||||||
<CopyrightComponent></CopyrightComponent>
|
<CopyrightComponent></CopyrightComponent>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
@ -14,23 +14,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.button-box{
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
flex-direction: row;
|
|
||||||
margin: 80px 0;
|
|
||||||
padding: 0 20px;
|
|
||||||
|
|
||||||
.button{
|
.button{
|
||||||
flex:1;
|
margin-top: 20%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
// margin:2%;
|
// margin:2%;
|
||||||
// justify-content:center;
|
// justify-content:center;
|
||||||
|
|
||||||
.at-button--primary{
|
|
||||||
background-color:#FF7142;
|
|
||||||
border:1PX solid #FF7142;
|
|
||||||
}
|
|
||||||
|
|
||||||
}}
|
}
|
||||||
|
|
@ -173,7 +173,6 @@ class Home extends Component {
|
|||||||
async login() {
|
async login() {
|
||||||
Taro.login({
|
Taro.login({
|
||||||
success(res) {
|
success(res) {
|
||||||
|
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
// 发起网络请求
|
// 发起网络请求
|
||||||
// console.log('手机端微信code:',res.code)
|
// console.log('手机端微信code:',res.code)
|
||||||
@ -396,8 +395,9 @@ class Home extends Component {
|
|||||||
</AtModal>
|
</AtModal>
|
||||||
|
|
||||||
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
||||||
|
|
||||||
return <SwiperItem key={index} >
|
return <SwiperItem key={index} >
|
||||||
<View className='demanding-item' >
|
<View className={this.state.demanding.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||||
<View className='item-tag'>
|
<View className='item-tag'>
|
||||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||||
@ -406,15 +406,22 @@ class Home extends Component {
|
|||||||
{item.sd_title}
|
{item.sd_title}
|
||||||
</View>
|
</View>
|
||||||
<View className='item-address'>
|
<View className='item-address'>
|
||||||
{item.user_address || '无地址'}
|
{item.user_address || '--'}
|
||||||
</View>
|
</View>
|
||||||
<View className='item-name'>
|
<View className='item-name'>
|
||||||
业主:{item.user_name}
|
业主:{item.user_name}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
{item.state === '1' ? <View className='button' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||||
|
<Button size='mini' className='button-orange'>抢单</Button>
|
||||||
|
</View> : null || item.state === '2' ? <View className='button'>
|
||||||
|
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||||
|
</View> : null || item.state === '3' ? <View className='button'>
|
||||||
|
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||||
|
</View> : null}
|
||||||
|
{/* <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||||
</View>
|
</View> */}
|
||||||
</View>
|
</View>
|
||||||
</SwiperItem >
|
</SwiperItem >
|
||||||
}) : null
|
}) : null
|
||||||
@ -539,7 +546,7 @@ class Home extends Component {
|
|||||||
indicatorColor='#999'
|
indicatorColor='#999'
|
||||||
indicatorActiveColor='#333'
|
indicatorActiveColor='#333'
|
||||||
horizontal
|
horizontal
|
||||||
circular
|
|
||||||
displayMultipleItems='2.5'
|
displayMultipleItems='2.5'
|
||||||
>
|
>
|
||||||
{demandingElemensArray}
|
{demandingElemensArray}
|
||||||
|
@ -82,7 +82,7 @@ $themeColor: #FF7142;
|
|||||||
.item-name{
|
.item-name{
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
font-size: 35px;
|
font-size: 30px;
|
||||||
// margin-top: 10px;
|
// margin-top: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@ -101,6 +101,9 @@ $themeColor: #FF7142;
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.last{
|
||||||
|
border-right: 3rpx solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.shop-box{
|
.shop-box{
|
||||||
|
@ -39,6 +39,7 @@ class Index extends Component {
|
|||||||
// 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'
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -50,7 +50,6 @@ const URL = {
|
|||||||
// 商品编辑页面 Goods-ajaxEditPhoneDeploy
|
// 商品编辑页面 Goods-ajaxEditPhoneDeploy
|
||||||
GetProductInfo: LOCALURL + 'Goods-ajaxEditPhoneDeploy',// 获取单个商品信息
|
GetProductInfo: LOCALURL + 'Goods-ajaxEditPhoneDeploy',// 获取单个商品信息
|
||||||
//我的需求
|
//我的需求
|
||||||
|
|
||||||
PublishMyNeed: LOCALURL + 'Supply-userPost',// 发布我的需求
|
PublishMyNeed: LOCALURL + 'Supply-userPost',// 发布我的需求
|
||||||
MyNeedUploadImage: LOCALURL + 'Supply-fileUpload?type=user',// 我的需求图片上传
|
MyNeedUploadImage: LOCALURL + 'Supply-fileUpload?type=user',// 我的需求图片上传
|
||||||
GetMyNeedsList: LOCALURL + 'Supply-userDemandList',// 获取我的需求列表
|
GetMyNeedsList: LOCALURL + 'Supply-userDemandList',// 获取我的需求列表
|
||||||
|
1006
src/todo list.txt
1006
src/todo list.txt
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user