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

Merge remote-tracking branch 'origin/master'

24282 пре 8 месеци
родитељ
комит
ecf9416525

+ 228 - 0
jy-ui/src/components/PDF/contractPDF.vue

@@ -0,0 +1,228 @@
+<template>
+  <div>
+    <div id="pdfDom" style="width: 776px; padding: 20px">
+      <div style="font-size: 22px; text-align: center">销售合同</div>
+      <div style="display: flex; justify-content: space-between; margin-top: 10px">
+        <div>供方:福州佰易来贸易有限公司</div>
+        <div style="width: 40%">合同编号:{{ formData.code }}</div>
+      </div>
+      <div style="display: flex; justify-content: space-between; margin-top: 10px">
+        <div>需方:{{ formData.customerCorporationName }}</div>
+        <div style="width: 40%">签订时间:{{ conversionDate(formData.signingDate) }}</div>
+      </div>
+      <div style="margin-top: 10px">一、产品名称、货号、规格、颜色、数量、单价、金额。</div>
+      <table cellspacing="0" border="2" style="width: 100%">
+        <thead>
+          <td style="width: 40px">序号</td>
+          <td>产品名称</td>
+          <td>产品货号</td>
+          <td>产品规格</td>
+          <td style="width: 60px">颜色</td>
+          <td style="width: 50px">单位</td>
+          <td style="width: 60px">数量</td>
+          <td style="width: 50px">单价/元</td>
+          <td style="width: 70px">金额RMB/元</td>
+          <td>备注</td>
+        </thead>
+        <template v-if="formData.list && formData.list.length > 0">
+          <tr v-for="(item, index) in formData.list" :key="index">
+            <td>{{ index + 1 }}</td>
+            <td>{{ item.productName }}</td>
+            <td>{{ item.productCode }}</td>
+            <td>{{ item.productSpec }}</td>
+            <td>{{ item.productColour }}</td>
+            <td>{{ item.productUnit }}</td>
+            <td>{{ item.quantity }}</td>
+            <td>{{ item.unitPrice }}</td>
+            <td>{{ computeMoney(item) }}</td>
+            <td>{{ item.remark }}</td>
+          </tr>
+        </template>
+        <tr>
+          <td :colspan="6">合计:</td>
+          <td></td>
+          <td></td>
+          <td>{{ computeAllMoney(formData.list) }}</td>
+          <td></td>
+        </tr>
+        <tr>
+          <td :colspan="3">金额合计(人民币)大写:</td>
+          <td :colspan="7">RMB{{ numberToRMB(computeAllMoney(formData.list)) }}</td>
+        </tr>
+      </table>
+      <div style="margin-top: 10px">
+        二、税率:
+        <span style="color: red">{{ formData.taxRate ? formData.taxRate + '%' : '不含税' }}</span>
+      </div>
+      <div style="margin-top: 10px">
+        三、运输费用:
+        <span style="color: red">{{ formData.freight ? formData.freight : '不含运费' }}</span>
+      </div>
+      <div style="margin-top: 10px">
+        四、包装方式:
+        <span style="color: red">常规包装</span>
+      </div>
+      <div style="margin-top: 10px">
+        五、支付方式:
+        <span style="color: red">出货前付清全款</span>
+      </div>
+      <div style="margin-top: 10px">六、供方收款账号如下:</div>
+      <div
+        style="display: flex; justify-content: space-between; margin-top: 10px; margin-left: 24px"
+      >
+        <div style="width: 48%">
+          <div>1.对公收款帐号:591909834210066</div>
+          <div style="margin-top: 10px">开户行:招商银行股份有限公司福州屏山支行</div>
+        </div>
+        <div style="width: 48%">
+          <div>帐户名称:福州佰易来贸易有限公司</div>
+        </div>
+      </div>
+      <div style="margin-top: 10px">七、交(提)货点:{{ formData.deliveryAddress }}</div>
+      <div style="margin-top: 10px">八、违约责任:</div>
+      <div style="margin-top: 10px; margin-left: 24px">
+        1.延迟交货:乙方应按照本合同约定时间完成交货,除不可抗力外(指疫情、战争、严重火灾、水灾、台风和地震以及
+        其他经双方同意属不可抗力的事故),需延期交货的须向甲方提前沟通延期时间,如超出双方约定交期15天后仍未能交
+        货的,则向甲方支付合同总金额0.1%/天的违约金。
+      </div>
+      <div style="margin-top: 10px; margin-left: 24px">
+        2.延迟付款:甲方应按照本合同约定时间按时付款,除不可抗力外(指疫情、战争、严重火灾、水灾、台风和地震以及
+        其他经双方同意属不可抗力的事故),如超出双方约定时间15天后仍未能付款出货的,每延迟一天履行本合同约定之义
+        务的,则向乙方支付合同总额1%/天的违约金,如超出1个月仍未付款出货的,另外支付每平方20元/月(不足一月按一
+        月算)的场地租金费用给乙方。如超出3个月以上的,则视为甲方自主放弃改单订,乙方有权处理所有货物。
+      </div>
+      <div style="margin-top: 10px">
+        九、解决合同纠纷方式:双方友好协商,协商不成后可提出诉讼,诉讼地点为厂家总部的当地人民法院。
+      </div>
+      <div style="margin-top: 10px">
+        十、本合同一式两份,双方签章后生效;双方各执一份,传真、扫描件有效。
+      </div>
+      <div style="display: flex; justify-content: space-between; margin-top: 20px">
+        <div style="width: 48%">
+          <div style="text-align: center">供方:</div>
+        </div>
+        <div style="width: 48%">
+          <div style="text-align: center">需方:</div>
+        </div>
+      </div>
+      <div style="display: flex; justify-content: space-between; margin-top: 10px">
+        <div style="width: 48%">
+          <div>单位名称:福州佰易来贸易有限公司</div>
+        </div>
+        <div style="width: 48%">
+          <div>单位名称:{{ formData.customerCorporationName }}</div>
+        </div>
+      </div>
+      <div style="display: flex; justify-content: space-between; margin-top: 10px">
+        <div style="width: 48%">
+          <div>
+            单位地址:福建省福州市鼓楼区洪山镇洪山园路52号 单位地址:
+            (原工业路东侧、福三路北侧洪山园地块)华润万象城 (三期)S10#楼18层17办公
+          </div>
+        </div>
+        <div style="width: 48%">
+          <div>单位地址:{{ formData.customerCorporationAddress }}</div>
+        </div>
+      </div>
+      <div style="display: flex; justify-content: space-between; margin-top: 10px">
+        <div style="width: 48%">
+          <div>法定代表人:黄凯</div>
+          <div style="margin-top: 10px">业务联系人:翁本娟</div>
+          <div style="margin-top: 10px">联系电话:15985717925</div>
+        </div>
+        <div style="width: 48%">
+          <div>法定代表人:{{ formData.customerLegalRepresentative }}</div>
+          <div style="margin-top: 10px">业务联系人:{{ formData.customerContactPerson }}</div>
+          <div style="margin-top: 10px">联系电话:{{ formData.customerContactNumber }}</div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { StrAnyObj } from '@/typings'
+import { getDetailApi } from '@/api/business/contract/info'
+
+const props = defineProps({
+  rowData: Object
+})
+const formData = ref<StrAnyObj>({})
+onMounted(() => {
+  if (props?.rowData?.id) {
+    getDetailApi({ id: props.rowData.id }).then((res: StrAnyObj) => {
+      formData.value = res
+    })
+  }
+})
+const conversionDate = (time) => {
+  // 创建一个日期对象(例如当前日期)
+  let date = new Date(time)
+  // 提取年份、月份和日期
+  let year = date.getFullYear()
+  let month = (date.getMonth() + 1).toString().padStart(2, '0') // 月份从0开始,所以需要加1,并且用padStart填充前导零
+  let day = date.getDate().toString().padStart(2, '0') // 用padStart填充前导零
+  // 格式化日期为XXXX年X月X日
+  return `${year}年${month}月${day}日`
+}
+const computeMoney = (item) => {
+  let money = 0
+  if (item.quantity && item.unitPrice) {
+    let price = Number(item.unitPrice)
+    money = Number(Math.round(price * item.quantity * 100) / 100)
+  }
+  return money
+}
+const computeAllMoney = (list) => {
+  let money = 0
+  if (list && list.length > 0) {
+    for (let i = 0; i < list.length; i++) {
+      if (list[i].quantity && list[i].unitPrice) {
+        let price = Number(list[i].unitPrice)
+        money = Number(Math.round((money + price * list[i].quantity) * 100) / 100)
+      }
+    }
+  }
+  return money
+}
+const numberToRMB = (num) => {
+  const fraction = ['角', '分']
+  const digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
+  const unit = [
+    ['元', '万', '亿'],
+    ['', '拾', '佰', '仟']
+  ]
+  const head = num < 0 ? '负' : ''
+  num = Math.abs(num)
+  let s = ''
+  for (let i = 0; i < fraction.length; i++) {
+    s += (digit[Math.floor(num * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '')
+  }
+  s = s || '整'
+  num = Math.floor(num)
+  for (let i = 0; i < unit[0].length && num > 0; i++) {
+    let p = ''
+    for (let j = 0; j < unit[1].length && num > 0; j++) {
+      p = digit[num % 10] + unit[1][j] + p
+      num = Math.floor(num / 10)
+    }
+    s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s
+  }
+  return (
+    head +
+    s
+      .replace(/(零.)*零元/, '元')
+      .replace(/(零.)+/g, '零')
+      .replace(/^整$/, '零元整')
+  )
+}
+</script>
+
+<style lang="scss" scoped>
+* {
+  font-weight: bold;
+}
+td {
+  text-align: center;
+}
+</style>

+ 33 - 205
jy-ui/src/views/business/contract/info/index.vue

@@ -6,109 +6,19 @@ import { ColumnConfigType } from '@/components/ATable/type'
 import { StrAnyObj, StrAnyObjArr } from '@/typings'
 import { useHandleData } from '@/utils/useHandleData'
 import { getPageApi, getDetailApi, addApi, editApi, deleteApi } from '@/api/business/contract/info'
+import ContractPDF from '@/components/PDF/contractPDF.vue'
+import { getPdf } from '@/utils/getPdf.js'
 
 const queryRef = ref<InstanceType<typeof AForm>>()
 const formRef = ref<InstanceType<typeof AForm>>()
-
-const showQuery = ref<boolean>(true)
-const selectKeys = ref<string[]>([])
 const pageTotal = ref<number>(0)
-
 const queryData = ref<StrAnyObj>({ pageNum: 1, pageSize: 10 })
 const tableData = ref<StrAnyObjArr>([])
 const formData = ref<StrAnyObj>({})
-
+const rowData = ref<StrAnyObj>({})
+const dialogPrint = ref<boolean>(false)
 const dialogTitle = ref<string>('')
 const dialogVisible = ref<boolean>(false)
-
-const queryConfig: FormConfigType[] = [
-  {
-    type: 'input',
-    prop: 'capitalTransactionsId',
-    label: '资金流水id'
-  },
-  {
-    type: 'input',
-    prop: 'code',
-    label: '合同编号'
-  },
-  {
-    type: 'input',
-    prop: 'customerCorporationName',
-    label: '客户单位名称'
-  },
-  {
-    type: 'input',
-    prop: 'customerCorporation Address',
-    label: '客户单位地址'
-  },
-  {
-    type: 'input',
-    prop: 'customerLegalRepresentative',
-    label: '客户法定代表人'
-  },
-  {
-    type: 'input',
-    prop: 'customerContactPerson',
-    label: '客户业务联系人'
-  },
-  {
-    type: 'input',
-    prop: 'customerContactNumber',
-    label: '客户联系电话'
-  },
-  {
-    type: 'input',
-    prop: 'signingDate',
-    label: '签订日期'
-  },
-  {
-    type: 'input',
-    prop: 'totalAmount',
-    label: '合同总金额'
-  },
-  {
-    type: 'input',
-    prop: 'taxRate',
-    label: '税率'
-  },
-  {
-    type: 'input',
-    prop: 'freight',
-    label: '运费'
-  },
-  {
-    type: 'input',
-    prop: 'deliveryAddress',
-    label: '收货地址'
-  },
-  {
-    type: 'input',
-    prop: 'createUser',
-    label: '创建人'
-  },
-  {
-    type: 'input',
-    prop: 'createTime',
-    label: '创建时间'
-  },
-  {
-    type: 'input',
-    prop: 'updateUser',
-    label: '更新人'
-  },
-  {
-    type: 'input',
-    prop: 'updateTime',
-    label: '更新时间'
-  },
-  {
-    type: 'input',
-    prop: 'delFlag',
-    label: '逻辑删除标记'
-  },
-]
-
 const toolbarConfig: ToolbarConfigType[] = [
   {
     common: 'search',
@@ -116,38 +26,10 @@ const toolbarConfig: ToolbarConfigType[] = [
       queryData.value.pageNum = 1
       getPage()
     }
-  },
-  {
-    common: 'reset',
-    click() {
-      queryRef.value?.resetFields()
-      getPage()
-    }
-  },
-  {
-    common: 'add',
-    click() {
-      dialogVisible.value = true
-      dialogTitle.value = '新增'
-    }
-  },
-  {
-    common: 'delete',
-    disabled() {
-      return selectKeys.value.length == 0
-    },
-    click() {
-      handleRemove(selectKeys.value)
-    }
   }
 ]
-
 const columnConfig: ColumnConfigType[] = [
   {
-    prop: 'capitalTransactionsId',
-    label: '资金流水id'
-  },
-  {
     prop: 'code',
     label: '合同编号'
   },
@@ -156,7 +38,7 @@ const columnConfig: ColumnConfigType[] = [
     label: '客户单位名称'
   },
   {
-    prop: 'customerCorporation Address',
+    prop: 'customerCorporationAddress',
     label: '客户单位地址'
   },
   {
@@ -192,27 +74,7 @@ const columnConfig: ColumnConfigType[] = [
     label: '收货地址'
   },
   {
-    prop: 'createUser',
-    label: '创建人'
-  },
-  {
-    prop: 'createTime',
-    label: '创建时间'
-  },
-  {
-    prop: 'updateUser',
-    label: '更新人'
-  },
-  {
-    prop: 'updateTime',
-    label: '更新时间'
-  },
-  {
-    prop: 'delFlag',
-    label: '逻辑删除标记'
-  },
-  {
-    width: 250,
+    width: 120,
     handleConfig: [
       {
         common: 'update',
@@ -225,24 +87,18 @@ const columnConfig: ColumnConfigType[] = [
         }
       },
       {
-        common: 'delete',
+        text: '打印',
         click(row) {
-          handleRemove([row.id])
+          rowData.value = row
+          dialogPrint.value = true
         }
       }
     ]
   }
 ]
-
 const formConfig: FormConfigType[] = [
   {
     type: 'input',
-    prop: 'capitalTransactionsId',
-    label: '资金流水id',
-    rule: [{ required: true, message: '资金流水id不能为空', trigger: 'blur' }]
-  },
-  {
-    type: 'input',
     prop: 'code',
     label: '合同编号',
     rule: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }]
@@ -255,7 +111,7 @@ const formConfig: FormConfigType[] = [
   },
   {
     type: 'input',
-    prop: 'customerCorporation Address',
+    prop: 'customerCorporationAddress',
     label: '客户单位地址',
     rule: [{ required: true, message: '客户单位地址不能为空', trigger: 'blur' }]
   },
@@ -306,37 +162,7 @@ const formConfig: FormConfigType[] = [
     prop: 'deliveryAddress',
     label: '收货地址',
     rule: [{ required: true, message: '收货地址不能为空', trigger: 'blur' }]
-  },
-  {
-    type: 'input',
-    prop: 'createUser',
-    label: '创建人',
-    rule: [{ required: true, message: '创建人不能为空', trigger: 'blur' }]
-  },
-  {
-    type: 'input',
-    prop: 'createTime',
-    label: '创建时间',
-    rule: [{ required: true, message: '创建时间不能为空', trigger: 'blur' }]
-  },
-  {
-    type: 'input',
-    prop: 'updateUser',
-    label: '更新人',
-    rule: [{ required: true, message: '更新人不能为空', trigger: 'blur' }]
-  },
-  {
-    type: 'input',
-    prop: 'updateTime',
-    label: '更新时间',
-    rule: [{ required: true, message: '更新时间不能为空', trigger: 'blur' }]
-  },
-  {
-    type: 'input',
-    prop: 'delFlag',
-    label: '逻辑删除标记',
-    rule: [{ required: true, message: '逻辑删除标记不能为空', trigger: 'blur' }]
-  },
+  }
 ]
 
 onMounted(() => {
@@ -349,11 +175,6 @@ function getPage() {
     pageTotal.value = resp.total
   })
 }
-
-function tableSelectionChange(item: StrAnyObjArr) {
-  selectKeys.value = item.map((item) => item.id)
-}
-
 function formSubmit() {
   formRef.value?.validate(() => {
     if (formData.value.id) {
@@ -371,49 +192,56 @@ function formSubmit() {
     }
   })
 }
-
 function formClosed() {
   formRef.value?.resetFields()
 }
-
-function handleRemove(idList: string[]) {
-  useHandleData('是否确认删除?', () => {
-    deleteApi({ idList }).then(() => {
-      ElMessage.success('删除成功')
-      getPage()
-    })
-  })
+const printObj = ref({
+  id: 'pdfDom',
+  popTitle: '',
+  extraCss:
+    'https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css',
+  extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>'
+})
+const clickDownload = () => {
+  getPdf('合同' + rowData.value.code)
 }
 </script>
 
 <template>
   <div>
-    <el-card v-if="showQuery">
-      <a-form ref="queryRef" v-model="queryData" :config="queryConfig" :span="6"> </a-form>
-    </el-card>
-
     <a-table
       selection
       :data="tableData"
       :page-total="pageTotal"
       :toolbar-config="toolbarConfig"
       :column-config="columnConfig"
-      v-model:showQuery="showQuery"
       v-model:page-num="queryData.pageNum"
       v-model:page-size="queryData.pageSize"
       @page-num-change="getPage"
       @page-size-change="getPage"
-      @selection-change="tableSelectionChange"
     >
     </a-table>
 
     <a-dialog
+      v-if="dialogVisible"
       v-model="dialogVisible"
       :title="dialogTitle"
       @submit="formSubmit"
       @closed="formClosed"
+      width="600px"
     >
       <a-form ref="formRef" v-model="formData" :config="formConfig" :span="24"> </a-form>
     </a-dialog>
+
+    <a-dialog :footer="false" v-if="dialogPrint" v-model="dialogPrint" title="打印" width="880px">
+      <ContractPDF :rowData="rowData"></ContractPDF>
+      <template #footer>
+        <div>
+          <el-button @click="dialogPrint = false" size="large">取消</el-button>
+          <el-button type="primary" v-print="printObj" size="large">打印</el-button>
+          <el-button type="primary" @click="clickDownload()" size="large">下载PDF</el-button>
+        </div>
+      </template>
+    </a-dialog>
   </div>
 </template>

+ 16 - 8
jy-ui/src/views/business/payment/remit/index.vue

@@ -102,13 +102,13 @@ const toolbarConfig: ToolbarConfigType[] = [
       queryRef.value?.resetFields()
       getPage()
     }
-  // },
-  // {
-  //   common: 'add',
-  //   click() {
-  //     dialogVisible.value = true
-  //     dialogTitle.value = '新增'
-  //   }
+    // },
+    // {
+    //   common: 'add',
+    //   click() {
+    //     dialogVisible.value = true
+    //     dialogTitle.value = '新增'
+    //   }
   },
   {
     text: '导出',
@@ -406,6 +406,7 @@ const clickDownload = () => {
     </a-table>
 
     <a-dialog
+      v-if="dialogVisible"
       v-model="dialogVisible"
       :title="dialogTitle"
       :footer="!disabled"
@@ -426,7 +427,14 @@ const clickDownload = () => {
       </el-card>
     </a-dialog>
 
-    <a-dialog :footer="false" v-model="dialogPrint" title="打印" width="840px" height="200px">
+    <a-dialog
+      :footer="false"
+      v-if="dialogPrint"
+      v-model="dialogPrint"
+      title="打印"
+      width="840px"
+      height="200px"
+    >
       <MoneyPDF :rowData="rowData"></MoneyPDF>
       <template #footer>
         <div>

+ 2 - 1
jy-ui/src/views/business/payment/requests/index.vue

@@ -566,6 +566,7 @@ const clickDownload = () => {
     </a-table>
 
     <a-dialog
+      v-if="dialogVisible"
       v-model="dialogVisible"
       :title="dialogTitle"
       :footer="!disabled"
@@ -624,7 +625,7 @@ const clickDownload = () => {
       </a-form>
     </a-dialog>
 
-    <a-dialog :footer="false" v-if="dialogPrint" v-model="dialogPrint" title="打印" width="840px" height="200px">
+    <a-dialog :footer="false" v-if="dialogPrint" v-model="dialogPrint" title="打印" width="840px">
       <MoneyPDF :rowData="rowData"></MoneyPDF>
       <template #footer>
         <div>