feat:适配支付,第三方app

This commit is contained in:
dzc committed 2026-03-14 14:57:51 +08:00
1 parent 196ed0285a
commit 7ec67acded
22 files changed
+173 -119

No files matched your search

+2 -2
View File
@@ -21,8 +21,8 @@ export default {
},
onHide() {
console.log("App Hide");
const _this = this;
wx.offAppRoute(_this.watchRouter)
// const _this = this;
// wx.offAppRoute(_this.watchRouter)
},
methods: {
async watchRouter(route) {
+18
View File
@@ -92,6 +92,13 @@
"navigationBarTitleText": "账号密码登录",
"disableScroll": true
}
},
{
"path": "pages/root/web-view",
"style": {
"navigationBarTitleText": "webview页面",
"disableScroll": true
}
}
],
"subPackages": [
@@ -440,6 +447,17 @@
}
}
]
},
{
"root": "pages/third-app",
"pages": [
{
"path": "happyMall",
"style": {
"navigationBarTitleText": "美好商城"
}
}
]
}
],
"globalStyle": {
+2 -2
View File
@@ -9,11 +9,11 @@
fill="#2BCDA3" p-id="1709" data-spm-anchor-id="a313x.search_index.0.i2.beb13a81SVstw0"
class="selected"></path>
</svg>
<text class="text-36 mt-24rpx font-bold c-#333333!">支付成功</text>
<text class="text-36rpx mt-24rpx font-bold c-#333333!">支付成功</text>
</view>
<view class="flex-col-center m-b-60rpx">
<text class="text-90 c-#333333!">¥{{ scanPayData.payPrice }}</text>
<text class="text-90rpx c-#333333!">¥{{ scanPayData.payPrice }}</text>
</view>
<view class="w-full p-10rpx flex-col justify-center">
+6 -8
View File
@@ -1,31 +1,29 @@
<template>
<crud-layout title="支付" bg="/static/page/blue-bg.png">
<crud-layout :title="scanPayState.mchName" bg="/static/page/blue-bg.png">
<view class="h-screen flex flex-col">
<view class="mx-auto text-34 py-16rpx h-80rpx">{{ scanPayState.mchName }}</view>
<tm-sheet :margin="[0, 10]" class="flex flex-row">
<span class="text-2xl text-[#333] mr-8rpx line-height-normal">¥</span>
<span class="text-3xl font-medium text-[#333]">{{ displayAmount }}</span>
</tm-sheet>
<tm-sheet v-if="walletList.length > 0" :margin="[0, 10]" class="flex flex-col">
<view class="text-gray-700 font-bold text-28 mb-8rpx">选择支付钱包:</view>
<view class="text-gray-700 font-bold text-28rpx mb-8rpx">选择支付钱包:</view>
<view v-for="(v, index) in walletList" :key="index"
class="border-6 border-solid border-#efefef my-16rpx duration-200 flex justify-between items-center p-24rpx rounded-2"
:class="{ 'border-6 border-solid border-blue!': selectWallet.id == v.id }"
@click="selectWallet = v">
<view class="flex items-center">
<image class="w-70 h-70 mr-16rpx" :src="filePath(v.walletTypeIcon)" />
<view class="text-32">{{ v.walletTypeName }}</view>
<image class="size-70rpx mr-16rpx" :src="filePath(v.walletTypeIcon)" />
<view class="text-32rpx">{{ v.walletTypeName }}</view>
</view>
<view class="text-28 flex items-center">
<view class="text-28rpx flex items-center">
<view>余额:</view>
<text class="main-text-28">{{ hooks.useMoney(v.balance) }} 元</text>
</view>
</view>
</tm-sheet>
<tm-button class="mt-8rpx" :block="true" @click="handlePay()" :disabled="loading">支 付</tm-button>
<tm-button class="mt-30rpx" :block="true" @click="handlePay()" :disabled="loading">支 付</tm-button>
<number-keyboard v-if="numberKeyboardShow" v-model="amount" />
</view>
+4 -3
View File
@@ -1,5 +1,5 @@
<template>
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
<crud-layout title="共富商城" mainIsScroll bg="/static/page/blue-bg.png">
<swiper class="w-full h-500rpx" circular :indicator-dots="true" indicator-active-color="#0779FD"
indicator-color="#ffffff" :autoplay="true">
<swiper-item v-for="(v, i) in goodsDetail.carouselImages?.split(',')" :key="i">
@@ -21,8 +21,9 @@
</view>
<view class="main-text-32 c-red! font-italic">
<text>约省</text>
<text class="text-44rpx mx-8rpx">{{ displayPrice(Number(goodsDetail.originalPrice) -
Number(goodsDetail.spuPrice), "") }}</text>
<text class="text-44rpx mx-8rpx">
{{ displayPrice(Number(goodsDetail.originalPrice) - Number(goodsDetail.spuPrice), "") }}
</text>
<text>元</text>
</view>
</view>
+18 -14
View File
@@ -1,30 +1,32 @@
<template>
<crud-layout mainIsScroll bg="/static/page/blue-bg.png">
<crud-layout title="共富商城" mainIsScroll bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
<template #top>
<view class="w-full my-16rpx">
<view
class="w-full my-16rpx flex items-center mb-16rpx border-4rpx border-solid border-#0779fd rounded-14rpx p-r-10rpx">
<tm-input class="flex-1" v-model="state.params.keyword" type="text" height="72" minHeight="72"
fontSize="28" :showClear="true" :focus="false" placeholder="请输入商品名称"
style="border: 4rpx solid #0779fd; border-radius: 14rpx" :focus-highlight="false"
color="#ECF4F9">
fontSize="28" :showClear="true" :focus="false" placeholder="请输入商品名称" :focus-highlight="false"
color="#ECF4F9" width="100%">
<template v-slot:rightIcon>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">搜
索</tm-button>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">
搜索
</tm-button>
</template>
</tm-input>
</view>
</template>
<view v-for="v in pageHook.list" :key="v.id" class="card flex mx-20rpx mb-16rpx p-16rpx"
<view v-for="v in pageHook.list" :key="v.id" class="card flex mb-16rpx p-16rpx"
@click="doGoodsDetail(v.id)">
<image :src="filePath(v.coverImage)" class="size-160rpx rounded-12rpx bg-#eeeeee" mode="aspectFill" />
<view class="flex-1 ml-16rpx overflow-hidden">
<view class="truncate sub-text-30">{{ v.title }}</view>
<view>
<text class="c-#0094ff! sub-text-24 px-16rpx bg-#0094ff22 rounded-2">{{ v.status == "0" ? "在售" :
"未售" }}</text>
<text class="c-#0094ff! sub-text-24 px-16rpx bg-#0094ff22 rounded-2">
{{ v.status == "0" ? "在售" : "未售" }}
</text>
</view>
<view>
<text class="second-text-26 mr-16rpx">单位 {{ v.unit }}</text>
@@ -38,10 +40,12 @@
</text>
<text class="color-red">
<text class="text-26rpx">¥</text>
<text class="text-32rpx font-bold">{{ displayPrice(v.spuPrice, "").split(".")[0]
}}.</text>
<text class="text-30rpx font-bold">{{ displayPrice(v.spuPrice, "").split(".")[1]
}}</text>
<text class="text-32rpx font-bold">
{{ displayPrice(v.spuPrice, "").split(".")[0] }}.
</text>
<text class="text-30rpx font-bold">
{{ displayPrice(v.spuPrice, "").split(".")[1] }}
</text>
</text>
</template>
<template v-else>
+4 -4
View File
@@ -1,11 +1,11 @@
<template>
<crud-layout mainIsScroll bg="/static/page/blue-bg.png" @scroll="onScroll">
<crud-layout title="共富商城" mainIsScroll bg="/static/page/blue-bg.png" @scroll="onScroll">
<view class="w-full h-400rpx relative">
<image :src="filePath(mchDetail.images)" class="w-full h-full bg-#eeeeee" mode="aspectFill" />
<view class="absolute w-full h-full top-0 left-0" :style="filterStyle"></view>
</view>
<view
class="fixed right-160rpx h-72rpx bg-#ECF4F9cc px-20rpx top-160rpx flex items-center flex-nowrap overflow-hidden rounded-20rpx"
<view v-if="visible"
class="fixed right-20rpx h-72rpx bg-#ECF4F9cc px-20rpx top-120rpx flex items-center flex-nowrap overflow-hidden rounded-20rpx"
:style="searchStyle" @click="goSearch">
<image class="w-36rpx h-36rpx" src="@/static/page/shop-goods-search.png" />
<text v-if="scrollDetail.scrollTop > 30"
@@ -121,7 +121,7 @@ const state = reactive<any>({
})
const mchDetail = computed(() => state.mchDetail)
const { scrollDetail, onScroll, filterStyle, searchStyle } = useShopDetailScroll()
const { scrollDetail, onScroll, visible, filterStyle, searchStyle } = useShopDetailScroll()
const { totPrice, totalCount, skuAddToCart, getShopCart, goSettlement } = useCartBuy()
onLoad(async (option: any) => {
@@ -11,8 +11,14 @@ interface scrollDetail {
export default function useShopDetailScroll() {
const scrollDetail = ref<scrollDetail>({} as scrollDetail)
const visible = ref<boolean>(true)
const onScroll = (e: any) => {
if (e.detail.scrollTop > 250) {
visible.value = false
} else {
visible.value = true
}
scrollDetail.value = e.detail
}
@@ -41,5 +47,5 @@ export default function useShopDetailScroll() {
}
})
return { scrollDetail, onScroll, filterStyle, searchStyle }
return { scrollDetail, visible, onScroll, filterStyle, searchStyle }
}
+4 -1
View File
@@ -48,7 +48,10 @@ onHide(() => {
})
const doMenu = async (v: any) => {
console.log("tabbarStore:", tabbarStore);
if (v.page.includes("thirdApp")) {
router.jump("/pages/third-app/happyMall")
return
}
await tabbarStore.componetTabbarList(v.page)
tabbarStore.jumpFirstTabbar()
}
+24
View File
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { ref, reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
const state = reactive({
url: ""
})
onLoad((options: any) => {
if (options.url) {
state.url = decodeURIComponent(options.url)
}
})
</script>
<template>
<crud-layout mainIsScroll tabBarType="just-flot-back">
<web-view :update-title="false" :fullscreen="false" :webview-styles="{
width: '100%',
height: '100%',
backgroundColor: '#fff'
}" :src="state.url" />
</crud-layout>
</template>
+4 -3
View File
@@ -61,7 +61,7 @@ const toDetail = async (v: any) => {
</script>
<template>
<crud-layout bg="/static/page/blue-bg.png">
<crud-layout title="合作商家" bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
@@ -72,8 +72,9 @@ const toDetail = async (v: any) => {
fontSize="28" :showClear="true" :focus="false" placeholder="请输入商家名称" width="100%"
:focus-highlight="false" color="#ECF4F9">
<template v-slot:rightIcon>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">搜
索</tm-button>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">
搜索
</tm-button>
</template>
</tm-input>
</view>
+27 -11
View File
@@ -1,14 +1,25 @@
<template>
<crud-layout title="我的" mainIsScroll bg="/static/page/blue-bg.png">
<template #main-top>
<view class="flex items-center py-24rpx mx-30rpx">
<image v-if="state.userInfo?.sysUser?.avatar && false" class="size-100rpx rounded-full"
:src="filePath(state.userInfo.sysUser.avatar)" mode="aspectFill" />
<image v-else class="w-100rpx h-100rpx rounded-full" src="/static/icon/default-avatar.png"
mode="aspectFill" />
<view class="ml-30rpx" v-if="state.userInfo?.sysUser?.userId">
<view class="sub-text-30">{{ state.userInfo?.sysUser?.name }}</view>
<view class="sub-text-26">ID {{ state.userInfo?.sysUser?.userId }}</view>
<view class="flex items-center py-24rpx px-40rpx" @tap="doUserArea">
<view class="flex items-center" v-if="state.userInfo?.sysUser?.userId">
<image v-if="state.userInfo?.sysUser?.avatar" class="size-100rpx rounded-full"
:src="filePath(state.userInfo.sysUser.avatar)" mode="aspectFill" />
<image v-else class="w-100rpx h-100rpx rounded-full" src="/static/icon/default-avatar.png"
mode="aspectFill" />
<view class="ml-30rpx">
<view class="flex items-center">
<view class="sub-text-30">{{ state.userInfo?.sysUser?.name }}</view>
<view v-if="state.userInfo?.sysUser?.birthday"
class="ml-20rpx flex items-center bg-#FFFFFF px-16rpx py-6rpx rounded-full shadow-sm">
<image class="size-32rpx mr-8rpx" src="/static/icon/birthday.png" mode="aspectFit" />
<text class="text-24rpx color-blue font-bold lh-1">
{{ dayjs(state.userInfo.sysUser.birthday).format("MM-DD") }}
</text>
</view>
</view>
<view class="m-t-5rpx sub-text-26">ID {{ state.userInfo?.sysUser?.userId }}</view>
</view>
</view>
<view v-else class="flex items-center ml-30rpx" @tap="onTabLogin">
<text class="sub-text-32">请先登录</text>
@@ -42,6 +53,8 @@
</view>
</crud-layout>
<modify-user ref="modifyUserRef" warnText="填写出生日期即可领取生日兑换券" @close="storage.getUserInfo" />
<tm-modal :show="state.actModalShow" :showCancel="false" title="核销活动兑换券" zIndex="999" @confirm="" @cancel=""
@close="">
<view class="text-center text-28">是否核销该活动兑换券?</view>
@@ -56,7 +69,7 @@
</template>
<script setup lang="ts">
import { reactive, computed } from "vue"
import { ref, reactive, computed } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { isEmpty } from "radash"
import dayjs from "dayjs"
@@ -66,6 +79,9 @@ import { hooks, router, constant } from "@@/index"
import { accessStatsApi, actCancelApi, userApi } from "@@/api"
import { APPENV } from "@/sheep/constant"
import ModifyUser from "@@/components/modify-user.vue"
const modifyUserRef = ref(null)
const state = reactive<any>({
wallet: [],
userInfo: {},
@@ -307,8 +323,8 @@ const onTabMenu = async (item: any) => {
}
}
const onNavRightClick = () => {
router.jump("/pages/setting/index")
const doUserArea = () => {
modifyUserRef.value?.open()
}
// 退出登录
+13 -10
View File
@@ -1,5 +1,5 @@
<template>
<crud-layout bg="/static/page/blue-bg.png">
<crud-layout title="共富商城" bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
@@ -14,8 +14,9 @@
fontSize="28" :showClear="true" :focus="false" placeholder="请输入超市名称" :focus-highlight="false"
color="#ECF4F9" width="100%">
<template v-slot:rightIcon>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">搜
索</tm-button>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">
搜索
</tm-button>
</template>
</tm-input>
</view>
@@ -41,23 +42,25 @@
</view>
</view>
<scroll-view scroll-x>
<view class="flex mt-16rpx">
<view class="h-20rpx"></view>
<view class="flex">
<view class="w-180rpx flex-col items-center mr-20rpx" v-for="(pV, pI) in v.featuredProducts"
:key="pI">
<image class="size-180rpx rounded-12rpx bg-#eeeeee" :src="filePath(pV.coverImage)"
mode="aspectFill" />
<view class="w-full mt-4rpx sub-text-24 truncate">{{ pV.title }}</view>
<view class="w-full flex justify-between">
<text class="text-26 color-red!">
<text class="text-26rpx color-red!">
<text class="text-22rpx">¥</text>
<text>{{ pV.priceType == "1" ? displayPrice(pV.minPrice, "") :
displayPrice(pV.spuPrice, "")
}}</text>
<text>
{{ pV.priceType == "1" ? displayPrice(pV.minPrice, "")
: displayPrice(pV.spuPrice, "") }}
</text>
</text>
</view>
<view class="w-full flex justify-between second-text-24">
<text>库存{{ pV.totalStock }}</text>
<text>{{ pV.status ? "已停售" : "在售" }}</text>
<view>库存{{ pV.totalStock }}</view>
<view>{{ pV.status ? "已停售" : "在售" }}</view>
</view>
</view>
</view>
+8 -7
View File
@@ -69,20 +69,21 @@ const toDetail = async (v: any) => {
</script>
<template>
<crud-layout bg="/static/page/blue-bg.png">
<crud-layout title="共富商家" bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
<template #top>
<view class="h-30rpx" />
<view class="flex w-full">
<view
class="flex w-full items-center mb-16rpx border-4rpx border-solid border-#0779fd rounded-14rpx p-r-10rpx">
<tm-input class="flex-1" v-model="state.pa.name" type="text" height="72" minHeight="72"
fontSize="28" :showClear="true" :focus="false" placeholder="请输入商家名称"
style="border: 4rpx solid #0779fd; border-radius: 14rpx" :focus-highlight="false"
color="#ECF4F9">
fontSize="28" :showClear="true" :focus="false" placeholder="请输入商家名称" :focus-highlight="false"
color="#ECF4F9" width="100%">
<template v-slot:rightIcon>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">搜
索</tm-button>
<tm-button class="mr-8rpx px-24rpx py-26rpx text-30rpx!" size="xs" @click="search">
搜索
</tm-button>
</template>
</tm-input>
</view>
+1 -1
View File
@@ -34,7 +34,7 @@ const toDetail = async (v: any) => {
</script>
<template>
<crud-layout bg="/static/page/blue-bg.png">
<crud-layout title="自营商家" bg="/static/page/blue-bg.png">
<z-paging ref="pageRef" height="100%" :fixed="false" v-model="pageHook.list" :default-page-size="10"
safe-area-inset-bottom :loading-more-enabled="true" :show-scrollbar="false" @query="query"
:auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" @scroll="pageHook.scroll">
+4 -4
View File
@@ -1,19 +1,19 @@
<template>
<view class="bg-[#f5f5f5] px-8rpx py-16rpx rounded-4 fixed bottom-0 left-0 right-0 w-full">
<view class="flex justify-end">
<image v-show="show" class="w-[50rpx] h-[50rpx] mx-16rpx mb-8rpx" src="@/static/page/fold.svg"
<image v-if="show" class="w-[50rpx] h-[50rpx] mx-16rpx mb-8rpx" src="@/static/page/fold.svg"
@click="show = !show" />
<image v-show="!show" class="w-[50rpx] h-[50rpx] mx-16rpx mb-8rpx" src="@/static/page/unfold.svg"
<image v-if="!show" class="w-[50rpx] h-[50rpx] mx-16rpx mb-8rpx" src="@/static/page/unfold.svg"
@click="show = !show" />
</view>
<view v-show="show" class="flex mb-20rpx" v-for="(row, rowIndex) in keyboardLayout" :key="rowIndex">
<view v-if="show" class="flex mb-20rpx" v-for="(row, rowIndex) in keyboardLayout" :key="rowIndex">
<view
class="flex-1 h-[90rpx] flex items-center justify-center bg-white text-2xl text-[#333] mx-[5px] rounded-lg cursor-pointer select-none active:bg-[#f0f0f0]"
v-for="(key, keyIndex) in row" :key="keyIndex" @click="handleKeyPress(key.toString())">
{{ key }}
</view>
</view>
<view v-show="show" class="flex mb-0rpx">
<view v-if="show" class="flex mb-0rpx">
<view
class="flex-1 h-[90rpx] flex items-center justify-center bg-white text-2xl text-[#333] mx-[5px] rounded-lg cursor-pointer select-none active:bg-[#f0f0f0]"
@click="handleKeyPress('.')">
+16 -47
View File
@@ -1,59 +1,28 @@
import { router } from ".."
import { APPENV } from "../constant"
import { getAppInfo, isDevEnv } from "../utils/app"
import { getUrlParamsObj } from "../utils/app"
export function useScanCode(actModalShow) {
async function scanCodeAction(): Promise<string | undefined> {
const appInfo = await getAppInfo()
if (isDevEnv() && appInfo != APPENV.APP) {
// 开发环境模拟扫码
// const testQrCode = "eyJpZCI6IjE5MDU4ODg4NjQ0NTQ1MzMxMjEiLCJuYW1lIjoi6ICB5Y6/5bqc6aOf5aCCIn0=" // 测试线上-老县府食堂-收款二维码
// const testQrCode = "eyJoYXJkRG9vcklkIjoiMTkxNDIxNTYwODQzNzQxMTg0MSIsImNhYmluZXRObyI6IjEifQ==" // 测试线上-智能柜-收款二维码
// const testQrCode = "eyJpZCI6IjE5MDU4MTY3NTEwNDM0NTI5MzAiLCJuYW1lIjoi5paw5Y6/5bqc6LaF5biCIn0=" // 邓本地-测试环境-新县府超市收款二维码
// const testQrCode = "eyJoYXJkRG9vcklkIjoiMTkxMzE1NzA4MDQxODI5NTgwOSIsImNhYmluZXRObyI6IjEifQ==" // 邓本地-测试单门智能柜柜门二维码
// const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?id=1905816751043452930&name=测试新县府超市" // 邓本地-测试环境-新县府超市收款二维码
// const testQrCode = "http://192.168.101.45:8889/h5/#/pages/pay/scanPay?hardDoorId=1913157080418295809&cabinetNo=1" // 测试智能柜柜门二维码
const testQrCode = "eyJjYW5jZWxJZCI6IjE5ODQyNDA4MzM5NDMyMDc5MzcifQ==" // 测试商户活动核销
uni.showModal({ content: "开发环境不是浙政钉和诗画环境,扫码仅供测试" })
return Promise.resolve(testQrCode)
}
if (appInfo == APPENV.APP) {
const scanResult = await new Promise<string>((resolve, reject) => {
uni.scanCode({
success: (res) => {
console.log("APP扫码成功:", JSON.stringify(res))
resolve(res.result || "")
},
fail: (err) => {
console.error("APP扫码失败", JSON.stringify(err))
resolve("")
},
})
const scanResult = await new Promise<string>((resolve, reject) => {
uni.scanCode({
success: (res) => {
console.log("uniapp扫码成功:", JSON.stringify(res))
resolve(res.result || "")
},
fail: (err) => {
console.error("uniapp扫码失败", JSON.stringify(err))
resolve("")
},
})
return scanResult
}
if (appInfo == APPENV.ZZD) {
// 浙政钉扫码
const res: any = await (window as any).dd.scan({ type: "all" })
return res.text || ""
}
if (appInfo == APPENV.SH) {
// 诗画扫码
const res = await (window as any).CP2.showScanQr({ needResult: 1 })
if (res.code == 1) return res.data.qrCode || ""
return ""
}
uni.showToast({ title: "当前环境未知", icon: "none" })
})
return scanResult
}
// 处理url扫码结果
function processUrlScanResult(url: string) {
if (!url) return
const searchParams = new URL(url).searchParams
const paramsObj: Record<string, string> = {}
searchParams.forEach((value, key) => (paramsObj[key] = value))
const { hardDoorId, cabinetNo, action, id, name } = paramsObj
const searchParams = getUrlParamsObj(url)
const { hardDoorId, cabinetNo, action, id, name } = searchParams
// 智能柜扫码
if (hardDoorId && cabinetNo) {
router.jump("/pages/cabinet/buy", { hardDoorId, cabinetNo })
@@ -61,7 +30,7 @@ export function useScanCode(actModalShow) {
}
// 扫收款机上生成的码支付
if (action === "harQrCodeScanPay") {
const { mchId, orderId } = paramsObj
const { mchId, orderId } = searchParams
router.jump("/pages/pay/scanPay", { action, mchId, orderId })
return
}
+1 -1
View File
@@ -70,7 +70,7 @@ const TABBAR_CONSTANT: Array<TabbarItem> = [
},
{
pagePath: "/pages/tabbar/prosperityShopMchList",
text: "共富商城",
text: "共富商家",
iconPath: "/static/tabbar/prosperity-shop.png",
selectedIconPath: "/static/tabbar/prosperity-shop-select.png",
launchParam: ["prosperityShopMchList"],
+10
View File
@@ -38,3 +38,13 @@ export const getLaunchParam = (url?: string) => {
const params = getUrlParams(url)
return params?.launchParam
}
export const getUrlParamsObj = (url?: string): Record<string, any> => {
if (!url) {
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
url = currentPage?.route ?? ""
}
const params = getUrlParams(url)
return params
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB