发布与编辑 按钮个数,联系电话长度,
This commit is contained in:
parent
f0adffacc5
commit
156abaf917
@ -37,6 +37,7 @@ class bottomNav extends Component {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -50,7 +51,7 @@ class bottomNav extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
const otherDataElementsArray = this.state.otherData.map((item) => {
|
||||
return { title: item.name, iconType: 'clock' }
|
||||
})
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, Text, Image } from '@tarojs/components'
|
||||
import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtInput, AtNoticebar } from 'taro-ui'
|
||||
import { View, Button, Text, Image, Input } from '@tarojs/components'
|
||||
import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtNoticebar } from 'taro-ui'
|
||||
|
||||
import VoucherPosterComponent from './voucherPosterComponent/voucherPosterComponent'
|
||||
|
||||
@ -11,8 +11,16 @@ const hornIcon = require('../../icons/horn.png')
|
||||
const houseIcon = require('../../icons/house.png')
|
||||
|
||||
class recommondShop extends Component {
|
||||
static options = {
|
||||
addGlobalClass: true
|
||||
|
||||
static defaultProps = {
|
||||
shop: {
|
||||
shop_name: 'kobe',
|
||||
goods: [{ goods_url: 'www.kobe.com', goods_price: '999', goods_name: 'kobe' }],
|
||||
shop_address: 'kobe road',
|
||||
distance: '247km',
|
||||
ads: 'Have you ever seen Los Angels sun dawn in 4 AM in the morning?',
|
||||
left_nums: '999'
|
||||
}
|
||||
}
|
||||
|
||||
config = {
|
||||
@ -26,10 +34,8 @@ class recommondShop extends Component {
|
||||
consultTip: '',
|
||||
voucherResponseMsg: '',
|
||||
voucherCanConsult: false,
|
||||
voucherName: this.props.userName,
|
||||
voucherPhone: this.props.userPhone,
|
||||
consultName: this.props.userName,
|
||||
consultPhone: this.props.userPhone,
|
||||
userName: Taro.getStorageSync('user_identity').username,
|
||||
userPhone: Taro.getStorageSync('user_identity').userphone,
|
||||
}
|
||||
}
|
||||
goToShop(value) {
|
||||
@ -135,7 +141,7 @@ class recommondShop extends Component {
|
||||
}
|
||||
voucherModalConfirm() {
|
||||
this.setState({ isOpenVoucher: false })
|
||||
this.buyConsult({ user: this.state.voucherName, phone: this.state.voucherPhone })
|
||||
this.buyConsult({ user: this.state.userName, phone: this.state.userPhone })
|
||||
}
|
||||
// 咨询弹框。取消。确认
|
||||
isOpenConsult() {
|
||||
@ -147,19 +153,19 @@ class recommondShop extends Component {
|
||||
}
|
||||
consultModalConfirm() {
|
||||
this.setState({ isOpenConsult: false })
|
||||
this.buyConsult({ user: this.state.consultName, phone: this.state.consultPhone })
|
||||
this.buyConsult({ user: this.state.userName, phone: this.state.userPhone })
|
||||
}
|
||||
handleInputVcherPhone(value) {
|
||||
this.setState({ voucherPhone: value })
|
||||
this.setState({ userPhone: value })
|
||||
}
|
||||
handleInputVcherName(value) {
|
||||
this.setState({ voucherName: value })
|
||||
this.setState({ userName: value })
|
||||
}
|
||||
handleInputCsultName(value) {
|
||||
this.setState({ consultName: value })
|
||||
this.setState({ userName: value })
|
||||
}
|
||||
handleInputCsultPhone(value) {
|
||||
this.setState({ consultPhone: value })
|
||||
this.setState({ userPhone: value })
|
||||
}
|
||||
getDataFromChild(value) {
|
||||
console.log('从voucherposter件传回来的值', value)
|
||||
@ -179,84 +185,60 @@ class recommondShop extends Component {
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
// console.log('店铺',this.props.shop)
|
||||
|
||||
const title = this.props.shop ? this.props.shop.shop_name : null
|
||||
const imgUrl = this.props.shop ? URL.Base + this.props.shop.goods[0].goods_url : null
|
||||
const price = this.props.shop ? this.props.shop.goods[0].goods_price : null
|
||||
const goods = this.props.shop ? this.props.shop.goods : null
|
||||
const ProductName = this.props.shop ? this.props.shop.goods[0].goods_name : null
|
||||
const address = this.props.shop ? this.props.shop.shop_address : null
|
||||
const distance = this.props.shop ? this.props.shop.distance : null
|
||||
const ads = this.props.shop ? this.props.shop.ads : null
|
||||
const voucherLeft = this.props.shop ? this.props.shop.left_nums : null
|
||||
// const consultText = this.props.shop.wx_open
|
||||
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
|
||||
const goods = this.props.shop.goods
|
||||
const ProductName = this.props.shop.goods[0].goods_name
|
||||
const address = this.props.shop.shop_address
|
||||
const distance = this.props.shop.distance
|
||||
const ads = this.props.shop.ads
|
||||
const voucherLeft = this.props.shop.left_nums // 优惠卷是否为灰色
|
||||
const isShowConsultButton = this.props.shop.wx_open === '0' ? false : true // 优惠卷是否为灰色
|
||||
const slicedGoods = goods !== null ? goods.slice(1) : null
|
||||
const goodsElementsArray = goods !== null ? slicedGoods.map((item, index) => {
|
||||
return <View className='goods-img-box' key={index}>
|
||||
<Image className='goods-img' onClick={this.goToShop.bind(this, this.props.shop)} mode='aspectFit' style='max-height: 100%; max-width: 100%;' src={URL.Base + item.goods_url} />
|
||||
<Image className='goods-img' onClick={this.goToShop.bind(this, this.props.shop)}
|
||||
mode='aspectFit' style='max-height: 100%; max-width: 100%;'
|
||||
src={URL.Base + item.goods_url}
|
||||
/>
|
||||
</View>
|
||||
}) : null
|
||||
|
||||
// 优惠卷和咨询元素
|
||||
// const voucherModalElement = <AtModal className='voucher-modal' isOpened={this.state.isOpenVoucher}>
|
||||
// <AtModalHeader>优惠卷须知:</AtModalHeader>
|
||||
// <AtModalContent>
|
||||
// <AtNoticebar >
|
||||
// <Text className='orange' > 提示:具体可以前往实体店进行领取优惠卷或通过电话进行咨询</Text>
|
||||
// </AtNoticebar>
|
||||
// <View className='voucher-left'>当前优惠卷{voucherLeft}张</View>
|
||||
// <AtInput
|
||||
// name='value'
|
||||
// title='联系人:'
|
||||
// type='text'
|
||||
// value={this.state.voucherName}
|
||||
// onChange={this.handleInputVcherName.bind(this)}
|
||||
// />
|
||||
// <AtInput
|
||||
// border={false}
|
||||
// name='value'
|
||||
// title='联系电话:'
|
||||
// type='number'
|
||||
// value={this.state.voucherPhone}
|
||||
// onChange={this.handleInputVcherPhone.bind(this)}
|
||||
|
||||
// />
|
||||
// {!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null}
|
||||
|
||||
// </AtModalContent>
|
||||
// <AtModalAction> <Button onClick={this.voucherModalClose.bind(this)} >取消</Button> <Button className='orange' onClick={this.voucherModalConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
// </AtModal>
|
||||
|
||||
|
||||
|
||||
const consultModalElement = <AtModal isOpened={this.state.isOpenConsult}>
|
||||
<AtModalHeader>咨询</AtModalHeader>
|
||||
<AtModalContent>
|
||||
|
||||
<AtNoticebar >
|
||||
<Text className='orange' >提示:{this.state.consultTip}</Text>
|
||||
<Text >提示:{this.state.consultTip}</Text>
|
||||
</AtNoticebar>
|
||||
<View className='input-box' style='display:flex; align-items:center; font-size:28rpx; margin:2% 2%'>
|
||||
<View className='title'>
|
||||
<Text>联系人:</Text>
|
||||
</View>
|
||||
<Input name='value'
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
|
||||
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系人:'
|
||||
type='text'
|
||||
value={this.state.consultName}
|
||||
onChange={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
type='number'
|
||||
value={this.state.consultPhone}
|
||||
border={false}
|
||||
onChange={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box' style='display:flex; align-items:center; font-size:28rpx; margin-left:2%'>
|
||||
<View className='title'>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<Input name='value'
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button className='orange' 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>
|
||||
|
||||
|
||||
@ -280,18 +262,14 @@ class recommondShop extends Component {
|
||||
{voucherLeft ? <View className='button' onClick={this.isOpenVoucher.bind(this)} >
|
||||
<Button size='mini' className='button-blue-mini'>
|
||||
优惠卷</Button>
|
||||
</View> : <View className='button blur' >
|
||||
</View> : <View className='button blur' onClick={this.isOpenVoucher.bind(this)} >
|
||||
<Button size='mini' className='button-blue-mini'>优惠卷</Button>
|
||||
</View>}
|
||||
<View className='button contult-button' onClick={this.isOpenConsult.bind(this)} >
|
||||
|
||||
{isShowConsultButton ? <View className='button contult-button' onClick={this.isOpenConsult.bind(this)} >
|
||||
<Button size='mini' className='button-blue-mini'>
|
||||
询价</Button>
|
||||
</View>
|
||||
|
||||
|
||||
{/* {voucherLeft ? <Button onClick={this.isOpenVoucher.bind(this)} size='mini' className='button-orange' >优惠卷</Button> : <Button disabled={true} size='mini' className='button-orange'>优惠卷</Button>}
|
||||
|
||||
<Button onClick={this.isOpenConsult.bind(this)} size='mini' className='button-orange'>询价</Button> */}
|
||||
</View> : null}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
|
@ -38,7 +38,7 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
.button{
|
||||
// margin-left:2%;
|
||||
text-align: center;
|
||||
margin-left:25%;
|
||||
// margin-left:22%;
|
||||
}
|
||||
.blur{
|
||||
opacity: 0.5;
|
||||
@ -67,11 +67,12 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
margin-bottom:2%;
|
||||
padding:0;
|
||||
}
|
||||
.consult-voucher-button{
|
||||
.button-container{
|
||||
flex:1;
|
||||
//margin-top: 20px ;
|
||||
margin-left: 50px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
//vertical-align: middle;
|
||||
|
||||
.consult-button-text{
|
||||
@ -120,7 +121,7 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
margin-top: 20px;
|
||||
|
||||
.goods-img{
|
||||
border: 1px solid #ddd;
|
||||
border: 2px solid #ddd;
|
||||
width: 90px;
|
||||
height: 90px;
|
||||
margin: 10px
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Input, Image, Text, Button } from '@tarojs/components'
|
||||
import { View, Input, Text, Button } from '@tarojs/components'
|
||||
import { AtIcon } from 'taro-ui'
|
||||
|
||||
import './voucherPosterComponent.scss'
|
||||
@ -43,24 +43,52 @@ class VoucherPoster extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('购买咨询请求成功', res)
|
||||
if (res.statusCode === 200) {
|
||||
Taro.showToast({ title: '领取成功', icon: 'success',duration:1500})
|
||||
|
||||
setTimeout(() => {
|
||||
this.passDataToParent()
|
||||
}, 1500);
|
||||
|
||||
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '领取成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.passDataToParent()
|
||||
}, 1500);
|
||||
|
||||
} else {
|
||||
Taro.showToast({ title: res.data.err_msg, icon: 'none' })
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}).catch(err => {
|
||||
console.log('购买咨询请求失败', err)
|
||||
})
|
||||
}
|
||||
// 确认键
|
||||
voucherModalConfirm() {
|
||||
this.buyConsult({ user: this.state.voucherName, phone: this.state.voucherPhone })
|
||||
if (!this.state.voucherName) {
|
||||
Taro.showToast({
|
||||
title: '请填写姓名',
|
||||
icon: 'fail',
|
||||
})
|
||||
} else if (!this.state.voucherPhone) {
|
||||
Taro.showToast({
|
||||
title: '请填写电话号码',
|
||||
icon: 'fail',
|
||||
})
|
||||
} else {
|
||||
this.buyConsult({ user: this.state.voucherName, phone: this.state.voucherPhone })
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//名字输入
|
||||
handleNameChange(value) {
|
||||
@ -68,7 +96,7 @@ class VoucherPoster extends Component {
|
||||
}
|
||||
//号码输入
|
||||
handlePhoneChange(value) {
|
||||
this.setState({ voucherPhone: value.detail.value })
|
||||
this.setState({ voucherPhone: value.detail.value })
|
||||
}
|
||||
passDataToParent() {
|
||||
this.props.onPassDataToChild(false)
|
||||
@ -109,8 +137,14 @@ class VoucherPoster extends Component {
|
||||
<View className='input-number ' >
|
||||
|
||||
<View className='title'> <Text>联系电话:</Text></View>
|
||||
<Input class='input-info' type='text' value={this.state.voucherPhone} onInput={this.handleNumberChange.bind(this)} />
|
||||
<Input class='input-info' type='text' maxLength='11' value={this.state.voucherPhone} onInput={this.handlePhoneChange.bind(this)} />
|
||||
</View>
|
||||
<View>
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='tips'>
|
||||
{this.props.voucherResponseMsg}
|
||||
</View>
|
||||
|
@ -56,50 +56,28 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
font-size: 50px;
|
||||
}
|
||||
}
|
||||
.input-name{
|
||||
margin-top:2%;
|
||||
margin-left:10%;
|
||||
// .input-name,.input-number{
|
||||
// margin-top:2%;
|
||||
// margin-left:10%;
|
||||
|
||||
overflow: hidden;
|
||||
width: 80%;
|
||||
// overflow: hidden;
|
||||
// width: 80%;
|
||||
|
||||
// border-radius:50rpx;
|
||||
// background-color: white;
|
||||
|
||||
// height:80px;
|
||||
// font-size:25px;
|
||||
// display:flex;
|
||||
// align-items:center;
|
||||
// .title{
|
||||
// margin-left:7%;
|
||||
// }
|
||||
|
||||
border-radius:50rpx;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
height:80px;
|
||||
font-size:25px;
|
||||
.title{
|
||||
flex:1;
|
||||
margin-left:7%;
|
||||
margin-top:4%
|
||||
}
|
||||
.input-info{
|
||||
flex:2;
|
||||
margin-top:3.5%
|
||||
}
|
||||
|
||||
}
|
||||
.input-number{
|
||||
margin-top:2%;
|
||||
margin-left:10%;
|
||||
overflow: hidden;
|
||||
width: 80%;
|
||||
border-radius:50rpx;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
height:80px;
|
||||
font-size:25px;
|
||||
.title{
|
||||
flex:1;
|
||||
margin-left:7%;
|
||||
margin-top:4%
|
||||
}
|
||||
.input-info{
|
||||
flex:2;
|
||||
margin-top:3.5%
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
.tips{
|
||||
|
||||
margin-left: 10%;
|
||||
@ -122,7 +100,6 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
font-size: 28px;
|
||||
background:$linearOrange;
|
||||
padding: 12rpx;
|
||||
// margin:20px auto
|
||||
|
||||
}
|
||||
}
|
||||
@ -146,6 +123,10 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
|
||||
|
||||
}}
|
||||
.input-box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Add Animation */
|
||||
@-webkit-keyframes animatetop {
|
||||
|
@ -6,7 +6,7 @@
|
||||
border-radius:50%;
|
||||
text-align:center;
|
||||
position:fixed;
|
||||
bottom:8%;
|
||||
bottom:10%;
|
||||
right:5%;
|
||||
font-size:25rpx;
|
||||
.box{
|
||||
|
@ -3,7 +3,6 @@ import { View, Image, Text } from '@tarojs/components'
|
||||
|
||||
import eyeIcon from '../../icons/eye.png'
|
||||
import cartIcon from '../../icons/cart.png'
|
||||
import errorImg from '../../assets/img/errorimg.png'
|
||||
|
||||
|
||||
import './shopItemComponent.scss'
|
||||
|
@ -2,16 +2,16 @@ import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image, Button } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './allDemanding.scss'
|
||||
|
||||
import eyeIcon from '../../icons/eye.png'
|
||||
|
||||
|
||||
let loadMorePageIndex = 1 // 底部加载接口请求参数
|
||||
|
||||
|
||||
class AllDemanding extends Component {
|
||||
config = {
|
||||
@ -33,7 +33,8 @@ class AllDemanding extends Component {
|
||||
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
||||
currentPage: 1,
|
||||
isAddToList: false,// / 请求业主需求的时候是否添加到旧列表里
|
||||
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1
|
||||
|
||||
}
|
||||
}
|
||||
@ -74,7 +75,7 @@ class AllDemanding extends Component {
|
||||
if (res.data.err_msg === 'success') {
|
||||
if (res.data.supplys.length) {
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys) })
|
||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys),isAddToList:false })
|
||||
} else {
|
||||
this.setState({ supplys: res.data.supplys })
|
||||
}
|
||||
@ -219,15 +220,23 @@ class AllDemanding extends Component {
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
loadMorePageIndex += 1
|
||||
this.setState({ isAddToList: true }, () => {
|
||||
this.searchDemanding({ curr_page: loadMorePageIndex })
|
||||
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
this.searchDemanding({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
|
||||
}
|
||||
@ -271,7 +280,7 @@ class AllDemanding extends Component {
|
||||
{item.state_name === '在用' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : <View className='button' >
|
||||
<Button size='mini' className='button-orange blur'> 已抢单</Button>
|
||||
<Button size='mini' className='button-orange blur'> 已抢光</Button>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
@ -354,7 +363,7 @@ class AllDemanding extends Component {
|
||||
<View className='demanding-box'>
|
||||
{allDemandingElementArray}
|
||||
</View>
|
||||
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
)
|
||||
|
@ -227,8 +227,8 @@ class Goods extends Component {
|
||||
{/* 详情和评论区 */}
|
||||
<View className='details-box'>
|
||||
{/* 大类 */}
|
||||
<AtTabs className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
|
||||
<AtTabsPane current={this.state.current} index={0} >
|
||||
<AtTabs className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
|
||||
<AtTabsPane style='color:red' current={this.state.current} index={0} >
|
||||
<View style='background-color: #FAFBFC;' >
|
||||
|
||||
<View className='description-title'>商品细节:</View>
|
||||
@ -290,6 +290,8 @@ class Goods extends Component {
|
||||
</View>
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
<View className='gap' style='height:150rpx'>
|
||||
</View>
|
||||
|
||||
<View className='shop-bottom-box' >
|
||||
<View className='shop-bottom-nav'>
|
||||
|
@ -31,6 +31,8 @@ class GoodsPublish extends Component {
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
shopCategoryList: [],
|
||||
productCategoryList: [],
|
||||
isPublishAndAdd:false,// 是否点击发布新增按钮
|
||||
isPublish:false, // 时候点击发布按钮
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,10 +106,17 @@ class GoodsPublish extends Component {
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + res.data.goods_id
|
||||
})
|
||||
if(this.state.isPublish){
|
||||
// 导航到编辑页面
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + res.data.goods_id
|
||||
})
|
||||
}else if(this.state.isPublishAndAdd){
|
||||
// 导航到发布页面
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
@ -167,7 +176,7 @@ class GoodsPublish extends Component {
|
||||
filePath: files[files.length - 1].url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
user: 'test'
|
||||
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
@ -175,17 +184,28 @@ class GoodsPublish extends Component {
|
||||
'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, ImagesInfo: newImageInfo }, () => {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
const responseMsg=JSON.parse(response.data).err_msg
|
||||
if (responseMsg=== 'success'||responseMsg === 'duplicate') {
|
||||
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, ImagesInfo: newImageInfo }, () => {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: responseMsg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -201,7 +221,7 @@ class GoodsPublish extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
onClickUploadGoods() {
|
||||
publishButtonHandler() {
|
||||
if (this.state.productName &&
|
||||
this.state.productPrice &&
|
||||
this.state.productUnit &&
|
||||
@ -209,7 +229,7 @@ class GoodsPublish extends Component {
|
||||
this.state.goodsTypeSelected.id &&
|
||||
this.state.shopTypeSelected.id) {
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
setTimeout(() => {
|
||||
this.setState({isPublish:true},()=>{
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
@ -218,13 +238,44 @@ class GoodsPublish extends Component {
|
||||
class_id: this.state.goodsTypeSelected.id,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
})
|
||||
}, 1000)
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({ title: '请填写完表格', icon: 'none' })
|
||||
}
|
||||
}
|
||||
publishAndNewButton() {
|
||||
if (this.state.productName &&
|
||||
this.state.productPrice &&
|
||||
this.state.productUnit &&
|
||||
this.state.ImagesInfo.length &&
|
||||
this.state.goodsTypeSelected.id &&
|
||||
this.state.shopTypeSelected.id) {
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({isPublishAndAdd:true},()=>{
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
class_id: this.state.goodsTypeSelected.id,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({ title: '请填写完表格', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
goToMyGoodListPage() {
|
||||
Taro.navigateTo({
|
||||
@ -261,7 +312,7 @@ class GoodsPublish extends Component {
|
||||
|
||||
return (
|
||||
<View className='goods-publish'>
|
||||
|
||||
|
||||
<View className='goods-category'>
|
||||
{/* 商品分类开始 */}
|
||||
<GoodsTypeInteractionComp
|
||||
@ -334,23 +385,24 @@ class GoodsPublish extends Component {
|
||||
<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' >
|
||||
<Button size='mini' className='button-orange' onClick={this.onClickUploadGoods.bind(this)}>发布</Button>
|
||||
<Button size='mini' className='button-orange' onClick={this.publishButtonHandler.bind(this)}>发布</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
<Button type='primary' className='button-a' size='small' >发布并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||
<Button size='mini' className='button-green'>发布并新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyGoodListPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>商品列表</Button>
|
||||
</View>
|
||||
|
@ -77,17 +77,11 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 120px;
|
||||
justify-content: space-around;
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor;
|
||||
border:1PX solid $themeColor;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:27rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import URL from '../../serviceAPI.config'
|
||||
import './home.scss'
|
||||
|
||||
|
||||
let loadMorePageIndex = 1 // 底部加载接口请求参数
|
||||
|
||||
class Home extends Component {
|
||||
|
||||
config = {
|
||||
@ -20,7 +20,7 @@ class Home extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
shopsDetails: [], // 推荐店铺的信息
|
||||
shops: [], // 推荐店铺的信息
|
||||
ads: [], //广告图片数组
|
||||
categories: [],// 大类
|
||||
subCate: [], //小类
|
||||
@ -30,7 +30,8 @@ class Home extends Component {
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: '',//用户名字
|
||||
userPhone: '',// 用户电话
|
||||
isShowTopNav: false,
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +104,7 @@ class Home extends Component {
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
if (res.data.shops.length) {
|
||||
this.setState({ shopsDetails: this.state.shopsDetails.concat(res.data.shops) })
|
||||
this.setState({ shops: this.state.shops.concat(res.data.shops) })
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
@ -151,7 +152,7 @@ class Home extends Component {
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
|
||||
this.setState({ shopsDetails: res.data.shops })
|
||||
this.setState({ shops: res.data.shops })
|
||||
Taro.hideLoading()
|
||||
|
||||
} else {
|
||||
@ -336,6 +337,7 @@ class Home extends Component {
|
||||
}
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
console.log('地址', this.$router)
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
|
||||
this.login().then(() => {
|
||||
@ -363,9 +365,9 @@ class Home extends Component {
|
||||
}
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300&&this.state.isShowTopNav) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if(location.scrollTop >300&&!this.state.isShowTopNav) {
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
@ -374,10 +376,9 @@ class Home extends Component {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
setTimeout(() => {
|
||||
loadMorePageIndex += 1
|
||||
this.getShops({ curr_page: loadMorePageIndex })
|
||||
}, 1000);
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
this.getShops({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -385,7 +386,6 @@ class Home extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
// 提示模态弹窗element
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
@ -413,7 +413,7 @@ class Home extends Component {
|
||||
</View>
|
||||
</View>
|
||||
<View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢单'}</Button>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||
</View>
|
||||
</View>
|
||||
</SwiperItem >
|
||||
@ -439,10 +439,14 @@ class Home extends Component {
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
const shopCollectionElementsArray = this.state.shopsDetails.length ? this.state.shopsDetails.map((item, index) => {
|
||||
return <FilteredShopComponent shop={item} userName={this.state.userName} userPhone={this.state.userPhone} key={index}></FilteredShopComponent>
|
||||
}) : null
|
||||
|
||||
const shopCollectionElementsArray = this.state.shops.map((item, index) => {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
userName={this.state.userName}
|
||||
userPhone={this.state.userPhone}
|
||||
key={index}
|
||||
></FilteredShopComponent>
|
||||
})
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
@ -476,7 +480,7 @@ class Home extends Component {
|
||||
{/* 第二行图片滚动条 */}
|
||||
<View className='second-banner'>
|
||||
<Swiper
|
||||
style='height:180px;'
|
||||
style='height:100%;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
|
@ -125,6 +125,8 @@ $themeColor: #FF7142;
|
||||
|
||||
}
|
||||
.second-banner{
|
||||
height:26vh;
|
||||
|
||||
.categories{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
@ -36,7 +36,7 @@ class Index extends Component {
|
||||
// url:'/pages/myGoodList/myGoodList'
|
||||
// url:'/pages/myNeeds/myNeeds',
|
||||
//url:'/pages/myNeedsPublish/myNeedsPublish'
|
||||
// url:'/pages/mySupplyDemand/mySupplyDemand'
|
||||
// url:'/pages/mySupplyDemand/mySupplyDemand'
|
||||
url:'/pages/home/home'
|
||||
// url:'/pages/allDemanding/allDemanding'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Button } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
@ -14,7 +14,7 @@ import './myDemandSupplyEdit.scss'
|
||||
class MyDemandSupplyEdit extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: '我的供求编辑'
|
||||
navigationBarTitleText: '供求编辑'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
@ -32,6 +32,10 @@ class MyDemandSupplyEdit extends Component {
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
|
||||
isFormCompleted: false,
|
||||
isConfirmWindow: false,// 删除提示框
|
||||
demandSupplyId: '',// 供求id
|
||||
isSave: false,//是否点击保存按钮
|
||||
isSaveAndNew: false//是否点击保存新增按钮
|
||||
|
||||
|
||||
}
|
||||
@ -57,6 +61,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
const selectedState = this.state.demandingSupplyState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
||||
this.setState({
|
||||
demandSupplyId: res.data.sdInfo.sd_id,
|
||||
demandingSupplyCateSelected: selectedType,
|
||||
title: res.data.sdInfo.sd_title,
|
||||
contactName: res.data.sdInfo.user_name,
|
||||
@ -76,35 +81,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
// 上传供求api
|
||||
uploadSupplyDemand() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
this.uploadDemSup({})
|
||||
} else {
|
||||
this.setState({ uploadDemSupTextTip: '请填写完表格', isUploadDemSupSuccess: true }, () => {
|
||||
setTimeout(() => {
|
||||
this.setState({ isUploadDemSupSuccess: false })
|
||||
}, 2000)
|
||||
})
|
||||
}
|
||||
|
||||
// Taro.request({
|
||||
// url: URL.UploadSupplyDemand,
|
||||
// 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
|
||||
uploadDemSup({ sd_type = this.state.demandingSupplyCateSelected.id,
|
||||
@ -150,19 +127,25 @@ class MyDemandSupplyEdit extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('上传供求', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
})
|
||||
}, 1500);
|
||||
if (this.state.isSave) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
||||
})
|
||||
} else if (this.state.isSaveAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
@ -220,6 +203,50 @@ class MyDemandSupplyEdit extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 删除我的供求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') {
|
||||
Taro.showToast({
|
||||
title: '删除成功'
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}, 1500);
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
|
||||
Taro.showToast({
|
||||
title: '删除失败',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
// 修改供求类型
|
||||
demandingSupplyCate = e => {
|
||||
this.setState({
|
||||
@ -248,11 +275,59 @@ class MyDemandSupplyEdit extends Component {
|
||||
contentChange(event) {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
// 上传供求api
|
||||
saveButtonHandler() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSave: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// 上传供求api
|
||||
saveAndNewButton() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
goToMyDemSupPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
})
|
||||
}
|
||||
deleteButtonHandler() {
|
||||
this.setState({ isConfirmWindow: true })
|
||||
}
|
||||
handleWindowModClose() {
|
||||
this.setState({ isConfirmWindow: false })
|
||||
}
|
||||
handleWindowModCancel() {
|
||||
this.setState({ isConfirmWindow: false })
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isConfirmWindow: false })
|
||||
this.onDelete({ sdID: this.state.demandSupplyId })
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
@ -271,10 +346,18 @@ class MyDemandSupplyEdit extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
const modalMessageConfirmElement = <AtModal isOpened={this.state.isConfirmWindow}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认删除{this.state.demandSupplyItemName}?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
return (
|
||||
<View className='supply-demand'>
|
||||
|
||||
{modalMessageConfirmElement}
|
||||
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
@ -296,7 +379,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
|
||||
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
@ -310,16 +393,18 @@ class MyDemandSupplyEdit extends Component {
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
border={false}
|
||||
onChange={this.contactNumberChange.bind(this)}
|
||||
/>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
@ -377,15 +462,21 @@ class MyDemandSupplyEdit extends Component {
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.uploadSupplyDemand.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>保存</Button>
|
||||
<View className='button' onClick={this.saveButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>保存</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
||||
<Button size='mini' className='button-green'>保存并新增</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
|
||||
<Button className='button-a' size='mini' className='button-orange'>保存并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.goToMyDemSupPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>我的供求</Button>
|
||||
<Button size='mini' className='button-green'>我的供求</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.deleteButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-dark-red'>删除</Button>
|
||||
</View>
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
@ -26,17 +26,11 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 120px;
|
||||
justify-content: space-around;
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor,;
|
||||
border:1PX solid $themeColor,;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,14 @@ import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Radio, Button } from '@tarojs/components'
|
||||
import { AtInput, Text, AtIcon, Picker, Image, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
|
||||
import './myGoodList.scss'
|
||||
|
||||
let loadMorePageIndex = 1 // 底部加载接口请求参数
|
||||
|
||||
class MyGoodList extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '商品列表'
|
||||
@ -33,19 +35,17 @@ class MyGoodList extends Component {
|
||||
}, // 正反排序
|
||||
selectedFilterValue: 0, //
|
||||
myGoodList: [],// 保存后台返回的商品列表
|
||||
myGoodListTotal: 0,// 后台的商品总数
|
||||
currentPage: 1,
|
||||
myGoodListTotal: '0',// 后台的商品总数
|
||||
goodsStateParam: 1,//商品状态参数
|
||||
pageCountParam: 2,// 商品数量参数
|
||||
pageCountParam: 10,// 商品数量参数
|
||||
currPageParam: 1,// 当前页面 参数
|
||||
isCheckAll: false,// 是否checked
|
||||
goodsIdList: [],//商品Id 列表
|
||||
isOpenDeleteModal: false,// 是否显示删除模态框
|
||||
isOpenOffStockModal: false,// 是否显示下架模态框
|
||||
isAddToList: false,// 是否下拉加载 如果是 就添加商品到我的商品列表
|
||||
|
||||
|
||||
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//上拉加载页面数
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,57 +106,7 @@ class MyGoodList extends Component {
|
||||
}
|
||||
|
||||
// 获取我的商品列表接口api
|
||||
getMyGoodListApi({ goodsState = this.state.goodsStateParam, pageCount = this.state.pageCountParam, currPage = this.state.currPageParam }) {
|
||||
Taro.request({
|
||||
url: URL.MyGoodList,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
|
||||
data: {
|
||||
goodsState: goodsState,
|
||||
pageCount: pageCount,
|
||||
currPage: currPage
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
console.log('我的商品列表', JSON.parse(res.data))
|
||||
const data = JSON.parse(res.data)
|
||||
Taro.hideLoading()
|
||||
if (data.goods.length) {
|
||||
data.goods.forEach(item => {
|
||||
item.checked = false
|
||||
});
|
||||
const goodCount = Number(data.goodsCount)
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ myGoodList: this.state.myGoodList.concat(data.goods) }, () => {
|
||||
this.setState({ isAddToList: false })
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
myGoodList: data.goods,
|
||||
myGoodListTotal: goodCount
|
||||
})
|
||||
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('我的商品列表获取失败')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
// 获取搜索结果api
|
||||
getGoodListResultApi({
|
||||
getMyGoodListApi({
|
||||
goodsName = this.state.productName,
|
||||
goodsSn = '',
|
||||
goodsClass = this.state.productCateSelected.id,
|
||||
@ -168,12 +118,12 @@ class MyGoodList extends Component {
|
||||
goodsState = this.state.goodsStateParam,
|
||||
pageCount = this.state.pageCountParam,
|
||||
currPage = this.state.currPageParam,
|
||||
order = '', }) {
|
||||
order = '',
|
||||
}) {
|
||||
Taro.request({
|
||||
url: URL.MyGoodList,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
|
||||
data: {
|
||||
goodsName: goodsName,
|
||||
goodsSn: goodsSn,
|
||||
@ -197,21 +147,94 @@ class MyGoodList extends Component {
|
||||
if (res.statusCode === 200) {
|
||||
console.log('我的商品列表', JSON.parse(res.data))
|
||||
const data = JSON.parse(res.data)
|
||||
const goodCount = Number(data.goodsCount)
|
||||
this.setState({
|
||||
myGoodList: data.goods,
|
||||
myGoodListTotal: goodCount
|
||||
})
|
||||
Taro.hideLoading()
|
||||
|
||||
if (data.goods.length) {
|
||||
data.goods.forEach(item => {
|
||||
item.checked = false
|
||||
});
|
||||
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ myGoodList: this.state.myGoodList.concat(data.goods) }, () => {
|
||||
this.setState({ isAddToList: false })
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
myGoodList: data.goods,
|
||||
myGoodListTotal: data.goodsCount
|
||||
})
|
||||
|
||||
}
|
||||
} else {
|
||||
this.setState({ isAddToList: false })
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('我的商品列表获取失败')
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 获取搜索结果api
|
||||
// getMyGoodListApi({
|
||||
// goodsName = this.state.productName,
|
||||
// goodsSn = '',
|
||||
// goodsClass = this.state.productCateSelected.id,
|
||||
// goodsPriceL = this.state.lowestPrice,
|
||||
// goodsPriceU = this.state.heightestPrice,
|
||||
// goodsSalesL = this.state.minimumSold,
|
||||
// goodsSalesU = this.state.maximumSold,
|
||||
// shopClassID = this.state.productId,
|
||||
// goodsState = this.state.goodsStateParam,
|
||||
// pageCount = this.state.pageCountParam,
|
||||
// currPage = this.state.currPageParam,
|
||||
// order = '', }) {
|
||||
// Taro.request({
|
||||
// url: URL.MyGoodList,
|
||||
// method: 'POST',
|
||||
// dataType: 'json',
|
||||
|
||||
// data: {
|
||||
// goodsName: goodsName,
|
||||
// goodsSn: goodsSn,
|
||||
// goodsClass: goodsClass,
|
||||
// goodsPriceL: goodsPriceL,
|
||||
// goodsPriceU: goodsPriceU,
|
||||
// goodsSalesL: goodsSalesL,
|
||||
// goodsSalesU: goodsSalesU,
|
||||
// shopClassID: shopClassID,
|
||||
// goodsState: goodsState,
|
||||
// pageCount: pageCount,
|
||||
// currPage: currPage,
|
||||
// order: order
|
||||
// },
|
||||
// header: {
|
||||
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
// 'content-type': 'application/x-www-form-urlencoded',
|
||||
// 'X-Requested-With': 'XMLHttpRequest'
|
||||
// }
|
||||
// }).then(res => {
|
||||
// if (res.statusCode === 200) {
|
||||
// console.log('我的商品列表', JSON.parse(res.data))
|
||||
// const data = JSON.parse(res.data)
|
||||
// const goodCount = Number(data.goodsCount)
|
||||
// this.setState({
|
||||
// myGoodList: data.goods,
|
||||
// myGoodListTotal: goodCount
|
||||
// })
|
||||
// Taro.hideLoading()
|
||||
|
||||
// } else {
|
||||
// console.log('我的商品列表获取失败')
|
||||
// }
|
||||
|
||||
|
||||
// })
|
||||
|
||||
// }
|
||||
|
||||
// 商品列表下架API
|
||||
changeGoodState({ goodsState = 0, goodsID = this.state.goodsIdList }) {
|
||||
@ -306,8 +329,8 @@ class MyGoodList extends Component {
|
||||
Taro.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
this.setState({ currentPage: 1, isCheckAll: false }, () => {
|
||||
this.getGoodListResultApi({})
|
||||
this.setState({ currPageParam: 1, isCheckAll: false,loadMorePageIndex:1 }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
}
|
||||
|
||||
@ -315,6 +338,9 @@ class MyGoodList extends Component {
|
||||
// 清空搜索
|
||||
emptyButtonHanlder() {
|
||||
this.setState({
|
||||
isCheckAll: false,
|
||||
loadMorePageIndex:1,
|
||||
currPageParam: 1,
|
||||
productName: '',
|
||||
lowestPrice: '',
|
||||
heightestPrice: '',
|
||||
@ -323,10 +349,7 @@ class MyGoodList extends Component {
|
||||
productId: '',
|
||||
productCateSelected: { id: '', name: '全部类目' },
|
||||
}, () => {
|
||||
|
||||
this.setState({ isCheckAll: false, currentPage: 1 }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
this.getMyGoodListApi({})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
icon: 'success',
|
||||
@ -340,7 +363,7 @@ class MyGoodList extends Component {
|
||||
this.setState({ selectedFilterValue: value })
|
||||
if (value == 0) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: !this.state.filterOptions.filterPrice,
|
||||
filterStock: false,
|
||||
@ -349,12 +372,12 @@ class MyGoodList extends Component {
|
||||
}
|
||||
}
|
||||
)
|
||||
this.state.filterOptions.filterPrice ? this.getGoodListResultApi({ order: "goods_price desc" }) : this.getGoodListResultApi({ order: "goods_price" })
|
||||
this.state.filterOptions.filterPrice ? this.getMyGoodListApi({ order: "goods_price desc" }) : this.getMyGoodListApi({ order: "goods_price" })
|
||||
|
||||
}
|
||||
if (value == 1) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: !this.state.filterOptions.filterStock,
|
||||
@ -362,13 +385,13 @@ class MyGoodList extends Component {
|
||||
filterPublishDate: false,
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterStock ? this.getGoodListResultApi({ order: "goods_stock desc" }) : this.getGoodListResultApi({ order: "goods_stock" })
|
||||
this.state.filterOptions.filterStock ? this.getMyGoodListApi({ order: "goods_stock desc" }) : this.getMyGoodListApi({ order: "goods_stock" })
|
||||
}
|
||||
)
|
||||
}
|
||||
if (value == 2) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: false,
|
||||
@ -377,7 +400,7 @@ class MyGoodList extends Component {
|
||||
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterSold ? this.getGoodListResultApi({ order: "sales_volume desc" }) : this.getGoodListResultApi({ order: "sales_volume" })
|
||||
this.state.filterOptions.filterSold ? this.getMyGoodListApi({ order: "sales_volume desc" }) : this.getMyGoodListApi({ order: "sales_volume" })
|
||||
}
|
||||
|
||||
)
|
||||
@ -385,7 +408,7 @@ class MyGoodList extends Component {
|
||||
}
|
||||
if (value == 3) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: false,
|
||||
@ -394,19 +417,13 @@ class MyGoodList extends Component {
|
||||
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterPublishDate ? this.getGoodListResultApi({ order: "update_date desc" }) : this.getGoodListResultApi({ order: "update_date" })
|
||||
this.state.filterOptions.filterPublishDate ? this.getMyGoodListApi({ order: "update_date desc" }) : this.getMyGoodListApi({ order: "update_date" })
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 翻页导航
|
||||
paginationNav(type) {
|
||||
this.setState({ currentPage: type.current, isCheckAll: false }, () => {
|
||||
this.getMyGoodListApi({ currPage: this.state.currentPage })
|
||||
})
|
||||
|
||||
}
|
||||
// 商品全部选择
|
||||
checkAllHandler() {
|
||||
if (this.state.myGoodList.length) {
|
||||
@ -536,6 +553,9 @@ class MyGoodList extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.getMyGoodListApi({})
|
||||
this.getBaoBeiCateList()
|
||||
}
|
||||
@ -548,16 +568,21 @@ class MyGoodList extends Component {
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
loadMorePageIndex += 1
|
||||
this.setState({ isAddToList: true }, () => {
|
||||
this.getMyGoodListApi({ currPage: loadMorePageIndex })
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
this.getMyGoodListApi({ currPage: this.state.loadMorePageIndex })
|
||||
})
|
||||
|
||||
|
||||
@ -565,13 +590,15 @@ class MyGoodList extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
//等待接口数据
|
||||
const goodListElementArray = this.state.myGoodList.map((item, index) => {
|
||||
return <View key={index} className='good-container'>
|
||||
<View className='good-container-a'>
|
||||
<Radio className='radio' value={item.goods_id} checked={item.checked} onClick={this.handleCheckChange.bind(this, item.goods_id)} ></Radio>
|
||||
<View className='img-box' onClick={this.goToGoodspage.bind(this, item.goods_id)}>
|
||||
<Image mode='aspectFit' className='img' style='height:50px;width:50px' src={URL.Base + item.goods_url} />
|
||||
{/* <Image mode='aspectFit' className='img' style='height:50px;width:50px' src={URL.Base + item.goods_url} /> */}
|
||||
<Image className='img' style='height:100%;width:100%' src={URL.Base + item.goods_url} />
|
||||
</View>
|
||||
<View className='name-box' onClick={this.goToGoodspage.bind(this, item.goods_id)} >{item.goods_name}</View>
|
||||
<View className='price-box'>¥{item.goods_price}</View>
|
||||
@ -704,17 +731,16 @@ class MyGoodList extends Component {
|
||||
</View>
|
||||
<View className='button' onClick={this.goToGoodsPublishPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.emptyButtonHanlder.bind(this)}>
|
||||
<Button className='button-dark-red' size='mini'>
|
||||
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
清空</Button>
|
||||
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
清空条件</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='text'>
|
||||
<Text>出售中的宝贝{this.state.myGoodListTotal}条记录</Text>
|
||||
</View>
|
||||
@ -740,6 +766,7 @@ class MyGoodList extends Component {
|
||||
<View className='mygoodlist-container'>
|
||||
{goodListElementArray}
|
||||
</View >
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
|
@ -1,4 +1,7 @@
|
||||
$themeColor:#FF7142;
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:28rpx;
|
||||
}
|
||||
.MyGoodList{
|
||||
padding: 10px 20px;
|
||||
.filterbar-container{
|
||||
@ -52,6 +55,9 @@ $themeColor:#FF7142;
|
||||
.button{
|
||||
margin-left:2%;
|
||||
text-align: center;
|
||||
.button-dark-red,.button-blue{
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,18 +107,11 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0;
|
||||
padding: 0 120px;
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor;
|
||||
border:1PX solid $themeColor;
|
||||
}
|
||||
.button-a{
|
||||
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,21 +141,24 @@ $themeColor:#FF7142;
|
||||
flex-direction: row;
|
||||
font-size: 30px;
|
||||
height: 200px;
|
||||
line-height: 200px;
|
||||
text-align: center;
|
||||
color:#717592;
|
||||
align-items:center;
|
||||
|
||||
.radio{
|
||||
margin-left: 10px;
|
||||
}
|
||||
.img-box{
|
||||
flex:1;
|
||||
.img{
|
||||
margin-top: 35%;
|
||||
}
|
||||
height:80%;
|
||||
width:100%;
|
||||
margin: 0 2%;
|
||||
|
||||
|
||||
|
||||
}
|
||||
.name-box{
|
||||
flex:1;
|
||||
flex:2;
|
||||
color: #0579c6
|
||||
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/sho
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
|
||||
import './myGoodsEdit.scss'
|
||||
|
||||
class MyGoodsEdit extends Component {
|
||||
@ -27,6 +25,8 @@ class MyGoodsEdit extends Component {
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
goodsTypeParam: '',//商品分类参数
|
||||
goodId: '',//商品id
|
||||
isSaveButton: false,//是否点击了保存按钮
|
||||
isSaveAndNewBUtton: false,// 是否点击了保存新增按钮
|
||||
}
|
||||
}
|
||||
//获取商品信息api GetProductInfo
|
||||
@ -172,12 +172,20 @@ class MyGoodsEdit extends Component {
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSaveButton) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + this.$router.params.id
|
||||
})
|
||||
} else if (this.state.isSaveAndNewBUtton) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + this.$router.params.id
|
||||
})
|
||||
}, 1000);
|
||||
|
||||
console.log('上传商品', res)
|
||||
}
|
||||
)
|
||||
@ -269,12 +277,18 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onClickUploadGoods() {
|
||||
shopCategoryChanged(e) {
|
||||
this.setState({
|
||||
shopCategoryCheckedPicker: this.state.shopCategoryList[e.detail.value]
|
||||
}, () => {
|
||||
console.log(this.state.shopCategoryCheckedPicker)
|
||||
})
|
||||
}
|
||||
// 保存按钮
|
||||
saveButtonHandler() {
|
||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopTypeSelected.id) {
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
setTimeout(() => {
|
||||
this.setState({ isSaveButton: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
@ -284,7 +298,8 @@ class MyGoodsEdit extends Component {
|
||||
class_id: this.state.goodsTypeParam,
|
||||
goods_id: this.state.goodId,
|
||||
})
|
||||
}, 1000);
|
||||
|
||||
})
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
@ -295,11 +310,37 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
}
|
||||
}
|
||||
shopCategoryChanged(e) {
|
||||
this.setState({
|
||||
shopCategoryCheckedPicker: this.state.shopCategoryList[e.detail.value]
|
||||
}, () => {
|
||||
console.log(this.state.shopCategoryCheckedPicker)
|
||||
// 保存并新增按钮
|
||||
saveAndNewButton() {
|
||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopTypeSelected.id) {
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveAndNewBUtton: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
class_id: this.state.goodsTypeParam,
|
||||
goods_id: this.state.goodId,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
goToGoodsDetailPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + this.$router.params.id
|
||||
})
|
||||
}
|
||||
goToMyGoodListPage() {
|
||||
@ -336,12 +377,12 @@ class MyGoodsEdit extends Component {
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='productName'
|
||||
title='商品名称:'
|
||||
type='text'
|
||||
value={this.state.productName}
|
||||
border={false}
|
||||
onChange={this.productNameChange.bind(this)}
|
||||
name='productName'
|
||||
title='商品名称:'
|
||||
type='text'
|
||||
value={this.state.productName}
|
||||
border={false}
|
||||
onChange={this.productNameChange.bind(this)}
|
||||
|
||||
|
||||
/>
|
||||
@ -349,24 +390,24 @@ class MyGoodsEdit extends Component {
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='productPrice'
|
||||
title='商品价格:'
|
||||
type='number'
|
||||
placeholder='¥'
|
||||
value={this.state.productPrice}
|
||||
border={false}
|
||||
onChange={this.productPriceChange.bind(this)}
|
||||
name='productPrice'
|
||||
title='商品价格:'
|
||||
type='number'
|
||||
placeholder='¥'
|
||||
value={this.state.productPrice}
|
||||
border={false}
|
||||
onChange={this.productPriceChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='productUnit'
|
||||
title='商品单位:'
|
||||
type='number'
|
||||
value={this.state.productUnit}
|
||||
border={false}
|
||||
onChange={this.productUnitChange.bind(this)}
|
||||
name='productUnit'
|
||||
title='商品单位:'
|
||||
type='number'
|
||||
value={this.state.productUnit}
|
||||
border={false}
|
||||
onChange={this.productUnitChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
{/* 图片上传 */}
|
||||
@ -377,18 +418,18 @@ class MyGoodsEdit extends Component {
|
||||
</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)}
|
||||
multiple
|
||||
files={this.state.pickerImageUrl}
|
||||
onChange={this.onChangeImg.bind(this)}
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
></ShopTypeInteractionComp>
|
||||
{/* 店铺分类结束 */}
|
||||
|
||||
@ -399,27 +440,34 @@ class MyGoodsEdit extends Component {
|
||||
</View>
|
||||
|
||||
<AtTextarea
|
||||
value={this.state.productDescript}
|
||||
onChange={this.productDescriptChange.bind(this)}
|
||||
maxlength='200'
|
||||
placeholder='你的产品简介'
|
||||
value={this.state.productDescript}
|
||||
onChange={this.productDescriptChange.bind(this)}
|
||||
maxlength='200'
|
||||
placeholder='你的产品简介'
|
||||
/>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
<View className='button-box' >
|
||||
<View className='button' >
|
||||
<Button size='mini' className='button-orange' onClick={this.onClickUploadGoods.bind(this)}>保存</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
<View className='button-box' >
|
||||
<View className='button' >
|
||||
<Button size='mini' className='button-orange' onClick={this.saveButtonHandler.bind(this)}>保存</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
<Button className='button-a' size='mini' >发布并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.goToMyGoodListPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>商品列表</Button>
|
||||
<View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
||||
<Button className='button-green' size='mini'>保存并新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToGoodsDetailPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>商品详情</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyGoodListPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>商品列表</Button>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
</View>
|
||||
|
@ -77,17 +77,11 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 120px;
|
||||
justify-content: space-around;
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor;
|
||||
border:1PX solid $themeColor;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
.button-orange,.button-green{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,13 @@ import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import './myNeeds.scss'
|
||||
|
||||
let loadMorePageIndex = 1 // 底部加载接口请求参数
|
||||
|
||||
class MyNeeds extends Component {
|
||||
|
||||
@ -38,23 +37,24 @@ class MyNeeds extends Component {
|
||||
totalNeeds: 0,// 我的需求数量
|
||||
currentPage: 1,
|
||||
needsItem: '',// 确认框提示时 使用的供求名
|
||||
isDeleteModal:false,
|
||||
isDeleteModal:false,// 删除提示框
|
||||
isAddToList: false,// 请求需求的时候是否添加到旧列表里
|
||||
|
||||
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex:1,// 上拉加载页面数
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//请求我的需求列表 api GetMyNeedsList
|
||||
getMyNeedsList({ curr_page = 1,
|
||||
page_count = 10,
|
||||
sd_type = '4',
|
||||
sd_title = '',
|
||||
update_dateL = '',
|
||||
update_dateU = '',
|
||||
class_id = '',
|
||||
state = ''
|
||||
getMyNeedsList({
|
||||
curr_page = this.state.currentPage,
|
||||
page_count = this.state.pageCount,
|
||||
sd_type = this.state.needsTypeSelected.id,
|
||||
sd_title = this.state.title,
|
||||
update_dateL = this.state.startDateSel,
|
||||
update_dateU = this.state.endDateSel,
|
||||
class_id = this.state.industryTypeSelected.id,
|
||||
state = this.state.needsStateSelected.id
|
||||
}) {
|
||||
//由于后台返回的问题, 所有当state为空的时候不传state,反之传state
|
||||
const param=state?{param: JSON.stringify({
|
||||
@ -99,6 +99,7 @@ class MyNeeds extends Component {
|
||||
})
|
||||
|
||||
}else{
|
||||
this.setState({isAddToList:false})
|
||||
this.setState({
|
||||
allNeedsList: res.data.supplys || [],
|
||||
totalNeeds: Number(res.data.count)
|
||||
@ -108,6 +109,7 @@ class MyNeeds extends Component {
|
||||
|
||||
|
||||
}else{
|
||||
this.setState({isAddToList:false})
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
@ -167,7 +169,7 @@ class MyNeeds extends Component {
|
||||
// 搜索按钮
|
||||
onSearchButtonHandler() {
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
setTimeout(() => {
|
||||
this.setState({ currentPage: 1,loadMorePageIndex:1 },()=>{
|
||||
this.getMyNeedsList({
|
||||
curr_page: this.state.currentPage,
|
||||
page_count: this.state.pageCount,
|
||||
@ -178,8 +180,11 @@ class MyNeeds extends Component {
|
||||
class_id: this.state.industryTypeSelected.id==='-1'?'':this.state.industryTypeSelected.id,
|
||||
state: this.state.needsStateSelected.id
|
||||
})
|
||||
this.setState({ currentPage: 1 })
|
||||
}, 1000);
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
@ -192,12 +197,17 @@ class MyNeeds extends Component {
|
||||
}
|
||||
//清空筛选项
|
||||
emptyFilter(){
|
||||
|
||||
this.setState({
|
||||
title:'',
|
||||
endDateSel:'',
|
||||
startDateSel:'',
|
||||
|
||||
industryTypeSelected: { name: '全部', id: '' },
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
needsStateSelected: { name: '全部', id: '' },
|
||||
currentPage:1,
|
||||
loadMorePageIndex:1,
|
||||
},()=>{
|
||||
this.getMyNeedsList({})
|
||||
})
|
||||
Taro.showToast({
|
||||
title:'已清空',
|
||||
@ -257,6 +267,9 @@ class MyNeeds extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({
|
||||
title:'加载中'
|
||||
})
|
||||
this.getMyNeedsList({})
|
||||
|
||||
}
|
||||
@ -270,14 +283,22 @@ class MyNeeds extends Component {
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
loadMorePageIndex += 1
|
||||
this.setState({ isAddToList: true }, () => {
|
||||
this.getMyNeedsList({ curr_page: loadMorePageIndex })
|
||||
|
||||
this.setState({ isAddToList: true,loadMorePageIndex:this.state.loadMorePageIndex+1 }, () => {
|
||||
this.getMyNeedsList({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
|
||||
}
|
||||
@ -314,7 +335,7 @@ class MyNeeds extends Component {
|
||||
<View className='button' onClick={this.goToMyNeedsEditPage.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange button-no-margin'>编辑</Button>
|
||||
</View>
|
||||
<View className='button-a' onClick={this.deleteButton.bind(this, item)}>
|
||||
<View className='button' onClick={this.deleteButton.bind(this, item)}>
|
||||
<Button size='mini' className='button-dark-red button-no-margin' >删除</Button>
|
||||
</View>
|
||||
</View > : <View className='info-button-box'>
|
||||
@ -422,13 +443,12 @@ class MyNeeds extends Component {
|
||||
共<Text className='count'>{this.state.totalNeeds}</Text> 条记录
|
||||
</View>
|
||||
{/* 我的需求信息 */}
|
||||
{this.state.totalNeeds != "0" ? <View className='info-box'>
|
||||
{ <View className='info-box'>
|
||||
{myNeedsListArrayElement}
|
||||
</View> : <View className='nomore' >
|
||||
没有更多了....
|
||||
</View >}
|
||||
</View>}
|
||||
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
|
||||
<CopyrightComponent ></CopyrightComponent>
|
||||
|
||||
</View>
|
||||
|
@ -1,4 +1,7 @@
|
||||
$themeColor:#FF7142;
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:28rpx;
|
||||
}
|
||||
.myNeeds{
|
||||
padding: 10px 20px;
|
||||
font-size: 32rpx;
|
||||
@ -83,15 +86,15 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0;
|
||||
padding: 0 120px;
|
||||
|
||||
justify-content:space-around;
|
||||
.button{
|
||||
flex:1;
|
||||
|
||||
text-align: center;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:28rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.pagination-box{
|
||||
@ -107,7 +110,8 @@ $themeColor:#FF7142;
|
||||
box-shadow: 0 8px 8px #ddd;
|
||||
padding: 10px;
|
||||
font-size: 25rpx;
|
||||
|
||||
padding-bottom:0px;
|
||||
|
||||
.box{
|
||||
margin-top: 10px;
|
||||
|
||||
@ -129,6 +133,9 @@ $themeColor:#FF7142;
|
||||
// flex:1;
|
||||
text-align: right;
|
||||
margin:0 1% 0;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,13 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Button } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
import { View, Text, Button,Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
|
||||
import './myNeedsEdit.scss'
|
||||
|
||||
|
||||
|
||||
class MyNeedsEdit extends Component {
|
||||
|
||||
config = {
|
||||
@ -20,7 +16,7 @@ class MyNeedsEdit extends Component {
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
|
||||
|
||||
industryTypeSelected: '',
|
||||
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
@ -37,6 +33,11 @@ class MyNeedsEdit extends Component {
|
||||
content: '',//描述
|
||||
pickerImageUrl: [],
|
||||
ImagesInfo: '',
|
||||
isDeleteModal: false,// 删除提示框
|
||||
isSave: false,//是否点击保存按钮
|
||||
isSaveAndNew: false,//是否点击保存新增按钮
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//获取需求信息api
|
||||
@ -76,12 +77,12 @@ class MyNeedsEdit extends Component {
|
||||
break
|
||||
}
|
||||
}
|
||||
if(!Object.keys(industryType).length){
|
||||
if (!Object.keys(industryType).length) {
|
||||
industryType.name = '全部'
|
||||
industryType.id =''
|
||||
industryType.id = '-1'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const needsType = this.state.needsType.filter(item => {
|
||||
return item.id === res.data.sdInfo.sd_type
|
||||
@ -95,8 +96,8 @@ class MyNeedsEdit extends Component {
|
||||
industryTypeSelected: industryType,
|
||||
needsTypeSelected: needsType,
|
||||
title: res.data.sdInfo.sd_title,
|
||||
contactName:res.data.sdInfo.user_name,
|
||||
contactNumber:res.data.sdInfo.user_phone,
|
||||
contactName: res.data.sdInfo.user_name,
|
||||
contactNumber: res.data.sdInfo.user_phone,
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
@ -112,22 +113,7 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
// 上传需求按键
|
||||
uploadMyNeedsButton() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
this.uploadMyNeedsApi({})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// uploadMyNeedsApi 上传需求 的api
|
||||
uploadMyNeedsApi() {
|
||||
@ -169,17 +155,25 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('上传需求', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
// setTimeout(() => {
|
||||
// Taro.navigateTo({
|
||||
// // url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
// })
|
||||
// }, 1500);
|
||||
setTimeout(() => {
|
||||
if (this.state.isSave) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + this.state.sd_id
|
||||
})
|
||||
} else if (this.state.isSaveAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
}
|
||||
|
||||
}, 1500);
|
||||
})
|
||||
|
||||
} else {
|
||||
@ -239,6 +233,46 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//删除我的需求 api DeleteMyNeeds
|
||||
deleteMyNeeds({ demandId = 10 }) {
|
||||
Taro.request({
|
||||
url: URL.DeleteMyNeeds,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
|
||||
demandId: demandId
|
||||
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('删除我的列表', res)
|
||||
if (res.data.err_msg === "success") {
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
}, 1000);
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
// 修改需求类型
|
||||
needsTypeChange = e => {
|
||||
this.setState({
|
||||
@ -272,6 +306,61 @@ class MyNeedsEdit extends Component {
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
}
|
||||
// 保存需求按钮
|
||||
saveButtonHandler() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
Taro.showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSave: true }, () => {
|
||||
this.uploadMyNeedsApi({})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
// 保存新增按钮
|
||||
saveAndNewButton() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
Taro.showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
this.uploadMyNeedsApi({})
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
deleteButtonHandler() {
|
||||
this.setState({ isDeleteModal: true })
|
||||
}
|
||||
|
||||
handleWindowModCancel() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
this.deleteMyNeeds({ demandId: this.state.sd_id })
|
||||
}
|
||||
|
||||
getDataFromChild(value) {
|
||||
console.log('从子组件传回来的值', value)
|
||||
@ -295,10 +384,17 @@ class MyNeedsEdit extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认删除{this.state.needsItem.sd_title}?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
return (
|
||||
<View className='supply-demand'>
|
||||
|
||||
{deleteModalWindowElement}
|
||||
{/* 行业分类 */}
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} ></InteractionComponent>
|
||||
|
||||
@ -323,9 +419,9 @@ class MyNeedsEdit extends Component {
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
|
||||
|
||||
/>
|
||||
|
||||
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
@ -338,17 +434,20 @@ class MyNeedsEdit extends Component {
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
border={false}
|
||||
onChange={this.contactNumberChange.bind(this)}
|
||||
/>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
@ -405,15 +504,17 @@ class MyNeedsEdit extends Component {
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.uploadMyNeedsButton.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>保存</Button>
|
||||
<View className='button' onClick={this.saveButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>保存</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
||||
<Button size='mini' className='button-green'>保存并新增</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
|
||||
<Button className='button-a' size='mini'>保存并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>我的需求</Button>
|
||||
<Button className='button-green' size='mini'>我的需求</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.deleteButtonHandler.bind(this)}>
|
||||
<Button className='button-dark-red' size='mini'>删除</Button>
|
||||
</View>
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
@ -26,21 +26,15 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 120px;
|
||||
justify-content: space-around;
|
||||
.button{
|
||||
flex:1;
|
||||
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor,;
|
||||
border:1PX solid $themeColor,;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.title-box{
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text ,Button} from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
import { View, Text, Button,Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
@ -32,31 +32,16 @@ class MyNeedsPublish extends Component {
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
|
||||
isPublish: false,//是否点击发布按钮
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 上传需求api
|
||||
uploadMyNeedsButton() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
this.uploadMyNeedsApi({})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// uploadMyNeeds 上传供求 的api
|
||||
@ -101,14 +86,21 @@ class MyNeedsPublish extends Component {
|
||||
console.log('上传需求', res)
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
title: '发布成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeeds/myNeeds'
|
||||
})
|
||||
if (this.state.isPublish) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.data.sd_id
|
||||
})
|
||||
} else if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
}
|
||||
|
||||
}, 1500);
|
||||
})
|
||||
|
||||
@ -200,6 +192,53 @@ class MyNeedsPublish extends Component {
|
||||
}
|
||||
contentChange(event) {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
// 发布按钮
|
||||
publishButtonHandler() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
|
||||
Taro.showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublish: true }, () => {
|
||||
this.uploadMyNeedsApi({})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 发布新增按钮
|
||||
publishAndNewButton() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
|
||||
Taro.showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
this.uploadMyNeedsApi({})
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
goToMyNeedsPage() {
|
||||
Taro.navigateTo({
|
||||
@ -258,7 +297,7 @@ class MyNeedsPublish extends Component {
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
|
||||
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
@ -272,17 +311,20 @@ class MyNeedsPublish extends Component {
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
border={false}
|
||||
onChange={this.contactNumberChange.bind(this)}
|
||||
/>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
@ -339,15 +381,15 @@ class MyNeedsPublish extends Component {
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.uploadMyNeedsButton.bind(this)}>
|
||||
<Button size='mini'className='button-orange' >发布</Button>
|
||||
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange' >发布</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
|
||||
<Button className='button-a' size='mini' >保存并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||
<Button className='button-green' size='mini' >发布并新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button className='button-green' size='mini' >我的需求</Button>
|
||||
<Button className='button-green' size='mini' >我的需求</Button>
|
||||
</View>
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
@ -26,17 +26,11 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 120px;
|
||||
justify-content: space-around;
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor,;
|
||||
border:1PX solid $themeColor,;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class SupplyDemandView extends Component {
|
||||
content: '',//描述
|
||||
pickerImageUrl: [],
|
||||
ImagesInfo: '',
|
||||
isShowAllButtons:true// 是否显示所有按钮
|
||||
}
|
||||
}
|
||||
//获取需求信息api
|
||||
@ -58,48 +59,60 @@ class SupplyDemandView extends Component {
|
||||
// const selectedType = this.state.demandingSupplyCate.filter(item => item.id == res.data.sdInfo.sd_type)[0]
|
||||
// const selectedState = this.state.needsState.filter(item => item.id == res.data.sdInfo.state)[0]
|
||||
Taro.hideLoading()
|
||||
let industryType = {}
|
||||
const classId = res.data.sdInfo.class_id
|
||||
for (let outter of res.data.supplyTree) {
|
||||
if (outter.children) {
|
||||
for (let inner of outter.children) {
|
||||
if (inner.class_id === classId) {
|
||||
industryType.name = inner.class_name
|
||||
industryType.id = inner.class_id
|
||||
break
|
||||
if(res.data.err_msg==='success'){
|
||||
let industryType = {}
|
||||
const classId = res.data.sdInfo.class_id
|
||||
for (let outter of res.data.supplyTree) {
|
||||
if (outter.children) {
|
||||
for (let inner of outter.children) {
|
||||
if (inner.class_id === classId) {
|
||||
industryType.name = inner.class_name
|
||||
industryType.id = inner.class_id
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if (outter.class_id === classId) {
|
||||
industryType.name = outter.class_name
|
||||
industryType.id = outter.class_id
|
||||
break
|
||||
}
|
||||
}
|
||||
if (outter.class_id === classId) {
|
||||
industryType.name = outter.class_name
|
||||
industryType.id = outter.class_id
|
||||
break
|
||||
}
|
||||
|
||||
const needsType = this.state.needsType.filter(item => {
|
||||
return item.id === res.data.sdInfo.sd_type
|
||||
})[0]
|
||||
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
||||
const needsState = this.state.needsState.filter(item => {
|
||||
return item.id === res.data.sdInfo.state
|
||||
})[0]
|
||||
this.setState({
|
||||
sd_id: res.data.sdInfo.sd_id,
|
||||
industryTypeSelected: industryType,
|
||||
needsTypeSelected: needsType,
|
||||
title: res.data.sdInfo.sd_title,
|
||||
browsing: res.data.sdInfo.browse_times,
|
||||
contactName: res.data.sdInfo.user_name,
|
||||
contactNumber: res.data.sdInfo.user_phone,
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
isDeleteModal: false,
|
||||
|
||||
})
|
||||
|
||||
}else{
|
||||
this.setState({
|
||||
isShowAllButtons:false
|
||||
})
|
||||
Taro.showToast({
|
||||
title:res.data.err_msg,
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
|
||||
const needsType = this.state.needsType.filter(item => {
|
||||
return item.id === res.data.sdInfo.sd_type
|
||||
})[0]
|
||||
const imageFile = res.data.sdInfo.file_path.map(item => { return { url: URL.Base + item.file_path } })
|
||||
const needsState = this.state.needsState.filter(item => {
|
||||
return item.id === res.data.sdInfo.state
|
||||
})[0]
|
||||
this.setState({
|
||||
sd_id: res.data.sdInfo.sd_id,
|
||||
industryTypeSelected: industryType,
|
||||
needsTypeSelected: needsType,
|
||||
title: res.data.sdInfo.sd_title,
|
||||
browsing: res.data.sdInfo.browse_times,
|
||||
contactName: res.data.sdInfo.user_name,
|
||||
contactNumber: res.data.sdInfo.user_phone,
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
isDeleteModal: false,
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -243,29 +256,40 @@ class SupplyDemandView extends Component {
|
||||
</View>:null
|
||||
}
|
||||
|
||||
<View className='button-box'>
|
||||
{this.state.isShowAllButtons? <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 className='button' size='mini' className='button-green'>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的需求</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goMyNeedEditPage.bind(this)}>
|
||||
<Button className='button' size='mini' className='button-orange'>
|
||||
<AtIcon value='settings' size='12' color='white'></AtIcon>
|
||||
修改</Button>
|
||||
</View>
|
||||
|
||||
<View className='button' onClick={this.deleteButton.bind(this)}>
|
||||
<Button className='button-a' size='mini' className='button-dark-red'>
|
||||
<AtIcon value='close' 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>
|
||||
</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>:<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>}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
|
||||
|
@ -16,23 +16,14 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 20px;
|
||||
justify-content: space-around;
|
||||
|
||||
|
||||
.button{
|
||||
flex:1;
|
||||
|
||||
text-align: center;
|
||||
.button-green{
|
||||
font-size: 25rpx;
|
||||
|
||||
}
|
||||
.button-orange{
|
||||
font-size: 25rpx;
|
||||
|
||||
}
|
||||
.button-dark-red{
|
||||
font-size: 25rpx;
|
||||
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,13 @@ import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import './mySupplyDemand.scss'
|
||||
|
||||
let loadMorePageIndex = 1 // 底部加载接口请求参数
|
||||
|
||||
class MySupplyDemand extends Component {
|
||||
|
||||
@ -30,65 +30,25 @@ class MySupplyDemand extends Component {
|
||||
demandSupplyItemName: '',// 确认框提示时 使用的供求名
|
||||
demandSupplyId: '',// 删除我的供求时的供求id
|
||||
totalDemandSupply: 0,//所有供求
|
||||
currentPage: 1 //当前页数
|
||||
currentPage: 1,//当前页数
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//上拉加载页面数
|
||||
}
|
||||
}
|
||||
//获取我的供求列表API
|
||||
getMySupplyDemand({ curr_page = 1, page_count = 10 }) {
|
||||
getMySupplyDemand({
|
||||
curr_page = 1, page_count = 10,
|
||||
sd_type = this.state.demandSupplyCateSelected.id,
|
||||
state = this.state.demandSupplyStatesSelected.id,
|
||||
sd_title = this.state.title,
|
||||
update_dateL = this.state.startDateSel,
|
||||
update_dateU = this.state.endDateSel
|
||||
}) {
|
||||
Taro.request({
|
||||
url: URL.MySupplyDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
Taro.hideLoading()
|
||||
console.log('我的供求列表', res)
|
||||
if (res.data.err_msg === "success") {
|
||||
// 判断是否有res.data.supplys , 如果没有就是空数组[]
|
||||
if (res.data.supplys.length) {
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ allDemandSupply: this.state.allDemandSupply.concat(res.data.supplys) }, () => {
|
||||
this.setState({ isAddToList: false })
|
||||
})
|
||||
} else {
|
||||
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: res.data.count })
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
//搜索我的供求api
|
||||
searchDemandSupply({ curr_page = 1, page_count = 20,
|
||||
sd_type = this.state.demandSupplyCateSelected.id,
|
||||
state = this.state.demandSupplyStatesSelected.id, sd_title = this.state.title, update_dateL = this.state.startDateSel, update_dateU = this.state.endDateSel }) {
|
||||
Taro.request({
|
||||
url: URL.SearchDemandSupply,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
@ -101,25 +61,54 @@ class MySupplyDemand extends Component {
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
//this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true })
|
||||
console.log('我的供求搜索结果', res)
|
||||
Taro.hideLoading()
|
||||
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: res.data.count })
|
||||
}).then(res => {
|
||||
Taro.hideLoading()
|
||||
console.log('我的供求列表', res)
|
||||
if (res.data.err_msg === "success") {
|
||||
if (this.state.isAddToList) {
|
||||
if (res.data.supplys.length&&res.data.count!=='0') {
|
||||
this.setState({ allDemandSupply: this.state.allDemandSupply.concat(res.data.supplys) }, () => {
|
||||
this.setState({ isAddToList: false })
|
||||
})
|
||||
} else {
|
||||
this.setState({ isAddToList: false })
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (res.data.count!=='0') {
|
||||
this.setState({ allDemandSupply: res.data.supplys, totalDemandSupply: res.data.count })
|
||||
} else {
|
||||
this.setState({ allDemandSupply: [], totalDemandSupply: res.data.count })
|
||||
Taro.showToast({
|
||||
title: '没有找到相关信息',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
onSearchButtonHandler() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
|
||||
this.setState({ currentPage: 1 }, () => {
|
||||
this.searchDemandSupply({})
|
||||
this.setState({ loadMorePageIndex:1 }, () => {
|
||||
this.getMySupplyDemand({curr_page:this.state.loadMorePageIndex})
|
||||
})
|
||||
|
||||
}
|
||||
@ -167,10 +156,7 @@ class MySupplyDemand extends Component {
|
||||
})
|
||||
})
|
||||
}
|
||||
//搜索我的供求
|
||||
|
||||
|
||||
|
||||
|
||||
// 新增我的供求
|
||||
addDemandSupply() {
|
||||
Taro.navigateTo({
|
||||
@ -186,6 +172,8 @@ class MySupplyDemand extends Component {
|
||||
startDateSel: '',
|
||||
demandSupplyCateSelected: { name: '全部', id: '' },
|
||||
demandSupplyStatesSelected: { name: '全部', id: '' },
|
||||
}, () => {
|
||||
this.getMySupplyDemand({})
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
@ -257,15 +245,7 @@ class MySupplyDemand extends Component {
|
||||
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
|
||||
})
|
||||
}
|
||||
// 翻页导航
|
||||
paginationNav(type) {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.setState({ currentPage: type.current, }, () => {
|
||||
this.getMySupplyDemand({ curr_page: this.state.currentPage })
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -282,15 +262,22 @@ class MySupplyDemand extends Component {
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
loadMorePageIndex += 1
|
||||
this.setState({ isAddToList: true }, () => {
|
||||
this.getMySupplyDemand({ curr_page: loadMorePageIndex })
|
||||
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
this.getMySupplyDemand({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
|
||||
}
|
||||
@ -339,9 +326,10 @@ class MySupplyDemand extends Component {
|
||||
<Text className='info'>{item.update_date}</Text>
|
||||
</View>
|
||||
<View className='info-button-box'>
|
||||
<View className='button' onClick={this.goSupplyDemandView.bind(this, item.sd_id)}>
|
||||
|
||||
{item.state === '0' ? null : <View className='button' onClick={this.goSupplyDemandView.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange button-no-margin'>查看</Button>
|
||||
</View>
|
||||
</View>}
|
||||
<View className='button' onClick={this.goToMyDSEditPage.bind(this, item.sd_id)} >
|
||||
<Button size='mini' className='button-orange button-no-margin'>编辑</Button>
|
||||
</View>
|
||||
@ -429,12 +417,12 @@ class MySupplyDemand extends Component {
|
||||
搜索</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.addDemandSupply.bind(this)}>
|
||||
<Button className='button-a' size='mini' className='button-green'>
|
||||
<Button className=' button-green' size='mini'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
||||
<Button className='button-b' size='mini' className='button-dark-red'>
|
||||
<Button size='mini' className='button-dark-red'>
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
清空</Button>
|
||||
</View>
|
||||
@ -444,10 +432,8 @@ class MySupplyDemand extends Component {
|
||||
<View className='info-box'>
|
||||
{demandSupplyElementArray}
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
</View>
|
||||
|
@ -1,4 +1,7 @@
|
||||
$themeColor:#FF7142;
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:28rpx;
|
||||
}
|
||||
|
||||
.mySupplyDemand{
|
||||
padding: 10px 20px;
|
||||
@ -74,18 +77,17 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0;
|
||||
padding: 0 120px;
|
||||
|
||||
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
.button-orange, .button-dark-red,.button-green{
|
||||
font-size:28rpx;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.info-box{
|
||||
font-size: 25rpx;
|
||||
|
||||
@ -112,6 +114,9 @@ $themeColor:#FF7142;
|
||||
// flex:1;
|
||||
text-align: center;
|
||||
margin:1% 1% 0;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, Text, Image } from '@tarojs/components'
|
||||
import { View, Button, Text, Image, Map } from '@tarojs/components'
|
||||
import { AtTag, AtIcon, } from 'taro-ui'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import './shop.scss'
|
||||
import ShopItem from '../../component/shopItemComponent/shopItemComponent'
|
||||
import BottomNav from '../../component/bottomNav/bottomNav'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
let loadMorePageIndex = 1 // 底部加载接口请求参数
|
||||
|
||||
class Shop extends Component {
|
||||
// 项目配置
|
||||
@ -53,6 +53,9 @@ class Shop extends Component {
|
||||
widthType: [],// 侧边宽度类型
|
||||
checkedFilterIdList: [],//已选的筛选id
|
||||
isAddToList: false,// 请求店铺商品的时候是否添加到旧列表里
|
||||
loadMorePageIndex:1,//上拉加载页面数
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
|
||||
// 下面是函数的默认参数
|
||||
curr_page: 1,
|
||||
page_count: 10,
|
||||
@ -65,6 +68,8 @@ class Shop extends Component {
|
||||
goodsSpec: [],
|
||||
goodsParam: [],
|
||||
goodsParamExt: [],
|
||||
longitude: '',
|
||||
latitude: ''
|
||||
|
||||
}
|
||||
}
|
||||
@ -142,7 +147,13 @@ class Shop extends Component {
|
||||
// console.log('数据',data.goods_type)
|
||||
let goodTypeArray = []
|
||||
Object.keys(data.goods_type).forEach(key => {
|
||||
goodTypeArray.push({ id: data.goods_type[key].goods_type_id, name: data.goods_type[key].goods_type_ch_name, checked: false })
|
||||
if (data.goods_type[key]) {
|
||||
goodTypeArray.push({
|
||||
id: data.goods_type[key].goods_type_id,
|
||||
name: data.goods_type[key].goods_type_ch_name,
|
||||
checked: false
|
||||
})
|
||||
}
|
||||
});
|
||||
formatedFilterOptions.goodType = goodTypeArray
|
||||
}
|
||||
@ -151,11 +162,15 @@ class Shop extends Component {
|
||||
let goodsParamArray = []
|
||||
|
||||
Object.keys(data.goodsParam).forEach(key => {
|
||||
const value = data.goodsParam[key]
|
||||
const subArray = value.param_value.map(item => {
|
||||
return { id: value.param_id, name: item, checked: false }
|
||||
})
|
||||
goodsParamArray.push({ [value.param_name]: subArray })
|
||||
if (data.goodsParam[key]) {
|
||||
const value = data.goodsParam[key]
|
||||
const subArray = value.param_value.map(item => {
|
||||
return { id: value.param_id, name: item, checked: false }
|
||||
})
|
||||
goodsParamArray.push({ [value.param_name]: subArray })
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
formatedFilterOptions.otherType = goodsParamArray
|
||||
}
|
||||
@ -190,6 +205,7 @@ class Shop extends Component {
|
||||
shop_class_id = this.state.shop_class_id,
|
||||
order = this.state.order,
|
||||
goods_class_id = this.state.goods_class_id,
|
||||
currPage = '', // 不知道为什么筛选的时候要加 加这个参数为1
|
||||
goodsSpec = this.state.goodsSpec,
|
||||
goodsParam = this.state.goodsParam,
|
||||
goodsParamExt = this.state.goodsParamExt }) {
|
||||
@ -207,6 +223,7 @@ class Shop extends Component {
|
||||
shop_class_id: shop_class_id,
|
||||
order: order,
|
||||
goods_class_id: goods_class_id,
|
||||
currPage: currPage
|
||||
}),
|
||||
goodsRegion: JSON.stringify({}),
|
||||
goodsSpec: JSON.stringify(goodsSpec),
|
||||
@ -264,7 +281,9 @@ class Shop extends Component {
|
||||
shopAddress: res.data.data.shop_address,
|
||||
contactName: res.data.userRes.name,
|
||||
contactNumber: res.data.userRes.phone,
|
||||
shopDescription: res.data.data.shop_desc
|
||||
shopDescription: res.data.data.shop_desc,
|
||||
latitude: res.data.data.shop_map.split(',')[0],
|
||||
longitude: res.data.data.shop_map.split(',')[1]
|
||||
}, () => {
|
||||
// console.log(this.state.shopDescriptionData)
|
||||
})
|
||||
@ -318,7 +337,6 @@ class Shop extends Component {
|
||||
this.setState({ selectedFilterValue: value })
|
||||
if (value == 0) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
filterOptions: {
|
||||
all: true,
|
||||
amount: false,
|
||||
@ -328,11 +346,11 @@ class Shop extends Component {
|
||||
}
|
||||
}
|
||||
)
|
||||
this.goodsSearch({})
|
||||
this.goodsSearch({ currPage: 1 })
|
||||
}
|
||||
if (value == 1) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
|
||||
filterOptions: {
|
||||
all: false,
|
||||
amount: !this.state.filterOptions.amount,
|
||||
@ -341,13 +359,13 @@ class Shop extends Component {
|
||||
popularity: false
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.amount ? this.goodsSearch({ order: "g.sales_volume desc" }) : this.goodsSearch({ order: "g.sales_volume" })
|
||||
this.state.filterOptions.amount ? this.goodsSearch({ currPage: 1, order: "g.sales_volume desc" }) : this.goodsSearch({ currPage: 1, order: "g.sales_volume" })
|
||||
}
|
||||
)
|
||||
}
|
||||
if (value == 2) {
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
|
||||
filterOptions: {
|
||||
all: false,
|
||||
amount: false,
|
||||
@ -356,7 +374,7 @@ class Shop extends Component {
|
||||
popularity: false
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.newProduct ? this.goodsSearch({ order: "g.create_date desc" }) : this.goodsSearch({ order: "g.create_date" })
|
||||
this.state.filterOptions.newProduct ? this.goodsSearch({ currPage: 1, order: "g.create_date desc" }) : this.goodsSearch({ currPage: 1, order: "g.create_date" })
|
||||
}
|
||||
)
|
||||
|
||||
@ -364,7 +382,7 @@ class Shop extends Component {
|
||||
if (value == 3) {
|
||||
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
|
||||
filterOptions: {
|
||||
all: false,
|
||||
amount: false,
|
||||
@ -373,7 +391,7 @@ class Shop extends Component {
|
||||
popularity: false
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.price ? this.goodsSearch({ order: "g.goods_price desc" }) : this.goodsSearch({ order: "g.goods_price" })
|
||||
this.state.filterOptions.price ? this.goodsSearch({ currPage: 1, order: "g.goods_price desc" }) : this.goodsSearch({ currPage: 1, order: "g.goods_price" })
|
||||
}
|
||||
)
|
||||
|
||||
@ -381,7 +399,7 @@ class Shop extends Component {
|
||||
if (value == 4) {
|
||||
|
||||
this.setState({
|
||||
currentPage: 1,
|
||||
|
||||
filterOptions: {
|
||||
all: false,
|
||||
amount: false,
|
||||
@ -390,7 +408,7 @@ class Shop extends Component {
|
||||
popularity: !this.state.filterOptions.popularity
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.popularity ? this.goodsSearch({ order: "g.browse_times desc", }) : this.goodsSearch({ order: "g.browse_times" })
|
||||
this.state.filterOptions.popularity ? this.goodsSearch({ currPage: 1, order: "g.browse_times desc", }) : this.goodsSearch({ currPage: 1, order: "g.browse_times" })
|
||||
|
||||
}
|
||||
)
|
||||
@ -464,7 +482,8 @@ class Shop extends Component {
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.setState({ mainType: newMainType, goodType: newGoodType, widthType: newWidthType, otherType: newOtherType }, () => {
|
||||
|
||||
this.setState({ mainType: newMainType, loadMorePageIndex:1,goodType: newGoodType, widthType: newWidthType, otherType: newOtherType }, () => {
|
||||
// console.log(this.state.mainType)
|
||||
})
|
||||
}
|
||||
@ -509,7 +528,7 @@ class Shop extends Component {
|
||||
config_id: 4,
|
||||
shop_class_id: '',
|
||||
order: '',
|
||||
currPage: 1,
|
||||
curr_page: 1,
|
||||
goods_class_id: '',
|
||||
goodsSpec: [],
|
||||
goodsParam: [],
|
||||
@ -533,9 +552,7 @@ class Shop extends Component {
|
||||
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
console.log('this.$router.params.id', this.$router.params.id)
|
||||
//页面加载之后 得到指定店铺的商品 和 筛选标签
|
||||
this.goodsSearch({ shop_id: this.$router.params.id }) // 加载店铺商品
|
||||
this.getSearchParams({})// 加载筛选项
|
||||
@ -553,15 +570,21 @@ class Shop extends Component {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
loadMorePageIndex += 1
|
||||
this.setState({ isAddToList: true }, () => {
|
||||
this.goodsSearch({ curr_page: loadMorePageIndex })
|
||||
|
||||
this.setState({ isAddToList: true,loadMorePageIndex:this.state.loadMorePageIndex }, () => {
|
||||
this.goodsSearch({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
render() {
|
||||
|
||||
const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => {
|
||||
return <View key={index} className='shop-item' >
|
||||
<ShopItem item={item}></ShopItem>
|
||||
@ -703,7 +726,7 @@ class Shop extends Component {
|
||||
<View className='description'>
|
||||
<Text className='title-sub'>店铺介绍:</Text>
|
||||
<Text className='detail'>{this.state.shopDescription}</Text>
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
@ -712,6 +735,20 @@ class Shop extends Component {
|
||||
<View className='img-box'> <Image mode='aspectFit' src={URL.Base + 'Public/images/shop/bg_banner.png'} style='max-width: 100%;max-height:100%;' /></View>
|
||||
<View className='img-box'> <Image mode='aspectFit' src={URL.Base + 'Public/images/shop/bg_banner.png'} style='max-width: 100%;max-height:100%;' /></View>
|
||||
</View>
|
||||
<Map
|
||||
id="map"
|
||||
longitude={this.state.longitude}
|
||||
latitude={this.state.latitude}
|
||||
scale="14"
|
||||
controls="{{controls}}"
|
||||
bindcontroltap="controltap"
|
||||
markers="{{markers}}"
|
||||
bindmarkertap="markertap"
|
||||
polyline="{{polyline}}"
|
||||
bindregionchange="regionchange"
|
||||
show-location
|
||||
style="width: 100%; height: 300px;"
|
||||
></Map>
|
||||
</View>
|
||||
|
||||
const shopAllCateElementArray = this.state.shopAllInnerCate.map((item, index) => {
|
||||
@ -749,8 +786,11 @@ class Shop extends Component {
|
||||
</View>
|
||||
{/* 显示店铺首页或者店铺详情 */}
|
||||
{this.state.showShopHomePage ? shopHomepageElement : shopDescriptionElement}
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
|
||||
<View className='gap' style='height:150rpx'>
|
||||
</View>
|
||||
<View className='bottom-nav-box'>
|
||||
<BottomNav otherData={{ menu: [{ name: '首页' }, { name: '分类' }, { name: '购物车' }, { name: '教程软件' }, { name: '更多' }] }} />
|
||||
</View>
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Button } from '@tarojs/components'
|
||||
import { View, Text, Button,Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
@ -30,26 +30,13 @@ class SupplyDemand extends Component {
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
isPublish: false,//是否点击发布按钮
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
}
|
||||
}
|
||||
|
||||
// 上传供求api
|
||||
uploadSupplyDemand() {
|
||||
console.log(this.state.ImagesInfo)
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
this.uploadDemSup({})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title:'请填写完表格',
|
||||
icon:'none',
|
||||
duration:1500
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 这个需要写一个uploadDemSup 上传供求 的api
|
||||
uploadDemSup({ sd_type = this.state.demandingSupplyCateSelected.id,
|
||||
sd_title = this.state.title,
|
||||
@ -92,17 +79,26 @@ class SupplyDemand extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
console.log('上传供求', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
})
|
||||
}, 1500);
|
||||
if (this.state.isPublish) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + res.data.sd_id
|
||||
})
|
||||
|
||||
} else if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandPublish/supplyDemandPublish'
|
||||
})
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
@ -126,6 +122,9 @@ class SupplyDemand extends Component {
|
||||
url: URL.UploadDSPorductImage,
|
||||
filePath: files[files.length - 1].url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
'key': 'michael',
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryAWxeadaAVmRVQCiz',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
@ -143,23 +142,23 @@ class SupplyDemand extends Component {
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (operationType === 'remove') {
|
||||
this.state.ImagesInfo.splice(index, 1) // 删除显示的图片
|
||||
this.state.pickerImageUrl.splice(index, 1)// 删除图片param
|
||||
that.setState({
|
||||
pockerImageUrl:this.state.pickerImageUrl,
|
||||
ImagesInfo:this.state.ImagesInfo,
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
that.setState({
|
||||
pockerImageUrl: this.state.pickerImageUrl,
|
||||
ImagesInfo: this.state.ImagesInfo,
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
// 修改供求类型
|
||||
demandingSupplyCate = e => {
|
||||
@ -189,6 +188,40 @@ class SupplyDemand extends Component {
|
||||
contentChange(event) {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
|
||||
// 上传供求api
|
||||
publishButtonHandler() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublish: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
publishAndNewButton() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
goToMyDemSupPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand'
|
||||
@ -197,7 +230,7 @@ class SupplyDemand extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
@ -210,11 +243,11 @@ class SupplyDemand extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<View className='supply-demand'>
|
||||
|
||||
|
||||
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
@ -249,17 +282,20 @@ class SupplyDemand extends Component {
|
||||
border={false}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onChange={this.contactNumberChange.bind(this)}
|
||||
border={false}
|
||||
/>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
@ -316,13 +352,12 @@ class SupplyDemand extends Component {
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.uploadSupplyDemand.bind(this)}>
|
||||
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange' >发布</Button>
|
||||
</View>
|
||||
{/* <View className='button'>
|
||||
|
||||
<Button size='mini' className='button-a' >发布并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||
<Button size='mini' className='button-green' >发布并新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyDemSupPage.bind(this)}>
|
||||
<Button size='mini' className='button-green' >我的供求</Button>
|
||||
</View>
|
||||
|
@ -26,18 +26,12 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 120px;
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
.at-button--primary{
|
||||
background-color:$themeColor,;
|
||||
border:1PX solid $themeColor,;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
}
|
||||
.button-orange,.button-green{
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ class SupplyDemandView extends Component {
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.goToSDPublishPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>
|
||||
<Button className='button-orange' size='mini'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
@ -231,13 +231,13 @@ class SupplyDemandView extends Component {
|
||||
修改</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMySDPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>
|
||||
<Button className='button-orange' size='mini'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的供求</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.deleteButton.bind(this)}>
|
||||
<Button className='button-dark-red' size='mini'>
|
||||
<AtIcon value='close' size='12' color='white'></AtIcon>
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
删除</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -19,25 +19,13 @@ $themeColor:#FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
margin: 40px 0 0;
|
||||
padding: 0 20px;
|
||||
|
||||
|
||||
.button{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
// margin:2%;
|
||||
// justify-content:center;
|
||||
|
||||
.at-button--primary{
|
||||
background-color:$themeColor;
|
||||
border:1PX solid $themeColor;
|
||||
}
|
||||
.button-g{
|
||||
background-color:#5cb85c;
|
||||
border:1PX solid #5cb85c;
|
||||
}
|
||||
.button-a{
|
||||
background-color:#d9534f;
|
||||
border:1PX solid #d9534f;
|
||||
.button-orange,.button-green,.button-dark-red{
|
||||
font-size: 27rpx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1422
src/todo list.txt
1422
src/todo list.txt
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user