Compare commits
No commits in common. "master" and "weapp" have entirely different histories.
@ -5,12 +5,5 @@ module.exports = {
|
||||
defineConstants: {
|
||||
},
|
||||
weapp: {},
|
||||
|
||||
h5: {
|
||||
esnextModules: ['taro-ui'],
|
||||
devServer:{
|
||||
host: "192.168.1.120",
|
||||
port:80
|
||||
}
|
||||
}
|
||||
h5: {}
|
||||
}
|
@ -8,7 +8,7 @@ const config = {
|
||||
'828': 1.81 / 2
|
||||
},
|
||||
sourceRoot: 'src',
|
||||
outputRoot: 'dist',
|
||||
outputRoot: 'dist',
|
||||
plugins: {
|
||||
babel: {
|
||||
sourceMap: true,
|
||||
@ -61,7 +61,6 @@ const config = {
|
||||
h5: {
|
||||
publicPath: '/',
|
||||
staticDirectory: 'static',
|
||||
esnextModules: ['@tarojs/components'],
|
||||
module: {
|
||||
postcss: {
|
||||
autoprefixer: {
|
||||
@ -70,7 +69,6 @@ const config = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = function (merge) {
|
||||
|
@ -5,7 +5,5 @@ module.exports = {
|
||||
defineConstants: {
|
||||
},
|
||||
weapp: {},
|
||||
h5: {
|
||||
esnextModules: ['taro-ui']
|
||||
}
|
||||
h5: {}
|
||||
}
|
||||
|
114
package.json
114
package.json
@ -1,59 +1,59 @@
|
||||
{
|
||||
"name": "cf-wx-app",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "cf-wx-app",
|
||||
"scripts": {
|
||||
"build:weapp": "taro build --type weapp",
|
||||
"build:swan": "taro build --type swan",
|
||||
"build:alipay": "taro build --type alipay",
|
||||
"build:h5": "taro build --type h5",
|
||||
"build:rn": "taro build --type rn",
|
||||
"dev:weapp": "npm run build:weapp -- --watch",
|
||||
"dev:swan": "npm run build:swan -- --watch",
|
||||
"dev:alipay": "npm run build:alipay -- --watch",
|
||||
"dev:h5": "npm run build:h5 -- --watch",
|
||||
"dev:rn": "npm run build:rn -- --watch"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tarojs/async-await": "1.2.17",
|
||||
"@tarojs/components": "1.2.17",
|
||||
"@tarojs/redux": "1.2.17",
|
||||
"@tarojs/redux-h5": "1.2.17",
|
||||
"@tarojs/router": "1.2.17",
|
||||
"@tarojs/taro": "1.2.17",
|
||||
"@tarojs/taro-alipay": "1.2.17",
|
||||
"@tarojs/taro-h5": "1.2.17",
|
||||
"@tarojs/taro-swan": "1.2.17",
|
||||
"@tarojs/taro-weapp": "1.2.17",
|
||||
"@tarojs/webpack-runner": "1.2.17",
|
||||
"nerv-devtools": "^1.3.9",
|
||||
"nervjs": "^1.3.9",
|
||||
"redux": "^4.0.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"taro-ui": "^1.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tarojs/plugin-babel": "1.2.17",
|
||||
"@tarojs/plugin-csso": "1.2.17",
|
||||
"@tarojs/plugin-sass": "1.2.17",
|
||||
"@tarojs/plugin-uglifyjs": "1.2.17",
|
||||
"@tarojs/webpack-runner": "1.2.17",
|
||||
"@types/react": "^16.4.8",
|
||||
"@types/webpack-env": "^1.13.6",
|
||||
"babel-eslint": "^8.2.3",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-plugin-transform-jsx-stylesheet": "^0.6.5",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-taro": "1.2.17",
|
||||
"eslint-plugin-import": "^2.12.0",
|
||||
"eslint-plugin-react": "^7.8.2",
|
||||
"eslint-plugin-taro": "1.2.17"
|
||||
}
|
||||
"name": "cf-wx-app",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "cf-wx-app",
|
||||
"scripts": {
|
||||
"build:weapp": "taro build --type weapp",
|
||||
"build:swan": "taro build --type swan",
|
||||
"build:alipay": "taro build --type alipay",
|
||||
"build:h5": "taro build --type h5",
|
||||
"build:rn": "taro build --type rn",
|
||||
"dev:weapp": "npm run build:weapp -- --watch",
|
||||
"dev:swan": "npm run build:swan -- --watch",
|
||||
"dev:alipay": "npm run build:alipay -- --watch",
|
||||
"dev:h5": "npm run build:h5 -- --watch",
|
||||
"dev:rn": "npm run build:rn -- --watch"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tarojs/async-await": "^1.2.0-beta.3",
|
||||
"@tarojs/components": "^1.2.0-beta.3",
|
||||
"@tarojs/redux": "^1.2.0-beta.3",
|
||||
"@tarojs/redux-h5": "^1.2.0-beta.3",
|
||||
"@tarojs/router": "^1.2.0-beta.3",
|
||||
"@tarojs/taro": "^1.2.0-beta.3",
|
||||
"@tarojs/taro-alipay": "^1.2.0-beta.3",
|
||||
"@tarojs/taro-h5": "^1.2.0-beta.3",
|
||||
"@tarojs/taro-swan": "^1.2.0-beta.3",
|
||||
"@tarojs/taro-weapp": "^1.2.0-beta.3",
|
||||
"@tarojs/webpack-runner": "^1.2.8",
|
||||
"nerv-devtools": "^1.3.9",
|
||||
"nervjs": "^1.3.9",
|
||||
"redux": "^4.0.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"taro-ui": "^1.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tarojs/plugin-babel": "^1.2.0-beta.3",
|
||||
"@tarojs/plugin-csso": "^1.2.0-beta.3",
|
||||
"@tarojs/plugin-sass": "^1.2.0",
|
||||
"@tarojs/plugin-uglifyjs": "^1.2.0-beta.3",
|
||||
"@tarojs/webpack-runner": "^1.2.0-beta.3",
|
||||
"@types/react": "^16.4.8",
|
||||
"@types/webpack-env": "^1.13.6",
|
||||
"babel-eslint": "^8.2.3",
|
||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-plugin-transform-jsx-stylesheet": "^0.6.5",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-taro": "^1.2.0-beta.3",
|
||||
"eslint-plugin-import": "^2.12.0",
|
||||
"eslint-plugin-react": "^7.8.2",
|
||||
"eslint-plugin-taro": "^1.2.0-beta.3"
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ $linearGreen:linear-gradient(to right, #5cb85c, #5cb85c);;
|
||||
$linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
page{
|
||||
height: 100%;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.input-index--at-input__title{
|
||||
@ -67,6 +66,3 @@ page{
|
||||
font-size: 25rpx;
|
||||
|
||||
}
|
||||
.ali-blue-color{
|
||||
color: #108ee9;
|
||||
}
|
@ -1,255 +0,0 @@
|
||||
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('店铺分类目录ali', 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() {
|
||||
// 只有店铺页面才有onAliValueFromChild
|
||||
|
||||
if (this.props.hasOwnProperty('onAliValueFromChild')) {
|
||||
this.props.onAliValueFromChild(false)
|
||||
} else {
|
||||
this.setState({
|
||||
AliIsShowPicker: false
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
aliConfirmButton() {
|
||||
// 只有店铺页面才有onAliValueFromChild
|
||||
if (this.props.hasOwnProperty('onAliValueFromChild')) {
|
||||
this.props.onAliValueFromChild(false)
|
||||
} else {
|
||||
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) {
|
||||
// 只有店铺页面才有isShowCurtain
|
||||
|
||||
if (nextProps.hasOwnProperty('isShowCurtain')) {
|
||||
this.setState({
|
||||
AliIsShowPicker: nextProps.isShowCurtain
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View className='shop-interaction' >
|
||||
<View className='picker-wrapper' onClick={this.invokeAliPicker.bind(this)} >
|
||||
<AtList>
|
||||
<AtListItem hasBorder={false} title='店铺分类' extraText={this.props.selectedValue.name} arrow='right' />
|
||||
</AtList>
|
||||
</View>
|
||||
{this.state.AliIsShowPicker ? <View>
|
||||
<View className='curtain' onClick={this.aliCancelButton.bind(this)} > </View>
|
||||
|
||||
<View class='ali-picker-container'>
|
||||
<View className='button'>
|
||||
<View className='cancel-button' onClick={this.aliCancelButton.bind(this)}>取消</View>
|
||||
<View className='confirm-button ali-blue-color' onClick={this.aliConfirmButton.bind(this)}>确定</View>
|
||||
</View>
|
||||
<picker-view value={this.state.multiIndex} onChange={this.aliBindMultiPickerCol.bind(this)}>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray[this.state.multiIndex[0]].children.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
|
||||
</picker-view>
|
||||
</View ></View> : null}
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ShopTypeInteractionComp
|
@ -1,91 +0,0 @@
|
||||
|
||||
.shop-interaction{
|
||||
opacity: 1;
|
||||
}
|
||||
.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%
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.curtain{
|
||||
height: 100%;
|
||||
background-color: black;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
opacity: 0.5;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.ali-picker-container{
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
bottom: 0px;
|
||||
left: 0;
|
||||
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;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
// .picker-wrapper{
|
||||
// .at-list__item{
|
||||
// background: rgba(0,0,0,1)
|
||||
// }
|
||||
// }
|
@ -1,303 +0,0 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Picker } from '@tarojs/components'
|
||||
import { AtList, AtListItem, } from 'taro-ui'
|
||||
|
||||
import './aliGoodsTypeInteraction.scss'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
let maxDepth = 0
|
||||
let initialDataArray = []
|
||||
class AliGoodsTypeInteraction extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: 'aliGoodsTypeInteraction'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.state = {
|
||||
///---行业分类 开始
|
||||
initailMultiArray: [[{ class_name: '选择商品分类', class_id: '' }], [], []], // 初始化底部数据
|
||||
multiIndex: [0, 0, 0, 0],// 默认联动列数为4个并且每一列都是第一行
|
||||
interactionMultiArray: [],// 联动
|
||||
|
||||
|
||||
///---行业分类 结束
|
||||
}
|
||||
|
||||
}
|
||||
//商品目录请求api GetShopCategoryList
|
||||
getProductCateList(url) {
|
||||
Taro.request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品分类目录', res)
|
||||
|
||||
const recursionInteractionData = this.recursionInteraction(res.data.data)
|
||||
maxDepth = 0
|
||||
initialDataArray = []
|
||||
|
||||
this.recursionInitialized(res.data.data) //
|
||||
const depthInArray = this.recursionDepth(res.data.data)
|
||||
console.log('depthInArray', depthInArray)
|
||||
console.log('initialDataArray', initialDataArray)
|
||||
for (let i = initialDataArray.length; i < depthInArray.length; i++) {
|
||||
initialDataArray.unshift([{ name: '--', id: '' }])
|
||||
}
|
||||
|
||||
this.setState({
|
||||
interactionMultiArray: recursionInteractionData,
|
||||
multiIndex: depthInArray,
|
||||
initailMultiArray: initialDataArray.reverse()
|
||||
}, () => {
|
||||
console.log('interactionMultiArray',this.state.interactionMultiArray)
|
||||
// 把全局变变量赋值给state之后,初始化商品分类为空, 不然第二次进去的时候会自动添加进去
|
||||
// console.log('联动数据', this.state.interactionMultiArray)
|
||||
// console.log('初始化数据', this.state.initailMultiArray)
|
||||
|
||||
|
||||
}) // 用递归来整理无限层次的数据
|
||||
// console.log('联动数据', this.recursionInteraction(res.data.data))
|
||||
// console.log('初始数据', this.recursionInitialized(res.data.data).reverse())
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
console.log('商品分类请求错误', error)
|
||||
})
|
||||
}
|
||||
|
||||
//联动确认
|
||||
bindMultiPickerChange(e) {
|
||||
// 如果没有上商品 那就不执行
|
||||
if (getGlobalStorage('shopInfo').shop_id) {
|
||||
this.setState({
|
||||
multiIndex: e.detail.value.map(item => { if (item === null) { item = 0 } return item })
|
||||
}, () => {
|
||||
// console.log('picker发送选择改变,携带值为', this.state.multiIndex)
|
||||
this.returnResultToParent()
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
returnResultToParent() {
|
||||
let selected = this.state.interactionMultiArray
|
||||
for (let index of this.state.multiIndex) {
|
||||
if (selected[index].children[0].id) {
|
||||
selected = selected[index].children
|
||||
} else {
|
||||
this.props.onPassDataToChild(selected[index])
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// 递归整理无限层初始数据,将整理好的数据赋值给initialDataArray
|
||||
recursionInitialized(data) {
|
||||
const arrayTem = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
}
|
||||
}
|
||||
if (data[0].children.length) {
|
||||
this.recursionInitialized(data[0].children)
|
||||
}
|
||||
initialDataArray.push(arrayTem)
|
||||
return arrayTem
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 递归整理无限层联动数据
|
||||
recursionInteraction(data) {
|
||||
let arrayTem = []
|
||||
for (let items of data) {
|
||||
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||
if (items.children) {
|
||||
arrayTem[arrayTem.length - 1].children = this.recursionInteraction(items.children)
|
||||
} else {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }]
|
||||
}
|
||||
}
|
||||
return arrayTem // 返回联动数据
|
||||
// return arrayTem
|
||||
}
|
||||
// 递归整理无限层初始数据
|
||||
// recursionInitialized(data) {
|
||||
// const arrayTem = []
|
||||
// const childrenHolderArray = []
|
||||
// if (data.length) {
|
||||
// for (let item of data) {
|
||||
// arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
// item.children ? childrenHolderArray.push(...item.children) : null
|
||||
// }
|
||||
// this.recursionInitialized(childrenHolderArray)
|
||||
// }
|
||||
|
||||
// arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
|
||||
// return initialDataArray
|
||||
// }
|
||||
|
||||
// 递归整理无限层初始数据
|
||||
recursionDepth(data) {
|
||||
const arrayTem = []
|
||||
const childrenHolderArray = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
item.children ? childrenHolderArray.push(...item.children) : null
|
||||
}
|
||||
this.recursionDepth(childrenHolderArray)
|
||||
maxDepth += 1
|
||||
}
|
||||
return new Array(maxDepth).fill(0)
|
||||
}
|
||||
|
||||
// 触动联动筛选
|
||||
bindMultiPickerCol(e) {
|
||||
console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
|
||||
console.log(this.state.initailMultiArray)
|
||||
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
|
||||
data.multiArray[2] = this.state.interactionMultiArray[indexNumber].children[data.multiIndex[1]].children
|
||||
data.multiArray[3] = this.state.interactionMultiArray[indexNumber].children[data.multiIndex[1]].children[data.multiIndex[2]].children
|
||||
}
|
||||
}
|
||||
} else if (e.detail.column == 1) {
|
||||
for (let index in data.multiArray[1]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[1]) {
|
||||
data.multiArray[2] = this.state.interactionMultiArray[data.multiIndex[0]].children[indexNumber].children
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.detail.column == 2) {
|
||||
for (let index in data.multiArray[2]) {
|
||||
const indexNumber = Number(index)
|
||||
if (indexNumber === data.multiIndex[2]) {
|
||||
data.multiArray[3] = this.state.interactionMultiArray[data.multiIndex[0]].children[data.multiIndex[1]].children[indexNumber].children
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({ multiIndex: data.multiIndex })
|
||||
}
|
||||
|
||||
aliBindMultiPickerCol(e) {
|
||||
console.log(',值为', e.detail.value)
|
||||
|
||||
this.setState({ multiIndex: e.detail.value })
|
||||
}
|
||||
|
||||
aliCancelButton() {
|
||||
this.setState({
|
||||
AliIsShowPicker: false
|
||||
})
|
||||
}
|
||||
aliConfirmButton() {
|
||||
this.setState({
|
||||
AliIsShowPicker: false
|
||||
})
|
||||
this.returnResultToParent()
|
||||
}
|
||||
invokeAliPicker() {
|
||||
this.setState({
|
||||
AliIsShowPicker: true
|
||||
})
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
if (getGlobalStorage('shopInfo').shop_id) {
|
||||
this.getProductCateList(this.props.url)
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View className='goods-interaction' >
|
||||
<View className='picker-wrapper' onClick={this.invokeAliPicker.bind(this)} >
|
||||
<AtList >
|
||||
<AtListItem hasBorder={false} title='商品分类' className='title' extraText={this.props.selectedValue.name} arrow='right' />
|
||||
</AtList>
|
||||
</View>
|
||||
{this.state.AliIsShowPicker ? <View>
|
||||
<View className='curtain' onClick={this.aliCancelButton.bind(this)} > </View>
|
||||
|
||||
<View class='ali-picker-container'>
|
||||
<View className='button'>
|
||||
<View className='cancel-button' onClick={this.aliCancelButton.bind(this)}>取消</View>
|
||||
<View className='confirm-button ali-blue-color' onClick={this.aliConfirmButton.bind(this)}>确定</View>
|
||||
</View>
|
||||
<picker-view value={this.state.multiIndex} onChange={this.aliBindMultiPickerCol.bind(this)}>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray[this.state.multiIndex[0]].children.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]].children.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]].children[this.state.multiIndex[2]].children.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</View ></View> : null}
|
||||
</View>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AliGoodsTypeInteraction
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
|
||||
.picker-wrapper{
|
||||
.item-content__info-title{
|
||||
font-weight: bold
|
||||
}
|
||||
.item-extra__info{
|
||||
color: black
|
||||
}
|
||||
.at-list__item{
|
||||
padding-left: 0px;
|
||||
}
|
||||
}
|
||||
.curtain{
|
||||
height: 100%;
|
||||
background-color: black;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
opacity: 0.5;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left:0
|
||||
}
|
||||
|
||||
.ali-picker-container{
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
bottom: 0px;
|
||||
left:0;
|
||||
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;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
@ -1,235 +0,0 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Picker } from '@tarojs/components'
|
||||
import { AtList, AtListItem, } from 'taro-ui'
|
||||
|
||||
import './aliIndustryTypeInteraction.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
let maxDepth = 0
|
||||
let initialDataArray = []
|
||||
class AliIndustryTypeInteraction extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: 'aliIndustryTypeInteraction'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.state = {
|
||||
///---行业分类 开始
|
||||
initailMultiArray: '',// 初始化底部数据
|
||||
multiIndex: [0, 0],
|
||||
interactionMultiArray: [],// 联动
|
||||
AliIsShowPicker: false,
|
||||
///---行业分类 结束
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 行业分类筛选列表GetIndustryTypeList
|
||||
getIndustryTypeList(url) {
|
||||
Taro.request({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('res',res)
|
||||
if (res.data.err_code === 0) {
|
||||
|
||||
let initailMultiArray = this.recursionInitialized(res.data.data)
|
||||
initailMultiArray[1].unshift({ name: '全部', id: '-1' })
|
||||
initailMultiArray[0] = [{ name: '--', id: '' }]
|
||||
// console.log('initailMultiArray', initailMultiArray)
|
||||
|
||||
|
||||
this.setState({
|
||||
initailMultiArray: initailMultiArray.reverse(), //initailMultiArray.reverse(),
|
||||
interactionMultiArray: [{ name: '全部', id: '-1', children: [{ name: '--', id: '' }] }, ...this.recursionInteraction(res.data.data)],
|
||||
multiIndex: this.recursionDepth(res.data.data),
|
||||
}, () => {
|
||||
initialDataArray = []
|
||||
console.log('state',this.state.interactionMultiArray)
|
||||
})
|
||||
|
||||
} else if (res.data.err_code === 88888) {
|
||||
// loginExpired(res)
|
||||
} else {
|
||||
console.log('行业分类请求没有成功', res)
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(error => {
|
||||
console.log('行业分类请求错误', error)
|
||||
})
|
||||
}
|
||||
// 递归整理无限层联动数据
|
||||
recursionInteraction(data) {
|
||||
let arrayTem = []
|
||||
for (let items of data) {
|
||||
arrayTem.push({ name: items.class_name, id: items.class_id })
|
||||
if (items.child.length) {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }, ...this.recursionInteraction(items.child)]
|
||||
} else {
|
||||
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }]
|
||||
}
|
||||
}
|
||||
return arrayTem // 返回联动数据
|
||||
// return arrayTem
|
||||
}
|
||||
// 递归整理无限层初始数据
|
||||
recursionInitialized(data) {
|
||||
const arrayTem = []
|
||||
const childrenHolderArray = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
if (data.indexOf(item) === 0) {
|
||||
item.child.length ? childrenHolderArray.push(...item.child) : null
|
||||
}
|
||||
}
|
||||
this.recursionInitialized(childrenHolderArray)
|
||||
}
|
||||
arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
|
||||
return initialDataArray
|
||||
}
|
||||
// 递归整理无限层层次
|
||||
recursionDepth(data) {
|
||||
const arrayTem = []
|
||||
const childrenHolderArray = []
|
||||
if (data.length) {
|
||||
for (let item of data) {
|
||||
arrayTem.push({ name: item.class_name, id: item.class_id })
|
||||
item.child.length ? childrenHolderArray.push(...item.child) : null
|
||||
}
|
||||
this.recursionDepth(childrenHolderArray)
|
||||
maxDepth += 1
|
||||
}
|
||||
return new Array(maxDepth).fill(0)
|
||||
}
|
||||
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 })
|
||||
|
||||
}
|
||||
|
||||
//--------------------开始-行业分类picker
|
||||
bindMultiPickerChange(e) {
|
||||
this.setState({
|
||||
multiIndex: e.detail.value,
|
||||
}, () => {
|
||||
this.passDataToParent()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------结束-行业分类picker
|
||||
passDataToParent() {
|
||||
const parent = this.state.interactionMultiArray[this.state.multiIndex[0]]
|
||||
const child = this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]]
|
||||
child.id ? this.props.onPassDataToChild(child) : this.props.onPassDataToChild(parent)
|
||||
}
|
||||
|
||||
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.getIndustryTypeList(this.props.url)
|
||||
}
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View className='industry-interaction' >
|
||||
<View className='picker-wrapper' onClick={this.invokeAliPicker.bind(this)} >
|
||||
<AtList >
|
||||
<AtListItem hasBorder={false} title='行业分类' className='title' extraText={this.props.selectedValue.name} arrow='right' />
|
||||
</AtList>
|
||||
</View>
|
||||
{this.state.AliIsShowPicker ? <View>
|
||||
<View className='curtain' onClick={this.aliCancelButton.bind(this)} > </View>
|
||||
|
||||
<View class='ali-picker-container'>
|
||||
<View className='button'>
|
||||
<View className='cancel-button' onClick={this.aliCancelButton.bind(this)}>取消</View>
|
||||
<View className='confirm-button ali-blue-color' onClick={this.aliConfirmButton.bind(this)}>确定</View>
|
||||
</View>
|
||||
<picker-view value={this.state.multiIndex} onChange={this.aliBindMultiPickerCol.bind(this)}>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
<picker-view-column>
|
||||
{this.state.interactionMultiArray[this.state.multiIndex[0]].children.map((item, index) => {
|
||||
return <View key={index}>{item.name}</View>
|
||||
})}
|
||||
</picker-view-column>
|
||||
|
||||
</picker-view>
|
||||
</View ></View> : null}
|
||||
</View>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AliIndustryTypeInteraction
|
||||
|
@ -1,47 +0,0 @@
|
||||
|
||||
.picker-wrapper{
|
||||
.item-content__info-title{
|
||||
font-weight: bold
|
||||
}
|
||||
.item-extra__info{
|
||||
color: black
|
||||
}
|
||||
.at-list__item{
|
||||
padding-left: 0px;
|
||||
}
|
||||
}
|
||||
.curtain{
|
||||
height: 100%;
|
||||
background-color: black;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
opacity: 0.5;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left:0
|
||||
}
|
||||
|
||||
.ali-picker-container{
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
bottom: 0px;
|
||||
left:0;
|
||||
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;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image, Button } from '@tarojs/components'
|
||||
import { AtIcon } from 'taro-ui'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
|
||||
import './aliPictureUploadComponent.scss'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class PictureUploadComponent extends Component {
|
||||
|
||||
|
||||
// maxLength={4}
|
||||
// isReceiveImageUrl={true}
|
||||
// url={URL.UploadDSPorductImage}
|
||||
// onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
// initialImageURL={this.state.initialImageURL}
|
||||
// initialImagesInfo={this.state.initialImagesInfo}
|
||||
static defaultProps = {
|
||||
url: '',
|
||||
maxLength: 100,
|
||||
isReceiveImageUrl: true,
|
||||
imageURLList: []
|
||||
};
|
||||
config = {
|
||||
navigationBarTitleText: 'pictureUploadComponent'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
this.state = {
|
||||
imageURL: [],
|
||||
imageDetails: [],
|
||||
onlyOnce: true,// initial props 只setstate一次
|
||||
}
|
||||
}
|
||||
uploadImage() {
|
||||
const that = this
|
||||
my.chooseImage({
|
||||
count: this.props.maxLength,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success(res) {
|
||||
// tempFilePath可以作为img标签的src属性显示图片
|
||||
// console.log('res.apFilePaths',res.apFilePaths)
|
||||
res.apFilePaths.forEach(item => {
|
||||
that.onChangeImg(item)
|
||||
});
|
||||
},
|
||||
fail(err) {
|
||||
Taro.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// 上传图片apo
|
||||
onChangeImg(files) {
|
||||
const that = this
|
||||
my.uploadFile({
|
||||
url: this.props.url,
|
||||
filePath: files,
|
||||
fileName: 'file',
|
||||
fileType: 'image',
|
||||
formData: {
|
||||
'key': 'michael',
|
||||
},
|
||||
header: {
|
||||
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryAWxeadaAVmRVQCiz',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
const data = JSON.parse(response.data)
|
||||
|
||||
if (data.err_code === 0) {
|
||||
console.log('上传成功')
|
||||
const imagePath = URL.Base + data.file_path
|
||||
that.setState({ imageURL: [...that.state.imageURL, { url: imagePath }], imageDetails: [...that.state.imageDetails, data] }, () => {
|
||||
that.props.onGetImageDetails(that.state.imageDetails)
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
fail(err) {
|
||||
Taro.showToast({
|
||||
title: err,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
deleteButton(e) {
|
||||
const value = onClickValueService(e)
|
||||
this.state.imageURL.splice(value, 1)
|
||||
this.state.imageDetails.splice(value, 1)
|
||||
this.setState({
|
||||
imageURL: this.state.imageURL,
|
||||
imageDetails: this.state.imageDetails,
|
||||
}, () => {
|
||||
this.props.onGetImageDetails(this.state.imageDetails)
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
// 当然父组件有新的props的 会从新渲染组件
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
if (nextProps.isReceiveImageUrl) {
|
||||
if (this.state.onlyOnce) {
|
||||
this.setState({
|
||||
imageURL: nextProps.initialImageURL,
|
||||
imageDetails: nextProps.initialImagesInfo,
|
||||
onlyOnce: false
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
const { maxLength } = this.props
|
||||
const imageElementArray = this.state.imageURL.map((item, index) => {
|
||||
return <View key={index} className='image-wrapper'>
|
||||
<View className='delete' onClick={this.deleteButton.bind(this, index)}><AtIcon value='close' size='15' color='#FFFFFF'></AtIcon>
|
||||
</View>
|
||||
<Image className='goods-img'
|
||||
mode='aspectFit' style='max-height: 100%; max-width: 100%;'
|
||||
src={item.url}
|
||||
/>
|
||||
</View>
|
||||
})
|
||||
return (
|
||||
|
||||
<View class='pictureUploadComponent' > {this.state.imageURL.length < maxLength ? <Button onClick={this.uploadImage.bind(this)}>上传图片</Button> : null} < View className='image-container' > {imageElementArray}</View></View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default PictureUploadComponent
|
||||
|
@ -1,21 +0,0 @@
|
||||
.image-container{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
.image-wrapper{
|
||||
box-sizing: border-box;
|
||||
width: 25%;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
.delete{
|
||||
position: absolute;
|
||||
top:10px;
|
||||
right: 10px;
|
||||
background-color: rgb(153, 153, 153);
|
||||
opacity: 0.8;
|
||||
padding: 5px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
//scrollToTopComponent
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, MovableArea, MovableView } from '@tarojs/components'
|
||||
import { View, Text,MovableArea, MovableView } from '@tarojs/components'
|
||||
|
||||
|
||||
import './backToCenterComponent.scss'
|
||||
@ -14,9 +14,9 @@ class BackToCenterComponent extends Component {
|
||||
}
|
||||
|
||||
|
||||
goToCenterPage() {
|
||||
goToCenterPage(){
|
||||
Taro.switchTab({
|
||||
url: '/pages/individualCenter/individualCenter'
|
||||
url:'/pages/individualCenter/individualCenter'
|
||||
})
|
||||
}
|
||||
|
||||
@ -35,11 +35,17 @@ class BackToCenterComponent extends Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
// <View className='backToCenterComponent' onClick={this.goToCenterPage.bind(this)}>
|
||||
// <View className='box'>
|
||||
// <View>个人中心</View>
|
||||
|
||||
// </View>
|
||||
|
||||
// </View>
|
||||
<MovableArea style='height: 100vh; width: 100%; position:fixed; top:0; '>
|
||||
<View>hello world</View>
|
||||
<MovableView style='height: 50px; width: 50px; background: blue;opacity:1' direction='all'></MovableView>
|
||||
</MovableArea>
|
||||
<View>hello world</View>
|
||||
<MovableView style='height: 50px; width: 50px; background: blue;opacity:1' direction='all'></MovableView>
|
||||
</MovableArea>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
47
src/component/clientTabBarComponent/clientTabBarComponent.js
Normal file
47
src/component/clientTabBarComponent/clientTabBarComponent.js
Normal file
@ -0,0 +1,47 @@
|
||||
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 (
|
||||
<View className='clientTabBarComponent'>
|
||||
<AtTabBar
|
||||
fixed
|
||||
tabList={[
|
||||
{ title: '首页', iconType: 'bullet-list', text: 'new' },
|
||||
{ title: '需求发布', iconType: 'camera' },
|
||||
{ title: '我的需求', iconType: 'folder', text: '100', max: '99' },
|
||||
{ title: '个人中心', iconType: 'folder', text: '100', max: '99' },
|
||||
]}
|
||||
onClick={this.handleClick.bind(this)}
|
||||
current={this.state.current}
|
||||
/>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ClientTabBarComponent
|
@ -35,14 +35,15 @@ class recommondShop extends Component {
|
||||
isOpenConsult: false,
|
||||
consultTip: '',
|
||||
voucherResponseMsg: 'i am voucherResponseMsg',
|
||||
userName: '',
|
||||
userPhone: '',
|
||||
userName: getGlobalStorage('user_identity').username || '',
|
||||
userPhone: getGlobalStorage('user_identity').userphone || '',
|
||||
isCanConsult: true,
|
||||
isCanVoucher: true
|
||||
|
||||
}
|
||||
}
|
||||
goToShop(e) {
|
||||
|
||||
const value = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/shop/shop?id=' + value.shop_id
|
||||
@ -222,10 +223,6 @@ class recommondShop extends Component {
|
||||
//console.log(this.props, nextProps)
|
||||
}
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
userName: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').username : '',
|
||||
userPhone: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').userphone : '',
|
||||
})
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
@ -268,12 +265,12 @@ class recommondShop extends Component {
|
||||
<Text>联系人:</Text>
|
||||
</View>
|
||||
<View className='value'>
|
||||
<Input name='value'
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
placeholder='请输入联系人'
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
<Input name='value'
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
placeholder='请输入联系人'
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
|
||||
@ -283,13 +280,13 @@ class recommondShop extends Component {
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View className='value'>
|
||||
<Input name='value'
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
placeholder='请输入联系电话'
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
<Input name='value'
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
placeholder='请输入联系电话'
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</AtModalContent>
|
||||
|
@ -148,7 +148,6 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
text-overflow: ellipsis;
|
||||
.details-text{
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Picker} from '@tarojs/components'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
|
||||
import { Picker } from 'taro-ui'
|
||||
|
||||
import './goodsTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
|
@ -1,12 +1,14 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Picker } from '@tarojs/components'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
|
||||
import { Picker } from 'taro-ui'
|
||||
|
||||
import './interactionComponent.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
// 这个是行业分类的联动
|
||||
|
||||
let maxDepth = 0
|
||||
let initialDataArray = []
|
||||
class Interaction extends Component {
|
||||
|
78
src/component/sellerTabBarComponent/sellerTabBarComponent.js
Normal file
78
src/component/sellerTabBarComponent/sellerTabBarComponent.js
Normal file
@ -0,0 +1,78 @@
|
||||
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 (
|
||||
<View className='sellerTabBarComponent'>
|
||||
<AtTabBar
|
||||
fixed
|
||||
tabList={this.state.options}
|
||||
onClick={this.handleClick.bind(this)}
|
||||
current={this.state.current}
|
||||
/>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default SellerTabBarComponent
|
@ -20,7 +20,7 @@ class ShopItem extends Component {
|
||||
shopOnClickHanlder(){
|
||||
let goodId=this.props.item.goods_id
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id='+encodeURIComponent(goodId)
|
||||
url: '/pages/goods/goods?id='+goodId
|
||||
})
|
||||
}
|
||||
componentDidMount(){
|
||||
|
@ -40,8 +40,6 @@
|
||||
margin:0 5%;
|
||||
.name{
|
||||
font-size: 30px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Picker } from '@tarojs/components'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
|
||||
import { Picker } from 'taro-ui'
|
||||
|
||||
import './shopTypeInteractionComp.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage,setGlobalStorage } from '../../util/getSetStoage';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
class ShopTypeInteractionComp extends Component {
|
||||
@ -47,14 +48,13 @@ class ShopTypeInteractionComp extends Component {
|
||||
}
|
||||
console.log('店铺分类目录', res)
|
||||
if(!getGlobalStorage('shopTypeObject')){
|
||||
setGlobalStorage('shopTypeObject',res.data.data)
|
||||
Taro.setStorageSync('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)
|
||||
//返回初始选项在 在商品编辑页面
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image, Button, Picker } from '@tarojs/components'
|
||||
import { AtInput, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import { View, Text, Image, Button } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
@ -13,384 +12,372 @@ import URL from '../../serviceAPI.config'
|
||||
import './allDemanding.scss'
|
||||
import eyeIcon from '../../icons/eye.png'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
|
||||
|
||||
|
||||
class AllDemanding extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '全部业主需求'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
supplys: [], // 需求列表
|
||||
demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
|
||||
demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
|
||||
industryTypeSelected: { name: '全部', id: '' },// 当前行业分类
|
||||
title: '',
|
||||
startDateSel: '',
|
||||
endDateSel: '',
|
||||
isOpenedGrabModal: false,
|
||||
grabOrderId: '',//抢到订单的id
|
||||
isGrabOrderSuccess: false,// 是否显示轻提示
|
||||
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
||||
isAddToList: false,// / 请求业主需求的时候是否添加到旧列表里
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1
|
||||
config = {
|
||||
navigationBarTitleText: '全部业主需求'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
supplys: [], // 需求列表
|
||||
demandingState: [{ name: '全部', id: '' }, { name: '在用', id: '1' }, { name: '已抢单', id: '2' }, { name: '已抢光', id: '3' },], // 供求状态选择
|
||||
demandingStateSelected: { name: '全部', id: '' }, // 当前供求状态
|
||||
industryTypeSelected: { name: '全部', id: '' },// 当前行业分类
|
||||
title: '',
|
||||
startDateSel: '',
|
||||
endDateSel: '',
|
||||
isOpenedGrabModal: false,
|
||||
grabOrderId: '',//抢到订单的id
|
||||
isGrabOrderSuccess: false,// 是否显示轻提示
|
||||
grabOrderSuccess: '无法显示绑定后的字段',// 抢单成功返回字段
|
||||
isAddToList: false,// / 请求业主需求的时候是否添加到旧列表里
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索业主需求函数
|
||||
searchDemanding({
|
||||
curr_page = 1,
|
||||
page_count = 10,
|
||||
sd_title = this.state.title,
|
||||
state = this.state.demandingStateSelected.id,
|
||||
update_dateL = this.state.startDateSel,
|
||||
update_dateU = this.state.endDateSel,
|
||||
class_id = this.state.industryTypeSelected.id
|
||||
}) {
|
||||
Taro.request({
|
||||
url: URL.GetAllDemanding,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
sd_title: sd_title,
|
||||
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',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_code === 0) {
|
||||
if (res.data.supplys) {
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
||||
} else {
|
||||
this.setState({ supplys: res.data.supplys })
|
||||
}
|
||||
} else {
|
||||
if (this.state.isAddToList) {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
this.setState({ supplys: [] })
|
||||
}
|
||||
|
||||
}
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
this.setState({ isAddToList: false })
|
||||
})
|
||||
}
|
||||
|
||||
// 改变需求选项
|
||||
changeDemandingState = e => {
|
||||
this.setState({
|
||||
demandingStateSelected: this.state.demandingState[e.detail.value]
|
||||
})
|
||||
}
|
||||
titleChange(event) {
|
||||
this.setState({ title: event })
|
||||
}
|
||||
|
||||
//改变开始日期
|
||||
onStartDateChange = e => {
|
||||
this.setState({
|
||||
startDateSel: e.detail.value,
|
||||
|
||||
})
|
||||
}
|
||||
// 改变结束日期
|
||||
onEndDateChange = e => {
|
||||
this.setState({
|
||||
endDateSel: e.detail.value
|
||||
})
|
||||
}
|
||||
// 抢单接口
|
||||
GrabDemand({ demandId = 218 }) {
|
||||
Taro.request({
|
||||
url: URL.GrabDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||
icon: res.data.err_msg === 'success' ? 'success' : 'none'
|
||||
})
|
||||
this.searchDemanding({ curr_page: 1 })
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
}
|
||||
else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
console.log('抢单请求:', res)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索业主需求函数
|
||||
searchDemanding({
|
||||
curr_page = 1,
|
||||
page_count = 10,
|
||||
sd_title = this.state.title,
|
||||
state = this.state.demandingStateSelected.id,
|
||||
update_dateL = this.state.startDateSel,
|
||||
update_dateU = this.state.endDateSel,
|
||||
class_id = this.state.industryTypeSelected.id
|
||||
}) {
|
||||
Taro.request({
|
||||
url: URL.GetAllDemanding,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
sd_title: sd_title,
|
||||
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',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_code === 0) {
|
||||
if (res.data.supplys) {
|
||||
if (this.state.isAddToList) {
|
||||
this.setState({ supplys: this.state.supplys.concat(res.data.supplys), isAddToList: false })
|
||||
} else {
|
||||
this.setState({ supplys: res.data.supplys })
|
||||
}
|
||||
} else {
|
||||
if (this.state.isAddToList) {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
this.setState({ supplys: [] })
|
||||
}
|
||||
|
||||
}
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
this.setState({ isAddToList: false })
|
||||
})
|
||||
}
|
||||
|
||||
// 改变需求选项
|
||||
changeDemandingState = e => {
|
||||
this.setState({
|
||||
demandingStateSelected: this.state.demandingState[e.detail.value]
|
||||
})
|
||||
}
|
||||
titleChange(event) {
|
||||
this.setState({ title: event })
|
||||
}
|
||||
|
||||
//改变开始日期
|
||||
onStartDateChange = e => {
|
||||
this.setState({
|
||||
startDateSel: e.detail.value,
|
||||
|
||||
})
|
||||
}
|
||||
// 改变结束日期
|
||||
onEndDateChange = e => {
|
||||
this.setState({
|
||||
endDateSel: e.detail.value
|
||||
})
|
||||
}
|
||||
// 抢单接口
|
||||
GrabDemand({ demandId = 218 }) {
|
||||
Taro.request({
|
||||
url: URL.GrabDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||
icon: res.data.err_msg === 'success' ? 'success' : 'none'
|
||||
})
|
||||
this.searchDemanding({ curr_page: 1 })
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
}
|
||||
else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
console.log('抢单请求:', res)
|
||||
})
|
||||
|
||||
}
|
||||
grabOrder(e) {
|
||||
const id = onClickValueService(e)
|
||||
this.setState({ isOpenedGrabModal: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
this.setState({ isOpenedGrabModal: false })
|
||||
}
|
||||
handleGrabModalCancel() {
|
||||
this.setState({ isOpenedGrabModal: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
this.setState({ isOpenedGrabModal: false })
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
searchHanlder() {
|
||||
showLoading({ title: '加载中' })
|
||||
this.searchDemanding({})
|
||||
}
|
||||
//清空筛选项
|
||||
emptyFilter() {
|
||||
this.setState({
|
||||
title: '',
|
||||
endDateSel: '',
|
||||
startDateSel: '',
|
||||
demandingStateSelected: { name: '全部', id: '' },
|
||||
industryTypeSelected: { name: '全部', id: '' },
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
|
||||
getDataFromChild(value) {
|
||||
console.log('从子组件传回来的值', value)
|
||||
this.setState({ industryTypeSelected: value })
|
||||
}
|
||||
|
||||
goToGrabOrderPage(e) {
|
||||
const id = onClickValueService(e)
|
||||
let orderId = encodeURIComponent(id)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
componentDidMount() {
|
||||
// 得到第一页需求数据
|
||||
showLoading({ title: '加载中' })
|
||||
this.searchDemanding({})
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
grabOrder(e) {
|
||||
const id = onClickValueService(e)
|
||||
this.setState({ isOpenedGrabModal: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
this.setState({ isOpenedGrabModal: false })
|
||||
}
|
||||
handleGrabModalCancel() {
|
||||
this.setState({ isOpenedGrabModal: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
this.setState({ isOpenedGrabModal: false })
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
searchHanlder() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.searchDemanding({})
|
||||
}
|
||||
//清空筛选项
|
||||
emptyFilter() {
|
||||
this.setState({
|
||||
title: '',
|
||||
endDateSel: '',
|
||||
startDateSel: '',
|
||||
demandingStateSelected: { name: '全部', id: '' },
|
||||
industryTypeSelected: { name: '全部', id: '' },
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '已清空',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
getDataFromChild(value) {
|
||||
console.log('从子组件传回来的值', value)
|
||||
this.setState({ industryTypeSelected: value })
|
||||
}
|
||||
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
this.searchDemanding({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
goToGrabOrderPage(e) {
|
||||
const id = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + id
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
componentDidMount() {
|
||||
// 得到第一页需求数据
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
this.searchDemanding({})
|
||||
})
|
||||
|
||||
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpenedGrabModal}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认抢单?
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
this.searchDemanding({ curr_page: this.state.loadMorePageIndex })
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
|
||||
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpenedGrabModal}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认抢单?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
const allDemandingElementArray = this.state.supplys.length ? this.state.supplys.map((item, index) => {
|
||||
return <View className='demanding-info' key={index}>
|
||||
<View className='header'>
|
||||
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
|
||||
<View className='name'> 业主:{item.user_name}</View>
|
||||
<View className='others'>
|
||||
<Text className='cate'>{item.class_name + ' '} </Text>
|
||||
|
|
||||
const allDemandingElementArray = this.state.supplys.length ? this.state.supplys.map((item, index) => {
|
||||
return <View className='demanding-info' key={index}>
|
||||
<View className='header'>
|
||||
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
|
||||
<View className='name'> 业主:{item.user_name}</View>
|
||||
<View className='others'>
|
||||
<Text className='cate'>{item.class_name + ' '} </Text>
|
||||
|
|
||||
<Image src={eyeIcon} style='width:12px; height:12px; vertical-align:middle;' />
|
||||
<Text className='watch'>{item.browse_times}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='body'>
|
||||
<View className='image-container' onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<Image style='width:100%;height:100%' src={URL.Base + item.file_path[0].thumb_path} />
|
||||
</View>
|
||||
<View className='detail'>
|
||||
<View className='title'>{item.sd_title}</View>
|
||||
<View className='para'>{item.sd_desc}</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
</View>
|
||||
</View>
|
||||
<View className='footer'>
|
||||
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon>{item.user_address}</View>
|
||||
<View className='time'>更新日期:{item.update_date}</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
}) : <View className='no-more-title'>没有更多了</View>
|
||||
return (
|
||||
<View className='allDemanding'>
|
||||
{/* 模态框 */}
|
||||
{modalMessageGrabElement}
|
||||
|
||||
<View className='page-section'>
|
||||
{/* 供求状态选择 */}
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.demandingState} onChange={this.changeDemandingState}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> 供求状态:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
|
||||
<Text className='watch'>{item.browse_times}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='body'>
|
||||
<View className='image-container' onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<Image style='width:100%;height:100%' src={URL.Base + item.file_path[0].thumb_path} />
|
||||
</View>
|
||||
<View className='detail'>
|
||||
<View className='title'>{item.sd_title}</View>
|
||||
<View className='para'>{item.sd_desc}</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrder.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
</View>
|
||||
</View>
|
||||
<View className='footer'>
|
||||
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon>{item.user_address}</View>
|
||||
<View className='time'>更新日期:{item.update_date}</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='input-box'>
|
||||
|
||||
<AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
placeholder='需求标题'
|
||||
value={this.state.title}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
border={false}
|
||||
/>
|
||||
</View>
|
||||
{/* 开始和结束日期选择 */}
|
||||
<View className='page-section-picker'>
|
||||
<View className='picker-box'>
|
||||
<View className='picker-wrapper'>
|
||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
}) : <View className='no-more-title'>没有更多了</View>
|
||||
return (
|
||||
<View className='allDemanding'>
|
||||
{/* 模态框 */}
|
||||
{modalMessageGrabElement}
|
||||
|
||||
<View className='picker-wrapper'>
|
||||
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>结束日期:</Text> <Text className='date'>{this.state.endDateSel}</Text>
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
{/* 供求状态选择 */}
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.demandingState} onChange={this.changeDemandingState}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> 供求状态:</Text> <Text className='selected'>{this.state.demandingStateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
|
||||
<View className='input-box'>
|
||||
|
||||
<AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
placeholder='需求标题'
|
||||
value={this.state.title}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
{/* 开始和结束日期选择 */}
|
||||
<View className='page-section'>
|
||||
<View className='picker-box'>
|
||||
<View className='picker-wrapper'>
|
||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
|
||||
<View className='picker-wrapper'>
|
||||
<Picker className='picker-container' mode='date' start={this.state.startDateSel} onChange={this.onEndDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>结束日期:</Text> <Text className='date'>{this.state.endDateSel}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
{/* 行业分类选择 */}
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
||||
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.searchHanlder.bind(this)}>
|
||||
<Button type='primary' size='mini' className='button-orange' >
|
||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||
搜索</Button>
|
||||
</View>
|
||||
|
||||
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
||||
<Button type='primary' size='mini' className='button-dark-red' >
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
清空</Button>
|
||||
</View>
|
||||
</View>
|
||||
{/* 供求页面的数据加载 */}
|
||||
<View className='demanding-box'>
|
||||
{allDemandingElementArray}
|
||||
</View>
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
{/* 行业分类选择 */}
|
||||
{platformChecker() ?
|
||||
<InteractionComponent url={URL.GetIndustryTypeList}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
selectedValue={this.state.industryTypeSelected}></InteractionComponent> :
|
||||
<AliIndustryTypeInteraction url={URL.GetIndustryTypeList}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
selectedValue={this.state.industryTypeSelected} />
|
||||
}
|
||||
|
||||
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.searchHanlder.bind(this)}>
|
||||
<Button type='primary' size='mini' className='button-orange' >
|
||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||
搜索</Button>
|
||||
</View>
|
||||
|
||||
<View className='button' onClick={this.emptyFilter.bind(this)}>
|
||||
<Button type='primary' size='mini' className='button-dark-red' >
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
清空</Button>
|
||||
</View>
|
||||
</View>
|
||||
{/* 供求页面的数据加载 */}
|
||||
<View className='demanding-box'>
|
||||
{allDemandingElementArray}
|
||||
</View>
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AllDemanding
|
||||
|
@ -17,34 +17,31 @@ $themeColor: #FF7142;
|
||||
.page-section{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
|
||||
.picker{
|
||||
// padding: 24rpx 0;
|
||||
.selected{
|
||||
display: inline-block;
|
||||
margin-left: 20%;
|
||||
font-size: 32rpx
|
||||
}
|
||||
.date{
|
||||
display: inline-block;
|
||||
|
||||
font-size: 32rpx
|
||||
}
|
||||
.title-box{
|
||||
.title{
|
||||
//color: #333;
|
||||
margin-right:16rpx;
|
||||
width:172rpx;
|
||||
font-size:32rpx;
|
||||
line-height:100px;
|
||||
// vertical-align:middle;
|
||||
text-align:left;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.page-section-picker{
|
||||
.picker{
|
||||
// padding: 24rpx 0;
|
||||
.selected{
|
||||
display: inline-block;
|
||||
margin-left: 20%;
|
||||
font-size: 32rpx
|
||||
}
|
||||
.date{
|
||||
display: inline-block;
|
||||
|
||||
font-size: 32rpx
|
||||
}
|
||||
.title-box{
|
||||
.title{
|
||||
//color: #333;
|
||||
margin-right:16rpx;
|
||||
width:172rpx;
|
||||
font-size:32rpx;
|
||||
line-height:100px;
|
||||
// vertical-align:middle;
|
||||
text-align:left;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.input-box{
|
||||
display: flex;
|
||||
|
@ -1,108 +0,0 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Image } from '@tarojs/components'
|
||||
import URL from '../../../serviceAPI.config'
|
||||
|
||||
|
||||
import './aliGoodCommentSection.scss'
|
||||
|
||||
//接收的参数
|
||||
// mainActived,subActived,productImagesUrl
|
||||
|
||||
class AliGoodCommentSection extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '商品详情和评论'
|
||||
}
|
||||
|
||||
passMainCurrentToParent(value) {
|
||||
this.props.onAliMainOnClick(value)
|
||||
}
|
||||
passSubCurrentToParent(value) {
|
||||
this.props.onAliSubOnClick(value)
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
const { mainActived, subActived, productImagesUrl } = this.props
|
||||
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
|
||||
const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '中评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
|
||||
const tabArrayElement = mainTabList.map((item, index) => {
|
||||
return <View className={mainActived === index ? 'tab actived' : 'tab'} key={index} onClick={this.passMainCurrentToParent.bind(this, index)}>
|
||||
{item.title}
|
||||
</View>
|
||||
})
|
||||
const subTabArrayElement = subTabList.map((item, index) => {
|
||||
return <View className={subActived === index ? 'sub-tab sub-actived' : 'sub-tab'} key={index} onClick={this.passSubCurrentToParent.bind(this, index)}>
|
||||
{item.title}
|
||||
</View>
|
||||
})
|
||||
const itemDescriptionPicsElementArray = productImagesUrl.map((item, index) => {
|
||||
return <View className='description-img' key={index}>
|
||||
<Image mode='widthFix' src={URL.Base + item.file_path} style='width: 100%; max-height:100%;' />
|
||||
|
||||
</View>
|
||||
})
|
||||
return (
|
||||
<View className='aliGoodCommentSection'>
|
||||
<View className='tab-wrapper'>
|
||||
<View className='tabs'>
|
||||
{tabArrayElement}
|
||||
</View>
|
||||
<View className='tab-details'>
|
||||
{mainActived === 0 && <View className='first-tab' style='background-color: #FAFBFC;' >
|
||||
|
||||
<View className='description-title'>商品细节:</View>
|
||||
<View className='description-img'>
|
||||
{itemDescriptionPicsElementArray}
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
}
|
||||
{mainActived === 1 && <View className='second-tab'>
|
||||
<View className='tab-header'> {subTabArrayElement}</View>
|
||||
|
||||
|
||||
{
|
||||
subActived === 0 && <View className='sub-tab-details'>全部</View>
|
||||
}
|
||||
{
|
||||
subActived === 1 && <View className='sub-tab-details'>好评</View>
|
||||
}
|
||||
{
|
||||
subActived === 2 && <View className='sub-tab-details'>中评</View>
|
||||
}
|
||||
{
|
||||
subActived === 3 && <View className='sub-tab-details'>差评</View>
|
||||
}
|
||||
{
|
||||
subActived === 4 && <View className='sub-tab-details'>公开</View>
|
||||
}
|
||||
{
|
||||
subActived === 5 && <View className='sub-tab-details'>匿名</View>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</View>}
|
||||
{mainActived === 2 && <View className='third-tab' >标签页三的内容</View>}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AliGoodCommentSection
|
@ -1,72 +0,0 @@
|
||||
.tabs{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
height: 80px;
|
||||
|
||||
border-bottom: 0.01px solid #d6e4ef;
|
||||
.tab{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
}
|
||||
.actived{
|
||||
color:#FF7142;
|
||||
border-bottom: 3px solid#FF7142
|
||||
}
|
||||
}
|
||||
.tab-details{
|
||||
|
||||
border: 1px solid #d6e4ef;
|
||||
.first-tab{
|
||||
.description-title{
|
||||
font-size:35px;
|
||||
color:#999;
|
||||
margin-top:20px;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.description-img{
|
||||
padding:0 10px;
|
||||
font-size: 0px;
|
||||
}
|
||||
}
|
||||
.second-tab{
|
||||
.tab-header{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
border-bottom: 0.1px solid #d6e4ef;
|
||||
.sub-tab{
|
||||
flex:1;
|
||||
text-align: center;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
}
|
||||
.sub-tab-details{
|
||||
padding: 100px 50px;
|
||||
background-color: #FAFBFC;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
}
|
||||
.third-tab{
|
||||
padding: 100px 50px;
|
||||
background-color: #FAFBFC;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.actived{
|
||||
color:#FF7142;
|
||||
border-bottom: 3px solid#FF7142
|
||||
}
|
||||
.sub-actived{
|
||||
color:#FF7142;
|
||||
border: 2px solid#FF7142;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Image, Text } from '@tarojs/components'
|
||||
import { AtTabs, AtTabsPane, AtSegmentedControl } from 'taro-ui'
|
||||
import URL from '../../../serviceAPI.config'
|
||||
|
||||
|
||||
|
||||
|
||||
import './goodCommentSection.scss'
|
||||
// 需要的props
|
||||
//productImagesUrl,current,subCurrent,onhandleClick,onClick
|
||||
|
||||
|
||||
class GoodCommentSection extends Component {
|
||||
config = {
|
||||
navigationBarTitleText: '商品详情和评论'
|
||||
}
|
||||
|
||||
passMainCurrentToParent(value){
|
||||
this.props.onMainOnClick(value)
|
||||
}
|
||||
passSubCurrentToParent(value){
|
||||
this.props.onSubOnClick(value)
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
|
||||
const { productImagesUrl, mainCurrent, subCurrent, } = this.props
|
||||
const itemDescriptionPicsElementArray = productImagesUrl.map((item, index) => {
|
||||
return <View className='description-img' key={index}>
|
||||
<Image mode='widthFix' src={URL.Base + item.file_path} style='width: 100%; max-height:100%;' />
|
||||
|
||||
</View>
|
||||
})
|
||||
return (
|
||||
<View className='good-info-section'>
|
||||
<View className='details-box'>
|
||||
{/* 大类 */}
|
||||
<AtTabs className='alltabs' animated={false} current={mainCurrent} tabList={mainTabList} onClick={this.passMainCurrentToParent.bind(this)}>
|
||||
<AtTabsPane style='color:red' current={this.state.current} index={0} >
|
||||
<View style='background-color: #FAFBFC;' >
|
||||
|
||||
<View className='description-title'>商品细节:</View>
|
||||
<View className='description-img'>
|
||||
{itemDescriptionPicsElementArray}
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</AtTabsPane>
|
||||
<AtTabsPane current={subCurrent} index={1}>
|
||||
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>
|
||||
{ /*子标签类*/}
|
||||
<AtSegmentedControl selectedColor='#FF9500'
|
||||
values={['全部', '好评', '中评', '差评', '公开', '匿名']}
|
||||
onClick={this.passSubCurrentToParent.bind(this)}
|
||||
current={subCurrent}
|
||||
/>
|
||||
{
|
||||
this.state.subCurrent === 0
|
||||
? <View className='tab-content'>
|
||||
<Text className='title'>全部</Text>
|
||||
</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 1
|
||||
? <View className='tab-content'>好评</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 2
|
||||
? <View className='tab-content'>中评</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 3
|
||||
? <View className='tab-content'>差评</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 4
|
||||
? <View className='tab-content'>公开</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 5
|
||||
? <View className='tab-content'>匿名</View>
|
||||
: null
|
||||
}
|
||||
|
||||
</View>
|
||||
</AtTabsPane>
|
||||
<AtTabsPane current={this.state.current} index={2}>
|
||||
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;'>标签页三的内容</View>
|
||||
</AtTabsPane>
|
||||
</AtTabs>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default GoodCommentSection
|
@ -1,22 +0,0 @@
|
||||
.details-box{
|
||||
.at-tabs{
|
||||
|
||||
.at-tabs__item--active{
|
||||
// color:$themeColor
|
||||
}
|
||||
}
|
||||
.description-title{
|
||||
font-size:35px;
|
||||
color:#999;
|
||||
margin-top:20px;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.description-img{
|
||||
padding:0 10px;
|
||||
font-size: 0px;
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +1,13 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image, Swiper, SwiperItem, Picker } from '@tarojs/components'
|
||||
import { AtIcon } from 'taro-ui'
|
||||
import { View, Text, Image, Swiper, SwiperItem } from '@tarojs/components'
|
||||
|
||||
import GoodCommentSection from './goodCommentSection/goodCommentSection'
|
||||
import AliGoodCommentSection from './aliGoodCommentSection/aliGoodCommentSection'
|
||||
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, Picker } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import platformChecker from '../../util/plaformChecker'
|
||||
|
||||
import LoginService from '../../util/LoginService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './goods.scss'
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
|
||||
class Goods extends Component {
|
||||
|
||||
@ -35,26 +31,21 @@ class Goods extends Component {
|
||||
monthSold: '',//月销量
|
||||
totalSold: '',//总销量
|
||||
browsingCount: '',// 浏览数
|
||||
shopId: '',
|
||||
actived: 0,// 默认tab
|
||||
subActived: 0,//默认sub-tab
|
||||
shopId: ''
|
||||
}
|
||||
}
|
||||
|
||||
// 商品详情api
|
||||
getGoodDescription() {
|
||||
|
||||
let goodId = decodeURIComponent(this.$router.params.id)
|
||||
|
||||
Taro.request({
|
||||
url: URL.GetShopItemDetail,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
goodsID: goodId,
|
||||
goodsID: this.$router.params.id,
|
||||
},
|
||||
header: {
|
||||
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
@ -89,13 +80,13 @@ class Goods extends Component {
|
||||
}
|
||||
|
||||
// 大类评论区方法
|
||||
mainTabClick(value) {
|
||||
handleClick(value) {
|
||||
this.setState({
|
||||
current: value
|
||||
})
|
||||
}
|
||||
// 小磊评论区方法
|
||||
subTabClick(value) {
|
||||
onClick(value) {
|
||||
this.setState({
|
||||
subCurrent: value
|
||||
})
|
||||
@ -131,18 +122,6 @@ class Goods extends Component {
|
||||
})
|
||||
|
||||
}
|
||||
aliMainTabClick(e) {
|
||||
let value = onClickValueService(e)
|
||||
this.setState({
|
||||
actived: value
|
||||
})
|
||||
}
|
||||
aliSubTabClick(e) {
|
||||
let value = onClickValueService(e)
|
||||
this.setState({
|
||||
subActived: value
|
||||
})
|
||||
}
|
||||
// 数量或者规格方法
|
||||
onChange = e => {
|
||||
this.setState({
|
||||
@ -151,9 +130,9 @@ class Goods extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
})
|
||||
this.getGoodDescription()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -167,9 +146,7 @@ class Goods extends Component {
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
|
||||
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
|
||||
const itemPicsBannerElementArray = this.state.productImagesUrl.map((item, index) => {
|
||||
return <SwiperItem key={index} >
|
||||
@ -179,19 +156,25 @@ class Goods extends Component {
|
||||
</SwiperItem >
|
||||
})
|
||||
|
||||
const itemDescriptionPicsElementArray = this.state.productImagesUrl.map((item, index) => {
|
||||
return <View className='description-img' key={index}>
|
||||
<Image mode='widthFix' src={URL.Base + item.file_path} style='width: 100%; max-height:100%;' />
|
||||
|
||||
</View>
|
||||
|
||||
})
|
||||
return (
|
||||
<View className='gooods=container'>
|
||||
<View className='img-box'>
|
||||
{/* <Image className='img' src={URL.Base + this.state.productImagesUrl}></Image> */}
|
||||
<Swiper
|
||||
className='swipper'
|
||||
style='height:100%;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
className='swipper'
|
||||
style='height:100%;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
>
|
||||
{itemPicsBannerElementArray}
|
||||
|
||||
@ -257,20 +240,70 @@ class Goods extends Component {
|
||||
</Picker>
|
||||
</View>
|
||||
{/* 详情和评论区 */}
|
||||
<View className='details-box'>
|
||||
{/* 大类 */}
|
||||
<AtTabs className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
|
||||
<AtTabsPane style='color:red' current={this.state.current} index={0} >
|
||||
<View style='background-color: #FAFBFC;' >
|
||||
|
||||
<View className='description-title'>商品细节:</View>
|
||||
<View className='description-img'>
|
||||
{itemDescriptionPicsElementArray}
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</AtTabsPane>
|
||||
<AtTabsPane current={this.state.current} index={1}>
|
||||
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>
|
||||
{ /*子标签类*/}
|
||||
<AtSegmentedControl selectedColor='#FF9500'
|
||||
values={['全部', '好评', '中评', '差评', '公开', '匿名']}
|
||||
onClick={this.onClick.bind(this)}
|
||||
current={this.state.subCurrent}
|
||||
/>
|
||||
{
|
||||
this.state.subCurrent === 0
|
||||
? <View className='tab-content'>
|
||||
<Text className='title'>全部</Text>
|
||||
</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 1
|
||||
? <View className='tab-content'>好评</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 2
|
||||
? <View className='tab-content'>中评</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 3
|
||||
? <View className='tab-content'>差评</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 4
|
||||
? <View className='tab-content'>公开</View>
|
||||
: null
|
||||
}
|
||||
{
|
||||
this.state.subCurrent === 5
|
||||
? <View className='tab-content'>匿名</View>
|
||||
: null
|
||||
}
|
||||
|
||||
</View>
|
||||
</AtTabsPane>
|
||||
<AtTabsPane current={this.state.current} index={2}>
|
||||
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;'>标签页三的内容</View>
|
||||
</AtTabsPane>
|
||||
</AtTabs>
|
||||
|
||||
</View>
|
||||
|
||||
{platformChecker() ? <GoodCommentSection
|
||||
productImagesUrl={this.state.productImagesUrl}
|
||||
mainCurrent={this.state.current}
|
||||
subCurrent={this.state.subCurrent}
|
||||
onMainOnClick={this.state.mainTabClick.bind(this)}
|
||||
onSubOnClick={this.state.subTabClick.bind(this)}
|
||||
/> : <AliGoodCommentSection
|
||||
mainActived={this.state.actived}
|
||||
subActived={this.state.subActived}
|
||||
productImagesUrl={this.state.productImagesUrl}
|
||||
onAliMainOnClick={this.state.aliMainTabClick.bind(this)}
|
||||
onAliSubOnClick={this.state.aliSubTabClick.bind(this)}
|
||||
/>}
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
<View className='gap' style='height:150rpx'>
|
||||
</View>
|
||||
@ -297,7 +330,7 @@ class Goods extends Component {
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</View >
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,30 @@ $themeColor:#FF7142;
|
||||
|
||||
|
||||
}
|
||||
//------------------------------
|
||||
.details-box{
|
||||
.at-tabs{
|
||||
|
||||
.at-tabs__item--active{
|
||||
// color:$themeColor
|
||||
}
|
||||
}
|
||||
.description-title{
|
||||
font-size:35px;
|
||||
color:#999;
|
||||
margin-top:20px;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.description-img{
|
||||
padding:0 10px;
|
||||
font-size: 0px;
|
||||
}
|
||||
|
||||
}
|
||||
//------------------------------
|
||||
.copyright-box{
|
||||
|
||||
padding:0 20px;
|
||||
@ -190,3 +213,4 @@ $themeColor:#FF7142;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, AtTextarea, AtImagePicker } from 'taro-ui'
|
||||
import { AtInput, AtImagePicker, AtTextarea, } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
|
||||
|
||||
|
||||
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
||||
import AliShopTypeInteraction from '../../component/AliShopTypeInteraction/AliShopTypeInteraction'
|
||||
import GoodsTypeInteractionComp from '../../component/goodsTypeInteractionComp/goodsTypeInteractionComp'
|
||||
import AliGoodsTypeInteraction from '../../component/aliGoodsTypeInteraction/aliGoodsTypeInteraction'
|
||||
|
||||
import LoginService from '../../util/LoginService'
|
||||
import URL from '../../serviceAPI.config'
|
||||
@ -16,9 +14,6 @@ import URL from '../../serviceAPI.config'
|
||||
import './goodsPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserShopOwner } from '../../util/checkLogin';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
class GoodsPublish extends Component {
|
||||
|
||||
@ -28,6 +23,7 @@ class GoodsPublish extends Component {
|
||||
constructor() {
|
||||
super(...arguments)
|
||||
this.state = {
|
||||
|
||||
shopTypeSelected: { name: '选择店铺类型', id: '' },//已选的店铺分类
|
||||
goodsTypeSelected: { name: '选择商品分类', id: '' },// 已选的商品分类
|
||||
productName: '',
|
||||
@ -112,7 +108,7 @@ class GoodsPublish extends Component {
|
||||
if (this.state.isPublish) {
|
||||
// 导航到编辑页面
|
||||
Taro.redirectTo({
|
||||
url: '/pages/myGoodList/myGoodList'
|
||||
url: '/pages/myGoodsList/myGoodsList'
|
||||
})
|
||||
} else if (this.state.isPublishAndAdd) {
|
||||
// 导航到发布页面
|
||||
@ -209,12 +205,7 @@ class GoodsPublish extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
|
||||
publishButtonHandler() {
|
||||
|
||||
if (this.state.productName &&
|
||||
@ -223,22 +214,22 @@ class GoodsPublish extends Component {
|
||||
this.state.ImagesInfo.length &&
|
||||
this.state.goodsTypeSelected.id &&
|
||||
this.state.shopTypeSelected.id) {
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublish: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
class_id: this.state.goodsTypeSelected.id,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublish: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
class_id: this.state.goodsTypeSelected.id,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
Taro.showToast({ title: '请填写完表格', icon: 'none' })
|
||||
}
|
||||
@ -251,22 +242,22 @@ class GoodsPublish extends Component {
|
||||
this.state.ImagesInfo.length &&
|
||||
this.state.goodsTypeSelected.id &&
|
||||
this.state.shopTypeSelected.id) {
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublishAndAdd: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
class_id: this.state.goodsTypeSelected.id,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublishAndAdd: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
class_id: this.state.goodsTypeSelected.id,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
Taro.showToast({ title: '请填写完表格', icon: 'none' })
|
||||
}
|
||||
@ -298,8 +289,8 @@ class GoodsPublish extends Component {
|
||||
}
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// console.log(this.props, nextProps)
|
||||
}
|
||||
@ -307,7 +298,12 @@ class GoodsPublish extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
isUserShopOwner()
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -321,16 +317,11 @@ class GoodsPublish extends Component {
|
||||
|
||||
<View className='goods-category'>
|
||||
{/* 商品分类开始 */}
|
||||
{platformChecker() ? <GoodsTypeInteractionComp
|
||||
<GoodsTypeInteractionComp
|
||||
url={URL.GetProductCategoryList}
|
||||
onPassDataToChild={this.getDataFromGoodsChild.bind(this)}
|
||||
selectedValue={this.state.goodsTypeSelected}
|
||||
></GoodsTypeInteractionComp>
|
||||
|
||||
: <AliGoodsTypeInteraction url={URL.GetProductCategoryList}
|
||||
onPassDataToChild={this.getDataFromGoodsChild.bind(this)}
|
||||
selectedValue={this.state.goodsTypeSelected} />}
|
||||
|
||||
{/* 商品分类结束 */}
|
||||
|
||||
<View className='input-box'>
|
||||
@ -373,7 +364,7 @@ class GoodsPublish extends Component {
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>上传图片:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <View className='img-container'>
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
files={this.state.pickerImageUrl}
|
||||
@ -381,24 +372,14 @@ class GoodsPublish extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View> : <AliPictureUploadComponent maxLength={20} isReceiveImageUrl={false} url={URL.UploadGoodsPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
|
||||
}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
{platformChecker() ?
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
></ShopTypeInteractionComp>
|
||||
|
||||
: <AliShopTypeInteraction url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
></AliShopTypeInteraction>
|
||||
}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
></ShopTypeInteractionComp>
|
||||
{/* 店铺分类结束 */}
|
||||
|
||||
|
||||
@ -407,19 +388,12 @@ class GoodsPublish extends Component {
|
||||
<Text className='require'></Text>
|
||||
<Text className='title'>商品简介:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
<AtTextarea
|
||||
value={this.state.productDescript}
|
||||
onChange={this.productDescriptChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='你的产品简介'
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.productDescriptChange.bind(this)}
|
||||
value={this.state.productDescript}
|
||||
placeholder='你的产品简介'
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<View className='button-box' >
|
||||
|
@ -18,20 +18,17 @@ $themeColor:#FF7142;
|
||||
}
|
||||
.img-box{
|
||||
margin-top:10Px;
|
||||
|
||||
.img-container{
|
||||
border: 1Px solid #d6e4ef;
|
||||
border-radius:8rpx;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
.shoptype-box{
|
||||
margin-top:10Px;
|
||||
}
|
||||
.description-box{
|
||||
margin-top:10Px;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -91,7 +88,6 @@ $themeColor:#FF7142;
|
||||
.page-section{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
|
||||
|
||||
}
|
||||
.selected{
|
||||
display: inline-block;
|
||||
@ -101,7 +97,6 @@ $themeColor:#FF7142;
|
||||
.input-box{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
display: flex;
|
||||
|
||||
}
|
||||
.require{
|
||||
color:red;
|
||||
@ -109,23 +104,5 @@ $themeColor:#FF7142;
|
||||
|
||||
}
|
||||
|
||||
.picker-wrapper{
|
||||
.item-content__info-title{
|
||||
font-weight: bold
|
||||
}
|
||||
.item-extra__info{
|
||||
color: black
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.textarea-wrapper{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgb(214, 228, 239);
|
||||
border-radius: 8px;
|
||||
padding:5px;
|
||||
.text-area{
|
||||
height: 150px;
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import './grabOrderPage.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
class GrabOrderPage extends Component {
|
||||
@ -30,6 +29,7 @@ class GrabOrderPage extends Component {
|
||||
content: '',
|
||||
images: [],
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: this.$router.params.orderId,
|
||||
stateId: '',
|
||||
stateName: '',
|
||||
userId: '',
|
||||
@ -40,13 +40,12 @@ class GrabOrderPage extends Component {
|
||||
|
||||
//获取抢单信息api supplyDemandDetails
|
||||
getGrabOrderInfo() {
|
||||
let orderId=decodeURIComponent(this.$router.params.orderId)
|
||||
Taro.request({
|
||||
url: URL.supplyDemandDetails,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: orderId,
|
||||
demandId: this.$router.params.orderId,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -74,10 +73,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'
|
||||
})
|
||||
}
|
||||
|
||||
@ -89,13 +88,12 @@ class GrabOrderPage extends Component {
|
||||
}
|
||||
//抢单请求
|
||||
GrabDemand({ demandId = 218 }) {
|
||||
let id=encodeURIComponent(demandId)
|
||||
Taro.request({
|
||||
url: URL.GrabDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: id
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -113,7 +111,7 @@ class GrabOrderPage extends Component {
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
delta:1
|
||||
})
|
||||
}, 1500);
|
||||
|
||||
@ -155,16 +153,15 @@ class GrabOrderPage extends Component {
|
||||
handleGrabConfirm() {
|
||||
this.setState({ isOpen: false })
|
||||
// 确认抢单之后
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
this.GrabDemand({ demandId: this.$router.params.orderId })
|
||||
})
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
Taro.showLoading({
|
||||
title:'加载中'
|
||||
})
|
||||
this.getGrabOrderInfo()
|
||||
}
|
||||
@ -188,7 +185,7 @@ class GrabOrderPage extends Component {
|
||||
})
|
||||
}
|
||||
goMyNeedEditPage() {
|
||||
let id = encodeURIComponent(this.$router.params.orderId)
|
||||
let id = this.$router.params.orderId
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id
|
||||
})
|
||||
@ -200,18 +197,16 @@ class GrabOrderPage extends Component {
|
||||
this.setState({ isDeleteModal: false })
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
|
||||
this.setState({ isDeleteModal: false })
|
||||
this.deleteMyNeeds({ demandId: this.$router.params.orderId })
|
||||
}
|
||||
deleteMyNeeds({ demandId }) {
|
||||
let id=encodeURIComponent(demandId)
|
||||
Taro.request({
|
||||
url: URL.DeleteMyNeeds,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: id
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
@ -228,7 +223,7 @@ class GrabOrderPage extends Component {
|
||||
})
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack({
|
||||
delta: -1
|
||||
delta:-1
|
||||
})
|
||||
}, 1500);
|
||||
} else if (res.data.err_code === 88888) {
|
||||
@ -244,7 +239,7 @@ class GrabOrderPage extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const localStoageUserId = getGlobalStorage('userInfo') ? getGlobalStorage('userInfo').user_id : ''
|
||||
const localStoageUserId = getGlobalStorage('userInfo').user_id
|
||||
|
||||
// 提示框
|
||||
const deleteModalWindowElement = <AtModal isOpened={this.state.isDeleteModal}>
|
||||
@ -254,82 +249,58 @@ class GrabOrderPage extends Component {
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleWindowModCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleWindowConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
let ButtonElement
|
||||
if (localStoageUserId === this.state.userId && this.state.stateId === '1') {
|
||||
ButtonElement = <View className='button-box'>
|
||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的需求</Button>
|
||||
</View>
|
||||
{/* <View className='button' onClick={this.goMyNeedEditPage.bind(this)}>
|
||||
<Button size='mini' className='button-blue'>
|
||||
<AtIcon value='settings' size='12' color='white'></AtIcon>
|
||||
修改</Button>
|
||||
</View>
|
||||
|
||||
|
||||
let ButtonElement = localStoageUserId === this.state.userId ? <View className='button-box'>
|
||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
<View className='button' onClick={this.deleteButton.bind(this)}>
|
||||
<Button size='mini' className='button-dark-red'>
|
||||
<AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
删除</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的需求</Button>
|
||||
} else if (localStoageUserId === this.state.userId && this.state.stateId != '1') {
|
||||
ButtonElement = <View className='button-box'>
|
||||
<View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
<Button size='mini' className='button-green'>
|
||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>
|
||||
<AtIcon value='' size='12' color='white'></AtIcon>
|
||||
我的需求</Button>
|
||||
</View>
|
||||
</View>
|
||||
</View> :
|
||||
this.state.stateId === '1' ? <View className='button-box'><View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
||||
} else if (this.state.stateId === '1') {
|
||||
ButtonElement = <View className='button-box'><View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View></View> :
|
||||
this.state.stateId === '2' ? <View className='button-box'><View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>已抢单</Button>
|
||||
</View></View> :
|
||||
<View className='button-box'><View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>已抢光</Button>
|
||||
</View></View>
|
||||
</View></View>
|
||||
|
||||
|
||||
// if (localStoageUserId === this.state.userId && this.state.stateId === '1') {
|
||||
// ButtonElement = <View className='button-box'>
|
||||
// <View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
// <Button size='mini' className='button-green'>
|
||||
// <AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
// 新增</Button>
|
||||
// </View>
|
||||
// <View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
// <Button size='mini' className='button-orange'>
|
||||
// <AtIcon value='' size='12' color='white'></AtIcon>
|
||||
// 我的需求</Button>
|
||||
// </View>
|
||||
// {/* <View className='button' onClick={this.goMyNeedEditPage.bind(this)}>
|
||||
// <Button size='mini' className='button-blue'>
|
||||
// <AtIcon value='settings' size='12' color='white'></AtIcon>
|
||||
// 修改</Button>
|
||||
// </View>
|
||||
|
||||
// <View className='button' onClick={this.deleteButton.bind(this)}>
|
||||
// <Button size='mini' className='button-dark-red'>
|
||||
// <AtIcon value='trash' size='12' color='white'></AtIcon>
|
||||
// 删除</Button>
|
||||
// </View> */}
|
||||
// </View>
|
||||
// } else if (localStoageUserId === this.state.userId && this.state.stateId != '1') {
|
||||
// ButtonElement = <View className='button-box'>
|
||||
// <View className='button' onClick={this.goMyNeedsPublishPage.bind(this)}>
|
||||
// <Button size='mini' className='button-green'>
|
||||
// <AtIcon value='add' size='12' color='white'></AtIcon>
|
||||
// 新增</Button>
|
||||
// </View>
|
||||
// <View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
// <Button size='mini' className='button-orange'>
|
||||
// <AtIcon value='' size='12' color='white'></AtIcon>
|
||||
// 我的需求</Button>
|
||||
// </View>
|
||||
// </View>
|
||||
// } else if (this.state.stateId === '1') {
|
||||
// ButtonElement = <View className='button-box'><View className='button' onClick={this.grabButtonHandler.bind(this)}>
|
||||
// <Button size='mini' className='button-orange'>抢单</Button>
|
||||
// </View></View>
|
||||
|
||||
// } else if (this.state.stateId === '2') {
|
||||
// ButtonElement = <View className='button-box'><View className='button'>
|
||||
// <Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||
// </View></View>
|
||||
// } else if (this.state.stateId === '3') {
|
||||
// ButtonElement = <View className='button-box'><View className='button'>
|
||||
// <Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||
// </View></View>
|
||||
// }
|
||||
} else if (this.state.stateId === '2') {
|
||||
ButtonElement = <View className='button-box'><View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||
</View></View>
|
||||
} else if (this.state.stateId === '3') {
|
||||
ButtonElement = <View className='button-box'><View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{this.state.stateName}</Button>
|
||||
</View></View>
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -353,7 +324,7 @@ class GrabOrderPage extends Component {
|
||||
{modalMessageGrabElement}
|
||||
{deleteModalWindowElement}
|
||||
{this.state.isShowRendering ? <RenderingView rendering={this.state.renderingImage}></RenderingView> : null}
|
||||
{this.state.stateId === '3' && !this.state.isShowRendering && this.state.renderingImage.length ? <View className='button-box show-image-button'><View className='button' onClick={this.showImageButton.bind(this)}>
|
||||
{this.state.stateId === '3' && !this.state.isShowRendering&&this.state.renderingImage.length ? <View className='button-box show-image-button'><View className='button' onClick={this.showImageButton.bind(this)}>
|
||||
<Button className='button-orange'>查看效果图</Button>
|
||||
</View></View> : null}
|
||||
<View className='type box'>
|
||||
|
@ -12,8 +12,7 @@ class ClientDemanding extends Component {
|
||||
}
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(e) {
|
||||
const id = onClickValueService(e)
|
||||
let orderId=encodeURIComponent(id)
|
||||
const orderId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
|
@ -17,8 +17,6 @@ $themeColor: #FF7142;
|
||||
}
|
||||
}
|
||||
.item-title{
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
font-size: 40px;
|
||||
min-height: 21px;
|
||||
clear: both;
|
||||
|
@ -13,8 +13,6 @@ import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './home.scss'
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
|
||||
|
||||
|
||||
@ -37,8 +35,8 @@ class Home extends Component {
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: '',//用户名字
|
||||
userPhone: '',// 用户电话
|
||||
userName: Taro.getStorageSync('user_identity').userName || '',//用户名字
|
||||
userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
@ -52,7 +50,7 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
// onPullDownRefresh() {
|
||||
// showLoading({ title: '加载中' })
|
||||
// Taro.showLoading({ title: '加载中' })
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
@ -114,7 +112,6 @@ class Home extends Component {
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
@ -147,11 +144,13 @@ class Home extends Component {
|
||||
)
|
||||
}
|
||||
getUserLocation() {
|
||||
|
||||
if (process.env.TARO_ENV === 'alipay') {
|
||||
return new Promise((resolve, reject) => {
|
||||
my.getLocation({
|
||||
success(res) {
|
||||
my.hideLoading();
|
||||
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
@ -162,23 +161,30 @@ class Home extends Component {
|
||||
})
|
||||
|
||||
})
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -235,7 +241,7 @@ class Home extends Component {
|
||||
onClickParentCate(e) {
|
||||
const item = onClickValueService(e)
|
||||
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
@ -245,7 +251,7 @@ class Home extends Component {
|
||||
// 点击子类
|
||||
clickChildCateHanlder(e) {
|
||||
const item = onClickValueService(e)
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||
@ -293,6 +299,8 @@ class Home extends Component {
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
|
||||
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
@ -304,23 +312,27 @@ class Home extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
showLoading({ title: '加载中' })
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getUserLocation().then(res => {
|
||||
this.setState({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
}, () => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
}).catch(err => {
|
||||
Taro.showToast({
|
||||
title: '定位获取失败',
|
||||
icon: 'none'
|
||||
})
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
@ -351,7 +363,7 @@ class Home extends Component {
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||
|
@ -9,14 +9,7 @@ $themeColor: #FF7142;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.first-banner {
|
||||
height:250px;
|
||||
.banner-img{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.third-banner{
|
||||
.first-banner ,.third-banner{
|
||||
height:200px;
|
||||
.banner-img{
|
||||
height: 100%;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View , Swiper, SwiperItem } from '@tarojs/components'
|
||||
import { AtGrid} from 'taro-ui'
|
||||
import { View } from '@tarojs/components'
|
||||
import { AtGrid, Swiper, SwiperItem } from 'taro-ui'
|
||||
|
||||
import URL from '../../../serviceAPI.config'
|
||||
import './mainCateSlider.scss'
|
||||
@ -28,6 +28,7 @@ class MainCateSlider extends Component {
|
||||
item.value = item.class_name
|
||||
return item
|
||||
})
|
||||
console.log('formatedData', formatedData)
|
||||
return formatedData
|
||||
}
|
||||
render() {
|
||||
|
@ -1,40 +1,45 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, ScrollView } from '@tarojs/components'
|
||||
import { View } from '@tarojs/components'
|
||||
import { AtGrid, Swiper, SwiperItem } from 'taro-ui'
|
||||
import URL from '../../../serviceAPI.config'
|
||||
import './subCateSlider.scss'
|
||||
|
||||
|
||||
class SubCateSlider extends Component {
|
||||
passDataToParent(e) {
|
||||
|
||||
this.props.onClickChildCate(e)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { subCateList } = this.props
|
||||
const subCateElementsArray = subCateList.map((item, index) => {
|
||||
return <View key={index} onClick={this.passDataToParent.bind(this, item)} className='view-item'>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</View>
|
||||
})
|
||||
passDataToParent(e) {
|
||||
|
||||
return (
|
||||
this.props.onClickChildCate(e)
|
||||
}
|
||||
|
||||
<ScrollView
|
||||
className='scroll-view'
|
||||
scrollX
|
||||
scrollWithAnimation
|
||||
scrollTop='0'
|
||||
lowerThreshold='20'
|
||||
upperThreshold='20'
|
||||
style='white-space: nowrap;'
|
||||
>
|
||||
render() {
|
||||
const { subCateList } = this.props
|
||||
const subCateElementsArray = subCateList.map((item, index) => {
|
||||
return <View key={index} onClick={this.passDataToParent.bind(this, item)} className='view-item'>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</View>
|
||||
})
|
||||
|
||||
{subCateElementsArray}
|
||||
return (
|
||||
|
||||
</ScrollView>
|
||||
<ScrollView
|
||||
|
||||
)
|
||||
}
|
||||
className='scroll-view'
|
||||
scrollX
|
||||
scrollWithAnimation
|
||||
scrollTop='0'
|
||||
lowerThreshold='20'
|
||||
upperThreshold='20'
|
||||
style='white-space: nowrap;'
|
||||
>
|
||||
|
||||
{subCateElementsArray}
|
||||
|
||||
</ScrollView>
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default SubCateSlider
|
||||
|
@ -2,12 +2,10 @@
|
||||
height:100%;
|
||||
padding:0px 0px;
|
||||
.view-item{
|
||||
font-size: 25px;
|
||||
width:150px;
|
||||
display:inline-block;
|
||||
text-align:center;
|
||||
padding-bottom: 10px;
|
||||
border-bottom:2px solid #F2F2F2;
|
||||
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import './individualCenter.scss'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { isUserLogin } from '../../util/checkLogin';
|
||||
|
||||
|
||||
|
||||
@ -19,7 +18,6 @@ class IndividualCenter extends Component {
|
||||
navigationBarTitleText: '个人中心'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
client: [
|
||||
{
|
||||
@ -54,7 +52,7 @@ class IndividualCenter extends Component {
|
||||
username: '',
|
||||
avatar: '',
|
||||
isShop: false,
|
||||
vip_level: ''
|
||||
vip_level:''
|
||||
}
|
||||
}
|
||||
handlerGridClick(e) {
|
||||
@ -103,25 +101,19 @@ class IndividualCenter extends Component {
|
||||
// })
|
||||
}
|
||||
getInfoFromStorage() {
|
||||
const username = getGlobalStorage('userInfo').login_name || ''
|
||||
const avatar = getGlobalStorage('userInfo').avatar || ''
|
||||
const vip_level = getGlobalStorage('userInfo').vip_name || ''
|
||||
const username = getGlobalStorage('userInfo').login_name||''
|
||||
const avatar = getGlobalStorage('userInfo').avatar||''
|
||||
const vip_level=getGlobalStorage('userInfo').vip_name||''
|
||||
const isShop = getGlobalStorage('shopInfo').shop_id ? true : false
|
||||
this.setState({
|
||||
username, avatar, isShop, vip_level
|
||||
username, avatar, isShop,vip_level
|
||||
})
|
||||
}
|
||||
handleLogoutClick() {
|
||||
Logout()
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
isUserLogin().then(res=>{
|
||||
return res
|
||||
}).then(res=>{
|
||||
this.getInfoFromStorage()
|
||||
})
|
||||
|
||||
this.getInfoFromStorage()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
@ -130,13 +122,17 @@ class IndividualCenter extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
isUserLogin()
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
console.log('login service')
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
render() {
|
||||
const { client, seller, username, avatar, vip_level, isShop } = this.state
|
||||
const { client, seller, username, avatar,vip_level, isShop } = this.state
|
||||
return (
|
||||
<View className='individualCenter'>
|
||||
<View className='avatar'>
|
||||
@ -160,14 +156,14 @@ class IndividualCenter extends Component {
|
||||
<View className='title'>我的足迹</View> */}
|
||||
</View>
|
||||
<AtList>
|
||||
<AtListItem hasBorder={false} title='业主中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='' />
|
||||
<AtListItem hasBorder={false} title='业主中心' onClick={this.handlerTitleBarClick.bind(this)} extraText=''/>
|
||||
</AtList>
|
||||
<AtGrid hasBorder={false} data={client} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
|
||||
</View>
|
||||
|
||||
{isShop ? <View className='seller-container'>
|
||||
<AtList>
|
||||
<AtListItem hasBorder={false} title='店铺中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='' />
|
||||
<AtListItem hasBorder={false} title='店铺中心' onClick={this.handlerTitleBarClick.bind(this)} extraText=''/>
|
||||
</AtList>
|
||||
<AtGrid hasBorder={false} data={seller} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
|
||||
</View> : <View />}
|
||||
|
@ -11,7 +11,6 @@ class Login extends Component {
|
||||
navigationBarTitleText: '登入'
|
||||
}
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
username: '',
|
||||
password: '',
|
||||
@ -32,11 +31,9 @@ class Login extends Component {
|
||||
loginHandler() {
|
||||
if (this.state.username && this.state.password) {
|
||||
standardLogin(this.state.username, this.state.password).then(res => {
|
||||
setTimeout(() => {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
}, 1000);
|
||||
Taro.reLaunch({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
}).catch(res => {
|
||||
Taro.showToast({
|
||||
title: res.data.msg,
|
||||
@ -67,7 +64,7 @@ class Login extends Component {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// console.log(this.props, nextProps)
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input, Picker } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
@ -10,8 +10,6 @@ import URL from '../../serviceAPI.config'
|
||||
import './myDemandSupplyEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
|
||||
|
||||
@ -34,8 +32,6 @@ class MyDemandSupplyEdit extends Component {
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
initialImagesInfo: [],//初始化图片信息
|
||||
initialImageURL: [],//初始化图片url
|
||||
isFormCompleted: false,
|
||||
isConfirmWindow: false,// 删除提示框
|
||||
demandSupplyId: '',// 供求id
|
||||
@ -46,13 +42,12 @@ class MyDemandSupplyEdit extends Component {
|
||||
}
|
||||
//获取商品信息api GetProductInfo
|
||||
getSupplyDemandInfo() {
|
||||
let sdId = decodeURIComponent(this.$router.params.sdId)
|
||||
Taro.request({
|
||||
url: URL.GetSupplyDemandInfo,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
sdID: sdId,
|
||||
sdID: this.$router.params.sdId,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -78,16 +73,14 @@ class MyDemandSupplyEdit extends Component {
|
||||
demandingSupplyStateSelected: selectedState,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
initialImageURL: imageFile,
|
||||
initialImagesInfo: res.data.sdInfo.file_path,
|
||||
})
|
||||
|
||||
} else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
}else{
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none'
|
||||
title:res.data.err_msg,
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -104,7 +97,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
user_address = this.state.contactAddress,
|
||||
sd_desc = this.state.content,
|
||||
state = this.state.demandingSupplyStateSelected.id }) {
|
||||
let sd_id = decodeURIComponent(this.$router.params.sdId)
|
||||
|
||||
const file_path = [];
|
||||
this.state.ImagesInfo.forEach((item) => {
|
||||
file_path.push({
|
||||
@ -121,7 +114,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
data: {
|
||||
action: 2,
|
||||
sdInfo: JSON.stringify({
|
||||
sd_id: sd_id,
|
||||
sd_id: this.$router.params.sdId,
|
||||
sd_type: sd_type,
|
||||
sd_title: sd_title,
|
||||
user_name: user_name,
|
||||
@ -156,7 +149,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
} else {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
})
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
@ -219,13 +212,6 @@ class MyDemandSupplyEdit extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 删除我的供求api
|
||||
onDelete({ sdID = 0 }) {
|
||||
Taro.request({
|
||||
@ -297,9 +283,10 @@ class MyDemandSupplyEdit extends Component {
|
||||
saveButtonHandler() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
@ -314,11 +301,11 @@ class MyDemandSupplyEdit extends Component {
|
||||
// 上传供求api
|
||||
saveAndNewButton() {
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -330,7 +317,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
goToMyDemSupPage() {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/mySupplyDemand/mySupplyDemand',//我的供求页面
|
||||
})
|
||||
})
|
||||
}
|
||||
deleteButtonHandler() {
|
||||
this.setState({ isConfirmWindow: true })
|
||||
@ -349,7 +336,7 @@ class MyDemandSupplyEdit extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
// console.log('this.$router.params.sdId',this.$router.params.sdId)
|
||||
showLoading({ title: '加载中' })
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.getSupplyDemandInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -427,44 +414,32 @@ class MyDemandSupplyEdit extends Component {
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'></Text>联系地址:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.contactAddressChange.bind(this)}
|
||||
value={this.state.contactAddress}
|
||||
placeholder="联系地址"
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
/>
|
||||
</View>
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求内容:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>: <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.contentChange.bind(this)}
|
||||
value={this.state.content}
|
||||
placeholder=""
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
/>
|
||||
</View>
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
{platformChecker() ? <View className='img-container'>
|
||||
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
@ -473,14 +448,8 @@ class MyDemandSupplyEdit extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View> : <AliPictureUploadComponent
|
||||
maxLength={4}
|
||||
isReceiveImageUrl={true}
|
||||
initialImageURL={this.state.initialImageURL}
|
||||
initialImagesInfo={this.state.initialImagesInfo}
|
||||
url={URL.UploadDSPorductImage}
|
||||
onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
/>}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
||||
|
@ -77,13 +77,3 @@ $themeColor:#FF7142;
|
||||
line-height:100rpx;
|
||||
}
|
||||
}
|
||||
.textarea-wrapper{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgb(214, 228, 239);
|
||||
border-radius: 8px;
|
||||
padding:5px;
|
||||
.text-area{
|
||||
height: 150px;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, MovableArea, MovableView, CheckboxGroup, Checkbox ,Picker, Image , Text} from '@tarojs/components'
|
||||
import { AtInput, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import { View, Radio, Button, MovableArea, MovableView } from '@tarojs/components'
|
||||
import { AtInput, Text, AtIcon, Picker, Image, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
@ -9,7 +9,6 @@ import './myGoodList.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import platformChecker from '../../util/plaformChecker'
|
||||
|
||||
|
||||
class MyGoodList extends Component {
|
||||
@ -144,14 +143,13 @@ class MyGoodList extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
Taro.hideLoading()
|
||||
console.log('res',res)
|
||||
const data = platformChecker()? JSON.parse(res.data):res.data
|
||||
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.err_code === 88888) {
|
||||
loginExpired(data)
|
||||
} else if (data.err_code != 10) {
|
||||
console.log('我的商品列表', JSON.parse(res.data))
|
||||
|
||||
Taro.hideLoading()
|
||||
if (data.goodsCount != '0' && data.goods.length) {
|
||||
data.goods.forEach(item => {
|
||||
item.checked = false
|
||||
@ -311,8 +309,7 @@ class MyGoodList extends Component {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(res => {
|
||||
console.log('res',res)
|
||||
let responseData = platformChecker()? JSON.parse(res.data):res.data
|
||||
let responseData = JSON.parse(res.data)
|
||||
Taro.hideLoading()
|
||||
if (responseData.err_code === 0) {
|
||||
Taro.showToast({
|
||||
@ -341,6 +338,10 @@ class MyGoodList extends Component {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 搜索
|
||||
searchButtonHandler() {
|
||||
Taro.showLoading({
|
||||
@ -493,14 +494,11 @@ class MyGoodList extends Component {
|
||||
// 单个商品选择
|
||||
handleCheckChange(e) {
|
||||
//如果goodid 一样的那么checked 就取反
|
||||
// const id = onClickValueService(e)
|
||||
const id = e.detail.value
|
||||
|
||||
console.log('clicke')
|
||||
const id = onClickValueService(e)
|
||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||
if (id.includes(item.goods_id)) {
|
||||
item['checked'] = true
|
||||
} else {
|
||||
item['checked'] = false
|
||||
if (item.goods_id === id) {
|
||||
item['checked'] = !item.checked
|
||||
}
|
||||
return item
|
||||
})
|
||||
@ -520,6 +518,9 @@ class MyGoodList extends Component {
|
||||
duration: 1500
|
||||
})
|
||||
// // this.deleteGood({ goodsID: checkedGoodsId })
|
||||
|
||||
|
||||
|
||||
}
|
||||
// 改变商品状态
|
||||
offStockGoodHandler() {
|
||||
@ -538,11 +539,11 @@ class MyGoodList extends Component {
|
||||
}
|
||||
// 导航到商品编辑页面myGoodsEdit
|
||||
goToGoodEditPage(e) {
|
||||
|
||||
console.log('e',e)
|
||||
const goodId = onClickValueService(e)
|
||||
const id=encodeURIComponent(goodId)
|
||||
console.log('goodId',goodId)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + id
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
|
||||
})
|
||||
}
|
||||
// 导航到商品发布页面
|
||||
@ -554,9 +555,8 @@ class MyGoodList extends Component {
|
||||
}
|
||||
goToGoodspage(e) {
|
||||
const goodId = onClickValueService(e)
|
||||
const id=encodeURIComponent(goodId)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + id
|
||||
url: '/pages/goods/goods?id=' + goodId
|
||||
})
|
||||
}
|
||||
|
||||
@ -662,7 +662,7 @@ class MyGoodList extends Component {
|
||||
const goodListElementArray = this.state.myGoodList.map((item, index) => {
|
||||
return <View key={index} className='good-container'>
|
||||
<View className='good-container-a'>
|
||||
<Checkbox className='radio' value={item.goods_id} checked={item.checked} ></Checkbox >
|
||||
<Radio className='radio' value={item.goods_id} checked={item.checked} onClick={this.handleCheckChange.bind(this, item.goods_id)} ></Radio>
|
||||
<View className='img-box' onClick={this.goToGoodspage.bind(this, item.goods_id)}>
|
||||
{/* <Image mode='aspectFit' className='img' style='height:50px;width:50px' src={URL.Base + item.goods_url} /> */}
|
||||
<Image className='img' style='height:100%;width:100%' src={URL.Base + item.goods_url} />
|
||||
@ -818,23 +818,19 @@ class MyGoodList extends Component {
|
||||
|
||||
</View>
|
||||
<View className='sub-filter'>
|
||||
<CheckboxGroup className='align-item' onChange={this.checkAllHandler.bind(this)}>
|
||||
<Checkbox className='radio' checked={this.state.isCheckAll} >全选</Checkbox>
|
||||
</CheckboxGroup>
|
||||
<View className='button align-item' onClick={this.deleteGoodsHandler.bind(this)}>
|
||||
<Radio className='radio' checked={this.state.isCheckAll} onClick={this.checkAllHandler.bind(this)}>全选</Radio>
|
||||
<View className='button' onClick={this.deleteGoodsHandler.bind(this)}>
|
||||
<Button size='mini' className='button-dark-red'>
|
||||
删除</Button>
|
||||
</View>
|
||||
<View className='button align-item' onClick={this.offStockGoodHandler.bind(this)}>
|
||||
<View className='button' onClick={this.offStockGoodHandler.bind(this)}>
|
||||
<Button size='mini' className='button-blue'>
|
||||
下架</Button>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
{this.state.myGoodList.length ? <View className='mygoodlist-container'>
|
||||
<CheckboxGroup onChange={this.handleCheckChange.bind(this)}>
|
||||
{goodListElementArray}
|
||||
</CheckboxGroup>
|
||||
{goodListElementArray}
|
||||
</View > : <View className='no-more-title'> 没有更多了</View>}
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
@ -843,9 +839,9 @@ class MyGoodList extends Component {
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
</View>
|
||||
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all'>
|
||||
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' onClick={this.goToCenterPage.bind(this)} >
|
||||
|
||||
<View onClick={this.goToCenterPage.bind(this)}> 个人中心</View>
|
||||
个人中心
|
||||
</MovableView>
|
||||
</MovableArea>
|
||||
)
|
||||
|
@ -17,10 +17,6 @@ $themeColor:#FF7142;
|
||||
opacity:1 ;
|
||||
position:fixed;
|
||||
}
|
||||
.align-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.MyGoodList{
|
||||
padding: 10px 20px;
|
||||
.filterbar-container{
|
||||
|
@ -1,18 +1,14 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, AtTextarea, AtImagePicker } from 'taro-ui'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Button, } from 'taro-ui'
|
||||
|
||||
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
||||
import AliShopTypeInteraction from '../../component/AliShopTypeInteraction/AliShopTypeInteraction'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myGoodsEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
class MyGoodsEdit extends Component {
|
||||
config = {
|
||||
@ -28,8 +24,6 @@ class MyGoodsEdit extends Component {
|
||||
productDescript: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
initialImagesInfo: [],//初始化图片信息
|
||||
initialImageURL: [],//初始化图片url
|
||||
goodsTypeParam: '',//商品分类参数
|
||||
goodId: '',//商品id
|
||||
isSaveButton: false,//是否点击了保存按钮
|
||||
@ -39,13 +33,12 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
//获取商品信息api GetProductInfo
|
||||
getGoodsInfo() {
|
||||
let goodsID = decodeURIComponent(this.$router.params.id)
|
||||
Taro.request({
|
||||
url: URL.GetProductInfo,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
goodsID: goodsID,
|
||||
goodsID: this.$router.params.id,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -55,27 +48,25 @@ class MyGoodsEdit extends Component {
|
||||
})
|
||||
.then(res => {
|
||||
Taro.hideLoading()
|
||||
|
||||
if (res.data.err_code === 0) {
|
||||
console.log('商品详情获取成功', res)
|
||||
|
||||
const imageFile = res.data.goodsFiles.map((item) => {
|
||||
return { url: URL.Base + item.files.file_path }
|
||||
})
|
||||
let shopTypeSelected
|
||||
// let shopTypeSelected
|
||||
|
||||
const shopTypeId = res.data.goods.shop_class_id
|
||||
for (let key in this.state.shopTypeList) {
|
||||
for (let item of this.state.shopTypeList[key].c) {
|
||||
if (item.id === shopTypeId) {
|
||||
shopTypeSelected = { name: item.n, id: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
// const shopTypeId = res.data.goods.shop_class_id
|
||||
// for (let key in this.state.shopTypeList) {
|
||||
// for (let item of this.state.shopTypeList[key].c) {
|
||||
// if (item.id === shopTypeId) {
|
||||
// shopTypeSelected = { name: item.n, id: item.id }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (getGlobalStorage('shopTypeObject')) {
|
||||
let selectedValue = ''
|
||||
const shopTypeObject = getGlobalStorage('shopTypeObject')
|
||||
console.log('shopTypeObject', shopTypeObject)
|
||||
for (let key in shopTypeObject) {
|
||||
for (let item of shopTypeObject[key].c) {
|
||||
if (item.id === res.data.goods.shop_class_id) {
|
||||
@ -90,8 +81,6 @@ class MyGoodsEdit extends Component {
|
||||
productDescript: res.data.goods.goods_profiles,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.goodsFiles,
|
||||
initialImageURL: imageFile,
|
||||
initialImagesInfo: res.data.goodsFiles,
|
||||
shopTypeSelected: selectedValue,
|
||||
goodsTypeParam: res.data.goods.class_id,
|
||||
goodId: res.data.goods.goods_id,
|
||||
@ -184,14 +173,14 @@ class MyGoodsEdit extends Component {
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isSaveButton) {
|
||||
// Taro.navigateBack({
|
||||
// Taro.navigateBack({
|
||||
|
||||
// delta:1
|
||||
// url: '/pages/myGoodsList/myGoodsEdit?id=' + this.$router.params.id
|
||||
// })
|
||||
Taro.redirectTo({
|
||||
url: '/pages/myGoodList/myGoodList'
|
||||
})
|
||||
// delta:1
|
||||
// url: '/pages/myGoodsList/myGoodsEdit?id=' + this.$router.params.id
|
||||
// })
|
||||
Taro.redirectTo({
|
||||
url: '/pages/myGoodList/myGoodList'
|
||||
})
|
||||
} else if (this.state.isSaveAndNewBUtton) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/goodsPublish/goodsPublish'
|
||||
@ -297,12 +286,6 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
}
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
shopCategoryChanged(e) {
|
||||
this.setState({
|
||||
shopCategoryCheckedPicker: this.state.shopCategoryList[e.detail.value]
|
||||
@ -313,20 +296,20 @@ class MyGoodsEdit extends Component {
|
||||
// 保存按钮
|
||||
saveButtonHandler() {
|
||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopTypeSelected.id) {
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveButton: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
class_id: this.state.goodsTypeParam,
|
||||
goods_id: this.state.goodId,
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveButton: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
class_id: this.state.goodsTypeParam,
|
||||
goods_id: this.state.goodId,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -339,21 +322,21 @@ class MyGoodsEdit extends Component {
|
||||
// 保存并新增按钮
|
||||
saveAndNewButton() {
|
||||
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.ImagesInfo.length && this.state.shopTypeSelected.id) {
|
||||
showLoading({ title: '保存中' })
|
||||
this.setState({ isSaveAndNewBUtton: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
class_id: this.state.goodsTypeParam,
|
||||
goods_id: this.state.goodId,
|
||||
Taro.showLoading({ title: '保存中' }).then(() => {
|
||||
this.setState({ isSaveAndNewBUtton: true }, () => {
|
||||
this.uploadGoods({
|
||||
goods_name: this.state.productName,
|
||||
goods_price: this.state.productPrice,
|
||||
goods_unit: this.state.productUnit,
|
||||
goods_profiles: this.state.productDescript,
|
||||
shop_class_id: this.state.shopTypeSelected.id,
|
||||
class_id: this.state.goodsTypeParam,
|
||||
goods_id: this.state.goodId,
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -365,9 +348,8 @@ class MyGoodsEdit extends Component {
|
||||
}
|
||||
|
||||
goToGoodsDetailPage() {
|
||||
let goodsID = encodeURIComponent(this.$router.params.id)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + goodsID
|
||||
url: '/pages/goods/goods?id=' + this.$router.params.id
|
||||
})
|
||||
}
|
||||
goToMyGoodListPage() {
|
||||
@ -380,16 +362,18 @@ class MyGoodsEdit extends Component {
|
||||
console.log('从子组件店铺分类传回来的值', value)
|
||||
this.setState({ shopTypeSelected: value })
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
Taro.showLoading({
|
||||
title:'加载中'
|
||||
})
|
||||
this.getGoodsInfo()
|
||||
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
||||
// console.log(this.props, nextProps)
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
@ -400,10 +384,8 @@ class MyGoodsEdit extends Component {
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<View className='goods-publish'>
|
||||
|
||||
<View className='goods-category'>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
@ -447,7 +429,7 @@ class MyGoodsEdit extends Component {
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>上传图片:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <View className='img-container'>
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
files={this.state.pickerImageUrl}
|
||||
@ -455,31 +437,15 @@ class MyGoodsEdit extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View> : <AliPictureUploadComponent
|
||||
maxLength={20}
|
||||
isReceiveImageUrl={true}
|
||||
initialImageURL={this.state.initialImageURL}
|
||||
initialImagesInfo={this.state.initialImagesInfo}
|
||||
url={URL.UploadGoodsPorductImage}
|
||||
onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
/>}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
{/* 店铺分类 */}
|
||||
{platformChecker() ?
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)
|
||||
}></ShopTypeInteractionComp>
|
||||
: <AliShopTypeInteraction url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
|
||||
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
|
||||
shopId={getGlobalStorage('shopInfo').shop_id}
|
||||
selectedValue={this.state.shopTypeSelected}
|
||||
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
||||
|
||||
></AliShopTypeInteraction>}
|
||||
|
||||
|
||||
></ShopTypeInteractionComp>
|
||||
{/* 店铺分类结束 */}
|
||||
|
||||
<View className='description-box'>
|
||||
@ -487,19 +453,13 @@ class MyGoodsEdit extends Component {
|
||||
<Text className='require'></Text>
|
||||
<Text className='title'>商品简介:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
|
||||
<AtTextarea
|
||||
value={this.state.productDescript}
|
||||
onChange={this.productDescriptChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='你的产品简介'
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.productDescriptChange.bind(this)}
|
||||
value={this.state.contactAddress}
|
||||
placeholder="你的产品简介"
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
/>
|
||||
|
||||
</View>
|
||||
<View className='button-box' >
|
||||
|
@ -7,23 +7,21 @@ $themeColor:#FF7142;
|
||||
.border-box{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
|
||||
|
||||
}
|
||||
.at-input__container{
|
||||
color:black;
|
||||
font-weight: bold;
|
||||
|
||||
.at-input__input{
|
||||
font-weight: normal
|
||||
}
|
||||
}
|
||||
.img-box{
|
||||
margin-top:10Px;
|
||||
|
||||
.img-container{
|
||||
border: 1Px solid #d6e4ef;
|
||||
border-radius:8rpx;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
.shoptype-box{
|
||||
@ -31,7 +29,6 @@ $themeColor:#FF7142;
|
||||
}
|
||||
.description-box{
|
||||
margin-top:10Px;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -100,21 +97,9 @@ $themeColor:#FF7142;
|
||||
.input-box{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
display: flex;
|
||||
|
||||
}
|
||||
.require{
|
||||
color:red;
|
||||
line-height:100rpx;
|
||||
|
||||
}
|
||||
|
||||
.textarea-wrapper{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgb(214, 228, 239);
|
||||
border-radius: 8px;
|
||||
padding:5px;
|
||||
.text-area{
|
||||
height: 150px;
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
//myNeeds
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Picker, Input } from '@tarojs/components'
|
||||
import { AtInput, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
|
||||
@ -14,9 +12,6 @@ import './myNeeds.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserLogin } from '../../util/checkLogin';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
class MyNeeds extends Component {
|
||||
|
||||
@ -190,21 +185,21 @@ class MyNeeds extends Component {
|
||||
|
||||
// 搜索按钮
|
||||
onSearchButtonHandler() {
|
||||
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
|
||||
Taro.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
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 新增我的需求
|
||||
addNeeds() {
|
||||
@ -288,15 +283,10 @@ class MyNeeds extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
isUserLogin().then(res => {
|
||||
return res
|
||||
}).then(res => {
|
||||
showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.getMyNeedsList({})
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
this.getMyNeedsList({})
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -306,7 +296,10 @@ class MyNeeds extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
isUserLogin()
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -321,7 +314,7 @@ class MyNeeds extends Component {
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
||||
@ -389,13 +382,12 @@ class MyNeeds extends Component {
|
||||
title='需求标题:'
|
||||
placeholder='需求标题·'
|
||||
type='text'
|
||||
border={false}
|
||||
value={this.state.title}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
{/* 开始和结束日期 */}
|
||||
<View className='page-section-picker'>
|
||||
<View className='page-section'>
|
||||
<View className='picker-box'>
|
||||
<View className='picker-wrapper'>
|
||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||
@ -419,14 +411,7 @@ class MyNeeds extends Component {
|
||||
</View>
|
||||
</View>
|
||||
{/* 行业分类开始 */}
|
||||
{/* 行业分类 */}
|
||||
|
||||
|
||||
{platformChecker() ? <View className='InteractionComponent-wrapper'>
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
||||
</View> : <AliIndustryTypeInteraction url={URL.GetIndustryTypeList}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
selectedValue={this.state.industryTypeSelected} />}
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected}></InteractionComponent>
|
||||
{/* 行业分类结束 */}
|
||||
{/* 需求类型 */}
|
||||
<View className='page-section'>
|
||||
|
@ -64,47 +64,6 @@ $themeColor:#FF7142;
|
||||
margin-left: 10%
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
.page-section-picker{
|
||||
|
||||
|
||||
.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;
|
||||
.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%
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,6 +102,7 @@ $themeColor:#FF7142;
|
||||
}
|
||||
|
||||
.info-box{
|
||||
|
||||
.needs-box{
|
||||
margin-top: 10px;
|
||||
border: 3rpx solid #ddd;
|
||||
|
@ -1,18 +1,14 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input, Picker } from '@tarojs/components'
|
||||
import { AtInput, AtTextarea, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtImagePicker } from 'taro-ui'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myNeedsEdit.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
class MyNeedsEdit extends Component {
|
||||
|
||||
@ -38,10 +34,9 @@ class MyNeedsEdit extends Component {
|
||||
contactAddress: '',
|
||||
content: '',//描述
|
||||
pickerImageUrl: [],
|
||||
ImagesInfo: [],// 图片详细信息
|
||||
initialImagesInfo: [],//初始化图片信息
|
||||
initialImageURL: [],//初始化图片url
|
||||
ImagesInfo: '',
|
||||
isDeleteModal: false,// 删除提示框
|
||||
|
||||
isSaveAndNew: false,//是否点击保存新增按钮
|
||||
|
||||
|
||||
@ -49,13 +44,12 @@ class MyNeedsEdit extends Component {
|
||||
}
|
||||
//获取需求信息api
|
||||
getMyNeedEditInfo() {
|
||||
let id = decodeURIComponent(this.$router.params.id)
|
||||
Taro.request({
|
||||
url: URL.EditMyNeeds,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: id,
|
||||
demandId: this.$router.params.id,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -108,15 +102,13 @@ class MyNeedsEdit extends Component {
|
||||
contactAddress: res.data.sdInfo.user_address,
|
||||
content: res.data.sdInfo.sd_desc,
|
||||
needsStateSelected: needsState,
|
||||
initialImageURL: imageFile,
|
||||
initialImagesInfo: res.data.sdInfo.file_path,
|
||||
pickerImageUrl: imageFile,
|
||||
ImagesInfo: res.data.sdInfo.file_path,
|
||||
})
|
||||
|
||||
} else if (JSON.parse(res.data).err_code === 88888) {
|
||||
}else if (JSON.parse(res.data).err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: JSON.parse(res.data).err_msg,
|
||||
icon: 'none'
|
||||
@ -127,6 +119,8 @@ class MyNeedsEdit extends Component {
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// uploadMyNeedsApi 上传需求 的api
|
||||
uploadMyNeedsApi() {
|
||||
|
||||
@ -191,9 +185,9 @@ class MyNeedsEdit extends Component {
|
||||
}
|
||||
}, 1500);
|
||||
})
|
||||
} else if (res.data.err_code === 88888) {
|
||||
}else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none',
|
||||
@ -205,6 +199,51 @@ class MyNeedsEdit extends Component {
|
||||
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
onChangeImg(files, operationType, index) {
|
||||
const that = this
|
||||
if (operationType === 'add') {
|
||||
Taro.uploadFile({
|
||||
url: URL.UploadDSPorductImage,
|
||||
filePath: files[files.length - 1].url,
|
||||
name: 'file',
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
const data = JSON.parse(response.data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
that.setState({
|
||||
pickerImageUrl: newPickerImageUrl,
|
||||
ImagesInfo: newImageInfo
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (operationType === 'remove') {
|
||||
this.state.ImagesInfo.splice(index, 1) // 删除显示的图片
|
||||
this.state.pickerImageUrl.splice(index, 1)// 删除图片param
|
||||
that.setState({
|
||||
pockerImageUrl: this.state.pickerImageUrl,
|
||||
ImagesInfo: this.state.ImagesInfo,
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//删除我的需求 api DeleteMyNeeds
|
||||
deleteMyNeeds({ demandId = 10 }) {
|
||||
Taro.request({
|
||||
@ -235,9 +274,9 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
|
||||
}, 1000);
|
||||
} else if (res.data.err_code === 88888) {
|
||||
}else if (res.data.err_code === 88888) {
|
||||
loginExpired(res)
|
||||
} else {
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@ -287,7 +326,7 @@ class MyNeedsEdit extends Component {
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSaveAndNew: false }, () => {
|
||||
@ -301,64 +340,13 @@ class MyNeedsEdit extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 上传图片
|
||||
onChangeImg(files, operationType, index) {
|
||||
const that = this
|
||||
if (operationType === 'add') {
|
||||
Taro.uploadFile({
|
||||
url: URL.UploadDSPorductImage,
|
||||
filePath: files[files.length - 1].url,
|
||||
name: 'file',
|
||||
header: {
|
||||
'content-type': 'multipart/form-data',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
success(response) {
|
||||
const data = JSON.parse(response.data)
|
||||
const imagePath = URL.Base + data.file_path
|
||||
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
|
||||
const newImageInfo = that.state.ImagesInfo.concat(data)
|
||||
that.setState({
|
||||
pickerImageUrl: newPickerImageUrl,
|
||||
ImagesInfo: newImageInfo
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
if (operationType === 'remove') {
|
||||
this.state.ImagesInfo.splice(index, 1) // 删除显示的图片
|
||||
this.state.pickerImageUrl.splice(index, 1)// 删除图片param
|
||||
that.setState({
|
||||
pockerImageUrl: this.state.pickerImageUrl,
|
||||
ImagesInfo: this.state.ImagesInfo,
|
||||
})
|
||||
Taro.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 保存新增按钮
|
||||
saveAndNewButton() {
|
||||
if (this.state.title &&
|
||||
this.state.contactName
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '保存中'
|
||||
})
|
||||
this.setState({ isSaveAndNew: true }, () => {
|
||||
@ -418,156 +406,131 @@ class MyNeedsEdit extends Component {
|
||||
<View className='supply-demand'>
|
||||
{deleteModalWindowElement}
|
||||
{/* 行业分类 */}
|
||||
{platformChecker() ?
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} ></InteractionComponent>
|
||||
: <AliIndustryTypeInteraction url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} />}
|
||||
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} ></InteractionComponent>
|
||||
|
||||
{/* 需求类型 */}
|
||||
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeChange.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求类型:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeChange.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求类型:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
<View className='border-box'>
|
||||
<Text className='require'>*</Text><AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
</View>
|
||||
<View className='border-box'>
|
||||
<Text className='require'>*</Text><AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
|
||||
/>
|
||||
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系人:'
|
||||
type='text'
|
||||
value={this.state.contactName}
|
||||
border={false}
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.contactAddressChange.bind(this)}
|
||||
value={this.state.contactAddress}
|
||||
placeholder="联系地址"
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
|
||||
</View>
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求内容:</Text>
|
||||
</View>
|
||||
{platformChecker() ?<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.contentChange.bind(this)}
|
||||
value={this.state.content}
|
||||
placeholder=""
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
</View>
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
{platformChecker() ? <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
files={this.state.pickerImageUrl}
|
||||
onChange={this.onChangeImg.bind(this)}
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View> : <AliPictureUploadComponent
|
||||
maxLength={4}
|
||||
isReceiveImageUrl={true}
|
||||
initialImageURL={this.state.initialImageURL}
|
||||
initialImagesInfo={this.state.initialImagesInfo}
|
||||
url={URL.UploadDSPorductImage}
|
||||
onGetImageDetails={this.getImageDetails.bind(this)}
|
||||
/>}
|
||||
|
||||
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateChange.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> <Text className='require'>*</Text>状态:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.saveButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>保存</Button>
|
||||
</View>
|
||||
{/* <View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
||||
<Button size='mini' className='button-green'>保存并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>我的需求</Button>
|
||||
</View>
|
||||
{/* <View className='button' onClick={this.deleteButtonHandler.bind(this)}>
|
||||
<Button className='button-dark-red' size='mini'>删除</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
/>
|
||||
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系人:'
|
||||
type='text'
|
||||
value={this.state.contactName}
|
||||
border={false}
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
</View>
|
||||
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/>
|
||||
</View>
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求内容:</Text>
|
||||
</View>
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
files={this.state.pickerImageUrl}
|
||||
onChange={this.onChangeImg.bind(this)}
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateChange.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> <Text className='require'>*</Text>状态:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.saveButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange'>保存</Button>
|
||||
</View>
|
||||
{/* <View className='button' onClick={this.saveAndNewButton.bind(this)}>
|
||||
<Button size='mini' className='button-green'>保存并新增</Button>
|
||||
</View> */}
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button className='button-green' size='mini'>我的需求</Button>
|
||||
</View>
|
||||
{/* <View className='button' onClick={this.deleteButtonHandler.bind(this)}>
|
||||
<Button className='button-dark-red' size='mini'>删除</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ $themeColor:#FF7142;
|
||||
|
||||
.supply-demand{
|
||||
padding: 10px 20px;
|
||||
|
||||
.border-box{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
display: flex
|
||||
@ -76,13 +77,3 @@ $themeColor:#FF7142;
|
||||
line-height:100rpx;
|
||||
}
|
||||
}
|
||||
.textarea-wrapper{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgb(214, 228, 239);
|
||||
border-radius: 8px;
|
||||
padding:5px;
|
||||
.text-area{
|
||||
height: 150px;
|
||||
}
|
||||
}
|
@ -1,22 +1,17 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input, Picker } from '@tarojs/components'
|
||||
import { AtInput, AtTextarea, AtImagePicker } from 'taro-ui'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
|
||||
|
||||
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
|
||||
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
|
||||
|
||||
import './myNeedsPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserLogin } from '../../util/checkLogin';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
|
||||
|
||||
@ -34,14 +29,14 @@ class MyNeedsPublish extends Component {
|
||||
needsType: [{ name: '业主需求', id: '4' }, { name: '效果图', id: '5' }],
|
||||
needsTypeSelected: { name: '业主需求', id: '4' },
|
||||
title: '',
|
||||
contactName: '',
|
||||
contactNumber: '',
|
||||
contactName: getGlobalStorage('user_identity').username || '',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone || '',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
ImagesInfo: [],// 后台传回来的图片信息
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
|
||||
isPublishAndNew: false,//是否点击发布新增按钮
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +72,7 @@ class MyNeedsPublish extends Component {
|
||||
sd_desc: this.state.content,
|
||||
state: this.state.needsStateSelected.id,
|
||||
file_path: file_path,
|
||||
|
||||
})
|
||||
},
|
||||
header: {
|
||||
@ -86,34 +82,36 @@ class MyNeedsPublish extends Component {
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
console.log('上传需求成功', response)
|
||||
const res = response.data
|
||||
console.log('上传需求', response)
|
||||
|
||||
const res = JSON.parse(response.data)
|
||||
console.log('jonson parse', res)
|
||||
Taro.hideLoading()
|
||||
if (res.err_code === 0) {
|
||||
console.log('error code 0')
|
||||
Taro.showToast({
|
||||
title: '发布成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.sd_id
|
||||
})
|
||||
}
|
||||
}, 1500);
|
||||
})
|
||||
setTimeout(() => {
|
||||
console.log('settimeout')
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish'
|
||||
})
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + res.sd_id
|
||||
})
|
||||
}
|
||||
}, 1500);
|
||||
|
||||
} else if (res.err_code === 88888) {
|
||||
console.log('返回错误88888')
|
||||
|
||||
const resp = { data: { err_msg: res.err_msg } }
|
||||
console.log('resp',resp)
|
||||
loginExpired(resp)
|
||||
} else {
|
||||
|
||||
Taro.showToast({
|
||||
title: res.err_msg,
|
||||
icon: 'none',
|
||||
@ -123,12 +121,12 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
onChangeImg(files, operationType, index) {
|
||||
const that = this
|
||||
|
||||
if (operationType === 'add') {
|
||||
Taro.uploadFile({
|
||||
url: URL.MyNeedUploadImage,
|
||||
@ -202,13 +200,6 @@ class MyNeedsPublish extends Component {
|
||||
contentChange(event) {
|
||||
this.setState({ content: event.target.value })
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 发布按钮
|
||||
publishButtonHandler() {
|
||||
if (this.state.title &&
|
||||
@ -216,7 +207,7 @@ class MyNeedsPublish extends Component {
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
@ -240,7 +231,7 @@ class MyNeedsPublish extends Component {
|
||||
&& this.state.contactNumber
|
||||
&& this.state.content && this.state.needsStateSelected) {
|
||||
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '发布中'
|
||||
})
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
@ -268,15 +259,11 @@ class MyNeedsPublish extends Component {
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
contactName: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').username : '',
|
||||
contactNumber: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').userphone : '',
|
||||
})
|
||||
// console.log('this.$router.params.sdId',this.$router.params.sdId)
|
||||
// Taro.showLoading({title:'加载中'})
|
||||
// this.getSupplyDemandInfo()
|
||||
// 如果路由参数为1 就默认显示 效果图,反之 显示业主需求
|
||||
const isRenderingPic = decodeURIComponent(this.$router.params.id)
|
||||
const isRenderingPic = this.$router.params.id
|
||||
if (parseInt(isRenderingPic)) {
|
||||
this.setState({ needsTypeSelected: { name: '效果图', id: '5' } })
|
||||
}
|
||||
@ -288,7 +275,10 @@ class MyNeedsPublish extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
isUserLogin()
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -298,156 +288,131 @@ class MyNeedsPublish extends Component {
|
||||
<View className='supply-demand'>
|
||||
|
||||
{/* 行业分类 */}
|
||||
|
||||
|
||||
{platformChecker() ? <View className='InteractionComponent-wrapper'><InteractionComponent url={URL.GetIndustryTypeList}
|
||||
<InteractionComponent url={URL.GetIndustryTypeList}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
selectedValue={this.state.industryTypeSelected}
|
||||
></InteractionComponent></View> : <AliIndustryTypeInteraction url={URL.GetIndustryTypeList}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
selectedValue={this.state.industryTypeSelected} />}
|
||||
<View className='page-section'>
|
||||
></InteractionComponent>
|
||||
{/* 需求类型 */}
|
||||
<View className='page-section'>
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeHandler.bind(this)}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求类型:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
<View className='border-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
<View className='border-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='需求标题:'
|
||||
type='text'
|
||||
value={this.state.title}
|
||||
border={false}
|
||||
onChange={this.titleChange.bind(this)}
|
||||
|
||||
/>
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系人:'
|
||||
type='text'
|
||||
value={this.state.contactName}
|
||||
border={false}
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系人:'
|
||||
type='text'
|
||||
value={this.state.contactName}
|
||||
border={false}
|
||||
onChange={this.contactNameChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
border={false}
|
||||
onChange={this.contactNumberChange.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
{/* <View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<View style='margin-left:5%;'>
|
||||
<Input name='value'
|
||||
maxLength='11'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View> */}
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area' onInput={this.contactAddressChange.bind(this)} value={this.state.contactAddress} placeholder="联系地址" maxlength='140' /></View>
|
||||
}
|
||||
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求内容:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area' onInput={this.contentChange.bind(this)} value={this.state.content} maxlength='140' /></View>
|
||||
}
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
{platformChecker() ? <View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
files={this.state.pickerImageUrl}
|
||||
onChange={this.onChangeImg.bind(this)}
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View> : <AliPictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
|
||||
}
|
||||
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateHandler}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> <Text className='require'>*</Text>状态:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange' >发布</Button>
|
||||
</View>
|
||||
|
||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||
<Button className='button-green' size='mini' >发布并新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button className='button-green' size='mini' >我的需求</Button>
|
||||
</View>
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
</View>
|
||||
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/>
|
||||
</View>
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求内容:</Text>
|
||||
</View>
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/>
|
||||
</View>
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
files={this.state.pickerImageUrl}
|
||||
onChange={this.onChangeImg.bind(this)}
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
||||
<View>
|
||||
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateHandler}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'> <Text className='require'>*</Text>状态:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='button-box'>
|
||||
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
|
||||
<Button size='mini' className='button-orange' >发布</Button>
|
||||
</View>
|
||||
|
||||
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
|
||||
<Button className='button-green' size='mini' >发布并新增</Button>
|
||||
</View>
|
||||
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
|
||||
<Button className='button-green' size='mini' >我的需求</Button>
|
||||
</View>
|
||||
</View>
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
$themeColor:#FF7142;
|
||||
|
||||
.supply-demand{
|
||||
padding: 10px 20px ;
|
||||
|
||||
padding: 10px 20px;
|
||||
|
||||
.border-box{
|
||||
border-bottom: 1Px solid #d6e4ef;
|
||||
@ -78,13 +77,3 @@ $themeColor:#FF7142;
|
||||
line-height:100rpx;
|
||||
}
|
||||
}
|
||||
.textarea-wrapper{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgb(214, 228, 239);
|
||||
border-radius: 8px;
|
||||
padding:5px;
|
||||
.text-area{
|
||||
height: 150px;
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import './myNeedsView.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
|
||||
@ -43,14 +42,13 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
//获取需求信息api
|
||||
getSingleMyNeedInfo() {
|
||||
let id=decodeURIComponent(this.$router.params.id)
|
||||
Taro.request({
|
||||
// url: URL.EditMyNeeds,
|
||||
url: URL.supplyDemandDetails,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId:id ,
|
||||
demandId: this.$router.params.id,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -196,7 +194,7 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
showLoading({ title: '加载中' })
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.getSingleMyNeedInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
@ -1,18 +1,17 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, MovableArea, MovableView ,Picker } from '@tarojs/components'
|
||||
import { AtInput, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import { View, Text, Button, MovableArea, MovableView } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
|
||||
|
||||
import './mySupplyDemand.scss'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserShopOwner } from '../../util/checkLogin';
|
||||
|
||||
|
||||
class MySupplyDemand extends Component {
|
||||
@ -117,7 +116,7 @@ class MySupplyDemand extends Component {
|
||||
|
||||
onSearchButtonHandler() {
|
||||
|
||||
showLoading({ title: '加载中' })
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
|
||||
this.setState({ loadMorePageIndex: 1 }, () => {
|
||||
this.getMySupplyDemand({ curr_page: this.state.loadMorePageIndex })
|
||||
@ -147,7 +146,6 @@ class MySupplyDemand extends Component {
|
||||
Taro.showToast({
|
||||
title: '删除成功'
|
||||
}).then(() => {
|
||||
Taro.showLoading()
|
||||
this.getMySupplyDemand({})
|
||||
})
|
||||
|
||||
@ -229,7 +227,7 @@ class MySupplyDemand extends Component {
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isConfirmWindow: false })
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.onDelete({ sdID: this.state.demandSupplyId })
|
||||
@ -248,8 +246,7 @@ class MySupplyDemand extends Component {
|
||||
|
||||
// 跳转到我的供求编辑页面
|
||||
goToMyDSEditPage(e) {
|
||||
let id = onClickValueService(e)
|
||||
let sdId=encodeURIComponent(id)
|
||||
const sdId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId
|
||||
})
|
||||
@ -257,8 +254,7 @@ class MySupplyDemand extends Component {
|
||||
}
|
||||
// 转到供求查看页面
|
||||
goSupplyDemandView(e) {
|
||||
let id = onClickValueService(e)
|
||||
let sdId=encodeURIComponent(id)
|
||||
const sdId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
|
||||
})
|
||||
@ -290,14 +286,23 @@ class MySupplyDemand extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.getUserSystemInfo()
|
||||
showLoading({ title: '加载中' })
|
||||
this.getMySupplyDemand({})
|
||||
|
||||
Taro.showLoading({ title: '加载中' }).then(() => {
|
||||
this.getMySupplyDemand({})
|
||||
})
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
isUserShopOwner()
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -311,7 +316,7 @@ class MySupplyDemand extends Component {
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
|
||||
@ -479,10 +484,10 @@ class MySupplyDemand extends Component {
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
|
||||
</View>
|
||||
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' >
|
||||
<View className='movable-point' onClick={this.goToCenterPage.bind(this)}> 个人中心</View>
|
||||
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' onClick={this.goToCenterPage.bind(this)} >
|
||||
|
||||
</MovableView>
|
||||
个人中心
|
||||
</MovableView>
|
||||
</MovableArea>
|
||||
)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -59,9 +59,7 @@ $themeColor:#FF7142;
|
||||
position: relative;
|
||||
.interaction{
|
||||
position: absolute;
|
||||
// opacity: 0;
|
||||
top:-100px;
|
||||
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
.homepage-link{
|
||||
|
@ -1,19 +1,15 @@
|
||||
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Button, Input, Picker } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea } from 'taro-ui'
|
||||
import { View, Text, Button, Input } from '@tarojs/components'
|
||||
import { AtInput, AtImagePicker, AtTextarea, Picker } from 'taro-ui'
|
||||
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
|
||||
import LoginService from '../../util/LoginService'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './supplyDemandPublish.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
import { isUserShopOwner } from '../../util/checkLogin';
|
||||
import platformChecker from '../../util/plaformChecker';
|
||||
|
||||
class SupplyDemand extends Component {
|
||||
config = {
|
||||
@ -27,8 +23,8 @@ class SupplyDemand extends Component {
|
||||
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
|
||||
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
|
||||
title: '',
|
||||
contactName: '',
|
||||
contactNumber: '',
|
||||
contactName: getGlobalStorage('user_identity').username||'',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone||'',
|
||||
contactAddress: '',
|
||||
content: '',
|
||||
pickerImageUrl: [], // 上传的图片
|
||||
@ -86,6 +82,7 @@ class SupplyDemand extends Component {
|
||||
icon: res.data.err_msg == 'success' ? 'success' : 'none',
|
||||
duration: 1000
|
||||
}).then(() => {
|
||||
console.log('this.state.isPublishAndNew', this.state.isPublishAndNew)
|
||||
setTimeout(() => {
|
||||
if (this.state.isPublishAndNew) {
|
||||
Taro.navigateTo({
|
||||
@ -169,12 +166,6 @@ class SupplyDemand extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
// 从图片子组件获取信息
|
||||
getImageDetails(value) {
|
||||
this.setState({
|
||||
ImagesInfo: value
|
||||
})
|
||||
}
|
||||
// 修改供求类型
|
||||
demandingSupplyCate = e => {
|
||||
this.setState({
|
||||
@ -212,11 +203,11 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublishAndNew: false }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -232,11 +223,11 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
if (this.state.demandingSupplyCateSelected && this.state.title && this.state.contactName && this.state.contactNumber && this.state.content && this.state.demandingSupplyStateSelected) {
|
||||
|
||||
showLoading({ title: '发布中' })
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
Taro.showLoading({ title: '发布中' }).then(() => {
|
||||
this.setState({ isPublishAndNew: true }, () => {
|
||||
this.uploadDemSup({})
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '请填写完表格',
|
||||
@ -259,10 +250,7 @@ class SupplyDemand extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
contactName: getGlobalStorage('user_identity').username || '',
|
||||
contactNumber: getGlobalStorage('user_identity').userphone || '',
|
||||
})
|
||||
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// console.log(this.props, nextProps)
|
||||
@ -271,7 +259,16 @@ class SupplyDemand extends Component {
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
isUserShopOwner()
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
if (!getGlobalStorage('shopInfo').shop_id && getGlobalStorage('userInfo').user_id) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
@ -314,18 +311,7 @@ class SupplyDemand extends Component {
|
||||
border={false}
|
||||
/>
|
||||
</View>
|
||||
<View className='input-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<AtInput
|
||||
name='value'
|
||||
title='联系电话:'
|
||||
type='number'
|
||||
value={this.state.contactNumber}
|
||||
onChange={this.contactNumberChange.bind(this)}
|
||||
border={false}
|
||||
/>
|
||||
</View>
|
||||
{/* <View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
|
||||
<View className='title' style='font-weight:bold;'>
|
||||
<Text style='color:red'>*</Text>
|
||||
<Text>联系电话:</Text>
|
||||
@ -337,51 +323,38 @@ class SupplyDemand extends Component {
|
||||
value={this.state.contactNumber}
|
||||
onInput={this.contactNumberChange.bind(this)}
|
||||
/></View>
|
||||
</View> */}
|
||||
</View>
|
||||
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>联系地址:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
|
||||
<AtTextarea
|
||||
value={this.state.contactAddress}
|
||||
onChange={this.contactAddressChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder='联系地址'
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.contactAddressChange.bind(this)}
|
||||
value={this.state.contactAddress}
|
||||
placeholder="联系地址"
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
|
||||
/>
|
||||
</View>
|
||||
<View className='demanding-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'><Text className='require'>*</Text>需求内容:</Text>
|
||||
</View>
|
||||
{platformChecker() ? <AtTextarea
|
||||
<AtTextarea
|
||||
value={this.state.content}
|
||||
onChange={this.contentChange.bind(this)}
|
||||
maxlength='140'
|
||||
placeholder=''
|
||||
/> : <View className='textarea-wrapper'>
|
||||
<textarea className='text-area'
|
||||
onInput={this.contentChange.bind(this)}
|
||||
value={this.state.content}
|
||||
placeholder=""
|
||||
maxlength='140' /></View>
|
||||
}
|
||||
|
||||
/>
|
||||
</View>
|
||||
<View className='img-box'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>需求图片:</Text>
|
||||
<View className='warn'>(最多4张)</View>
|
||||
</View>
|
||||
{platformChecker() ? <View className='img-container'>
|
||||
|
||||
<View className='img-container'>
|
||||
<AtImagePicker
|
||||
multiple
|
||||
showAddBtn={this.state.pickerImageUrl.length < 4}
|
||||
@ -390,9 +363,7 @@ class SupplyDemand extends Component {
|
||||
onFail={this.onFail.bind(this)}
|
||||
onImageClick={this.onImageClick.bind(this)}
|
||||
/>
|
||||
</View> : <AliPictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
|
||||
}
|
||||
|
||||
</View>
|
||||
|
||||
</View>
|
||||
<View className='page-section'>
|
||||
|
@ -72,13 +72,3 @@ $themeColor:#FF7142;
|
||||
line-height:100rpx;
|
||||
|
||||
}
|
||||
.textarea-wrapper{
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgb(214, 228, 239);
|
||||
border-radius: 8px;
|
||||
padding:5px;
|
||||
.text-area{
|
||||
height: 150px;
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import CopyrightComponent from '../../component/copyrightComponent/copyrightComp
|
||||
import './supplyDemandView.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import { getGlobalStorage } from '../../util/getSetStoage';
|
||||
import { showLoading } from '../../util/hideShowLoading';
|
||||
|
||||
|
||||
|
||||
@ -36,14 +35,12 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
//获取商品信息api GetProductInfo
|
||||
getSupplyDemandInfo() {
|
||||
|
||||
let sdId=decodeURIComponent(this.$router.params.sdId)
|
||||
Taro.request({
|
||||
url: URL.GetSupplyDemandInfo,
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
sdID: sdId,
|
||||
sdID: this.$router.params.sdId,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
@ -70,12 +67,12 @@ class SupplyDemandView 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'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
@ -132,9 +129,8 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
// 跳转到我的供求编辑页面
|
||||
goToMyDSEditPage() {
|
||||
let sdId=encodeURIComponent(this.state.itemId)
|
||||
Taro.redirectTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + this.state.itemId
|
||||
})
|
||||
|
||||
}
|
||||
@ -157,15 +153,15 @@ class SupplyDemandView extends Component {
|
||||
}
|
||||
handleWindowConfirm() {
|
||||
this.setState({ isDeleteModal: false })
|
||||
showLoading({
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.onDelete({ sdID: this.state.itemId })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
showLoading({ title: '加载中' })
|
||||
|
||||
componentDidMount() {
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.getSupplyDemandInfo()
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
const LOCALURL = "http://192.168.1.230/"
|
||||
//const LOCALURL = "https://www.ihome6.com/"
|
||||
// const LOCALURL = "https://www.ihome6.com/"
|
||||
|
||||
const URL = {
|
||||
Base: LOCALURL,
|
||||
|
588
src/todo list.txt
Normal file
588
src/todo list.txt
Normal file
@ -0,0 +1,588 @@
|
||||
todo list:
|
||||
首页:
|
||||
商品发布页面:
|
||||
|
||||
供求发布页面
|
||||
全部业主需求页面:
|
||||
我的供求页面:
|
||||
我的商品列表页面
|
||||
商品编辑页面
|
||||
|
||||
我的需求列表页面:
|
||||
接口问题:
|
||||
优惠卷和询价
|
||||
bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
|
||||
|
||||
|
||||
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import MainCateSlider from './mainCateSlider/mainCateSlider'
|
||||
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './home.scss'
|
||||
|
||||
|
||||
|
||||
|
||||
class Home extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: '首页',
|
||||
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
shops: [], // 推荐店铺的信息
|
||||
ads: [], //广告图片数组
|
||||
categories: [],// 大类
|
||||
subCate: [], //小类
|
||||
demanding: [],// 业主需求
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: getGlobalStorage('user_identity').userName || '',//用户名字
|
||||
userPhone: getGlobalStorage('user_identity').userPhone || '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
parentClass: '',// 大类的id
|
||||
childClass: '-1',//小类的id
|
||||
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// onPullDownRefresh() {
|
||||
// Taro.showLoading({ title: '加载中' })
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
// this.getHomeCategoriesInfo()
|
||||
// }).catch(err => console.log('微信登入失败:', err))
|
||||
|
||||
// Taro.stopPullDownRefresh()
|
||||
// }
|
||||
|
||||
|
||||
//api得到首页的信息
|
||||
getHomeCategoriesInfo() {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
// 'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('首页基本信息', res)
|
||||
if (res.data.err_msg === 'success') {
|
||||
|
||||
this.setState({
|
||||
ads: res.data.data.adsLb,
|
||||
categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])],
|
||||
demanding: res.data.data.demand.supplys,
|
||||
otherData: res.data.otherData,
|
||||
userName: res.data.otherData.userName,
|
||||
userPhone: res.data.otherData.userPhone,
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
// api 得到推荐商店的信息
|
||||
getShops({ parent_supply_class = this.state.parentClass, supply_class = this.state.childClass, supply_level = this.state.supplyLevel, curr_page = 1,
|
||||
page_count = 5, action = "2" }) {
|
||||
Taro.request({
|
||||
url: URL.ShopSupplyShops,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
parent_supply_class: parent_supply_class, //父级class id
|
||||
supply_class: supply_class,// 子级class id
|
||||
supply_level: supply_level,// 层级
|
||||
action: action,
|
||||
latitude: this.state.latitude,
|
||||
longitude: this.state.longitude,
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('所有店铺的信息', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_code === 0) {
|
||||
if (this.state.isAddToList) {
|
||||
if (res.data.shops) {
|
||||
this.setState({ shops: this.state.shops.concat(res.data.shops), isAddToList: false })
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
} else {
|
||||
res.data.shops ? this.setState({ shops: res.data.shops }) : this.setState({ shops: [] })
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
this.setState({ isAddToList: false })
|
||||
}
|
||||
)
|
||||
}
|
||||
getUserLocation() {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 微信用户设置
|
||||
// wxUserSetting() {
|
||||
// Taro.getSetting({
|
||||
// success(res) {
|
||||
// if (res.authSetting['scope.userInfo']) {
|
||||
// console.log('personal info', res)
|
||||
// Taro.authorize({
|
||||
// scope: 'scope.userInfo',
|
||||
// success() {
|
||||
// // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
|
||||
// // Taro.getUserInfo({
|
||||
// // success(res1) {
|
||||
// // console.log('res1',res1)
|
||||
// // }
|
||||
// // })
|
||||
// console.log('权限允许')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// api 抢单请求
|
||||
GrabDemand({ demandId = 218 }) {
|
||||
Taro.request({
|
||||
url: URL.GrabDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
console.log('抢单请求:', res)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 点击大类icon
|
||||
onClickParentCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
this.getShops({})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 点击子类
|
||||
onClickChildCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||
this.getShops({})
|
||||
|
||||
})
|
||||
// this.getShops(item.parent_class_id, item.class_id, 2)
|
||||
|
||||
}
|
||||
scrollToSubCate(item) {
|
||||
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: 410,
|
||||
duration: 300
|
||||
})
|
||||
this.onClickParentCate(item)
|
||||
}
|
||||
// 转到其他页面
|
||||
goToAllDemandingPage() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: '/pages/allDemanding/allDemanding'
|
||||
})
|
||||
}
|
||||
|
||||
grabOrderId(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
this.setState({ isOpen: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabModalCancel() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
if (!getGlobalStorage('userInfo').user_id) {
|
||||
LoginService()
|
||||
}
|
||||
this.setState({ isOpen: false })
|
||||
// 确认抢单之后
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(e) {
|
||||
const orderId = e.currentTarget.dataset.eTapAA
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish?id=1'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getUserLocation().then(res => {
|
||||
this.setState({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
}, () => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
}).catch(err => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
getGlobalStorage('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() {
|
||||
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
|
||||
// 微信用户信息
|
||||
onGotUserInfo(e) {
|
||||
console.log(e.detail.errMsg)
|
||||
console.log(e.detail.userInfo)
|
||||
console.log(e.detail.rawData)
|
||||
}
|
||||
// 页面位置
|
||||
onPageScroll(location) {
|
||||
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: false })
|
||||
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
||||
this.setState({ isShowTopNav: true })
|
||||
}
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||
this.getShops({ curr_page: this.state.loadMorePageIndex, })
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认抢单?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
||||
|
||||
return <SwiperItem key={index} >
|
||||
<View className={this.state.demanding.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<View className='item-tag'>
|
||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||
</View>
|
||||
<View className='item-title'>
|
||||
{item.sd_title}
|
||||
</View>
|
||||
<View className='item-address'>
|
||||
{item.user_address || '--'}
|
||||
</View>
|
||||
<View className='item-name'>
|
||||
业主:{item.user_name}
|
||||
</View>
|
||||
</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
{/* <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
</SwiperItem >
|
||||
}) : null
|
||||
|
||||
const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
|
||||
return <SwiperItem key={index}>
|
||||
<Image className='banner-img' src={URL.Base + item.ads_pic} />
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
// 这里应该代码可以优化-----
|
||||
const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
|
||||
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
key={index}
|
||||
categoryLevel={this.state.supplyLevel}
|
||||
classId={this.state.parentClass === this.state.childClass ? this.state.parentClass : this.state.childClass}
|
||||
></FilteredShopComponent>
|
||||
}) : <View className='no-more-title top'> 没有更多了</View>
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
return (
|
||||
<View className='home'>
|
||||
|
||||
{/* 获取微信用户的信息 */}
|
||||
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||
|
||||
{modalMessageGrabElement}
|
||||
|
||||
<View className='first-banner'>
|
||||
<Swiper
|
||||
className='swipper'
|
||||
style='height:120px;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
{adsImgElementsArray}
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
{/* 第二行图片滚动条 */}
|
||||
{/* <View className='second-banner'>
|
||||
<Swiper
|
||||
style='height:100%;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
// autoplay
|
||||
>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray1}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray2}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
</Swiper>
|
||||
</View> */}
|
||||
<MainCateSlider/>
|
||||
{/* 第三行图片滚动条 */}
|
||||
<View className='third-banner'>
|
||||
<Swiper
|
||||
style='height:100px;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
<SwiperItem onClick={this.goToMyNeedsPublish.bind(this)}>
|
||||
<Image className='banner-img' src={URL.Base + 'Public/images/xgt.png'} />
|
||||
</SwiperItem>
|
||||
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
{/* 业主需求和行业推荐 */}
|
||||
<View className='container'>
|
||||
<View className='title'>
|
||||
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>业主需求</Text>
|
||||
|
||||
<Text className='more-link' onClick={this.goToAllDemandingPage.bind(this)}>
|
||||
更多>>
|
||||
</Text>
|
||||
</View>
|
||||
<View className='customer-demanding'>
|
||||
<Swiper
|
||||
style='height:180px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
|
||||
displayMultipleItems='2.5'
|
||||
>
|
||||
{demandingElemensArray}
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
<View className='second-banner-level2'>
|
||||
{this.state.subCate.length ? <Swiper
|
||||
style='height:35px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
displayMultipleItems={this.state.subCate.length > 4.5 ? 4.5 : this.state.subCate.length}
|
||||
>
|
||||
{subCateElementsArray}
|
||||
</Swiper> : null}
|
||||
</View>
|
||||
<View className='title'>
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>行业推荐</Text>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='shop-box'>
|
||||
{shopCollectionElementsArray}
|
||||
|
||||
|
||||
</View>
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
<View className='gap'>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
</View>
|
||||
<View className='bottom-nav-box'>
|
||||
{/* <BottomNav otherData={this.state.otherData} /> */}
|
||||
</View>
|
||||
{/* {this.state.isShopOwner ? <SellerTabBarComponent currentUrl={currentUrl} /> : <ClientTabBarComponent currentUrl={currentUrl} />} */}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
@ -1,31 +0,0 @@
|
||||
import { getGlobalStorage } from "./getSetStoage";
|
||||
import Taro from '@tarojs/taro'
|
||||
// check if user login
|
||||
|
||||
const isUserLogin = () => {
|
||||
return new Promise((resolve,reject)=>{
|
||||
let isLogin = getGlobalStorage('userInfo') ? true : false
|
||||
if (!isLogin) {
|
||||
Taro.switchTab({
|
||||
url: '/pages/home/home'
|
||||
})
|
||||
Taro.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
|
||||
}else{
|
||||
resolve('继续')
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
const isUserShopOwner = () => {
|
||||
let isShopOwner = getGlobalStorage('shopInfo') ? true : false
|
||||
if (!isShopOwner) {
|
||||
Taro.showToast({
|
||||
title: '您还没有店铺,不能使用该功能,快去申请吧',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
export { isUserLogin, isUserShopOwner }
|
@ -3,7 +3,10 @@ import Taro from '@tarojs/taro'
|
||||
|
||||
const setGlobalStorage = (key, value) => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
Taro.setStorageSync(key, value)
|
||||
Taro.setStorageSync({
|
||||
key: key,
|
||||
data: value
|
||||
})
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
my.setStorageSync({
|
||||
@ -15,20 +18,15 @@ const setGlobalStorage = (key, value) => {
|
||||
|
||||
const getGlobalStorage = (key) => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
return Taro.getStorageSync(key)
|
||||
|
||||
getGlobalStorage(key)
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
|
||||
let res = my.getStorageSync({
|
||||
key: key,
|
||||
})
|
||||
if (res.data || res.APDataStorage) {
|
||||
return res.data || res.APDataStorage
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
res.data=res.data?res.data:{username:'',userphone:'',user_id:''}
|
||||
return res.data ||res.APDataStorage
|
||||
}
|
||||
}
|
||||
export { setGlobalStorage, getGlobalStorage }
|
@ -1,24 +0,0 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
|
||||
|
||||
const showLoading = ({ title='加载中'}) => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
Taro.showLoading({
|
||||
title: title
|
||||
})
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
my.showLoading({
|
||||
content: title
|
||||
})
|
||||
}
|
||||
}
|
||||
const hideLoading = () => {
|
||||
if (process.env.TARO_ENV === 'weapp') {
|
||||
Taro.hideLoading()
|
||||
|
||||
} else if (process.env.TARO_ENV === 'alipay') {
|
||||
my.hideLoading()
|
||||
}
|
||||
}
|
||||
export { showLoading, hideLoading }
|
@ -1,13 +1,13 @@
|
||||
|
||||
|
||||
export default function onClickValueService(value) {
|
||||
|
||||
export default function onClickValueService(e) {
|
||||
let value
|
||||
if (process.env.TARO_ENV === 'alipay') {
|
||||
return value
|
||||
value = e.currentTarget.dataset.eOnTapAA
|
||||
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
return value
|
||||
value = e.currentTarget.dataset.eTapAA
|
||||
}
|
||||
|
||||
|
||||
value=typeof(value)==='string'?encodeURIComponent(value):value
|
||||
return value
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
const platformChecker=()=>{
|
||||
if(process.env.TARO_ENV==='weapp'||process.env.TARO_ENV==='h5'||process.env.TARO_ENV==='rn'){
|
||||
return true
|
||||
}else if(process.env.TARO_ENV==='alipay'){
|
||||
return false
|
||||
}
|
||||
}
|
||||
export default platformChecker
|
@ -4,59 +4,60 @@ import { setGlobalStorage, getGlobalStorage } from './getSetStoage';
|
||||
|
||||
|
||||
const setUserInfoToStorage = () => {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
if (res.data.err_msg === 'success') {
|
||||
setGlobalStorage('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_msg === 'success') {
|
||||
setGlobalStorage('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
export default function standardLogin(username, password) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve,reject)=>{
|
||||
Taro.request({
|
||||
url: URL.StandardLogin,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
username: username,
|
||||
password: password,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('普通登录', res)
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '登入成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
setGlobalStorage('session_id', res.data.session_id)
|
||||
setGlobalStorage('shopInfo', res.data.shop_info)
|
||||
setGlobalStorage('userInfo', res.data.user_info)
|
||||
setGlobalStorage('accountInfo', { username: username, password: password })
|
||||
setUserInfoToStorage()
|
||||
resolve('success')
|
||||
} else {
|
||||
reject(res)
|
||||
url: URL.StandardLogin,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
username: username,
|
||||
password: password,
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
})
|
||||
.then(res => {
|
||||
console.log('普通登录',res)
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: '登入成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
|
||||
setGlobalStorage('session_id', res.data.session_id)
|
||||
setGlobalStorage('shopInfo', res.data.shop_info)
|
||||
setGlobalStorage('userInfo', res.data.user_info)
|
||||
setGlobalStorage('accountInfo', { username: username, password: password })
|
||||
setUserInfoToStorage()
|
||||
resolve('success')
|
||||
} else {
|
||||
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import URL from '../serviceAPI.config'
|
||||
import { getGlobalStorage } from './getSetStoage';
|
||||
import platformChecker from './plaformChecker'
|
||||
|
||||
//用户信息姓名和电话号码接口
|
||||
const setUserInfoToStorage = () => {
|
||||
@ -29,61 +28,54 @@ const setUserInfoToStorage = () => {
|
||||
|
||||
// 异步函数登入api
|
||||
export default function wechatLogin() {
|
||||
//微信登录的时候查看小程序端是什么平台
|
||||
if (platformChecker()) {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
// 发起网络请求
|
||||
Taro.request({
|
||||
url: URL.Login,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
code: res.code
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (response.data.err_code === 0) {
|
||||
console.log('微信登入成功', response)
|
||||
Taro.showToast({
|
||||
title: '微信登入成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
Taro.setStorageSync('session_id', response.data.session_id)
|
||||
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
||||
Taro.setStorageSync('userInfo', response.data.user_info)
|
||||
setUserInfoToStorage()
|
||||
resolve('微信登入成功')
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '微信登入失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject('微信登入失败')
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
return new Promise((resolve,reject)=>{
|
||||
Taro.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
// 发起网络请求
|
||||
console.log('手机端微信code:', res.code)
|
||||
Taro.request({
|
||||
url: URL.Login,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
code: res.code
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
else {
|
||||
console.log('微信登录失败!' + res.errMsg)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.data.err_code === 0) {
|
||||
console.log('微信登入成功', response)
|
||||
Taro.showToast({
|
||||
title: '微信登入成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
Taro.setStorageSync('session_id', response.data.session_id)
|
||||
Taro.setStorageSync('shopInfo', response.data.shop_info)
|
||||
Taro.setStorageSync('userInfo', response.data.user_info)
|
||||
setUserInfoToStorage()
|
||||
resolve('微信登入成功')
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '微信登入失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
reject('微信登入失败')
|
||||
// Taro.clearStorageSync()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}else{
|
||||
return new Promise((resolve, reject)=>{
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
else {
|
||||
console.log('登录失败!' + res.errMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
220
todo list.json
220
todo list.json
@ -1,220 +0,0 @@
|
||||
todo list:
|
||||
首页:
|
||||
商品发布页面:
|
||||
|
||||
供求发布页面
|
||||
全部业主需求页面:
|
||||
我的供求页面:
|
||||
我的商品列表页面
|
||||
商品编辑页面
|
||||
|
||||
我的需求列表页面:
|
||||
接口问题:
|
||||
优惠卷和询价
|
||||
bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
|
||||
|
||||
|
||||
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
<View className='details-box'>
|
||||
|
||||
// shop interaction
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text,Picker } from '@tarojs/components'
|
||||
|
||||
|
||||
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 (
|
||||
<View class='page-section'>
|
||||
<Picker
|
||||
rangeKey='name'
|
||||
mode='multiSelector'
|
||||
onChange={this.bindMultiPickerChange.bind(this)}
|
||||
onColumnchange={this.bindMultiPickerCol.bind(this)}
|
||||
value={this.state.multiIndex}
|
||||
range={this.state.initailMultiArray}
|
||||
>
|
||||
<View class='picker type'>
|
||||
<View className='title-box'>
|
||||
<Text className='require'>*</Text>
|
||||
<Text className='title'>店铺分类:</Text>
|
||||
<Text className='first-col'>
|
||||
{this.props.selectedValue.name}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Picker>
|
||||
</View>
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ShopTypeInteractionComp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user