支付宝-checker bug -图片上传bug-编辑-发布
This commit is contained in:
parent
0263f775a5
commit
fc44a8b828
@ -20,6 +20,7 @@ class App extends Component {
|
||||
config = {
|
||||
pages: [
|
||||
//'pages/index/index', // index页面
|
||||
|
||||
|
||||
'pages/home/home',//首页 ---------------------
|
||||
'pages/login/login',//登入页面 ---------------------
|
||||
|
@ -7,6 +7,7 @@ $linearGreen:linear-gradient(to right, #5cb85c, #5cb85c);;
|
||||
$linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
page{
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.input-index--at-input__title{
|
||||
|
@ -35,8 +35,8 @@ class recommondShop extends Component {
|
||||
isOpenConsult: false,
|
||||
consultTip: '',
|
||||
voucherResponseMsg: 'i am voucherResponseMsg',
|
||||
userName: getGlobalStorage('user_identity').username || '',
|
||||
userPhone: getGlobalStorage('user_identity').userphone || '',
|
||||
userName: '',
|
||||
userPhone: '',
|
||||
isCanConsult: true,
|
||||
isCanVoucher: true
|
||||
|
||||
@ -223,6 +223,10 @@ class recommondShop extends Component {
|
||||
//console.log(this.props, nextProps)
|
||||
}
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
userName: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').username : '',
|
||||
userPhone: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').userphone : '',
|
||||
})
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
@ -265,14 +269,14 @@ class recommondShop extends Component {
|
||||
<Text>联系人:</Text>
|
||||
</View>
|
||||
<View className='value'>
|
||||
<Input name='value'
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
placeholder='请输入联系人'
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
<Input name='value'
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
placeholder='请输入联系人'
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
@ -280,13 +284,13 @@ class recommondShop extends Component {
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View className='value'>
|
||||
<Input name='value'
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
placeholder='请输入联系电话'
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
<Input name='value'
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
placeholder='请输入联系电话'
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</AtModalContent>
|
||||
|
@ -148,6 +148,7 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
text-overflow: ellipsis;
|
||||
.details-text{
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
}
|
||||
|
178
src/component/pictureUploadComponent/pictureUploadComponent.js
Normal file
178
src/component/pictureUploadComponent/pictureUploadComponent.js
Normal file
@ -0,0 +1,178 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image, Button } from '@tarojs/components'
|
||||
import { AtIcon } from 'taro-ui'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
|
||||
import './pictureUploadComponent.scss'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class PictureUploadComponent extends Component {
|
||||
|
||||
|
||||
// maxLength={4}
|
||||
// isReceiveImageUrl={true}
|
||||
// url={URL.UploadDSPorductImage}
|
||||
// onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
// initialImageURL={this.state.initialImageURL}
|
||||
// initialImagesInfo={this.state.initialImagesInfo}
|
||||
static defaultProps = {
|
||||
url: '',
|
||||
maxLength: 100,
|
||||
isReceiveImageUrl: true,
|
||||
imageURLList: []
|
||||
};
|
||||
config = {
|
||||
navigationBarTitleText: 'pictureUploadComponent'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.state = {
|
||||
imageURL: [],
|
||||
imageDetails: [],
|
||||
onlyOnce: true,// initial props 只setstate一次
|
||||
}
|
||||
}
|
||||
uploadImage() {
|
||||
const that = this
|
||||
my.chooseImage({
|
||||
count: this.props.maxLength,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success(res) {
|
||||
// tempFilePath可以作为img标签的src属性显示图片
|
||||
// console.log('res.apFilePaths',res.apFilePaths)
|
||||
res.apFilePaths.forEach(item => {
|
||||
that.onChangeImg(item)
|
||||
});
|
||||
},
|
||||
fail(err) {
|
||||
Taro.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// 上传图片apo
|
||||
onChangeImg(files) {
|
||||
const that = this
|
||||
my.uploadFile({
|
||||
url: this.props.url,
|
||||
filePath: files,
|
||||
fileName: 'file',
|
||||
fileType: 'image',
|
||||
formData: {
|
||||
'key': 'michael',
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryAWxeadaAVmRVQCiz',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
const data = JSON.parse(response.data)
|
||||
|
||||
if (data.err_code === 0) {
|
||||
console.log('上传成功')
|
||||
const imagePath = URL.Base + data.file_path
|
||||
that.setState({ imageURL: [...that.state.imageURL, { url: imagePath }], imageDetails: [...that.state.imageDetails, data] }, () => {
|
||||
that.props.onGetImageDetails(that.state.imageDetails)
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
fail(err) {
|
||||
Taro.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
deleteButton(e) {
|
||||
const value = onClickValueService(e)
|
||||
this.state.imageURL.splice(value, 1)
|
||||
this.state.imageDetails.splice(value, 1)
|
||||
this.setState({
|
||||
imageURL: this.state.imageURL,
|
||||
imageDetails: this.state.imageDetails,
|
||||
}, () => {
|
||||
this.props.onGetImageDetails(this.state.imageDetails)
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// 第一次的props 要给state
|
||||
console.log('next props', nextProps)
|
||||
if (nextProps.isReceiveImageUrl) {
|
||||
if (this.state.onlyOnce) {
|
||||
console.log('onlyonce')
|
||||
this.setState({
|
||||
imageURL: nextProps.initialImageURL,
|
||||
imageDetails: nextProps.initialImagesInfo,
|
||||
onlyOnce: false
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
console.log('state', this.state)
|
||||
const { maxLength } = this.props
|
||||
const imageElementArray = this.state.imageURL.map((item, index) => {
|
||||
return <View key={index} className='image-wrapper'>
|
||||
<View className='delete' onClick={this.deleteButton.bind(this, index)}><AtIcon value='close' size='15' color='#FFFFFF'></AtIcon>
|
||||
</View>
|
||||
<Image className='goods-img'
|
||||
mode='aspectFit' style='max-height: 100%; max-width: 100%;'
|
||||
src={item.url}
|
||||
/>
|
||||
</View>
|
||||
})
|
||||
|
||||
return (
|
||||
|
||||
<View class='pictureUploadComponent' > {this.state.imageURL.length < maxLength ? <Button onClick={this.uploadImage.bind(this)}>上传图片</Button> : null} < View className='image-container' > {imageElementArray}</View></View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default PictureUploadComponent
|
||||
|
@ -0,0 +1,21 @@
|
||||
.image-container{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
.image-wrapper{
|
||||
box-sizing: border-box;
|
||||
width: 25%;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
.delete{
|
||||
position: absolute;
|
||||
top:10px;
|
||||
right: 10px;
|
||||
background-color: rgb(153, 153, 153);
|
||||
opacity: 0.8;
|
||||
padding: 5px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
@ -40,6 +40,8 @@
|
||||
margin:0 5%;
|
||||
.name{
|
||||
font-size: 30px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { Picker } from 'taro-ui'
|
||||
|
||||
import './shopTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { getGlobalStorage,setGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class ShopTypeInteractionComp extends Component {
|
||||
@ -48,7 +48,7 @@ class ShopTypeInteractionComp extends Component {
|
||||
}
|
||||
console.log('店铺分类目录', res)
|
||||
if(!getGlobalStorage('shopTypeObject')){
|
||||
Taro.setStorageSync('shopTypeObject',res.data.data)
|
||||
setGlobalStorage('shopTypeObject',res.data.data)
|
||||
}
|
||||
this.setState({
|
||||
interactionMultiArray: this.interactionData(res.data.data),
|
||||
|
@ -12,6 +12,7 @@ import URL from '../../serviceAPI.config'
|
||||
import './allDemanding.scss'
|
||||
import eyeIcon from '../../icons/eye.png'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
|
||||
@ -181,7 +182,7 @@ class AllDemanding extends Component {
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
searchHanlder() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
this.searchDemanding({})
|
||||
}
|
||||
//清空筛选项
|
||||
@ -217,9 +218,9 @@ class AllDemanding extends Component {
|
||||
}
|
||||
componentDidMount() {
|
||||
// 得到第一页需求数据
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
showLoading({ title: '加载中' })
|
||||
this.searchDemanding({})
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -240,7 +241,7 @@ class AllDemanding extends Component {
|
||||
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
|
@ -8,6 +8,8 @@ import LoginService from '../../util/LoginService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './goods.scss'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
|
||||
class Goods extends Component {
|
||||
|
||||
@ -31,13 +33,14 @@ class Goods extends Component {
|
||||
monthSold: '',//月销量
|
||||
totalSold: '',//总销量
|
||||
browsingCount: '',// 浏览数
|
||||
shopId: ''
|
||||
shopId: '',
|
||||
actived:0// 默认tab
|
||||
}
|
||||
}
|
||||
|
||||
// 商品详情api
|
||||
getGoodDescription() {
|
||||
|
||||
|
||||
Taro.request({
|
||||
url: URL.GetShopItemDetail,
|
||||
method: 'POST',
|
||||
@ -122,6 +125,12 @@ class Goods extends Component {
|
||||
})
|
||||
|
||||
}
|
||||
clickTabHandler(e){
|
||||
let value=onClickValueService(e)
|
||||
this.setState({
|
||||
actived:value
|
||||
})
|
||||
}
|
||||
// 数量或者规格方法
|
||||
onChange = e => {
|
||||
this.setState({
|
||||
@ -130,9 +139,9 @@ class Goods extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
})
|
||||
this.getGoodDescription()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -146,7 +155,13 @@ class Goods extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
|
||||
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
|
||||
const tabArrayElement=mainTabList.map((item,index)=>{
|
||||
return <View className={this.state.actived===index?'tab actived':'tab'} key={index} onClick={this.clickTabHandler.bind(this,index)}>
|
||||
{item.title}
|
||||
</View>
|
||||
})
|
||||
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
|
||||
const itemPicsBannerElementArray = this.state.productImagesUrl.map((item, index) => {
|
||||
return <SwiperItem key={index} >
|
||||
@ -168,13 +183,13 @@ class Goods extends Component {
|
||||
<View className='img-box'>
|
||||
{/* <Image className='img' src={URL.Base + this.state.productImagesUrl}></Image> */}
|
||||
<Swiper
|
||||
className='swipper'
|
||||
style='height:100%;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
className='swipper'
|
||||
style='height:100%;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
>
|
||||
{itemPicsBannerElementArray}
|
||||
|
||||
@ -240,7 +255,12 @@ class Goods extends Component {
|
||||
</Picker>
|
||||
</View>
|
||||
{/* 详情和评论区 */}
|
||||
<View className='tabs'>
|
||||
{tabArrayElement}
|
||||
</View>
|
||||
<View className='details-box'>
|
||||
|
||||
|
||||
{/* 大类 */}
|
||||
<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} >
|
||||
@ -258,9 +278,9 @@ class Goods extends Component {
|
||||
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>
|
||||
{ /*子标签类*/}
|
||||
<AtSegmentedControl selectedColor='#FF9500'
|
||||
values={['全部', '好评', '中评', '差评', '公开', '匿名']}
|
||||
onClick={this.onClick.bind(this)}
|
||||
current={this.state.subCurrent}
|
||||
values={['全部', '好评', '中评', '差评', '公开', '匿名']}
|
||||
onClick={this.onClick.bind(this)}
|
||||
current={this.state.subCurrent}
|
||||
/>
|
||||
{
|
||||
this.state.subCurrent === 0
|
||||
@ -330,7 +350,7 @@ class Goods extends Component {
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -213,4 +213,20 @@ $themeColor:#FF7142;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.tabs{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
height: 80px;
|
||||
|
||||
border-bottom: 1px solid #d6e4ef;
|
||||
.tab{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
}
|
||||
.actived{
|
||||
color:#FF7142;
|
||||
border-bottom: 3px solid#FF7142
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
|
||||
|
||||
|
||||
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
||||
@ -14,6 +15,8 @@ import URL from '../../serviceAPI.config'
|
||||
import './goodsPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserShopOwner } from '../../util/checkLogin';
|
||||
|
||||
class GoodsPublish extends Component {
|
||||
|
||||
@ -205,7 +208,12 @@ class GoodsPublish extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
publishButtonHandler() {
|
||||
|
||||
if (this.state.productName &&
|
||||
@ -214,22 +222,22 @@ class GoodsPublish extends Component {
|
||||
this.state.ImagesInfo.length &&
|
||||
this.state.goodsTypeSelected.id &&
|
||||
this.state.shopTypeSelected.id) {
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublish: 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,
|
||||
})
|
||||
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublish: 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' })
|
||||
}
|
||||
@ -242,22 +250,22 @@ class GoodsPublish extends Component {
|
||||
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,
|
||||
})
|
||||
|
||||
showLoading({ title: '发布中' })
|
||||
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' })
|
||||
}
|
||||
@ -298,12 +306,7 @@ class GoodsPublish extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
isUserShopOwner()
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -364,7 +367,9 @@ class GoodsPublish extends Component {
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>上传图片:</Text>
|
||||
</View>
|
||||
<View className='img-container'>
|
||||
<PictureUploadComponent maxLength={20} isReceiveImageUrl={false} url={URL.UploadGoodsPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
|
||||
|
||||
{/* <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
files={this.state.pickerImageUrl}
|
||||
@ -372,11 +377,11 @@ class GoodsPublish extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View> */}
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
></ShopTypeInteractionComp>
|
||||
|
@ -10,6 +10,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import './grabOrderPage.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
class GrabOrderPage extends Component {
|
||||
@ -153,16 +154,16 @@ class GrabOrderPage extends Component {
|
||||
handleGrabConfirm() {
|
||||
this.setState({ isOpen: false })
|
||||
// 确认抢单之后
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({
|
||||
title:'加载中'
|
||||
})
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.getGrabOrderInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -239,7 +240,7 @@ class GrabOrderPage extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const localStoageUserId = getGlobalStorage('userInfo').user_id
|
||||
const localStoageUserId = getGlobalStorage('userInfo')?getGlobalStorage('userInfo').user_id:''
|
||||
|
||||
// 提示框
|
||||
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
|
||||
|
@ -13,6 +13,8 @@ import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './home.scss'
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -35,8 +37,8 @@ class Home extends Component {
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: Taro.getStorageSync('user_identity').userName || '',//用户名字
|
||||
userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话
|
||||
userName: '',//用户名字
|
||||
userPhone: '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
@ -50,7 +52,7 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
// onPullDownRefresh() {
|
||||
// Taro.showLoading({ title: '加载中' })
|
||||
// showLoading({ title: '加载中' })
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
@ -150,7 +152,7 @@ class Home extends Component {
|
||||
my.getLocation({
|
||||
success(res) {
|
||||
my.hideLoading();
|
||||
|
||||
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
@ -159,31 +161,31 @@ class Home extends Component {
|
||||
reject(res)
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
|
||||
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -240,8 +242,8 @@ class Home extends Component {
|
||||
// 点击大类icon
|
||||
onClickParentCate(e) {
|
||||
const item = onClickValueService(e)
|
||||
|
||||
Taro.showLoading({
|
||||
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
@ -251,7 +253,7 @@ class Home extends Component {
|
||||
// 点击子类
|
||||
clickChildCateHanlder(e) {
|
||||
const item = onClickValueService(e)
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||
@ -299,8 +301,6 @@ class Home extends Component {
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
|
||||
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
@ -312,8 +312,7 @@ class Home extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getUserLocation().then(res => {
|
||||
this.setState({
|
||||
@ -329,10 +328,6 @@ class Home extends Component {
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
@ -363,7 +358,7 @@ class Home extends Component {
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||
@ -402,7 +397,7 @@ class Home extends Component {
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
className='home'
|
||||
@ -433,7 +428,7 @@ class Home extends Component {
|
||||
</Swiper>
|
||||
</View>
|
||||
{/* 第二行图片滚动条 */}
|
||||
|
||||
|
||||
<View className='second-banner'>
|
||||
<MainCateSlider onScrollFromChild={this.scrollToSubFromChild.bind(this)} firstSlideData={mainCate1} secondSlideData={mainCate2} />
|
||||
</View>
|
||||
|
@ -9,7 +9,14 @@ $themeColor: #FF7142;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.first-banner ,.third-banner{
|
||||
.first-banner {
|
||||
height:250px;
|
||||
.banner-img{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.third-banner{
|
||||
height:200px;
|
||||
.banner-img{
|
||||
height: 100%;
|
||||
|
@ -28,7 +28,6 @@ class MainCateSlider extends Component {
|
||||
item.value = item.class_name
|
||||
return item
|
||||
})
|
||||
console.log('formatedData', formatedData)
|
||||
return formatedData
|
||||
}
|
||||
render() {
|
||||
|
@ -9,6 +9,7 @@ import './individualCenter.scss'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { isUserLogin } from '../../util/checkLogin';
|
||||
|
||||
|
||||
|
||||
@ -52,12 +53,12 @@ class IndividualCenter extends Component {
|
||||
username: '',
|
||||
avatar: '',
|
||||
isShop: false,
|
||||
vip_level:''
|
||||
vip_level: ''
|
||||
}
|
||||
}
|
||||
handlerGridClick(e) {
|
||||
const value = onClickValueService(e).value
|
||||
|
||||
|
||||
switch (value) {
|
||||
case '需求发布':
|
||||
Taro.switchTab({
|
||||
@ -101,19 +102,25 @@ class IndividualCenter extends Component {
|
||||
// })
|
||||
}
|
||||
getInfoFromStorage() {
|
||||
const username = getGlobalStorage('userInfo').login_name||''
|
||||
const avatar = getGlobalStorage('userInfo').avatar||''
|
||||
const vip_level=getGlobalStorage('userInfo').vip_name||''
|
||||
const username = getGlobalStorage('userInfo').login_name || ''
|
||||
const avatar = getGlobalStorage('userInfo').avatar || ''
|
||||
const vip_level = getGlobalStorage('userInfo').vip_name || ''
|
||||
const isShop = getGlobalStorage('shopInfo').shop_id ? true : false
|
||||
this.setState({
|
||||
username, avatar, isShop,vip_level
|
||||
username, avatar, isShop, vip_level
|
||||
})
|
||||
}
|
||||
handleLogoutClick() {
|
||||
Logout()
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getInfoFromStorage()
|
||||
isUserLogin().then(res=>{
|
||||
return res
|
||||
}).then(res=>{
|
||||
this.getInfoFromStorage()
|
||||
})
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
@ -122,17 +129,13 @@ class IndividualCenter extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
console.log('login service')
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
isUserLogin()
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
const { client, seller, username, avatar,vip_level, isShop } = this.state
|
||||
const { client, seller, username, avatar, vip_level, isShop } = this.state
|
||||
return (
|
||||
<View className='individualCenter'>
|
||||
<View className='avatar'>
|
||||
@ -156,14 +159,14 @@ class IndividualCenter extends Component {
|
||||
<View className='title'>我的足迹</View> */}
|
||||
</View>
|
||||
<AtList>
|
||||
<AtListItem hasBorder={false} title='业主中心' onClick={this.handlerTitleBarClick.bind(this)} extraText=''/>
|
||||
<AtListItem hasBorder={false} title='业主中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='' />
|
||||
</AtList>
|
||||
<AtGrid hasBorder={false} data={client} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
|
||||
</View>
|
||||
|
||||
{isShop ? <View className='seller-container'>
|
||||
<AtList>
|
||||
<AtListItem hasBorder={false} title='店铺中心' onClick={this.handlerTitleBarClick.bind(this)} extraText=''/>
|
||||
<AtListItem hasBorder={false} title='店铺中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='' />
|
||||
</AtList>
|
||||
<AtGrid hasBorder={false} data={seller} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
|
||||
</View> : <View />}
|
||||
|
@ -2,7 +2,7 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
@ -10,6 +10,7 @@ import URL from '../../serviceAPI.config'
|
||||
import './myDemandSupplyEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
|
||||
@ -32,6 +33,8 @@ class MyDemandSupplyEdit extends Component {
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
initialImagesInfo: [],//初始化图片信息
|
||||
initialImageURL: [],//初始化图片url
|
||||
isFormCompleted: false,
|
||||
isConfirmWindow: false,// 删除提示框
|
||||
demandSupplyId: '',// 供求id
|
||||
@ -73,14 +76,16 @@ class MyDemandSupplyEdit extends Component {
|
||||
demandingSupplyStateSelected: selectedState,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
initialImageURL: imageFile,
|
||||
initialImagesInfo: res.data.sdInfo.file_path,
|
||||
})
|
||||
|
||||
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
}else{
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title:res.data.err_msg,
|
||||
icon:'none'
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -149,7 +154,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
} else {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
@ -212,6 +217,13 @@ class MyDemandSupplyEdit extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 删除我的供求api
|
||||
onDelete({ sdID = 0 }) {
|
||||
Taro.request({
|
||||
@ -283,10 +295,9 @@ class MyDemandSupplyEdit extends Component {
|
||||
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({ isSaveAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
|
||||
} else {
|
||||
@ -301,11 +312,11 @@ class MyDemandSupplyEdit extends Component {
|
||||
// 上传供求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({})
|
||||
})
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -317,7 +328,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
goToMyDemSupPage() {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
})
|
||||
}
|
||||
deleteButtonHandler() {
|
||||
this.setState({ isConfirmWindow: true })
|
||||
@ -336,7 +347,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
// console.log('this.$router.params.sdId',this.$router.params.sdId)
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
this.getSupplyDemandInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -438,8 +449,15 @@ class MyDemandSupplyEdit extends Component {
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
|
||||
<View className='img-container'>
|
||||
<PictureUploadComponent
|
||||
maxLength={4}
|
||||
isReceiveImageUrl={true}
|
||||
initialImageURL={this.state.initialImageURL}
|
||||
initialImagesInfo={this.state.initialImagesInfo}
|
||||
url={URL.UploadDSPorductImage}
|
||||
onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
/>
|
||||
{/* <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
@ -448,7 +466,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View> */}
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Radio, Button, MovableArea, MovableView } from '@tarojs/components'
|
||||
import { View, Button, MovableArea, MovableView, CheckboxGroup, Checkbox } 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'
|
||||
@ -494,11 +494,14 @@ class MyGoodList extends Component {
|
||||
// 单个商品选择
|
||||
handleCheckChange(e) {
|
||||
//如果goodid 一样的那么checked 就取反
|
||||
console.log('clicke')
|
||||
const id = onClickValueService(e)
|
||||
// const id = onClickValueService(e)
|
||||
const id = e.detail.value
|
||||
|
||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||
if (item.goods_id === id) {
|
||||
item['checked'] = !item.checked
|
||||
if (id.includes(item.goods_id)) {
|
||||
item['checked'] = true
|
||||
} else {
|
||||
item['checked'] = false
|
||||
}
|
||||
return item
|
||||
})
|
||||
@ -518,9 +521,6 @@ class MyGoodList extends Component {
|
||||
duration: 1500
|
||||
})
|
||||
// // this.deleteGood({ goodsID: checkedGoodsId })
|
||||
|
||||
|
||||
|
||||
}
|
||||
// 改变商品状态
|
||||
offStockGoodHandler() {
|
||||
@ -539,9 +539,9 @@ class MyGoodList extends Component {
|
||||
}
|
||||
// 导航到商品编辑页面myGoodsEdit
|
||||
goToGoodEditPage(e) {
|
||||
console.log('e',e)
|
||||
console.log('e', e)
|
||||
const goodId = onClickValueService(e)
|
||||
console.log('goodId',goodId)
|
||||
console.log('goodId', goodId)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
|
||||
})
|
||||
@ -662,7 +662,7 @@ class MyGoodList extends Component {
|
||||
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>
|
||||
<Checkbox className='radio' value={item.goods_id} checked={item.checked} ></Checkbox >
|
||||
<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 className='img' style='height:100%;width:100%' src={URL.Base + item.goods_url} />
|
||||
@ -818,19 +818,23 @@ class MyGoodList extends Component {
|
||||
|
||||
</View>
|
||||
<View className='sub-filter'>
|
||||
<Radio className='radio' checked={this.state.isCheckAll} onClick={this.checkAllHandler.bind(this)}>全选</Radio>
|
||||
<View className='button' onClick={this.deleteGoodsHandler.bind(this)}>
|
||||
<CheckboxGroup className='align-item' onChange={this.checkAllHandler.bind(this)}>
|
||||
<Checkbox className='radio' checked={this.state.isCheckAll} >全选</Checkbox>
|
||||
</CheckboxGroup>
|
||||
<View className='button align-item' onClick={this.deleteGoodsHandler.bind(this)}>
|
||||
<Button size='mini' className='button-dark-red'>
|
||||
删除</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.offStockGoodHandler.bind(this)}>
|
||||
<View className='button align-item' onClick={this.offStockGoodHandler.bind(this)}>
|
||||
<Button size='mini' className='button-blue'>
|
||||
下架</Button>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
{this.state.myGoodList.length ? <View className='mygoodlist-container'>
|
||||
{goodListElementArray}
|
||||
<CheckboxGroup onChange={this.handleCheckChange.bind(this)}>
|
||||
{goodListElementArray}
|
||||
</CheckboxGroup>
|
||||
</View > : <View className='no-more-title'> 没有更多了</View>}
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
|
@ -17,6 +17,10 @@ $themeColor:#FF7142;
|
||||
opacity:1 ;
|
||||
position:fixed;
|
||||
}
|
||||
.align-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.MyGoodList{
|
||||
padding: 10px 20px;
|
||||
.filterbar-container{
|
||||
|
@ -4,11 +4,13 @@ import { AtInput, AtImagePicker, AtTextarea, Button, } from 'taro-ui'
|
||||
|
||||
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myGoodsEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
class MyGoodsEdit extends Component {
|
||||
config = {
|
||||
@ -24,6 +26,8 @@ class MyGoodsEdit extends Component {
|
||||
productDescript: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
initialImagesInfo: [],//初始化图片信息
|
||||
initialImageURL: [],//初始化图片url
|
||||
goodsTypeParam: '',//商品分类参数
|
||||
goodId: '',//商品id
|
||||
isSaveButton: false,//是否点击了保存按钮
|
||||
@ -48,25 +52,27 @@ class MyGoodsEdit extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
Taro.hideLoading()
|
||||
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品详情获取成功', res)
|
||||
|
||||
const imageFile = res.data.goodsFiles.map((item) => {
|
||||
return { url: URL.Base + item.files.file_path }
|
||||
})
|
||||
// let shopTypeSelected
|
||||
let shopTypeSelected
|
||||
|
||||
// const shopTypeId = res.data.goods.shop_class_id
|
||||
// for (let key in this.state.shopTypeList) {
|
||||
// for (let item of this.state.shopTypeList[key].c) {
|
||||
// if (item.id === shopTypeId) {
|
||||
// shopTypeSelected = { name: item.n, id: item.id }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
const shopTypeId = res.data.goods.shop_class_id
|
||||
for (let key in this.state.shopTypeList) {
|
||||
for (let item of this.state.shopTypeList[key].c) {
|
||||
if (item.id === shopTypeId) {
|
||||
shopTypeSelected = { name: item.n, id: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getGlobalStorage('shopTypeObject')) {
|
||||
let selectedValue = ''
|
||||
const shopTypeObject = getGlobalStorage('shopTypeObject')
|
||||
console.log('shopTypeObject',shopTypeObject)
|
||||
for (let key in shopTypeObject) {
|
||||
for (let item of shopTypeObject[key].c) {
|
||||
if (item.id === res.data.goods.shop_class_id) {
|
||||
@ -81,12 +87,14 @@ class MyGoodsEdit extends Component {
|
||||
productDescript: res.data.goods.goods_profiles,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.goodsFiles,
|
||||
shopTypeSelected: selectedValue,
|
||||
initialImageURL: imageFile,
|
||||
initialImagesInfo: res.data.goodsFiles,
|
||||
shopTypeSelected: selectedValue,
|
||||
goodsTypeParam: res.data.goods.class_id,
|
||||
goodId: res.data.goods.goods_id,
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (res.data.err_code === 88888) {
|
||||
console.log('88888')
|
||||
@ -173,14 +181,14 @@ class MyGoodsEdit extends Component {
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSaveButton) {
|
||||
// Taro.navigateBack({
|
||||
// Taro.navigateBack({
|
||||
|
||||
// delta:1
|
||||
// url: '/pages/myGoodsList/myGoodsEdit?id=' + this.$router.params.id
|
||||
// })
|
||||
Taro.redirectTo({
|
||||
url: '/pages/myGoodList/myGoodList'
|
||||
})
|
||||
// delta:1
|
||||
// url: '/pages/myGoodsList/myGoodsEdit?id=' + this.$router.params.id
|
||||
// })
|
||||
Taro.redirectTo({
|
||||
url: '/pages/myGoodList/myGoodList'
|
||||
})
|
||||
} else if (this.state.isSaveAndNewBUtton) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
@ -286,6 +294,12 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
}
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
shopCategoryChanged(e) {
|
||||
this.setState({
|
||||
shopCategoryCheckedPicker: this.state.shopCategoryList[e.detail.value]
|
||||
@ -296,20 +310,20 @@ class MyGoodsEdit extends Component {
|
||||
// 保存按钮
|
||||
saveButtonHandler() {
|
||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopTypeSelected.id) {
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveButton: 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,
|
||||
})
|
||||
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveButton: 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: '请填写完表格',
|
||||
@ -322,21 +336,21 @@ class MyGoodsEdit extends Component {
|
||||
// 保存并新增按钮
|
||||
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,
|
||||
})
|
||||
|
||||
showLoading({ title: '保存中' })
|
||||
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: '请填写完表格',
|
||||
@ -365,8 +379,8 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({
|
||||
title:'加载中'
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.getGoodsInfo()
|
||||
|
||||
@ -429,7 +443,15 @@ class MyGoodsEdit extends Component {
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>上传图片:</Text>
|
||||
</View>
|
||||
<View className='img-container'>
|
||||
<PictureUploadComponent
|
||||
maxLength={20}
|
||||
isReceiveImageUrl={true}
|
||||
initialImageURL={this.state.initialImageURL}
|
||||
initialImagesInfo={this.state.initialImagesInfo}
|
||||
url={ URL.UploadGoodsPorductImage}
|
||||
onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
/>
|
||||
{/* <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
files={this.state.pickerImageUrl}
|
||||
@ -437,11 +459,11 @@ class MyGoodsEdit extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View> */}
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
shopId={getGlobalStorage('shopInfo')?getGlobalStorage('shopInfo').shop_id:''}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
|
||||
@ -460,7 +482,6 @@ class MyGoodsEdit extends Component {
|
||||
maxlength='140'
|
||||
placeholder='你的产品简介'
|
||||
/>
|
||||
|
||||
</View>
|
||||
<View className='button-box' >
|
||||
<View className='button' >
|
||||
|
@ -12,6 +12,8 @@ import './myNeeds.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserLogin } from '../../util/checkLogin';
|
||||
|
||||
class MyNeeds extends Component {
|
||||
|
||||
@ -185,7 +187,7 @@ class MyNeeds extends Component {
|
||||
|
||||
// 搜索按钮
|
||||
onSearchButtonHandler() {
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
showLoading({ title: '加载中' }).then(() => {
|
||||
this.setState({ currentPage: 1, loadMorePageIndex: 1 }, () => {
|
||||
this.getMyNeedsList({
|
||||
curr_page: this.state.currentPage,
|
||||
@ -283,10 +285,15 @@ class MyNeeds extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({
|
||||
isUserLogin().then(res=>{
|
||||
return res
|
||||
}).then(res=>{
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.getMyNeedsList({})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -296,10 +303,7 @@ class MyNeeds extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
isUserLogin()
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -314,7 +318,7 @@ class MyNeeds extends Component {
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
|
@ -1,14 +1,16 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import { AtInput, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myNeedsEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
class MyNeedsEdit extends Component {
|
||||
|
||||
@ -34,9 +36,10 @@ class MyNeedsEdit extends Component {
|
||||
contactAddress: '',
|
||||
content: '',//描述
|
||||
pickerImageUrl: [],
|
||||
ImagesInfo: '',
|
||||
ImagesInfo: [],// 图片详细信息
|
||||
initialImagesInfo: [],//初始化图片信息
|
||||
initialImageURL: [],//初始化图片url
|
||||
isDeleteModal: false,// 删除提示框
|
||||
|
||||
isSaveAndNew: false,//是否点击保存新增按钮
|
||||
|
||||
|
||||
@ -62,7 +65,7 @@ class MyNeedsEdit 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]
|
||||
if (res.data.err_code === 0) {
|
||||
|
||||
|
||||
let industryType = {}
|
||||
const classId = res.data.sdInfo.class_id
|
||||
for (let outter of res.data.supplyTree) {
|
||||
@ -102,13 +105,15 @@ class MyNeedsEdit extends Component {
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
pickerImageUrl: imageFile,
|
||||
initialImageURL: imageFile,
|
||||
initialImagesInfo: res.data.sdInfo.file_path,
|
||||
ImageURL: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
})
|
||||
|
||||
}else if (JSON.parse(res.data).err_code === 88888) {
|
||||
|
||||
} else if (JSON.parse(res.data).err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: JSON.parse(res.data).err_msg,
|
||||
icon: 'none'
|
||||
@ -119,8 +124,6 @@ class MyNeedsEdit extends Component {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// uploadMyNeedsApi 上传需求 的api
|
||||
uploadMyNeedsApi() {
|
||||
|
||||
@ -185,9 +188,9 @@ class MyNeedsEdit extends Component {
|
||||
}
|
||||
}, 1500);
|
||||
})
|
||||
}else if (res.data.err_code === 88888) {
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
@ -199,51 +202,6 @@ class MyNeedsEdit extends Component {
|
||||
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
onChangeImg(files, operationType, index) {
|
||||
const that = this
|
||||
if (operationType === 'add') {
|
||||
Taro.uploadFile({
|
||||
url: URL.UploadDSPorductImage,
|
||||
filePath: files[files.length - 1].url,
|
||||
name: 'file',
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
const data = JSON.parse(response.data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
that.setState({
|
||||
pickerImageUrl: newPickerImageUrl,
|
||||
ImagesInfo: newImageInfo
|
||||
})
|
||||
Taro.showToast({
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//删除我的需求 api DeleteMyNeeds
|
||||
deleteMyNeeds({ demandId = 10 }) {
|
||||
Taro.request({
|
||||
@ -274,9 +232,9 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
|
||||
}, 1000);
|
||||
}else if (res.data.err_code === 88888) {
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@ -319,14 +277,14 @@ 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({
|
||||
showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
@ -340,13 +298,19 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 保存新增按钮
|
||||
saveAndNewButton() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
@ -486,17 +450,14 @@ class MyNeedsEdit extends Component {
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
files={this.state.pickerImageUrl}
|
||||
onChange={this.onChangeImg.bind(this)}
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<PictureUploadComponent
|
||||
maxLength={4}
|
||||
isReceiveImageUrl={true}
|
||||
initialImageURL={this.state.initialImageURL}
|
||||
initialImagesInfo={this.state.initialImagesInfo}
|
||||
url={URL.UploadDSPorductImage}
|
||||
onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
/>
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
@ -1,17 +1,20 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
import { View, Text, Button, Input, } from '@tarojs/components'
|
||||
import { AtInput, AtTextarea, Picker } from 'taro-ui'
|
||||
|
||||
|
||||
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
|
||||
|
||||
import './myNeedsPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import {isUserLogin} from '../../util/checkLogin';
|
||||
|
||||
|
||||
|
||||
@ -29,14 +32,14 @@ class MyNeedsPublish extends Component {
|
||||
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
title: '',
|
||||
contactName: getGlobalStorage('user_identity').username || '',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone || '',
|
||||
contactName: '',
|
||||
contactNumber: '',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +75,6 @@ class MyNeedsPublish extends Component {
|
||||
sd_desc: this.state.content,
|
||||
state: this.state.needsStateSelected.id,
|
||||
file_path: file_path,
|
||||
|
||||
})
|
||||
},
|
||||
header: {
|
||||
@ -82,36 +84,34 @@ class MyNeedsPublish extends Component {
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log('上传需求', response)
|
||||
|
||||
const res = JSON.parse(response.data)
|
||||
console.log('jonson parse', res)
|
||||
console.log('上传需求成功', response)
|
||||
const res = response.data
|
||||
Taro.hideLoading()
|
||||
if (res.err_code === 0) {
|
||||
console.log('error code 0')
|
||||
Taro.showToast({
|
||||
title: '发布成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.sd_id
|
||||
})
|
||||
}
|
||||
}, 1500);
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('settimeout')
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.sd_id
|
||||
})
|
||||
}
|
||||
}, 1500);
|
||||
} else if (res.err_code === 88888) {
|
||||
|
||||
console.log('返回错误88888')
|
||||
const resp = { data: { err_msg: res.err_msg } }
|
||||
console.log('resp',resp)
|
||||
loginExpired(resp)
|
||||
} else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.err_msg,
|
||||
icon: 'none',
|
||||
@ -121,12 +121,12 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
onChangeImg(files, operationType, index) {
|
||||
const that = this
|
||||
|
||||
if (operationType === 'add') {
|
||||
Taro.uploadFile({
|
||||
url: URL.MyNeedUploadImage,
|
||||
@ -199,6 +199,13 @@ class MyNeedsPublish extends Component {
|
||||
}
|
||||
contentChange(event) {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 发布按钮
|
||||
publishButtonHandler() {
|
||||
@ -207,7 +214,7 @@ class MyNeedsPublish extends Component {
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
@ -231,7 +238,7 @@ class MyNeedsPublish extends Component {
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
@ -259,6 +266,10 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
contactName: getGlobalStorage('user_identity')?getGlobalStorage('user_identity').username : '',
|
||||
contactNumber: getGlobalStorage('user_identity')?getGlobalStorage('user_identity').userphone : '',
|
||||
})
|
||||
// console.log('this.$router.params.sdId',this.$router.params.sdId)
|
||||
// Taro.showLoading({title:'加载中'})
|
||||
// this.getSupplyDemandInfo()
|
||||
@ -274,11 +285,8 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
componentDidShow() {
|
||||
isUserLogin()
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -365,13 +373,18 @@ class MyNeedsPublish extends Component {
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
<PictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
|
||||
|
||||
<View className='img-container'>
|
||||
{/* 微信使用 */}
|
||||
{/* <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
@ -380,7 +393,7 @@ class MyNeedsPublish extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View> */}
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
@ -76,4 +76,4 @@ $themeColor:#FF7142;
|
||||
.title-box{
|
||||
line-height:100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import './myNeedsView.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
|
||||
@ -194,7 +195,7 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
this.getSingleMyNeedInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
@ -12,6 +12,8 @@ import loginExpired from '../../util/loginExpired'
|
||||
import './mySupplyDemand.scss'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserShopOwner } from '../../util/checkLogin';
|
||||
|
||||
|
||||
class MySupplyDemand extends Component {
|
||||
@ -116,7 +118,7 @@ class MySupplyDemand extends Component {
|
||||
|
||||
onSearchButtonHandler() {
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
|
||||
this.setState({ loadMorePageIndex: 1 }, () => {
|
||||
this.getMySupplyDemand({ curr_page: this.state.loadMorePageIndex })
|
||||
@ -227,7 +229,7 @@ class MySupplyDemand extends Component {
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isConfirmWindow: false })
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.onDelete({ sdID: this.state.demandSupplyId })
|
||||
@ -286,23 +288,14 @@ class MySupplyDemand extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.getUserSystemInfo()
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
this.getMySupplyDemand({})
|
||||
})
|
||||
showLoading({ title: '加载中' })
|
||||
this.getMySupplyDemand({})
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
isUserShopOwner()
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -316,7 +309,7 @@ class MySupplyDemand extends Component {
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
|
@ -13,6 +13,7 @@ import ShopItem from '../../component/shopItemComponent/shopItemComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
const locationIcon = require('../../assets/img/location.png')
|
||||
|
||||
@ -355,7 +356,7 @@ class Shop extends Component {
|
||||
// 产品排序
|
||||
accendingDescending(e) {
|
||||
const value = onClickValueService(e)
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
this.setState({ selectedFilterValue: value })
|
||||
if (value == 0) {
|
||||
this.setState({
|
||||
@ -456,7 +457,7 @@ class Shop extends Component {
|
||||
// 选择侧边筛选的标签
|
||||
selectTag(name) {
|
||||
const id = name.name
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
// 处理分类筛选项
|
||||
const newMainType = this.state.mainType.map((item) => {
|
||||
if (item.id === id) {
|
||||
@ -523,7 +524,7 @@ class Shop extends Component {
|
||||
}
|
||||
|
||||
handleOnPageChange(value) {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
this.goodsSearch({ curr_page: value.current, order: this.state.filterCondition })
|
||||
}
|
||||
showHomePage() {
|
||||
@ -541,7 +542,7 @@ class Shop extends Component {
|
||||
//重置按键筛选
|
||||
resetFilterList() {
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
this.setState({
|
||||
checkedFilterIdList: [],
|
||||
curr_page: 1,
|
||||
@ -573,7 +574,7 @@ class Shop extends Component {
|
||||
})
|
||||
}
|
||||
componentDidMount() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
//页面加载之后 得到指定店铺的商品 和 筛选标签
|
||||
this.goodsSearch({}) // 加载店铺商品
|
||||
this.getSearchParams({})// 加载筛选项
|
||||
@ -586,7 +587,7 @@ class Shop extends Component {
|
||||
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
|
@ -4,12 +4,15 @@ import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
|
||||
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './supplyDemandPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserShopOwner } from '../../util/checkLogin';
|
||||
|
||||
class SupplyDemand extends Component {
|
||||
config = {
|
||||
@ -23,8 +26,8 @@ class SupplyDemand extends Component {
|
||||
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
|
||||
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
|
||||
title: '',
|
||||
contactName: getGlobalStorage('user_identity').username||'',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone||'',
|
||||
contactName:'',
|
||||
contactNumber: '',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
@ -165,6 +168,12 @@ class SupplyDemand extends Component {
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 修改供求类型
|
||||
demandingSupplyCate = e => {
|
||||
@ -203,11 +212,11 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
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: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -223,11 +232,11 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
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({})
|
||||
})
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -250,7 +259,10 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
this.setState({
|
||||
contactName: getGlobalStorage('user_identity').username || '',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone || '',
|
||||
})
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// console.log(this.props, nextProps)
|
||||
@ -259,16 +271,7 @@ class SupplyDemand extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
isUserShopOwner()
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -353,8 +356,9 @@ class SupplyDemand extends Component {
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
<PictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
|
||||
|
||||
<View className='img-container'>
|
||||
{/* <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
@ -363,7 +367,7 @@ class SupplyDemand extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View> */}
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
@ -10,6 +10,7 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import './supplyDemandView.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
|
||||
@ -64,15 +65,15 @@ class SupplyDemandView extends Component {
|
||||
images: res.data.sdInfo.file_path,
|
||||
itemId: res.data.sdInfo.sd_id
|
||||
})
|
||||
|
||||
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
}else{
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title:res.data.err_msg,
|
||||
icon:'none'
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
@ -120,7 +121,7 @@ class SupplyDemandView extends Component {
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
goToSDPublishPage() {
|
||||
Taro.redirectTo({
|
||||
@ -153,15 +154,15 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
Taro.showLoading({
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.onDelete({ sdID: this.state.itemId })
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
showLoading({ title: '加载中' })
|
||||
|
||||
this.getSupplyDemandInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
const LOCALURL = "http://192.168.1.230/"
|
||||
// const LOCALURL = "https://www.ihome6.com/"
|
||||
//const LOCALURL = "https://www.ihome6.com/"
|
||||
|
||||
const URL = {
|
||||
Base: LOCALURL,
|
||||
|
@ -1,588 +0,0 @@
|
||||
todo list:
|
||||
首页:
|
||||
商品发布页面:
|
||||
|
||||
供求发布页面
|
||||
全部业主需求页面:
|
||||
我的供求页面:
|
||||
我的商品列表页面
|
||||
商品编辑页面
|
||||
|
||||
我的需求列表页面:
|
||||
接口问题:
|
||||
优惠卷和询价
|
||||
bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
|
||||
|
||||
|
||||
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import MainCateSlider from './mainCateSlider/mainCateSlider'
|
||||
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './home.scss'
|
||||
|
||||
|
||||
|
||||
|
||||
class Home extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: '首页',
|
||||
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
shops: [], // 推荐店铺的信息
|
||||
ads: [], //广告图片数组
|
||||
categories: [],// 大类
|
||||
subCate: [], //小类
|
||||
demanding: [],// 业主需求
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: getGlobalStorage('user_identity').userName || '',//用户名字
|
||||
userPhone: getGlobalStorage('user_identity').userPhone || '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
parentClass: '',// 大类的id
|
||||
childClass: '-1',//小类的id
|
||||
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// onPullDownRefresh() {
|
||||
// Taro.showLoading({ title: '加载中' })
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
// this.getHomeCategoriesInfo()
|
||||
// }).catch(err => console.log('微信登入失败:', err))
|
||||
|
||||
// Taro.stopPullDownRefresh()
|
||||
// }
|
||||
|
||||
|
||||
//api得到首页的信息
|
||||
getHomeCategoriesInfo() {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
// 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('首页基本信息', res)
|
||||
if (res.data.err_msg === 'success') {
|
||||
|
||||
this.setState({
|
||||
ads: res.data.data.adsLb,
|
||||
categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])],
|
||||
demanding: res.data.data.demand.supplys,
|
||||
otherData: res.data.otherData,
|
||||
userName: res.data.otherData.userName,
|
||||
userPhone: res.data.otherData.userPhone,
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// api 得到推荐商店的信息
|
||||
getShops({ parent_supply_class = this.state.parentClass, supply_class = this.state.childClass, supply_level = this.state.supplyLevel, curr_page = 1,
|
||||
page_count = 5, action = "2" }) {
|
||||
Taro.request({
|
||||
url: URL.ShopSupplyShops,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
parent_supply_class: parent_supply_class, //父级class id
|
||||
supply_class: supply_class,// 子级class id
|
||||
supply_level: supply_level,// 层级
|
||||
action: action,
|
||||
latitude: this.state.latitude,
|
||||
longitude: this.state.longitude,
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('所有店铺的信息', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_code === 0) {
|
||||
if (this.state.isAddToList) {
|
||||
if (res.data.shops) {
|
||||
this.setState({ shops: this.state.shops.concat(res.data.shops), isAddToList: false })
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
} else {
|
||||
res.data.shops ? this.setState({ shops: res.data.shops }) : this.setState({ shops: [] })
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
this.setState({ isAddToList: false })
|
||||
}
|
||||
)
|
||||
}
|
||||
getUserLocation() {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 微信用户设置
|
||||
// wxUserSetting() {
|
||||
// Taro.getSetting({
|
||||
// success(res) {
|
||||
// if (res.authSetting['scope.userInfo']) {
|
||||
// console.log('personal info', res)
|
||||
// Taro.authorize({
|
||||
// scope: 'scope.userInfo',
|
||||
// success() {
|
||||
// // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
|
||||
// // Taro.getUserInfo({
|
||||
// // success(res1) {
|
||||
// // console.log('res1',res1)
|
||||
// // }
|
||||
// // })
|
||||
// console.log('权限允许')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// api 抢单请求
|
||||
GrabDemand({ demandId = 218 }) {
|
||||
Taro.request({
|
||||
url: URL.GrabDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
console.log('抢单请求:', res)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 点击大类icon
|
||||
onClickParentCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
this.getShops({})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 点击子类
|
||||
onClickChildCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||
this.getShops({})
|
||||
|
||||
})
|
||||
// this.getShops(item.parent_class_id, item.class_id, 2)
|
||||
|
||||
}
|
||||
scrollToSubCate(item) {
|
||||
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: 410,
|
||||
duration: 300
|
||||
})
|
||||
this.onClickParentCate(item)
|
||||
}
|
||||
// 转到其他页面
|
||||
goToAllDemandingPage() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: '/pages/allDemanding/allDemanding'
|
||||
})
|
||||
}
|
||||
|
||||
grabOrderId(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
this.setState({ isOpen: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabModalCancel() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
}
|
||||
this.setState({ isOpen: false })
|
||||
// 确认抢单之后
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(e) {
|
||||
const orderId = e.currentTarget.dataset.eTapAA
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish?id=1'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getUserLocation().then(res => {
|
||||
this.setState({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
}, () => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
}).catch(err => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
getGlobalStorage('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
|
||||
// 微信用户信息
|
||||
onGotUserInfo(e) {
|
||||
console.log(e.detail.errMsg)
|
||||
console.log(e.detail.userInfo)
|
||||
console.log(e.detail.rawData)
|
||||
}
|
||||
// 页面位置
|
||||
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: '加载中'
|
||||
})
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||
this.getShops({ curr_page: this.state.loadMorePageIndex, })
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认抢单?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
||||
|
||||
return <SwiperItem key={index} >
|
||||
<View className={this.state.demanding.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<View className='item-tag'>
|
||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||
</View>
|
||||
<View className='item-title'>
|
||||
{item.sd_title}
|
||||
</View>
|
||||
<View className='item-address'>
|
||||
{item.user_address || '--'}
|
||||
</View>
|
||||
<View className='item-name'>
|
||||
业主:{item.user_name}
|
||||
</View>
|
||||
</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
{/* <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
</SwiperItem >
|
||||
}) : null
|
||||
|
||||
const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
|
||||
return <SwiperItem key={index}>
|
||||
<Image className='banner-img' src={URL.Base + item.ads_pic} />
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
// 这里应该代码可以优化-----
|
||||
const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
|
||||
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
key={index}
|
||||
categoryLevel={this.state.supplyLevel}
|
||||
classId={this.state.parentClass === this.state.childClass ? this.state.parentClass : this.state.childClass}
|
||||
></FilteredShopComponent>
|
||||
}) : <View className='no-more-title top'> 没有更多了</View>
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
return (
|
||||
<View className='home'>
|
||||
|
||||
{/* 获取微信用户的信息 */}
|
||||
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||
|
||||
{modalMessageGrabElement}
|
||||
|
||||
<View className='first-banner'>
|
||||
<Swiper
|
||||
className='swipper'
|
||||
style='height:120px;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
{adsImgElementsArray}
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
{/* 第二行图片滚动条 */}
|
||||
{/* <View className='second-banner'>
|
||||
<Swiper
|
||||
style='height:100%;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
// autoplay
|
||||
>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray1}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray2}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
</Swiper>
|
||||
</View> */}
|
||||
<MainCateSlider/>
|
||||
{/* 第三行图片滚动条 */}
|
||||
<View className='third-banner'>
|
||||
<Swiper
|
||||
style='height:100px;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
<SwiperItem onClick={this.goToMyNeedsPublish.bind(this)}>
|
||||
<Image className='banner-img' src={URL.Base + 'Public/images/xgt.png'} />
|
||||
</SwiperItem>
|
||||
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
{/* 业主需求和行业推荐 */}
|
||||
<View className='container'>
|
||||
<View className='title'>
|
||||
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>业主需求</Text>
|
||||
|
||||
<Text className='more-link' onClick={this.goToAllDemandingPage.bind(this)}>
|
||||
更多>>
|
||||
</Text>
|
||||
</View>
|
||||
<View className='customer-demanding'>
|
||||
<Swiper
|
||||
style='height:180px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
|
||||
displayMultipleItems='2.5'
|
||||
>
|
||||
{demandingElemensArray}
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
<View className='second-banner-level2'>
|
||||
{this.state.subCate.length ? <Swiper
|
||||
style='height:35px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
displayMultipleItems={this.state.subCate.length > 4.5 ? 4.5 : this.state.subCate.length}
|
||||
>
|
||||
{subCateElementsArray}
|
||||
</Swiper> : null}
|
||||
</View>
|
||||
<View className='title'>
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>行业推荐</Text>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='shop-box'>
|
||||
{shopCollectionElementsArray}
|
||||
|
||||
|
||||
</View>
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
<View className='gap'>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
</View>
|
||||
<View className='bottom-nav-box'>
|
||||
{/* <BottomNav otherData={this.state.otherData} /> */}
|
||||
</View>
|
||||
{/* {this.state.isShopOwner ? <SellerTabBarComponent currentUrl={currentUrl} /> : <ClientTabBarComponent currentUrl={currentUrl} />} */}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
31
src/util/checkLogin.js
Normal file
31
src/util/checkLogin.js
Normal file
@ -0,0 +1,31 @@
|
||||
import { getGlobalStorage } from "./getSetStoage";
|
||||
import Taro from '@tarojs/taro'
|
||||
// check if user login
|
||||
|
||||
const isUserLogin = () => {
|
||||
return new Promise((resolve,reject)=>{
|
||||
let isLogin = getGlobalStorage('userInfo') ? true : false
|
||||
if (!isLogin) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
Taro.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
|
||||
}else{
|
||||
resolve('继续')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
const isUserShopOwner = () => {
|
||||
let isShopOwner = getGlobalStorage('shopInfo') ? true : false
|
||||
if (!isShopOwner) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
export { isUserLogin, isUserShopOwner }
|
@ -25,8 +25,12 @@ const getGlobalStorage = (key) => {
|
||||
let res = my.getStorageSync({
|
||||
key: key,
|
||||
})
|
||||
res.data=res.data?res.data:{username:'',userphone:'',user_id:''}
|
||||
return res.data ||res.APDataStorage
|
||||
if (res.data||res.APDataStorage) {
|
||||
return res.data||res.APDataStorage
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
export { setGlobalStorage, getGlobalStorage }
|
24
src/util/hideShowLoading.js
Normal file
24
src/util/hideShowLoading.js
Normal file
@ -0,0 +1,24 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
|
||||
|
||||
const showLoading = ({ title='加载中'}) => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
Taro.showLoading({
|
||||
title: title
|
||||
})
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
my.showLoading({
|
||||
content: title
|
||||
})
|
||||
}
|
||||
}
|
||||
const hideLoading = () => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
Taro.hideLoading()
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
my.hideLoading()
|
||||
}
|
||||
}
|
||||
export { showLoading, hideLoading }
|
873
todo list.json
Normal file
873
todo list.json
Normal file
@ -0,0 +1,873 @@
|
||||
todo list:
|
||||
首页:
|
||||
商品发布页面:
|
||||
|
||||
供求发布页面
|
||||
全部业主需求页面:
|
||||
我的供求页面:
|
||||
我的商品列表页面
|
||||
商品编辑页面
|
||||
|
||||
我的需求列表页面:
|
||||
接口问题:
|
||||
优惠卷和询价
|
||||
bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
|
||||
|
||||
|
||||
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Radio, Button, MovableArea, MovableView } 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'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
class MyGoodList extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '商品列表'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
productName: '',
|
||||
lowestPrice: '',
|
||||
heightestPrice: '',
|
||||
minimumSold: '',
|
||||
maximumSold: '',
|
||||
order: '',// 商品列表排序参数
|
||||
productId: '',// 商品编号参数
|
||||
productCate: [], //宝贝类目
|
||||
productCateSelected: { id: '', name: '全部类目' },// 已选宝贝类目
|
||||
filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项
|
||||
filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: false,
|
||||
filterSold: false,
|
||||
filterPublishDate: false,
|
||||
}, // 正反排序
|
||||
selectedFilterValue: 0, //
|
||||
myGoodList: [],// 保存后台返回的商品列表
|
||||
myGoodListTotal: '0',// 后台的商品总数
|
||||
goodsStateParam: 1,//商品状态参数
|
||||
pageCountParam: 20,// 商品数量参数
|
||||
currPageParam: 1,// 当前页面 参数
|
||||
isCheckAll: false,// 是否checked
|
||||
goodsIdList: [],//商品Id 列表
|
||||
isOpenDeleteModal: false,// 是否显示删除模态框
|
||||
isOpenOffStockModal: false,// 是否显示下架模态框
|
||||
isAddToList: false,// 是否下拉加载 如果是 就添加商品到我的商品列表
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
screenWidth: '',
|
||||
screenHeight: ''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
productNameChange(event) {
|
||||
this.setState({ productName: event })
|
||||
}
|
||||
productIdChange(event) {
|
||||
this.setState({ productId: event })
|
||||
}
|
||||
lowestPriceChange(event) {
|
||||
this.setState({ lowestPrice: event })
|
||||
}
|
||||
heightestPriceChange(event) {
|
||||
this.setState({ heightestPrice: event })
|
||||
}
|
||||
minimumSoldChange(event) {
|
||||
this.setState({ minimumSold: event })
|
||||
}
|
||||
maximumSoldChange(event) {
|
||||
this.setState({ maximumSold: event })
|
||||
}
|
||||
productCateChange = e => {
|
||||
this.setState({
|
||||
productCateSelected: this.state.productCate[e.detail.value]
|
||||
})
|
||||
}
|
||||
//获取宝贝类目搜索列表接口api
|
||||
getBaoBeiCateList() {
|
||||
Taro.request({
|
||||
url: URL.BaoBeiCateList,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('宝贝类目', res)
|
||||
if (res.data.err_code != 10) {
|
||||
const productCate = [{ name: '全部类目', id: '' }]
|
||||
for (let item of res.data.goodsClass) {
|
||||
productCate.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
this.setState({ productCate: productCate })
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取我的商品列表接口api
|
||||
getMyGoodListApi({
|
||||
goodsName = this.state.productName,
|
||||
goodsSn = this.state.productId,
|
||||
goodsClass = this.state.productCateSelected.id,
|
||||
goodsPriceL = this.state.lowestPrice,
|
||||
goodsPriceU = this.state.heightestPrice,
|
||||
goodsSalesL = this.state.minimumSold,
|
||||
goodsSalesU = this.state.maximumSold,
|
||||
goodsState = this.state.goodsStateParam,
|
||||
pageCount = this.state.pageCountParam,
|
||||
currPage = this.state.currPageParam,
|
||||
order = this.state.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,
|
||||
goodsState: goodsState,
|
||||
pageCount: pageCount,
|
||||
currPage: currPage,
|
||||
order: order
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.err_code === 88888) {
|
||||
loginExpired(data)
|
||||
} else if (data.err_code != 10) {
|
||||
console.log('我的商品列表', JSON.parse(res.data))
|
||||
|
||||
Taro.hideLoading()
|
||||
if (data.goodsCount != '0' && 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 {
|
||||
if (data.goods === null) {
|
||||
this.setState({
|
||||
myGoodList: [],
|
||||
myGoodListTotal: data.goodsCount
|
||||
})
|
||||
} else {
|
||||
this.setState({ isAddToList: false })
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
// 获取搜索结果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=' + getGlobalStorage('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 }) {
|
||||
Taro.request({
|
||||
url: URL.ChangeGoodState,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
|
||||
data: {
|
||||
goodsState: goodsState,
|
||||
goodsID: JSON.stringify(goodsID)
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
let responseData = JSON.parse(res.data)
|
||||
Taro.hideLoading()
|
||||
if (responseData.err_code === 0) {
|
||||
this.setState({
|
||||
isCheckAll: false,
|
||||
currPageParam: 1,
|
||||
|
||||
}, () => {
|
||||
this.getMyGoodListApi({})
|
||||
Taro.showToast({
|
||||
title: '下架成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
})
|
||||
} else if (responseData.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: responseData.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
this.setState({ isCheckAll: false })
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 商品列表删除api
|
||||
deleteGood({ goodsState = 1, goodsID = this.state.goodsIdList }) {
|
||||
Taro.request({
|
||||
url: URL.DeleteGood,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
|
||||
data: {
|
||||
goodsState: goodsState,
|
||||
goodsID: JSON.stringify(goodsID)
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
let responseData = JSON.parse(res.data)
|
||||
Taro.hideLoading()
|
||||
if (responseData.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
this.setState({ isCheckAll: false, currPageParam: 1 }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
|
||||
})
|
||||
} else if (responseData.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: responseData.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
this.setState({ isCheckAll: false })
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 搜索
|
||||
searchButtonHandler() {
|
||||
showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
this.setState({ currPageParam: 1, isCheckAll: false, order: '' }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 清空搜索
|
||||
emptyButtonHanlder() {
|
||||
this.setState({
|
||||
isCheckAll: false,
|
||||
currPageParam: 1,
|
||||
productName: '',
|
||||
lowestPrice: '',
|
||||
heightestPrice: '',
|
||||
minimumSold: '',
|
||||
maximumSold: '',
|
||||
productId: '',
|
||||
productCateSelected: { id: '', name: '全部类目' },
|
||||
order: '',
|
||||
}, () => {
|
||||
this.getMyGoodListApi({})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
// 产品排序
|
||||
accendingDescending(e) {
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
const value = onClickValueService(e)
|
||||
this.setState({ selectedFilterValue: value })
|
||||
if (value == 0) {
|
||||
this.setState({
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: !this.state.filterOptions.filterPrice,
|
||||
filterStock: false,
|
||||
filterSold: false,
|
||||
filterPublishDate: false,
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterPrice ? this.setState({ order: "goods_price" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
}) : this.setState({ order: "goods_price desc" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
if (value == 1) {
|
||||
this.setState({
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: !this.state.filterOptions.filterStock,
|
||||
filterSold: false,
|
||||
filterPublishDate: false,
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterStock ? this.setState({ order: "goods_stock" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
}) : this.setState({ order: "goods_stock desc" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
if (value == 2) {
|
||||
this.setState({
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: false,
|
||||
filterSold: !this.state.filterOptions.filterSold,
|
||||
filterPublishDate: false,
|
||||
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterSold ? this.setState({ order: "sales_volume " }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
}) : this.setState({ order: "sales_volume desc" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
if (value == 3) {
|
||||
this.setState({
|
||||
currPageParam: 1,
|
||||
filterOptions: {
|
||||
filterPrice: false,
|
||||
filterStock: false,
|
||||
filterSold: false,
|
||||
filterPublishDate: !this.state.filterOptions.filterPublishDate,
|
||||
|
||||
}
|
||||
}, () => {
|
||||
this.state.filterOptions.filterPublishDate ? this.setState({ order: "update_date desc" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
}) : this.setState({ order: "update_date" }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 商品全部选择
|
||||
checkAllHandler() {
|
||||
if (this.state.myGoodList.length) {
|
||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||
item.checked = !this.state.isCheckAll
|
||||
return item
|
||||
})
|
||||
this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList }, () => {
|
||||
console.log('全选列表', this.state.myGoodList)
|
||||
})
|
||||
}
|
||||
else {
|
||||
this.setState({
|
||||
isCheckAll: true
|
||||
}, () => {
|
||||
this.setState({ isCheckAll: false })
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '全选无效',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 单个商品选择
|
||||
handleCheckChange(e) {
|
||||
//如果goodid 一样的那么checked 就取反
|
||||
console.log('clicke')
|
||||
const id = onClickValueService(e)
|
||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||
if (item.goods_id === id) {
|
||||
item['checked'] = !item.checked
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.setState({ myGoodList: newMyGoodList })
|
||||
}
|
||||
// 删除商品
|
||||
deleteGoodsHandler() {
|
||||
const checkedGoodsId = []
|
||||
this.state.myGoodList.forEach(item => {
|
||||
if (item.checked) {
|
||||
checkedGoodsId.push(item.goods_id)
|
||||
}
|
||||
});
|
||||
checkedGoodsId.length ? this.setState({ isOpenDeleteModal: true }) : Taro.showToast({
|
||||
title: '请选择要删除的商品',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
// // this.deleteGood({ goodsID: checkedGoodsId })
|
||||
|
||||
|
||||
|
||||
}
|
||||
// 改变商品状态
|
||||
offStockGoodHandler() {
|
||||
const checkedGoodsId = []
|
||||
this.state.myGoodList.forEach(item => {
|
||||
if (item.checked) {
|
||||
checkedGoodsId.push(item.goods_id)
|
||||
}
|
||||
});
|
||||
//this.changeGoodState({ goodsID: checkedGoodsId })
|
||||
checkedGoodsId.length ? this.setState({ isOpenOffStockModal: true }) : Taro.showToast({
|
||||
title: '请选择要下架的商品',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
// 导航到商品编辑页面myGoodsEdit
|
||||
goToGoodEditPage(e) {
|
||||
console.log('e', e)
|
||||
const goodId = onClickValueService(e)
|
||||
console.log('goodId', goodId)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
|
||||
})
|
||||
}
|
||||
// 导航到商品发布页面
|
||||
|
||||
goToGoodsPublishPage() {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
})
|
||||
}
|
||||
goToGoodspage(e) {
|
||||
const goodId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + goodId
|
||||
})
|
||||
}
|
||||
|
||||
DeleteConfirm() {
|
||||
this.setState({
|
||||
isOpenDeleteModal: false
|
||||
})
|
||||
const checkedGoodsId = []
|
||||
this.state.myGoodList.forEach(item => {
|
||||
if (item.checked) {
|
||||
checkedGoodsId.push(item.goods_id)
|
||||
}
|
||||
});
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.deleteGood({ goodsID: checkedGoodsId })
|
||||
}
|
||||
deleteModalClose() {
|
||||
this.setState({
|
||||
isOpenDeleteModal: false
|
||||
})
|
||||
}
|
||||
OffStockConfirm() {
|
||||
|
||||
this.setState({
|
||||
isOpenOffStockModal: false
|
||||
})
|
||||
const checkedGoodsId = []
|
||||
this.state.myGoodList.forEach(item => {
|
||||
if (item.checked) {
|
||||
checkedGoodsId.push(item.goods_id)
|
||||
}
|
||||
});
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.changeGoodState({ goodsID: checkedGoodsId })
|
||||
}
|
||||
offStockModalClose() {
|
||||
this.setState({
|
||||
isOpenOffStockModal: false
|
||||
})
|
||||
}
|
||||
goToCenterPage() {
|
||||
Taro.switchTab({
|
||||
url: '/pages/individualCenter/individualCenter'
|
||||
})
|
||||
}
|
||||
getUserSystemInfo() {
|
||||
Taro.getSystemInfo().then(res => {
|
||||
return res
|
||||
}).then(res => {
|
||||
this.setState({
|
||||
screenWidth: res.screenWidth - 80 + 'px',
|
||||
screenHeight: res.screenHeight - 200 + 'px'
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getUserSystemInfo()
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.getMyGoodListApi({})
|
||||
this.getBaoBeiCateList()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
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() {
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ isAddToList: true, currPageParam: this.state.currPageParam + 1 }, () => {
|
||||
this.getMyGoodListApi({})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
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 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>
|
||||
<View className='quantity-box'>{item.sales_volume}</View>
|
||||
|
||||
</View>
|
||||
|
||||
<View className='button-box1' onClick={this.goToGoodEditPage.bind(this, item.goods_id)}>
|
||||
<Button className='button-orange' size='mini'>
|
||||
编辑商品</Button>
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
// 筛选项目排序element
|
||||
const filterElementsArray = this.state.filterBar.map((item, index) => {
|
||||
let isTure = this.state.filterOptions[item]
|
||||
|
||||
return <View key={index} onClick={this.accendingDescending.bind(this, index)} className={index === this.state.selectedFilterValue ? 'filter-title actived' : 'filter-title'}>
|
||||
<Text className='text-a'>
|
||||
{this.state.filterBarKeys[item]}
|
||||
</Text>
|
||||
{isTure ? <AtIcon value='chevron-down' size='10' color='#F00'></AtIcon> : <AtIcon value='chevron-up' size='10' color='#F00'></AtIcon>}
|
||||
</View>
|
||||
})
|
||||
// 删除提示模态弹窗element
|
||||
const modalMessageDeleteElement = <AtModal isOpened={this.state.isOpenDeleteModal}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确定要删除已选商品?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.deleteModalClose.bind(this)}>取消</Button> <Button className='orange' onClick={this.DeleteConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
// 下架提示模态弹窗element
|
||||
const modalMessageOffStockElement = <AtModal isOpened={this.state.isOpenOffStockModal}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确定要下架已选商品?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.offStockModalClose.bind(this)}>取消</Button> <Button className='orange' onClick={this.OffStockConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
return (
|
||||
<MovableArea style='height: 100vh; width: 100%; '>
|
||||
<View className='MyGoodList' >
|
||||
{/* 删除模态提示框 */}
|
||||
{modalMessageDeleteElement}
|
||||
{/* 下架模态框提示 */}
|
||||
{modalMessageOffStockElement}
|
||||
|
||||
<View className='border-box'>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='宝贝名称:'
|
||||
placeholder='宝贝名称'
|
||||
type='text'
|
||||
value={this.state.productName}
|
||||
onChange={this.productNameChange.bind(this)}
|
||||
border={false}
|
||||
/>
|
||||
</View>
|
||||
<View className='border-box'>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='最低价:'
|
||||
className='input'
|
||||
|
||||
type='number'
|
||||
value={this.state.lowestPrice}
|
||||
onChange={this.lowestPriceChange.bind(this)}
|
||||
border={false}
|
||||
/>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='最高价:'
|
||||
className='input'
|
||||
type='number'
|
||||
value={this.state.heightestPrice}
|
||||
border={false}
|
||||
onChange={this.heightestPriceChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='border-box'>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='最低销量:'
|
||||
className='input'
|
||||
type='number'
|
||||
value={this.state.minimumSold}
|
||||
border={false}
|
||||
onChange={this.minimumSoldChange.bind(this)}
|
||||
/>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='最高销量:'
|
||||
className='input'
|
||||
type='number'
|
||||
value={this.state.maximumSold}
|
||||
border={false}
|
||||
onChange={this.maximumSoldChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View className='border-box'>
|
||||
<AtInput
|
||||
border={false}
|
||||
name='value'
|
||||
title='商品编码:'
|
||||
type='number'
|
||||
value={this.state.productId}
|
||||
onChange={this.productIdChange.bind(this)}
|
||||
border={false}
|
||||
/>
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.productCate} onChange={this.productCateChange.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>宝贝类目:</Text>
|
||||
|
||||
<Text className='selected'>{this.state.productCateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.searchButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>
|
||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||
搜索</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToGoodsPublishPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>
|
||||
<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>
|
||||
</View>
|
||||
</View>
|
||||
<View className='text'>
|
||||
<Text>出售中的宝贝{this.state.myGoodListTotal}条记录</Text>
|
||||
</View>
|
||||
<View className='filterbar-container'>
|
||||
<View className='filter-bar'>
|
||||
{filterElementsArray}
|
||||
|
||||
</View>
|
||||
<View className='sub-filter'>
|
||||
<Radio className='radio' checked={this.state.isCheckAll} onClick={this.checkAllHandler.bind(this)}>全选</Radio>
|
||||
<View className='button' onClick={this.deleteGoodsHandler.bind(this)}>
|
||||
<Button size='mini' className='button-dark-red'>
|
||||
删除</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.offStockGoodHandler.bind(this)}>
|
||||
<Button size='mini' className='button-blue'>
|
||||
下架</Button>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
{this.state.myGoodList.length ? <View className='mygoodlist-container'>
|
||||
|
||||
{goodListElementArray}
|
||||
</View > : <View className='no-more-title'> 没有更多了</View>}
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
</View>
|
||||
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' onClick={this.goToCenterPage.bind(this)} >
|
||||
|
||||
个人中心
|
||||
</MovableView>
|
||||
</MovableArea>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default MyGoodList
|
Loading…
Reference in New Issue
Block a user