Commit 5a6e236b by 李嘉林

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents b8f64675 eb259922
......@@ -16,5 +16,13 @@ export default {
//获取电子卡券订单卡券
getElectronicCardRedeemCode(data){
return requestGET(`${process.env.OLSHOP_URL}/order/getElectronicCardRedeemCode?orderSn=${data}`)
}
},
// 获取订单是否参加支付有礼
getPayWithCourtesyInfoForShop(data) {
return requestPOST(`${process.env.OLSHOP_URL}/payWithCourtesy/getPayWithCourtesyInfoForShop`, data);
},
// 保存支付有礼积分
save_pay_with_courtesy_integral(data) {
return requestPOST(`${process.env.OLSHOP_URL}/order/save_pay_with_courtesy_integral`, data)
},
}
<template>
<div v-if="isShowIntegral || isShowGifts" :style="{ 'padding-top': paddingTop, 'padding-bottom': paddingBottom }">
<div class="pay-with-gifts__wrapper">
<template v-if="isShowGifts">
<!-- 推广类型: (0: 送优惠券 1: 抽奖大转盘 2: 优惠码) -->
<template v-if="giftsInfo.getPayWithCourtesyInfoForShopRespDTO.promotionType == 0">
<div @click="handleUseCoupon">
<!-- 默认图片 -->
<template v-if="giftsInfo.getPayWithCourtesyInfoForShopRespDTO.picType == 2">
<image mode="widthFix" src="http://test-ant.mayi888.cn/static/img/couponImg.043ef7c.png"></image>
</template>
<!-- 自定义图片 -->
<template v-else>
<image mode="widthFix" :src="giftsInfo.getPayWithCourtesyInfoForShopRespDTO.picUrl" alt></image>
</template>
</div>
</template>
<template v-else-if="giftsInfo.getPayWithCourtesyInfoForShopRespDTO.promotionType == 1">
<div @click="handleLottery">
<!-- 默认图片 -->
<template v-if="giftsInfo.getPayWithCourtesyInfoForShopRespDTO.picType == 2">
<image mode="widthFix" src="http://test-bucket-ant.oss-cn-shanghai.aliyuncs.com/product/png/2a61b201-4fe3-406b-9d76-9ec606ed08c0.png"></image>
</template>
<!-- 自定义图片 -->
<template v-else>
<image mode="widthFix" :src="giftsInfo.getPayWithCourtesyInfoForShopRespDTO.picUrl" alt></image>
</template>
</div>
</template>
</template>
<div class="points-wrapper flex" v-if="isShowIntegral">
<image class="image" src="http://cdn.mayi888.com/public/png/4eef96f4-a6be-4d13-9b5e-60577d289e08.png"></image>
<div class="flex center">
<div class="points-content">+ {{ giftsInfo.integral }}积分</div>
<div class="tip">海量积分好礼等你来兑</div>
</div>
<div class="points-btn" @click="handleToPoint">去兑换</div>
</div>
</div>
</div>
</template>
<script>
import order from "@/api/order";
const app = getApp();
export default {
name: "pay-with-gifts",
props: {
datas: {
type: Object,
default: () => {
return {};
},
},
orderDetail: {
type: Object,
default: () => {
return {};
},
},
totalMoney: {
type: Number,
default: 0,
},
},
data() {
return {
isShowIntegral: false,
isShowGifts: false,
_orderDetail: {},
giftsInfo: [],
getPayWithCourtesyInfoForShopRespDTO: {},
}
},
watch: {
orderDetail: {
handler(val) {
if (val && Object.keys(val).length > 0) {
this._orderDetail = val;
this.getPayWithCourtesyInfoForShop();
}
},
immediate: true
}
},
computed: {
paddingTop() {
return this.datas.componentData["paddingTop"] + "px";
},
paddingBottom() {
return this.datas.componentData["paddingBottom"] + "px";
},
},
methods: {
// 领取优惠券
handleUseCoupon() {
app.$themeToLink({ type: 1, link: '/personalCenter/coupon/myCoupon' })
},
// 积分抽奖
handleLottery() {
app.$themeToLink({
type: 1,
link: `/turntable?type=payWithGifts&orderSn=${this.orderDetail.orderSn}&turntableCode=${this.giftsInfo.getPayWithCourtesyInfoForShopRespDTO.promotionContent}&payWithCcourtesyId=${this.giftsInfo.getPayWithCourtesyInfoForShopRespDTO.activityid}`
})
},
// 去兑换
handleToPoint() {
app.$themeToLink({ type: 1, link: '/pointShop/pointCenter' })
},
// 获取礼物信息
async getPayWithCourtesyInfoForShop() {
const goodsIds = [];
this._orderDetail.orderItems.forEach(item => {
// 赠品不参与计算
if (item.giftFlag == 0) {
goodsIds.push(Number(item.goodsId));
}
})
const data = {
orderSn: this._orderDetail.orderSn,
goodsIds,
amountMoney: this.totalMoney
}
const res = await order.getPayWithCourtesyInfoForShop(data);
if (res.data.code == 200) {
this.giftsInfo = res.data.data;
// 如果不存在数据则不显示
if (this.giftsInfo.integral && this.giftsInfo.integral > 0) {
this.isShowIntegral = true;
}
const info = this.giftsInfo.getPayWithCourtesyInfoForShopRespDTO;
if (info && (info.payWithCourtesyIntegralRedemptionPageRespDTO || info.detailCouponInfoResponseDTO)) {
this.isShowGifts = true;
this.savePayWithCourtesyIntegral();
}
}
},
// 支付有礼保存积分
async savePayWithCourtesyIntegral() {
const data = {
orderSn: this._orderDetail.orderSn, // 订单编号
payWithCourtesyId: this.giftsInfo.getPayWithCourtesyInfoForShopRespDTO.activityid, // 支付有礼 id
}
await order.save_pay_with_courtesy_integral(data);
}
},
}
</script>
<style lang="scss" scoped>
.pay-with-gifts__wrapper {
padding: 0 12px;
image {
width: 100%;
}
.image {
width: 88px;
height: 88px;
}
.points-wrapper {
margin-top: 8px;
border-radius: 8px;
align-items: center;
justify-content: space-between;
background: #fff;
.center {
align-self: normal;
margin: 18px auto 18px 8px;
flex-direction: column;
justify-content: space-between;
.points-content {
font-size: 14px;
color: #C72A30;
}
.tip {
font-size: 12px;
color: rgba(0, 0, 0, 0.4);
}
}
.points-btn {
font-size: 12px;
color: #C9353F;
padding: 2px 8px;
margin-right: 16px;
border-radius: 4px;
border: 1px solid #C9353F;
}
}
}
</style>
\ No newline at end of file
......@@ -67,6 +67,12 @@
:whetherOpenEnterprisesWantGoods="whetherOpenEnterprisesWantGoods"
:whetherOpenApproval="whetherOpenApproval"
/>
<payWithGifts
v-if="item.componentCode=='pay-with-gifts' && item.componentInfo.visible==1"
:datas="item"
:orderDetail="orderDetail"
:totalMoney="totalMoney"
/>
</div>
</div>
<automati-Card :showReceiveCard="showReceiveCard" @closeHandle="closeHandle" :cardInfo="cardInfo"></automati-Card>
......@@ -105,6 +111,7 @@ import { serialize } from "@/utils/index";
import { checkTabbarPage, checkShowConditionIds, themeColor } from "@/utils/mayi";
import ThemeDataPlant from "@/components/ThemeDataPlant";
import paySuccessInfo from "@/components/paySuccess/paySuccessInfo";
import payWithGifts from "@/components/paySuccess/payWithGifts";
import PayElectronCard from "@/components/paySuccess/PayElectronCard";
import automatiCard from "@/components/paySuccess/automatiCard";
import text from "@/components/content/text";
......@@ -159,6 +166,7 @@ export default {
interval,
partition,
paySuccessInfo,
payWithGifts,
PayElectronCard,
automatiCard,
coupon,
......@@ -197,7 +205,7 @@ export default {
} else {
this.mpApp.pageCallBack = (params) => {
console.log(params, "-----------------this.mpApp.globalData.pageList");
that.init(params);
this.init(params);
};
}
this.systemInfo = wx.getSystemInfoSync()
......
......@@ -61,9 +61,6 @@ const componentOptions = {
})
log.info('datas');
},
secKillText() {
return `${this.data.currentSecKillInfo.activityTag ? this.data.currentSecKillInfo.activityTag + ' ' : ''}${this.formatDate(this.data.currentSecKillInfo.startTime)}`
},
// 获取当前秒杀信息
getSecKillInfo(val) {
if (val.secondKillActivityInfoGoodsList.length === 0) return;
......@@ -71,8 +68,10 @@ const componentOptions = {
const item = val.goodsItems.find(item => item.goodsId == tempObj.goodsId);
tempObj.spikePrice = Number(tempObj.spikePrice).toFixed(2);
tempObj.originPrice = Number(item.salePrice).toFixed(2);
tempObj.formatTime = this.formatDate(tempObj.startTime);
this.setData({ currentSecKillInfo: tempObj })
if (new Date(this.data.currentSecKillInfo.startTime) - Date.now() > 0) {
const timestamp = new Date(this.data.currentSecKillInfo.startTime) - Date.now()
if (timestamp > 0) {
this.setData({ isBeginSecKill: false });
// 判断当前剩余时间是否小于 10 分钟
if (timestamp < 10 * 60 * 1000) {
......
......@@ -38,7 +38,8 @@
<!-- 秒杀活动 -->
<block wx:if="{{items && items.secondKillActivityInfoGoodsList}}">
<view class="secKillBanner" style="border-radius:{{datas.componentData.borderRadius*2}}rpx 0 {{datas.componentData.borderRadius*2}}rpx 0">
<block wx:if="{{!isBeginSecKill}}">{{ secKillText || "" }}</block>
<image class="seckill-image" src="../../../svg/seckill.svg"></image>
<block wx:if="{{!isBeginSecKill}}">{{ currentSecKillInfo.formatTime || "" }}</block>
<block wx:else>
<block wx:if="{{!isLessTenHour}}">正在抢购中</block>
<block wx:else>
......
......@@ -87,6 +87,14 @@ align-items: flex-start;
font-size: 12px;
padding: 2px 8px;
background: linear-gradient(84.33deg, #FE1F4C 10.5%, #FE3D1C 41.53%, #FE140D 71.52%, #FF673E 97.28%);
display: flex;
align-items: center;
}
.secKillBanner .seckill-image {
width: 52rpx;
height: 24rpx;
margin-right: 8rpx;
}
.goodsPicture .saleWay{
position: absolute;
......
<svg width="26" height="12" viewBox="0 0 26 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_85_4922)">
<path d="M1.17529 11.9537L3.10521 4.35219L1.40887 4.27168C1.47123 3.99244 1.532 3.71822 1.59489 3.44099C2.06415 3.46212 2.52285 3.47822 2.98103 3.5069C3.13058 3.51596 3.21143 3.47369 3.25107 3.33332C3.31712 3.09885 3.39903 2.86791 3.46985 2.63445C3.51265 2.49306 3.47619 2.39998 3.29651 2.39998C2.77704 2.39998 2.2581 2.39998 1.7344 2.39998L1.96533 1.60803H7.30009C7.25412 1.88828 7.21131 2.14841 7.17115 2.39143C6.88948 2.39143 6.59619 2.39143 6.30342 2.39143C6.05294 2.39143 5.80245 2.39143 5.55249 2.40602C5.45573 2.40548 5.3617 2.43656 5.28611 2.49406C5.21051 2.55157 5.15792 2.63202 5.13712 2.722C5.13395 2.73407 5.12972 2.74614 5.12603 2.75822C4.95216 3.30061 5.03143 3.41231 5.61062 3.42237C6.12375 3.42942 6.63688 3.42237 7.1907 3.42237C7.11513 3.74388 7.05383 4.00703 6.99834 4.242C6.38269 4.242 5.79029 4.24452 5.19789 4.242C5.07001 4.242 5.00554 4.26011 4.97383 4.40401C4.5863 6.1999 4.18943 7.99445 3.78322 9.78766C3.75331 9.89899 3.68774 9.99869 3.59562 10.0729C2.85103 10.6626 2.0985 11.2428 1.34863 11.8259C1.30846 11.8556 1.2683 11.8853 1.17529 11.9537Z" fill="white"/>
<path d="M25.7886 5.57382C25.7139 5.86766 25.641 6.1563 25.5698 6.43973C25.119 6.43973 24.6593 6.43973 24.1995 6.43973C23.0332 6.44728 21.8664 6.46037 20.7001 6.46188C20.4945 6.46188 20.4205 6.56703 20.3804 6.72452C20.1933 7.46364 20.0047 8.20275 19.8234 8.94338C19.733 9.31319 19.6585 9.68653 19.575 10.0654H14.8744C15.1101 9.79219 15.3204 9.5386 15.545 9.29709C15.5788 9.26087 15.6782 9.27495 15.7469 9.27445C16.3721 9.27445 16.9972 9.27445 17.6414 9.27445C17.8977 8.35671 18.1577 7.42741 18.4288 6.45684C16.8471 6.37382 15.303 6.45936 13.7509 6.48653C13.777 6.16921 13.802 5.85978 13.826 5.55822C14.3047 5.55822 14.7714 5.55822 15.2375 5.55822C16.3444 5.56225 17.4519 5.56728 18.5599 5.57332C18.6814 5.57332 18.7543 5.5547 18.776 5.42238C18.8065 5.28427 18.8462 5.14815 18.8949 5.01483H20.7725C20.7661 5.08165 20.7544 5.14791 20.7376 5.21307C20.6346 5.51848 20.6747 5.57332 21.0151 5.57332H25.7886V5.57382Z" fill="white"/>
<path d="M14.8401 1.58644C15.954 1.58644 17.068 1.58644 18.182 1.58644C18.2603 1.5921 18.3367 1.6119 18.4071 1.64481C18.971 1.8677 19.5354 2.09009 20.0982 2.32103C20.1507 2.34466 20.2082 2.35619 20.2662 2.3547C20.3243 2.35322 20.3811 2.33875 20.4322 2.31248C20.9437 2.08405 21.459 1.86267 21.9747 1.6433C22.0512 1.60866 22.1343 1.58931 22.2189 1.58644C23.4058 1.58242 24.5932 1.58644 25.7801 1.58644H25.9059C24.5763 2.10418 23.2446 2.46896 21.9953 3.02192C21.9953 3.04607 21.9953 3.07223 21.9953 3.09437L25.6501 4.90569L23.2251 4.83022C23.1466 4.82062 23.0674 4.81625 22.9883 4.81713C22.5169 4.86745 22.1031 4.72154 21.6915 4.51877C21.1604 4.25764 20.6108 4.03072 20.0728 3.78167C20.0227 3.75435 19.9662 3.73949 19.9085 3.73843C19.8508 3.73738 19.7937 3.75017 19.7425 3.77563C18.7998 4.18988 17.8545 4.59877 16.9068 5.00229C16.8124 5.0431 16.7099 5.06453 16.6061 5.06519C15.8013 5.05915 14.997 5.04557 14.1927 5.03399C14.1626 5.03399 14.1324 5.03097 14.0521 5.02644C14.1488 4.97613 14.2022 4.94443 14.2577 4.91726C15.4229 4.35122 16.5898 3.7877 17.7524 3.21613C17.8401 3.17336 17.9638 3.06519 17.9537 3.00632C17.9357 2.92028 17.8274 2.82418 17.7328 2.78443C16.7953 2.38946 15.8536 2.00556 14.9125 1.61865C14.8844 1.61009 14.857 1.59399 14.8401 1.58644Z" fill="white"/>
<path d="M8.25818 10.0483C8.34115 9.68855 8.41355 9.36805 8.48859 9.04805C9.0107 6.83421 9.53281 4.62037 10.0549 2.40654C10.1141 2.15496 10.1606 1.90339 10.2314 1.65836C10.261 1.56671 10.3204 1.48638 10.4011 1.42893C11.0606 0.983144 11.7264 0.545911 12.4346 0.0764771C12.3394 0.423144 12.2586 0.725534 12.1735 1.02641C11.4252 3.67631 10.6746 6.32486 9.92176 8.97207C9.88995 9.06909 9.82409 9.15276 9.73521 9.20906C9.26119 9.4883 8.77818 9.75496 8.25818 10.0483Z" fill="white"/>
<path d="M6.89209 11.8531L8.48908 11.037C8.73217 10.9127 8.96892 10.7743 9.22046 10.6677C10.1046 10.2918 10.8455 9.7313 11.5457 9.1079C12.1994 8.52526 12.8811 7.97029 13.5538 7.40576C13.6066 7.36249 13.6738 7.31067 13.7351 7.31017C14.4717 7.30363 15.2089 7.30614 15.9852 7.30614C15.9207 7.38111 15.8795 7.43394 15.8346 7.48174C15.0657 8.29129 14.2984 9.10237 13.5242 9.9069C13.4437 9.98621 13.3433 10.0447 13.2325 10.077C11.1539 10.6767 9.07531 11.2728 6.99672 11.8651C6.9666 11.8737 6.93489 11.8787 6.90424 11.8858L6.89209 11.8531Z" fill="white"/>
<path d="M12.5921 1.9884H13.9512C13.8831 2.32249 13.8228 2.63092 13.7573 2.93884C13.5375 3.97029 13.3192 5.00174 13.0893 6.03218C13.0603 6.15683 12.9961 6.27161 12.9038 6.36425C12.2903 6.95041 11.6662 7.52601 11.0458 8.10463C11.0041 8.14337 10.9597 8.1801 10.8793 8.25054C11.458 6.12828 12.0277 4.04928 12.5921 1.9884Z" fill="white"/>
<path d="M8.12607 2.00604H9.39436C9.31403 2.34868 9.23582 2.68076 9.15814 3.01233C8.8999 4.08571 8.64096 5.16009 8.38131 6.23548C8.36229 6.31296 8.34802 6.40252 8.29834 6.46089C7.84334 6.99472 7.38147 7.52303 6.88684 8.03875C7.29956 6.0317 7.71176 4.02516 8.12607 2.00604Z" fill="white"/>
<path d="M25.2908 9.86162H21.191L21.6603 7.3313H23.6452C23.5754 7.62765 23.511 7.89633 23.4491 8.16602C23.4016 8.37264 23.3558 8.57977 23.3117 8.7874C23.2737 8.96451 23.3086 9.09231 23.5157 9.16828C24.0542 9.36602 24.5853 9.58187 25.119 9.79117C25.1761 9.8113 25.2348 9.83646 25.2908 9.86162Z" fill="white"/>
<path d="M5.56676 9.99397H4.57062C4.96537 8.26618 5.35802 6.54945 5.75066 4.83221L6.70769 4.90517C6.32685 6.60546 5.94654 8.30173 5.56676 9.99397Z" fill="white"/>
<path d="M1.39248 4.88605H2.31939L0.978168 10.0277H0.0602417C0.506786 8.3019 0.951217 6.58567 1.39248 4.88605Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_85_4922">
<rect width="26" height="12" fill="white"/>
</clipPath>
</defs>
</svg>
\ No newline at end of file
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