第一次上传

This commit is contained in:
Ls
2026-03-09 16:39:03 +08:00
commit 3d9efaf15c
924 changed files with 326227 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { Service } from '@/Service/Service';
/*****用户订单*****/
class vpOrderService {
private static GetUserOrderListPath : string = '/Order/GetUserOrderList';
/*****获取用户订单列表*****/
static GetUserOrderList(time:string,page:number) {
var result = Service.Request(this.GetUserOrderListPath, 'GET', {time,page});
return result;
}
}
export { Service, vpOrderService };

View File

@@ -0,0 +1,788 @@
<template>
<view class="index-page">
<!-- 页面整体加载状态 -->
<view v-if="loding" class="page-loading">
<!-- 固定顶部区域 -->
<view class="top-fixed">
<view class="status-bar-placeholder"></view>
<view class="top-section-fixed">
<view class="location-box-skeleton">
<view class="skeleton-location-icon"></view>
<view class="skeleton-location-text"></view>
<view class="skeleton-arrow-icon"></view>
</view>
<view class="search-wrapper">
<view class="search-box-skeleton"></view>
</view>
</view>
</view>
<!-- 状态栏占位 - 沉浸式状态栏 -->
<view class="status-bar"></view>
<!-- 占位区域 - 抵消固定顶部的高度 -->
<view class="top-placeholder"></view>
<!-- 分类骨架屏 -->
<view class="category-section">
<SkeletonCategory />
</view>
<!-- 商家列表骨架屏 -->
<view class="shop-list">
<view class="shop-waterfall">
<view class="waterfall-column">
<SkeletonShopCard v-for="i in 3" :key="'left-' + i" />
</view>
<view class="waterfall-column">
<SkeletonShopCard v-for="i in 3" :key="'right-' + i" />
</view>
</view>
</view>
</view>
<!-- 实际内容 -->
<view v-else>
<!-- 固定顶部区域 -->
<view class="top-fixed">
<view class="status-bar-placeholder"></view>
<view class="top-section-fixed">
<view class="location-box" @click.stop="choooseLocation()">
<text class="ri-map-pin-line location-icon-small"></text>
<text class="location-text">{{ location }}</text>
<text class="ri-arrow-down-s-line arrow-icon"></text>
</view>
<view class="search-wrapper">
<view class="search-box">
<input type="text" v-model="searchKey" @confirm="Service.GoPage('/pages/goods/search?search='+searchKey)" class="search-input" placeholder="知白茶社"
placeholder-class="search-placeholder" />
<view @click="Service.GoPage('/pages/goods/search?search='+searchKey)" class="search-btn">搜索</view>
</view>
</view>
</view>
</view>
<!-- 状态栏占位 - 沉浸式状态栏 -->
<view class="status-bar"></view>
<!-- 占位区域 - 抵消固定顶部的高度 -->
<view class="top-placeholder"></view>
<!-- 分类导航 - 三行五列 -->
<view class="category-section">
<view class="category-grid">
<view v-for="(category, index) in tabList" :key="index" class="category-item"
@click="Service.GoPage('/pages/goods/goodsClass?type='+category.assortId+'&name='+category.name )">
<view class="category-icon-box" :style="{ background: category.bgColor }">
<image :src="Service.GetMateUrlByImg(category.icon)" mode="" style="width: 100%; height: 100%;" ></image>
</view>
<text class="category-name">{{ category.name }}</text>
</view>
</view>
</view>
<!-- 商家列表 - 瀑布流布局 -->
<view class="shop-list">
<view class="shop-waterfall">
<!-- 左列 -->
<view class="waterfall-column">
<view v-for="shop in leftGoodsList" :key="shop.merchId" class="shop-card"
@click="Service.GoPage('/pages/community/merchantDetail?merchId='+shop.merchId)">
<view class="shop-cover-wrapper">
<image class="shop-cover" :src="Service.GetMateUrlByImg(shop.logo)" mode="aspectFill" />
<!-- 浮动标签 - 左下角距离 -->
<view class="float-tag float-distance">
<text class="ri-map-pin-2-line tag-icon"></text>
<text class="tag-text">{{formatDistance(shop.distance)}}</text>
</view>
<!-- 右上角商家标签 -->
<view class="shop-badges">
<text v-if="shop.codeName=='联盟商家'" class="badge-partner">{{shop.codeName }}</text>
<text v-else class="badge-coop">{{shop.codeName }}</text>
</view>
</view>
<view class="shop-info">
<view class="shop-header">
<text class="shop-name">{{ shop.name }}</text>
</view>
<view class="shop-meta">
<text class="shop-sales">月售:{{ shop.sale }}</text>
<text class="shop-avg-price">人均{{ shop.price }}</text>
</view>
<view class="shop-footer">
<view class="shop-tags">
<view v-for="(coupon, idx) in shop.tips" :key="idx" :class="getTagClass(coupon)" style="font-size: 24rpx;" class="shop-tag">
{{ coupon }}
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 右列 -->
<view class="waterfall-column">
<view v-for="shop in rightGoodsList" :key="shop.merchId" class="shop-card"
@click="Service.GoPage('/pages/community/merchantDetail?merchId='+shop.merchId)">
<view class="shop-cover-wrapper">
<image class="shop-cover" :src="Service.GetMateUrlByImg(shop.logo)" mode="aspectFill" />
<!-- 浮动标签 - 左下角距离 -->
<view class="float-tag float-distance">
<text class="ri-map-pin-2-line tag-icon"></text>
<text class="tag-text">{{formatDistance(shop.distance)}}</text>
</view>
<!-- 右上角商家标签 -->
<view class="shop-badges">
<text v-if="shop.code=='Discounts'" class="badge-partner">联盟商家</text>
<text v-else class="badge-coop">合作商家</text>
</view>
</view>
<view class="shop-info">
<view class="shop-header">
<text class="shop-name">{{ shop.name }}</text>
</view>
<view class="shop-meta">
<text class="shop-sales">月售:{{ shop.sale }}</text>
<text class="shop-avg-price">人均{{ shop.price }}</text>
</view>
<view class="shop-footer">
<view class="shop-tags">
<view v-for="(coupon, idx) in shop.tips" :key="idx" :class="getTagClass(coupon)" style="font-size: 24rpx;"
class="shop-tag">
{{ coupon }}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<up-loadmore :status="status" />
</view>
</view>
</view>
</template>
<script lang="ts" setup>
import {
onLoad, onShareAppMessage, onShareTimeline
} from '@dcloudio/uni-app'
import {
ref,
onMounted,
computed
} from 'vue'
import SkeletonCategory from '../../components/skeleton/skeleton-category.vue'
import SkeletonShopCard from '../../components/skeleton/skeleton-shop-card.vue'
import { vpLoginService, Service } from '@/Service/vp/vpLoginService'
import { vpMerchService } from '@/Service/vp/vpMerchService'
import { vpUserService } from '@/Service/vp/vpUserService'
// 数据
let location = ref('')
const categories = ref([])
const shops = ref([])
const currentCategory = ref('all')
let status = ref('nomore')
let loding = ref(true)
let longitude = ref(0)
let latitude = ref(0)
let searchKey=ref('')
let leftGoodsList = ref<Array<any>>([])
let rightGoodsList = ref<Array<any>>([])
let tabList = ref<Array<any>>([])
let page = ref(1)
onLoad(() => {
getLocation()
})
// 分享
onShareAppMessage((res) => {
return {
path: '/pages/index/index'
}
});
onShareTimeline(() => {
return {
path: '/pages/index/index'
}
})
const getLocation = () => {
uni.getLocation({
type: 'wgs84',
success: function (res) {
longitude.value = res.longitude
latitude.value = res.latitude
getAddress()
if (!Service.GetUserToken()) {
login()
return
}
getdata()
},
fail: function (e) {
console.log(e);
}
});
}
const login = () => {
uni.getProvider({
service: 'oauth',
success: function (res : any) {
uni.login({
onlyAuthorize: true,
provider: res.provider,
success: function (loginRes) {
vpLoginService.WxLogin(loginRes.code, res.provider=='weixin'?1:2, longitude.value, latitude.value, '').then(content => {
if (content.code == 0) {
Service.SetUserToken(content.data.accToken)
getdata()
} else {
Service.Msg(content.msg)
}
})
}
})
}
});
}
const getdata = () => {
leftGoodsList.value = []
rightGoodsList.value = []
status.value = 'loadmore'
page.value = 1
getList()
}
const getList = () => {
if (status.value !== 'loadmore') {
return
}
status.value = 'loading'
vpMerchService.GetMerchList('', '', longitude.value, latitude.value, page.value).then(res => {
loding.value=false
res.data.merchList.forEach((goodsItem : any, GoodsIndex : number) => {
if (GoodsIndex % 2 == 0) {
leftGoodsList.value.push(goodsItem)
} else {
rightGoodsList.value.push(goodsItem)
}
})
tabList.value = res.data.assortList
if(tabList.value.length>=15){
tabList.value=tabList.value.slice(0,14)
tabList.value.push({
assortId: "",
icon: "",
name: "更多",
})
}
status.value = res.data.merchList.length == 10 ? 'loadmore' : 'nomore'
page.value++
})
}
const getAddress=()=>{
vpUserService.GetAddressInfo(longitude.value,latitude.value).then(res=>{
if(res.code==0){
location.value=res.data.addrName
}else{
Service.Msg(res.msg)
}
})
}
const choooseLocation=()=>{
uni.chooseLocation({
success: function (res) {
longitude.value=res.longitude
latitude.value=res.latitude
location.value=res.address
getdata()
}
});
}
// 格式化距离
const formatDistance = (distance : any) => {
if (distance < 1000) {
return `${distance}m`
}
return `${(distance / 1000).toFixed(1)}km`
}
// 根据标签文本获取样式类
const getTagClass = (tagText : string) => {
const tagMap = {
'可用积分': 'tag-points-available',
'可用券': 'tag-coupon'
}
return tagMap[tagText] || 'tag-points'
}
</script>
<style lang="scss" scoped>
.index-page {
min-height: 100vh;
background: #F5F5F5;
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
}
/* 状态栏占位 - 沉浸式 */
.status-bar {
background: linear-gradient(135deg, #FF6B00, #FF9500);
height: var(--status-bar-height);
width: 100%;
}
/* 固定顶部区域 - 始终固定 */
.top-fixed {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
}
.status-bar-placeholder {
background: linear-gradient(135deg, #FF6B00, #FF9500);
height: var(--status-bar-height);
width: 100%;
}
.top-section-fixed {
background: linear-gradient(135deg, #FF6B00, #FF9500);
padding: 58rpx 20rpx 28rpx;
}
/* 占位区域 - 抵消固定顶部的高度 */
.top-placeholder {
height: calc(var(--status-bar-height) + 170rpx);
width: 100%;
}
.location-box {
display: flex;
align-items: center;
margin-bottom: 28rpx;
}
.location-icon-small {
font-size: 28rpx;
color: #FFFFFF;
margin-right: 8rpx;
}
.location-text {
font-size: 28rpx;
color: #FFFFFF;
font-weight: 500;
margin-right: 8rpx;
}
.arrow-icon {
font-size: 24rpx;
color: #FFFFFF;
}
/* 搜索区域 */
.search-wrapper {
display: flex;
align-items: center;
}
/* 搜索框 */
.search-box {
flex: 1;
display: flex;
align-items: center;
background: #FFFFFF;
border-radius: 32rpx;
padding: 8rpx 28rpx;
gap: 8rpx;
}
.search-input {
flex: 1;
font-size: 26rpx;
color: #222222;
height: 48rpx;
line-height: 48rpx;
}
.search-placeholder {
color: #999999;
}
.search-btn {
background: #FF6B00;
color: #FFFFFF;
font-size: 24rpx;
padding: 6rpx 18rpx;
border-radius: 20rpx;
font-weight: 500;
flex-shrink: 0;
}
/* 分类导航 - 三行五列 */
.category-section {
background: #FFFFFF;
padding: 32rpx 20rpx;
margin-bottom: 20rpx;
}
.category-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 32rpx 20rpx;
}
.category-item {
display: flex;
flex-direction: column;
align-items: center;
}
.category-icon-box {
width: 70rpx;
height: 70rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 16rpx;
margin-bottom: 12rpx;
}
.category-icon-box text {
font-size: 44rpx;
color: #FFFFFF;
}
.category-name {
font-size: 24rpx;
color: #222222;
white-space: nowrap;
}
/* 商家列表 - 瀑布流布局 */
.shop-list {
padding: 0 20rpx;
}
.shop-waterfall {
display: flex;
gap: 16rpx;
}
.waterfall-column {
flex: 1;
display: flex;
flex-direction: column;
gap: 16rpx;
}
.shop-card {
background: #FFFFFF;
border-radius: 12rpx;
overflow: hidden;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
break-inside: avoid;
}
.shop-cover-wrapper {
position: relative;
width: 100%;
height: 200rpx;
}
.shop-cover {
width: 100%;
height: 100%;
}
/* 浮动标签 */
.float-tag {
position: absolute;
padding: 2rpx 6rpx;
border-radius: 3rpx;
font-size: 16rpx;
backdrop-filter: blur(10rpx);
-webkit-backdrop-filter: blur(10rpx);
display: flex;
align-items: center;
gap: 2rpx;
}
.float-distance {
left: 6rpx;
bottom: 6rpx;
background: rgba(0, 0, 0, 0.65);
color: #FFFFFF;
}
.float-distance .tag-icon {
font-size: 14rpx;
color: #FFFFFF;
}
.float-distance .tag-text {
font-size: 16rpx;
color: #FFFFFF;
}
.shop-info {
padding: 16rpx;
}
// 右上角
.shop-badges {
position: absolute;
top: 16rpx;
right: 16rpx;
display: flex;
flex-direction: column;
gap: 8rpx;
align-items: flex-end;
}
/* 商家信息 */
.shop-header {
margin-bottom: 12rpx;
}
.shop-name {
font-size: 28rpx;
font-weight: 500;
color: #222222;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.4;
}
.shop-meta {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12rpx;
}
.shop-sales {
font-size: 22rpx;
color: #999999;
}
.shop-avg-price {
font-size: 26rpx;
color: #FF6B00;
font-weight: 700;
}
/* 商家标签 */
.shop-tags {
display: flex;
flex-wrap: wrap;
gap: 4rpx;
}
/* 标签 */
.tag-badge {
display: inline-block;
padding: 4rpx 12rpx;
border-radius: 6rpx;
font-size: 20rpx;
font-weight: 500;
margin-right: 12rpx;
flex-shrink: 0;
}
.tag-coupon {
background: #FFF8E1;
color: #FF6B00;
}
.shop-price {
font-size: 28rpx;
font-weight: 600;
color: #FF4D4F;
margin-right: 8rpx;
}
.shop-original {
font-size: 22rpx;
color: #999999;
text-decoration: line-through;
}
/* 空状态 */
.empty {
grid-column: 1 / -1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 120rpx 0;
}
.empty-icon {
font-size: 120rpx;
color: #CCCCCC;
margin-bottom: 24rpx;
}
.empty-text {
font-size: 28rpx;
color: #999999;
}
/* 底部导航栏 - 小巧精致风格 */
.tabbar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: space-around;
padding: 12rpx 0 calc(12rpx + env(safe-area-inset-bottom));
box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.04);
z-index: 999;
height: calc(90rpx + env(safe-area-inset-bottom));
}
.tabbar-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10rpx 0;
position: relative;
height: 100%;
}
.tabbar-icon {
font-size: 44rpx;
color: #CCCCCC;
margin-bottom: 8rpx;
transition: all 0.3s ease;
line-height: 1;
}
.tabbar-text {
font-size: 22rpx;
color: #CCCCCC;
font-weight: 400;
transition: all 0.3s ease;
line-height: 1.2;
}
/* 激活状态 */
.tabbar-item.active .tabbar-icon {
color: #FF6B00;
transform: scale(1.1);
}
.tabbar-item.active .tabbar-text {
color: #FF6B00;
font-weight: 500;
}
/* 首页头部骨架屏样式 */
.location-box-skeleton {
display: flex;
align-items: center;
margin-bottom: 28rpx;
}
.skeleton-location-icon {
width: 28rpx;
height: 28rpx;
border-radius: 4rpx;
background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3) 75%);
background-size: 200% 100%;
animation: loading-white 1.5s ease-in-out infinite;
margin-right: 8rpx;
}
.skeleton-location-text {
width: 200rpx;
height: 28rpx;
border-radius: 4rpx;
background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3) 75%);
background-size: 200% 100%;
animation: loading-white 1.5s ease-in-out infinite;
margin-right: 8rpx;
}
.skeleton-arrow-icon {
width: 24rpx;
height: 24rpx;
border-radius: 4rpx;
background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3) 75%);
background-size: 200% 100%;
animation: loading-white 1.5s ease-in-out infinite;
}
.search-box-skeleton {
width: 100%;
height: 60rpx;
border-radius: 32rpx;
background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 25%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0.3) 75%);
background-size: 200% 100%;
animation: loading-white 1.5s ease-in-out infinite;
}
@keyframes loading-white {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
.page-loading {
min-height: 100vh;
background: #F5F5F5;
}
</style>

View File

@@ -0,0 +1,135 @@
<template>
<view style=" margin: 20rpx; padding: 20rpx;">
<view @click="uploadFImg()" class=""
style=" display: flex; flex-direction: column; justify-content: center; align-items: center; ">
<img v-if="userInfo.headImg!=''" :src="Service.GetMateUrlByImg(userInfo.headImg)" style="width: 140rpx; height: 140rpx; border-radius: 50%; " alt="" />
<view v-else class=""
style="background-color: #EBEBEB; width: 140rpx; height: 140rpx; border-radius: 50%; display: flex; align-items: center; justify-content: center; ">
<img :src="Service.GetIconImg('/static/userFunc/photo.png')" style="width: 50rpx; height: 50rpx; "
alt="" />
</view>
<view class="" style="margin-top: 15rpx; font-size: 26rpx; color: #999999; ">
点击更换头像
</view>
</view>
<view class="" style=" margin-top: 30rpx; ">
<up-form labelWidth='90' labelPosition="left" :model="userInfo" ref="form1">
<up-form-item label="昵称" prop="userInfo.name" :borderBottom="true" ref="item1">
<up-input inputAlign='right' v-model="userInfo.nick" border="none"></up-input>
</up-form-item>
<up-form-item label="性别" prop="userInfo.sex" :borderBottom="true">
<view class="" style="position: relative; width: 100%;" >
<view class="" style=" position: absolute; top: -8rpx; right: 0; ">
<up-radio-group style="width: 300rpx;" v-model="userInfo.sex" placement="row">
<up-radio v-for="(item, index) in radiolist1" activeColor='#FF6A00' :key="index"
iconPlacement="right" :label="item.name" :name="item.name">
</up-radio>
</up-radio-group>
</view>
</view>
</up-form-item>
<up-form-item label="生日" prop="userInfo.sex" :borderBottom="true" >
<view class="" style="position: relative;width: 100%;" >
<view @click="showDate=true" class="" style=" position: absolute; right: 0; display: flex; align-items: center; ">
{{Service.formatDate(userInfo.date,2)}}
<u-icon name="arrow-right" size="24rpx" color="#000"></u-icon>
</view>
</view>
</up-form-item>
<up-form-item label="手机号" prop="userInfo.sex" :borderBottom="true">
<up-input inputAlign='right' v-model="userInfo.phone" border="none"></up-input>
</up-form-item>
<up-form-item label="邮箱" prop="userInfo.sex" :borderBottom="true">
<up-input inputAlign='right' v-model="userInfo.age" border="none"></up-input>
</up-form-item>
</up-form>
</view>
<up-datetime-picker :show="showDate" @cancel="showDate=!showDate" @confirm="dateConfirm" v-model="userInfo.date" mode="date"></up-datetime-picker>
<view class="" style="width: 100%; height: 200rpx;">
</view>
<view class="" style=" width: 100% ; background-color: #fff; position: fixed; bottom: 15rpx; left: 0; ">
<view class=""
style=" margin: 0 20rpx; padding: 20rpx 0; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 10rpx; background-color: #FF6A00;">
保存信息
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app";
import { Service } from '@/Service/Service';
import { ref } from "vue";
let showDate=ref(false)
const userInfo = ref({
headImg: '',
age: '1',
sex: '',
phone: '1',
date:Date.now(),
nick: '大大怪将军'
})
const radiolist1 = ref([
{
name: '男',
disabled: false,
},
{
name: '女',
disabled: false,
}
]);
onLoad(() => {
});
onShow(() => {
});
const dateConfirm=(e)=>{
showDate.value=!showDate.value
userInfo.value.date=e.value
}
const uploadFImg = () => {
uni.chooseImage({
count: 1, // 最多选择3张图片
sizeType: ['original', 'compressed'], // 支持原图和压缩图
sourceType: ['album', 'camera'], // 可从相册选择或使用相机拍照
success: function (res) {
let path = res.tempFiles[0].path
userInfo.value.headImg=path
// Service.uploadH5(path, 'Avatar', data => {
// userInfo.value.headImg = data.split(',')[2].split(':')[1].split('"')[1]
// })
},
fail: function (err) {
console.error('选择失败:', err.errMsg);
}
})
}
</script>
<style lang="scss">
page {
background-color: #fff;
}
</style>

View File

@@ -0,0 +1,313 @@
<template>
<view style="display: flex; flex-direction: column; height: 100vh; ">
<view class="merchant-info">
<view class="">
<text class="section-title">付款给商户</text>
<text class="merchant-name">{{ storeInfo.name }}</text>
</view>
<image :src="Service.GetMateUrlByImg(storeInfo.logo)" mode="aspectFill" class="merchant-icon">
</image>
</view>
<view class=""
style=" padding: 30rpx 40rpx; flex: 1; background-color: #fff; width: 100%; border-top-right-radius: 30rpx; border-top-left-radius: 30rpx; ">
<view class="" style="font-size: 24rpx; font-weight: 600;">
余额
</view>
<view class="" style="margin: 20rpx 0; padding: 20rpx 0; border-bottom: 1rpx solid #e2e2e2; ">
<!-- <up-input prefixIcon='rmb' :prefixIconStyle="{ 'color':'#000','font-weight': 600,'font-size':'60rpx' }"
fontSize='50rpx'
auto-blur="false"
@focus="focusFunc"
:customStyle="{'color':'#000', height: '90rpx', 'padding-left': 0, 'font-weight': 600,'padding-bottom':'20rpx' }"
border="bottom" v-model="account"></up-input> -->
<view class="" style="display: flex; align-items: center; width: 100%; ">
<view class="" style="height: 70rpx; display: flex; align-items: center; ">
<up-icon name="rmb" :bold='true' size='50rpx' color="#000"></up-icon>
</view>
<view class="" style=" height: 70rpx; line-height: 70rpx; font-weight: 600;font-size: 70rpx; ">
{{account}}
</view>
<view class="" v-if="isShow"
style="margin: 0 10rpx; width: 4rpx; height: 70rpx; background-color: var(--nav-mian); ">
</view>
</view>
</view>
<view v-if="storeInfo.code=='Discounts' && userInfo.integral>0 " class="" style="font-size: 24rpx; color: #6B6B6B; ">
<text>当前拥有{{ userInfo.integral }}积分</text>
<text style="margin-left: 10rpx;">可抵扣 ¥{{ userInfo.integral }}元</text>
</view>
<view v-else class="" style="font-size: 24rpx; color: #6B6B6B; ">
本次消费可得 50 积分
</view>
<!-- <view class="" style="font-size: 28rpx; margin-top: 10rpx; ">
<text :style="{'margin-right':!des?'':'15rpx'}">{{des}}</text>
<text @click="showDes=true" style="font-weight: 600; color: #586B95;">添加备注</text>
</view> -->
<view class=""
style="background-color: #f5f5f5; padding: 20rpx; position: fixed; bottom: 0; left: 0; width: 100%; padding-top: 25rpx; padding-bottom: 20rpx; ">
<view class="" style="display: grid; grid-template-columns: repeat(4,1fr); ">
<view class="button" @click="input(item)" v-for="(item,index) in 3" :key="index">
{{item}}
</view>
<view @click="deleInput()" class="button">
<up-icon name="backspace" :bold='true' size="26"></up-icon>
</view>
</view>
<view class="" style="display: grid; grid-template-columns: 3fr 1fr; ">
<view class="">
<view class="" style="display: grid; grid-template-columns: repeat(3,1fr); ">
<view class="button" @click="input(item+3)" v-for="(item,index) in 3" :key="index">
{{item+3}}
</view>
</view>
<view class="" style="display: grid; grid-template-columns: repeat(3,1fr); ">
<view class="button" @click="input(item+6)" v-for="(item,index) in 3" :key="index">
{{item+6}}
</view>
</view>
<view class="" style="display: grid; grid-template-columns: 2fr 1fr; ">
<view @click="input(0)" class="button">
0
</view>
<view @click="input('.')" class="button">
.
</view>
</view>
</view>
<view @click="save()" class="button" style="background-color: var(--nav-mian); color: #fff; ">
付款
</view>
</view>
</view>
</view>
</view>
<!-- <up-popup :show="showDes">
<view style="width: 100%; padding: 50rpx 30rpx; ">
<view class="">
<text style="font-size: 28rpx; font-weight: 600;">添加备注</text>
</view>
<view class=""
style=" margin-top: 30rpx; padding: 20rpx 0; border-bottom: 1rpx solid #e2e2e2; border-top: 1rpx solid #e2e2e2; ">
<up-input placeholder="请输入内容" border="none" v-model="des"></up-input>
</view>
<view class=""
style=" margin: 0 110rpx; margin-top: 50rpx; display: flex; align-items: center; justify-content: space-between; ">
<view class="" @click="showDes=false,des=''"
style=" background-color: #f2f2f2; color: #000; padding: 20rpx 80rpx;border-radius: 20rpx; display: flex; align-items: center; justify-content: center; ">
取消
</view>
<view class="" @click="showDes=false"
style=" background-color: #07c160; color: #fff; padding: 20rpx 80rpx;border-radius: 20rpx; display: flex; align-items: center; justify-content: center; ">
确定
</view>
</view>
</view>
</up-popup> -->
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app";
import { Service } from "@/Service/Service"
import { onUnmounted, ref } from "vue";
import { vpMerchService } from "@/Service/vp/vpMerchService";
import { vpUserService } from "@/Service/vp/vpUserService";
import { vpLoginService } from "@/Service/vp/vpLoginService";
let account = ref('')
// let showDes = ref(false)
let des = ref()
let isShow = ref(false)
let timeOut = ref()
let par = ref('')
let openId=ref('')
let storeInfo = ref<any>({})
let userInfo = ref<any>({})
onLoad((data : any) => {
focusFunc()
getOpid()
// 支付宝
// #ifdef MP-ALIPAY
let querdata = Service.GetStorageCache('quer')
par.value = querdata.query.par
getData()
// #endif
// #ifdef MP-WEIXIN
if (data.par) {
console.log(data);
par.value = data.par
getData()
} else {
par.value = ''
getData()
}
// #endif
});
onShow(() => {
});
onUnmounted(() => {
clearInterval(timeOut.value)
})
const getData = () => {
vpMerchService.GetUnitMerchInfo(par.value).then(res => {
if (res.code == 0) {
storeInfo.value = res.data.merchInfo
userInfo.value = res.data.accInfo
} else {
Service.Msg(res.msg)
}
})
}
const input = (val : any) => {
if (account.value.split('').length > 8) {
return
}
if (val == '.') {
let arr = account.value.split('').filter((item => item == val))
if (arr.length > 0) {
return
}
if (!account.value) {
account.value = '0.'
return
}
}
account.value = account.value + val
}
const deleInput = () => {
let arr = account.value.split('')
arr.pop()
account.value = arr.join('')
}
const save = () => {
if(!account.value){
Service.Msg('请输入金额')
return
}
Service.LoadIng('支付中')
vpUserService.PayMerch(storeInfo.value.merchId,Number(account.value),'wx',openId.value).then(res=>{
if(res.code==0){
wx.requestPayment({
timeStamp: res.data.resdata.timeStamp,
nonceStr: res.data.resdata.nonceStr,
package: res.data.resdata.package,
signType: res.data.resdata.signType,
paySign: res.data.resdata.paySign,
success(payRes) {
Service.LoadClose()
//支付完成处理逻辑
Service.Msg("支付成功");
},
fail(err) {
Service.Msg("支付失败");
console.error('pay fail', err)
}
})
}else{
Service.Msg(res.msg)
}
})
}
const focusFunc = () => {
timeOut.value = setInterval(() => {
isShow.value = !isShow.value
}, 1000)
}
const getOpid=()=>{
uni.login({
onlyAuthorize: true,
provider: 'weixin',
success: function (loginRes) {
vpLoginService.GetOpenIdByWeixin(loginRes.code,1).then(res=>{
if(res.code==0){
openId.value=res.data
}else{
Service.Msg(res.msg)
}
})
}
})
}
</script>
<style lang="scss">
page {
background-color: #f5f5f5;
}
// 按键
.button {
background-color: #fff;
display: flex;
align-items: center;
justify-content: center;
padding: 18rpx 0;
border-radius: 10rpx;
font-weight: 700;
margin: 8rpx;
font-size: 38rpx;
}
.button:active {
background-color: #ababab;
}
/* 商户信息 */
.merchant-info {
padding: 30rpx 40rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.merchant-name {
font-size: 24rpx;
color: #999999;
display: block;
margin-top: 20rpx;
}
.section-title {
font-size: 32rpx;
font-weight: 700;
}
.merchant-icon {
width: 95rpx;
height: 95rpx;
border-radius: 50%;
margin-right: 20rpx;
}
</style>