首页活动,报事报修评价
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Has been cancelled

This commit is contained in:
2025-09-09 17:21:35 +08:00
parent fb02715afb
commit 400e95c81b
7 changed files with 199 additions and 71 deletions

View File

@@ -71,14 +71,33 @@
this.selectedType = item;
},
async getOrderType() {
this.repairTypes = []
let params = {
parentId: '1952989217332658178'
}
let res = await this.$u.api.getRepairTypes(params);
let res = await this.$u.api.getRepairTypes2(params);
if (res.code == '200') {
this.repairTypes = res.data
this.repairInfo.type = res.data[0].id;
this.selectType(res.data[0].orderTypeName)
// 只处理前两条数据
const types = [];
const data = res.data.slice(0, 2); // 只取前两条数据
// 遍历前两个父级分类
data.forEach(parent => {
// 如果没有children或者children为空则添加父级数据
if (!parent.children || parent.children.length === 0) {
types.push(parent);
} else {
// 如果有children则添加所有children数据
types.push(...parent.children);
}
});
this.repairTypes = types;
if (this.repairTypes.length > 0) {
this.repairInfo.type = this.repairTypes[0].id;
this.selectType(this.repairTypes[0].orderTypeName)
}
}
},
// 删除图片
@@ -122,7 +141,7 @@
uni.showToast({
title: '上传失败',
icon: 'none'
});
});
uni.hideLoading();
return;
}
@@ -136,21 +155,21 @@
async realSubmit() {
let res = await this.$u.api.addOrder2(this.repairInfo);
if (res.code == '200') {
if (res.code == '200') {
uni.hideLoading();
// 关闭页面前发送事件通知前页面刷新
uni.$emit('refreshData', '');
// 返回上一页
uni.navigateBack();
const itemStr = encodeURIComponent(JSON.stringify(this.repairInfo));
uni.navigateTo({
url: "/pages/sys/user/myRepair/addSuc?item=" + itemStr,
uni.navigateBack();
const itemStr = encodeURIComponent(JSON.stringify(this.repairInfo));
uni.navigateTo({
url: "/pages/sys/user/myRepair/addSuc?item=" + itemStr,
});
}else{
uni.showToast({
title: res.msg,
icon: 'none'
});
}else{
uni.showToast({
title: res.msg,
icon: 'none'
});
}
},