|
|
@@ -26,19 +26,19 @@
|
|
|
|
|
|
<div class="content">
|
|
|
<div class="card" v-for="(card, index) in cardList" :key="index">
|
|
|
- <div class="card-title">卡包{{ getNumStr(index + 1) }}</div>
|
|
|
+ <div class="card-title">第{{ index + 1 }}组</div>
|
|
|
<div class="card-list">
|
|
|
<div
|
|
|
v-for="(item, itemIndex) in card"
|
|
|
:key="item.id"
|
|
|
class="card-item"
|
|
|
:class="{
|
|
|
- used: item.caseStatus !== 'WAIT' || item.userId,
|
|
|
+ used: item.caseStatus !== ('WAIT' || 'PROGRESS') || item.userId,
|
|
|
active: nowChoose.includes(item.id)
|
|
|
}"
|
|
|
- @click="choose(item.id, item.caseStatus !== 'WAIT' || item.userId)"
|
|
|
+ @click="choose(item.id, item.caseStatus !== ('WAIT' || 'PROGRESS') || item.userId)"
|
|
|
>
|
|
|
- {{ getChart(itemIndex) }}
|
|
|
+ {{ itemIndex + 1 }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -116,14 +116,11 @@ export default {
|
|
|
if (used) {
|
|
|
return;
|
|
|
}
|
|
|
- console.log(id);
|
|
|
let list = [...this.nowChoose];
|
|
|
if (list.includes(id)) {
|
|
|
list.splice(list.indexOf(id), 1);
|
|
|
- } else if (list.length < 6) {
|
|
|
- list.push(id);
|
|
|
} else {
|
|
|
- this.toast('最多选择六张');
|
|
|
+ list.push(id);
|
|
|
}
|
|
|
this.nowChoose = list;
|
|
|
},
|
|
|
@@ -132,15 +129,42 @@ export default {
|
|
|
this.toast('请选择卡牌');
|
|
|
return;
|
|
|
}
|
|
|
- this.$emit('update:chooseIds', this.nowChoose);
|
|
|
- this.show = false;
|
|
|
- if (this.buy) {
|
|
|
- this.$emit('buy');
|
|
|
- }
|
|
|
- },
|
|
|
- getChart(index) {
|
|
|
- const list = ['A', 'B', 'C', 'D', 'E', 'F'];
|
|
|
- return list[index];
|
|
|
+ let caseId = this.cardCaseInfo.cardCaseId;
|
|
|
+ let boxIds = this.nowChoose.join(',');
|
|
|
+ this.$http
|
|
|
+ .get('/orderInfo/checkBox', {
|
|
|
+ caseId,
|
|
|
+ boxIds
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ let checkResult = false;
|
|
|
+ checkResult = res;
|
|
|
+ if (!checkResult) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '该卡箱需要两个卡包组选择数量一样'
|
|
|
+ });
|
|
|
+ return Promise.reject();
|
|
|
+ } else {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.$emit('update:chooseIds', this.nowChoose);
|
|
|
+ this.show = false;
|
|
|
+ if (this.buy) {
|
|
|
+ this.$emit('buy');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ wx.hideLoading();
|
|
|
+ if (e.error) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: e.error
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -227,16 +251,13 @@ export default {
|
|
|
color: #939599;
|
|
|
line-height: 24px;
|
|
|
}
|
|
|
-.card-list {
|
|
|
- margin: 5px;
|
|
|
-}
|
|
|
.card {
|
|
|
background-color: @bg;
|
|
|
padding: 12px 16px;
|
|
|
border-radius: 8px;
|
|
|
.card-list {
|
|
|
.flex();
|
|
|
-
|
|
|
+ flex-wrap: wrap;
|
|
|
.card-item {
|
|
|
width: 42px;
|
|
|
height: 42px;
|
|
|
@@ -247,7 +268,7 @@ export default {
|
|
|
text-align: center;
|
|
|
color: #000000;
|
|
|
line-height: 42px;
|
|
|
-
|
|
|
+ margin-top: 10px;
|
|
|
&.used {
|
|
|
background-color: #939599;
|
|
|
color: #ffffff;
|
|
|
@@ -261,6 +282,10 @@ export default {
|
|
|
&:active {
|
|
|
opacity: 0.8;
|
|
|
}
|
|
|
+
|
|
|
+ &:nth-child(6n + 1) {
|
|
|
+ margin-left: 0 !important;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.card-item + .card-item {
|