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",
// 兑换
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 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>
<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
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",
//
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;
}