Ver código fonte

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 9 meses atrás
pai
commit
cdfb2f945d

+ 20 - 7
src/components/FormUI/cascade/index.vue

@@ -2,7 +2,7 @@
 <template>
   <div>
     <div style="height: 50px;"></div>
-    <v-text-field
+    <!-- <v-text-field
       v-model="value"
       variant="outlined" 
       id="menu-activator"
@@ -14,14 +14,21 @@
     >
     </v-text-field>
     <v-menu activator="#menu-activator" :close-on-content-click="closeOnContentClick">
-      <!-- <el-cascader-panel
+      <el-cascader-panel
         v-model="value"
         :options="options"
+        :show-all-levels="false"
         style="width: fit-content; background-color: #fff;"
         @change="handleChange"
       >
-      </el-cascader-panel> -->
-    </v-menu>
+      </el-cascader-panel>
+    </v-menu> -->
+
+    <el-cascader :options="options" :show-all-levels="false">
+      <template #default="{ node, data }">
+        <span @click="handleChange(node, data)">123</span>
+      </template>
+    </el-cascader>
   </div>
 </template>
 
@@ -37,9 +44,15 @@ defineOptions({ name:'FormUI-el-cascade'})
 const value = ref('')
 // setTimeout(() => { value.value = 'controllability' }, 1000)
 
-// const handleChange = (val, val1, val2) => {
-//   console.log('1', val, val1, val2)
-// }
+
+const handleChange = (val, val1, val2) => {
+  console.log('1', val, val1, val2)
+}
+
+const getCheckedNodes = (val, val1, val2) => {
+  console.log('1', val, val1, val2)
+  debugger
+}
 
 const closeOnContentClick = ref(false) // multiple
 

+ 176 - 0
src/components/FormUI/datePicker/index copy.vue

@@ -0,0 +1,176 @@
+<template>
+  <div :style="{ width: item.width ? item.width + 'px' : '100%' }">
+    <div class="d-flex">
+      <VueDatePicker
+        v-model="value"
+        ref="datepicker"
+        :options="item.options || {}"
+        locale="zh-CN"
+        :disabled="soFar || item.disabled || false"
+        :range="item.range || false"
+        :model-type="timestamp"
+        :month-picker="month"
+        :time-picker="time"
+        :year-picker="year"
+        auto-apply
+        text-input
+        :show-now-button="item.showToday"
+        now-button-label="今天"
+        :enable-time-picker="item.enableTimePicker ?? false"
+        :clearable="item.clearable ?? true"
+        :day-names="['一', '二', '三', '四', '五', '六', '七']"
+        v-bind="$attrs"
+        :class="{'detailMargin': detailMargin}"
+        style="flex: 1"
+        @open="handleOpen"
+        @closed="handleClosed"
+        @update:modelValue="modelValueUpDate"
+      >
+        <template #trigger>
+          <v-text-field
+            v-model="formatText"
+            variant="outlined"
+            :density="item.dense || 'compact'"
+            type="text"
+            :rules="soFar ? [] : rules"
+            :disabled="soFar || item.disabled"
+            :style="{width: item.width}"
+            :color="item.color || 'primary'"
+            :label="item.label"
+            :placeholder="item.placeholder || item.label"
+            :autofocus="item.autofocus"
+            :required="item.required"
+            :suffix="item.suffix"
+            :append-icon="item.appendIcon"
+            :append-inner-icon="item.appendInnerIcon"
+            :clearable="item.clearable"
+            :readonly="true"
+            :counter="item.counter"
+            :prepend-inner-icon="item.prependInnerIcon"
+            hide-spin-buttons
+            :class="item.class"
+            :hide-details="hideDetails || false"
+            @click:clear="handleClear"
+            @click="inputClick"
+            @blur="inputBlur"
+          ></v-text-field>
+        </template>
+      </VueDatePicker>
+      <div>
+        <v-checkbox-btn
+          v-if="item.showSoFar"
+          v-model="soFar"
+          color="primary"
+          :label="$t('sys.soFar')"
+          class="ml-2"
+          :disabled="item.disabled"
+          :style="`line-height: ${item.dense === 'default' ? 56 : item.dense === 'comfortable' ? 48 : 40 }px;`"
+          hide-details
+          @update:modelValue="handleCheckboxChange"
+        ></v-checkbox-btn>
+      </div>
+    </div>
+  </div>
+</template>
+<script setup>
+import { timesTampChange } from '@/utils/date'
+import { computed, ref } from 'vue'
+defineOptions({ name:'FormUI-v-text-field'})
+
+const props = defineProps({item: Object, modelValue: [String, Number, Boolean], changeFn: Function})
+const emit = defineEmits(['update:modelValue', 'change'])
+const item = props.item
+
+const value = ref(props.modelValue === true ? null : props.modelValue)
+const soFar = ref(false)
+
+// watch(
+//   () => props.modelValue, 
+//   (newVal) => {
+//     if (newVal === true) {
+//       value.value = ''
+//       soFar.value = !newVal
+//     }
+//   },
+//   { immediate: true },
+//   { deep: true }
+// )
+
+const timestamp = 'timestamp' // 固定不能变
+const formatText = ref('')
+
+const modelValueUpDate = (val) => {
+  value.value = val
+  getFormatText()
+  emit('update:modelValue', value.value)
+  emit('change', value.value)
+}
+
+const getFormatText = () => {
+  const format = item.format || 'Y-M-D'
+  formatText.value = timesTampChange(value.value, format)
+}
+
+const handleClear = () => {
+  value.value = null
+  emit('change', value.value)
+}
+
+const rules = ref(item.rules)
+const handleOpen = () => {
+  rules.value = []
+}
+const handleClosed = () => {
+  rules.value = item.rules
+}
+
+const hideDetails = ref(item.hideDetails || false)
+const detailMargin = ref(false)
+const inputClick = () => {
+  if (item.hideDetails) return
+  hideDetails.value = true
+  detailMargin.value = true
+}
+const inputBlur = () => {
+  if (item.hideDetails) return
+  hideDetails.value = item.hideDetails || false
+  detailMargin.value = false
+}
+
+// dateType: 默认 date, 即年月日
+const year = computed(() => {
+  return item.dateType === 'year'
+})
+const month = computed(() => {
+  return item.dateType === 'month'
+})
+const time = computed(() => {
+  return item.dateType === 'time'
+})
+
+if (!item.format) item.format = year.value ? 'Y' : month.value ? 'Y-M' : time.value ? 'Y-M-D h:m:s' : 'Y-M-D'
+if (item.value) value.value = item.value; getFormatText()
+
+
+// 《至今》复选框事件
+const handleCheckboxChange = (val) => {
+  rules.value = val ? [] : item.rules
+  if (val) {
+    modelValueUpDate(null)
+  } else {
+    modelValueUpDate(null)
+  }
+}
+// if (soFar.value) handleCheckboxChange(soFar.value)
+
+</script>
+<style lang="scss" scoped>
+// .removeDetailHeight {}
+:deep(.dp--menu-wrapper) {
+  // top: 50px !important;
+  left: 0 !important;
+}
+.detailMargin {
+  margin-bottom: 22px;
+}
+</style>

+ 9 - 29
src/components/FormUI/datePicker/index.vue

@@ -56,33 +56,25 @@
           ></v-text-field>
         </template>
       </VueDatePicker>
-      <div>
-        <v-checkbox-btn
-          v-if="item.showSoFar"
-          v-model="soFar"
-          color="primary"
-          :label="$t('sys.soFar')"
-          class="ml-2"
-          :disabled="item.disabled"
-          :style="`line-height: ${item.dense === 'default' ? 56 : item.dense === 'comfortable' ? 48 : 40 }px;`"
-          hide-details
-          @update:modelValue="handleCheckboxChange"
-        ></v-checkbox-btn>
-      </div>
     </div>
   </div>
 </template>
 <script setup>
 import { timesTampChange } from '@/utils/date'
-import { computed, ref } from 'vue'
+import { computed, ref, watch } from 'vue'
 defineOptions({ name:'FormUI-v-text-field'})
 
-const props = defineProps({item: Object})
+const props = defineProps({item: Object, modelValue: [String, Number, Boolean], changeFn: Function})
 const emit = defineEmits(['update:modelValue', 'change'])
 const item = props.item
 
 const value = ref(props.modelValue)
-const soFar = ref(item.value - 0 === -28800000 ? true : false)
+const soFar = ref(false)
+
+watch(() => item.value, (newVal) => {
+  value.value = newVal - 0
+  if (value.value) getFormatText()
+})
 
 const timestamp = 'timestamp' // 固定不能变
 const formatText = ref('')
@@ -137,19 +129,7 @@ const time = computed(() => {
 })
 
 if (!item.format) item.format = year.value ? 'Y' : month.value ? 'Y-M' : time.value ? 'Y-M-D h:m:s' : 'Y-M-D'
-if (item.value) value.value = item.value - 0; getFormatText()
-
-
-// 《至今》复选框事件
-const handleCheckboxChange = (val) => {
-  rules.value = val ? [] : item.rules
-  if (val) {
-    modelValueUpDate(-28800000)
-  } else {
-    modelValueUpDate(null)
-  }
-}
-if (soFar.value) handleCheckboxChange(soFar.value)
+if (item.value) value.value = item.value; getFormatText()
 
 </script>
 <style lang="scss" scoped>

+ 49 - 35
src/components/pay/index.vue

@@ -96,9 +96,9 @@ const loading = ref(true)
 const tip = ref('')
 
 // 步骤:
-//      1. 创建支付订单(先获取有无创建的,没有就创建)
-//      2. 获取支付方式类型列表
-//      3. 如果是二维码类型支付(isQrCodePay=true)生成二维码(需要第一步的订单号绑定
+//      1. 获取支付方式类型列表getCodeList
+//      2. 创建支付订单(先获取有无创建的,没有就创建)getUnpaidOrderList
+//      3. 如果是二维码类型支付(isQrCodePay=true)生成二维码(需要绑定支付订单的订单号
 
 
 const balance = JSON.parse(localStorage.getItem('enterpriseUserAccount'))?.balance || 0
@@ -106,7 +106,35 @@ const balanceNotEnough = computed(() => {
   return (Number(props.cost) > Number(balance))
 })
 
-const payOrder = ref({}) // 支付订单
+
+// 生成二维码内容
+const timer = ref(null)
+onUnmounted(() => {
+  if (timer.value) clearInterval(timer.value); timer.value = null
+})
+const initPayQrCode = async () => { // 生成二维码内容
+  if (!payOrder.value?.id || !payOrder.value.notifyUrl || !payType.value) return
+  if (timer.value) clearInterval(timer.value); timer.value = null
+  try {
+    if (payOrder.value) {
+      // 提交支付订单
+      const params = {
+        id: payOrder.value.id, // 支付单编号
+        channelCode: payType.value, // 支付渠道
+        displayMode: payOrder.value.notifyUrl, // 展示模式 notifyUrl
+        // returnUrl: location.href, // 支付成功后,支付渠道跳转回当前页;再由当前页,跳转回 {@link returnUrl} 对应的地址
+      }
+      const res = await payOrderSubmit(params)
+      payQrCodeTxt.value = res?.displayContent || '' // 支付二维码
+      timer.value = setInterval(() => { payStatus() }, 1000) // 轮巡查询用户是否支付
+    }
+  } catch (error) {
+    console.log(error)
+  }
+}
+
+// 2.支付订单
+const payOrder = ref({})
 let maxCount = 0
 const getUnpaidOrderList = async () => {
   try {
@@ -127,42 +155,16 @@ const getUnpaidOrderList = async () => {
     }
     // 
     payOrder.value = data?.payOrder || null
-    initPayQrCode() // 生成二维码内容
+    if (isQrCodePay.value) initPayQrCode() // 生成二维码内容
   } catch (error) {
     console.log(error)
   } finally {
     loading.value = false
   }
 }
-getUnpaidOrderList() // getUnpaidOrder
+// getUnpaidOrderList() // getUnpaidOrder
 
 
-// 生成二维码内容
-const timer = ref(null)
-onUnmounted(() => {
-  if (timer.value) clearInterval(timer.value); timer.value = null
-})
-const initPayQrCode = async () => { // 生成二维码内容
-  if (!payOrder.value?.id || !payOrder.value.notifyUrl || !payType.value) return
-  if (timer.value) clearInterval(timer.value); timer.value = null
-  try {
-    if (payOrder.value) {
-      // 提交支付订单
-      const params = {
-        id: payOrder.value.id, // 支付单编号
-        channelCode: payType.value, // 支付渠道
-        displayMode: payOrder.value.notifyUrl, // 展示模式 notifyUrl
-        // returnUrl: location.href, // 支付成功后,支付渠道跳转回当前页;再由当前页,跳转回 {@link returnUrl} 对应的地址
-      }
-      const res = await payOrderSubmit(params)
-      payQrCodeTxt.value = res?.displayContent || '' // 支付二维码
-      timer.value = setInterval(() => { payStatus() }, 1000) // 轮巡查询用户是否支付
-    }
-  } catch (error) {
-    console.log(error)
-  }
-}
-
 // 支付方式
 const isWalletPay = ref(false)
 const isQrCodePay = ref(false)
@@ -174,8 +176,7 @@ const payTypeChange = (value) => {
   initPayQrCode() // 生成二维码内容
   emit('payTypeChange', value, balanceNotEnough)
 }
-
-// 支付方式
+// 1.支付方式
 const payType = ref('')
 const payTypeList = ref([])
 const sharedState = useSharedState()
@@ -204,6 +205,7 @@ const getCodeList = async () => {
         }
       })
     }
+    getUnpaidOrderList()
   }
 }
 getCodeList()
@@ -218,15 +220,27 @@ const walletPaySubmit = () => {
 }
 
 import Snackbar from '@/plugins/snackbar'
+import { useRoute } from 'vue-router'; const route = useRoute()
 import { useRouter } from 'vue-router'; const router = useRouter()
 const payStatus = async () => {
+  // if (timer.value) clearInterval(timer.value); timer.value = null
+  // setTimeout(() => {
+  //   console.log('fullPath1', route.fullPath)
+  //   console.log('returnUrl2',props.returnUrl)
+  //   debugger
+  //   if (route.fullPath === props.returnUrl) router.go(0)
+  //   else if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
+  //   else emit('paySuccess')
+  //   Snackbar.success('付款成功')
+  // }, 2000)
   try {
     const data = await getOrderPayStatus({ id: payOrder.value.id })
     if ((data?.status - 0) === 10) {
       // 支付成功
       if (timer.value) clearInterval(timer.value); timer.value = null
       setTimeout(() => {
-        if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
+        if (route.fullPath === props.returnUrl) router.go(0)
+        else if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
         else emit('paySuccess')
         Snackbar.success('付款成功')
       }, 1000);

+ 2 - 1
src/utils/position.js

@@ -91,7 +91,8 @@ const getRation = async () => {
 getRation()
 
 export const commissionCalculation = (count, type) => {
-  if (count && type === 'realPay') return ((count - 0)/100) // 众聘发布需要支付金额(需要统一除以100)
+  if (count && type === 'emitPay') return ((count - 0)*100) // 众聘职位金额回显需要除以100
+  if (count && type === 'realPay') return ((count - 0)/100) // 众聘职位发布金额需要提交时需要乘以100
   if (!data || !Object.keys(data).length) return
   const ratio = parseFloat(data[list[type]]) / 100
   const value = (count * ratio)/100 // 后端需要除100

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

@@ -121,7 +121,7 @@ const getPositionDetail = async (id) => {
 if (route.query && route.query.id) {
   if (route.query.id) getPositionDetail(route.query.id)
 }
-// getPositionDetail('1821495780406075393') // 测试使用
+// getPositionDetail('1824338255638728705') // 测试使用
 
 // 取消
 const handleCancel = (hire) => { //  hire:是否是众聘岗位

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

@@ -248,6 +248,7 @@ watch(
         return
       }
       if (e.noParam) return
+      if (e.key === 'hirePrice') return e.value = commissionCalculation(val[e.key], 'realPay')
       e.value = val[e.key]
       e.change && e.change(e.value)
     })
@@ -285,8 +286,10 @@ const getQuery = async () => {
   if (!obj.hire) {
     // obj.hirePoint = 0
     obj.hirePrice = 0
+  } else {
+    obj.hirePrice = commissionCalculation(obj.hirePrice, 'emitPay')
   }
-  obj.hirePrice = (obj.hirePrice - 0)*100 // 后端需要
+  
   query = Object.assign(query, obj)
   return query
 }

+ 1 - 1
src/views/recruit/enterprise/positionManagement/index.vue

@@ -57,7 +57,7 @@ const query = ref({
 
 const showHire = (route.query?.hire - 0) || 0
 const tab = ref(showHire ? 4: 1)
-if (showHire) history.replaceState({ ...route.query, hire: 0 }, '', route.path) // 更新浏览器历史记录,不触发页面重新加载 ( 目的:去除目标参数 )
+// if (showHire) history.replaceState({ ...route.query, hire: 0 }, '', route.path) // 更新浏览器历史记录,不触发页面重新加载 ( 目的:去除目标参数 )
 
 const tabList = [
   { label: t('position.recruitmentInProgress'), value: 1 },