Browse Source

Merge branch 'master' into ch-h5

zhangtao 19 giờ trước cách đây
mục cha
commit
05714389fb

+ 2 - 0
src/auto-imports.d.ts

@@ -49,6 +49,7 @@ declare global {
   const extendRef: typeof import('@vueuse/core')['extendRef']
   const fixImgStyle: typeof import('./utils/index')['fixImgStyle']
   const getActivePinia: typeof import('pinia')['getActivePinia']
+  const getCityName: typeof import('./utils/index')['getCityName']
   const getCurrentInstance: typeof import('vue')['getCurrentInstance']
   const getCurrentPath: typeof import('./utils/index')['getCurrentPath']
   const getCurrentScope: typeof import('vue')['getCurrentScope']
@@ -415,6 +416,7 @@ declare module 'vue' {
     readonly extendRef: UnwrapRef<typeof import('@vueuse/core')['extendRef']>
     readonly fixImgStyle: UnwrapRef<typeof import('./utils/index')['fixImgStyle']>
     readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
+    readonly getCityName: UnwrapRef<typeof import('./utils/index')['getCityName']>
     readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
     readonly getCurrentPath: UnwrapRef<typeof import('./utils/index')['getCurrentPath']>
     readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>

+ 2 - 0
src/store/address.ts

@@ -1,4 +1,5 @@
 import { defineStore } from 'pinia'
+import { getCityName } from '@/utils/index'
 
 interface addressState {
   Location: {
@@ -129,6 +130,7 @@ export const useAddressStore = defineStore('address', {
           this.Location.latitude = res.latitude
           this.Location.longitude = res.longitude
           this.name = res.name
+          this.city = getCityName(res.address)
         },
         fail: (e) => {
           console.log('获取地址失败', e)

+ 3 - 1
src/subPack-common/afterSalesDetail/index.vue

@@ -347,7 +347,9 @@ function handleGOCoupon() {
             共减
           </view>
           <view class="ml5rpx text-28rpx text-#FF4D3A font-semibold">
-            ¥{{ Number(refundOrderInfo.omsOrderVo.offsetPointsMoney) + Number(refundOrderInfo.couponBaseInfoDTO?.discountMoney) }}
+            <!-- ¥{{ Number(refundOrderInfo.omsOrderVo.offsetPointsMoney) + Number(refundOrderInfo.couponBaseInfoDTO?.discountMoney) }} -->
+
+            {{ Number(refundOrderInfo.omsOrderVo.offsetPoints) / 100 + (Number(refundOrderInfo.couponBaseInfoDTO?.discountMoney) || 0) }}
           </view>
         </view>
         <view class="ml10rpx flex items-center">

+ 2 - 1
src/subPack-film/index/index.vue

@@ -10,6 +10,7 @@ definePage({
     backgroundColorBottom: '#fff',
   },
 })
+const addressStore = useAddressStore()
 
 const hotList = ref<Api.filmMovieList>([
 
@@ -30,7 +31,7 @@ function handleBuy(item: Api.filmMovieList) {
 
 async function getList(showSt: number) {
   uni.showLoading({ title: '加载中' })
-  const res = await Apis.film.getMovieList({ data: { showSt, pageNum: 1, pageSize: 8 } })
+  const res = await Apis.film.getMovieList({ data: { showSt, pageNum: 1, pageSize: 8, cityName: addressStore.city } })
   console.log(res, '请求')
   if (!res.data) {
     useGlobalToast().show('暂无该商品查看权限!')

+ 2 - 2
src/subPack-film/movie/index.vue

@@ -24,7 +24,7 @@ const tabList = reactive([
 ])
 
 const { data: hotList, isLastPage, page, reload, error, refresh } = usePagination((pageNum, pageSize) =>
-  Apis.film.getMovieList({ data: { showSt: 1, pageNum, pageSize } }), {
+  Apis.film.getMovieList({ data: { showSt: 1, pageNum, pageSize, cityName: addressStore.city } }), {
   data: resp => resp.data?.records,
   initialData: [],
   initialPage: 1,
@@ -44,7 +44,7 @@ const { data: filmList, isLastPage: isLastPage1, page: page1, reload: reload1, e
 })
 
 const { data: comingSoonList, isLastPage: isLastPage2, page: page2, reload: reload2, error: error2, refresh: refresh2 } = usePagination((pageNum, pageSize) =>
-  Apis.film.getMovieList({ data: { showSt: 2, pageNum, pageSize } }), {
+  Apis.film.getMovieList({ data: { showSt: 2, pageNum, pageSize, cityName: addressStore.city } }), {
   data: resp => resp.data?.records,
   initialData: [],
   initialPage: 1,

+ 5 - 0
src/subPack-xsb/confirmOrder/index.vue

@@ -105,6 +105,11 @@ function handleSelectCoupon(item: Api.AppMemberCouponVO) {
   if (item.isUsed !== 2 || !item.allowanceId) {
     return
   }
+  // 再次点击已选中的券则取消选中
+  if (draftCouponId.value === item.allowanceId) {
+    draftCouponId.value = undefined
+    return
+  }
   draftCouponId.value = item.allowanceId
 }
 

+ 18 - 0
src/utils/index.ts

@@ -239,3 +239,21 @@ export function fixImgStyle(html: string) {
 
   return result
 }
+
+// 从地址字符串中提取城市名称
+export function getCityName(address: string): string {
+  if (!address)
+    return ''
+
+  // 安全正则,无 ESLint 警告
+  const regex = /^[^省]+省([^市]+)/
+  const match = address.match(regex)
+
+  if (match) {
+    return match[1]
+  }
+
+  // 兼容直辖市(北京 / 上海 / 重庆 / 天津)
+  const municipality = address.match(/(北京|上海|重庆|天津)/)
+  return municipality ? municipality[1] : ''
+}