Task:收礼相关接口

This commit is contained in:
linxi
2025-02-21 18:25:34 +08:00
parent 425821ecf7
commit f0a4a0edf9
6 changed files with 441 additions and 27 deletions
+12 -20
View File
@@ -80,7 +80,7 @@
<u-switch v-model="canTransfe" ></u-switch>
</view>
</view>
<button v-if="isPayOk" open-type="share" class="share-btn" @click="shareToFriend">
<button v-if="isPayOk" open-type="share" class="share-btn" >
<view class="v12-font-28 v12-primary-text v12-align-center">
<u-icon :name="webUrl + '/icon/gift-primary.png'" size="18"></u-icon>
点击送给朋友</view>
@@ -157,15 +157,22 @@ export default {
payPassword: '',
payType: '',
isPayOk: false,
giftKey: '',
}
},
onLoad(opts) {
console.log(opts, 'gift');
this.cartId = opts.cartId
this.couponId = opts.couponId
this.getGift()
},
computed: mapGetters(["userInfo"]),
onShareAppMessage() {
return {
title: '送朋友',
path: `/pkg_user/views/gift/receive?code=${this.giftKey}`,
imageUrl: this.goodsInfo.productInfo.image
}
},
methods: {
pwdPopFinish(payPwd) {
this.payPassword = payPwd;
@@ -176,7 +183,6 @@ export default {
this.confirmGift(false)
},
onCoverConfirm(cover) {
console.log(cover);
this.cover = cover.name
this.templateId = cover.id
this.selectedCover = cover.image
@@ -223,7 +229,9 @@ export default {
});
const params = {
orderKey: this.orderKey,
from: 'routine',
cartId: this.cartId,
couponId: this.couponId,
templateId: this.templateId,
message : this.message,
cover: this.selectedCover,
@@ -267,6 +275,7 @@ export default {
duration: 2000
});
this.isPayOk = true;
this.giftKey = data.giftCard.code;
break;
case "WECHAT_H5_PAY":
// H5支付
@@ -305,23 +314,6 @@ export default {
this.$refs.payPwdPop.clear();//清空支付密码
this.$refs.payPwdPop.close();//关闭支付密码弹窗
});
},
shareToFriend() {
uni.share({
provider: 'weixin',
scene: 'WXSceneSession', // 分享到好友
type: 0, // 0:文字 1:图片 2:音乐 3:视频 4:小程序
title: '送你一份礼物', // 分享标题
summary: '我精心挑选了一份礼物送给你,快来领取吧!', // 分享描述
href: 'https://your-domain.com/gift', // 分享链接
imageUrl: this.goodsInfo.productInfo.image, // 分享图片
success: (res) => {
console.log('分享成功', res);
},
fail: (err) => {
console.log('分享失败', err);
}
});
}
}
}