修改联动,登入新账号后的数据更新,优惠卷和咨询
This commit is contained in:
parent
0ba9766007
commit
5baa65e718
@ -32,10 +32,11 @@ class recommondShop extends Component {
|
||||
isOpenVoucher: false,
|
||||
isOpenConsult: false,
|
||||
consultTip: '',
|
||||
voucherResponseMsg: '',
|
||||
voucherCanConsult: false,
|
||||
voucherResponseMsg: 'i am voucherResponseMsg',
|
||||
userName: Taro.getStorageSync('user_identity').username || '',
|
||||
userPhone: Taro.getStorageSync('user_identity').userphone || '',
|
||||
canConsult: false
|
||||
|
||||
}
|
||||
}
|
||||
goToShop(value) {
|
||||
@ -44,20 +45,28 @@ class recommondShop extends Component {
|
||||
})
|
||||
}
|
||||
// api 优惠卷请求
|
||||
getVoucherInfo({ user = "某某人", phone = "18950295811", shops = ["808"], source_type = 4, flag = false, source_class = "1", source_level = 1 }) {
|
||||
getVoucherInfo({ user = this.state.userName,
|
||||
phone = this.state.userPhone,
|
||||
shops = [this.props.shop.shop_id],
|
||||
source_type = 4,
|
||||
flag = false,
|
||||
source_level = this.props.categoryLevel }) {
|
||||
Taro.request({
|
||||
url: URL.GetVoucherInfo,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
user: user,
|
||||
phone: phone,
|
||||
shops: shops,
|
||||
source_type: source_type,
|
||||
flag: flag,
|
||||
source_class: source_class,
|
||||
source_level: source_level
|
||||
data: JSON.stringify({
|
||||
user: user,
|
||||
phone: phone,
|
||||
shops: shops,
|
||||
source_type: source_type,
|
||||
flag: flag,
|
||||
source_level: source_level
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
@ -67,7 +76,7 @@ class recommondShop extends Component {
|
||||
.then(res => {
|
||||
this.setState({
|
||||
voucherResponseMsg: res.data.tips,
|
||||
voucherCanConsult: res.data.canConsult
|
||||
canConsult: res.data.canConsult,
|
||||
})
|
||||
console.log('优惠卷请求', res)
|
||||
})
|
||||
@ -75,18 +84,27 @@ class recommondShop extends Component {
|
||||
}
|
||||
// api 咨询信息
|
||||
|
||||
getConsultInfo({ user = "某某人", phone = "18950295811", shops = ["1306"], source_type = "2", flag = false, source_level = 1 }) {
|
||||
getConsultInfo({
|
||||
user = this.state.userName,
|
||||
phone = this.state.userPhone,
|
||||
shops = [this.props.shop.shop_id],
|
||||
source_type = "2",
|
||||
flag = false,
|
||||
source_level = this.props.categoryLevel,
|
||||
}) {
|
||||
Taro.request({
|
||||
url: URL.GetConsultInfo,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
user: user,
|
||||
phone: phone,
|
||||
shops: shops,
|
||||
source_type: source_type,
|
||||
flag: flag,
|
||||
source_level: source_level
|
||||
data: JSON.stringify({
|
||||
user: user,
|
||||
phone: phone,
|
||||
shops: shops,
|
||||
source_type: source_type,
|
||||
flag: flag,
|
||||
source_level: source_level,
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -100,7 +118,12 @@ class recommondShop extends Component {
|
||||
})
|
||||
}
|
||||
// api 购买咨询 BuyConsult
|
||||
buyConsult({ user = "某某人", phone = "18950295811", shops = ["1306"], source_type = "2", source_level = 1, coupons_flag = 0 }) {
|
||||
buyConsult({ user = this.state.userName,
|
||||
phone = this.state.userPhone,
|
||||
shops = [this.props.shop.shop_id],
|
||||
source_type = "2",
|
||||
source_level = 1,
|
||||
coupons_flag = 0 }) {
|
||||
Taro.request({
|
||||
url: URL.BuyConsult,
|
||||
method: 'POST',
|
||||
@ -123,7 +146,7 @@ class recommondShop extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('购买咨询请求成功', res)
|
||||
if (res.statusCode === 200) {
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({ title: '咨询成功', icon: 'success' })
|
||||
} else {
|
||||
Taro.showToast({ title: res.data.err_msg, icon: 'none' })
|
||||
@ -134,38 +157,39 @@ class recommondShop extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 咨询弹框。取消。确认
|
||||
isOpenConsult() {
|
||||
this.setState({
|
||||
isOpenConsult: true,
|
||||
userName: Taro.getStorageSync('user_identity').username,
|
||||
userPhone: Taro.getStorageSync('user_identity').userphone,
|
||||
|
||||
}, () => {
|
||||
this.getConsultInfo({})
|
||||
})
|
||||
this.getConsultInfo({})
|
||||
|
||||
}
|
||||
consultModalClose() {
|
||||
this.setState({ isOpenConsult: false })
|
||||
}
|
||||
consultModalConfirm() {
|
||||
if(!this.state.userName){
|
||||
if (!this.state.userName) {
|
||||
Taro.showToast({
|
||||
title: '请填写姓名',
|
||||
icon: 'none',
|
||||
})
|
||||
|
||||
}else if(!this.state.userPhone){
|
||||
})
|
||||
|
||||
} else if (!this.state.userPhone) {
|
||||
Taro.showToast({
|
||||
title: '请填写电话',
|
||||
icon: 'none',
|
||||
})
|
||||
|
||||
}else{
|
||||
})
|
||||
|
||||
} else {
|
||||
this.setState({ isOpenConsult: false })
|
||||
this.buyConsult({ user: this.state.userName, phone: this.state.userPhone })
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
handleInputCsultName(e) {
|
||||
this.setState({ userName: e.detail.value })
|
||||
@ -177,14 +201,21 @@ class recommondShop extends Component {
|
||||
console.log('从voucherposter件传回来的值', value)
|
||||
this.setState({ isOpenVoucher: value })
|
||||
}
|
||||
isOpenVoucher(){
|
||||
this.setState({isOpenVoucher:true})
|
||||
isOpenVoucher() {
|
||||
|
||||
this.setState({
|
||||
isOpenVoucher: true,
|
||||
userName: Taro.getStorageSync('user_identity').username,
|
||||
userPhone: Taro.getStorageSync('user_identity').userphone
|
||||
}, () => {
|
||||
this.getVoucherInfo({})
|
||||
})
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
//console.log(this.props, nextProps)
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
console.log('this.props', this.props)
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
@ -194,6 +225,7 @@ class recommondShop extends Component {
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
const title = this.props.shop.shop_name
|
||||
const imgUrl = URL.Base + this.props.shop.goods[0].goods_url
|
||||
const price = this.props.shop.goods[0].goods_price
|
||||
@ -247,20 +279,24 @@ class recommondShop extends Component {
|
||||
/>
|
||||
</View>
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button style='color:#FF7142' onClick={this.consultModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button style='color:#FF7142' onClick={this.consultModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
// <AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> {this.props.canConsult?<Button style='color:#FF7142' onClick={this.consultModalConfirm.bind(this)}>确定</Button>:<Text></Text>} </AtModalAction>
|
||||
|
||||
return (
|
||||
<View className='shop-list-box' >
|
||||
{consultModalElement}
|
||||
<VoucherPosterComponent
|
||||
userName={this.state.userName}
|
||||
userPhone={this.state.userPhone}
|
||||
name={this.state.userName}
|
||||
phone={this.state.userPhone}
|
||||
shopId={this.props.shop.shop_id}
|
||||
canConsult={this.state.canConsult}
|
||||
isVoucherPoster={this.state.isOpenVoucher}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
voucherLeft={this.props.shop.left_nums}
|
||||
voucherResponseMsg={this.state.voucherResponseMsg}
|
||||
categoryLevel={this.props.categoryLevel}
|
||||
></VoucherPosterComponent>
|
||||
<View className='header'>
|
||||
|
||||
|
@ -17,13 +17,20 @@ class VoucherPoster extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
voucherName: this.props.userName,
|
||||
voucherPhone: this.props.userPhone,
|
||||
voucherName: this.props.name,
|
||||
voucherPhone: this.props.phone,
|
||||
|
||||
voucherPosterImage: 'background-image:url(' + URL.Base + '/Public/images/store/m_yhq.png);'
|
||||
}
|
||||
}
|
||||
// api 购买咨询 BuyConsult
|
||||
buyConsult({ user = "某某人", phone = "18950295811", shops = ["1306"], source_type = "2", source_level = 1, coupons_flag = 0 }) {
|
||||
buyConsult({
|
||||
user = this.state.voucherName,
|
||||
phone = this.state.voucherPhone,
|
||||
shops = [this.props.shopId],
|
||||
source_type = '4',
|
||||
source_level = this.props.categoryLevel,
|
||||
coupons_flag = '1' }) {
|
||||
Taro.request({
|
||||
url: URL.BuyConsult,
|
||||
method: 'POST',
|
||||
@ -46,7 +53,6 @@ class VoucherPoster extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('购买咨询请求成功', res)
|
||||
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '领取成功',
|
||||
@ -57,9 +63,9 @@ class VoucherPoster extends Component {
|
||||
this.passDataToParent()
|
||||
}, 1500);
|
||||
|
||||
}else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@ -78,13 +84,13 @@ class VoucherPoster extends Component {
|
||||
title: '请填写姓名',
|
||||
icon: 'none',
|
||||
})
|
||||
} else if (!this.state.voucherPhone) {
|
||||
} else if (this.state.voucherPhone.length !== 11) {
|
||||
Taro.showToast({
|
||||
title: '请填写电话号码',
|
||||
title: '请填正确的电话号码',
|
||||
icon: 'none',
|
||||
})
|
||||
} else {
|
||||
this.buyConsult({ user: this.state.voucherName, phone: this.state.voucherPhone })
|
||||
this.buyConsult({})
|
||||
|
||||
}
|
||||
|
||||
@ -101,10 +107,7 @@ class VoucherPoster extends Component {
|
||||
this.props.onPassDataToChild(false)
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.setState({
|
||||
voucherName: nextProps.userName,
|
||||
voucherPhone: nextProps.userPhone,
|
||||
})
|
||||
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
@ -118,6 +121,7 @@ class VoucherPoster extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
console.log('i am poster')
|
||||
return (
|
||||
<View className='voucherEventPopUpComponent'>
|
||||
{/* <!-- The Modal --> */}
|
||||
@ -133,21 +137,16 @@ class VoucherPoster extends Component {
|
||||
</View>
|
||||
<View className='input-name' >
|
||||
<View className='title'> <Text>联系人:</Text></View>
|
||||
<Input class='input-info' type='text' placeholder='请输入联系人' value={this.state.voucherName} onInput={this.handleNameChange.bind(this)} />
|
||||
<Input class='input-info' type='text' placeholder='请输入联系人' value={this.props.name} onInput={this.handleNameChange.bind(this)} />
|
||||
</View>
|
||||
<View className='input-number' >
|
||||
|
||||
<View className='title'> <Text>联系电话:</Text></View>
|
||||
<Input class='input-info' placeholder='请输入联系电话' type='text' maxLength='11' value={this.state.voucherPhone} onInput={this.handlePhoneChange.bind(this)} />
|
||||
<Input class='input-info' placeholder='请输入联系电话' type='number' maxLength='11' value={this.props.phone} onInput={this.handlePhoneChange.bind(this)} />
|
||||
</View>
|
||||
<View>
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='tips'>
|
||||
{this.props.voucherResponseMsg}
|
||||
{this.props.canConsult ? '' : this.props.voucherResponseMsg}
|
||||
</View>
|
||||
|
||||
<View className='button' >
|
||||
|
@ -42,15 +42,25 @@ class GoodsTypeInteractionComp extends Component {
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品分类目录', res)
|
||||
|
||||
|
||||
const recursionInteractionData=this.recursionInteraction(res.data.data)
|
||||
maxDepth=0
|
||||
initialDataArray=[]
|
||||
|
||||
this.recursionInitialized(res.data.data) //
|
||||
const depthInArray=this.recursionDepth(res.data.data)
|
||||
console.log('depthInArray',depthInArray)
|
||||
console.log('initialDataArray',initialDataArray)
|
||||
for(let i=initialDataArray.length;i<depthInArray.length;i++){
|
||||
initialDataArray.unshift([{name:'--',id:''}])
|
||||
}
|
||||
|
||||
this.setState({
|
||||
interactionMultiArray: recursionInteractionData,
|
||||
multiIndex: this.recursionDepth(res.data.data),
|
||||
multiIndex: depthInArray,
|
||||
initailMultiArray:initialDataArray.reverse()
|
||||
}, () => {
|
||||
initialDataArray=[]// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
|
||||
@ -107,7 +117,6 @@ class GoodsTypeInteractionComp extends Component {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
|
||||
}
|
||||
if(data[0].children.length){
|
||||
this.recursionInitialized(data[0].children)
|
||||
@ -126,7 +135,7 @@ class GoodsTypeInteractionComp extends Component {
|
||||
if (items.children) {
|
||||
arrayTem[arrayTem.length - 1].children = this.recursionInteraction(items.children)
|
||||
} else {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }]
|
||||
}
|
||||
}
|
||||
return arrayTem // 返回联动数据
|
||||
@ -178,9 +187,6 @@ class GoodsTypeInteractionComp extends Component {
|
||||
for (let index in data.multiArray[0]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[0]) {
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[indexNumber].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
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
.first-col{
|
||||
font-weight: normal;
|
||||
margin-left: 2%
|
||||
margin-left: 10%
|
||||
}
|
||||
.second-col{
|
||||
font-weight: normal;
|
||||
|
@ -41,25 +41,23 @@ class Interaction extends Component {
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('行业分类目录', res)
|
||||
|
||||
let initailMultiArray = this.recursionInitialized(res.data.data)
|
||||
initialDataArray[1].unshift({ name: '全部', id: '-1' }) // 默认
|
||||
initailMultiArray[1].unshift({ name: '全部', id: '-1' })
|
||||
initailMultiArray[0] = [{ name: '--', id: '' }]
|
||||
console.log('initailMultiArray', initailMultiArray)
|
||||
|
||||
|
||||
this.setState({
|
||||
initailMultiArray: [initailMultiArray[1]], //initailMultiArray.reverse(),
|
||||
interactionMultiArray: [{ name: '全部', id: '-1', children: [{ name: '', id: '' }] }, ...this.recursionInteraction(res.data.data)],
|
||||
initailMultiArray: initailMultiArray.reverse(), //initailMultiArray.reverse(),
|
||||
interactionMultiArray: [{ name: '全部', id: '-1', children: [{ name: '--', id: '' }] }, ...this.recursionInteraction(res.data.data)],
|
||||
multiIndex: this.recursionDepth(res.data.data),
|
||||
|
||||
}, () => {
|
||||
console.log('interactionMultiArray',this.state.interactionMultiArray)
|
||||
initialDataArray = []// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
initialDataArray = []
|
||||
})
|
||||
|
||||
|
||||
}) // 用递归来整理无限层次的数据
|
||||
|
||||
}else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else if (res.data.err_code === 88888) {
|
||||
// loginExpired(res)
|
||||
} else {
|
||||
console.log('行业分类请求没有成功', res)
|
||||
}
|
||||
@ -75,9 +73,9 @@ class Interaction extends Component {
|
||||
for (let items of data) {
|
||||
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||
if (items.child.length) {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '可选', id: '' }, ...this.recursionInteraction(items.child)]
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }, ...this.recursionInteraction(items.child)]
|
||||
} else {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }]
|
||||
}
|
||||
}
|
||||
return arrayTem // 返回联动数据
|
||||
@ -90,7 +88,9 @@ class Interaction extends Component {
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
item.child.length ? childrenHolderArray.push(...item.child) : null
|
||||
if (data.indexOf(item) === 0) {
|
||||
item.child.length ? childrenHolderArray.push(...item.child) : null
|
||||
}
|
||||
}
|
||||
this.recursionInitialized(childrenHolderArray)
|
||||
}
|
||||
@ -113,7 +113,7 @@ class Interaction extends Component {
|
||||
}
|
||||
bindMultiPickerCol(e) {
|
||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||
|
||||
|
||||
const data = {
|
||||
multiArray: this.state.initailMultiArray,
|
||||
multiIndex: this.state.multiIndex
|
||||
@ -124,7 +124,7 @@ class Interaction extends Component {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[0]) {
|
||||
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||
console.log('datat',data)
|
||||
console.log('datat', data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ class GoodsPublish extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.productDescript}
|
||||
onChange={this.productDescriptChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder='你的产品简介'
|
||||
/>
|
||||
</View>
|
||||
|
@ -189,7 +189,6 @@ class Home extends Component {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
console.log('item', item)
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
this.getShops({})
|
||||
})
|
||||
@ -382,6 +381,8 @@ class Home extends Component {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
key={index}
|
||||
categoryLevel={this.state.supplyLevel}
|
||||
classId={this.state.parentClass===this.state.childClass?this.state.parentClass:this.state.childClass}
|
||||
></FilteredShopComponent>
|
||||
}) : <View className='no-more-title top'> 没有更多了</View>
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
|
@ -412,7 +412,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/>
|
||||
</View>
|
||||
@ -423,7 +423,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
|
@ -443,7 +443,7 @@ class MyGoodsEdit extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.productDescript}
|
||||
onChange={this.productDescriptChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder='你的产品简介'
|
||||
/>
|
||||
|
||||
|
@ -69,15 +69,15 @@ class MyNeeds extends Component {
|
||||
state: state
|
||||
})
|
||||
} : {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
sd_type: sd_type,
|
||||
sd_title: sd_title,
|
||||
update_dateL: update_dateL,
|
||||
update_dateU: update_dateU,
|
||||
class_id: class_id,
|
||||
})
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
sd_type: sd_type,
|
||||
sd_title: sd_title,
|
||||
update_dateL: update_dateL,
|
||||
update_dateU: update_dateU,
|
||||
class_id: class_id,
|
||||
})
|
||||
}
|
||||
|
||||
Taro.request({
|
||||
@ -104,33 +104,35 @@ class MyNeeds extends Component {
|
||||
} else {
|
||||
this.setState({ isAddToList: false })
|
||||
this.setState({
|
||||
allNeedsList: res.data.supplys,
|
||||
totalNeeds:Number(res.data.count)
|
||||
allNeedsList: res.data.supplys,
|
||||
totalNeeds: Number(res.data.count)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if(this.state.isAddToList){
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ isAddToList: false })
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}else{
|
||||
this.setState({allNeedsList:[],totalNeeds:0})
|
||||
} else {
|
||||
this.setState({ allNeedsList: [], totalNeeds: 0 })
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if(JSON.parse(res.data).err_code===88888){
|
||||
loginExpired(res)
|
||||
|
||||
}else{
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
} else if (JSON.parse(res.data).err_code === 88888) {
|
||||
const response={data:JSON.parse(res.data)}
|
||||
loginExpired(response)
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -163,9 +165,9 @@ class MyNeeds extends Component {
|
||||
this.getMyNeedsList({
|
||||
})
|
||||
}, 1500);
|
||||
}else if (res.data.err_code === 88888) {
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@ -250,10 +252,10 @@ class MyNeeds extends Component {
|
||||
})
|
||||
}
|
||||
goToMyNeedsViewPage(Id) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + Id
|
||||
})
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + Id
|
||||
})
|
||||
|
||||
}
|
||||
goToMyNeedsEditPage(id) {
|
||||
Taro.navigateTo({
|
||||
@ -292,8 +294,8 @@ class MyNeeds extends Component {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
@ -454,7 +456,7 @@ class MyNeeds extends Component {
|
||||
</View>
|
||||
{/* 我的需求信息 */}
|
||||
{<View className='info-box'>
|
||||
{this.state.allNeedsList.length?myNeedsListArrayElement:<View className='no-more-title'>没有更多了</View>}
|
||||
{this.state.allNeedsList.length ? myNeedsListArrayElement : <View className='no-more-title'>没有更多了</View>}
|
||||
</View>}
|
||||
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
@ -462,7 +462,7 @@ class MyNeedsEdit extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/>
|
||||
</View>
|
||||
@ -473,7 +473,7 @@ class MyNeedsEdit extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
|
@ -27,8 +27,8 @@ class MyNeedsPublish extends Component {
|
||||
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
title: '',
|
||||
contactName: Taro.getStorageSync('user_identity').username,
|
||||
contactNumber: Taro.getStorageSync('user_identity').userphone,
|
||||
contactName: Taro.getStorageSync('user_identity').username||'',
|
||||
contactNumber: Taro.getStorageSync('user_identity').userphone||'',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
@ -337,7 +337,7 @@ class MyNeedsPublish extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/>
|
||||
</View>
|
||||
@ -348,7 +348,7 @@ class MyNeedsPublish extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
|
@ -318,7 +318,7 @@ class Shop extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 0) {
|
||||
if (res.data.err_code === 0) {
|
||||
this.setState({
|
||||
shopDescriptionData: res.data,
|
||||
shopName: res.data.data.shop_name,
|
||||
|
@ -280,7 +280,8 @@ class SupplyDemand extends Component {
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>供求类型:</Text> <Text className='selected'>{this.state.demandingSupplyCateSelected.name}</Text>
|
||||
<Text className='title'><Text className='require'>*</Text>供求类型:</Text>
|
||||
<Text className='selected'>{this.state.demandingSupplyCateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
@ -288,7 +289,8 @@ class SupplyDemand extends Component {
|
||||
</View>
|
||||
</View>
|
||||
<View className='border-box'>
|
||||
<Text className='require'>*</Text><AtInput
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
@ -330,7 +332,7 @@ class SupplyDemand extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/>
|
||||
</View>
|
||||
@ -341,7 +343,7 @@ class SupplyDemand extends Component {
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='200'
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
|
@ -19,52 +19,372 @@ bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
|
||||
const selfAndAvailable = localStoageUserId === this.state.userId && this.state.stateId === '1' && <View className='button-box'>
|
||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的需求</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goMyNeedEditPage.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>
|
||||
<AtIcon value='settings' size='12' color='white'></AtIcon>
|
||||
修改</Button>
|
||||
import { Picker } from 'taro-ui'
|
||||
|
||||
import './goodsTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
|
||||
let maxDepth = 0
|
||||
let initialDataArray = []
|
||||
class GoodsTypeInteractionComp extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: 'goodsTypeInteractionComp'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.state = {
|
||||
///---行业分类 开始
|
||||
initailMultiArray: [[{ class_name: '选择商品分类', class_id: '' }], [], []], // 初始化底部数据
|
||||
multiIndex: [0, 0, 0, 0],// 默认联动列数为4个并且每一列都是第一行
|
||||
interactionMultiArray: [],// 联动
|
||||
|
||||
|
||||
///---行业分类 结束
|
||||
}
|
||||
|
||||
}
|
||||
//商品目录请求api GetShopCategoryList
|
||||
getProductCateList(url) {
|
||||
Taro.request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品分类目录', res)
|
||||
|
||||
const recursionInteractionData=this.recursionInteraction(res.data.data)
|
||||
this.recursionInitialized(res.data.data) //
|
||||
console.log('initialDataArray',initialDataArray.reverse())
|
||||
this.setState({
|
||||
interactionMultiArray: recursionInteractionData,
|
||||
multiIndex: this.recursionDepth(res.data.data),
|
||||
initailMultiArray:initialDataArray.reverse()
|
||||
}, () => {
|
||||
initialDataArray=[]// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
|
||||
|
||||
}) // 用递归来整理无限层次的数据
|
||||
// console.log('联动数据', this.recursionInteraction(res.data.data))
|
||||
// console.log('初始数据', this.recursionInitialized(res.data.data).reverse())
|
||||
}else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
console.log('商品分类请求错误', error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//联动确认
|
||||
bindMultiPickerChange(e) {
|
||||
// 如果没有上商品 那就不执行
|
||||
if(Taro.getStorageSync('shopInfo').shop_id){
|
||||
this.setState({
|
||||
multiIndex: e.detail.value.map(item => { if (item === null) { item = 0 } return item })
|
||||
}, () => {
|
||||
// console.log('picker发送选择改变,携带值为', this.state.multiIndex)
|
||||
this.returnResultToParent()
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
returnResultToParent() {
|
||||
let selected = this.state.interactionMultiArray
|
||||
for (let index of this.state.multiIndex) {
|
||||
if (selected[index].children[0].id) {
|
||||
selected = selected[index].children
|
||||
} else {
|
||||
this.props.onPassDataToChild(selected[index])
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// 递归整理无限层初始数据,将整理好的数据赋值给initialDataArray
|
||||
recursionInitialized(data) {
|
||||
const arrayTem = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
}
|
||||
if(data[0].children.length){
|
||||
this.recursionInitialized(data[0].children)
|
||||
}
|
||||
initialDataArray.push(arrayTem)
|
||||
return arrayTem
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 递归整理无限层联动数据
|
||||
recursionInteraction(data) {
|
||||
let arrayTem = []
|
||||
for (let items of data) {
|
||||
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||
if (items.children) {
|
||||
arrayTem[arrayTem.length - 1].children = this.recursionInteraction(items.children)
|
||||
} else {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '', id: '' }]
|
||||
}
|
||||
}
|
||||
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) {
|
||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||
console.log(this.state.initailMultiArray)
|
||||
const data = {
|
||||
multiArray: this.state.initailMultiArray,
|
||||
multiIndex: this.state.multiIndex
|
||||
}
|
||||
data.multiIndex[e.detail.column] = e.detail.value
|
||||
|
||||
|
||||
if (e.detail.column == 0) {
|
||||
for (let index in data.multiArray[0]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[0]) {
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[indexNumber].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) {
|
||||
for (let index in data.multiArray[1]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[1]) {
|
||||
data.multiArray[2] = this.state.interactionMultiArray[data.multiIndex[0]].children[indexNumber].children
|
||||
}
|
||||
}
|
||||
}
|
||||
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.interactionMultiArray[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.interactionMultiArray[0].children
|
||||
// data.multiArray[2]=this.state.interactionMultiArray[0].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[3].children
|
||||
// break
|
||||
// case 4:
|
||||
// data.multiArray[1] = this.state.interactionMultiArray[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.interactionMultiArray[1].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[1].children[3].children ? this.state.interactionMultiArray[1].children[3].children : [{ class_name: '' }]
|
||||
// break
|
||||
// }
|
||||
// break
|
||||
// case 2:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[3].children
|
||||
// break
|
||||
// case 4:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[4].children
|
||||
// break
|
||||
// case 5:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[2].children[5].children
|
||||
// break
|
||||
// }
|
||||
// break
|
||||
// case 3:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[2].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[3].children
|
||||
// break
|
||||
// case 3:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[3].children[3].children
|
||||
// break
|
||||
// }
|
||||
// break
|
||||
// case 4:
|
||||
// switch (data.multiIndex[1]) {
|
||||
// case 0:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[4].children[0].children
|
||||
// break
|
||||
// case 1:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[4].children[1].children
|
||||
// break
|
||||
// case 2:
|
||||
// data.multiArray[2] = this.state.interactionMultiArray[4].children[2].children
|
||||
// break
|
||||
|
||||
// }
|
||||
// break
|
||||
|
||||
// }
|
||||
// data.multiIndex[2] = 0
|
||||
// data.multiIndex[3] = 0
|
||||
// break
|
||||
// }
|
||||
this.setState({ multiIndex: data.multiIndex })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
if(Taro.getStorageSync('shopInfo').shop_id){
|
||||
this.getProductCateList(this.props.url)
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View class='page-section'>
|
||||
<Picker
|
||||
rangeKey='name'
|
||||
mode='multiSelector'
|
||||
onChange={this.bindMultiPickerChange.bind(this)}
|
||||
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
||||
value={this.state.multiIndex}
|
||||
range={this.state.initailMultiArray}
|
||||
>
|
||||
<View class='picker type'>
|
||||
<View className='title-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>商品分类:</Text>
|
||||
<Text className='first-col'>
|
||||
{this.props.selectedValue.name}
|
||||
</Text>
|
||||
|
||||
{/* {this.state.initailMultiArray[0].length?<Text className='first-col'> {this.state.initailMultiArray[0][this.state.multiIndex[0]].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.initailMultiArray[2].length?<Text className='third-col'>{this.state.initailMultiArray[2][this.state.multiIndex[2]].name}</Text>:null} */}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
|
||||
<View className='button' onClick={this.deleteButton.bind(this)}>
|
||||
<Button size='mini' className='button-dark-red'>
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
删除</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
const selfAndUnAvaialble = localStoageUserId === this.state.userId && this.state.stateId != '1' && <View className='button-box'>
|
||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的需求</Button>
|
||||
</View>
|
||||
</View>
|
||||
const Avaialble = this.state.stateId === '1' && <View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View>
|
||||
const Unavailable = this.state.stateId === '2' && <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||
</View>
|
||||
const SoldOut = this.state.stateId === '3' && <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default GoodsTypeInteractionComp
|
||||
|
||||
const ButtonElement = selfAndAvailable || selfAndUnAvaialble || Avaialble || Unavailable || SoldOut
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user