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

发布众聘改为给点数,计算方式修改(点数抠除及回显都不需要乘除)

lifanagju_citu пре 9 месеци
родитељ
комит
c7655b132f

+ 1 - 1
src/components/pay/confirmPaymentDialog.vue

@@ -38,7 +38,7 @@ const handleClose = () => {
 }
 }
 const paySuccess = () => {
 const paySuccess = () => {
   emit('paySuccess')
   emit('paySuccess')
-  payDialog.value = false
+  // payDialog.value = false
 }
 }
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 17 - 4
src/components/pay/index.vue

@@ -13,8 +13,9 @@
 
 
     <!-- 赏金所需 -->
     <!-- 赏金所需 -->
     <div class="pt-3 pb-5" style="color: var(--v-error-base); font-weight: bold; text-align: center;">
     <div class="pt-3 pb-5" style="color: var(--v-error-base); font-weight: bold; text-align: center;">
-      <span class="font-size-13">¥</span>
+      <!-- <span class="font-size-13">¥</span> -->
       <span class="font-size-30">{{ cost }}</span>
       <span class="font-size-30">{{ cost }}</span>
+      <!-- <span class="font-size-13 ml-1">点数</span> -->
     </div>
     </div>
     <template v-if="payTypeList?.length">
     <template v-if="payTypeList?.length">
       <v-chip-group v-model="payType" selected-class="text-primary" column mandatory @update:modelValue="payTypeChange">
       <v-chip-group v-model="payType" selected-class="text-primary" column mandatory @update:modelValue="payTypeChange">
@@ -34,7 +35,11 @@
           </div>
           </div>
           <div class="my-3" v-if="balanceNotEnough">
           <div class="my-3" v-if="balanceNotEnough">
             <!-- <v-icon color="warning">mdi-information</v-icon> -->
             <!-- <v-icon color="warning">mdi-information</v-icon> -->
-            <span class="color-warning">{{ props.params?.txt || '当前余额不足,请选择其他支付方式' }}</span>
+            <!-- <span class="color-warning">{{ props.params?.txt || '当前余额不足,请选择其他支付方式' }}</span> -->
+            <span class="color-warning">
+              当前点数不足
+              <div class="recharge">充值</div>
+            </span>
           </div>
           </div>
         </div>
         </div>
         <!-- 二维码支付 -->
         <!-- 二维码支付 -->
@@ -260,7 +265,7 @@ const payStatus = async () => {
   //   Snackbar.success('付款成功')
   //   Snackbar.success('付款成功')
   // }, 2000)
   // }, 2000)
   try {
   try {
-    const data = await getOrderPayStatus({ id: payOrder.value.id })
+    const data = await getOrderPayStatus({ id: (props.appId - 0) === 11 ? payOrder.value.payOrderId : payOrder.value.id })
     if ((data?.status - 0) === 10) {
     if ((data?.status - 0) === 10) {
       // 支付成功
       // 支付成功
       if (timer.value) clearInterval(timer.value); timer.value = null
       if (timer.value) clearInterval(timer.value); timer.value = null
@@ -269,7 +274,7 @@ const payStatus = async () => {
         else if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
         else if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
         emit('paySuccess', isWalletPay.value)
         emit('paySuccess', isWalletPay.value)
         Snackbar.success('付款成功')
         Snackbar.success('付款成功')
-      }, 1000);
+      }, 2000);
     }
     }
   } catch (error) {
   } catch (error) {
     console.log(error)
     console.log(error)
@@ -279,4 +284,12 @@ const payStatus = async () => {
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .font-size-30 { font-size: 30px; }
 .font-size-30 { font-size: 30px; }
+.recharge {
+  margin: 12px;
+  color: red;
+  cursor: pointer;
+  &:hover {
+    color: rgba(255, 0, 0, 0.6);
+  }
+}
 </style>
 </style>

+ 11 - 5
src/utils/position.js

@@ -90,11 +90,17 @@ const getRation = async () => {
 }
 }
 getRation()
 getRation()
 
 
-export const commissionCalculation = (count, type, status) => {
-  if (count && type === 'emitPay') return ((count - 0)*100) // 众聘职位金额回显需要除以100
-  if (count && type === 'realPay') return ((count - 0)/100) // 众聘职位发布金额需要提交时需要乘以100
+export const commissionCalculation = (count, type) => {
   if (!data || !Object.keys(data).length) return
   if (!data || !Object.keys(data).length) return
-  const ratio = parseFloat(data[list[type]]) / 100
-  const value = status ? count * ratio : (count * ratio) / 100 // 后端需要除100
+  // 所占的百分比
+  const ratio = parseFloat(data[list[type]]) / 100 // 所占的百分比-> 50%变为0.5 (不能改)
+  // 积分变成金额
+  const value = count * ratio / 10
   return value % 1 === 0 ? Math.floor(value) : value.toFixed(2)
   return value % 1 === 0 ? Math.floor(value) : value.toFixed(2)
+}
+
+// type: emit-> 提交(需要*100) real-> 回显(需要/100)
+export const payCalculation = (count, type) => {
+  const Magnification = type === 'show' ? 1/100 : 100
+  return ((count - 0)*Magnification).toFixed(2)
 }
 }

+ 21 - 23
src/views/recruit/enterprise/memberCenter/myMembers/components/pointsAndBalance.vue

@@ -13,8 +13,8 @@
         @click="current = index + 1; price = item.price"
         @click="current = index + 1; price = item.price"
       >
       >
         <div class="d-flex flex-column align-center pb-5" style="position: relative;">  
         <div class="d-flex flex-column align-center pb-5" style="position: relative;">  
-          <div class="my-4 font-size-16 font-weight-bold titleColor">{{ item.name }}</div>  
-          <div class="font-weight-bold priceBox">
+          <div class="my-5 font-size-16 font-weight-bold titleColor">{{ item.name }}</div>  
+          <div class="font-weight-bold priceBox mt-3">
             <span v-if="item.custom">
             <span v-if="item.custom">
               <input 
               <input 
                 v-model="item.payPrice" 
                 v-model="item.payPrice" 
@@ -25,16 +25,18 @@
                 @focus="item.tip = '输入完成后请按Enter键确认'"
                 @focus="item.tip = '输入完成后请按Enter键确认'"
               >
               >
             </span>
             </span>
-            <span class="font28" v-else>{{ calcFun(item.payPrice, true) }}</span>
+            <span class="font28" v-else>¥{{ payCalculation(item.payPrice, 'real') }}</span>
           </div>  
           </div>  
-          <div class="dailyPrice font-size-12 mt-3">
+          <!-- <div class="dailyPrice font-size-12 mt-3">
             <span v-if="!item.custom">¥{{ calcFun(item.payPrice, true) }}</span>
             <span v-if="!item.custom">¥{{ calcFun(item.payPrice, true) }}</span>
             <span v-else>{{ item.tip }}</span>
             <span v-else>{{ item.tip }}</span>
-          </div>
-          <span class="mt-3" @click="handleRecharge(item)">立即充值</span>
+          </div> -->
+          <!-- <span class="mt-3" @click="handleRecharge(item)">立即充值</span> -->
+          <v-btn class="mt-8" size="small" color="error" variant="outlined" rounded @click="handleRecharge(item)">立即充值</v-btn>
           <div class="vip">
           <div class="vip">
-            <svg-icon v-if="current === (index+1)" name="diamond-active" size="50"></svg-icon>
-            <svg-icon v-else name="diamond" size="50"></svg-icon>
+            <!-- <svg-icon v-if="current === (index+1)" name="diamond-active" size="50"></svg-icon>
+            <svg-icon v-else name="diamond" size="50"></svg-icon> -->
+            <svg-icon name="diamond" size="50"></svg-icon>
           </div> 
           </div> 
         </div> 
         </div> 
       </div>
       </div>
@@ -78,7 +80,7 @@
   <confirmPaymentDialog
   <confirmPaymentDialog
     v-if="showConfirmPaymentDialog"
     v-if="showConfirmPaymentDialog"
     :appId="11"
     :appId="11"
-    :cost="calcFun(rechargeDataItem.payPrice, true)"
+    :cost="payCalculation(rechargeDataItem.payPrice, 'real')"
     :rechargeInfo="rechargeDataItem"
     :rechargeInfo="rechargeDataItem"
     @paySuccess="paySuccess"
     @paySuccess="paySuccess"
     @close="showConfirmPaymentDialog = false"
     @close="showConfirmPaymentDialog = false"
@@ -91,6 +93,7 @@ import { ref } from 'vue'
 import Public from './public.vue'
 import Public from './public.vue'
 // import QrCode from '@/components/QrCode'
 // import QrCode from '@/components/QrCode'
 import { getEnterpriseRechargePackageList } from '@/api/recruit/enterprise/member/points'
 import { getEnterpriseRechargePackageList } from '@/api/recruit/enterprise/member/points'
+import { payCalculation } from '@/utils/position'
 
 
 defineProps({
 defineProps({
   showTitle: {
   showTitle: {
@@ -135,7 +138,6 @@ getData()
 const rechargeDataItem = ref(null)
 const rechargeDataItem = ref(null)
 const showConfirmPaymentDialog = ref(false)
 const showConfirmPaymentDialog = ref(false)
 const handleRecharge = (item) => {
 const handleRecharge = (item) => {
-  // rechargeDataItem.value = { ...item, payPrice: calcFun(item.payPrice, show) }
   rechargeDataItem.value = { ...item }
   rechargeDataItem.value = { ...item }
   // 打开支付弹窗
   // 打开支付弹窗
   showConfirmPaymentDialog.value = true
   showConfirmPaymentDialog.value = true
@@ -148,10 +150,6 @@ const paySuccess = async () => {
   await store.getEnterpriseUserAccountInfo()
   await store.getEnterpriseUserAccountInfo()
 }
 }
 
 
-const calcFun = (value, show) => { // show除以一百,提交乘以一百
-  const Magnification = show ? 1/100 : 100
-  return ((value - 0)*Magnification).toFixed(2)
-}
 
 
 </script>
 </script>
 
 
@@ -168,15 +166,15 @@ const calcFun = (value, show) => { // show除以一百,提交乘以一百
   color: var(--color-666);
   color: var(--color-666);
 }
 }
 .active {
 .active {
-  border: 2px solid #cf990c;
-  background: linear-gradient(rgb(255, 242, 214) 8.86%, rgb(255, 225, 177) 100%);;
-  .priceBox {
-    color: var(--v-error-base);
-  }
-  .dailyPrice {
-    color: var(--v-error-base);
-    background-color: #fff4e7;
-  }
+  // border: 2px solid #cf990c;
+  // background: linear-gradient(rgb(255, 242, 214) 8.86%, rgb(255, 225, 177) 100%);;
+  // .priceBox {
+  //   color: var(--v-error-base);
+  // }
+  // .dailyPrice {
+  //   color: var(--v-error-base);
+  //   background-color: #fff4e7;
+  // }
 }
 }
 .custom-input-num {
 .custom-input-num {
   border: none;
   border: none;

+ 7 - 8
src/views/recruit/enterprise/positionManagement/components/add.vue

@@ -77,14 +77,13 @@ const handleSave = async () => {
   if (!baseInfo?.hire) {
   if (!baseInfo?.hire) {
     saveEmit(submitParams)
     saveEmit(submitParams)
   } else {
   } else {
-    if (!baseInfo.hirePrice && !baseInfo.hirePoint) return Snackbar.warning('您选择的是众聘岗位,请填写奖励赏金或积分!')
-    if (Number(baseInfo.hirePrice) === 0 && Number(baseInfo.hirePoint) === 0) return Snackbar.warning('填写的赏金/积分不得小于1')
-    
-    const point = JSON.parse(localStorage.getItem('enterpriseUserAccount'))?.point
-    if (Number(baseInfo.hirePoint) && (Number(baseInfo.hirePoint) > Number(point))) {
-      // 积分不足
-      return Snackbar.warning('您所剩的积分不足,请修改奖励的积分!')
-    }
+    if (!baseInfo.hirePrice) return Snackbar.warning('您选择的是众聘岗位,请填写点数!') // 或积分
+    // if (Number(baseInfo.hirePrice) === 0 && Number(baseInfo.hirePoint) === 0) return Snackbar.warning('填写的赏金不得小于10')
+    // const point = JSON.parse(localStorage.getItem('enterpriseUserAccount'))?.point
+    // if (Number(baseInfo.hirePoint) && (Number(baseInfo.hirePoint) > Number(point))) {
+    //   // 积分不足
+    //   return Snackbar.warning('您所剩的积分不足,请修改奖励的积分!')
+    // }
     saveEmit(submitParams) // 正常发布,到列表中发起支付(暂定解决方案)
     saveEmit(submitParams) // 正常发布,到列表中发起支付(暂定解决方案)
     // needPrice.value = Number(baseInfo.hirePrice)
     // needPrice.value = Number(baseInfo.hirePrice)
     // // 生成订单
     // // 生成订单

+ 19 - 8
src/views/recruit/enterprise/positionManagement/components/baseInfo.vue

@@ -76,9 +76,9 @@ const show = ref(false)
 const ratio = ref({})
 const ratio = ref({})
 
 
 // 按分配比例计算金额积分
 // 按分配比例计算金额积分
-const calculation = (key, type, status) => {
+const calculation = (key, type) => {
   const value = items.value.options.find(e => e.key === key).value
   const value = items.value.options.find(e => e.key === key).value
-  return commissionCalculation(value, type, status)
+  return commissionCalculation(value, type)
 }
 }
 
 
 const getValue = (key) => {
 const getValue = (key) => {
@@ -132,13 +132,14 @@ const items = ref({
       type: 'number',
       type: 'number',
       key: 'hirePrice',
       key: 'hirePrice',
       value: null,
       value: null,
-      label: '请填写众聘赏金',
-      suffix: '',
-      integer: true,
+      label: '请填写点数 (1赏金=10点数,点数填入不得少于10且为10的倍数)',
+      suffix: '',
+      // integer: true,
       hide: true,
       hide: true,
       show: true,
       show: true,
       disabled: false,
       disabled: false,
       hideDetails: true,
       hideDetails: true,
+      change: val => hirePriceChange(val, 'hirePrice')
       // col: 6,
       // col: 6,
       // flexStyle: 'mr-3'
       // flexStyle: 'mr-3'
     },
     },
@@ -248,7 +249,6 @@ watch(
         return
         return
       }
       }
       if (e.noParam) return
       if (e.noParam) return
-      if (e.key === 'hirePrice') return e.value = commissionCalculation(val[e.key], 'realPay')
       e.value = val[e.key]
       e.value = val[e.key]
       e.change && e.change(e.value)
       e.change && e.change(e.value)
     })
     })
@@ -274,6 +274,19 @@ const handleViewRule = () => {
   show.value = true
   show.value = true
 }
 }
 
 
+// 众聘规则查看
+const hirePriceChange = (value, key) => {
+  let calcCost = value-0
+  if (calcCost < 10 ) calcCost = 10
+  else {
+    calcCost = parseInt(calcCost/10)*10
+  }
+  const obj = items.value.options.find(k => k.key === key)
+  if (obj) {
+    obj.value = calcCost
+  }
+}
+
 const getQuery = async () => {
 const getQuery = async () => {
   const { valid } = await formPageRef.value.formRef.validate()
   const { valid } = await formPageRef.value.formRef.validate()
   if (!valid) return
   if (!valid) return
@@ -286,8 +299,6 @@ const getQuery = async () => {
   if (!obj.hire) {
   if (!obj.hire) {
     // obj.hirePoint = 0
     // obj.hirePoint = 0
     obj.hirePrice = 0
     obj.hirePrice = 0
-  } else {
-    obj.hirePrice = commissionCalculation(obj.hirePrice, 'emitPay')
   }
   }
   
   
   query = Object.assign(query, obj)
   query = Object.assign(query, obj)

+ 1 - 1
src/views/recruit/enterprise/positionManagement/components/item.vue

@@ -108,7 +108,7 @@ const spuName = ref('')
 const toPay = (val) => {
 const toPay = (val) => {
   spuId.value = val.id || ''
   spuId.value = val.id || ''
   spuName.value = val.name || ''
   spuName.value = val.name || ''
-  cost.value = commissionCalculation(val.hirePrice, 'realPay')
+  cost.value = val.hirePrice
   // 打开支付弹窗
   // 打开支付弹窗
   showConfirmPaymentDialog.value = true
   showConfirmPaymentDialog.value = true
 }
 }