浏览代码

招聘会-门票购买

Xiao_123 1 月之前
父节点
当前提交
af60379194

+ 7 - 1
components/payPopup/index.vue

@@ -208,12 +208,15 @@ let interTimer = null
 let payLoading = false
 const checkPayStatus = async (id) => {
   if (!id) return
+  uni.showLoading({ title: '加载中' })
   try {
     if (payLoading || !interTimer) return
     payLoading = true
     const res = await getOrderPayStatus({ id })
     if (res?.data?.status === 10) {
+      handleClose()
       if (interTimer) clearInterval(interTimer)
+      uni.hideLoading()
       uni.showToast({ title: '支付成功', icon: 'none'})
       setTimeout(async () => {
         emit('paySuccess')
@@ -221,6 +224,9 @@ const checkPayStatus = async (id) => {
     }
   } catch (error) {
     console.log(error)
+    handleClose()
+    uni.hideLoading()
+    if (interTimer) clearInterval(interTimer)
   } finally {
     payLoading = false
   }
@@ -259,7 +265,7 @@ const weChatMiniProgramPay = async (data) => {
     success: (res) => {
       // 用户支付成功
       initIntervalFun()
-      handleClose()
+      // handleClose()
     },
     fail: (err) => {
       if (err.errMsg === 'requestPayment:fail cancel') {

+ 7 - 6
pages/index/jobFair.vue

@@ -13,7 +13,7 @@
       </view>
     </view>
 
-    <payPopup ref="payRef" amount="123" @paySuccess="paySuccess"></payPopup>
+    <payPopup ref="payRef" :amount="FenYuanTransform(itemData?.admissionPrice || 0)" @paySuccess="paySuccess"></payPopup>
   </layout-page>
 </template>
 
@@ -27,6 +27,7 @@ import { getJobFairList, checkJobFairPermission } from '@/api/jobFair'
 import { timesTampChange } from '@/utils/date'
 import { userStore } from '@/store/user'
 import payPopup from '@/components/payPopup'
+import { FenYuanTransform } from '@/utils'
 
 const useUserStore = userStore()
 const items = ref([])
@@ -63,15 +64,18 @@ const handleToJobFairEnterprises = async (val) => {
   if (!val?.id) {
     uni.showToast({ title: '资源获取失败,请稍后重试', icon: 'none' })
   }
+  uni.showLoading({ title: '加载中' })
 
   try {
     const { data } = await checkJobFairPermission(val.id)
+    uni.hideLoading()
     if (data) {
       uni.navigateTo({
         url: '/pagesB/jobFair/details?id=' + val.id
       })
     }
   } catch (error) {
+    uni.hideLoading()
     // 权限被禁用
     if (error?.code === 1100056008) {
       uni.showToast({ title: error.msg, icon: 'none', duration: 2000 })
@@ -87,17 +91,14 @@ const handleToJobFairEnterprises = async (val) => {
       // 设置门票金额则提示购买门票
       uni.showToast({ title: '您暂时无法参加该招聘会,请先购买门票', icon: 'none', duration: 2000 })
 
-      payRef.value && payRef.value.handleOpen({ spuId: val?.id || '', spuName: val?.title || '', price: 0.1, type: 5 })
+      payRef.value && payRef.value.handleOpen({ spuId: val?.id || '', spuName: val?.title || '', price: val.admissionPrice, type: 5 })
     }
   }
 }
 
 // 支付成功
 const paySuccess = () => {
-  uni.showToast({ title: '支付成功', icon: 'success' })
-  uni.navigateTo({
-    url: '/pagesB/jobFair/details?id=' + itemData.value.id
-  })
+  handleToJobFairEnterprises(itemData.value)
 }
 </script>
 

+ 0 - 1
pagesB/jobFair/join.vue

@@ -126,7 +126,6 @@ const handleJoin = async (item) => {
 		}, 1000)
 	} catch (e) {
 		uni.hideLoading()
-		uni.showToast({ title: e.message })
 	}
 }
 </script>

+ 1 - 1
static/style/index.css

@@ -9045,7 +9045,7 @@
   position: fixed;
   bottom: 0;
   left: 0;
-  background-image: linear-gradient(rgba(255, 255, 255, 0.8), white);
+  background-color: #fff;
 }
 
 .send-button {

文件差异内容过多而无法显示
+ 0 - 0
static/style/index.min.css


+ 2 - 1
static/style/index.scss

@@ -420,7 +420,8 @@
   position: fixed;
   bottom:0;
   left: 0;
-  background-image:linear-gradient(rgba(255,255,255,0.8),white);
+  background-color: #fff;
+  // background-image:linear-gradient(rgba(255,255,255,0.8),white);
 }
 // 主要页面大按钮用这个
 .send-button {

+ 7 - 0
utils/index.js

@@ -167,3 +167,10 @@ export const removeEmptyProperties = (obj) => {
     Object.entries(obj).filter(([key, value]) => value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true))
   )
 }
+
+export const FenYuanTransform = (count, type='toYuan') => {
+  if ((count - 0) === 0) return 0
+  if (!count) return ''
+  const Magnification = type === 'toCent' ? 100 : 1/100 
+  return type === 'toCent' ? (count - 0)*Magnification : ((count - 0)*Magnification).toFixed(2)
+}

+ 1 - 0
utils/request.js

@@ -293,6 +293,7 @@ http.interceptors.response.use(
 				uni.showToast({
 					title: error.data?.msg || errorMessage,
 					icon: 'none',
+					duration: 2000,
 					mask: true,
 				});
 			}

部分文件因为文件数量过多而无法显示