|
|
@@ -49,7 +49,14 @@
|
|
|
<div class="box-con">
|
|
|
<div class="label">卡牌细节图</div>
|
|
|
<van-uploader :file-list="fileList" :after-read="afterRead" @delete="deleteImg" />
|
|
|
- <div></div>
|
|
|
+ <van-sticky :offset-top="0">
|
|
|
+ <div class="time-box">
|
|
|
+ <van-dropdown-menu>
|
|
|
+ <van-dropdown-item @change="change" :value="time" :options="option1" />
|
|
|
+ </van-dropdown-menu>
|
|
|
+ </div>
|
|
|
+ </van-sticky>
|
|
|
+
|
|
|
<div class="box">
|
|
|
<div class="top">
|
|
|
<span>选择卡包</span>
|
|
|
@@ -62,21 +69,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
<div class="content">
|
|
|
- <div class="card" v-for="(card, index) in cardList" :key="index">
|
|
|
- <div class="card-title">第{{ index + 1 }}组</div>
|
|
|
+ <div class="card" v-for="(card, index) in cardLists" :key="index">
|
|
|
+ <div class="card-title">第{{ index }}组</div>
|
|
|
<div class="card-list">
|
|
|
- <div
|
|
|
- v-for="(item, itemIndex) in card"
|
|
|
- :key="item.id"
|
|
|
- class="card-item"
|
|
|
- :class="{
|
|
|
- used: !canChoose(item),
|
|
|
- active: nowChoose.includes(item.id)
|
|
|
- }"
|
|
|
- @click="choose(item.id, !canChoose(item))"
|
|
|
- >
|
|
|
+ <div v-for="(item, itemIndex) in card" :key="item" class="card-item">
|
|
|
{{ itemIndex }}
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -102,7 +99,7 @@
|
|
|
description="卡牌名称"
|
|
|
cancel-text="取消"
|
|
|
:actions="actions"
|
|
|
- @click-overlay="cancel"
|
|
|
+ @overlay="overlay = false"
|
|
|
@select="select"
|
|
|
@cancel="cancel"
|
|
|
>
|
|
|
@@ -118,7 +115,6 @@
|
|
|
:max-date="maxDate"
|
|
|
/>
|
|
|
</van-popup>
|
|
|
- <slot></slot>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -136,20 +132,69 @@ export default {
|
|
|
},
|
|
|
show: false,
|
|
|
newShow: false,
|
|
|
- cardCaseInfo: {},
|
|
|
fileList: [],
|
|
|
- chooseIds: [],
|
|
|
- nowChoose: [],
|
|
|
+ nowChooseId: [],
|
|
|
+ list: [],
|
|
|
closeFlag: false,
|
|
|
- detailsList: [],
|
|
|
- cardList: [{ A: 'A' }, { B: 'B' }, { C: 'C' }],
|
|
|
+ cardList: [
|
|
|
+ // [
|
|
|
+ // { id: '106', title: '数组' },
|
|
|
+ // { id: '11', title: '数组' },
|
|
|
+ // { id: '201', title: '数组' },
|
|
|
+ // { id: '31', title: '数组' },
|
|
|
+ // { id: '41', title: '数组' },
|
|
|
+ // { id: '51', title: '数组' }
|
|
|
+ // ],
|
|
|
+ // [
|
|
|
+ // { id: '100', title: '数组' },
|
|
|
+ // { id: '212', title: '数组' },
|
|
|
+ // { id: '22', title: '数组' },
|
|
|
+ // { id: '32', title: '数组' },
|
|
|
+ // { id: '47', title: '数组' },
|
|
|
+ // { id: '58', title: '数组' }
|
|
|
+ // ],
|
|
|
+ // [
|
|
|
+ // { id: '90', title: '数组' },
|
|
|
+ // { id: '19', title: '数组' },
|
|
|
+ // { id: '29', title: '数组' },
|
|
|
+ // { id: '39', title: '数组' },
|
|
|
+ // { id: '49', title: '数组' },
|
|
|
+ // { id: '59', title: '数组' }
|
|
|
+ // ]
|
|
|
+ ],
|
|
|
+ time: 0,
|
|
|
+ typeOptions: [
|
|
|
+ { id: 0, name: '组队模板(24组6包)', group: 24, groupCount: 6, special: false },
|
|
|
+ { id: 1, name: '端盒模板(AB组)', group: 2, groupCount: 24, special: true },
|
|
|
+ { id: 2, name: '组队模板(单组24包)', group: 1, groupCount: 24, special: false },
|
|
|
+ { id: 3, name: '组队模板(单组20包)', group: 1, groupCount: 20, special: false }
|
|
|
+ ],
|
|
|
actions: [],
|
|
|
minDate: new Date(new Date().getFullYear() - 1, 10, 1).getTime(),
|
|
|
maxDate: new Date(new Date().getFullYear() + 2, 10, 1).getTime(),
|
|
|
currentDate: new Date().getTime()
|
|
|
};
|
|
|
},
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+ option1() {
|
|
|
+ let list = [...this.typeOptions];
|
|
|
+ return list.map(item => {
|
|
|
+ return {
|
|
|
+ text: item.name,
|
|
|
+ value: item.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ cardLists() {
|
|
|
+ let boxMap = { ...this.cardList };
|
|
|
+ return Object.keys(boxMap).map(item => {
|
|
|
+ return boxMap[item];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ allCards() {
|
|
|
+ return [...this.cardLists].flat();
|
|
|
+ }
|
|
|
+ },
|
|
|
watch: {
|
|
|
show: {
|
|
|
handler: function(newVal) {
|
|
|
@@ -160,9 +205,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- this.cartBox();
|
|
|
- },
|
|
|
methods: {
|
|
|
cardInit() {
|
|
|
this.showLoading();
|
|
|
@@ -224,22 +266,6 @@ export default {
|
|
|
cancel() {
|
|
|
this.show = false;
|
|
|
},
|
|
|
- canChoose(info) {
|
|
|
- let status = ['WAIT', 'PROGRESS'];
|
|
|
- return status.includes(info.caseStatus) && !this.sold;
|
|
|
- },
|
|
|
- choose(id, used = false) {
|
|
|
- if (used) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let list = [...this.nowChoose];
|
|
|
- if (list.includes(id)) {
|
|
|
- list.splice(list.indexOf(id), 1);
|
|
|
- } else {
|
|
|
- list.push(id);
|
|
|
- }
|
|
|
- this.nowChoose = list;
|
|
|
- },
|
|
|
select(e) {
|
|
|
if (this.closeFlag) {
|
|
|
this.form.name = e.detail.name;
|
|
|
@@ -273,10 +299,27 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- cartBox() {
|
|
|
- this.$http.post('/cardCase/genNew').then(res => {
|
|
|
- console.log(res);
|
|
|
+ change(e) {
|
|
|
+ this.time = e.detail;
|
|
|
+ let cardBos = this.typeOptions.find(item => {
|
|
|
+ return item.id == this.time;
|
|
|
});
|
|
|
+ this.initApi(cardBos);
|
|
|
+ },
|
|
|
+ initApi(params) {
|
|
|
+ this.showLoading();
|
|
|
+ this.$http
|
|
|
+ .post('/cardCase/genNew', {
|
|
|
+ group: params.group,
|
|
|
+ groupCount: params.groupCount,
|
|
|
+ special: params.special
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.hideLoading();
|
|
|
+ console.log(res);
|
|
|
+ this.cardList = { ...res };
|
|
|
+ console.log(this.cardList);
|
|
|
+ });
|
|
|
},
|
|
|
afterRead(file) {
|
|
|
this.showLoading();
|
|
|
@@ -323,8 +366,11 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
wx.showToast({
|
|
|
- title: '提交成功'
|
|
|
+ title: '商品上架成功'
|
|
|
});
|
|
|
+ },
|
|
|
+ created(params) {
|
|
|
+ this.initApi(params.group, params.groupCount, params.special);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -333,6 +379,26 @@ export default {
|
|
|
/deep/ .van-uploader {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
+// /deep/ .van-dropdown-menu {
|
|
|
+// width: 110px;
|
|
|
+// border-radius: 4px;
|
|
|
+// overflow: hidden;
|
|
|
+// background: aquamarine;
|
|
|
+
|
|
|
+// .van-cell__value {
|
|
|
+// &::after {
|
|
|
+// content: '';
|
|
|
+// }
|
|
|
+// &::before {
|
|
|
+// content: '';
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+.time-box {
|
|
|
+ background-color: @bg;
|
|
|
+ padding: 20px;
|
|
|
+ margin-right: 20px;
|
|
|
+}
|
|
|
/deep/ .van-cell {
|
|
|
--cell-vertical-padding: 23px;
|
|
|
--cell-horizontal-padding: 20px;
|