| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <custom-popup
- v-model="showPopup"
- mode="center"
- border-radius="24"
- width="650rpx"
- :bg-color="'transparent'"
- >
- <view class="popup-container">
- <!-- 顶部黄色手掌图标和标题 -->
- <view class="header">
- <!-- <image src="/static/img/activity/hand.png" class="hand-icon"></image> -->
- <view class="title-text">你真的太幸运了</view>
- <view class="title-text">恭喜你获得限时加价权益</view>
- </view>
- <!-- 绿色价格信息区域 -->
- <view class="price-section">
- <view class="price-row">
- <text class="price-label">此书预估书款</text>
- <text class="price-value">¥ {{ bookInfo.recyclePrice || 0 }}</text>
- </view>
- <view class="price-row">
- <text class="price-label">助力成功提升至</text>
- <text class="price-value increased"
- >¥ {{ bookInfo.upsellMoney || 0 }}</text
- >
- <image
- class="up-icon"
- src="/static/img/activity/up2.png"
- mode="widthFix"
- ></image>
- </view>
- <view class="small-text"
- >实际金额以最终审核书款为准,活动时间{{
- formatDate(bookInfo.startTime)
- }}至{{ formatDate(bookInfo.endTime) }}</view
- >
- </view>
- <!-- 分享助力区域 -->
- <view class="share-section">
- <view class="share-text">分享{{ inviteUsers.length }}位好友助力</view>
- <view class="add-button">
- <block v-for="(item, index) in inviteUsers" :key="index">
- <view class="add-item" v-if="item.imgPath">
- <image
- class="hand-icon"
- :src="item.imgPath"
- mode="widthFix"
- ></image>
- <view class="add-text">{{ formatName(item.nickName) }}</view>
- </view>
- <image
- v-else
- class="hand-icon"
- src="/static/img/activity/invite.png"
- mode="widthFix"
- ></image>
- </block>
- </view>
- </view>
- <!-- 分享按钮 -->
- <view class="action-buttons">
- <button class="share-button" @click="shareAction" open-type="share">
- 立即分享
- </button>
- <button class="scan-button" @click="scanAction">扫码助力</button>
- </view>
- <!-- 关闭按钮 -->
- <view class="close-button" @click="closePopup">
- <image src="/static/img/activity/close2.png" mode="widthFix"></image>
- </view>
- </view>
- </custom-popup>
- </template>
- <script>
- import customPopup from "../../../components/custom-popup.vue";
- export default {
- components: {
- customPopup,
- },
- data() {
- return {
- showPopup: false,
- bookInfo: {},
- inviteUsers: [],
- };
- },
- methods: {
- open(data) {
- this.showPopup = true;
- this.getIsbnInfo(data.isbn, data.orderId);
- },
- //获取信息
- getIsbnInfo(isbn, orderId) {
- uni.$u.http
- .get(`/token/order/clickUpsellInvite?isbn=${isbn}&orderId=${orderId}`)
- .then((res) => {
- if (res.code == 200) {
- this.bookInfo = res.data;
- let needInviteNum = res.data.needInviteNum;
- let inviteUsers = res.data.inviteUsers || [];
- let length = inviteUsers.length;
- for (let index = 0; index < needInviteNum - length; index++) {
- inviteUsers.push({
- nickName: "",
- imgPath: "",
- });
- }
- this.inviteUsers = inviteUsers;
- uni.setStorageSync("upsellCodeShare", res.data.upsellCode);
- }else {
- uni.$u.toast(res.msg);
- }
- });
- },
- // 转换时间的方法,将年月日时分秒转换成 3/25 格式
- formatDate(dateString) {
- if (!dateString) return "";
- const date = new Date(dateString);
- const month = date.getMonth() + 1; // 月份从0开始,需要+1
- const day = date.getDate();
- return `${month}/${day}`;
- },
- //格式化 name,长度大于 3,只保留第一个和最后一个字,中间最多使用三个 *代替
- // 长度小于 3,只保留第一个字
- formatName(name) {
- if (!name) return "";
- if (name.length > 2) {
- return name.slice(0, 1) + "*" + name.slice(-1);
- } else {
- return name.slice(0, 1) + "*";
- }
- },
- closePopup() {
- this.showPopup = false;
- },
- shareAction() {
- this.$emit("share", this.bookInfo);
- },
- scanAction() {
- this.showPopup = false;
- this.$emit("scan", this.bookInfo);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .popup-container {
- position: relative;
- padding: 30rpx;
- box-sizing: border-box;
- padding-bottom: 50rpx;
- background: url("https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/bg2.png")
- no-repeat center center;
- background-size: 100% 100%;
- }
- .header {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20rpx 0 10rpx;
- padding-top: 160rpx;
- .title-text {
- font-size: 38rpx;
- font-weight: bold;
- color: #000;
- margin-bottom: 10rpx;
- }
- .subtitle-text {
- font-size: 32rpx;
- color: #000;
- }
- .hand-icon {
- width: 140rpx;
- height: 140rpx;
- position: relative;
- top: -30rpx;
- }
- }
- .price-section {
- background-color: #39c248;
- border-radius: 16rpx;
- padding: 20rpx 30rpx;
- margin: 20rpx 0;
- .price-row {
- display: flex;
- align-items: center;
- .price-label {
- color: #ffffff;
- font-size: 30rpx;
- }
- .price-value {
- color: #ffeb3b;
- font-size: 30rpx;
- font-weight: bold;
- margin-left: 10rpx;
- }
- .increased {
- font-size: 42rpx;
- }
- .up-icon {
- width: 30rpx;
- height: 30rpx;
- margin-left: 5rpx;
- }
- }
- .small-text {
- color: #ffffff;
- font-size: 22rpx;
- margin-top: 10rpx;
- }
- }
- .share-section {
- background-color: #e8f8e8;
- border-radius: 16rpx;
- padding: 30rpx;
- margin: 20rpx 0;
- .share-text {
- color: #39c248;
- font-size: 32rpx;
- text-align: center;
- margin-bottom: 30rpx;
- }
- .add-button {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 10rpx;
- .hand-icon {
- width: 100rpx;
- height: 100rpx;
- }
- }
- .add-item {
- position: relative;
- .add-text {
- position: absolute;
- bottom: 2rpx;
- left: 5rpx;
- font-size: 24rpx;
- background: #39c248;
- text-align: center;
- color: #fff;
- padding: 0 10rpx;
- border-radius: 20rpx;
- display: inline-block;
- width: 94rpx;
- }
- }
- }
- .action-buttons {
- margin-top: 30rpx;
- .share-button {
- height: 90rpx;
- background: linear-gradient(to bottom, #47d46c, #24ad3c) !important;
- margin-bottom: 24rpx;
- font-size: 32rpx;
- color: #ffffff;
- border-radius: 10rpx;
- line-height: 90rpx;
- }
- .scan-button {
- height: 90rpx;
- font-size: 32rpx;
- color: #39c248;
- border: 1rpx solid #39c248;
- background-color: transparent;
- border-radius: 10rpx;
- line-height: 90rpx;
- }
- button + button {
- margin-left: 0;
- }
- }
- .close-button {
- position: absolute;
- bottom: -120rpx;
- left: 50%;
- transform: translateX(-50%);
- image {
- width: 70rpx;
- height: 70rpx;
- }
- }
- </style>
|