提交 9d557b59 authored 作者: 何忠建's avatar 何忠建

小程序联调

上级 ff1b14c3
<template> <template>
<view> <view>
<uni-popup ref="authorization" background-color="#fff"> <uni-popup ref="authorization" background-color="#fff">
<view class="content-page" @touchmove="stopTouchMove"> <view class="content-page" @touchmove="stopTouchMove">
<view class="img-box"> <view class="img-box">
<image style="width: 100rpx; height: 100rpx;margin:22rpx;" mode="aspectFill" src="../static/images/logo.png"></image> <image style="width: 100rpx; height: 100rpx;margin:22rpx;" mode="aspectFill"
src="../static/images/logo.png"></image>
</view> </view>
<view class="text">为了更完美的体验,请授权获取电话</view> <view class="text">为了更完美的体验,请授权获取电话</view>
<button v-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber" hover-class="none">手机号登录</button> <button v-if="checked" class="login-btn" type="primary" open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber" hover-class="none">手机号登录</button>
<button v-else class="login-btn" type="primary" @click="verifyPolicy" hover-class="none">手机号登录</button> <button v-else class="login-btn" type="primary" @click="verifyPolicy" hover-class="none">手机号登录</button>
<view class="refuse" @click="refuse">取消</view> <view class="refuse" @click="refuse">取消</view>
...@@ -14,7 +16,8 @@ ...@@ -14,7 +16,8 @@
<checkbox-group @change="changePolicy"> <checkbox-group @change="changePolicy">
<label> <label>
<view class="policy-box"> <view class="policy-box">
<checkbox value="true" :checked="checked" color="#1677FF" style="transform:scale(0.7)" /> <checkbox value="true" :checked="checked" color="#1677FF"
style="transform:scale(0.7)" />
<text class="text">我已阅读并同意</text> <text class="text">我已阅读并同意</text>
<text class="policy" @click.stop="readAgreement">《用户服务协议》</text> <text class="policy" @click.stop="readAgreement">《用户服务协议》</text>
<text class="text"></text> <text class="text"></text>
...@@ -23,16 +26,17 @@ ...@@ -23,16 +26,17 @@
</label> </label>
</checkbox-group> </checkbox-group>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<script> <script>
import serverConfig from '@/config/server_config.js';
import { import {
analysisMobileApi, analysisMobileApi,
getPropertyLoginApi, getPropertyLoginApi,
bindingUserInfoApi queryLoginPhoneApi
} from "@/config/api.js" } from "@/config/api.js"
export default { export default {
data() { data() {
...@@ -43,10 +47,10 @@ ...@@ -43,10 +47,10 @@
}, },
watch: { watch: {
checked(newV) { checked(newV) {
if(newV) { if (newV) {
let _this = this let _this = this
wx.login({ wx.login({
success (res) { success(res) {
if (res.code) { if (res.code) {
_this.getCode(res.code) _this.getCode(res.code)
} }
...@@ -57,8 +61,19 @@ ...@@ -57,8 +61,19 @@
}, },
methods: { methods: {
async getCode(code) { async getCode(code) {
let {result} = await getPropertyLoginApi({code}, {custom: {load: false}}) let {
this.result = {...result} result
} = await getPropertyLoginApi({
code,
type: 'partner'
}, {
custom: {
load: false
}
})
this.result = {
...result
}
}, },
onOpenLogin() { onOpenLogin() {
this.$refs.authorization.open('center') this.$refs.authorization.open('center')
...@@ -75,7 +90,7 @@ ...@@ -75,7 +90,7 @@
}) })
}, },
verifyPolicy(e) { verifyPolicy(e) {
if(!this.checked) { if (!this.checked) {
uni.showToast({ uni.showToast({
title: '请先同意协议和政策', title: '请先同意协议和政策',
icon: 'none' icon: 'none'
...@@ -98,7 +113,6 @@ ...@@ -98,7 +113,6 @@
}, },
// 获取手机号 // 获取手机号
async getUserPhone(e) { async getUserPhone(e) {
let res = await analysisMobileApi({ let res = await analysisMobileApi({
code: e.detail.code, code: e.detail.code,
iv: e.detail.iv, iv: e.detail.iv,
...@@ -108,26 +122,36 @@ ...@@ -108,26 +122,36 @@
if (res.code === 200 && res.result) { if (res.code === 200 && res.result) {
uni.setStorageSync('openid', this.result.openid); uni.setStorageSync('openid', this.result.openid);
let data = JSON.parse(res.result) let data = JSON.parse(res.result)
uni.setStorageSync('user_phone', data.purePhoneNumber); //uni.setStorageSync('user_phone', data.purePhoneNumber);
// this.$emit('loginEnd')
// this.$refs.authorization.close()
this.getUserInfo(data.purePhoneNumber);
}
},
// 查询用户用户
async getUserInfo(phone) {
let params = {
loginName: phone,
platformType: 'partner'
}
let res = await queryLoginPhoneApi(params)
if (res.code === 200 && res.result && res.result.token) {
uni.setStorageSync('token', res.result.token);
let userInfo = res.result.userInfo;
if (userInfo) {
uni.setStorageSync('platform_code',userInfo.platformCode)
uni.setStorageSync('user_phone', userInfo.phone);
uni.setStorageSync('user_name', userInfo.realname);
let img = userInfo.avatar ?
`${serverConfig.imageURL}${userInfo.avatar}` : ''
uni.setStorageSync('user_avatar', img)
}
this.$emit('loginEnd') this.$emit('loginEnd')
this.$refs.authorization.close() this.$refs.authorization.close()
}else{
wx.clearStorage()
} }
}, },
// 绑定用户
// async onbindingUserInfo(openId, phone) {
// let res = await bindingUserInfoApi({openId, phone})
// if(res.code === 200 && res.result) {
// uni.setStorageSync('openid', res.result.communityUser.openid);
// if(res.result.communityOwners && res.result.communityOwners.length) { // 业主
// this.$emit('loginEnd', true)
// } else if(res.result.employeeVos && res.result.employeeVos.comList.length) { // 维修员
// this.$emit('loginEnd', true)
// } else {
// this.$emit('loginEnd', false)
// }
// this.$refs.authorization.close()
// }
// },
changePolicy(e) { changePolicy(e) {
this.checked = e.detail.value.length === 1 this.checked = e.detail.value.length === 1
}, },
...@@ -146,65 +170,70 @@ ...@@ -146,65 +170,70 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.content-page { .content-page {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
position: relative; position: relative;
.img-box {
width: 144rpx; .img-box {
height: 144rpx; width: 144rpx;
border: 2rpx solid #E4E6E9; height: 144rpx;
border-radius: 50%; border: 2rpx solid #E4E6E9;
margin-top: 200rpx; border-radius: 50%;
} margin-top: 200rpx;
.text { }
font-size: 28rpx;
color: #3D3D3D;
line-height: 50rpx;
margin-top: 50rpx;
}
.login-btn {
width: 578rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
color: #FFFFFF;
background: #6799F1;
border-radius: 200rpx;
margin-top: 72rpx;
}
.refuse {
font-size: 28rpx;
color: #767676;
line-height: 33rpx;
margin-top: 34rpx;
}
.policy-fixed { .text {
position: fixed; font-size: 28rpx;
bottom: 160rpx; color: #3D3D3D;
left: 0; line-height: 50rpx;
right: 0; margin-top: 50rpx;
z-index: 11; }
.policy-box { .login-btn {
padding: 0 30rpx; width: 578rpx;
font-size: 14px; height: 80rpx;
vertical-align: middle; line-height: 80rpx;
font-size: 28rpx;
color: #FFFFFF;
background: #6799F1;
border-radius: 200rpx;
margin-top: 72rpx;
}
.text { .refuse {
color: #191A23; font-size: 28rpx;
vertical-align: middle; color: #767676;
} line-height: 33rpx;
.policy { margin-top: 34rpx;
color: #1677FF; }
.policy-fixed {
position: fixed;
bottom: 160rpx;
left: 0;
right: 0;
z-index: 11;
.policy-box {
padding: 0 30rpx;
font-size: 14px;
vertical-align: middle; vertical-align: middle;
.text {
color: #191A23;
vertical-align: middle;
}
.policy {
color: #1677FF;
vertical-align: middle;
}
} }
} }
} }
} </style>
</style> \ No newline at end of file
差异被折叠。
...@@ -2,62 +2,69 @@ import Request from '@/utils/luch-request/luch-request/index.js' ...@@ -2,62 +2,69 @@ import Request from '@/utils/luch-request/luch-request/index.js'
import serverConfig from './server_config.js' import serverConfig from './server_config.js'
const http = new Request() const http = new Request()
http.setConfig((config) => { /* config 为默认全局配置*/ http.setConfig((config) => {
config.baseURL = serverConfig.baseURL; /* config 为默认全局配置*/
config.header = { config.baseURL = serverConfig.baseURL;
'Content-Type': 'application/json;charset=UTF-8' config.header = {
} 'Content-Type': 'application/json;charset=UTF-8'
return config }
return config
}) })
//请求前拦截 //请求前拦截
let loginPopupNum = 0; let loginPopupNum = 0;
http.interceptors.request.use((config) => { // 可使用async await 做异步操作 http.interceptors.request.use((config) => { // 可使用async await 做异步操作
config.header = { config.header = {
...config.header, ...config.header,
} }
//获取存储的token //获取存储的token
// const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
// config.header['X-Token'] = token; const tenantId = uni.getStorageSync('platform_code');
// 根据custom参数中配置的是否需要loading if (token) {
if (config.custom.load) { config.header['X-Access-Token'] = token;
loginPopupNum ++ config.header['tenant-id'] = tenantId;
uni.showLoading({ }
title: '加载中...' // 根据custom参数中配置的是否需要loading
}); if (config.custom.load) {
} loginPopupNum++
return config uni.showLoading({
title: '加载中...'
});
}
return config
}, config => { // 可使用async await 做异步操作 }, config => { // 可使用async await 做异步操作
return Promise.reject(config) return Promise.reject(config)
}) })
// 请求后拦截器 // 请求后拦截器
http.interceptors.response.use((response) => { http.interceptors.response.use((response) => {
setTimeout(()=> { setTimeout(() => {
loginPopupNum -- loginPopupNum--
if(loginPopupNum <= 0) { if (loginPopupNum <= 0) {
uni.hideLoading(); uni.hideLoading();
} }
}, 30) }, 30)
if(Array.isArray(response.data) || response.data.success) { if (Array.isArray(response.data) || response.data.success) {
return response.data return response.data
} else { } else {
setTimeout(()=> { setTimeout(() => {
uni.showToast({ uni.showToast({
title: response.data.message, title: response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
}, 60) }, 60)
return Promise.reject(response) return Promise.reject(response)
} }
}, (response) => { }, (response) => {
setTimeout(()=> { setTimeout(() => {
loginPopupNum -- loginPopupNum--
if(loginPopupNum <= 0) { if (loginPopupNum <= 0) {
uni.hideLoading(); uni.hideLoading();
} }
}, 30) }, 30)
return Promise.reject(response) return Promise.reject(response)
}) })
export { http } export {
\ No newline at end of file http
}
\ No newline at end of file
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
"navigationBarTitleText": "选择商铺" "navigationBarTitleText": "选择商铺"
} }
}, },
{
"path": "pages/myShopsList/index",
"style": {
"navigationBarTitleText": "我的商铺"
}
},
{ {
"path": "pages/shopsDetails/index", "path": "pages/shopsDetails/index",
"style": { "style": {
......
...@@ -3,66 +3,97 @@ ...@@ -3,66 +3,97 @@
<view class="page"> <view class="page">
<view class="search"> <view class="search">
<uni-search-bar placeholder="请输入小区名" bgColor="#EEEEEE" @confirm="search" @cancel="cancel" /> <uni-search-bar placeholder="请输入小区名" bgColor="#EEEEEE" @confirm="search" @cancel="cancel" />
<view class="list"> <view class="list" v-if="dataList.length">
<view class="item" :class="{'active': item.communityCode === currentHouseCode}" @click="onChangeHouse(item)" v-for="item in houseList" :key="item.communityCode"> <view class="item" @click="onChangeHouse(item)" v-for="item in dataList" :key="item.communityCode">
{{item.communityName}} {{item.communityName}}
</view> </view>
</view> </view>
<no-data :show="dataList.length === 0" text="暂无数据"></no-data>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { getCompanyListApi } from '@/config/api.js' import {
let houseAllList = [] getCompanyListApi
} from '@/config/api.js'
import noData from '@/components/no-data/no-data'
export default { export default {
components: {
noData
},
data() { data() {
return { return {
houseList: [], page: {
currentHouseCode: '' pageSize: 10,
pageNo: 1
},
dataList: [],
isFinish: false
}
},
computed: {
hideAdd() {
return this.dataList.some(item => item.auditStatus !== 'auditPass')
} }
}, },
methods: { methods: {
async getList() { async getList(flag) {
let {result} = await getCompanyListApi() let {
houseAllList = result result
this.houseList = [...result] } = await getCompanyListApi(this.page)
let data = result.records;
if (flag) {
uni.stopPullDownRefresh();
this.dataList = [].concat(data)
} else {
this.dataList = this.dataList.concat(data)
}
if (data.length < 10) {
this.isFinish = true
} else {
this.page.pageNo += 1
}
}, },
onChangeHouse(item) { onChangeHouse(item) {
uni.navigateTo({ if (item.communityCode) {
url: '/pages/shopsList/index' uni.navigateTo({
}); url: '/pages/shopsList/index?code=' + item.communityCode
// getApp().globalData.registerInfo = {} });
// // if(item.communityCode === this.currentHouseCode) return }
// uni.setStorageSync('user_type', '1')
// uni.setStorageSync('property_code', item.platformCode)
// uni.setStorageSync('property_name', item.platformName)
// uni.setStorageSync('platform_code', item.communityCode)
// uni.setStorageSync('platform_name', item.communityName)
// uni.reLaunch({
// url: '/pages/home/index'
//})
}, },
search(value) { search(value) {
this.houseList = houseAllList.filter(item=> { console.log(value)
return item.communityName.includes(value.value) if (value.value) {
}) this.page.communityName = value.value.toString();
this.dataList = [];
this.page.pageNo = 1;
this.getList();
}
}, },
cancel() { cancel() {
this.houseList = [...houseAllList] this.dataList = [];
this.page.communityName = '';
this.page.pageNo = 1;
this.getList();
} }
}, },
onLoad() { onLoad() {
this.currentHouseCode = uni.getStorageSync('platform_code') || '' const token = uni.getStorageSync('token');
let type = uni.getStorageSync('user_type') if (token) {
if(type === '2') {
let data = uni.getStorageSync('user_house_list')
houseAllList = JSON.parse(data)
this.houseList = [...houseAllList]
} else {
this.getList() this.getList()
} }
},
onPullDownRefresh() {
this.page.pageNo = 1
this.getList(true)
},
onReachBottom() {
if (this.isFinish) return
this.getList()
} }
} }
</script> </script>
...@@ -75,13 +106,15 @@ ...@@ -75,13 +106,15 @@
.search { .search {
.list { .list {
padding:20rpx 30rpx; padding: 20rpx 30rpx;
.item { .item {
font-size: 28rpx; font-size: 28rpx;
color: #373737; color: #373737;
height: 84rpx; height: 84rpx;
line-height: 84rpx; line-height: 84rpx;
border-bottom: 1px solid #F8F6F9; border-bottom: 1px solid #F8F6F9;
&.active { &.active {
color: #6A59F2; color: #6A59F2;
} }
......
...@@ -5,7 +5,12 @@ ...@@ -5,7 +5,12 @@
<view class="nav-top"> <view class="nav-top">
<view class="title"> <view class="title">
<view class="icons"> <view class="icons">
<uni-icons type="person" size="20px" color="#666666"></uni-icons> <view class="box">
<image :src="userAvatar" class="icon" v-if="userAvatar"></image>
<uni-icons type="person" size="20px" color="#666666" v-else
@click="toLogin"></uni-icons>
</view>
<view class="name" v-if="userPhone">{{userPhone}}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -113,6 +118,7 @@ ...@@ -113,6 +118,7 @@
</view> </view>
</view> </view>
</view> </view>
<authorization-modal ref="authorization" @loginEnd="onLoginEnd" @refuse="onRefuse" />
</view> </view>
</template> </template>
...@@ -143,8 +149,12 @@ ...@@ -143,8 +149,12 @@
}, },
data() { data() {
return { return {
statusBarHeight: 24, isLogin: false,
userName: '',
userAvatar: '',
userPhone: '',
statusBarHeight: 24,
houseInfo: {}, // 当前小区信息 houseInfo: {}, // 当前小区信息
bannerList: [], bannerList: [],
chartData: {}, chartData: {},
...@@ -230,6 +240,12 @@ ...@@ -230,6 +240,12 @@
this.getServerData(); this.getServerData();
}, },
methods: { methods: {
toLogin() {
uni.hideTabBar()
this.$nextTick(() => {
this.$refs.authorization.onOpenLogin()
});
},
async getPropertyAdv() { async getPropertyAdv() {
let { let {
result result
...@@ -283,35 +299,43 @@ ...@@ -283,35 +299,43 @@
// }); // });
}, },
quickEntry(type) { quickEntry(type) {
if (type == 1) { if (this.isLogin) {
uni.navigateTo({ if (type == 1) {
url: '/pages/community/index' uni.navigateTo({
}); url: '/pages/community/index'
} else if (type == 2) { });
uni.navigateTo({ } else if (type == 2) {
url: '/pages/shopsList/index' uni.navigateTo({
}); url: '/pages/myShopsList/index'
} else if (type == 3) { });
uni.navigateTo({ } else if (type == 3) {
url: '/pages/myCommunityList/index', uni.navigateTo({
}); url: '/pages/myCommunityList/index',
} else if (type == 4) { });
uni.navigateTo({ } else if (type == 4) {
url: '/pages/reconciliationList/index' uni.navigateTo({
}); url: '/pages/reconciliationList/index'
} else if (type == 5) { });
uni.navigateTo({ } else if (type == 5) {
url: '/pages/settlementList/index' uni.navigateTo({
}); url: '/pages/settlementList/index'
} else if (type == 6) { });
uni.navigateTo({ } else if (type == 6) {
url: '/pages/withdrawalList/index' uni.navigateTo({
}); url: '/pages/withdrawalList/index'
});
}
} else {
uni.showToast({
icon: "none",
title: '请登录后在操作!'
})
wx.clearStorage()
} }
}, },
onLoginEnd() { onLoginEnd() {
uni.showTabBar() uni.showTabBar()
//this.getUserInfo() this.initData()
}, },
onRefuse() { onRefuse() {
uni.showTabBar() uni.showTabBar()
...@@ -325,9 +349,12 @@ ...@@ -325,9 +349,12 @@
}, },
initData() { initData() {
this.getPropertyAdv() this.getPropertyAdv()
let isLogin = uni.getStorageSync('openid') const token = uni.getStorageSync('token');
if (!!isLogin) { if (token) {
//this.getUserInfo() this.isLogin = true
//this.userName = uni.getStorageSync('user_name')
this.userAvatar = uni.getStorageSync('user_avatar')
this.userPhone = uni.getStorageSync('user_phone')
} }
} }
}, },
...@@ -368,20 +395,34 @@ ...@@ -368,20 +395,34 @@
display: flex; display: flex;
align-items: center; align-items: center;
.title {
font-size: 32rpx;
color: #1D1F1C;
font-weight: 700;
}
.icons { .icons {
width: 58rpx;
height: 58rpx; height: 58rpx;
background-color: #ffffff;
border-radius: 58rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
.box {
width: 58rpx;
height: 58rpx;
background-color: #ffffff;
border-radius: 58rpx;
display: flex;
align-items: center;
justify-content: center;
.icon {
width: 58rpx;
height: 58rpx;
border-radius: 58rpx;
}
}
.name {
font-size: 28rpx;
color: #1D1F1C;
margin-left: 14rpx;
}
} }
} }
......
...@@ -3,22 +3,22 @@ ...@@ -3,22 +3,22 @@
style="background-image: url('https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_me1_1692254734871.png');"> style="background-image: url('https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_me1_1692254734871.png');">
<view class="page"> <view class="page">
<view class="user"> <view class="user">
<template v-if="userAvatar"> <template v-if="isLogin && userAvatar">
<image :src="userAvatar" class="icon"></image> <image :src="userAvatar" class="icon" ></image>
</template> </template>
<view class="icon" v-else> <view class="icon" v-else>
<uni-icons type="person" size="50px" color="#6A59F2"></uni-icons> <uni-icons type="person" size="50px" color="#6A59F2"></uni-icons>
</view> </view>
<template v-if="userPhone"> <template v-if="isLogin">
<view class="name">林二</view> <view class="name" v-if="userName">{{userName}}</view>
<view class="phone">15245214563</view> <view class="phone" v-if="userPhone">{{userPhone}}</view>
<div class="information" @click="employeeEntry(1)">修改个人资料 ></div> <div class="information" @click="employeeEntry(1)">修改个人资料 ></div>
</template> </template>
<teleport v-else> <teleport v-else>
<view class="name" @click="toLogin" style="margin-bottom: 36rpx;">请登录</view> <view class="name" @click="toLogin" style="margin-bottom: 36rpx;">请登录</view>
</teleport> </teleport>
</view> </view>
<view class="LogOut" v-if="userPhone" @click="logout">退出登录</view> <view class="LogOut" v-if="isLogin" @click="logout">退出登录</view>
</view> </view>
...@@ -35,12 +35,10 @@ ...@@ -35,12 +35,10 @@
}, },
data() { data() {
return { return {
currentHouseVerify: false, isLogin: false,
userType: '0',
userName: '', userName: '',
userAvatar: '', userAvatar: '',
userPhone: '', userPhone: '',
isEmployee: false
} }
}, },
methods: { methods: {
...@@ -50,7 +48,7 @@ ...@@ -50,7 +48,7 @@
this.$refs.authorization.onOpenLogin() this.$refs.authorization.onOpenLogin()
}); });
}, },
logout(){ logout() {
let _this = this let _this = this
uni.showModal({ uni.showModal({
title: '警告', title: '警告',
...@@ -59,13 +57,13 @@ ...@@ -59,13 +57,13 @@
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
wx.clearStorage() wx.clearStorage()
_this.onLoginEnd()
} }
} }
}); });
}, },
quickEntry(type) { employeeEntry(type) {
let isLogin = uni.getStorageSync('openid') if (this.isLogin) {
if (!!isLogin) {
if (type == 1) { if (type == 1) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/myInformation/index', url: '/pages/myInformation/index',
...@@ -78,17 +76,6 @@ ...@@ -78,17 +76,6 @@
}); });
} }
}, },
employeeEntry(type) {
if (type == 1) {
uni.navigateTo({
url: '/pages/myInformation/index',
});
} else {
uni.navigateTo({
url: '/pages/repairList/index',
});
}
},
onLoginEnd() { onLoginEnd() {
uni.showTabBar() uni.showTabBar()
uni.reLaunch({ uni.reLaunch({
...@@ -98,19 +85,17 @@ ...@@ -98,19 +85,17 @@
onRefuse() { onRefuse() {
uni.showTabBar() uni.showTabBar()
}, },
onChangeEmployee(type) {
uni.setStorageSync('user_type', type)
uni.reLaunch({
url: '/pages/home/index'
})
}
}, },
onLoad() { onLoad() {
this.userType = uni.getStorageSync('user_type') const token = uni.getStorageSync('token');
this.userName = uni.getStorageSync('user_name') if (token) {
this.userAvatar = uni.getStorageSync('user_avatar') this.isLogin = true
this.userPhone = uni.getStorageSync('user_phone') this.userName = uni.getStorageSync('user_name')
this.isEmployee = !!uni.getStorageSync('employee_code') this.userAvatar = uni.getStorageSync('user_avatar')
this.userPhone = uni.getStorageSync('user_phone')
} else {
this.isLogin = false
}
}, },
onHide() { onHide() {
if (timer) clearTimeout(timer) if (timer) clearTimeout(timer)
......
<template>
<view class="container">
<view class="shops">
<view class="search">
<uni-search-bar placeholder="请输入商铺名" bgColor="#ffffff" radius="100" @confirm="search"
@cancel="cancel" />
</view>
<view class="list" v-if="dataList.length">
<view class="item" v-for="item in dataList" :key="item.id" @click="toDetails(item)">
<image mode="aspectFill" :src="imageURL+item.shopInfo.logoUrl" class="icon"></image>
<view class="con">
<view class="name">{{item.shopName}}</view>
<view class="tags">
<view :class="item.auditTatus === 'auditPass'?'tag purple':'tag gray'">
<template v-if="item.auditTatus === 'waitAudit'">待审核</template>
<template v-if="item.auditTatus === 'auditPass'">审核通过</template>
<template v-if="item.auditTatus === 'refuse'">审核拒绝</template>
</view>
<view class="tag red" v-if="item.freezingStatus === 'freeze'">冻结</view>
</view>
<view class="text">所属小区:{{item.communityName}}</view>
<view class="card">
<image mode="aspectFill" src="../../static/images/icon_licence.png" class="icon"></image>
{{item.creditCode}}
</view>
</view>
</view>
</view>
<no-data :show="dataList.length === 0" text="暂无数据"></no-data>
</view>
</view>
</template>
<script>
import serverConfig from '@/config/server_config.js';
import {
getMyShopList
} from '@/config/api.js'
import noData from '@/components/no-data/no-data'
export default {
components: {
noData
},
data() {
return {
page: {
column:'createTime',
order:'desc',
pageSize: 10,
pageNo: 1
},
dataList: [],
isFinish: false,
imageURL: '',
}
},
computed: {
hideAdd() {
return this.dataList.some(item => item.auditStatus !== 'auditPass')
}
},
methods: {
async getList(flag) {
let {
result
} = await getMyShopList(this.page)
let data = result.records;
if (flag) {
uni.stopPullDownRefresh();
this.dataList = [].concat(data)
} else {
this.dataList = this.dataList.concat(data)
}
if (data.length < 10) {
this.isFinish = true
} else {
this.page.pageNo += 1
}
},
search(value) {
console.log(value)
if (value.value) {
this.page.shopName = value.value.toString();
this.dataList = [];
this.page.pageNo = 1;
this.getList();
}
},
cancel() {
this.dataList = [];
this.page.shopName = '';
this.page.pageNo = 1;
this.getList();
},
toDetails(item) {
if (item.shopInfo.id) {
uni.navigateTo({
url: `/pages/shopsDetails/index?id=${item.shopInfo.id}`
});
}
},
},
onLoad(option) {
const token = uni.getStorageSync('token');
if (token) {
this.imageURL = `${serverConfig.imageURL}`
this.getList()
}
}
}
</script>
<style>
page {
background-color: #F8F6F9;
}
.shops .uni-searchbar {
padding: 0;
}
</style>
<style lang="scss" scoped>
.page {
padding: 30rpx 0 0;
}
.shops {
border-radius: 16rpx;
.search {
margin: 30rpx 30rpx 0;
}
.list {
background-color: #F8F6F9;
padding: 30rpx;
.item {
background-color: #ffffff;
border-radius: 16rpx;
display: flex;
padding: 30rpx;
margin-bottom: 30rpx;
box-shadow: 0 0 25rpx 0 rgba(81, 89, 234, 0.06);
position: relative;
&::after {
content: " ";
position: absolute;
top: 30rpx;
right: 30rpx;
width: 14rpx;
height: 14rpx;
border-radius: 50%;
z-index: 11;
}
&.noRead::after {
background-color: #F6C864;
;
}
.icon {
flex: none;
width: 176rpx;
height: 176rpx;
border-radius: 6rpx;
background: #eeeeee;
}
.con {
margin-left: 30rpx;
padding-right: 10rpx;
.name {
font-size: 32rpx;
color: #373737;
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
word-break: break-all;
/* 追加这一行代码 */
}
.tags{
display: flex;
margin: 6rpx 0;
.tag {
padding: 0 24rpx;
height: 36rpx;
line-height: 36rpx;
font-size: 24rpx;
text-align: center;
border-radius: 36rpx;
display: inline-block;
margin-right: 20rpx;
}
.purple {
color: #6A59F2;
background-color: #F5F4FF;
border: 1px solid #6A59F2;
}
.gray {
color: #B6B6BA;
background-color: #F8F8F8;
border: 1px solid #B6B6BA;
}
.red {
color: #f5222d;
background-color: #fff1f0;
border: 1px solid #f5222d;
}
}
.text {
font-size: 28rpx;
color: #9D9CA6;
margin: 6rpx 0 6rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-break: break-all;
}
.card {
font-size: 28rpx;
color: #9D9CA6;
height: 30rpx;
line-height: 30rpx;
display: flex;
.icon {
width: 35rpx;
height: 28rpx;
margin-right: 10rpx;
}
}
}
}
}
}
</style>
\ No newline at end of file
...@@ -6,110 +6,119 @@ ...@@ -6,110 +6,119 @@
<view class="content"> <view class="content">
<view class="item"> <view class="item">
<view class="name">所属小区</view> <view class="name">所属小区</view>
<view class="detail">汉江之星小区</view> <view class="detail">{{details.platformName}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="name">关联房屋</view> <view class="name">关联房屋</view>
<view class="detail">B栋201</view> <view class="detail">{{details.roomName}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="name">商铺名称</view> <view class="name">商铺名称</view>
<view class="detail">寿康永乐</view> <view class="detail">{{details.shopName}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="name">营业执照编码</view> <view class="name">营业执照编码</view>
<view class="detail">BSHEHSJE12352421</view> <view class="detail">{{details.creditCode}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="name">法人</view> <view class="name">法人</view>
<view class="detail">张三</view> <view class="detail">{{details.legalName}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="name">联系人</view> <view class="name">联系人</view>
<view class="detail">张三</view> <view class="detail">{{details.contactName}}</view>
</view> </view>
<view class="item"> <view class="item">
<view class="name">联系人电话</view> <view class="name">联系人电话</view>
<view class="detail">张三 1301234****</view> <view class="detail">{{details.contactPhone}}</view>
</view> </view>
<view class="item text"> <view class="item">
<view class="name">注册地址</view>
<view class="detail">{{details.provinceName + details.cityName + details.countyName}}</view>
</view>
<view class="item">
<view class="name">详细地址</view> <view class="name">详细地址</view>
<view class="detail">湖北省十堰市郧阳区汉江之星 小区B栋201</view> <view class="detail">{{details.addressInfo}}</view>
</view> </view>
<view class="item text" v-if="imageList.length"> <view class="item text">
<view class="name">商铺图</view> <view class="name">商铺图</view>
<view class="image"> <view class="image">
<image v-for="(url, index) in imageList" :key="index" :src="url" class="icon"></image> <image :src="imageURL+details.logoUrl" class="icon"></image>
</view> </view>
</view> </view>
<view class="item text"> <view class="item text">
<view class="name">介绍</view> <view class="name">介绍</view>
<view class="detail">诚信经营,提供“新鲜、超值 休闲、时尚”的商品和服务</view> <view class="detail">{{details.shopContent}}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="form-submit" @click="onSubmit">确认绑定</view> <view class="form-submit" @click="onSubmit" v-if="communityCode">确认绑定</view>
<view class="form-submit" @click="toCode">商铺收款二维码</view> <view class="form-submit" @click="toCode" v-else>商铺收款二维码</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import serverConfig from '@/config/server_config.js';
import { import {
getCommunityRepairDetailApi, getShopDetails,
editCommunityRepairApi partnersShopAdd
} from '@/config/api.js' } from '@/config/api.js'
export default { export default {
data() { data() {
return { return {
rateValue: 5, communityCode: '',
evaluation: '', details: {},
formModel: { imageURL: '',
},
imageList: ['https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_1690786506694.png'] imageList: ['https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_1690786506694.png']
} }
}, },
methods: { methods: {
async getDetail(id) { async getDetail(id) {
// let { let {
// result result
// } = await getCommunityRepairDetailApi({ } = await getShopDetails({
// id id
// }) })
// this.formModel = { this.details = {
// ...result ...result
// } }
// this.imageList = result.repairPhoto ? result.repairPhoto.split(',') : []
}, },
async onSubmit() { async onSubmit() {
// await editCommunityRepairApi({ if (this.details.shopCode && this.communityCode) {
// id: this.formModel.id, await partnersShopAdd({
// repairEvaluate: this.evaluation, shopCode: this.details.shopCode,
// evaluateCount: this.rateValue communityCode: this.communityCode
// }) })
// uni.$emit('change-maintenance'); setTimeout(() => {
// setTimeout(() => { uni.showToast({
// uni.showToast({ title: '绑定成功,待待审核!',
// title: '评价成功!', icon: 'none'
// icon: 'none' });
// }); setTimeout(() => {
// setTimeout(() => { uni.navigateBack({
// uni.navigateBack({ delta: 2
// delta: 2 });
// }); }, 1500)
// }, 1500) }, 30)
// }, 30) }
}, },
toCode(){ toCode() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/shopsCode/index' url: '/pages/shopsCode/index'
}); });
} }
}, },
onLoad(option) { onLoad(option) {
this.getDetail(option.id) const token = uni.getStorageSync('token');
if (token && option.id) {
if(option.code){
this.communityCode = option.code;
}
this.imageURL = `${serverConfig.imageURL}`
this.getDetail(option.id)
}
} }
} }
</script> </script>
......
...@@ -5,74 +5,104 @@ ...@@ -5,74 +5,104 @@
<uni-search-bar placeholder="请输入商铺名" bgColor="#ffffff" radius="100" @confirm="search" <uni-search-bar placeholder="请输入商铺名" bgColor="#ffffff" radius="100" @confirm="search"
@cancel="cancel" /> @cancel="cancel" />
</view> </view>
<view class="list" v-if="allList.length"> <view class="list" v-if="dataList.length">
<view class="item" :class="{'noRead' : item.readStatus === '2'}" v-for="item in allList" :key="item.id" <view class="item" v-for="item in dataList" :key="item.id"
@click="toDetails(1)"> @click="toDetails(item)">
<image mode="aspectFill" :src="item.image" class="icon"></image> <image mode="aspectFill" :src="imageURL+item.shopInfo.logoUrl" class="icon"></image>
<view class="con"> <view class="con">
<view class="name">{{item.title}}</view> <view class="name">{{item.shopName}}</view>
<view class="text">{{item.text}}</view> <view class="text">{{item.shopInfo.shopContent}}</view>
<view class="card"> <view class="card">
<image mode="aspectFill" src="../../static/images/icon_licence.png" class="icon"></image> <image mode="aspectFill" src="../../static/images/icon_licence.png" class="icon"></image>
{{item.card}} {{item.shopInfo.creditCode}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<no-data :show="allList.length === 0" text="暂无数据"></no-data> <no-data :show="dataList.length === 0" text="暂无数据"></no-data>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import serverConfig from '@/config/server_config.js';
import { import {
queryNoticePageApi getShopList
} from '@/config/api.js' } from '@/config/api.js'
import serverConfig from '@/config/server_config.js';
import noData from '@/components/no-data/no-data' import noData from '@/components/no-data/no-data'
export default { export default {
components: { components: {
noData noData
}, },
data() { data() {
return { return {
activeStatus: '', page: {
allPageNo: 1, column:'createTime',
yesPageNo: 1, order:'desc',
notPageNo: 1, pageSize: 10,
allList: [{ pageNo: 1
id: 1, },
image: 'https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_1690786506694.png', dataList: [],
title: '车之家(北京路店)', isFinish: false,
text: '车辆介绍与洽谈、车辆演示、车辆选购、开票收款、交车和办理临牌', imageURL: '',
card: '91510600MA6B00XP2F', communityCode:''
},{ }
id: 2, },
image: 'https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_1690786506694.png', computed: {
title: '鲜果乐园(北京路店)', hideAdd() {
text: '果真好吃,回味甘甜,一口接着一口根本停不下来。', return this.dataList.some(item => item.auditStatus !== 'auditPass')
card: '91510600MA6B00XP2F',
},{
id: 3,
image: 'https://life.cloud.hjxbc.cn/sys/common/static/scott/pic/bg_1690786506694.png',
title: '寿康永乐(北京路店)',
text: '诚信经营,提供“新鲜、超值休闲、时尚”的商品和服务',
card: '91510600MA6B00XP2F',
}],
} }
}, },
computed: {},
methods: { methods: {
async getList() { async getList(flag) {
let {
result
} = await getShopList(this.page)
let data = result.records;
if (flag) {
uni.stopPullDownRefresh();
this.dataList = [].concat(data)
} else {
this.dataList = this.dataList.concat(data)
}
if (data.length < 10) {
this.isFinish = true
} else {
this.page.pageNo += 1
}
}, },
toDetails(id) { search(value) {
uni.navigateTo({ console.log(value)
url: `/pages/shopsDetails/index?id=${id}` if (value.value) {
}); this.page.shopName = value.value.toString();
this.dataList = [];
this.page.pageNo = 1;
this.getList();
}
},
cancel() {
this.dataList = [];
this.page.shopName = '';
this.page.pageNo = 1;
this.getList();
},
toDetails(item) {
if (item.shopInfo.id) {
uni.navigateTo({
url: `/pages/shopsDetails/index?id=${item.shopInfo.id}&code=${this.communityCode}`
});
}
}, },
}, },
onShow() { onLoad(option) {
//this.getList() const token = uni.getStorageSync('token');
if (token && option.code) {
this.imageURL = `${serverConfig.imageURL}`
this.page.communityCode = option.code;
this.communityCode = option.code;
this.getList()
}
} }
} }
</script> </script>
...@@ -132,6 +162,7 @@ ...@@ -132,6 +162,7 @@
width: 176rpx; width: 176rpx;
height: 176rpx; height: 176rpx;
border-radius: 6rpx; border-radius: 6rpx;
background: #eeeeee;
} }
.con { .con {
...@@ -170,6 +201,7 @@ ...@@ -170,6 +201,7 @@
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;
display: flex; display: flex;
.icon { .icon {
width: 35rpx; width: 35rpx;
height: 28rpx; height: 28rpx;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论