1 Commits

Author SHA1 Message Date
13ae818fd4 工具库更新 2026-01-26 16:02:43 +08:00
37 changed files with 5342 additions and 6682 deletions

View File

@@ -1,4 +1,3 @@
<script setup> <script setup>
import { import {
useCartsStore useCartsStore

View File

@@ -136,15 +136,6 @@ export const getInviteCode = (data) => {
data: data, data: data,
}); });
}; };
export const autoGetInviteCode = (data) => {
return request({
url: prveUrl + "/user/distribution/autoGetInviteCode",
method: "get",
data: data,
});
};
// 获取配置 // 获取配置
export const getConfig = (data) => { export const getConfig = (data) => {
@@ -156,20 +147,3 @@ export const getConfig = (data) => {
}; };
// 分销员中心-无感-绑定邀请人
export const autoBindInviteUser = (data) => {
return request({
url: prveUrl + "/user/distribution/autoBindInviteUser",
method: "post",
data: data,
});
};
// 全民股东界面-进入过标识
export const distributionEditIn = (data) => {
return request({
url: prveUrl + "/user/distribution/editIn",
method: "get",
data: data,
});
};

View File

@@ -1,8 +1,6 @@
// 引入 request 文件 // 引入 request 文件
import request from '@/common/api/request.js' import request from '@/common/api/request.js'
import { import {prveUrl} from './config.js'
prveUrl
} from './config.js'
export const consumeDiscount = (data) => { export const consumeDiscount = (data) => {
return request({ return request({
@@ -18,11 +16,3 @@ export const homeData = (data) => {
data: data data: data
}) })
} }
// 清除所有分销绑定关系
export const distributionClear = (data) => {
return request({
url: prveUrl + '/user/distribution/clean',
method: 'get'
})
}

View File

@@ -1,26 +0,0 @@
// 引入 request 文件
import request from "@/common/api/request.js";
import { prveUrl } from "./config.js";
export const carousel = (data) => {
return request({
url: prveUrl + "/user/carousel",
method: "get",
data: data,
});
};
export const shareClaim = (data) => {
return request({
url: prveUrl + "/user/shareClaim",
method: "POST",
data: data,
});
};
export const shareConfig = (data) => {
return request({
url: prveUrl + "/user/share",
method: "get",
data: data,
});
};

View File

@@ -20,12 +20,6 @@ export const pointGoodsPage = (data) => {
data: data data: data
}) })
} }
export const pointsGoods = (data) => {
return request({
url: url + '/user/pointGoods/'+data.id,
method: 'get',
})
}
export const exchange = (data) => { export const exchange = (data) => {

View File

@@ -52,7 +52,7 @@ export default async (params) => {
//获取成功 //获取成功
if (res.code == 200) { if (res.code == 200) {
uni.hideLoading(); uni.hideLoading();
// uni.hideToast(); uni.hideToast();
resolve(res.data ? res.data : true); resolve(res.data ? res.data : true);
} else { } else {
switch (res.code) { switch (res.code) {
@@ -135,7 +135,7 @@ export default async (params) => {
// 不管成功还是失败都会执行 // 不管成功还是失败都会执行
setTimeout((res) => { setTimeout((res) => {
uni.hideLoading(); uni.hideLoading();
// uni.hideToast(); uni.hideToast();
}, 10000); }, 10000);
}, },
}); });

View File

@@ -1,9 +1,12 @@
// const debug = process.env.NODE_ENV == 'development' ? true : false; // const debug = process.env.NODE_ENV == 'development' ? true : false;
// const debug = false; // false线上 true本地 // const debug = false; // false线上 true本地
const debug = true; // false线上 true本地 const debug = false; // false线上 true本地
let baseUrl = '' let baseUrl = ''
let baseUrlwws = '' let baseUrlwws = ''
const version = "100"; const version = "100";
const autoRemoveCache = { const autoRemoveCache = {
count: 100000, count: 100000,

View File

@@ -44,9 +44,6 @@ page,
image { image {
display: block; display: block;
} }
.relative{
position: relative;
}
.absolute{ .absolute{
position: absolute; position: absolute;
} }

View File

@@ -1,141 +0,0 @@
<!-- 私域引流 -->
<template>
<u-popup :show="show" mode="center" :safeAreaInsetBottom="false">
<view class="new_preview">
<view class="header">{{ shopInfo.shopName }}</view>
<view class="content">
<view class="title">{{ group.title }}</view>
<view class="img_wrap">
<image class="img" :show-menu-by-longpress="true" :src="group.groupUrl" @click=""></image>
</view>
<view class="intro">
{{ group.content }}
</view>
<view class="foot">
如果长按不能识别可截图或保存二维码图片至相册通过微信扫码入群
</view>
</view>
<view class="close" @click="closeHandle">
<u-icon name="close" color="#fff" size="14"></u-icon>
</view>
</view>
</u-popup>
</template>
<script setup>
import dayjs from 'dayjs';
import { ref, onMounted } from 'vue';
import { centerConfig,distributionEditIn } from '@/common/api/market/distribution.js';
import { checkArrayElementsExist } from '@/utils/util.js';
const shopInfo = ref('');
const props = defineProps({
type: {
type: String,
default: 'home' // 调用的位置 home首页 order支付成功后
},
group:{
type:Object,
default:()=>{}
}
});
const show = defineModel(false) ;
function closeHandle() {
const shopUserInfo=uni.cache.get('shopUserInfo')
distributionEditIn({
shopUserId:shopUserInfo.id
})
show.value = false;
}
onMounted(() => {
shopInfo.value = uni.cache.get('shopInfo');
});
</script>
<style scoped lang="scss">
.new_preview {
--bg: #3f3b37;
--color: #f6dfc4;
--borderColor: #f6dfc45b;
width: 90vw;
background-color: var(--bg);
border-radius: 4px;
position: relative;
.close {
--size: 70upx;
width: var(--size);
height: var(--size);
border-radius: 50%;
background-color: var(--bg);
display: flex;
align-items: center;
justify-content: center;
position: absolute;
bottom: calc(var(--size) * -1 - 20upx);
left: 50%;
margin-left: calc(var(--size) / 2 * -1);
}
.header {
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: var(--color);
height: 50px;
border-bottom: 1px dashed var(--borderColor);
}
.content {
padding-bottom: 14px;
.title {
font-size: 14px;
color: var(--color);
height: 50px;
display: flex;
align-items: center;
justify-content: center;
}
.img_wrap {
display: flex;
justify-content: center;
.img {
--size: 220px;
width: var(--size);
height: var(--size);
border-radius: 4px;
}
}
.intro {
height: 40px;
font-size: 14px;
color: var(--color);
display: flex;
align-items: center;
justify-content: center;
padding: 0 14px;
}
.foot {
height: 40px;
color: var(--borderColor);
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 14px;
text-align: center;
}
}
}
</style>

View File

@@ -1,224 +0,0 @@
<template>
<view class="ynf-share">
<up-popup :show="show" mode="center" bg-color="transparent">
<view >
<view class="bg" v-if="config.sharerCoupon" :style="returnBg('bg')">
<view class="title">邀请奖励</view>
<view class="desc">邀请1人即可得超值优惠券{{config.sharerCouponNum}}</view>
<view class="u-flex u-row-center">
<view class="coupon" :style="returnBg('coupon')">
<template v-if="config.sharerCoupon.couponType==1">
<view class="font-bold text-center color">
<text class="fuhao">¥</text>
<text>{{config.sharerCoupon.fullAmount}}-{{config.sharerCoupon.discountAmount}}</text>
</view>
</template>
<template v-if="config.sharerCoupon.couponType==2">
<view class="font-bold text-center color">
<text>{{config.sharerCoupon.discountNum}}</text>
</view>
</template>
<template v-if="config.sharerCoupon.couponType==3">
<view class="font-bold text-center color">
<text>{{config.sharerCoupon.discountRate/10}}</text>
</view>
</template>
<template v-if="config.sharerCoupon.couponType==3">
<view class="font-bold text-center color">
<text>{{config.sharerCoupon.discountRate/10}}</text>
</view>
</template>
<template v-if="config.sharerCoupon.couponType==4">
<view class="font-bold text-center color">
<text>第二件半价</text>
</view>
</template>
<template v-if="config.sharerCoupon.couponType==6">
<view class="font-bold text-center color">
<text>买一送一</text>
</view>
</template>
<view class="font-bold name">{{config.sharerCoupon.title}}</view>
</view>
</view>
<view class="u-flex u-row-center u-m-t-44">
<ymf-share>
<view class="share-btn" :style="returnBg('btn')"></view>
</ymf-share>
</view>
</view>
<view class="u-flex u-row-center u-m-t-30">
<view class="close-box u-flex u-col-center u-row-center" @click="close">
<up-icon name="close" size="36rpx" color="#000" :bold="true"></up-icon>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
shareConfig,
} from '@/common/api/market/share.js'
import {returnPageTags} from '@/utils/share.js'
import {
productStore
} from '@/stores/user.js';
const userStore = productStore();
const show = defineModel(false)
const imgs = {
btn: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/14ca8d88516b4739b4020b10d95a33c2.png',
coupon: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/4ccffb7cf8414cd19f0a10c6cf45b45b.png',
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/1ac6490c4efd4290abe7ca7f6d8e6eb2.png'
}
function returnBg(key) {
return {
backgroundImage: 'url(' + imgs[key] + ')'
}
}
// watch(() => show.value, (newval)=>{
// if(newval){
// getData()
// }
// })
function close() {
show.value = false
}
const config = reactive({})
async function getData(id) {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
const path = `/${currentPath}`;
const shopId = id||currentOptions.shopId||uni.cache.get('shopId')
// console.log('分享组件挂载完毕:shopId',shopId);
if (!shopId) {
return
}
shareConfig({
shopId
}).then(res => {
// console.log('分享组件挂载完毕:shareConfig',res);
// console.log('分享组件挂载完毕:currentOptions',currentOptions);
if(res){
Object.assign(config,res)
const rewardSharePages=res.rewardSharePages.split(',')
const pTag = returnPageTags(path)
if( pTag&&rewardSharePages.includes(pTag)&&currentOptions.fromUserId&&res.isSharedUserPopup){
show.value=true
}
// if(res.sharedUserCouponId&&res.sharedUserCouponNum){
// }
}
})
}
watch(()=>userStore.shopInfo.id,(newval)=>{
if(newval){
// getData()
shareConfig({
shopId:newval
}).then(res => {
if(res){
Object.assign(config,res)
}
})
}
})
onMounted(() => {
console.log('分享组件挂载完毕!');
getData()
})
</script>
<style lang="scss">
.bg {
width: 710rpx;
background-size: cover;
min-height: 820rpx;
padding-top: 260rpx;
background-color: transparent;
padding-left: 26rpx;
.title {
font-weight: 700;
font-size: 74rpx;
text-align: center;
background-image: linear-gradient(to bottom, #FF7E2D, #FF270E);
/* 定义渐变色 */
-webkit-background-clip: text;
/* Webkit 浏览器前缀 */
background-clip: text;
/* 标准属性 */
color: transparent;
/* 使文本透明,显示背景渐变 */
}
.desc {
margin-top: 20rpx;
font-size: 28rpx;
font-weight: 700;
text-align: center;
color: #FF280F;
}
}
.coupon {
margin-top: 30rpx;
width: 436rpx;
height: 182rpx;
background-size: cover;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 54rpx;
text-align: center;
.color {
background-image: linear-gradient(to bottom, #FFFFFB, #FFEBB0);
/* 定义渐变色 */
-webkit-background-clip: text;
/* Webkit 浏览器前缀 */
background-clip: text;
/* 标准属性 */
color: transparent;
/* 使文本透明,显示背景渐变 */
}
.fuhao {
font-size: 32rpx;
}
.name {
font-size: 36rpx;
color: #FFFFFB;
}
}
.close-box {
width: 74rpx;
height: 74rpx;
opacity: 0.82;
border-radius: 50%;
background: #fff;
}
.share-btn {
width: 262rpx;
height: 72rpx;
background-size: cover;
}
</style>

View File

@@ -1,38 +0,0 @@
<template>
<view class="relative">
<slot v-if="$slots.default" name="default"></slot>
<up-icon v-else name="share-square" bold :color="color" :size="size"></up-icon>
<view class="absolute share-box">
<button open-type="share" @click.stop="shareClick">分享</button>
</view>
</view>
</template>
<script setup>
const emits = defineEmits(['shareClick'])
const props = defineProps({
size: {
type: String,
default: '36rpx'
},
color:{
type: String,
default: '#333'
}
})
function shareClick() {
emits('shareClick')
}
</script>
<style lang="scss">
.share-box {
left: 0;
right: 0;
bottom: 0;
top: 0;
opacity: 0;
overflow: hidden;
}
</style>

View File

@@ -1,21 +1,38 @@
<template> <template>
<view class=""> <view class="">
<view class="w-qrcode"> <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> </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="box">
<view class="info"> <view class="info">
<view class="u-flex justify-center"> <view class="u-flex justify-center">
<up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar> <up-avatar size="214rpx" :src="shopUserInfo.headImg"></up-avatar>
</view> </view>
<view class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54"> <view
class="u-m-t-48 font-14 font-700 color-333 text-center line-height-54"
>
<view>{{ shopUserInfo.nickName }} </view> <view>{{ shopUserInfo.nickName }} </view>
<view>{{ desensitizePhone(shopUserInfo.phone) }}</view> <view>{{ desensitizePhone(shopUserInfo.phone) }}</view>
</view> </view>
<view class="u-m-t-16 font-14 line-height-54 text-center"> <view class="u-m-t-16 font-14 line-height-54 text-center">
<text class="color-666">邀请码</text> <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> <text class="" style="color: #fe6d11" @click="copyCode">复制</text>
</view> </view>
<view class="u-flex justify-center" style="margin-top: 90rpx"> <view class="u-flex justify-center" style="margin-top: 90rpx">
@@ -27,10 +44,10 @@
></w-qrcode> --> ></w-qrcode> -->
<up-image width="322rpx" height="322rpx" :src="code"></up-image> <up-image width="322rpx" height="322rpx" :src="code"></up-image>
</view> </view>
<view class="u-m-t-60 u-flex u-col-center justify-center">
<view class="confirm" @click="save">保存图片</view>
</view> </view>
<view class="footer-wrap">
<view class="confirm line" @click="save">保存图片</view>
<ymf-share><view class="confirm">微信分享</view></ymf-share>
</view> </view>
</view> </view>
</up-popup> </up-popup>
@@ -38,80 +55,47 @@
</template> </template>
<script setup> <script setup>
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js'; import wQrcode from "@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue";
import ymfShare from '@/components/ymf-components/ymf-share.vue'; import {desensitizePhone} from "@/utils/util.js";
import wQrcode from '@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue'; import { ref } from "vue";
import { desensitizePhone } from '@/utils/util.js';
import { ref, onMounted, nextTick } from 'vue';
onMounted(async () => {
setTimeout(async () => {
await nextTick();
const query = await returnQuery();
codeOptions.value.code = `https://cashier.sxczgkj.com/invite?${removeQAndAfter(query)}`;
console.log('codeOptions.value', codeOptions.value);
}, 500);
});
/**
* 截取字符串,移除 &q 及后面的所有内容
* @param {string} str - 原始字符串
* @returns {string} 处理后的字符串
*/
function removeQAndAfter(str) {
// 检查是否为空字符串
if (!str || typeof str !== 'string') {
return str || '';
}
// 找到 &q 的起始位置
const qIndex = str.indexOf('&q');
// 如果找到 &q截取前面的部分否则返回原字符串
return qIndex !== -1 ? str.slice(0, qIndex) : str;
}
const props = defineProps({ const props = defineProps({
inviteCode: { inviteCode: {
type: String, type: String,
default: '' default: "",
}, },
shopUserInfo: { shopUserInfo: {
type: Object, type: Object,
default: () => {} default: () => {},
} },
}); });
const codeOptions = ref({ const codeOptions = ref({
padding: 10,
size: 200, size: 200,
code: '' code: props.inviteCode,
}); });
function copyCode() { function copyCode() {
uni.setClipboardData({ uni.setClipboardData({
data: props.inviteCode, data: props.inviteCode,
success: function () { success: function () {
console.log('success'); console.log("success");
} },
}); });
} }
const code = ref(''); const code = ref("");
function qrcodeResult(e) { function qrcodeResult(e) {
console.log('qrcodeResult', e); console.log("qrcodeResult", e);
code.value = e.img.tempFilePath; code.value = e.img.tempFilePath;
console.log('code', code.value); console.log("code", code.value);
} }
const show = defineModel({ const show = defineModel({
type: Boolean, type: Boolean,
default: false default: false,
}); });
const emits = defineEmits(['cancel', 'confirm']); const emits = defineEmits(["cancel", "confirm"]);
function close() { function close() {
show.value = false; show.value = false;
emits('cancel'); emits("cancel");
} }
function save() { function save() {
show.value = false; show.value = false;
@@ -121,7 +105,7 @@ function save() {
filePath: code.value, filePath: code.value,
success: function () { success: function () {
uni.showToast({ uni.showToast({
title: '保存成功', title: "保存成功",
icon: 'none' icon: 'none'
}); });
}, },
@@ -167,14 +151,14 @@ function save() {
} else { } else {
// 非授权问题的保存失败(如文件路径错误、系统问题等) // 非授权问题的保存失败(如文件路径错误、系统问题等)
uni.showToast({ uni.showToast({
title: '保存失败', title: "保存失败",
icon: 'none' icon: 'none'
}); });
} }
} },
}); });
emits('confirm', code.value); emits("confirm", code.value);
} }
</script> </script>
@@ -191,8 +175,7 @@ function save() {
width: 638rpx; width: 638rpx;
background-color: #fff; background-color: #fff;
border-radius: 16rpx; border-radius: 16rpx;
// overflow: hidden; overflow: hidden;
position: relative;
.title { .title {
color: #000000; color: #000000;
font-size: 32rpx; font-size: 32rpx;
@@ -209,14 +192,6 @@ function save() {
min-width: 84rpx; min-width: 84rpx;
text-align: right; text-align: right;
} }
.footer-wrap {
width: 100%;
position: absolute;
left: 0;
bottom: -100upx;
display: flex;
gap: 28upx;
}
} }
.cancel { .cancel {
@@ -230,23 +205,15 @@ function save() {
line-height: 48rpx; line-height: 48rpx;
} }
.confirm { .confirm {
$color: #e8ad7b;
flex: 1;
padding: 14rpx 76rpx; padding: 14rpx 76rpx;
border-radius: 16rpx; border-radius: 16rpx;
background-color: $color; background-color: #e8ad7b;
border: 2rpx solid $color; border: 2rpx solid #e8ad7b;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
font-weight: 400; font-weight: 400;
line-height: 48rpx;
white-space: nowrap; white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
&.line {
background-color: #fff;
color: $color;
}
} }
.line-height-54 { .line-height-54 {
line-height: 54rpx; line-height: 54rpx;
@@ -258,3 +225,4 @@ function save() {
z-index: -1; z-index: -1;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@@ -28,11 +28,11 @@
<view class="bg-f7" style="height: 32rpx"></view> <view class="bg-f7" style="height: 32rpx"></view>
<view class="desc"> <view class="desc">
<view class="u-flex"> <view class="u-flex">
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店</view> <view class="color-666 no-wrap" style="min-width: 180rpx;">可核销门店</view>
<view class="">{{item.shopName}}</view> <view class="">{{item.shopName}}</view>
</view> </view>
<view class="u-flex u-m-t-16 u-col-baseline"> <view class="u-flex u-m-t-16 u-col-baseline">
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址</view> <view class="color-666 no-wrap" style="min-width: 180rpx;">门店地址</view>
<view class="">{{item.shopAddress}}</view> <view class="">{{item.shopAddress}}</view>
</view> </view>
</view> </view>
@@ -44,9 +44,8 @@
<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> <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 class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
<view> <view>立即购买购
立即购买购 <view class="color-000 u-line-1" style="max-width: 180rpx;">{{item.nickName}}</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="main-color u-m-t-2">{{returnNeedPerpole(item)}}人拼成</view>
</view> </view>
<view class="u-m-t-22"> <view class="u-m-t-22">
@@ -55,11 +54,17 @@
</view> </view>
<view class="btn" @click="fastBuy(item)">快速拼成</view> <view class="btn" @click="fastBuy(item)">快速拼成</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<view class="bg-f7" style="height: 24rpx"></view> <view class="bg-f7" style="height: 24rpx"></view>
<view class="goods-detail" v-if="item.goodsCategory!='优惠券'"> <view class="goods-detail" v-if="item.goodsCategory!='优惠券'">
@@ -67,7 +72,9 @@
<view class="title">商品详情</view> <view class="title">商品详情</view>
</view> </view>
<view class="u-m-t-32"> <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> </view>
@@ -81,6 +88,8 @@
</view> </view>
</view> </view>
<!-- 需要支付的弹窗 --> <!-- 需要支付的弹窗 -->
<up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false"> <up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false">
<view class="popup-content"> <view class="popup-content">
@@ -103,6 +112,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom u-flex u-row-between u-col-center"> <view class="bottom u-flex u-row-between u-col-center">
@@ -115,6 +125,7 @@
<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> <up-icon name="plus-circle-fill" size="20" color="#ED5A2E" @click="changeNumber('+')"></up-icon>
</view> </view>
</view> </view>
<view class="u-m-t-42 u-flex u-row-center"> <view class="u-m-t-42 u-flex u-row-center">
@@ -123,69 +134,77 @@
</view> </view>
</up-popup> </up-popup>
<!-- 兑换确认弹窗end --> <!-- 兑换确认弹窗end -->
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js'; import {
import { computed, reactive, watch } from 'vue'; computed,
import dayjs from 'dayjs'; reactive,
import { wxShare } from '@/utils/share.js'; watch
import { getOpenId } from '@/utils/uniapp.js'; } from "vue";
import modal from '@/groupBuying/components/modal.vue'; import dayjs from "dayjs";
import * as Api from '@/common/api/order/gbOrder.js'; import {wxShare} from '@/utils/share.js'
import { pay } from '@/utils/pay.js'; import {
import { Storelogin } from '@/stores/user.js'; 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 storelogin = Storelogin();
const imgs = { const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png' bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png",
}; };
const number = ref(1); const number = ref(1)
import { BigNumber } from 'bignumber.js'; import {
BigNumber
} from "bignumber.js";
const totalPrice = computed(() => { const totalPrice = computed(() => {
if (!item.groupPrice) { if (!item.groupPrice) {
return 0; 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 (step === '-') {
if (number.value == 1) { if (number.value == 1) {
return; return
} }
number.value--; number.value--
return; return
} }
if (step === '+') { if (step === '+') {
if(item.limitBuyNum==-10086){ if(item.limitBuyNum==-10086){
number.value++; number.value++
return; return
} }
if(number.value>=item.limitBuyNum){ if(number.value>=item.limitBuyNum){
return uni.showToast({ return uni.showToast({
title:'最多可购买'+item.limitBuyNum+'份', title:'最多可购买'+item.limitBuyNum+'份',
icon:'none' icon:'none'
}); })
} }
number.value++; number.value++
return; return
} }
} }
const modalData = reactive({ const modalData = reactive({
show: false show: false,
}); });
function prveImg(index) { function prveImg(index) {
uni.previewImage({ uni.previewImage({
urls: coverImgs.value, urls: coverImgs.value,
current: index current: index
}); })
} }
const popupData = reactive({ const popupData = reactive({
@@ -194,50 +213,52 @@ const popupData = reactive({
}); });
function exchangeClick() { function exchangeClick() {
popupData.show = true; popupData.show = true
} }
function fastBuy(item) { function fastBuy(item) {
popupData.item = item; popupData.item = item;
popupData.show = true; popupData.show = true
} }
watch( watch(() => popupData.show, (newval) => {
() => popupData.show,
(newval) => {
if (!newval) { if (!newval) {
popupData.item = null; popupData.item = null
} }
} })
);
function dingyue() { function dingyue() {
return new Promise((revlove, reject) => { return new Promise((revlove, reject) => {
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0', 'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'], tmplIds: ['JGPAGmqcPEgWB6mvAl0SC5cMqr5H5Qjcim8JCpHAZd0',
'F4OyUhe_ZQ9BR731jlkaN2QXAUaA3HBZuUeVPfraSz0'
],
success(res) {}, success(res) {},
complete() { complete() {
revlove(); revlove()
} }
}); })
}); })
} }
async function payExchange() { async function payExchange() {
uni.setStorageSync('group_buying_order', { uni.setStorageSync('group_buying_order', {
...item, ...item,
number: number.value, number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '' groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
}); })
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/confirm-order/confirm-order' url: '/groupBuying/confirm-order/confirm-order'
}); })
return; return
await dingyue(); await dingyue();
uni.showLoading({ uni.showLoading({
title: '支付中……' title: '支付中……'
}); })
const openId = await getOpenId(); const openId = await getOpenId()
uni.hideLoading(); uni.hideLoading()
if (openId) { if (openId) {
Api.exchange({ Api.exchange({
paramId: item.id, paramId: item.id,
@@ -245,68 +266,75 @@ async function payExchange() {
number: number.value, number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '', groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
openId openId
}).then((orderRes) => { }).then(orderRes => {
popupData.show = false; popupData.show = false;
pay(orderRes.payInfo).then((res) => { pay(orderRes.payInfo).then(res => {
console.log(res); console.log(res)
if (res) { if (res) {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/success/index?detailId=' + orderRes.record.id url: '/groupBuying/success/index?detailId=' + orderRes.record
}); .id
})
} else { } else {
uni.showToast({ uni.showToast({
title: '开团失败', title: '开团失败',
icon: 'none' icon: 'none'
}); })
} }
});
}); })
})
} else { } else {
uni.showToast({ uni.showToast({
title: '鉴权失败,兑换失败', title: '鉴权失败,兑换失败',
icon: 'none' icon: 'none'
}); })
} }
} }
const item = reactive({ const item = reactive({
goodsDescription: [] goodsDescription: []
}); })
const isCanExchange = computed(() => { const isCanExchange = computed(() => {
if (item.quantity <= 0) { if (item.quantity <= 0) {
return false; return false
} }
if (item.limitQuota && item.boughtCount >= item.limitQuota) { if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return false; return false
} }
return true; return true
}); })
const returnBtmText = computed(() => { const returnBtmText = computed(() => {
if (isCanExchange.value) { if (isCanExchange.value) {
return '立即开团'; return '立即开团'
} }
if (pointsUser.pointBalance < item.requiredPoints) { if (pointsUser.pointBalance < item.requiredPoints) {
const num = item.requiredPoints - pointsUser.pointBalance; const num = item.requiredPoints - pointsUser.pointBalance
return `积分不足,还差${num}积分`; return `积分不足,还差${num}积分`
} }
if (item.quantity <= 0) { if (item.quantity <= 0) {
return `库存不足`; return `库存不足`
} }
if (item.limitQuota && item.boughtCount >= item.limitQuota) { if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return `单人兑换已达上限`; return `单人兑换已达上限`
} }
}); })
const query = reactive({ const query = reactive({
shopId: '', shopId: '',
wareId: '', wareId: '',
groupOrderNo: '' groupOrderNo: ''
}); })
const coverImgs = ref([]);
const coverImgs = ref([])
async function init(opt) { async function init(opt) {
// 获取小程序进入场景和参数 // 获取小程序进入场景和参数
@@ -315,17 +343,17 @@ async function init(opt) {
// 获取链接上的参数 // 获取链接上的参数
const launchOptionsQuery = launchOptions.query; const launchOptionsQuery = launchOptions.query;
console.log('launchOptionsQuery', launchOptionsQuery); console.log('launchOptionsQuery', launchOptionsQuery);
Object.assign(query, launchOptionsQuery); Object.assign(query, launchOptionsQuery)
console.log(opt); console.log(opt)
Object.assign(query, opt); Object.assign(query, opt)
console.log(query); console.log(query)
await storelogin.actionslogin(); await storelogin.actionslogin()
getDetail(); getDetail()
} }
function getDetail() { function getDetail() {
Api.wareDetail(query).then((res) => { Api.wareDetail(query).then(res => {
console.log('res', res); console.log('res',res)
if(!res){ if(!res){
uni.showModal({ uni.showModal({
title:'提示', title:'提示',
@@ -334,19 +362,20 @@ function getDetail() {
success() { success() {
uni.redirectTo({ uni.redirectTo({
url:'/groupBuying/index/index' url:'/groupBuying/index/index'
}); })
} }
}); })
} }
res.wareCommentImgs = res.wareCommentImgs.split(',').filter((v) => v); res.wareCommentImgs = res.wareCommentImgs.split(',').filter(v => v)
Object.assign(item, res); Object.assign(item, res)
console.log(item); console.log(item)
coverImgs.value = res.wareImgs.split(','); coverImgs.value = res.wareImgs.split(',')
uni.cache.set('shopId', item.shopId); uni.cache.set('shopId',item.shopId)
}); })
} }
/** /**
* 计算剩余时间差(毫秒) * 计算剩余时间差(毫秒)
* @param {Object} item - 包含groupEndTime的订单/拼团对象 * @param {Object} item - 包含groupEndTime的订单/拼团对象
@@ -384,52 +413,40 @@ function formatTimeToHMS(ms) {
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`; return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
} }
let timer = null;
let nowTime = ref(Date.now()); let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => { timer = setInterval(() => {
nowTime.value = Date.now(); nowTime.value = Date.now()
}, 1000); }, 1000)
// 组合使用:获取格式化后的剩余时间 // 组合使用:获取格式化后的剩余时间
function getRemainingHMS(item) { function getRemainingHMS(item) {
nowTime.value; nowTime.value
const ms = returnRemainingTime(item); const ms = returnRemainingTime(item);
return formatTimeToHMS(ms); return formatTimeToHMS(ms);
} }
function returnNeedPerpole(data) { function returnNeedPerpole(data) {
return data.groupPeopleNum - data.currentPeopleNum; return data.groupPeopleNum - data.currentPeopleNum
} }
onShareAppMessage(async () => {
let query = await returnQuery(); onLoad(init)
// query += `&wareId=${item.id}&shopId=${item.shopId}`; // #ifdef MP-WEIXIN
const options = { uni.showShareMenu()
// #endif
onShareAppMessage(() => {
const query = `wareId=${item.id}&shopId=${item.shopId}`
return wxShare({
title: item.wareName, title: item.wareName,
imageUrl: coverImgs.value[0], imageUrl: coverImgs.value[0],
path: '/groupBuying/goodsDetail/goodsDetail' + '?' + decodeURIComponent(query), path: '/groupBuying/goodsDetail/goodsDetail' + '?' + query,
query query,
}; })
console.log('onShareAppMessage===', options); })
return wxShare(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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -477,8 +494,8 @@ $topHeight: 350rpx;
.old-price { .old-price {
margin-left: 16rpx; margin-left: 16rpx;
color: #e7e7e7; color: #E7E7E7;
opacity: 0.85; opacity: .85;
font-weight: 700; font-weight: 700;
text-decoration: line-through; text-decoration: line-through;
} }
@@ -500,6 +517,8 @@ $topHeight: 350rpx;
} }
} }
.desc { .desc {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
background-color: #fff; background-color: #fff;
@@ -513,7 +532,7 @@ $topHeight: 350rpx;
padding: 0 22rpx; padding: 0 22rpx;
&::before { &::before {
content: ''; content: "";
display: block; display: block;
position: absolute; position: absolute;
right: 100%; right: 100%;
@@ -526,7 +545,7 @@ $topHeight: 350rpx;
&::after { &::after {
left: 100%; left: 100%;
content: ''; content: "";
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
@@ -549,6 +568,7 @@ $topHeight: 350rpx;
bottom: 0; bottom: 0;
z-index: 10; z-index: 10;
.btn { .btn {
padding: 22rpx; padding: 22rpx;
border-radius: 200rpx; border-radius: 200rpx;
@@ -556,7 +576,7 @@ $topHeight: 350rpx;
color: #fff; color: #fff;
width: 556rpx; width: 556rpx;
text-align: center; text-align: center;
background-color: #e8ad7b; background-color: #E8AD7B;
&.gray { &.gray {
background: #9999992b; background: #9999992b;
@@ -613,6 +633,7 @@ $topHeight: 350rpx;
color: #666; color: #666;
line-height: 42rpx; line-height: 42rpx;
} }
} }
.bottom { .bottom {
@@ -649,7 +670,7 @@ $topHeight: 350rpx;
.item { .item {
padding: 28rpx 0; padding: 28rpx 0;
border-bottom: 2rpx solid #ededed; border-bottom: 2rpx solid #EDEDED;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
@@ -662,7 +683,7 @@ $topHeight: 350rpx;
.btn { .btn {
padding: 8rpx 26rpx; padding: 8rpx 26rpx;
border-radius: 36rpx; border-radius: 36rpx;
background: #e8ad7b; background: #E8AD7B;
font-weight: 700; font-weight: 700;
color: #fff; color: #fff;
} }
@@ -674,9 +695,8 @@ $topHeight: 350rpx;
right: 0; right: 0;
padding: 4rpx 30rpx; padding: 4rpx 30rpx;
border-radius: 0 0 0 24rpx; border-radius: 0 0 0 24rpx;
color: #ed5a2e; color: #ed5a2e; font-weight: 700;
font-weight: 700; background: #FFF;
background: #fff;
overflow: hidden; overflow: hidden;
.share{ .share{
position: absolute; position: absolute;

View File

@@ -2,7 +2,8 @@
<view class="min-page bg-f7 u-font-28"> <view class="min-page bg-f7 u-font-28">
<up-sticky :offsetTop="0" :customNavHeight="0"> <up-sticky :offsetTop="0" :customNavHeight="0">
<view class="top" :style="topStyle"> <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"> <view class="u-flex info u-col-center">
<image :src="imgs.map" class="map"></image> <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>
@@ -25,24 +26,31 @@
</view> </view>
<view class="filters "> <view class="filters ">
<view class="u-flex tabs"> <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>
<view class="u-flex u-col-center" v-if="tabs.sel==0"> <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> <up-search v-model="query.wareName" @search="refresh" @clear="refresh"
@custom="refresh"></up-search>
<!-- <perpoleNumber v-model="query.groupPeopleNum"></perpoleNumber> --> <!-- <perpoleNumber v-model="query.groupPeopleNum"></perpoleNumber> -->
</view> </view>
<view class="u-flex orderStatus" v-if="tabs.sel==1"> <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"> <view class="orderState" :class="{'active':orders.sel==index}"
v-for="(item,index) in orders.list" :key="index" @click="orders.sel=index">
{{item.name}} {{item.name}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</up-sticky> </up-sticky>
<view class="lists" v-if="tabs.sel==0"> <view class="lists" v-if="tabs.sel==0">
<view class="item" v-for="(item,index) in list" :key="index" @click="toDetail(item)"> <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> <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-1 u-p-l-16">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
@@ -56,7 +64,7 @@
<text class="u-font-24">拼团到手</text> <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>
<view style="opacity: 0.84"> <view style="opacity: 0.84;">
<text class="u-font-24">原价</text> <text class="u-font-24">原价</text>
<text class=""> ¥{{item.originalPrice}}</text> <text class=""> ¥{{item.originalPrice}}</text>
</view> </view>
@@ -79,11 +87,13 @@
<up-image width="154rpx" height="154rpx" :src="item.goodsImg"></up-image> <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 class="u-flex-1 u-flex u-p-l-30 u-col-center u-row-between">
<view> <view>
<view class="" v-if="item.wareJson">{{ item.wareJson.wareName }}</view> <view class="">{{item.wareJson.wareName}}</view>
<view class="u-m-t-34 price">¥{{item.payAmount}}</view> <view class="u-m-t-34 price">¥{{item.payAmount}}</view>
</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> </view>
<view class="u-m-t-32 info"> <view class="u-m-t-32 info">
<view class="u-flex u-col-center"> <view class="u-flex u-col-center">
@@ -114,44 +124,62 @@
</template> </template>
<template v-else> <template v-else>
<view class="btn " @click.stop="refund(item)" v-if="canRefund(item)">申请退款</view> <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> <button open-type="share" class="btn black" @click.stop="share(item)"
v-if="showShare(item)">邀请好友</button>
</template> </template>
</view>
</view> </view>
</view> </view>
</view>
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode> <LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import { APIusershopInfodetail } from '@/common/api/member.js'; import {
import { back } from '@/utils/uniapp.js'; APIusershopInfodetail
import LookQrcode from '@/components/look-qrcode/look-qrcode.vue'; } from '@/common/api/member.js'
import { wxShare } from '@/utils/share.js'; import {
import { getRemainingHMS } from '@/utils/countdown.js'; back
import { onShow } from '@dcloudio/uni-app'; } from '@/utils/uniapp.js'
import * as Api from '@/common/api/order/gbOrder.js'; import LookQrcode from "@/components/look-qrcode/look-qrcode.vue";
import perpoleNumber from './components/perpole-number.vue'; import {
import statusVue from '@/groupBuying/components/status.vue'; wxShare
import { computed, reactive, watch } from 'vue'; } 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)) { if (canRefundStatus.includes(item.status)) {
return true; return true
} }
return false; return false
} }
const modalData = reactive({ const modalData = reactive({
show: false show: false,
}); });
const qrcode = ref(''); const qrcode = ref("");
function lookCode(item) { function lookCode(item) {
qrcode.value = item.verifyCode; qrcode.value = item.verifyCode
modalData.show = true; modalData.show = true;
} }
@@ -160,22 +188,21 @@ const imgs = {
bg1: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/604c3f917daa41af9239145196c6d3f3.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', 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' 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 + ')' backgroundImage: 'url(' + imgs.bg + ')'
}; }
const tabs = reactive({ const tabs = reactive({
list: ['活动列表', '我的拼团'], list: ['活动列表', '我的拼团'],
sel: 0 sel: 0
}); })
const orders = reactive({ const orders = reactive({
list: [ list: [{
{
name: '全部', name: '全部',
value: '' value: ''
}, },
@@ -194,100 +221,102 @@ const orders = reactive({
{ {
name: '退款', name: '退款',
value: '退款' value: '退款'
} },
], ],
sel: 0 sel: 0
}); })
const query = reactive({ const query = reactive({
page: 1, page: 1,
size: 10, size: 10,
wareName: '', wareName: '',
groupPeopleNum: '', groupPeopleNum: '',
shopId: uni.cache.get('shopId') shopId: uni.cache.get('shopId'),
}); })
const list = ref([]); const list = ref([])
const isEnd = ref(false); const isEnd = ref(false)
const status = computed(() => { const status = computed(() => {
return orders.list[orders.sel].value; return orders.list[orders.sel].value
}); })
watch( watch(() => status.value, () => {
() => status.value, refresh()
() => { })
refresh();
}
);
function getData() { function getData() {
if (tabs.sel == 0) { if (tabs.sel == 0) {
Api.warePage(query).then((res) => { Api.warePage(query).then(res => {
const newArr = res.records || []; const newArr = res.records || []
if (query.page == 1) { if (query.page == 1) {
list.value = newArr; list.value = newArr
} else { } else {
list.value.push(...newArr); list.value.push(...newArr)
} }
isEnd.value = query.page >= res.totalPage * 1 ? true : false; isEnd.value = query.page >= res.totalPage * 1 ? true : false
}); })
return; return
} }
if (tabs.sel == 1) { if (tabs.sel == 1) {
const { page, size, shopId } = query; const {
page,
size,
shopId
} = query
Api.record({ Api.record({
page, page,
size, size,
shopId, shopId,
status: status.value status: status.value,
}).then((res) => { }).then(res => {
const newArr = (res.records || []).map((v) => { const newArr = (res.records || []).map(v => {
const wareJson = JSON.parse(v.wareJson); const wareJson = JSON.parse(v.wareJson)
wareJson.wareImgs = wareJson.wareImgs.split(',').filter((v) => v); wareJson.wareImgs = wareJson.wareImgs.split(',').filter(v => v)
return { return {
...v, ...v,
goodsImg: wareJson.wareImgs[0], goodsImg: wareJson.wareImgs[0],
wareJson wareJson,
}; }
}); })
if (query.page == 1) { if (query.page == 1) {
list.value = newArr; list.value = newArr
} else { } else {
list.value.push(...newArr); list.value.push(...newArr)
} }
console.log(list.value); console.log(list.value)
isEnd.value = query.page >= res.totalPage * 1 ? true : false; isEnd.value = query.page >= res.totalPage * 1 ? true : false
}); })
return; return
} }
} }
function toDetail(item) { function toDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/goodsDetail/goodsDetail?wareId=' + item.id + '&shopId=' + item.shopId url: '/groupBuying/goodsDetail/goodsDetail?wareId=' + item.id + '&shopId=' + item.shopId
}); })
} }
function toOrderDetail(item) { function toOrderDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId
}); })
} }
function returnCoverImg(item) { function returnCoverImg(item) {
if (!item.wareImgs) { if (!item.wareImgs) {
return ''; return ''
} }
const arr = item.wareImgs.split(','); const arr = item.wareImgs.split(',')
return arr[0]; return arr[0]
} }
function refresh() { function refresh() {
query.page = 1; query.page = 1
isEnd.value = false; isEnd.value = false
getData(); getData()
} }
function refund(item) { function refund(item) {
@@ -299,20 +328,20 @@ function refund(item) {
if (res.confirm) { if (res.confirm) {
Api.applyRefund({ Api.applyRefund({
recordId: item.id, recordId: item.id,
orderNo: item.orderNo orderNo: item.orderNo,
}).then((res) => { }).then(res => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '申请成功' title: '申请成功'
}); })
setTimeout(() => { setTimeout(() => {
refresh(); refresh()
}, 1000); }, 1000)
} }
}); })
} }
} }
}); })
} }
function cancelRefund(item) { function cancelRefund(item) {
@@ -324,92 +353,90 @@ function cancelRefund(item) {
if (res.confirm) { if (res.confirm) {
Api.cancelRefund({ Api.cancelRefund({
recordId: item.id, recordId: item.id,
orderNo: item.orderNo orderNo: item.orderNo,
}).then((res) => { }).then(res => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '取消成功' title: '取消成功'
}); })
setTimeout(() => { setTimeout(() => {
refresh(); refresh()
}, 1000); }, 1000)
} }
}); })
} }
} }
}); })
} }
watch( watch(() => tabs.sel, (newval) => {
() => tabs.sel, orders.sel = 0
(newval) => { refresh()
orders.sel = 0; })
refresh();
}
);
function showBtns(item) { function showBtns(item) {
if (item.status == '已退款') { if (item.status == '已退款') {
return false; return false
} }
return true; return true
} }
function showShare(item) { function showShare(item) {
if (item.status == '待成团') { if (item.status == '待成团') {
return true; return true
} }
return false; return false
} }
function showTime(item) { function showTime(item) {
if (item.status == '待成团') { if (item.status == '待成团') {
return true; return true
} }
return false; return false
} }
let shareItem = null;
let shareItem = null
function share(item) { function share(item) {
shareItem = item; shareItem = item
} }
onShareAppMessage(() => { onShareAppMessage(() => {
console.log('onShareAppMessage'); console.log('onShareAppMessage')
console.log(shareItem); console.log(shareItem)
const query = `groupOrderNo=${shareItem.groupOrderNo}&shopId=${shareItem.shopId}`; const query = `groupOrderNo=${shareItem.groupOrderNo}&shopId=${shareItem.shopId}`
return wxShare({ return wxShare({
title: shareItem.wareJson.wareName, title: shareItem.wareJson.wareName,
imageUrl: shareItem.goodsImg, imageUrl: shareItem.goodsImg,
path: '/groupBuying/detail/index' + '?' + query, path: '/groupBuying/detail/index' + '?' + query,
query query,
}); })
}); })
onShow(getData); onShow(getData)
onLoad((opt) => { onLoad((opt) => {
const shopId = opt.shopId || uni.cache.get('shopId'); const shopId=opt.shopId||uni.cache.get('shopId')
query.shopId = shopId; query.shopId=shopId
uni.cache.set('shopId', query.shopId); uni.cache.set('shopId',query.shopId)
console.log('opt',opt); console.log('opt',opt);
APIusershopInfodetail({ APIusershopInfodetail({
shopId: shopId shopId: shopId
}).then((res) => { }).then(res => {
console.log(res); console.log(res);
shopInfo.value = res.shopInfo; shopInfo.value = res.shopInfo
uni.cache.set('shopInfo', res.shopInfo); uni.cache.set('shopInfo', res.shopInfo)
uni.cache.set('shopId', res.shopInfo.id); uni.cache.set('shopId', res.shopInfo.id)
}); })
}); })
let timer = null; let timer = null
let nowTime = ref(Date.now()); let nowTime = ref(Date.now())
timer = setInterval(() => { timer = setInterval(() => {
nowTime.value = Date.now(); nowTime.value = Date.now()
}, 1000); }, 1000)
function returnTime(item) { function returnTime(item) {
nowTime.value; nowTime.value
return getRemainingHMS(item); return getRemainingHMS(item)
} }
</script> </script>
@@ -436,7 +463,7 @@ function returnTime(item) {
padding: 20rpx 20rpx; padding: 20rpx 20rpx;
gap: 20rpx; gap: 20rpx;
border-radius: 14rpx 14rpx 0 0; 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; align-items: center;
.step { .step {
@@ -451,11 +478,11 @@ function returnTime(item) {
height: 44rpx; height: 44rpx;
line-height: 44rpx; line-height: 44rpx;
text-align: center; text-align: center;
background: #e55626; background: #E55626;
} }
.text { .text {
color: #5a352f; color: #5A352F;
margin-left: 10rpx; margin-left: 10rpx;
margin-right: 22rpx; margin-right: 22rpx;
white-space: nowrap; white-space: nowrap;
@@ -466,7 +493,7 @@ function returnTime(item) {
} }
.icon1 { .icon1 {
color: #5a352f; color: #5A352F;
} }
} }
@@ -477,15 +504,15 @@ function returnTime(item) {
display: flex; display: flex;
padding: 32rpx 16rpx; padding: 32rpx 16rpx;
border-radius: 32rpx; border-radius: 32rpx;
background: #fff; background: #FFF;
margin-bottom: 14rpx; margin-bottom: 14rpx;
.numbers { .numbers {
background: #4c2828; background: #4C2828;
padding: 8rpx 18rpx; padding: 8rpx 18rpx;
border-radius: 10rpx; border-radius: 10rpx;
font-weight: 700; font-weight: 700;
color: #faeac6; color: #FAEAC6;
white-space: nowrap; white-space: nowrap;
} }
@@ -495,13 +522,13 @@ function returnTime(item) {
.members { .members {
margin-top: 26rpx; margin-top: 26rpx;
background: #fdf1cb; background: #FDF1CB;
padding: 4rpx 18rpx; padding: 4rpx 18rpx;
border-radius: 10rpx 10rpx 10rpx 0; border-radius: 10rpx 10rpx 10rpx 0;
width: fit-content; width: fit-content;
font-size: 24rpx; font-size: 24rpx;
font-weight: 700; font-weight: 700;
color: #ed5a2e; color: #ED5A2E;
} }
.info { .info {
@@ -534,7 +561,7 @@ function returnTime(item) {
.filters { .filters {
padding: 16rpx 28rpx; padding: 16rpx 28rpx;
border-radius: 6rpx 6rpx 16rpx 16rpx; border-radius: 6rpx 6rpx 16rpx 16rpx;
background: #fff; background: #FFF;
} }
.tabs { .tabs {
@@ -545,11 +572,11 @@ function returnTime(item) {
padding: 32rpx 88rpx; padding: 32rpx 88rpx;
.tabs { .tabs {
transition: all 0.3s linear; transition: all .3s linear;
} }
.active { .active {
color: #ed5a2e; color: #ED5A2E;
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
font-weight: 700; font-weight: 700;
@@ -567,7 +594,7 @@ function returnTime(item) {
.orderState { .orderState {
color: #999; color: #999;
transition: all 0.3s linear; transition: all .3s linear;
&.active { &.active {
color: #000; color: #000;
@@ -583,11 +610,11 @@ function returnTime(item) {
.item { .item {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #fff; background: #FFF;
margin-bottom: 32rpx; margin-bottom: 32rpx;
.numbers { .numbers {
background-color: #ed5a2e; background-color: #ED5A2E;
padding: 16rpx 30rpx; padding: 16rpx 30rpx;
border-radius: 12rpx; border-radius: 12rpx;
font-size: 32rpx; font-size: 32rpx;
@@ -596,8 +623,10 @@ function returnTime(item) {
line-height: 36rpx; line-height: 36rpx;
} }
.price { .price {
color: #ed5a2e; color: #ED5A2E;
font-weight: 700; font-weight: 700;
line-height: 36rpx; line-height: 36rpx;
font-size: 40rpx; font-size: 40rpx;
@@ -608,7 +637,7 @@ function returnTime(item) {
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
border-radius: 8rpx; border-radius: 8rpx;
background: #f8f8f8; background: #F8F8F8;
.title { .title {
min-width: 208rpx; min-width: 208rpx;
@@ -625,6 +654,7 @@ function returnTime(item) {
font-weight: 700; font-weight: 700;
} }
} }
} }
.btns { .btns {
@@ -638,8 +668,8 @@ function returnTime(item) {
margin: 0; margin: 0;
padding: 12rpx 14rpx; padding: 12rpx 14rpx;
border-radius: 10rpx; border-radius: 10rpx;
border: 2rpx solid #d9d9d9; border: 2rpx solid #D9D9D9;
background: #fff; background: #FFF;
font-size: 28rpx; font-size: 28rpx;
&.black { &.black {
@@ -652,6 +682,7 @@ function returnTime(item) {
} }
} }
.copy { .copy {
width: 28rpx; width: 28rpx;
height: 28rpx; height: 28rpx;

View File

@@ -1,8 +1,10 @@
<template> <template>
<view> <view>
<template v-if="item.status=='待核销'"> <template v-if="item.status=='待核销'">
<view class="min-page bg-f7 color-333 u-font-28 relative"> <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="bottom">
<view class="u-p-32 u-flex u-row-center u-col-center u-flex-col bg-fff"> <view class="u-p-32 u-flex u-row-center u-col-center u-flex-col bg-fff">
@@ -12,15 +14,16 @@
<view class="shop "> <view class="shop ">
<view class="u-flex"> <view class="u-flex">
<text style="min-width: 180rpx" class="color-666">可核销门店</text> <text style="min-width: 180rpx;" class="color-666">可核销门店</text>
<text>{{item.shopName}}</text> <text>{{item.shopName}}</text>
</view> </view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx" class="color-666">门店地址</text> <text style="min-width: 180rpx;" class="color-666">门店地址</text>
<text>{{item.shopAddress}}</text> <text>{{item.shopAddress}}</text>
</view> </view>
</view> </view>
<view class="goods u-flex u-col-center"> <view class="goods u-flex u-col-center">
<up-image width="158rpx" height="158rpx" radius="14rpx" :src="item.goodsImg"></up-image> <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">
@@ -31,8 +34,9 @@
</view> </view>
</view> </view>
<view class="u-m-t-16 u-flex u-col-center"> <view class="u-m-t-16 u-flex u-col-center">
<view style="width: 356rpx"> <view style="width: 356rpx;">
<view class="font-bold" v-if="item.wareJson">{{ item.wareJson.wareName }}</view> <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="u-flex u-m-t-10 u-col-center ">
<view class="price"> <view class="price">
<text class="u-font-30">¥</text> <text class="u-font-30">¥</text>
@@ -44,10 +48,13 @@
</view> </view>
</view> </view>
</view> </view>
<view class="u-p-l-16 color-333">数量{{ item.num }}</view> <view class="u-p-l-16 color-333">
数量{{item.num}}
</view> </view>
</view> </view>
</view> </view>
</view>
<view class="members"> <view class="members">
<view class="list"> <view class="list">
@@ -58,9 +65,11 @@
<view class="u-flex u-row-center absolute"> <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> </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> </view>
<view class="item" v-if="false"> <view class="item" v-if="false">
@@ -74,15 +83,20 @@
<view class="u-line-1 u-m-t-16 color-000 text-center">等待参团</view> <view class="u-line-1 u-m-t-16 color-000 text-center">等待参团</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="order"> <view class="order">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view> <view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline"> <view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;">
<text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text> <text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showOrder}"> <view class="guodu" :class="{rotate:!showOrder}">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
@@ -108,9 +122,11 @@
<view class="">{{item.payTime}}</view> <view class="">{{item.payTime}}</view>
</view> </view>
</view> </view>
</view> </view>
<view style="height: 100px"></view>
<view style="height: 100px;"></view>
<view class="btns"> <view class="btns">
<view class="btn" @click="toPinIndex">继续拼团</view> <view class="btn" @click="toPinIndex">继续拼团</view>
<button class="btn main" @click="toOrderDetail(item)">查看订单</button> <button class="btn main" @click="toOrderDetail(item)">查看订单</button>
@@ -120,16 +136,10 @@
<template v-if="item.status=='待成团'"> <template v-if="item.status=='待成团'">
<view class="min-page bg-f7 color-333 u-font-28 relative"> <view class="min-page bg-f7 color-333 u-font-28 relative">
<view class="top" :style="topStyle"> <view class="top" :style="topStyle">
<up-navbar <up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="支付成功"
bg-color="transparent" left-icon-color="#fff" @leftClick="uni.navigateBack()" title-color="#fff"></up-navbar>
:fixed="false" <view class="u-flex info u-col-center">
:placeholder="false" </view>
title="支付成功"
left-icon-color="#fff"
@leftClick="uni.navigateBack()"
title-color="#fff"
></up-navbar>
<view class="u-flex info u-col-center"></view>
</view> </view>
<view class="bottom bottom1"> <view class="bottom bottom1">
<view class="time" v-if="item.status=='待成团'"> <view class="time" v-if="item.status=='待成团'">
@@ -151,10 +161,12 @@
<text class="">{{item.groupPeopleNum}}人团</text> <text class="">{{item.groupPeopleNum}}人团</text>
</view> </view>
<statusVue :status="item.status"></statusVue> <statusVue :status="item.status"></statusVue>
</view> </view>
<view class="u-m-t-16 u-flex u-col-center u-row-between"> <view class="u-m-t-16 u-flex u-col-center u-row-between">
<view style="max-width: 356rpx"> <view style="max-width: 356rpx;">
<view class="font-bold u-line-1" v-if="item.wareJson">{{ item.wareJson.wareName }}</view> <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="u-flex u-m-t-10 u-col-center ">
<view class="price"> <view class="price">
<text class="u-font-30">¥</text> <text class="u-font-30">¥</text>
@@ -166,7 +178,9 @@
</view> </view>
</view> </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>
</view> </view>
@@ -174,11 +188,11 @@
<view class="shop-box"> <view class="shop-box">
<view class="shop "> <view class="shop ">
<view class="u-flex"> <view class="u-flex">
<text style="min-width: 180rpx" class="color-666">可核销门店</text> <text style="min-width: 180rpx;" class="color-666">可核销门店</text>
<text>{{item.shopName}}</text> <text>{{item.shopName}}</text>
</view> </view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx" class="color-666">门店地址</text> <text style="min-width: 180rpx;" class="color-666">门店地址</text>
<text>{{item.shopAddress}}</text> <text>{{item.shopAddress}}</text>
</view> </view>
</view> </view>
@@ -193,9 +207,11 @@
<view class="u-flex u-row-center absolute"> <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> </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> </view>
<view class="item"> <view class="item">
@@ -211,9 +227,9 @@
</view> </view>
</view> </view>
<view class="u-flex u-row-center" v-if="item.status=='待成团'"> <view class="u-flex u-row-center" v-if="item.status=='待成团'">
<view class="pin-btn"> <view class="pin-btn">邀请好友参团
邀请好友参团
<button open-type="share" class="share">邀请好友参团</button> <button open-type="share" class="share">邀请好友参团</button>
</view> </view>
</view> </view>
</view> </view>
@@ -222,7 +238,7 @@
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view> <view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline"> <view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;">
<text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text> <text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showOrder}"> <view class="guodu" :class="{rotate:!showOrder}">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
@@ -248,23 +264,19 @@
<view class="">{{item.payTime}}</view> <view class="">{{item.payTime}}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </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="min-page bg-f7 color-333 u-font-28 relative">
<view class="top" :style="topStyle"> <view class="top" :style="topStyle">
<up-navbar <up-navbar bg-color="transparent" :fixed="false" :placeholder="false" title="订单详情"
bg-color="transparent" left-icon-color="#fff" @leftClick="uni.navigateBack()" title-color="#fff"></up-navbar>
:fixed="false" <view class="u-flex info u-col-center">
:placeholder="false" </view>
title="订单详情"
left-icon-color="#fff"
@leftClick="uni.navigateBack()"
title-color="#fff"
></up-navbar>
<view class="u-flex info u-col-center"></view>
</view> </view>
<view class="bottom bottom1"> <view class="bottom bottom1">
<view class="time" v-if="item.status=='待成团'"> <view class="time" v-if="item.status=='待成团'">
@@ -277,7 +289,7 @@
<text class="number">{{returnNum(2)}}</text> <text class="number">{{returnNum(2)}}</text>
</view> </view>
</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> <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 u-col-center u-row-between">
@@ -286,10 +298,12 @@
<text class="">{{item.groupPeopleNum}}人团</text> <text class="">{{item.groupPeopleNum}}人团</text>
</view> </view>
<statusVue :status="item.status"></statusVue> <statusVue :status="item.status"></statusVue>
</view> </view>
<view class="u-m-t-16 u-flex u-col-center u-row-between"> <view class="u-m-t-16 u-flex u-col-center u-row-between">
<view style="max-width: 356rpx"> <view style="max-width: 356rpx;">
<view class="font-bold u-line-1" v-if="item.wareJson">{{ item.wareJson.wareName }}</view> <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="u-flex u-m-t-10 u-col-center ">
<view class="price"> <view class="price">
<text class="u-font-30">¥</text> <text class="u-font-30">¥</text>
@@ -301,7 +315,9 @@
</view> </view>
</view> </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>
</view> </view>
@@ -309,21 +325,23 @@
<view class="shop-box"> <view class="shop-box">
<view class="shop "> <view class="shop ">
<view class="u-flex"> <view class="u-flex">
<text style="min-width: 180rpx" class="color-666">可核销门店</text> <text style="min-width: 180rpx;" class="color-666">可核销门店</text>
<text>{{item.shopName}}</text> <text>{{item.shopName}}</text>
</view> </view>
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<text style="min-width: 180rpx" class="color-666">门店地址</text> <text style="min-width: 180rpx;" class="color-666">门店地址</text>
<text>{{item.shopAddress}}</text> <text>{{item.shopAddress}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="order"> <view class="order">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="font-bold u-font-32">订单信息</view> <view class="font-bold u-font-32">订单信息</view>
<view class="u-flex color-666" @click="showOrder = !showOrder" style="align-items: baseline"> <view class="u-flex color-666" @click="showOrder=!showOrder" style="align-items: baseline;">
<text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text> <text class="u-m-r-18">{{showOrder?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showOrder}"> <view class="guodu" :class="{rotate:!showOrder}">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
@@ -349,58 +367,70 @@
<view class="">{{item.payTime}}</view> <view class="">{{item.payTime}}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view>
</template>
</view> </view>
</template> </template>
</view>
</template>
<script setup> <script setup>
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js'; import statusVue from '@/groupBuying/components/status.vue'
import statusVue from '@/groupBuying/components/status.vue'; import * as Api from '@/common/api/order/gbOrder.js'
import * as Api from '@/common/api/order/gbOrder.js'; import {
import { wxShare } from '@/utils/share.js'; wxShare
import { computed, reactive } from 'vue'; } from '@/utils/share.js'
import { getRemainingHMS } from '@/utils/countdown.js'; import {
computed,
reactive
} from 'vue'
import {
getRemainingHMS
} from '@/utils/countdown.js'
function toPinIndex() { function toPinIndex() {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/index/index' url: '/groupBuying/index/index'
}); })
} }
const imgs = { const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/d21f2dfd7bec44618f2d5e4b88372b08.png', 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', 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' success: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6a75acd0c0db4bfe9937854b2b2df3f0.png'
}; }
const topStyle = { const topStyle = {
backgroundImage: 'url(' + imgs.bg + ')' backgroundImage: 'url(' + imgs.bg + ')'
}; }
const showOrder = ref(true); const showOrder = ref(true)
function copyText(text) { function copyText(text) {
uni.setClipboardData({ uni.setClipboardData({
data: text, data: text,
success() {} success() {}
}); })
} }
const query = reactive({ const query = reactive({
shopId: '', shopId: '',
detailId: '' detailId: '',
}); })
function init(opt) { function init(opt) {
console.log(opt); console.log(opt)
Object.assign(query, opt); Object.assign(query, opt)
getDetail(); getDetail()
} }
const item = reactive({}); const item = reactive({})
function getDetail() { function getDetail() {
try { try {
Api.recordDetail(query).then((res) => { Api.recordDetail(query).then(res => {
if (!res) { if (!res) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -409,43 +439,45 @@ function getDetail() {
success(res) { success(res) {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/index/index' url: '/groupBuying/index/index'
}); })
} }
});
return; })
return
} }
console.log(res, 'res'); console.log(res, 'res')
const wareJson = JSON.parse(res.wareJson); const wareJson = JSON.parse(res.wareJson)
wareJson.wareImgs = wareJson.wareImgs.split(',').filter((v) => v); wareJson.wareImgs = wareJson.wareImgs.split(',').filter(v => v)
res.wareJson = wareJson; res.wareJson = wareJson;
res.goodsImg = wareJson.wareImgs[0]; res.goodsImg = wareJson.wareImgs[0];
Object.assign(item, res); Object.assign(item, res)
console.log('item', item); console.log('item', item)
}); })
} catch (err) { } 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());
}
onLoad(init)
let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => { timer = setInterval(() => {
nowTime.value = Date.now(); nowTime.value = Date.now()
}, 1000); }, 1000)
const returnTime = computed(() => { const returnTime = computed(() => {
nowTime.value; nowTime.value
return getRemainingHMS(item); return getRemainingHMS(item)
}); })
function returnNum(index) { function returnNum(index) {
return returnTime.value.split(':')[index]; return returnTime.value.split(':')[index]
} }
function refund(item) { function refund(item) {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -455,48 +487,39 @@ function refund(item) {
if (res.confirm) { if (res.confirm) {
Api.applyRefund({ Api.applyRefund({
recordId: item.id, recordId: item.id,
orderNo: item.orderNo orderNo: item.orderNo,
}).then((res) => { }).then(res => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '申请成功' title: '申请成功'
}); })
setTimeout(() => { setTimeout(() => {
getDetail(); getDetail()
}, 1000); }, 1000)
} }
}); })
} }
} }
}); })
} }
onShareAppMessage(async (res) => { onShareAppMessage(() => {
let query = await returnQuery(); console.log('onShareAppMessage')
return { console.log(item)
const query = `groupOrderNo=${item.groupOrderNo}&shopId=${item.shopId}`
return wxShare({
title: item.wareJson.wareName, title: item.wareJson.wareName,
imageUrl: item.goodsImg, imageUrl: item.goodsImg,
path: '/groupBuying/detail/index' + '?' + query, 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({ uni.navigateTo({
url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId url: '/groupBuying/detail/index?detailId=' + item.id + '&shopId=' + item.shopId
}); })
} }
</script> </script>
@@ -511,6 +534,8 @@ function toOrderDetail(item) {
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
} }
} }
.bottom { .bottom {
@@ -519,7 +544,7 @@ function toOrderDetail(item) {
.time { .time {
padding: 18rpx 24rpx; padding: 18rpx 24rpx;
background: #fff4e2; background: #FFF4E2;
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 16rpx 16rpx 0 0; border-radius: 16rpx 16rpx 0 0;
@@ -527,7 +552,7 @@ function toOrderDetail(item) {
.number { .number {
padding: 6rpx; padding: 6rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #ed5a2e; background: #ED5A2E;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
margin-left: 18rpx; margin-left: 18rpx;
@@ -553,7 +578,7 @@ function toOrderDetail(item) {
.tuan-members { .tuan-members {
padding: 0 16rpx 0 0; padding: 0 16rpx 0 0;
border-radius: 0 6rpx 6rpx 0; border-radius: 0 6rpx 6rpx 0;
background: #4c2828; background: #4C2828;
color: #f5d9ad; color: #f5d9ad;
font-weight: 700; font-weight: 700;
} }
@@ -586,7 +611,7 @@ function toOrderDetail(item) {
.shop { .shop {
border-radius: 8rpx; border-radius: 8rpx;
background: #f8f8f8; background: #F8F8F8;
padding: 16rpx 34rpx; padding: 16rpx 34rpx;
} }
@@ -612,7 +637,7 @@ function toOrderDetail(item) {
.add-box { .add-box {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border: 2rpx dashed #d9d9d9; border: 2rpx dashed #D9D9D9;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@@ -651,12 +676,14 @@ function toOrderDetail(item) {
.tuanzhang { .tuanzhang {
padding: 8rpx 18rpx; padding: 8rpx 18rpx;
border-radius: 20rpx; border-radius: 20rpx;
background: #ed5a2e; background: #ED5A2E;
color: #fff; color: #fff;
bottom: 0; bottom: 0;
} }
} }
} }
} }
.btns { .btns {
@@ -677,19 +704,19 @@ function toOrderDetail(item) {
line-height: 1; line-height: 1;
margin: 0; margin: 0;
justify-content: center; justify-content: center;
border: 2rpx solid #e8ad7b; border: 2rpx solid #E8AD7B;
background: #fff; background: #FFF;
color: #e8ad7b; color: #E8AD7B;
&.main { &.main {
background-color: #e8ad7b; background-color: #E8AD7B;
color: #fff; color: #fff;
} }
} }
} }
.guodu { .guodu {
transition: all 0.3s; transition: all .3s;
} }
.pin-btn { .pin-btn {
@@ -698,8 +725,8 @@ function toOrderDetail(item) {
text-align: center; text-align: center;
font-size: 32rpx; font-size: 32rpx;
justify-content: center; justify-content: center;
border: 2rpx solid #e8ad7b; border: 2rpx solid #E8AD7B;
background: #e8ad7b; background: #E8AD7B;
color: #fff; color: #fff;
position: relative; position: relative;
@@ -731,7 +758,7 @@ function toOrderDetail(item) {
.refund { .refund {
padding: 18rpx 164rpx; padding: 18rpx 164rpx;
border-radius: 0 0 16rpx 16rpx; border-radius: 0 0 16rpx 16rpx;
background: #fff4e2; background: #FFF4E2;
font-weight: 700; font-weight: 700;
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
@@ -753,7 +780,7 @@ function toOrderDetail(item) {
.time { .time {
padding: 18rpx 24rpx; padding: 18rpx 24rpx;
background: #fff4e2; background: #FFF4E2;
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 16rpx 16rpx 0 0; border-radius: 16rpx 16rpx 0 0;
@@ -761,7 +788,7 @@ function toOrderDetail(item) {
.number { .number {
padding: 6rpx; padding: 6rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #ed5a2e; background: #ED5A2E;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 32rpx;
margin-left: 18rpx; margin-left: 18rpx;
@@ -787,7 +814,7 @@ function toOrderDetail(item) {
.tuan-members { .tuan-members {
padding: 0 16rpx 0 0; padding: 0 16rpx 0 0;
border-radius: 0 6rpx 6rpx 0; border-radius: 0 6rpx 6rpx 0;
background: #4c2828; background: #4C2828;
color: #f5d9ad; color: #f5d9ad;
font-weight: 700; font-weight: 700;
} }
@@ -819,7 +846,7 @@ function toOrderDetail(item) {
.shop { .shop {
border-radius: 8rpx; border-radius: 8rpx;
background: #f8f8f8; background: #F8F8F8;
padding: 16rpx 34rpx; padding: 16rpx 34rpx;
} }
@@ -842,10 +869,11 @@ function toOrderDetail(item) {
width: calc(100% / 3); width: calc(100% / 3);
display: flex; display: flex;
.add-box { .add-box {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border: 2rpx dashed #d9d9d9; border: 2rpx dashed #D9D9D9;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@@ -884,7 +912,7 @@ function toOrderDetail(item) {
.tuanzhang { .tuanzhang {
padding: 8rpx 18rpx; padding: 8rpx 18rpx;
border-radius: 20rpx; border-radius: 20rpx;
background: #ed5a2e; background: #ED5A2E;
color: #fff; color: #fff;
bottom: 0; bottom: 0;
} }

View File

@@ -7,7 +7,7 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"pinia": "^2.3.1", "pinia": "^2.3.1",
"pinia-plugin-unistorage": "^0.1.2", "pinia-plugin-unistorage": "^0.1.2",
"ysk-utils": "^1.0.83" "ysk-utils": "^1.0.85"
}, },
"devDependencies": { "devDependencies": {
"unplugin-auto-import": "^0.16.7" "unplugin-auto-import": "^0.16.7"

View File

@@ -2,7 +2,6 @@
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "custom": {
"^ymf-(.*)": "@/components/ymf-components/ymf-$1.vue",
"^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue", "^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue", "^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue" "^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"

View File

@@ -5,8 +5,7 @@
<!-- 轮播图 --> <!-- 轮播图 -->
<swipers :carousel="hometoplist.bannerList"></swipers> <swipers :carousel="hometoplist.bannerList"></swipers>
<!-- 广告 --> <!-- 广告 -->
<advertisement :bannervo="hometoplist.freeBannerList" :itemStyle="advertisementStyle" ref="refbannervo"> <advertisement :bannervo="hometoplist.freeBannerList" :itemStyle="advertisementStyle" ref="refbannervo"></advertisement>
</advertisement>
<!-- 金刚区 --> <!-- 金刚区 -->
<diamond :district="hometoplist.district"></diamond> <diamond :district="hometoplist.district"></diamond>
<!-- 今日上线 --> <!-- 今日上线 -->
@@ -130,33 +129,15 @@
<!-- <CouponModal></CouponModal> --> <!-- <CouponModal></CouponModal> -->
<!-- 页面加载动画 --> <!-- 页面加载动画 -->
<pageLoading v-if="showPageLoading" /> <pageLoading v-if="showPageLoading" />
</view> </view>
</template> </template>
<script setup> <script setup>
import CouponModal from '@/components/coupon-modal.vue'; import CouponModal from '@/components/coupon-modal.vue';
import { import { ref, computed, onMounted, reactive, onBeforeUnmount, watch, getCurrentInstance, nextTick } from 'vue';
ref, import { onLoad, onReady, onShow, onReachBottom, onPageScroll } from '@dcloudio/uni-app';
computed,
onMounted,
reactive,
onBeforeUnmount,
watch,
getCurrentInstance,
nextTick
} from 'vue';
import {
onLoad,
onReady,
onShow,
onReachBottom,
onPageScroll
} from '@dcloudio/uni-app';
// 获取全局属性 // 获取全局属性
const { const { proxy } = getCurrentInstance();
proxy
} = getCurrentInstance();
import pageLoading from './components/pageLoading.vue'; import pageLoading from './components/pageLoading.vue';
import swipers from './components/swiper.vue'; //引入轮播 import swipers from './components/swiper.vue'; //引入轮播
import advertisement from './components/advertisement.vue'; //广告 import advertisement from './components/advertisement.vue'; //广告
@@ -166,22 +147,11 @@
import AreaSelect from './components/AreaSelect.vue'; //城市联动 import AreaSelect from './components/AreaSelect.vue'; //城市联动
import grouping from './components/grouping.vue'; //其他 import grouping from './components/grouping.vue'; //其他
import Nav from '@/components/indexnav.vue'; //导航栏 import Nav from '@/components/indexnav.vue'; //导航栏
import { import { APIhomehomePageUp, APIhome } from '@/common/api/index/index.js';
APIhomehomePageUp, import { APIgeocodelocation } from '@/common/api/api.js';
APIhome import { useNavbarStore } from '@/stores/navbarStore';
} from '@/common/api/index/index.js'; import { productStore } from '@/stores/user.js';
import { import { getUnReadCountReq } from '../../common/api/account/message';
APIgeocodelocation
} from '@/common/api/api.js';
import {
useNavbarStore
} from '@/stores/navbarStore';
import {
productStore
} from '@/stores/user.js';
import {
getUnReadCountReq
} from '../../common/api/account/message';
const store = useNavbarStore(); const store = useNavbarStore();
const storeuser = productStore(); const storeuser = productStore();
store.updateNavbarConfig({ store.updateNavbarConfig({
@@ -346,8 +316,7 @@
} }
// 是否有弹出层 // 是否有弹出层
if (item.isChild) { if (item.isChild) {
showproductlist.value = showproductlist.value ? (viewHistoryindex.value == index ? false : true) : ! showproductlist.value = showproductlist.value ? (viewHistoryindex.value == index ? false : true) : !showproductlist.value;
showproductlist.value;
} }
viewHistoryindex.value = index; viewHistoryindex.value = index;
}; };
@@ -358,35 +327,18 @@
}); });
const indexsRef = ref(null); const indexsRef = ref(null);
const shopId = ref(null)
const shopInfo = ref(null)
onShow(async () => { onShow(async () => {
if (!storeuser.isHasLogin) {
await handleMixinOnLoad(options)
console.log('shopInfo', uni.cache.get('shopInfo'));
console.log('【页面】开始处理自身业务逻辑');
onPageShow()
} else {
onPageShow()
}
setTimeout(() => {
showPageLoading.value = false;
getUnReadMsgCount();
}, 800);
});
async function onPageShow() {
try { try {
await storeuser.getLocation(); await storeuser.getLocation();
proxy.$isResolve(); proxy.$isResolve();
shopId.value = uni.cache.get('shopId'); const shopId = uni.cache.get('shopId');
if (shopId.value) { if (shopId) {
indexsRef.value.updateData(); indexsRef.value.updateData();
} }
} catch (error) {} } catch (error) {}
await proxy.$onLaunched; await proxy.$onLaunched;
if (shopId.value) { if (uni.cache.get('shopId')) {
showindex.value = 'shopIndex'; showindex.value = 'shopIndex';
await storeuser.actionsproductqueryProduct(); await storeuser.actionsproductqueryProduct();
await nextTick(); await nextTick();
@@ -397,9 +349,7 @@
init_fn(); init_fn();
// 获取初始定位高度 // 获取初始定位高度
} }
});
shopInfo.value = uni.cache.get('shopInfo');
}
const showPageLoading = ref(true); const showPageLoading = ref(true);
@@ -419,52 +369,18 @@
} }
} }
onMounted(async () => {
setTimeout(() => {
showPageLoading.value = false;
getUnReadMsgCount();
}, 800);
});
onReachBottom(() => { onReachBottom(() => {
onLoadhome(); onLoadhome();
}); });
import {
shareMixin,
handleMixinOnLoad
} from '@/utils/share.js'
watch(() => shopId.value, (newval) => {
if (newval) {
uni.showShareMenu({
withShareTicket: true, // 可选:是否返回分享票据
menus: ['shareAppMessage', 'shareTimeline'] // 显示「分享好友」和「分享朋友圈」
});
} else {
uni.hideShareMenu();
}
}, {
immediate: true
})
defineOptions({
mixins: [shareMixin],
});
const options = reactive({})
onLoad(async (opt) => {
Object.assign(options, opt)
// await handleMixinOnLoad(options)
// console.log('shopInfo', uni.cache.get('shopInfo'));
// console.log('【页面】开始处理自身业务逻辑');
// setTimeout(() => {
// showPageLoading.value = false;
// getUnReadMsgCount();
// }, 800);
})
// 页面离开时清除定时器 // 页面离开时清除定时器
// onBeforeUnmount(() => { // onBeforeUnmount(() => {
// if (refbannervo.value) { // if (refbannervo.value) {

View File

@@ -2,11 +2,9 @@
<view class="content min-page bg-f7"> <view class="content min-page bg-f7">
<view class="contentbox"> <view class="contentbox">
<template v-if="shopExtend.length"> <template v-if="shopExtend.length">
<image class="bg" :src="shopExtend[0].value" mode="aspectFill" <image class="bg" :src="shopExtend[0].value" mode="aspectFill" v-if="!isJsonArrayString(shopExtend[0].value)"></image>
v-if="!isJsonArrayString(shopExtend[0].value)"></image>
<swiper class="swiper" autoplay circular v-else> <swiper class="swiper" autoplay circular v-else>
<swiper-item class="swiper-item" v-for="(item, index) in JSON.parse(shopExtend[0].value)" <swiper-item class="swiper-item" v-for="(item, index) in JSON.parse(shopExtend[0].value)" :key="index">
:key="index">
<image class="swiper-bg" :src="item"></image> <image class="swiper-bg" :src="item"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
@@ -90,7 +88,7 @@
</view> </view>
<view class="item" @click="toFenxiao"> <view class="item" @click="toFenxiao">
<image :src="imgs.share" class="img"></image> <image :src="imgs.share" class="img"></image>
<view class="title">全民股东</view> <view class="title">股东共享</view>
<view class="desc">邀请好友获得佣金</view> <view class="desc">邀请好友获得佣金</view>
</view> </view>
</view> </view>
@@ -116,30 +114,15 @@
</u-popup> </u-popup>
<!-- 私域引流弹窗 --> <!-- 私域引流弹窗 -->
<attractPopup type="home" ref="attractPopupRef" /> <attractPopup type="home" ref="attractPopupRef" />
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import attractPopup from '@/components/attract-popup.vue'; import attractPopup from '@/components/attract-popup.vue';
import { import { homeData } from '@/common/api/market/index.js';
homeData import { getMemberConfig, getRechargeConfig } from '@/common/api/index/index.js';
} from '@/common/api/market/index.js'; import { ref, reactive, defineProps, defineEmits, onMounted } from 'vue';
import { import { isJsonArrayString } from '@/utils/util.js';
getMemberConfig,
getRechargeConfig
} from '@/common/api/index/index.js';
import {
ref,
reactive,
defineProps,
defineEmits,
onMounted
} from 'vue';
import {
isJsonArrayString
} from '@/utils/util.js';
const attractPopupRef = ref(null); const attractPopupRef = ref(null);
@@ -182,12 +165,8 @@
}); });
} }
import { import { productStore } from '@/stores/user.js';
productStore import { onShow } from '@dcloudio/uni-app';
} from '@/stores/user.js';
import {
onShow
} from '@dcloudio/uni-app';
// 显示弹窗 // 显示弹窗
const popupShow = ref(false); const popupShow = ref(false);
@@ -316,9 +295,6 @@
defineExpose({ defineExpose({
updateData updateData
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -547,7 +523,8 @@
background: #ededed; background: #ededed;
} }
.takeout {} .takeout {
}
} }
&.layout1 { &.layout1 {

View File

@@ -70,7 +70,7 @@
v-else-if="item1.isTemporary &&item1.productName=='签子'" v-else-if="item1.isTemporary &&item1.productName=='签子'"
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png" src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"
></u-image> ></u-image>
<u-image width="56" height="56" radius="10" <u-image width="112" height="112" radius="20"
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
mode="heightFix" v-else></u-image> mode="heightFix" v-else></u-image>
<text class="productName"> {{ item1.productName }} </text> <text class="productName"> {{ item1.productName }} </text>
@@ -151,7 +151,7 @@
uni.cache.set("shopId", item.shopId); uni.cache.set("shopId", item.shopId);
uni.navigateTo({ uni.navigateTo({
url: "/pages/product/index?type=beforehand&order_id=" + item.id + url: "/pages/product/index?type=beforehand&order_id=" + item.id +
'&one_more_order=1&shopId='+item.shopId, '&one_more_order=1',
}); });
} }
}) })

View File

@@ -13,10 +13,8 @@
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px" <up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])"> height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
</up-swiper> </up-swiper>
<view class="shop_sku_name u-flex u-row-between">
<view class="u-line-1" style="max-width: 600rpx;">{{ goods.name }}</view> <view class="shop_sku_name">{{ goods.name }}</view>
<ymfShare @shareClick="shareClick" />
</view>
<view class="shop_sku_description" v-if="isSkuGoods"> <view class="shop_sku_description" v-if="isSkuGoods">
{{ goods.shortTitle ? goods.shortTitle : '' }} {{ goods.shortTitle ? goods.shortTitle : '' }}
</view> </view>
@@ -192,7 +190,7 @@
<view class="shop_bottom" style="position: absolute;bottom: 0;z-index:100;"> <view class="shop_bottom" style="position: absolute;bottom: 0;">
<view class="flex-between"> <view class="flex-between">
<view class="price price-sku" v-if="goods.type != 'package' && goods.result"> <view class="price price-sku" v-if="goods.type != 'package' && goods.result">
<text class="i"></text> <text class="i"></text>
@@ -310,7 +308,6 @@
import { import {
useNavbarStore useNavbarStore
} from '@/stores/navbarStore'; } from '@/stores/navbarStore';
import ymfShare from '@/components/ymf-components/ymf-share.vue'
const store = useNavbarStore(); const store = useNavbarStore();
const { const {
showBack, showBack,
@@ -482,11 +479,11 @@
const swiperCurrent = ref(0); const swiperCurrent = ref(0);
function returnFirstSku(product) { function returnFirstSku(product) {
console.log('returnFirstSku', product); console.log('returnFirstSku', product.skuList[0]);
return { return {
...product.skuList[0]||'', ...product.skuList[0],
sku_id: product.skuList[0].id||'', sku_id: product.skuList[0].id,
id: product.id||'', id: product.id,
} }
} }
//返回是否是多规格商品 //返回是否是多规格商品
@@ -506,10 +503,8 @@
swiperCurrent.value = e.current; swiperCurrent.value = e.current;
} }
const emits = defineEmits(['prveImgs', 'websocketsendMessage', 'close', 'modalAdd','shareClick']) const emits = defineEmits(['prveImgs', 'websocketsendMessage', 'close', 'modalAdd'])
function shareClick(){
emits('shareClick',props.goods)
}
function prveImgs(images, currentUrl) { function prveImgs(images, currentUrl) {
emits('prveImgs', images, currentUrl) emits('prveImgs', images, currentUrl)
} }
@@ -836,7 +831,7 @@
padding: 0 28rpx; padding: 0 28rpx;
margin-top: 20rpx; margin-top: 20rpx;
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32upx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
} }

View File

@@ -192,29 +192,6 @@
</scroll-view> </scroll-view>
</view> </view>
<view class="main"> <view class="main">
<view class="u-p-r-32">
<up-swiper indicator indicatorMode="line" height="188rpx" :list="carouselList"
keyName="imageUrl">
<template #default="scope">
<view class="relative">
<image :src="scope.item.imageUrl" mode="aspectFill"
style="width:600rpx;height: 188rpx;"></image>
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
<view class="share-btn-box" v-if="showShare(scope.item)">
<ymf-share
@shareClick="shareBtnClick(scope.item)"
>
<view class="share-btn">分享</view>
</ymf-share>
</view>
</view>
</view>
</template>
</up-swiper>
</view>
<view> <view>
<view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index" <view class="item main-item" v-for="(item, index) in shopProductList.productInfo" :key="index"
:id="'item-' + index"> :id="'item-' + index">
@@ -597,10 +574,14 @@
<ModalList></ModalList> <ModalList></ModalList>
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal> <recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
<view v-for="(item,index) in goodsModalList" :key="index"> <view
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" v-for="(item,index) in goodsModalList" :key="index"
@shareClick="shareClick" @close="goodsModalClose(index)" @websocketsendMessage="websocketsendMessage" >
@modalAdd="modalAdd" :GoodsIDInCartNumMap="GoodsIDInCartNumMap"></goodsModal> <goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" @close="goodsModalClose(index)"
@websocketsendMessage="websocketsendMessage"
@modalAdd="modalAdd"
:GoodsIDInCartNumMap="GoodsIDInCartNumMap"
></goodsModal>
</view> </view>
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg"> <xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
@@ -639,8 +620,6 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
@@ -674,11 +653,6 @@
import { import {
APIproductqueryShop APIproductqueryShop
} from '@/common/api/member.js'; } from '@/common/api/member.js';
import {
carousel
} from '@/common/api/market/share.js'
/** /**
* api合集 end * api合集 end
*/ */
@@ -775,9 +749,7 @@
useCartStore useCartStore
} from '@/stores/order.js'; } from '@/stores/order.js';
import { import {
computed, computed, provide
provide,
reactive
} from 'vue'; } from 'vue';
const cartStore = useCartStore(); const cartStore = useCartStore();
/** /**
@@ -847,7 +819,11 @@
const shopExtend = ref(''); // 分步取值 + 每层兜底,避免某一环不存在导致 undefined
const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
// 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
/** /**
* 通用数据合集 end * 通用数据合集 end
@@ -1020,79 +996,6 @@
uni.$u.debounce(mainScroll(res), 500); uni.$u.debounce(mainScroll(res), 500);
}); });
/*商品区域轮播图 start*/
const shareSwiperItem=ref(null)
function swiperClick(item) {
console.log('swiperClick',item);
shareSwiperItem.value=item
const pTag=returnPageTags(item.jumpPagePath)
if(pTag==='pp-list'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='pp-detail'){
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
return uni.navigateTo({
url:url.replace('goodsId','id')
})
}
if(pTag==='gb-list'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='gb-detail'){
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
return uni.navigateTo({
url:url.replace('goodsId','wareId')
})
}
if(pTag==='dis'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='index'){
return uni.switchTab({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='eat'){
if (item.extendParam) {
const id=item.extendParam.split('=')[1]
const item = allGoodsArr.value.find(v => v.id == id)
if (item) {
clickspecifications(item)
}
}
}
if(pTag==='point'){
return uni.navigateTo({
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
})
}
if(pTag==='point-detail'){
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
return uni.navigateTo({
url:url.replace('goodsId','id')
})
}
}
function showShare(item){
if(item.isShareable&&item.isEnabled){
return true
}
return false
}
/*商品区域轮播图 end*/
// 点击详情 // 点击详情
const showShopsku = ref(false); const showShopsku = ref(false);
@@ -1472,7 +1375,6 @@
function goodsModalClose(index){ function goodsModalClose(index){
goodsModalList.value.splice(index,1) goodsModalList.value.splice(index,1)
} }
function modalAdd(item){ function modalAdd(item){
clickspecifications(item) clickspecifications(item)
} }
@@ -1543,19 +1445,11 @@
// showShopsku.value = true; // showShopsku.value = true;
goodsModalList.value.push({ goodsModalList.value.push({
show:true, show:true,
goods: { goods:specifications.item
...specifications.item,
/*过滤掉只有一个规格且下架的商品或者skuList为空的商品*/
relatedRecommendJson: (specifications.item.relatedRecommendJson || []).filter(v => v
.skuList && v.skuList.length)
}
}) })
}; };
// 判断商品是否在可售时间内 // 判断商品是否在可售时间内
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => { const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
if(!sellDaysStr){
return false
}
// 将后端返回的字符串转换为数组 // 将后端返回的字符串转换为数组
const sellDays = sellDaysStr.split(','); const sellDays = sellDaysStr.split(',');
const now = dayjs(); const now = dayjs();
@@ -1867,11 +1761,8 @@
if (Message.operate_type == 'init') { if (Message.operate_type == 'init') {
// cartStore.limitTimeDiscount = Message.time_dis_info; // cartStore.limitTimeDiscount = Message.time_dis_info;
cartInit(Message.data) cartInit(Message.data)
try {
uni.hideLoading(); uni.hideLoading();
} catch (error) {
//TODO handle the exception
}
isLoading.value = false; isLoading.value = false;
if (!socketInitFinished) { if (!socketInitFinished) {
@@ -2365,16 +2256,6 @@
}, 1000); }, 1000);
return false; return false;
} }
if (pageOptions.showGoodsId) {
const item = allGoodsArr.value.find(v => v.id == pageOptions.showGoodsId)
if (item) {
clickspecifications(item)
}
pageOptions.showGoodsId = null
}
}; };
provide('cartStore', cartStore); provide('cartStore', cartStore);
@@ -2556,130 +2437,28 @@
}); });
} }
import {
shareMixin,
handleMixinOnLoad,
returnQuery,
jsonToUrl,
wxShare,returnPageTags,
returnCommonQuery
} from '@/utils/share.js'
// defineOptions({
// mixins: [shareMixin],
// });
let isGoodsShare = ref(false)
function shareClick() {
isGoodsShare.value = true
}
function getPage(pageStr){
}
function shareBtnClick(item){
console.log('shareBtnClick',item);
shareSwiperItem.value=item
}
function swiperShare(queryJson){
console.log('shareSwiperItem',shareSwiperItem.value);
const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath)
let query = jsonToUrl(queryJson)
query +=('&'+shareSwiperItem.value.extendParam)
const shopName = uni.cache.get('shopInfo').shopName || ''
const path=shareSwiperItem.value.jumpPagePath?shareSwiperItem.value.jumpPagePath:'/pages/product/index?type=beforehand'
console.log('path',path);
const json={
imageUrl:shareSwiperItem.value.imageUrl,
path: path+'&'+query,
title:shareSwiperItem.value.name+ (shopName ? `-${shopName}` : ''),
}
if(pTag==='pp-detail'){
json.path=json.path.replace('goodsId','id')
}
if(pTag==='gb-detail'){
json.path=json.path.replace('goodsId','wareId')
}
if(pTag==='point-detail'){
json.path=json.path.replace('goodsId','id')
}
if(pTag.includes('eat')){
if(shareSwiperItem.value.extendParam){
json.path=json.path.replace('goodsId','showGoodsId')
}
}
return wxShare(json)
}
async function onShare() {
const queryJson = await returnCommonQuery()
if(shareSwiperItem.value){
return swiperShare(queryJson)
}
let query = jsonToUrl(queryJson)
query += '&type=beforehand'
let json = {}
const shopName = uni.cache.get('shopInfo').shopName || ''
if (goodsModalList.value.length && isGoodsShare.value) {
const goods = goodsModalList.value[goodsModalList.value.length - 1].goods
query += '&showGoodsId=' + goods.id
json.title = goods.name + (shopName ? `-${shopName}` : '')
json.imageUrl = goods.coverImg
json.showGoodsId = goods.id
} else {
json.title = shopName
json.imageUrl = uni.cache.get('shopInfo').logo || ''
}
return wxShare({
query,
...json,
path: '/pages/product/index' + '?' + query
})
}
onShareAppMessage(onShare)
onShareTimeline(onShare)
const pageOptions = reactive({})
const carouselList = ref([])
onLoad(async (e) => { onLoad(async (e) => {
Object.assign(pageOptions, e)
if (e.type) { if (e.type) {
orderType.value = e.type; orderType.value = e.type;
} }
//获取用户信息
await handleMixinOnLoad({ const userInfo = await APIshopUserInfo({
...e, shopId: uni.cache.get('shopId')
shopId: e.shopId || uni.cache.get('shopId')
}) })
//获取店铺信息
if (userStore.shopUserInfo.shopExtendList) { const shopInfoRes = await APIusershopInfodetail({
shopExtend.value = userStore.shopUserInfo.shopExtendList.find(v => v.autoKey == 'shopinfo_bg') || shopId: uni.cache.get('shopId')
'' });
if (shopInfoRes && shopInfoRes.shopInfo) {
Object.assign(shopInfo, shopInfoRes.shopInfo);
uni.cache.set('shopInfo', shopInfoRes.shopInfo)
} }
// //获取用户信息
// const userInfo = await APIshopUserInfo({
// shopId: uni.cache.get('shopId')
// })
// //获取店铺信息
// const shopInfoRes = await APIusershopInfodetail({
// shopId: uni.cache.get('shopId')
// });
Object.assign(shopInfo, userStore.shopInfo);
if (e.type == 'beforehand') {
uni.cache.set("tableCode", userStore.shopUserInfo.id);
options.initMessage.table_code = userStore.shopUserInfo.id
}
options.initMessage.shop_id = userStore.shopInfo.id
shopUserInfo.value = userStore.shopUserInfo
if (userInfo && typeof userInfo === 'object') {
shopUserInfo.value = userInfo
uni.cache.set('shopUserInfo', userInfo)
}
await productqueryProduct(); await productqueryProduct();
const extraInitPar = {} const extraInitPar = {}
@@ -2691,11 +2470,6 @@
const time_dis_info = await getLimitDiscount() const time_dis_info = await getLimitDiscount()
options.initMessage.time_dis_info = time_dis_info options.initMessage.time_dis_info = time_dis_info
console.log('options.initMessage', {
...options.initMessage,
...extraInitPar,
})
useSocket.connect({ useSocket.connect({
...options.initMessage, ...options.initMessage,
...extraInitPar, ...extraInitPar,
@@ -2712,13 +2486,6 @@
// 满减活动 // 满减活动
getDiscountActivity(); getDiscountActivity();
//分享轮播
carousel({
shopId: uni.cache.get('shopId')
}).then(res => {
carouselList.value = res
})
let res = await APIhistoryOrder({ let res = await APIhistoryOrder({
tableCode: uni.cache.get('tableCode') tableCode: uni.cache.get('tableCode')
}); });
@@ -2823,8 +2590,6 @@
useSocket.setOnMessage(() => {}); useSocket.setOnMessage(() => {});
} }
onHide(() => { onHide(() => {
isGoodsShare.value = false
shareSwiperItem.value=null
closeSocket(); closeSocket();
}); });
onUnload(() => { onUnload(() => {
@@ -4065,26 +3830,4 @@
} }
} }
} }
.swiper-mask {
left: 0;
right: 0;
top: 0;
bottom: 0;
padding: 32rpx 28rpx;
}
.share-btn-box{
position: absolute;
right: 8rpx;
bottom: 14rpx;
}
.share-btn {
padding: 10rpx 32rpx;
border-radius: 50rpx;
background: #E3AD7F;
font-size: 24rpx;
color: #ffffff;
}
</style> </style>

View File

@@ -1,16 +1,23 @@
<!-- 充值中心 --> <!-- 充值中心 -->
<template> <template>
<view class="container"> <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"> <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-shop">
<view class="select-btn"> <view class="select-btn">
<up-icon name="map" color="#333"></up-icon> <up-icon name="map" color="#333"></up-icon>
<text class="t">{{ shopInfo.shopName }}</text> <text class="t">{{ shopInfo.shopName }}</text>
<up-icon name="arrow-right" color="#333"></up-icon> <up-icon name="arrow-right" color="#333"></up-icon>
</view> </view>
<ymf-share></ymf-share>
</view> </view>
<view class="balance-wrap"> <view class="balance-wrap">
<view class="left"> <view class="left">
@@ -30,7 +37,11 @@
<view class="bottom"> <view class="bottom">
<view class="u-flex u-flex-between"> <view class="u-flex u-flex-between">
<view class="u-flex"> <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> <text class="u-m-l-24 color-333 font-16 font-700">立即充值</text>
</view> </view>
<view class="font-12 color-999"> <view class="font-12 color-999">
@@ -39,12 +50,27 @@
</view> </view>
</view> </view>
<view class="list u-m-t-40"> <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=""> <view class="">
<text></text> <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>
<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></text> <text></text>
<text class="font-14">{{ item.rewardAmount }}</text> <text class="font-14">{{ item.rewardAmount }}</text>
@@ -58,7 +84,12 @@
<text></text> <text></text>
<text>{{ couponNum(item.couponInfoList) }}</text> <text>{{ couponNum(item.couponInfoList) }}</text>
<text>张券</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>
<view class="sel u-flex" v-if="sel == index"> <view class="sel u-flex" v-if="sel == index">
@@ -69,12 +100,24 @@
<template v-if="state.isCustom"> <template v-if="state.isCustom">
<view class="u-flex other flex-center"> <view class="u-flex other flex-center">
<text class="font-14 color-333 font-700 u-m-r-28">其他金额</text> <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>
<view class="color-999 font-12 u-m-t-4">自定义金额充值时不享受任何优惠赠送</view> <view class="color-999 font-12 u-m-t-4"
>自定义金额充值时不享受任何优惠赠送</view
>
</template> </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-16">{{ charge_money }}</text>
<text class="font-14 u-m-l-24">立即充值</text> <text class="font-14 u-m-l-24">立即充值</text>
</button> </button>
@@ -82,7 +125,9 @@
<view>充值说明</view> <view>充值说明</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<text>适用门店</text> <text>适用门店</text>
<text class="color2 u-m-l-28" @click="toShopList">全国门店通用 {{ '>' }}</text> <text class="color2 u-m-l-28" @click="toShopList"
>全国门店通用 {{ ">" }}
</text>
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<text>有效期限</text> <text>有效期限</text>
@@ -98,36 +143,37 @@
<view class="u-m-t-16 u-flex u-flex-y-center"> <view class="u-m-t-16 u-flex u-flex-y-center">
<text class="no-wrap">充值说明</text> <text class="no-wrap">充值说明</text>
<text class="u-m-l-28" style="word-break: break-all"> <text class="u-m-l-28" style="word-break: break-all">
{{ state.remark || '' }} {{ state.remark || "" }}
</text> </text>
</view> </view>
</view> </view>
</view> </view>
<CouponList v-model="couponModel.show" :list="couponModel.couponInfoList"></CouponList> <CouponList
v-model="couponModel.show"
:list="couponModel.couponInfoList"
></CouponList>
</view> </view>
</template> </template>
<script setup> <script setup>
import ymfShare from '@/components/ymf-components/ymf-share.vue'; import { APIusershopInfodetail, APIshopUserInfo } from "@/common/api/member.js";
import { shareMixin, handleMixinOnLoad, returnQuery } from '@/utils/share.js'; import CouponList from "@/components/coupon/list.vue";
import { APIusershopInfodetail, APIshopUserInfo } from '@/common/api/member.js'; import * as rechargeApi from "@/common/api/market/recharge.js";
import CouponList from '@/components/coupon/list.vue'; import { recharge } from "@/common/api/order/index.js";
import * as rechargeApi from '@/common/api/market/recharge.js'; import { joinMember } from "@/common/api/order/index.js";
import { recharge } from '@/common/api/order/index.js'; import { ref, onMounted, computed, reactive, watch } from "vue";
import { joinMember } from '@/common/api/order/index.js'; import { onLoad, onShow } from "@dcloudio/uni-app";
import { ref, onMounted, computed, reactive, watch } from 'vue'; import { pay } from "@/utils/pay.js";
import { onLoad, onShow } from '@dcloudio/uni-app';
import { pay } from '@/utils/pay.js';
function toShopList() { function toShopList() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/czzx-shop-list?shopId=' + option.shopId url: "/pages/user/member/czzx-shop-list?shopId=" + option.shopId,
}); });
} }
function toduihuan() { function toduihuan() {
uni.navigateTo({ uni.navigateTo({
url: '/user/exchange/index' url: "/user/exchange/index",
}); });
} }
@@ -138,7 +184,7 @@ function couponNum(list) {
} }
const couponModel = reactive({ const couponModel = reactive({
show: false, show: false,
couponInfoList: [] couponInfoList: [],
}); });
function lookCoupon(item) { function lookCoupon(item) {
@@ -148,19 +194,19 @@ function lookCoupon(item) {
async function buy() { async function buy() {
if (!state.isEnable) { if (!state.isEnable) {
return uni.showToast({ return uni.showToast({
title: '充值未开启暂不能充值', title: "充值未开启,暂不能充值",
icon: 'none' icon: "none",
}); });
} }
if (!charge_money.value) { if (!charge_money.value) {
return uni.showToast({ return uni.showToast({
title: '请选择或者输入充值金额', title: "请选择或者输入充值金额",
icon: 'none' icon: "none",
}); });
} }
const json = { const json = {
shopId: option.shopId, shopId: option.shopId,
shopUserId: shopUserInfo.id shopUserId: shopUserInfo.id,
}; };
if (sel.value < 0) { if (sel.value < 0) {
json.amount = `${money.value}`.trim() * 1; json.amount = `${money.value}`.trim() * 1;
@@ -171,16 +217,16 @@ async function buy() {
const res = await recharge(json); const res = await recharge(json);
if (!res) { if (!res) {
return uni.showToast({ return uni.showToast({
title: '充值失败', title: "充值失败",
icon: 'error' icon: "error",
}); });
} }
const payRes = await pay(res); const payRes = await pay(res);
console.log(payRes); console.log(payRes);
if (payRes) { if (payRes) {
uni.showToast({ uni.showToast({
title: '充值成功', title: "充值成功",
icon: 'none' icon: "none",
}); });
init(); init();
} }
@@ -188,114 +234,43 @@ async function buy() {
function toDetail() { function toDetail() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/billDetails?type=1&shopId=' + option.shopId url: "/pages/user/member/billDetails?type=1&shopId=" + option.shopId,
}); });
} }
function toPwd() { function toPwd() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/setPassword?type=1&shopId=' + option.shopId url: "/pages/user/member/setPassword?type=1&shopId=" + option.shopId,
}); });
} }
function back() { function back() {
safeNavigateBack(); uni.navigateBack();
} }
/**
* 修复版:安全的页面返回方法
* 彻底避免 "cannot navigate back at first page" 报错
* @param {Number} delta 返回的页面数默认1
* @param {Function} fallback 失败时的降级处理函数
*/
function safeNavigateBack(delta = 1, fallback) {
// 1. 立即获取页面栈,确保拿到最新状态(关键修复点)
const pages = getCurrentPages();
// 2. 严谨判断:页面栈长度必须大于 delta 才能返回
const canNavigateBack = pages.length > delta;
console.log('页面栈信息:', {
pagesLength: pages.length,
delta: delta,
canNavigateBack: canNavigateBack
});
// 3. 如果不能返回,直接执行降级逻辑
if (!canNavigateBack) {
console.warn('当前是首页/页面栈不足无法返回');
handleFallback(fallback);
return; // 终止后续执行,彻底避免调用 navigateBack
}
// 4. 能返回时才执行 navigateBack
try {
uni.navigateBack({
delta: delta,
success: () => {
console.log('页面返回成功');
},
fail: (err) => {
console.error('navigateBack 执行失败:', err);
handleFallback(fallback);
}
});
} catch (error) {
console.error('页面返回异常:', error);
handleFallback(fallback);
}
}
/**
* 统一处理降级逻辑
* @param {Function} fallback 自定义降级函数
*/
function handleFallback(fallback) {
if (typeof fallback === 'function') {
fallback(); // 执行自定义降级
} else {
// 默认降级:返回首页(请替换为你的首页路径)
uni.showToast({
title: '已到首页无法返回',
icon: 'none',
duration: 1500
});
// 如果需要强制跳首页,解开下面注释(根据你的业务选择)
uni.switchTab({
url: '/pages/index/index',
fail: () => {
uni.redirectTo({
url: '/pages/index/index'
});
}
});
}
}
const list = ref([]); const list = ref([]);
const sel = ref(0); const sel = ref(0);
const money = ref(null); const money = ref(null);
const option = reactive({ const option = reactive({
shopId: '' shopId: "",
}); });
const shopInfo = reactive({}); const shopInfo = reactive({});
const shopUserInfo = reactive({}); const shopUserInfo = reactive({});
const state = reactive({}); const state = reactive({});
async function init() { async function init() {
const shopInfoRes = await APIusershopInfodetail({ const shopInfoRes = await APIusershopInfodetail({
shopId: option.shopId shopId: option.shopId,
}); });
if (shopInfoRes) { if (shopInfoRes) {
Object.assign(shopInfo, shopInfoRes.shopInfo); Object.assign(shopInfo, shopInfoRes.shopInfo);
} }
const shopUserInfoRes = await APIshopUserInfo({ const shopUserInfoRes = await APIshopUserInfo({
shopId: option.shopId shopId: option.shopId,
}); });
if (shopUserInfoRes) { if (shopUserInfoRes) {
Object.assign(shopUserInfo, shopUserInfoRes); Object.assign(shopUserInfo, shopUserInfoRes);
} }
const res = await rechargeApi.config({ const res = await rechargeApi.config({
shopId: option.shopId shopId: option.shopId,
}); });
if (res) { if (res) {
Object.assign(state, res); Object.assign(state, res);
@@ -307,28 +282,16 @@ const charge_money = computed(() => {
if (money.value > 0) { if (money.value > 0) {
return money.value; return money.value;
} }
return ''; return "";
} }
const item = list.value[sel.value]; const item = list.value[sel.value];
if (item) { if (item) {
return item.amount; 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); Object.assign(option, opt);
await handleMixinOnLoad(opt);
// init(); // init();
}); });
@@ -362,7 +325,8 @@ onShow(() => {
font-weight: 700; font-weight: 700;
border-radius: 80rpx; border-radius: 80rpx;
line-height: 1; 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; box-shadow: 0 14rpx 30.4rpx 0 #fe8b435e;
&.disabled { &.disabled {
background: #eee; background: #eee;
@@ -395,7 +359,6 @@ onShow(() => {
.select-shop { .select-shop {
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
position: relative; position: relative;

28
pnpm-lock.yaml generated
View File

@@ -30,8 +30,8 @@ importers:
specifier: ^0.1.2 specifier: ^0.1.2
version: 0.1.2 version: 0.1.2
ysk-utils: ysk-utils:
specifier: ^1.0.83 specifier: ^1.0.85
version: 1.0.83 version: 1.0.85
devDependencies: devDependencies:
unplugin-auto-import: unplugin-auto-import:
specifier: ^0.16.7 specifier: ^0.16.7
@@ -50,13 +50,13 @@ packages:
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==} resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@babel/parser@7.28.5': '@babel/parser@7.28.6':
resolution: {integrity: sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==} resolution: {integrity: sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
hasBin: true hasBin: true
'@babel/types@7.28.5': '@babel/types@7.28.6':
resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} resolution: {integrity: sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@dcloudio/types@3.4.21': '@dcloudio/types@3.4.21':
@@ -357,8 +357,8 @@ packages:
webpack-virtual-modules@0.6.2: webpack-virtual-modules@0.6.2:
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==} resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
ysk-utils@1.0.83: ysk-utils@1.0.85:
resolution: {integrity: sha512-48KLQJXQtF8nLaaFHR1hAFx/QGS848fg7n37BpZEtwliD+D5ZHQFPOCZNaM68jiwDTWhNg41rHpZzhAUQXe+/Q==} resolution: {integrity: sha512-HkbV4Jidi3G6DAuGAN972tClUYtC2zVoxo4crrxexfn0rZa8HjXatUfEbawHOeEzyl6G1CdC+160I2bKfxEBlA==}
snapshots: snapshots:
@@ -368,11 +368,11 @@ snapshots:
'@babel/helper-validator-identifier@7.28.5': {} '@babel/helper-validator-identifier@7.28.5': {}
'@babel/parser@7.28.5': '@babel/parser@7.28.6':
dependencies: dependencies:
'@babel/types': 7.28.5 '@babel/types': 7.28.6
'@babel/types@7.28.5': '@babel/types@7.28.6':
dependencies: dependencies:
'@babel/helper-string-parser': 7.27.1 '@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5 '@babel/helper-validator-identifier': 7.28.5
@@ -408,7 +408,7 @@ snapshots:
'@vue/compiler-core@3.5.22': '@vue/compiler-core@3.5.22':
dependencies: dependencies:
'@babel/parser': 7.28.5 '@babel/parser': 7.28.6
'@vue/shared': 3.5.22 '@vue/shared': 3.5.22
entities: 4.5.0 entities: 4.5.0
estree-walker: 2.0.2 estree-walker: 2.0.2
@@ -421,7 +421,7 @@ snapshots:
'@vue/compiler-sfc@3.5.22': '@vue/compiler-sfc@3.5.22':
dependencies: dependencies:
'@babel/parser': 7.28.5 '@babel/parser': 7.28.6
'@vue/compiler-core': 3.5.22 '@vue/compiler-core': 3.5.22
'@vue/compiler-dom': 3.5.22 '@vue/compiler-dom': 3.5.22
'@vue/compiler-ssr': 3.5.22 '@vue/compiler-ssr': 3.5.22
@@ -684,7 +684,7 @@ snapshots:
webpack-virtual-modules@0.6.2: {} webpack-virtual-modules@0.6.2: {}
ysk-utils@1.0.83: ysk-utils@1.0.85:
dependencies: dependencies:
bignumber.js: 9.3.1 bignumber.js: 9.3.1
loadsh: 0.0.4 loadsh: 0.0.4

View File

@@ -27,10 +27,7 @@
</view> </view>
<text class="text">剩余{{item.quantity}}</text> <text class="text">剩余{{item.quantity}}</text>
</view> </view>
<view class="goods-name u-flex u-row-between"> <view class="goods-name">{{item.goodsName}}</view>
<text class="u-m-r-30" style="word-break: break-all;">{{item.goodsName}}</text>
<ymfShare color="#333" />
</view>
<view class="bg-f7" style="height: 24rpx"></view> <view class="bg-f7" style="height: 24rpx"></view>
<view class="desc"> <view class="desc">
<view class="u-flex"> <view class="u-flex">
@@ -116,12 +113,9 @@
</view> </view>
</up-popup> </up-popup>
<!-- 兑换确认弹窗end --> <!-- 兑换确认弹窗end -->
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import ymfShare from '@/components/ymf-components/ymf-share.vue'
import { import {
computed, computed,
reactive reactive
@@ -131,11 +125,6 @@
} from '@/utils/uniapp.js' } from '@/utils/uniapp.js'
import modal from "@/scoreShop/components/modal.vue"; import modal from "@/scoreShop/components/modal.vue";
import * as pointGoodsApi from "@/common/api/order/pointGoods.js"; import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
import {
userPoints
} from "@/common/api/market/points.js";
import couponIcon from "@/components/coupon-icon/index"; import couponIcon from "@/components/coupon-icon/index";
import { import {
pay pay
@@ -315,64 +304,16 @@
return `单人兑换已达上限` return `单人兑换已达上限`
} }
}) })
async function getGoods() { onLoad((opt) => {
const res = await pointGoodsApi.pointsGoods({ const exchange_goods = uni.getStorageSync('exchange_goods')
id: options.id if (exchange_goods.goodsDescription) {
}) exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription)
if (res.goodsDescription) {
res.goodsDescription = JSON.parse(res.goodsDescription)
} else { } else {
res.goodsDescription = [] exchange_goods.goodsDescription = []
} }
res.couponInfo=res.couponInfo||{} const pointsUserData = uni.getStorageSync('pointsUser')
Object.assign(item, exchange_goods)
Object.assign(item, res) Object.assign(pointsUser, pointsUserData)
}
async function getPointUser() {
const res = await userPoints({
shopUserId: uni.cache.get('shopUserInfo').id || ''
})
Object.assign(pointsUser, res.pointsUser)
}
async function init() {
await getGoods()
await getPointUser()
}
import {
shareMixin,
handleMixinOnLoad,wxShare,returnQuery ,returnIndexBg,
} from '@/utils/share.js'
// defineOptions({
// mixins: [shareMixin],
// });
onShareAppMessage(async(res)=>{
const query=await returnQuery()
const shopInfo=uni.cache.get('shopInfo')
return wxShare({
...res,
title:item.goodsName +'-'+shopInfo.shopName,
path:'/scoreShop/detail/index'+'?'+query,
query,
imageUrl:item.goodsImageUrl||returnIndexBg()||''
})
})
const options = reactive({})
onLoad(async (opt) => {
Object.assign(options, opt)
await handleMixinOnLoad(opt)
await init()
// const exchange_goods = uni.getStorageSync('exchange_goods')
// if (exchange_goods.goodsDescription) {
// exchange_goods.goodsDescription = JSON.parse(exchange_goods.goodsDescription)
// } else {
// exchange_goods.goodsDescription = []
// }
// const pointsUserData = uni.getStorageSync('pointsUser')
// Object.assign(item, exchange_goods)
// Object.assign(pointsUser, pointsUserData)
}) })
</script> </script>
@@ -522,7 +463,6 @@
height: 184rpx; height: 184rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: #d9d9d9; background: #d9d9d9;
&.bg-fff{ &.bg-fff{
background-color: #fff; background-color: #fff;
} }
@@ -547,7 +487,6 @@
font-size: 700; font-size: 700;
} }
} }
.w-full{ .w-full{
width: 100%; width: 100%;
} }

View File

@@ -74,7 +74,7 @@
function toDetail(item) { function toDetail(item) {
uni.setStorageSync('exchange_goods', item) uni.setStorageSync('exchange_goods', item)
uni.navigateTo({ uni.navigateTo({
url: '/scoreShop/detail/index?id=' + item.id+'&shopId='+item.shopId, url: '/scoreShop/detail/index?id=' + item.id,
}) })
} }

View File

@@ -31,13 +31,9 @@
<view class="tab-item" :class="tabActive === 0 ? 'active' : ''" @click="tabActive = 0">优惠券</view> <view class="tab-item" :class="tabActive === 0 ? 'active' : ''" @click="tabActive = 0">优惠券</view>
<view class="tab-item" :class="tabActive === 1 ? 'active' : ''" @click="tabActive = 1">其它商品</view> <view class="tab-item" :class="tabActive === 1 ? 'active' : ''" @click="tabActive = 1">其它商品</view>
</view> </view>
<view class="u-flex gap-20"> <view class="u-flex" @click="toggleLayout">
<view @click="toggleLayout">
<image :src="layout === 'block' ? imgs.layout_block : imgs.layout" class="layout" /> <image :src="layout === 'block' ? imgs.layout_block : imgs.layout" class="layout" />
</view> </view>
<ymfShare size="40rpx" color="#9C571F"></ymfShare>
</view>
</view> </view>
<goodsList :pointsUser="pointsUser" :layout="layout" :list="list" @exchange="exchange"></goodsList> <goodsList :pointsUser="pointsUser" :layout="layout" :list="list" @exchange="exchange"></goodsList>
@@ -45,12 +41,9 @@
<up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore> <up-loadmore :status="isEnd?'nomore':'loadmore'"></up-loadmore>
</view> </view>
</view> </view>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
<script setup> <script setup>
import ymfShare from '@/components/ymf-components/ymf-share.vue'
import * as pointGoodsApi from "@/common/api/order/pointGoods.js"; import * as pointGoodsApi from "@/common/api/order/pointGoods.js";
import goodsList from "./components/goods-list.vue"; import goodsList from "./components/goods-list.vue";
import { import {
@@ -77,20 +70,11 @@
} }
function back() { function back() {
const pages = getCurrentPages();
if (pages.length < 2) {
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
}); });
} }
}
// function exchange(item) { // function exchange(item) {
// pointGoodsApi.exchange({ // pointGoodsApi.exchange({
// pointsGoodsId: item.id, // pointsGoodsId: item.id,
@@ -108,8 +92,7 @@
} }
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/member/billDetails?type=2&shopId=' + query.shopId + '&id=' + (pointsUser.value ? url: '/pages/user/member/billDetails?type=2&shopId=' + query.shopId + '&id=' + (pointsUser.value?pointsUser.value.id :
pointsUser.value.id :
'') '')
}) })
} }
@@ -149,41 +132,7 @@
} }
}) })
} }
onLoad((opt) => {
import {
shareMixin,
handleMixinOnLoad,
returnQuery,
jsonToUrl,
wxShare,returnIndexBg ,
returnCommonQuery
} from '@/utils/share.js'
// defineOptions({
// mixins: [shareMixin],
// });
async function onShare() {
const queryJson = await returnCommonQuery()
let query = jsonToUrl(queryJson)
let json = {}
json.title = '积分乐园,好物兑换'
json.imageUrl = returnIndexBg()||uni.cache.get('shopInfo').logo || ''
return wxShare({
query,
...json,
path: '/scoreShop/index/index' + '?' + query
})
}
onShareAppMessage(onShare)
onShareTimeline(onShare)
const options = reactive({
})
onLoad(async (opt) => {
Object.assign(options, opt)
query.shopId = opt.shopId || '' query.shopId = opt.shopId || ''
}) })
watch(() => tabActive.value, (newval, oldval) => { watch(() => tabActive.value, (newval, oldval) => {
@@ -202,23 +151,8 @@
query.page++ query.page++
getList(); getList();
}) })
import { onShow(() => {
productStore
} from '@/stores/user.js';
import {
onShareAppMessage
} from '@dcloudio/uni-app';
import { onShareTimeline } from '@dcloudio/uni-app';
const storeuser = productStore();
onShow(async () => {
if (!storeuser.isHasLogin) {
await handleMixinOnLoad(options)
refresh() refresh()
} else {
refresh()
}
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -230,10 +164,6 @@ import { onShareTimeline } from '@dcloudio/uni-app';
justify-content: flex-end; justify-content: flex-end;
} }
.gap-20 {
gap: 20rpx;
}
.top { .top {
padding: 138rpx 26rpx 48rpx 42rpx; padding: 138rpx 26rpx 48rpx 42rpx;
display: flex; display: flex;

View File

@@ -1,7 +1,12 @@
<template> <template>
<view class="min-page bg-f7 u-font-28 color-333"> <view class="min-page bg-f7 u-font-28 color-333">
<up-navbar title="兑换成功" bgColor="transparent" leftIconColor="#333" @leftClick="back()" <up-navbar
titleStyle="color:#333"></up-navbar> title="兑换成功"
bgColor="transparent"
leftIconColor="#333"
@leftClick="back()"
titleStyle="color:#333"
></up-navbar>
<view class="content"> <view class="content">
<view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }"> <view class="bg" :style="{ backgroundImage: `url(${imgs.bg})` }">
<image :src="imgs.success" class="success"></image> <image :src="imgs.success" class="success"></image>
@@ -45,22 +50,16 @@
</template> </template>
<script setup> <script setup>
const imgs = { const imgs = {
bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png", bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/b625560a5b75418c9e643841f8674a0c.png",
success: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png", success:
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/c2f0865efb444de58ff0d8bb3a51d300.png",
}; };
function back() { function back() {
const pages = getCurrentPages();
if(pages.length<2){
uni.redirectTo({
url: '/scoreShop/index/index?shopId=' + item.shopId
})
}else{
uni.navigateBack(); uni.navigateBack();
} }
}
function lookOrder() { function lookOrder() {
uni.redirectTo({ uni.redirectTo({
url:'/scoreShop/order/index?shopId='+item.shopId url:'/scoreShop/order/index?shopId='+item.shopId
@@ -81,7 +80,6 @@
background: linear-gradient(180deg, #f5cd82 0%, rgba(247, 219, 165, 0) 100%); background: linear-gradient(180deg, #f5cd82 0%, rgba(247, 219, 165, 0) 100%);
height: 670rpx; height: 670rpx;
$color: #9c571f; $color: #9c571f;
.bg { .bg {
width: 100%; width: 100%;
height: 586rpx; height: 586rpx;
@@ -98,13 +96,11 @@
height: 206rpx; height: 206rpx;
} }
} }
.info { .info {
padding-left: 174rpx; padding-left: 174rpx;
padding-right: 32rpx; padding-right: 32rpx;
} }
} }
.bottom { .bottom {
gap: 48rpx; gap: 48rpx;
margin-top: 44rpx; margin-top: 44rpx;
@@ -114,12 +110,10 @@
border-radius: 100rpx; border-radius: 100rpx;
font-size: 32rpx; font-size: 32rpx;
border: 1px solid transparent; border: 1px solid transparent;
&.back { &.back {
border-color: $my-main-color; border-color: $my-main-color;
color: $my-main-color; color: $my-main-color;
} }
&.look { &.look {
background-color: $my-main-color; background-color: $my-main-color;
border-color: $my-main-color; border-color: $my-main-color;

View File

@@ -39,7 +39,6 @@ declare global {
const onScopeDispose: typeof import('vue')['onScopeDispose'] const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch'] const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage'] const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
const onShareTimeline: typeof import('@dcloudio/uni-app')['onShareTimeline']
const onShow: typeof import('@dcloudio/uni-app')['onShow'] const onShow: typeof import('@dcloudio/uni-app')['onShow']
const onUnload: typeof import('@dcloudio/uni-app')['onUnload'] const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
const onUnmounted: typeof import('vue')['onUnmounted'] const onUnmounted: typeof import('vue')['onUnmounted']

View File

@@ -90,11 +90,9 @@ export const useWebSocket = defineStore('socketTask', () => {
let onMessage = () => { let onMessage = () => {
} }
function setOnMessage(onMessageBallBack){ function setOnMessage(onMessageBallBack){
onMessage=onMessageBallBack onMessage=onMessageBallBack
} }
function chnageInitMessage(data){ function chnageInitMessage(data){
initMessage=data initMessage=data
} }
@@ -129,8 +127,6 @@ export const useWebSocket = defineStore('socketTask', () => {
url: uni.conf.baseUrlwws + '?' + Date.now(), url: uni.conf.baseUrlwws + '?' + Date.now(),
success: (res) => { success: (res) => {
console.log('连接成功'); console.log('连接成功');
console.log('connectMsg', connectMsg);
console.log('initMessage', initMessage);
isConnected.value = true; isConnected.value = true;
// 监听初始化成功在开启心跳 // 监听初始化成功在开启心跳
startHeartbeat(); startHeartbeat();
@@ -373,8 +369,6 @@ export const useWebSocket = defineStore('socketTask', () => {
initNetworkListener, initNetworkListener,
connect, connect,
allowReconnect, allowReconnect,
socketTask, socketTask,setOnMessage,chnageInitMessage
setOnMessage,
chnageInitMessage
}; };
}) })

View File

@@ -110,90 +110,12 @@ export const productStore = defineStore("product", {
latitude: "", latitude: "",
longitude: "", longitude: "",
}, },
token: "",
miniAppOpenId: "",
userInfo: "",
shopId: uni.cache.get('shopId') || '',
shopInfo: { shopInfo: {
shopId: "", shopId: "",
isOrderFence: 0, isOrderFence: 0,
id: '',
}, },
shopUserInfo:{
},
isHasLogin:false
}), }),
actions: { actions: {
actionslogin() {
return new Promise(async (resolve, reject) => {
// #ifdef MP-WEIXIN
uni.login({
provider: "weixin",
success: (data) => {
// 微信小程序环境
uni.getUserInfo({
provider: "weixin",
success: async (infoRes) => {
let res = await APIuserlogin({
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
source: "wechat",
});
console.log('APIuserlogin', res);
if (res) {
this.token = res.token;
this.isHasLogin=true
this.miniAppOpenId = res.userInfo
.miniAppOpenId;
this.userInfo = res.userInfo;
uni.cache.set("token", res.token);
uni.cache.set("userInfo", res.userInfo);
uni.cache.set("followIndex", res
.followIndex || "");
}
resolve(true);
},
fail: (err) => {
reject(false);
},
});
},
});
// #endif
// #ifdef MP-ALIPAY
my.getAuthCode({
scopes: "auth_base",
success: async (data) => {
// 支付宝小程序环境
// my.getAuthUserInfo({
// success: async (infoRes) => {
let res = await APIuserlogin({
code: data.authCode, //临时登录凭证
// rawData: JSON.stringify(infoRes),
source: "alipay",
});
if (res) {
this.isHasLogin=true
this.token = res.token;
this.miniAppOpenId = res.userInfo.miniAppOpenId;
this.userInfo = res.userInfo;
uni.cache.set("token", res.token);
uni.cache.set("openId", res.userInfo.alipayOpenId);
uni.cache.set("userInfo", res.userInfo);
resolve(true);
}
},
fail: () => {
reject(false);
},
});
// #endif
// #ifdef H5
resolve(true)
// #endif
});
},
getLocation() { getLocation() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log("获取经纬度"); console.log("获取经纬度");
@@ -526,43 +448,19 @@ export const productStore = defineStore("product", {
// 通过shopId 获取店铺会员信息 // 通过shopId 获取店铺会员信息
actionsproductqueryProduct() { actionsproductqueryProduct() {
console.log('actionsproductqueryProduct:token',uni.cache.get('token'));
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
let res = await APIshopUserInfo(); let res = await APIshopUserInfo();
if(res&& typeof res === 'object'){
this.shopUserInfo=res;
uni.cache.set("shopUserInfo", res); uni.cache.set("shopUserInfo", res);
uni.cache.set("orderVIP", res); uni.cache.set("orderVIP", res);
uni.cache.set("ordershopUserInfo", res.shopInfo); uni.cache.set("ordershopUserInfo", res.shopInfo);
resolve(res); resolve(res);
}else{
reject(false);
}
} catch (e) { } catch (e) {
reject(false); reject(false);
} }
}); });
}, },
async pageOnload() {
console.log('开始加载必须数据')
//登录
await this.actionslogin()
//获取会员信息
await this.actionsproductqueryProduct()
//获取店铺信息
await this.getShopInfo()
console.log('必须数据加载完毕')
},
async getShopInfo(shopId) {
const shopRes = await APIusershopInfodetail({
shopId: this.shopId || shopId,
});
this.shopInfo = shopRes.shopInfo;
uni.cache.set("shopInfo", shopRes.shopInfo);
},
// 用户信息获取 // 用户信息获取
actionsAPIuser() { actionsAPIuser() {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {

View File

@@ -28,11 +28,11 @@
<view class="bg-f7" style="height: 32rpx"></view> <view class="bg-f7" style="height: 32rpx"></view>
<view class="desc"> <view class="desc">
<view class="u-flex"> <view class="u-flex">
<view class="color-666 no-wrap" style="min-width: 180rpx">可核销门店</view> <view class="color-666 no-wrap" style="min-width: 180rpx;">可核销门店</view>
<view class="">{{item.shopName}}</view> <view class="">{{item.shopName}}</view>
</view> </view>
<view class="u-flex u-m-t-16 u-col-baseline"> <view class="u-flex u-m-t-16 u-col-baseline">
<view class="color-666 no-wrap" style="min-width: 180rpx">门店地址</view> <view class="color-666 no-wrap" style="min-width: 180rpx;">门店地址</view>
<view class="">{{item.shopAddress}}</view> <view class="">{{item.shopAddress}}</view>
</view> </view>
</view> </view>
@@ -45,7 +45,7 @@
<up-avatar size="76rpx" :src="item.avatar"></up-avatar> <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 class="u-flex u-flex-1 u-p-l-22 u-col-center u-row-between">
<view> <view>
<view class="color-000 u-line-1" style="max-width: 180rpx">{{ item.nickName }}</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="main-color u-m-t-2">{{returnNeedPerpole(item)}}人拼成</view>
</view> </view>
<view class="u-m-t-22"> <view class="u-m-t-22">
@@ -54,21 +54,26 @@
</view> </view>
<view class="btn" @click="fastBuy(item)">快速拼成</view> <view class="btn" @click="fastBuy(item)">快速拼成</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<view class="bg-f7" style="height: 24rpx"></view> <view class="bg-f7" style="height: 24rpx"></view>
<view class="goods-group"> <view class="goods-group">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="name">套餐商品</view> <view class="name">套餐商品</view>
<view class="u-flex color-666" @click="showGroup = !showGroup" style="align-items: baseline"> <view class="u-flex color-666" @click="showGroup=!showGroup" style="align-items: baseline;">
<text class="u-m-r-18">{{showGroup?'收起':'展开'}}</text> <text class="u-m-r-18">{{showGroup?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showGroup}"> <view class="guodu" :class="{rotate:!showGroup}">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
</view> </view>
</view> </view>
</view> </view>
<view class="" v-if="showGroup"> <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">
@@ -82,23 +87,30 @@
<text>{{goods.name}}</text> <text>{{goods.name}}</text>
<view class="u-flex text-right"> <view class="u-flex text-right">
<text class="color-666 u-m-r-42">x{{goods.num}}</text> <text class="color-666 u-m-r-42">x{{goods.num}}</text>
<view style="min-width: 110rpx">¥{{ goods.price }}</view> <view style="min-width: 110rpx;">¥{{goods.price}}</view>
</view>
</view>
</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="u-flex u-row-between">
<view class="name">分享说明</view> <view class="name">分享说明</view>
<view class="u-flex color-666" @click="showDesc = !showDesc" style="align-items: baseline"> <view class="u-flex color-666" @click="showDesc=!showDesc" style="align-items: baseline;">
<text class="u-m-r-18">{{showDesc?'收起':'展开'}}</text> <text class="u-m-r-18">{{showDesc?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!showDesc}"> <view class="guodu" :class="{rotate:!showDesc}">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
</view> </view>
</view> </view>
</view> </view>
<template v-if="showDesc"> <template v-if="showDesc">
<view class="u-m-t-26 text-center table"> <view class="u-m-t-26 text-center table">
@@ -113,38 +125,64 @@
</view> </view>
<view class="u-m-t-26" > <view class="u-m-t-26" >
<view>分享期限小时{{ item.expireHours }}</view> <view>
<view class="u-m-t-10">规定期限内的助力才会被计入</view> 分享期限小时{{item.expireHours}}
<view class="u-m-t-40">如何才是分享成功被分享人只需要点击助力提示助力成功后即可</view> </view>
<view class="u-m-t-10">
规定期限内的助力才会被计入
</view>
<view class="u-m-t-40">
如何才是分享成功被分享人只需要点击助力提示助力成功后即可
</view>
</view> </view>
</template> </template>
</view> </view>
<view class="desc"> <view class="desc">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="name">使用说明</view> <view class="name">使用说明</view>
<view class="u-flex color-666" @click="useDescShow = !useDescShow" style="align-items: baseline"> <view class="u-flex color-666" @click="useDescShow=!useDescShow" style="align-items: baseline;">
<text class="u-m-r-18">{{useDescShow?'收起':'展开'}}</text> <text class="u-m-r-18">{{useDescShow?'收起':'展开'}}</text>
<view class="guodu" :class="{rotate:!useDescShow}"> <view class="guodu" :class="{rotate:!useDescShow}">
<up-icon name="arrow-down" bold></up-icon> <up-icon name="arrow-down" bold></up-icon>
</view> </view>
</view> </view>
</view> </view>
<template v-if="useDescShow"> <template v-if="useDescShow">
<view class="u-m-t-16 color-666"> <view class="u-m-t-16 color-666">
<view>1可用时间段{{ canuseTime }}</view> <view>
<view v-if="item.otherDesc">2其他使用说明{{ item.otherDesc }}</view> 1可用时间段{{canuseTime}}
</view> </view>
<view v-if="item.otherDesc">
2其他使用说明{{item.otherDesc}}
</view>
</view>
</template> </template>
</view> </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="u-flex u-row-center">
<view class="title">商品详情</view> <view class="title">商品详情</view>
</view> </view>
<view class="u-m-t-32"> <view class="u-m-t-32">
<image class="w-full" v-for="(item, index) in item.detailImages" :key="index" mode="widthFix" <image class="w-full" v-for="(item,index) in item.detailImages" :key="index" mode="widthFix" :src="item">
:src="item"></image> </image>
</view> </view>
</view> </view>
@@ -156,10 +194,14 @@
<view v-if="isCanExchange" class="btn" @click="payExchange"> <view v-if="isCanExchange" class="btn" @click="payExchange">
{{returnBtmText}} {{returnBtmText}}
</view> </view>
<view class="btn gray u-m-t-32" @click="createOrder" <view class="btn gray u-m-t-32" @click="createOrder" v-if="item.tieredDiscount&&item.tieredDiscount.length>0">
v-if="item.tieredDiscount && item.tieredDiscount.length > 0">发起助力</view> 发起助力
</view> </view>
</view>
<!-- 需要支付的弹窗 --> <!-- 需要支付的弹窗 -->
<up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false"> <up-popup :show="popupData.show" mode="bottom" closeOnClickOverlay @close="popupData.show = false">
<view class="popup-content"> <view class="popup-content">
@@ -182,6 +224,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom u-flex u-row-between u-col-center"> <view class="bottom u-flex u-row-between u-col-center">
@@ -194,6 +237,7 @@
<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> <up-icon name="plus-circle-fill" size="20" color="#ED5A2E" @click="changeNumber('+')"></up-icon>
</view> </view>
</view> </view>
<view class="u-m-t-42 u-flex u-row-center"> <view class="u-m-t-42 u-flex u-row-center">
@@ -201,17 +245,10 @@
</view> </view>
</view> </view>
</up-popup> </up-popup>
<ymf-share-popup ></ymf-share-popup>
<!-- 兑换确认弹窗end --> <!-- 兑换确认弹窗end -->
</view> </view>
</template> </template>
<script setup> <script setup>
import {
shareMixin,
handleMixinOnLoad,
returnQuery
} from '@/utils/share.js';
import { import {
Storelogin Storelogin
} from '@/stores/user.js'; } from '@/stores/user.js';
@@ -220,71 +257,71 @@
computed, computed,
reactive, reactive,
watch watch
} from 'vue'; } from "vue";
import dayjs from 'dayjs'; import dayjs from "dayjs";
import { import {
wxShare wxShare
} from '@/utils/share.js'; } from '@/utils/share.js'
import { import {
getOpenId getOpenId
} from '@/utils/uniapp.js'; } from '@/utils/uniapp.js'
import modal from '@/groupBuying/components/modal.vue'; import modal from "@/groupBuying/components/modal.vue";
import * as Api from '@/common/api/market/package.js'; import * as Api from '@/common/api/market/package.js'
import { import {
pay pay
} from '@/utils/pay.js'; } from '@/utils/pay.js'
const imgs = { const imgs = {
bg: 'https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png' bg: "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/2/9fd6a3ad2b384f6cb4e88ed6b77bd334.png",
}; };
const number = ref(1); const number = ref(1)
const showGroup = ref(true); const showGroup = ref(true)
const showDesc = ref(true); const showDesc = ref(true)
const useDescShow = ref(true); const useDescShow=ref(true)
import { import {
BigNumber BigNumber
} from 'bignumber.js'; } from "bignumber.js";
const totalPrice = computed(() => { const totalPrice = computed(() => {
if (!item.price) { if (!item.price) {
return 0; 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 (step === '-') {
if (number.value == 1) { if (number.value == 1) {
return; return
} }
number.value--; number.value--
return; return
} }
if (step === '+') { if (step === '+') {
if (item.limitBuyNum == -10086) { if (item.limitBuyNum == -10086) {
number.value++; number.value++
return; return
} }
if (number.value >= item.limitBuyNum) { if (number.value >= item.limitBuyNum) {
return uni.showToast({ return uni.showToast({
title: '最多可购买' + item.limitBuyNum + '份', title: '最多可购买' + item.limitBuyNum + '份',
icon: 'none' icon: 'none'
}); })
} }
number.value++; number.value++
return; return
} }
} }
const modalData = reactive({ const modalData = reactive({
show: false show: false,
}); });
function prveImg(index) { function prveImg(index) {
uni.previewImage({ uni.previewImage({
urls: coverImgs.value, urls: coverImgs.value,
current: index current: index
}); })
} }
const popupData = reactive({ const popupData = reactive({
@@ -293,21 +330,20 @@
}); });
function exchangeClick() { function exchangeClick() {
popupData.show = true; popupData.show = true
} }
function fastBuy(item) { function fastBuy(item) {
popupData.item = item; popupData.item = item;
popupData.show = true; popupData.show = true
} }
watch( watch(() => popupData.show, (newval) => {
() => popupData.show,
(newval) => {
if (!newval) { if (!newval) {
popupData.item = null; popupData.item = null
} }
} })
);
function dingyue() { function dingyue() {
return new Promise((revlove, reject) => { return new Promise((revlove, reject) => {
@@ -317,45 +353,46 @@
], ],
success(res) {}, success(res) {},
complete() { complete() {
revlove(); revlove()
} }
}); })
}); })
} }
async function createOrder(){ async function createOrder(){
Api.createOrder({ Api.createOrder({
packageId:item.id, packageId:item.id,
shopId: item.shopId shopId: item.shopId,
}).then((res) => { }).then(res=>{
if(res){ if(res){
uni.redirectTo({ uni.redirectTo({
url:'/userPackage/order/detail?orderId='+res url:'/userPackage/order/detail?orderId='+res
}); })
}else{ }else{
uni.showToast({ uni.showToast({
title:'发起助力失败', title:'发起助力失败',
icon:'none' icon:'none'
}); })
} }
}); })
} }
async function payExchange() { async function payExchange() {
uni.setStorageSync('group_buying_order', { uni.setStorageSync('group_buying_order', {
...item, ...item,
number: number.value number: number.value,
}); })
uni.navigateTo({ uni.navigateTo({
url: '/userPackage/confirm-order/confirm-order' url: '/userPackage/confirm-order/confirm-order'
}); })
return; return
await dingyue(); await dingyue();
uni.showLoading({ uni.showLoading({
title: '支付中……' title: '支付中……'
}); })
const openId = await getOpenId(); const openId = await getOpenId()
uni.hideLoading(); uni.hideLoading()
if (openId) { if (openId) {
Api.exchange({ Api.exchange({
paramId: item.id, paramId: item.id,
@@ -363,67 +400,74 @@
number: number.value, number: number.value,
groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '', groupOrderNo: popupData.item ? popupData.item.groupOrderNo : '',
openId openId
}).then((orderRes) => { }).then(orderRes => {
popupData.show = false; popupData.show = false;
pay(orderRes.payInfo).then((res) => { pay(orderRes.payInfo).then(res => {
console.log(res); console.log(res)
if (res) { if (res) {
uni.redirectTo({ uni.redirectTo({
url: '/groupBuying/success/index?detailId=' + orderRes.record.id url: '/groupBuying/success/index?detailId=' + orderRes.record
}); .id
})
} else { } else {
uni.showToast({ uni.showToast({
title: '开团失败', title: '开团失败',
icon: 'none' icon: 'none'
}); })
} }
});
}); })
})
} else { } else {
uni.showToast({ uni.showToast({
title: '鉴权失败,兑换失败', title: '鉴权失败,兑换失败',
icon: 'none' icon: 'none'
}); })
} }
} }
const item = reactive({ const item = reactive({
goodsDescription: [] goodsDescription: []
}); })
const isCanExchange = computed(() => { const isCanExchange = computed(() => {
if (item.quantity <= 0) { if (item.quantity <= 0) {
return false; return false
} }
if (item.limitQuota && item.boughtCount >= item.limitQuota) { if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return false; return false
} }
return true; return true
}); })
const returnBtmText = computed(() => { const returnBtmText = computed(() => {
if (isCanExchange.value) { if (isCanExchange.value) {
return '立即购买'; return '立即购买'
} }
if (pointsUser.pointBalance < item.requiredPoints) { if (pointsUser.pointBalance < item.requiredPoints) {
const num = item.requiredPoints - pointsUser.pointBalance; const num = item.requiredPoints - pointsUser.pointBalance
return `积分不足,还差${num}积分`; return `积分不足,还差${num}积分`
} }
if (item.quantity <= 0) { if (item.quantity <= 0) {
return `库存不足`; return `库存不足`
} }
if (item.limitQuota && item.boughtCount >= item.limitQuota) { if (item.limitQuota && item.boughtCount >= item.limitQuota) {
return `单人兑换已达上限`; return `单人兑换已达上限`
} }
}); })
const query = reactive({ const query = reactive({
shopId: '', shopId: '',
id: '' id: '',
}); })
const coverImgs = ref([]);
const coverImgs = ref([])
async function init(opt) { async function init(opt) {
// 获取小程序进入场景和参数 // 获取小程序进入场景和参数
@@ -432,23 +476,24 @@
// 获取链接上的参数 // 获取链接上的参数
const launchOptionsQuery = launchOptions.query; const launchOptionsQuery = launchOptions.query;
console.log('launchOptionsQuery', launchOptionsQuery); console.log('launchOptionsQuery', launchOptionsQuery);
Object.assign(query, launchOptionsQuery); Object.assign(query, launchOptionsQuery)
console.log(opt); console.log(opt)
Object.assign(query, opt); Object.assign(query, opt)
console.log(query); console.log(query)
await storelogin.actionslogin(); await storelogin.actionslogin()
getDetail(); getDetail()
} }
function getDetail() { function getDetail() {
Api.getPackageDetail(query).then((res) => { Api.getPackageDetail(query).then(res => {
Object.assign(item, res); Object.assign(item, res)
console.log(item); console.log(item)
coverImgs.value = res.images; coverImgs.value = res.images
uni.cache.set('shopId', item.shopId); uni.cache.set('shopId', item.shopId)
}); })
} }
/** /**
* 计算剩余时间差(毫秒) * 计算剩余时间差(毫秒)
* @param {Object} item - 包含groupEndTime的订单/拼团对象 * @param {Object} item - 包含groupEndTime的订单/拼团对象
@@ -486,47 +531,43 @@
return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`; return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
} }
let timer = null;
let nowTime = ref(Date.now()); let timer = null
let nowTime = ref(Date.now())
timer = setInterval(() => { timer = setInterval(() => {
nowTime.value = Date.now(); nowTime.value = Date.now()
}, 1000); }, 1000)
// 组合使用:获取格式化后的剩余时间 // 组合使用:获取格式化后的剩余时间
function getRemainingHMS(item) { function getRemainingHMS(item) {
nowTime.value; nowTime.value
const ms = returnRemainingTime(item); const ms = returnRemainingTime(item);
return formatTimeToHMS(ms); return formatTimeToHMS(ms);
} }
function returnNeedPerpole(data) { function returnNeedPerpole(data) {
return data.groupPeopleNum - data.currentPeopleNum; return data.groupPeopleNum - data.currentPeopleNum
} }
onLoad(async (opt) => {
await handleMixinOnLoad(opt);
init(opt);
});
onLoad(init)
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.showShareMenu(); uni.showShareMenu()
// #endif // #endif
onShareAppMessage(() => {
onShareAppMessage(async () => { const query = `id=${item.id}&shopId=${item.shopId}`
let query = await returnQuery(); return wxShare({
const options = { title: item.wareName,
title: item.packageName,
imageUrl: coverImgs.value[0], imageUrl: coverImgs.value[0],
path: '/userPackage/goodsDetail/goodsDetail' + '?' + query, path: '/userPackage/goodsDetail/goodsDetail' + '?' + query,
query query,
}; })
console.log('onShareAppMessage===', options); })
return wxShare(options);
});
const canuseTime=computed(()=>{ const canuseTime=computed(()=>{
return item.useWeeks.join('、') + ' ' + item.useTimes; return item.useWeeks.join('、')+' '+item.useTimes
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -574,8 +615,8 @@
.old-price { .old-price {
margin-left: 16rpx; margin-left: 16rpx;
color: #e7e7e7; color: #E7E7E7;
opacity: 0.85; opacity: .85;
font-weight: 700; font-weight: 700;
text-decoration: line-through; text-decoration: line-through;
} }
@@ -597,6 +638,8 @@
} }
} }
.desc { .desc {
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
background-color: #fff; background-color: #fff;
@@ -610,7 +653,7 @@
padding: 0 22rpx; padding: 0 22rpx;
&::before { &::before {
content: ''; content: "";
display: block; display: block;
position: absolute; position: absolute;
right: 100%; right: 100%;
@@ -623,7 +666,7 @@
&::after { &::after {
left: 100%; left: 100%;
content: ''; content: "";
position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
@@ -651,13 +694,13 @@
color: #fff; color: #fff;
width: 556rpx; width: 556rpx;
text-align: center; text-align: center;
background-color: #e8ad7b; background-color: #E8AD7B;
border: 1px solid transparent; border: 1px solid transparent;
&.gray { &.gray {
background: #fff; background: #fff;
color: #e8ad7b; color: #E8AD7B;
border-color: #e8ad7b; border-color: #E8AD7B;
} }
} }
} }
@@ -710,6 +753,7 @@
color: #666; color: #666;
line-height: 42rpx; line-height: 42rpx;
} }
} }
.bottom { .bottom {
@@ -746,7 +790,7 @@
.item { .item {
padding: 28rpx 0; padding: 28rpx 0;
border-bottom: 2rpx solid #ededed; border-bottom: 2rpx solid #EDEDED;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
@@ -759,7 +803,7 @@
.btn { .btn {
padding: 8rpx 26rpx; padding: 8rpx 26rpx;
border-radius: 36rpx; border-radius: 36rpx;
background: #e8ad7b; background: #E8AD7B;
font-weight: 700; font-weight: 700;
color: #fff; color: #fff;
} }
@@ -774,7 +818,7 @@
border-radius: 0 0 0 24rpx; border-radius: 0 0 0 24rpx;
color: #ed5a2e; color: #ed5a2e;
font-weight: 700; font-weight: 700;
background: #fff; background: #FFF;
overflow: hidden; overflow: hidden;
.share { .share {
@@ -812,7 +856,7 @@
} }
.table { .table {
border: 2rpx solid #ededed; border: 2rpx solid #EDEDED;
border-radius: 8rpx; border-radius: 8rpx;
margin: 0 52rpx; margin: 0 52rpx;
@@ -821,7 +865,7 @@
} }
.row { .row {
border-top: 2rpx solid #ededed; border-top: 2rpx solid #EDEDED;
&:first-child { &:first-child {
border-top: none; border-top: none;
@@ -835,6 +879,6 @@
} }
.guodu { .guodu {
transition: all 0.3s; transition: all .3s;
} }
</style> </style>

View File

@@ -167,7 +167,6 @@
<LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode> <LookQrcode v-model="modalData.show" :qrcode="qrcode"></LookQrcode>
<ymf-share-popup ></ymf-share-popup>
</view> </view>
</template> </template>
@@ -514,9 +513,9 @@
}) })
}) })
onLoad((opt) => { onLoad(() => {
APIusershopInfodetail({ APIusershopInfodetail({
shopId: uni.cache.get('shopId')||opt.shopId shopId: uni.cache.get('shopId')
}).then(res => { }).then(res => {
console.log(res); console.log(res);
shopInfo.value = res.shopInfo shopInfo.value = res.shopInfo

File diff suppressed because it is too large Load Diff

View File

@@ -1,30 +1,5 @@
import {
autoBindInviteUser,
autoGetInviteCode
} from '@/common/api/market/distribution.js'
import {
shareClaim
} from '@/common/api/market/share.js'
import {
APIshopUserInfo,
APIusershopInfodetail
} from '@/common/api/member.js'
import {
productStore
} from '@/stores/user.js';
const accountStore = productStore();
// #ifdef MP-WEIXIN
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
export const envVersion = accountInfo.miniProgram.envVersion; export const envVersion = accountInfo.miniProgram.envVersion;
// #endif
// #ifdef H5
const accountInfo = {};
export const envVersion = 'release'
// #endif
let type = 3; let type = 3;
if (envVersion === 'trial') { if (envVersion === 'trial') {
console.log('当前环境是体验版'); console.log('当前环境是体验版');
@@ -37,314 +12,10 @@ if (envVersion === 'trial') {
console.log('当前环境是开发版或其他'); console.log('当前环境是开发版或其他');
} }
export const pageTags = {
'/userPackage/index/index': 'pp-list', //套餐推广列表页
'/userPackage/goodsDetail/goodsDetail': 'pp-detail', //套餐推广商品详情页
'/groupBuying/index/index': 'gb-list', //商品拼团列表页
'/groupBuying/goodsDetail/goodsDetail': 'gb-detail', //商品拼团详情页
'/distribution/shop-detail/index': 'dis', //全民股东页面
'/pages/index/index': 'index', //店铺首页
'/pages/product/index': 'eat', //点餐页
'/pages/product/index?pTag=eat-detail': 'eat-detail', //点餐商品详情弹窗页
'/scoreShop/index/index':'point' ,//积分商品
'/scoreShop/detail/index':'point-detail' ,//积分商品详情
}
export function returnPageTags(page) {
for (let key in pageTags) {
if (page.includes(key)) {
if (page.includes('/pages/product/index')) {
if (page.includes('showGoodsId=')||page.includes('goodsId=')) {
return 'eat-detail'
} else {
return 'eat'
}
} else {
return pageTags[key]
}
}
}
return ''
}
/**
* 绑定用户邀请关系(核心函数)
* 功能说明:校验邀请码有效性,有效则调用自动绑定接口完成邀请关系绑定
* @param {Object} args - 绑定邀请关系的入参对象
* @param {number} args.fromUserId - 需要绑定邀请人的用户IDinteger <int64>,必填)
* @param {number} args.shopId - 店铺IDinteger <int64>,必填)
* @param {string} args.pTag - 来源页面类型
* @returns {void} 无返回值
*/
export async function bindInvite(args) {
// 解构入参对象,获取需要的核心参数
const {
fromUserId,
shopId,
pTag,
} = args;
console.log('bindInvite',args);
if (!fromUserId || !shopId) {
return;
}
const shopUserInfo = uni.cache.get('shopUserInfo')
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
return await shareClaim({
tagType: pTag || '',
shopId,
fromUserId: fromUserId,
toUserId: shopUserInfo.id
});
}
export function wxShare(par) { export function wxShare(par) {
const path = par.path
const pTag = returnPageTags(path)
if (pTag) {
par.path += '&pTag=' + pTag
par.query += '&pTag=' + pTag
}
console.log('pTag', pTag);
console.log('wxShare', {
...par,
type
});
return { return {
...par, ...par,
type type
} }
} }
export async function returnCommonQuery() {
const shopId = uni.cache.get('shopId')
const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// fromUserId: shopUserInfo.id
// })
const queryJson = {
// inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
shopId,
fromUserId: shopUserInfo.id,
}
return Promise.resolve(queryJson)
}
export function jsonToUrl(json) {
let result = ''
for (let key in json) {
if (json[key]) {
if (result === '') {
result += `${key}=${json[key]}`
} else {
result += `&${key}=${json[key]}`
}
}
}
return result
}
/**
* @param {Object} query 参数对象
* @param {Array} showkeys 需要显示的key不包括公共参数
*/
export async function returnQuery(query, showkeys) {
const shopId = uni.cache.get('shopId')
const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo')
// const inviteCode = await autoGetInviteCode({
// shopId: shopId,
// fromUserId: shopUserInfo.id
// })
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
let sharePath = `/${currentPath}`;
const queryJson = {
// inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
shopId,
fromUserId: shopUserInfo.id,
...query
}
for (const key in currentOptions) {
if (currentOptions.hasOwnProperty(key)) {
if (showkeys && Array.isArray(showkeys) && showkeys.includes(key)) {
queryJson[key] = encodeURIComponent(currentOptions[key])
} else {
queryJson[key] = encodeURIComponent(currentOptions[key])
}
}
}
queryJson.shopId = shopId
// queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
queryJson.fromUserId = shopUserInfo.id
let result = ''
for (let key in queryJson) {
if (queryJson[key]) {
if (result === '') {
result += `${key}=${queryJson[key]}`
} else {
result += `&${key}=${queryJson[key]}`
}
}
}
return Promise.resolve(result)
}
function parseQueryString(queryString) {
const queryParams = queryString.split("&").map((param) => param.split("="));
const params = {};
for (const [key, value] of queryParams) {
params[key] = value;
}
return params;
}
/**
* 混入的 onLoad 核心逻辑(抽成独立函数)
* @param {Object} opt - 页面 onLoad 接收的参数
* @param {Object} vm - 组件实例this
*/
export async function handleMixinOnLoad(opt, vm) {
console.log('onLoad');
const options = {}
if (opt.q) {
const q = decodeURIComponent(opt.q);
const params = parseQueryString(q.split("?")[1]);
Object.assign(options, params);
} else {
Object.assign(options, opt);
}
console.log('options', options);
if (options.shopId) {
uni.cache.set('shopId', options.shopId)
accountStore.shopId = options.shopId
await accountStore.pageOnload()
}
uni.setStorageSync('loadFinsh', true)
if (options.shopId) {
return await bindInvite(options)
}
}
import {
isJsonArrayString
} from '@/utils/util.js';
/**
* 返回店铺首页图片
*/
export function returnIndexBg() {
try {
const orderVIP = uni.cache.get('orderVIP')
if (!orderVIP || !orderVIP.shopExtendList) {
return ''
}
if (!isJsonArrayString(orderVIP.shopExtendList[0].value)) {
return ''
}
return JSON.parse(orderVIP.shopExtendList[0].value)[0]
} catch (error) {
console.error('orderVIP.shopExtendList[0].value 格式不正确')
return ''
//TODO handle the exception
}
}
// utils/share.js
export const shareMixin = {
async onShareAppMessage(res) {
const shopInfo = uni.cache.get('shopInfo')
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
let sharePath = `/${currentPath}`;
let query = await returnQuery()
const indexBg = returnIndexBg()
console.log('indexBg', indexBg);
const imageUrl = indexBg || shopInfo.logo
// 全局默认配置(可被页面覆盖)
const defaultShareConfig = {
title: shopInfo.shopName,
path: sharePath + '?' + query,
imageUrl: imageUrl,
query,
// desc: '描述',
success: (res) => {
console.log('分享好友成功', res);
// 可加埋点等统一逻辑
},
fail: (err) => {
console.error('分享好友失败', err);
}
};
// 页面自定义配置覆盖全局
const pageShareConfig = this.$options.shareConfig || {};
console.log('mixIn onShareAppMessage', {
...defaultShareConfig,
...pageShareConfig
})
return wxShare({
...defaultShareConfig,
...pageShareConfig
});
},
async onShareTimeline() {
const shopInfo = uni.cache.get('shopInfo')
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
let sharePath = `/${currentPath}`;
let query = await returnQuery()
const indexBg = returnIndexBg()
const imageUrl = indexBg || shopInfo.logo
const defaultTimelineConfig = {
title: shopInfo.shopName,
path: sharePath + '?' + query,
imageUrl: imageUrl,
query,
};
const pageTimelineConfig = this.$options.shareTimelineConfig || {};
return wxShare({
...defaultTimelineConfig,
...pageTimelineConfig
});
}
};

View File

@@ -15,7 +15,6 @@ module.exports = defineConfig({
{ {
"@dcloudio/uni-app": [ "@dcloudio/uni-app": [
"onShareAppMessage", "onShareAppMessage",
"onShareTimeline",
"onLoad", "onLoad",
"onShow", "onShow",
"onHide", "onHide",