diff --git a/src/app.js b/src/app.js
index 22a1e50..b36edba 100644
--- a/src/app.js
+++ b/src/app.js
@@ -20,13 +20,12 @@ class App extends Component {
config = {
pages: [
//'pages/index/index', // index页面
-
- 'pages/goodsPublish/goodsPublish',// 商品发布页面 ---------------------
+
'pages/home/home',//首页 ---------------------
'pages/login/login',//登入页面 ---------------------
'pages/shop/shop',//店铺页面 ---------------------
'pages/goods/goods',// 商品页面 ---------------------
-
+ 'pages/goodsPublish/goodsPublish',// 商品发布页面 ---------------------
'pages/supplyDemandPublish/supplyDemandPublish',// 供求发布页面 ---------------------
'pages/mySupplyDemand/mySupplyDemand',// 我的供求列表页面 ---------------------
'pages/myGoodsEdit/myGoodsEdit',// 我的商品编辑页面 ---------------------
@@ -90,7 +89,7 @@ class App extends Component {
}
componentDidMount() {
-
+
}
componentDidShow() { }
diff --git a/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js
new file mode 100644
index 0000000..57e6052
--- /dev/null
+++ b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js
@@ -0,0 +1,235 @@
+import Taro, { Component } from '@tarojs/taro'
+import { View, Text, Picker } from '@tarojs/components'
+import { AtList, AtListItem, } from 'taro-ui'
+
+
+import './AliShopTypeInteraction.scss'
+import loginExpired from '../../util/loginExpired';
+import { getGlobalStorage, setGlobalStorage } from '../../util/getSetStoage';
+
+
+class ShopTypeInteractionComp extends Component {
+
+ config = {
+ navigationBarTitleText: 'shopTypeInteractionComp'
+ }
+ constructor() {
+ super(...arguments);
+
+ this.state = {
+ initailMultiArray: [[{}], [{ name: '选择店铺分类', id: '' }]],
+ multiIndex: [0, 0],
+ interactionMultiArray: [],// 联动数据
+ AliIsShowPicker:false,
+ }
+
+ }
+ // 店铺分类筛选列表GetShopTypeList
+ getShopTypeList(url) {
+ Taro.request({
+ url: url,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ id: this.props.shopId,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
+ 'X-Requested-With': 'XMLHttpRequest'
+ }
+ })
+ .then(res => {
+ // console.log('店铺分类目录', res)
+ // this.formatIndustryType(res.data.data)
+ // this.formatIndustTypeInit(res.data.data)
+ if (res.data.err_code === 0) {
+ if (res.data.data === null) {
+ return
+ }
+ console.log('店铺分类目录', res)
+ if (!getGlobalStorage('shopTypeObject')) {
+ setGlobalStorage('shopTypeObject', res.data.data)
+ }
+ this.setState({
+ interactionMultiArray: this.interactionData(res.data.data),
+ initailMultiArray: this.initializedData(res.data.data),
+ }, () => {
+
+ console.log('state', this.state.initailMultiArray, this.state.interactionMultiArray)
+ // this.passDataToParent(this.state.initailMultiArray)
+ //返回初始选项在 在商品编辑页面
+
+
+ // console.log('联动数据', this.state.interactionMultiArray)
+ // console.log('初始化数据', this.state.initailMultiArray)
+ // console.log('index初始化', this.state.multiIndex)
+
+
+ }) // 用递归来整理无限层次的数据
+ } else if (res.data.err_code === 88888) {
+ loginExpired(res)
+ } else {
+ console.log('店铺分类目录获取失败', res)
+ }
+ }
+ )
+ .catch(error => {
+ console.log('店铺分类请求错误', error)
+ })
+ }
+
+
+ // 递归整理无限层联动数据
+ interactionData(data) {
+ let parentArrayHolder = []
+ const keys = Object.keys(data)
+ for (let key of keys) {
+ let childrenArrayHolder = []
+ let parent = { name: data[key].n, id: key }
+ parentArrayHolder.push(parent)
+ for (let childItem of data[key].c) {
+ let child = { name: childItem.n, id: childItem.id }
+ childrenArrayHolder.push(child)
+ }
+ parent.children = childrenArrayHolder
+ }
+ return parentArrayHolder
+ }
+ // 递归整理无限层初始数据
+ initializedData(data) {
+ let outter = []
+ let inner = []
+ const keys = Object.keys(data)
+ for (let key of keys) {
+ outter.push({ name: data[key].n, id: key })
+ for (let child of data[key].c) {
+ inner.push({ name: child.n, id: child.id })
+ }
+ }
+ return [outter, inner]
+ }
+
+ // 触动联动筛选
+ bindMultiPickerCol(e) {
+ console.log('e', e)
+ console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
+ const data = {
+ multiArray: this.state.initailMultiArray,
+ multiIndex: this.state.multiIndex
+ }
+ data.multiIndex[e.detail.column] = e.detail.value
+ if (e.detail.column == 0) {
+ for (let index in data.multiArray[0]) {
+ const indexNumber = Number(index)
+ if (indexNumber === data.multiIndex[0]) {
+ data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
+ }
+ }
+ }
+ this.setState({ multiIndex: data.multiIndex })
+ }
+ bindMultiPickerChange(e) {
+ // console.log('picker发送选择改变,携带值为', e.detail.value)
+ if (getGlobalStorage('shopInfo').shop_id) {
+ this.setState({
+ multiIndex: e.detail.value,
+ }, () => {
+ //判断如果interactionMultiArray 的子类为空 那就取父类, 反之取子类
+ let industryTypeSelected
+ industryTypeSelected = this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]]
+ this.passDataToParent(industryTypeSelected)
+ })
+
+ }
+
+
+ }
+
+
+
+ //--------------------结束-行业分类picker
+ passDataToParent(industryTypeSelected) {
+ this.props.onPassDataToChild(industryTypeSelected)
+ }
+ aliBindMultiPickerCol(e) {
+ console.log('e', e)
+ console.log(',值为', e.detail.value)
+
+ this.setState({ multiIndex: e.detail.value })
+ }
+
+ aliCancelButton() {
+ this.setState({
+ AliIsShowPicker:false
+ })
+ }
+ aliConfirmButton() {
+ this.setState({
+ AliIsShowPicker:false
+ })
+ let result = this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]]
+
+ this.passDataToParent(result)
+ }
+ invokeAliPicker() {
+ this.setState({
+ AliIsShowPicker:true
+ })
+ }
+
+ componentDidMount() {
+ this.getShopTypeList(this.props.url)
+ }
+
+ // 当然父组件有新的props的 会从新渲染组件
+ componentWillReceiveProps(nextProps) {
+ console.log('next props', nextProps)
+
+ }
+ componentWillUnmount() { }
+
+ componentDidShow() { }
+
+ componentDidHide() { }
+
+ render() {
+ return (
+
+
+
+
+
+
+ {this.state.AliIsShowPicker ?
+
+
+
+
+ 取消
+ 确定
+
+
+
+ {this.state.interactionMultiArray.map((item, index) => {
+ return {item.name}
+ })}
+
+
+ {this.state.interactionMultiArray[this.state.multiIndex[0]].children.map((item, index) => {
+ return {item.name}
+ })}
+
+
+
+ : null}
+
+
+
+
+
+ )
+ }
+}
+
+export default ShopTypeInteractionComp
diff --git a/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss
new file mode 100644
index 0000000..a59865d
--- /dev/null
+++ b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss
@@ -0,0 +1,83 @@
+.page-section{
+ border-bottom: 1Px solid #d6e4ef;
+ font-size:32rpx;
+
+ .picker{
+ // padding: 24rpx 0;
+ .selected{
+ font-weight: normal;
+ display: inline-block;
+ margin-left: 20%;
+ font-size: 32rpx
+ }
+ .date{
+ margin-left: 0%
+ }
+ .title-box{
+ line-height:100rpx;
+ font-weight: bold;
+ .require{
+ color:red
+ }
+ .title{
+ //color: #333;
+ line-height:100rpx;
+ margin-right:16rpx;
+ width:172rpx;
+ font-size:32rpx;
+ vertical-align:middle;
+ text-align:left;
+ font-weight: bold;
+ }
+
+ .first-col{
+ font-weight: normal;
+ margin-left: 10%
+ }
+ .second-col{
+ font-weight: normal;
+ display: inline-block;
+ margin-left: 10%
+ }
+
+}
+ }
+}
+.picker-wrapper{
+ padding-left: 20px;
+ padding-right: 20px;
+}
+.curtain{
+ height: 100%;
+ background-color: black;
+ width: 100%;
+ position: fixed;
+ z-index: 99;
+ opacity: 0.5;
+ position: fixed;
+ top: 0;
+}
+
+.ali-picker-container{
+ position: fixed;
+ width: 100%;
+ bottom: 0px;
+ background-color: #fff;
+ z-index: 100;
+ opacity: 1;
+ .button{
+ display: flex;
+ flex-direction: row;
+ padding:20px 30px;
+ border-bottom: 1px solid #d6e4ef;
+}
+ .cancel-button{
+ flex:1;
+ text-align: left;
+ }
+ .confirm-button{
+ flex:1;
+ color:#FF7142;
+ text-align: right;
+ }
+ }
diff --git a/src/component/clientTabBarComponent/clientTabBarComponent.js b/src/component/clientTabBarComponent/clientTabBarComponent.js
deleted file mode 100644
index 4e6e64e..0000000
--- a/src/component/clientTabBarComponent/clientTabBarComponent.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import Taro, { Component } from '@tarojs/taro'
-import { View } from '@tarojs/components'
-
-import { AtTabBar } from 'taro-ui'
-import './clientTabBarComponent.scss'
-
-
-
-class ClientTabBarComponent extends Component {
- config = {
- navigationBarTitleText: '业主底栏导航'
- }
-
- //http://ihome6.com/Shop-supplyShops
- componentDidMount() {
-
- }
- componentWillReceiveProps(nextProps) {
- }
-
- componentWillUnmount() { }
-
- componentDidShow() { }
-
- componentDidHide() { }
-
- render() {
- return (
-
-
-
-
- )
- }
-}
-
-export default ClientTabBarComponent
diff --git a/src/component/clientTabBarComponent/clientTabBarComponent.scss b/src/component/clientTabBarComponent/clientTabBarComponent.scss
deleted file mode 100644
index e69de29..0000000
diff --git a/src/component/sellerTabBarComponent/sellerTabBarComponent.js b/src/component/sellerTabBarComponent/sellerTabBarComponent.js
deleted file mode 100644
index 1153b18..0000000
--- a/src/component/sellerTabBarComponent/sellerTabBarComponent.js
+++ /dev/null
@@ -1,78 +0,0 @@
-import Taro, { Component } from '@tarojs/taro'
-import { View } from '@tarojs/components'
-
-import { AtTabBar } from 'taro-ui'
-import './sellerTabBarComponent.scss'
-
-
-
-class SellerTabBarComponent extends Component {
- config = {
- navigationBarTitleText: '店铺底栏导航'
- }
- constructor(){
- this.state = {
- current: 0,
- options:[
- { title: '首页', url: '/pages/home/home', iconType: 'bullet-list', text: 'new' },
- { title: '商品发布', url: '/pages/goodsPublish/goodsPublish', iconType: 'camera' },
- { title: '供求发布', url: '/pages/supplyDemandPublish/supplyDemandPublish', iconType: 'folder', text: '100', max: '99' },
- { title: '我的供求', url: '/pages/mySupplyDemand/mySupplyDemand', iconType: 'folder', text: '100', max: '99' },
- { title: '我的需求', url: '/pages/myNeeds/myNeeds', iconType: 'folder', text: '100', max: '99' }
- ]
-
- }
- }
- handleClick(value) {
-
- this.setState({
- current: value
- })
-
- let path = this.state.options[value].url
- Taro.navigateTo({
- url: path,
- })
-
- }
-
- componentDidMount() {
-
- }
- componentWillReceiveProps(nextProps) {
- }
-
- componentWillUnmount() { }
-
- componentDidShow() {
- console.log('this.props.currentUrl',this.props.currentUrl)
- if(this.props.currentUrl==='pages/home/home'){
- this.setState({
- current:0
- })
- }else if(this.props.currentUrl==='pages/supplyDemandPublish/supplyDemandPublish'){
- this.setState({
- current:2
- })
- }
-
- }
-
- componentDidHide() { }
-
- render() {
- return (
-
-
-
-
- )
- }
-}
-
-export default SellerTabBarComponent
diff --git a/src/component/sellerTabBarComponent/sellerTabBarComponent.scss b/src/component/sellerTabBarComponent/sellerTabBarComponent.scss
deleted file mode 100644
index e69de29..0000000
diff --git a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.scss b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.scss
index 90902db..1f4e96f 100644
--- a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.scss
+++ b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.scss
@@ -42,4 +42,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js
index 97b2389..e7d5b4f 100644
--- a/src/pages/goodsPublish/goodsPublish.js
+++ b/src/pages/goodsPublish/goodsPublish.js
@@ -1,11 +1,12 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button } from '@tarojs/components'
-import { AtInput, AtImagePicker, AtTextarea, } from 'taro-ui'
+import { AtInput, AtTextarea, } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
+import AliShopTypeInteraction from '../../component/AliShopTypeInteraction/AliShopTypeInteraction'
import GoodsTypeInteractionComp from '../../component/goodsTypeInteractionComp/goodsTypeInteractionComp'
import LoginService from '../../util/LoginService'
@@ -290,7 +291,7 @@ class GoodsPublish extends Component {
console.log('从子组件商品分类传回来的值', value)
this.setState({ goodsTypeSelected: value })
}
-
+
componentWillMount() {
if (!getGlobalStorage('userInfo').user_id) {
LoginService()
@@ -380,11 +381,16 @@ class GoodsPublish extends Component {
*/}
{/* 店铺分类 */}
-
+ > :
+ }
{/* 店铺分类结束 */}
diff --git a/src/pages/goodsPublish/goodsPublish.scss b/src/pages/goodsPublish/goodsPublish.scss
index c669bd8..21b3270 100644
--- a/src/pages/goodsPublish/goodsPublish.scss
+++ b/src/pages/goodsPublish/goodsPublish.scss
@@ -3,7 +3,7 @@ $themeColor:#FF7142;
.goods-category{
- padding: 10px 20px;
+ padding-top: 10px;
.border-box{
border-bottom: 1Px solid #d6e4ef;
@@ -18,6 +18,8 @@ $themeColor:#FF7142;
}
.img-box{
margin-top:10Px;
+ padding-left: 20px;
+ padding-right: 20px;
.img-container{
border: 1Px solid #d6e4ef;
border-radius:8rpx;
@@ -29,6 +31,8 @@ $themeColor:#FF7142;
}
.description-box{
margin-top:10Px;
+ padding-left: 20px;
+ padding-right: 20px;
}
}
@@ -87,6 +91,8 @@ $themeColor:#FF7142;
}
.page-section{
border-bottom: 1Px solid #d6e4ef;
+ padding-left: 20px;
+ padding-right: 20px;
}
.selected{
@@ -97,6 +103,8 @@ $themeColor:#FF7142;
.input-box{
border-bottom: 1Px solid #d6e4ef;
display: flex;
+ padding-left: 20px;
+ padding-right: 20px;
}
.require{
color:red;
@@ -104,5 +112,12 @@ $themeColor:#FF7142;
}
-
+.picker-wrapper{
+ .item-content__info-title{
+ font-weight: bold
+ }
+ .item-extra__info{
+ color: black
+ }
+}
diff --git a/src/pages/grabOrderPage/grabOrderPage.js b/src/pages/grabOrderPage/grabOrderPage.js
index 445ebcd..6ff0564 100644
--- a/src/pages/grabOrderPage/grabOrderPage.js
+++ b/src/pages/grabOrderPage/grabOrderPage.js
@@ -74,10 +74,10 @@ class GrabOrderPage extends Component {
})
} else if (res.data.err_code === 88888) {
loginExpired(res)
- }else{
+ } else {
Taro.showToast({
- title:res.data.err_msg,
- icon:'none'
+ title: res.data.err_msg,
+ icon: 'none'
})
}
@@ -112,7 +112,7 @@ class GrabOrderPage extends Component {
})
setTimeout(() => {
Taro.navigateBack({
- delta:1
+ delta: 1
})
}, 1500);
@@ -156,14 +156,14 @@ class GrabOrderPage extends Component {
// 确认抢单之后
showLoading({
title: '加载中'
- })
+ })
this.GrabDemand({ demandId: this.state.grabOrderId })
}
componentDidMount() {
showLoading({
title: '加载中'
- })
+ })
this.getGrabOrderInfo()
}
componentWillReceiveProps(nextProps) {
@@ -224,7 +224,7 @@ class GrabOrderPage extends Component {
})
setTimeout(() => {
Taro.navigateBack({
- delta:-1
+ delta: -1
})
}, 1500);
} else if (res.data.err_code === 88888) {
@@ -240,7 +240,7 @@ class GrabOrderPage extends Component {
}
render() {
- const localStoageUserId = getGlobalStorage('userInfo')?getGlobalStorage('userInfo').user_id:''
+ const localStoageUserId = getGlobalStorage('userInfo') ? getGlobalStorage('userInfo').user_id : ''
// 提示框
const deleteModalWindowElement =
@@ -250,7 +250,31 @@ class GrabOrderPage extends Component {
- let ButtonElement
+
+
+ let ButtonElement = localStoageUserId === this.state.userId ?
+
+
+
+
+
+
+ :
+ this.state.stateId === '1' ?
+
+ :
+ this.state.stateId === '2' ?
+
+ :
+
+
+
+
+
// if (localStoageUserId === this.state.userId && this.state.stateId === '1') {
// ButtonElement =
//
@@ -325,7 +349,7 @@ class GrabOrderPage extends Component {
{modalMessageGrabElement}
{deleteModalWindowElement}
{this.state.isShowRendering ? : null}
- {this.state.stateId === '3' && !this.state.isShowRendering&&this.state.renderingImage.length ?
+ {this.state.stateId === '3' && !this.state.isShowRendering && this.state.renderingImage.length ?
: null}
diff --git a/src/pages/myGoodsEdit/myGoodsEdit.js b/src/pages/myGoodsEdit/myGoodsEdit.js
index 76cd3aa..10d92c1 100644
--- a/src/pages/myGoodsEdit/myGoodsEdit.js
+++ b/src/pages/myGoodsEdit/myGoodsEdit.js
@@ -1,8 +1,9 @@
import Taro, { Component } from '@tarojs/taro'
-import { View, Text , Button} from '@tarojs/components'
-import { AtInput, AtImagePicker, AtTextarea, } from 'taro-ui'
+import { View, Text, Button } from '@tarojs/components'
+import { AtInput, AtTextarea, } from 'taro-ui'
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
+import AliShopTypeInteraction from '../../component/AliShopTypeInteraction/AliShopTypeInteraction'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
@@ -52,7 +53,7 @@ class MyGoodsEdit extends Component {
})
.then(res => {
Taro.hideLoading()
-
+
if (res.data.err_code === 0) {
console.log('商品详情获取成功', res)
@@ -72,7 +73,7 @@ class MyGoodsEdit extends Component {
if (getGlobalStorage('shopTypeObject')) {
let selectedValue = ''
const shopTypeObject = getGlobalStorage('shopTypeObject')
- console.log('shopTypeObject',shopTypeObject)
+ console.log('shopTypeObject', shopTypeObject)
for (let key in shopTypeObject) {
for (let item of shopTypeObject[key].c) {
if (item.id === res.data.goods.shop_class_id) {
@@ -88,13 +89,13 @@ class MyGoodsEdit extends Component {
pickerImageUrl: imageFile,
ImagesInfo: res.data.goodsFiles,
initialImageURL: imageFile,
- initialImagesInfo: res.data.goodsFiles,
- shopTypeSelected: selectedValue,
+ initialImagesInfo: res.data.goodsFiles,
+ shopTypeSelected: selectedValue,
goodsTypeParam: res.data.goods.class_id,
goodId: res.data.goods.goods_id,
})
- }
+ }
} else if (res.data.err_code === 88888) {
console.log('88888')
@@ -294,12 +295,12 @@ class MyGoodsEdit extends Component {
}
}
- // 从图片子组件获取信息
- getImageDetails(value) {
- this.setState({
- ImagesInfo: value
- })
- }
+ // 从图片子组件获取信息
+ getImageDetails(value) {
+ this.setState({
+ ImagesInfo: value
+ })
+ }
shopCategoryChanged(e) {
this.setState({
shopCategoryCheckedPicker: this.state.shopCategoryList[e.detail.value]
@@ -376,8 +377,6 @@ class MyGoodsEdit extends Component {
console.log('从子组件店铺分类传回来的值', value)
this.setState({ shopTypeSelected: value })
}
-
-
componentDidMount() {
showLoading({
title: '加载中'
@@ -387,7 +386,7 @@ class MyGoodsEdit extends Component {
}
componentWillReceiveProps(nextProps) {
- // console.log(this.props, nextProps)
+
}
componentWillUnmount() { }
@@ -398,8 +397,10 @@ class MyGoodsEdit extends Component {
render() {
+
return (
+
*
@@ -444,13 +445,13 @@ class MyGoodsEdit extends Component {
上传图片:
+ maxLength={20}
+ isReceiveImageUrl={true}
+ initialImageURL={this.state.initialImageURL}
+ initialImagesInfo={this.state.initialImagesInfo}
+ url={URL.UploadGoodsPorductImage}
+ onGetImageDetails={this.getImageDetails.bind(this)}
+ />
{/*
*/}
{/* 店铺分类 */}
- : }
+
- >
{/* 店铺分类结束 */}
diff --git a/src/pages/myGoodsEdit/myGoodsEdit.scss b/src/pages/myGoodsEdit/myGoodsEdit.scss
index ad00561..51bc471 100644
--- a/src/pages/myGoodsEdit/myGoodsEdit.scss
+++ b/src/pages/myGoodsEdit/myGoodsEdit.scss
@@ -3,24 +3,28 @@ $themeColor:#FF7142;
.goods-category{
- padding: 10px 20px;
+ padding-top: 10px;
.border-box{
border-bottom: 1Px solid #d6e4ef;
-
}
.at-input__container{
color:black;
font-weight: bold;
+ padding-left: 20px;
+ padding-right: 20px;
.at-input__input{
font-weight: normal
}
}
.img-box{
margin-top:10Px;
+ padding-left: 20px;
+ padding-right: 20px;
.img-container{
border: 1Px solid #d6e4ef;
border-radius:8rpx;
+
}
}
@@ -29,6 +33,8 @@ $themeColor:#FF7142;
}
.description-box{
margin-top:10Px;
+ padding-left: 20px;
+ padding-right: 20px;
}
}
@@ -97,6 +103,8 @@ $themeColor:#FF7142;
.input-box{
border-bottom: 1Px solid #d6e4ef;
display: flex;
+ padding-left: 20px;
+ padding-right: 20px;
}
.require{
color:red;
diff --git a/src/pages/myNeeds/myNeeds.js b/src/pages/myNeeds/myNeeds.js
index dec29ef..0a51852 100644
--- a/src/pages/myNeeds/myNeeds.js
+++ b/src/pages/myNeeds/myNeeds.js
@@ -187,21 +187,21 @@ class MyNeeds extends Component {
// 搜索按钮
onSearchButtonHandler() {
- showLoading({ title: '加载中' }).then(() => {
- this.setState({ currentPage: 1, loadMorePageIndex: 1 }, () => {
- this.getMyNeedsList({
- curr_page: this.state.currentPage,
- page_count: this.state.pageCount,
- sd_type: this.state.needsTypeSelected.id,
- sd_title: this.state.title,
- update_dateL: this.state.startDateSel,
- update_dateU: this.state.endDateSel,
- class_id: this.state.industryTypeSelected.id === '-1' ? '' : this.state.industryTypeSelected.id,
- state: this.state.needsStateSelected.id
- })
+ showLoading({ title: '加载中' })
+ this.setState({ currentPage: 1, loadMorePageIndex: 1 }, () => {
+ this.getMyNeedsList({
+ curr_page: this.state.currentPage,
+ page_count: this.state.pageCount,
+ sd_type: this.state.needsTypeSelected.id,
+ sd_title: this.state.title,
+ update_dateL: this.state.startDateSel,
+ update_dateU: this.state.endDateSel,
+ class_id: this.state.industryTypeSelected.id === '-1' ? '' : this.state.industryTypeSelected.id,
+ state: this.state.needsStateSelected.id
})
})
+
}
// 新增我的需求
addNeeds() {
diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js
index c95a9bb..79fc7c9 100644
--- a/src/serviceAPI.config.js
+++ b/src/serviceAPI.config.js
@@ -1,6 +1,6 @@
const LOCALURL = "http://192.168.1.230/"
- //const LOCALURL = "https://www.ihome6.com/"
+ // const LOCALURL = "https://www.ihome6.com/"
const URL = {
Base: LOCALURL,
diff --git a/todo list.json b/todo list.json
index bfe2a8d..dea82f9 100644
--- a/todo list.json
+++ b/todo list.json
@@ -19,66 +19,202 @@ bug: 商品编辑 增加图片后 图片顺序乱了
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
+// shop interaction
+import Taro, { Component } from '@tarojs/taro'
+import { View, Text,Picker } from '@tarojs/components'
-{/* 大类 */}
-
-
-
- 商品细节:
-
- {itemDescriptionPicsElementArray}
+import './shopTypeInteractionComp.scss'
+import loginExpired from '../../util/loginExpired';
+import { getGlobalStorage,setGlobalStorage } from '../../util/getSetStoage';
+
+class ShopTypeInteractionComp extends Component {
+
+ config = {
+ navigationBarTitleText: 'shopTypeInteractionComp'
+ }
+ constructor() {
+ super(...arguments);
+
+ this.state = {
+ initailMultiArray: [[{}], [{ name: '选择店铺分类', id: '' }]],
+ multiIndex: [0, 0],
+ interactionMultiArray: [],// 联动数据
+ }
+
+ }
+ // 店铺分类筛选列表GetShopTypeList
+ getShopTypeList(url) {
+ Taro.request({
+ url: url,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ id: this.props.shopId,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
+ 'X-Requested-With': 'XMLHttpRequest'
+ }
+ })
+ .then(res => {
+ // console.log('店铺分类目录', res)
+ // this.formatIndustryType(res.data.data)
+ // this.formatIndustTypeInit(res.data.data)
+ if (res.data.err_code === 0) {
+ if (res.data.data === null) {
+ return
+ }
+ console.log('店铺分类目录', res)
+ if(!getGlobalStorage('shopTypeObject')){
+ setGlobalStorage('shopTypeObject',res.data.data)
+ }
+ this.setState({
+ interactionMultiArray: this.interactionData(res.data.data),
+ initailMultiArray: this.initializedData(res.data.data)[0],
+ }, () => {
+
+ console.log('state',this.state.initailMultiArray,this.state.interactionMultiArray)
+ // this.passDataToParent(this.state.initailMultiArray)
+ //返回初始选项在 在商品编辑页面
+
+
+ // console.log('联动数据', this.state.interactionMultiArray)
+ // console.log('初始化数据', this.state.initailMultiArray)
+ // console.log('index初始化', this.state.multiIndex)
+
+
+ }) // 用递归来整理无限层次的数据
+ }else if (res.data.err_code === 88888) {
+ loginExpired(res)
+ } else {
+ console.log('店铺分类目录获取失败', res)
+ }
+ }
+ )
+ .catch(error => {
+ console.log('店铺分类请求错误', error)
+ })
+ }
+
+
+ // 递归整理无限层联动数据
+ interactionData(data) {
+ let parentArrayHolder = []
+ const keys = Object.keys(data)
+ for (let key of keys) {
+ let childrenArrayHolder = []
+ let parent = { name: data[key].n, id: key }
+ parentArrayHolder.push(parent)
+ for (let childItem of data[key].c) {
+ let child = { name: childItem.n, id: childItem.id }
+ childrenArrayHolder.push(child)
+ }
+ parent.children = childrenArrayHolder
+ }
+ return parentArrayHolder
+ }
+ // 递归整理无限层初始数据
+ initializedData(data) {
+ let outter = []
+ let inner = []
+ const keys = Object.keys(data)
+ for (let key of keys) {
+ outter.push({ name: data[key].n, id: key })
+ for (let child of data[key].c) {
+ inner.push({ name: child.n, id: child.id })
+ }
+ }
+ return [outter, inner]
+ }
+
+ // 触动联动筛选
+ bindMultiPickerCol(e) {
+ console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
+ const data = {
+ multiArray: this.state.initailMultiArray,
+ multiIndex: this.state.multiIndex
+ }
+ data.multiIndex[e.detail.column] = e.detail.value
+ if (e.detail.column == 0) {
+ for (let index in data.multiArray[0]) {
+ const indexNumber = Number(index)
+ if (indexNumber === data.multiIndex[0]) {
+ data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
+ }
+ }
+ }
+ this.setState({ multiIndex: data.multiIndex })
+ }
+ bindMultiPickerChange(e) {
+ // console.log('picker发送选择改变,携带值为', e.detail.value)
+ if (getGlobalStorage('shopInfo').shop_id) {
+ this.setState({
+ multiIndex: e.detail.value,
+ }, () => {
+ //判断如果interactionMultiArray 的子类为空 那就取父类, 反之取子类
+ let industryTypeSelected
+ industryTypeSelected = this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]]
+ this.passDataToParent(industryTypeSelected)
+ })
+
+ }
+
+
+ }
+
+
+ //--------------------结束-行业分类picker
+ passDataToParent(industryTypeSelected) {
+ this.props.onPassDataToChild(industryTypeSelected)
+ }
+
+
+ componentDidMount() {
+ this.getShopTypeList(this.props.url)
+ }
+
+ // 当然父组件有新的props的 会从新渲染组件
+ componentWillReceiveProps(nextProps) {
+
+
+ }
+ componentWillUnmount() { }
+
+ componentDidShow() { }
+
+ componentDidHide() { }
+
+ render() {
+ return (
+
+
+
+
+ *
+ 店铺分类:
+
+ {this.props.selectedValue.name}
+
+
+
+
-
-
-
-
- { /*子标签类*/}
-
- {
- this.state.subCurrent === 0
- ?
- 全部
-
- : null
- }
- {
- this.state.subCurrent === 1
- ? 好评
- : null
- }
- {
- this.state.subCurrent === 2
- ? 中评
- : null
- }
- {
- this.state.subCurrent === 3
- ? 差评
- : null
- }
- {
- this.state.subCurrent === 4
- ? 公开
- : null
- }
- {
- this.state.subCurrent === 5
- ? 匿名
- : null
- }
-
-
-
- 标签页三的内容
-
-
+ )
+ }
+}
+
+export default ShopTypeInteractionComp
+
-
\ No newline at end of file