清除定时器

This commit is contained in:
zhouxinyu1029 2024-04-12 21:41:50 +08:00
parent db279e7a13
commit 9d2318d68f
3 changed files with 78 additions and 60 deletions

View File

@ -214,7 +214,7 @@
const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
new Vue({ new Vue({
el: "#app", el: "#app",
data () { data() {
return { return {
goods: '', goods: '',
backAble: (~~sessionStorage.getItem('goodsCount')) > 1, backAble: (~~sessionStorage.getItem('goodsCount')) > 1,
@ -249,7 +249,7 @@
}; };
}, },
mounted () { mounted() {
document.title = localStorage.getItem('title'); document.title = localStorage.getItem('title');
this.code_batch_id = JSON.parse(sessionStorage.getItem('goodsInfo')).entity.code_batch_id; this.code_batch_id = JSON.parse(sessionStorage.getItem('goodsInfo')).entity.code_batch_id;
this.getProductDetail(); this.getProductDetail();
@ -272,7 +272,7 @@
}, },
computed: { computed: {
dynamicStyle () { dynamicStyle() {
switch (Number(this.goods.group_info.channel)) { switch (Number(this.goods.group_info.channel)) {
case 1: case 1:
return { return {
@ -326,7 +326,7 @@
methods: { methods: {
//获取商品详情 //获取商品详情
getProductDetail () { getProductDetail() {
const self = this; const self = this;
req.axiosGet('/key/group/v2/groupProductDetail', { req.axiosGet('/key/group/v2/groupProductDetail', {
token: self.token, token: self.token,
@ -341,6 +341,10 @@
// send_status 1发放中2全部成功 3全部失败4部分失败 5未领取 // send_status 1发放中2全部成功 3全部失败4部分失败 5未领取
self.popMsg = self.goods.send_status === 2 || self.goods.send_status === 3 || self.goods.send_status === 4 ? true : false; self.popMsg = self.goods.send_status === 2 || self.goods.send_status === 3 || self.goods.send_status === 4 ? true : false;
if (self.goods.send_status === 2 || self.goods.send_status === 3) {
clearInterval(self.timeGet);
self.timeGet = null;
}
// 部分失败 // 部分失败
if (self.goods.send_status === 4) { if (self.goods.send_status === 4) {
let all_product_voucher = []; let all_product_voucher = [];
@ -351,6 +355,8 @@
let is_err_length = all_product_voucher.filter(item => item.status === 9).length; let is_err_length = all_product_voucher.filter(item => item.status === 9).length;
self.isOKLength = all_product_voucher.length - is_err_length; self.isOKLength = all_product_voucher.length - is_err_length;
self.isErrLength = is_err_length; self.isErrLength = is_err_length;
clearInterval(self.timeGet);
self.timeGet = null;
} }
// 1.发放中 轮循 // 1.发放中 轮循
@ -391,7 +397,7 @@
}).catch(); }).catch();
}, },
// 轮循 // 轮循
groupProductVoucherDetail () { groupProductVoucherDetail() {
let self = this; let self = this;
req.axiosPost('/key/group/groupProductVoucherDetail', { req.axiosPost('/key/group/groupProductVoucherDetail', {
token: this.token, token: this.token,
@ -507,7 +513,7 @@
/* ******************************************** 官方领取 ******************************************** */ /* ******************************************** 官方领取 ******************************************** */
/* 直接领取 */ /* 直接领取 */
directSubmit () { directSubmit() {
const self = this; const self = this;
self.loading = true; self.loading = true;
setTimeout(() => { setTimeout(() => {
@ -558,7 +564,7 @@
}, },
/* 公众号领取 */ /* 公众号领取 */
publicCollection () { publicCollection() {
let params = { let params = {
token: this.token, token: this.token,
code_batch_id: this.code_batch_id, code_batch_id: this.code_batch_id,
@ -588,7 +594,7 @@
}, },
/* 支付宝官方领取H5跳转 */ /* 支付宝官方领取H5跳转 */
toLinkAlipay () { toLinkAlipay() {
// 领取成功结算 5 // 领取成功结算 5
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) {
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
@ -621,7 +627,7 @@
/* ******************************************** 账号领取 ******************************************** */ /* ******************************************** 账号领取 ******************************************** */
/* 立即领取 */ /* 立即领取 */
submit () { submit() {
if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) { if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) {
const { confirm, receive_account } = this.form; const { confirm, receive_account } = this.form;
if (this.loading) return; if (this.loading) return;
@ -638,7 +644,7 @@
}, },
// 提交函数 // 提交函数
submitOne (data) { submitOne(data) {
/* 领取立减金 */ /* 领取立减金 */
req.axiosPost("/key/couponGroupUsage", data) req.axiosPost("/key/couponGroupUsage", data)
.then(({ code, message }) => { .then(({ code, message }) => {
@ -656,7 +662,7 @@
}, },
// 重试函数 // 重试函数
resetSubmit (data) { resetSubmit(data) {
/* 领取立减金 */ /* 领取立减金 */
req.axiosPost("/voucher/groupVoucherRetry", data) req.axiosPost("/voucher/groupVoucherRetry", data)
.then(({ code, message }) => { .then(({ code, message }) => {
@ -670,7 +676,7 @@
}, },
/* 验证后 最终提交 */ /* 验证后 最终提交 */
finalSubmit () { finalSubmit() {
const self = this; const self = this;
self.loading = true; self.loading = true;
setTimeout(() => { setTimeout(() => {
@ -697,7 +703,7 @@
}, },
/* 返回 */ /* 返回 */
backGoodsFn () { backGoodsFn() {
if (this.backAble) { if (this.backAble) {
window.location.replace('./homepage.html'); window.location.replace('./homepage.html');
} else { } else {
@ -706,7 +712,7 @@
}, },
/* 接口异常处理 */ /* 接口异常处理 */
axiosErrorFun (code, message) { axiosErrorFun(code, message) {
this.loading = false; this.loading = false;
if (code == 403) { if (code == 403) {
if (this.backAble) { if (this.backAble) {
@ -723,7 +729,7 @@
}, },
//复制文本 //复制文本
copyFn () { copyFn() {
var textArea = document.createElement("textarea"); var textArea = document.createElement("textarea");
textArea.value = this.copyLink; textArea.value = this.copyLink;
document.body.appendChild(textArea); document.body.appendChild(textArea);
@ -738,7 +744,7 @@
}, },
/* 触发提示 */ /* 触发提示 */
tips (text) { tips(text) {
this.cls && clearTimeout(this.cls); this.cls && clearTimeout(this.cls);
this.prompt_text = text; this.prompt_text = text;
this.promptShow = true; this.promptShow = true;
@ -747,18 +753,18 @@
}, 3000); }, 3000);
}, },
// 错误弹出框关闭 // 错误弹出框关闭
knowFn () { knowFn() {
this.popboxshow = false; this.popboxshow = false;
this.maskshow = false; this.maskshow = false;
}, },
// 错误弹窗 // 错误弹窗
openErrorDialog (tip) { openErrorDialog(tip) {
this.maskshow = true; this.maskshow = true;
this.tiptext = tip; this.tiptext = tip;
this.popboxshow = true; this.popboxshow = true;
}, },
// 6发放中 1待使用 9领取失败 20待领取 轮循+详情 // 6发放中 1待使用 9领取失败 20待领取 轮循+详情
formatStatusText (status) { formatStatusText(status) {
switch (status) { switch (status) {
case 6: case 6:
return "发放中"; return "发放中";
@ -775,7 +781,7 @@
} }
}, },
// 计算 num // 计算 num
computeNum (data) { computeNum(data) {
const self = this; const self = this;
let new_product = data.map(item => { let new_product = data.map(item => {
let result = item.voucher.reduce((acc, curr) => { let result = item.voucher.reduce((acc, curr) => {

View File

@ -214,7 +214,7 @@
const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
new Vue({ new Vue({
el: "#app", el: "#app",
data () { data() {
return { return {
goods: '', goods: '',
backAble: (~~sessionStorage.getItem('goodsCount')) > 1, backAble: (~~sessionStorage.getItem('goodsCount')) > 1,
@ -249,7 +249,7 @@
}; };
}, },
mounted () { mounted() {
document.title = localStorage.getItem('title'); document.title = localStorage.getItem('title');
this.code_batch_id = JSON.parse(sessionStorage.getItem('goodsInfo')).entity.code_batch_id; this.code_batch_id = JSON.parse(sessionStorage.getItem('goodsInfo')).entity.code_batch_id;
this.getProductDetail(); this.getProductDetail();
@ -272,7 +272,7 @@
}, },
computed: { computed: {
dynamicStyle () { dynamicStyle() {
switch (Number(this.goods.group_info.channel)) { switch (Number(this.goods.group_info.channel)) {
case 1: case 1:
return { return {
@ -326,7 +326,7 @@
methods: { methods: {
//获取商品详情 //获取商品详情
getProductDetail () { getProductDetail() {
const self = this; const self = this;
req.axiosGet('/key/group/v2/groupProductDetail', { req.axiosGet('/key/group/v2/groupProductDetail', {
token: self.token, token: self.token,
@ -341,6 +341,10 @@
// send_status 1发放中2全部成功 3全部失败4部分失败 5未领取 // send_status 1发放中2全部成功 3全部失败4部分失败 5未领取
self.popMsg = self.goods.send_status === 2 || self.goods.send_status === 3 || self.goods.send_status === 4 ? true : false; self.popMsg = self.goods.send_status === 2 || self.goods.send_status === 3 || self.goods.send_status === 4 ? true : false;
if (self.goods.send_status === 2 || self.goods.send_status === 3) {
clearInterval(self.timeGet);
self.timeGet = null;
}
// 部分失败 // 部分失败
if (self.goods.send_status === 4) { if (self.goods.send_status === 4) {
let all_product_voucher = []; let all_product_voucher = [];
@ -351,6 +355,8 @@
let is_err_length = all_product_voucher.filter(item => item.status === 9).length; let is_err_length = all_product_voucher.filter(item => item.status === 9).length;
self.isOKLength = all_product_voucher.length - is_err_length; self.isOKLength = all_product_voucher.length - is_err_length;
self.isErrLength = is_err_length; self.isErrLength = is_err_length;
clearInterval(self.timeGet);
self.timeGet = null;
} }
// 1.发放中 轮循 // 1.发放中 轮循
@ -391,7 +397,7 @@
}).catch(); }).catch();
}, },
// 轮循 // 轮循
groupProductVoucherDetail () { groupProductVoucherDetail() {
let self = this; let self = this;
req.axiosPost('/key/group/groupProductVoucherDetail', { req.axiosPost('/key/group/groupProductVoucherDetail', {
token: this.token, token: this.token,
@ -507,7 +513,7 @@
/* ******************************************** 官方领取 ******************************************** */ /* ******************************************** 官方领取 ******************************************** */
/* 直接领取 */ /* 直接领取 */
directSubmit () { directSubmit() {
const self = this; const self = this;
self.loading = true; self.loading = true;
setTimeout(() => { setTimeout(() => {
@ -557,7 +563,7 @@
}, },
/* 公众号领取 */ /* 公众号领取 */
publicCollection () { publicCollection() {
let params = { let params = {
token: this.token, token: this.token,
code_batch_id: this.code_batch_id, code_batch_id: this.code_batch_id,
@ -587,7 +593,7 @@
}, },
/* 支付宝官方领取H5跳转 */ /* 支付宝官方领取H5跳转 */
toLinkAlipay () { toLinkAlipay() {
// 领取成功结算 5 // 领取成功结算 5
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) { if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) {
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type); settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
@ -620,7 +626,7 @@
/* ******************************************** 账号领取 ******************************************** */ /* ******************************************** 账号领取 ******************************************** */
/* 立即领取 */ /* 立即领取 */
submit () { submit() {
if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) { if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) {
const { confirm, receive_account } = this.form; const { confirm, receive_account } = this.form;
if (this.loading) return; if (this.loading) return;
@ -637,7 +643,7 @@
}, },
// 提交函数 // 提交函数
submitOne (data) { submitOne(data) {
/* 领取立减金 */ /* 领取立减金 */
req.axiosPost("/key/couponGroupUsage", data) req.axiosPost("/key/couponGroupUsage", data)
.then(({ code, message }) => { .then(({ code, message }) => {
@ -655,7 +661,7 @@
}, },
// 重试函数 // 重试函数
resetSubmit (data) { resetSubmit(data) {
/* 领取立减金 */ /* 领取立减金 */
req.axiosPost("/voucher/groupVoucherRetry", data) req.axiosPost("/voucher/groupVoucherRetry", data)
.then(({ code, message }) => { .then(({ code, message }) => {
@ -669,7 +675,7 @@
}, },
/* 验证后 最终提交 */ /* 验证后 最终提交 */
finalSubmit () { finalSubmit() {
const self = this; const self = this;
self.loading = true; self.loading = true;
setTimeout(() => { setTimeout(() => {
@ -696,7 +702,7 @@
}, },
/* 返回 */ /* 返回 */
backGoodsFn () { backGoodsFn() {
if (this.backAble) { if (this.backAble) {
window.location.replace('./homepage.html'); window.location.replace('./homepage.html');
} else { } else {
@ -705,7 +711,7 @@
}, },
/* 接口异常处理 */ /* 接口异常处理 */
axiosErrorFun (code, message) { axiosErrorFun(code, message) {
this.loading = false; this.loading = false;
if (code == 403) { if (code == 403) {
if (this.backAble) { if (this.backAble) {
@ -722,7 +728,7 @@
}, },
//复制文本 //复制文本
copyFn () { copyFn() {
var textArea = document.createElement("textarea"); var textArea = document.createElement("textarea");
textArea.value = this.copyLink; textArea.value = this.copyLink;
document.body.appendChild(textArea); document.body.appendChild(textArea);
@ -737,7 +743,7 @@
}, },
/* 触发提示 */ /* 触发提示 */
tips (text) { tips(text) {
this.cls && clearTimeout(this.cls); this.cls && clearTimeout(this.cls);
this.prompt_text = text; this.prompt_text = text;
this.promptShow = true; this.promptShow = true;
@ -746,18 +752,18 @@
}, 3000); }, 3000);
}, },
// 错误弹出框关闭 // 错误弹出框关闭
knowFn () { knowFn() {
this.popboxshow = false; this.popboxshow = false;
this.maskshow = false; this.maskshow = false;
}, },
// 错误弹窗 // 错误弹窗
openErrorDialog (tip) { openErrorDialog(tip) {
this.maskshow = true; this.maskshow = true;
this.tiptext = tip; this.tiptext = tip;
this.popboxshow = true; this.popboxshow = true;
}, },
// 6发放中 1待使用 9领取失败 20待领取 轮循+详情 // 6发放中 1待使用 9领取失败 20待领取 轮循+详情
formatStatusText (status) { formatStatusText(status) {
switch (status) { switch (status) {
case 6: case 6:
return "发放中"; return "发放中";
@ -774,7 +780,7 @@
} }
}, },
// 计算 num // 计算 num
computeNum (data) { computeNum(data) {
const self = this; const self = this;
let new_product = data.map(item => { let new_product = data.map(item => {
let result = item.voucher.reduce((acc, curr) => { let result = item.voucher.reduce((acc, curr) => {

View File

@ -213,7 +213,7 @@
const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
new Vue({ new Vue({
el: "#app", el: "#app",
data () { data() {
return { return {
goods: '', goods: '',
backAble: (~~sessionStorage.getItem('goodsCount')) > 1, backAble: (~~sessionStorage.getItem('goodsCount')) > 1,
@ -248,7 +248,7 @@
}; };
}, },
mounted () { mounted() {
document.title = localStorage.getItem('title'); document.title = localStorage.getItem('title');
this.code_batch_id = JSON.parse(sessionStorage.getItem('goodsInfo')).entity.code_batch_id; this.code_batch_id = JSON.parse(sessionStorage.getItem('goodsInfo')).entity.code_batch_id;
this.getProductDetail(); this.getProductDetail();
@ -271,7 +271,7 @@
}, },
computed: { computed: {
dynamicStyle () { dynamicStyle() {
switch (Number(this.goods.group_info.channel)) { switch (Number(this.goods.group_info.channel)) {
case 1: case 1:
return { return {
@ -325,7 +325,7 @@
methods: { methods: {
//获取商品详情 //获取商品详情
getProductDetail () { getProductDetail() {
const self = this; const self = this;
req.axiosGet('/key/group/v2/groupProductDetail', { req.axiosGet('/key/group/v2/groupProductDetail', {
token: self.token, token: self.token,
@ -340,6 +340,10 @@
// send_status 1发放中2全部成功 3全部失败4部分失败 5未领取 // send_status 1发放中2全部成功 3全部失败4部分失败 5未领取
self.popMsg = self.goods.send_status === 2 || self.goods.send_status === 3 || self.goods.send_status === 4 ? true : false; self.popMsg = self.goods.send_status === 2 || self.goods.send_status === 3 || self.goods.send_status === 4 ? true : false;
if (self.goods.send_status === 2 || self.goods.send_status === 3) {
clearInterval(self.timeGet);
self.timeGet = null;
}
// 部分失败 // 部分失败
if (self.goods.send_status === 4) { if (self.goods.send_status === 4) {
let all_product_voucher = []; let all_product_voucher = [];
@ -350,6 +354,8 @@
let is_err_length = all_product_voucher.filter(item => item.status === 9).length; let is_err_length = all_product_voucher.filter(item => item.status === 9).length;
self.isOKLength = all_product_voucher.length - is_err_length; self.isOKLength = all_product_voucher.length - is_err_length;
self.isErrLength = is_err_length; self.isErrLength = is_err_length;
clearInterval(self.timeGet);
self.timeGet = null;
} }
// 1.发放中 轮循 // 1.发放中 轮循
@ -378,7 +384,7 @@
}).catch(); }).catch();
}, },
// 轮循 // 轮循
groupProductVoucherDetail () { groupProductVoucherDetail() {
let self = this; let self = this;
req.axiosPost('/key/group/groupProductVoucherDetail', { req.axiosPost('/key/group/groupProductVoucherDetail', {
token: this.token, token: this.token,
@ -494,7 +500,7 @@
/* ******************************************** 官方领取 ******************************************** */ /* ******************************************** 官方领取 ******************************************** */
/* 直接领取 */ /* 直接领取 */
directSubmit () { directSubmit() {
const self = this; const self = this;
self.loading = true; self.loading = true;
setTimeout(() => { setTimeout(() => {
@ -540,7 +546,7 @@
}, },
/* 公众号领取 */ /* 公众号领取 */
publicCollection () { publicCollection() {
let params = { let params = {
token: this.token, token: this.token,
code_batch_id: this.code_batch_id, code_batch_id: this.code_batch_id,
@ -560,7 +566,7 @@
}, },
/* 支付宝官方领取H5跳转 */ /* 支付宝官方领取H5跳转 */
toLinkAlipay () { toLinkAlipay() {
let self = this; let self = this;
let banklink = encodeURIComponent( let banklink = encodeURIComponent(
window.location.origin + window.location.origin +
@ -583,7 +589,7 @@
/* ******************************************** 账号领取 ******************************************** */ /* ******************************************** 账号领取 ******************************************** */
/* 立即领取 */ /* 立即领取 */
submit () { submit() {
if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) { if (this.goods.group_info.channel == 3 || this.goods.group_info.channel == 1 && this.goods.group_info.receive_mode == 2) {
const { confirm, receive_account } = this.form; const { confirm, receive_account } = this.form;
if (this.loading) return; if (this.loading) return;
@ -600,7 +606,7 @@
}, },
// 提交函数 // 提交函数
submitOne (data) { submitOne(data) {
/* 领取立减金 */ /* 领取立减金 */
req.axiosPost("/key/couponGroupUsage", data) req.axiosPost("/key/couponGroupUsage", data)
.then(({ code, message }) => { .then(({ code, message }) => {
@ -614,7 +620,7 @@
}, },
// 重试函数 // 重试函数
resetSubmit (data) { resetSubmit(data) {
/* 领取立减金 */ /* 领取立减金 */
req.axiosPost("/voucher/groupVoucherRetry", data) req.axiosPost("/voucher/groupVoucherRetry", data)
.then(({ code, message }) => { .then(({ code, message }) => {
@ -628,7 +634,7 @@
}, },
/* 验证后 最终提交 */ /* 验证后 最终提交 */
finalSubmit () { finalSubmit() {
const self = this; const self = this;
self.loading = true; self.loading = true;
setTimeout(() => { setTimeout(() => {
@ -655,7 +661,7 @@
}, },
/* 返回 */ /* 返回 */
backGoodsFn () { backGoodsFn() {
if (this.backAble) { if (this.backAble) {
window.location.replace('./homepage.html'); window.location.replace('./homepage.html');
} else { } else {
@ -664,7 +670,7 @@
}, },
/* 接口异常处理 */ /* 接口异常处理 */
axiosErrorFun (code, message) { axiosErrorFun(code, message) {
this.loading = false; this.loading = false;
if (code == 403) { if (code == 403) {
if (this.backAble) { if (this.backAble) {
@ -681,7 +687,7 @@
}, },
//复制文本 //复制文本
copyFn () { copyFn() {
var textArea = document.createElement("textarea"); var textArea = document.createElement("textarea");
textArea.value = this.copyLink; textArea.value = this.copyLink;
document.body.appendChild(textArea); document.body.appendChild(textArea);
@ -696,7 +702,7 @@
}, },
/* 触发提示 */ /* 触发提示 */
tips (text) { tips(text) {
this.cls && clearTimeout(this.cls); this.cls && clearTimeout(this.cls);
this.prompt_text = text; this.prompt_text = text;
this.promptShow = true; this.promptShow = true;
@ -705,18 +711,18 @@
}, 3000); }, 3000);
}, },
// 错误弹出框关闭 // 错误弹出框关闭
knowFn () { knowFn() {
this.popboxshow = false; this.popboxshow = false;
this.maskshow = false; this.maskshow = false;
}, },
// 错误弹窗 // 错误弹窗
openErrorDialog (tip) { openErrorDialog(tip) {
this.maskshow = true; this.maskshow = true;
this.tiptext = tip; this.tiptext = tip;
this.popboxshow = true; this.popboxshow = true;
}, },
// 6发放中 1待使用 9领取失败 20待领取 轮循+详情 // 6发放中 1待使用 9领取失败 20待领取 轮循+详情
formatStatusText (status) { formatStatusText(status) {
switch (status) { switch (status) {
case 6: case 6:
return "发放中"; return "发放中";
@ -733,7 +739,7 @@
} }
}, },
// 计算 num // 计算 num
computeNum (data) { computeNum(data) {
const self = this; const self = this;
let new_product = data.map(item => { let new_product = data.map(item => {
let result = item.voucher.reduce((acc, curr) => { let result = item.voucher.reduce((acc, curr) => {