第一次上传
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<view class="address-manager">
|
||||
<!-- 提示信息 -->
|
||||
<view class="tip-bar">
|
||||
<u-icon name="info-circle" size="24rpx" color="#ff9c07" class="info-icon"></u-icon>
|
||||
<text class="tip-text">最多可添加10个收货地址</text>
|
||||
</view>
|
||||
|
||||
<!-- 地址列表 -->
|
||||
<view class="address-list">
|
||||
<!-- 地址项1 - 默认地址 -->
|
||||
<view v-for="(address,index) in addressList " :key="index" class="address-item">
|
||||
<view class="address-content">
|
||||
<view class="name-phone">
|
||||
<text class="name">{{ address.name }}</text>
|
||||
<text class="phone">{{ address.phone }}</text>
|
||||
<view v-if="address.isDefault==1" class="default-tag">默认</view>
|
||||
</view>
|
||||
<text class="address">{{address.address}}</text>
|
||||
</view>
|
||||
<up-icon @click="Service.GoPage('/pages/userFunc/addAddress?addressId='+address.addressId)"
|
||||
name="edit-pen" color="#1890FF" size="22"></up-icon>
|
||||
<up-icon @click="deleAddress(address.addressId)" name="trash" color="#FF4D4F" size="22"></up-icon>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 新增地址按钮 -->
|
||||
<view class=""
|
||||
style=" border-top: 1rpx solid #e2e2e2; position: fixed; bottom: 0; width: 100%; padding: 30rpx 20rpx; background-color: #fff; ">
|
||||
<up-button @click="Service.GoPage('/pages/userFunc/addAddress')" color='var(--nav-mian)' shape='circle'
|
||||
style="width: 90%; margin: 15rpx auto 0; " text="新增地址"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { Service } from "@/Service/Service"
|
||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||
import { vpAddressService } from '@/Service/vp/vpAddressService'
|
||||
|
||||
// 地址数据
|
||||
const addressList = ref<Array<any>>([
|
||||
]);
|
||||
|
||||
onLoad(() => {
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
getData()
|
||||
});
|
||||
|
||||
const getData = () => {
|
||||
vpAddressService.GetUserAddressList().then(res => {
|
||||
if (res.code == 0) {
|
||||
addressList.value = res.data.list
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const deleAddress = (id:any) => {
|
||||
uni.showModal({
|
||||
title: '提示', // 对话框标题
|
||||
content: '是否删除该地址', // 显示的内容
|
||||
showCancel: true, // 是否显示取消按钮
|
||||
cancelText: '取消', // 取消按钮的文字
|
||||
cancelColor: '#000000', // 取消按钮的文字颜色
|
||||
confirmText: '确定', // 确认按钮的文字
|
||||
confirmColor: '#3c76ff', // 确认按钮的文字颜色
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
vpAddressService.DelUserAddress(id).then(content=>{
|
||||
if(content.code==0){
|
||||
Service.Msg('删除成功!')
|
||||
getData()
|
||||
}else{
|
||||
Service.Msg(content.msg)
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.address-manager {
|
||||
background-color: #f6f6f6;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* 提示信息样式 */
|
||||
.tip-bar {
|
||||
background-color: #fff8e6;
|
||||
padding: 20rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.info-icon {
|
||||
color: #ff9c07;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
font-size: 26rpx;
|
||||
color: #ff9c07;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 地址列表样式 */
|
||||
.address-list {
|
||||
|
||||
background-color: #fff;
|
||||
padding: 0 30rpx;
|
||||
border-top: 1rpx solid #e2e2e2;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
|
||||
.address-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
padding: 30rpx 0;
|
||||
border-bottom: 1rpx solid #fff;
|
||||
gap: 10rpx;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.address-content {
|
||||
flex: 1;
|
||||
|
||||
.name-phone {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.name {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.phone {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.default-tag {
|
||||
background-color: #ff6b00;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 15rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.address {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.5;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
color: #999;
|
||||
margin-top: 5rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 新增地址按钮样式 */
|
||||
.add-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100rpx;
|
||||
background-color: #ff6b00;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
|
||||
<!-- 设置列表 -->
|
||||
<view class="settings-list">
|
||||
<!-- 账户安全 -->
|
||||
<view class="settings-section" >
|
||||
<view class="section-title">账户安全</view>
|
||||
<view v-for="(accountItem,accountIndex) in account" :key="accountIndex" class="section-item">
|
||||
<view class="" style="display: flex; align-items: center;">
|
||||
<view class="icon" style=" ">
|
||||
<img class="icon-img" :src="Service.GetIconImg(accountItem.icon)"
|
||||
alt="" />
|
||||
</view>
|
||||
<text style="margin-left: 14rpx; font-weight: 500; " >{{accountItem.name}}</text>
|
||||
</view>
|
||||
<view class="" style="display: flex; align-items: baseline; font-size: 24rpx; color: #9CA3AF; " >
|
||||
<text v-if="accountItem.name=='实名认证'" style="margin-right: 10rpx;" >未认证</text>
|
||||
<text v-if="accountItem.name=='绑定社交账号'" style="margin-right: 10rpx;" >小红书、微博</text>
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 应用设置 -->
|
||||
<view class="settings-section">
|
||||
<view class="section-title">应用设置</view>
|
||||
<view v-for="(appItem,appIndex) in app" :key="appIndex" class="section-item">
|
||||
<view class="" style="display: flex; align-items: center;">
|
||||
<view class="icon" style=" ">
|
||||
<img class="icon-img" :src="Service.GetIconImg(appItem.icon)"
|
||||
alt="" />
|
||||
</view>
|
||||
<text style="margin-left: 14rpx; font-weight: 500; " >{{appItem.name}}</text>
|
||||
</view>
|
||||
<view class="" style="display: flex; align-items: baseline; font-size: 24rpx; color: #9CA3AF; " >
|
||||
<text v-if="appItem.name=='清除缓存'" style="margin-right: 10rpx;" >46.8MB</text>
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 支持与帮助 -->
|
||||
<view class="settings-section">
|
||||
<view class="section-title">支持与帮助</view>
|
||||
<view v-for="(helpItem,helpIndex) in help" :key="helpIndex" class="section-item">
|
||||
<view class="" style="display: flex; align-items: center;">
|
||||
<view class="icon" style=" ">
|
||||
<img class="icon-img" :src="Service.GetIconImg(helpItem.icon)"
|
||||
alt="" />
|
||||
</view>
|
||||
<text style="margin-left: 14rpx; font-weight: 500; " >{{helpItem.name}}</text>
|
||||
</view>
|
||||
<view class="" style="display: flex; align-items: baseline; font-size: 24rpx; color: #9CA3AF; " >
|
||||
<up-icon name="arrow-right" size="12"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 版本信息 -->
|
||||
<view class="version-info">
|
||||
<text class="version-text">当前版本</text>
|
||||
<view class="" style="display: flex; align-items: center;" >
|
||||
<text class="version-number">v1.0.0</text>
|
||||
<view class="check-update">检查更新</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="" style="width: 100%; height: 100rpx;" >
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 退出登录按钮 -->
|
||||
<view class="" style=" width: 100%; position: fixed; bottom: 0; left: 0; background-color: #f5f5f5; padding: 20rpx 30rpx; " >
|
||||
<view class="" style="width: 100%; color: #fff; background-color: #FF6A00; padding: 20rpx ; text-align: center; border-radius: 20rpx; " >
|
||||
退出登录
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { Service } from '@/Service/Service'
|
||||
|
||||
|
||||
|
||||
|
||||
const account = ref([
|
||||
{
|
||||
name: '实名认证',
|
||||
icon: '/static/userFunc/set/security.png'
|
||||
}, {
|
||||
name: '修改密码',
|
||||
icon: '/static/userFunc/set/password.png'
|
||||
}
|
||||
])
|
||||
|
||||
const app=ref([
|
||||
{
|
||||
name: '消息推送',
|
||||
icon: '/static/userFunc/set/notice.png'
|
||||
},
|
||||
{
|
||||
name: '清除缓存',
|
||||
icon: '/static/userFunc/set/dele.png'
|
||||
}
|
||||
])
|
||||
|
||||
const help=ref([
|
||||
{
|
||||
name: '用户协议',
|
||||
icon: '/static/userFunc/set/agreement.png'
|
||||
},
|
||||
{
|
||||
name: '隐私政策',
|
||||
icon: '/static/userFunc/set/privacy.png'
|
||||
},
|
||||
{
|
||||
name: '联系客服',
|
||||
icon: '/static/userFunc/set/service.png'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
const handleClearCache = () => {
|
||||
uni.showModal({
|
||||
title: '清除缓存',
|
||||
content: '确定要清除所有缓存数据吗?',
|
||||
success: (res) => {
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
const handleLogout = () => {
|
||||
uni.showModal({
|
||||
title: '退出登录',
|
||||
content: '确定要退出当前账号吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
background-color: #f5f5f5;
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
// 图标
|
||||
.icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #FFEDD5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.icon-img {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
/* 用户信息卡片 */
|
||||
.user-card {
|
||||
margin: 30rpx;
|
||||
border-radius: 20rpx;
|
||||
background: linear-gradient(to right,#F97316,#FB923C);
|
||||
padding: 40rpx 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.user-avatar {
|
||||
background-color: #FFFFFF;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
margin-left: 30rpx;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 500;
|
||||
margin-bottom: 10rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.user-level {
|
||||
width: fit-content;
|
||||
font-size: 18rpx;
|
||||
color: #fff;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
padding: 4rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
/* 设置列表 */
|
||||
.settings-list {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
|
||||
.settings-section {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
overflow: hidden;
|
||||
padding: 30rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
color: #6B7280;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.section-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 0;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
|
||||
// &:last-child{
|
||||
// border-bottom: none;
|
||||
// }
|
||||
}
|
||||
|
||||
.u-cell {
|
||||
height: 100rpx;
|
||||
font-size: 32rpx;
|
||||
--u-cell-value-color: #999999;
|
||||
--u-cell-title-color: #333333;
|
||||
--u-cell-arrow-size: 40rpx;
|
||||
}
|
||||
|
||||
/* 版本信息 */
|
||||
.version-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 20rpx;
|
||||
margin-bottom: 60rpx;
|
||||
|
||||
}
|
||||
|
||||
.version-text {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.version-number {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.check-update {
|
||||
font-size: 24rpx;
|
||||
color: #FF6600;
|
||||
background-color: #FFF7ED;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
/* 退出登录按钮 */
|
||||
.logout-btn {
|
||||
margin: 0 30rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,688 @@
|
||||
<template>
|
||||
<view style="display: flex; flex-direction: column; height: 100vh; ">
|
||||
<view class="merchant-info">
|
||||
<view class="">
|
||||
<text class="merchant-name" style="margin: 0 0 10rpx;">付款给商户</text>
|
||||
<text class="section-title">{{ 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 && computePoints( account ) >0 && currentCouponId=='' " class=""
|
||||
style="font-size: 24rpx; color: #6B6B6B; ">
|
||||
本次消费可得 {{ computePoints( account ) }} 积分
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card" style="padding: 0;">
|
||||
<up-cell @click="showCoupon=true" title="优惠券"
|
||||
:value="currentCouponId!==''?'满'+currentCoupon.needMoney+'减'+currentCoupon.deductMoney: (couponList.length==0?'暂无可用优惠券':couponList.length+'张可用') "
|
||||
isLink>
|
||||
<template #icon>
|
||||
<up-icon name="coupon-fill" color="#999" size="22"></up-icon>
|
||||
</template>
|
||||
</up-cell>
|
||||
</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> -->
|
||||
<up-popup :show="showCoupon" round='10' bgColor='#f6f6f6' @close="showCoupon=false" :closeable="true">
|
||||
<view class="" style="text-align: center; margin: 24rpx 0 26rpx; font-weight: bold; ">
|
||||
使用优惠券
|
||||
</view>
|
||||
<scroll-view v-if="couponList.length>0" scroll-y="true"
|
||||
style="margin: 0 auto; width: 96%; height: 50vh; overflow-y: auto; ">
|
||||
<view v-for="(coupon,index) in couponList" @click=" userCoupon(coupon)" :key="index" class="coupon-card">
|
||||
<!-- 左侧金额 -->
|
||||
<view class="coupon-left">
|
||||
<view class="coupon-amount">
|
||||
<text class="amount-number">{{coupon.deductMoney}}</text>
|
||||
<text class="amount-unit">元</text>
|
||||
</view>
|
||||
<!-- <view v-else-if="coupon.type === 'reduction'" class="coupon-amount">
|
||||
<text class="amount-symbol">¥</text>
|
||||
<text class="amount-number">{{ coupon.discount }}</text>
|
||||
</view> -->
|
||||
<!-- <view class="coupon-amount">
|
||||
<text class="amount-gift">礼品</text>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 分割线 -->
|
||||
<view class="coupon-divider">
|
||||
<view class="divider-circle top"></view>
|
||||
<view class="divider-line"></view>
|
||||
<view class="divider-circle bottom"></view>
|
||||
</view>
|
||||
|
||||
<!-- 右侧信息 -->
|
||||
<view class="coupon-right">
|
||||
<view class="coupon-title">满{{ coupon.needMoney }}减{{ coupon.deductMoney }}优惠券</view>
|
||||
<view class="coupon-condition">
|
||||
<!-- <text v-if="coupon.minAmount > 0">满{{ coupon.minAmount }}元可用</text> -->
|
||||
<text>联盟券</text>
|
||||
</view>
|
||||
<view class="coupon-expire">有效期至{{ Service.formatDate(coupon.endTime,2) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="margin: 0 20rpx;display: flex; align-items: center;">
|
||||
<view class="radio" :class="{active: currentCouponId === coupon.udId}">
|
||||
<view class="dot"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view v-else class=""
|
||||
style=" margin: 0 30rpx; border-radius: 20rpx; padding: 40rpx 0; border: 1rpx solid #e2e2e2; font-weight: bold; font-size: 32rpx; height: 20vh; text-align: center; display: flex; align-items: center; justify-content: center;">
|
||||
暂无优惠券
|
||||
</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";
|
||||
import { vpOrderService } from "@/Service/vp/vpOrderService";
|
||||
|
||||
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 couponList = ref<Array<any>>([])
|
||||
let currentCouponId = ref('')
|
||||
let currentCoupon = ref<any>({})
|
||||
let showCoupon = ref(false)
|
||||
|
||||
onLoad((data : any) => {
|
||||
focusFunc()
|
||||
getOpid()
|
||||
// 支付宝
|
||||
// #ifdef MP-ALIPAY
|
||||
let querdata = Service.GetStorageCache('quer')
|
||||
payway.value = 'zfb'
|
||||
par.value = decodeURIComponent(querdata.query.qrCode).split('?')[1].split('=')[1]
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
payway.value = 'wx'
|
||||
if (data.q) {
|
||||
console.log(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
|
||||
couponList.value = res.data.discount
|
||||
} else {
|
||||
Service.Msg('商家获取失败,请重新扫码')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 使用优惠券
|
||||
const userCoupon = (coupon : any) => {
|
||||
|
||||
if (coupon.udId == currentCouponId.value) {
|
||||
currentCouponId.value = ''
|
||||
currentCoupon.value = ''
|
||||
return
|
||||
}
|
||||
|
||||
if (account.value == '') {
|
||||
Service.Msg('请输入金额')
|
||||
return
|
||||
}
|
||||
if (account.value < coupon.needMoney) {
|
||||
Service.Msg('无法使用该优惠券')
|
||||
return
|
||||
}
|
||||
currentCouponId.value = coupon.udId,
|
||||
currentCoupon.value = coupon
|
||||
}
|
||||
|
||||
|
||||
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, currentCouponId.value).then(res => {
|
||||
if (res.data.code == 1) {
|
||||
// #ifdef MP-WEIXIN
|
||||
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("支付成功");
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
Service.GoPageTab('/pages/index/order')
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
if (err.errMsg == 'requestPayment:fail cancel') {
|
||||
vpOrderService.CancalPay(storeInfo.value.merchId)
|
||||
Service.Msg("取消支付");
|
||||
}
|
||||
else {
|
||||
Service.Msg("支付失败");
|
||||
}
|
||||
Service.LoadClose()
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
// 支付宝
|
||||
// #ifdef MP-ALIPAY
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
orderInfo: res.data.resdata.tradeNO,
|
||||
success: function (res) {
|
||||
if (res.resultCode == 9000) {
|
||||
Service.Msg('支付成功')
|
||||
setTimeout(() => {
|
||||
Service.GoPageTab('/pages/index/order')
|
||||
}, 1000)
|
||||
}
|
||||
else if (res.resultCode == 6001) {
|
||||
vpOrderService.CancalPay(storeInfo.value.merchId)
|
||||
Service.Msg("取消支付");
|
||||
}
|
||||
else {
|
||||
Service.Msg(res.errMsg);
|
||||
}
|
||||
Service.LoadClose()
|
||||
},
|
||||
fail: function (err) {
|
||||
Service.LoadClose()
|
||||
console.log('pay fail', err)
|
||||
Service.Msg(err)
|
||||
},
|
||||
complete: function (data) {
|
||||
// console.log('支付完成:', data)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
|
||||
} else if (res.data.code == 2) {
|
||||
Service.Msg("支付成功");
|
||||
setTimeout(() => {
|
||||
Service.GoPageTab('/pages/index/order')
|
||||
}, 1000)
|
||||
} else {
|
||||
Service.Msg(res.msg)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const focusFunc = () => {
|
||||
timeOut.value = setInterval(() => {
|
||||
isShow.value = !isShow.value
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
const getOpid = () => {
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: function (res : any) {
|
||||
console.log(res.provider);
|
||||
uni.login({
|
||||
onlyAuthorize: true,
|
||||
provider: res.provider,
|
||||
success: function (loginRes) {
|
||||
vpLoginService.GetOpenIdByWeixin(loginRes.code, res.provider == 'weixin' ? 1 : 3).then(content => {
|
||||
if (content.code == 0) {
|
||||
openId.value = content.data
|
||||
} else {
|
||||
Service.Msg(content.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 : 3, 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;
|
||||
}
|
||||
|
||||
// 选中
|
||||
.radio {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 50%;
|
||||
border: 1rpx solid #ccc;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.dot {
|
||||
width: 18rpx;
|
||||
height: 18rpx;
|
||||
border-radius: 50%;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: #fa6400;
|
||||
|
||||
.dot {
|
||||
background-color: #fa6400;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 优惠券
|
||||
.coupon-card {
|
||||
background: #FFFFFF;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 未使用 - 橙色边框 */
|
||||
.coupon-unused {
|
||||
border: 2rpx solid #FF6B00;
|
||||
}
|
||||
|
||||
/* 已使用 - 灰色 */
|
||||
.coupon-used {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* 已过期 - 灰色 */
|
||||
.coupon-expired {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* 左侧金额区 */
|
||||
.coupon-left {
|
||||
flex-shrink: 0;
|
||||
width: 200rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #FFF4E6, #FFE0B2);
|
||||
padding: 32rpx 20rpx;
|
||||
}
|
||||
|
||||
.coupon-amount {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.amount-symbol {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #FF6B00;
|
||||
}
|
||||
|
||||
.amount-number {
|
||||
font-size: 56rpx;
|
||||
font-weight: 600;
|
||||
color: #FF6B00;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.amount-unit {
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
color: #FF6B00;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
|
||||
.amount-gift {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #FF6B00;
|
||||
}
|
||||
|
||||
/* 分割线 */
|
||||
.coupon-divider {
|
||||
position: relative;
|
||||
width: 4rpx;
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
.divider-circle {
|
||||
position: absolute;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
background: #F5F5F5;
|
||||
border-radius: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.divider-circle.top {
|
||||
top: -10rpx;
|
||||
}
|
||||
|
||||
.divider-circle.bottom {
|
||||
bottom: -10rpx;
|
||||
}
|
||||
|
||||
.divider-line {
|
||||
position: absolute;
|
||||
top: 10rpx;
|
||||
bottom: 10rpx;
|
||||
left: 50%;
|
||||
width: 2rpx;
|
||||
background: repeating-linear-gradient(to bottom,
|
||||
#F5F5F5 0rpx,
|
||||
#F5F5F5 6rpx,
|
||||
transparent 6rpx,
|
||||
transparent 12rpx);
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
/* 右侧信息 */
|
||||
.coupon-right {
|
||||
flex: 1;
|
||||
padding: 24rpx 20rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.coupon-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #222;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.coupon-condition {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.coupon-expire {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 状态标识 */
|
||||
.coupon-status {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 20rpx;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.coupon-status text {
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.coupon-status.used text {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.coupon-status.expired text {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 按键
|
||||
.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>
|
||||
@@ -0,0 +1,18 @@
|
||||
## 1.0.8(2024-09-13)
|
||||
新增矩形框最大缩放、修复图片旋转时居中
|
||||
## 1.0.7(2024-08-08)
|
||||
优化选择大文件图片后,无法在Image中直接显示图片,提供针对大图片压缩思路
|
||||
## 1.0.6(2024-06-16)
|
||||
优化确定按钮,快速重复点击出现多个裁剪图片,更新了文档
|
||||
## 1.0.5(2023-11-16)
|
||||
优化裁剪框圆角/裁剪图片圆角,更新了文档
|
||||
## 1.0.4(2023-11-14)
|
||||
支持图片最大缩放功能,优化App端图标问题,
|
||||
## 1.0.3(2023-11-11)
|
||||
新增图片旋转图标rotate.svg
|
||||
## 1.0.2(2023-11-11)
|
||||
新增H5端和App端(Android端通过自测,Ios端没有设备暂未自测)
|
||||
## 1.0.1(2023-11-10)
|
||||
新增项目示例
|
||||
## 1.0.0(2023-11-10)
|
||||
图片裁剪工具
|
||||
@@ -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 payway=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')
|
||||
payway.value='zfb'
|
||||
par.value = querdata.query.par
|
||||
getData()
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
payway.value='wx'
|
||||
if (data.par) {
|
||||
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),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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</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