|
@@ -1,20 +1,76 @@
|
|
|
<template>
|
|
|
<div class="w-full h-full">
|
|
|
- 销售订单详情
|
|
|
+ <van-tabs v-model:active="tabActive">
|
|
|
+ <van-tab title="销售订单信息" name="销售订单信息">
|
|
|
+ <OrderInfo :info="info" />
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="相关任务" name="相关任务">
|
|
|
+ <RelatedTasks :infoList="relatedTasksList" />
|
|
|
+ </van-tab>
|
|
|
+ <van-tab title="相关产品" name="相关产品">
|
|
|
+ <RelatedProducts :infoList="relatedProductsList" />
|
|
|
+ </van-tab>
|
|
|
+ </van-tabs>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue';
|
|
|
+import { ref, onActivated, watch } from 'vue';
|
|
|
import { useLifecycle } from '@hooks/useCommon.js';
|
|
|
+import { GET_ORDER_RELATED_TASKS, OBTAIN_ORDER_RELATED_PRODUCTS } from "@hooks/useApi"
|
|
|
+import requests from "@common/requests";
|
|
|
+import OrderInfo from './orderInfo.vue';
|
|
|
+import RelatedTasks from '../tasks/relatedTasks.vue';
|
|
|
+import RelatedProducts from '../product/relatedProducts.vue';
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ info: {
|
|
|
+ type: Object,
|
|
|
+ required: true,
|
|
|
+ default: () => ({})
|
|
|
+ }
|
|
|
+})
|
|
|
+const tabActive = ref('销售订单信息');
|
|
|
+const relatedTasksList = ref([]);
|
|
|
+const relatedProductsList = ref([]);
|
|
|
+
|
|
|
+watch(() => props.info, (newValue) => {
|
|
|
+ tabActive.value = '销售订单信息';
|
|
|
+ processingData(newValue.id)
|
|
|
+})
|
|
|
+
|
|
|
+function getDetailedData(id) {
|
|
|
+ requests.post(GET_ORDER_RELATED_TASKS, { id }).then(({ data }) => {
|
|
|
+ relatedTasksList.value = data || []
|
|
|
+ })
|
|
|
+ requests.post(OBTAIN_ORDER_RELATED_PRODUCTS, { id }).then(({ data }) => {
|
|
|
+ const list = (data || []).map((item) => {
|
|
|
+ const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, orderProductDetail } = item
|
|
|
+ return {
|
|
|
+ id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory,
|
|
|
+ productType: typeName,
|
|
|
+ quantity: +orderProductDetail?.num,
|
|
|
+ discount: +orderProductDetail?.discount,
|
|
|
+ sellingPrice: +orderProductDetail?.sealPrice,
|
|
|
+ totalPrice: +orderProductDetail?.totalPrice
|
|
|
+ }
|
|
|
+ })
|
|
|
+ relatedProductsList.value = list
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function processingData(id) {
|
|
|
+ getDetailedData(id)
|
|
|
+}
|
|
|
|
|
|
useLifecycle({
|
|
|
- load: () => {
|
|
|
- // 添加加载逻辑
|
|
|
+ init: () => {
|
|
|
+ tabActive.value = '销售订单信息';
|
|
|
+ processingData(props.info.id)
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
<style lang='scss' scoped>
|
|
|
- /* 样式代码 */
|
|
|
+/* 样式代码 */
|
|
|
</style>
|