- Fix hospital/service/caregiver images blank by prepending baseUrl for relative paths
- Add icon name mapping and resolveIcon() for service icon fallback
- Fix login phone field: res.phone -> res.data.phoneNumber
- Fix pagination stuck at page 1 in mechanism.js and qianbao.js
- Fix response parsing to handle both {code:200} and {erro:0} formats
- Replace raw wx.request calls with unified request() utility (6+ instances)
- Fix hardcoded phone number exposure in orderdetail.js
- Fix broken privacy URL (http: -> https://)
- Fix expired date range in goddess.wxml (2025 -> 2030)
- Remove duplicate refund box in orderdetail.wxml
- Fix service icon fallback ternary logic
- Add proper error handling replacing empty .catch() blocks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
98 lines
2.4 KiB
JavaScript
98 lines
2.4 KiB
JavaScript
//获取应用实例
|
|
var app = getApp();
|
|
const { request } = require('../../utils/request')
|
|
|
|
Page({
|
|
data: {
|
|
option1: [{ text: '全部医院', value: 0 }],
|
|
value1: 0,
|
|
version_number: '1.0',
|
|
height: '',
|
|
url: app.globalData.url,
|
|
itemView: [],
|
|
firstLoad: true
|
|
},
|
|
onChange(e) {
|
|
this.setData({ timeData: e.detail });
|
|
},
|
|
|
|
onShow: function () {
|
|
if (this.data.firstLoad) {
|
|
this.setData({ firstLoad: false })
|
|
this.getHospitals()
|
|
this.getServiceTypes()
|
|
}
|
|
},
|
|
|
|
// 加载医院列表(用于下拉选择)
|
|
getHospitals: function () {
|
|
var that = this;
|
|
request({
|
|
url: '/system/hospital/list',
|
|
method: 'GET',
|
|
loading: false
|
|
}).then(res => {
|
|
var hospitals = res.rows || res.data || [];
|
|
var options = [{ text: '全部医院', value: 0 }];
|
|
hospitals.forEach(function (h, i) {
|
|
options.push({
|
|
text: h.hospitalname,
|
|
value: i + 1
|
|
})
|
|
})
|
|
that.setData({ option1: options, hospitalData: hospitals })
|
|
}).catch(function() {
|
|
that.setData({ option1: [{ text: '加载失败', value: 0 }] })
|
|
})
|
|
},
|
|
|
|
// 加载服务类型
|
|
getServiceTypes: function () {
|
|
var that = this;
|
|
request({
|
|
url: '/system/serviceType/enabled',
|
|
method: 'GET',
|
|
data: { category: '2' },
|
|
loading: false
|
|
}).then(res => {
|
|
var services = res.data || [];
|
|
if (services.length) {
|
|
var mapped = services.map(function (s) {
|
|
return {
|
|
icon: s.icon || s.name,
|
|
title: s.name,
|
|
price: s.price,
|
|
describe: s.description || '',
|
|
ordertype: s.typeCode
|
|
}
|
|
})
|
|
that.setData({ itemView: mapped })
|
|
}
|
|
}).catch(function() {
|
|
wx.showToast({ title: '加载服务失败', icon: 'none' })
|
|
})
|
|
},
|
|
|
|
// 跳转详情
|
|
details(e) {
|
|
if (e.currentTarget.dataset.item != 0) {
|
|
let item = JSON.stringify(e.currentTarget.dataset.item);
|
|
wx.navigateTo({
|
|
url: "/pages/peizhen/peizhendetail?item=" + item,
|
|
});
|
|
}
|
|
},
|
|
back(e){
|
|
wx.navigateBack()
|
|
},
|
|
onLoad() {
|
|
var statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
|
|
this.setData({
|
|
statusBarHeight: statusBarHeight,
|
|
height: 46 + statusBarHeight,
|
|
});
|
|
},
|
|
changeDateTime1(e) {
|
|
this.setData({ dateTime1: e.detail.value });
|
|
},
|
|
}) |