|
|
@ -37,6 +37,7 @@ |
|
|
|
import { |
|
|
|
useStore |
|
|
|
} from "vuex" |
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
|
|
|
const current = ref(0) |
|
|
|
const list = reactive([{ |
|
|
@ -78,8 +79,42 @@ |
|
|
|
if (response.code == 200 && response.data) { |
|
|
|
orderlist.value = response.data.rows; |
|
|
|
|
|
|
|
orderlist.value.forEach(item => { |
|
|
|
item.h5OrderVO.petVOList.forEach(pet => { |
|
|
|
pet.orderServiceText = getOrderServiceText(pet.id, item.h5OrderVO.orderServiceList) |
|
|
|
pet.productNameText = getProductNameText(pet.id, item.h5OrderVO.orderItemList, item.h5OrderVO.orderServiceList) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getOrderServiceText(petId, orderServiceList){ |
|
|
|
|
|
|
|
let YYYY = undefined |
|
|
|
|
|
|
|
return orderServiceList |
|
|
|
.filter(service => service.petId == petId)//过滤 |
|
|
|
.map(service => dayjs(service.serviceDate))//转成时间 |
|
|
|
.sort((a, b) => a.valueOf() - b.valueOf())//排序 |
|
|
|
.map((service, i) => { |
|
|
|
if(YYYY && YYYY.format('YYYY-MM') == service.format('YYYY-MM')){ |
|
|
|
return service.format('DD') |
|
|
|
} |
|
|
|
if(YYYY && YYYY.format('YYYY') == service.format('YYYY')){ |
|
|
|
return service.format('MM-DD') |
|
|
|
} |
|
|
|
YYYY = service |
|
|
|
return service.format('YYYY-MM-DD') |
|
|
|
}) |
|
|
|
} |
|
|
|
function getProductNameText(petId, productList, orderServiceList){ |
|
|
|
|
|
|
|
let orderService = orderServiceList.filter(service => service.petId == petId) |
|
|
|
|
|
|
|
return productList |
|
|
|
.filter(product => orderService.filter(service => service.id == product.orderServiceId).length > 0) |
|
|
|
.map(product => product.productName) |
|
|
|
} |
|
|
|
|
|
|
|
const clickEvent = (item) => { |
|
|
|
current.value = item.index; |
|
|
|