Commit b49e9d02 authored by Xuguangxing's avatar Xuguangxing

feat: 处理支付结果页

parent 1da6920e
...@@ -52,5 +52,9 @@ export default { ...@@ -52,5 +52,9 @@ export default {
return http.get(`${talosHost}/api/kdsp/group-order/list`, { return http.get(`${talosHost}/api/kdsp/group-order/list`, {
params params
}); });
},
// 获取小程序码
getQrcodeUrl(params) {
return http.get(`${talosHost}/api/kdsp/playBill/getMakePicData`, params);
} }
}; };
...@@ -84,6 +84,11 @@ export default { ...@@ -84,6 +84,11 @@ export default {
const getCouponList = function(params) { const getCouponList = function(params) {
return request.get(`${talosHost}/api/kdsp/appconfig/pay-succ-page/guide-stream`, { params }); return request.get(`${talosHost}/api/kdsp/appconfig/pay-succ-page/guide-stream`, { params });
}; };
const getOrderShareInfo = function(params) {
return request.get(`${talosHost}/api/kdsp/groupShareInfo`, { params });
};
export { export {
pay, pay,
prepay, prepay,
...@@ -97,5 +102,6 @@ export { ...@@ -97,5 +102,6 @@ export {
kaGetNextUrl, kaGetNextUrl,
getCouponList, getCouponList,
queryPayStatus, queryPayStatus,
reissueContract reissueContract,
getOrderShareInfo
}; };
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</div> </div>
<div class="skuImg"> <div class="skuImg">
<!-- 商品图 --> <!-- 商品图 -->
<img src="https://img.lkbang.net/activity/share/default/skuImg.png" alt="" /> <img :src="sharePicData.skuImg" alt="" />
<div class="skuInfo"> <div class="skuInfo">
<div class="skuPrice"> <div class="skuPrice">
<span class="groupPriceContainer">拼团价 ¥</span> <span class="groupPriceContainer">拼团价 ¥</span>
...@@ -50,12 +50,12 @@ ...@@ -50,12 +50,12 @@
</div> </div>
<div class="skuName"> <div class="skuName">
<!-- 商品名称 --> <!-- 商品名称 -->
SAINT LAURENT PARIS 圣罗兰 方管纯口红 3.8克 女神挚爱款 千颂伊同款 {{ sharePicData.skuName }}
</div> </div>
<div class="shareInfo"> <div class="shareInfo">
<!-- 底部分享信息 --> <!-- 底部分享信息 -->
<div class="qrcode"> <div class="qrcode">
<img src="https://img.lkbang.net/activity/share/default/qrcode.png" alt="" /> <img :src="qrcodeUrl" alt="" />
</div> </div>
<div class="shareDesc"> <div class="shareDesc">
<p>分享自 <span>羊小咩小程序</span></p> <p>分享自 <span>羊小咩小程序</span></p>
...@@ -67,45 +67,55 @@ ...@@ -67,45 +67,55 @@
<script> <script>
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
import qiNiuApi from '@/api/qiniu.api'; import qiNiuApi from '@/api/qiniu.api';
import { getQrcodeUrl } from '@/api/groupBuy';
import { upload } from 'qiniu-js'; import { upload } from 'qiniu-js';
import config from '@/config'; import config from '@/config';
export default { export default {
mounted() { props: {
// this.uploadPic(); sharePicData: {
type: Object,
default: () => {
return {};
}
}
},
data() {
return {
qrcodeUrl: ''
};
}, },
methods: { methods: {
async uploadPic() { async uploadPic() {
const _this = this;
const [qrcodeUrl] = await getQrcodeUrl(this.sharePicData);
this.qrcodeUrl = qrcodeUrl;
const [res] = await qiNiuApi.getQiniuToken(); const [res] = await qiNiuApi.getQiniuToken();
const token = res.token; const token = res.token;
html2canvas(this.$refs.sharePic, { this.$nextTick(() => {
width: 1080, html2canvas(this.$refs.sharePic, {
height: 1920, width: 1080,
useCORS: true, height: 1920,
scale: 1 useCORS: true,
}).then(function(canvas) { scale: 1
canvas.toBlob( }).then(function(canvas) {
blob => { canvas.toBlob(
const observable = upload(blob, null, token); blob => {
const observer = { const observable = upload(blob, null, token);
error(err) { const observer = {
console.log(err); error(err) {
}, console.log(err);
complete({ hash }) { },
const fileLink = config.qiniuHost + hash; complete({ hash }) {
console.log('fileLink', fileLink); const fileLink = config.qiniuHost + hash;
} _this.$emit('outputPicUrl', fileLink);
}; }
observable.subscribe(observer); };
// newImg.onload = function() { observable.subscribe(observer);
// URL.revokeObjectURL(url); },
// }; 'image/jpeg',
0.85
// newImg.src = url; );
// document.body.appendChild(newImg); });
},
'image/jpeg',
0.85
);
}); });
} }
} }
......
...@@ -11,7 +11,11 @@ ...@@ -11,7 +11,11 @@
</div> </div>
<div class="goods-product-info"> <div class="goods-product-info">
<div class="goods-product-info-img"> <div class="goods-product-info-img">
<span class="goods-product-info-tag">3人团</span> <span
v-if="detailInfo.groupBuyInfo && detailInfo.groupBuyInfo.groupBuyLimitUserCount"
class="goods-product-info-tag"
>{{ detailInfo.groupBuyInfo.groupBuyLimitUserCount }}人团</span
>
<cr-image width="108px" :src="detailInfo.thumbImageUrl" /> <cr-image width="108px" :src="detailInfo.thumbImageUrl" />
</div> </div>
<div class="goods-product-info-desc"> <div class="goods-product-info-desc">
...@@ -26,7 +30,7 @@ ...@@ -26,7 +30,7 @@
color="#EC1500" color="#EC1500"
track-color="#F7F8F9" track-color="#F7F8F9"
:show-pivot="false" :show-pivot="false"
:percentage="50" :percentage="stockPercentage"
/> />
</div> </div>
<div class="goods-product-info-desc-num"> <div class="goods-product-info-desc-num">
...@@ -116,6 +120,7 @@ export default { ...@@ -116,6 +120,7 @@ export default {
inProgress: false, // 活动是否已经开始 inProgress: false, // 活动是否已经开始
countDownText: '', countDownText: '',
showShareButton: false, // 是否显示分享按钮 showShareButton: false, // 是否显示分享按钮
stockPercentage: 0,
// 以下是原有的data // 以下是原有的data
detailParam: { detailParam: {
skuNo: '', skuNo: '',
...@@ -174,6 +179,15 @@ export default { ...@@ -174,6 +179,15 @@ export default {
localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单 localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this.groupId = +res.groupBuyInfo.groupId || ''; this.groupId = +res.groupBuyInfo.groupId || '';
} }
if (res.saleCount && res.activitySkuTotalCount) {
const percentage = +res.saleCount / +res.activitySkuTotalCount;
if (isNaN(percentage)) {
this.stockPercentage = 0;
} else {
this.stockPercentage = Math.floor(percentage) >= 1 ? 100 : Math.floor(percentage * 100);
}
console.log(this.stockPercentage);
}
this.showShareButton = res.groupBuyInfo.groupBuyStatus == 1 ? true : false; this.showShareButton = res.groupBuyInfo.groupBuyStatus == 1 ? true : false;
this.imgList = res.imageUrl || []; this.imgList = res.imageUrl || [];
this.detailInfo = res; this.detailInfo = res;
......
...@@ -207,9 +207,7 @@ export default { ...@@ -207,9 +207,7 @@ export default {
newUrl: `/pages/pay/index?orderNo=${data.orderNo}&from=groupbuy` newUrl: `/pages/pay/index?orderNo=${data.orderNo}&from=groupbuy`
}); });
} else if (isApp) { } else if (isApp) {
this.nativeBridge.openNewUrl({ this.$router.push({ path: `/pay?orderNo=${data.orderNo}` });
newUrl: `/pay?orderNo=${data.orderNo}`
});
} else { } else {
return; // todo 处理纯h5情况 return; // todo 处理纯h5情况
// this.$dialog({ // this.$dialog({
......
...@@ -59,18 +59,22 @@ ...@@ -59,18 +59,22 @@
</div> </div>
</div> </div>
<Goods /> <Goods />
<sharePic ref="sharePic" :share-pic-data="sharePicData" />
</div> </div>
</template> </template>
<script> <script>
import { goUrlExtends } from './extends'; import { goUrlExtends } from './extends';
import CouponCard from './components/CouponCard.vue'; import CouponCard from './components/CouponCard.vue';
import { getCouponList } from '@/api/pay.api'; import { getCouponList, getOrderShareInfo } from '@/api/pay.api';
import Goods from '@/components/RecoGoods/RecoGoods.vue'; import Goods from '@/components/RecoGoods/RecoGoods.vue';
import { isApp, isWxMp } from '@/service/validation.service'; import { isApp, isWxMp } from '@/service/validation.service';
import { EventBus } from '@/service/utils.service';
import sharePic from '@/components/sharePic';
export default { export default {
components: { components: {
Goods, Goods,
CouponCard CouponCard,
sharePic
}, },
extends: goUrlExtends, extends: goUrlExtends,
data() { data() {
...@@ -83,7 +87,8 @@ export default { ...@@ -83,7 +87,8 @@ export default {
couponList: [], couponList: [],
payStatusName: '', payStatusName: '',
payMethodName: '', payMethodName: '',
payType: '' payType: '',
sharePicData: {}
}; };
}, },
created() { created() {
...@@ -101,10 +106,32 @@ export default { ...@@ -101,10 +106,32 @@ export default {
pay_status: this.payStatus pay_status: this.payStatus
}); });
this.getCouponList(); this.getCouponList();
this.setShareData();
},
mounted() {
EventBus.$on('shareClickItem', ev => {
if (ev === 'pic') {
this.getOrderShareInfo();
}
});
},
beforeDestroy() {
EventBus.$off('shareClickItem');
}, },
methods: { methods: {
async setShareData() {
const [res] = await getOrderShareInfo({
orderNo: this.orderNo
});
this.sharePicData = res;
},
getOrderShareInfo() {
console.log(typeof this.$refs.sharePic.uploadPic);
this.$refs.sharePic.uploadPic();
},
share() { share() {
// 分享 // 分享
this.$store.dispatch('goods_share_open');
}, },
// goPay() { // goPay() {
// this.$track?.registeredEvents('h5_RechargeResultPageClick', { // this.$track?.registeredEvents('h5_RechargeResultPageClick', {
...@@ -125,9 +152,7 @@ export default { ...@@ -125,9 +152,7 @@ export default {
newUrl: `/pages/pay/index?orderNo=${this.orderNo}&from=groupbuy` newUrl: `/pages/pay/index?orderNo=${this.orderNo}&from=groupbuy`
}); });
} else if (isApp) { } else if (isApp) {
this.nativeBridge.openNewUrl({ this.$router.push({ path: `/pay?orderNo=${this.orderNo}` });
newUrl: `/pay?orderNo=${this.orderNo}`
});
} else { } else {
return; // todo 处理纯h5情况 return; // todo 处理纯h5情况
// this.$dialog({ // this.$dialog({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment