diff --git a/src/app.js b/src/app.js
index 347a518..b5dab47 100644
--- a/src/app.js
+++ b/src/app.js
@@ -29,6 +29,7 @@ class App extends Component {
'pages/allDemanding/allDemanding',// 所有供求页面
'pages/myGoodList/myGoodList',// 我的商品列表页面
'pages/myDemandSupplyEdit/myDemandSupplyEdit',// 我的供求编辑页面
+ 'pages/supplyDemandView/supplyDemandView',// 查看单个供求页面
// 'pages/shopDescription/shopDescription',
],
window: {
diff --git a/src/component/filteredShopComponent/filteredShopComponent.js b/src/component/filteredShopComponent/filteredShopComponent.js
index 6cff813..1ba2cee 100644
--- a/src/component/filteredShopComponent/filteredShopComponent.js
+++ b/src/component/filteredShopComponent/filteredShopComponent.js
@@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Image } from '@tarojs/components'
-import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtInput, AtToast, AtNoticebar } from 'taro-ui'
+import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtInput, AtNoticebar } from 'taro-ui'
import './filteredShopComponent.scss'
@@ -23,11 +23,12 @@ class recommondShop extends Component {
isOpenVouhcer: false,
isOpenConsult: false,
consultTip: '',
- isToast: false,
- consultResponseMsg: '',
voucherResponseMsg: '',
voucherCanConsult: false,
-
+ voucherName:this.props.userName,
+ voucherPhone:this.props.userPhone,
+ consultName:this.props.userName,
+ consultPhone:this.props.userPhone,
}
}
goToShop(value) {
@@ -91,7 +92,6 @@ class recommondShop extends Component {
}
// api 购买咨询 BuyConsult
buyConsult({ user = "杨夕兵", phone = "18950295811", shops = ["1306"], source_type = "2", source_level = 1, coupons_flag = 0 }) {
-
Taro.request({
url: URL.BuyConsult,
method: 'POST',
@@ -112,25 +112,15 @@ class recommondShop extends Component {
}
})
.then(res => {
- console.log('购买咨询请求', res)
- if (res.err_code === 0 && res.err_msg === "success") {
- this.setState({ consultResponseMsg: '成功' }, () => {
- this.setState({ isToast: true })
- })
- // 延迟3秒 后将toast 关掉
- setTimeout(() => {
- this.setState({ isToast: false })
- }, 3000);
-
+ console.log('购买咨询请求成功', res)
+ if (res.statusCode === 200) {
+ Taro.showToast({ title: res.data.err_msg,icon:'success' })
} else {
- this.setState({ consultResponseMsg: res.data.err_msg }, () => {
- this.setState({ isToast: true })
- })
- setTimeout(() => {
- this.setState({ isToast: false })
- }, 3000);
-
+ Taro.showToast({ title: res.data.err_msg,icon:'none' })
+
}
+ }).catch(err=>{
+ console.log('购买咨询请求失败', err)
})
}
@@ -144,7 +134,7 @@ class recommondShop extends Component {
}
voucherModalConfirm() {
this.setState({ isOpenVouhcer: false })
- this.buyConsult({})
+ this.buyConsult({user:this.state.voucherName,phone:this.state.voucherPhone})
}
// 咨询弹框。取消。确认
isOpenConsult() {
@@ -156,9 +146,20 @@ class recommondShop extends Component {
}
consultModalConfirm() {
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) {
@@ -201,18 +202,20 @@ class recommondShop extends Component {
当前优惠卷{voucherLeft}张
{!this.state.voucherCanConsult ? {this.state.voucherResponseMsg} : null}
@@ -229,36 +232,30 @@ class recommondShop extends Component {
- // 请提示元素
- const toast =
+
return (
{voucherModalElement}
{consultModalElement}
- {toast}
+
diff --git a/src/pages/allDemanding/allDemanding.js b/src/pages/allDemanding/allDemanding.js
index 37693ce..e19c0ab 100644
--- a/src/pages/allDemanding/allDemanding.js
+++ b/src/pages/allDemanding/allDemanding.js
@@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
-import { View, Text, Image,Button } from '@tarojs/components'
-import { AtInput, AtButton, Picker, AtIcon, AtLoadMore, AtModal, AtToast,AtModalHeader ,AtModalContent ,AtModalAction } from 'taro-ui'
+import { View, Text, Image, Button } from '@tarojs/components'
+import { AtInput, AtButton, Picker, AtIcon, AtLoadMore, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config'
@@ -18,13 +18,14 @@ class AllDemanding extends Component {
super(...arguments)
this.state = {
supplys: [], // 需求列表
- isMore: 'more', // 上拉加载状态
- demandingState: ['全部', '在用', '已抢单', '已抢光'], // 供求状态选择
- demandingStateSelected: '全部', // 当前供求状态
+ isMore: 'more', // 加载状态
+ demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
+ demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
industryCate: ['全部', '制定家具', '成品家具', '办公家具', '设计'], // 行业分类状态选择
industryCateSelected: '全部', // 当前行业分类状态
- startDateSel: '2018-04-22',
- endDateSel: '2018-04-22',
+ startDateSel: '',
+ endDateSel: '',
+ classId: '',
isOpenedGrabModal: false,
grabOrderId: '',//抢到订单的id
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({
url: URL.GetAllDemanding,
method: 'POST',
@@ -40,7 +49,11 @@ class AllDemanding extends Component {
data: {
param: JSON.stringify({
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: {
@@ -50,21 +63,53 @@ class AllDemanding extends Component {
})
.then(res => {
if (res.data.supplys.length) {
- const newSupplys = this.state.supplys.concat(res.data.supplys)
- this.setState({ supplys: newSupplys, isMore: 'more' })
+ Taro.hideLoading()
+ this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isMore: 'more' })
} else {
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() {
this.setState({ isMore: 'loading' })
setTimeout(() => {
currentPage += 1
- this.GetAllDemanding({ curr_page: currentPage })
-
+ this.loadMoreDemanding({ curr_page: currentPage })
}, 1000);
}
// 改变需求选项
@@ -83,7 +128,7 @@ class AllDemanding extends Component {
onStartDateChange = e => {
this.setState({
startDateSel: e.detail.value,
-
+
})
}
// 改变结束日期
@@ -134,13 +179,26 @@ class AllDemanding extends Component {
this.GrabDemand({ demandId: this.state.grabOrderId })
}
+ searchHanlder() {
+
+ Taro.showLoading({ title: '加载中' }).then(() => {
+ setTimeout(() => {
+ this.searchDemanding({})
+ }, 1000);
+
+ })
+
+ }
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
componentDidMount() {
// 得到第一页需求数据
- this.GetAllDemanding({})
+ Taro.showLoading({ title: '加载中' }).then(() => {
+ this.searchDemanding({})
+ })
+
}
@@ -152,20 +210,20 @@ class AllDemanding extends Component {
render() {
// 提示模态弹窗element
-
- const modalMessageGrabElement=
- 提示
-
- 确认抢单?
+
+ const modalMessageGrabElement =
+ 提示
+
+ 确认抢单?
-
-
+
+
// 抢单返回轻提示
const grabOrderSuccessElement =
const allDemandingElementArray = this.state.supplys ? this.state.supplys.map((item, index) => {
return
@@ -207,26 +265,26 @@ class AllDemanding extends Component {
{/* 供求状态选择 */}
-
+
- *供求状态: {this.state.demandingStateSelected}
+ *供求状态: {this.state.demandingStateSelected.name}
-
+
*
{/* 开始和结束日期选择 */}
@@ -260,7 +318,7 @@ class AllDemanding extends Component {
-
+
@@ -272,10 +330,10 @@ class AllDemanding extends Component {
{allDemandingElementArray}
diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js
index 425476f..52edb23 100644
--- a/src/pages/goodsPublish/goodsPublish.js
+++ b/src/pages/goodsPublish/goodsPublish.js
@@ -105,7 +105,10 @@ class GoodsPublish extends Component {
}
// 发布商品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 = []
@@ -155,22 +158,26 @@ class GoodsPublish extends Component {
}
})
.then(res => {
- this.setState({ uploadProductTextTip: '发布成功', isUploadProductSuccess: true }, () => {
- setTimeout(() => {
- this.setState({ isUploadProductSuccess: false })
- Taro.navigateTo({
- url: '/pages/goodsPublish/goodsPublish'
- })
- }, 2000)
+ Taro.hideLoading()
+ Taro.showToast({
+ title: '发布成功',
+ icon: 'success',
+ duration: 1000
})
+ setTimeout(() => {
+ Taro.navigateTo({
+ url: '/pages/goods/goods?id=5cf3Ptn5wKQdyPpwsSe2nDKnN4QDFdz8moPTf+QIOm788Q'// 虚拟地址
+ })
+ }, 1000);
console.log('上传商品', res)
}
)
.catch(error => {
- this.setState({ uploadProductTextTip: '发布失败', isUploadProductSuccess: true }, () => {
- setTimeout(() => {
- this.setState({ isUploadProductSuccess: false })
- }, 2000)
+ Taro.hideLoading()
+ Taro.showToast({
+ title: '保存失败',
+ icon: 'none',
+ duration: 1000
})
})
}
@@ -247,10 +254,12 @@ class GoodsPublish extends Component {
const imagePath = URL.Base + data.file_path
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
const newImageInfo = that.state.ImagesInfo.concat(data)
- that.setState({ pickerImageUrl: newPickerImageUrl, isUploadImageSuccess: true, uploadImageTextTip: '图片上传成功', ImagesInfo: newImageInfo }, () => {
- setTimeout(() => {
- that.setState({ isUploadImageSuccess: false })
- }, 2000)
+ that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo }, () => {
+ Taro.showToast({
+ title: '上传成功',
+ icon: 'success',
+ duration: 2000
+ })
})
}
})
@@ -258,10 +267,10 @@ class GoodsPublish extends Component {
if (operationType === 'remove') {
this.state.pickerImageUrl.splice(index, 1);
this.setState({ files: this.state.pickerImageUrl });
- that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' }, () => {
- setTimeout(() => {
- that.setState({ isUploadImageSuccess: false })
- }, 2000)
+ Taro.showToast({
+ title: '删除成功',
+ icon: 'success',
+ duration: 2000
})
}
}
@@ -274,20 +283,21 @@ class GoodsPublish extends Component {
}
onClickUploadGoods() {
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) {
- this.uploadGoods({
- goods_name: this.state.productName,
- goods_price: this.state.productPrice,
- goods_unit: this.state.productUnit,
- goods_profiles: this.state.productDescript,
- class_id: "10103",
- shop_class_id: this.state.shopCategoryCheckedPicker,
- })
- } else {
- this.setState({ uploadProductTextTip: '请填写完表格', isUploadProductSuccess: true }, () => {
+ Taro.showLoading({ title: '发布中' }).then(() => {
setTimeout(() => {
- this.setState({ isUploadProductSuccess: false })
- }, 2000)
- })
+ this.uploadGoods({
+ goods_name: this.state.productName,
+ goods_price: this.state.productPrice,
+ goods_unit: this.state.productUnit,
+ goods_profiles: this.state.productDescript,
+ class_id: "10103",// to be continue
+ shop_class_id: this.state.shopCategoryCheckedPicker.id,
+ })
+ },1000)})
+
+ } else {
+
+ Taro.showToast({title:'请填写完表格',icon:'none'})
}
}
shopCategoryChanged(e) {
@@ -444,20 +454,11 @@ class GoodsPublish extends Component {
}
render() {
- const imageUploadSuccess =
- const productUploadSuccess =
+
+
return (
- {imageUploadSuccess}
- {productUploadSuccess}
+
diff --git a/src/pages/home/home.js b/src/pages/home/home.js
index 4869197..fa99ab5 100644
--- a/src/pages/home/home.js
+++ b/src/pages/home/home.js
@@ -1,11 +1,12 @@
import Taro, { Component } from '@tarojs/taro'
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 BottomNav from '../../component/bottomNav/bottomNav'
import URL from '../../serviceAPI.config'
import './home.scss'
+let currentPage = 1
class Home extends Component {
config = {
@@ -25,7 +26,10 @@ class Home extends Component {
grabOrderId: '',//抢到订单的id
isGrabOrderSuccess: false,// 是否显示轻提示
grabOrderSuccess: '',// 抢单成功返回字段
-
+ isMore: 'noMore',// 加载更多店铺
+ userName:'',//用户名字
+ userPhone:'',// 用户电话
+
}
}
@@ -36,6 +40,9 @@ class Home extends Component {
getHomeCategoriesInfo() {
Taro.request({
url: URL.ShopWxStore,
+ header: {
+ 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
+ }
})
.then(res => {
console.log('首页基本信息', res)
@@ -43,41 +50,53 @@ class Home extends Component {
ads: res.data.data.adsLb,
categories: res.data.data.supplyClass,
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 得到推荐商店的信息
- 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({
url: URL.ShopSupplyShops,
method: 'POST',
dataType: 'json',
data: {
param: JSON.stringify({
- curr_page: 1,
- page_count: 20,
+ 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: "2"
+ action: action
})
},
header: {
'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
})
.then(res => {
console.log('所有店铺的信息', res)
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
- login() {
+ // 异步函数登入api
+ async login() {
Taro.login({
success(res) {
if (res.code) {
@@ -102,7 +121,10 @@ class Home extends Component {
Taro.setStorageSync('userInfo', response.data.user_info)
}
- )
+ ).catch(err => {
+ console.log('登入微信失败', err)
+
+ })
}
else {
console.log('登录失败!' + res.errMsg)
@@ -148,7 +170,7 @@ class Home extends Component {
}
})
.then(res => {
- this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true }, () => {
+ this.setState({ grabOrderSuccess: res.data.err_msg, isGrabOrderSuccess: true }, () => {
setTimeout(() => {
this.setState({ isGrabOrderSuccess: false })
}, 2000)
@@ -160,12 +182,18 @@ class Home extends Component {
}
// 点击大类icon
onClickParentCate(item) {
+ const parentClass = item.parent_class_id
+ const childClass = item.class_id
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) {
- 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() {
@@ -188,13 +216,23 @@ class Home extends Component {
// 确认抢单之后
this.GrabDemand({ demandId: this.state.grabOrderId })
}
+ // 向上拉升延迟一秒加载数据
+ handleLoadMore() {
+ this.setState({ isMore: 'loading' })
+ setTimeout(() => {
+ currentPage += 1
+ this.getShops({ curr_page: currentPage })
+ }, 1000);
+ }
componentDidMount() {
// 页面加载后 得到首页的基本信息和推荐店铺的信息
Taro.showLoading({ title: '加载中' })
- this.getShops()
- this.getHomeCategoriesInfo()
- this.login()
+
+ this.login().then(() => {
+ this.getShops({})
+ this.getHomeCategoriesInfo()
+ }).catch(err => console.log('微信登入失败:', err))
}
@@ -219,22 +257,22 @@ class Home extends Component {
render() {
-
-// 提示模态弹窗element
- const modalMessageGrabElement=
- 提示
-
- 确认抢单?
+
+ // 提示模态弹窗element
+ const modalMessageGrabElement =
+ 提示
+
+ 确认抢单?
-
-
+
+
// 抢单返回轻提示
const grabOrderSuccessElement =
@@ -256,7 +294,7 @@ class Home extends Component {
业主:{item.user_name}
-
+
@@ -282,7 +320,7 @@ class Home extends Component {
}) : null
const shopCollectionElementsArray = this.state.shopsDetails.length ? this.state.shopsDetails.map((item, index) => {
- return
+ return
}) : null
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
@@ -406,11 +444,14 @@ class Home extends Component {
{shopCollectionElementsArray}
- {this.state.shopsDetails.length !== 0 ?
- 沒有更多了...
- :
- 没有找到...
- }
+
+
+
diff --git a/src/pages/index/index.js b/src/pages/index/index.js
index 1091d3c..5422cc4 100644
--- a/src/pages/index/index.js
+++ b/src/pages/index/index.js
@@ -30,9 +30,9 @@ class Index extends Component {
componentDidMount(){
Taro.navigateTo({
// url: '/pages/goodsPublish/goodsPublish'
- url: '/pages/home/home'
+ //url: '/pages/goodsPublish/goodsPublish'
// url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
- // url: '/pages/home/home'
+ url: '/pages/mySupplyDemand/mySupplyDemand'
// url:'/pages/supplyDemandPublish/supplyDemandPublish'
})
}
diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js
index f7abbb0..b85b437 100644
--- a/src/pages/myGoodList/myGoodList.js
+++ b/src/pages/myGoodList/myGoodList.js
@@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
-import { View, Radio, } from '@tarojs/components'
-import { AtInput, Text, AtButton, AtIcon, Picker, Image, AtPagination,AtToast } from 'taro-ui'
+import { View, Radio, } from '@tarojs/components'
+import { AtInput, Text, AtButton, AtIcon, Picker, Image, AtPagination, AtToast } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config'
@@ -22,8 +22,8 @@ class MyGoodList extends Component {
minimumSold: '',
maximumSold: '',
productId: '',
- productCate: ['全部类目', '衣柜', '人工服务', '开料机', '书柜', '橱柜', '更衣室'],
- productCateSelected: '全部类目',
+ productCate: [], //宝贝类目
+ productCateSelected: { class_Id: '', class_name: '全部类目' },// 已选宝贝类目
filterBar: ['filterPrice', 'filterStock', 'filterSold', 'filterPublishDate',], //筛选选项
filterBarKeys: { filterPrice: '价格', filterStock: '库存', filterSold: '总销量', filterPublishDate: '发布时间' }, // 筛选选项对应值
filterOptions: {
@@ -39,10 +39,10 @@ class MyGoodList extends Component {
goodsStateParam: 1,//商品状态参数
pageCountParam: 10,// 商品数量参数
currPageParam: 1,// 当前页面 参数
- isCheckAll:false,// 是否checked
- goodsIdList:[],//商品Id 列表
- isToast:false,// 是否显示轻提示
- toastText:''// 轻提示字段
+ isCheckAll: false,// 是否checked
+ goodsIdList: [],//商品Id 列表
+ isToast: false,// 是否显示轻提示
+ toastText: ''// 轻提示字段
}
@@ -72,6 +72,28 @@ class MyGoodList extends Component {
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
getMyGoodListApi({ goodsState = this.state.goodsStateParam, pageCount = this.state.pageCountParam, currPage = this.state.currPageParam }) {
Taro.request({
@@ -91,10 +113,10 @@ class MyGoodList extends Component {
}
}).then(res => {
if (res.statusCode === 200) {
- console.log('我的商品列表', JSON.parse(res.data))
+ console.log('我的商品列表', JSON.parse(res.data))
const data = JSON.parse(res.data)
data.goods.forEach(item => {
- item.checked=false
+ item.checked = false
});
const goodCount = Number(data.goodsCount)
this.setState({
@@ -111,7 +133,20 @@ class MyGoodList extends Component {
}
// 获取搜索结果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({
url: URL.MyGoodList,
method: 'POST',
@@ -156,7 +191,7 @@ class MyGoodList extends Component {
}
// 商品列表下架API
- changeGoodState({goodsState=0,goodsID= this.state.goodsIdList }) {
+ changeGoodState({ goodsState = 0, goodsID = this.state.goodsIdList }) {
Taro.request({
url: URL.ChangeGoodState,
method: 'POST',
@@ -164,7 +199,7 @@ class MyGoodList extends Component {
data: {
goodsState: goodsState,
- goodsID:JSON.stringify(goodsID)
+ goodsID: JSON.stringify(goodsID)
},
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
@@ -173,15 +208,15 @@ class MyGoodList extends Component {
}
}).then(res => {
if (res.statusCode === 200) {
- console.log('商品状态返回', res)
- this.setState({isToast:true,toastText:'下架成功'},()=>{
+ console.log('商品状态返回', res)
+ this.setState({ isToast: true, toastText: '下架成功' }, () => {
setTimeout(() => {
- this.setState({isToast:false})
+ this.setState({ isToast: false })
this.getMyGoodListApi({})// 从新获取商品列表数据
}, 2000);
})
-
-
+
+
} else {
console.log('我的商品列表获取失败')
}
@@ -191,7 +226,7 @@ class MyGoodList extends Component {
}
// 商品列表删除api
- deleteGood({goodsState=1,goodsID= this.state.goodsIdList }) {
+ deleteGood({ goodsState = 1, goodsID = this.state.goodsIdList }) {
Taro.request({
url: URL.DeleteGood,
method: 'POST',
@@ -199,7 +234,7 @@ class MyGoodList extends Component {
data: {
goodsState: goodsState,
- goodsID:JSON.stringify(goodsID)
+ goodsID: JSON.stringify(goodsID)
},
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
@@ -208,16 +243,16 @@ class MyGoodList extends Component {
}
}).then(res => {
if (res.statusCode === 200) {
- console.log('商品删除返回', res)
- this.setState({isToast:true,toastText:'删除成功'},()=>{
+ console.log('商品删除返回', res)
+ this.setState({ isToast: true, toastText: '删除成功' }, () => {
setTimeout(() => {
- this.setState({isToast:false})
+ this.setState({ isToast: false })
this.getMyGoodListApi({})// 从新获取商品列表数据
}, 2000);
})
-
-
-
+
+
+
} else {
console.log('我的商品列表获取失败')
}
@@ -247,7 +282,7 @@ class MyGoodList extends Component {
minimumSold: '',
maximumSold: '',
productId: '',
- productCateSelected: '全部类目',
+ productCateSelected: { class_Id: '', class_name: '全部类目' },
})
}
// 产品排序
@@ -312,81 +347,83 @@ class MyGoodList extends Component {
this.state.filterOptions.filterPublishDate ? this.getGoodListResultApi({ order: "update_date desc" }) : this.getGoodListResultApi({ order: "update_date" })
}
)
-
}
-
}
-
+
// 翻页导航
paginationNav(type) {
-
- this.setState({ currentPage: type.current,isCheckAll:false }, () => {
+ this.setState({ currentPage: type.current, isCheckAll: false }, () => {
this.getMyGoodListApi({ currPage: this.state.currentPage })
})
}
// 商品全部选择
- checkAllHandler(){
- const newMyGoodList=this.state.myGoodList.map((item)=>{
- item.checked=!this.state.isCheckAll
+ checkAllHandler() {
+ const newMyGoodList = this.state.myGoodList.map((item) => {
+ item.checked = !this.state.isCheckAll
return item
- })
- this.setState({isCheckAll:!this.state.isCheckAll,myGoodList:newMyGoodList})
-
+ })
+ this.setState({ isCheckAll: !this.state.isCheckAll, myGoodList: newMyGoodList })
+
}
// 单个商品选择
handleCheckChange(Id) {
//如果goodid 一样的那么checked 就取反
- const newMyGoodList=this.state.myGoodList.map((item)=>{
- if(item.goods_id===Id){
- item.checked=!item.checked
- }
- return item
+ const newMyGoodList = this.state.myGoodList.map((item) => {
+ if (item.goods_id === Id) {
+ item.checked = !item.checked
+ }
+ return item
})
- this.setState({myGoodList:newMyGoodList})
+ this.setState({ myGoodList: newMyGoodList })
}
-// 删除商品
- deleteGoodsHandler(){
- const checkedGoodsId=[]
+ // 删除商品
+ deleteGoodsHandler() {
+ const checkedGoodsId = []
this.state.myGoodList.forEach(item => {
- if(item.checked){
+ if (item.checked) {
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(() => {
- this.setState({isToast:false})
+ this.setState({ isToast: false })
}, 2000);
})
}
-// 改变商品状态
- offStockGoodHandler(){
- const checkedGoodsId=[]
- this.state.myGoodList.forEach(item => {
- if(item.checked){
- checkedGoodsId.push(item.goods_id)
- }
- });
- checkedGoodsId.length?this.changeGoodState({goodsID:checkedGoodsId}):this.setState({isToast:true,toastText:'请选择要下架的商品'},()=>{
- setTimeout(() => {
- this.setState({isToast:false})
- }, 2000);
+ // 改变商品状态
+ offStockGoodHandler() {
+ const checkedGoodsId = []
+ this.state.myGoodList.forEach(item => {
+ if (item.checked) {
+ checkedGoodsId.push(item.goods_id)
+ }
+ });
+ checkedGoodsId.length ? this.changeGoodState({ goodsID: checkedGoodsId }) : this.setState({ isToast: true, toastText: '请选择要下架的商品' }, () => {
+ setTimeout(() => {
+ this.setState({ isToast: false })
+ }, 2000);
+ })
+ }
+ // 导航到商品编辑页面myGoodsEdit
+ goToGoodEditPage(goodId) {
+ Taro.navigateTo({
+ url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
})
- }
-// 导航到商品编辑页面myGoodsEdit
- goToGoodEditPage(){
- Taro.navigateTo({
- url: '/pages/myGoodsEdit/myGoodsEdit'
-
+ }
+ goToGoodspage(goodId){
+ Taro.navigateTo({
+ url: '/pages/goods/goods?id='+goodId// 虚拟地址
})
- }
+ }
componentDidMount() {
this.getMyGoodListApi({})
+ this.getBaoBeiCateList()
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
@@ -400,24 +437,24 @@ class MyGoodList extends Component {
render() {
// 轻提示
- const toastElement=
+ const toastElement =
//等待接口数据 {item.text}
const goodListElementArray = this.state.myGoodList.map((item, index) => {
return
-
+
{/* onClick={this.handleCheckChange.bind(this,item.goods_id)} */}
-
+
- {item.goods_name}
+ {item.goods_name}
¥{item.goods_price}
{item.sales_volume}
-
+
编辑商品
@@ -438,7 +475,7 @@ class MyGoodList extends Component {
return (
- {toastElement}
+ {toastElement}
-
+
宝贝类目:
- {this.state.productCateSelected}
+ {this.state.productCateSelected.class_name}
@@ -525,11 +562,11 @@ class MyGoodList extends Component {
- {filterElementsArray}
-
+ {filterElementsArray}
+
- 全选
+ 全选
删除
@@ -546,8 +583,8 @@ class MyGoodList extends Component {
{/* */}
- {goodListElementArray}
- {/* */}
+ {goodListElementArray}
+ {/* */}
diff --git a/src/pages/myGoodsEdit/myGoodsEdit.js b/src/pages/myGoodsEdit/myGoodsEdit.js
index 85d6aa9..2264f18 100644
--- a/src/pages/myGoodsEdit/myGoodsEdit.js
+++ b/src/pages/myGoodsEdit/myGoodsEdit.js
@@ -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 { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui'
@@ -14,26 +14,63 @@ class MyGoodsEdit extends Component {
constructor() {
super(...arguments)
this.state = {
-
shopCategoryPicker: [], // 店铺分类选项
- shopCategoryCheckedPicker: { name: '选择店铺类型' },
+ shopCategoryCheckedPicker: { name: '选择店铺类型', id: '' },
productName: '',
productPrice: '',
productUnit: '',
productDescript: '',
pickerImageUrl: [], // 上传的图片
ImagesInfo: [],// 后台传回来的图片信息
-
-
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
- getShopCateList() {
+ async getShopCateList() {
Taro.request({
url: URL.GetShopCategoryList,
method: 'POST',
@@ -61,6 +98,7 @@ class MyGoodsEdit extends Component {
}
this.setState({ shopCategoryPicker: shopCategory })
console.log('店铺分类目录', res)
+ return
}
}
)
@@ -120,29 +158,34 @@ class MyGoodsEdit extends Component {
}
})
.then(res => {
- this.setState({ toastText: '发布成功', isToast: true }, () => {
- setTimeout(() => {
- this.setState({ isToast: false })
- Taro.navigateTo({
- url: '/pages/goods/goods?id=5cf3Ptn5wKQdyPpwsSe2nDKnN4QDFdz8moPTf+QIOm788Q'// 虚拟地址
- })
- }, 2000)
+ Taro.hideLoading()
+ Taro.showToast({
+ title: '保存成功',
+ icon: 'success',
+ duration: 1000
})
+ setTimeout(() => {
+ Taro.navigateTo({
+ url: '/pages/goods/goods?id=5cf3Ptn5wKQdyPpwsSe2nDKnN4QDFdz8moPTf+QIOm788Q'// 虚拟地址
+ })
+ }, 1000);
+
console.log('上传商品', res)
}
)
.catch(error => {
- this.setState({ toastText: '发布失败', isToast: true }, () => {
- setTimeout(() => {
- this.setState({ isToast: false })
- }, 2000)
+ Taro.hideLoading()
+ Taro.showToast({
+ title: '保存失败',
+ icon: 'none',
+ duration: 1000
})
})
}
-
-
+
+
productNameChange(event) {
this.setState({
productName: event
@@ -184,10 +227,12 @@ class MyGoodsEdit extends Component {
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, isToast: true, toastText: '图片上传成功', ImagesInfo: newImageInfo }, () => {
- setTimeout(() => {
- that.setState({ isToast: false })
- }, 2000)
+ that.setState({ pickerImageUrl: newPickerImageUrl, ImagesInfo: newImageInfo }, () => {
+ Taro.showToast({
+ title: '上传成功',
+ icon: 'success',
+ duration: 2000
+ })
})
}
})
@@ -195,11 +240,13 @@ class MyGoodsEdit extends Component {
if (operationType === 'remove') {
this.state.pickerImageUrl.splice(index, 1);
this.setState({ files: this.state.pickerImageUrl });
- that.setState({ isToast: true, toastText: '删除成功' }, () => {
- setTimeout(() => {
- that.setState({ isToast: false })
- }, 2000)
+
+ Taro.showToast({
+ title: '删除成功',
+ icon: 'success',
+ duration: 2000
})
+
}
}
// 图片上传失败
@@ -211,20 +258,24 @@ class MyGoodsEdit extends Component {
}
onClickUploadGoods() {
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopCategoryCheckedPicker.id) {
- this.uploadGoods({
- goods_name: this.state.productName,
- goods_price: this.state.productPrice,
- goods_unit: this.state.productUnit,
- goods_profiles: this.state.productDescript,
- class_id: "10103",
- shop_class_id: this.state.shopCategoryCheckedPicker,
+ Taro.showLoading({ title: '保存中' }).then(() => {
+ setTimeout(() => {
+ 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.shopCategoryCheckedPicker,
+ })
+ }, 1000);
})
} else {
- this.setState({ toastText: '请填写完表格', isToast: true }, () => {
- setTimeout(() => {
- this.setState({ isToast: false })
- }, 2000)
+ Taro.showToast({
+ title: '请填写完表格',
+ icon: 'none',
+ duration: 2000
})
+
}
}
shopCategoryChanged(e) {
@@ -234,16 +285,19 @@ class MyGoodsEdit extends Component {
console.log(this.state.shopCategoryCheckedPicker)
})
}
- goToMyGoodListPage(){
+ goToMyGoodListPage() {
Taro.navigateTo({
- url: '/pages/myGoodList/myGoodList'
- })
+ url: '/pages/myGoodList/myGoodList'
+ })
}
componentDidMount() {
-
- this.getShopCateList()
+
+ this.getShopCateList().then(() => {
+ this.getGoodsInfo()
+ })
+
}
componentWillReceiveProps(nextProps) {
@@ -255,56 +309,46 @@ class MyGoodsEdit extends Component {
componentDidHide() { }
-
+
render() {
- const imageUploadSuccess =
- const productUploadSuccess =
+
return (
- {imageUploadSuccess}
- {productUploadSuccess}
-
+
+
-
+
*
*
*
{/* 图片上传 */}
@@ -315,11 +359,11 @@ class MyGoodsEdit extends Component {
@@ -346,10 +390,10 @@ class MyGoodsEdit extends Component {
diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js
index f4c59fe..46f046d 100644
--- a/src/pages/mySupplyDemand/mySupplyDemand.js
+++ b/src/pages/mySupplyDemand/mySupplyDemand.js
@@ -1,9 +1,9 @@
import Taro, { Component } from '@tarojs/taro'
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 copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
+import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './mySupplyDemand.scss'
@@ -17,17 +17,16 @@ class MySupplyDemand extends Component {
constructor() {
super(...arguments)
this.state = {
- demandSupplyCate: ['全部', '需求', '供应', '人才'],
- demandSupplyCateSelected: '全部',
- demandSupplyState: ['全部', '上架', '下架'],
- demandSupplyStatesSelected: '全部',
+ demandSupplyCate: [{ name: '全部', id: '' }, { name: '需求', id: '1' }, { name: '供应', id: '2' }, { name: '人才', id: '3' },],
+ demandSupplyCateSelected: { name: '全部', id: '' },
+ demandSupplyState: [{ name: '全部', id: '' }, { name: '上架', id: '1' }, { name: '下架', id: '0' }],
+ demandSupplyStatesSelected: { name: '全部', id: '' },
title: '',
startDateSel: '',
endDateSel: '',
allDemandSupply: [],
totalDemandSupply: '',
- isToast: false,// 是否显示轻提示
- toastContent: '', // 轻提示内容
+
isConfirmWindow: false, // 是否显示确认弹窗
demandSupplyItemName: '',// 确认框提示时 使用的供求名
demandSupplyId: '',// 删除我的供求时的供求id
@@ -56,13 +55,16 @@ class MySupplyDemand extends Component {
}).then(res => {
if (res.data.err_msg === "success") {
// 判断是否有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
- 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({
url: URL.SearchDemandSupply,
method: 'POST',
@@ -87,11 +89,20 @@ class MySupplyDemand extends Component {
.then(res => {
//this.setState({ grabOrderSuccess: res.data.err_msg,isGrabOrderSuccess: true })
console.log('我的供求搜索结果', res)
-
- this.setState({ allDemandSupply: res.data.supplys, totalDemandSupply: res.data.count })
+ Taro.hideLoading()
+ this.setState({ allDemandSupply: res.data.supplys || [], totalDemandSupply: res.data.count })
})
+ }
+ onSearchButtonHandler(){
+ Taro.showLoading({title:'加载中'}) .then(() => {
+ setTimeout(() => {
+ this.searchDemandSupply({})
+ }, 1000);
+
+ })
+
}
// 删除我的供求api
@@ -112,28 +123,28 @@ class MySupplyDemand extends Component {
.then(res => {
if (res.data.err_msg == 'success') {
console.log('删除成功')
- this.setState({ toastContent: '删除成功', isToast: true }, () => {
- setTimeout(() => {
- this.setState({ isToast: false })
- this.getMySupplyDemand({})
- }, 2000)
+ Taro.showToast({
+ title: '删除成功'
+ }).then(() => {
+ this.getMySupplyDemand({})
})
- } 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 => {
- this.setState({ toastContent: '删除失败', isToast: true }, () => {
- setTimeout(() => {
- this.setState({ isToast: false })
- }, 2000)
+
+ Taro.showToast({
+ title: '删除失败',
+ icon: 'none'
})
})
}
@@ -153,6 +164,8 @@ class MySupplyDemand extends Component {
demSupplyCateChange = e => {
this.setState({
demandSupplyCateSelected: this.state.demandSupplyCate[e.detail.value]
+ }, () => {
+ console.log(this.state.demandSupplyCateSelected)
})
}
// 修改供求状态
@@ -198,14 +211,18 @@ class MySupplyDemand extends Component {
// 编辑我的供求
// 跳转到我的供求编辑页面
- goToMyDSEditPage(){
+ goToMyDSEditPage() {
Taro.navigateTo({
-
- url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
-
- })
+ url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit'
+ })
}
+ // 转到供求查看页面
+ goToSupplyDemandPage(){
+ Taro.navigateTo({
+ url: '/pages/supplyDemandView/supplyDemandView'
+ })
+ }
//查看我的供求
componentWillReceiveProps(nextProps) {
@@ -213,7 +230,14 @@ class MySupplyDemand extends Component {
}
componentDidMount() {
- this.getMySupplyDemand({})
+
+
+ Taro.showLoading({title:'加载中'}) .then(() => {
+
+ this.getMySupplyDemand({})
+
+
+ })
}
componentWillUnmount() { }
@@ -232,12 +256,7 @@ class MySupplyDemand extends Component {
- // 轻提示
- const toastElement =
+
const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => {
return
@@ -265,10 +284,10 @@ class MySupplyDemand extends Component {
{item.update_date}
-
+
查看
-
+
编辑
@@ -285,18 +304,17 @@ class MySupplyDemand extends Component {
{/* 是否删除供求确认框 */}
{modalMessageConfirmElement}
- {/* 轻提示 */}
- {toastElement}
+
{/* 供求类型 */}
-
+
- *供求类型: {this.state.demandSupplyCateSelected}
+ *供求类型: {this.state.demandSupplyCateSelected.name}
@@ -306,10 +324,10 @@ class MySupplyDemand extends Component {
-
+
- *供求状态: {this.state.demandSupplyStatesSelected}
+ *供求状态: {this.state.demandSupplyStatesSelected.name}
@@ -320,12 +338,12 @@ class MySupplyDemand extends Component {
*
{/* 开始和结束日期 */}
@@ -351,7 +369,7 @@ class MySupplyDemand extends Component {
-
+
搜索
@@ -370,7 +388,7 @@ class MySupplyDemand extends Component {
-
+
)
diff --git a/src/pages/shop/shop.js b/src/pages/shop/shop.js
index 8096f7e..3a9c214 100644
--- a/src/pages/shop/shop.js
+++ b/src/pages/shop/shop.js
@@ -27,7 +27,7 @@ class Shop extends Component {
filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], //筛选选项
filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, // 筛选选项对应值
selectedFilterValue: 0, //筛选项
- isShowFilter: true, //是否显示侧边筛选
+ isShowFilter: false, //是否显示侧边筛选
showShopHomePage: true,// 是否显示首页页面
shopDescriptionData: '',// 店铺详情信息
shopName: '',//店铺名称
@@ -54,7 +54,7 @@ class Shop extends Component {
otherType: [],//侧边其他类型
widthType: [],// 侧边宽度类型
checkedFilterIdList: [],//已选的筛选id
- isLoading: false,
+
// 下面是函数的默认参数
curr_page: 1,
page_count: 10,
@@ -110,17 +110,14 @@ class Shop extends Component {
.then(res => {
if (res.statusCode === 200) {
console.log('筛选项目成功', res)
-
-
+ Taro.hideLoading()
this.formatFilterData(res.data).then(data => {
-
this.setState({
sideFilterdata: data,
mainType: data.mainType || [],
goodType: data.goodType || [],
otherType: data.otherType || [],
widthType: data.widthType || [],
- isLoading: false
})
console.log('formated data', data)
})
@@ -226,7 +223,8 @@ class Shop extends Component {
}
})
.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 => {
+ Taro.hideLoading()
+
this.setState({
shopDescriptionData: res.data,
shopName: res.data.data.shop_name,
@@ -277,6 +277,8 @@ class Shop extends Component {
})
.then(res => {
if (res.statusCode === 200) {
+ Taro.hideLoading()
+
const originalData = res.data.data
const sortedData = []
for (let item in originalData) {
@@ -301,6 +303,7 @@ class Shop extends Component {
// 产品排序
accendingDescending(value) {
+ Taro.showLoading({ title: '加载中' })
this.setState({ selectedFilterValue: value })
if (value == 0) {
this.setState({
@@ -390,8 +393,7 @@ class Shop extends Component {
// 选择侧边筛选的标签
selectTag(name) {
const id = name.name
- console.log('clicked ID', id)
- this.setState({ isLoading: true })
+ Taro.showLoading({ title: '加载中' })
// 处理分类筛选项
const newMainType = this.state.mainType.map((item) => {
if (item.id === id) {
@@ -428,6 +430,7 @@ class Shop extends Component {
value[each].checked = !value[each].checked
setTimeout(() => {
+
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.goodsSearch({ goodsParam: this.state.goodsParam })
@@ -456,6 +459,7 @@ class Shop extends Component {
}
handleOnPageChange(value) {
+ Taro.showLoading({ title: '加载中' })
this.setState({ currentPage: value.current })
this.goodsSearch({ curr_page: value.current, order: this.state.filterCondition })
}
@@ -470,6 +474,8 @@ class Shop extends Component {
}
handleShopInnerCate(id) {
+
+ Taro.showLoading({ title: '加载中' })
this.setState({
isShowShopAllCate: false, isBlurWindow: false
})
@@ -483,6 +489,8 @@ class Shop extends Component {
//重置按键筛选
resetFilterList() {
+
+ Taro.showLoading({ title: '加载中' })
this.setState({
checkedFilterIdList: [], curr_page: 1,
page_count: 10,
@@ -515,6 +523,9 @@ class Shop extends Component {
}
componentDidMount() {
+
+ Taro.showLoading({ title: '加载中' })
+
//页面加载之后 得到指定店铺的商品 和 筛选标签
this.goodsSearch({ shop_id: this.$router.params.id }) // 加载店铺商品
this.getSearchParams({})// 加载筛选项
@@ -528,11 +539,7 @@ class Shop extends Component {
componentDidHide() { }
render() {
- const loadingElement =
+
const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => {
return
@@ -699,7 +706,7 @@ class Shop extends Component {
})
return (
- {loadingElement}
+
diff --git a/src/pages/supplyDemandPublish/supplyDemandPublish.js b/src/pages/supplyDemandPublish/supplyDemandPublish.js
index dfbd621..cc7f33f 100644
--- a/src/pages/supplyDemandPublish/supplyDemandPublish.js
+++ b/src/pages/supplyDemandPublish/supplyDemandPublish.js
@@ -19,10 +19,10 @@ class SupplyDemand extends Component {
constructor() {
super(...arguments)
this.state = {
- demandingSupplyCate: ['需求', '供应', '人才'], //供求类型选择
- demandingSupplyCateSelected: '需求',// 当前供求类型
- demandingSupplyState: ['上架', '下架'], // 状态选择
- demandingSupplyStateSelected: '上架',// 当前状态
+ demandingSupplyCate: [{name:'需求',id:1}, {name:'供应',id:2}, {name:'人才',id:3}], //供求类型选择
+ demandingSupplyCateSelected: {name:'需求',id:1},// 当前供求类型
+ demandingSupplyState: [{name:'上架',id:1}, {name:'下架',id:0}], // 状态选择
+ demandingSupplyStateSelected: {name:'上架',id:1},// 当前状态
title: '',
contactName: '',
contactNumber: '',
@@ -44,13 +44,13 @@ class SupplyDemand extends Component {
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) {
this.uploadDemSup({
- sd_type:"2",
+ sd_type:this.state.demandingSupplyCateSelected,
sd_title:this.state.title,
user_name:this.state.contactName,
user_phone:this.state.contactNumber,
user_address:this.state.contactAddress,
sd_desc:this.state.content,
- state:"1"})
+ state:this.state.demandingSupplyStateSelected})
} else {
this.setState({ uploadDemSupTextTip: '请填写完表格', isUploadDemSupSuccess: true }, () => {
setTimeout(() => {
@@ -223,10 +223,10 @@ class SupplyDemand extends Component {
-
+
- *供求类型: {this.state.demandingSupplyCateSelected}
+ *供求类型: {this.state.demandingSupplyCateSelected.name}
@@ -306,10 +306,10 @@ class SupplyDemand extends Component {
-
+
- *状态: {this.state.demandingSupplyStateSelected}
+ *状态: {this.state.demandingSupplyStateSelected.name}
diff --git a/src/pages/supplyDemandView/supplyDemandView.js b/src/pages/supplyDemandView/supplyDemandView.js
new file mode 100644
index 0000000..a1cdf54
--- /dev/null
+++ b/src/pages/supplyDemandView/supplyDemandView.js
@@ -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 (
+
+ 单独供求
+
+ )
+ }
+}
+
+export default SupplyDemandView
diff --git a/src/pages/supplyDemandView/supplyDemandView.scss b/src/pages/supplyDemandView/supplyDemandView.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js
index 0c238f1..168084e 100644
--- a/src/serviceAPI.config.js
+++ b/src/serviceAPI.config.js
@@ -36,11 +36,19 @@ const URL = {
// 商品列表的api 接口 GoodsList-goodsDelete
DeleteGood: LOCALURL + 'GoodsList-goodsDelete',// 删除商品列表接口
ChangeGoodState: LOCALURL + 'GoodsList-setGoodsState',// 改变商品列表状态 (下架)
+ BaoBeiCateList: LOCALURL + 'GoodsList-wxSales',// 获取宝贝类目列表
+
// 我的供求页面接口Supply-myList
SearchDemandSupply: LOCALURL + 'Supply-myList',// 搜索我的供求接口
DeleteDemandSupply: LOCALURL + 'Supply-delete',// 删除我的供求接口
+
+ // 商品编辑页面 Goods-wxEditPhoneDeploy
+ GetProductInfo: LOCALURL + 'Goods-wxEditPhoneDeploy',// 获取商品信息
+
+
+
}
module.exports = URL
\ No newline at end of file
diff --git a/src/todo list.txt b/src/todo list.txt
index ffda7b6..4112740 100644
--- a/src/todo list.txt
+++ b/src/todo list.txt
@@ -1,35 +1,27 @@
todo list:
-
首页:
- 优惠卷和询价接口
- 联系人和联系电话 改动?
-店铺页面:
- 侧边筛选
-
商品发布页面:
商品分类三级联动 // 有bug
店铺分类选项 二级联动// 需要修改
商品价格无法设定为数字 // 有bug
供求发布页面
- 等待后台- 供求类型 和供求状态
联系电话无法设置为数字 // 有bug type=‘password’ 可以
全部业主需求页面:
- 供求状态和行业分类--等待后台接口--搜索
-
+ 行业分类--等待后台接口--搜索 二级联动--
+
我的供求页面:
- 搜索接口--等待后台
我的供求查看页面
我的供求编辑页面--等待后台接口数据
我的商品列表页面
- 等待后台的搜索- 宝贝类目
商品价格无法设定为数字 // 有bug
商品编辑页面
- 等待后台api
+ 店铺分类--二级联动
-alldemanding
+接口问题:
+优惠卷和询价