优化套餐、拼团、分销、积分分享功能

This commit is contained in:
gyq
2026-01-21 16:41:49 +08:00
parent 8f1b21bf00
commit a0cc43e118
8 changed files with 4134 additions and 4511 deletions

View File

@@ -1,38 +1,21 @@
<template>
<view class="">
<view class="w-qrcode">
<w-qrcode
:options="codeOptions"
:opacity="0"
ref="wQrcode"
@generate="(e) => qrcodeResult(e)"
></w-qrcode>
<w-qrcode :options="codeOptions" :opacity="0" ref="wQrcode" @generate="(e) => qrcodeResult(e)"></w-qrcode>
</view>
<up-popup
:show="show"
bgColor="transparent"
:safeAreaInsetBottom="false"
:closeOnClickOverlay="true"
@close="close"
mode="center"
>
<up-popup :show="show" bgColor="transparent" :safeAreaInsetBottom="false" :closeOnClickOverlay="true" @close="close" mode="center">
<view class="box">
<view class="info">
<view class="u-flex justify-center">
<up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar>
</view>
<view
class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54"
>
<view>{{ shopUserInfo.nickName }} </view>
<view class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54">
<view>{{ shopUserInfo.nickName }}</view>
<view>{{ desensitizePhone(shopUserInfo.phone) }}</view>
</view>
<view class="u-m-t-16 font-14 line-height-54 text-center">
<text class="color-666">邀请码</text>
<text class="u-m-l-16 u-m-r-16 color-333 font-16 font-700">{{
inviteCode
}}</text>
<text class="u-m-l-16 u-m-r-16 color-333 font-16 font-700">{{ inviteCode }}</text>
<text class="" style="color: #fe6d11" @click="copyCode">复制</text>
</view>
<view class="u-flex justify-center" style="margin-top: 90rpx">
@@ -44,58 +27,59 @@
></w-qrcode> -->
<up-image width="322rpx" height="322rpx" :src="code"></up-image>
</view>
<view class="u-m-t-60 u-flex u-col-center justify-center">
<view class="confirm" @click="save">保存图片</view>
</view>
<view class="footer-wrap">
<view class="confirm line" @click="save">保存图片</view>
<ymf-share><view class="confirm">微信分享</view></ymf-share>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import wQrcode from "@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue";
import {desensitizePhone} from "@/utils/util.js";
import { ref } from "vue";
<script setup>
import ymfShare from '@/components/ymf-components/ymf-share.vue';
import wQrcode from '@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue';
import { desensitizePhone } from '@/utils/util.js';
import { ref } from 'vue';
const props = defineProps({
inviteCode: {
type: String,
default: "",
default: ''
},
shopUserInfo: {
type: Object,
default: () => {},
},
default: () => {}
}
});
const codeOptions = ref({
size: 200,
code: props.inviteCode,
code: props.inviteCode
});
function copyCode() {
uni.setClipboardData({
data: props.inviteCode,
success: function () {
console.log("success");
},
console.log('success');
}
});
}
const code = ref("");
const code = ref('');
function qrcodeResult(e) {
console.log("qrcodeResult", e);
console.log('qrcodeResult', e);
code.value = e.img.tempFilePath;
console.log("code", code.value);
console.log('code', code.value);
}
const show = defineModel({
type: Boolean,
default: false,
default: false
});
const emits = defineEmits(["cancel", "confirm"]);
const emits = defineEmits(['cancel', 'confirm']);
function close() {
show.value = false;
emits("cancel");
emits('cancel');
}
function save() {
show.value = false;
@@ -105,7 +89,7 @@ function save() {
filePath: code.value,
success: function () {
uni.showToast({
title: "保存成功",
title: '保存成功',
icon: 'none'
});
},
@@ -151,14 +135,14 @@ function save() {
} else {
// 非授权问题的保存失败(如文件路径错误、系统问题等)
uni.showToast({
title: "保存失败",
title: '保存失败',
icon: 'none'
});
}
},
}
});
emits("confirm", code.value);
emits('confirm', code.value);
}
</script>
@@ -175,7 +159,8 @@ function save() {
width: 638rpx;
background-color: #fff;
border-radius: 16rpx;
overflow: hidden;
// overflow: hidden;
position: relative;
.title {
color: #000000;
font-size: 32rpx;
@@ -192,6 +177,14 @@ function save() {
min-width: 84rpx;
text-align: right;
}
.footer-wrap {
width: 100%;
position: absolute;
left: 0;
bottom: -100upx;
display: flex;
gap: 28upx;
}
}
.cancel {
@@ -205,15 +198,23 @@ function save() {
line-height: 48rpx;
}
.confirm {
$color: #e8ad7b;
flex: 1;
padding: 14rpx 76rpx;
border-radius: 16rpx;
background-color: #e8ad7b;
border: 2rpx solid #e8ad7b;
background-color: $color;
border: 2rpx solid $color;
color: #fff;
font-size: 32rpx;
font-weight: 400;
line-height: 48rpx;
white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
&.line {
background-color: #fff;
color: $color;
}
}
.line-height-54 {
line-height: 54rpx;
@@ -225,4 +226,3 @@ function save() {
z-index: -1;
}
</style>

View File

@@ -1,74 +1,37 @@
<template>
<view class="min-h-100vh bg-gray">
<up-navbar
bg-color="transparent"
title="分销中心"
@leftClick="back"
:fixed="true"
></up-navbar>
<up-navbar bg-color="transparent" title="分销中心" @leftClick="back" :fixed="true"></up-navbar>
<view class="top">
<image
class="top_bg"
src="/distribution/static/top_bg.png"
:style="imageStyle"
></image>
<image class="top_bg" src="/distribution/static/top_bg.png" :style="imageStyle"></image>
<view class="box" :class="{ type1: isActivated }">
<view class="u-flex align-center justify-between">
<view class="u-flex align-center">
<!-- <up-avatar size="62rpx" /> -->
<text class="u-m-l-14 font-14 color-333 font-700">{{
state.shopName
}}</text>
<text class="u-m-l-14 font-14 color-333 font-700">{{ state.shopName }}</text>
</view>
<view>
<template v-if="state.parentPhone">
<view class="font-12 color-666">
上级{{ state.parentName }}{{ state.parentPhone }}
</view>
<view class="font-12 color-666">上级{{ state.parentName }}{{ state.parentPhone }}</view>
</template>
<template v-if="!state.parentPhone">
<view class="bind" @click="showBindShangji = true">
绑定上级
</view>
<view class="bind" @click="showBindShangji = true">绑定上级</view>
</template>
</view>
</view>
<view
class="top_content type1 u-m-t-32"
v-if="state.distributionUser && state.distributionUser.level"
>
<view class="top_content type1 u-m-t-32" v-if="state.distributionUser && state.distributionUser.level">
<view class="font-14">
<view class="u-flex align-center">
<text class="color-666">我的分销等级</text>
<text
class="color-333 font-700 u-m-r-6"
v-if="state.distributionUser"
>{{ state.distributionUser.level }}
{{ state.distributionUser.levelName }}</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('等级升级条件')"
/>
<text class="color-333 font-700 u-m-r-6" v-if="state.distributionUser">
{{ state.distributionUser.level }} {{ state.distributionUser.levelName }}
</text>
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('等级升级条件')" />
</view>
<view
class="u-m-t-28 u-flex align-center"
v-if="
juNextLvMoney &&
state.distributionUser &&
state.distributionUser.isAssignLevel == 0
"
>
<view class="u-m-t-28 u-flex align-center" v-if="juNextLvMoney && state.distributionUser && state.distributionUser.isAssignLevel == 0">
<text class="color-666">距离下一级还差</text>
<text class="color-333 font-700 u-m-r-18"
>{{ juNextLvMoney }}
</text>
<text class="color-333 font-700 u-m-r-18"
>{{ config.upgradeType == "cost" ? "元" : "人" }}
</text>
<text class="color-333 font-700 u-m-r-18">{{ juNextLvMoney }}</text>
<text class="color-333 font-700 u-m-r-18">{{ config.upgradeType == 'cost' ? '元' : '人' }}</text>
<!-- <up-icon
name="question-circle"
size="24rpx"
@@ -79,45 +42,17 @@
<view class="u-flex u-m-t-28">
<view class="u-flex-1">
<view class="u-flex align-center">
<text
class="u-m-r-10 font-12 color-666"
@click="toShouyiDetail('')"
>总收益</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('总收益')"
/>
<text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('')">总收益</text>
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('总收益')" />
</view>
<view
class="u-m-t-16 price"
@click="toShouyiDetail('')"
v-if="state.distributionUser"
>{{ state.distributionUser.totalIncome }}</view
>
<view class="u-m-t-16 price" @click="toShouyiDetail('')" v-if="state.distributionUser">{{ state.distributionUser.totalIncome }}</view>
</view>
<view class="u-flex-1">
<view class="u-flex align-center">
<text
class="u-m-r-10 font-12 color-666"
@click="toShouyiDetail('待入账')"
>待入账</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('待入账')"
/>
<text class="u-m-r-10 font-12 color-666" @click="toShouyiDetail('待入账')">待入账</text>
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('待入账')" />
</view>
<view
class="u-m-t-16 price"
@click="toShouyiDetail('待入账')"
v-if="state.distributionUser"
>{{ state.distributionUser.pendingIncome }}</view
>
<view class="u-m-t-16 price" @click="toShouyiDetail('待入账')" v-if="state.distributionUser">{{ state.distributionUser.pendingIncome }}</view>
</view>
</view>
</view>
@@ -125,37 +60,21 @@
<template v-else>
<view class="top_content u-m-t-32" v-if="config">
<template v-if="config.openType == 'auto'">
<view class="color-333 font-16 font-700"> 如何成为分销员 </view>
<view class="color-333 font-16 font-700">如何成为分销员</view>
<view class="u-m-t-16 color-666 font-14">
<view> 需要邀请人数:{{ config.inviteCount }}人</view>
<view
>是否需要邀请人数下单:{{
config.inviteConsume ? "是" : "否"
}}
</view>
<view
>每人可获得的分销奖励次数:{{
config.rewardCount == -1
? "永久"
: config.rewardCount + "次"
}}
</view>
<view>需要邀请人数{{ config.inviteCount }}</view>
<view>是否需要邀请人数下单{{ config.inviteConsume ? '是' : '否' }}</view>
<view>每人可获得的分销奖励次数{{ config.rewardCount == -1 ? '永久' : config.rewardCount + '次' }}</view>
</view>
</template>
<template v-if="config.openType == 'pay'">
<view class="color-333 font-16 font-700 text-center">
如何成为分销员
</view>
<view class="color-333 font-16 font-700 text-center">如何成为分销员</view>
<view class="u-m-t-16 color-666 font-14 text-center">
<view
>只需付费{{ config.payAmount || "" }}元,即可成为分销员</view
>
<view>只需付费{{ config.payAmount || '' }}即可成为分销员</view>
</view>
</template>
<template v-if="config.openType == 'manual'">
<view class="color-333 font-16 font-700 text-center">
如何成为分销员
</view>
<view class="color-333 font-16 font-700 text-center">如何成为分销员</view>
<view class="u-m-t-16 color-666 font-14 text-center">
<view>请联系商家咨询详情</view>
</view>
@@ -168,42 +87,18 @@
<view class="bottom type1" v-if="isActivated">
<view class="u-flex justify-between align-center">
<view class="u-flex align-center">
<view class="color-333 font-16 u-m-r-6"
>我的邀请({{ inviteUserRes.totalRow }}</view
>
<up-icon
name="question-circle"
size="24rpx"
@click="showRule = true"
color="#666"
/>
<view class="color-333 font-16 u-m-r-6">我的邀请{{ inviteUserRes.totalRow }}</view>
<up-icon name="question-circle" size="24rpx" @click="showRule = true" color="#666" />
</view>
<view class="font-10 color-999 u-flex align-center">
<text
>分成比例{{ state.distributionUser.levelOneCommission || 0 }}%</text
>
<up-icon
name="question-circle"
size="24rpx"
color="#666"
@click="questionClick('等级分成比例')"
/>
<text>分成比例{{ state.distributionUser.levelOneCommission || 0 }}%</text>
<up-icon name="question-circle" size="24rpx" color="#666" @click="questionClick('等级分成比例')" />
</view>
</view>
<view class="tabs" v-if="false">
<view
class="tabs-item"
:class="{ active: activeTab == 'distributor' }"
@click="activeTab = 'distributor'"
>分销员</view
>
<view
class="tabs-item"
:class="{ active: activeTab == 'inviter' }"
@click="activeTab = 'inviter'"
>邀请人</view
>
<view class="tabs-item" :class="{ active: activeTab == 'distributor' }" @click="activeTab = 'distributor'">分销员</view>
<view class="tabs-item" :class="{ active: activeTab == 'inviter' }" @click="activeTab = 'inviter'">邀请人</view>
</view>
<view class="u-m-t-48 font-14">
@@ -213,11 +108,7 @@
<view>邀请时间</view>
</view>
<view class="u-m-t-16">
<view
v-for="(item, index) in userList"
:key="index"
class="u-flex justify-between align-center recoder-item color-666 font-12"
>
<view v-for="(item, index) in userList" :key="index" class="u-flex justify-between align-center recoder-item color-666 font-12">
<view class="">
<view class="u-line-1" style="max-width: 160rpx">
<text>
@@ -225,22 +116,18 @@
</text>
</view>
<view class="u-line-1" style="max-width: 160rpx">
<text v-if="item.levelName"> ( {{ item.levelName }}) </text>
<text v-if="item.levelName">( {{ item.levelName }})</text>
</view>
<view>{{ desensitizePhone(item.shopUserPhone) }}</view>
</view>
<view>
<text>{{ item.oneIncome }}</text>
<text v-if="item.distributionLevelName"
>{{ item.distributionLevelName }}</text
>
<text v-if="item.distributionLevelName">{{ item.distributionLevelName }}</text>
</view>
<view>
<text v-if="item.inviteTime">{{
item.inviteTime.split(" ")[0]
}}</text>
<text style="color: #fff" v-else>{{ "yyyy-MM-dd" }}</text>
<text v-if="item.inviteTime">{{ item.inviteTime.split(' ')[0] }}</text>
<text style="color: #fff" v-else>{{ 'yyyy-MM-dd' }}</text>
</view>
</view>
</view>
@@ -254,26 +141,20 @@
<view>
<view class="font-12 color-666 u-m-t-16">
<view>
<view> 我的收益什么时候可以到账?</view>
<view> 分销的结算时长为{{ config.settlementDay || 0 }}天</view>
<view>我的收益什么时候可以到账</view>
<view>分销的结算时长为{{ config.settlementDay || 0 }}</view>
</view>
<template
v-if="
config.upgradeType != 'not_upgrade' &&
config.levelConfigList &&
config.levelConfigList.length >= 2
"
>
<template v-if="config.upgradeType != 'not_upgrade' && config.levelConfigList && config.levelConfigList.length >= 2">
<view class="u-m-t-40">
<view>怎么样才能升级分销员等级</view>
<template v-if="config.upgradeType == 'invite' && nextLvMoney">
<view>邀请的有效人数达到{{ nextLvMoney }}人即可升级</view>
<view class="u-m-t-40"> 什么是有效邀请人数</view>
<view> 被邀请人在店铺消费过即有一笔订单完成才算有效</view>
<view class="u-m-t-40">什么是有效邀请人数</view>
<view>被邀请人在店铺消费过即有一笔订单完成才算有效</view>
</template>
<template v-if="config.upgradeType == 'cost' && nextLvMoney">
<view> 消费金额总计达到{{ nextLvMoney }}元即可升级</view>
<view>消费金额总计达到{{ nextLvMoney }}元即可升级</view>
</template>
<template v-else>
@@ -284,9 +165,7 @@
<view class="u-m-t-40" v-if="config.upgradeType == 'cost'">
<view>消费金额如何计算</view>
<view
>消费金额是计算您和您邀请的人在店铺消费的总金额,但退款订单不计入</view
>
<view>消费金额是计算您和您邀请的人在店铺消费的总金额但退款订单不计入</view>
</view>
</view>
</view>
@@ -297,11 +176,7 @@
<view style="height: 240rpx"></view>
</template>
<view
class="tips u-m-t-32"
v-if="state.distributionUser && state.distributionUser.status"
>您的分销员身份已取消,不再获得分成有疑问可联系商家</view
>
<view class="tips u-m-t-32" v-if="state.distributionUser && state.distributionUser.status">您的分销员身份已取消不再获得分成有疑问可联系商家</view>
<view class="u-flex justify-center bottom-btn" v-if="showInviteCode">
<view class="copy" @click="copyCode">
@@ -313,98 +188,72 @@
</view>
</view>
<view
class="buy"
v-if="config.openType == 'pay' && config.payAmount && !isActivated"
@click="buy"
>
付费{{ config.payAmount }}元开通
</view>
<view class="buy" v-if="config.openType == 'pay' && config.payAmount && !isActivated" @click="buy">付费{{ config.payAmount }}元开通</view>
<bindShangji
v-model="showBindShangji"
@confirm="confirmBindShangji"
></bindShangji>
<bindShangji v-model="showBindShangji" @confirm="confirmBindShangji"></bindShangji>
<sharePopup
v-model="showSharePopup"
v-if="
(state.distributionUser && state.distributionUser.inviteCode) ||
inviteCode
"
:inviteCode="
state.distributionUser ? state.distributionUser.inviteCode : inviteCode
"
v-if="(state.distributionUser && state.distributionUser.inviteCode) || inviteCode"
:inviteCode="state.distributionUser ? state.distributionUser.inviteCode : inviteCode"
:shopUserInfo="shopUserInfo"
></sharePopup>
<TipsPopup v-model="showPopup" :tips-type="tipsType"></TipsPopup>
<commissionPopup
:tipsType="commissionTipsType"
v-model="showCommission"
:config="config"
:levelConfigList="config.levelConfigList || []"
></commissionPopup>
<rulePopup
v-model="showRule"
:config="config"
:distributionUser="state.distributionUser"
></rulePopup>
<commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config" :levelConfigList="config.levelConfigList || []"></commissionPopup>
<rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup>
</view>
</template>
<script setup>
import bindShangji from "./components/bind-shangji.vue";
import sharePopup from "./components/share-popup.vue";
import TipsPopup from "../components/tips-popup.vue";
import commissionPopup from "../components/commission.vue";
import rulePopup from "../components/rule.vue";
import { desensitizePhone } from "@/utils/util.js";
import BigNumber from "bignumber.js";
import * as distributionApi from "@/common/api/market/distribution.js";
import { distributionLtPayOrder } from "@/common/api/order/index.js";
import { APIshopUserInfo } from "@/common/api/member.js";
import { pay } from "@/utils/pay.js";
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import bindShangji from './components/bind-shangji.vue';
import sharePopup from './components/share-popup.vue';
import TipsPopup from '../components/tips-popup.vue';
import commissionPopup from '../components/commission.vue';
import rulePopup from '../components/rule.vue';
import { desensitizePhone } from '@/utils/util.js';
import BigNumber from 'bignumber.js';
import * as distributionApi from '@/common/api/market/distribution.js';
import { distributionLtPayOrder } from '@/common/api/order/index.js';
import { APIshopUserInfo } from '@/common/api/member.js';
import { pay } from '@/utils/pay.js';
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
const showBindShangji = ref(false);
const showSharePopup = ref(false);
import { ref, reactive, computed, watch } from "vue";
const content = ref("");
import { ref, reactive, computed, watch } from 'vue';
const content = ref('');
const showPopup = ref(false);
const showRule = ref(false);
const showCommission = ref(false);
const tipsType = ref("");
const commissionTipsType = ref("");
const tipsType = ref('');
const commissionTipsType = ref('');
function toShouyiDetail(name) {
uni.navigateTo({
url:
"/distribution/income-details/index?name=" +
name +
"&shopId=" +
options.shopId,
url: '/distribution/income-details/index?name=' + name + '&shopId=' + options.shopId
});
}
function questionClick(title) {
if (title == "总收益") {
tipsType.value = "总收益";
if (title == '总收益') {
tipsType.value = '总收益';
showPopup.value = true;
}
if (title == "待入账") {
tipsType.value = "待入账";
if (title == '待入账') {
tipsType.value = '待入账';
showPopup.value = true;
}
if (title == "等级分成比例") {
commissionTipsType.value = "等级分成比例";
if (title == '等级分成比例') {
commissionTipsType.value = '等级分成比例';
showCommission.value = true;
}
if (title == "等级升级条件") {
commissionTipsType.value = "等级升级条件";
if (title == '等级升级条件') {
commissionTipsType.value = '等级升级条件';
showCommission.value = true;
}
}
function back() {
uni.navigateBack({
delta: 1,
delta: 1
});
}
@@ -412,12 +261,12 @@ async function confirmBindShangji(code) {
const res = await distributionApi.bindInviteUser({
shopId: options.shopId,
inviteCode: code,
id: shopUserInfo.value.id,
id: shopUserInfo.value.id
});
if (res) {
uni.showToast({
title: "绑定成功",
icon: "none",
title: '绑定成功',
icon: 'none'
});
setTimeout(() => {
init();
@@ -434,32 +283,32 @@ function copyCode() {
uni.setClipboardData({
data: inviteCode.value,
success: function () {
console.log("success");
},
console.log('success');
}
});
}
const shopUserInfo = ref();
const config = reactive({});
//邀请码
const inviteCode = ref("");
const inviteCode = ref('');
async function init() {
const shopUserRes = await APIshopUserInfo({
shopId: options.shopId,
shopId: options.shopId
});
const configRes = await distributionApi.getConfig({
shopId: options.shopId,
shopId: options.shopId
});
Object.assign(config, configRes);
if (shopUserRes) {
shopUserInfo.value = shopUserRes;
}
if (configRes && configRes.openType == "auto") {
if (configRes && configRes.openType == 'auto') {
const codeRes = await distributionApi.getInviteCode({
shopId: options.shopId,
shopUserId: shopUserRes.id,
shopUserId: shopUserRes.id
});
if (codeRes) {
inviteCode.value = codeRes;
@@ -467,41 +316,41 @@ async function init() {
}
const res = await distributionApi.centerConfig({
shopId: options.shopId,
shopId: options.shopId
});
if (res) {
if (res.distributionId) {
options.type = "activates";
options.type = 'activates';
}
Object.assign(state, res);
if (res.distributionUser) {
inviteCode.value = res.distributionUser.inviteCode;
}
content.value = res.config ? res.config.notActivatedPage : "";
content.value = res.config ? res.config.notActivatedPage : '';
}
}
const options = reactive({ type: "" });
const options = reactive({ type: '' });
const imageStyle = computed(() => {
return {
height: isActivated.value ? "580rpx" : "580rpx",
height: isActivated.value ? '580rpx' : '580rpx'
};
});
async function buy() {
const res = await distributionLtPayOrder({
shopId: options.shopId,
userId: uni.cache.get("userInfo") ? uni.cache.get("userInfo").id : "",
returnUrl: "",
buyerRemark: "",
amount: "",
remark: "",
code: "",
userId: uni.cache.get('userInfo') ? uni.cache.get('userInfo').id : '',
returnUrl: '',
buyerRemark: '',
amount: '',
remark: '',
code: ''
});
const payRes = await pay(res);
if (payRes) {
uni.showToast({
title: "购买成功",
icon: "none",
title: '购买成功',
icon: 'none'
});
setTimeout(() => {
init();
@@ -511,39 +360,36 @@ async function buy() {
}
const state = reactive({
parentPhone: "",
parentName: "",
shopName: "",
parentPhone: '',
parentName: '',
shopName: ''
});
const query = reactive({
page: 1,
size: 10,
size: 10
});
const isEnd = ref(false);
const activeTab = ref("inviter");
const activeTab = ref('inviter');
const userList = ref([]);
const inviteUserRes = reactive({
records: [],
totalRow: 0,
totalPage: 0,
totalPage: 0
});
async function getRecoders() {
if (state.config) return;
const ajaxQuery = {
...query,
shopId: options.shopId,
shopId: options.shopId
};
if (activeTab.value == "distributor") {
if (activeTab.value == 'distributor') {
ajaxQuery.parentId = state.distributionUser.distributionId;
} else {
ajaxQuery.id = state.distributionUser.distributionId;
}
const res =
activeTab.value == "distributor"
? await distributionApi.childUser(ajaxQuery)
: await distributionApi.inviteUser(ajaxQuery);
const res = activeTab.value == 'distributor' ? await distributionApi.childUser(ajaxQuery) : await distributionApi.inviteUser(ajaxQuery);
if (res) {
Object.assign(inviteUserRes, res);
if (query.page == 1) {
@@ -558,11 +404,9 @@ const nextLvMoney = computed(() => {
let nextLv = undefined;
if (!config.levelConfigList || !config.levelConfigList.length) {
return "";
return '';
}
const nowLevel = state.distributionUser
? state.distributionUser.level || 1
: 1;
const nowLevel = state.distributionUser ? state.distributionUser.level || 1 : 1;
if (!nowLevel) {
nextLv = config.levelConfigList[0];
} else {
@@ -570,25 +414,25 @@ const nextLvMoney = computed(() => {
}
if (nextLv) {
if (config.upgradeType == "cost") {
if (config.upgradeType == 'cost') {
return nextLv.costAmount;
}
if (config.upgradeType == "invite") {
if (config.upgradeType == 'invite') {
return nextLv.inviteCount;
}
}
return "";
return '';
});
const juNextLvMoney = computed(() => {
if (!nextLvMoney.value) {
return "";
return '';
}
let total = 0;
if (config.upgradeType == "cost" && state.distributionUser) {
if (config.upgradeType == 'cost' && state.distributionUser) {
total = new BigNumber(nextLvMoney.value).minus(state.distributionUser.consumeAmount || 0).toNumber();
}
if (config.upgradeType == "invite" && state.distributionUser) {
if (config.upgradeType == 'invite' && state.distributionUser) {
total = new BigNumber(nextLvMoney.value).minus(config.inviteCount || 0).toNumber();
}
return Math.max(total, 0);
@@ -596,26 +440,19 @@ const juNextLvMoney = computed(() => {
//是否显示邀请码
const showInviteCode = computed(() => {
if (config.upgradeType == "invite") {
if (config.upgradeType == 'invite') {
return true;
}
if (
config.openType == "manual" &&
(!state.distributionUser || !state.distributionUser.level)
) {
if (config.openType == 'manual' && (!state.distributionUser || !state.distributionUser.level)) {
return false;
}
if (
state.distributionUser &&
state.distributionUser.level &&
inviteCode.value
) {
if (state.distributionUser && state.distributionUser.level && inviteCode.value) {
return true;
}
if( config.openType == "auto" ){
if (config.openType == 'auto') {
return true;
}
if (!state.distributionUser && config.openType == "manual") {
if (!state.distributionUser && config.openType == 'manual') {
return true;
}
return false;
@@ -637,17 +474,33 @@ watch(
);
function parseQueryString(queryString) {
const queryParams = queryString.split("&").map((param) => param.split("="));
const queryParams = queryString.split('&').map((param) => param.split('='));
const params = {};
for (const [key, value] of queryParams) {
params[key] = value;
}
return params;
}
// defineOptions({
// mixins: [shareMixin]
// });
onShareAppMessage(async (res) => {
let query = await returnQuery();
return {
title: `股东共享-${state.shopName}`,
path: `/distribution/shop-detail/index?${query}`,
imageUrl: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/ec402c96a183489788f9e43430962d04.png',
query
};
});
onLoad(async (opt) => {
await handleMixinOnLoad(opt);
if (opt.q) {
const q = decodeURIComponent(opt.q);
const params = parseQueryString(q.split("?")[1]);
const params = parseQueryString(q.split('?')[1]);
Object.assign(options, params);
} else {
Object.assign(options, opt);
@@ -872,8 +725,7 @@ onReachBottom(async () => {
.buy {
padding: 32rpx 224rpx;
border-radius: 40rpx;
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%),
linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%), linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
box-shadow: 0 14rpx 30.4rpx 0 #fe8b435e;
font-size: 32rpx;
color: #fff;

View File

@@ -10,30 +10,30 @@
<view class="sku">
<view class="u-flex u-col-center">
<text class="price">¥{{item.groupPrice}}</text>
<text class="old-price">¥{{item.originalPrice}}</text>
<text class="price">¥{{ item.groupPrice }}</text>
<text class="old-price">¥{{ item.originalPrice }}</text>
</view>
<view>
<view class="u-m-t-16 text" v-if="item.limitBuyNum&&item.limitBuyNum!='-10086'"> 限购{{item.limitBuyNum}} </view>
<view class="text u-m-t-10">已团{{item.groupedNum||0}}</view>
<view class="u-m-t-16 text" v-if="item.limitBuyNum && item.limitBuyNum != '-10086'">限购{{ item.limitBuyNum }}</view>
<view class="text u-m-t-10">已团{{ item.groupedNum || 0 }}</view>
</view>
</view>
<view class="goods">
<view class="goods-name">{{item.wareName}}</view>
<view class="goods-name">{{ item.wareName }}</view>
<view class="u-m-t-20 color-666">
{{item.wareDetail}}
{{ item.wareDetail }}
</view>
</view>
<view class="bg-f7" style="height: 32rpx"></view>
<view class="desc">
<view class="u-flex">
<view class="color-666 no-wrap" style="min-width: 180rpx;">可核销门店</view>
<view class="">{{item.shopName}}</view>
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店</view>
<view class="">{{ item.shopName }}</view>
</view>
<view class="u-flex u-m-t-16 u-col-baseline">
<view class="color-666 no-wrap" style="min-width: 180rpx;">门店地址</view>
<view class="">{{item.shopAddress}}</view>
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址</view>
<view class="">{{ item.shopAddress }}</view>
</view>
</view>
@@ -41,55 +41,46 @@
<view class="bg-f7" style="height: 32rpx"></view>
<view class="groups">
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
<view class="item u-flex" v-for="(item,index) in item.gbOrderList" :key="index">
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
<view>立即购买购
<view class="color-000 u-line-1" style="max-width: 180rpx;">{{item.nickName}}</view>
<view class="main-color u-m-t-2">{{returnNeedPerpole(item)}}人拼成</view>
<view>
立即购买购
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
<view class="main-color u-m-t-2">{{ returnNeedPerpole(item) }}人拼成</view>
</view>
<view class="u-m-t-22">
<text class="color-666">剩余</text>
<text class="main-color">{{getRemainingHMS(item)}}</text>
<text class="main-color">{{ getRemainingHMS(item) }}</text>
</view>
<view class="btn" @click="fastBuy(item)">快速拼成</view>
</view>
</view>
</view>
</template>
<view class="bg-f7" style="height: 24rpx"></view>
<view class="goods-detail" v-if="item.goodsCategory!='优惠券'">
<view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
<view class="u-flex u-row-center">
<view class="title">商品详情</view>
</view>
<view class="u-m-t-32">
<image class="w-full" v-for="(item,index) in item.wareCommentImgs" :key="index" mode="widthFix"
:src="item">
</image>
<image class="w-full" v-for="(item, index) in item.wareCommentImgs" :key="index" mode="widthFix" :src="item"></image>
</view>
</view>
<view style="height: 140px"></view>
<view class="fixed-bottom u-flex u-row-center">
<view v-if="isCanExchange" class="btn" @click="exchangeClick">
{{returnBtmText}}
{{ returnBtmText }}
</view>
<view class="btn gray" v-else>
{{returnBtmText}}
{{ returnBtmText }}
</view>
</view>
<!-- 需要支付的弹窗 -->
<up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false">
<view class="popup-content">
@@ -101,31 +92,29 @@
<image class="cover" :src="coverImgs[0]"></image>
<view class="u-flex u-flex-1 u-row-between u-p-l-16 u-col-center">
<view>
<view class="u-font-32 font-bold">{{item.wareName}}</view>
<view class="u-font-32 font-bold">{{ item.wareName }}</view>
<view class="u-m-t-12 color-666 u-line-2">{{item.wareDetail}}</view>
<view class="u-m-t-12 color-666 u-line-2">{{ item.wareDetail }}</view>
</view>
<view>
<view class="price">¥{{item.groupPrice}}</view>
<view class="old-price">¥{{item.originalPrice}}</view>
<view class="limitBuyNum" v-if="item.limitBuyNum&&item.limitBuyNum!=-10086"> 限购{{item.limitBuyNum}} </view>
<view class="price">¥{{ item.groupPrice }}</view>
<view class="old-price">¥{{ item.originalPrice }}</view>
<view class="limitBuyNum" v-if="item.limitBuyNum && item.limitBuyNum != -10086">限购{{ item.limitBuyNum }}</view>
</view>
</view>
</view>
</view>
<view class="bottom u-flex u-row-between u-col-center">
<view class="u-flex u-col-baseline">
<text class="color-666">合计</text>
<text class=" price">{{totalPrice}}</text>
<text class="price">{{ totalPrice }}</text>
</view>
<view class="u-flex">
<up-icon name="minus-circle" size="20" color="#666" @click="changeNumber('-')"></up-icon>
<text class="u-m-l-20 u-m-r-20">{{number}}</text>
<text class="u-m-l-20 u-m-r-20">{{ number }}</text>
<up-icon name="plus-circle-fill" size="20" color="#ED5A2E" @click="changeNumber('+')"></up-icon>
</view>
</view>
<view class="u-m-t-42 u-flex u-row-center">
@@ -137,128 +126,115 @@
</view>
</template>
<script setup>
import {
computed,
reactive,
watch
} from "vue";
import dayjs from "dayjs";
import {wxShare} from '@/utils/share.js'
import {
getOpenId
} from '@/utils/uniapp.js'
import modal from "@/groupBuying/components/modal.vue";
import * as Api from '@/common/api/order/gbOrder.js'
import {
pay
} from '@/utils/pay.js'
import {
Storelogin
} from '@/stores/user.js';
const storelogin = Storelogin();
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import { computed, reactive, watch } from 'vue';
import dayjs from 'dayjs';
import { wxShare } from '@/utils/share.js';
import { getOpenId } from '@/utils/uniapp.js';
import modal from '@/groupBuying/components/modal.vue';
import * as Api from '@/common/api/order/gbOrder.js';
import { pay } from '@/utils/pay.js';
import { Storelogin } from '@/stores/user.js';
const storelogin = Storelogin();
const imgs = {
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png",
};
const number = ref(1)
const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png'
};
const number = ref(1);
import {
BigNumber
} from "bignumber.js";
const totalPrice = computed(() => {
import { BigNumber } from 'bignumber.js';
const totalPrice = computed(() => {
if (!item.groupPrice) {
return 0;
}
return BigNumber(number.value).times(item.groupPrice).toNumber()
})
return BigNumber(number.value).times(item.groupPrice).toNumber();
});
function changeNumber(step) {
function changeNumber(step) {
if (step === '-') {
if (number.value == 1) {
return
return;
}
number.value--
return
number.value--;
return;
}
if (step === '+') {
if(item.limitBuyNum==-10086){
number.value++
return
if (item.limitBuyNum == -10086) {
number.value++;
return;
}
if(number.value>=item.limitBuyNum){
if (number.value >= item.limitBuyNum) {
return uni.showToast({
title:'最多可购买'+item.limitBuyNum+'份',
icon:'none'
})
}
number.value++
return
}
}
const modalData = reactive({
show: false,
title: '最多可购买' + item.limitBuyNum + '份',
icon: 'none'
});
}
number.value++;
return;
}
}
const modalData = reactive({
show: false
});
function prveImg(index) {
function prveImg(index) {
uni.previewImage({
urls: coverImgs.value,
current: index
})
}
});
}
const popupData = reactive({
const popupData = reactive({
show: false,
item: null
});
});
function exchangeClick() {
popupData.show = true
function exchangeClick() {
popupData.show = true;
}
}
function fastBuy(item) {
function fastBuy(item) {
popupData.item = item;
popupData.show = true
}
watch(() => popupData.show, (newval) => {
popupData.show = true;
}
watch(
() => popupData.show,
(newval) => {
if (!newval) {
popupData.item = null
popupData.item = null;
}
})
}
);
function dingyue() {
function dingyue() {
return new Promise((revlove, reject) => {
uni.requestSubscribeMessage({
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0',
'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'
],
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', 'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'],
success(res) {},
complete() {
revlove()
revlove();
}
})
})
});
});
}
}
async function payExchange() {
async function payExchange() {
uni.setStorageSync('group_buying_order', {
...item,
number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
})
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : ''
});
uni.navigateTo({
url: '/groupBuying/confirm-order/confirm-order'
})
return
});
return;
await dingyue();
uni.showLoading({
title: '支付中……'
})
const openId = await getOpenId()
uni.hideLoading()
});
const openId = await getOpenId();
uni.hideLoading();
if (openId) {
Api.exchange({
paramId: item.id,
@@ -266,132 +242,124 @@
number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
openId
}).then(orderRes => {
}).then((orderRes) => {
popupData.show = false;
pay(orderRes.payInfo).then(res => {
console.log(res)
pay(orderRes.payInfo).then((res) => {
console.log(res);
if (res) {
uni.redirectTo({
url: '/groupBuying/success/index?detailId=' + orderRes.record
.id
})
url: '/groupBuying/success/index?detailId=' + orderRes.record.id
});
} else {
uni.showToast({
title: '开团失败',
icon: 'none'
})
});
}
})
})
});
});
} else {
uni.showToast({
title: '鉴权失败,兑换失败',
icon: 'none'
})
}
});
}
}
const item = reactive({
const item = reactive({
goodsDescription: []
})
const isCanExchange = computed(() => {
});
const isCanExchange = computed(() => {
if (item.quantity <= 0) {
return false
return false;
}
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return false
return false;
}
return true
})
return true;
});
const returnBtmText = computed(() => {
const returnBtmText = computed(() => {
if (isCanExchange.value) {
return '立即开团'
return '立即开团';
}
if (pointsUser.pointBalance < item.requiredPoints) {
const num = item.requiredPoints - pointsUser.pointBalance
return `积分不足,还差${num}积分`
const num = item.requiredPoints - pointsUser.pointBalance;
return `积分不足,还差${num}积分`;
}
if (item.quantity <= 0) {
return `库存不足`
return `库存不足`;
}
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return `单人兑换已达上限`
return `单人兑换已达上限`;
}
})
});
const query = reactive({
const query = reactive({
shopId: '',
wareId: '',
groupOrderNo: ''
})
});
const coverImgs = ref([]);
const coverImgs = ref([])
async function init(opt) {
async function init(opt) {
// 获取小程序进入场景和参数
const launchOptions = uni.getLaunchOptionsSync();
console.log(launchOptions);
// 获取链接上的参数
const launchOptionsQuery = launchOptions.query;
console.log('launchOptionsQuery', launchOptionsQuery);
Object.assign(query, launchOptionsQuery)
console.log(opt)
Object.assign(query, opt)
console.log(query)
await storelogin.actionslogin()
getDetail()
}
Object.assign(query, launchOptionsQuery);
console.log(opt);
Object.assign(query, opt);
console.log(query);
await storelogin.actionslogin();
getDetail();
}
function getDetail() {
Api.wareDetail(query).then(res => {
console.log('res',res)
if(!res){
function getDetail() {
Api.wareDetail(query).then((res) => {
console.log('res', res);
if (!res) {
uni.showModal({
title:'提示',
content:'当前商品已下架',
showCancel:false,
title: '提示',
content: '当前商品已下架',
showCancel: false,
success() {
uni.redirectTo({
url:'/groupBuying/index/index'
})
url: '/groupBuying/index/index'
});
}
})
});
}
res.wareCommentImgs = res.wareCommentImgs.split(',').filter(v => v)
Object.assign(item, res)
console.log(item)
coverImgs.value = res.wareImgs.split(',')
uni.cache.set('shopId',item.shopId)
})
}
res.wareCommentImgs = res.wareCommentImgs.split(',').filter((v) => v);
Object.assign(item, res);
console.log(item);
coverImgs.value = res.wareImgs.split(',');
uni.cache.set('shopId', item.shopId);
});
}
/**
/**
* 计算剩余时间差(毫秒)
* @param {Object} item - 包含groupEndTime的订单/拼团对象
* @returns {number} 剩余时间(毫秒)
*/
function returnRemainingTime(item) {
function returnRemainingTime(item) {
if (!item?.groupEndTime) return 0; // 容错无结束时间则返回0
return dayjs(item.groupEndTime).valueOf() - dayjs().valueOf();
}
}
/**
/**
* 将毫秒差格式化为 HH:MM:SS最多72小时
* @param {number} ms - 时间差(毫秒)
* @returns {string} 格式化后的时分秒(如 09:09:09、72:00:00、00:00:00
*/
function formatTimeToHMS(ms) {
function formatTimeToHMS(ms) {
// 边界1已过期/无剩余时间 → 显示00:00:00
if (ms <= 0) return '00:00:00';
@@ -411,53 +379,65 @@
// 补零(确保两位数,如 9 → 09
const pad = (num) => String(num).padStart(2, '0');
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
}
}
let timer = null;
let nowTime = ref(Date.now());
timer = setInterval(() => {
nowTime.value = Date.now();
}, 1000);
let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => {
nowTime.value = Date.now()
}, 1000)
// 组合使用:获取格式化后的剩余时间
function getRemainingHMS(item) {
nowTime.value
// 组合使用:获取格式化后的剩余时间
function getRemainingHMS(item) {
nowTime.value;
const ms = returnRemainingTime(item);
return formatTimeToHMS(ms);
}
}
function returnNeedPerpole(data) {
return data.groupPeopleNum - data.currentPeopleNum;
}
function returnNeedPerpole(data) {
return data.groupPeopleNum - data.currentPeopleNum
}
onLoad(init)
// #ifdef MP-WEIXIN
uni.showShareMenu()
// #endif
onShareAppMessage(() => {
const query = `wareId=${item.id}&shopId=${item.shopId}`
return wxShare({
onShareAppMessage(async () => {
let query = await returnQuery();
// query += `&wareId=${item.id}&shopId=${item.shopId}`;
const options = {
title: item.wareName,
imageUrl: coverImgs.value[0],
path: '/groupBuying/goodsDetail/goodsDetail' + '?' + query,
query,
})
})
path: '/groupBuying/goodsDetail/goodsDetail' + '?' + decodeURIComponent(query),
query
};
console.log('onShareAppMessage===', options);
return options;
});
onLoad(async (opt) => {
await handleMixinOnLoad(opt);
init(opt);
});
// #ifdef MP-WEIXIN
uni.showShareMenu();
// #endif
// onShareAppMessage(() => {
// const query = `wareId=${item.id}&shopId=${item.shopId}`;
// return wxShare({
// title: item.wareName,
// imageUrl: coverImgs.value[0],
// path: '/groupBuying/goodsDetail/goodsDetail' + '?' + query,
// query
// });
// });
</script>
<style lang="scss" scoped>
$topHeight: 350rpx;
$topHeight: 350rpx;
.top-img {
.top-img {
width: 750rpx;
height: $topHeight;
}
}
.top {
.top {
margin: 14rpx 18rpx;
background-size: cover;
height: $topHeight;
@@ -477,9 +457,9 @@
font-weight: 700;
margin-top: 62rpx;
}
}
}
.sku {
.sku {
display: flex;
justify-content: space-between;
padding: 20rpx 36rpx;
@@ -494,8 +474,8 @@
.old-price {
margin-left: 16rpx;
color: #E7E7E7;
opacity: .85;
color: #e7e7e7;
opacity: 0.85;
font-weight: 700;
text-decoration: line-through;
}
@@ -504,9 +484,9 @@
color: #fff;
font-size: 28rpx;
}
}
}
.goods {
.goods {
padding: 20rpx 28rpx;
background: #fff;
@@ -515,16 +495,14 @@
font-weight: 700;
color: #333;
}
}
}
.desc {
.desc {
padding: 32rpx 28rpx;
background-color: #fff;
}
}
.goods-detail {
.goods-detail {
padding: 32rpx;
.title {
@@ -532,7 +510,7 @@
padding: 0 22rpx;
&::before {
content: "";
content: '';
display: block;
position: absolute;
right: 100%;
@@ -545,7 +523,7 @@
&::after {
left: 100%;
content: "";
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
@@ -555,9 +533,9 @@
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
}
}
}
}
.fixed-bottom {
.fixed-bottom {
position: fixed;
background-color: #fff;
left: 0;
@@ -568,7 +546,6 @@
bottom: 0;
z-index: 10;
.btn {
padding: 22rpx;
border-radius: 200rpx;
@@ -576,22 +553,22 @@
color: #fff;
width: 556rpx;
text-align: center;
background-color: #E8AD7B;
background-color: #e8ad7b;
&.gray {
background: #9999992b;
color: #999999;
}
}
}
}
.waring {
.waring {
background-color: rgba(255, 204, 0, 0.09);
padding: 32rpx 24rpx;
color: #ff8d28;
}
}
.popup-content {
.popup-content {
font-size: 28rpx;
min-height: 300px;
@@ -633,7 +610,6 @@
color: #666;
line-height: 42rpx;
}
}
.bottom {
@@ -658,19 +634,19 @@
color: #fff;
font-size: 700;
}
}
}
.w-full {
.w-full {
width: 100%;
}
}
.groups {
.groups {
padding: 28rpx 22rpx;
background-color: #fff;
.item {
padding: 28rpx 0;
border-bottom: 2rpx solid #EDEDED;
border-bottom: 2rpx solid #ededed;
&:last-child {
border-bottom: none;
@@ -683,28 +659,29 @@
.btn {
padding: 8rpx 26rpx;
border-radius: 36rpx;
background: #E8AD7B;
background: #e8ad7b;
font-weight: 700;
color: #fff;
}
}
}
.share-box{
}
.share-box {
top: 0;
position: absolute;
right: 0;
padding: 4rpx 30rpx;
border-radius: 0 0 0 24rpx;
color: #ed5a2e; font-weight: 700;
background: #FFF;
color: #ed5a2e;
font-weight: 700;
background: #fff;
overflow: hidden;
.share{
.share {
position: absolute;
left:0;
left: 0;
right: 0;
top:0;
top: 0;
bottom: 0;
opacity: 0;
}
}
}
</style>

View File

@@ -2,71 +2,63 @@
<view class="min-page bg-f7 u-font-28">
<up-sticky :offsetTop="0" :customNavHeight="0">
<view class="top" :style="topStyle">
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="拼团特惠" @leftClick="back()"
left-icon-color="#fff" title-color="#fff"></up-navbar>
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="拼团特惠" @leftClick="back()" left-icon-color="#fff" title-color="#fff"></up-navbar>
<view class="u-flex info u-col-center">
<image :src="imgs.map" class="map"></image>
<view class="u-line-1 u-m-l-20">{{shopInfo.shopName||''}}</view>
<view class="u-line-1 u-m-l-20">{{ shopInfo.shopName || '' }}</view>
</view>
</view>
<view class="translateY20">
<view class="steps">
<view class="step" v-for="(item,index) in steps" :key="index">
<text class="index">{{index+1}}</text>
<text class="text">{{item}}</text>
<template v-if="index<steps.length-1">
<view class="step" v-for="(item, index) in steps" :key="index">
<text class="index">{{ index + 1 }}</text>
<text class="text">{{ item }}</text>
<template v-if="index < steps.length - 1">
<text class="icon">
{{'>'}}
{{ '>' }}
</text>
<text class="icon icon1">
{{'>'}}
{{ '>' }}
</text>
</template>
</view>
</view>
<view class="filters ">
<view class="filters">
<view class="u-flex tabs">
<view class="tab" v-for="(item,index) in tabs.list" :class="{'active':tabs.sel==index}"
@click="tabs.sel=index">{{item}}</view>
<view class="tab" v-for="(item, index) in tabs.list" :class="{ active: tabs.sel == index }" @click="tabs.sel = index">{{ item }}</view>
</view>
<view class="u-flex u-col-center" v-if="tabs.sel==0">
<up-search v-model="query.wareName" @search="refresh" @clear="refresh"
@custom="refresh"></up-search>
<view class="u-flex u-col-center" v-if="tabs.sel == 0">
<up-search v-model="query.wareName" @search="refresh" @clear="refresh" @custom="refresh"></up-search>
<!-- <perpoleNumber v-model="query.groupPeopleNum"></perpoleNumber> -->
</view>
<view class="u-flex orderStatus" v-if="tabs.sel==1">
<view class="orderState" :class="{'active':orders.sel==index}"
v-for="(item,index) in orders.list" :key="index" @click="orders.sel=index">
{{item.name}}
<view class="u-flex orderStatus" v-if="tabs.sel == 1">
<view class="orderState" :class="{ active: orders.sel == index }" v-for="(item, index) in orders.list" :key="index" @click="orders.sel = index">
{{ item.name }}
</view>
</view>
</view>
</view>
</up-sticky>
<view class="lists" v-if="tabs.sel==0">
<view class="item" v-for="(item,index) in list" :key="index" @click="toDetail(item)">
<view class="lists" v-if="tabs.sel == 0">
<view class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<up-image width="218rpx" radius="16rpx" height="218rpx" :src="returnCoverImg(item)"></up-image>
<view class="u-flex-1 u-p-l-16">
<view class="u-flex u-col-center">
<text class="numbers">{{item.groupPeopleNum}}人团</text>
<text class="u-line-1 font-bold u-m-l-18 name">{{item.wareName}}</text>
<text class="numbers">{{ item.groupPeopleNum }}人团</text>
<text class="u-line-1 font-bold u-m-l-18 name">{{ item.wareName }}</text>
</view>
<view class="members">已团{{item.groupedNum}}</view>
<view class="members">已团{{ item.groupedNum }}</view>
<view class="info">
<view class="left">
<view class="">
<text class="u-font-24">拼团到手</text>
<text class="u-font-32 font-bold"> ¥{{item.groupPrice}}</text>
<text class="u-font-32 font-bold">¥{{ item.groupPrice }}</text>
</view>
<view style="opacity: 0.84;">
<view style="opacity: 0.84">
<text class="u-font-24">原价</text>
<text class=""> ¥{{item.originalPrice}}</text>
<text class="">¥{{ item.originalPrice }}</text>
</view>
</view>
<view class="right">
@@ -77,132 +69,112 @@
</view>
</view>
<view class="orders" v-else-if="tabs.sel==1">
<view class="item" v-for="(item,index) in list" :key="index" @click="toOrderDetail(item)">
<view class="orders" v-else-if="tabs.sel == 1">
<view class="item" v-for="(item, index) in list" :key="index" @click="toOrderDetail(item)">
<view class="u-flex u-col-center u-row-between">
<text class="numbers">{{item.groupPeopleNum}}人团</text>
<text class="numbers">{{ item.groupPeopleNum }}人团</text>
<statusVue :status="item.status"></statusVue>
</view>
<view class="u-m-t-32 u-flex">
<up-image width="154rpx" height="154rpx" :src="item.goodsImg"></up-image>
<view class="u-flex-1 u-flex u-p-l-30 u-col-center u-row-between">
<view>
<view class="">{{item.wareJson.wareName}}</view>
<view class="u-m-t-34 price">¥{{item.payAmount}}</view>
<view class="" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
<view class="u-m-t-34 price">¥{{ item.payAmount }}</view>
</view>
<text class="u-font-40 font-bold">x{{item.num}}</text>
<text class="u-font-40 font-bold">x{{ item.num }}</text>
</view>
</view>
<view class="u-m-t-32 info">
<view class="u-flex u-col-center">
<text class="title">可核销门店</text>
<text class="stitle">{{item.shopName}}</text>
<text class="stitle">{{ item.shopName }}</text>
</view>
<view class="u-flex u-m-t-32 u-col-center">
<text class="title ">门店地址</text>
<text class="stitle">{{item.shopAddress}}</text>
<text class="title">门店地址</text>
<text class="stitle">{{ item.shopAddress }}</text>
</view>
<view class="u-flex u-m-t-32 u-col-center" v-if="item.groupEndTime&&item.wareGroupStatus=='success'">
<view class="u-flex u-m-t-32 u-col-center" v-if="item.groupEndTime && item.wareGroupStatus == 'success'">
<text class="title">成团时间</text>
<text class="stitle ">{{item.groupEndTime}}</text>
<text class="stitle">{{ item.groupEndTime }}</text>
</view>
<view class="u-flex u-m-t-32 u-col-center" v-if="showTime(item)">
<text class="title">剩余成团时间</text>
<text class="stitle price">{{returnTime(item)}}</text>
<text class="stitle price">{{ returnTime(item) }}</text>
</view>
</view>
<view class="btns" v-if="showBtns(item)">
<template v-if="item.status=='待核销'">
<view class="btn " @click.stop="lookCode(item)">查看券码</view>
<template v-if="item.status == '待核销'">
<view class="btn" @click.stop="lookCode(item)">查看券码</view>
<button class="btn black" @click.stop="refund(item)">申请退款</button>
</template>
<template v-else-if="item.status=='退款中'">
<view class="btn " @click.stop="lookCode(item)">查看券码</view>
<template v-else-if="item.status == '退款中'">
<view class="btn" @click.stop="lookCode(item)">查看券码</view>
<view class="btn black" @click.stop="cancelRefund(item)">取消退款</view>
</template>
<template v-else>
<view class="btn " @click.stop="refund(item)" v-if="canRefund(item)">申请退款</view>
<button open-type="share" class="btn black" @click.stop="share(item)"
v-if="showShare(item)">邀请好友</button>
<view class="btn" @click.stop="refund(item)" v-if="canRefund(item)">申请退款</view>
<button open-type="share" class="btn black" @click.stop="share(item)" v-if="showShare(item)">邀请好友</button>
</template>
</view>
</view>
</view>
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
</view>
</template>
<script setup>
import {
APIusershopInfodetail
} from '@/common/api/member.js'
import {
back
} from '@/utils/uniapp.js'
import LookQrcode from "@/components/look-qrcode/look-qrcode.vue";
import {
wxShare
} from '@/utils/share.js'
import {
getRemainingHMS
} from '@/utils/countdown.js'
import {
onShow
} from '@dcloudio/uni-app'
import * as Api from '@/common/api/order/gbOrder.js'
import perpoleNumber from './components/perpole-number.vue'
import statusVue from '@/groupBuying/components/status.vue'
import {
computed,
reactive,
watch
} from 'vue'
import { APIusershopInfodetail } from '@/common/api/member.js';
import { back } from '@/utils/uniapp.js';
import LookQrcode from '@/components/look-qrcode/look-qrcode.vue';
import { wxShare } from '@/utils/share.js';
import { getRemainingHMS } from '@/utils/countdown.js';
import { onShow } from '@dcloudio/uni-app';
import * as Api from '@/common/api/order/gbOrder.js';
import perpoleNumber from './components/perpole-number.vue';
import statusVue from '@/groupBuying/components/status.vue';
import { computed, reactive, watch } from 'vue';
const canRefundStatus = ['待成团', '待核销']
const canRefundStatus = ['待成团', '待核销'];
function canRefund(item) {
function canRefund(item) {
if (canRefundStatus.includes(item.status)) {
return true
return true;
}
return false
}
const modalData = reactive({
show: false,
});
const qrcode = ref("");
return false;
}
const modalData = reactive({
show: false
});
const qrcode = ref('');
function lookCode(item) {
qrcode.value = item.verifyCode
function lookCode(item) {
qrcode.value = item.verifyCode;
modalData.show = true;
}
}
const imgs = {
const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/d21f2dfd7bec44618f2d5e4b88372b08.png',
bg1: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/604c3f917daa41af9239145196c6d3f3.png',
map: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/0a293f6e1a6a4e7b956379a5b6701104.png',
pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/4bcce5bdfa074f2a838a0209fac24241.png'
}
};
const shopInfo = ref({})
const shopInfo = ref({});
const steps = ['发起拼团', '邀请好友', '成团优惠']
const steps = ['发起拼团', '邀请好友', '成团优惠'];
const topStyle = {
const topStyle = {
backgroundImage: 'url(' + imgs.bg + ')'
}
const tabs = reactive({
};
const tabs = reactive({
list: ['活动列表', '我的拼团'],
sel: 0
})
const orders = reactive({
list: [{
});
const orders = reactive({
list: [
{
name: '全部',
value: ''
},
@@ -221,105 +193,103 @@
{
name: '退款',
value: '退款'
},
}
],
sel: 0
})
});
const query = reactive({
const query = reactive({
page: 1,
size: 10,
wareName: '',
groupPeopleNum: '',
shopId: uni.cache.get('shopId'),
})
shopId: uni.cache.get('shopId')
});
const list = ref([])
const isEnd = ref(false)
const list = ref([]);
const isEnd = ref(false);
const status = computed(() => {
return orders.list[orders.sel].value
})
const status = computed(() => {
return orders.list[orders.sel].value;
});
watch(() => status.value, () => {
refresh()
})
function getData() {
if (tabs.sel == 0) {
Api.warePage(query).then(res => {
const newArr = res.records || []
if (query.page == 1) {
list.value = newArr
} else {
list.value.push(...newArr)
watch(
() => status.value,
() => {
refresh();
}
isEnd.value = query.page >= res.totalPage * 1 ? true : false
})
return
);
function getData() {
if (tabs.sel == 0) {
Api.warePage(query).then((res) => {
const newArr = res.records || [];
if (query.page == 1) {
list.value = newArr;
} else {
list.value.push(...newArr);
}
isEnd.value = query.page >= res.totalPage * 1 ? true : false;
});
return;
}
if (tabs.sel == 1) {
const {
page,
size,
shopId
} = query
const { page, size, shopId } = query;
Api.record({
page,
size,
shopId,
status: status.value,
}).then(res => {
const newArr = (res.records || []).map(v => {
const wareJson = JSON.parse(v.wareJson)
wareJson.wareImgs = wareJson.wareImgs.split(',').filter(v => v)
status: status.value
}).then((res) => {
const newArr = (res.records || []).map((v) => {
const wareJson = JSON.parse(v.wareJson);
wareJson.wareImgs = wareJson.wareImgs.split(',').filter((v) => v);
return {
...v,
goodsImg: wareJson.wareImgs[0],
wareJson,
}
})
wareJson
};
});
if (query.page == 1) {
list.value = newArr
list.value = newArr;
} else {
list.value.push(...newArr)
}
console.log(list.value)
isEnd.value = query.page >= res.totalPage * 1 ? true : false
})
return
list.value.push(...newArr);
}
console.log(list.value);
isEnd.value = query.page >= res.totalPage * 1 ? true : false;
});
return;
}
}
function toDetail(item) {
function toDetail(item) {
uni.navigateTo({
url: '/groupBuying/goodsDetail/goodsDetail?wareId=' + item.id + '&shopId=' + item.shopId
})
}
});
}
function toOrderDetail(item) {
function toOrderDetail(item) {
uni.navigateTo({
url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId
})
}
});
}
function returnCoverImg(item) {
function returnCoverImg(item) {
if (!item.wareImgs) {
return ''
}
const arr = item.wareImgs.split(',')
return arr[0]
return '';
}
const arr = item.wareImgs.split(',');
return arr[0];
}
function refresh() {
query.page = 1
isEnd.value = false
getData()
}
function refresh() {
query.page = 1;
isEnd.value = false;
getData();
}
function refund(item) {
function refund(item) {
uni.showModal({
title: '提示',
content: '是否申请退款?',
@@ -328,23 +298,23 @@
if (res.confirm) {
Api.applyRefund({
recordId: item.id,
orderNo: item.orderNo,
}).then(res => {
orderNo: item.orderNo
}).then((res) => {
if (res) {
uni.showToast({
title: '申请成功'
})
});
setTimeout(() => {
refresh()
}, 1000)
refresh();
}, 1000);
}
})
});
}
}
})
}
});
}
function cancelRefund(item) {
function cancelRefund(item) {
uni.showModal({
title: '提示',
content: '是否取消退款?',
@@ -353,95 +323,97 @@
if (res.confirm) {
Api.cancelRefund({
recordId: item.id,
orderNo: item.orderNo,
}).then(res => {
orderNo: item.orderNo
}).then((res) => {
if (res) {
uni.showToast({
title: '取消成功'
})
});
setTimeout(() => {
refresh()
}, 1000)
refresh();
}, 1000);
}
})
});
}
}
})
});
}
watch(
() => tabs.sel,
(newval) => {
orders.sel = 0;
refresh();
}
watch(() => tabs.sel, (newval) => {
orders.sel = 0
refresh()
})
);
function showBtns(item) {
function showBtns(item) {
if (item.status == '已退款') {
return false
}
return true
return false;
}
return true;
}
function showShare(item) {
function showShare(item) {
if (item.status == '待成团') {
return true
}
return false
return true;
}
return false;
}
function showTime(item) {
function showTime(item) {
if (item.status == '待成团') {
return true
}
return false
return true;
}
return false;
}
let shareItem = null;
let shareItem = null
function share(item) {
shareItem = item;
}
function share(item) {
shareItem = item
}
onShareAppMessage(() => {
console.log('onShareAppMessage')
console.log(shareItem)
const query = `groupOrderNo=${shareItem.groupOrderNo}&shopId=${shareItem.shopId}`
onShareAppMessage(() => {
console.log('onShareAppMessage');
console.log(shareItem);
const query = `groupOrderNo=${shareItem.groupOrderNo}&shopId=${shareItem.shopId}`;
return wxShare({
title: shareItem.wareJson.wareName,
imageUrl: shareItem.goodsImg,
path: '/groupBuying/detail/index' + '?' + query,
query,
})
})
onShow(getData)
onLoad((opt) => {
const shopId=opt.shopId||uni.cache.get('shopId')
query.shopId=shopId
uni.cache.set('shopId',query.shopId)
console.log('opt',opt);
query
});
});
onShow(getData);
onLoad((opt) => {
const shopId = opt.shopId || uni.cache.get('shopId');
query.shopId = shopId;
uni.cache.set('shopId', query.shopId);
console.log('opt', opt);
APIusershopInfodetail({
shopId: shopId
}).then(res => {
}).then((res) => {
console.log(res);
shopInfo.value = res.shopInfo
uni.cache.set('shopInfo', res.shopInfo)
uni.cache.set('shopId', res.shopInfo.id)
})
})
shopInfo.value = res.shopInfo;
uni.cache.set('shopInfo', res.shopInfo);
uni.cache.set('shopId', res.shopInfo.id);
});
});
let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => {
nowTime.value = Date.now()
}, 1000)
let timer = null;
let nowTime = ref(Date.now());
timer = setInterval(() => {
nowTime.value = Date.now();
}, 1000);
function returnTime(item) {
nowTime.value
return getRemainingHMS(item)
}
function returnTime(item) {
nowTime.value;
return getRemainingHMS(item);
}
</script>
<style lang="scss" scoped>
.top {
.top {
height: 422rpx;
background-size: cover;
@@ -456,14 +428,14 @@
width: 48rpx;
height: 48rpx;
}
}
}
.steps {
.steps {
display: flex;
padding: 20rpx 20rpx;
gap: 20rpx;
border-radius: 14rpx 14rpx 0 0;
background: linear-gradient(90deg, #FFF5E6 0%, #FFD2CA 100%);
background: linear-gradient(90deg, #fff5e6 0%, #ffd2ca 100%);
align-items: center;
.step {
@@ -478,11 +450,11 @@
height: 44rpx;
line-height: 44rpx;
text-align: center;
background: #E55626;
background: #e55626;
}
.text {
color: #5A352F;
color: #5a352f;
margin-left: 10rpx;
margin-right: 22rpx;
white-space: nowrap;
@@ -493,26 +465,26 @@
}
.icon1 {
color: #5A352F;
}
color: #5a352f;
}
}
.lists {
.lists {
padding: 18rpx 10rpx;
.item {
display: flex;
padding: 32rpx 16rpx;
border-radius: 32rpx;
background: #FFF;
background: #fff;
margin-bottom: 14rpx;
.numbers {
background: #4C2828;
background: #4c2828;
padding: 8rpx 18rpx;
border-radius: 10rpx;
font-weight: 700;
color: #FAEAC6;
color: #faeac6;
white-space: nowrap;
}
@@ -522,13 +494,13 @@
.members {
margin-top: 26rpx;
background: #FDF1CB;
background: #fdf1cb;
padding: 4rpx 18rpx;
border-radius: 10rpx 10rpx 10rpx 0;
width: fit-content;
font-size: 24rpx;
font-weight: 700;
color: #ED5A2E;
color: #ed5a2e;
}
.info {
@@ -556,15 +528,15 @@
}
}
}
}
}
.filters {
.filters {
padding: 16rpx 28rpx;
border-radius: 6rpx 6rpx 16rpx 16rpx;
background: #FFF;
}
background: #fff;
}
.tabs {
.tabs {
display: flex;
justify-content: space-between;
font-size: 24rpx;
@@ -572,29 +544,29 @@
padding: 32rpx 88rpx;
.tabs {
transition: all .3s linear;
transition: all 0.3s linear;
}
.active {
color: #ED5A2E;
color: #ed5a2e;
font-size: 32rpx;
font-weight: 700;
font-weight: 700;
}
}
}
.translateY20 {
.translateY20 {
transform: translateY(-20rpx);
}
}
.orderStatus {
.orderStatus {
padding: 26rpx 28rpx;
justify-content: space-between;
height: 100rpx;
.orderState {
color: #999;
transition: all .3s linear;
transition: all 0.3s linear;
&.active {
color: #000;
@@ -602,19 +574,19 @@
font-weight: 700;
}
}
}
}
.orders {
.orders {
padding: 0 26rpx 36rpx;
.item {
padding: 32rpx 24rpx;
border-radius: 16rpx;
background: #FFF;
background: #fff;
margin-bottom: 32rpx;
.numbers {
background-color: #ED5A2E;
background-color: #ed5a2e;
padding: 16rpx 30rpx;
border-radius: 12rpx;
font-size: 32rpx;
@@ -623,10 +595,8 @@
line-height: 36rpx;
}
.price {
color: #ED5A2E;
color: #ed5a2e;
font-weight: 700;
line-height: 36rpx;
font-size: 40rpx;
@@ -637,7 +607,7 @@
flex-direction: column;
align-items: flex-start;
border-radius: 8rpx;
background: #F8F8F8;
background: #f8f8f8;
.title {
min-width: 208rpx;
@@ -654,7 +624,6 @@
font-weight: 700;
}
}
}
.btns {
@@ -668,8 +637,8 @@
margin: 0;
padding: 12rpx 14rpx;
border-radius: 10rpx;
border: 2rpx solid #D9D9D9;
background: #FFF;
border: 2rpx solid #d9d9d9;
background: #fff;
font-size: 28rpx;
&.black {
@@ -680,11 +649,10 @@
}
}
}
}
}
.copy {
.copy {
width: 28rpx;
height: 28rpx;
}
}
</style>

View File

@@ -1,10 +1,8 @@
<template>
<view>
<template v-if="item.status=='待核销'">
<template v-if="item.status == '待核销'">
<view class="min-page bg-f7 color-333 u-font-28 relative">
<up-navbar bg-color="#F8F8F8" :fixed="true" :placeholder="true" title="支付成功"
@leftClick="uni.navigateBack()"></up-navbar>
<up-navbar bg-color="#F8F8F8" :fixed="true" :placeholder="true" title="支付成功" @leftClick="uni.navigateBack()"></up-navbar>
<view class="bottom">
<view class="u-p-32 u-flex u-row-center u-col-center u-flex-col bg-fff">
@@ -12,64 +10,57 @@
<view class="u-font-36 font-bold u-m-t-16">拼团成功</view>
</view>
<view class="shop ">
<view class="shop">
<view class="u-flex">
<text style="min-width: 180rpx;" class="color-666">可核销门店</text>
<text>{{item.shopName}}</text>
<text style="min-width: 180rpx" class="color-666">可核销门店</text>
<text>{{ item.shopName }}</text>
</view>
<view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx;" class="color-666">门店地址</text>
<text>{{item.shopAddress}}</text>
<text style="min-width: 180rpx" class="color-666">门店地址</text>
<text>{{ item.shopAddress }}</text>
</view>
</view>
<view class="goods u-flex u-col-center">
<up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image>
<view class=" u-flex-1 u-p-l-16">
<view class="u-flex-1 u-p-l-16">
<view class="u-flex u-col-center u-row-between">
<view class="u-flex tuan-members">
<image :src="imgs.pin" class="pin" mode=""></image>
<text class="">{{item.groupPeopleNum}}人团</text>
<text class="">{{ item.groupPeopleNum }}人团</text>
</view>
</view>
<view class="u-m-t-16 u-flex u-col-center">
<view style="width: 356rpx;">
<view class="font-bold" v-if="item.wareJson">{{item.wareJson
.wareName}}</view>
<view class="u-flex u-m-t-10 u-col-center ">
<view style="width: 356rpx">
<view class="font-bold" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
<view class="u-flex u-m-t-10 u-col-center">
<view class="price">
<text class="u-font-30">¥</text>
<text class="u-font-48 font-bold">{{item.wareGroupPrice}} </text>
<text class="u-font-48 font-bold">{{ item.wareGroupPrice }}</text>
</view>
<view class="old-price u-m-l-32">
<text>¥</text>
<text>{{item.wareOriginalPrice}} </text>
<text>{{ item.wareOriginalPrice }}</text>
</view>
</view>
</view>
<view class="u-p-l-16 color-333">
数量{{item.num}}
<view class="u-p-l-16 color-333">数量{{ item.num }}</view>
</view>
</view>
</view>
</view>
<view class="members">
<view class="list">
<view class="item" v-for="(user,index) in item.users" :key="index">
<view class="item" v-for="(user, index) in item.users" :key="index">
<view class="box">
<view class="u-flex relative">
<up-avatar size="140rpx" :src="user.userAvatar"></up-avatar>
<view class="u-flex u-row-center absolute">
<text class="tuanzhang" v-if="index==0">团长</text>
<text class="tuanzhang" v-if="index == 0">团长</text>
</view>
</view>
<view class="u-line-1 u-m-t-16 color-000 text-center">{{user.userName}}</view>
<view class="u-line-1 u-m-t-16 color-000 text-center">{{ user.userName }}</view>
</view>
</view>
<view class="item" v-if="false">
@@ -83,22 +74,17 @@
<view class="u-line-1 u-m-t-16 color-000 text-center">等待参团</view>
</view>
</view>
</view>
</view>
</view>
<view class="order">
<view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;">
<text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showOrder}">
<view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline">
<text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showOrder }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
@@ -107,111 +93,109 @@
<view class="u-m-t-16" v-if="showOrder">
<view class="u-flex u-row-between item">
<view class="color-666">商品总额</view>
<view class="">¥{{item.payAmount}}</view>
<view class="">¥{{ item.payAmount }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">实付金额</view>
<view class="">¥{{item.payAmount}}</view>
<view class="">¥{{ item.payAmount }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">订单号</view>
<view class="">{{item.orderNo}}</view>
<view class="">{{ item.orderNo }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">支付时间</view>
<view class="">{{item.payTime}}</view>
<view class="">{{ item.payTime }}</view>
</view>
</view>
</view>
</view>
<view style="height: 100px;"></view>
<view style="height: 100px"></view>
<view class="btns">
<view class="btn" @click="toPinIndex">继续拼团</view>
<button class="btn main" @click="toOrderDetail(item)">查看订单</button>
</view>
</view>
</template>
<template v-if="item.status=='待成团'">
<template v-if="item.status == '待成团'">
<view class="min-page bg-f7 color-333 u-font-28 relative">
<view class="top" :style="topStyle">
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="支付成功"
left-icon-color="#fff" @leftClick="uni.navigateBack()" title-color="#fff"></up-navbar>
<view class="u-flex info u-col-center">
</view>
<up-navbar
bg-color="transparent"
:fixed="false"
:placeholder="false"
title="支付成功"
left-icon-color="#fff"
@leftClick="uni.navigateBack()"
title-color="#fff"
></up-navbar>
<view class="u-flex info u-col-center"></view>
</view>
<view class="bottom bottom1">
<view class="time" v-if="item.status=='待成团'">
<view class="time" v-if="item.status == '待成团'">
<text class="color-666">剩余成团时间</text>
<view class="u-font-32">
<text class="number">{{returnNum(0)}}</text>
<text class="number">{{ returnNum(0) }}</text>
<text class="gap"></text>
<text class="number">{{returnNum(1)}}</text>
<text class="number">{{ returnNum(1) }}</text>
<text class="gap"></text>
<text class="number">{{returnNum(2)}}</text>
<text class="number">{{ returnNum(2) }}</text>
</view>
</view>
<view class="goods u-flex u-col-center">
<up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image>
<view class=" u-flex-1 u-p-l-16">
<view class="u-flex-1 u-p-l-16">
<view class="u-flex u-col-center u-row-between">
<view class="u-flex tuan-members">
<image :src="imgs.pin" class="pin" mode=""></image>
<text class="">{{item.groupPeopleNum}}人团</text>
<text class="">{{ item.groupPeopleNum }}人团</text>
</view>
<statusVue :status="item.status"></statusVue>
</view>
<view class="u-m-t-16 u-flex u-col-center u-row-between">
<view style="max-width: 356rpx;">
<view class="font-bold u-line-1" v-if="item.wareJson">{{item.wareJson
.wareName}}</view>
<view class="u-flex u-m-t-10 u-col-center ">
<view style="max-width: 356rpx">
<view class="font-bold u-line-1" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
<view class="u-flex u-m-t-10 u-col-center">
<view class="price">
<text class="u-font-30">¥</text>
<text class="u-font-48 font-bold">{{item.wareGroupPrice}} </text>
<text class="u-font-48 font-bold">{{ item.wareGroupPrice }}</text>
</view>
<view class="old-price u-m-l-32">
<text>¥</text>
<text>{{item.wareOriginalPrice}} </text>
<text>{{ item.wareOriginalPrice }}</text>
</view>
</view>
</view>
<view class="u-p-l-16 color-333 no-wrap">
数量{{item.num}}
</view>
<view class="u-p-l-16 color-333 no-wrap">数量{{ item.num }}</view>
</view>
</view>
</view>
<view class="shop-box">
<view class="shop ">
<view class="shop">
<view class="u-flex">
<text style="min-width: 180rpx;" class="color-666">可核销门店</text>
<text>{{item.shopName}}</text>
<text style="min-width: 180rpx" class="color-666">可核销门店</text>
<text>{{ item.shopName }}</text>
</view>
<view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx;" class="color-666">门店地址</text>
<text>{{item.shopAddress}}</text>
<text style="min-width: 180rpx" class="color-666">门店地址</text>
<text>{{ item.shopAddress }}</text>
</view>
</view>
</view>
<view class="members">
<view class="list">
<view class="item" v-for="(user,index) in item.users" :key="index">
<view class="item" v-for="(user, index) in item.users" :key="index">
<view class="box">
<view class="u-flex relative">
<up-avatar size="140rpx" :src="user.userAvatar"></up-avatar>
<view class="u-flex u-row-center absolute">
<text class="tuanzhang" v-if="index==0">团长</text>
<text class="tuanzhang" v-if="index == 0">团长</text>
</view>
</view>
<view class="u-line-1 u-m-t-16 color-000 text-center">{{user.userName}}</view>
<view class="u-line-1 u-m-t-16 color-000 text-center">{{ user.userName }}</view>
</view>
</view>
<view class="item">
@@ -226,10 +210,10 @@
</view>
</view>
</view>
<view class="u-flex u-row-center" v-if="item.status=='待成团'">
<view class="pin-btn">邀请好友参团
<view class="u-flex u-row-center" v-if="item.status == '待成团'">
<view class="pin-btn">
邀请好友参团
<button open-type="share" class="share">邀请好友参团</button>
</view>
</view>
</view>
@@ -238,9 +222,9 @@
<view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;">
<text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showOrder}">
<view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline">
<text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showOrder }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
@@ -249,101 +233,99 @@
<view class="u-m-t-16" v-if="showOrder">
<view class="u-flex u-row-between item">
<view class="color-666">商品总额</view>
<view class="">¥{{item.payAmount}}</view>
<view class="">¥{{ item.payAmount }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">实付金额</view>
<view class="">¥{{item.payAmount}}</view>
<view class="">¥{{ item.payAmount }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">订单号</view>
<view class="">{{item.orderNo}}</view>
<view class="">{{ item.orderNo }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">支付时间</view>
<view class="">{{item.payTime}}</view>
<view class="">{{ item.payTime }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<template v-if="item.status=='已退款'">
<template v-if="item.status == '已退款'">
<view class="min-page bg-f7 color-333 u-font-28 relative">
<view class="top" :style="topStyle">
<up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="订单详情"
left-icon-color="#fff" @leftClick="uni.navigateBack()" title-color="#fff"></up-navbar>
<view class="u-flex info u-col-center">
</view>
<up-navbar
bg-color="transparent"
:fixed="false"
:placeholder="false"
title="订单详情"
left-icon-color="#fff"
@leftClick="uni.navigateBack()"
title-color="#fff"
></up-navbar>
<view class="u-flex info u-col-center"></view>
</view>
<view class="bottom bottom1">
<view class="time" v-if="item.status=='待成团'">
<view class="time" v-if="item.status == '待成团'">
<text class="color-666">剩余成团时间</text>
<view class="u-font-32">
<text class="number">{{returnNum(0)}}</text>
<text class="number">{{ returnNum(0) }}</text>
<text class="gap"></text>
<text class="number">{{returnNum(1)}}</text>
<text class="number">{{ returnNum(1) }}</text>
<text class="gap"></text>
<text class="number">{{returnNum(2)}}</text>
<text class="number">{{ returnNum(2) }}</text>
</view>
</view>
<view class="goods u-flex u-col-center" style="border-radius: 16rpx;">
<view class="goods u-flex u-col-center" style="border-radius: 16rpx">
<up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image>
<view class=" u-flex-1 u-p-l-16">
<view class="u-flex-1 u-p-l-16">
<view class="u-flex u-col-center u-row-between">
<view class="u-flex tuan-members">
<image :src="imgs.pin" class="pin" mode=""></image>
<text class="">{{item.groupPeopleNum}}人团</text>
<text class="">{{ item.groupPeopleNum }}人团</text>
</view>
<statusVue :status="item.status"></statusVue>
</view>
<view class="u-m-t-16 u-flex u-col-center u-row-between">
<view style="max-width: 356rpx;">
<view class="font-bold u-line-1" v-if="item.wareJson">{{item.wareJson
.wareName}}</view>
<view class="u-flex u-m-t-10 u-col-center ">
<view style="max-width: 356rpx">
<view class="font-bold u-line-1" v-if="item.wareJson">{{ item.wareJson.wareName }}</view>
<view class="u-flex u-m-t-10 u-col-center">
<view class="price">
<text class="u-font-30">¥</text>
<text class="u-font-48 font-bold">{{item.wareGroupPrice}} </text>
<text class="u-font-48 font-bold">{{ item.wareGroupPrice }}</text>
</view>
<view class="old-price u-m-l-32">
<text>¥</text>
<text>{{item.wareOriginalPrice}} </text>
<text>{{ item.wareOriginalPrice }}</text>
</view>
</view>
</view>
<view class="u-p-l-16 color-333 no-wrap">
数量{{item.num}}
</view>
<view class="u-p-l-16 color-333 no-wrap">数量{{ item.num }}</view>
</view>
</view>
</view>
<view class="shop-box">
<view class="shop ">
<view class="shop">
<view class="u-flex">
<text style="min-width: 180rpx;" class="color-666">可核销门店</text>
<text>{{item.shopName}}</text>
<text style="min-width: 180rpx" class="color-666">可核销门店</text>
<text>{{ item.shopName }}</text>
</view>
<view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx;" class="color-666">门店地址</text>
<text>{{item.shopAddress}}</text>
<text style="min-width: 180rpx" class="color-666">门店地址</text>
<text>{{ item.shopAddress }}</text>
</view>
</view>
</view>
<view class="order">
<view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;">
<text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showOrder}">
<view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline">
<text class="u-m-r-18">{{ showOrder ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showOrder }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
@@ -352,85 +334,73 @@
<view class="u-m-t-16" v-if="showOrder">
<view class="u-flex u-row-between item">
<view class="color-666">商品总额</view>
<view class="">¥{{item.payAmount}}</view>
<view class="">¥{{ item.payAmount }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">实付金额</view>
<view class="">¥{{item.payAmount}}</view>
<view class="">¥{{ item.payAmount }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">订单号</view>
<view class="">{{item.orderNo}}</view>
<view class="">{{ item.orderNo }}</view>
</view>
<view class="u-flex u-row-between item">
<view class="color-666">支付时间</view>
<view class="">{{item.payTime}}</view>
<view class="">{{ item.payTime }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
</view>
</template>
<script setup>
import statusVue from '@/groupBuying/components/status.vue'
import * as Api from '@/common/api/order/gbOrder.js'
import {
wxShare
} from '@/utils/share.js'
import {
computed,
reactive
} from 'vue'
import {
getRemainingHMS
} from '@/utils/countdown.js'
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import statusVue from '@/groupBuying/components/status.vue';
import * as Api from '@/common/api/order/gbOrder.js';
import { wxShare } from '@/utils/share.js';
import { computed, reactive } from 'vue';
import { getRemainingHMS } from '@/utils/countdown.js';
function toPinIndex() {
function toPinIndex() {
uni.redirectTo({
url: '/groupBuying/index/index'
})
}
const imgs = {
});
}
const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/d21f2dfd7bec44618f2d5e4b88372b08.png',
pin: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/3947892924dd481782331513aff00eb3.png',
success: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6a75acd0c0db4bfe9937854b2b2df3f0.png'
}
};
const topStyle = {
const topStyle = {
backgroundImage: 'url(' + imgs.bg + ')'
}
const showOrder = ref(true)
};
const showOrder = ref(true);
function copyText(text) {
function copyText(text) {
uni.setClipboardData({
data: text,
success() {}
})
}
const query = reactive({
});
}
const query = reactive({
shopId: '',
detailId: '',
})
detailId: ''
});
function init(opt) {
console.log(opt)
Object.assign(query, opt)
getDetail()
}
const item = reactive({})
function init(opt) {
console.log(opt);
Object.assign(query, opt);
getDetail();
}
const item = reactive({});
function getDetail() {
function getDetail() {
try {
Api.recordDetail(query).then(res => {
Api.recordDetail(query).then((res) => {
if (!res) {
uni.showModal({
title: '提示',
@@ -439,46 +409,44 @@
success(res) {
uni.redirectTo({
url: '/groupBuying/index/index'
})
});
}
})
return
});
return;
}
console.log(res, 'res')
const wareJson = JSON.parse(res.wareJson)
wareJson.wareImgs = wareJson.wareImgs.split(',').filter(v => v)
console.log(res, 'res');
const wareJson = JSON.parse(res.wareJson);
wareJson.wareImgs = wareJson.wareImgs.split(',').filter((v) => v);
res.wareJson = wareJson;
res.goodsImg = wareJson.wareImgs[0];
Object.assign(item, res)
console.log('item', item)
})
Object.assign(item, res);
console.log('item', item);
});
} catch (err) {
console.log('err', err)
console.log('err', err);
}
}
onLoad(async (opt) => {
await handleMixinOnLoad(opt);
init(opt);
});
let timer = null;
let nowTime = ref(Date.now());
timer = setInterval(() => {
nowTime.value = Date.now();
}, 1000);
}
onLoad(init)
const returnTime = computed(() => {
nowTime.value;
return getRemainingHMS(item);
});
let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => {
nowTime.value = Date.now()
}, 1000)
function returnNum(index) {
return returnTime.value.split(':')[index];
}
const returnTime = computed(() => {
nowTime.value
return getRemainingHMS(item)
})
function returnNum(index) {
return returnTime.value.split(':')[index]
}
function refund(item) {
function refund(item) {
uni.showModal({
title: '提示',
content: '是否申请退款?',
@@ -487,44 +455,53 @@
if (res.confirm) {
Api.applyRefund({
recordId: item.id,
orderNo: item.orderNo,
}).then(res => {
orderNo: item.orderNo
}).then((res) => {
if (res) {
uni.showToast({
title: '申请成功'
})
});
setTimeout(() => {
getDetail()
}, 1000)
getDetail();
}, 1000);
}
})
});
}
}
})
}
});
}
onShareAppMessage(() => {
console.log('onShareAppMessage')
console.log(item)
const query = `groupOrderNo=${item.groupOrderNo}&shopId=${item.shopId}`
return wxShare({
onShareAppMessage(async (res) => {
let query = await returnQuery();
return {
title: item.wareJson.wareName,
imageUrl: item.goodsImg,
path: '/groupBuying/detail/index' + '?' + query,
query,
})
})
query
};
});
// onShareAppMessage(() => {
// console.log('onShareAppMessage');
// console.log(item);
// const query = `groupOrderNo=${item.groupOrderNo}&shopId=${item.shopId}`;
// return wxShare({
// title: item.wareJson.wareName,
// imageUrl: item.goodsImg,
// path: '/groupBuying/detail/index' + '?' + query,
// query
// });
// });
function toOrderDetail(item) {
function toOrderDetail(item) {
uni.navigateTo({
url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId
})
}
});
}
</script>
<style lang="scss" scoped>
.top {
.top {
height: 422rpx;
background-size: cover;
@@ -534,17 +511,15 @@
font-size: 32rpx;
font-weight: 700;
}
}
}
.bottom {
.bottom {
background-color: #fff;
padding: 0 28rpx;
.time {
padding: 18rpx 24rpx;
background: #FFF4E2;
background: #fff4e2;
display: flex;
align-items: center;
border-radius: 16rpx 16rpx 0 0;
@@ -552,7 +527,7 @@
.number {
padding: 6rpx;
border-radius: 16rpx;
background: #ED5A2E;
background: #ed5a2e;
color: #fff;
font-size: 32rpx;
margin-left: 18rpx;
@@ -578,7 +553,7 @@
.tuan-members {
padding: 0 16rpx 0 0;
border-radius: 0 6rpx 6rpx 0;
background: #4C2828;
background: #4c2828;
color: #f5d9ad;
font-weight: 700;
}
@@ -611,7 +586,7 @@
.shop {
border-radius: 8rpx;
background: #F8F8F8;
background: #f8f8f8;
padding: 16rpx 34rpx;
}
@@ -637,7 +612,7 @@
.add-box {
width: 140rpx;
height: 140rpx;
border: 2rpx dashed #D9D9D9;
border: 2rpx dashed #d9d9d9;
border-radius: 50%;
overflow: hidden;
position: relative;
@@ -676,17 +651,15 @@
.tuanzhang {
padding: 8rpx 18rpx;
border-radius: 20rpx;
background: #ED5A2E;
background: #ed5a2e;
color: #fff;
bottom: 0;
}
}
}
}
}
.btns {
.btns {
position: fixed;
left: 87rpx;
right: 87rpx;
@@ -704,29 +677,29 @@
line-height: 1;
margin: 0;
justify-content: center;
border: 2rpx solid #E8AD7B;
background: #FFF;
color: #E8AD7B;
border: 2rpx solid #e8ad7b;
background: #fff;
color: #e8ad7b;
&.main {
background-color: #E8AD7B;
background-color: #e8ad7b;
color: #fff;
}
}
}
}
.guodu {
transition: all .3s;
}
.guodu {
transition: all 0.3s;
}
.pin-btn {
.pin-btn {
padding: 14rpx 60rpx;
border-radius: 200rpx;
text-align: center;
font-size: 32rpx;
justify-content: center;
border: 2rpx solid #E8AD7B;
background: #E8AD7B;
border: 2rpx solid #e8ad7b;
background: #e8ad7b;
color: #fff;
position: relative;
@@ -738,13 +711,13 @@
bottom: 0;
opacity: 0;
}
}
}
.rotate {
.rotate {
transform: rotate(-90deg);
}
}
.order {
.order {
padding: 32rpx 28rpx;
border-radius: 16rpx;
margin: 14rpx 30rpx 30rpx 30rpx;
@@ -753,26 +726,26 @@
.item {
padding: 16rpx 0;
}
}
}
.refund {
.refund {
padding: 18rpx 164rpx;
border-radius: 0 0 16rpx 16rpx;
background: #FFF4E2;
background: #fff4e2;
font-weight: 700;
margin-bottom: 32rpx;
}
}
.success-icon {
.success-icon {
width: 102rpx;
height: 102rpx;
}
}
.bg-fff {
.bg-fff {
background-color: #fff;
}
}
.bottom1 {
.bottom1 {
margin: 0 28rpx;
padding: 0;
transform: translateY(-160rpx);
@@ -780,7 +753,7 @@
.time {
padding: 18rpx 24rpx;
background: #FFF4E2;
background: #fff4e2;
display: flex;
align-items: center;
border-radius: 16rpx 16rpx 0 0;
@@ -788,7 +761,7 @@
.number {
padding: 6rpx;
border-radius: 16rpx;
background: #ED5A2E;
background: #ed5a2e;
color: #fff;
font-size: 32rpx;
margin-left: 18rpx;
@@ -814,7 +787,7 @@
.tuan-members {
padding: 0 16rpx 0 0;
border-radius: 0 6rpx 6rpx 0;
background: #4C2828;
background: #4c2828;
color: #f5d9ad;
font-weight: 700;
}
@@ -846,7 +819,7 @@
.shop {
border-radius: 8rpx;
background: #F8F8F8;
background: #f8f8f8;
padding: 16rpx 34rpx;
}
@@ -869,11 +842,10 @@
width: calc(100% / 3);
display: flex;
.add-box {
width: 140rpx;
height: 140rpx;
border: 2rpx dashed #D9D9D9;
border: 2rpx dashed #d9d9d9;
border-radius: 50%;
overflow: hidden;
position: relative;
@@ -912,7 +884,7 @@
.tuanzhang {
padding: 8rpx 18rpx;
border-radius: 20rpx;
background: #ED5A2E;
background: #ed5a2e;
color: #fff;
bottom: 0;
}
@@ -930,5 +902,5 @@
padding: 16rpx 0;
}
}
}
}
</style>

View File

@@ -1,23 +1,16 @@
<!-- 充值中心 -->
<template>
<view class="container">
<up-navbar
bgColor="transparent"
title="充值中心"
@leftClick="back"
></up-navbar>
<up-navbar bgColor="transparent" title="充值中心" @leftClick="back"></up-navbar>
<view class="header-wrap">
<image
class="bg"
src="/static/czzx_header_bg.png"
mode="aspectFill"
></image>
<image class="bg" src="/static/czzx_header_bg.png" mode="aspectFill"></image>
<view class="select-shop">
<view class="select-btn">
<up-icon name="map" color="#333"></up-icon>
<text class="t">{{ shopInfo.shopName }}</text>
<up-icon name="arrow-right" color="#333"></up-icon>
</view>
<ymf-share></ymf-share>
</view>
<view class="balance-wrap">
<view class="left">
@@ -31,17 +24,13 @@
</view>
</view>
<view class="btm-wrap">
<view class=""> </view>
<view class=""></view>
</view>
</view>
<view class="bottom">
<view class="u-flex u-flex-between">
<view class="u-flex">
<image
src="/static/vip/money.png"
style="width: 44rpx; height: 44rpx"
mode=""
></image>
<image src="/static/vip/money.png" style="width: 44rpx; height: 44rpx" mode=""></image>
<text class="u-m-l-24 color-333 font-16 font-700">立即充值</text>
</view>
<view class="font-12 color-999">
@@ -50,27 +39,12 @@
</view>
</view>
<view class="list u-m-t-40">
<view
class="item color1"
@click="sel = index"
v-for="(item, index) in list"
:key="index"
:class="{ active: sel == index }"
>
<view class="item color1" @click="sel = index" v-for="(item, index) in list" :key="index" :class="{ active: sel == index }">
<view class="">
<text></text>
<text
class="font-700"
style="font-size: 48 u-flex-1rpx"
:class="{ color2: sel == index }"
>{{ item.amount }}</text
>
<text class="font-700" style="font-size: 48 u-flex-1rpx" :class="{ color2: sel == index }">{{ item.amount }}</text>
</view>
<view
class="font-12"
v-if="item.rewardAmount"
:class="{ color2: sel == index }"
>
<view class="font-12" v-if="item.rewardAmount" :class="{ color2: sel == index }">
<text></text>
<text></text>
<text class="font-14">{{ item.rewardAmount }}</text>
@@ -84,12 +58,7 @@
<text></text>
<text>{{ couponNum(item.couponInfoList) }}</text>
<text>张券</text>
<text
class="color2 u-m-l-8"
v-if="sel == index"
@click="lookCoupon(item)"
>查看</text
>
<text class="color2 u-m-l-8" v-if="sel == index" @click="lookCoupon(item)">查看</text>
</view>
<view class="sel u-flex" v-if="sel == index">
@@ -100,24 +69,12 @@
<template v-if="state.isCustom">
<view class="u-flex other flex-center">
<text class="font-14 color-333 font-700 u-m-r-28">其他金额</text>
<up-input
v-model="money"
type="number"
placeholder="请输入充值金额"
border="none"
placeholder-style="font-size:14px;"
></up-input>
<up-input v-model="money" type="number" placeholder="请输入充值金额" border="none" placeholder-style="font-size:14px;"></up-input>
</view>
<view class="color-999 font-12 u-m-t-4"
>自定义金额充值时不享受任何优惠赠送</view
>
<view class="color-999 font-12 u-m-t-4">自定义金额充值时不享受任何优惠赠送</view>
</template>
<button
class="buy-btn"
@click="buy"
:class="{ disabled: !state.isEnable }"
>
<button class="buy-btn" @click="buy" :class="{ disabled: !state.isEnable }">
<text class="font-16">{{ charge_money }}</text>
<text class="font-14 u-m-l-24">立即充值</text>
</button>
@@ -125,55 +82,52 @@
<view>充值说明</view>
<view class="u-m-t-16">
<text>适用门店</text>
<text class="color2 u-m-l-28" @click="toShopList"
>全国门店通用 {{ ">" }}
</text>
<text class="color2 u-m-l-28" @click="toShopList">全国门店通用 {{ '>' }}</text>
</view>
<view class="u-m-t-16">
<text>有效期限</text>
<text class="u-m-l-28">永久有效 </text>
<text class="u-m-l-28">永久有效</text>
</view>
<view class="u-m-t-16 u-flex u-flex-y-center">
<text class="no-wrap">注意事项</text>
<view class="u-m-l-28">
<view>1.储值完成后不支持自助退款,可联系商家处理</view>
<view> 2.余额不支持转赠不可提现长期有效</view>
<view>2.余额不支持转赠,不可提现,长期有效</view>
</view>
</view>
<view class="u-m-t-16 u-flex u-flex-y-center">
<text class="no-wrap">充值说明</text>
<text class="u-m-l-28" style="word-break: break-all">
{{ state.remark || "" }}
{{ state.remark || '' }}
</text>
</view>
</view>
</view>
<CouponList
v-model="couponModel.show"
:list="couponModel.couponInfoList"
></CouponList>
<CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList>
</view>
</template>
<script setup>
import { APIusershopInfodetail, APIshopUserInfo } from "@/common/api/member.js";
import CouponList from "@/components/coupon/list.vue";
import * as rechargeApi from "@/common/api/market/recharge.js";
import { recharge } from "@/common/api/order/index.js";
import { joinMember } from "@/common/api/order/index.js";
import { ref, onMounted, computed, reactive, watch } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { pay } from "@/utils/pay.js";
import ymfShare from '@/components/ymf-components/ymf-share.vue';
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import { APIusershopInfodetail, APIshopUserInfo } from '@/common/api/member.js';
import CouponList from '@/components/coupon/list.vue';
import * as rechargeApi from '@/common/api/market/recharge.js';
import { recharge } from '@/common/api/order/index.js';
import { joinMember } from '@/common/api/order/index.js';
import { ref, onMounted, computed, reactive, watch } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { pay } from '@/utils/pay.js';
function toShopList() {
uni.navigateTo({
url: "/pages/user/member/czzx-shop-list?shopId=" + option.shopId,
url: '/pages/user/member/czzx-shop-list?shopId=' + option.shopId
});
}
function toduihuan() {
uni.navigateTo({
url: "/user/exchange/index",
url: '/user/exchange/index'
});
}
@@ -184,7 +138,7 @@ function couponNum(list) {
}
const couponModel = reactive({
show: false,
couponInfoList: [],
couponInfoList: []
});
function lookCoupon(item) {
@@ -194,19 +148,19 @@ function lookCoupon(item) {
async function buy() {
if (!state.isEnable) {
return uni.showToast({
title: "充值未开启,暂不能充值",
icon: "none",
title: '充值未开启暂不能充值',
icon: 'none'
});
}
if (!charge_money.value) {
return uni.showToast({
title: "请选择或者输入充值金额",
icon: "none",
title: '请选择或者输入充值金额',
icon: 'none'
});
}
const json = {
shopId: option.shopId,
shopUserId: shopUserInfo.id,
shopUserId: shopUserInfo.id
};
if (sel.value < 0) {
json.amount = `${money.value}`.trim() * 1;
@@ -217,16 +171,16 @@ async function buy() {
const res = await recharge(json);
if (!res) {
return uni.showToast({
title: "充值失败",
icon: "error",
title: '充值失败',
icon: 'error'
});
}
const payRes = await pay(res);
console.log(payRes);
if (payRes) {
uni.showToast({
title: "充值成功",
icon: "none",
title: '充值成功',
icon: 'none'
});
init();
}
@@ -234,13 +188,13 @@ async function buy() {
function toDetail() {
uni.navigateTo({
url: "/pages/user/member/billDetails?type=1&shopId=" + option.shopId,
url: '/pages/user/member/billDetails?type=1&shopId=' + option.shopId
});
}
function toPwd() {
uni.navigateTo({
url: "/pages/user/member/setPassword?type=1&shopId=" + option.shopId,
url: '/pages/user/member/setPassword?type=1&shopId=' + option.shopId
});
}
@@ -251,26 +205,26 @@ const list = ref([]);
const sel = ref(0);
const money = ref(null);
const option = reactive({
shopId: "",
shopId: ''
});
const shopInfo = reactive({});
const shopUserInfo = reactive({});
const state = reactive({});
async function init() {
const shopInfoRes = await APIusershopInfodetail({
shopId: option.shopId,
shopId: option.shopId
});
if (shopInfoRes) {
Object.assign(shopInfo, shopInfoRes.shopInfo);
}
const shopUserInfoRes = await APIshopUserInfo({
shopId: option.shopId,
shopId: option.shopId
});
if (shopUserInfoRes) {
Object.assign(shopUserInfo, shopUserInfoRes);
}
const res = await rechargeApi.config({
shopId: option.shopId,
shopId: option.shopId
});
if (res) {
Object.assign(state, res);
@@ -282,16 +236,28 @@ const charge_money = computed(() => {
if (money.value > 0) {
return money.value;
}
return "";
return '';
}
const item = list.value[sel.value];
if (item) {
return item.amount;
}
return "";
return '';
});
onLoad((opt) => {
onShareAppMessage(async (res) => {
let query = await returnQuery();
return {
title: `充值-${shopInfo.shopName}`,
path: `/pages/user/member/czzx?${query}`,
imageUrl: shopInfo.logo,
query
};
});
onLoad(async (opt) => {
Object.assign(option, opt);
await handleMixinOnLoad(opt);
// init();
});
@@ -325,8 +291,7 @@ onShow(() => {
font-weight: 700;
border-radius: 80rpx;
line-height: 1;
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%),
linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
background: linear-gradient(98deg, #fe6d1100 40.64%, #ffd1b4 105.2%), linear-gradient(259deg, #fe6d11 50.14%, #ffd1b4 114.93%);
box-shadow: 0 14rpx 30.4rpx 0 #fe8b435e;
&.disabled {
background: #eee;
@@ -359,6 +324,7 @@ onShow(() => {
.select-shop {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;

View File

@@ -10,30 +10,30 @@
<view class="sku">
<view class="u-flex u-col-center">
<text class="price">¥{{item.price}}</text>
<text class="old-price">¥{{item.originPrice}}</text>
<text class="price">¥{{ item.price }}</text>
<text class="old-price">¥{{ item.originPrice }}</text>
</view>
<view>
<view class="u-m-t-16 text" v-if="item.limitBuyNum"> 限购{{item.limitBuyNum}} </view>
<view class="text u-m-t-10">已售{{item.saleNum||0}}</view>
<view class="u-m-t-16 text" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}</view>
<view class="text u-m-t-10">已售{{ item.saleNum || 0 }}</view>
</view>
</view>
<view class="goods">
<view class="goods-name">{{item.packageName}}</view>
<view class="goods-name">{{ item.packageName }}</view>
<view class="u-m-t-20 color-666">
{{item.description}}
{{ item.description }}
</view>
</view>
<view class="bg-f7" style="height: 32rpx"></view>
<view class="desc">
<view class="u-flex">
<view class="color-666 no-wrap" style="min-width: 180rpx;">可核销门店</view>
<view class="">{{item.shopName}}</view>
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店</view>
<view class="">{{ item.shopName }}</view>
</view>
<view class="u-flex u-m-t-16 u-col-baseline">
<view class="color-666 no-wrap" style="min-width: 180rpx;">门店地址</view>
<view class="">{{item.shopAddress}}</view>
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址</view>
<view class="">{{ item.shopAddress }}</view>
</view>
</view>
@@ -41,76 +41,63 @@
<view class="bg-f7" style="height: 32rpx"></view>
<view class="groups">
<view class="color-000 u-m-b-28 u-font-32 font-700">立即拼团</view>
<view class="item u-flex" v-for="(item,index) in item.gbOrderList" :key="index">
<view class="item u-flex" v-for="(item, index) in item.gbOrderList" :key="index">
<up-avatar size="76rpx" :src="item.avatar"></up-avatar>
<view class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
<view>
<view class="color-000 u-line-1" style="max-width: 180rpx;">{{item.nickName}}</view>
<view class="main-color u-m-t-2">{{returnNeedPerpole(item)}}人拼成</view>
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</view>
<view class="main-color u-m-t-2">{{ returnNeedPerpole(item) }}人拼成</view>
</view>
<view class="u-m-t-22">
<text class="color-666">剩余</text>
<text class="main-color">{{getRemainingHMS(item)}}</text>
<text class="main-color">{{ getRemainingHMS(item) }}</text>
</view>
<view class="btn" @click="fastBuy(item)">快速拼成</view>
</view>
</view>
</view>
</template>
<view class="bg-f7" style="height: 24rpx"></view>
<view class="goods-group">
<view class="u-flex u-row-between">
<view class="name">套餐商品</view>
<view class="u-flex color-666" @click="showGroup=!showGroup" style="align-items: baseline;">
<text class="u-m-r-18">{{showGroup?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showGroup}">
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline">
<text class="u-m-r-18">{{ showGroup ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showGroup }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<view class="" v-if="showGroup">
<view class="u-m-t-48" v-for="(item,index) in item.packageContent" :key="index">
<view class="u-m-t-48" v-for="(item, index) in item.packageContent" :key="index">
<view class="font-bold">
<text class="">{{item.name}}</text>
<text class="u-m-l-30">{{item.packageProducts.length}}{{item.num}}</text>
<text class="">{{ item.name }}</text>
<text class="u-m-l-30">{{ item.packageProducts.length }}{{ item.num }}</text>
</view>
<view class="">
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods,goodsIndex) in item.packageProducts"
:key="goodsIndex">
<text>{{goods.name}}</text>
<view class="u-flex u-m-t-24 u-row-between" v-for="(goods, goodsIndex) in item.packageProducts" :key="goodsIndex">
<text>{{ goods.name }}</text>
<view class="u-flex text-right">
<text class="color-666 u-m-r-42">x{{goods.num}}</text>
<view style="min-width: 110rpx;">¥{{goods.price}}</view>
<text class="color-666 u-m-r-42">x{{ goods.num }}</text>
<view style="min-width: 110rpx">¥{{ goods.price }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="desc" v-if="item.tieredDiscount&&item.tieredDiscount.length>0">
<view class="desc" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">
<view class="u-flex u-row-between">
<view class="name">分享说明</view>
<view class="u-flex color-666" @click="showDesc=!showDesc" style="align-items: baseline;">
<text class="u-m-r-18">{{showDesc?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showDesc}">
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline">
<text class="u-m-r-18">{{ showDesc ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !showDesc }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<template v-if="showDesc">
<view class="u-m-t-26 text-center table">
@@ -118,90 +105,58 @@
<view class="u-flex-1 u-p-t-32 u-p-b-32">分享人数</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">购买价格</view>
</view>
<view class="u-flex row" v-for="(step,index) in item.tieredDiscount" :key="index">
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{step.peopleNum}}</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{step.price}}</view>
<view class="u-flex row" v-for="(step, index) in item.tieredDiscount" :key="index">
<view class="u-flex-1 u-p-t-32 u-p-b-32">{{ step.peopleNum }}</view>
<view class="u-flex-1 u-p-t-32 u-p-b-32">¥{{ step.price }}</view>
</view>
</view>
<view class="u-m-t-26" >
<view>
分享期限小时{{item.expireHours}}
</view>
<view class="u-m-t-10">
规定期限内的助力才会被计入
</view>
<view class="u-m-t-40">
如何才是分享成功被分享人只需要点击助力提示助力成功后即可
</view>
<view class="u-m-t-26">
<view>分享期限小时{{ item.expireHours }}</view>
<view class="u-m-t-10">规定期限内的助力才会被计入</view>
<view class="u-m-t-40">如何才是分享成功被分享人只需要点击助力提示助力成功后即可</view>
</view>
</template>
</view>
<view class="desc">
<view class="u-flex u-row-between">
<view class="name">使用说明</view>
<view class="u-flex color-666" @click="useDescShow=!useDescShow" style="align-items: baseline;">
<text class="u-m-r-18">{{useDescShow?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!useDescShow}">
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline">
<text class="u-m-r-18">{{ useDescShow ? '收起' : '展开' }}</text>
<view class="guodu" :class="{ rotate: !useDescShow }">
<up-icon name="arrow-down" bold></up-icon>
</view>
</view>
</view>
<template v-if="useDescShow">
<view class="u-m-t-16 color-666">
<view>
1可用时间段{{canuseTime}}
<view>1可用时间段{{ canuseTime }}</view>
<view v-if="item.otherDesc">2其他使用说明{{ item.otherDesc }}</view>
</view>
<view v-if="item.otherDesc">
2其他使用说明{{item.otherDesc}}
</view>
</view>
</template>
</view>
<view class="goods-detail" v-if="item.goodsCategory!='优惠券'">
<view class="goods-detail" v-if="item.goodsCategory != '优惠券'">
<view class="u-flex u-row-center">
<view class="title">商品详情</view>
</view>
<view class="u-m-t-32">
<image class="w-full" v-for="(item,index) in item.detailImages" :key="index" mode="widthFix" :src="item">
</image>
<image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix" :src="item"></image>
</view>
</view>
<view style="height: 140px"></view>
<view class="fixed-bottom ">
<view class="fixed-bottom">
<!-- <view v-if="isCanExchange" class="btn" @click="exchangeClick">
{{returnBtmText}}
</view> -->
<view v-if="isCanExchange" class="btn" @click="payExchange">
{{returnBtmText}}
{{ returnBtmText }}
</view>
<view class="btn gray u-m-t-32" @click="createOrder" v-if="item.tieredDiscount&&item.tieredDiscount.length>0">
发起助力
<view class="btn gray u-m-t-32" @click="createOrder" v-if="item.tieredDiscount && item.tieredDiscount.length > 0">发起助力</view>
</view>
</view>
<!-- 需要支付的弹窗 -->
<up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false">
<view class="popup-content">
@@ -213,31 +168,29 @@
<image class="cover" :src="coverImgs[0]"></image>
<view class="u-flex u-flex-1 u-row-between u-p-l-16 u-col-center">
<view>
<view class="u-font-32 font-bold">{{item.packageName}}</view>
<view class="u-font-32 font-bold">{{ item.packageName }}</view>
<view class="u-m-t-12 color-666 u-line-2">{{item.otherDesc}}</view>
<view class="u-m-t-12 color-666 u-line-2">{{ item.otherDesc }}</view>
</view>
<view>
<view class="price">¥{{item.price}}</view>
<view class="old-price">¥{{item.originPrice}}</view>
<view class="limitBuyNum" v-if="item.limitBuyNum"> 限购{{item.limitBuyNum}} </view>
<view class="price">¥{{ item.price }}</view>
<view class="old-price">¥{{ item.originPrice }}</view>
<view class="limitBuyNum" v-if="item.limitBuyNum">限购{{ item.limitBuyNum }}</view>
</view>
</view>
</view>
</view>
<view class="bottom u-flex u-row-between u-col-center">
<view class="u-flex u-col-baseline">
<text class="color-666">合计</text>
<text class=" price">{{totalPrice}}</text>
<text class="price">{{ totalPrice }}</text>
</view>
<view class="u-flex">
<up-icon name="minus-circle" size="20" color="#666" @click="changeNumber('-')"></up-icon>
<text class="u-m-l-20 u-m-r-20">{{number}}</text>
<text class="u-m-l-20 u-m-r-20">{{ number }}</text>
<up-icon name="plus-circle-fill" size="20" color="#ED5A2E" @click="changeNumber('+')"></up-icon>
</view>
</view>
<view class="u-m-t-42 u-flex u-row-center">
@@ -249,150 +202,135 @@
</view>
</template>
<script setup>
import {
Storelogin
} from '@/stores/user.js';
const storelogin = Storelogin();
import {
computed,
reactive,
watch
} from "vue";
import dayjs from "dayjs";
import {
wxShare
} from '@/utils/share.js'
import {
getOpenId
} from '@/utils/uniapp.js'
import modal from "@/groupBuying/components/modal.vue";
import * as Api from '@/common/api/market/package.js'
import {
pay
} from '@/utils/pay.js'
const imgs = {
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png",
};
const number = ref(1)
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js';
import { Storelogin } from '@/stores/user.js';
const storelogin = Storelogin();
import { computed, reactive, watch } from 'vue';
import dayjs from 'dayjs';
import { wxShare } from '@/utils/share.js';
import { getOpenId } from '@/utils/uniapp.js';
import modal from '@/groupBuying/components/modal.vue';
import * as Api from '@/common/api/market/package.js';
import { pay } from '@/utils/pay.js';
const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png'
};
const number = ref(1);
const showGroup = ref(true)
const showDesc = ref(true)
const useDescShow=ref(true)
const showGroup = ref(true);
const showDesc = ref(true);
const useDescShow = ref(true);
import {
BigNumber
} from "bignumber.js";
const totalPrice = computed(() => {
import { BigNumber } from 'bignumber.js';
const totalPrice = computed(() => {
if (!item.price) {
return 0;
}
return BigNumber(number.value).times(item.price).toNumber()
})
return BigNumber(number.value).times(item.price).toNumber();
});
function changeNumber(step) {
function changeNumber(step) {
if (step === '-') {
if (number.value == 1) {
return
return;
}
number.value--
return
number.value--;
return;
}
if (step === '+') {
if (item.limitBuyNum == -10086) {
number.value++
return
number.value++;
return;
}
if (number.value >= item.limitBuyNum) {
return uni.showToast({
title: '最多可购买' + item.limitBuyNum + '份',
icon: 'none'
})
}
number.value++
return
}
}
const modalData = reactive({
show: false,
});
}
number.value++;
return;
}
}
const modalData = reactive({
show: false
});
function prveImg(index) {
function prveImg(index) {
uni.previewImage({
urls: coverImgs.value,
current: index
})
}
});
}
const popupData = reactive({
const popupData = reactive({
show: false,
item: null
});
});
function exchangeClick() {
popupData.show = true
function exchangeClick() {
popupData.show = true;
}
}
function fastBuy(item) {
function fastBuy(item) {
popupData.item = item;
popupData.show = true
}
watch(() => popupData.show, (newval) => {
popupData.show = true;
}
watch(
() => popupData.show,
(newval) => {
if (!newval) {
popupData.item = null
popupData.item = null;
}
})
}
);
function dingyue() {
function dingyue() {
return new Promise((revlove, reject) => {
uni.requestSubscribeMessage({
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0',
'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'
],
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', 'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'],
success(res) {},
complete() {
revlove()
revlove();
}
})
})
});
});
}
}
async function createOrder(){
async function createOrder() {
Api.createOrder({
packageId:item.id,
shopId: item.shopId,
}).then(res=>{
if(res){
packageId: item.id,
shopId: item.shopId
}).then((res) => {
if (res) {
uni.redirectTo({
url:'/userPackage/order/detail?orderId='+res
})
}else{
url: '/userPackage/order/detail?orderId=' + res
});
} else {
uni.showToast({
title:'发起助力失败',
icon:'none'
})
}
})
title: '发起助力失败',
icon: 'none'
});
}
});
}
async function payExchange() {
async function payExchange() {
uni.setStorageSync('group_buying_order', {
...item,
number: number.value,
})
number: number.value
});
uni.navigateTo({
url: '/userPackage/confirm-order/confirm-order'
})
return
});
return;
await dingyue();
uni.showLoading({
title: '支付中……'
})
const openId = await getOpenId()
uni.hideLoading()
});
const openId = await getOpenId();
uni.hideLoading();
if (openId) {
Api.exchange({
paramId: item.id,
@@ -400,116 +338,108 @@
number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
openId
}).then(orderRes => {
}).then((orderRes) => {
popupData.show = false;
pay(orderRes.payInfo).then(res => {
console.log(res)
pay(orderRes.payInfo).then((res) => {
console.log(res);
if (res) {
uni.redirectTo({
url: '/groupBuying/success/index?detailId=' + orderRes.record
.id
})
url: '/groupBuying/success/index?detailId=' + orderRes.record.id
});
} else {
uni.showToast({
title: '开团失败',
icon: 'none'
})
});
}
})
})
});
});
} else {
uni.showToast({
title: '鉴权失败,兑换失败',
icon: 'none'
})
}
});
}
}
const item = reactive({
const item = reactive({
goodsDescription: []
})
const isCanExchange = computed(() => {
});
const isCanExchange = computed(() => {
if (item.quantity <= 0) {
return false
return false;
}
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return false
return false;
}
return true
})
return true;
});
const returnBtmText = computed(() => {
const returnBtmText = computed(() => {
if (isCanExchange.value) {
return '立即购买'
return '立即购买';
}
if (pointsUser.pointBalance < item.requiredPoints) {
const num = item.requiredPoints - pointsUser.pointBalance
return `积分不足,还差${num}积分`
const num = item.requiredPoints - pointsUser.pointBalance;
return `积分不足,还差${num}积分`;
}
if (item.quantity <= 0) {
return `库存不足`
return `库存不足`;
}
if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return `单人兑换已达上限`
return `单人兑换已达上限`;
}
})
});
const query = reactive({
const query = reactive({
shopId: '',
id: '',
})
id: ''
});
const coverImgs = ref([]);
const coverImgs = ref([])
async function init(opt) {
async function init(opt) {
// 获取小程序进入场景和参数
const launchOptions = uni.getLaunchOptionsSync();
console.log(launchOptions);
// 获取链接上的参数
const launchOptionsQuery = launchOptions.query;
console.log('launchOptionsQuery', launchOptionsQuery);
Object.assign(query, launchOptionsQuery)
console.log(opt)
Object.assign(query, opt)
console.log(query)
await storelogin.actionslogin()
getDetail()
}
Object.assign(query, launchOptionsQuery);
console.log(opt);
Object.assign(query, opt);
console.log(query);
await storelogin.actionslogin();
getDetail();
}
function getDetail() {
Api.getPackageDetail(query).then(res => {
Object.assign(item, res)
console.log(item)
coverImgs.value = res.images
uni.cache.set('shopId', item.shopId)
})
}
function getDetail() {
Api.getPackageDetail(query).then((res) => {
Object.assign(item, res);
console.log(item);
coverImgs.value = res.images;
uni.cache.set('shopId', item.shopId);
});
}
/**
/**
* 计算剩余时间差(毫秒)
* @param {Object} item - 包含groupEndTime的订单/拼团对象
* @returns {number} 剩余时间(毫秒)
*/
function returnRemainingTime(item) {
function returnRemainingTime(item) {
if (!item?.groupEndTime) return 0; // 容错无结束时间则返回0
return dayjs(item.groupEndTime).valueOf() - dayjs().valueOf();
}
}
/**
/**
* 将毫秒差格式化为 HH:MM:SS最多72小时
* @param {number} ms - 时间差(毫秒)
* @returns {string} 格式化后的时分秒(如 09:09:09、72:00:00、00:00:00
*/
function formatTimeToHMS(ms) {
function formatTimeToHMS(ms) {
// 边界1已过期/无剩余时间 → 显示00:00:00
if (ms <= 0) return '00:00:00';
@@ -529,56 +459,60 @@
// 补零(确保两位数,如 9 → 09
const pad = (num) => String(num).padStart(2, '0');
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
}
}
let timer = null;
let nowTime = ref(Date.now());
timer = setInterval(() => {
nowTime.value = Date.now();
}, 1000);
let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => {
nowTime.value = Date.now()
}, 1000)
// 组合使用:获取格式化后的剩余时间
function getRemainingHMS(item) {
nowTime.value
// 组合使用:获取格式化后的剩余时间
function getRemainingHMS(item) {
nowTime.value;
const ms = returnRemainingTime(item);
return formatTimeToHMS(ms);
}
}
function returnNeedPerpole(data) {
return data.groupPeopleNum - data.currentPeopleNum;
}
function returnNeedPerpole(data) {
return data.groupPeopleNum - data.currentPeopleNum
}
onLoad(async (opt) => {
await handleMixinOnLoad(opt);
init(opt);
});
// #ifdef MP-WEIXIN
uni.showShareMenu();
// #endif
onLoad(init)
// #ifdef MP-WEIXIN
uni.showShareMenu()
// #endif
onShareAppMessage(() => {
const query = `id=${item.id}&shopId=${item.shopId}`
return wxShare({
title: item.wareName,
onShareAppMessage(async () => {
let query = await returnQuery();
const options = {
title: item.packageName,
imageUrl: coverImgs.value[0],
path: '/userPackage/goodsDetail/goodsDetail' + '?' + query,
query,
})
})
query
};
console.log('onShareAppMessage===', options);
return options;
});
const canuseTime=computed(()=>{
return item.useWeeks.join('、')+' '+item.useTimes
})
const canuseTime = computed(() => {
return item.useWeeks.join('、') + ' ' + item.useTimes;
});
</script>
<style lang="scss" scoped>
$topHeight: 350rpx;
$topHeight: 350rpx;
.top-img {
.top-img {
width: 750rpx;
height: $topHeight;
}
}
.top {
.top {
margin: 14rpx 18rpx;
background-size: cover;
height: $topHeight;
@@ -598,9 +532,9 @@
font-weight: 700;
margin-top: 62rpx;
}
}
}
.sku {
.sku {
display: flex;
justify-content: space-between;
padding: 20rpx 36rpx;
@@ -615,8 +549,8 @@
.old-price {
margin-left: 16rpx;
color: #E7E7E7;
opacity: .85;
color: #e7e7e7;
opacity: 0.85;
font-weight: 700;
text-decoration: line-through;
}
@@ -625,9 +559,9 @@
color: #fff;
font-size: 28rpx;
}
}
}
.goods {
.goods {
padding: 20rpx 28rpx;
background: #fff;
@@ -636,16 +570,14 @@
font-weight: 700;
color: #333;
}
}
}
.desc {
.desc {
padding: 32rpx 28rpx;
background-color: #fff;
}
}
.goods-detail {
.goods-detail {
padding: 32rpx;
.title {
@@ -653,7 +585,7 @@
padding: 0 22rpx;
&::before {
content: "";
content: '';
display: block;
position: absolute;
right: 100%;
@@ -666,7 +598,7 @@
&::after {
left: 100%;
content: "";
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
@@ -676,9 +608,9 @@
background: linear-gradient(90deg, #c9cbcc 0%, #f7f8f9 100%);
}
}
}
}
.fixed-bottom {
.fixed-bottom {
position: fixed;
left: 98rpx;
right: 98rpx;
@@ -694,24 +626,24 @@
color: #fff;
width: 556rpx;
text-align: center;
background-color: #E8AD7B;
background-color: #e8ad7b;
border: 1px solid transparent;
&.gray {
background: #fff;
color: #E8AD7B;
border-color: #E8AD7B;
}
color: #e8ad7b;
border-color: #e8ad7b;
}
}
}
.waring {
.waring {
background-color: rgba(255, 204, 0, 0.09);
padding: 32rpx 24rpx;
color: #ff8d28;
}
}
.popup-content {
.popup-content {
font-size: 28rpx;
min-height: 300px;
@@ -753,7 +685,6 @@
color: #666;
line-height: 42rpx;
}
}
.bottom {
@@ -778,19 +709,19 @@
color: #fff;
font-size: 700;
}
}
}
.w-full {
.w-full {
width: 100%;
}
}
.groups {
.groups {
padding: 28rpx 22rpx;
background-color: #fff;
.item {
padding: 28rpx 0;
border-bottom: 2rpx solid #EDEDED;
border-bottom: 2rpx solid #ededed;
&:last-child {
border-bottom: none;
@@ -803,14 +734,14 @@
.btn {
padding: 8rpx 26rpx;
border-radius: 36rpx;
background: #E8AD7B;
background: #e8ad7b;
font-weight: 700;
color: #fff;
}
}
}
}
.share-box {
.share-box {
top: 0;
position: absolute;
right: 0;
@@ -818,7 +749,7 @@
border-radius: 0 0 0 24rpx;
color: #ed5a2e;
font-weight: 700;
background: #FFF;
background: #fff;
overflow: hidden;
.share {
@@ -829,9 +760,9 @@
bottom: 0;
opacity: 0;
}
}
}
.goods-group {
.goods-group {
padding: 32rpx 46rpx;
background-color: #fff;
@@ -843,9 +774,9 @@
.rotate {
transform: rotate(-90deg);
}
}
}
.desc {
.desc {
padding: 32rpx 46rpx;
background-color: #fff;
margin-top: 32rpx;
@@ -856,7 +787,7 @@
}
.table {
border: 2rpx solid #EDEDED;
border: 2rpx solid #ededed;
border-radius: 8rpx;
margin: 0 52rpx;
@@ -865,7 +796,7 @@
}
.row {
border-top: 2rpx solid #EDEDED;
border-top: 2rpx solid #ededed;
&:first-child {
border-top: none;
@@ -876,9 +807,9 @@
.rotate {
transform: rotate(-90deg);
}
}
}
.guodu {
transition: all .3s;
}
.guodu {
transition: all 0.3s;
}
</style>

File diff suppressed because it is too large Load Diff