feat: 添加优惠金额
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
<view class="p-x-32">
|
<view class="p-x-32">
|
||||||
<view class="center p-t-96 weight500 size100"><span class="size48">¥</span>
|
<view class="center p-t-96 weight500 size100"><span class="size48">¥</span>
|
||||||
{{ fen2yuan(state.orderInfo.payPrice) }}
|
{{ fen2yuan(state.orderInfo.payPrice) }}
|
||||||
|
</view>
|
||||||
|
<view class="center size22 c_money">
|
||||||
|
已优惠{{ fen2yuan(state.orderInfo.randomDiscountPrice) }}元
|
||||||
</view>
|
</view>
|
||||||
<view class="center m-t-20 m-b-66">{{ payDescText }}</view>
|
<view class="center m-t-20 m-b-66">{{ payDescText }}</view>
|
||||||
<view>
|
<view>
|
||||||
|
|||||||
+79
-68
@@ -6,13 +6,20 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="share_card">
|
<view class="share_card">
|
||||||
|
<view class="center m-t-22 m-b-14 label_text">我的邀请码</view>
|
||||||
|
<view class="invite_code_bar">
|
||||||
|
<view class="code_val">{{ inviteinfo?.inviteCode }}</view>
|
||||||
|
<view class="copy_btn" @click="copy(inviteinfo?.inviteCode)">
|
||||||
|
<image class="copy-icon-img" src="/static/icon/copy_1.png" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="con_center">
|
<view class="con_center">
|
||||||
<view class="flex-center">
|
<view class="flex-center">
|
||||||
<view class="code flex-center code_wrap">
|
<view class="code flex-center code_wrap">
|
||||||
<view class="img">
|
<view class="img">
|
||||||
<Qrcode
|
<Qrcode
|
||||||
ref="qrcodeRef"
|
ref="qrcodeRef"
|
||||||
:size="420"
|
:size="320"
|
||||||
@generated="onQrGenerated"
|
@generated="onQrGenerated"
|
||||||
@longpress="saveServiceQrcode"
|
@longpress="saveServiceQrcode"
|
||||||
/>
|
/>
|
||||||
@@ -20,15 +27,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="center m-t-32 m-b-24 label_text">我的邀请码</view>
|
|
||||||
|
|
||||||
<view class="invite_code_bar">
|
|
||||||
<view class="code_val">{{ inviteinfo?.inviteCode }}</view>
|
|
||||||
<view class="copy_btn" @click="copy(inviteinfo?.inviteCode)">
|
|
||||||
<view class="icon-copy"></view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="qr_tip">扫描二维码,注册并登录APP</view>
|
<view class="qr_tip">扫描二维码,注册并登录APP</view>
|
||||||
|
|
||||||
<!-- <view class="btns">
|
<!-- <view class="btns">
|
||||||
@@ -54,32 +52,32 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import Qrcode from './components/Qrcode';
|
import Qrcode from './components/Qrcode';
|
||||||
import { getCurrentInstance, nextTick, ref } from 'vue';
|
import { getCurrentInstance, nextTick, ref } from 'vue';
|
||||||
import * as api from '@/sheep/api/home/index';
|
import * as api from '@/sheep/api/home/index';
|
||||||
|
|
||||||
const instance = getCurrentInstance();
|
const instance = getCurrentInstance();
|
||||||
const proxy = instance?.proxy;
|
const proxy = instance?.proxy;
|
||||||
|
|
||||||
const inviteinfo = ref({});
|
const inviteinfo = ref({});
|
||||||
const qrCodeUrl = ref('');
|
const qrCodeUrl = ref('');
|
||||||
const qrcodeRef = ref(null);
|
const qrcodeRef = ref(null);
|
||||||
const popup = ref(null);
|
const popup = ref(null);
|
||||||
|
|
||||||
const generateQRCode = (text) => {
|
const generateQRCode = (text) => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
qrcodeRef.value?.createQRcode(text);
|
qrcodeRef.value?.createQRcode(text);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getinviteinfo = () => {
|
const getinviteinfo = () => {
|
||||||
api.inviteinfo().then((res) => {
|
api.inviteinfo().then((res) => {
|
||||||
inviteinfo.value = res?.data || {};
|
inviteinfo.value = res?.data || {};
|
||||||
if (inviteinfo.value?.inviteUrl) generateQRCode(inviteinfo.value.inviteUrl);
|
if (inviteinfo.value?.inviteUrl) generateQRCode(inviteinfo.value.inviteUrl);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCaptureBoxRect = () =>
|
const getCaptureBoxRect = () =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
uni
|
uni
|
||||||
.createSelectorQuery()
|
.createSelectorQuery()
|
||||||
@@ -95,7 +93,7 @@ const getCaptureBoxRect = () =>
|
|||||||
.exec();
|
.exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
const saveToAlbum = (filePath) =>
|
const saveToAlbum = (filePath) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
uni.saveImageToPhotosAlbum({
|
uni.saveImageToPhotosAlbum({
|
||||||
filePath,
|
filePath,
|
||||||
@@ -104,22 +102,22 @@ const saveToAlbum = (filePath) =>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const toFileUrlIfNeeded = (p) => (p.startsWith('file://') ? p : `file://${p}`);
|
const toFileUrlIfNeeded = (p) => (p.startsWith('file://') ? p : `file://${p}`);
|
||||||
|
|
||||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
let isSavingPoster = false;
|
let isSavingPoster = false;
|
||||||
|
|
||||||
const showSaveSuccessToast = () => {
|
const showSaveSuccessToast = () => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '保存成功',
|
title: '保存成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 500,
|
duration: 500,
|
||||||
});
|
});
|
||||||
setTimeout(() => uni.hideToast(), 500);
|
setTimeout(() => uni.hideToast(), 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
const drawCurrentWebviewToFile = async (params) => {
|
const drawCurrentWebviewToFile = async (params) => {
|
||||||
if (typeof plus === 'undefined' || !plus.webview || !plus.nativeObj) {
|
if (typeof plus === 'undefined' || !plus.webview || !plus.nativeObj) {
|
||||||
throw new Error('plus is not available');
|
throw new Error('plus is not available');
|
||||||
}
|
}
|
||||||
@@ -140,7 +138,9 @@ const drawCurrentWebviewToFile = async (params) => {
|
|||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
bitmap.save(
|
bitmap.save(
|
||||||
fileUrl,
|
fileUrl,
|
||||||
params?.clip ? { overwrite: true, format: 'jpg', quality: 90, clip: params.clip } : { overwrite: true, format: 'jpg', quality: 90 },
|
params?.clip
|
||||||
|
? { overwrite: true, format: 'jpg', quality: 90, clip: params.clip }
|
||||||
|
: { overwrite: true, format: 'jpg', quality: 90 },
|
||||||
() => resolve(true),
|
() => resolve(true),
|
||||||
(e) => reject(e),
|
(e) => reject(e),
|
||||||
);
|
);
|
||||||
@@ -152,9 +152,9 @@ const drawCurrentWebviewToFile = async (params) => {
|
|||||||
localPath,
|
localPath,
|
||||||
filePath: toFileUrlIfNeeded(localPath),
|
filePath: toFileUrlIfNeeded(localPath),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const savePoster = async () => {
|
const savePoster = async () => {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
if (isSavingPoster) return;
|
if (isSavingPoster) return;
|
||||||
isSavingPoster = true;
|
isSavingPoster = true;
|
||||||
@@ -210,7 +210,10 @@ const savePoster = async () => {
|
|||||||
showSaveSuccessToast();
|
showSaveSuccessToast();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg =
|
const msg =
|
||||||
(typeof e === 'string' && e) || e?.errMsg || e?.message || (e ? JSON.stringify(e) : 'unknown error');
|
(typeof e === 'string' && e) ||
|
||||||
|
e?.errMsg ||
|
||||||
|
e?.message ||
|
||||||
|
(e ? JSON.stringify(e) : 'unknown error');
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '保存失败',
|
title: '保存失败',
|
||||||
content:
|
content:
|
||||||
@@ -228,21 +231,21 @@ const savePoster = async () => {
|
|||||||
// #ifndef APP-PLUS
|
// #ifndef APP-PLUS
|
||||||
uni.showToast({ title: '仅App支持整页保存', icon: 'none' });
|
uni.showToast({ title: '仅App支持整页保存', icon: 'none' });
|
||||||
// #endif
|
// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveImg = async () => {
|
const saveImg = async () => {
|
||||||
await savePoster();
|
await savePoster();
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveServiceQrcode = async () => {
|
const saveServiceQrcode = async () => {
|
||||||
await savePoster();
|
await savePoster();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onQrGenerated = (path) => {
|
const onQrGenerated = (path) => {
|
||||||
qrCodeUrl.value = path;
|
qrCodeUrl.value = path;
|
||||||
};
|
};
|
||||||
|
|
||||||
const copy = (text) => {
|
const copy = (text) => {
|
||||||
const val = text || inviteinfo.value?.inviteCode || '';
|
const val = text || inviteinfo.value?.inviteCode || '';
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
@@ -251,13 +254,13 @@ const copy = (text) => {
|
|||||||
uni.showToast({ icon: 'none', title: '复制成功' });
|
uni.showToast({ icon: 'none', title: '复制成功' });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const openShare = () => {
|
const openShare = () => {
|
||||||
popup.value?.open?.();
|
popup.value?.open?.();
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapShareProvider = (name) => {
|
const mapShareProvider = (name) => {
|
||||||
if (!name) return '';
|
if (!name) return '';
|
||||||
const m = {
|
const m = {
|
||||||
wx: 'weixin',
|
wx: 'weixin',
|
||||||
@@ -266,9 +269,9 @@ const mapShareProvider = (name) => {
|
|||||||
sina: 'sinaweibo',
|
sina: 'sinaweibo',
|
||||||
};
|
};
|
||||||
return m[name] || '';
|
return m[name] || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const doShare = async (res) => {
|
const doShare = async (res) => {
|
||||||
const provider = mapShareProvider(res?.item?.name);
|
const provider = mapShareProvider(res?.item?.name);
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
uni.showToast({ title: '当前渠道不支持', icon: 'none' });
|
uni.showToast({ title: '当前渠道不支持', icon: 'none' });
|
||||||
@@ -294,9 +297,9 @@ const doShare = async (res) => {
|
|||||||
uni.showToast({ title: '截图失败', icon: 'none' });
|
uni.showToast({ title: '截图失败', icon: 'none' });
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
getinviteinfo();
|
getinviteinfo();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -320,7 +323,7 @@ getinviteinfo();
|
|||||||
background-position: center top;
|
background-position: center top;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 0;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slogan {
|
.slogan {
|
||||||
@@ -328,7 +331,7 @@ getinviteinfo();
|
|||||||
top: 0rpx;
|
top: 0rpx;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 1;
|
z-index: 0;
|
||||||
// padding: 0 40rpx;
|
// padding: 0 40rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -342,7 +345,7 @@ getinviteinfo();
|
|||||||
|
|
||||||
.share_card {
|
.share_card {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 28rpx;
|
border-radius: 28rpx;
|
||||||
background: rgba(255, 255, 255, 0.96);
|
background: rgba(255, 255, 255, 0.96);
|
||||||
@@ -351,7 +354,7 @@ getinviteinfo();
|
|||||||
}
|
}
|
||||||
|
|
||||||
.con_center {
|
.con_center {
|
||||||
padding: 48rpx 40rpx 44rpx;
|
padding: 5rpx 40rpx 24rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,36 +376,38 @@ getinviteinfo();
|
|||||||
}
|
}
|
||||||
|
|
||||||
.code {
|
.code {
|
||||||
width: 460rpx;
|
width: 360rpx;
|
||||||
height: 460rpx;
|
height: 360rpx;
|
||||||
border-radius: 22rpx;
|
border-radius: 22rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code_wrap {
|
.code_wrap {
|
||||||
box-shadow: 0 10rpx 28rpx rgba(31, 63, 132, 0.14);
|
// box-shadow: 0 10rpx 28rpx rgba(31, 63, 132, 0.14);
|
||||||
}
|
}
|
||||||
|
|
||||||
.img {
|
.img {
|
||||||
width: 420rpx;
|
width: 320rpx;
|
||||||
height: 420rpx;
|
height: 320rpx;
|
||||||
border-radius: 18rpx;
|
// border-radius: 18rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invite_code_bar {
|
.invite_code_bar {
|
||||||
|
width: 80%;
|
||||||
|
margin: 0 auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: #f2f3f5;
|
background: #f2f3f5;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 112rpx;
|
height: 90rpx;
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.code_val {
|
.code_val {
|
||||||
flex: 1;
|
// flex: 1;
|
||||||
color: #111;
|
color: #111;
|
||||||
font-size: 56rpx;
|
font-size: 56rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -416,7 +421,7 @@ getinviteinfo();
|
|||||||
}
|
}
|
||||||
|
|
||||||
.copy_btn {
|
.copy_btn {
|
||||||
width: 120rpx;
|
width: 80rpx;
|
||||||
height: 112rpx;
|
height: 112rpx;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -447,8 +452,14 @@ getinviteinfo();
|
|||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.copy-icon-img {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.qr_tip {
|
.qr_tip {
|
||||||
margin-top: 22rpx;
|
margin-top: 0rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
color: #9aa0a6;
|
color: #9aa0a6;
|
||||||
@@ -459,14 +470,14 @@ getinviteinfo();
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 104rpx;
|
height: 104rpx;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
background: #2f7cf6;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 34rpx;
|
font-size: 34rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-shadow: 0 18rpx 40rpx rgba(47, 124, 246, 0.35);
|
background: linear-gradient(135deg, var(--primary-grad-start) 0%, var(--primary-grad-end) 100%);
|
||||||
|
box-shadow: 0 18rpx 40rpx var(--primary-shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btns {
|
.btns {
|
||||||
|
|||||||
@@ -416,7 +416,7 @@
|
|||||||
height: 64rpx;
|
height: 64rpx;
|
||||||
border-radius: 64rpx;
|
border-radius: 64rpx;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
background: linear-gradient(135deg, #2c8cfa 0%, #3d5efb 100%);
|
background: linear-gradient(135deg, var(--primary-grad-start) 0%, var(--primary-grad-end) 100%);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -179,6 +179,11 @@
|
|||||||
value: 'totalPrice',
|
value: 'totalPrice',
|
||||||
type: 1,
|
type: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "随机优惠",
|
||||||
|
value: 'randomDiscountPrice',
|
||||||
|
type: 1,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '消费金抵扣',
|
title: '消费金抵扣',
|
||||||
value: 'consumptionPrice',
|
value: 'consumptionPrice',
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
<view class="money-box ss-m-b-20">
|
<view class="money-box ss-m-b-20">
|
||||||
<text class="money-text">{{ fen2yuan(state.orderInfo.price) }}</text>
|
<text class="money-text">{{ fen2yuan(state.orderInfo.price) }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="size22 c_money">
|
||||||
|
已优惠{{ fen2yuan(state.orderInfo.randomDiscountPrice) }}元
|
||||||
|
</view>
|
||||||
<view class="time-text">
|
<view class="time-text">
|
||||||
<text>{{ payDescText }}</text>
|
<text>{{ payDescText }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
--auth-grad-end: #fe3b48;
|
--auth-grad-end: #fe3b48;
|
||||||
--wallet-grad-start: #fd9d72;
|
--wallet-grad-start: #fd9d72;
|
||||||
--wallet-grad-end: #ff4e00;
|
--wallet-grad-end: #ff4e00;
|
||||||
|
--primary-grad-start: #2c8cfa;
|
||||||
|
--primary-grad-end: #3d5efb;
|
||||||
|
--primary-shadow: rgba(47, 124, 246, 0.35);
|
||||||
--fff: #ffffff;
|
--fff: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
Reference in New Issue
Block a user