|
@@ -1,8 +1,9 @@
|
|
// pages/buy/buy.js
|
|
// pages/buy/buy.js
|
|
import { goodsList } from '../../api/index'
|
|
import { goodsList } from '../../api/index'
|
|
import { submitOrder } from '../../api/pay'
|
|
import { submitOrder } from '../../api/pay'
|
|
-import { getAccountNmber } from '../../api/appointment'
|
|
|
|
|
|
+import { getAccountNmber, appointmentList } from '../../api/appointment'
|
|
import { documentList } from "../../api/document"
|
|
import { documentList } from "../../api/document"
|
|
|
|
+
|
|
const app = getApp()
|
|
const app = getApp()
|
|
|
|
|
|
Page({
|
|
Page({
|
|
@@ -22,12 +23,16 @@ Page({
|
|
from: '' // 从哪个页面进入的页面
|
|
from: '' // 从哪个页面进入的页面
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ onShow () {
|
|
|
|
+ this.getGoodsList()
|
|
|
|
+ this.getAccountNmberFn()
|
|
|
|
+ },
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
- this.getGoodsList()
|
|
|
|
- this.getAccountNmberFn()
|
|
|
|
|
|
+
|
|
this.setData({
|
|
this.setData({
|
|
from: options.from,
|
|
from: options.from,
|
|
appusername: app.globalData.userInfo.userName.length > 8 ? app.globalData.userInfo.userName.substring(0,4) : app.globalData.userInfo.userName,
|
|
appusername: app.globalData.userInfo.userName.length > 8 ? app.globalData.userInfo.userName.substring(0,4) : app.globalData.userInfo.userName,
|
|
@@ -60,7 +65,6 @@ Page({
|
|
recommendIndx = index
|
|
recommendIndx = index
|
|
return item.isRecommend == true
|
|
return item.isRecommend == true
|
|
})
|
|
})
|
|
- console.log(recommendItem,recommendIndx,'recommendItem');
|
|
|
|
if (recommendItem) {
|
|
if (recommendItem) {
|
|
this.setData({
|
|
this.setData({
|
|
activeIndex: recommendIndx,
|
|
activeIndex: recommendIndx,
|
|
@@ -156,12 +160,48 @@ Page({
|
|
if (that.data.from == 'appointment') {
|
|
if (that.data.from == 'appointment') {
|
|
wx.navigateBack()
|
|
wx.navigateBack()
|
|
} else {
|
|
} else {
|
|
- that.getDocumentList()
|
|
|
|
|
|
+ that.hasAppointmentFn()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 获取用户预约信息
|
|
|
|
+ hasAppointmentFn (flag = true) {
|
|
|
|
+ var that = this
|
|
|
|
+ wx.showNavigationBarLoading()
|
|
|
|
+ appointmentList({
|
|
|
|
+ status: 1,
|
|
|
|
+ currentPage: 1
|
|
|
|
+ }).then(res => {
|
|
|
|
+ wx.hideNavigationBarLoading()
|
|
|
|
+ if (res.data.vos.length !== 0) {
|
|
|
|
+ app.globalData.hasAppointment = true
|
|
|
|
+ that.navigateAppointment()
|
|
|
|
+ } else {
|
|
|
|
+ app.globalData.hasAppointment = false
|
|
|
|
+ that.getDocumentList()
|
|
|
|
+ }
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ wx.hideNavigationBarLoading()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ navigateAppointment () {
|
|
|
|
+ wx.showModal({
|
|
|
|
+ content: '您预约的健康筛查还未体验,请先体验',
|
|
|
|
+ cancelColor: '#666',
|
|
|
|
+ cancelText: '取消',
|
|
|
|
+ confirmText: '我的预约',
|
|
|
|
+ confirmColor: '#333',
|
|
|
|
+ success (res) {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '/pages/myAppointment/myAppointment'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 获取用户档案信息
|
|
// 获取用户档案信息
|
|
getDocumentList () {
|
|
getDocumentList () {
|
|
wx.showLoading({
|
|
wx.showLoading({
|