链接大部分api

This commit is contained in:
郑茂强 2018-12-29 17:15:59 +08:00
parent 6084030925
commit 8930358a6d
15 changed files with 679 additions and 437 deletions

View File

@ -29,6 +29,7 @@ class App extends Component {
'pages/allDemanding/allDemanding',// 所有供求页面 'pages/allDemanding/allDemanding',// 所有供求页面
'pages/myGoodList/myGoodList',// 我的商品列表页面 'pages/myGoodList/myGoodList',// 我的商品列表页面
'pages/myDemandSupplyEdit/myDemandSupplyEdit',// 我的供求编辑页面 'pages/myDemandSupplyEdit/myDemandSupplyEdit',// 我的供求编辑页面
'pages/supplyDemandView/supplyDemandView',// 查看单个供求页面
// 'pages/shopDescription/shopDescription', // 'pages/shopDescription/shopDescription',
], ],
window: { window: {

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Image } from '@tarojs/components' import { View, Button, Text, Image } from '@tarojs/components'
import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtInput, AtToast, AtNoticebar } from 'taro-ui' import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtInput, AtNoticebar } from 'taro-ui'
import './filteredShopComponent.scss' import './filteredShopComponent.scss'
@ -23,11 +23,12 @@ class recommondShop extends Component {
isOpenVouhcer: false, isOpenVouhcer: false,
isOpenConsult: false, isOpenConsult: false,
consultTip: '', consultTip: '',
isToast: false,
consultResponseMsg: '',
voucherResponseMsg: '', voucherResponseMsg: '',
voucherCanConsult: false, voucherCanConsult: false,
voucherName:this.props.userName,
voucherPhone:this.props.userPhone,
consultName:this.props.userName,
consultPhone:this.props.userPhone,
} }
} }
goToShop(value) { goToShop(value) {
@ -91,7 +92,6 @@ class recommondShop extends Component {
} }
// api 购买咨询 BuyConsult // api 购买咨询 BuyConsult
buyConsult({ user = "杨夕兵", phone = "18950295811", shops = ["1306"], source_type = "2", source_level = 1, coupons_flag = 0 }) { buyConsult({ user = "杨夕兵", phone = "18950295811", shops = ["1306"], source_type = "2", source_level = 1, coupons_flag = 0 }) {
Taro.request({ Taro.request({
url: URL.BuyConsult, url: URL.BuyConsult,
method: 'POST', method: 'POST',
@ -112,25 +112,15 @@ class recommondShop extends Component {
} }
}) })
.then(res => { .then(res => {
console.log('购买咨询请求', res) console.log('购买咨询请求成功', res)
if (res.err_code === 0 && res.err_msg === "success") { if (res.statusCode === 200) {
this.setState({ consultResponseMsg: '成功' }, () => { Taro.showToast({ title: res.data.err_msg,icon:'success' })
this.setState({ isToast: true })
})
// 延迟3秒 后将toast 关掉
setTimeout(() => {
this.setState({ isToast: false })
}, 3000);
} else { } else {
this.setState({ consultResponseMsg: res.data.err_msg }, () => { Taro.showToast({ title: res.data.err_msg,icon:'none' })
this.setState({ isToast: true })
})
setTimeout(() => {
this.setState({ isToast: false })
}, 3000);
} }
}).catch(err=>{
console.log('购买咨询请求失败', err)
}) })
} }
@ -144,7 +134,7 @@ class recommondShop extends Component {
} }
voucherModalConfirm() { voucherModalConfirm() {
this.setState({ isOpenVouhcer: false }) this.setState({ isOpenVouhcer: false })
this.buyConsult({}) this.buyConsult({user:this.state.voucherName,phone:this.state.voucherPhone})
} }
// 咨询弹框。取消。确认 // 咨询弹框。取消。确认
isOpenConsult() { isOpenConsult() {
@ -156,9 +146,20 @@ class recommondShop extends Component {
} }
consultModalConfirm() { consultModalConfirm() {
this.setState({ isOpenConsult: false }) this.setState({ isOpenConsult: false })
this.buyConsult({}) this.buyConsult({user:this.state.consultName,phone:this.state.consultPhone})
}
handleInputVcherPhone(value){
this.setState({voucherPhone:value})
}
handleInputVcherName(value){
this.setState({voucherName:value})
}
handleInputCsultName(value){
this.setState({consultName:value})
}
handleInputCsultPhone(value){
this.setState({consultPhone:value})
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
@ -201,18 +202,20 @@ class recommondShop extends Component {
</AtNoticebar> </AtNoticebar>
<View className='voucher-left'>当前优惠卷{voucherLeft}</View> <View className='voucher-left'>当前优惠卷{voucherLeft}</View>
<AtInput <AtInput
name='value' name='value'
title='联系人:' title='联系人:'
type='text' type='text'
placeholder='123' value={this.state.voucherName}
onChange={this.handleInputVcherName.bind(this)}
/> />
<AtInput <AtInput
border={false} border={false}
name='value' name='value'
title='联系电话:' title='联系电话:'
type='number' type='number'
placeholder='需求标题' value={this.state.voucherPhone}
onChange={this.handleInputVcherPhone.bind(this)}
/> />
{!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null} {!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null}
@ -232,33 +235,27 @@ class recommondShop extends Component {
name='value' name='value'
title='联系人:' title='联系人:'
type='text' type='text'
placeholder='123' value={this.state.consultName}
onChange={this.handleInputCsultName.bind(this)}
/> />
<AtInput <AtInput
name='value' name='value'
title='联系电话:' title='联系电话:'
type='number' type='number'
placeholder='需求标题' value={this.state.consultPhone}
border={false} border={false}
onChange={this.handleInputCsultPhone.bind(this)}
/> />
</AtModalContent> </AtModalContent>
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button className='orange' onClick={this.consultModalConfirm.bind(this)}></Button> </AtModalAction> <AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button className='orange' onClick={this.consultModalConfirm.bind(this)}></Button> </AtModalAction>
</AtModal> </AtModal>
// 请提示元素
const toast = <AtToast
isOpened={this.state.isToast}
text={this.state.consultResponseMsg}
// iconSize={iconSize}
// iconType={iconType}
// iconColor={iconColor}
// isHiddenIcon={isHiddenIcon}
></AtToast>
return ( return (
<View className='shop-list-box' > <View className='shop-list-box' >
{voucherModalElement} {voucherModalElement}
{consultModalElement} {consultModalElement}
{toast}
<View className='header'> <View className='header'>
<View className='title'> <View className='title'>
<Image src={ads !== 0 ? hornIcon : houseIcon} style='width:12px; height:12px; vertical-align: middle;' /> <Image src={ads !== 0 ? hornIcon : houseIcon} style='width:12px; height:12px; vertical-align: middle;' />

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image,Button } from '@tarojs/components' import { View, Text, Image, Button } from '@tarojs/components'
import { AtInput, AtButton, Picker, AtIcon, AtLoadMore, AtModal, AtToast,AtModalHeader ,AtModalContent ,AtModalAction } from 'taro-ui' import { AtInput, AtButton, Picker, AtIcon, AtLoadMore, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
@ -18,13 +18,14 @@ class AllDemanding extends Component {
super(...arguments) super(...arguments)
this.state = { this.state = {
supplys: [], // 需求列表 supplys: [], // 需求列表
isMore: 'more', // 上拉加载状态 isMore: 'more', // 加载状态
demandingState: ['全部', '在用', '已抢单', '已抢光'], // 供求状态选择 demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
demandingStateSelected: '全部', // 当前供求状态 demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
industryCate: ['全部', '制定家具', '成品家具', '办公家具', '设计'], // 行业分类状态选择 industryCate: ['全部', '制定家具', '成品家具', '办公家具', '设计'], // 行业分类状态选择
industryCateSelected: '全部', // 当前行业分类状态 industryCateSelected: '全部', // 当前行业分类状态
startDateSel: '2018-04-22', startDateSel: '',
endDateSel: '2018-04-22', endDateSel: '',
classId: '',
isOpenedGrabModal: false, isOpenedGrabModal: false,
grabOrderId: '',//抢到订单的id grabOrderId: '',//抢到订单的id
isGrabOrderSuccess: false,// 是否显示轻提示 isGrabOrderSuccess: false,// 是否显示轻提示
@ -32,7 +33,15 @@ class AllDemanding extends Component {
} }
} }
GetAllDemanding({ curr_page = 1, page_count = 20 }) { //加载更多业主需求函数
loadMoreDemanding(
{ curr_page = 1, page_count = 20,
state = this.state.demandingStateSelected.id,
update_dateL = this.state.startDateSel,
update_dateU = this.state.endDateSel,
class_id = this.state.classId
}
) {
Taro.request({ Taro.request({
url: URL.GetAllDemanding, url: URL.GetAllDemanding,
method: 'POST', method: 'POST',
@ -40,7 +49,11 @@ class AllDemanding extends Component {
data: { data: {
param: JSON.stringify({ param: JSON.stringify({
curr_page: curr_page, curr_page: curr_page,
page_count: page_count page_count: page_count,
state: state,
update_dateL: update_dateL,
update_dateU: update_dateU,
class_id: class_id
}), }),
}, },
header: { header: {
@ -50,21 +63,53 @@ class AllDemanding extends Component {
}) })
.then(res => { .then(res => {
if (res.data.supplys.length) { if (res.data.supplys.length) {
const newSupplys = this.state.supplys.concat(res.data.supplys) Taro.hideLoading()
this.setState({ supplys: newSupplys, isMore: 'more' }) this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isMore: 'more' })
} else { } else {
this.setState({ isMore: 'noMore' }) this.setState({ isMore: 'noMore' })
} }
}) })
} }
// 搜索业主需求函数
searchDemanding({ curr_page = 1, page_count = 20,
state = this.state.demandingStateSelected.id,
update_dateL = this.state.startDateSel,
update_dateU = this.state.endDateSel,
class_id = this.state.classId
}) {
Taro.request({
url: URL.GetAllDemanding,
method: 'POST',
dataType: 'json',
data: {
param: JSON.stringify({
curr_page: curr_page,
page_count: page_count,
state: state,
update_dateL: update_dateL,
update_dateU: update_dateU,
class_id: class_id
}),
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(res => {
Taro.hideLoading()
this.setState({ supplys: res.data.supplys })
})
}
// 向上拉升延迟一秒加载数据 // 向上拉升延迟一秒加载数据
handleLoadMore() { handleLoadMore() {
this.setState({ isMore: 'loading' }) this.setState({ isMore: 'loading' })
setTimeout(() => { setTimeout(() => {
currentPage += 1 currentPage += 1
this.GetAllDemanding({ curr_page: currentPage }) this.loadMoreDemanding({ curr_page: currentPage })
}, 1000); }, 1000);
} }
// 改变需求选项 // 改变需求选项
@ -134,13 +179,26 @@ class AllDemanding extends Component {
this.GrabDemand({ demandId: this.state.grabOrderId }) this.GrabDemand({ demandId: this.state.grabOrderId })
} }
searchHanlder() {
Taro.showLoading({ title: '加载中' }).then(() => {
setTimeout(() => {
this.searchDemanding({})
}, 1000);
})
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps) console.log(this.props, nextProps)
} }
componentDidMount() { componentDidMount() {
// 得到第一页需求数据 // 得到第一页需求数据
this.GetAllDemanding({}) Taro.showLoading({ title: '加载中' }).then(() => {
this.searchDemanding({})
})
} }
@ -154,7 +212,7 @@ class AllDemanding extends Component {
// 提示模态弹窗element // 提示模态弹窗element
const modalMessageGrabElement=<AtModal isOpened={this.state.isOpenedGrabModal}> const modalMessageGrabElement = <AtModal isOpened={this.state.isOpenedGrabModal}>
<AtModalHeader>提示</AtModalHeader> <AtModalHeader>提示</AtModalHeader>
<AtModalContent> <AtModalContent>
确认抢单 确认抢单
@ -207,10 +265,10 @@ class AllDemanding extends Component {
<View className='page-section'> <View className='page-section'>
{/* 供求状态选择 */} {/* 供求状态选择 */}
<View> <View>
<Picker mode='selector' range={this.state.demandingState} onChange={this.changeDemandingState}> <Picker mode='selector' rangeKey='name' range={this.state.demandingState} onChange={this.changeDemandingState}>
<View className='picker'> <View className='picker'>
<View className='title-box'> <View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingStateSelected}</Text> <Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
</View> </View>
</View> </View>
@ -260,7 +318,7 @@ class AllDemanding extends Component {
</Picker> </Picker>
</View> </View>
</View> </View>
<View className='button-box'> <View className='button-box' onClick={this.searchHanlder.bind(this)}>
<View className='button'> <View className='button'>
<AtButton type='primary' size='small'> <AtButton type='primary' size='small'>
<AtIcon value='search' size='12' color='white'></AtIcon> <AtIcon value='search' size='12' color='white'></AtIcon>

View File

@ -105,7 +105,10 @@ class GoodsPublish extends Component {
} }
// 发布商品api // 发布商品api
uploadGoods({ goods_name = "test2", goods_price = "1.00", goods_unit = "1", goods_profiles = "test2", class_id = "10103", shop_class_id = "1930" }) { uploadGoods({ goods_name = "test2", goods_price = "1.00",
goods_unit = "1", goods_profiles = "test2",
class_id = "10103",
shop_class_id = "1930" }) {
// 上传图片的参数 // 上传图片的参数
const uploadProductGoodFileParams = [] const uploadProductGoodFileParams = []
@ -155,22 +158,26 @@ class GoodsPublish extends Component {
} }
}) })
.then(res => { .then(res => {
this.setState({ uploadProductTextTip: '发布成功', isUploadProductSuccess: true }, () => { Taro.hideLoading()
Taro.showToast({
title: '发布成功',
icon: 'success',
duration: 1000
})
setTimeout(() => { setTimeout(() => {
this.setState({ isUploadProductSuccess: false })
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/goodsPublish/goodsPublish' url: '/pages/goods/goods?id=5cf3Ptn5wKQdyPpwsSe2nDKnN4QDFdz8moPTf+QIOm788Q'// 虚拟地址
})
}, 2000)
}) })
}, 1000);
console.log('上传商品', res) console.log('上传商品', res)
} }
) )
.catch(error => { .catch(error => {
this.setState({ uploadProductTextTip: '发布失败', isUploadProductSuccess: true }, () => { Taro.hideLoading()
setTimeout(() => { Taro.showToast({
this.setState({ isUploadProductSuccess: false }) title: '保存失败',
}, 2000) icon: 'none',
duration: 1000
}) })
}) })
} }
@ -247,10 +254,12 @@ class GoodsPublish extends Component {
const imagePath = URL.Base + data.file_path const imagePath = URL.Base + data.file_path
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath }) const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
const newImageInfo = that.state.ImagesInfo.concat(data) const newImageInfo = that.state.ImagesInfo.concat(data)
that.setState({ pickerImageUrl: newPickerImageUrl, isUploadImageSuccess: true, uploadImageTextTip: '图片上传成功', ImagesInfo: newImageInfo }, () => { that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo }, () => {
setTimeout(() => { Taro.showToast({
that.setState({ isUploadImageSuccess: false }) title: '上传成功',
}, 2000) icon: 'success',
duration: 2000
})
}) })
} }
}) })
@ -258,10 +267,10 @@ class GoodsPublish extends Component {
if (operationType === 'remove') { if (operationType === 'remove') {
this.state.pickerImageUrl.splice(index, 1); this.state.pickerImageUrl.splice(index, 1);
this.setState({ files: this.state.pickerImageUrl }); this.setState({ files: this.state.pickerImageUrl });
that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' }, () => { Taro.showToast({
setTimeout(() => { title: '删除成功',
that.setState({ isUploadImageSuccess: false }) icon: 'success',
}, 2000) duration: 2000
}) })
} }
} }
@ -274,20 +283,21 @@ class GoodsPublish extends Component {
} }
onClickUploadGoods() { onClickUploadGoods() {
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) { if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) {
Taro.showLoading({ title: '发布中' }).then(() => {
setTimeout(() => {
this.uploadGoods({ this.uploadGoods({
goods_name: this.state.productName, goods_name: this.state.productName,
goods_price: this.state.productPrice, goods_price: this.state.productPrice,
goods_unit: this.state.productUnit, goods_unit: this.state.productUnit,
goods_profiles: this.state.productDescript, goods_profiles: this.state.productDescript,
class_id: "10103", class_id: "10103",// to be continue
shop_class_id: this.state.shopCategoryCheckedPicker, shop_class_id: this.state.shopCategoryCheckedPicker.id,
}) })
},1000)})
} else { } else {
this.setState({ uploadProductTextTip: '请填写完表格', isUploadProductSuccess: true }, () => {
setTimeout(() => { Taro.showToast({title:'请填写完表格',icon:'none'})
this.setState({ isUploadProductSuccess: false })
}, 2000)
})
} }
} }
shopCategoryChanged(e) { shopCategoryChanged(e) {
@ -444,20 +454,11 @@ class GoodsPublish extends Component {
} }
render() { render() {
const imageUploadSuccess = <AtToast
isOpened={this.state.isUploadImageSuccess}
text={this.state.uploadImageTextTip}
duration={2000}
></AtToast>
const productUploadSuccess = <AtToast
isOpened={this.state.isUploadProductSuccess}
text={this.state.uploadProductTextTip}
duration={2000}
></AtToast>
return ( return (
<View className='goods-publish'> <View className='goods-publish'>
{imageUploadSuccess}
{productUploadSuccess}
<View className='goods-category'> <View className='goods-category'>
<View className='page-section'> <View className='page-section'>

View File

@ -1,11 +1,12 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components' import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
import { AtModal, AtButton, AtToast,AtModalHeader ,AtModalContent,AtModalAction} from 'taro-ui' import { AtModal, AtButton, AtToast, AtModalHeader, AtModalContent, AtModalAction, AtLoadMore } from 'taro-ui'
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent' import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
import BottomNav from '../../component/bottomNav/bottomNav' import BottomNav from '../../component/bottomNav/bottomNav'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import './home.scss' import './home.scss'
let currentPage = 1
class Home extends Component { class Home extends Component {
config = { config = {
@ -25,6 +26,9 @@ class Home extends Component {
grabOrderId: '',//抢到订单的id grabOrderId: '',//抢到订单的id
isGrabOrderSuccess: false,// 是否显示轻提示 isGrabOrderSuccess: false,// 是否显示轻提示
grabOrderSuccess: '',// 抢单成功返回字段 grabOrderSuccess: '',// 抢单成功返回字段
isMore: 'noMore',// 加载更多店铺
userName:'',//用户名字
userPhone:'',// 用户电话
} }
} }
@ -36,6 +40,9 @@ class Home extends Component {
getHomeCategoriesInfo() { getHomeCategoriesInfo() {
Taro.request({ Taro.request({
url: URL.ShopWxStore, url: URL.ShopWxStore,
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
}) })
.then(res => { .then(res => {
console.log('首页基本信息', res) console.log('首页基本信息', res)
@ -43,41 +50,53 @@ class Home extends Component {
ads: res.data.data.adsLb, ads: res.data.data.adsLb,
categories: res.data.data.supplyClass, categories: res.data.data.supplyClass,
demanding: res.data.data.demand.supplys, demanding: res.data.data.demand.supplys,
otherData: res.data.otherData otherData: res.data.otherData,
userName:res.data.otherData.userName,
userPhone:res.data.otherData.userPhone,
}) })
}) })
} }
// api 得到推荐商店的信息 // api 得到推荐商店的信息
getShops(parent_supply_class = 0, supply_class = '-1', supply_level = 1) { getShops({ parent_supply_class = 0, supply_class = '-1', supply_level = 1, curr_page = 1,
page_count = 20, action = "2" }) {
Taro.request({ Taro.request({
url: URL.ShopSupplyShops, url: URL.ShopSupplyShops,
method: 'POST', method: 'POST',
dataType: 'json', dataType: 'json',
data: { data: {
param: JSON.stringify({ param: JSON.stringify({
curr_page: 1, curr_page: curr_page,
page_count: 20, page_count: page_count,
parent_supply_class: parent_supply_class, //父级class id parent_supply_class: parent_supply_class, //父级class id
supply_class: supply_class,// 子级class id supply_class: supply_class,// 子级class id
supply_level: supply_level,// 层级 supply_level: supply_level,// 层级
action: "2" action: action
}) })
}, },
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
} }
}) })
.then(res => { .then(res => {
console.log('所有店铺的信息', res) console.log('所有店铺的信息', res)
Taro.hideLoading() Taro.hideLoading()
this.setState({ shopsDetails: res.data.shops }, () => { if (res.data.shops.length) {
this.setState({ shopsDetails: this.state.shopsDetails.concat(res.data.shops), isMore: 'more' }, () => {
}) })
} else {
this.setState({ isMore: 'noMore' }, () => {
console.log('ismore?', this.state.isMore)
})
}
} }
) )
} }
// 登入api // 异步函数登入api
login() { async login() {
Taro.login({ Taro.login({
success(res) { success(res) {
if (res.code) { if (res.code) {
@ -102,7 +121,10 @@ class Home extends Component {
Taro.setStorageSync('userInfo', response.data.user_info) Taro.setStorageSync('userInfo', response.data.user_info)
} }
) ).catch(err => {
console.log('登入微信失败', err)
})
} }
else { else {
console.log('登录失败!' + res.errMsg) console.log('登录失败!' + res.errMsg)
@ -148,7 +170,7 @@ class Home extends Component {
} }
}) })
.then(res => { .then(res => {
this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true }, () => { this.setState({ grabOrderSuccess: res.data.err_msg, isGrabOrderSuccess: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ isGrabOrderSuccess: false }) this.setState({ isGrabOrderSuccess: false })
}, 2000) }, 2000)
@ -160,12 +182,18 @@ class Home extends Component {
} }
// 点击大类icon // 点击大类icon
onClickParentCate(item) { onClickParentCate(item) {
const parentClass = item.parent_class_id
const childClass = item.class_id
this.setState({ subCate: item.children }) this.setState({ subCate: item.children })
this.getShops(item.parent_class_id, item.class_id) this.getShops({ parent_supply_class: parentClass, supply_class: childClass })
this.getShops({ parent_supply_class: parentClass, supply_class: childClass })
} }
// 点击子类 // 点击子类
onClickChildCate(item) { onClickChildCate(item) {
this.getShops(item.parent_class_id, item.class_id, 2) const parentClass = item.parent_class_id
const childClass = item.class_id
// this.getShops(item.parent_class_id, item.class_id, 2)
this.getShops({ parent_supply_class: parentClass, supply_class: childClass, supply_level: 2 })
} }
// 转到其他页面 // 转到其他页面
goToAllDemandingPage() { goToAllDemandingPage() {
@ -188,13 +216,23 @@ class Home extends Component {
// 确认抢单之后 // 确认抢单之后
this.GrabDemand({ demandId: this.state.grabOrderId }) this.GrabDemand({ demandId: this.state.grabOrderId })
} }
// 向上拉升延迟一秒加载数据
handleLoadMore() {
this.setState({ isMore: 'loading' })
setTimeout(() => {
currentPage += 1
this.getShops({ curr_page: currentPage })
}, 1000);
}
componentDidMount() { componentDidMount() {
// 页面加载后 得到首页的基本信息和推荐店铺的信息 // 页面加载后 得到首页的基本信息和推荐店铺的信息
Taro.showLoading({ title: '加载中' }) Taro.showLoading({ title: '加载中' })
this.getShops()
this.login().then(() => {
this.getShops({})
this.getHomeCategoriesInfo() this.getHomeCategoriesInfo()
this.login() }).catch(err => console.log('微信登入失败:', err))
} }
@ -220,14 +258,14 @@ class Home extends Component {
render() { render() {
// 提示模态弹窗element // 提示模态弹窗element
const modalMessageGrabElement=<AtModal isOpened={this.state.isOpen}> const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
<AtModalHeader>提示</AtModalHeader> <AtModalHeader>提示</AtModalHeader>
<AtModalContent> <AtModalContent>
确认抢单 确认抢单
</AtModalContent> </AtModalContent>
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}></Button> </AtModalAction> <AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}></Button> </AtModalAction>
</AtModal> </AtModal>
@ -256,7 +294,7 @@ class Home extends Component {
业主{item.user_name} 业主{item.user_name}
</View> </View>
<View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}> <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
<Button className='item-button' > {item.state_name==='在用'?'抢单':'已抢单'}</Button> <Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢单'}</Button>
</View> </View>
</View> </View>
</SwiperItem > </SwiperItem >
@ -282,7 +320,7 @@ class Home extends Component {
</View> </View>
}) : null }) : null
const shopCollectionElementsArray = this.state.shopsDetails.length ? this.state.shopsDetails.map((item, index) => { const shopCollectionElementsArray = this.state.shopsDetails.length ? this.state.shopsDetails.map((item, index) => {
return <FilteredShopComponent shop={item} key={index}></FilteredShopComponent> return <FilteredShopComponent shop={item} userName={this.state.userName} userPhone={this.state.userPhone} key={index}></FilteredShopComponent>
}) : null }) : null
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => { const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
@ -406,11 +444,14 @@ class Home extends Component {
<View className='shop-box'> <View className='shop-box'>
{shopCollectionElementsArray} {shopCollectionElementsArray}
{this.state.shopsDetails.length !== 0 ? <View className='title'>
沒有更多了... <AtLoadMore
</View> :<View className='title' > onClick={this.handleLoadMore.bind(this)}
没有找到... status={this.state.isMore}
</View >} loadingText='加载中'
noMoreText='没有更多了'
/>
</View> </View>
<View className='gap'> <View className='gap'>

View File

@ -30,9 +30,9 @@ class Index extends Component {
componentDidMount(){ componentDidMount(){
Taro.navigateTo({ Taro.navigateTo({
// url: '/pages/goodsPublish/goodsPublish' // url: '/pages/goodsPublish/goodsPublish'
url: '/pages/home/home' //url: '/pages/goodsPublish/goodsPublish'
// url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit' // url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
// url: '/pages/home/home' url: '/pages/mySupplyDemand/mySupplyDemand'
// url:'/pages/supplyDemandPublish/supplyDemandPublish' // url:'/pages/supplyDemandPublish/supplyDemandPublish'
}) })
} }

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Radio, } from '@tarojs/components' import { View, Radio, } from '@tarojs/components'
import { AtInput, Text, AtButton, AtIcon, Picker, Image, AtPagination,AtToast } from 'taro-ui' import { AtInput, Text, AtButton, AtIcon, Picker, Image, AtPagination, AtToast } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
@ -22,8 +22,8 @@ class MyGoodList extends Component {
minimumSold: '', minimumSold: '',
maximumSold: '', maximumSold: '',
productId: '', productId: '',
productCate: ['全部类目', '衣柜', '人工服务', '开料机', '书柜', '橱柜', '更衣室'], productCate: [], //宝贝类目
productCateSelected: '全部类目', productCateSelected: { class_Id: '', class_name: '全部类目' },// 已选宝贝类目
filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项 filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项
filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值 filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值
filterOptions: { filterOptions: {
@ -39,10 +39,10 @@ class MyGoodList extends Component {
goodsStateParam: 1,//商品状态参数 goodsStateParam: 1,//商品状态参数
pageCountParam: 10,// 商品数量参数 pageCountParam: 10,// 商品数量参数
currPageParam: 1,// 当前页面 参数 currPageParam: 1,// 当前页面 参数
isCheckAll:false,// 是否checked isCheckAll: false,// 是否checked
goodsIdList:[],//商品Id 列表 goodsIdList: [],//商品Id 列表
isToast:false,// 是否显示轻提示 isToast: false,// 是否显示轻提示
toastText:''// 轻提示字段 toastText: ''// 轻提示字段
} }
@ -72,6 +72,28 @@ class MyGoodList extends Component {
productCateSelected: this.state.productCate[e.detail.value] productCateSelected: this.state.productCate[e.detail.value]
}) })
} }
//获取宝贝类目搜索列表接口api
getBaoBeiCateList() {
Taro.request({
url: URL.BaoBeiCateList,
method: 'POST',
dataType: 'json',
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
console.log('baobei', res)
this.setState({ productCate: res.data.goodsClass })
}).catch(err => {
console.log('获取宝贝类目失败', err)
})
}
// 获取我的商品列表接口api // 获取我的商品列表接口api
getMyGoodListApi({ goodsState = this.state.goodsStateParam, pageCount = this.state.pageCountParam, currPage = this.state.currPageParam }) { getMyGoodListApi({ goodsState = this.state.goodsStateParam, pageCount = this.state.pageCountParam, currPage = this.state.currPageParam }) {
Taro.request({ Taro.request({
@ -94,7 +116,7 @@ class MyGoodList extends Component {
console.log('我的商品列表', JSON.parse(res.data)) console.log('我的商品列表', JSON.parse(res.data))
const data = JSON.parse(res.data) const data = JSON.parse(res.data)
data.goods.forEach(item => { data.goods.forEach(item => {
item.checked=false item.checked = false
}); });
const goodCount = Number(data.goodsCount) const goodCount = Number(data.goodsCount)
this.setState({ this.setState({
@ -111,7 +133,20 @@ class MyGoodList extends Component {
} }
// 获取搜索结果api // 获取搜索结果api
getGoodListResultApi({ goodsName = this.state.productName, goodsSn = '', goodsClass = '', 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 = '', }) { getGoodListResultApi({
goodsName = this.state.productName,
goodsSn = '',
goodsClass = this.state.productCateSelected.class_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({ Taro.request({
url: URL.MyGoodList, url: URL.MyGoodList,
method: 'POST', method: 'POST',
@ -156,7 +191,7 @@ class MyGoodList extends Component {
} }
// 商品列表下架API // 商品列表下架API
changeGoodState({goodsState=0,goodsID= this.state.goodsIdList }) { changeGoodState({ goodsState = 0, goodsID = this.state.goodsIdList }) {
Taro.request({ Taro.request({
url: URL.ChangeGoodState, url: URL.ChangeGoodState,
method: 'POST', method: 'POST',
@ -164,7 +199,7 @@ class MyGoodList extends Component {
data: { data: {
goodsState: goodsState, goodsState: goodsState,
goodsID:JSON.stringify(goodsID) goodsID: JSON.stringify(goodsID)
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
@ -174,9 +209,9 @@ class MyGoodList extends Component {
}).then(res => { }).then(res => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
console.log('商品状态返回', res) console.log('商品状态返回', res)
this.setState({isToast:true,toastText:'下架成功'},()=>{ this.setState({ isToast: true, toastText: '下架成功' }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({isToast:false}) this.setState({ isToast: false })
this.getMyGoodListApi({})// 从新获取商品列表数据 this.getMyGoodListApi({})// 从新获取商品列表数据
}, 2000); }, 2000);
}) })
@ -191,7 +226,7 @@ class MyGoodList extends Component {
} }
// 商品列表删除api // 商品列表删除api
deleteGood({goodsState=1,goodsID= this.state.goodsIdList }) { deleteGood({ goodsState = 1, goodsID = this.state.goodsIdList }) {
Taro.request({ Taro.request({
url: URL.DeleteGood, url: URL.DeleteGood,
method: 'POST', method: 'POST',
@ -199,7 +234,7 @@ class MyGoodList extends Component {
data: { data: {
goodsState: goodsState, goodsState: goodsState,
goodsID:JSON.stringify(goodsID) goodsID: JSON.stringify(goodsID)
}, },
header: { header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'), 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
@ -209,9 +244,9 @@ class MyGoodList extends Component {
}).then(res => { }).then(res => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
console.log('商品删除返回', res) console.log('商品删除返回', res)
this.setState({isToast:true,toastText:'删除成功'},()=>{ this.setState({ isToast: true, toastText: '删除成功' }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({isToast:false}) this.setState({ isToast: false })
this.getMyGoodListApi({})// 从新获取商品列表数据 this.getMyGoodListApi({})// 从新获取商品列表数据
}, 2000); }, 2000);
}) })
@ -247,7 +282,7 @@ class MyGoodList extends Component {
minimumSold: '', minimumSold: '',
maximumSold: '', maximumSold: '',
productId: '', productId: '',
productCateSelected: '全部类目', productCateSelected: { class_Id: '', class_name: '全部类目' },
}) })
} }
// 产品排序 // 产品排序
@ -312,26 +347,23 @@ class MyGoodList extends Component {
this.state.filterOptions.filterPublishDate ? this.getGoodListResultApi({ order: "update_date desc" }) : this.getGoodListResultApi({ order: "update_date" }) this.state.filterOptions.filterPublishDate ? this.getGoodListResultApi({ order: "update_date desc" }) : this.getGoodListResultApi({ order: "update_date" })
} }
) )
} }
} }
// 翻页导航 // 翻页导航
paginationNav(type) { paginationNav(type) {
this.setState({ currentPage: type.current, isCheckAll: false }, () => {
this.setState({ currentPage: type.current,isCheckAll:false }, () => {
this.getMyGoodListApi({ currPage: this.state.currentPage }) this.getMyGoodListApi({ currPage: this.state.currentPage })
}) })
} }
// 商品全部选择 // 商品全部选择
checkAllHandler(){ checkAllHandler() {
const newMyGoodList=this.state.myGoodList.map((item)=>{ const newMyGoodList = this.state.myGoodList.map((item) => {
item.checked=!this.state.isCheckAll item.checked = !this.state.isCheckAll
return item return item
}) })
this.setState({isCheckAll:!this.state.isCheckAll,myGoodList:newMyGoodList}) this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList })
} }
@ -339,54 +371,59 @@ class MyGoodList extends Component {
// 单个商品选择 // 单个商品选择
handleCheckChange(Id) { handleCheckChange(Id) {
//如果goodid 一样的那么checked 就取反 //如果goodid 一样的那么checked 就取反
const newMyGoodList=this.state.myGoodList.map((item)=>{ const newMyGoodList = this.state.myGoodList.map((item) => {
if(item.goods_id===Id){ if (item.goods_id === Id) {
item.checked=!item.checked item.checked = !item.checked
} }
return item return item
}) })
this.setState({myGoodList:newMyGoodList}) this.setState({ myGoodList: newMyGoodList })
} }
// 删除商品 // 删除商品
deleteGoodsHandler(){ deleteGoodsHandler() {
const checkedGoodsId=[] const checkedGoodsId = []
this.state.myGoodList.forEach(item => { this.state.myGoodList.forEach(item => {
if(item.checked){ if (item.checked) {
checkedGoodsId.push(item.goods_id) checkedGoodsId.push(item.goods_id)
} }
}); });
checkedGoodsId.length?this.deleteGood({goodsID:checkedGoodsId}):this.setState({isToast:true,toastText:'请选择要删除的商品'},()=>{ checkedGoodsId.length ? this.deleteGood({ goodsID: checkedGoodsId }) : this.setState({ isToast: true, toastText: '请选择要删除的商品' }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({isToast:false}) this.setState({ isToast: false })
}, 2000); }, 2000);
}) })
} }
// 改变商品状态 // 改变商品状态
offStockGoodHandler(){ offStockGoodHandler() {
const checkedGoodsId=[] const checkedGoodsId = []
this.state.myGoodList.forEach(item => { this.state.myGoodList.forEach(item => {
if(item.checked){ if (item.checked) {
checkedGoodsId.push(item.goods_id) checkedGoodsId.push(item.goods_id)
} }
}); });
checkedGoodsId.length?this.changeGoodState({goodsID:checkedGoodsId}):this.setState({isToast:true,toastText:'请选择要下架的商品'},()=>{ checkedGoodsId.length ? this.changeGoodState({ goodsID: checkedGoodsId }) : this.setState({ isToast: true, toastText: '请选择要下架的商品' }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({isToast:false}) this.setState({ isToast: false })
}, 2000); }, 2000);
}) })
} }
// 导航到商品编辑页面myGoodsEdit // 导航到商品编辑页面myGoodsEdit
goToGoodEditPage(){ goToGoodEditPage(goodId) {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/myGoodsEdit/myGoodsEdit' url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
})
}
goToGoodspage(goodId){
Taro.navigateTo({
url: '/pages/goods/goods?id='+goodId// 虚拟地址
}) })
} }
componentDidMount() { componentDidMount() {
this.getMyGoodListApi({}) this.getMyGoodListApi({})
this.getBaoBeiCateList()
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps) console.log(this.props, nextProps)
@ -400,7 +437,7 @@ class MyGoodList extends Component {
render() { render() {
// 轻提示 // 轻提示
const toastElement=<AtToast const toastElement = <AtToast
isOpened={this.state.isToast} isOpened={this.state.isToast}
text={this.state.toastText} text={this.state.toastText}
></AtToast> ></AtToast>
@ -409,15 +446,15 @@ class MyGoodList extends Component {
//等待接口数据 <Radio className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio> //等待接口数据 <Radio className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio>
const goodListElementArray = this.state.myGoodList.map((item, index) => { const goodListElementArray = this.state.myGoodList.map((item, index) => {
return <View key={index} className='good-container'> return <View key={index} className='good-container'>
<Radio className='radio' value={item.goods_id} checked={item.checked} onClick={this.handleCheckChange.bind(this,item.goods_id)} ></Radio> <Radio className='radio' value={item.goods_id} checked={item.checked} onClick={this.handleCheckChange.bind(this, item.goods_id)} ></Radio>
{/* onClick={this.handleCheckChange.bind(this,item.goods_id)} */} {/* onClick={this.handleCheckChange.bind(this,item.goods_id)} */}
<View className='img-box'> <View className='img-box' onClick={this.goToGoodspage.bind(this,item.goods_id)}>
<Image mode='aspectFit' className='img' style='height:50px;width:50px' src={URL.Base + item.goods_url} /> <Image mode='aspectFit' className='img' style='height:50px;width:50px' src={URL.Base + item.goods_url} />
</View> </View>
<View className='name-box'>{item.goods_name}</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='price-box'>{item.goods_price}</View>
<View className='quantity-box'>{item.sales_volume}</View> <View className='quantity-box'>{item.sales_volume}</View>
<View className='button-box1' onClick={this.goToGoodEditPage.bind(this)}> <View className='button-box1' onClick={this.goToGoodEditPage.bind(this,item.goods_id)}>
<AtButton type='primary' className='button-a' size='small'> <AtButton type='primary' className='button-a' size='small'>
编辑商品</AtButton> 编辑商品</AtButton>
</View> </View>
@ -496,12 +533,12 @@ class MyGoodList extends Component {
/> />
</View> </View>
<View className='page-section'> <View className='page-section'>
<Picker mode='selector' range={this.state.productCate} onChange={this.productCateChange.bind(this)}> <Picker mode='selector' rangeKey='class_name' range={this.state.productCate} onChange={this.productCateChange.bind(this)}>
<View className='picker'> <View className='picker'>
<View className='title-box'> <View className='title-box'>
<Text className='title'>宝贝类目:</Text> <Text className='title'>宝贝类目:</Text>
<Text className='selected'>{this.state.productCateSelected}</Text> <Text className='selected'>{this.state.productCateSelected.class_name}</Text>
</View> </View>
</View> </View>

View File

@ -1,4 +1,4 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component, UpdateManager } from '@tarojs/taro'
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components' import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui' import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui'
@ -14,26 +14,63 @@ class MyGoodsEdit extends Component {
constructor() { constructor() {
super(...arguments) super(...arguments)
this.state = { this.state = {
shopCategoryPicker: [], // 店铺分类选项 shopCategoryPicker: [], // 店铺分类选项
shopCategoryCheckedPicker: { name: '选择店铺类型' }, shopCategoryCheckedPicker: { name: '选择店铺类型', id: '' },
productName: '', productName: '',
productPrice: '', productPrice: '',
productUnit: '', productUnit: '',
productDescript: '', productDescript: '',
pickerImageUrl: [], // 上传的图片 pickerImageUrl: [], // 上传的图片
ImagesInfo: [],// 后台传回来的图片信息 ImagesInfo: [],// 后台传回来的图片信息
shopCategoryList: [], shopCategoryList: [],
isToast:false,
toastText:'',
} }
} }
//获取商品信息api GetProductInfo
getGoodsInfo() {
Taro.request({
url: URL.GetProductInfo,
method: 'GET',
dataType: 'json',
data: {
// goodsID: 'c610femn1j8fHUOM5gvh6VxW03O5mBDgNcAJGGFmvFX3Zw'
goodsID: this.$router.params.id,
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(res => {
console.log('商品详情获取成功', res)
const imageFile = res.data.goodsFiles.map((item) => {
return { url: URL.Base + item.files.file_path }
})
const selectedShopCateId=res.data.goods.shop_class_id
const selectedShopCate=this.state.shopCategoryPicker.filter(item=>{
return item.id===selectedShopCateId
})
console.log('abc',selectedShopCate)
this.setState({
productName: res.data.goods.goods_name,
productPrice: res.data.goods.goods_price,
productUnit: res.data.goods.goods_unit,
productDescript: res.data.goods.goods_profiles,
shopCategoryCheckedPicker:selectedShopCate[0],
pickerImageUrl: imageFile
})
}
)
.catch(error => {
console.log('商品详情获取失败', error)
})
}
// 店铺分类目录请求 api // 店铺分类目录请求 api
getShopCateList() { async getShopCateList() {
Taro.request({ Taro.request({
url: URL.GetShopCategoryList, url: URL.GetShopCategoryList,
method: 'POST', method: 'POST',
@ -61,6 +98,7 @@ class MyGoodsEdit extends Component {
} }
this.setState({ shopCategoryPicker: shopCategory }) this.setState({ shopCategoryPicker: shopCategory })
console.log('店铺分类目录', res) console.log('店铺分类目录', res)
return
} }
} }
) )
@ -120,22 +158,27 @@ class MyGoodsEdit extends Component {
} }
}) })
.then(res => { .then(res => {
this.setState({ toastText: '发布成功', isToast: true }, () => { Taro.hideLoading()
Taro.showToast({
title: '保存成功',
icon: 'success',
duration: 1000
})
setTimeout(() => { setTimeout(() => {
this.setState({ isToast: false })
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/goods/goods?id=5cf3Ptn5wKQdyPpwsSe2nDKnN4QDFdz8moPTf+QIOm788Q'// 虚拟地址 url: '/pages/goods/goods?id=5cf3Ptn5wKQdyPpwsSe2nDKnN4QDFdz8moPTf+QIOm788Q'// 虚拟地址
}) })
}, 2000) }, 1000);
})
console.log('上传商品', res) console.log('上传商品', res)
} }
) )
.catch(error => { .catch(error => {
this.setState({ toastText: '发布失败', isToast: true }, () => { Taro.hideLoading()
setTimeout(() => { Taro.showToast({
this.setState({ isToast: false }) title: '保存失败',
}, 2000) icon: 'none',
duration: 1000
}) })
}) })
} }
@ -184,10 +227,12 @@ class MyGoodsEdit extends Component {
const imagePath = URL.Base + data.file_path const imagePath = URL.Base + data.file_path
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath }) const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
const newImageInfo = that.state.ImagesInfo.concat(data) const newImageInfo = that.state.ImagesInfo.concat(data)
that.setState({ pickerImageUrl: newPickerImageUrl, isToast: true, toastText: '图片上传成功', ImagesInfo: newImageInfo }, () => { that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo }, () => {
setTimeout(() => { Taro.showToast({
that.setState({ isToast: false }) title: '上传成功',
}, 2000) icon: 'success',
duration: 2000
})
}) })
} }
}) })
@ -195,11 +240,13 @@ class MyGoodsEdit extends Component {
if (operationType === 'remove') { if (operationType === 'remove') {
this.state.pickerImageUrl.splice(index, 1); this.state.pickerImageUrl.splice(index, 1);
this.setState({ files: this.state.pickerImageUrl }); this.setState({ files: this.state.pickerImageUrl });
that.setState({ isToast: true, toastText: '删除成功' }, () => {
setTimeout(() => { Taro.showToast({
that.setState({ isToast: false }) title: '删除成功',
}, 2000) icon: 'success',
duration: 2000
}) })
} }
} }
// 图片上传失败 // 图片上传失败
@ -211,20 +258,24 @@ class MyGoodsEdit extends Component {
} }
onClickUploadGoods() { onClickUploadGoods() {
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) { if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) {
Taro.showLoading({ title: '保存中' }).then(() => {
setTimeout(() => {
this.uploadGoods({ this.uploadGoods({
goods_name: this.state.productName, goods_name: this.state.productName,
goods_price: this.state.productPrice, goods_price: this.state.productPrice,
goods_unit: this.state.productUnit, goods_unit: this.state.productUnit,
goods_profiles: this.state.productDescript, goods_profiles: this.state.productDescript,
class_id: "10103",
shop_class_id: this.state.shopCategoryCheckedPicker, shop_class_id: this.state.shopCategoryCheckedPicker,
}) })
} else { }, 1000);
this.setState({ toastText: '请填写完表格', isToast: true }, () => {
setTimeout(() => {
this.setState({ isToast: false })
}, 2000)
}) })
} else {
Taro.showToast({
title: '请填写完表格',
icon: 'none',
duration: 2000
})
} }
} }
shopCategoryChanged(e) { shopCategoryChanged(e) {
@ -234,7 +285,7 @@ class MyGoodsEdit extends Component {
console.log(this.state.shopCategoryCheckedPicker) console.log(this.state.shopCategoryCheckedPicker)
}) })
} }
goToMyGoodListPage(){ goToMyGoodListPage() {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/myGoodList/myGoodList' url: '/pages/myGoodList/myGoodList'
}) })
@ -243,7 +294,10 @@ class MyGoodsEdit extends Component {
componentDidMount() { componentDidMount() {
this.getShopCateList() this.getShopCateList().then(() => {
this.getGoodsInfo()
})
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
@ -258,20 +312,10 @@ class MyGoodsEdit extends Component {
render() { render() {
const imageUploadSuccess = <AtToast
isOpened={this.state.isToast}
text={this.state.toastText}
duration={2000}
></AtToast>
const productUploadSuccess = <AtToast
isOpened={this.state.isToast}
text={this.state.toastText}
duration={2000}
></AtToast>
return ( return (
<View className='goods-publish'> <View className='goods-publish'>
{imageUploadSuccess}
{productUploadSuccess}
<View className='goods-category'> <View className='goods-category'>

View File

@ -1,9 +1,9 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button } from '@tarojs/components' import { View, Text, Button } from '@tarojs/components'
import { AtInput, AtButton, Picker, AtIcon, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui' import { AtInput, AtButton, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import URL from '../../serviceAPI.config' import URL from '../../serviceAPI.config'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent' import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './mySupplyDemand.scss' import './mySupplyDemand.scss'
@ -17,17 +17,16 @@ class MySupplyDemand extends Component {
constructor() { constructor() {
super(...arguments) super(...arguments)
this.state = { this.state = {
demandSupplyCate: ['全部', '需求', '供应', '人才'], demandSupplyCate: [{ name: '全部', id: '' }, { name: '需求', id: '1' }, { name: '供应', id: '2' }, { name: '人才', id: '3' },],
demandSupplyCateSelected: '全部', demandSupplyCateSelected: { name: '全部', id: '' },
demandSupplyState: ['全部', '上架', '下架'], demandSupplyState: [{ name: '全部', id: '' }, { name: '上架', id: '1' }, { name: '下架', id: '0' }],
demandSupplyStatesSelected: '全部', demandSupplyStatesSelected: { name: '全部', id: '' },
title: '', title: '',
startDateSel: '', startDateSel: '',
endDateSel: '', endDateSel: '',
allDemandSupply: [], allDemandSupply: [],
totalDemandSupply: '', totalDemandSupply: '',
isToast: false,// 是否显示轻提示
toastContent: '', // 轻提示内容
isConfirmWindow: false, // 是否显示确认弹窗 isConfirmWindow: false, // 是否显示确认弹窗
demandSupplyItemName: '',// 确认框提示时 使用的供求名 demandSupplyItemName: '',// 确认框提示时 使用的供求名
demandSupplyId: '',// 删除我的供求时的供求id demandSupplyId: '',// 删除我的供求时的供求id
@ -56,13 +55,16 @@ class MySupplyDemand extends Component {
}).then(res => { }).then(res => {
if (res.data.err_msg === "success") { if (res.data.err_msg === "success") {
// 判断是否有res.data.supplys 如果没有就是空数组[] // 判断是否有res.data.supplys 如果没有就是空数组[]
this.setState({ allDemandSupply: res.data.supplys ? res.data.supplys : [], totalDemandSupply: res.data.count }) Taro.hideLoading()
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: res.data.count })
} }
}) })
} }
//搜索我的供求api //搜索我的供求api
searchDemandSupply({ curr_page = 1, page_count = 20, sd_type = "2", state = "1", sd_title = this.state.title, update_dateL = this.state.startDateSel, update_dateU = this.state.endDateSel }) { searchDemandSupply({ curr_page = 1, page_count = 20,
sd_type = this.state.demandSupplyCateSelected.id,
state = this.state.demandSupplyStatesSelected.id, sd_title = this.state.title, update_dateL = this.state.startDateSel, update_dateU = this.state.endDateSel }) {
Taro.request({ Taro.request({
url: URL.SearchDemandSupply, url: URL.SearchDemandSupply,
method: 'POST', method: 'POST',
@ -87,8 +89,17 @@ class MySupplyDemand extends Component {
.then(res => { .then(res => {
//this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true }) //this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true })
console.log('我的供求搜索结果', res) console.log('我的供求搜索结果', res)
Taro.hideLoading()
this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: res.data.count })
this.setState({ allDemandSupply: res.data.supplys, totalDemandSupply: res.data.count }) })
}
onSearchButtonHandler(){
Taro.showLoading({title:'加载中'}) .then(() => {
setTimeout(() => {
this.searchDemandSupply({})
}, 1000);
}) })
@ -112,28 +123,28 @@ class MySupplyDemand extends Component {
.then(res => { .then(res => {
if (res.data.err_msg == 'success') { if (res.data.err_msg == 'success') {
console.log('删除成功') console.log('删除成功')
this.setState({ toastContent: '删除成功', isToast: true }, () => { Taro.showToast({
setTimeout(() => { title: '删除成功'
this.setState({ isToast: false }) }).then(() => {
this.getMySupplyDemand({}) this.getMySupplyDemand({})
}, 2000)
}) })
} else {
this.setState({ toastContent: res.data.err_msg, isToast: true }, () => {
setTimeout(() => {
this.setState({ isToast: false })
}, 2000) } else {
Taro.showToast({
title: res.data.err_msg,
icon: 'none'
}) })
} }
} }
) )
.catch(error => { .catch(error => {
this.setState({ toastContent: '删除失败', isToast: true }, () => {
setTimeout(() => { Taro.showToast({
this.setState({ isToast: false }) title: '删除失败',
}, 2000) icon: 'none'
}) })
}) })
} }
@ -153,6 +164,8 @@ class MySupplyDemand extends Component {
demSupplyCateChange = e => { demSupplyCateChange = e => {
this.setState({ this.setState({
demandSupplyCateSelected: this.state.demandSupplyCate[e.detail.value] demandSupplyCateSelected: this.state.demandSupplyCate[e.detail.value]
}, () => {
console.log(this.state.demandSupplyCateSelected)
}) })
} }
// 修改供求状态 // 修改供求状态
@ -198,14 +211,18 @@ class MySupplyDemand extends Component {
// 编辑我的供求 // 编辑我的供求
// 跳转到我的供求编辑页面 // 跳转到我的供求编辑页面
goToMyDSEditPage(){ goToMyDSEditPage() {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit' url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
}) })
} }
// 转到供求查看页面
goToSupplyDemandPage(){
Taro.navigateTo({
url: '/pages/supplyDemandView/supplyDemandView'
})
}
//查看我的供求 //查看我的供求
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
@ -213,7 +230,14 @@ class MySupplyDemand extends Component {
} }
componentDidMount() { componentDidMount() {
Taro.showLoading({title:'加载中'}) .then(() => {
this.getMySupplyDemand({}) this.getMySupplyDemand({})
})
} }
componentWillUnmount() { } componentWillUnmount() { }
@ -232,12 +256,7 @@ class MySupplyDemand extends Component {
</AtModalContent> </AtModalContent>
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}></Button> </AtModalAction> <AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}></Button> </AtModalAction>
</AtModal> </AtModal>
// 轻提示
const toastElement = <AtToast
isOpened={this.state.isToast}
text={this.state.toastContent}
duration={2000}
></AtToast>
const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => { const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => {
return <View key={index} className='info-container'> return <View key={index} className='info-container'>
<View className='type'> <View className='type'>
@ -265,10 +284,10 @@ class MySupplyDemand extends Component {
<Text className='info'>{item.update_date}</Text> <Text className='info'>{item.update_date}</Text>
</View> </View>
<View className='info-button-box'> <View className='info-button-box'>
<View className='button'> <View className='button' onClick={this.goToSupplyDemandPage.bind(this)}>
<AtButton type='primary' size='small'>查看</AtButton> <AtButton type='primary' size='small'>查看</AtButton>
</View> </View>
<View className='button'onClick={this.goToMyDSEditPage.bind(this)} > <View className='button' onClick={this.goToMyDSEditPage.bind(this)} >
<AtButton type='primary' size='small'>编辑</AtButton> <AtButton type='primary' size='small'>编辑</AtButton>
</View> </View>
<View className='button' onClick={this.handleOnDelete.bind(this, item.sd_id, item.sd_title)}> <View className='button' onClick={this.handleOnDelete.bind(this, item.sd_id, item.sd_title)}>
@ -285,18 +304,17 @@ class MySupplyDemand extends Component {
<View className='mySupplyDemand'> <View className='mySupplyDemand'>
{/* 是否删除供求确认框 */} {/* 是否删除供求确认框 */}
{modalMessageConfirmElement} {modalMessageConfirmElement}
{/* 轻提示 */}
{toastElement}
{/* 供求类型 */} {/* 供求类型 */}
<View className='page-section'> <View className='page-section'>
<View> <View>
<Picker mode='selector' range={this.state.demandSupplyCate} onChange={this.demSupplyCateChange.bind(this)}> <Picker mode='selector' rangeKey='name' range={this.state.demandSupplyCate} onChange={this.demSupplyCateChange.bind(this)}>
<View className='picker'> <View className='picker'>
<View className='title-box'> <View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyCateSelected}</Text> <Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyCateSelected.name}</Text>
</View> </View>
</View> </View>
</Picker> </Picker>
@ -306,10 +324,10 @@ class MySupplyDemand extends Component {
<View className='page-section'> <View className='page-section'>
<View> <View>
<Picker mode='selector' range={this.state.demandSupplyState} onChange={this.demSupplyStateChange.bind(this)}> <Picker mode='selector' rangeKey='name' range={this.state.demandSupplyState} onChange={this.demSupplyStateChange.bind(this)}>
<View className='picker'> <View className='picker'>
<View className='title-box'> <View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyStatesSelected}</Text> <Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyStatesSelected.name}</Text>
</View> </View>
</View> </View>
@ -351,7 +369,7 @@ class MySupplyDemand extends Component {
</View> </View>
<View className='button-box'> <View className='button-box'>
<View className='button' onClick={this.searchDemandSupply.bind(this)}> <View className='button' onClick={this.onSearchButtonHandler.bind(this)}>
<AtButton type='primary' size='small'> <AtButton type='primary' size='small'>
<AtIcon value='search' size='12' color='white'></AtIcon> <AtIcon value='search' size='12' color='white'></AtIcon>
搜索</AtButton> 搜索</AtButton>
@ -370,7 +388,7 @@ class MySupplyDemand extends Component {
<copyrightComponent></copyrightComponent> <CopyrightComponent></CopyrightComponent>
</View> </View>
) )

View File

@ -27,7 +27,7 @@ class Shop extends Component {
filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], //筛选选项 filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], //筛选选项
filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, // 筛选选项对应值 filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, // 筛选选项对应值
selectedFilterValue: 0, //筛选项 selectedFilterValue: 0, //筛选项
isShowFilter: true, //是否显示侧边筛选 isShowFilter: false, //是否显示侧边筛选
showShopHomePage: true,// 是否显示首页页面 showShopHomePage: true,// 是否显示首页页面
shopDescriptionData: '',// 店铺详情信息 shopDescriptionData: '',// 店铺详情信息
shopName: '',//店铺名称 shopName: '',//店铺名称
@ -54,7 +54,7 @@ class Shop extends Component {
otherType: [],//侧边其他类型 otherType: [],//侧边其他类型
widthType: [],// 侧边宽度类型 widthType: [],// 侧边宽度类型
checkedFilterIdList: [],//已选的筛选id checkedFilterIdList: [],//已选的筛选id
isLoading: false,
// 下面是函数的默认参数 // 下面是函数的默认参数
curr_page: 1, curr_page: 1,
page_count: 10, page_count: 10,
@ -110,17 +110,14 @@ class Shop extends Component {
.then(res => { .then(res => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
console.log('筛选项目成功', res) console.log('筛选项目成功', res)
Taro.hideLoading()
this.formatFilterData(res.data).then(data => { this.formatFilterData(res.data).then(data => {
this.setState({ this.setState({
sideFilterdata: data, sideFilterdata: data,
mainType: data.mainType || [], mainType: data.mainType || [],
goodType: data.goodType || [], goodType: data.goodType || [],
otherType: data.otherType || [], otherType: data.otherType || [],
widthType: data.widthType || [], widthType: data.widthType || [],
isLoading: false
}) })
console.log('formated data', data) console.log('formated data', data)
}) })
@ -226,7 +223,8 @@ class Shop extends Component {
} }
}) })
.then(res => { .then(res => {
this.setState({ shopItem: res.data.goods, total: res.data.goodsCount, filterCondition: order, isLoading: false }, () => { Taro.hideLoading()
this.setState({ shopItem: res.data.goods, total: res.data.goodsCount, filterCondition: order }, () => {
}) })
@ -247,6 +245,8 @@ class Shop extends Component {
} }
}) })
.then(res => { .then(res => {
Taro.hideLoading()
this.setState({ this.setState({
shopDescriptionData: res.data, shopDescriptionData: res.data,
shopName: res.data.data.shop_name, shopName: res.data.data.shop_name,
@ -277,6 +277,8 @@ class Shop extends Component {
}) })
.then(res => { .then(res => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
Taro.hideLoading()
const originalData = res.data.data const originalData = res.data.data
const sortedData = [] const sortedData = []
for (let item in originalData) { for (let item in originalData) {
@ -301,6 +303,7 @@ class Shop extends Component {
// 产品排序 // 产品排序
accendingDescending(value) { accendingDescending(value) {
Taro.showLoading({ title: '加载中' })
this.setState({ selectedFilterValue: value }) this.setState({ selectedFilterValue: value })
if (value == 0) { if (value == 0) {
this.setState({ this.setState({
@ -390,8 +393,7 @@ class Shop extends Component {
// 选择侧边筛选的标签 // 选择侧边筛选的标签
selectTag(name) { selectTag(name) {
const id = name.name const id = name.name
console.log('clicked ID', id) Taro.showLoading({ title: '加载中' })
this.setState({ isLoading: true })
// 处理分类筛选项 // 处理分类筛选项
const newMainType = this.state.mainType.map((item) => { const newMainType = this.state.mainType.map((item) => {
if (item.id === id) { if (item.id === id) {
@ -428,6 +430,7 @@ class Shop extends Component {
value[each].checked = !value[each].checked value[each].checked = !value[each].checked
setTimeout(() => { setTimeout(() => {
this.setState({ checkedFilterIdList: this.state.checkedFilterIdList.concat(value[each]), goodsParam: [{ param_id: value[each].name.id, param_value: value[each].name }] }, () => { this.setState({ checkedFilterIdList: this.state.checkedFilterIdList.concat(value[each]), goodsParam: [{ param_id: value[each].name.id, param_value: value[each].name }] }, () => {
this.getSearchParams({ goodsParam: this.state.goodsParam }) this.getSearchParams({ goodsParam: this.state.goodsParam })
this.goodsSearch({ goodsParam: this.state.goodsParam }) this.goodsSearch({ goodsParam: this.state.goodsParam })
@ -456,6 +459,7 @@ class Shop extends Component {
} }
handleOnPageChange(value) { handleOnPageChange(value) {
Taro.showLoading({ title: '加载中' })
this.setState({ currentPage: value.current }) this.setState({ currentPage: value.current })
this.goodsSearch({ curr_page: value.current, order: this.state.filterCondition }) this.goodsSearch({ curr_page: value.current, order: this.state.filterCondition })
} }
@ -470,6 +474,8 @@ class Shop extends Component {
} }
handleShopInnerCate(id) { handleShopInnerCate(id) {
Taro.showLoading({ title: '加载中' })
this.setState({ this.setState({
isShowShopAllCate: false, isBlurWindow: false isShowShopAllCate: false, isBlurWindow: false
}) })
@ -483,6 +489,8 @@ class Shop extends Component {
//重置按键筛选 //重置按键筛选
resetFilterList() { resetFilterList() {
Taro.showLoading({ title: '加载中' })
this.setState({ this.setState({
checkedFilterIdList: [], curr_page: 1, checkedFilterIdList: [], curr_page: 1,
page_count: 10, page_count: 10,
@ -515,6 +523,9 @@ class Shop extends Component {
} }
componentDidMount() { componentDidMount() {
Taro.showLoading({ title: '加载中' })
//页面加载之后 得到指定店铺的商品 和 筛选标签 //页面加载之后 得到指定店铺的商品 和 筛选标签
this.goodsSearch({ shop_id: this.$router.params.id }) // 加载店铺商品 this.goodsSearch({ shop_id: this.$router.params.id }) // 加载店铺商品
this.getSearchParams({})// 加载筛选项 this.getSearchParams({})// 加载筛选项
@ -528,11 +539,7 @@ class Shop extends Component {
componentDidHide() { } componentDidHide() { }
render() { render() {
const loadingElement = <AtToast
isOpened={this.state.isLoading}
status='loading'
text='加载中'
></AtToast>
const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => { const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => {
return <View key={index} className='shop-item' > return <View key={index} className='shop-item' >
<ShopItem item={item}></ShopItem> <ShopItem item={item}></ShopItem>
@ -699,7 +706,7 @@ class Shop extends Component {
}) })
return ( return (
<View className='shop' > <View className='shop' >
{loadingElement}
<View onClick={this.state.closeBgWindow.bind(this)} className={this.state.isBlurWindow ? 'show-blur' : ''}></View> <View onClick={this.state.closeBgWindow.bind(this)} className={this.state.isBlurWindow ? 'show-blur' : ''}></View>
<View className='banner-box'> <View className='banner-box'>
<Image src={URL.Base + 'Public/visual_editing/img/ksh_bg.jpg'} mode='scaleToFill' style='width: 100%;height:120px; ' /> <Image src={URL.Base + 'Public/visual_editing/img/ksh_bg.jpg'} mode='scaleToFill' style='width: 100%;height:120px; ' />

View File

@ -19,10 +19,10 @@ class SupplyDemand extends Component {
constructor() { constructor() {
super(...arguments) super(...arguments)
this.state = { this.state = {
demandingSupplyCate: ['需求', '供应', '人才'], //供求类型选择 demandingSupplyCate: [{name:'需求',id:1}, {name:'供应',id:2}, {name:'人才',id:3}], //供求类型选择
demandingSupplyCateSelected: '需求',// 当前供求类型 demandingSupplyCateSelected: {name:'需求',id:1},// 当前供求类型
demandingSupplyState: ['上架', '下架'], // 状态选择 demandingSupplyState: [{name:'上架',id:1}, {name:'下架',id:0}], // 状态选择
demandingSupplyStateSelected: '上架',// 当前状态 demandingSupplyStateSelected: {name:'上架',id:1},// 当前状态
title: '', title: '',
contactName: '', contactName: '',
contactNumber: '', contactNumber: '',
@ -44,13 +44,13 @@ class SupplyDemand extends Component {
console.log(this.state.ImagesInfo) console.log(this.state.ImagesInfo)
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.contactAddress && this.state.content && this.state.demandingSupplyStateSelected) { if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.contactAddress && this.state.content && this.state.demandingSupplyStateSelected) {
this.uploadDemSup({ this.uploadDemSup({
sd_type:"2", sd_type:this.state.demandingSupplyCateSelected,
sd_title:this.state.title, sd_title:this.state.title,
user_name:this.state.contactName, user_name:this.state.contactName,
user_phone:this.state.contactNumber, user_phone:this.state.contactNumber,
user_address:this.state.contactAddress, user_address:this.state.contactAddress,
sd_desc:this.state.content, sd_desc:this.state.content,
state:"1"}) state:this.state.demandingSupplyStateSelected})
} else { } else {
this.setState({ uploadDemSupTextTip: '请填写完表格', isUploadDemSupSuccess: true }, () => { this.setState({ uploadDemSupTextTip: '请填写完表格', isUploadDemSupSuccess: true }, () => {
setTimeout(() => { setTimeout(() => {
@ -223,10 +223,10 @@ class SupplyDemand extends Component {
<View className='page-section'> <View className='page-section'>
<View> <View>
<Picker mode='selector' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}> <Picker mode='selector' rangeKey='name' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}>
<View className='picker'> <View className='picker'>
<View className='title-box'> <View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingSupplyCateSelected}</Text> <Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingSupplyCateSelected.name}</Text>
</View> </View>
</View> </View>
@ -306,10 +306,10 @@ class SupplyDemand extends Component {
<View className='page-section'> <View className='page-section'>
<View> <View>
<Picker mode='selector' range={this.state.demandingSupplyState} onChange={this.demSupplyStateChange}> <Picker mode='selector' rangeKey='name' range={this.state.demandingSupplyState} onChange={this.demSupplyStateChange}>
<View className='picker'> <View className='picker'>
<View className='title-box'> <View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingSupplyStateSelected}</Text> <Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingSupplyStateSelected.name}</Text>
</View> </View>
</View> </View>

View File

@ -0,0 +1,38 @@
//supplyDemandItemView
import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import './supplyDemandView.scss'
class SupplyDemandView extends Component {
config = {
navigationBarTitleText: '单独供求'
}
componentDidMount(){
}
componentWillReceiveProps (nextProps) {
console.log(this.props, nextProps)
}
componentWillUnmount () { }
componentDidShow () { }
componentDidHide () { }
render () {
return (
<View className='SupplyDemandItemView'>
单独供求
</View>
)
}
}
export default SupplyDemandView

View File

@ -36,11 +36,19 @@ const URL = {
// 商品列表的api 接口 GoodsList-goodsDelete // 商品列表的api 接口 GoodsList-goodsDelete
DeleteGood: LOCALURL + 'GoodsList-goodsDelete',// 删除商品列表接口 DeleteGood: LOCALURL + 'GoodsList-goodsDelete',// 删除商品列表接口
ChangeGoodState: LOCALURL + 'GoodsList-setGoodsState',// 改变商品列表状态 (下架) ChangeGoodState: LOCALURL + 'GoodsList-setGoodsState',// 改变商品列表状态 (下架)
BaoBeiCateList: LOCALURL + 'GoodsList-wxSales',// 获取宝贝类目列表
// 我的供求页面接口Supply-myList // 我的供求页面接口Supply-myList
SearchDemandSupply: LOCALURL + 'Supply-myList',// 搜索我的供求接口 SearchDemandSupply: LOCALURL + 'Supply-myList',// 搜索我的供求接口
DeleteDemandSupply: LOCALURL + 'Supply-delete',// 删除我的供求接口 DeleteDemandSupply: LOCALURL + 'Supply-delete',// 删除我的供求接口
// 商品编辑页面 Goods-wxEditPhoneDeploy
GetProductInfo: LOCALURL + 'Goods-wxEditPhoneDeploy',// 获取商品信息
} }
module.exports = URL module.exports = URL

View File

@ -1,35 +1,27 @@
todo list todo list
首页: 首页:
优惠卷和询价接口
联系人和联系电话 改动?
店铺页面:
侧边筛选
商品发布页面: 商品发布页面:
商品分类三级联动 // 有bug 商品分类三级联动 // 有bug
店铺分类选项 二级联动// 需要修改 店铺分类选项 二级联动// 需要修改
商品价格无法设定为数字 // 有bug 商品价格无法设定为数字 // 有bug
供求发布页面 供求发布页面
等待后台- 供求类型 和供求状态
联系电话无法设置为数字 // 有bug type=password 可以 联系电话无法设置为数字 // 有bug type=password 可以
全部业主需求页面: 全部业主需求页面:
供求状态和行业分类--等待后台接口--搜索 行业分类--等待后台接口--搜索 二级联动--
我的供求页面: 我的供求页面:
搜索接口--等待后台
我的供求查看页面 我的供求查看页面
我的供求编辑页面--等待后台接口数据 我的供求编辑页面--等待后台接口数据
我的商品列表页面 我的商品列表页面
等待后台的搜索- 宝贝类目
商品价格无法设定为数字 // 有bug 商品价格无法设定为数字 // 有bug
商品编辑页面 商品编辑页面
等待后台api 店铺分类--二级联动
alldemanding 接口问题:
优惠卷和询价