修复支付未设置密码时关闭支付前需要输入密码未立即生效问题,修复会员页面周期福利弹窗显示问题
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user