lxf 2 luni în urmă
părinte
comite
f0b94ed014

+ 1 - 1
jy-ui/.prettierrc.json

@@ -3,6 +3,6 @@
   "semi": false,
   "tabWidth": 2,
   "singleQuote": true,
-  "printWidth": 100,
+  "printWidth": 180,
   "trailingComma": "none"
 }

+ 15 - 0
jy-ui/src/api/business/contract/info.ts

@@ -35,3 +35,18 @@ export function getStatistics(params: StrAnyObj): Promise<void> {
 export function getTransactionList(params: StrAnyObj): Promise<void> {
   return request.get('/contractInfo/getTransactionList', params)
 }
+
+// 客户付款数据
+export function getFundReceived(params: StrAnyObj): Promise<void> {
+  return request.get('/contractFundReceived/getList', params)
+}
+
+// 请款数据
+export function getPayment(params: StrAnyObj): Promise<void> {
+  return request.get('/paymentRequests/getDetailList', params)
+}
+
+// 订单
+export function getOrderList(params: StrAnyObj): Promise<void> {
+  return request.get('/contractInfo/getOrderList', params)
+}

+ 4 - 0
jy-ui/src/views/business/contract/info/index.vue

@@ -15,6 +15,7 @@ import {
 } from '@/api/business/contract/info'
 import Detail from './detail.vue'
 import TransactionDetail from './transaction-detail.vue'
+import OrderDetail from './order-detail.vue'
 
 const queryRef = ref<InstanceType<typeof AForm>>()
 const formRef = ref<InstanceType<typeof AForm>>()
@@ -601,6 +602,9 @@ function handleRemove(idList: string[]) {
         <el-tab-pane label="交易明细" name="2">
           <TransactionDetail :rowData="formData"></TransactionDetail>
         </el-tab-pane>
+        <el-tab-pane label="订单明细" name="3">
+          <OrderDetail :rowData="formData"></OrderDetail>
+        </el-tab-pane>
       </el-tabs>
     </a-dialog>
   </div>

+ 265 - 0
jy-ui/src/views/business/contract/info/order-detail.vue

@@ -0,0 +1,265 @@
+<template>
+  <div style="max-height: calc(100vh - 200px); overflow: hidden auto">
+    <el-form-item label="订单" :label-position="'top'">
+      <el-table :data="formData.data.order" style="width: 100%">
+        <el-table-column label="订单号">
+          <template v-slot="scope">
+            <div>
+              <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickDetail(scope.row)">
+                {{ scope.row.orderNo }}
+              </a>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column label="订单金额" prop="paymentPrice" />
+        <el-table-column label="三梵成本" prop="costAmount" />
+        <el-table-column label="预计利润" prop="expectedProfit" />
+      </el-table>
+    </el-form-item>
+    <el-form-item label="请款" :label-position="'top'">
+      <el-table :data="formData.data.payment" style="width: 100%">
+        <el-table-column label="请款金额" prop="amount" />
+        <el-table-column label="请款时间" prop="requestsTime" />
+        <el-table-column label="打款时间" prop="remitTime" />
+      </el-table>
+    </el-form-item>
+    <el-form-item label="客户付款" :label-position="'top'">
+      <el-table :data="formData.data.fundReceived" style="width: 100%">
+        <el-table-column label="客户付款金额" prop="receivedAmount" />
+        <el-table-column label="付款时间" prop="receivedTime" />
+        <el-table-column label="是否认领" prop="hasReceived">
+          <template v-slot="scope">
+            <div>
+              {{ scope.row.hasReceived ? '是' : '否' }}
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-form-item>
+    <el-form-item label="总利润" :label-position="'top'">
+      <div>{{ calculateTotalProfit() }}</div>
+    </el-form-item>
+
+    <a-dialog v-if="dialogVisible" v-model="dialogVisible" title="订单详情" style="width: 90%" :footer="false">
+      <div style="max-height: calc(100vh - 200px); overflow: hidden auto">
+        <div style="width: 100%">
+          <el-table :data="orderDetail.orderItemList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+            <el-table-column label="图片" width="130">
+              <template #default="props">
+                <el-image
+                  style="width: 100px; height: 100px; border: 1px solid #ccc"
+                  v-if="props.row.picUrls && props.row.picUrls.length > 0 && props.row.picUrls[0]"
+                  :src="props.row.picUrls[0]"
+                  fit="scale-down"
+                  :referrerpolicy="'no-referrer'"
+                  :zoom-rate="1.2"
+                  :preview-src-list="[props.row.picUrls[0]]"
+                  :initial-index="0"
+                  preview-teleported
+                >
+                </el-image>
+                <el-image
+                  style="width: 100px; height: 100px; border: 1px solid #ccc"
+                  v-else
+                  :src="props.row.picUrl"
+                  fit="scale-down"
+                  :referrerpolicy="'no-referrer'"
+                  :zoom-rate="1.2"
+                  :preview-src-list="[props.row.picUrl]"
+                  :initial-index="0"
+                  preview-teleported
+                >
+                </el-image>
+              </template>
+            </el-table-column>
+            <el-table-column label="设计图" width="130">
+              <template #default="props">
+                <el-image
+                  style="width: 100px; border: 1px solid #ccc"
+                  v-if="props.row.customizeVo && props.row.customizeVo.blueprintUrl"
+                  :src="props.row.customizeVo.blueprintUrl"
+                  fit="scale-down"
+                  :referrerpolicy="'no-referrer'"
+                  :zoom-rate="1.2"
+                  :preview-src-list="[props.row.customizeVo.blueprintUrl]"
+                  :initial-index="0"
+                  preview-teleported
+                >
+                </el-image>
+              </template>
+            </el-table-column>
+            <el-table-column label="商品信息" min-width="300">
+              <template #default="props">
+                <div>
+                  <div>SKU编码:{{ props.row.skuId }}</div>
+                  <div>商品名称:{{ props.row.spuName }}</div>
+                  <div>商品属性:{{ props.row.attrValue }}</div>
+                  <div v-if="orderDetail.type == 1">颜色:{{ props.row.colour || (props.row.customizeVo ? props.row.customizeVo.colour : '') }}</div>
+                  <div>规格:{{ props.row.length }} * {{ props.row.width }} * {{ props.row.height }}</div>
+                  <div>其他定制明细:{{ props.row.additionalCustomizeDetails }}</div>
+                  <div>其他定制总费用:{{ props.row.additionalCustomizePrice }}</div>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="单价" width="120">
+              <template #default="props">{{ orderDetail.settlementCurrency }} {{ props.row.salesPrice }}</template>
+            </el-table-column>
+            <el-table-column label="运费" width="120" v-if="orderDetail.deliveryWay == '1'">
+              <template #default="props"> {{ orderDetail.settlementCurrency }} {{ props.row.freightPrice }} </template>
+            </el-table-column>
+            <el-table-column label="数量" prop="quantity" width="120" v-if="orderDetail.type == 1" />
+            <el-table-column label="数量" min-width="300" v-if="orderDetail.type == 2">
+              <template #default="props">
+                <div v-if="props.row.customizeVo.colourList && props.row.customizeVo.colourList.length > 0">
+                  <el-table :data="props.row.customizeVo.colourList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+                    <el-table-column label="颜色" prop="colour" />
+                    <el-table-column label="图片" width="100">
+                      <template #default="item">
+                        <div>
+                          <el-image
+                            v-if="item.row.picUrl"
+                            :src="item.row.picUrl"
+                            style="max-width: 80px"
+                            fit="scale-down"
+                            :referrerpolicy="'no-referrer'"
+                            :zoom-rate="1.2"
+                            :preview-src-list="[item.row.picUrl]"
+                            :initial-index="0"
+                            preview-teleported
+                          >
+                          </el-image>
+                        </div>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="SKU编码" prop="skuId" width="140" />
+                    <el-table-column label="数量" prop="quantity" />
+                  </el-table>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="定制金额" width="140">
+              <template #default="props">{{ orderDetail.settlementCurrency }} {{ computeMoney(props.row) }} </template>
+            </el-table-column>
+            <el-table-column label="商品总金额" width="160">
+              <template #default="props">{{ orderDetail.settlementCurrency }} {{ props.row.paymentPrice }} </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div style="width: 100%; margin-top: 20px" v-if="orderDetail.packagingList && orderDetail.packagingList.length > 0">
+          <el-table :data="orderDetail.packagingList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
+            <el-table-column label="包材名称" prop="name" />
+            <el-table-column label="单价">
+              <template #default="props">
+                <div>{{ orderDetail.settlementCurrency }} {{ props.row.salesPrice }}</div>
+              </template>
+            </el-table-column>
+            <el-table-column label="数量" prop="quantity" />
+            <el-table-column label="包材费用小计" width="120">
+              <template #default="props">
+                <div>{{ orderDetail.settlementCurrency }} {{ packagingSubtotal(props.row) }}</div>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div style="margin-top: 20px; font-size: 18px; font-weight: bold; color: black">
+          <span>订单总金额: {{ orderDetail.settlementCurrency }} {{ orderTotal() }}</span>
+          <span style="margin-left: 40px"> 商品总金额: {{ orderDetail.settlementCurrency }} {{ goodsTotal() }} </span>
+          <span style="margin-left: 40px"> 包材总金额: {{ orderDetail.settlementCurrency }} {{ packagingTotal() }} </span>
+        </div>
+      </div>
+    </a-dialog>
+  </div>
+</template>
+
+<script setup>
+import { getFundReceived, getPayment, getOrderList } from '@/api/business/contract/info'
+
+const { proxy } = getCurrentInstance()
+const props = defineProps({
+  rowData: Object
+})
+const formData = reactive({
+  data: {
+    order: [],
+    payment: [],
+    fundReceived: []
+  }
+})
+const dialogVisible = ref(false)
+const orderDetail = ref({
+  orderItemList: [],
+  packagingList: []
+})
+const calculateTotalProfit = () => {
+  let profit = 0
+  if (orderDetail.fundReceived && orderDetail.fundReceived.length > 0) {
+    for (let i = 0; i < orderDetail.fundReceived.length; i++) {
+      profit = Number(Math.round((profit + orderDetail.fundReceived[i].receivedAmount) * 100) / 100)
+    }
+  }
+  if (orderDetail.payment && orderDetail.payment.length > 0) {
+    for (let i = 0; i < orderDetail.payment.length; i++) {
+      profit = Number(Math.round((profit - orderDetail.payment[i].amount) * 100) / 100)
+    }
+  }
+  return profit
+}
+const clickDetail = (row) => {
+  orderDetail.value = row
+  dialogVisible.value = true
+}
+const computeMoney = (item) => {
+  let money = 0
+  if (item.customizeProcessingPrice > 0 && item.quantity > 0) {
+    money = Number(Math.round((money + item.customizeProcessingPrice * item.quantity) * 100) / 100)
+  }
+  return money
+}
+const packagingSubtotal = (item) => {
+  let money = 0
+  if (item.salesPrice && item.quantity) {
+    let price = Number(item.salesPrice)
+    money = Number(Math.round(price * item.quantity * 100) / 100)
+  } else {
+    money = 0
+  }
+  return money
+}
+const packagingTotal = () => {
+  let money = 0
+  if (orderDetail.value.packagingList && orderDetail.value.packagingList.length > 0) {
+    for (let i = 0; i < orderDetail.value.packagingList.length; i++) {
+      money = Number(Math.round((money + packagingSubtotal(orderDetail.value.packagingList[i])) * 100) / 100)
+    }
+  }
+  return money
+}
+const goodsTotal = () => {
+  let money = 0
+  if (orderDetail.value.orderItemList && orderDetail.value.orderItemList.length > 0) {
+    for (let i = 0; i < orderDetail.value.orderItemList.length; i++) {
+      if (orderDetail.value.orderItemList[i].paymentPrice) {
+        money = Number(Math.round((money + Number(orderDetail.value.orderItemList[i].paymentPrice)) * 100) / 100)
+      }
+    }
+  }
+  return money
+}
+const orderTotal = () => {
+  let money = Number(Math.round((goodsTotal() + packagingTotal()) * 100) / 100)
+  return money
+}
+onMounted(() => {
+  getFundReceived({ contractId: props.rowData.id }).then((res) => {
+    formData.data.fundReceived = res
+  })
+  getPayment({ contractId: props.rowData.id }).then((res) => {
+    formData.data.payment = res
+  })
+  getOrderList({ contractId: props.rowData.id }).then((res) => {
+    formData.data.order = res
+  })
+})
+</script>
+
+<style lang="scss" scoped></style>