From 85defcaac35b31c685be3d69f4e14e02f1c48b8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com>
Date: Tue, 22 Oct 2024 11:54:28 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=B4=E4=BF=AEapp=E5=AE=8C=E5=96=84?=
=?UTF-8?q?=E4=BA=86=E5=86=8D=E9=A2=84=E7=BA=A6=E5=B7=A5=E5=8D=95=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E8=B7=B3=E8=BD=AC=E5=88=B0=E6=96=B0=E5=BB=BA=E5=B7=A5?=
=?UTF-8?q?=E5=8D=95=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=BB=B4?=
=?UTF-8?q?=E4=BF=AE=E9=A1=B9=E7=9B=AE=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/projectPicker.vue | 41 +++++---
pages-order/addOrder/addOrder.vue | 23 +++--
pages-order/appointOrder/appointOrder.vue | 37 +-------
pages/project/project.vue | 111 ++++++++++++++++++++--
utils/utils.js | 18 ++++
5 files changed, 168 insertions(+), 62 deletions(-)
diff --git a/components/projectPicker.vue b/components/projectPicker.vue
index 05c24c3..a691363 100644
--- a/components/projectPicker.vue
+++ b/components/projectPicker.vue
@@ -39,8 +39,9 @@
-
- 新增维修项目
+
+
+
@@ -63,18 +64,39 @@ export default {
],
typeList: [],
typeId: 1,
- groupList: []
+ groupList: [],
+ show: false
}
},
+ onLoad() {
+ // 注册事件监听器
+ uni.$on('projectCreated', this.handleProjectCreated);
+ },
+ onUnload() {
+ // 移除事件监听器
+ uni.$off('projectCreated');
+ },
methods: {
open(selectedProj = []) {
- console.log("执行onload")
+ if (selectedProj) {
+ this.selectedProj = JSON.parse(JSON.stringify(selectedProj))
+ }
this.$refs.popup.open()
this.getProjeectList()
- if (this.typeList && this.typeList.length > 0) {
- this.typeId = this.typeList[0].id
+ setTimeout(() => {
+ if (this.typeList && this.typeList.length > 0) {
+ this.typeId = this.typeList[0].id
+ this.getProject()
+ this.show = true
+ }
+ },500)
+
+ // 监听事件
+ uni.$on('projectCreated', (data) => {
+ // 在这里处理接收到的数据
+ this.selectedProj.push(data)
this.getProject()
- }
+ });
// this.selectedProj = JSON.parse(JSON.stringify(selectedProj))
},
removeProj(index) {
@@ -91,7 +113,6 @@ export default {
chooseType(type) {
this.typeId = type.id
this.getProject()
- console.log("this.groupList",this.groupList)
// this.typeId = type.typeId
},
addProject() {
@@ -102,7 +123,7 @@ export default {
getProjeectList() {
const params = {
pageNo: 1,
- pageSize: 10000,
+ pageSize: 100000,
type: '03'
}
request({
@@ -111,7 +132,6 @@ export default {
method: 'GET',
params: params
}).then(res => {
- console.log("分类",res);
this.typeList = res.data
})
},
@@ -125,7 +145,6 @@ export default {
type: this.typeId
}
}).then(res => {
- console.log("项目",res);
this.groupList = res.data.records
})
},
diff --git a/pages-order/addOrder/addOrder.vue b/pages-order/addOrder/addOrder.vue
index 304c050..3e21e31 100644
--- a/pages-order/addOrder/addOrder.vue
+++ b/pages-order/addOrder/addOrder.vue
@@ -202,11 +202,22 @@ export default {
}
},
onLoad(data) {
+ console.log('预约订单页面跳转传进来的数据',data)
this.ticketNo = this.createUniqueCodeByHead('GD')
if (data.phone) {
this.phone = data.phone
this.listUserInfo()
}
+ setTimeout(() => {
+ if (data.carId) {
+ for (let i = 0; i < this.carList.length; i++) {
+ if (data.carId == this.carList[i].id) {
+ this.activeCarIndex = i
+ break
+ }
+ }
+ }
+ },500)
},
onShow() {
if (this.phone != '') {
@@ -221,11 +232,6 @@ export default {
},
//新增工单
submit() {
- console.log('userInfo', this.userInfo)
- console.log(this.carList[this.activeCarIndex])
- console.log('selectedProj', this.selectedProj)
- console.log("ticketType", this.ticketType)
- console.log('登陆人信息', getUserInfo())
if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0) {
uni.showToast({
title: '请完善信息',
@@ -257,7 +263,6 @@ export default {
title: '创建成功',
icon: 'success'
})
- console.log("工单提交返回的结果", res)
uni.navigateTo({
url: `/pages-order/orderDetail/orderDetail?id=${res.data.id}&isDetail=0`
});
@@ -266,7 +271,6 @@ export default {
listUserInfo() {
this.carList = []
this.userInfo = null
- console.log("获取用户信息")
if (this.phone != '') {
const params = {
phoneNumber: this.phone
@@ -276,7 +280,6 @@ export default {
method: 'GET',
params: params
}).then(res => {
- console.log(res);
if (res.data.records.length > 0) {
this.userInfo = res.data.records[0]
this.getCarList()
@@ -325,7 +328,6 @@ export default {
method: 'GET',
params: params
}).then(res => {
- console.log(res);
this.carList = res.data.records
//将时间戳转换
this.carList.forEach(item => {
@@ -338,7 +340,6 @@ export default {
editCarInfo(index) {
bus.$off('updateCarInfo')
bus.$on('updateCarInfo', (carInfo) => {
- console.log('Car', carInfo)
if (index) {
this.carList[index] = carInfo
} else {
@@ -361,7 +362,6 @@ export default {
editUserInfo(userInfo) {
bus.$off('updateUserInfo')
bus.$on('updateUserInfo', (userInfo) => {
- console.log('userInfo', userInfo)
this.userInfo = userInfo
})
uni.navigateTo({
@@ -373,7 +373,6 @@ export default {
},
projConfirm(proj) {
this.selectedProj = proj
- console.log("回到主页后", proj)
}
}
}
diff --git a/pages-order/appointOrder/appointOrder.vue b/pages-order/appointOrder/appointOrder.vue
index 3234e56..467a2b1 100644
--- a/pages-order/appointOrder/appointOrder.vue
+++ b/pages-order/appointOrder/appointOrder.vue
@@ -20,7 +20,7 @@
-
+
@@ -46,36 +46,7 @@ export default {
phone: '',
userInfo: null,
carList: [],
- orderList: [
- // {
- // orderNo: '1209840149750105501',
- // flag: 1, flagStr: '待处理', carNum: '川A 184AO1',
- // carModel: '一汽奥迪 2024款 A6L',
- // projectList: [
- // {name: '清洗内饰', id: 1},
- // {name: '内饰精洗除臭', id: 2},
- // {name: '烘干底板胶及脚垫', id: 3}
- // ],
- // userName: '张三',
- // userPhone: '157****6879',
- // appointDate: '2024-10-20 12:00',
- // counselorName: '李相东'
- // },
- // {
- // orderNo: '1209840149750105501',
- // flag: 1, flagStr: '待处理', carNum: '川A 184AO1',
- // carModel: '一汽奥迪 2024款 A6L',
- // projectList: [
- // {name: '清洗内饰', id: 1},
- // {name: '内饰精洗除臭', id: 2},
- // {name: '烘干底板胶及脚垫', id: 3}
- // ],
- // userName: '张三',
- // userPhone: '157****6879',
- // appointDate: '2024-10-20 12:00',
- // counselorName: '李相东'
- // }
- ]
+ orderList: []
}
},
onLoad(data) {
@@ -120,10 +91,10 @@ export default {
})
}
},
- addOrder(){
+ addOrder(carId){
console.log('执行')
uni.navigateTo({
- url: `/pages-order/addOrder/addOrder?phone=${this.phone}`
+ url: `/pages-order/addOrder/addOrder?phone=${this.phone}&carId=${carId}`
});
},
}
diff --git a/pages/project/project.vue b/pages/project/project.vue
index 37dd2f4..842f94e 100644
--- a/pages/project/project.vue
+++ b/pages/project/project.vue
@@ -5,19 +5,57 @@
-
+
-
+
+
+
+
+
+
+
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+