Преглед изворни кода

Merge remote-tracking branch 'origin/master'

yusm пре 5 месеци
родитељ
комит
6809425648
18 измењених фајлова са 617 додато и 31 уклоњено
  1. 11 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/scss/iframe.scss
  2. 87 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/foldingPanel.vue
  3. 1 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/formForm/formCorrespondenceProcessing.js
  4. 7 12
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/formForm/formItem.vue
  5. 3 3
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/translationComponent.vue
  6. 12 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/hooks/useApi.js
  7. 72 3
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/404.vue
  8. 1 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/addEditor/index.vue
  9. 100 2
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/addEditor.vue
  10. 18 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contacts/addEditor.vue
  11. 17 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/addEditor.vue
  12. 17 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/customer/addEditor.vue
  13. 199 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/newAndModifiedRelatedProducts.vue
  14. 17 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/addEditor.vue
  15. 17 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/thread/addEditor.vue
  16. 10 3
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/tabbar/home/component/workbench.vue
  17. 14 0
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/defaultData.js
  18. 14 1
      fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/generalVariables.js

+ 11 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/assets/scss/iframe.scss

@@ -26,4 +26,15 @@ $themeColor: #075985;
 
 .mar-20px {
   margin: 14px 20px;
+}
+
+.relatedAddButton {
+  padding: 4px 10px;
+  font-size: 12px;
+}
+
+.resetStyles {
+  ::v-deep .van-field__label {
+    padding-left: 7.35px;
+  }
 }

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

@@ -0,0 +1,87 @@
+<template>
+  <div class="w-full fold">
+    <div class="foldingTheHead" @click="handleBox" :style="`background-color: ${bgColor}`">
+      <div class="flex items-center">
+        <van-icon name="play" class="text-size-in" color="#FF8B32" />
+        <div class="text-[#FF8B32] pl-1">{{ title }}</div>
+      </div>
+      <slot name="foldingRight"></slot>
+    </div>
+    <div class="container">
+      <div :class="selClassName">
+        <slot name="foldContainer"></slot>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { useLifecycle } from "@hooks/useCommon.js";
+
+const props = defineProps({
+  bgColor: {
+    type: String,
+    default: '#FFEFE2'
+  },
+  title: {
+    type: String,
+    default: '标题'
+  }
+})
+
+useLifecycle({
+  load: () => {
+    // 添加加载逻辑
+  }
+});
+
+const selClassName = ref(['sel-menu', 'expand'])
+const selStatus = ref(true)
+
+const handleBox = () => {
+  if (selStatus.value) {
+    selClassName.value.pop()
+    selStatus.value = false
+  } else {
+    selClassName.value.push('expand')
+    selStatus.value = true
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.fold {
+  margin-bottom: 10px;
+  .foldingTheHead {
+    min-height: 44px;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 7px 16px 7px 12px;
+  }
+
+  .container {
+    height: calc(100% - 50px);
+    display: flex;
+    justify-content: center;
+
+    // 折叠样式
+    .sel-menu {
+      width: 100%;
+      overflow: hidden;
+      cursor: pointer;
+      transition: max-height 0.5s linear;
+      position: relative;
+    }
+
+    .sel-menu {
+      max-height: 0;
+    }
+
+    .expand {
+      max-height: 1000px;
+    }
+  }
+}
+</style>

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/formForm/formCorrespondenceProcessing.js

@@ -15,7 +15,7 @@ export const relatedField = {
 export function itemFormSetValue(formJson = [], formVal = {}) {
   const list = resetListData(formJson);
   for (const item of list) {
-    if (formVal[item.model]) {
+    if (formVal[item.model] || formVal[item.model] == 0) {
       item.options.defaultValue = formVal[item.model];
       item.options.disabled = false
     } else {

+ 7 - 12
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/formForm/formItem.vue

@@ -50,7 +50,7 @@
       is-link
       :class="element.options?.rules?.required ? '' : 'resetStyles'"
     >
-      <template #input v-if="element.options.defaultValue">
+      <template #input v-if="element.options.defaultValue || element.options.defaultValue == 0">
         {{ selectedLabel }}
       </template>
     </van-field>
@@ -176,7 +176,7 @@ const selectedLabel = computed(() => {
       .map((item) => item.label)
       .join(",");
   } else {
-    return options.find((item) => item.value === defaultValue)?.label;
+    return options.find((item) => item.value == defaultValue)?.label;
   }
 });
 
@@ -274,14 +274,9 @@ onMounted(() => {
 </script>
 
 <style lang="scss" scoped>
-.resetStyles {
-  ::v-deep .van-field__label {
-    padding-left: 7.35px;
-  }
-}
-.resetStyles-right {
-  ::v-deep .van-cell__value {
-    margin-right: 20px;
-  }
-}
+// .resetStyles-right {
+//   ::v-deep .van-cell__value {
+//     margin-right: 20px;
+//   }
+// }
 </style>

+ 3 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/translationComponent.vue

@@ -1,12 +1,12 @@
 <template>
   <template v-if="userInfo.userNameNeedTranslate == 1">
-    <template v-if="Array.isArray(openId)">
+    <!-- <template v-if="Array.isArray(openId)">
       <template v-for="(item, index) in openId">
         <ww-open-data :type='type' :openid='item'></ww-open-data>
         <span v-if="index < openId.length - 1">,</span>
       </template>
     </template>
-    <ww-open-data :type='type' :openid='openId' v-else></ww-open-data>
+    <ww-open-data :type='type' :openid='openId' v-else></ww-open-data> -->
   </template>
   <template v-else>
     {{ Array.isArray(openId) ? openId.join(',') : openId }} 😔
@@ -34,7 +34,7 @@ const userInfo = useInfoStore()
 useLifecycle({
   load: () => {
     // 添加加载逻辑
-    console.log(useEnv(), '<==== useEnv')
+    // console.log(useEnv(), '<==== useEnv')
   }
 });
 </script>

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

@@ -25,3 +25,15 @@ export const DELETE_ORDER = '/order/delete' // 删除订单
 export const BUSINESS_OPPORTUNITY_TRANSFER = '/business-opportunity/claim' // 转移商机
 export const TRANSFER_CLUES = '/clue/claim' // 转移线索
 export const TRANSFER_CUSTOMERS = '/custom/claim' // 转移客户
+export const NEW_BUSINESS_OPPORTUNITY_EDITING = `/business-opportunity/insertAndUpdate` // 商机新增编辑
+export const NEW_CLUE_EDITING = `/clue/insertAndUpdate` // 线索新增编辑
+export const CUSTOMER_ADDED_EDITOR = `/custom/insertAndUpdate` // 客户新增编辑
+export const CONTACT_PERSON_ADDITION_EDITOR = `/contacts/addContacts` // 联系人新增编辑
+export const TASK_ADD_EDIT = `/tasks/addTask` // 任务新增编辑
+export const PRODUCT_ADD_EDITOR = `/product/addOrUpdate` // 产品新增编辑
+export const CONTRACT_ADDITION_EDITING = `/contract/addContract` // 合同新增编辑
+export const ORDER_ADDITION_EDITING = `/order/addOrUpdate` // 订单新增编辑
+
+export const GET_BUSINESS_OPPORTUNITY_DETAILS = `/business-opportunity/getInfo` // 商机详情
+
+

+ 72 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/404.vue

@@ -1,18 +1,87 @@
 <template>
-  404
+  <div class="w-full fold">
+    <div class="foldingTheHead" @click="handleBox" :style="`background-color: ${bgColor}`">
+      <div class="flex items-center">
+        <van-icon name="play" class="text-size-in" color="#FF8B32" />
+        <div class="text-[#FF8B32] pl-1">{{ title }}</div>
+      </div>
+      <slot name="foldingRight"></slot>
+    </div>
+    <div class="container">
+      <div :class="selClassName">
+        <slot name="primaryCoverage"></slot>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script setup>
 import { ref } from 'vue';
+import { useLifecycle } from "@hooks/useCommon.js";
 
+const props = defineProps({
+  bgColor: {
+    type: String,
+    default: '#FFEFE2'
+  },
+  title: {
+    type: String,
+    default: '标题'
+  }
+})
 
 useLifecycle({
   load: () => {
     // 添加加载逻辑
   }
 });
+
+const selClassName = ref(['sel-menu'])
+const selStatus = ref(false)
+
+const handleBox = () => {
+  if (selStatus.value) {
+    selClassName.value.pop()
+    selStatus.value = false
+  } else {
+    selClassName.value.push('expand')
+    selStatus.value = true
+  }
+}
 </script>
 
-<style lang='scss' scoped>
-  /* 样式代码 */
+<style scoped lang="scss">
+.fold {
+  margin-bottom: 10px;
+  .foldingTheHead {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 8px 16px;
+  }
+
+  .container {
+    height: calc(100% - 50px);
+    background-color: antiquewhite;
+    display: flex;
+    justify-content: center;
+
+    // 折叠样式
+    .sel-menu {
+      width: 100%;
+      overflow: hidden;
+      cursor: pointer;
+      transition: max-height 0.5s linear;
+      position: relative;
+    }
+
+    .sel-menu {
+      max-height: 0;
+    }
+
+    .expand {
+      max-height: 1000px;
+    }
+  }
+}
 </style>

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/addEditor/index.vue

@@ -1,7 +1,7 @@
 <template>
   <Page :title="`${currentRoutingInformation?.name}${addOrEdit ? '编辑' : '新增'}`">
     <template v-slot:body>
-      <div class="w-full h-full pt-2">
+      <div class="w-full h-full">
         <van-skeleton title :row="10" v-if="pageLoading" class="w-full h-full" />
         <template v-if="!pageLoading">
           <!-- 商机 -->

+ 100 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/business/addEditor.vue

@@ -1,7 +1,26 @@
 <template>
   <div class="w-full h-full flex flex-col">
     <div class="flex-1 overflow-y-auto">
-      <CustomerForm ref="formFormRef" :formJson="formJson" :formValue="formVal"></CustomerForm>
+      <FoldingPanel :title="Object.keys(formVal).length > 0 ? '修改商机' : '新建商机'">
+        <template #foldContainer>
+          <CustomerForm ref="formFormRef" :formJson="formJson" :formValue="formVal"></CustomerForm>
+        </template>
+      </FoldingPanel>
+
+      <template v-for="(item, index) in businessItemProductList">
+        <FoldingPanel :title="`相关产品(${index + 1})`">
+          <template #foldingRight>
+            <div class="flex items-center">
+              <van-button icon="plus" color="#FF8B32" size="mini" class="relatedAddButton" @click="addBusinessItemProductList()">添加</van-button>
+              <van-button icon="plus" color="#075985" size="mini" class="relatedAddButton" @click.stop="resetBusinessItemProductList(index)" v-if="businessItemProductList.length == 1">重置</van-button>
+              <van-button icon="plus" color="#EE0A24" size="mini" class="relatedAddButton" @click.stop="deleteBusinessItemProductList(index)" v-if="businessItemProductList.length > 1">删除</van-button>
+            </div>
+          </template>
+          <template #foldContainer>
+            <NewAndModifiedRelatedProducts :form="item" />
+          </template>
+        </FoldingPanel>
+      </template>
     </div>
     <div class="mar-20px ">
       <van-button type="primary" @click="onSubmit" class="w-full">
@@ -14,28 +33,107 @@
 <script setup>
 import { ref, onActivated } from 'vue';
 import { useLifecycle } from '@hooks/useCommon.js';
+import { GET_BUSINESS_OPPORTUNITY_DETAILS, NEW_BUSINESS_OPPORTUNITY_EDITING } from "@hooks/useApi"
+import { defaultRelatedProductDataFields } from "@utility/defaultData"
+import dayjs from 'dayjs';
+import requests from "@common/requests";
+import useToast from "@hooks/useToast"
 import CustomerForm from '@components/common/formForm/formView.vue'
+import FoldingPanel from '@components/common/foldingPanel.vue';
+import NewAndModifiedRelatedProducts from '@pages/pageComponents/order/newAndModifiedRelatedProducts.vue'
 
 const props = defineProps({
   formJson: { required: true },
   formValue: { required: true },
 });
 
+const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
 const formFormRef = ref(null)
 const formVal = ref({})
+const businessItemProductList = ref([{...defaultRelatedProductDataFields}])
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    console.log('表单验证成功', res, JSON.stringify(res));
+    if(!res.data) {
+      return
+    }
+    const flagVal = judgmentaAmounteEqual(res.data, businessItemProductList.value)
+    if(flagVal) {
+      return
+    }
+    businessItemProductList.value.forEach((item) => {
+      item.typeName = item.productType
+      delete item.id
+    })
+    const newForm = {
+      ...props.formValue,
+      ...res.data,
+      expectedTransactionDate: res.data.expectedTransactionDate ? dayjs(new Date(res.data.expectedTransactionDate)).format('YYYY-MM-DD') : '',
+      businessItemProductList: businessItemProductList.value ? JSON.stringify(businessItemProductList.value) : []
+    }
+    toastLoading('保存中', 0)
+    requests.post(NEW_BUSINESS_OPPORTUNITY_EDITING, { ...newForm }).then(() => {
+      toastSuccess('保存成功')
+      setTimeout(() => {
+        history.back();
+      }, 2000)
+    }).catch((err) => {
+      toastFail('保存失败:' + err.msg)
+    })
+  })
+}
+
+function judgmentaAmounteEqual(mob, arr) {
+  if(!arr || arr.length <= 0) {
+    return false;
+  }
+  let flag = false;
+  const amounte = +mob.amountOfMoney || 0;
+  const totalAmounte = arr.reduce((pre, cur) => pre + (cur.totalPrice || 0), 0);
+
+  if (amounte != totalAmounte) {
+    toastText(`商机金额${amounte > totalAmounte ? '大于' : '小于'}产品总金额,${amounte > totalAmounte ? '保存中...' : '请修改'}`)
+    flag = true;
+  }
+
+  return (amounte > totalAmounte) ? false : flag;
+}
+
+function addBusinessItemProductList() {
+  businessItemProductList.value.push({ ...defaultRelatedProductDataFields })
+}
+
+function resetBusinessItemProductList(index) {
+  businessItemProductList.value.splice(index, 1, { ...defaultRelatedProductDataFields })
+}
+
+function deleteBusinessItemProductList(index) {
+  businessItemProductList.value.splice(index, 1)
+}
+
+function getBusinessOpportunityDetails(row) {
+  const { id } = row
+  if(!id) {
+    businessItemProductList.value = [{...defaultRelatedProductDataFields}]
+    return
+  }
+  requests.post(GET_BUSINESS_OPPORTUNITY_DETAILS, { id }).then(({ data }) => {
+    const { businessItemProducts } = data
+    businessItemProductList.value = businessItemProducts.length > 0 ? businessItemProducts : [{...defaultRelatedProductDataFields}]
+    console.log(businessItemProductList.value, '<==== businessItemProductList.value')
   })
 }
 
 useLifecycle({
   load: () => {
     formVal.value = props.formValue
+    getBusinessOpportunityDetails(formVal.value)
+    console.log(formVal.value, '<==== formVal.value')
   },
   init: () => {
     formVal.value = props.formValue
+    getBusinessOpportunityDetails(formVal.value)
+    console.log(formVal.value, '<==== formVal.value')
   }
 });
 

+ 18 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contacts/addEditor.vue

@@ -15,6 +15,11 @@
 import { ref, onActivated } 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 { CONTACT_PERSON_ADDITION_EDITOR } from "@hooks/useApi"
+
+const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
 
 const props = defineProps({
   formJson: { required: true },
@@ -26,7 +31,19 @@ const formVal = ref({})
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    console.log('表单验证成功', res, JSON.stringify(res));
+    if(!res.data) {
+      return
+    }
+    toastLoading('保存中', 0)
+    const url = props.formValue.id ? '/contacts/updateContacts' : CUSTOMER_ADDED_EDITOR
+    requests.post(url, { ...props.formValue, ...res.data }).then(() => {
+      toastSuccess('保存成功')
+      setTimeout(() => {
+        history.back();
+      }, 2000)
+    }).catch((err) => {
+      toastFail('保存失败:' + err.msg)
+    })
   })
 }
 

+ 17 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contract/addEditor.vue

@@ -15,6 +15,11 @@
 import { ref, onActivated } 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 } from "@hooks/useApi"
+
+const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
 
 const props = defineProps({
   formJson: { required: true },
@@ -26,7 +31,18 @@ const formVal = ref({})
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    console.log('表单验证成功', res, JSON.stringify(res));
+    if(!res.data) {
+      return
+    }
+    toastLoading('保存中', 0)
+    requests.post(CONTRACT_ADDITION_EDITING, { ...props.formValue, ...res.data }).then(() => {
+      toastSuccess('保存成功')
+      setTimeout(() => {
+        history.back();
+      }, 2000)
+    }).catch(() => {
+      toastFail('保存失败')
+    })
   })
 }
 

+ 17 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/customer/addEditor.vue

@@ -15,6 +15,11 @@
 import { ref, onActivated } 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 { CUSTOMER_ADDED_EDITOR } from "@hooks/useApi"
+
+const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
 
 const props = defineProps({
   formJson: { required: true },
@@ -26,7 +31,18 @@ const formVal = ref({})
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    console.log('表单验证成功', res, JSON.stringify(res));
+    if(!res.data) {
+      return
+    }
+    toastLoading('保存中', 0)
+    requests.post(CUSTOMER_ADDED_EDITOR, { ...props.formValue, ...res.data }).then(() => {
+      toastSuccess('保存成功')
+      setTimeout(() => {
+        history.back();
+      }, 2000)
+    }).catch(() => {
+      toastFail('保存失败')
+    })
   })
 }
 

+ 199 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/order/newAndModifiedRelatedProducts.vue

@@ -0,0 +1,199 @@
+<template>
+  <van-form
+    ref="productFormRef"
+    show-error
+    :show-error-message="false"
+    label-align="left"
+    input-align="right"
+    class="bg-white"
+  >
+    <van-field
+      v-model="form.productId"
+      is-link
+      readonly
+      required
+      name="productId"
+      label="产品名称"
+      placeholder="请选择"
+      :rules="[{ required: true, message: '请选择' }]"
+      @click="showPicker = true"
+    >
+      <template #input v-if="form.productId"> {{ form.productName }} </template>
+    </van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.productType"
+      readonly
+      name="productType"
+      label="产品类型"
+      placeholder="请先选择产品"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.unit"
+      readonly
+      name="unit"
+      label="单位"
+      placeholder="请先选择产品"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.price"
+      type="number"
+      readonly
+      name="price"
+      label="标准价格"
+      placeholder="请先选择产品"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.inventory"
+      type="number"
+      readonly
+      name="inventory"
+      label="库存"
+      placeholder="请先选择产品"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.sellingPrice"
+      type="number"
+      name="sellingPrice"
+      label="售价"
+      placeholder="请输入"
+      @input="inputNumberChange('sellingPrice')"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.quantity"
+      type="number"
+      name="quantity"
+      label="数量"
+      placeholder="请输入"
+      @input="inputNumberChange('quantity')"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.discount"
+      type="number"
+      name="discount"
+      label="折扣(%)"
+      placeholder="请输入"
+      @input="inputNumberChange('discount')"
+    ></van-field>
+    <van-field
+      class="resetStyles"
+      v-model="form.totalPrice"
+      readonly
+      name="totalPrice"
+      label="合计"
+      placeholder="自动计算"
+    ></van-field>
+
+    <!-- 弹窗 -->
+    <van-popup
+      v-model:show="showPicker"
+      destroy-on-close
+      position="bottom"
+      :style="{ height: '80%' }"
+    >
+      <PullDownSelector
+        :options="productsList"
+        :doYouNeedTranslation="false"
+        @change="selectChange"
+      />
+    </van-popup>
+  </van-form>
+</template>
+
+<script setup>
+import { ref, watch } from "vue";
+import { useLifecycle } from "@hooks/useCommon.js";
+import { GET_PRODUCT_LIST } from "@hooks/useApi";
+import requests from "@common/requests";
+
+/**
+ * @property {Object} form 表单数据以下为固定字段
+ * productId: "", // 产品id
+ * productType: "", // 产品类型
+ * unit: "", // 单位
+ * price: "", // 标准价格
+ * inventory: "", // 库存
+ * sellingPrice: "", // 售价
+ * quantity: "", // 数量
+ * discount: "", // 折扣
+ * totalPrice: "", // 总价
+ */
+const props = defineProps({
+  form: {
+    type: Object,
+    required: true,
+  },
+});
+
+const formRef = ref(null);
+const showPicker = ref(false);
+const productsList = ref([]);
+const allProducts = ref([]);
+
+function selectChange(value, label) {
+  const selectedItem = allProducts.value.find(item => item.id === value);
+  if (selectedItem) {
+    const {
+      id, productName, typeName, price, inventory, unitName
+    } = selectedItem;
+    Object.assign(props.form, {
+      productId: id,
+      productName,
+      productType: typeName,
+      price,
+      inventory,
+      unitName,
+      sellingPrice: 0,
+      quantity: 0,
+      discount: 0,
+      totalPrice: ''
+    });
+    
+    // 隐藏选择器
+    showPicker.value = false;
+  } else {
+    console.error('未找到匹配的产品');
+  }
+}
+
+function inputNumberChange(field) {
+    const { sellingPrice, quantity, discount, price } = props.form
+    props.form.discount = field == 'sellingPrice' ? Math.round(sellingPrice / price * 100) : props.form.discount
+    props.form.sellingPrice = field == 'discount' ? Math.round(price * discount / 100) : props.form.sellingPrice
+    if (sellingPrice && quantity && price && discount) {
+        props.form.totalPrice = Math.round(Math.round(price * discount / 100) * quantity)
+    }
+}
+
+function getAllProducts() {
+  requests
+    .post(GET_PRODUCT_LIST, { pageIndex: -1, pageSize: -1 })
+    .then(({ data = {} }) => {
+      const { record = [] } = data;
+      productsList.value = record.map(item => {
+        return {
+          label: item.productName,
+          value: item.id
+        }
+      })
+      allProducts.value = record;
+    });
+}
+
+useLifecycle({
+  load: () => {},
+  init: () => {
+    getAllProducts();
+  },
+});
+</script>
+
+<style lang="scss" scoped>
+/* 样式代码 */
+</style>

+ 17 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/addEditor.vue

@@ -15,6 +15,11 @@
 import { ref, onActivated } 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 { PRODUCT_ADD_EDITOR } from "@hooks/useApi"
+
+const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
 
 const props = defineProps({
   formJson: { required: true },
@@ -26,7 +31,18 @@ const formVal = ref({})
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    console.log('表单验证成功', res, JSON.stringify(res));
+    if(!res.data) {
+      return
+    }
+    toastLoading('保存中', 0)
+    requests.post(PRODUCT_ADD_EDITOR, { ...props.formValue, ...res.data }).then(() => {
+      toastSuccess('保存成功')
+      setTimeout(() => {
+        history.back();
+      }, 2000)
+    }).catch(() => {
+      toastFail('保存失败')
+    })
   })
 }
 

+ 17 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/thread/addEditor.vue

@@ -15,6 +15,11 @@
 import { ref, onActivated } 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 { NEW_CLUE_EDITING } from "@hooks/useApi"
+
+const { toastText, toastSuccess, toastFail, toastLoading } = useToast()
 
 const props = defineProps({
   formJson: { required: true },
@@ -26,7 +31,18 @@ const formVal = ref({})
 
 function onSubmit() {
   formFormRef.value.getJsonData().then((res) => {
-    console.log('表单验证成功', res, JSON.stringify(res));
+    if(!res.data) {
+      return
+    }
+    toastLoading('保存中', 0)
+    requests.post(NEW_CLUE_EDITING, { ...props.formValue, ...res.data }).then(() => {
+      toastSuccess('保存成功')
+      setTimeout(() => {
+        history.back();
+      }, 2000)
+    }).catch((err) => {
+      toastFail('保存失败:' + err.msg)
+    })
   })
 }
 

+ 10 - 3
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/tabbar/home/component/workbench.vue

@@ -1,9 +1,10 @@
 <template>
   <div class="w-full h-full workbench">
     <!-- 日历 -->
-    <div class="w-full p16 backgroundThemeColor rounded-b-lg">
-      <van-calendar :show-title="false" :show-subtitle="false" :show-mark="false" :poppable="false" :show-confirm="false" :row-height="'2.5rem'"
-        :style="{ height: '45.174vh', borderRadius: '2vw' }" :min-date="minDate" />
+    <div class="w-full p16 backgroundThemeColor rounded-b-lg setCaleStrle">
+      <van-calendar switch-mode="year-month" :show-title="false" :show-mark="false" :poppable="false" :show-confirm="false" :row-height="'3rem'" :min-date="minDate" :style="{ borderRadius: '0.3rem' }">
+        <template #month-title></template>
+      </van-calendar>
     </div>
 
     <!-- 日程安排 -->
@@ -107,4 +108,10 @@ useLifecycle({
   width: 48px;
   height: 51px;
 }
+.setCaleStrle ::v-deep .van-calendar__month-title {
+  display: none;
+}
+.setCaleStrle ::v-deep .van-calendar__month {
+  padding: 0.8rem 0 0.5rem 0;
+}
 </style>

+ 14 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/defaultData.js

@@ -0,0 +1,14 @@
+/**
+ * 默认相关产品数据字段
+ */
+export const defaultRelatedProductDataFields = {
+  productId: "", // 产品id
+  productType: "", // 产品类型
+  unit: "", // 单位
+  price: "", // 标准价格
+  inventory: "", // 库存
+  sellingPrice: "", // 售价
+  quantity: "", // 数量
+  discount: "", // 折扣
+  totalPrice: "", // 总价
+}

Разлика између датотеке није приказан због своје велике величине
+ 14 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/generalVariables.js