Compare commits

...

2 Commits

2 changed files with 86 additions and 189 deletions

View File

@ -10,7 +10,9 @@ export enum Api {
// 模板查询 // 模板查询
GET_THEME = "/v1/theme", GET_THEME = "/v1/theme",
// 兑换 // 兑换
EXCHANGE = "/v1/order/exchange" EXCHANGE = "/v1/order/exchange",
// 商品详情查询
DETAIL_QUERY = "/v1/goods/detail",
} }
@ -23,3 +25,5 @@ export const DETAIL = (data?: any) => request.get(Api.DETAIL, data);
export const GET_THEME = (data?: any) => request.get(Api.GET_THEME, 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 EXCHANGE = (data?: any) => request.post(Api.EXCHANGE, data);
export const getGoodsDetail = (data?: any) => request.get(Api.DETAIL_QUERY, data);

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="reduce" :style="{ paddingTop: outTime.length > 0 ? '0' : '21px' }"> <div id="reduce" :style="{ paddingTop: '21px' }">
<!-- 弹出框 --> <!-- 弹出框 -->
<div class="mask" v-if="maskshow"></div> <div class="mask" v-if="maskshow"></div>
<!-- 单条弹出框 --> <!-- 单条弹出框 -->
@ -7,7 +7,7 @@
{{ promttip }} {{ promttip }}
</div> --> </div> -->
<!-- 弹出提示 --> <!-- 弹出提示 -->
<div <!-- <div
class="popboxshow" class="popboxshow"
v-if="popboxshow" v-if="popboxshow"
:class="popboxshow ? 'active' : ''" :class="popboxshow ? 'active' : ''"
@ -16,16 +16,16 @@
<p>{{ tiptext }}</p> <p>{{ tiptext }}</p>
<span @click="knowFn">知道了</span> <span @click="knowFn">知道了</span>
</div> </div>
</div> </div> -->
<!-- 复制提示 --> <!-- 复制提示 -->
<div class="popboxshow" v-if="copyshow" :class="copyshow ? 'active' : ''"> <!-- <div class="popboxshow" v-if="copyshow" :class="copyshow ? 'active' : ''">
<div class="tip"> <div class="tip">
<p>请点击下方[复制]按钮复制链接到浏览器打开</p> <p>请点击下方[复制]按钮复制链接到浏览器打开</p>
<span @click="copyFn">复制</span> <span @click="copyFn">复制</span>
</div> </div>
</div> </div> -->
<div class="countdown" v-if="outTime.length > 0"> <!-- <div class="countdown" v-if="outTime.length > 0">
<span>链接有效期</span> <span>链接有效期</span>
<p>{{ outTime[0] }}</p> <p>{{ outTime[0] }}</p>
@ -33,9 +33,9 @@
<p>{{ outTime[2] }}</p> <p>{{ outTime[2] }}</p>
</div> </div> -->
<div <!-- <div
class="mask" class="mask"
v-if="loading" v-if="loading"
ref="load" ref="load"
@ -43,10 +43,10 @@
@mousewheel.prevent @mousewheel.prevent
> >
<preload-component /> <preload-component />
</div> </div> -->
<div class="couponShow"> <div class="couponShow">
<span> <!-- <span>
<img <img
@click="backgoodsFn" @click="backgoodsFn"
v-if="backAble" v-if="backAble"
@ -54,36 +54,36 @@
src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png" src="https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/backprepageBtn.png"
alt="" alt=""
/> />
</span> </span> -->
<div class="coupon-left"> <div class="coupon-left">
<p class="coupon_money" :style="{ fontSize: '32px' }"> <p class="coupon_money" :style="{ fontSize: fonts() }">
<span></span>{{ parseFloat(reduceInfo.reduce_amount) }} <span></span>{{ parseFloat(info.amount || 1) }}
</p> </p>
<p class="full_money"> <p class="full_money">
{{ parseFloat(reduceInfo.denomination) }}可用 {{ parseFloat(info.full_amount || 1.01) }}可用
</p> </p>
</div> </div>
<div class="coupon-right"> <div class="coupon-right">
<p class="title"> <p class="title">
{{ reduceInfo.batch_goods_name }} {{ goods.name }}
<span class="send_num" v-if="reduceInfo.send_num > 1" <span class="send_num" v-if="info.send_num > 1"
>x{{ reduceInfo.send_num }}</span >x{{ info.send_num }}</span
> >
</p> </p>
<p style="font-size: 11px">{{ reduceInfo.card_type }}可用</p> <p style="font-size: 11px">{{ cardType(info.card_type) }}可用</p>
<p class="validity" v-if="receive_time.timer_show != 2"> <p class="validity" v-if="info.time_limit.start_date">
有效期:{{ receive_time.effect_time.start_time }}{{ 有效期:{{ info.time_limit.start_date }}{{
receive_time.effect_time.end_time info.time_limit.end_date
}} }}
</p> </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 ? "立即" : "次日凌晨" info.time_limit.receive_type == 0 ? "立即" : "次日凌晨"
}}生效,有效期 {{ receive_time.use_time.effect_day }} }}生效,有效期 {{ info.time_limit.receive_day }}
</p> </p>
<p class="validity" v-if="receive_time.use_time.type == 'fiexd'"> <p class="validity" v-if="info.time_limit.start_time">
可用时间:{{ receive_time.use_time.fiexd_time.start_time }}-{{ 可用时间:{{ info.time_limit.start_time }}-{{
receive_time.use_time.fiexd_time.end_time info.time_limit.end_time
}} }}
</p> </p>
</div> </div>
@ -91,7 +91,7 @@
<div <div
class="receiveBtn" class="receiveBtn"
@click="receiveFn" @click="receiveFn"
:class="goodInfo.available != 1 ? 'readOnly' : ''" :class="goods.err_code != 0 ? 'readOnly' : ''"
> >
立即领取 立即领取
<!-- {{ <!-- {{
@ -102,7 +102,7 @@
</div> </div>
<div class="coupon_explain"> <div class="coupon_explain">
<h1>- 兑换说明 -</h1> <h1>- 兑换说明 -</h1>
<div class="content"> <!-- <div class="content">
<h3 <h3
v-if=" v-if="
receive_time.use_time.type == 'week' || receive_time.use_time.type == 'week' ||
@ -137,30 +137,32 @@
</div> </div>
</li> </li>
</ul> </ul>
</div> </div> -->
<div class="content"> <div class="content">
<h3>使用须知</h3> <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> <p v-else>
1{{ 1{{
reduceInfo.channel == 1 ? "支付宝H5" : "微信APP内打开链接" info.channel == 1 ? "支付宝H5" : "微信APP内打开链接"
}}点击一键领取完成领取{{ }}点击一键领取完成领取{{
reduceInfo.channel == 1 ? "支付宝" : "微信" info.channel == 1 ? "支付宝" : "微信"
}}立减金<br /> }}立减金<br />
2{{ 2{{
reduceInfo.channel == 1 ? "支付宝" : "微信" info.channel == 1 ? "支付宝" : "微信"
}}立减金一旦领取不可撤销不可转让注意不要将兑换券泄露给他人 }}立减金一旦领取不可撤销不可转让注意不要将兑换券泄露给他人
</p> </p>
</div> </div>
<div class="content"> <div class="content">
<h3>使用规则</h3> <h3>使用规则</h3>
<p v-html="goodInfo.instruction"></p> <p v-html="info.instruction" v-if="info.instruction"></p>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import "./index.scss"; import "./index.scss";
import { getGoodsDetail, EXCHANGE } from "@/router/api";
let goodsDetail = 0, let goodsDetail = 0,
goodsCount = 0; goodsCount = 0;
export default { export default {
@ -168,155 +170,36 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
plaflam: 1, // //
promtshow: false, goodsID: 0, // ID
promttip: "警告提示", //
copyshow: false, //ios info: {
copyLink: "", // amount: 1, //
popboxshow: false, full_amount: 1.01, //
maskshow: false, send_num: 1, //
openId: localStorage.getItem("openid"), card_type: ["1"], //
bindClick: false, //
tiptext: "错误提示", time_limit: {},
goodInfo: { },
available: 0, goods: {
instruction: "", name: "立减金", //
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
SixtyOchirlyApple商城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",
}, },
}; };
}, },
created() { async created() {
document.title = localStorage.getItem("title") || ""; this.goodsID = localStorage.getItem("id") || 810;
/* 获取立减金信息*/ const { code, data } = await getGoodsDetail({ id: this.goodsID });
let goodsDetail = this.goodsInfo; if (code === 200) {
this.goodInfo = goodsDetail; Object.assign(this.info, data.info, {
/*默认显示*/ time_limit: data.info.time_limit
// if (goodsDetail.available != 1) { ? JSON.parse(data.info.time_limit)
// this.openErrorDialog(product_status(goodsDetail.available, goodsDetail)); : {},
// this.bindClick = true; card_type: data.info.card_type || ["1"],
// } });
const goodsCount: any = sessionStorage.getItem("goodsCount") || 12; Object.assign(this.goods, data.goods);
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
// );
} }
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[]) { cardType(val: any[]) {
return val return val
.map((item) => { .map((item) => {
@ -324,8 +207,6 @@ export default {
}) })
.join(" "); .join(" ");
}, },
},
methods: {
globalFormatStatus(type: any) { globalFormatStatus(type: any) {
switch (type) { switch (type) {
case 1: case 1:
@ -343,10 +224,23 @@ export default {
history.go(-2); history.go(-2);
} }
}, },
receiveFn() { async receiveFn() {
if (this.loading) return;
this.loading = true;
let self = this; 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 */ /* 动态font */
fonts() { fonts() {
const defaultCss = "0.32rem"; const defaultCss = "32px";
const count = const count = String(parseFloat(this.info.amount || 1)).length + 1;
String(parseFloat(this.reduceInfo.reduce_amount)).length + 1;
if (count > 4) { if (count > 4) {
return 0.32 - ((count - 3) / 100) * 2.2 + "rem"; return 32 - (count - 3) * 2.2 + "px";
} else { } else {
return defaultCss; return defaultCss;
} }