Przeglądaj źródła

feat: 更新版本号至1.4.1,优化日期时间格式化,增强页面数据加载逻辑

laiqi 11 miesięcy temu
rodzic
commit
d02c461b40

+ 1 - 1
env/.env

@@ -1,6 +1,6 @@
 VITE_APP_TITLE='达川农机优惠劵'
 VITE_APP_PORT=9000
-VITE_APP_VERSION=1.1.0
+VITE_APP_VERSION=1.4.1
 
 VITE_UNI_APPID='H57F2ACE4'
 VITE_WX_APPID='wxd3ca52d7f454048d'

+ 3 - 4
src/pages/coupon/audit-detail.vue

@@ -249,6 +249,7 @@ import { onLoad } from '@dcloudio/uni-app'
 import { useCouponStore } from '@/store/coupon'
 import { useUserStore } from '@/store/user'
 import { useFileStore } from '@/store/file'
+import dayjs from 'dayjs'
 
 const message = useMessage()
 const couponStore = useCouponStore()
@@ -289,8 +290,7 @@ const idPhotoLabel = computed(() =>
 // 格式化日期时间
 const formatDateTime = (dateTime: string) => {
   if (!dateTime) return '-'
-  const date = new Date(dateTime)
-  return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`
+  return dayjs(dateTime).format('YYYY-MM-DD HH:mm:ss')
 }
 
 // 获取状态文本
@@ -408,11 +408,10 @@ const handleSubmitAudit = async () => {
       overlayShow.value = false
 
       message
-        .confirm({
+        .alert({
           msg: '审核提交成功!',
           title: '提示',
           confirmButtonText: '确定',
-          showCancelButton: false,
         })
         .then(() => {
           // 跳转回审核列表页面

+ 15 - 2
src/pages/coupon/audit-list.vue

@@ -116,7 +116,7 @@
 
 <script lang="ts" setup>
 import { ref } from 'vue'
-import { onLoad } from '@dcloudio/uni-app'
+import { onLoad, onShow } from '@dcloudio/uni-app'
 import { useCouponStore } from '@/store/coupon'
 import { useUserStore } from '@/store/user'
 import { useMessage } from 'wot-design-uni'
@@ -283,7 +283,8 @@ const handleItemClick = (item: any) => {
   })
 }
 
-onLoad(() => {
+// 检查权限并加载数据
+const checkAuthAndLoadData = () => {
   // 检查审核权限
   if (!userStore.audit_auth) {
     message
@@ -298,6 +299,18 @@ onLoad(() => {
   }
 
   loadCouponList()
+}
+
+onLoad(() => {
+  checkAuthAndLoadData()
+})
+
+// 页面显示时刷新数据,确保从审核详情页面返回时数据是最新的
+onShow(() => {
+  // 只有在有审核权限时才刷新数据
+  if (userStore.audit_auth) {
+    loadCouponList()
+  }
 })
 </script>
 

+ 13 - 1
src/pages/coupon/index.vue

@@ -137,6 +137,7 @@
 
 <script lang="ts" setup>
 import { ref } from 'vue'
+import { onLoad, onShow } from '@dcloudio/uni-app'
 import { useCouponStore } from '@/store/coupon'
 import { useAppStore } from '@/store/app'
 import { useMessage } from 'wot-design-uni'
@@ -147,6 +148,7 @@ const couponStore = useCouponStore()
 const couponList = ref([])
 const overlayShow = ref(false)
 const message = useMessage()
+const isFirstLoad = ref(true)
 
 // 筛选表单数据
 const filterForm = ref({
@@ -247,7 +249,8 @@ function handleBack() {
   })
 }
 
-onLoad(() => {
+// 加载优惠券列表数据
+const loadCouponList = () => {
   overlayShow.value = true
 
   // 调用获取优惠券列表接口
@@ -263,6 +266,15 @@ onLoad(() => {
     .finally(() => {
       overlayShow.value = false
     })
+}
+
+onLoad(() => {
+  // onLoad 时不加载数据,等待 onShow
+})
+
+// 页面显示时刷新数据,确保从其他页面返回时数据是最新的
+onShow(() => {
+  loadCouponList()
 })
 
 // 优惠劵下单

+ 1 - 2
src/pages/coupon/modify-info.vue

@@ -409,11 +409,10 @@ async function handleSubmit() {
       overlayShow.value = false
 
       message
-        .confirm({
+        .alert({
           msg: '信息修改成功!系统将重新审核您的优惠券。',
           title: '提示',
           confirmButtonText: '确定',
-          showCancelButton: false,
         })
         .then(() => {
           // 跳转回优惠券列表页面

+ 7 - 5
src/pages/order/detail.vue

@@ -69,14 +69,16 @@ const orderStore = useOrderStore()
 const fileStore = useFileStore()
 const message = useMessage()
 const currentOrdersId = ref('')
-const orderscouponid = ref('')
+const coupon2sid = ref('')
 const orderDetail = ref<OrderType>({} as OrderType)
 
 // 获取订单详情
 const getOrderDetail = async () => {
-  const res = await orderStore.getOrderDetail(currentOrdersId.value)
+  const res = await orderStore.getOrderViewDetail({
+    ordersid: currentOrdersId.value,
+  })
   orderDetail.value = res
-  orderscouponid.value = res.orderscouponid
+  coupon2sid.value = res.coupon2sid
 }
 
 // 获取订单状态
@@ -122,7 +124,7 @@ const getInvoiceImg = async () => {
 // 获取购机者证件照片附件
 const getIdentityImg = async () => {
   const res = await fileStore.getAttachmentList({
-    attlsh: orderscouponid.value, // 关联id为优惠劵id
+    attlsh: coupon2sid.value, // 关联id为优惠劵id
     attmodel: 'coupon_identity',
   })
   identityImg.value = res
@@ -131,7 +133,7 @@ const getIdentityImg = async () => {
 // 获取购机者照片附件
 const getBuyerImg = async () => {
   const res = await fileStore.getAttachmentList({
-    attlsh: orderscouponid.value, // 关联id为优惠劵id
+    attlsh: coupon2sid.value, // 关联id为优惠劵id
     attmodel: 'coupon_buyer',
   })
   buyerImg.value = res

+ 1 - 0
src/service/coupon1/index.ts

@@ -79,5 +79,6 @@ export const getCoupon2ListApi = (params: Partial<Coupon2Type>, page: Partial<Li
   return http.get<any>('/api/query/list?pagevalue=100', {
     ...page,
     'coupon2userid.value': params.coupon2userid, // 用户id
+    'coupon2adddatetime.Sort': '1', // desc
   })
 }