立减金对接
This commit is contained in:
parent
77a71f54ec
commit
7452f8924d
|
@ -8,7 +8,9 @@ export enum Api {
|
|||
// 模板查询
|
||||
GET_THEME = "/v1/theme",
|
||||
// 兑换
|
||||
EXCHANGE = "/v1/order/exchange"
|
||||
EXCHANGE = "/v1/order/exchange",
|
||||
// 商品详情查询
|
||||
DETAIL_QUERY = "/v1/goods/detail",
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,3 +21,5 @@ export const QUERY = (data?: any) => request.get(Api.QUERY, data);
|
|||
export const GET_THEME = (data?: any) => request.get(Api.GET_THEME, data);
|
||||
|
||||
export const EXCHANGE = (data?: any) => request.post(Api.EXCHANGE, data);
|
||||
|
||||
export const getGoodsDetail = (data?: any) => request.get(Api.DETAIL_QUERY, data);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div id="reduce" :style="{ paddingTop: outTime.length > 0 ? '0' : '21px' }">
|
||||
<div id="reduce" :style="{ paddingTop: '21px' }">
|
||||
<!-- 弹出框 -->
|
||||
<div class="mask" v-if="maskshow"></div>
|
||||
<!-- 单条弹出框 -->
|
||||
|
@ -7,7 +7,7 @@
|
|||
{{ promttip }}
|
||||
</div> -->
|
||||
<!-- 弹出提示 -->
|
||||
<div
|
||||
<!-- <div
|
||||
class="popboxshow"
|
||||
v-if="popboxshow"
|
||||
:class="popboxshow ? 'active' : ''"
|
||||
|
@ -16,16 +16,16 @@
|
|||
<p>{{ tiptext }}</p>
|
||||
<span @click="knowFn">知道了</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- 复制提示 -->
|
||||
<div class="popboxshow" v-if="copyshow" :class="copyshow ? 'active' : ''">
|
||||
<!-- <div class="popboxshow" v-if="copyshow" :class="copyshow ? 'active' : ''">
|
||||
<div class="tip">
|
||||
<p>请点击下方[复制]按钮,复制链接到浏览器打开!</p>
|
||||
<span @click="copyFn">复制</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="countdown" v-if="outTime.length > 0">
|
||||
<!-- <div class="countdown" v-if="outTime.length > 0">
|
||||
<span>链接有效期:</span>
|
||||
<p>{{ outTime[0] }}</p>
|
||||
时
|
||||
|
@ -33,9 +33,9 @@
|
|||
分
|
||||
<p>{{ outTime[2] }}</p>
|
||||
秒
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div
|
||||
<!-- <div
|
||||
class="mask"
|
||||
v-if="loading"
|
||||
ref="load"
|
||||
|
@ -43,10 +43,10 @@
|
|||
@mousewheel.prevent
|
||||
>
|
||||
<preload-component />
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="couponShow">
|
||||
<span>
|
||||
<!-- <span>
|
||||
<img
|
||||
@click="backgoodsFn"
|
||||
v-if="backAble"
|
||||
|
@ -54,36 +54,36 @@
|
|||
src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png"
|
||||
alt=""
|
||||
/>
|
||||
</span>
|
||||
</span> -->
|
||||
<div class="coupon-left">
|
||||
<p class="coupon_money" :style="{ fontSize: '32px' }">
|
||||
<span>¥</span>{{ parseFloat(reduceInfo.reduce_amount) }}
|
||||
<p class="coupon_money" :style="{ fontSize: fonts() }">
|
||||
<span>¥</span>{{ parseFloat(info.amount || 1) }}
|
||||
</p>
|
||||
<p class="full_money">
|
||||
满{{ parseFloat(reduceInfo.denomination) }}可用
|
||||
满{{ parseFloat(info.full_amount || 1.01) }}可用
|
||||
</p>
|
||||
</div>
|
||||
<div class="coupon-right">
|
||||
<p class="title">
|
||||
{{ reduceInfo.batch_goods_name }}
|
||||
<span class="send_num" v-if="reduceInfo.send_num > 1"
|
||||
>x{{ reduceInfo.send_num }}</span
|
||||
{{ goods.name }}
|
||||
<span class="send_num" v-if="info.send_num > 1"
|
||||
>x{{ info.send_num }}</span
|
||||
>
|
||||
</p>
|
||||
<p style="font-size: 11px">{{ reduceInfo.card_type }}可用</p>
|
||||
<p class="validity" v-if="receive_time.timer_show != 2">
|
||||
有效期:{{ receive_time.effect_time.start_time }}至{{
|
||||
receive_time.effect_time.end_time
|
||||
<p style="font-size: 11px">{{ cardType(info.card_type) }}可用</p>
|
||||
<p class="validity" v-if="info.time_limit.start_date">
|
||||
有效期:{{ info.time_limit.start_date }}至{{
|
||||
info.time_limit.end_date
|
||||
}}
|
||||
</p>
|
||||
<p class="validity" v-if="receive_time.use_time.type == 'received'">
|
||||
<p class="validity" v-if="info.time_limit.receive_type">
|
||||
领取后{{
|
||||
receive_time.use_time.effect_date_type == 0 ? "立即" : "次日凌晨"
|
||||
}}生效,有效期 {{ receive_time.use_time.effect_day }}天
|
||||
info.time_limit.receive_type == 0 ? "立即" : "次日凌晨"
|
||||
}}生效,有效期 {{ info.time_limit.receive_day }}天
|
||||
</p>
|
||||
<p class="validity" v-if="receive_time.use_time.type == 'fiexd'">
|
||||
可用时间:{{ receive_time.use_time.fiexd_time.start_time }}-{{
|
||||
receive_time.use_time.fiexd_time.end_time
|
||||
<p class="validity" v-if="info.time_limit.start_time">
|
||||
可用时间:{{ info.time_limit.start_time }}-{{
|
||||
info.time_limit.end_time
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
|
@ -91,7 +91,7 @@
|
|||
<div
|
||||
class="receiveBtn"
|
||||
@click="receiveFn"
|
||||
:class="goodInfo.available != 1 ? 'readOnly' : ''"
|
||||
:class="goods.err_code != 0 ? 'readOnly' : ''"
|
||||
>
|
||||
立即领取
|
||||
<!-- {{
|
||||
|
@ -102,7 +102,7 @@
|
|||
</div>
|
||||
<div class="coupon_explain">
|
||||
<h1>- 兑换说明 -</h1>
|
||||
<div class="content">
|
||||
<!-- <div class="content">
|
||||
<h3
|
||||
v-if="
|
||||
receive_time.use_time.type == 'week' ||
|
||||
|
@ -137,30 +137,32 @@
|
|||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="content">
|
||||
<h3>使用须知</h3>
|
||||
<p v-html="goodInfo.entity.notice" v-if="goodInfo.entity.notice"></p>
|
||||
<p v-html="info.notice" v-if="info.notice"></p>
|
||||
<p v-else>
|
||||
1、在{{
|
||||
reduceInfo.channel == 1 ? "支付宝H5" : "微信APP内打开链接"
|
||||
info.channel == 1 ? "支付宝H5" : "微信APP内打开链接"
|
||||
}},点击【一键领取】完成领取{{
|
||||
reduceInfo.channel == 1 ? "支付宝" : "微信"
|
||||
info.channel == 1 ? "支付宝" : "微信"
|
||||
}}立减金<br />
|
||||
2、{{
|
||||
reduceInfo.channel == 1 ? "支付宝" : "微信"
|
||||
info.channel == 1 ? "支付宝" : "微信"
|
||||
}}立减金一旦领取不可撤销、不可转让。注意不要将兑换券泄露给他人
|
||||
</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3>使用规则</h3>
|
||||
<p v-html="goodInfo.instruction"></p>
|
||||
<p v-html="info.instruction" v-if="info.instruction"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import "./index.scss";
|
||||
import { getGoodsDetail, EXCHANGE } from "@/router/api";
|
||||
|
||||
let goodsDetail = 0,
|
||||
goodsCount = 0;
|
||||
export default {
|
||||
|
@ -168,155 +170,36 @@ export default {
|
|||
props: {},
|
||||
data() {
|
||||
return {
|
||||
plaflam: 1, //支付宝
|
||||
promtshow: false,
|
||||
promttip: "警告提示",
|
||||
copyshow: false, //解决ios,必须触发按钮复制
|
||||
copyLink: "", //存储链接
|
||||
popboxshow: false,
|
||||
maskshow: false,
|
||||
openId: localStorage.getItem("openid"),
|
||||
bindClick: false,
|
||||
tiptext: "错误提示",
|
||||
goodInfo: {
|
||||
available: 0,
|
||||
instruction: "",
|
||||
entity: {
|
||||
notice: "",
|
||||
},
|
||||
}, //商品信息
|
||||
reduceInfo: {
|
||||
channel: 1,
|
||||
reduce_amount: "",
|
||||
denomination: "",
|
||||
batch_goods_name: "",
|
||||
send_num: 0,
|
||||
card_type: 1,
|
||||
}, //券信息
|
||||
orderId: "",
|
||||
backAble: true,
|
||||
loading: false,
|
||||
outTime: [],
|
||||
receive_time: {
|
||||
timer_show: 1,
|
||||
use_time: {
|
||||
week: "",
|
||||
day: "",
|
||||
time: "",
|
||||
type: "",
|
||||
effect_date_type: 0,
|
||||
effect_day: 0,
|
||||
fiexd_time: { start_time: "", end_time: "" },
|
||||
},
|
||||
effect_time: { start_time: "", end_time: "" },
|
||||
}, //领取立减金时间
|
||||
tip: `1、立减金自领取之日起0天有效,请在有效期内使用<br />
|
||||
2、微信立减金自领取后每个立减金一次性使用,不兑换,不找零,到期后自动失效,逾期未使用不再补发。使用微信支付进行付款(大于立减金面额0.01元以上)即可自动抵扣<br />
|
||||
3、多张立减金可在单笔微信支付订单中一起使用,但当用户的立减金超过8张时,系统会选取其中一部分使用,不保证在一张订单中全部使用<br />
|
||||
4、在中国境内商户使用微信支付即可使用,少数特定商户(包括但不限于:CoCo奶茶、优衣库、星巴克、肯德基、必胜客、同程艺龙、热风、太平鸟、孩子王、航联保险、华为商城、Miss
|
||||
Sixty、Ochirly、Apple商城、FivePlus、信用卡还款、零钱通、理财通等)、以及社交支付(如转账、红包、个人收款码支付等)及合单支付(微信支付订单号为44开头的交易)无法使用立减金<br />
|
||||
5、使用立减金的微信支付订单,如发生全额退款,且立减金仍在有效期内,立减金将自动退还给用户,如立减金已过期,则不退还给用户;如发生部分退款,用户支付金额将按比例原路退还,立减金将不退还给用户<br />`,
|
||||
goodsInfo: {
|
||||
id: 68147,
|
||||
type: 2,
|
||||
code_batch_id: 9164,
|
||||
weight: 0,
|
||||
delete_time: null,
|
||||
stock: 100,
|
||||
entity: {
|
||||
id: 2776,
|
||||
goods_id: 68147,
|
||||
channel: 1,
|
||||
channel_activity_id: "23232323221jjk",
|
||||
batch_goods_name: "支付宝立减金",
|
||||
price: "10.0000",
|
||||
recharge_amount: "100.00",
|
||||
frozen_amount: "0.0000",
|
||||
balance: "100.0000",
|
||||
used_amount: "0.0000",
|
||||
denomination: "1.01",
|
||||
reduce_amount: "1.00",
|
||||
all_budget: "100.00",
|
||||
day_budget: "100.00",
|
||||
receive_conf: { num: "1", type: "all" },
|
||||
card_type: ["1"],
|
||||
natural_limit: 1,
|
||||
brush_limit: 1,
|
||||
time_limit: {
|
||||
use_time: {
|
||||
type: "received",
|
||||
effect_day: "1",
|
||||
fiexd_time: [],
|
||||
effect_date_type: "0",
|
||||
},
|
||||
timer_show: "1",
|
||||
effect_time: {
|
||||
end_time: "2024-09-30 23:59:59",
|
||||
start_time: "2024-08-28 11:41:36",
|
||||
},
|
||||
receive_time: [],
|
||||
},
|
||||
instruction:
|
||||
"<p>1、立减金自领取之日起7天有效,请在有效期内使用\n<br/>2、支付宝立减金自领取后每个立减金一次性使用,不兑换、不找零,到期后自动失效,逾期未使用不再补发。使用支付宝支付进行付款(大于立减金面额0.01元以上)即可自动抵扣\n<br/>3、多张立减金可在单笔支付宝支付订单中一起使用,但当用户的立减金超过8张时,系统会选取其中一部分使用,不保证在一张订单中全部使用\n<br/>4、使用立减金的支付宝支付订单,如发生全额退款,且立减金仍在有效期内,立减金将自动退还给用户,如立减金已过期,则不退还给用户;如发生部分退款,用户支付金额将按比例原路退还,立减金将不退还给用户</p>",
|
||||
early_per: ["1"],
|
||||
early_notifier: [{ mobile: "18202818112", real_name: "张城" }],
|
||||
last_early_per: 0,
|
||||
temp_no: "23232323",
|
||||
create_time: "2024-08-28 11:46:17",
|
||||
delete_time: null,
|
||||
provider: "lsxd",
|
||||
receive_mode: 1,
|
||||
send_num: 1,
|
||||
is_webview: 0,
|
||||
notice:
|
||||
"<p>1、在支付宝H5内打开链接,点击【一键领取】完成领取支付宝立减金<br/>\n2、支付宝立减金一旦领取不可撤销、不可转让。注意不要将兑换券泄露给他人</p>",
|
||||
voucher_batch: ["23232323221jjk"],
|
||||
},
|
||||
begin_time: "2024-08-23 15:19:10",
|
||||
end_time: "2024-09-30 23:59:59",
|
||||
available: 1,
|
||||
exchange: 0,
|
||||
product_id: 68147,
|
||||
key: "AAACsHAafZqcB5vd",
|
||||
instruction:
|
||||
"<p>1、立减金自领取之日起7天有效,请在有效期内使用\n<br/>2、支付宝立减金自领取后每个立减金一次性使用,不兑换、不找零,到期后自动失效,逾期未使用不再补发。使用支付宝支付进行付款(大于立减金面额0.01元以上)即可自动抵扣\n<br/>3、多张立减金可在单笔支付宝支付订单中一起使用,但当用户的立减金超过8张时,系统会选取其中一部分使用,不保证在一张订单中全部使用\n<br/>4、使用立减金的支付宝支付订单,如发生全额退款,且立减金仍在有效期内,立减金将自动退还给用户,如立减金已过期,则不退还给用户;如发生部分退款,用户支付金额将按比例原路退还,立减金将不退还给用户</p>",
|
||||
recharge_type: 1,
|
||||
origin_price: "1.00",
|
||||
coupon_price: "1.00",
|
||||
// 新版
|
||||
goodsID: 0, // 商品ID
|
||||
// 立减金商品信息
|
||||
info: {
|
||||
amount: 1, // 金额
|
||||
full_amount: 1.01, // 满减金额
|
||||
send_num: 1, // 多少张立减金
|
||||
card_type: ["1"], // 卡种类型
|
||||
// 领取时间
|
||||
time_limit: {},
|
||||
},
|
||||
goods: {
|
||||
name: "立减金", // 商品名称
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
document.title = localStorage.getItem("title") || "";
|
||||
/* 获取立减金信息*/
|
||||
let goodsDetail = this.goodsInfo;
|
||||
this.goodInfo = goodsDetail;
|
||||
/*默认显示*/
|
||||
// if (goodsDetail.available != 1) {
|
||||
// this.openErrorDialog(product_status(goodsDetail.available, goodsDetail));
|
||||
// this.bindClick = true;
|
||||
// }
|
||||
const goodsCount: any = sessionStorage.getItem("goodsCount") || 12;
|
||||
this.backAble = goodsCount > 1; //多个商品才有返回
|
||||
Object.assign(this.reduceInfo, goodsDetail.entity);
|
||||
this.plaflam = goodsDetail.entity.channel;
|
||||
if (
|
||||
goodsDetail.entity.time_limit.use_time &&
|
||||
goodsDetail.entity.time_limit.use_time.type == "week"
|
||||
) {
|
||||
//处理星期连贯操作
|
||||
// goodsDetail.entity.time_limit.use_time.week = sortWeeks(
|
||||
// goodsDetail.entity.time_limit.use_time.week
|
||||
// );
|
||||
async created() {
|
||||
this.goodsID = localStorage.getItem("id") || 810;
|
||||
const { code, data } = await getGoodsDetail({ id: this.goodsID });
|
||||
if (code === 200) {
|
||||
Object.assign(this.info, data.info, {
|
||||
time_limit: data.info.time_limit
|
||||
? JSON.parse(data.info.time_limit)
|
||||
: {},
|
||||
card_type: data.info.card_type || ["1"],
|
||||
});
|
||||
Object.assign(this.goods, data.goods);
|
||||
}
|
||||
Object.assign(this.receive_time, goodsDetail.entity.time_limit);
|
||||
|
||||
/* 倒计时 */
|
||||
const key_expiration_time =
|
||||
sessionStorage.getItem("key_expiration_time") || 0;
|
||||
this.outTime = [];
|
||||
},
|
||||
filters: {
|
||||
methods: {
|
||||
cardType(val: any[]) {
|
||||
return val
|
||||
.map((item) => {
|
||||
|
@ -324,8 +207,6 @@ export default {
|
|||
})
|
||||
.join(" ");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
globalFormatStatus(type: any) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
|
@ -343,10 +224,23 @@ export default {
|
|||
history.go(-2);
|
||||
}
|
||||
},
|
||||
receiveFn() {
|
||||
if (this.loading) return;
|
||||
this.loading = true;
|
||||
async receiveFn() {
|
||||
let self = this;
|
||||
if (this.goods.err_code != 0) {
|
||||
return showToast(this.goods.reason);
|
||||
}
|
||||
const params = {
|
||||
id: [this.goodsID],
|
||||
key:
|
||||
localStorage.getItem("key") ||
|
||||
"rPBVzOCs0FN4P7jNMqHo5IVfb0oaAyigbfNBmCKnavs=",
|
||||
account: "123",
|
||||
name: "123",
|
||||
};
|
||||
const res = await EXCHANGE(params);
|
||||
// if(res.code === 200) {
|
||||
|
||||
// }
|
||||
},
|
||||
|
||||
/* 公众号领取 */
|
||||
|
@ -404,11 +298,10 @@ export default {
|
|||
|
||||
/* 动态font */
|
||||
fonts() {
|
||||
const defaultCss = "0.32rem";
|
||||
const count =
|
||||
String(parseFloat(this.reduceInfo.reduce_amount)).length + 1;
|
||||
const defaultCss = "32px";
|
||||
const count = String(parseFloat(this.info.amount || 1)).length + 1;
|
||||
if (count > 4) {
|
||||
return 0.32 - ((count - 3) / 100) * 2.2 + "rem";
|
||||
return 32 - (count - 3) * 2.2 + "px";
|
||||
} else {
|
||||
return defaultCss;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue