lishanshan 2 ماه پیش
والد
کامیت
d2a17cfba6
4فایلهای تغییر یافته به همراه127 افزوده شده و 63 حذف شده
  1. 12 3
      pages/order/components/serviceDetail.vue
  2. 1 1
      pages/order/index.vue
  3. 70 55
      pages/order/serviceOrder/project.vue
  4. 44 4
      pages/store/addHours.vue

+ 12 - 3
pages/order/components/serviceDetail.vue

@@ -9,9 +9,9 @@
 					<view class="item_name" style="margin-bottom: 10rpx;">
 						{{item.itemName}}
 					</view>
-					<view class="item_center">
-						<span>{{item.itemContent}}</span>
-						<span class="item_price"><text>¥</text>{{item.itemMoney}}</span>
+					<view class="item_center" v-for="(subRow,subRowIndex) in item.subItem" :key="subRowIndex">
+						<span><span class="dots"></span>{{subRow.itemContent}}</span>
+						<span class="item_price"><text>¥</text>{{subRow.itemPrice}}</span>
 					</view>
 				</view>
 			</view>
@@ -114,6 +114,15 @@
 				display: flex;
 				align-items: center;
 				justify-content: space-between;
+				.dots{
+          width: 10rpx;
+          height: 10rpx;
+          background-color: #85868A;
+          border-radius: 50%;
+          display: inline-block;
+          margin-right: 10rpx;
+          margin-bottom: 4rpx;
+				}
 				span{
 					font-size: 24rpx;
 					color: #888888;

+ 1 - 1
pages/order/index.vue

@@ -1306,7 +1306,7 @@
 					width: 100%;
 					display: flex;
 					align-items: center;
-					justify-content: space-between;
+					justify-content: end;
 					margin-top: 20rpx;
 
 					.time_left {

+ 70 - 55
pages/order/serviceOrder/project.vue

@@ -225,28 +225,36 @@
 					this.calculateTotal(item)
 				})
 				
-				let list = []
-				this.projectList.forEach(item => {
-					if (item.checked) {
-						item.delFlag = 0
-						// 如果有serveList,生成说明
-						if (item.serveList && item.serveList.length > 0) {
-							const detailNames = item.serveList.map(row => row.name).filter(name => name).join('、')
-							if (detailNames) {
-								item.itemContent = detailNames
-							}
-						}
-					} else {
-						item.delFlag = 1
-						item.itemMoney = 0
-					}
-					list.push({
-						delFlag: item.delFlag,
-						itemContent: item.itemContent || '',
-						itemMoney: item.itemMoney || 0,
-						itemName: item.itemName
-					})
-				})
+        let list = []
+        this.projectList.forEach(item => {
+          if (item.checked) {
+            item.delFlag = 0
+            // 如果有serveList,生成subItem数组
+            if (item.serveList && item.serveList.length > 0) {
+              item.subItem = item.serveList.map(row => ({
+                itemContent: row.name || '',
+                itemPrice: row.price || '0'
+              }))
+              // 计算总金额
+              const total = item.serveList.reduce((sum, row) => {
+                return sum + parseFloat(row.price || 0)
+              }, 0)
+              item.itemMoney = total.toFixed(2)
+            } else {
+              item.subItem = []
+            }
+          } else {
+            item.delFlag = 1
+            item.itemMoney = 0
+            item.subItem = []
+          }
+          list.push({
+            delFlag: item.delFlag,
+            subItem: item.subItem,
+            itemMoney: item.itemMoney || 0,
+            itemName: item.itemName
+          })
+        })
 				
 				console.log('提交数据:', list)
 				
@@ -288,39 +296,46 @@
 				})
 			},
 			
-			//回显
-			getChange() {
-				this.$http.get("/ts/merchant/servicesDetails?subOrderId=" + this.orderNo).then(res => {
-					if (res.data.code == 200) {
-						this.editId = res.data.result.id
-						const details = res.data.result.serviceDetails || []
-						
-						// 更新项目列表,保持原有结构
-						this.projectList = this.projectList.map(project => {
-							const detail = details.find(d => d.itemName === project.itemName)
-							if (detail) {
-								return {
-									...project,
-									checked: detail.delFlag == 0,
-									delFlag: detail.delFlag,
-									itemMoney: detail.itemMoney,
-									itemContent: detail.itemContent || '',
-									serveList: detail.serveList || [{
-										name: detail.itemContent || '',
-										price: detail.itemMoney || '',
-										quantity: 1
-									}]
-								}
-							}
-							return project
-						})
-						
-						console.log('回显数据:', this.projectList)
-					}
-				}).catch(err => {
-					console.error('获取回显数据错误:', err)
-				})
-			}
+      //回显
+      getChange() {
+        this.$http.get("/ts/merchant/servicesDetails?subOrderId=" + this.orderNo).then(res => {
+          if (res.data.code == 200) {
+            this.editId = res.data.result.id
+            const details = res.data.result.serviceDetails || []
+	          // 更新项目列表,保持原有结构
+            this.projectList = this.projectList.map(project => {
+              const detail = details.find(d => d.itemName === project.itemName)
+              if (detail) {
+                // 将subItem转换为serveList格式用于页面显示
+                const serveList = (detail.subItem && detail.subItem.length > 0) 
+                  ? detail.subItem.map(sub => ({
+                      name: sub.itemContent || '',
+                      price: sub.itemPrice || '',
+                      quantity: 1
+                    }))
+                  : [{
+                      name: '',
+                      price: '',
+                      quantity: 1
+                    }]
+                  
+                return {
+                  ...project,
+                  checked: detail.delFlag == 0,
+                  delFlag: detail.delFlag,
+                  itemMoney: detail.itemMoney,
+                  serveList: serveList
+                }
+              }
+              return project
+            })
+
+            console.log('回显数据:', this.projectList)
+          }
+        }).catch(err => {
+          console.error('获取回显数据错误:', err)
+        })
+      }
 		},
 		onLoad(options) {
 			console.log('页面参数:', options)

+ 44 - 4
pages/store/addHours.vue

@@ -223,10 +223,50 @@ export default {
            
         },
         onEndTimeChange(val) {
-            this.timeArr[this.timeIndex].value = val.startDate + '-' + val.endDate
-						this.$refs.rangTime.startDate = ''
-						this.$refs.rangTime.endDate = ''
-
+            const newValue = val.startDate + '-' + val.endDate
+            
+            // 校验时间段是否重叠
+            if (this.checkTimeOverlap(newValue)) {
+                this.$tip.toast('时间段不能重叠,请重新选择')
+                return
+            }
+            
+            this.timeArr[this.timeIndex].value = newValue
+            this.$refs.rangTime.startDate = ''
+            this.$refs.rangTime.endDate = ''
+        },
+        // 校验时间段是否重叠
+        checkTimeOverlap(newTime) {
+            const [newStart, newEnd] = this.parseTimeRange(newTime)
+            
+            for (let i = 0; i < this.timeArr.length; i++) {
+                // 跳过当前正在编辑的时间段
+                if (i === this.timeIndex) continue
+                
+                const existingTime = this.timeArr[i].value
+                if (!existingTime) continue
+                
+                const [existStart, existEnd] = this.parseTimeRange(existingTime)
+                
+                // 判断时间段是否重叠:新开始时间 < 已存在结束时间 且 已存在开始时间 < 新结束时间
+                if (newStart < existEnd && existStart < newEnd) {
+                    return true
+                }
+            }
+            return false
+        },
+        // 解析时间段字符串为分钟数
+        parseTimeRange(timeRange) {
+            const [start, end] = timeRange.split('-')
+            return [
+                this.timeToMinutes(start),
+                this.timeToMinutes(end)
+            ]
+        },
+        // 将时间字符串转换为分钟数(如 "08:30" -> 510)
+        timeToMinutes(timeStr) {
+            const [hours, minutes] = timeStr.split(':').map(Number)
+            return hours * 60 + minutes
         },
         sumbit() {
             let data = {