修复支付未设置密码时关闭支付前需要输入密码未立即生效问题,修复会员页面周期福利弹窗显示问题

This commit is contained in:
2025-11-13 16:57:13 +08:00
parent bfdd099840
commit 9ee6586e9e
9 changed files with 1185 additions and 370 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,385 @@
<template>
<view class="swiper-content" v-if="visable">
<view class="hander-top p-lr-32 w-s flex-j-sb--a-ct">
<view class="icon-back-wrap" @click="onBack">
<image class="icon-back" src="./images/icon-back.png" mode="widthFix" />
</view>
<view class="count">{{ currentImg + 1 }} / {{ imgs.length }}</view>
</view>
<swiper
class="swiper-img"
:current="currentImg"
:duration="300"
@change="changeSwiper"
>
<swiper-item
class="swiper-item"
v-for="(item, index) in imgs"
:key="index"
>
<view class="img-page">
<movable-area scale-area>
<movable-view
direction="all"
scale="true"
scale-min="1"
scale-max="4"
@click.stop="onBack"
>
<image
@click.stop="()=>{}"
class="max-img"
:src="item"
:lazy-load="true"
mode="aspectFill"
/>
</movable-view>
</movable-area>
</view>
</swiper-item>
</swiper>
<view class="item-bottom" v-if="false">
<scroll-view
class="scroll-view_H"
:scroll-x="true"
:scroll-into-view="scrollTopIndex"
:scroll-with-animation="true"
scroll-left="20"
>
<view
class="img-page-box scroll-view-item_H"
:class="currentImg == index ? 'img-page-checked' : ''"
v-for="(item, index) in imgs"
:key="index"
:id="`scrollToIndex${index}`"
@click.stop="toImg(index)"
>
<image class="img" :src="item" mode="aspectFill" />
</view>
</scroll-view>
</view>
<view class="pop" v-if="isPop">
<view class="item" @click.stop="share()">分享图片</view>
<!-- #ifndef H5 -->
<view class="item" @click.stop="saveImg(false)">保存图片</view>
<view class="item" @click.stop="saveImg(true)">保存全部图片</view>
<!-- #endif -->
</view>
</view>
</template>
<script>
export default {
props: {
imgs: {
type: [],
default: () => [],
},
visable: {
type: Boolean,
default: false,
},
},
emits: ['update:visable'],
data() {
return {
currentImg: 0,
isPop: false,
scrollTopIndex: "",
isScale: false,
isCollect: false,
isLike: false,
};
},
onLoad(options) {
// let { imgs, current } = options;
// this.imgs = JSON.parse(imgs);
// this.currentImg = current;
},
methods: {
changeSwiper(e) {
this.currentImg = e.detail.current;
console.log("e", e);
this.scrollTopIndex = `scrollToIndex${e.detail.current}`;
},
toImg(index) {
this.currentImg = index;
},
onBack() {
this.$emit('update:visable', false);
},
share() {
uni.downloadFile({
// 下面一行时拼接预览PDF的地址
url: this.imgs[this.currentImg],
success: function (res) {
var filePath = res.tempFilePath;
if (!filePath) return;
uni.openDocument({
filePath: filePath,
success: function (res) {
console.log(res);
console.log("打开文档成功");
},
});
},
});
},
saveImg(isAll = false) {
const that = this;
if (!isAll) {
uni.downloadFile({
url: this.imgs[this.currentImg],
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function () {
uni.showToast({
icon: "none",
title: "保存成功",
});
that.isPop = false;
},
fail: function () {},
});
} else {
}
},
});
return;
}
this.imgs.forEach((item) => {
uni.downloadFile({
url: item,
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function () {
uni.showToast({
icon: "none",
title: "保存全部成功",
});
that.isPop = false;
},
fail: function () {},
});
} else {
}
},
});
});
},
},
};
</script>
<style lang="scss" scoped>
.swiper-content {
width: 100vw;
top: 0;
height: 100vh;
position: fixed;
background: #000;
z-index: 99999;
}
movable-view {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
movable-area {
position: fixed;
overflow: hidden;
width: 100%;
height: 100%;
transform: scale();
}
movable-view image {
width: 100%;
}
uni-image > img {
z-index: -1 !important;
}
.hander-top {
position: absolute;
z-index: 1000;
top: 48rpx;
left: 0;
display: flex;
justify-content: space-between;
width: 100%;
padding: 0 32rpx;
box-sizing: border-box;
.icon-back-wrap {
width: 64rpx;
height: 64rpx;
.icon-back {
width: 64rpx;
height: 64rpx;
}
}
.count {
box-sizing: border-box;
padding: 8rpx 24rpx;
color: #fff;
border-radius: 24rpx;
background: rgba(0, 0, 0, 0.4);
font-size: 28rpx;
}
}
.swiper-img {
width: 100vw;
height: 100vh;
background-color: #000;
.swiper-item {
width: 100vw;
height: 100vh;
.img-page {
display: flex;
align-items: center;
width: 100vw;
height: 100vh;
.max-img {
// width: 100%;
// height: 100%;
}
}
}
}
.handle-wrap {
position: absolute;
z-index: 100;
bottom: 40rpx;
left: 0;
width: 100%;
display: flex;
justify-content: space-between;
padding: 32rpx;
box-sizing: border-box;
image {
width: 64rpx;
height: 64rpx;
}
width: 100%;
}
.item-bottom {
position: fixed;
z-index: 9999;
bottom: 110rpx;
left: 0rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 100vw;
// height: 200rpx;
padding: 30rpx;
transition: ease-in-out 0.3s;
}
.small-list-page {
min-height: 60rpx;
}
.scroll-Y {
height: 300rpx;
}
.scroll-view_H {
width: 100%;
box-sizing: border-box;
padding-right: 32rpx;
white-space: nowrap;
}
.scroll-view-item_H {
display: inline-block;
margin-right: 10rpx;
transition: ease-in 0.1s;
transform: scale(0.8);
border-radius: 11rpx;
background: #c2c2c2;
&:last-child {
margin-right: 0;
}
.img {
display: block;
width: 160rpx;
height: 272rpx;
}
}
.img-page-checked {
transform: translateY(-28rpx) scale(1);
}
.pop {
position: fixed;
z-index: 999999;
top: 50%;
left: 50%;
overflow: hidden;
width: 500rpx;
transform: translate(-50%, -50%);
border-radius: 20rpx;
background-color: #fff;
.item {
height: 100rpx;
padding: 0 50rpx;
transition: all 0.2s;
border-radius: 20rpx;
line-height: 100rpx;
&:active {
background-color: #eee;
}
}
}
</style>

View File

@@ -413,7 +413,7 @@ import { onShow, onBackPress } from "@dcloudio/uni-app";
import { onHide } from "@dcloudio/uni-app";
// 输入支付密码
const ispws = ref(false);
const userInfo = uni.cache.get("userInfo");
let userInfo = uni.cache.get("userInfo");
// 会员信息
const orderVIP = ref(uni.cache.get("orderVIP"));
@@ -891,8 +891,10 @@ const goToPay = async (payParams) => {
}
return;
}
// 余额支付
if (payParams.payType == "accountPay") {
console.log("orderVIP.value", orderVIP.value);
if (orderVIP.value.payPwd == "" &&userInfo.usePayPwd) {
uni.showModal({
title: "提示",
@@ -1032,6 +1034,7 @@ function closeSocket() {
}
onShow(() => {
userInfo = uni.cache.get("userInfo");
if (cartsSocket) {
cartsSocket.connect();
}

View File

@@ -0,0 +1,251 @@
<template>
<up-popup :show="visible" :round="20" mode="bottom" @close="close">
<view class="shop_sku">
<scroll-view scroll-y style="max-height: 60vh; width: 100%">
<view class="positionabsolute">
<up-icon
name="close-circle"
@click="close"
color="#000"
size="25"
></up-icon>
</view>
<up-swiper :list="specifications.item.images" height="250"></up-swiper>
<view class="shop_sku_name">{{ specifications.item.name }}</view>
<view class="shop_sku_description">
{{
specifications.item.shortTitle ? specifications.item.shortTitle : ""
}}
</view>
<view v-if="specifications.item.type != 'package'">
<view
class="shop_sku_box"
v-for="(specOptions, specType) in specifications.item
.selectSpecInfo"
:key="specType"
>
<view class="shop_sku_box_name">
{{ specType }}
</view>
<view class="flex-start">
<view
class="shop_sku_box_item"
v-for="option in specOptions"
:key="option"
@click="selectSpec(specType, option)"
:class="{
shop_sku_box_item_selected: isSelected(option),
}"
>
{{ option }}
<view
class="shop_sku_box_item_tip"
v-if="
specifications.item.result &&
specifications.item.result.isSoldStock == 1 &&
selectedSpecs[specType] === option
"
>
<view>售罄</view>
</view>
<view
class="shop_sku_box_item_tip"
v-if="
specifications.item.result == 'kong' &&
canSubmit == false &&
selectedSpecs[specType] === option
"
>
<view>已下架</view>
</view>
</view>
</view>
</view>
</view>
<!-- 套餐 -->
<view v-else>
<view class="shop_sku_box">
<view
v-for="(setmenu, setmenuindex) in specifications.item.groupSnap"
:key="setmenuindex"
>
<view class="shop_sku_box_name"
>{{ setmenu.title }} {{ setmenu.count }} 选{{
setmenu.number
}}</view
>
<view class="flex-start">
<view
class="shop_sku_box_item"
v-for="(option, goodsid) in setmenu.goods"
:key="goodsid"
@click="goodsidClick(setmenuindex, option, goodsid)"
:class="{
shop_sku_box_item_selected: isOptionSelected(
setmenuindex,
option
),
}"
:disabled="
isMaxSelected(setmenuindex) &&
!isOptionSelected(setmenuindex, option)
"
>
{{ option.proName }}
<text v-if="option.unitName">/{{ option.unitName }}</text>
<view
class="shop_sku_box_item_tip"
v-if="specifications.item.isSoldStock == 1"
>
<view>售罄</view>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="shop_bottom">
<view class="flex-between">
<view
class="price"
v-if="
specifications.item.type != 'package' &&
specifications.item.result
"
>
<text class="i">¥</text>
<view class="num">
<GoodsPrice
:limitDiscount="limitTimeDiscountRes"
:cart="specifications.item.result"
:shopUserInfo="shopUserInfo"
:shopInfo="shopInfo"
></GoodsPrice>
</view>
<text class="num" v-if="false">
{{
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
? specifications.item.result.memberPrice ||
specifications.item.result.salePrice
: specifications.item.result.salePrice
}}
</text>
<text class="i" v-if="specifications.item.unitName"
>/{{ specifications.item.unitName }}</text
>
<text v-if="specifications.item.result.suitNum > 1"
>「{{ specifications.item.result.suitNum
}}{{ specifications.item.result.unitName }}起点」</text
>
</view>
<view class="price" v-else>
<text class="i">¥</text>
<view class="num">
<GoodsPrice
:limitDiscount="limitTimeDiscountRes"
:cart="specifications.item"
:shopUserInfo="shopUserInfo"
:shopInfo="shopInfo"
></GoodsPrice>
</view>
<text class="num" v-if="false">
{{
shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
? specifications.item.memberPrice ||
specifications.item.salePrice
: specifications.item.salePrice
}}
</text>
<text class="i" v-if="specifications.item.unitName"
>/{{ specifications.item.unitName }}</text
>
<text v-if="specifications.item.suitNum > 1"
>「{{ specifications.item.suitNum
}}{{ specifications.item.unitName }}起点」</text
>
</view>
<view
class="operation-wrap"
v-if="specifications.item.type != 'package'"
>
<view class="btn">
<up-icon
name="minus-circle-fill"
color="#E9AB7A"
size="25"
v-if="shopCartNumber > 0"
></up-icon>
<view class="btnClick" @click="shopCart('-')"></view>
</view>
<text class="num">{{ shopCartNumber }}</text>
<view class="btn">
<up-icon
name="plus-circle-fill"
color="#E9AB7A"
size="25"
></up-icon>
<view class="btnClick" @click="shopCart('+')"></view>
</view>
</view>
</view>
<view class="shop_skuselect flex-start" v-if="selectedSpecsStr">
<view class="shop_skuselectname">{{ selectedSpecsStr }}</view>
</view>
<view
v-if="specifications.item.type == 'package'"
class="addShopping"
:class="shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
<view
v-else
class="addShopping"
:class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
</view>
</view>
</up-popup>
</template>
<script setup>
import { ref } from "vue";
const props = defineProps({
data: {
type: Object,
default: () => {},
},
specifications: {
type: Object,
default: () => {
return {
item: {},
}
},
},
});
const visible = defineModel({
default: false,
});
function close() {
visible.value = false;
}
const selectedSpecs = ref({});
function isSelected(option) {
return selectedSpecs.value[specType] === option;
}
</script>
<style scoped lang="scss">
.box {
width: 100%;
height: 200px;
background-color: #f5f5f5;
}
</style>

View File

@@ -65,6 +65,7 @@
>限时折扣</view
>
<image
@click.stop="getImgs(item)"
class="panelfiveitemimage"
:src="item.coverImg"
mode="aspectFill"
@@ -318,6 +319,7 @@
>
<image
class="goodsImg"
@click.stop="getImgs(item1)"
v-if="item1.coverImg != null"
:lazy-load="true"
@load="imageLoaded(item1, index, index1)"
@@ -335,6 +337,7 @@
v-else
:lazy-load="true"
></image>
<view
class="vifgoodsImg"
v-if="
@@ -595,10 +598,24 @@
</view>
<up-swiper
:list="specifications.item.images"
@change="swiperChange"
:current="swiperCurrent"
radius="6px"
height="250"
></up-swiper>
@click="
prveImgs(
specifications.item.images,
specifications.item.images[swiperCurrent]
)
"
>
<!-- <template v-slot:default="{item}">
<image :src=item></image>
</templte> -->
</up-swiper>
<view class="shop_sku_name">{{ specifications.item.name }}</view>
<view class="shop_sku_description">
<view class="shop_sku_description" v-if="isSkuGoods">
{{
specifications.item.shortTitle
? specifications.item.shortTitle
@@ -622,8 +639,7 @@
:key="option"
@click="selectSpec(specType, option)"
:class="{
shop_sku_box_item_selected:
selectedSpecs[specType] === option,
shop_sku_box_item_selected: isSkuSelected(specType, option),
}"
>
{{ option }}
@@ -783,24 +799,35 @@
<view class="shop_skuselect flex-start" v-if="selectedSpecsStr">
<view class="shop_skuselectname">{{ selectedSpecsStr }}</view>
</view>
<view
v-if="specifications.item.type == 'package'"
class="addShopping"
:class="
shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''
"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
<view
v-else
class="addShopping"
:class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
<template v-if="isSkuGoods">
<view
v-if="specifications.item.type == 'package'"
class="addShopping"
:class="
shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''
"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
<view
v-else
class="addShopping"
:class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
</template>
<template v-else>
<view
class="addShopping"
:class="shopCartNumber > 0 ? 'active' : ''"
@click="submitSelection()"
>
{{ skuBtnText }}
</view>
</template>
</view>
</view>
</up-popup>
@@ -818,10 +845,17 @@
v-if="isDataLoaded"
@onBuyClick="onBuyClick"
></recommendGoodsModal>
<goodsModal></goodsModal>
<xbSwiperPreview
:visable="showPrveImg"
:imgs="prveImgsList"
@update:visable="showPrveImg = $event"
></xbSwiperPreview>
</view>
</template>
<script setup>
import xbSwiperPreview from "@/components/xb-swiper-preview/index.vue";
//价格计算辅助函数
import * as orderUtils from "@/utils/order-utils.js";
import BigNumber from "bignumber.js";
@@ -854,6 +888,7 @@ import {
//导航栏
import Nav from "@/components/CustomNavbar.vue";
import shopindex from "./components/shopindex.vue";
import goodsModal from "./components/goods-modal.vue";
import shoppingCartes from "./components/shoppingCartes.vue";
import confirmorder from "./components/confirmorder.vue";
import Loading from "@/components/Loading.vue";
@@ -956,6 +991,11 @@ Object.assign(shopInfo, uni.cache.get("shopInfo"));
const shopTable = uni.cache.get("shopTable");
const distance = uni.cache.get("distance"); //距离
const swiperCurrent = ref(0);
function swiperChange(e) {
swiperCurrent.value = e.current;
}
//店铺详情
const showShopInfoRef = ref(null);
@@ -1136,6 +1176,10 @@ const allSpecsSelected = computed(() => {
return specKeys.every((key) => selectedSpecs.value[key]);
});
function isSkuSelected(specType, option) {
return selectedSpecs.value[specType] === option;
}
// 处理规格选择的方法
const selectSpec = async (specType, option) => {
// 规格清零
@@ -1260,13 +1304,24 @@ const selectedSpecsStr = computed(() => {
//添加购物车数量
const shopCartNumber = ref(0);
// 多规格 套餐添加数量
// 多规格 套餐 单规格添加数量
const shopCart = async (i) => {
if (i == "-" && shopCartNumber.value >= 0) {
shopCartNumber.value = 0;
return false;
}
let res = await shoppingcart();
// if (!isSkuGoods.value) {
// console.log("specifications.item", specifications.item);
// if (i == "-") {
// shopCartNumber.value--;
// } else {
// shopCartNumber.value++;
// }
// specifications.item.cartNumber = shopCartNumber.value;
// singleclick(specifications.item, i);
// return;
// }
if (i == "-") {
if (!res && shopCartNumber.value == specifications.item.suitNum) {
uni.showToast({
@@ -1386,11 +1441,14 @@ const shoppingcart = async () => {
}
);
res = await matchingProduct(selectedGroupSnap.value);
} else {
} else if (specifications.item.type == "sku") {
if (!canSubmit.value) {
return false;
}
res = await matchingProduct(specifications.item.result);
} else {
// 单规格
res = await matchingProduct(specifications.item);
}
return res;
};
@@ -1414,12 +1472,12 @@ const submitSelection = async () => {
if (shopCartNumber.value <= 0) {
return;
}
let res = await shoppingcart();
if (
(specifications.item.type == "package" && allConditionsSatisfied.value) ||
(specifications.item.type == "sku" && canSubmit.value)
) {
let res = await shoppingcart();
// 是否是套餐 有就传
if (specifications.item.type == "package") {
// 需求更改:所所有商品套餐都是add,没有修改
@@ -1427,7 +1485,7 @@ const submitSelection = async () => {
} else {
selectedGroupSnap.value = [];
}
console.log('specifications.item', specifications.item);
console.log("specifications.item", specifications.item);
websocketsendMessage({
id: res ? res.cartListId : "",
type: "shopping",
@@ -1451,25 +1509,84 @@ const submitSelection = async () => {
selectedGroupSnap.value = [];
showShopsku.value = false;
} else {
websocketsendMessage({
id: res ? res.cartListId : "",
type: "shopping",
suitNum: specifications.productListitem.suitNum,
table_code: uni.cache.get("tableCode"),
shop_id: uni.cache.get("shopId"),
operate_type: res ? "edit" : "add",
product_id: specifications.product_id,
sku_id: specifications.sku_id,
number: res
? await calculateValue(res.cartNumber, "+", shopCartNumber.value)
: shopCartNumber.value,
memberPrice: specifications.item.memberPrice,
is_print: 1,
product_type: specifications.item.type,
is_time_discount: specifications.item.is_time_discount,
});
showShopsku.value = false;
return;
}
};
//获取多规格数据
const clickspecifications = async (item, index, indexs, type) => {
console.log(item);
// 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
//返回是否是多规格商品
function returnIsSkuGoods(item) {
if (
item.isSoldStock == 1 ||
(item.isSaleTime == 0 && !item.isSaleTimeshow) ||
item.type == "single" ||
item.type == "weight" ||
(item.type == "package" && item.groupType == "0")
) {
return false;
}
// 数量清零
return true;
}
const isSkuGoods = computed(() => {
return returnIsSkuGoods(specifications.item);
});
//预览图
const showPrveImg = ref(false);
const prveImgsList = ref([]);
function prveImgs(images) {
prveImgsList.value = images;
showPrveImg.value = true;
return;
uni.previewImage({
urls: images,
current: swiperCurrent.value,
});
}
async function getImgs(item) {
let res = await APIminiAppinfo(item.id);
prveImgs(res.images);
}
//获取多规格数据
const clickspecifications = async (item, index, indexs, type) => {
console.log(item);
// 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
// if (
// item.isSoldStock == 1 ||
// (item.isSaleTime == 0 && !item.isSaleTimeshow) ||
// item.type == "single" ||
// item.type == "weight" ||
// (item.type == "package" && item.groupType == "0")
// ) {
// return false;
// }
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
return false;
}
shopCartNumber.value = 0;
// 数量清零
// 初始化
let data = {
item: item,
@@ -1485,12 +1602,23 @@ const clickspecifications = async (item, index, indexs, type) => {
// skuBtnText.value = '请选择规格'
// single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
let res = await APIminiAppinfo(item.id);
specifications.item = {...res,is_time_discount:item.is_time_discount};
console.log("res", res);
console.log("item", item);
specifications.item = {
...res,
...item,
product_id: res.id,
sku_id: item.skuId,
};
if (specifications.item.type == "package") {
selectedOptions.value = [];
specifications.product_id = res.id;
specifications.sku_id = item.skuId;
shopCartNumber.value = 1;
} else {
specifications.product_id = res.id || specifications.item.product_id;
specifications.sku_id = item.skuId || specifications.item.sku_id;
}
// 购物车是否有商品
specifications.type = res.type;
@@ -1548,6 +1676,7 @@ const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
// 单规格
const singleclick = async (item, i) => {
console.log("单规格商品点击事件:", item, i);
if (!isProductAvailable(item.days, item.startTime, item.endTime)) {
uni.showToast({
title: "不在可售时间内",
@@ -1962,7 +2091,11 @@ const totalPrices = computed(() => {
}
});
}
if (limitTimeDiscountRes.value && limitTimeDiscountRes.value.id && item.is_time_discount==1) {
if (
limitTimeDiscountRes.value &&
limitTimeDiscountRes.value.id &&
item.is_time_discount == 1
) {
//限时折扣
const price = orderUtils.returnPrice({
goods: item,
@@ -1974,7 +2107,10 @@ const totalPrices = computed(() => {
return total + parseFloat(price) * parseFloat(item.cartNumber);
}
// 是否启用会员价 0否1是
if (shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1) {
if (
shopUserInfo.value.isVip == 1 &&
shopUserInfo.value.isMemberPrice == 1
) {
// memberPrice会员价
return (
total +
@@ -2221,12 +2357,12 @@ onShow(async () => {
onHide(() => {
console.log("product index onHide");
useSocket.closeSocket();
useSocket.setOnMessage(()=>{});
useSocket.setOnMessage(() => {});
});
onUnload(() => {
console.log("product index onUnload");
useSocket.closeSocket();
useSocket.setOnMessage(()=>{});
useSocket.setOnMessage(() => {});
});
onMounted(async () => {
@@ -2237,6 +2373,7 @@ onMounted(async () => {
const currentPage = pages[pages.length - 1];
// 获取页面参数
const options = currentPage.options;
console.log("onMounted", options);
let res = await APIhistoryOrder({
tableCode: uni.cache.get("tableCode"),
});
@@ -2882,7 +3019,7 @@ function toHistory() {
border-radius: 20rpx;
background: #fff;
box-sizing: border-box;
padding-bottom: 250rpx;
padding-bottom: 200rpx;
.positionabsolute {
position: absolute;

View File

@@ -1,11 +1,11 @@
<template>
<view class="u-p-30">
<birthdayGift></birthdayGift>
<xb-swiper-preview></xb-swiper-preview>
</view>
</template>
<script setup>
import birthdayGift from "@/components/birthday-modal.vue";
import xbSwiperPreview from '@/components/xb-swiper-preview/index.vue'
</script>
<style lang="scss" scoped>

View File

@@ -1,338 +1,373 @@
<template>
<view class="Box">
<view class="box_box">
<!-- <view class="box_item flex-between">
<view class="Box">
<view class="box_box">
<!-- <view class="box_item flex-between">
<text class="top_box_one_text">当前账号</text>
<input type="number" v-model="form.mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
<button v-if="!form.mobile" class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<view class="text">获取手机号</view>
</button>
</view> -->
<view class="u-flex">
<view class="u-p-r-40">
<view class="color-333 font-16 font-700">密码支付</view>
<view class="font-12 color-999 u-m-t-4">关闭时使用余额支付将会直接扣除不再进行确认</view>
</view>
<up-switch v-model="form.usePayPwd" active-color="#FFD158" :inactive-value="0" @change="usePayPwdChange"
:active-value="1"></up-switch>
</view>
<view class="color-333 font-16 font-700" style="margin-top: 60rpx;">密码支付</view>
<view class="box_item flex-between">
<text class="top_box_one_text">当前账号</text>
<input type="number" v-model="form.mobile" placeholder="请输入手机号" maxlength="11" :disabled="false" />
<view class="top_box_one_texts">
<view v-if="datalist.showText == true" class="yzm" @click="CodeRegister">{{ datalist.Recapture }}
</view>
<view v-else style="color: #ccc; background-color: #f9f9f9; border-radius:16px; padding: 10rpx;">
{{ datalist.second }}s重新发送
</view>
</view>
</view>
<view class="box_item flex-between" style="position:relative;">
<text class="top_box_one_text"></text>
<input type="number" v-model="form.checkCode" placeholder="请输入验证码"
style="padding-right: 140rpx;color: #333" />
</view>
<view class="box_item flex-between">
<text class="top_box_one_text">新密码</text>
<input type="number" v-model="form.password" placeholder="请输入6位数字交易密码" maxlength="6"
:password="!passwords" />
</view>
<view class="box_item flex-between">
<text class="top_box_one_text">确认密码</text>
<input type="number" v-model="form.payPassword" placeholder="请再次输入密码" maxlength="6"
:password="!payPasswords" />
</view>
</view>
<view class="flex-colum">
<view class="Box_bottom active"
@click="userInfosavePayPassword">重置密码</view>
</view>
</view>
<view class="u-flex">
<view class="u-p-r-40">
<view class="color-333 font-16 font-700">密码支付</view>
<view class="font-12 color-999 u-m-t-4"
>关闭时使用余额支付将会直接扣除不再进行确认</view
>
</view>
<up-switch
v-model="form.usePayPwd"
active-color="#FFD158"
:inactive-value="0"
@change="usePayPwdChange"
:active-value="1"
></up-switch>
</view>
<view class="color-333 font-16 font-700" style="margin-top: 60rpx"
>密码支付</view
>
<view class="box_item flex-between">
<text class="top_box_one_text">当前账号</text>
<input
type="number"
v-model="form.mobile"
placeholder="请输入手机号"
maxlength="11"
:disabled="false"
/>
<view class="top_box_one_texts">
<view
v-if="datalist.showText == true"
class="yzm"
@click="CodeRegister"
>{{ datalist.Recapture }}
</view>
<view
v-else
style="
color: #ccc;
background-color: #f9f9f9;
border-radius: 16px;
padding: 10rpx;
"
>
{{ datalist.second }}s重新发送
</view>
</view>
</view>
<view class="box_item flex-between" style="position: relative">
<text class="top_box_one_text"></text>
<input
type="number"
v-model="form.checkCode"
placeholder="请输入验证码"
style="padding-right: 140rpx; color: #333"
/>
</view>
<view class="box_item flex-between">
<text class="top_box_one_text">新密码</text>
<input
type="number"
v-model="form.password"
placeholder="请输入6位数字交易密码"
maxlength="6"
:password="!passwords"
/>
</view>
<view class="box_item flex-between">
<text class="top_box_one_text">确认密码</text>
<input
type="number"
v-model="form.payPassword"
placeholder="请再次输入密码"
maxlength="6"
:password="!payPasswords"
/>
</view>
</view>
<view class="flex-colum">
<view class="Box_bottom active" @click="userInfosavePayPassword"
>重置密码</view
>
</view>
</view>
</template>
<script setup>
import {
reactive,
onMounted
} from 'vue';
import { reactive, onMounted } from "vue";
import {
APIuserpwd,
APIusercode
} from '@/common/api/api.js'
import {
APIshopUserInfo
} from '@/common/api/member.js'
import { APIuserpwd, APIusercode } from "@/common/api/api.js";
import { APIshopUserInfo } from "@/common/api/member.js";
import {
productStore
} from '@/stores/user.js';
import {APIuser} from '@/common/api/api.js'
const storeuser = productStore();
const shopUserInfo = reactive({
shopInfo: uni.cache.get('orderVIP'),
shopId: ''
})
const userInfo=uni.cache.get('userInfo')
import { productStore } from "@/stores/user.js";
import { APIuser } from "@/common/api/api.js";
const storeuser = productStore();
const shopUserInfo = reactive({
shopInfo: uni.cache.get("orderVIP"),
shopId: "",
});
const form = reactive({
mobile: uni.cache.get('orderVIP').phone,
password: '',
payPassword: '',
checkCode: '',
usePayPwd: userInfo.usePayPwd
})
const userInfo = uni.cache.get("userInfo");
const datalist = reactive({
isPwd: "",
passwords: false,
payPasswords: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: '获取验证码',
})
const form = reactive({
mobile: uni.cache.get("orderVIP").phone,
password: "",
payPassword: "",
checkCode: "",
usePayPwd: userInfo.usePayPwd,
});
const CodeRegister = async () => {
console.log('CodeRegister');
const res = await APIusercode({
// post 手机验证码
phone: form.mobile
});
if (res) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
// 定时器
datalist.showText = false;
datalist.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --datalist.second;
datalist.second = times < 10 ? '0' + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
datalist.second = 60;
datalist.showText = true;
}, 60000);
}
}
const datalist = reactive({
isPwd: "",
passwords: false,
payPasswords: false,
// 注册定时器 初始值
second: 60,
showText: true,
Recapture: "获取验证码",
});
/**
* 获取手机号
* @param {Object} d
*/
const getPhone = async (d) => {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
// form.mobile = res ? (res.slice(0, 3) + '****' + res.slice(7)) : '';
form.mobile = res
}
})
}
}
const loginwxuserInfo = async () => {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
}
const CodeRegister = async () => {
console.log("CodeRegister");
const res = await APIusercode({
// post 手机验证码
phone: form.mobile,
});
if (res) {
uni.showToast({
title: "验证码获取成功",
icon: "none",
});
// 定时器
datalist.showText = false;
datalist.Recapture = "重新获取";
var interval = setInterval(() => {
let times = --datalist.second;
datalist.second = times < 10 ? "0" + times : times; //小于10秒补 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
datalist.second = 60;
datalist.showText = true;
}, 60000);
}
};
const userInfosavePayPassword = async () => {
if (form.mobile.length != 11) {
uni.showToast({
title: '手机号必须是11位',
icon: 'none'
});
return false;
}
if (form.password == null || form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (form.payPassword == null || form.payPassword == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (form.password.length != 6 || form.payPassword.length != 6) {
uni.showToast({
title: '密码必须是6位',
icon: 'none'
});
return false;
}
if (form.payPassword != form.password) {
uni.showToast({
title: '密码和确认密码不一致',
icon: 'none'
});
return false;
}
if (form.checkCode == null || form.checkCode == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
/**
* 获取手机号
* @param {Object} d
*/
const getPhone = async (d) => {
if (d.detail.iv) {
uni.login({
provider: "weixin",
success: async (data) => {
console.log(data);
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
});
// form.mobile = res ? (res.slice(0, 3) + '****' + res.slice(7)) : '';
form.mobile = res;
},
});
}
};
const loginwxuserInfo = async () => {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get("userInfo").id,
});
if (res.code == 0) {
uni.cache.set("userInfo", res.data);
}
};
let res = await APIuserpwd({
checkPayPwd: form.payPassword,
payPwd: form.password,
code: form.checkCode,
usePayPwd:form.usePayPwd
})
// * 获取会员信息
await storeuser.actionsproductqueryProduct()
if (res) {
uni.navigateBack()
}
}
async function usePayPwdChange(){
uni.showLoading()
await APIuserpwd({
usePayPwd:form.usePayPwd
})
uni.showToast({
title:'修改成功'
})
}
onMounted(()=>{
APIuser().then(res=>{
uni.cache.set('userInfo', res);
form.usePayPwd=res.usePayPwd
})
})
const userInfosavePayPassword = async () => {
if (form.mobile.length != 11) {
uni.showToast({
title: "手机号必须是11位",
icon: "none",
});
return false;
}
if (form.password == null || form.password == "") {
uni.showToast({
title: "请输入密码",
icon: "none",
});
return false;
}
if (form.payPassword == null || form.payPassword == "") {
uni.showToast({
title: "请输入确认密码",
icon: "none",
});
return false;
}
if (form.password.length != 6 || form.payPassword.length != 6) {
uni.showToast({
title: "密码必须是6位",
icon: "none",
});
return false;
}
if (form.payPassword != form.password) {
uni.showToast({
title: "密码和确认密码不一致",
icon: "none",
});
return false;
}
if (form.checkCode == null || form.checkCode == "") {
uni.showToast({
title: "请输入验证码",
icon: "none",
});
return false;
}
let res = await APIuserpwd({
checkPayPwd: form.payPassword,
payPwd: form.password,
code: form.checkCode,
usePayPwd: form.usePayPwd,
});
// * 获取会员信息
await storeuser.actionsproductqueryProduct();
if (res) {
const userInfo = uni.cache.get("userInfo");
const orderVIP = uni.cache.get("orderVIP");
uni.cache.set("userInfo", { ...userInfo, usePayPwd: form.usePayPwd });
uni.cache.set("orderVIP", { ...orderVIP, payPwd: 'abcd' });
uni.navigateBack();
}
};
async function usePayPwdChange() {
uni.showLoading();
const res = await APIuserpwd({
usePayPwd: form.usePayPwd,
});
if (res) {
const userInfo = uni.cache.get("userInfo");
uni.cache.set("userInfo", { ...userInfo, usePayPwd: form.usePayPwd });
uni.showToast({
title: "修改成功",
});
}
}
onMounted(() => {
APIuser().then((res) => {
uni.cache.set("userInfo", res);
form.usePayPwd = res.usePayPwd;
});
});
</script>
<style lang="scss" scoped>
.Box {
padding: 80rpx 28rpx 28rpx;
.Box {
padding: 80rpx 28rpx 28rpx;
.box_one {
margin-top: 26rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.box_one {
margin-top: 26rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.box_box {
background: #fff;
.box_box {
background: #fff;
.box_item {
// border-bottom: 1rpx solid #E5E5E5;
position: relative;
.box_item {
// border-bottom: 1rpx solid #E5E5E5;
position: relative;
.top_box_one_text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
.top_box_one_text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
input {
padding: 26rpx 0;
width: 75%;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333;
}
input {
padding: 26rpx 0;
width: 75%;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333;
}
.top_box_one_texts {
position: absolute;
right: 0;
margin: auto;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
z-index: 100;
.yzm {
padding: 8rpx 20rpx;
background: #ffd158;
border-radius: 24rpx;
font-weight: 500;
font-size: 24rpx;
color: #5f2e0f;
}
}
}
.top_box_one_texts {
position: absolute;
right: 0;
margin: auto;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
z-index: 100;
.yzm {
padding: 8rpx 20rpx;
background: #FFD158;
border-radius: 24rpx;
font-weight: 500;
font-size: 24rpx;
color: #5F2E0F;
}
}
}
.box_item:nth-child(1) {
border-bottom: none;
border-top: 1rpx solid #e5e5e5;
.box_item:nth-child(1) {
border-bottom: none;
border-top: 1rpx solid #E5E5E5;
input {
border-bottom: 1rpx solid #e5e5e5;
color: #333;
}
}
}
input {
border-bottom: 1rpx solid #E5E5E5;
color: #333;
}
}
}
.flex-colum {
width: 100%;
margin-top: 56rpx;
.Box_bottom {
width: 100%;
height: 96rpx;
line-height: 96rpx;
background-color: #ffd158;
border-radius: 48rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 500;
color: #333;
text-align: center;
}
}
.flex-colum {
width: 100%;
margin-top: 56rpx;
.Box_bottom {
width: 100%;
height: 96rpx;
line-height: 96rpx;
background-color: #FFD158;
border-radius: 48rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 500;
color: #333;
text-align: center;
}
}
.getPhone {
line-height: initial;
background-color: none;
border: 2rpx solid #E3AD7F;
color: #E3AD7F;
font-size: 28rpx;
padding: 5rpx 10rpx;
position: absolute;
right: 10rpx;
z-index: 2;
}
}
.Box .box_box .box_item uni-input{
border-bottom: 1rpx solid #E5E5E5;
}
.Box .box_box .box_item input{
border-bottom: 1rpx solid #E5E5E5;
}
:deep(.Box .box_box .box_item uni-input){
border-bottom: 1rpx solid #E5E5E5;
}
.getPhone {
line-height: initial;
background-color: none;
border: 2rpx solid #e3ad7f;
color: #e3ad7f;
font-size: 28rpx;
padding: 5rpx 10rpx;
position: absolute;
right: 10rpx;
z-index: 2;
}
}
.Box .box_box .box_item uni-input {
border-bottom: 1rpx solid #e5e5e5;
}
.Box .box_box .box_item input {
border-bottom: 1rpx solid #e5e5e5;
}
:deep(.Box .box_box .box_item uni-input) {
border-bottom: 1rpx solid #e5e5e5;
}
</style>

View File

@@ -182,8 +182,9 @@
}
if (name == '周期福利') {
model.title = '周期福利'
let couponLen=memberLevel.value.cycleRewardCouponList?memberLevel.value.cycleRewardCouponList.length:0
modelContent.value =
`${memberLevel.value.cycleUnit}赠送${memberLevel.value.cycleRewardPoints}积分,${memberLevel.value.cycleRewardCouponList.length}张优惠券`
`${memberLevel.value.cycleUnit}赠送${memberLevel.value.cycleRewardPoints}积分${couponLen?(','+couponLen+'张优惠券'):''}`
}
if (name == '会员说明') {
model.title = '会员说明'

View File

@@ -13,7 +13,7 @@
<view class="lv">{{ memberLevel ? memberLevel.name : '' }}</view>
<view class="time" v-if="shopUserInfo.openType == 'PAY'">
<text>{{ memberLevel ? dayjs(memberLevel.endTime).format('YYYY-MM-DD') : '' }}到期</text>
<text style="margin-left: 8px;">{{ memberLevel ? memberLevel.memberName : '' }}</text>
<text style="margin-left: 8px;">{{ memberLevel ? memberLevel.memberCircleName : '' }}</text>
</view>
<view class="rule u-m-t-40 u-flex u-flex-between u-flex-y-center">
<text class="color-one">
@@ -235,6 +235,27 @@
const res = await vipApi.config({
shopId: shopId
});
const res1 = await vipApi.detail({
shopId: shopId
});
if (res1) {
memberLevel.value = {
...res1.memberLevel,
endTime: res1.endTime,
memberName: res1.memberName,
experience: res1.experience,
nextExperienceValue: res1.nextExperienceValue,
memberCircleName:res1.memberCircleName,
memberCircleReward:res1.memberCircleReward,
};
const total = res1.experience * 1 + res1.nextExperienceValue * 1;
const percent = ((res1.experience * 1) / total) * 100;
if (total <= 0 || res1.experience * 1 <= 0) {
expProgress.value = 100;
}
expProgress.value = percent;
}
if (res) {
res.memberLevel.cycleRewardCouponList = res.memberLevel.cycleRewardCouponList || []
res.memberLevel = res.memberLevel || {}
@@ -254,7 +275,7 @@
return true
}).map((v) => {
if (v.name == '赠送成长值' && res.memberLevel) {
v.desc = `赠送${res.memberLevel.experienceValue}成长值`
v.desc = `赠送${memberLevel.value.memberCircleReward}成长值`
}
if (v.name == '优惠券') {
if (res.memberLevel.cycleRewardCouponList.length) {
@@ -301,24 +322,6 @@
menus.value = tiaojian_menus;
}
}
const res1 = await vipApi.detail({
shopId: shopId
});
if (res1) {
memberLevel.value = {
...res1.memberLevel,
endTime: res1.endTime,
memberName: res1.memberName,
experience: res1.experience,
nextExperienceValue: res1.nextExperienceValue
};
const total = res1.experience * 1 + res1.nextExperienceValue * 1;
const percent = ((res1.experience * 1) / total) * 100;
if (total <= 0 || res1.experience * 1 <= 0) {
expProgress.value = 100;
}
expProgress.value = percent;
}
}
const nextName = computed(() => {