Commit 2883c97e by 潘琦

完成代码接口联调

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