Explorar o código

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

# Conflicts:
#	fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
zhouyy hai 4 meses
pai
achega
ffa0317b73

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/foldingPanel.vue

@@ -80,7 +80,7 @@ const handleBox = () => {
     }
 
     .expand {
-      max-height: 1000px;
+      max-height: 800px;
     }
   }
 

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/hooks/useApi.js

@@ -119,3 +119,4 @@ export const OBTAIN_SALES_ORDER_RECEIPTS = `/order/paymentCollectionList` // 获
 export const NEW_SALES_ORDER_PAYMENT_COLLECTION = `/order/paymentCollection` // 新建销售订单收款
 export const SALES_ORDER_COLLECTION_EDITING = `/order/editPayment` // 编辑销售订单收款
 export const DELETE_SALES_ORDER_PAYMENT_RECORDS = `/order/deletePayment` // 删除销售订单收款记录
+export const OBTAIN_THE_CONTRACT_REMITTANCE_LIST = `/contract-payment/getList` // 获取合同打款列表

+ 107 - 7
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/addEditor.vue

@@ -2,28 +2,65 @@
   <div class="w-full h-full flex flex-col">
     <div class="flex-1 overflow-y-auto">
       <CustomerForm ref="formFormRef" :formJson="formJson" :formValue="formVal"></CustomerForm>
+      <template v-for="(item, index) in paymentPlanList">
+        <FoldingPanel :title="`回款计划(${index + 1})`" class="mb-4">
+          <template #foldingRight>
+            <div class="flex items-center">
+              <div class="pr-3 themeTextColor" @click="addPaymentCollection(index)">添加</div>
+              <div class="text-[red]" @click="deletePaymentCollection(index)">删除</div>
+            </div>
+          </template>
+          <template #foldContainer>
+            <div>
+              <van-cell title="是否已回款">
+                <template #default>
+                  <div class="flex justify-end">
+                    <van-checkbox v-model="item.isPayed">已回款</van-checkbox>
+                  </div>
+                </template>
+              </van-cell>
+              <van-cell title="回款日期" @click="showDatePicker(index)">
+                <template #default>
+                  <van-field v-model="item.payDate" input-align="right" placeholder="请选择日期" class="resetStyles" readonly />
+                </template>
+              </van-cell>
+              <van-cell title="回款金额">
+                <template #default>
+                  <van-field v-model="item.amount" type="digit" input-align="right" placeholder="请输入金额"
+                    class="resetStyles" />
+                </template>
+              </van-cell>
+            </div>
+          </template>
+        </FoldingPanel>
+      </template>
     </div>
     <div class="mar-20px ">
       <van-button type="primary" @click="onSubmit" class="w-full">
         {{ Object.keys(formVal).length > 0 ? '确定修改' : '确定添加' }}
       </van-button>
     </div>
+
+    <!-- 日期选择器 -->
+    <van-popup v-model:show="showPicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
+      <van-date-picker v-model="pickerValue" @confirm="showPickerConfirm" @cancel="showPicker = false" />
+    </van-popup>
   </div>
 </template>
 
 <script setup>
-import { ref, onActivated } from 'vue';
+import { ref, onActivated, watch } from 'vue';
 import { useLifecycle } from '@hooks/useCommon.js';
 import CustomerForm from '@components/common/formForm/formView.vue'
 import requests from "@common/requests";
 import useToast from "@hooks/useToast"
-import { CONTRACT_ADDITION_EDITING, CONTRACT_EDITING } from "@hooks/useApi"
+import { CONTRACT_ADDITION_EDITING, CONTRACT_EDITING, OBTAIN_THE_CONTRACT_REMITTANCE_LIST } from "@hooks/useApi"
 import useRouterStore from "@store/useRouterStore.js";
+import FoldingPanel from '@components/common/foldingPanel.vue';
+import dayjs from 'dayjs';
 
 const router = useRouterStore()
-
 const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
-
 const props = defineProps({
   formJson: { required: true },
   formValue: { required: true },
@@ -31,14 +68,45 @@ const props = defineProps({
 
 const formFormRef = ref(null)
 const formVal = ref({})
+const paymentPlanList = ref([{}])
+const showPicker = ref(false)
+const pickerValue = ref([])
+const rowIndex = ref(0)
+
+watch(() => formVal.value, (newValue) => {
+  console.log(newValue, '<==== 看看')
+  if (!newValue.id) {
+    paymentPlanList.value = [{}]
+    return
+  }
+
+  getPaymentCollectionList(newValue.id)
+})
+
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    if(!res.data) {
+    if (!res.data) {
       return
     }
+
+    for(let i in paymentPlanList.value) {
+      const row = paymentPlanList.value[i]
+      if(!row.payDate) {
+        toastText('回款日期不能为空')
+        return
+      }
+      if(!row.amount || row.amount == 0) {
+        toastText('回款金额不能为空和0')
+        return
+      }
+      if(formVal.value.id) {
+        paymentPlanList.value[i].contractId = formVal.value.id
+      }
+    }
+
     toastLoading('保存中', 0)
-    requests.post(props.formValue?.id ? CONTRACT_EDITING : CONTRACT_ADDITION_EDITING, { ...props.formValue, ...res.data }).then(() => {
+    requests.post(props.formValue?.id ? CONTRACT_EDITING : CONTRACT_ADDITION_EDITING, { ...props.formValue, ...res.data, paymentListStr: JSON.stringify(paymentPlanList.value) }).then(() => {
       toastSuccess('保存成功')
       setTimeout(() => {
         router.navigateBack({
@@ -53,20 +121,52 @@ function onSubmit() {
   })
 }
 
+function addPaymentCollection(index) {
+  paymentPlanList.value.splice(index + 1, 0, { isPayed: false, payDate: dayjs(new Date()).format('YYYY-MM-DD'), amount: null })
+}
+
+function deletePaymentCollection(index) {
+  paymentPlanList.value.splice(index, 1)
+}
+
+function showDatePicker(index) {
+  const { payDate } = paymentPlanList.value[index];
+  rowIndex.value = index;
+  const currentDate = dayjs(payDate ? new Date(payDate) : new Date()).format('YYYY-MM-DD').split('-');
+  pickerValue.value = currentDate;
+  showPicker.value = true;
+}
+
+function showPickerConfirm({ selectedValues }) {
+  paymentPlanList.value[rowIndex.value].payDate = selectedValues.join("-");
+  showPicker.value = false;
+}
+
+function getPaymentCollectionList(id) {
+  requests.post(OBTAIN_THE_CONTRACT_REMITTANCE_LIST, { contractId: id }).then((res) => {
+    paymentPlanList.value = res.data.length > 0 ? res.data : [{}]
+  })
+}
+
 useLifecycle({
   load: () => {
     formVal.value = props.formValue
+    paymentPlanList.value = [{}]
   },
   init: () => {
     formVal.value = props.formValue
+    paymentPlanList.value = [{}]
   }
 });
 
 onActivated(() => {
-  
+
 })
 </script>
 
 <style lang='scss' scoped>
 /* 样式代码 */
+.resetStyles {
+  padding: 0;
+}
 </style>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DingDingServiceImpl.java


+ 3 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -1600,7 +1600,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             int percentRes = 0;
                             if(tmpVO.getPlanHoursSum().compareTo(new BigDecimal(0)) > 0){
                                 percentRes = tmpVO.getRealHoursSum().multiply(new BigDecimal(100))
-                                        .divide(tmpVO.getPlanHoursSum(),0,RoundingMode.HALF_UP).intValue();
+                                        .divide(tmpVO.getPlanHoursSum(),0, RoundingMode.HALF_UP).intValue();
                             }
                             projectVO.setProgress(percentRes);
                         }
@@ -3297,7 +3297,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 }
                 int percentRes = 0;
                 if(planHourSum.compareTo(new BigDecimal(0)) > 0){
-                    percentRes = realHourSum.multiply(new BigDecimal(100)).divide(planHourSum,0,RoundingMode.HALF_UP).intValue();
+                    BigDecimal bg = realHourSum.multiply(new BigDecimal(100)).divide(planHourSum, 0, BigDecimal.ROUND_HALF_UP);
+                    percentRes = bg.intValue();
                 }
                 project.setProgress(percentRes);
             }