下单页面增加生日有礼弹窗,关注公众号弹窗,订单结算增加满减活动,修改霸王餐,增加结算成功私域引流和公众号弹窗
This commit is contained in:
11
common/api/market/birthdayGift.js
Normal file
11
common/api/market/birthdayGift.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// 引入 request 文件
|
||||
import request from "@/common/api/request.js";
|
||||
import { prveUrl } from "./config.js";
|
||||
|
||||
export const config = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/birthdayGift",
|
||||
method: "get",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
11
common/api/market/discountActivity.js
Normal file
11
common/api/market/discountActivity.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// 引入 request 文件
|
||||
import request from "@/common/api/request.js";
|
||||
import { prveUrl } from "./config.js";
|
||||
|
||||
export const config = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/discountActivity",
|
||||
method: "get",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
11
common/api/market/drainageConfig.js
Normal file
11
common/api/market/drainageConfig.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// 引入 request 文件
|
||||
import request from "@/common/api/request.js";
|
||||
import { prveUrl } from "./config.js";
|
||||
|
||||
export const config = (data) => {
|
||||
return request({
|
||||
url: prveUrl + "/user/drainageConfig",
|
||||
method: "get",
|
||||
data: data,
|
||||
});
|
||||
};
|
||||
545
components/birthday-modal.vue
Normal file
545
components/birthday-modal.vue
Normal file
@@ -0,0 +1,545 @@
|
||||
<template>
|
||||
<view>
|
||||
<up-popup
|
||||
:show="show"
|
||||
bgColor="transparent"
|
||||
:safeAreaInsetBottom="false"
|
||||
@close="close"
|
||||
mode="center"
|
||||
>
|
||||
<view class="container">
|
||||
<view
|
||||
class="content"
|
||||
:style="contentStyle"
|
||||
:class="`content${currentPage}`"
|
||||
>
|
||||
<!-- 顶部标题图 -->
|
||||
<view class="top">
|
||||
<image class="image" :src="imageList.gift" mode="widthFix"></image>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券列表 -->
|
||||
<view class="list">
|
||||
<view
|
||||
class="item"
|
||||
:style="kuangStyle"
|
||||
v-for="(item, index) in couponList"
|
||||
:key="index"
|
||||
>
|
||||
<!-- <view class="kuang">
|
||||
<image
|
||||
class="kuang-img"
|
||||
:src="imageList.kuang"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
</view> -->
|
||||
<!-- 优惠券金额 -->
|
||||
<view>
|
||||
<template
|
||||
v-if="
|
||||
item.couponInfo.couponType == 3 ||
|
||||
item.couponInfo.couponType == 1
|
||||
"
|
||||
>
|
||||
<text class="big-title">{{
|
||||
returnTitle(item.couponInfo)
|
||||
}}</text>
|
||||
<text class="u-m-l-12 small-title">
|
||||
{{ returnSmallTitle(item.couponInfo) }}
|
||||
</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="big-title" style="font-size: 48rpx">{{
|
||||
returnTitle(item.couponInfo)
|
||||
}}</text>
|
||||
</template>
|
||||
</view>
|
||||
<!-- 优惠券名称与领取按钮 -->
|
||||
<view class="u-flex u-row-between u-m-t-16">
|
||||
<view>
|
||||
<text class="title">{{ item.couponInfo.title }}</text>
|
||||
<text class="num">x{{ item.num }}</text>
|
||||
</view>
|
||||
<button class="lingqu" @click="handleReceive(item)">
|
||||
立即领取
|
||||
</button>
|
||||
</view>
|
||||
<!-- 有效期(替换硬编码,用接口返回数据) -->
|
||||
<view class="u-m-t-10 time">
|
||||
有效期至:{{ formatDate(item.couponInfo.validStartTime) }}-{{
|
||||
formatDate(item.couponInfo.validEndTime)
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分页控制(左右箭头+页码) -->
|
||||
<view
|
||||
class="u-flex u-row-center u-m-t-16"
|
||||
v-if="allCoupons.length > 3"
|
||||
>
|
||||
<!-- 左箭头:当前页>1可点击 -->
|
||||
<view
|
||||
@click="handlePrevPage"
|
||||
class="page-arrow"
|
||||
:class="{ disabled: currentPage === 1 }"
|
||||
>
|
||||
<up-icon
|
||||
name="arrow-left"
|
||||
size="12"
|
||||
:color="currentPage === 1 ? '#999' : '#000'"
|
||||
></up-icon>
|
||||
</view>
|
||||
<!-- 页码列表:点击切换+当前页高亮 -->
|
||||
<view class="u-flex page-nums">
|
||||
<view
|
||||
v-for="(num, index) in pageNums"
|
||||
:key="index"
|
||||
class="item"
|
||||
:class="{ active: currentPage === num }"
|
||||
@click="handleClickPage(num)"
|
||||
>
|
||||
{{ num }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 右箭头:当前页<总页数可点击 -->
|
||||
<view
|
||||
@click="handleNextPage"
|
||||
class="page-arrow"
|
||||
:class="{ disabled: currentPage === totalPages }"
|
||||
>
|
||||
<up-icon
|
||||
name="arrow-right"
|
||||
size="12"
|
||||
:color="currentPage === totalPages ? '#999' : '#000'"
|
||||
></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部一键领取按钮 -->
|
||||
<view class="btn-wrap" :class="{ 'u-m-t-18': allCoupons.length > 3 }">
|
||||
<image
|
||||
@click="handleReceiveAll"
|
||||
class="btn-img"
|
||||
:src="imageList.btn"
|
||||
mode="widthFix"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import _ from "lodash";
|
||||
import dayjs from "dayjs";
|
||||
import { onMounted, ref, reactive, computed } from "vue";
|
||||
import * as birthdayGiftApi from "@/common/api/market/birthdayGift.js";
|
||||
|
||||
// 1. 分页核心配置
|
||||
const currentPage = ref(1); // 当前页码
|
||||
const pageSize = ref(3); // 每页显示条数
|
||||
const allCoupons = ref([]); // 存储全部优惠券(用于分页截取)
|
||||
const couponList = ref([]); // 当前页优惠券列表
|
||||
const pageNums = ref([]); // 页码数组(如[1,2,3])
|
||||
const totalPages = computed(() => {
|
||||
// 计算总页数:向上取整(如5条数据→2页)
|
||||
return Math.ceil(allCoupons.value.length / pageSize.value);
|
||||
});
|
||||
|
||||
// 2. 图片资源(修复bg2地址缺失的"g")
|
||||
const imageList = reactive({
|
||||
btn: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/493b459f8c944057be72750c12c4cd1a.png",
|
||||
gift: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/112d2433378349b4a26ab311b8d3bac4.png",
|
||||
kuang:
|
||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/bb5e2d5ed73c455d9b6e9b4ac0e86192.png",
|
||||
bg1: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/847f9aea44d64b15b35caf8967f3d63f.png",
|
||||
bg2: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/2f704eef2e3d484d8862673131ae3989.png", // 修复:.pn→.png
|
||||
bg3: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/7ab43d1ef2fc490d80165d18795a93f3.png",
|
||||
});
|
||||
|
||||
// 3. 背景图(随当前页切换)
|
||||
const bgUrl = ref(imageList.bg1);
|
||||
const contentStyle = computed(() => ({
|
||||
backgroundImage: `url(${bgUrl.value})`,
|
||||
backgroundSize: "100% 100%", // 确保背景图铺满容器
|
||||
}));
|
||||
const kuangStyle = computed(() => ({
|
||||
backgroundImage: `url(${imageList.kuang})`,
|
||||
}));
|
||||
|
||||
// 4. 弹窗状态与props
|
||||
const show = ref(false);
|
||||
const props = defineProps({
|
||||
getMode: {
|
||||
type: String,
|
||||
default: "eat",
|
||||
},
|
||||
});
|
||||
|
||||
// ---------------------- 分页核心逻辑 ----------------------
|
||||
/**
|
||||
* 1. 生成页码数组(如总数据5条→[1,2])
|
||||
*/
|
||||
const generatePageNums = () => {
|
||||
pageNums.value = Array.from({ length: totalPages.value }, (_, i) => i + 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* 2. 更新当前页优惠券列表(根据当前页截取数据)
|
||||
*/
|
||||
const updateCouponList = () => {
|
||||
const startIdx = (currentPage.value - 1) * pageSize.value;
|
||||
const endIdx = startIdx + pageSize.value;
|
||||
couponList.value = allCoupons.value.slice(startIdx, endIdx);
|
||||
// 同步切换背景图(当前页对应bg1/bg2/bg3)
|
||||
bgUrl.value = imageList[`bg${currentPage.value}`] || imageList.bg1;
|
||||
};
|
||||
|
||||
/**
|
||||
* 3. 上一页切换
|
||||
*/
|
||||
const handlePrevPage = () => {
|
||||
if (currentPage.value > 1) {
|
||||
currentPage.value--;
|
||||
updateCouponList();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 4. 下一页切换
|
||||
*/
|
||||
const handleNextPage = () => {
|
||||
if (currentPage.value < totalPages.value) {
|
||||
currentPage.value++;
|
||||
updateCouponList();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 5. 点击页码切换
|
||||
*/
|
||||
const handleClickPage = (num) => {
|
||||
currentPage.value = num;
|
||||
updateCouponList();
|
||||
};
|
||||
|
||||
// ---------------------- 数据与交互逻辑 ----------------------
|
||||
/**
|
||||
* 1. 格式化日期(YYYY.MM.DD)
|
||||
*/
|
||||
const formatDate = (dateStr) => {
|
||||
return dateStr ? dayjs(dateStr).format("YYYY.MM.DD") : ""; // 默认兜底日期
|
||||
};
|
||||
|
||||
/**
|
||||
* 2. 单个优惠券领取
|
||||
*/
|
||||
const handleReceive = async (item) => {
|
||||
close();
|
||||
uni.showToast({ title: "领取成功!去「我的优惠券」查看", icon: "none" });
|
||||
};
|
||||
|
||||
/**
|
||||
* 3. 底部一键领取(领取当前页所有优惠券)
|
||||
*/
|
||||
const handleReceiveAll = async () => {
|
||||
if (couponList.value.length === 0) {
|
||||
uni.showToast({ title: "当前页无优惠券可领", icon: "none" });
|
||||
return;
|
||||
}
|
||||
close();
|
||||
uni.showToast({ title: "领取成功!去「我的优惠券」查看", icon: "none" });
|
||||
};
|
||||
|
||||
/**
|
||||
* 4. 初始化获取优惠券数据
|
||||
*/
|
||||
const getCouponPopupAjax = async () => {
|
||||
try {
|
||||
const shopId = uni.cache.get("shopId");
|
||||
const res = await birthdayGiftApi.config({ shopId });
|
||||
if (res.length) {
|
||||
// 处理有效期格式(固定有效期规则)
|
||||
allCoupons.value = res.map((item) => {
|
||||
if (item.validType === "fixed") {
|
||||
item.validStartTime = dayjs()
|
||||
.add(item.daysToTakeEffect, "day")
|
||||
.format("YYYY-MM-DD HH:mm:ss");
|
||||
item.validEndTime = dayjs()
|
||||
.add(+item.daysToTakeEffect + +item.validDays, "day")
|
||||
.format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
return item;
|
||||
});
|
||||
// 初始化分页:生成页码→更新列表→显示弹窗
|
||||
generatePageNums();
|
||||
updateCouponList();
|
||||
show.value = true;
|
||||
}else{
|
||||
close();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取优惠券失败:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// 页面挂载时初始化
|
||||
onMounted(() => {
|
||||
getCouponPopupAjax();
|
||||
});
|
||||
|
||||
function returnTitle(coupon) {
|
||||
if (coupon.couponType == 1) {
|
||||
return `¥${coupon.discountAmount}`;
|
||||
}
|
||||
if (coupon.couponType == 2) {
|
||||
return `商品兑换券`;
|
||||
}
|
||||
if (coupon.couponType == 3) {
|
||||
const discountRate = coupon.discountRate / 10;
|
||||
return `${discountRate}折券`;
|
||||
}
|
||||
if (coupon.couponType == 4) {
|
||||
return `第二件半价券`;
|
||||
}
|
||||
if (coupon.couponType == 6) {
|
||||
return `买一送一券`;
|
||||
}
|
||||
}
|
||||
|
||||
function returnSmallTitle(coupon) {
|
||||
if (coupon.couponType == 1) {
|
||||
return `满${coupon.fullAmount || 0}可用`;
|
||||
}
|
||||
if (coupon.couponType == 3) {
|
||||
return `满${coupon.fullAmount || 0}可用`;
|
||||
}
|
||||
}
|
||||
|
||||
const emit = defineEmits(["close"]);
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
emit("close");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// 基础容器样式
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 52rpx;
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
margin: auto;
|
||||
min-height: 836rpx;
|
||||
padding: 0 28rpx 62rpx;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
// 分页箭头样式(添加禁用态)
|
||||
.page-arrow {
|
||||
cursor: pointer;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
box-sizing: border-box;
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
border: 1px solid #d9d9d9;
|
||||
font-size: 14px;
|
||||
line-height: 60rpx;
|
||||
padding: 0 14rpx;
|
||||
border-radius: 4rpx;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
margin: 0 16rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
&.disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
// 页码样式(当前页高亮)
|
||||
.page-nums {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
.item {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
box-sizing: border-box;
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
border: 1px solid #d9d9d9;
|
||||
font-size: 14px;
|
||||
line-height: 64rpx;
|
||||
padding: 0 4rpx;
|
||||
border-radius: 4rpx;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
text-align: center;
|
||||
&.active {
|
||||
border-color: #1890ff;
|
||||
color: #1890ff;
|
||||
font-weight: 500;
|
||||
}
|
||||
&:active:not(.active) {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 底部按钮容器
|
||||
.btn-wrap {
|
||||
margin: 28rpx 0 0;
|
||||
margin-top: 30rpx;
|
||||
.btn-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 顶部标题图
|
||||
.top {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
.image {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// 优惠券列表样式
|
||||
.list {
|
||||
margin-top: 332rpx;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
.item {
|
||||
position: relative;
|
||||
padding: 32rpx 12rpx 36rpx 36rpx;
|
||||
background-size: 100% 100%;
|
||||
background-position: center;
|
||||
overflow: hidden;
|
||||
margin-top: 36rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
// 优惠券边框图
|
||||
.kuang {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
.kuang-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// 金额样式
|
||||
.big-title {
|
||||
color: #f05a82;
|
||||
font-size: 36px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.small-title {
|
||||
color: #f05a82;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
// 名称与数量
|
||||
.title {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
padding-bottom: 10rpx;
|
||||
border-bottom: 4rpx dashed #fd8293;
|
||||
}
|
||||
.num {
|
||||
color: #f05a82;
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
line-height: 22px;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
// 有效期
|
||||
.time {
|
||||
color: #666; // 调整颜色更柔和
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 领取按钮样式
|
||||
.lingqu {
|
||||
padding: 12rpx 20rpx; // 加宽内边距,点击区域更大
|
||||
border-radius: 14rpx;
|
||||
background: #fd8293;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
border: none;
|
||||
outline: none;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
&:active {
|
||||
background: #f07080; // 点击深色反馈
|
||||
}
|
||||
}
|
||||
|
||||
// 工具类样式(补充缺失的flex基础样式)
|
||||
.u-flex {
|
||||
display: flex;
|
||||
}
|
||||
.u-row-center {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.u-row-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.u-m-t-10 {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.u-m-t-16 {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
.u-m-t-20 {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.u-m-t-30 {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.u-m-x-16 {
|
||||
margin-left: 16rpx;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
.u-m-l-12 {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- 首页优惠券弹窗 -->
|
||||
<template>
|
||||
<up-popup :show="show" bgColor="transparent">
|
||||
<up-popup :show="show" bgColor="transparent" @close="close">
|
||||
<view class="container">
|
||||
<view class="content" :class="`content${currentNum}`">
|
||||
<image class="bg" :src="bgUrl" mode="widthFix"></image>
|
||||
@@ -141,6 +141,8 @@ async function getCouponPopupAjax() {
|
||||
bgUrl.value = bgUrlList.value[1];
|
||||
currentNum.value = 1;
|
||||
}
|
||||
}else{
|
||||
close()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@@ -167,6 +169,12 @@ async function getHandle() {
|
||||
}
|
||||
uni.hideLoading();
|
||||
}
|
||||
const emit=defineEmits(['close'])
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
emit('close');
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getCouponPopupAjax();
|
||||
|
||||
101
components/drainage.vue
Normal file
101
components/drainage.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 私域引流 -->
|
||||
<up-popup
|
||||
:show="showPreview"
|
||||
mode="center"
|
||||
round="16rpx"
|
||||
closeOnClickOverlay
|
||||
@close="close"
|
||||
:safeAreaInsetBottom="false"
|
||||
>
|
||||
<view class="preview-box">
|
||||
<view class="u-flex" style="align-items: stretch">
|
||||
<view
|
||||
class="u-flex-1 u-p-r-24 u-flex u-flex-col"
|
||||
style="align-items: start; justify-content: space-between"
|
||||
>
|
||||
<view>
|
||||
<view class="font-14 font-bold color-333">{{
|
||||
drainageConfig.title
|
||||
}}</view>
|
||||
<view class="u-m-t-16 font-12 color-666">{{
|
||||
drainageConfig.content
|
||||
}}</view>
|
||||
</view>
|
||||
|
||||
<view class="color-999 font-12 u-m-t-16">{{
|
||||
drainageConfig.note
|
||||
}}</view>
|
||||
</view>
|
||||
|
||||
<image
|
||||
:show-menu-by-longpress="true"
|
||||
:src="drainageConfig.qrCode"
|
||||
style="width: 240rpx; height: 240rpx"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
<view class="close" @click="close">
|
||||
<up-icon name="close-circle" size="34" color="#fff"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as drainageConfigApi from "@/common/api/market/drainageConfig.js";
|
||||
import { ref, reactive, computed, watch, onMounted } from "vue";
|
||||
|
||||
const showPreview = defineModel({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
});
|
||||
const emit = defineEmits(["close"]);
|
||||
|
||||
function close() {
|
||||
showPreview.value = false;
|
||||
emit("close");
|
||||
}
|
||||
const drainageConfig = ref({});
|
||||
onMounted(async () => {
|
||||
const shopId = uni.cache.get("shopId");
|
||||
const drainageConfigRes = await drainageConfigApi.config({
|
||||
shopId: shopId,
|
||||
});
|
||||
drainageConfig.value = drainageConfigRes;
|
||||
if (drainageConfig.value.isEnable) {
|
||||
showPreview.value = true;
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.u-flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
.preview {
|
||||
padding: 8rpx 32rpx;
|
||||
border-radius: 12rpx;
|
||||
background: $my-main-color;
|
||||
color: #ffffff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.preview-box {
|
||||
width: 700rpx;
|
||||
padding: 32rpx 28rpx;
|
||||
position: relative;
|
||||
.close {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: -100rpx;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
41
components/modal-list.vue
Normal file
41
components/modal-list.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<view>
|
||||
<officialAccount
|
||||
v-if="showOfficialAccount"
|
||||
@close="modelClose($event, 'officialAccount')"
|
||||
/>
|
||||
<couponModal
|
||||
v-if="showCoupon"
|
||||
getMode="eat"
|
||||
@close="modelClose($event, 'coupon')"
|
||||
/>
|
||||
<birthdayGift v-if="showBirthdayGift" @close="modelClose($event, 'birthdayGift')" />
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, watch, computed, reactive, toRaw } from "vue";
|
||||
import couponModal from "@/components/coupon-modal.vue";
|
||||
import birthdayGift from "@/components/birthday-modal.vue";
|
||||
import officialAccount from "@/components/official-account.vue";
|
||||
//弹窗列表
|
||||
const list = ref([]);
|
||||
|
||||
const showBirthdayGift = ref(true);
|
||||
const showCoupon = ref(false);
|
||||
const showOfficialAccount = ref(false);
|
||||
|
||||
function modelClose(e, type) {
|
||||
console.log("modelClose", type);
|
||||
if (type == "birthdayGift") {
|
||||
showCoupon.value = true;
|
||||
return;
|
||||
}
|
||||
if (type == "coupon") {
|
||||
showOfficialAccount.value = true;
|
||||
return;
|
||||
}
|
||||
if (type == "officialAccount") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
116
components/official-account.vue
Normal file
116
components/official-account.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<!-- 首页优惠券弹窗 -->
|
||||
<template>
|
||||
<up-popup :show="show" bgColor="transparent" mode="center" @close="close">
|
||||
<view class="container">
|
||||
<view class="content">
|
||||
<image class="bg" :src="bgUrl" mode="widthFix"></image>
|
||||
<view class="info">
|
||||
<view class="u-flex u-row-center">
|
||||
<image
|
||||
:show-menu-by-longpress="true"
|
||||
:src="code"
|
||||
style="height: 240rpx"
|
||||
mode="heightFix"
|
||||
></image>
|
||||
</view>
|
||||
<view
|
||||
class="color-999 font-12 text-center u-m-t-10"
|
||||
style="line-height: 36rpx"
|
||||
>长按识别关注,更多优惠不能错过</view
|
||||
>
|
||||
</view>
|
||||
<view class="close" @click="close">
|
||||
<up-icon name="close-circle" size="34" color="#fff"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import _ from "lodash";
|
||||
import dayjs from "dayjs";
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
const bgUrl = ref(
|
||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/41239c8852874aa39d1f106e45456e10.png"
|
||||
);
|
||||
|
||||
const show = ref(false);
|
||||
const code = ref(
|
||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240408/4d6e818a01f145a898d8c2368f4b5ad1.jpg"
|
||||
);
|
||||
|
||||
|
||||
const emit=defineEmits(['close'])
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
emit('close');
|
||||
}
|
||||
onMounted(() => {
|
||||
show.value = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.u-row-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 54rpx;
|
||||
.content {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
.close {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: -100rpx;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.bg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.info {
|
||||
position: absolute;
|
||||
bottom: 86rpx;
|
||||
left: 60rpx;
|
||||
right: 60rpx;
|
||||
}
|
||||
.btn-wrap {
|
||||
width: 60%;
|
||||
position: absolute;
|
||||
left: 20%;
|
||||
&.btn-wrap1 {
|
||||
bottom: 74upx;
|
||||
}
|
||||
&.btn-wrap2 {
|
||||
bottom: 74upx;
|
||||
}
|
||||
&.btn-wrap3 {
|
||||
bottom: 38upx;
|
||||
}
|
||||
.btn-img {
|
||||
width: 100%;
|
||||
}
|
||||
.t {
|
||||
font-size: 42upx;
|
||||
font-weight: bold;
|
||||
color: #b43a14;
|
||||
position: absolute;
|
||||
top: 44%;
|
||||
left: 54%;
|
||||
white-space: nowrap;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
26
components/order-finish-modal.vue
Normal file
26
components/order-finish-modal.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<view>
|
||||
<officialAccount
|
||||
v-if="showOfficialAccount"
|
||||
@close="modelClose($event, 'officialAccount')"
|
||||
/>
|
||||
<Drainage v-model="showDrainage" @close="modelClose($event, 'drainage')" />
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, watch, computed, reactive, toRaw } from "vue";
|
||||
import officialAccount from "@/components/official-account.vue";
|
||||
import Drainage from "@/components/drainage.vue";
|
||||
|
||||
const showDrainage = ref(true);
|
||||
const showOfficialAccount = ref(false);
|
||||
|
||||
function modelClose(e, type) {
|
||||
console.log("modelClose", type);
|
||||
if(type=='drainage'){
|
||||
showOfficialAccount.value = true;
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
260
components/paymentMethod copy.vue
Normal file
260
components/paymentMethod copy.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<!-- 支付方式 -->
|
||||
<view class="paymentMethod">
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChanges" :size="28"
|
||||
placement="column">
|
||||
<block v-for="(item,index) in paymentMethodList" :key="index">
|
||||
<view class="method_list" @click="groupChanges(item.type)" :class="{disabled:returnDisabled(item)}"
|
||||
v-if="(index+1) == radiovalue?!changeFreeenable:true">
|
||||
<view class="method_list_top">
|
||||
<view class="method_list_top_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill" />
|
||||
<view class="method_list_top_cen">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="method_list_bom" v-if="item.type == 1">
|
||||
<text class="balance">
|
||||
当前余额¥{{orderVIP?(orderVIP.amount||0):0}}</text>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<up-radio :disabled="returnDisabled(item)" activeColor="#E8AD7B" icon-size="18" size="18" :name="item.type">
|
||||
</up-radio>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
defineProps,
|
||||
computed,
|
||||
defineEmits,
|
||||
watch,
|
||||
watchEffect,
|
||||
defineExpose
|
||||
} from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
payAmount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
changeFreeenable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
disablePayType: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function returnDisabled(item) {
|
||||
if (props.disablePayType.includes(item.name)) {
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const orderVIP = ref(null)
|
||||
const emits = defineEmits(['customevent', 'groupChange']);
|
||||
watchEffect(() => {
|
||||
orderVIP.value = uni.cache.get('orderVIP')
|
||||
})
|
||||
|
||||
const orderVIPfun = (data) => {
|
||||
orderVIP.value = data
|
||||
}
|
||||
|
||||
const paymentMethodList = ref([
|
||||
// #ifdef MP-WEIXIN
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: 'wechatPay'
|
||||
},
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: 'aliPay'
|
||||
},
|
||||
// #endif
|
||||
{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: 'accountPay'
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
const paymentMethodName = ref([{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: 'accountPay'
|
||||
},
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: 'wechatPay'
|
||||
},
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: 'aliPay'
|
||||
},
|
||||
])
|
||||
|
||||
const radiovalue = ref(2) // 支付方式
|
||||
|
||||
const ispws = ref(false) // 输入支付密码
|
||||
|
||||
const storeInfo = ref({})
|
||||
|
||||
// * 监听支付方式切换
|
||||
const groupChanges = (type) => {
|
||||
if (props.freeCheck && type == 1) {
|
||||
return;
|
||||
}
|
||||
const item=paymentMethodList.value.find(v=>v.type==type)
|
||||
if(item&&returnDisabled(item)){
|
||||
uni.showToast({
|
||||
title:"当前支付方式不可用",
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
// if (props.payAmount <= 0 && type != 1) {
|
||||
// return;
|
||||
// }
|
||||
radiovalue.value = type;
|
||||
let name = paymentMethodName.value[type - 1].name;
|
||||
|
||||
emits("groupChange", paymentMethodName.value[type - 1])
|
||||
}
|
||||
|
||||
// 去充值
|
||||
const goRecharge = () => {
|
||||
if (orderVIP.value.isVip) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/member/czzx?shopId=' + orderVIP.value.shopId
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/user/vip/buy-vip?shopId=' + orderVIP.value.shopId
|
||||
})
|
||||
|
||||
// uni.pro.navigateTo('user/member/index', {
|
||||
// shopId: orderVIP.value.shopId
|
||||
// })
|
||||
}
|
||||
// 将方法暴露给父组件
|
||||
defineExpose({
|
||||
groupChanges,
|
||||
orderVIPfun
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.paymentMethod {
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
|
||||
.paymentMethod_content {
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding: 30rpx 30rpx 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.paymentMethod_title {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.method_list {
|
||||
padding: 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
&.disabled{
|
||||
opacity: .6;
|
||||
}
|
||||
.method_list_top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.method_list_top_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 54.67rpx !important;
|
||||
height: 48rpx !important;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.method_list_top_cen {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.method_list_bom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.balance {
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.topUpNow {
|
||||
color: #FF803D;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.method_list:nth-child(odd) {
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,260 +1,276 @@
|
||||
<template>
|
||||
<!-- 支付方式 -->
|
||||
<view class="paymentMethod">
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<up-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChanges" :size="28"
|
||||
placement="column">
|
||||
<block v-for="(item,index) in paymentMethodList" :key="index">
|
||||
<view class="method_list" @click="groupChanges(item.type)" :class="{disabled:returnDisabled(item)}"
|
||||
v-if="(index+1) == radiovalue?!changeFreeenable:true">
|
||||
<view class="method_list_top">
|
||||
<view class="method_list_top_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill" />
|
||||
<view class="method_list_top_cen">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="method_list_bom" v-if="item.type == 1">
|
||||
<text class="balance">
|
||||
当前余额¥{{orderVIP?(orderVIP.amount||0):0}}</text>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<up-radio :disabled="returnDisabled(item)" activeColor="#E8AD7B" icon-size="18" size="18" :name="item.type">
|
||||
</up-radio>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 支付方式 -->
|
||||
<view class="paymentMethod">
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<up-radio-group
|
||||
v-model="radiovalue"
|
||||
iconPlacement="right"
|
||||
@change="groupChanges"
|
||||
:size="28"
|
||||
placement="column"
|
||||
>
|
||||
<block v-for="(item, index) in paymentMethodList" :key="index">
|
||||
<view
|
||||
class="method_list"
|
||||
@click="groupChanges(item.type)"
|
||||
:class="{ disabled: returnDisabled(item) }"
|
||||
>
|
||||
<view class="method_list_top">
|
||||
<view class="method_list_top_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill" />
|
||||
<view class="method_list_top_cen">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="method_list_bom" v-if="item.type == 1">
|
||||
<text class="balance">
|
||||
当前余额¥{{ orderVIP ? orderVIP.amount || 0 : 0 }}</text
|
||||
>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<up-radio
|
||||
:disabled="returnDisabled(item)"
|
||||
activeColor="#E8AD7B"
|
||||
icon-size="18"
|
||||
size="18"
|
||||
:name="item.type"
|
||||
>
|
||||
</up-radio>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</up-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
defineProps,
|
||||
computed,
|
||||
defineEmits,
|
||||
watch,
|
||||
watchEffect,
|
||||
defineExpose
|
||||
} from 'vue'
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
defineProps,
|
||||
computed,
|
||||
defineEmits,
|
||||
watch,
|
||||
watchEffect,
|
||||
defineExpose,
|
||||
} from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
payAmount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
changeFreeenable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
disablePayType: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
const props = defineProps({
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
payAmount: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
changeFreeenable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
disablePayType: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
function returnDisabled(item) {
|
||||
if (props.disablePayType.includes(item.name)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function returnDisabled(item) {
|
||||
if (props.disablePayType.includes(item.name)) {
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
const orderVIP = ref(null);
|
||||
const emits = defineEmits(["customevent", "groupChange"]);
|
||||
watchEffect(() => {
|
||||
orderVIP.value = uni.cache.get("orderVIP");
|
||||
});
|
||||
|
||||
const orderVIP = ref(null)
|
||||
const emits = defineEmits(['customevent', 'groupChange']);
|
||||
watchEffect(() => {
|
||||
orderVIP.value = uni.cache.get('orderVIP')
|
||||
})
|
||||
const orderVIPfun = (data) => {
|
||||
orderVIP.value = data;
|
||||
};
|
||||
|
||||
const orderVIPfun = (data) => {
|
||||
orderVIP.value = data
|
||||
}
|
||||
const paymentMethodList = ref([
|
||||
// #ifdef MP-WEIXIN
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: "wechatPay",
|
||||
},
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: "aliPay",
|
||||
},
|
||||
// #endif
|
||||
{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: "accountPay",
|
||||
},
|
||||
]);
|
||||
|
||||
const paymentMethodList = ref([
|
||||
// #ifdef MP-WEIXIN
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: 'wechatPay'
|
||||
},
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: 'aliPay'
|
||||
},
|
||||
// #endif
|
||||
{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: 'accountPay'
|
||||
}
|
||||
])
|
||||
const paymentMethodName = ref([
|
||||
{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: "accountPay",
|
||||
},
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: "wechatPay",
|
||||
},
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: "aliPay",
|
||||
},
|
||||
]);
|
||||
|
||||
const radiovalue = ref(2); // 支付方式
|
||||
|
||||
const paymentMethodName = ref([{
|
||||
name: "余额支付",
|
||||
type: 1,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png",
|
||||
payType: 'accountPay'
|
||||
},
|
||||
{
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: 'wechatPay'
|
||||
},
|
||||
{
|
||||
name: "支付宝支付",
|
||||
type: 3,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png",
|
||||
payType: 'aliPay'
|
||||
},
|
||||
])
|
||||
const ispws = ref(false); // 输入支付密码
|
||||
|
||||
const radiovalue = ref(2) // 支付方式
|
||||
const storeInfo = ref({});
|
||||
|
||||
const ispws = ref(false) // 输入支付密码
|
||||
// * 监听支付方式切换
|
||||
const groupChanges = (type) => {
|
||||
if (props.freeCheck && type == 1) {
|
||||
return;
|
||||
}
|
||||
const item = paymentMethodList.value.find((v) => v.type == type);
|
||||
if (item && returnDisabled(item)) {
|
||||
uni.showToast({
|
||||
title: "当前支付方式不可用",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (props.payAmount <= 0 && type != 1) {
|
||||
// return;
|
||||
// }
|
||||
radiovalue.value = type;
|
||||
let name = paymentMethodName.value[type - 1].name;
|
||||
|
||||
const storeInfo = ref({})
|
||||
emits("groupChange", paymentMethodName.value[type - 1]);
|
||||
};
|
||||
|
||||
// * 监听支付方式切换
|
||||
const groupChanges = (type) => {
|
||||
if (props.freeCheck && type == 1) {
|
||||
return;
|
||||
}
|
||||
const item=paymentMethodList.value.find(v=>v.type==type)
|
||||
if(item&&returnDisabled(item)){
|
||||
uni.showToast({
|
||||
title:"当前支付方式不可用",
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
// if (props.payAmount <= 0 && type != 1) {
|
||||
// return;
|
||||
// }
|
||||
radiovalue.value = type;
|
||||
let name = paymentMethodName.value[type - 1].name;
|
||||
// 去充值
|
||||
const goRecharge = () => {
|
||||
if (props.disablePayType.includes("余额支付")) {
|
||||
return;
|
||||
}
|
||||
if (orderVIP.value.isVip) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/member/czzx?shopId=" + orderVIP.value.shopId,
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: "/user/vip/buy-vip?shopId=" + orderVIP.value.shopId,
|
||||
});
|
||||
|
||||
emits("groupChange", paymentMethodName.value[type - 1])
|
||||
}
|
||||
|
||||
// 去充值
|
||||
const goRecharge = () => {
|
||||
if (orderVIP.value.isVip) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/user/member/czzx?shopId=' + orderVIP.value.shopId
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/user/vip/buy-vip?shopId=' + orderVIP.value.shopId
|
||||
})
|
||||
|
||||
// uni.pro.navigateTo('user/member/index', {
|
||||
// shopId: orderVIP.value.shopId
|
||||
// })
|
||||
}
|
||||
// 将方法暴露给父组件
|
||||
defineExpose({
|
||||
groupChanges,
|
||||
orderVIPfun
|
||||
});
|
||||
// uni.pro.navigateTo('user/member/index', {
|
||||
// shopId: orderVIP.value.shopId
|
||||
// })
|
||||
};
|
||||
// 将方法暴露给父组件
|
||||
defineExpose({
|
||||
groupChanges,
|
||||
orderVIPfun,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.paymentMethod {
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
.paymentMethod {
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
|
||||
.paymentMethod_content {
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding: 30rpx 30rpx 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
.paymentMethod_content {
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding: 30rpx 30rpx 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.paymentMethod_title {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.paymentMethod_title {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.method_list {
|
||||
padding: 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
&.disabled{
|
||||
opacity: .6;
|
||||
}
|
||||
.method_list_top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.method_list {
|
||||
padding: 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
.method_list_top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.method_list_top_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.method_list_top_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 54.67rpx !important;
|
||||
height: 48rpx !important;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
.icon {
|
||||
width: 54.67rpx !important;
|
||||
height: 48rpx !important;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.method_list_top_cen {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.method_list_top_cen {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.method_list_bom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.method_list_bom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.balance {
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.balance {
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.topUpNow {
|
||||
color: #ff803d;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.topUpNow {
|
||||
color: #FF803D;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.method_list:nth-child(odd) {
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
.method_list:nth-child(odd) {
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||
const debug = false
|
||||
const debug = true
|
||||
// #ifdef H5
|
||||
const proxyApi = "/api"
|
||||
// #endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,92 +1,107 @@
|
||||
<template>
|
||||
<!-- 充值免单 -->
|
||||
<view class="rechargeFree">
|
||||
<view class="rechargeFree_bg" @click="changeFree">
|
||||
<view class="left">
|
||||
<view class="icon">优惠</view>
|
||||
<view class="text">
|
||||
充值消费{{freeDineConfig.rechargeTimes}}倍(订单满¥{{freeDineConfig.rechargeThreshold}}元可用),本单立享免单!</view>
|
||||
</view>
|
||||
<up-checkbox :disabled="!freeDineConfig.enable" @change="change" shape="circle" usedAlone v-model:checked="changeFreeenable" icon-size="20" size="20">
|
||||
</up-checkbox>
|
||||
<!-- <up-checkbox-group iconPlacement="right">
|
||||
<!-- 充值免单 -->
|
||||
<view class="rechargeFree">
|
||||
<view class="rechargeFree_bg" @click="itemClick">
|
||||
<view class="left">
|
||||
<view class="icon">优惠</view>
|
||||
<view class="text">
|
||||
充值消费{{ freeDineConfig.rechargeTimes }}倍(订单满¥{{
|
||||
freeDineConfig.rechargeThreshold
|
||||
}}元可用),本单立享免单!</view
|
||||
>
|
||||
</view>
|
||||
<view @click.stop="()=>{}">
|
||||
<up-checkbox
|
||||
:disabled="!freeDineConfig.enable"
|
||||
@change="changeFree"
|
||||
shape="circle"
|
||||
activeColor="#E8AD7B"
|
||||
usedAlone
|
||||
v-model:checked="changeFreeenable"
|
||||
icon-size="20"
|
||||
size="20"
|
||||
>
|
||||
</up-checkbox>
|
||||
</view>
|
||||
|
||||
<!-- <up-checkbox-group iconPlacement="right">
|
||||
<up-checkbox : v-model="changeFreeenable"
|
||||
:checked="freeDineConfig.enable" @change="change" activeColor="#E8AD7B" shape="circle"
|
||||
icon-size="16" size="16">
|
||||
</up-checkbox>
|
||||
</up-checkbox-group> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
defineProps,
|
||||
defineEmits
|
||||
} from 'vue';
|
||||
import { ref, defineProps, defineEmits } from "vue";
|
||||
|
||||
// 定义接收的属性
|
||||
const props = defineProps({
|
||||
freeDineConfig: {
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
payAmount: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
});
|
||||
// 定义接收的属性
|
||||
const props = defineProps({
|
||||
freeDineConfig: {
|
||||
type: Object,
|
||||
default: {},
|
||||
},
|
||||
payAmount: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
function itemClick(){
|
||||
changeFreeenable.value = !changeFreeenable.value;
|
||||
emits("changeFree", changeFreeenable.value);
|
||||
|
||||
const emits = defineEmits(['changeFree']);
|
||||
}
|
||||
const emits = defineEmits(["changeFree"]);
|
||||
|
||||
const changeFreeenable = ref(false)
|
||||
const changeFreeenable = ref(false);
|
||||
|
||||
/**
|
||||
* 监听是否免单
|
||||
*/
|
||||
const change = (e) => {
|
||||
emits('changeFree', e);
|
||||
}
|
||||
/**
|
||||
* 监听是否免单
|
||||
*/
|
||||
const changeFree = (e) => {
|
||||
emits("changeFree", e);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.rechargeFree {
|
||||
// padding: 0 20rpx;
|
||||
margin-top: 32rpx;
|
||||
.rechargeFree {
|
||||
// padding: 0 20rpx;
|
||||
margin-top: 32rpx;
|
||||
|
||||
.rechargeFree_bg {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: #fff;
|
||||
.rechargeFree_bg {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 32rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 68rpx;
|
||||
height: 36rpx;
|
||||
text-align: center;
|
||||
line-height: 36rpx;
|
||||
background: linear-gradient(180deg, #FEDE81 0%, #FEB263 100%);
|
||||
border-radius: 12rpx 0rpx 12rpx 0rpx;
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.icon {
|
||||
width: 68rpx;
|
||||
height: 36rpx;
|
||||
text-align: center;
|
||||
line-height: 36rpx;
|
||||
background: linear-gradient(180deg, #fede81 0%, #feb263 100%);
|
||||
border-radius: 12rpx 0rpx 12rpx 0rpx;
|
||||
font-weight: 500;
|
||||
font-size: 20rpx;
|
||||
color: #ffffff;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 80%;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.text {
|
||||
width: 80%;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,65 +1,13 @@
|
||||
<template>
|
||||
<view class="u-p-30">
|
||||
<view>
|
||||
<up-button type="warning" @click="popupShow">初始化</up-button>
|
||||
</view>
|
||||
<view class="u-m-t-30">
|
||||
<up-button type="primary" @click="toCreate">去下单</up-button>
|
||||
</view>
|
||||
|
||||
<up-popup :show="show" mode="bottom" close-on-click-overlay @close="resetForm">
|
||||
<view class="u-p-30">
|
||||
<up-form label-width="80" ref="refForm">
|
||||
<up-form-item label="台桌码">
|
||||
<up-input v-model="form.tableCode" placeholder="请输入台桌码"></up-input>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
<view class="u-flex gap-20 u-m-t-30">
|
||||
<up-button @click="show=false">取消</up-button>
|
||||
<up-button type="primary" @click="scanCodehandle">确定</up-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</up-popup>
|
||||
</view>
|
||||
<view class="u-p-30">
|
||||
<birthdayGift></birthdayGift>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {onLoad} from '@dcloudio/uni-app'
|
||||
import { reactive,ref} from 'vue'
|
||||
import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
const store = productStore();
|
||||
const scanCodehandle = async (i) => {
|
||||
await store.scanCodeactions(form)
|
||||
}
|
||||
const show=ref(false);
|
||||
const options=ref({})
|
||||
function popupShow(){
|
||||
show.value=true;
|
||||
}
|
||||
const refForm=ref(null);
|
||||
const form=reactive({
|
||||
tableCode:"40963902920"
|
||||
})
|
||||
function resetForm(){
|
||||
form.tableCode=""
|
||||
}
|
||||
onLoad((opt)=>{
|
||||
console.log(opt);
|
||||
options.value=opt
|
||||
})
|
||||
function toCreate(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}
|
||||
import birthdayGift from "@/components/birthday-modal.vue";
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.gap-20{
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
1157
stores/carts.js
1157
stores/carts.js
File diff suppressed because it is too large
Load Diff
@@ -23,10 +23,7 @@ export const Memberpay = defineStore('memberpay', {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
let res = await APIpayltPayVip({
|
||||
shopId: data.shopId,
|
||||
shopUserId: data.shopUserId,
|
||||
amount: data.amount,
|
||||
activateId: data.activateId,
|
||||
...data,
|
||||
// #ifdef MP-WEIXIN
|
||||
payType: 'wechatPay',
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
@@ -35,11 +32,6 @@ export const Memberpay = defineStore('memberpay', {
|
||||
payType: 'aliPay',
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
// #endif
|
||||
returnUrl: data.returnUrl ? data.returnUrl : '',
|
||||
buyerRemark: data.buyerRemark ? data.buyerRemark : '',
|
||||
orderId: data.orderId,
|
||||
userAllPack: data.userAllPack,
|
||||
seatNum:data.seatNum
|
||||
})
|
||||
if (res) {
|
||||
uni.showLoading({
|
||||
@@ -67,20 +59,20 @@ export const Memberpay = defineStore('memberpay', {
|
||||
title: "支付成功"
|
||||
})
|
||||
console.log('支付成功')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
resolve(res)
|
||||
// setTimeout(() => {
|
||||
// uni.navigateBack()
|
||||
// }, 1000)
|
||||
resolve(true)
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if (res.resultCode == '9000') {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1000)
|
||||
resolve(res)
|
||||
// setTimeout(() => {
|
||||
// uni.navigateBack()
|
||||
// }, 1000)
|
||||
resolve(true)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败"
|
||||
@@ -163,14 +155,14 @@ export const Memberpay = defineStore('memberpay', {
|
||||
title: "支付成功"
|
||||
})
|
||||
console.log('支付成功')
|
||||
resolve(res)
|
||||
resolve(true)
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if (res.resultCode == '9000') {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
resolve(res)
|
||||
resolve(true)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败"
|
||||
|
||||
@@ -104,6 +104,7 @@ export const productStore = defineStore('product', {
|
||||
},
|
||||
// 扫码请求
|
||||
scanCodeactions(q) {
|
||||
console.log('扫码内容', q)
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (q) {
|
||||
console.log(q)
|
||||
@@ -121,7 +122,7 @@ export const productStore = defineStore('product', {
|
||||
// 储存卓玛
|
||||
uni.cache.set('tableCode', tableCode)
|
||||
if (tableCode) {
|
||||
console.log(uni.cache.get('tableCode'));
|
||||
console.log('台桌码', uni.cache.get('tableCode'));
|
||||
let data = await this.actionsproductqueryShop(tableCode)
|
||||
|
||||
console.log('data', data)
|
||||
@@ -194,6 +195,7 @@ export const productStore = defineStore('product', {
|
||||
|
||||
// /通过桌码获取当前店铺信息
|
||||
actionsproductqueryShop(tableCode) {
|
||||
console.log('台桌码',tableCode);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
// try {
|
||||
try {
|
||||
@@ -213,7 +215,7 @@ export const productStore = defineStore('product', {
|
||||
|
||||
resolve(res)
|
||||
} else {
|
||||
console.log(res)
|
||||
console.error('通过桌码获取当前店铺信息失败' ,res)
|
||||
reject()
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +295,7 @@ export function calcDiscountGoodsArrPrice(discountGoodsArr, discountNum, user, s
|
||||
* @param shopInfo 店铺信息
|
||||
*/
|
||||
export function returnCouponDiscount(arr, coupon, user, goodsOrderPrice, selCoupon, shopInfo) {
|
||||
arr = returnCanDikouGoods(arr, user, shopInfo);
|
||||
const canDikouGoodsArr = returnCanDikouGoodsArr(arr, selCoupon, user);
|
||||
if (coupon.type == 2) {
|
||||
return returnCouponProductDiscount(canDikouGoodsArr, coupon, user, shopInfo);
|
||||
@@ -423,7 +424,6 @@ function returnCouponBuyOneGiveOneDiscount(canDikouGoodsArr, coupon, user, shopI
|
||||
}
|
||||
let discountPrice = 0;
|
||||
let hasDiscountGoodsArr = [];
|
||||
console.log("returnCouponBuyOneGiveOneDiscount:discountGoods", discountGoods);
|
||||
if (discountGoods) {
|
||||
discountPrice = returnGoodsPrice(discountGoods, user, shopInfo);
|
||||
hasDiscountGoodsArr = [discountGoods];
|
||||
|
||||
1374
utils/goods.ts
Normal file
1374
utils/goods.ts
Normal file
File diff suppressed because it is too large
Load Diff
112
utils/pay.js
112
utils/pay.js
@@ -1,57 +1,57 @@
|
||||
export const pay = (res) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showLoading({
|
||||
title: '支付中...',
|
||||
mask: true
|
||||
})
|
||||
uni.requestPayment({
|
||||
// #ifdef MP-WEIXIN
|
||||
provider: 'wxpay', //支付类型-固定值
|
||||
partnerid: res.appId, // 微信支付商户号
|
||||
timeStamp: res.timeStamp, // 时间戳(单位:秒)
|
||||
nonceStr: res.nonceStr, // 随机字符串
|
||||
package: res.package, // 固定值
|
||||
signType: res.signType, //固定值
|
||||
paySign: res.paySign, //签名
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
provider: 'alipay', //支付类型-固定值
|
||||
orderInfo: res.tradeNo, // 微信支付商户号
|
||||
// #endif
|
||||
success: (res) => {
|
||||
console.log('pay');
|
||||
console.log(res);
|
||||
uni.hideLoading()
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon:'none'
|
||||
})
|
||||
console.log('支付成功')
|
||||
resolve(res)
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if (res.resultCode == '9000') {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon:'none'
|
||||
})
|
||||
resolve(res)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon:'none'
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
fail: (res) => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
}, 1000)
|
||||
reject(false)
|
||||
},
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.showLoading({
|
||||
title: "支付中...",
|
||||
mask: true,
|
||||
});
|
||||
uni.requestPayment({
|
||||
// #ifdef MP-WEIXIN
|
||||
provider: "wxpay", //支付类型-固定值
|
||||
partnerid: res.appId, // 微信支付商户号
|
||||
timeStamp: res.timeStamp, // 时间戳(单位:秒)
|
||||
nonceStr: res.nonceStr, // 随机字符串
|
||||
package: res.package, // 固定值
|
||||
signType: res.signType, //固定值
|
||||
paySign: res.paySign, //签名
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
provider: "alipay", //支付类型-固定值
|
||||
orderInfo: res.tradeNo, // 微信支付商户号
|
||||
// #endif
|
||||
success: (res) => {
|
||||
console.log("pay");
|
||||
console.log(res);
|
||||
uni.hideLoading();
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "none",
|
||||
});
|
||||
console.log("支付成功");
|
||||
resolve(true);
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if (res.resultCode == "9000") {
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "none",
|
||||
});
|
||||
resolve(true);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
reject(false);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
fail: (res) => {
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
reject(false);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user