wechat app 1.0.1

This commit is contained in:
郑茂强 2019-03-06 14:16:09 +08:00
parent 1f79ef2bda
commit ad18b8919c
22 changed files with 142 additions and 66 deletions

View File

@ -20,7 +20,7 @@ class App extends Component {
config = {
pages: [
//'pages/index/index', // index页面
'pages/home/home',//首页 ---------------------
'pages/login/login',//登入页面 ---------------------
'pages/shop/shop',//店铺页面 ---------------------
@ -40,8 +40,6 @@ class App extends Component {
'pages/myNeedsPublish/myNeedsPublish',// 需求发布
'pages/individualCenter/individualCenter',// 个人中心页面
// 'pages/shopDescription/shopDescription',
],
permission: {

View File

@ -40,12 +40,14 @@ class recommondShop extends Component {
}
}
goToShop(value) {
goToShop(e) {
console.log('e',e)
const value = e.currentTarget.dataset.eTapAA
Taro.navigateTo({
url: '/pages/shop/shop?id=' + value.shop_id
})
}
// api 优惠请求
// api 优惠请求
getVoucherInfo({ user = this.state.userName,
phone = this.state.userPhone,
shops = [this.props.shop.shop_id],
@ -79,7 +81,7 @@ class recommondShop extends Component {
voucherResponseMsg: res.data.tips,
isCanVoucher: res.data.canConsult,
})
console.log('优惠请求', res)
console.log('优惠请求', res)
})
}
@ -237,8 +239,8 @@ class recommondShop extends Component {
const address = this.props.shop.shop_address
const distance = this.props.shop.distance
const ads = this.props.shop.ads
const voucherLeft = this.props.shop.left_nums // 优惠是否为灰色
const isShowConsultButton = this.props.shop.wx_open === '0' ? false : true // 优惠是否为灰色
const voucherLeft = this.props.shop.left_nums // 优惠是否为灰色
const isShowConsultButton = this.props.shop.wx_open === '0' ? false : true // 优惠是否为灰色
const slicedGoods = goods !== null ? goods.slice(1) : null
const goodsElementsArray = goods !== null ? slicedGoods.map((item, index) => {
return <View className='goods-img-box' key={index}>
@ -249,7 +251,7 @@ class recommondShop extends Component {
</View>
}) : null
// 优惠和咨询元素
// 优惠和咨询元素
const consultModalElement = <AtModal isOpened={this.state.isOpenConsult}>
<AtModalHeader>咨询</AtModalHeader>
<AtModalContent>
@ -315,9 +317,9 @@ class recommondShop extends Component {
<View className='button-container' style='margin-right:5px'>
{voucherLeft ? <View className='button' onClick={this.isOpenVoucher.bind(this)} >
<Button size='mini' className='button-blue-mini'>
优惠</Button>
优惠</Button>
</View> : <View className='button blur' onClick={this.isOpenVoucher.bind(this)} >
<Button size='mini' className='button-blue-mini'>优惠</Button>
<Button size='mini' className='button-blue-mini'>优惠</Button>
</View>}
{isShowConsultButton ? <View className='button contult-button' onClick={this.isOpenConsult.bind(this)} >

View File

@ -11,7 +11,7 @@ import loginExpired from '../../../util/loginExpired'
class VoucherPoster extends Component {
config = {
navigationBarTitleText: '优惠活动弹窗'
navigationBarTitleText: '优惠活动弹窗'
}
constructor() {
@ -134,7 +134,7 @@ class VoucherPoster extends Component {
</View>
<View className='voucher-left'>
当前优惠<Text class='left-amount'>{this.props.voucherLeft}</Text>
当前优惠<Text class='left-amount'>{this.props.voucherLeft}</Text>
</View>
<View className='input-name' >
<View className='title'> <Text>联系人</Text></View>

View File

@ -49,6 +49,7 @@ class Goods extends Component {
}
})
.then(res => {
Taro.hideLoading()
console.log('商品详情:', res)
if (res.data.err_msg === "success") {
this.setState({
@ -127,7 +128,9 @@ class Goods extends Component {
}
componentDidMount() {
Taro.showLoading({
title: '加载中'
})
this.getGoodDescription()
}
componentWillReceiveProps(nextProps) {

View File

@ -54,6 +54,7 @@ class GrabOrderPage extends Component {
})
.then(res => {
console.log('抢单详情获取成功', res)
Taro.hideLoading()
if (res.data.err_code === 0) {
this.setState({
type: res.data.sdInfo.class_name,
@ -100,6 +101,7 @@ class GrabOrderPage extends Component {
}
})
.then(res => {
Taro.hideLoading()
if (res.data.err_code === 0) {
Taro.showToast({
title: '抢单成功',
@ -107,8 +109,8 @@ class GrabOrderPage extends Component {
duration: 1500
})
setTimeout(() => {
Taro.navigateTo({
url: '/pages/home/home'
Taro.navigateBack({
delta:1
})
}, 1500);
@ -150,11 +152,16 @@ class GrabOrderPage extends Component {
handleGrabConfirm() {
this.setState({ isOpen: false })
// 确认抢单之后
Taro.showLoading({
title: '加载中'
})
this.GrabDemand({ demandId: this.state.grabOrderId })
}
componentDidMount() {
Taro.showLoading({
title:'加载中'
})
this.getGrabOrderInfo()
}
componentWillReceiveProps(nextProps) {

View File

@ -24,7 +24,8 @@ class RenderingView extends Component {
}
onClickHandler(item) {
onClickHandler(e) {
const item = e.currentTarget.dataset.eTapAA
this.setState({
image: URL.Base + item.file_path,
isOpened:true

View File

@ -211,7 +211,8 @@ class Home extends Component {
}
// 点击大类icon
onClickParentCate(item) {
onClickParentCate(e) {
const item = e.currentTarget.dataset.eTapAA
Taro.showLoading({
title: '加载中'
})
@ -222,7 +223,8 @@ class Home extends Component {
}
// 点击子类
onClickChildCate(item) {
onClickChildCate(e) {
const item = e.currentTarget.dataset.eTapAA
Taro.showLoading({
title: '加载中'
})
@ -252,8 +254,9 @@ class Home extends Component {
})
}
grabOrderId(Id) {
this.setState({ isOpen: true, grabOrderId: Id })
grabOrderId(e) {
const id = e.currentTarget.dataset.eTapAA
this.setState({ isOpen: true, grabOrderId: id })
}
handleGrabModalClose() {
this.setState({ isOpen: false })
@ -272,9 +275,10 @@ class Home extends Component {
// 导航去抢单页面
goToGrabOrderPage(orderId) {
Taro.navigateTo({
goToGrabOrderPage(e) {
const orderId = e.currentTarget.dataset.eTapAA
Taro.navigateTo({
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
})
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -3,6 +3,8 @@ import { View, Image, Button } from '@tarojs/components'
import { AtGrid, AtList, AtListItem, AtAvatar, AtButton } from "taro-ui"
import LoginService from '../../util/LoginService'
import Logout from '../../util/logout'
import './individualCenter.scss'
import URL from '../../serviceAPI.config'
@ -28,13 +30,14 @@ class IndividualCenter extends Component {
],
seller: [
{
image: 'https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png',
image: 'https://img30.360buyimg.com/jdphoto/s72x72_jfs/t5770/97/5184449507/2423/294d5f95/595c3b4dNbc6bc95d.png',
value: '我的商品'
},
{
image: 'https://img20.360buyimg.com/jdphoto/s72x72_jfs/t15151/308/1012305375/2300/536ee6ef/5a411466N040a074b.png',
image: 'https://img14.360buyimg.com/jdphoto/s72x72_jfs/t17251/336/1311038817/3177/72595a07/5ac44618Na1db7b09.png',
value: '商品发布'
},
{
image: 'https://img10.360buyimg.com/jdphoto/s72x72_jfs/t5872/209/5240187906/2872/8fa98cd/595c3b2aN4155b931.png',
value: '我的供求'
@ -47,6 +50,7 @@ class IndividualCenter extends Component {
username: '',
avatar: '',
isShop: false,
vip_level:''
}
}
handlerGridClick(e) {
@ -88,25 +92,22 @@ class IndividualCenter extends Component {
}
}
handlerTitleBarClick() {
Taro.showToast({
title: '暂时没有更多',
icon: 'none'
})
// Taro.showToast({
// title: '暂时没有更多',
// icon: 'none'
// })
}
getInfoFromStorage() {
const username = Taro.getStorageSync('userInfo').login_name
const avatar = Taro.getStorageSync('userInfo').avatar
const username = Taro.getStorageSync('userInfo').login_name||''
const avatar = Taro.getStorageSync('userInfo').avatar||''
const vip_level=Taro.getStorageSync('userInfo').vip_name||''
const isShop = Taro.getStorageSync('shopInfo').shop_id ? true : false
this.setState({
username, avatar, isShop
username, avatar, isShop,vip_level
})
}
handleLogoutClick() {
Taro.clearStorageSync()
Taro.reLaunch({
url: '/pages/login/login'
})
Logout()
}
componentDidMount() {
this.getInfoFromStorage()
@ -121,13 +122,13 @@ class IndividualCenter extends Component {
if (!Taro.getStorageSync('userInfo').user_id) {
LoginService()
return
}
}
}
}
componentDidHide() { }
render() {
const { client, seller, username, avatar, isShop } = this.state
const { client, seller, username, avatar,vip_level, isShop } = this.state
return (
<View className='individualCenter'>
<View className='avatar'>
@ -135,7 +136,7 @@ class IndividualCenter extends Component {
<View className='user-name'>
<View className='name'>
{username}</View>
<View className='badge'>????</View>
<View className='badge'>{vip_level}</View>
</View>
</View>
<View className='client-container'>
@ -146,21 +147,21 @@ class IndividualCenter extends Component {
/>
</View>
<View className='row'>
<View className='title'>收藏的宝贝</View>|
{/* <View className='title'></View>|
<View className='title'>收藏的店铺</View>|
<View className='title'>我的足迹</View>
<View className='title'>我的足迹</View> */}
</View>
<AtList>
<AtListItem hasBorder={false} title='业主中心' onClick={this.handlerTitleBarClick.bind(this)} extraText='更多' arrow='right' />
<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='更多' arrow='right' />
<AtListItem hasBorder={false} title='店铺中心' onClick={this.handlerTitleBarClick.bind(this)} extraText=''/>
</AtList>
<AtGrid hasBorder={false} data={seller} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
<AtGrid hasBorder={false} data={seller} columnNum={4} onClick={this.handlerGridClick.bind(this)} />
</View> : <View />}
<View className='logout' onClick={this.handleLogoutClick.bind(this)}>
{/* <AtButton type='primary' size='normal'>退出</AtButton> */}

View File

@ -7,13 +7,19 @@
display: flex;
.user-name{
display: flex;
font-size: 25rpx;
font-size: 30rpx;
color: #FFFFFF;
height:40rpx;
.name{
margin-left: 15rpx
}
.badge{
margin-left: 15rpx
margin-left: 15rpx;
background-color: #BFB899;
line-height: 40rpx;
padding-left:10rpx;
padding-right:10rpx;
}
}
}

View File

@ -261,6 +261,7 @@ class MyGoodList extends Component {
}
}).then(res => {
let responseData = JSON.parse(res.data)
Taro.hideLoading()
if (responseData.err_code === 0) {
this.setState({
isCheckAll: false,
@ -307,6 +308,7 @@ class MyGoodList extends Component {
}
}).then(res => {
let responseData = JSON.parse(res.data)
Taro.hideLoading()
if (responseData.err_code === 0) {
Taro.showToast({
title: '删除成功',
@ -373,7 +375,11 @@ class MyGoodList extends Component {
}
// 产品排序
accendingDescending(value) {
accendingDescending(e) {
Taro.showLoading({
title: '加载中'
})
const value = e.currentTarget.dataset.eTapAA
this.setState({ selectedFilterValue: value })
if (value == 0) {
this.setState({
@ -484,10 +490,11 @@ class MyGoodList extends Component {
// 单个商品选择
handleCheckChange(Id) {
handleCheckChange(e) {
//如果goodid 一样的那么checked 就取反
const id = e.currentTarget.dataset.eTapAA
const newMyGoodList = this.state.myGoodList.map((item) => {
if (item.goods_id === Id) {
if (item.goods_id === id) {
item.checked = !item.checked
}
return item
@ -558,6 +565,9 @@ class MyGoodList extends Component {
checkedGoodsId.push(item.goods_id)
}
});
Taro.showLoading({
title: '加载中'
})
this.deleteGood({ goodsID: checkedGoodsId })
}
deleteModalClose() {
@ -576,6 +586,9 @@ class MyGoodList extends Component {
checkedGoodsId.push(item.goods_id)
}
});
Taro.showLoading({
title: '加载中'
})
this.changeGoodState({ goodsID: checkedGoodsId })
}
offStockModalClose() {
@ -592,7 +605,6 @@ class MyGoodList extends Component {
Taro.getSystemInfo().then(res => {
return res
}).then(res => {
console.log('res', res)
this.setState({
screenWidth: res.screenWidth - 80 + 'px',
screenHeight: res.screenHeight - 200 + 'px'

View File

@ -46,7 +46,7 @@ class MyGoodsEdit extends Component {
}
})
.then(res => {
console.log('res',res)
Taro.hideLoading()
if (res.data.err_code === 0) {
console.log('商品详情获取成功', res)
@ -238,7 +238,6 @@ class MyGoodsEdit extends Component {
'X-Requested-With': 'XMLHttpRequest'
},
success(response) {
const data = JSON.parse(response.data)
if (data.err_code === 0) {
console.log('imagedata', data)
@ -365,6 +364,9 @@ class MyGoodsEdit extends Component {
componentDidMount() {
Taro.showLoading({
title:'加载中'
})
this.getGoodsInfo()
}

View File

@ -264,7 +264,8 @@ class MyNeeds extends Component {
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id
})
}
deleteButton(item) {
deleteButton(e) {
const item = e.currentTarget.dataset.eTapAA
this.setState({ isDeleteModal: true, needsItem: item })
}
handleWindowModCancel() {

View File

@ -263,7 +263,6 @@ class MyNeedsPublish extends Component {
// this.getSupplyDemandInfo()
// 如果路由参数为1 就默认显示 效果图,反之 显示业主需求
const isRenderingPic = this.$router.params.id
console.log(parseInt(isRenderingPic))
if (parseInt(isRenderingPic)) {
this.setState({ needsTypeSelected: { name: '效果图', id: '5' } })
}

View File

@ -138,6 +138,7 @@ class MySupplyDemand extends Component {
}
})
.then(res => {
Taro.hideLoading()
if (res.data.err_code == 0) {
console.log('删除成功')
Taro.showToast({
@ -224,13 +225,18 @@ class MySupplyDemand extends Component {
}
handleWindowConfirm() {
this.setState({ isConfirmWindow: false })
Taro.showLoading({
title: '加载中'
})
this.onDelete({ sdID: this.state.demandSupplyId })
}
// 删除我的供求
handleOnDelete(id, itemName) {
this.setState({ isConfirmWindow: true, demandSupplyItemName: itemName, demandSupplyId: id })
handleOnDelete(e) {
const title = e.currentTarget.dataset.eTapAA.sd_title
const id = e.currentTarget.dataset.eTapAA.sd_id
this.setState({ isConfirmWindow: true, demandSupplyItemName: title, demandSupplyId: id })
}
@ -260,7 +266,6 @@ class MySupplyDemand extends Component {
Taro.getSystemInfo().then(res => {
return res
}).then(res => {
console.log('res', res)
this.setState({
screenWidth: res.screenWidth - 80 + 'px',
screenHeight: res.screenHeight - 200 + 'px'
@ -370,7 +375,7 @@ class MySupplyDemand extends Component {
<View className='button' onClick={this.goToMyDSEditPage.bind(this, item.sd_id)} >
<Button size='mini' className='button-orange button-no-margin'>编辑</Button>
</View>
<View className='button' onClick={this.handleOnDelete.bind(this, item.sd_id, item.sd_title)}>
<View className='button' onClick={this.handleOnDelete.bind(this, item)}>
<Button size='mini' className='button-dark-red button-no-margin'>删除</Button>
</View>
</View>

View File

@ -351,7 +351,8 @@ class Shop extends Component {
// 产品排序
accendingDescending(value) {
accendingDescending(e) {
const value = e.currentTarget.dataset.eTapAA
Taro.showLoading({ title: '加载中' })
this.setState({ selectedFilterValue: value })
if (value == 0) {

View File

@ -93,6 +93,7 @@ class SupplyDemandView extends Component {
}
})
.then(res => {
Taro.hideLoading()
if (res.data.err_code == 0) {
console.log('删除成功')
Taro.showToast({
@ -151,6 +152,9 @@ class SupplyDemandView extends Component {
}
handleWindowConfirm() {
this.setState({ isDeleteModal: false })
Taro.showLoading({
title: '加载中'
})
this.onDelete({ sdID: this.state.itemId })
}

View File

@ -1,13 +1,15 @@
const LOCALURL = "http://192.168.1.230/"
const LOCALURL = "http://192.168.1.230/"
// const LOCALURL = "https://www.ihome6.com/"
const URL = {
Base: LOCALURL,
Login: LOCALURL + 'Applet-login', //登入接口
Login: LOCALURL + 'Applet-login', //微信登入接口
StandardLogin: LOCALURL+ 'user-login', // 使用用户名和密码登入
LogOut:LOCALURL+'User-ajaxLoginOut',//退出接口
ShopWxStore: LOCALURL + 'Shop-ajaxStore', //商城首页信息
ShopSupplyShops: LOCALURL + 'Shop-supplyShops',// 商城店铺信息
GrabDemand: LOCALURL + 'Supply-grabDemand',// 抢单接口
GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠信息
GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠信息
GetConsultInfo: LOCALURL + 'Shop-consultTips',// 咨询信息
BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询
GetShopItemDetail: LOCALURL + 'GoodsQuery-ajaxGoodsDetail',// 商品详情

27
src/util/logout.js Normal file
View File

@ -0,0 +1,27 @@
import Taro from '@tarojs/taro'
import URL from '../serviceAPI.config'
export default function logout() {
Taro.request({
url:URL.LogOut,
header: {
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
}
}).then(res=>{
Taro.showToast({
title:'退出成功'
})
Taro.clearStorageSync()
setTimeout(() => {
Taro.reLaunch({
url: '/pages/login/login'
})
}, 2000);
}).catch(err=>{
Taro.showToast({
title:'退出失败',
icon:'none'
})
Taro.clearStorageSync()
})
}

View File

@ -25,7 +25,7 @@ const setUserInfoToStorage = () => {
export default function standardLogin(username, password) {
return new Promise((resolve,reject)=>{
Taro.request({
url: URL.Base + 'user-login',
url: URL.StandardLogin,
method: 'POST',
dataType: 'json',
data: {
@ -38,6 +38,7 @@ export default function standardLogin(username, password) {
}
})
.then(res => {
console.log('普通登录',res)
if (res.data.err_code === 0) {
Taro.showToast({
title: '登入成功',

BIN
weapp.rar

Binary file not shown.