uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改
This commit is contained in:
@@ -159,7 +159,7 @@ async function getHandle() {
|
||||
const res = await receivePopUp({
|
||||
getMode: props.getMode
|
||||
});
|
||||
show.value = false;
|
||||
close()
|
||||
uni.showToast({
|
||||
title: '已领取,请在我的优惠券中查看',
|
||||
icon: 'none'
|
||||
|
||||
@@ -60,7 +60,7 @@ function close() {
|
||||
emit("close");
|
||||
}
|
||||
const drainageConfig = ref({});
|
||||
onMounted(async () => {
|
||||
async function getDrainageConfig() {
|
||||
const shopId = uni.cache.get("shopId");
|
||||
const drainageConfigRes = await drainageConfigApi.config({
|
||||
shopId: shopId,
|
||||
@@ -71,7 +71,18 @@ onMounted(async () => {
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
// onMounted(() => {
|
||||
// getDrainageConfig();
|
||||
// });
|
||||
watch(
|
||||
() => showPreview.value,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
getDrainageConfig();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 生成公众号二维码 -->
|
||||
<we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode>
|
||||
<officialAccount
|
||||
followIndex="eat"
|
||||
:wechatAcQrcode="wechatAcQrcode"
|
||||
v-if="showOfficialAccount"
|
||||
@close="modelClose($event, 'officialAccount')"
|
||||
/>
|
||||
@@ -9,10 +13,15 @@
|
||||
getMode="eat"
|
||||
@close="modelClose($event, 'coupon')"
|
||||
/>
|
||||
<birthdayGift v-if="showBirthdayGift" @close="modelClose($event, 'birthdayGift')" />
|
||||
<birthdayGift
|
||||
v-if="showBirthdayGift"
|
||||
@close="modelClose($event, 'birthdayGift')"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import weQrcode from "@/components/wechat-ac-qrcode.vue";
|
||||
|
||||
import { ref, watch, computed, reactive, toRaw } from "vue";
|
||||
import couponModal from "@/components/coupon-modal.vue";
|
||||
import birthdayGift from "@/components/birthday-modal.vue";
|
||||
@@ -38,4 +47,12 @@ function modelClose(e, type) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
const wechatAcQrcode = ref("");
|
||||
const userinfo = uni.cache.get("userInfo") || {};
|
||||
const codeVal = ref(userinfo.wechatAcQrcode || "");
|
||||
function qrcodeResult(e) {
|
||||
console.log("qrcodeResult", e);
|
||||
wechatAcQrcode.value = e;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,36 +1,39 @@
|
||||
<!-- 首页优惠券弹窗 -->
|
||||
<template>
|
||||
<up-popup :show="show" bgColor="transparent" mode="center" @close="close">
|
||||
<view class="container">
|
||||
<view class="content">
|
||||
<image class="bg" :src="bgUrl" mode="widthFix"></image>
|
||||
<view class="info">
|
||||
<view class="u-flex u-row-center">
|
||||
<image
|
||||
:show-menu-by-longpress="true"
|
||||
:src="code"
|
||||
style="height: 240rpx"
|
||||
mode="heightFix"
|
||||
></image>
|
||||
<view>
|
||||
|
||||
<up-popup :show="show" bgColor="transparent" mode="center" @close="close">
|
||||
<view class="container">
|
||||
<view class="content">
|
||||
<image class="bg" :src="bgUrl" mode="widthFix"></image>
|
||||
<view class="info">
|
||||
<view class="u-flex u-row-center">
|
||||
<image
|
||||
:show-menu-by-longpress="true"
|
||||
:src="wechatAcQrcode"
|
||||
style="height: 240rpx"
|
||||
mode="heightFix"
|
||||
></image>
|
||||
</view>
|
||||
<view
|
||||
class="color-999 font-12 text-center u-m-t-10"
|
||||
style="line-height: 36rpx"
|
||||
>长按识别关注,更多优惠不能错过</view
|
||||
>
|
||||
</view>
|
||||
<view class="close" @click="close">
|
||||
<up-icon name="close-circle" size="34" color="#fff"></up-icon>
|
||||
</view>
|
||||
<view
|
||||
class="color-999 font-12 text-center u-m-t-10"
|
||||
style="line-height: 36rpx"
|
||||
>长按识别关注,更多优惠不能错过</view
|
||||
>
|
||||
</view>
|
||||
<view class="close" @click="close">
|
||||
<up-icon name="close-circle" size="34" color="#fff"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
</up-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import _ from "lodash";
|
||||
import dayjs from "dayjs";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { string } from "../uni_modules/uview-plus/libs/function/test";
|
||||
|
||||
const bgUrl = ref(
|
||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/4/41239c8852874aa39d1f106e45456e10.png"
|
||||
@@ -40,16 +43,31 @@ const show = ref(false);
|
||||
const code = ref(
|
||||
"https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240408/4d6e818a01f145a898d8c2368f4b5ad1.jpg"
|
||||
);
|
||||
|
||||
|
||||
const emit=defineEmits(['close'])
|
||||
const props = defineProps({
|
||||
followIndex: {
|
||||
type: string,
|
||||
default: "", // 公众号关注位置 mine-我的 order-订单 eat-就餐
|
||||
},
|
||||
wechatAcQrcode: {
|
||||
type: string,
|
||||
default: "", // 微信公众号二维码
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(["close"]);
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
emit('close');
|
||||
emit("close");
|
||||
}
|
||||
function init() {
|
||||
const followIndex = uni.cache.get("followIndex");
|
||||
if (props.wechatAcQrcode && props.followIndex == followIndex) {
|
||||
show.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
show.value = true;
|
||||
init();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,26 +1,50 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 生成公众号二维码 -->
|
||||
<we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode>
|
||||
|
||||
<officialAccount
|
||||
followIndex="order"
|
||||
:wechatAcQrcode="wechatAcQrcode"
|
||||
v-if="showOfficialAccount"
|
||||
@close="modelClose($event, 'officialAccount')"
|
||||
/>
|
||||
<Drainage v-model="showDrainage" @close="modelClose($event, 'drainage')" />
|
||||
<Drainage v-model="showDrainage" @close="modelClose($event, 'drainage')" />
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import weQrcode from "@/components/wechat-ac-qrcode.vue";
|
||||
|
||||
import { ref, watch, computed, reactive, toRaw } from "vue";
|
||||
import officialAccount from "@/components/official-account.vue";
|
||||
import Drainage from "@/components/drainage.vue";
|
||||
|
||||
const showDrainage = ref(true);
|
||||
const showDrainage = defineModel({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
});
|
||||
const showOfficialAccount = ref(false);
|
||||
|
||||
function modelClose(e, type) {
|
||||
console.log("modelClose", type);
|
||||
if(type=='drainage'){
|
||||
if (type == "drainage") {
|
||||
showOfficialAccount.value = true;
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
const wechatAcQrcode = ref("");
|
||||
const userinfo = uni.cache.get("userInfo") || {};
|
||||
const codeVal = ref(userinfo.wechatAcQrcode || "");
|
||||
console.log("codeVal", codeVal.value);
|
||||
function qrcodeResult(e) {
|
||||
console.log("qrcodeResult", e);
|
||||
wechatAcQrcode.value = e;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.qrcode {
|
||||
position: fixed;
|
||||
transform: translateX(200vw, 200vh);
|
||||
}
|
||||
</style>
|
||||
@@ -48,6 +48,7 @@
|
||||
password.value += num;
|
||||
}
|
||||
if (password.value.length === 6) {
|
||||
console.log('密码输入完成:', password.value);
|
||||
emits('inputComplete', password.value);
|
||||
password.value = ''
|
||||
}
|
||||
@@ -56,7 +57,7 @@
|
||||
// 关闭模态框
|
||||
const closeModal = () => {
|
||||
emits('close');
|
||||
password = '';
|
||||
password.value = '';
|
||||
};
|
||||
// 将方法暴露给父组件
|
||||
defineExpose({
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<up-radio-group
|
||||
v-model="radiovalue"
|
||||
v-model="radiovalue.type"
|
||||
iconPlacement="right"
|
||||
@change="groupChanges"
|
||||
:size="28"
|
||||
@@ -146,11 +146,37 @@ const paymentMethodName = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
const radiovalue = ref(2); // 支付方式
|
||||
// const radiovalue = ref(2); // 支付方式
|
||||
const radiovalue = defineModel({
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
name: "微信支付",
|
||||
type: 2,
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png",
|
||||
payType: "wechatPay",
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
const ispws = ref(false); // 输入支付密码
|
||||
watch(
|
||||
() => props.disablePayType,
|
||||
(newval) => {
|
||||
console.log('禁止支付方式', newval);
|
||||
|
||||
const storeInfo = ref({});
|
||||
const canUsePayType = paymentMethodList.value.filter((item) => {
|
||||
return !newval.includes(item.name);
|
||||
});
|
||||
console.log('可用支付方式', canUsePayType);
|
||||
if (canUsePayType.find((v) => v.type == radiovalue.value.type)) {
|
||||
return;
|
||||
}
|
||||
radiovalue.value = canUsePayType[0];
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
// * 监听支付方式切换
|
||||
const groupChanges = (type) => {
|
||||
@@ -158,8 +184,6 @@ const groupChanges = (type) => {
|
||||
return;
|
||||
}
|
||||
const item = paymentMethodList.value.find((v) => v.type == type);
|
||||
console.log("groupChanges", item);
|
||||
console.log("props.disablePayType", props.disablePayType);
|
||||
|
||||
if (item && returnDisabled(item)) {
|
||||
uni.showToast({
|
||||
@@ -171,9 +195,7 @@ const groupChanges = (type) => {
|
||||
// if (props.payAmount <= 0 && type != 1) {
|
||||
// return;
|
||||
// }
|
||||
radiovalue.value = type;
|
||||
let name = paymentMethodName.value[type - 1].name;
|
||||
console.log('emit:groupChange',paymentMethodName.value[type - 1]);
|
||||
radiovalue.value = item;
|
||||
emits("groupChange", paymentMethodName.value[type - 1]);
|
||||
};
|
||||
|
||||
@@ -182,15 +204,18 @@ const goRecharge = () => {
|
||||
if (props.disablePayType.includes("余额支付")) {
|
||||
return;
|
||||
}
|
||||
if (orderVIP.value.isVip) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/user/member/czzx?shopId=" + orderVIP.value.shopId,
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: "/user/vip/buy-vip?shopId=" + orderVIP.value.shopId,
|
||||
url: "/pages/user/member/czzx?shopId=" + orderVIP.value.shopId,
|
||||
});
|
||||
// if (orderVIP.value.isVip) {
|
||||
// uni.navigateTo({
|
||||
// url: "/pages/user/member/czzx?shopId=" + orderVIP.value.shopId,
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// uni.navigateTo({
|
||||
// url: "/user/vip/buy-vip?shopId=" + orderVIP.value.shopId,
|
||||
// });
|
||||
|
||||
// uni.pro.navigateTo('user/member/index', {
|
||||
// shopId: orderVIP.value.shopId
|
||||
|
||||
41
components/wechat-ac-qrcode.vue
Normal file
41
components/wechat-ac-qrcode.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 生成公众号二维码 -->
|
||||
|
||||
<view class="qrcode-box" v-if="codeOptions.code">
|
||||
<w-qrcode
|
||||
:options="codeOptions"
|
||||
ref="wQrcode"
|
||||
@generate="(e) => qrcodeResult(e)"
|
||||
></w-qrcode>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import wQrcode from "@/uni_modules/wmf-code/components/w-qrcode/w-qrcode.vue";
|
||||
import { onMounted ,ref} from "vue";
|
||||
const codeOptions = ref({
|
||||
size: 200,
|
||||
code: "",
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
// 页面加载完成后生成二维码
|
||||
const userInfo = uni.cache.get("userInfo") || {};
|
||||
const wechatAcQrcode = userInfo.wechatAcQrcode || "";
|
||||
codeOptions.value.code = wechatAcQrcode;
|
||||
});
|
||||
const emit = defineEmits(["generate"]);
|
||||
function qrcodeResult(e) {
|
||||
console.log(e);
|
||||
emit("generate", e.img.tempFilePath);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.qrcode-box {
|
||||
position: fixed;
|
||||
transform: translateX(200vw, 200vh);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user