|
|
@@ -18,11 +18,13 @@
|
|
|
<view class="price-section">
|
|
|
<view class="price-row">
|
|
|
<text class="price-label">此书预估书款</text>
|
|
|
- <text class="price-value">¥ {{ bookInfo.recyclePrice }}</text>
|
|
|
+ <text class="price-value">¥ {{ bookInfo.recyclePrice || 0 }}</text>
|
|
|
</view>
|
|
|
<view class="price-row">
|
|
|
<text class="price-label">助力成功提升至</text>
|
|
|
- <text class="price-value increased">¥ {{ upselledMoney }}</text>
|
|
|
+ <text class="price-value increased"
|
|
|
+ >¥ {{ bookInfo.upsellMoney || 0 }}</text
|
|
|
+ >
|
|
|
<image
|
|
|
class="up-icon"
|
|
|
src="/static/img/activity/up2.png"
|
|
|
@@ -30,35 +32,42 @@
|
|
|
></image>
|
|
|
</view>
|
|
|
<view class="small-text"
|
|
|
- >实际金额以最终审核书款为准,活动时间3/25至4/30</view
|
|
|
+ >实际金额以最终审核书款为准,活动时间{{
|
|
|
+ formatDate(bookInfo.startTime)
|
|
|
+ }}至{{ formatDate(bookInfo.endTime) }}</view
|
|
|
>
|
|
|
</view>
|
|
|
|
|
|
<!-- 分享助力区域 -->
|
|
|
<view class="share-section">
|
|
|
- <view class="share-text">分享一位好友助力</view>
|
|
|
+ <view class="share-text">分享{{ inviteUsers.length }}位好友助力</view>
|
|
|
<view class="add-button">
|
|
|
- <image
|
|
|
- class="hand-icon"
|
|
|
- src="/static/img/activity/invite.png"
|
|
|
- mode="widthFix"
|
|
|
- ></image>
|
|
|
+ <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
|
|
|
- >
|
|
|
+ <button class="share-button" @click="shareAction" open-type="share">
|
|
|
+ 立即分享
|
|
|
+ </button>
|
|
|
+ <button class="scan-button" @click="scanAction">扫码助力</button>
|
|
|
</view>
|
|
|
|
|
|
<!-- 关闭按钮 -->
|
|
|
@@ -70,7 +79,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import customPopup from '../../../components/custom-popup.vue';
|
|
|
+import customPopup from "../../../components/custom-popup.vue";
|
|
|
export default {
|
|
|
components: {
|
|
|
customPopup,
|
|
|
@@ -79,20 +88,56 @@ export default {
|
|
|
return {
|
|
|
showPopup: false,
|
|
|
bookInfo: {},
|
|
|
+ inviteUsers: [],
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- upselledMoney() {
|
|
|
- return (this.bookInfo.recyclePrice + this.bookInfo.upsellMoney).toFixed(
|
|
|
- 2
|
|
|
- );
|
|
|
- },
|
|
|
- },
|
|
|
methods: {
|
|
|
open(data) {
|
|
|
- this.bookInfo = 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;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 转换时间的方法,将年月日时分秒转换成 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;
|
|
|
},
|
|
|
@@ -100,7 +145,8 @@ export default {
|
|
|
this.$emit("share");
|
|
|
},
|
|
|
scanAction() {
|
|
|
- this.$emit("scan");
|
|
|
+ this.showPopup = false;
|
|
|
+ this.$emit("scan", this.bookInfo);
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
@@ -199,15 +245,32 @@ export default {
|
|
|
|
|
|
.add-button {
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
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 {
|
|
|
@@ -232,7 +295,7 @@ export default {
|
|
|
border-radius: 10rpx;
|
|
|
line-height: 90rpx;
|
|
|
}
|
|
|
- button+button{
|
|
|
+ button + button {
|
|
|
margin-left: 0;
|
|
|
}
|
|
|
}
|