|
|
@@ -79,7 +79,8 @@ export default {
|
|
|
gas: 1,
|
|
|
collectionList: [],
|
|
|
collectionIds: '',
|
|
|
- price: 0
|
|
|
+ price: 0,
|
|
|
+ collectionIdList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -91,26 +92,72 @@ export default {
|
|
|
if (window.cordova && window.cordova.platformId === 'ios' && this.$store.state.review) {
|
|
|
this.gas = 0;
|
|
|
}
|
|
|
- this.price = Number(this.$route.query.priceSum) + Number(this.gas) * this.$route.query.id.length;
|
|
|
return Promise.resolve();
|
|
|
});
|
|
|
if (this.$route.query.id) {
|
|
|
- let collectionIdList = this.$route.query.id;
|
|
|
- if (collectionIdList.length == 7) {
|
|
|
- this.$http.get('/collection/get/' + collectionIdList).then(res => {
|
|
|
- this.collectionList.push(res);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.collectionIds = collectionIdList.join(',');
|
|
|
- collectionIdList.forEach(item => {
|
|
|
- this.$http.get('/collection/get/' + item).then(res => {
|
|
|
- this.collectionList.push(res);
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ this.collectionIdLis = this.$route.query.id.split(',');
|
|
|
+ // collectionIdList.forEach(item => {
|
|
|
+ // this.$http.get('/collection/get/' + item).then(res => {
|
|
|
+ // this.collectionList.push(res);
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ this.getCollectionList(0, [], this.collectionIdLis);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ getCollectionList(index, list, allList) {
|
|
|
+ console.log('gagagfasfa');
|
|
|
+ if (index >= allList.length) {
|
|
|
+ this.collectionList = list;
|
|
|
+ console.log('cgcgvcg', this.collectionList.length, this.$route.query.id.length);
|
|
|
+ this.collectionList.forEach(item => {
|
|
|
+ this.price += Number(item.price);
|
|
|
+ });
|
|
|
+ this.price = Number(this.price) + Number(this.gas) * this.collectionList.length;
|
|
|
+ if (parseInt(this.price.toString()) != parseFloat(this.price.toString())) {
|
|
|
+ this.price = this.price.toFixed(2);
|
|
|
+ }
|
|
|
+ if (this.collectionList.length == 0) {
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ title: '提示',
|
|
|
+ message: '订单存在已售罄的藏品'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.$router.back();
|
|
|
+ });
|
|
|
+ } else if (this.collectionList.length < this.collectionIdLis.length) {
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ title: '提示',
|
|
|
+ message: '订单存在已售罄的藏品,已重新刷新订单列表'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ let newList = [];
|
|
|
+ this.collectionList.forEach(item => {
|
|
|
+ newList.push(item.id);
|
|
|
+ });
|
|
|
+ this.collectionIds = newList.join(',');
|
|
|
+ });
|
|
|
+ } else if (this.collectionList.length == this.collectionIdLis.length) {
|
|
|
+ let newList = [];
|
|
|
+ this.collectionList.forEach(item => {
|
|
|
+ newList.push(item.id);
|
|
|
+ });
|
|
|
+ this.collectionIds = newList.join(',');
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$http
|
|
|
+ .get('/collection/get/' + allList[index])
|
|
|
+ .then(res => {
|
|
|
+ list.push(res);
|
|
|
+ this.getCollectionList(index + 1, list, allList);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.getCollectionList(index + 1, list, allList);
|
|
|
+ });
|
|
|
+ },
|
|
|
getOrder(next = false) {
|
|
|
this.$http.get('/order/get/' + this.id).then(res => {
|
|
|
this.info = res;
|