三级联动
This commit is contained in:
parent
fc5ed758ea
commit
6c6f3df246
@ -0,0 +1,9 @@
|
|||||||
|
.orange{
|
||||||
|
color:#FF7142,
|
||||||
|
}
|
||||||
|
.orange-bg{
|
||||||
|
background-color:#FF7142,
|
||||||
|
}
|
||||||
|
.green-bg{
|
||||||
|
background-color: #5cb85c
|
||||||
|
}
|
@ -36,7 +36,6 @@ class recommondShop extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// api 优惠卷请求
|
// api 优惠卷请求
|
||||||
|
|
||||||
getVoucherInfo({ user = "杨夕兵", phone = "18950295811", shops = ["808"], source_type = 4, flag = false, source_class = "1", source_level = 1 }) {
|
getVoucherInfo({ user = "杨夕兵", phone = "18950295811", shops = ["808"], source_type = 4, flag = false, source_class = "1", source_level = 1 }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.GetVoucherInfo,
|
url: URL.GetVoucherInfo,
|
||||||
@ -197,19 +196,19 @@ class recommondShop extends Component {
|
|||||||
const voucherModalElement = <AtModal className='voucher-modal' isOpened={this.state.isOpenVouhcer}>
|
const voucherModalElement = <AtModal className='voucher-modal' isOpened={this.state.isOpenVouhcer}>
|
||||||
<AtModalHeader>优惠卷须知:</AtModalHeader>
|
<AtModalHeader>优惠卷须知:</AtModalHeader>
|
||||||
<AtModalContent>
|
<AtModalContent>
|
||||||
<AtNoticebar style='color:#a94442' icon='volume-plus'>
|
<AtNoticebar >
|
||||||
提示:具体可以前往实体店进行领取优惠卷或通过电话进行咨询
|
<Text className='orange' > 提示:具体可以前往实体店进行领取优惠卷或通过电话进行咨询</Text>
|
||||||
</AtNoticebar>
|
</AtNoticebar>
|
||||||
<View className='voucher-left'>当前优惠卷{voucherLeft}张</View>
|
<View className='voucher-left'>当前优惠卷{voucherLeft}张</View>
|
||||||
<AtInput
|
<AtInput
|
||||||
disabled
|
|
||||||
name='value'
|
name='value'
|
||||||
title='联系人:'
|
title='联系人:'
|
||||||
type='text'
|
type='text'
|
||||||
placeholder='123'
|
placeholder='123'
|
||||||
/>
|
/>
|
||||||
<AtInput
|
<AtInput
|
||||||
disabled
|
border={false}
|
||||||
name='value'
|
name='value'
|
||||||
title='联系电话:'
|
title='联系电话:'
|
||||||
type='number'
|
type='number'
|
||||||
@ -218,12 +217,17 @@ class recommondShop extends Component {
|
|||||||
{!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null}
|
{!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null}
|
||||||
|
|
||||||
</AtModalContent>
|
</AtModalContent>
|
||||||
<AtModalAction> <Button onClick={this.voucherModalClose.bind(this)} >取消</Button> <Button style='color:#FF7B00' onClick={this.voucherModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
<AtModalAction> <Button onClick={this.voucherModalClose.bind(this)} >取消</Button> <Button className='orange' onClick={this.voucherModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
</AtModal>
|
</AtModal>
|
||||||
const consultModalElement = <AtModal isOpened={this.state.isOpenConsult}>
|
const consultModalElement = <AtModal isOpened={this.state.isOpenConsult}>
|
||||||
<AtModalHeader>咨询</AtModalHeader>
|
<AtModalHeader>咨询</AtModalHeader>
|
||||||
<AtModalContent>
|
<AtModalContent>
|
||||||
<View className='tip'> <Text>提示:</Text><Text className='tip-info'>{this.state.consultTip}</Text></View>
|
|
||||||
|
<AtNoticebar >
|
||||||
|
<Text className='orange' >提示:{this.state.consultTip}</Text>
|
||||||
|
</AtNoticebar>
|
||||||
|
|
||||||
|
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='联系人:'
|
title='联系人:'
|
||||||
@ -235,9 +239,10 @@ class recommondShop extends Component {
|
|||||||
title='联系电话:'
|
title='联系电话:'
|
||||||
type='number'
|
type='number'
|
||||||
placeholder='需求标题'
|
placeholder='需求标题'
|
||||||
|
border={false}
|
||||||
/>
|
/>
|
||||||
</AtModalContent>
|
</AtModalContent>
|
||||||
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button onClick={this.consultModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button className='orange' onClick={this.consultModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
</AtModal>
|
</AtModal>
|
||||||
|
|
||||||
// 请提示元素
|
// 请提示元素
|
||||||
@ -259,8 +264,10 @@ class recommondShop extends Component {
|
|||||||
<Image src={ads !== 0 ? hornIcon : houseIcon} style='width:12px; height:12px; vertical-align: middle;' />
|
<Image src={ads !== 0 ? hornIcon : houseIcon} style='width:12px; height:12px; vertical-align: middle;' />
|
||||||
<Text style='margin-left:2px; vertical-align: middle;'> {title}</Text>
|
<Text style='margin-left:2px; vertical-align: middle;'> {title}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className='consult-voucher-button' >
|
<View className='consult-voucher-button' style='margin-right:5px'>
|
||||||
<Button onClick={this.isOpenVoucher.bind(this)} style='padding:0' className={voucherLeft ? 'voucher-button-text voucher' : 'voucher-button-text'} >优惠卷</Button>
|
{voucherLeft ? <Button onClick={this.isOpenVoucher.bind(this)} style='padding:0' className='voucher-button-text voucher' >优惠卷</Button> : <Button style='padding:0' className='voucher-button-text'>优惠卷</Button>}
|
||||||
|
|
||||||
|
|
||||||
<Button onClick={this.isOpenConsult.bind(this)} style='padding:0' className='consult-button-text'>询价</Button>
|
<Button onClick={this.isOpenConsult.bind(this)} style='padding:0' className='consult-button-text'>询价</Button>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
@ -277,8 +284,8 @@ class recommondShop extends Component {
|
|||||||
</View>
|
</View>
|
||||||
<View className='footer'>
|
<View className='footer'>
|
||||||
<View className='address'>
|
<View className='address'>
|
||||||
<AtIcon value='map-pin' size='15' color='#FF7142'></AtIcon>
|
<AtIcon value='map-pin' size='15' color='#999'></AtIcon>
|
||||||
{address} </View>
|
<Text>{address} </Text> </View>
|
||||||
<View className='distance'><Text>{distance}</Text></View>
|
<View className='distance'><Text>{distance}</Text></View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
.at-modal-content{
|
.at-modal-content{
|
||||||
background-color: black
|
background-color: black
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tip-info{
|
.tip-info{
|
||||||
@ -35,14 +33,16 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
// margin:20px;
|
overflow:hidden;
|
||||||
|
white-space:nowrap;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.consult-voucher-button{
|
.consult-voucher-button{
|
||||||
|
|
||||||
flex:1;
|
flex:1;
|
||||||
//margin-top: 20px ;
|
//margin-top: 20px ;
|
||||||
margin-left: 200px;
|
margin-left: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
//vertical-align: middle;
|
//vertical-align: middle;
|
||||||
|
|
||||||
@ -124,11 +124,15 @@
|
|||||||
.distance{
|
.distance{
|
||||||
width: 30%;
|
width: 30%;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
}
|
}
|
||||||
.address{
|
.address{
|
||||||
width:70%;
|
width:70%;
|
||||||
|
overflow:hidden;
|
||||||
|
white-space:nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.at-noticebar {
|
||||||
|
color:red;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -34,15 +34,14 @@ class SearchBarComponent extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View className='searchBarComponent'>
|
<View className='searchBarComponent'>
|
||||||
|
|
||||||
<View className='searchBar-box'>
|
<View className='searchBar-box'>
|
||||||
<AtSearchBar className='search-button'
|
<AtSearchBar className='search-button'
|
||||||
|
showActionButton
|
||||||
actionName='搜索'
|
actionName='搜索'
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
onChange={this.onChange.bind(this)}
|
onChange={this.onChange.bind(this)}
|
||||||
onActionClick={this.onActionClick.bind(this)}
|
onActionClick={this.onActionClick.bind(this)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
@ -13,7 +13,5 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
.search-button{
|
.search-button{
|
||||||
.at-search-bar__action{
|
font-size: 100px
|
||||||
background-color:#FF9900
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,156 +0,0 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
|
||||||
import { View,Button } from '@tarojs/components'
|
|
||||||
import { AtTag, AtButton} from 'taro-ui'
|
|
||||||
|
|
||||||
|
|
||||||
import URL from '../../serviceAPI.config'
|
|
||||||
|
|
||||||
import './sideBarFilterComponent.scss'
|
|
||||||
|
|
||||||
class sideBarFilterComponent extends Component {
|
|
||||||
// 项目配置
|
|
||||||
config = {
|
|
||||||
navigationBarTitleText: '筛选'
|
|
||||||
}
|
|
||||||
constructor() {
|
|
||||||
super(...arguments)
|
|
||||||
this.state = {
|
|
||||||
isActive:false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onClick(value){
|
|
||||||
console.log(value)
|
|
||||||
}
|
|
||||||
getSearchParam(){
|
|
||||||
Taro.request({
|
|
||||||
url: URL.GetSearchParam,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
goods: JSON.stringify({
|
|
||||||
shop_name: false,
|
|
||||||
shop_id: 808,
|
|
||||||
shop_class_id: "",
|
|
||||||
goods_type: 12
|
|
||||||
}),
|
|
||||||
goodsSpec: JSON.stringify([]),
|
|
||||||
goodsParam: JSON.stringify([]),
|
|
||||||
goodsParamExt: JSON.stringify([]),
|
|
||||||
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
console.log('param',res)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
getSearchResult(){
|
|
||||||
Taro.request({
|
|
||||||
url: URL.SearchResult,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
goods: JSON.stringify({
|
|
||||||
curr_page: 1,
|
|
||||||
page_count: 50,
|
|
||||||
shop_name: false,
|
|
||||||
shop_id: 808,
|
|
||||||
config_id: 4,
|
|
||||||
shop_class_id: '',
|
|
||||||
goods_type:12
|
|
||||||
}),
|
|
||||||
goodsSpec: JSON.stringify([]),
|
|
||||||
goodsParam: JSON.stringify([]),
|
|
||||||
goodsParamExt: JSON.stringify([]),
|
|
||||||
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
console.log('result',res)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
|
|
||||||
}
|
|
||||||
componentDidMount() {
|
|
||||||
this.getSearchParam()
|
|
||||||
this.getSearchResult()
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidShow() { }
|
|
||||||
|
|
||||||
componentDidHide() { }
|
|
||||||
render() {
|
|
||||||
|
|
||||||
const goodsClass = this.props.FilterText?this.props.FilterText.goods_class:null
|
|
||||||
const goodsType = this.props.FilterText?this.props.FilterText.goods_type:null
|
|
||||||
const widthness = this.props.FilterText?this.props.FilterText.goodsParamExt['5'].param_value[0]:null
|
|
||||||
|
|
||||||
const goodsParam = this.props.FilterText? this.props.FilterText.goodsParam:null
|
|
||||||
// 分类
|
|
||||||
const goodsClassElementsArray=goodsClass.map((item,index)=>{
|
|
||||||
return <AtTag style='margin-left:5px' key={index}
|
|
||||||
name={item.class_name}
|
|
||||||
type='primary'
|
|
||||||
active={this.state.isActive}
|
|
||||||
onClick={this.onClick.bind(this)}
|
|
||||||
>{item.class_name}</AtTag>
|
|
||||||
})
|
|
||||||
// 商品类型
|
|
||||||
const goodsTypeElementsArray=goodsType.map((item,index)=>{
|
|
||||||
return <AtTag style='margin-left:5px' key={index}
|
|
||||||
name={item.goods_type_ch_name}
|
|
||||||
type='primary'
|
|
||||||
active={this.state.isActive}
|
|
||||||
onClick={this.onClick.bind(this)}
|
|
||||||
>{item.goods_type_ch_name}</AtTag>
|
|
||||||
})
|
|
||||||
//---------
|
|
||||||
const goodsParamElementsArray = goodsParam.map((item,index)=>{
|
|
||||||
return <View key={index}><View className='title' >{item.param_name}</View>
|
|
||||||
<View className='button-box'>
|
|
||||||
<AtTag style='margin-left:5px'
|
|
||||||
name={item.param_value[0]}
|
|
||||||
type='primary'
|
|
||||||
active={this.state.isActive}
|
|
||||||
onClick={this.onClick.bind(this)}
|
|
||||||
>{item.param_value[0]}</AtTag>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
})
|
|
||||||
// 宽度
|
|
||||||
return (
|
|
||||||
<View className='filter-box'>
|
|
||||||
<View className='title'>分类</View>
|
|
||||||
<View className='button-box'>{goodsClassElementsArray}</View>
|
|
||||||
<View className='title'>商品类型</View>
|
|
||||||
<View className='button-box'>{goodsTypeElementsArray}</View>
|
|
||||||
{goodsParamElementsArray}
|
|
||||||
<View className='title'>宽度</View>
|
|
||||||
<View className='button-box'>
|
|
||||||
<AtTag style='margin-left:5px'
|
|
||||||
name={widthness.value_desc}
|
|
||||||
type='primary'
|
|
||||||
active={this.state.isActive}
|
|
||||||
onClick={this.onClick.bind(this)}
|
|
||||||
>{widthness.value_desc}</AtTag>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
<View className='confirm-button'>
|
|
||||||
<Button className='button' type='primary' size='mini' style='background-color:#FF9900' >确认</Button>
|
|
||||||
<Button className='button' type='primary' size='mini' style='background-color:#FF9900'>重置</Button>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default sideBarFilterComponent
|
|
@ -1,18 +0,0 @@
|
|||||||
.filter-box{
|
|
||||||
height: 100%;
|
|
||||||
margin-top: 30px;
|
|
||||||
overflow: scroll;
|
|
||||||
.title{
|
|
||||||
margin-left: 20px;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
.button-box{
|
|
||||||
margin:20px
|
|
||||||
}
|
|
||||||
.confirm-button{
|
|
||||||
margin: 80px;
|
|
||||||
.button{
|
|
||||||
margin:0 20px
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,6 +25,7 @@ class AllDemanding extends Component {
|
|||||||
industryCateSelected: '全部', // 当前行业分类状态
|
industryCateSelected: '全部', // 当前行业分类状态
|
||||||
startDateSel: '2018-04-22',
|
startDateSel: '2018-04-22',
|
||||||
endDateSel: '2018-04-22',
|
endDateSel: '2018-04-22',
|
||||||
|
startValidDate:'',
|
||||||
isOpenedGrabModal: false,
|
isOpenedGrabModal: false,
|
||||||
grabOrderId: '',//抢到订单的id
|
grabOrderId: '',//抢到订单的id
|
||||||
isGrabOrderSuccess: false,// 是否显示轻提示
|
isGrabOrderSuccess: false,// 是否显示轻提示
|
||||||
@ -82,7 +83,8 @@ class AllDemanding extends Component {
|
|||||||
//改变开始日期
|
//改变开始日期
|
||||||
onStartDateChange = e => {
|
onStartDateChange = e => {
|
||||||
this.setState({
|
this.setState({
|
||||||
startDateSel: e.detail.value
|
startDateSel: e.detail.value,
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 改变结束日期
|
// 改变结束日期
|
||||||
@ -113,7 +115,7 @@ class AllDemanding extends Component {
|
|||||||
|
|
||||||
this.setState({ isGrabOrderSuccess: false })
|
this.setState({ isGrabOrderSuccess: false })
|
||||||
|
|
||||||
}, 1000)
|
}, 2000)
|
||||||
})
|
})
|
||||||
console.log('抢单请求:', res)
|
console.log('抢单请求:', res)
|
||||||
})
|
})
|
||||||
@ -151,7 +153,7 @@ class AllDemanding extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
// 提示模态弹窗element
|
// 提示模态弹窗element
|
||||||
const modalMessageGrab = <AtModal className='modal'
|
const modalMessageGrabElement = <AtModal className='modal'
|
||||||
isOpened={this.state.isOpenedGrabModal}
|
isOpened={this.state.isOpenedGrabModal}
|
||||||
title='提示'
|
title='提示'
|
||||||
cancelText='取消'
|
cancelText='取消'
|
||||||
@ -162,10 +164,10 @@ class AllDemanding extends Component {
|
|||||||
content='确认抢单?\n'
|
content='确认抢单?\n'
|
||||||
/>
|
/>
|
||||||
// 抢单返回轻提示
|
// 抢单返回轻提示
|
||||||
const grabOrderSuccess = <AtToast
|
const grabOrderSuccessElement = <AtToast
|
||||||
isOpened={this.state.isGrabOrderSuccess}
|
isOpened={this.state.isGrabOrderSuccess}
|
||||||
text={this.state.grabOrderSuccess} // 轻提示字段显示不出来 to be continue
|
text={this.state.grabOrderSuccess}
|
||||||
duration={1000}
|
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}>
|
||||||
@ -201,9 +203,9 @@ class AllDemanding extends Component {
|
|||||||
return (
|
return (
|
||||||
<View className='allDemanding'>
|
<View className='allDemanding'>
|
||||||
{/* 模态框 */}
|
{/* 模态框 */}
|
||||||
{modalMessageGrab}
|
{modalMessageGrabElement}
|
||||||
{/* 轻提示 */}
|
{/* 轻提示 */}
|
||||||
{grabOrderSuccess}
|
{grabOrderSuccessElement}
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
{/* 供求状态选择 */}
|
{/* 供求状态选择 */}
|
||||||
<View>
|
<View>
|
||||||
@ -217,6 +219,7 @@ class AllDemanding extends Component {
|
|||||||
</Picker>
|
</Picker>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='input-box'>
|
<View className='input-box'>
|
||||||
<Text className='require'>*</Text>
|
<Text className='require'>*</Text>
|
||||||
<AtInput
|
<AtInput
|
||||||
@ -238,7 +241,7 @@ class AllDemanding extends Component {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Picker>
|
</Picker>
|
||||||
<Picker className='picker-container' mode='date' onChange={this.onEndDateChange}>
|
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
|
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text, Image , Swiper, SwiperItem} from '@tarojs/components'
|
import { View, Text, Image , Swiper, SwiperItem} from '@tarojs/components'
|
||||||
|
|
||||||
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast, Picker } from 'taro-ui'
|
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast, Picker,AtSearchBar } from 'taro-ui'
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
|
||||||
|
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
@ -130,8 +129,14 @@ class Goods extends Component {
|
|||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<View className='gooods=container'>
|
<View className='gooods=container'>
|
||||||
<SearchBarComponent></SearchBarComponent>
|
<View className='searchBar-box'>
|
||||||
<View className='img-box'>
|
<AtSearchBar className='search-button'
|
||||||
|
actionName='搜索'
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={this.onChange.bind(this)}
|
||||||
|
onActionClick={this.onActionClick.bind(this)}
|
||||||
|
/>
|
||||||
|
</View> <View className='img-box'>
|
||||||
{/* <Image className='img' src={URL.Base + this.state.productImagesUrl}></Image> */}
|
{/* <Image className='img' src={URL.Base + this.state.productImagesUrl}></Image> */}
|
||||||
<Swiper
|
<Swiper
|
||||||
className='swipper'
|
className='swipper'
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
// border: 1px solid #ddd;
|
// border: 1px solid #ddd;
|
||||||
// padding: 5px 0;
|
// padding: 5px 0;
|
||||||
|
.search-button{
|
||||||
|
.at-search-bar__action{
|
||||||
|
background-color:#FF7142
|
||||||
|
}
|
||||||
|
}
|
||||||
.img-box{
|
.img-box{
|
||||||
// border: 1px solid #ddd;
|
// border: 1px solid #ddd;
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
|
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
|
||||||
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui'
|
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast, AtSearchBar } from 'taro-ui'
|
||||||
|
|
||||||
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
|
|
||||||
@ -18,49 +16,9 @@ class GoodsPublish extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments)
|
super(...arguments)
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
||||||
objectMultiArray: [
|
objectMultiArray: [
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '扁性动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '线形动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '环节动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '软体动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '节肢动物'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '猪肉绦虫'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '吸血虫'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
multiIndex: [0, 0, 0],
|
multiIndex: [0, 0, 0],
|
||||||
shopCategoryPicker: [], // 店铺分类选项
|
shopCategoryPicker: [], // 店铺分类选项
|
||||||
@ -147,14 +105,13 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发布商品api
|
// 发布商品api
|
||||||
//{"goods_name":"hellol","goods_price":"1.00","goods_unit":"1","goods_profiles":"111","class_id":"2","shop_class_id":"1928"}
|
|
||||||
uploadGoods({ goods_name = "test2", goods_price = "1.00", goods_unit = "1", goods_profiles = "test2", class_id = "10103", shop_class_id = "1930" }) {
|
uploadGoods({ goods_name = "test2", goods_price = "1.00", goods_unit = "1", goods_profiles = "test2", class_id = "10103", shop_class_id = "1930" }) {
|
||||||
|
|
||||||
|
// 上传图片的参数
|
||||||
const uploadProductGoodFileParams = []
|
const uploadProductGoodFileParams = []
|
||||||
if (this.state.ImagesInfo.length) {
|
if (this.state.ImagesInfo.length) {
|
||||||
|
|
||||||
for (let i = 0; i < this.state.ImagesInfo.length; i++) {
|
for (let i = 0; i < this.state.ImagesInfo.length; i++) {
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
|
|
||||||
uploadProductGoodFileParams.push({
|
uploadProductGoodFileParams.push({
|
||||||
file_id: this.state.ImagesInfo[i].file_id,
|
file_id: this.state.ImagesInfo[i].file_id,
|
||||||
file_type: 1,
|
file_type: 1,
|
||||||
@ -174,8 +131,6 @@ class GoodsPublish extends Component {
|
|||||||
alert('图片为空')
|
alert('图片为空')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.UploadProduct,
|
url: URL.UploadProduct,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -200,39 +155,50 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.setState({ uploadProductTextTip: '发布成功', isUploadProductSuccess: true })
|
this.setState({ uploadProductTextTip: '发布成功', isUploadProductSuccess: true }, () => {
|
||||||
console.log('上传商品', res) // 提示非法请求 ----- to be continue
|
setTimeout(() => {
|
||||||
|
this.setState({ isUploadProductSuccess: false })
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/goodsPublish/goodsPublish'
|
||||||
|
})
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
console.log('上传商品', res)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this.setState({ uploadProductTextTip: '发布失败', isUploadProductSuccess: true })
|
this.setState({ uploadProductTextTip: '发布失败', isUploadProductSuccess: true }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({ isUploadProductSuccess: false })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 整理后台传出来的店铺分类目录
|
// 整理后台传出来的店铺分类目录
|
||||||
sortShopCateToState(shopData) {
|
sortShopCateToState(shopData) {
|
||||||
const firstColumn = []
|
const firstColumn = []
|
||||||
const secondColumn = []
|
const secondColumn = []
|
||||||
const thirdColumn = []
|
const thirdColumn = []
|
||||||
for (let outterItem of shopData) {
|
for (let outterItem of shopData) {
|
||||||
firstColumn.push({ id: outterItem.class_id, name: outterItem.class_name })
|
firstColumn.push({ id: outterItem.class_id, class_name: outterItem.class_name })
|
||||||
if (outterItem.children.length) {
|
if (outterItem.children.length) {
|
||||||
for (let middleItem of outterItem.children) {
|
for (let middleItem of outterItem.children) {
|
||||||
secondColumn.push({ id: middleItem.class_id, name: middleItem.class_name })
|
secondColumn.push({ id: middleItem.class_id, class_name: middleItem.class_name })
|
||||||
if (middleItem.children.length) {
|
if (middleItem.children.length) {
|
||||||
for (let innerItem of middleItem.children) {
|
for (let innerItem of middleItem.children) {
|
||||||
thirdColumn.push({ id: innerItem.class_id, name: innerItem.class_name })
|
thirdColumn.push({ id: innerItem.class_id, class_name: innerItem.class_name })
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------- 把新指传给objectMultiArray之后就不可以用了 to be continue
|
//------- 把新指传给objectMultiArray之后就不可以用了 to be continue
|
||||||
// console.log('old',this.state.objectMultiArray)
|
|
||||||
// this.setState({objectMultiArray:[firstColumn,secondColumn,thirdColumn]},()=>{
|
this.setState({ objectMultiArray: [firstColumn, secondColumn, thirdColumn] }, () => {
|
||||||
// console.log('new', this.state.objectMultiArray)
|
console.log('new', this.state.objectMultiArray)
|
||||||
// })
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 改变商品分类状态
|
// 改变商品分类状态
|
||||||
@ -266,7 +232,7 @@ class GoodsPublish extends Component {
|
|||||||
const that = this
|
const that = this
|
||||||
if (operationType === 'add') {
|
if (operationType === 'add') {
|
||||||
Taro.uploadFile({
|
Taro.uploadFile({
|
||||||
url: URL.UploadPorductImage, // 仅为示例,非真实的接口地址
|
url: URL.UploadPorductImage,
|
||||||
filePath: files[files.length - 1].url,
|
filePath: files[files.length - 1].url,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
formData: {
|
formData: {
|
||||||
@ -283,7 +249,9 @@ class GoodsPublish extends Component {
|
|||||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||||
that.setState({ pickerImageUrl: newPickerImageUrl, isUploadImageSuccess: true, uploadImageTextTip: '图片上传成功', ImagesInfo: newImageInfo }, () => {
|
that.setState({ pickerImageUrl: newPickerImageUrl, isUploadImageSuccess: true, uploadImageTextTip: '图片上传成功', ImagesInfo: newImageInfo }, () => {
|
||||||
// console.log(that.state.ImagesInfo)
|
setTimeout(() => {
|
||||||
|
that.setState({ isUploadImageSuccess: false })
|
||||||
|
}, 2000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -291,7 +259,11 @@ class GoodsPublish extends Component {
|
|||||||
if (operationType === 'remove') {
|
if (operationType === 'remove') {
|
||||||
this.state.pickerImageUrl.splice(index, 1);
|
this.state.pickerImageUrl.splice(index, 1);
|
||||||
this.setState({ files: this.state.pickerImageUrl });
|
this.setState({ files: this.state.pickerImageUrl });
|
||||||
that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' })
|
that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
that.setState({ isUploadImageSuccess: false })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 图片上传失败
|
// 图片上传失败
|
||||||
@ -302,7 +274,7 @@ class GoodsPublish extends Component {
|
|||||||
onImageClick(index) {
|
onImageClick(index) {
|
||||||
}
|
}
|
||||||
onClickUploadGoods() {
|
onClickUploadGoods() {
|
||||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length) {
|
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) {
|
||||||
this.uploadGoods({
|
this.uploadGoods({
|
||||||
goods_name: this.state.productName,
|
goods_name: this.state.productName,
|
||||||
goods_price: this.state.productPrice,
|
goods_price: this.state.productPrice,
|
||||||
@ -310,11 +282,13 @@ class GoodsPublish extends Component {
|
|||||||
goods_profiles: this.state.productDescript,
|
goods_profiles: this.state.productDescript,
|
||||||
class_id: "10103",
|
class_id: "10103",
|
||||||
shop_class_id: this.state.shopCategoryCheckedPicker,
|
shop_class_id: this.state.shopCategoryCheckedPicker,
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.setState({ uploadProductTextTip: '请填写完表格', isUploadProductSuccess: true })
|
this.setState({ uploadProductTextTip: '请填写完表格', isUploadProductSuccess: true }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({ isUploadProductSuccess: false })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shopCategoryChanged(e) {
|
shopCategoryChanged(e) {
|
||||||
@ -359,42 +333,21 @@ class GoodsPublish extends Component {
|
|||||||
case 0:
|
case 0:
|
||||||
switch (data.multiIndex[0]) {
|
switch (data.multiIndex[0]) {
|
||||||
case 0:
|
case 0:
|
||||||
data.multiArray[1] = [
|
data.multiArray[1] = this.state.productCategoryList[0].children ? this.state.productCategoryList[0].children : [{ class_name: '' }]
|
||||||
{
|
data.multiArray[2] = this.state.productCategoryList[0].children ? this.state.productCategoryList[0].children : [{ class_name: '' }]
|
||||||
id: 0,
|
|
||||||
name: '01'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '10a'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '02'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '02a'
|
|
||||||
}]
|
|
||||||
break
|
break
|
||||||
case 1:
|
case 1:
|
||||||
data.multiArray[1] = [{
|
data.multiArray[1] = this.state.productCategoryList[1].children
|
||||||
id: 0,
|
break
|
||||||
name: '11'
|
case 2:
|
||||||
},
|
data.multiArray[1] = this.state.productCategoryList[2].children
|
||||||
{
|
break
|
||||||
id: 1,
|
case 3:
|
||||||
name: '11a'
|
data.multiArray[1] = this.state.productCategoryList[3].children
|
||||||
}]
|
break
|
||||||
data.multiArray[2] = [{
|
case 4:
|
||||||
id: 0,
|
data.multiArray[1] = this.state.productCategoryList[4].children
|
||||||
name: '12'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '12a'
|
|
||||||
}]
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
data.multiIndex[1] = 0
|
data.multiIndex[1] = 0
|
||||||
@ -403,109 +356,84 @@ class GoodsPublish extends Component {
|
|||||||
case 1:
|
case 1:
|
||||||
switch (data.multiIndex[0]) {
|
switch (data.multiIndex[0]) {
|
||||||
case 0:
|
case 0:
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
break
|
||||||
case 1:
|
case 1:
|
||||||
data.multiArray[2] = [
|
switch (data.multiIndex[1]) {
|
||||||
{
|
case 0:
|
||||||
id: 1,
|
data.multiArray[2] = this.state.productCategoryList[1].children[0].children
|
||||||
name: '脊柱动物'
|
break
|
||||||
}]
|
case 1:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[1].children[1].children
|
||||||
break
|
break
|
||||||
case 2:
|
case 2:
|
||||||
data.multiArray[2] = [{
|
data.multiArray[2] = this.state.productCategoryList[1].children[2].children
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
break
|
||||||
case 3:
|
case 3:
|
||||||
data.multiArray[2] = [{
|
data.multiArray[2] = this.state.productCategoryList[1].children[3].children ? this.state.productCategoryList[1].children[3].children : [{ class_name: '' }]
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}, {
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 1:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}, {
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 2:
|
case 2:
|
||||||
data.multiArray[2] = [{
|
switch (data.multiIndex[1]) {
|
||||||
id: 0,
|
case 0:
|
||||||
name: '蛇'
|
data.multiArray[2] = this.state.productCategoryList[2].children[0].children
|
||||||
},
|
break
|
||||||
{
|
case 1:
|
||||||
id: 1,
|
data.multiArray[2] = this.state.productCategoryList[2].children[1].children
|
||||||
name: '青蛙'
|
break
|
||||||
}]
|
case 2:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[2].children[2].children
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[2].children[3].children
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[2].children[4].children
|
||||||
|
break
|
||||||
|
case 5:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[2].children[5].children
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 3:
|
||||||
|
switch (data.multiIndex[1]) {
|
||||||
|
case 0:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[3].children[0].children
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[3].children[1].children
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[3].children[2].children
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[3].children[3].children ? this.state.productCategoryList[3].children[3].children : [{ class_name: '' }]
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[3].children[3].children ? this.state.productCategoryList[3].children[3].children : [{ class_name: '' }]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
switch (data.multiIndex[1]) {
|
||||||
|
case 0:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[4].children[0].children
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[4].children[1].children
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
data.multiArray[2] = this.state.productCategoryList[4].children[2].children
|
||||||
|
break
|
||||||
|
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
data.multiIndex[2] = 0
|
data.multiIndex[2] = 0
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
console.log(data.multiIndex)
|
|
||||||
this.setState({ multiIndex: data.multiIndex })
|
this.setState({ multiIndex: data.multiIndex })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,33 +441,40 @@ class GoodsPublish extends Component {
|
|||||||
const imageUploadSuccess = <AtToast
|
const imageUploadSuccess = <AtToast
|
||||||
isOpened={this.state.isUploadImageSuccess}
|
isOpened={this.state.isUploadImageSuccess}
|
||||||
text={this.state.uploadImageTextTip}
|
text={this.state.uploadImageTextTip}
|
||||||
duration={1000}
|
duration={2000}
|
||||||
></AtToast>
|
></AtToast>
|
||||||
const productUploadSuccess = <AtToast
|
const productUploadSuccess = <AtToast
|
||||||
isOpened={this.state.isUploadProductSuccess}
|
isOpened={this.state.isUploadProductSuccess}
|
||||||
text={this.state.uploadProductTextTip}
|
text={this.state.uploadProductTextTip}
|
||||||
duration={1000}
|
duration={2000}
|
||||||
></AtToast>
|
></AtToast>
|
||||||
return (
|
return (
|
||||||
<View className='goods-publish'>
|
<View className='goods-publish'>
|
||||||
{imageUploadSuccess}
|
{imageUploadSuccess}
|
||||||
{productUploadSuccess}
|
{productUploadSuccess}
|
||||||
<SearchBarComponent></SearchBarComponent>
|
<View className='searchBar-box'>
|
||||||
|
<AtSearchBar className='search-button'
|
||||||
|
actionName='搜索'
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={this.onChange.bind(this)}
|
||||||
|
onActionClick={this.onActionClick.bind(this)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
<View className='goods-category'>
|
<View className='goods-category'>
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
<View>
|
<View>
|
||||||
<Picker mode='selector'
|
<Picker
|
||||||
range={this.state.objectMultiArray}
|
range={this.state.objectMultiArray}
|
||||||
onChange={this.bindMultiPickerChange.bind(this)}
|
onChange={this.bindMultiPickerChange.bind(this)}
|
||||||
rangeKey='name'
|
rangeKey='class_name'
|
||||||
mode="multiSelector"
|
mode='multiSelector'
|
||||||
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
||||||
value={this.state.multiIndex}
|
value={this.state.multiIndex}
|
||||||
>
|
>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='title'><Text className='require'>*</Text>商品分类:</Text> <Text className='selected'>
|
<Text className='title'><Text className='require'>*</Text>商品分类:</Text> <Text className='selected'>
|
||||||
{/* {this.state.multiArray[0][this.state.multiIndex[0]].name}{this.state.multiArray[1][this.state.multiIndex[1]].name}{this.state.multiArray[2][this.state.multiIndex[2]].name} */}
|
{this.state.objectMultiArray[0][this.state.multiIndex[0]].class_name}{this.state.objectMultiArray[1][this.state.multiIndex[1]].class_name}{this.state.objectMultiArray[2][this.state.multiIndex[2]].class_name}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@ -630,9 +565,9 @@ class GoodsPublish extends Component {
|
|||||||
<View className='button' >
|
<View className='button' >
|
||||||
<AtButton type='primary' size='small' onClick={this.onClickUploadGoods.bind(this)}>发布</AtButton>
|
<AtButton type='primary' size='small' onClick={this.onClickUploadGoods.bind(this)}>发布</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View className='button'>
|
{/* <View className='button'>
|
||||||
<AtButton type='primary' className='button-a' size='small' >发布并新增</AtButton>
|
<AtButton type='primary' className='button-a' size='small' >发布并新增</AtButton>
|
||||||
</View>
|
</View> */}
|
||||||
<View className='button'>
|
<View className='button'>
|
||||||
<AtButton type='primary' className='button-a' size='small'>商品列表</AtButton>
|
<AtButton type='primary' className='button-a' size='small'>商品列表</AtButton>
|
||||||
</View>
|
</View>
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
.search-button{
|
||||||
|
.at-search-bar__action{
|
||||||
|
background-color:#FF7142
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.goods-category{
|
.goods-category{
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
.border-box{
|
.border-box{
|
||||||
@ -78,10 +85,8 @@
|
|||||||
flex:1;
|
flex:1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
.at-button--primary{
|
.at-button--primary{
|
||||||
background-color:#FF9500;
|
background-color:#FF7142;
|
||||||
border:1PX solid #FF9500;
|
border:1PX solid #FF7142;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.button-a{
|
.button-a{
|
||||||
background-color:#5cb85c;
|
background-color:#5cb85c;
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||||
import { AtModal, AtButton, AtToast } from 'taro-ui'
|
import { AtModal, AtButton, AtToast,AtModalHeader ,AtModalContent,AtModalAction} from 'taro-ui'
|
||||||
import filteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
import filteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||||
import bottomNav from '../../component/bottomNav/bottomNav'
|
import bottomNav from '../../component/bottomNav/bottomNav'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
import './home.scss'
|
import './home.scss'
|
||||||
|
|
||||||
class Home extends Component {
|
class Home extends Component {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -23,7 +24,7 @@ class Home extends Component {
|
|||||||
isOpen: false, // 抢单消息提示
|
isOpen: false, // 抢单消息提示
|
||||||
grabOrderId: '',//抢到订单的id
|
grabOrderId: '',//抢到订单的id
|
||||||
isGrabOrderSuccess: false,// 是否显示轻提示
|
isGrabOrderSuccess: false,// 是否显示轻提示
|
||||||
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
grabOrderSuccess: '',// 抢单成功返回字段
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,13 +148,10 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
||||||
this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true }, () => {
|
this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true }, () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log(this.state.grabOrderSuccess)
|
|
||||||
this.setState({ isGrabOrderSuccess: false })
|
this.setState({ isGrabOrderSuccess: false })
|
||||||
|
}, 2000)
|
||||||
}, 1000)
|
|
||||||
})
|
})
|
||||||
console.log('抢单请求:', res)
|
console.log('抢单请求:', res)
|
||||||
|
|
||||||
@ -221,22 +219,23 @@ class Home extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
|
||||||
// 提示模态弹窗element
|
// 提示模态弹窗element
|
||||||
const modalMessageGrab = <AtModal className='modal'
|
const modalMessageGrabElement=<AtModal isOpened={this.state.isOpen}>
|
||||||
isOpened={this.state.isOpen}
|
<AtModalHeader>提示</AtModalHeader>
|
||||||
title='提示'
|
<AtModalContent>
|
||||||
cancelText='取消'
|
确认抢单?
|
||||||
confirmText='确认'
|
</AtModalContent>
|
||||||
onClose={this.handleGrabModalClose}
|
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||||
onCancel={this.handleGrabModalCancel}
|
</AtModal>
|
||||||
onConfirm={this.handleGrabConfirm.bind(this)}
|
|
||||||
content='确认抢单?\n'
|
|
||||||
/>
|
|
||||||
// 抢单返回轻提示
|
// 抢单返回轻提示
|
||||||
const grabOrderSuccess = <AtToast
|
const grabOrderSuccessElement = <AtToast
|
||||||
isOpened={this.state.isGrabOrderSuccess}
|
isOpened={this.state.isGrabOrderSuccess}
|
||||||
text={this.state.grabOrderSuccess} // 轻提示字段显示不出来 to be continue
|
text={this.state.grabOrderSuccess}
|
||||||
duration={1000}
|
duration={2000}
|
||||||
></AtToast>
|
></AtToast>
|
||||||
|
|
||||||
|
|
||||||
@ -296,12 +295,11 @@ class Home extends Component {
|
|||||||
return (
|
return (
|
||||||
<View className='home'>
|
<View className='home'>
|
||||||
{/* 抢单成功预付轻提示 */}
|
{/* 抢单成功预付轻提示 */}
|
||||||
{grabOrderSuccess}
|
{grabOrderSuccessElement}
|
||||||
{/* 获取微信用户的信息 */}
|
{/* 获取微信用户的信息 */}
|
||||||
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||||
|
|
||||||
{modalMessageGrab}
|
{modalMessageGrabElement}
|
||||||
{/* 第一行图片滚动条 */}
|
|
||||||
|
|
||||||
<View className='first-banner'>
|
<View className='first-banner'>
|
||||||
<Swiper
|
<Swiper
|
||||||
|
@ -28,8 +28,8 @@ class Index extends Component {
|
|||||||
//http://ihome6.com/Shop-supplyShops
|
//http://ihome6.com/Shop-supplyShops
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
// url: '/pages/allDemanding/allDemanding'
|
url: '/pages/goodsPublish/goodsPublish'
|
||||||
url: '/pages/home/home'
|
// url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||||
// url:'/pages/supplyDemandPublish/supplyDemandPublish'
|
// url:'/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
import { AtInput, AtButton, Picker, AtIcon } from 'taro-ui'
|
import { AtInput, AtButton, Picker, AtIcon, AtModal, AtToast ,AtSearchBar} from 'taro-ui'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import searchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
|
||||||
|
|
||||||
|
|
||||||
import './mySupplyDemand.scss'
|
import './mySupplyDemand.scss'
|
||||||
@ -28,11 +27,16 @@ class MySupplyDemand extends Component {
|
|||||||
endDateSel: '2018-04-22',
|
endDateSel: '2018-04-22',
|
||||||
allDemandSupply: [],
|
allDemandSupply: [],
|
||||||
totalDemandSupply: '',
|
totalDemandSupply: '',
|
||||||
|
isToast: false,// 是否显示轻提示
|
||||||
|
toastContent: '', // 轻提示内容
|
||||||
|
isConfirmWindow: false, // 是否显示确认弹窗
|
||||||
|
demandSupplyItemName: '',// 确认框提示时 使用的供求名
|
||||||
|
demandSupplyId: '',// 删除我的供求时的供求id
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//MySupplyDemand
|
//获取我的供求API
|
||||||
getMySupplyDemand({ curr_page = 1, page_count = 20 }) {
|
getMySupplyDemand({ curr_page = 1, page_count = 20 }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.MySupplyDemand,
|
url: URL.MySupplyDemand,
|
||||||
@ -51,16 +55,99 @@ class MySupplyDemand extends Component {
|
|||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res) // ------------------------------------------- to be continue----
|
|
||||||
// console.log('个人供求=》暂时无数据, 后台需要权限验证')
|
|
||||||
if (res.data.err_msg === "success") {
|
if (res.data.err_msg === "success") {
|
||||||
this.setState({ allDemandSupply: res.data.supplys,totalDemandSupply:res.data.count })
|
// 判断是否有res.data.supplys , 如果没有就是空数组[]
|
||||||
|
this.setState({ allDemandSupply: res.data.supplys?res.data.supplys:[], totalDemandSupply: res.data.count })
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
//搜索我的供求api
|
||||||
|
searchDemandSupply({ curr_page = 1, page_count = 20, sd_type = "2", state = "1", sd_title = "1", update_dateL = "2018-12-18", update_dateU = "2018-12-20" }) {
|
||||||
|
Taro.request({
|
||||||
|
url: URL.SearchDemandSupply,
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
param: JSON.stringify({
|
||||||
|
curr_page: curr_page,
|
||||||
|
page_count: page_count,
|
||||||
|
sd_type: sd_type,
|
||||||
|
state: state,
|
||||||
|
sd_title: sd_title,
|
||||||
|
update_dateL: update_dateL,
|
||||||
|
update_dateU: update_dateU
|
||||||
|
})
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
//this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true })
|
||||||
|
console.log('我的供求搜索结果', res)
|
||||||
|
|
||||||
|
this.setState({ allDemandSupply: res.data.supplys, totalDemandSupply: res.data.count })
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除我的供求api
|
||||||
|
onDelete({ sdID = 0 }) {
|
||||||
|
Taro.request({
|
||||||
|
url: URL.DeleteDemandSupply,
|
||||||
|
method: 'POST',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
sdID: sdID
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.data.err_msg == 'success') {
|
||||||
|
console.log('删除成功')
|
||||||
|
this.setState({ toastContent: '删除成功', isToast: true }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({ isToast: false })
|
||||||
|
this.getMySupplyDemand({})
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.setState({ toastContent: res.data.err_msg, isToast: true }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({ isToast: false })
|
||||||
|
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.catch(error => {
|
||||||
|
this.setState({ toastContent: '删除失败', isToast: true }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({ isToast: false })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//搜索我的供求
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 新增我的供求
|
||||||
|
addDemandSupply() {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//修改供求类型
|
//修改供求类型
|
||||||
@ -90,6 +177,29 @@ class MySupplyDemand extends Component {
|
|||||||
endDateSel: e.detail.value
|
endDateSel: e.detail.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
handleWindowModClose() {
|
||||||
|
this.setState({ isConfirmWindow: false })
|
||||||
|
}
|
||||||
|
handleWindowModCancel() {
|
||||||
|
this.setState({ isConfirmWindow: false })
|
||||||
|
}
|
||||||
|
handleWindowConfirm() {
|
||||||
|
this.setState({ isConfirmWindow: false })
|
||||||
|
this.onDelete({ sdID: this.state.demandSupplyId })
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除我的供求
|
||||||
|
handleOnDelete(id, itemName) {
|
||||||
|
|
||||||
|
this.setState({ isConfirmWindow: true, demandSupplyItemName: itemName, demandSupplyId: id })
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑我的供求
|
||||||
|
|
||||||
|
|
||||||
|
//查看我的供求
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
console.log(this.props, nextProps)
|
console.log(this.props, nextProps)
|
||||||
}
|
}
|
||||||
@ -104,6 +214,23 @@ class MySupplyDemand extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
// 提示模态弹窗element
|
||||||
|
const modalMessageConfirmElement = <AtModal className='modal'
|
||||||
|
isOpened={this.state.isConfirmWindow}
|
||||||
|
title='提示'
|
||||||
|
cancelText='取消'
|
||||||
|
confirmText='确认'
|
||||||
|
onClose={this.handleWindowModClose}
|
||||||
|
onCancel={this.handleWindowModCancel}
|
||||||
|
onConfirm={this.handleWindowConfirm.bind(this)}
|
||||||
|
content={'确认删除' + this.state.demandSupplyItemName + '?'}
|
||||||
|
/>
|
||||||
|
// 轻提示
|
||||||
|
const toastElement = <AtToast
|
||||||
|
isOpened={this.state.isToast}
|
||||||
|
text={this.state.toastContent}
|
||||||
|
duration={2000}
|
||||||
|
></AtToast>
|
||||||
const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => {
|
const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => {
|
||||||
return <View key={index} className='info-container'>
|
return <View key={index} className='info-container'>
|
||||||
<View className='type'>
|
<View className='type'>
|
||||||
@ -137,17 +264,32 @@ class MySupplyDemand extends Component {
|
|||||||
<View className='button'>
|
<View className='button'>
|
||||||
<AtButton type='primary' size='small'>编辑</AtButton>
|
<AtButton type='primary' size='small'>编辑</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View className='button'>
|
<View className='button' onClick={this.handleOnDelete.bind(this, item.sd_id, item.sd_title)}>
|
||||||
<AtButton type='primary' className='button-a' size='small'>删除</AtButton>
|
<AtButton type='primary' className='button-a' size='small'>删除</AtButton>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
}) : null
|
}) : <View className='title' >
|
||||||
|
没有更多了....
|
||||||
|
</View >
|
||||||
return (
|
return (
|
||||||
<View className='mySupplyDemand'>
|
<View className='mySupplyDemand'>
|
||||||
<searchBarComponent></searchBarComponent>
|
{/* 是否删除供求确认框 */}
|
||||||
|
{modalMessageConfirmElement}
|
||||||
|
{/* 轻提示 */}
|
||||||
|
{toastElement}
|
||||||
|
|
||||||
|
|
||||||
|
<View className='searchBar-box'>
|
||||||
|
<AtSearchBar className='search-button'
|
||||||
|
actionName='搜索'
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={this.onChange.bind(this)}
|
||||||
|
onActionClick={this.onActionClick.bind(this)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
{/* 供求类型 */}
|
{/* 供求类型 */}
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
<View>
|
<View>
|
||||||
@ -209,12 +351,12 @@ class MySupplyDemand extends Component {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='button-box'>
|
<View className='button-box'>
|
||||||
<View className='button'>
|
<View className='button' onClick={this.searchDemandSupply.bind(this)}>
|
||||||
<AtButton type='primary' size='small'>
|
<AtButton type='primary' size='small'>
|
||||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||||
搜索</AtButton>
|
搜索</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View className='button'>
|
<View className='button' onClick={this.addDemandSupply.bind(this)}>
|
||||||
<AtButton type='primary' className='button-a' size='small'>
|
<AtButton type='primary' className='button-a' size='small'>
|
||||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||||
新增</AtButton>
|
新增</AtButton>
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
.require{
|
.require{
|
||||||
color:red;
|
color:red;
|
||||||
line-height:100rpx;
|
line-height:100rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
.search-button{
|
||||||
|
.at-search-bar__action{
|
||||||
|
background-color:#FF7142
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.total-count{
|
.total-count{
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@ -71,8 +77,8 @@
|
|||||||
flex:1;
|
flex:1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
.at-button--primary{
|
.at-button--primary{
|
||||||
background-color:#FF9500;
|
background-color:#FF7142;
|
||||||
border:1PX solid #FF9500;
|
border:1PX solid #FF7142;
|
||||||
}
|
}
|
||||||
.button-a{
|
.button-a{
|
||||||
|
|
||||||
@ -120,3 +126,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title{
|
||||||
|
text-align: center;
|
||||||
|
font-size: 35px;
|
||||||
|
|
||||||
|
}
|
@ -407,8 +407,8 @@ class Shop extends Component {
|
|||||||
>{widthness.value_desc}</AtTag> */}
|
>{widthness.value_desc}</AtTag> */}
|
||||||
</View>
|
</View>
|
||||||
<View className='confirm-button'>
|
<View className='confirm-button'>
|
||||||
<Button className='button' type='primary' size='mini' style='background-color:#FF9900' >确认</Button>
|
<Button className='button' type='primary' size='mini' style='background-color:#FF7142' >确认</Button>
|
||||||
<Button className='button' type='primary' size='mini' style='background-color:#FF9900'>重置</Button>
|
<Button className='button' type='primary' size='mini' style='background-color:#5cb85c'>重置</Button>
|
||||||
<View className='gap'></View>
|
<View className='gap'></View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
.shop{
|
.shop{
|
||||||
.search-button{
|
.search-button{
|
||||||
.at-search-bar__action{
|
.at-search-bar__action{
|
||||||
background-color:#FF9900
|
background-color:#FF7142
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +106,9 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
.show{
|
.show{
|
||||||
left:0px
|
left:0px;
|
||||||
|
width:100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
|
|
||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } from 'taro-ui'
|
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast,AtSearchBar } from 'taro-ui'
|
||||||
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
|
||||||
|
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
@ -29,57 +28,88 @@ class SupplyDemand extends Component {
|
|||||||
contactNumber: '',
|
contactNumber: '',
|
||||||
contactAddress: '',
|
contactAddress: '',
|
||||||
content: '',
|
content: '',
|
||||||
addImg: true, // 是否支持添加图片
|
pickerImageUrl: [], // 上传的图片
|
||||||
files: [{
|
ImagesInfo: [],// 后台传回来的图片信息
|
||||||
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
|
isUploadImageSuccess: false,
|
||||||
},
|
uploadImageTextTip: '',
|
||||||
{
|
isFormCompleted: false,
|
||||||
url: 'https://jimczj.gitee.io/lazyrepay/aragaki2.jpeg',
|
isUploadDemSupSuccess: false,
|
||||||
},
|
uploadDemSupTextTip: '',
|
||||||
{
|
|
||||||
url: 'https://jimczj.gitee.io/lazyrepay/aragaki3.png',
|
|
||||||
}]
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传供求api
|
// 上传供求api
|
||||||
uploadSupplyDemand() {
|
uploadSupplyDemand() {
|
||||||
Taro.request({
|
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.contactAddress && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||||
url: URL.UploadSupplyDemand,
|
this.uploadDemSup({})
|
||||||
method: 'POST',
|
} else {
|
||||||
dataType: 'json',
|
this.setState({ uploadDemSupTextTip: '请填写完表格', isUploadDemSupSuccess: true }, () => {
|
||||||
data: {
|
setTimeout(() => {
|
||||||
action: 1,
|
this.setState({ isUploadDemSupSuccess: false })
|
||||||
sdInfo: JSON.stringify({ "sd_type": "2", "sd_title": "534523", "user_name": "杨夕兵", "user_phone": "18950295811", "user_address": "2342", "sd_desc": "42342", "state": "1", "file_path": [{ "file_name": "bg3.jpg", "file_size": "212678", "file_path": "Uploads/supply/user_27/201812/38bf91f30d215bbefb2686f2401217a6.jpg", "thumb_path": "Uploads/supply/user_27/201812/thumb/38bf91f30d215bbefb2686f2401217a6_200X200.jpg" }] })
|
}, 2000)
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then(res => {
|
|
||||||
console.log('上传供求', res)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传商品图片api
|
// Taro.request({
|
||||||
uploadGoodsImage() {
|
// url: URL.UploadSupplyDemand,
|
||||||
Taro.request({
|
// method: 'POST',
|
||||||
|
// dataType: 'json',
|
||||||
|
// data: {
|
||||||
|
// action: 1,
|
||||||
|
// sdInfo: JSON.stringify({ "sd_type": "2", "sd_title": "534523", "user_name": "杨夕兵", "user_phone": "18950295811", "user_address": "2342", "sd_desc": "42342", "state": "1", "file_path": [{ "file_name": "bg3.jpg", "file_size": "212678", "file_path": "Uploads/supply/user_27/201812/38bf91f30d215bbefb2686f2401217a6.jpg", "thumb_path": "Uploads/supply/user_27/201812/thumb/38bf91f30d215bbefb2686f2401217a6_200X200.jpg" }] })
|
||||||
|
// },
|
||||||
|
// header: {
|
||||||
|
// 'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .then(res => {
|
||||||
|
// console.log('上传供求', res)
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
}
|
||||||
|
|
||||||
|
// 这个需要写一个uploadDemSup 上传供求 的api
|
||||||
|
|
||||||
|
|
||||||
|
// 上传图片
|
||||||
|
onChangeImg(files, operationType, index) {
|
||||||
|
const that = this
|
||||||
|
if (operationType === 'add') {
|
||||||
|
Taro.uploadFile({
|
||||||
url: URL.UploadPorductImage,
|
url: URL.UploadPorductImage,
|
||||||
method: 'POST',
|
filePath: files[files.length - 1].url,
|
||||||
dataType: 'json',
|
name: 'file',
|
||||||
data: {
|
formData: {
|
||||||
file: 1,
|
user: 'test'
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
'content-type': 'multipart/form-data',
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
success(response) {
|
||||||
|
const data = JSON.parse(response.data)
|
||||||
|
const imagePath = URL.Base + data.file_path
|
||||||
|
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||||
|
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||||
|
that.setState({ pickerImageUrl: newPickerImageUrl, isUploadImageSuccess: true, uploadImageTextTip: '图片上传成功', ImagesInfo: newImageInfo }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
that.setState({ isUploadImageSuccess: false })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
|
||||||
console.log('上传商品图片', res)
|
|
||||||
}
|
}
|
||||||
)
|
if (operationType === 'remove') {
|
||||||
|
this.state.pickerImageUrl.splice(index, 1);
|
||||||
|
this.setState({ files: this.state.pickerImageUrl });
|
||||||
|
that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' }, () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
that.setState({ isUploadImageSuccess: false })
|
||||||
|
}, 2000)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 修改供求类型
|
// 修改供求类型
|
||||||
demandingSupplyCate = e => {
|
demandingSupplyCate = e => {
|
||||||
@ -109,34 +139,10 @@ class SupplyDemand extends Component {
|
|||||||
contentChange(event) {
|
contentChange(event) {
|
||||||
this.setState({ content: event.target.value })
|
this.setState({ content: event.target.value })
|
||||||
}
|
}
|
||||||
// 添加图片
|
|
||||||
onChange(files, operationType, index) {
|
|
||||||
console.log(files[0].url)
|
|
||||||
Taro.uploadFile(files[0].url).then((res)=>{
|
|
||||||
console.log(res)
|
|
||||||
})
|
|
||||||
if (operationType === 'add') {
|
|
||||||
this.setState({
|
|
||||||
files
|
|
||||||
}, () => {
|
|
||||||
if (this.state.files.length === 4) {
|
|
||||||
this.setState({ addImg: false })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (operationType === 'remove') {
|
|
||||||
this.state.files.splice(index, 1);
|
|
||||||
this.setState({ files: this.state.files });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onFail(mes) {
|
|
||||||
console.log(mes)
|
|
||||||
}
|
|
||||||
onImageClick(index, file) {
|
|
||||||
console.log(index, file)
|
|
||||||
}
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.uploadSupplyDemand()
|
// this.uploadSupplyDemand()
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
console.log(this.props, nextProps)
|
console.log(this.props, nextProps)
|
||||||
@ -149,11 +155,31 @@ class SupplyDemand extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const imageUploadSuccessElement = <AtToast
|
||||||
|
isOpened={this.state.isUploadImageSuccess}
|
||||||
|
text={this.state.uploadImageTextTip}
|
||||||
|
duration={2000}
|
||||||
|
></AtToast>
|
||||||
|
const demandSupplyUploadSuccessElement = <AtToast
|
||||||
|
isOpened={this.state.isUploadDemSupSuccess}
|
||||||
|
text={this.state.uploadDemSupTextTip}
|
||||||
|
duration={2000}
|
||||||
|
></AtToast>
|
||||||
return (
|
return (
|
||||||
<View className='supply-demand'>
|
<View className='supply-demand'>
|
||||||
<SearchBarComponent></SearchBarComponent>
|
{/* 图片上传模态框 */}
|
||||||
|
{imageUploadSuccessElement}
|
||||||
|
{/* 商品发布模态框 */}
|
||||||
|
{demandSupplyUploadSuccessElement}
|
||||||
|
<View className='searchBar-box'>
|
||||||
|
<AtSearchBar className='search-button'
|
||||||
|
actionName='搜索'
|
||||||
|
value={this.state.value}
|
||||||
|
onChange={this.onChange.bind(this)}
|
||||||
|
onActionClick={this.onActionClick.bind(this)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Picker mode='selector' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}>
|
<Picker mode='selector' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
@ -225,9 +251,9 @@ class SupplyDemand extends Component {
|
|||||||
|
|
||||||
<View className='img-container'>
|
<View className='img-container'>
|
||||||
<AtImagePicker
|
<AtImagePicker
|
||||||
showAddBtn={this.state.addImg}
|
multiple
|
||||||
files={this.state.files}
|
files={this.state.pickerImageUrl}
|
||||||
onChange={this.onChange.bind(this)}
|
onChange={this.onChangeImg.bind(this)}
|
||||||
onFail={this.onFail.bind(this)}
|
onFail={this.onFail.bind(this)}
|
||||||
onImageClick={this.onImageClick.bind(this)}
|
onImageClick={this.onImageClick.bind(this)}
|
||||||
/>
|
/>
|
||||||
@ -249,7 +275,7 @@ class SupplyDemand extends Component {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='button-box'>
|
<View className='button-box'>
|
||||||
<View className='button'>
|
<View className='button' onClick={this.uploadSupplyDemand.bind(this)}>
|
||||||
<AtButton type='primary' size='small'>发布</AtButton>
|
<AtButton type='primary' size='small'>发布</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View className='button'>
|
<View className='button'>
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
.supply-demand{
|
.supply-demand{
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
|
.search-button{
|
||||||
|
.at-search-bar__action{
|
||||||
|
background-color:#FF7142
|
||||||
|
}
|
||||||
|
}
|
||||||
.border-box{
|
.border-box{
|
||||||
border-bottom: 1Px solid #d6e4ef;
|
border-bottom: 1Px solid #d6e4ef;
|
||||||
display: flex
|
display: flex
|
||||||
@ -28,8 +33,8 @@
|
|||||||
flex:1;
|
flex:1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
.at-button--primary{
|
.at-button--primary{
|
||||||
background-color:#FF9500;
|
background-color:#FF7142,;
|
||||||
border:1PX solid #FF9500;
|
border:1PX solid #FF7142,;
|
||||||
}
|
}
|
||||||
.button-a{
|
.button-a{
|
||||||
background-color:#5cb85c;
|
background-color:#5cb85c;
|
||||||
|
@ -1,656 +0,0 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
|
||||||
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
|
|
||||||
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui'
|
|
||||||
|
|
||||||
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
|
||||||
import Test3 from '../../component/Test3/Test3'
|
|
||||||
import URL from '../../serviceAPI.config'
|
|
||||||
|
|
||||||
|
|
||||||
import './goodsPublish.scss'
|
|
||||||
import { throws } from 'assert';
|
|
||||||
|
|
||||||
class GoodsPublish extends Component {
|
|
||||||
|
|
||||||
config = {
|
|
||||||
navigationBarTitleText: '商品发布'
|
|
||||||
}
|
|
||||||
constructor() {
|
|
||||||
super(...arguments)
|
|
||||||
this.state = {
|
|
||||||
objectMultiArray: [
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '扁性动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '线形动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '环节动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '软体动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '节肢动物'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '猪肉绦虫'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '吸血虫'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
multiIndex: [0, 0, 0],
|
|
||||||
shopCategoryPicker: [], // 店铺分类选项
|
|
||||||
shopCategoryCheckedPicker: {name:'选择店铺类型'},
|
|
||||||
productName: '',
|
|
||||||
productPrice: '',
|
|
||||||
productUnit: '',
|
|
||||||
productDescript: '',
|
|
||||||
pickerImageUrl: [], // 上传的图片
|
|
||||||
ImagesInfo: [],// 后台传回来的图片信息
|
|
||||||
isUploadImageSuccess: false,
|
|
||||||
uploadImageTextTip: '',
|
|
||||||
isUploadProductSuccess: false,
|
|
||||||
uploadProductTextTip: '',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//商品目录请求api GetShopCategoryList
|
|
||||||
getProductCateList() {
|
|
||||||
Taro.request({
|
|
||||||
url: URL.GetProductCategoryList,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.data.err_msg === 'success') {
|
|
||||||
this.setState({ productCategoryList: res.data.data })
|
|
||||||
console.log('商品分类目录', res)
|
|
||||||
this.sortShopCateToState(res.data.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.catch(error => {
|
|
||||||
console.log('商品分类请求错误', error)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 店铺分类目录请求 api
|
|
||||||
getShopCateList() {
|
|
||||||
Taro.request({
|
|
||||||
url: URL.GetShopCategoryList,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
id: Taro.getStorageSync('shopInfo').shop_id
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.data.err_msg === 'success') {
|
|
||||||
this.setState({ shopCategoryList: res.data.data })
|
|
||||||
const shopCategoryInfo = res.data.data
|
|
||||||
const shopCategory = []
|
|
||||||
// 处理后台返回的店铺分类信息
|
|
||||||
for (let item in shopCategoryInfo) {
|
|
||||||
const children = shopCategoryInfo[item].c
|
|
||||||
for (let child in children) {
|
|
||||||
shopCategory.push({ id: children[child].id, name: children[child].n })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.setState({ shopCategoryPicker: shopCategory })
|
|
||||||
console.log('店铺分类目录', res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.catch(error => {
|
|
||||||
console.log('店铺分类请求错误', error)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发布商品api
|
|
||||||
//{"goods_name":"hellol","goods_price":"1.00","goods_unit":"1","goods_profiles":"111","class_id":"2","shop_class_id":"1928"}
|
|
||||||
uploadGoods({ goods_name = "test2", goods_price = "1.00", goods_unit = "1", goods_profiles = "test2", class_id = "10103", shop_class_id = "1930" }) {
|
|
||||||
|
|
||||||
//定义上传商品的多图片的参数
|
|
||||||
const uploadProductGoodFileParams = []
|
|
||||||
if (this.state.ImagesInfo.length) {
|
|
||||||
for (let i = 0; i < this.state.ImagesInfo.length; i++) {
|
|
||||||
if (i === 0) {
|
|
||||||
|
|
||||||
uploadProductGoodFileParams.push({
|
|
||||||
file_id:this.state.ImagesInfo[i].file_id,
|
|
||||||
file_type: 1,
|
|
||||||
if_cover: 1,
|
|
||||||
file_sort: 1
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uploadProductGoodFileParams.push({
|
|
||||||
file_id: this.state.ImagesInfo[i].file_id,
|
|
||||||
file_type: 1,
|
|
||||||
if_cover: 0,
|
|
||||||
file_sort: 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alert('图片为空')
|
|
||||||
}
|
|
||||||
|
|
||||||
Taro.request({
|
|
||||||
url: URL.UploadProduct,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
deployType: 1,
|
|
||||||
action: 1,
|
|
||||||
goods: JSON.stringify({
|
|
||||||
goods_name: goods_name,
|
|
||||||
goods_price: goods_price,
|
|
||||||
goods_unit: goods_unit,
|
|
||||||
goods_profiles: goods_profiles,
|
|
||||||
class_id: class_id,
|
|
||||||
shop_class_id: shop_class_id
|
|
||||||
}),
|
|
||||||
goodsFiles: JSON.stringify(uploadProductGoodFileParams)
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
let tipText=res.data.err_msg==='success'?'商品发布成功':res.data.err_msg
|
|
||||||
|
|
||||||
this.setState({ uploadProductTextTip: tipText, isUploadProductSuccess: true },()=>{
|
|
||||||
setTimeout(()=>{
|
|
||||||
this.setState({isUploadProductSuccess: false})
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: '/pages/goodsPublish/goodsPublish'
|
|
||||||
})
|
|
||||||
},1000)
|
|
||||||
})
|
|
||||||
console.log('上传商品', res) // 提示非法请求 ----- to be continue
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.catch(error => {
|
|
||||||
this.setState({ uploadProductTextTip: '发布失败', isUploadProductSuccess: true })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 整理后台传出来的店铺分类目录
|
|
||||||
sortShopCateToState(shopData) {
|
|
||||||
const firstColumn = []
|
|
||||||
const secondColumn = []
|
|
||||||
const thirdColumn = []
|
|
||||||
for (let outterItem of shopData) {
|
|
||||||
firstColumn.push({ id: outterItem.class_id, name: outterItem.class_name })
|
|
||||||
if (outterItem.children.length) {
|
|
||||||
for (let middleItem of outterItem.children) {
|
|
||||||
secondColumn.push({ id: middleItem.class_id, name: middleItem.class_name })
|
|
||||||
if (middleItem.children.length) {
|
|
||||||
for (let innerItem of middleItem.children) {
|
|
||||||
thirdColumn.push({ id: innerItem.class_id, name: innerItem.class_name })
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------- 把新指传给objectMultiArray之后就不可以用了 to be continue
|
|
||||||
console.log('old',this.state.objectMultiArray)
|
|
||||||
this.setState({objectMultiArray:[firstColumn,secondColumn,thirdColumn]},()=>{
|
|
||||||
console.log('new', this.state.objectMultiArray)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 改变商品分类状态
|
|
||||||
onChangeProductType(e) {
|
|
||||||
this.setState({
|
|
||||||
selectorChecked: this.state.selector[e.detail.value]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
productNameChange(event) {
|
|
||||||
this.setState({
|
|
||||||
productName: event
|
|
||||||
})
|
|
||||||
}
|
|
||||||
productPriceChange(event) {
|
|
||||||
this.setState({
|
|
||||||
productPrice: event
|
|
||||||
})
|
|
||||||
}
|
|
||||||
productUnitChange(event) {
|
|
||||||
this.setState({
|
|
||||||
productUnit: event
|
|
||||||
})
|
|
||||||
}
|
|
||||||
productDescriptChange(event) {
|
|
||||||
this.setState({
|
|
||||||
productDescript: event.target.value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 上传图片
|
|
||||||
onChangeImg(files, operationType, index) {
|
|
||||||
const that = this
|
|
||||||
if (operationType === 'add') {
|
|
||||||
Taro.uploadFile({
|
|
||||||
url: URL.UploadPorductImage, // 仅为示例,非真实的接口地址
|
|
||||||
filePath: files[files.length - 1].url,
|
|
||||||
name: 'file',
|
|
||||||
formData: {
|
|
||||||
user: 'test'
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'multipart/form-data',
|
|
||||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
},
|
|
||||||
success(response) {
|
|
||||||
const data = JSON.parse(response.data)
|
|
||||||
const imagePath = URL.Base + data.file_path
|
|
||||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
|
||||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
|
||||||
that.setState({ pickerImageUrl: newPickerImageUrl, isUploadImageSuccess: true, uploadImageTextTip: '图片上传成功', ImagesInfo: newImageInfo }, () => {
|
|
||||||
setTimeout(()=>{that.setState({isUploadImageSuccess: false})},1000)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (operationType === 'remove') {
|
|
||||||
this.state.pickerImageUrl.splice(index, 1);
|
|
||||||
this.setState({ files: this.state.pickerImageUrl });
|
|
||||||
that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' },()=>{
|
|
||||||
setTimeout(()=>{that.setState({isUploadImageSuccess: false})},1000)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 图片上传失败
|
|
||||||
onFail(mes) {
|
|
||||||
console.log(mes)
|
|
||||||
}
|
|
||||||
// 删除图片
|
|
||||||
onImageClick(index) {
|
|
||||||
}
|
|
||||||
onClickUploadGoods() {
|
|
||||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length) {
|
|
||||||
this.uploadGoods({
|
|
||||||
goods_name: this.state.productName,
|
|
||||||
goods_price: this.state.productPrice,
|
|
||||||
goods_unit: this.state.productUnit,
|
|
||||||
goods_profiles: this.state.productDescript,
|
|
||||||
class_id: "10103",
|
|
||||||
shop_class_id: this.state.shopCategoryCheckedPicker,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.setState({ uploadProductTextTip: '请填写完表格', isUploadProductSuccess: true },()=>{
|
|
||||||
setTimeout(()=>{this.setState({isUploadProductSuccess: false})},1000)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
shopCategoryChanged(e) {
|
|
||||||
this.setState({
|
|
||||||
shopCategoryCheckedPicker: this.state.shopCategoryPicker[e.detail.value]
|
|
||||||
}, () => {
|
|
||||||
console.log(this.state.shopCategoryCheckedPicker)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.getProductCateList()
|
|
||||||
this.getShopCateList()
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
// console.log(this.props, nextProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() { }
|
|
||||||
|
|
||||||
componentDidShow() { }
|
|
||||||
|
|
||||||
componentDidHide() { }
|
|
||||||
|
|
||||||
//--- 三级联动--------------
|
|
||||||
bindMultiPickerChange(e) {
|
|
||||||
console.log('picker发送选择改变,携带值为', e.detail.value)
|
|
||||||
this.setState({
|
|
||||||
multiIndex: e.detail.value
|
|
||||||
})
|
|
||||||
}
|
|
||||||
bindMultiPickerCol(e) {
|
|
||||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
|
||||||
const data = {
|
|
||||||
multiArray: this.state.objectMultiArray,
|
|
||||||
multiIndex: this.state.multiIndex
|
|
||||||
}
|
|
||||||
data.multiIndex[e.detail.column] = e.detail.value
|
|
||||||
switch (e.detail.column) {
|
|
||||||
case 0:
|
|
||||||
switch (data.multiIndex[0]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[1] = [
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
name: '01'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '10a'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '02'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '02a'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[1] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '11'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '11a'
|
|
||||||
}]
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '12'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '12a'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
data.multiIndex[1] = 0
|
|
||||||
data.multiIndex[2] = 0
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
switch (data.multiIndex[0]) {
|
|
||||||
case 0:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 3:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}, {
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '无脊柱动物'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '脊柱动物'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
switch (data.multiIndex[1]) {
|
|
||||||
case 0:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 1:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}, {
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
data.multiArray[2] = [{
|
|
||||||
id: 0,
|
|
||||||
name: '蛇'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '青蛙'
|
|
||||||
}]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
data.multiIndex[2] = 0
|
|
||||||
break
|
|
||||||
}
|
|
||||||
console.log(data.multiIndex)
|
|
||||||
this.setState({ multiIndex: data.multiIndex })
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const imageUploadSuccess = <AtToast
|
|
||||||
isOpened={this.state.isUploadImageSuccess}
|
|
||||||
text={this.state.uploadImageTextTip}
|
|
||||||
duration={1000}
|
|
||||||
></AtToast>
|
|
||||||
const productUploadSuccess = <AtToast
|
|
||||||
isOpened={this.state.isUploadProductSuccess}
|
|
||||||
text={this.state.uploadProductTextTip}
|
|
||||||
duration={1000}
|
|
||||||
></AtToast>
|
|
||||||
return (
|
|
||||||
<View className='goods-publish'>
|
|
||||||
<Test3></Test3>
|
|
||||||
{imageUploadSuccess}
|
|
||||||
{productUploadSuccess}
|
|
||||||
<SearchBarComponent></SearchBarComponent>
|
|
||||||
<View className='goods-category'>
|
|
||||||
<View className='page-section'>
|
|
||||||
<View>
|
|
||||||
<Picker
|
|
||||||
range={this.state.objectMultiArray}
|
|
||||||
onChange={this.bindMultiPickerChange.bind(this)}
|
|
||||||
rangeKey='name'
|
|
||||||
mode='multiSelector'
|
|
||||||
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
|
||||||
value={this.state.multiIndex}
|
|
||||||
>
|
|
||||||
<View className='picker'>
|
|
||||||
<View className='title-box'>
|
|
||||||
<Text className='title'><Text className='require'>*</Text>商品分类:</Text> <Text className='selected'>
|
|
||||||
{/* {this.state.multiArray[0][this.state.multiIndex[0]].name}{this.state.multiArray[1][this.state.multiIndex[1]].name}{this.state.multiArray[2][this.state.multiIndex[2]].name} */}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</Picker>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className='input-box'>
|
|
||||||
<Text className='require'>*</Text>
|
|
||||||
<AtInput
|
|
||||||
name='value'
|
|
||||||
title='商品名称:'
|
|
||||||
type='text'
|
|
||||||
value={this.state.productName}
|
|
||||||
onChange={this.productNameChange.bind(this)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
<View className='input-box'>
|
|
||||||
<Text className='require'>*</Text>
|
|
||||||
<AtInput
|
|
||||||
name='value'
|
|
||||||
title='商品价格:'
|
|
||||||
type='number'
|
|
||||||
placeholder='¥'
|
|
||||||
value={this.state.productPrice}
|
|
||||||
onChange={this.productPriceChange.bind(this)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
<View className='input-box'>
|
|
||||||
<Text className='require'>*</Text>
|
|
||||||
<AtInput
|
|
||||||
name='value'
|
|
||||||
title='商品单位:'
|
|
||||||
type='text'
|
|
||||||
value={this.state.productUnit}
|
|
||||||
onChange={this.productUnitChange.bind(this)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
{/* 图片上传 */}
|
|
||||||
<View className='img-box'>
|
|
||||||
<View className='title-box'>
|
|
||||||
<Text className='require'>*</Text>
|
|
||||||
<Text className='title'>上传图片:</Text>
|
|
||||||
</View>
|
|
||||||
<View className='img-container'>
|
|
||||||
<AtImagePicker
|
|
||||||
multiple
|
|
||||||
files={this.state.pickerImageUrl}
|
|
||||||
onChange={this.onChangeImg.bind(this)}
|
|
||||||
onFail={this.onFail.bind(this)}
|
|
||||||
onImageClick={this.onImageClick.bind(this)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className='shoptype-box'>
|
|
||||||
{/* 店铺分类 */}
|
|
||||||
<View className='title-box page-section'>
|
|
||||||
<Picker mode='selector' rangeKey='name' range={this.state.shopCategoryPicker} onChange={this.shopCategoryChanged.bind(this)}>
|
|
||||||
<View className='picker'>
|
|
||||||
<Text className='require'>*</Text>
|
|
||||||
<Text className='title'> 店铺分类:</Text>
|
|
||||||
<Text className='selected'>{this.state.shopCategoryCheckedPicker.name}</Text>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</Picker>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<View className='description-box'>
|
|
||||||
<View className='title-box'>
|
|
||||||
<Text className='require'></Text>
|
|
||||||
<Text className='title'>商品简介:</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<AtTextarea
|
|
||||||
value={this.state.productDescript}
|
|
||||||
onChange={this.productDescriptChange.bind(this)}
|
|
||||||
maxlength='200'
|
|
||||||
placeholder='你的产品简介'
|
|
||||||
/>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className='button-box'>
|
|
||||||
<View className='button'>
|
|
||||||
<AtButton type='primary' size='small' >发布</AtButton>
|
|
||||||
</View>
|
|
||||||
<View className='button'>
|
|
||||||
<AtButton type='primary' className='button-a' size='small' onClick={this.onClickUploadGoods.bind(this)}>发布并新增</AtButton>
|
|
||||||
</View>
|
|
||||||
<View className='button'>
|
|
||||||
<AtButton type='primary' className='button-a' size='small'>商品列表</AtButton>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<copyrightComponent></copyrightComponent>
|
|
||||||
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default GoodsPublish
|
|
@ -24,8 +24,9 @@ const URL = {
|
|||||||
UploadPorductImage: LOCALURL + 'Goods-fileUpload',// 上传商品图片
|
UploadPorductImage: LOCALURL + 'Goods-fileUpload',// 上传商品图片
|
||||||
UploadProduct: LOCALURL + 'Goods-phonePost',// 上传商品
|
UploadProduct: LOCALURL + 'Goods-phonePost',// 上传商品
|
||||||
UploadSupplyDemand: LOCALURL + 'Supply-post',// 上传供求
|
UploadSupplyDemand: LOCALURL + 'Supply-post',// 上传供求
|
||||||
|
// 我的供求页面接口Supply-myList
|
||||||
|
SearchDemandSupply: LOCALURL + 'Supply-myList',// 搜索我的供求接口
|
||||||
|
DeleteDemandSupply: LOCALURL + 'Supply-delete',// 删除我的供求接口
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = URL
|
module.exports = URL
|
13
src/todo list.txt
Normal file
13
src/todo list.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
todo list:
|
||||||
|
|
||||||
|
搜索栏的search button 样式
|
||||||
|
首页:
|
||||||
|
优惠卷和询价接口
|
||||||
|
商品发布页面:
|
||||||
|
商品分类三级联动 // 改变新的multiObject 之后 三级联动就失效了
|
||||||
|
商品价格无法设定为数字
|
||||||
|
全部业主需求页面:
|
||||||
|
供求状态 和行业分类--等待后台接口
|
||||||
|
搜索api
|
||||||
|
我的供求页面:
|
||||||
|
搜索接口--等待后台
|
Loading…
Reference in New Issue
Block a user