update @接口字段联调

This commit is contained in:
huangzhen 2024-09-13 16:21:59 +08:00
parent 3fea2931ad
commit 4a3e41d759
7 changed files with 41 additions and 28 deletions

View File

@ -1,7 +1,7 @@
/** /**
* err_code * err_code
*/ */
export const { iconMap, btnMap, btnHighLight, receivingCode, btnPoll } = { export const { iconMap, btnMap, btnHighLight, btnPoll, successCode } = {
iconMap: new Map([ iconMap: new Map([
[12006, 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/jijiangkaishi.png'], // 即将开始 [12006, 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/jijiangkaishi.png'], // 即将开始
[14001, 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/yiduiwan.png'], // 已兑完 [14001, 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/yiduiwan.png'], // 已兑完
@ -16,11 +16,11 @@ export const { iconMap, btnMap, btnHighLight, receivingCode, btnPoll } = {
[14001, '已兑完'], [14001, '已兑完'],
[14003, '领取中'], // 已兑换,充值中 (隐藏轮询) [14003, '领取中'], // 已兑换,充值中 (隐藏轮询)
[14004, '重新领取'], // 已兑换,充值失败(暂时直接轮询) // todo 清空授权逻辑 [14004, '重新领取'], // 已兑换,充值失败(暂时直接轮询) // todo 清空授权逻辑
[14005, '立即兑换'], // 已兑换,充值成功(非"已兑完"-继续领取) [14005, '继续兑换'], // 已兑换,充值成功(非"已兑完"-继续领取)
]), ]),
btnHighLight: [14004, 14005], // 高亮按钮,点击不提示 btnHighLight: [14004, 14005], // 高亮按钮,点击不提示
receivingCode: 14003, // 已兑换,充值中
btnPoll: [14004], // 直接轮询code btnPoll: [14004], // 直接轮询code
successCode: [14001, 14005], // 成功code
}; };

View File

@ -14,7 +14,12 @@
<p @click.stop="receiveAll('top', pageData.get(item), item)" :style="{ color: listCss.get(item)?.btnTextColor, opacity: !detailType ? 1 : 0 }" class="topBtn">一键领取 ></p> <p @click.stop="receiveAll('top', pageData.get(item), item)" :style="{ color: listCss.get(item)?.btnTextColor, opacity: !detailType ? 1 : 0 }" class="topBtn">一键领取 ></p>
<ul class="listBox"> <ul class="listBox">
<li v-for="(i, j) in pageData.get(item)" :key="j" class="listContent"> <li v-for="(i, j) in pageData.get(item)" :key="j" class="listContent">
<p v-if="i.goods.err_code" class="tipText">{{ i.goods.reson }}</p> <p
v-if="i.goods.err_code && i.goods.err_code !== 14003"
:class="['tipText', successCode.includes(i.goods.err_code) && 'tipTextSuccess' ]"
>
{{ i.goods.reson }}
</p>
<div v-if="listCss.get(item)?.text" class="leftInfo" :style="{ backgroundColor: listCss.get(item)?.infoBgc }"> <div v-if="listCss.get(item)?.text" class="leftInfo" :style="{ backgroundColor: listCss.get(item)?.infoBgc }">
<p class="infoIcon" :style="{ backgroundImage: `url(${listCss.get(item)?.textIcon})` }">{{ listCss.get(item)?.text }}</p> <p class="infoIcon" :style="{ backgroundImage: `url(${listCss.get(item)?.textIcon})` }">{{ listCss.get(item)?.text }}</p>
<p class="amountInfo" :style="{ color: listCss.get(item)?.textColor }"> <p class="amountInfo" :style="{ color: listCss.get(item)?.textColor }">
@ -37,12 +42,6 @@
@click.stop="receiveAll('one', [i], item, j)" @click.stop="receiveAll('one', [i], item, j)"
> >
{{ {{
i.goods.type === 3
?
btnMap.get(i.goods.err_code)
? (i.info.send_num > 1) ? `${btnMap.get(i.goods.err_code)} ${(i.goods.exchange_times || 0)}/${i.info.send_num || 0}` : btnMap.get(i.goods.err_code)
: (i.info.send_num > 1) ? `立即兑换 ${(i.goods.exchange_times || 0)}/${i.info.send_num || 0}` : '立即兑换'
:
btnMap.get(i.goods.err_code) ? btnMap.get(i.goods.err_code) : '立即兑换' btnMap.get(i.goods.err_code) ? btnMap.get(i.goods.err_code) : '立即兑换'
}} }}
<img v-if="i.goods.err_code === 14003" class="loadingBtn" src="./img/loading.png" alt=""> <img v-if="i.goods.err_code === 14003" class="loadingBtn" src="./img/loading.png" alt="">
@ -100,7 +99,7 @@
<script lang="ts"> <script lang="ts">
import { QUERY, EXCHANGE, ORDER_QUERY, GET_SMS } from "@/router/api"; import { QUERY, EXCHANGE, ORDER_QUERY, GET_SMS } from "@/router/api";
import { btnHighLight, btnMap, btnPoll } from "@/utils/datas"; import { btnHighLight, btnMap, btnPoll, successCode } from "@/utils/datas";
import { channelJudge } from "@/utils/empower"; import { channelJudge } from "@/utils/empower";
import { phoneRegex, startsWith, urlToLocal } from "@/utils/methods"; import { phoneRegex, startsWith, urlToLocal } from "@/utils/methods";
@ -202,6 +201,7 @@ export default {
btnMap: new Map([ ...btnMap ]), btnMap: new Map([ ...btnMap ]),
btnHighLight: [ ... btnHighLight ], btnHighLight: [ ... btnHighLight ],
btnPoll: [ ...btnPoll ], btnPoll: [ ...btnPoll ],
successCode: [ ...successCode ],
} }
}, },
async created() { async created() {
@ -298,10 +298,10 @@ export default {
} }
this.loadingStatus = false; this.loadingStatus = false;
if (this.orderData.length) { // if (this.orderData.length) { //
if (type === 'start') { // if (type === 'start') {
this.dialogText = '已有领取中的商品'; // this.dialogText = '';
} // }
return await this.orderPolling(); return this.pollTime = setTimeout(() => { this.orderPolling() }, 3000);
} }
if (sessionStorage.getItem('autoReceive') === 'is') { if (sessionStorage.getItem('autoReceive') === 'is') {
sessionStorage.setItem('autoReceive', 'no'); sessionStorage.setItem('autoReceive', 'no');
@ -610,6 +610,18 @@ export default {
box-sizing: border-box; box-sizing: border-box;
background-color: rgba(255, 102, 102, 0.20); background-color: rgba(255, 102, 102, 0.20);
} }
.tipTextSuccess {
color: rgb(127, 190, 122);
background-color: rgb(222, 255, 219);
animation-name: tipTextSuccessDH;
animation-duration: 3s;
animation-fill-mode: forwards; /* 保持动画结束状态 */
}
@keyframes tipTextSuccessDH {
0% { opacity:1; }
99% { opacity:1; }
100% { opacity:0; }
}
.leftInfo { .leftInfo {
width: 51px; width: 51px;
height: 47px; height: 47px;
@ -710,7 +722,6 @@ export default {
margin-left: 3px; margin-left: 3px;
animation: loadingBtnRotate 3s linear infinite; animation: loadingBtnRotate 3s linear infinite;
} }
@keyframes loadingBtnRotate { @keyframes loadingBtnRotate {
from { from {
transform: rotate(0deg); transform: rotate(0deg);

View File

@ -88,9 +88,9 @@ export default {
pollTime: null, pollTime: null,
dialogType: '', dialogType: '',
dialogText: '', dialogText: '',
btnMap: btnMap, btnMap: new Map([ ...btnMap ]),
btnHighLight: btnHighLight, btnHighLight: [ ... btnHighLight ],
btnPoll: btnPoll, btnPoll: [ ...btnPoll ],
}; };
}, },
created() { created() {

View File

@ -109,9 +109,9 @@ export default {
popComStatus: false, popComStatus: false,
dialogType: '', dialogType: '',
dialogText: '', dialogText: '',
btnMap: btnMap, btnMap: new Map([ ...btnMap ]),
btnHighLight: btnHighLight, btnHighLight: [ ... btnHighLight ],
btnPoll: btnPoll, btnPoll: [ ...btnPoll ],
} }
}, },
created() { created() {

View File

@ -51,6 +51,7 @@
color: #242533; color: #242533;
font-size: 10px; font-size: 10px;
margin-top: 10px; margin-top: 10px;
white-space: nowrap;
} }
} }
} }

View File

@ -152,6 +152,7 @@ export default {
// //
this.btnMap.set(14003, '立即兑换'); this.btnMap.set(14003, '立即兑换');
this.btnMap.set(14004, '立即兑换'); this.btnMap.set(14004, '立即兑换');
this.btnMap.set(14005, '立即兑换');
this.btnHighLight.push(14003); this.btnHighLight.push(14003);
this.getData() this.getData()
} else { } else {
@ -161,7 +162,7 @@ export default {
watch: { watch: {
formData: { formData: {
handler(newVal: any) { handler(newVal: any) {
console.log('---list-watch---', newVal); // console.log('---list-watch---', newVal);
this.cssData = { this.cssData = {
...this.cssData, ...this.cssData,
...newVal ...newVal
@ -244,7 +245,7 @@ export default {
}, },
onSlideChange(swiper: any) { onSlideChange(swiper: any) {
this.initialSlide = swiper.realIndex; this.initialSlide = swiper.realIndex;
console.log('---onSlideChange---', this.pageData[this.initialSlide]); // console.log('---onSlideChange---', this.pageData[this.initialSlide]);
}, },
jumpBanner() { jumpBanner() {
if (this.comType === 2) return; if (this.comType === 2) return;

View File

@ -81,9 +81,9 @@ export default {
pollTime: null, pollTime: null,
dialogType: '', dialogType: '',
dialogText: '', dialogText: '',
btnMap: btnMap, btnMap: new Map([ ...btnMap ]),
btnHighLight: btnHighLight, btnHighLight: [ ... btnHighLight ],
btnPoll: btnPoll, btnPoll: [ ...btnPoll ],
}; };
}, },
created() { created() {