Commit 2883c97e by 潘琦

完成代码接口联调

parent dfc1d76d
...@@ -11,7 +11,12 @@ const user = { ...@@ -11,7 +11,12 @@ const user = {
code: getStore({ code: getStore({
name: 'code' name: 'code'
}) || '', }) || '',
authId: '', authId: getStore({
name: 'auth_id'
}) || '',
accountId: getStore({
name: 'account_id'
}) || '',
userInfo: {} userInfo: {}
}, },
actions: { actions: {
...@@ -26,6 +31,9 @@ const user = { ...@@ -26,6 +31,9 @@ const user = {
}, },
setAuthId ({ commit }, param) { setAuthId ({ commit }, param) {
commit('SET_AUTHID', param) commit('SET_AUTHID', param)
},
setAccountId ({ commit }, param) {
commit('SET_ACCOUNTID', param)
} }
}, },
mutations: { mutations: {
...@@ -57,11 +65,19 @@ const user = { ...@@ -57,11 +65,19 @@ const user = {
SET_AUTHID: (state, authId) => { SET_AUTHID: (state, authId) => {
state.authId = authId state.authId = authId
setStore({ setStore({
name: 'code', name: 'auth_id',
content: state.authId, content: state.authId,
type: 'session' type: 'session'
}) })
}, },
SET_ACCOUNTID: (state, accountId) => {
state.accountId = accountId
setStore({
name: 'account_id',
content: state.accountId,
type: 'session'
})
},
SET_USERIFNO: (state, userInfo) => { SET_USERIFNO: (state, userInfo) => {
state.userInfo = userInfo state.userInfo = userInfo
} }
......
...@@ -140,8 +140,8 @@ export default { ...@@ -140,8 +140,8 @@ export default {
name: 'member', name: 'member',
data () { data () {
return { return {
memberId: this.$route.query.id ? parseInt(this.$route.query.id) : null, memberId: this.$route.query.userId ? parseInt(this.$route.query.userId) : null,
userId: this.$route.query.userId ? parseInt(this.$route.query.userId) : null, userId: this.$route.query.id ? parseInt(this.$route.query.id) : null,
pageType: this.$route.query.type ? parseInt(this.$route.query.type) : null, // 1=子女 2=配偶 3=父母 pageType: this.$route.query.type ? parseInt(this.$route.query.type) : null, // 1=子女 2=配偶 3=父母
picture: _iconBoy, picture: _iconBoy,
userData: { userData: {
...@@ -404,6 +404,7 @@ export default { ...@@ -404,6 +404,7 @@ export default {
position: 'center', position: 'center',
duration: 3000 duration: 3000
}) })
this.$router.back(-1)
} else { } else {
this.$toast({ this.$toast({
message: '删除失败', message: '删除失败',
......
...@@ -61,6 +61,7 @@ export default { ...@@ -61,6 +61,7 @@ export default {
return { return {
userId: parseInt(this.$route.query.userId), userId: parseInt(this.$route.query.userId),
mainData: { // 户主信息 mainData: { // 户主信息
id: '',
name: '', name: '',
picture: _iconMan picture: _iconMan
}, },
...@@ -97,6 +98,7 @@ export default { ...@@ -97,6 +98,7 @@ export default {
} }
res.data.forEach(item => { res.data.forEach(item => {
if (item.masterMark === 1) { if (item.masterMark === 1) {
that.mainData.id = item.userId
that.mainData.name = item.name that.mainData.name = item.name
that.mainData.picture = item.sex === 1 ? _iconBoy : item.sex === 2 ? _iconGirl : _iconGirl that.mainData.picture = item.sex === 1 ? _iconBoy : item.sex === 2 ? _iconGirl : _iconGirl
} else { } else {
...@@ -143,7 +145,7 @@ export default { ...@@ -143,7 +145,7 @@ export default {
this.$router.push({ this.$router.push({
path: '/member/edit', path: '/member/edit',
query: { query: {
userId: this.userId, userId: this.mainData.id,
type: _type, type: _type,
id: _id id: _id
} }
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<div class="list"> <div class="list">
<div class="list-head"> <div class="list-head">
<span class="title"><i class="glyphicon glyphicon-map-marker"></i> {{orgdata.orgName !== '' ? orgdata.orgName: '附近社区暂无电子健康券'}}</span> <span class="title"><i class="glyphicon glyphicon-map-marker"></i> {{orgdata.orgName !== '' ? orgdata.orgName: '附近社区暂无电子健康券'}}</span>
<span class="more" @click="goToOrgList">切换社区 <i class="glyphicon glyphicon-menu-right"></i></span> <span class="more" v-if="!queryAccountId" @click="goToOrgList">切换社区 <i class="glyphicon glyphicon-menu-right"></i></span>
<span class="more" v-if="queryAccountId" @click="goToHome">我的福利 <i class="glyphicon glyphicon-menu-right"></i></span>
</div> </div>
<div class="list-body"> <div class="list-body">
<div class="line"></div> <div class="line"></div>
...@@ -89,6 +90,10 @@ import { getVoucherByOrgId } from '@/api/make/make' ...@@ -89,6 +90,10 @@ import { getVoucherByOrgId } from '@/api/make/make'
import { getOrgListByPosition } from '@/api/sjkgbasic/sjkgbasic' import { getOrgListByPosition } from '@/api/sjkgbasic/sjkgbasic'
import CouponItem from '@/components/couponItem' import CouponItem from '@/components/couponItem'
import _defaultImg from '../../assets/images/org-default-picture.png' import _defaultImg from '../../assets/images/org-default-picture.png'
import store from '@/store'
import { wxpermission } from '@/wxpermission'
const wx = require('weixin-js-sdk')
export default { export default {
name: 'recommend', name: 'recommend',
data () { data () {
...@@ -97,13 +102,15 @@ export default { ...@@ -97,13 +102,15 @@ export default {
tipsVisible: false, tipsVisible: false,
animateClass: 'off', // 健康券列标模块动画样式 animateClass: 'off', // 健康券列标模块动画样式
data: null, data: null,
orgId: 2398, queryOrgId: this.$route.query.orgId ? this.$route.query.orgId : null,
queryOrgName: this.$route.query.orgName ? this.$route.query.orgName : '',
queryAccountId: this.$route.query.accountId ? this.$route.query.accountId : '',
orglist: [], orglist: [],
placeholder: true, // 搜索框提示占位符显示状态 placeholder: true, // 搜索框提示占位符显示状态
searchOrgName: '', // 机构名称手动搜索 searchOrgName: '', // 机构名称手动搜索
searchCurPage: 0, // 机构列表页数 searchCurPage: 0, // 机构列表页数
latitude: '28.22778', latitude: '',
longitude: '112.93886', longitude: '',
size: 10, size: 10,
loadMoreState: true, // 加载更多状态 loadMoreState: true, // 加载更多状态
enterSearchState: false, // 回车搜索状态 enterSearchState: false, // 回车搜索状态
...@@ -130,53 +137,74 @@ export default { ...@@ -130,53 +137,74 @@ export default {
}, },
methods: { methods: {
getOrgListFn () { getOrgListFn () {
if (!this.latitude || !this.longitude || this.latitude === '' || this.longitude === '') { this.$Indicator.open()
this.$toast({ console.log('getLocation success')
message: '未获取到当前位置信息!', let that = this
position: 'center', wxpermission(() => {
duration: 3000 wx && wx.getLocation({
}) success: function (res) {
return false console.log('getLocation success')
} that.latitude = res.latitude // 纬度,浮点数,范围为90 ~ -90
that.longitude = res.longitude // 经度,浮点数,范围为180 ~ -180。
let params = { let params = {
current: this.searchCurPage, current: that.searchCurPage,
latitude: this.latitude, latitude: that.latitude,
longitude: this.longitude, longitude: that.longitude,
size: this.size size: that.size
} }
if (this.searchOrgName !== '') { if (that.searchOrgName && that.searchOrgName !== '') {
params.key = this.searchOrgName params.key = that.searchOrgName
} }
this.$Indicator.open()
getOrgListByPosition(params).then(res => { getOrgListByPosition(params).then(res => {
this.$Indicator.close() that.$Indicator.close()
if (res.code === 0 && res.data.records.length > 0) { if (res.code === 0 && res.data.records.length > 0) {
this.orglist = this.orglist.concat(res.data.records) that.orglist = that.orglist.concat(res.data.records)
this.loadMoreState = true that.loadMoreState = true
// 获取第一次页面加载后附近第一家社区机构电子健康券 // 获取第一次页面加载后附近第一家社区机构电子健康券
if (this.firstinit) { if (that.firstinit) {
this.selectedOrgVoucher(this.orglist[0]) that.selectedOrgVoucher(that.orglist[0])
this.firstinit = false that.firstinit = false
} }
} else { } else {
this.loadMoreState = false that.loadMoreState = false
this.searchCurPage = this.searchCurPage - 1 that.searchCurPage = that.searchCurPage - 1
// this.tipsVisible = true // this.tipsVisible = true
} }
}).catch((error) => { }).catch((error) => {
this.$Indicator.close() that.$Indicator.close()
this.$toast({ that.$toast({
message: error.message, message: error.message,
position: 'center', position: 'center',
duration: 3000 duration: 3000
}) })
}) })
}, },
fail: function () {
that.$Indicator.close()
that.$toast({
message: '位置获取失败,请打开定位后再重新尝试!',
position: 'center',
duration: 3000
})
}
})
})
},
loadMore () { loadMore () {
if (!this.queryAccountId) {
if (this.loadMoreState) { if (this.loadMoreState) {
this.searchCurPage = this.searchCurPage + 1 this.searchCurPage = this.searchCurPage + 1
this.getOrgListFn() this.getOrgListFn()
} }
} else {
store.dispatch('setAccountId', this.queryAccountId)
let org = {
id: this.queryOrgId,
orgname: this.queryOrgName
}
this.selectedOrgVoucher(org)
}
}, },
changesearch () { changesearch () {
console.log('change') console.log('change')
...@@ -243,6 +271,11 @@ export default { ...@@ -243,6 +271,11 @@ export default {
// }) // })
this.popupVisible = true this.popupVisible = true
}, },
goToHome () {
this.$router.push({
path: '/'
})
},
handleRegister (type) { // 进入成员注册领券页 type=1本人 type=2配偶 handleRegister (type) { // 进入成员注册领券页 type=1本人 type=2配偶
if (type === 1) { if (type === 1) {
this.$router.push({ // 福利券领取(实名认证) this.$router.push({ // 福利券领取(实名认证)
...@@ -427,7 +460,7 @@ export default { ...@@ -427,7 +460,7 @@ export default {
margin: 0 1em; margin: 0 1em;
} }
.orgListPage .content { .orgListPage .content {
padding-top: 17%; padding-top: 15%;
} }
.orgListPage ul > li { .orgListPage ul > li {
background-color: #fff; background-color: #fff;
......
...@@ -218,9 +218,10 @@ export default { ...@@ -218,9 +218,10 @@ export default {
padding: 0 0.5em; padding: 0 0.5em;
margin: 0 0.5em; margin: 0 0.5em;
color: #80848f; color: #80848f;
max-width: 5em; max-width: 7em;
height: 2em; height: 2em;
font-size: 1em; font-size: 1em;
flex:none;
} }
.tab-container .mint-navbar .mint-tab-item.is-selected { .tab-container .mint-navbar .mint-tab-item.is-selected {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
</div> </div>
</div> </div>
<div class="title">{{voucherData.deptName}}</div> <div class="title">{{voucherData.deptName}}</div>
<div class="tool"> <!-- <div class="tool">
<img src="../../assets/images/icon-qr-code.png" class="full-width"/> <img src="../../assets/images/icon-qr-code.png" class="full-width"/>
</div> </div> -->
</div> </div>
<div class="body"> <div class="body">
<div class="big-title">{{voucherData.cost}}<span class="unit"></span></div> <div class="big-title">{{voucherData.cost}}<span class="unit"></span></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment