2023-11-17 09:51:35 +08:00

73 lines
1.8 KiB
JavaScript

import{recommendPrice} from "../../api/consult.js"
const app = getApp()
import {throttle} from "../../utils/util"
Component({
behaviors: [],
externalClasses: ['consultbox'],
// 属性定义(详情参见下文)
properties: {
myProperty: { // 属性名
type: String,
value: ''
}
},
data: {
price:null,
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static'
}, // 私有数据,可用于模板渲染
lifetimes: {
// 生命周期函数,可以为函数,或一个在 methods 段中定义的方法名
attached: function () { },
moved: function () { },
detached: function () { },
},
// 生命周期函数,可以为函数,或一个在 methods 段中定义的方法名
attached: function () { }, // 此处 attached 的声明会被 lifetimes 字段中的声明覆盖
ready: function() { },
pageLifetimes: {
// 组件所在页面的生命周期函数
show() {
this.getPrice();
this.setData({
img_host:app.hostConfig().imghost
})
},
hide: function () { },
resize: function () { },
},
methods: {
goFree:throttle(function(){
app.method.navigateTo({
url: '/pages/expertConsult/expertConsult?type=free',
})
}),
goQuick:throttle(function(){
app.method.navigateTo({
url: '/pages/quickConsult/quickConsult'
})
}),
goExpert:throttle(function(){
app.method.navigateTo({
url: '/pages/expertConsult/expertConsult'
})
}),
goBuyMedince:throttle(function(){
app.method.navigateTo({
url: '/pages/quickConsult/quickConsult?inquiry_type=4'
})
}),
getPrice(){
recommendPrice().then(data=>{
this.setData({
price:data
})
})
}
}
})