| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- <template>
- <Theme>
- <view class="wrap">
- <Navbar title="邀请有礼" fixed border>
- <template #right>
- <navMenu :options="{ icon: 'icon-home', text: '主页' }" />
- </template>
- </Navbar>
- <view class="content">
- <view class="qrcode">
- <image
- :src="BaseUrl + '/api/other/qrcode?text=' + detail.app_url"
- alt=""
- class="img"
- />
- </view>
- <view class="invite-code-section">
- <text class="invite-label"> <trans _t="我的邀请码"></trans>: </text>
- <text class="invite-code">{{ userInfo.share_code }}</text>
- </view>
- <!-- <view class="invite-link-section">
- <text class="invite-link">{{ detail.text }}</text>
- </view> -->
- <up-copy
- class="invite-copy-btn"
- :content="userInfo.share_code"
- :notice="t('复制成功')"
- >
- <trans class="copy" _t="复制" />
- </up-copy>
- </view>
- <view class="tips_content">
- <view class="tips_content-head">
- <view class="tips_content-head__tag">
- <trans _t="推广步骤"></trans>:
- </view>
- </view>
- <view class="tips_content-body">
- <view v-html="detail.share_info"></view>
- </view>
- </view>
- <view class="invitation-records-page">
- <view class="page-title">
- <trans _t="邀请记录" />
- </view>
- <view class="records-list">
- <view
- class="record-item"
- v-for="(record, index) in records"
- :key="index"
- >
- <view class="inviter-info">
- <view class="avatar">
- <image
- :src="record.comfrom?.userimg"
- mode="widthFix"
- class="avatar-img"
- alt="用户头像"
- ></image>
- </view>
- <!-- 姓名 -->
- <view class="inviter-name">
- <text>{{ record.comfrom?.username }}</text>
- </view>
- </view>
- <!-- 优惠券信息 -->
- <view class="coupon-info">
- <view class="coupon-name">
- <text>{{ record.title }}</text>
- </view>
- <view class="coupon-amount">
- <text class="symbol">{{ symbol.symbol }}</text>
- <text class="amount">{{ Moneyhtml(record.money) }}</text>
- </view>
- </view>
- </view>
- <view class="empty-state" v-if="records.length === 0">
- <trans class="empty-text" _t="暂无邀请记录"></trans>
- </view>
- </view>
- </view>
- </view>
- </Theme>
- </template>
- <script setup>
- import { BaseUrl, Moneyhtml } from "@/utils";
- import Navbar from "@/components/navbar";
- import navMenu from "@/components/nav_menu";
- import { computed, ref, nextTick } from "vue";
- import { OTHER_CONFIG, SHOP_SHOPCOUNPON_LIST } from "@/api";
- import { t } from "@/locale";
- import { useUserStore, useSystemStore } from "@/store";
- import { onShow } from "@dcloudio/uni-app";
- const useUser = useUserStore();
- const userInfo = computed(() => useUser.getuserInfo);
- const useSystem = useSystemStore();
- const symbol = computed(() => useSystem.getSymbol);
- const detail = ref({});
- const records = ref([]);
- const getDetail = async () => {
- try {
- const res = await OTHER_CONFIG("share");
- detail.value = res.data;
- } catch (error) {}
- };
- const getDataList = async () => {
- try {
- const res = await SHOP_SHOPCOUNPON_LIST();
- records.value = res.data || [];
- } catch (error) {
- Toast(error.msg);
- }
- };
- const getStatusText = (status) => {
- switch (status) {
- case "used":
- return "已使用";
- case "unused":
- return "未使用";
- case "expired":
- return "已过期";
- default:
- return "";
- }
- };
- onShow(() => {
- nextTick(() => {
- getDetail();
- getDataList();
- });
- });
- </script>
- <style lang="less" scoped>
- @import url("@/style.less");
- .wrap {
- background: var(--bg);
- min-height: 100vh;
- .content {
- position: relative;
- z-index: 3;
- margin: 10% 8% 0;
- border-radius: 2.667vw;
- box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
- padding: 20rpx;
- .qrcode {
- .hor();
- .img {
- width: 200rpx;
- height: 200rpx;
- }
- }
- .invite-code-section {
- .flex_center();
- padding-bottom: 40rpx;
- color: var(--black);
- .invite-label {
- font-size: 28rpx;
- display: block;
- }
- .invite-code {
- font-size: 32rpx;
- font-weight: bold;
- }
- }
- .invite-link-section {
- background-color: var(--bg);
- border: 1rpx solid var(--borderColor);
- border-radius: 12rpx;
- padding: 24rpx;
- margin-bottom: 40rpx;
- word-break: break-all;
- .invite-link {
- font-size: 28rpx;
- }
- }
- .invite-copy-btn {
- max-width: 40vw;
- height: 70rpx;
- background-color: var(--black);
- color: @white;
- border-radius: 12rpx;
- padding: 0 24rpx;
- font-size: 32rpx;
- text-align: center;
- line-height: 70rpx;
- margin: 0 auto;
- &:active {
- opacity: 0.8;
- }
- }
- }
- .tips_content {
- margin: 30px 8% 0;
- // border-radius: 2.667vw;
- // box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
- padding: 0 0rpx;
- .tips_content-head__tag {
- display: inline-block;
- padding: 12rpx 20rpx;
- background-color: var(--black);
- border-radius: 10rpx;
- color: #fff;
- font-size: 30rpx;
- font-weight: 500;
- }
- .tips_content-body {
- margin-top: 18px;
- }
- }
- .invitation-records-page {
- padding-bottom: 20rpx;
- .page-title {
- height: 120rpx;
- line-height: 120rpx;
- text-align: center;
- font-size: 36rpx;
- font-weight: 600;
- color: #333;
- background-color: #fff;
- border-bottom: 1rpx solid #eee;
- }
- .records-list {
- padding: 20rpx;
- .record-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #f5f5f7;
- border-radius: 16rpx;
- padding: 30rpx 24rpx;
- margin-bottom: 20rpx;
- box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
- transition: all 0.3s ease;
- &:active {
- transform: scale(0.99);
- box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.03);
- }
- .inviter-info {
- display: flex;
- align-items: center;
- .avatar {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- overflow: hidden;
- margin-right: 20rpx;
- background-color: #f0f0f0;
- .avatar-img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- }
- .inviter-name {
- font-size: 32rpx;
- color: #333;
- font-weight: 500;
- }
- }
- .coupon-info {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- .coupon-name {
- font-size: 26rpx;
- color: #666;
- margin-bottom: 8rpx;
- }
- .coupon-amount {
- display: flex;
- align-items: baseline;
- .symbol {
- font-size: 28rpx;
- color: #ff4d4f;
- }
- .amount {
- font-size: 36rpx;
- color: #ff4d4f;
- font-weight: 600;
- }
- }
- }
- }
- .empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 30rpx 0;
- .empty-text {
- font-size: 30rpx;
- color: #999;
- }
- }
- }
- }
- }
- </style>
|