第一次上传
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<view style="padding: 20rpx;">
|
||||
<view class="" v-for="(item,index) in noticeList " :key="index" @click="Service.GoPage('/pages/article/articleCom?noticeId='+item.noticeId)"
|
||||
style=" padding: 20rpx; margin-top: 20rpx; border-radius: 20rpx; box-shadow: 0 0 10rpx 4rpx #e2e2e2; ">
|
||||
<view class="" style="display: flex; align-items: center; ">
|
||||
<view class="tag" v-if="index==0"
|
||||
style=" color: #fff; border-radius: 12rpx; background-color: #FF6B35; padding: 4rpx 20rpx; ">
|
||||
<img :src="Service.GetIconImg('/static/index/community/top.png')"
|
||||
style="width: 30rpx; height: 30rpx; " alt="" />
|
||||
<text style="margin-left: 10rpx; font-size: 24rpx;">置顶</text>
|
||||
</view>
|
||||
<view class="tag" v-else
|
||||
style=" color: #fff; border-radius: 12rpx; background-color: #FF6B35; padding: 4rpx 20rpx; ">
|
||||
<img :src="Service.GetIconImg('/static/index/community/top.png')"
|
||||
style="width: 30rpx; height: 30rpx; " alt="" />
|
||||
<text style="margin-left: 10rpx; font-size: 24rpx;">{{item.sign}}</text>
|
||||
</view>
|
||||
<text style="font-size: 32rpx; font-weight: 600; margin-left: 15rpx; ">{{item.title}}</text>
|
||||
</view>
|
||||
<view class=""
|
||||
style=" margin: 16rpx 0; color: #666666; font-size: 26rpx; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; ">
|
||||
{{item.remark}}
|
||||
</view>
|
||||
<view class="" style=" font-size: 22rpx; color: #999999; display: flex; align-items: center;">
|
||||
<up-icon name="clock" size="12" color='#999999' ></up-icon>
|
||||
<text style="margin-left: 10rpx;" >{{Service.formatDate(item.addTime,2)}}</text>
|
||||
<!-- <text style="margin: 0 15rpx;">·</text>
|
||||
<view class="" style="display: flex;align-items: center;">
|
||||
<img :src="Service.GetIconImg('/static/index/community/see.png')"
|
||||
style="width: 30rpx; height: 30rpx; " alt="" />
|
||||
<text style="margin-left: 10rpx;">1200人阅读</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<up-loadmore :status="status" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onShow, onLoad, onReachBottom } from "@dcloudio/uni-app";
|
||||
import { Service } from "@/Service/Service"
|
||||
import { ref } from "vue";
|
||||
import { vpCommunityService } from '@/Service/vp/vpCommunityService'
|
||||
|
||||
interface notice{
|
||||
addTime:string
|
||||
noticeId:string
|
||||
remark:string
|
||||
sign:string
|
||||
title:string
|
||||
}
|
||||
|
||||
let status = ref('nomore')
|
||||
let page=ref(1)
|
||||
let noticeList=ref<notice[]>([])
|
||||
let comId=ref()
|
||||
onLoad((data:any) => {
|
||||
comId.value=data.comId
|
||||
getData()
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
});
|
||||
|
||||
onReachBottom(()=>{
|
||||
getList()
|
||||
})
|
||||
|
||||
const getData=()=>{
|
||||
status.value='loadmore'
|
||||
page.value=1
|
||||
noticeList.value=[]
|
||||
getList()
|
||||
}
|
||||
|
||||
const getList=()=>{
|
||||
if (status.value !== 'loadmore') {
|
||||
return
|
||||
}
|
||||
status.value = 'loading'
|
||||
vpCommunityService.GetCommunityNoticeList(comId.value,page.value).then(res=>{
|
||||
noticeList.value=[...noticeList.value,...res.data.noticeList]
|
||||
status.value = res.data.noticeList.length == 10 ? 'loadmore' : 'nomore'
|
||||
page.value++
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: fit-content;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {parent, children} from '../common/relation';
|
||||
export default {
|
||||
name: 'lime-painter-image',
|
||||
mixins:[children('painter')],
|
||||
props: {
|
||||
id: String,
|
||||
css: [String, Object],
|
||||
src: String
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: 'image',
|
||||
el: {
|
||||
css: {},
|
||||
src: null
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,442 @@
|
||||
<template>
|
||||
<view class="member-code-page">
|
||||
<!-- 沉浸式状态栏 -->
|
||||
<view class="status-bar"></view>
|
||||
|
||||
<!-- 顶部导航 -->
|
||||
<view class="nav-bar">
|
||||
<image class="back-icon" src="/static/icons/back.svg" @click="Service.GoPageBack()" mode="aspectFit" />
|
||||
<text class="nav-title">会员码</text>
|
||||
<view class="nav-placeholder"></view>
|
||||
</view>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="content">
|
||||
<!-- 会员卡片 -->
|
||||
<view class="member-card">
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-section">
|
||||
<image class="user-avatar" :src="Service.GetMateUrlByImg(userData.headImg)" mode="aspectFill" />
|
||||
<view class="user-info">
|
||||
<text class="user-name">{{ userData.nick }}</text>
|
||||
<!-- ID和会员等级标签在一排 -->
|
||||
<view class="tags-row">
|
||||
<view class="user-id-tag" @click="copyMemberId">
|
||||
<text class="ri-vip-crown-2-fill id-icon"></text>
|
||||
<text class="id-text">ID: {{ userData.userNo }}</text>
|
||||
<text class="ri-file-copy-line id-copy"></text>
|
||||
</view>
|
||||
<!-- <view class="user-member-tag">
|
||||
<text class="ri-vip-crown-fill member-icon"></text>
|
||||
<text class="member-text">黄金会员</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分割线 -->
|
||||
<view class="divider"></view>
|
||||
|
||||
<!-- 条形码区域 -->
|
||||
<view class="barcode-section">
|
||||
<u-barcode :value="code" :displayValue='false' :width="300" :height="100" />
|
||||
<text class="barcode-number">{{ code }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 二维码区域 -->
|
||||
<view class="qrcode-section">
|
||||
<view class="qrcode-wrapper" >
|
||||
<view class="qrcode-placeholder">
|
||||
<up-qrcode cid="ex1" :size="180" :val="erCode"></up-qrcode>
|
||||
</view>
|
||||
</view>
|
||||
<text class="code-tip">向商家出示会员码,扫码享受积分优惠</text>
|
||||
</view>
|
||||
|
||||
<!-- 刷新提示 -->
|
||||
<view class="refresh-section">
|
||||
<text class="ri-time-line refresh-icon"></text>
|
||||
<text class="refresh-text">{{ refreshCountdown }}秒后自动刷新</text>
|
||||
<view class="refresh-btn" @click="refreshCode">
|
||||
<text class="ri-refresh-line btn-icon"></text>
|
||||
<text class="btn-text">刷新</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 温馨提示 -->
|
||||
<view class="tips-section">
|
||||
<view class="tips-title">
|
||||
<text class="ri-lightbulb-line tips-icon"></text>
|
||||
<text class="title-text">温馨提示</text>
|
||||
</view>
|
||||
<view class="tips-list">
|
||||
<text class="tips-item">• 会员码每分钟自动更新,确保使用安全</text>
|
||||
<text class="tips-item">• 结账时请向商家出示此码</text>
|
||||
<text class="tips-item">• 消费可获得积分,积分可抵扣现金</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { vpUserService, Service } from '@/Service/vp/vpUserService'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
// 用户数据
|
||||
const user = ref({
|
||||
nickname: '美食达人',
|
||||
avatar: 'https://picsum.photos/200/200?random=100',
|
||||
points: 2580,
|
||||
memberLevel: 'gold',
|
||||
memberId: '8888888',
|
||||
memberCode: 'VIP8888888888888'
|
||||
})
|
||||
let code = ref('')
|
||||
let erCode = ref('')
|
||||
|
||||
let userData = ref<any>({})
|
||||
|
||||
// 刷新倒计时(秒)
|
||||
const refreshCountdown = ref(60)
|
||||
let refreshTimer = ref(0)
|
||||
let countdownTimer = ref(0)
|
||||
|
||||
|
||||
onLoad(() => {
|
||||
fetchUserInfo()
|
||||
getCode()
|
||||
startAutoRefresh()
|
||||
})
|
||||
|
||||
// 获取用户信息
|
||||
const fetchUserInfo = () => {
|
||||
vpUserService.GetUserInfo().then(res => {
|
||||
if (res.code == 0) {
|
||||
userData.value = res.data.userInfo
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const getCode=()=>{
|
||||
vpUserService.GetUserCode().then(res => {
|
||||
if (res.code==0){
|
||||
code.value=res.data.code
|
||||
erCode.value=res.data.erCode
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新会员码
|
||||
const refreshCode = () => {
|
||||
getCode()
|
||||
// 重置倒计时
|
||||
refreshCountdown.value = 60
|
||||
Service.Msg('会员码已刷新')
|
||||
}
|
||||
|
||||
|
||||
// 复制会员ID
|
||||
const copyMemberId = () => {
|
||||
uni.setClipboardData({
|
||||
data: userData.value.userNo,
|
||||
success: () => {
|
||||
Service.Msg('会员ID已复制')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 开始自动刷新
|
||||
const startAutoRefresh = () => {
|
||||
// 清除之前的定时器
|
||||
if (refreshTimer.value) {
|
||||
clearInterval(refreshTimer.value)
|
||||
}
|
||||
if (countdownTimer.value) {
|
||||
clearInterval(countdownTimer.value)
|
||||
}
|
||||
|
||||
// 倒计时定时器(每秒更新)
|
||||
countdownTimer.value = setInterval(() => {
|
||||
refreshCountdown.value--
|
||||
if (refreshCountdown.value <= 0) {
|
||||
refreshCountdown.value = 60
|
||||
getCode()
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 清理定时器
|
||||
onUnmounted(() => {
|
||||
if (refreshTimer) {
|
||||
clearInterval(refreshTimer.value)
|
||||
}
|
||||
if (countdownTimer) {
|
||||
clearInterval(countdownTimer.value)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 引入全局标签样式 */
|
||||
@import '@/styles/member-tags.scss';
|
||||
|
||||
/* 现代化会员码页面 */
|
||||
.member-code-page {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(180deg, #FFF4E6 0%, #F5F5F5 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* 状态栏 */
|
||||
.status-bar {
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 24rpx;
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
padding: 8rpx;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.nav-placeholder {
|
||||
width: 40rpx;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 32rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 会员卡片 */
|
||||
.member-card {
|
||||
width: 100%;
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 4rpx 20rpx rgba(255, 107, 0, 0.12);
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
/* 用户信息区域 */
|
||||
.user-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 48rpx;
|
||||
margin-right: 20rpx;
|
||||
border: 3rpx solid #FF6B00;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
/* 分割线 */
|
||||
.divider {
|
||||
height: 1rpx;
|
||||
background: linear-gradient(90deg, transparent, #E0E0E0, transparent);
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
/* 条形码区域 */
|
||||
.barcode-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.barcode-wrapper {
|
||||
width: 480rpx;
|
||||
background: #F8F8F8;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx 32rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.barcode-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.barcode-lines {
|
||||
font-size: 40rpx;
|
||||
color: #000000;
|
||||
letter-spacing: 2rpx;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.barcode-number {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
letter-spacing: 4rpx;
|
||||
}
|
||||
|
||||
/* 二维码区域 */
|
||||
.qrcode-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.qrcode-wrapper {
|
||||
width: 360rpx;
|
||||
height: 360rpx;
|
||||
background: #F8F8F8;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.qrcode-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #000000;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.qrcode-icon {
|
||||
font-size: 200rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.code-tip {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
/* 刷新区域 */
|
||||
.refresh-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.refresh-icon {
|
||||
font-size: 24rpx;
|
||||
color: #FF6B00;
|
||||
}
|
||||
|
||||
.refresh-text {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
background: linear-gradient(135deg, #FF6B00, #FF9500);
|
||||
padding: 10rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 24rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 温馨提示 */
|
||||
.tips-section {
|
||||
width: 100%;
|
||||
background: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.tips-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.tips-icon {
|
||||
font-size: 28rpx;
|
||||
color: #FFA500;
|
||||
}
|
||||
|
||||
.title-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #222222;
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.tips-item {
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,361 @@
|
||||
<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="">
|
||||
<view v-if="account>0 " class="" style="font-size: 24rpx; color: #6B6B6B; ">
|
||||
本次消费可得 {{ computePoints( account ) }} 积分
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="font-size: 24rpx; color: #6B6B6B; ">
|
||||
当前可用优惠券3张 <text style="color: blue;">点击查看</text>
|
||||
</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 payway = ref('')
|
||||
let par = ref('')
|
||||
let openId = ref('')
|
||||
let storeInfo = ref<any>({})
|
||||
let userInfo = ref<any>({})
|
||||
let radio = ref(0)
|
||||
let points = ref('')
|
||||
|
||||
|
||||
let showCoupon = ref(false)
|
||||
|
||||
onLoad((data : any) => {
|
||||
focusFunc()
|
||||
getOpid()
|
||||
// 支付宝
|
||||
// #ifdef MP-ALIPAY
|
||||
let querdata = Service.GetStorageCache('quer')
|
||||
payway.value = 'zfb'
|
||||
par.value = querdata.query.par
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
payway.value = 'wx'
|
||||
if (data.q) {
|
||||
par.value = decodeURIComponent(data.q).split('?')[1].split('=')[1]
|
||||
}
|
||||
// #endif
|
||||
if (!Service.GetUserIsLogin()) {
|
||||
login()
|
||||
return
|
||||
}
|
||||
getData()
|
||||
});
|
||||
|
||||
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
|
||||
radio.value = res.data.radio
|
||||
} else {
|
||||
Service.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 computePoints = (e : any) => {
|
||||
if (e <= 0.1) {
|
||||
return 0
|
||||
}
|
||||
if (storeInfo.value.code == 'Discounts') {
|
||||
return Number(e * radio.value).toFixed(2)
|
||||
} else {
|
||||
return Number(e * radio.value - e * 0.003).toFixed(2)
|
||||
}
|
||||
}
|
||||
|
||||
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), payway.value, 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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, 0, 0, '').then(content => {
|
||||
if (content.code == 0) {
|
||||
Service.SetUserToken(content.data.accToken)
|
||||
getData()
|
||||
} else {
|
||||
Service.Msg(content.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>
|
||||
Reference in New Issue
Block a user