chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* 红娘服务进度页 U35
|
||||
*/
|
||||
const api = require('../../utils/api');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
service: null,
|
||||
loading: true
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
const lastServiceId = wx.getStorageSync('lastServiceId');
|
||||
if (lastServiceId) {
|
||||
this.loadService(lastServiceId);
|
||||
} else {
|
||||
this.loadMyServices();
|
||||
}
|
||||
},
|
||||
|
||||
async loadService(serviceId) {
|
||||
this.setData({ loading: true });
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
const res = await api.get(`/matchmaker/services/${serviceId}`, {}, { Authorization: `Bearer ${token}` });
|
||||
this.setData({ service: res, loading: false });
|
||||
} catch (err) {
|
||||
this.setData({ loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
async loadMyServices() {
|
||||
this.setData({ loading: true });
|
||||
try {
|
||||
const token = wx.getStorageSync('accessToken');
|
||||
const res = await api.get('/matchmaker/services', {}, { Authorization: `Bearer ${token}` });
|
||||
if (res && res.length > 0) {
|
||||
this.setData({ service: res[0], loading: false });
|
||||
} else {
|
||||
this.setData({ loading: false });
|
||||
}
|
||||
} catch (err) {
|
||||
this.setData({ loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
getStatusText(status) {
|
||||
const map = {
|
||||
'submitted': '已提交,等待分配',
|
||||
'assigned': '已分配红娘',
|
||||
'in_service': '红娘正在服务中',
|
||||
'waiting_user': '等待您确认',
|
||||
'completed': '服务已完成',
|
||||
'cancelled': '已取消'
|
||||
};
|
||||
return map[status] || status;
|
||||
},
|
||||
|
||||
getStatusColor(status) {
|
||||
const map = {
|
||||
'submitted': '#E59A32',
|
||||
'assigned': '#17A2B8',
|
||||
'in_service': '#E96B6B',
|
||||
'waiting_user': '#E59A32',
|
||||
'completed': '#2E9B68',
|
||||
'cancelled': '#999'
|
||||
};
|
||||
return map[status] || '#999';
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user