yuanyuan %!s(int64=3) %!d(string=hai) anos
pai
achega
3b6eefbd82
Modificáronse 1 ficheiros con 31 adicións e 0 borrados
  1. 31 0
      src/views/user/ShoppingCartSubmit.vue

+ 31 - 0
src/views/user/ShoppingCartSubmit.vue

@@ -75,6 +75,7 @@ export default {
             showPwdDialog: false,
             showPwdDialog: false,
             timerNum: 0,
             timerNum: 0,
             id: '',
             id: '',
+            orderId: '',
             payName: '',
             payName: '',
             gas: 1,
             gas: 1,
             collectionList: [],
             collectionList: [],
@@ -272,12 +273,41 @@ export default {
                 this.showPwdDialog = true;
                 this.showPwdDialog = true;
             }
             }
             if (this.payName == '1') {
             if (this.payName == '1') {
+                this.id = this.orderId;
+                console.log('hggafg', this.id, this.orderId);
                 if (this.payType != 'BALANCE') {
                 if (this.payType != 'BALANCE') {
                     this.pay();
                     this.pay();
                 }
                 }
             } else {
             } else {
                 this.createOrder()
                 this.createOrder()
                     .then(res => {
                     .then(res => {
+                        this.orderId = res.id;
+                        let newCollectionIds = res.collectionIds;
+                        if (res.collectionIds.length < this.collectionIds.length) {
+                            this.showPwdDialog = false;
+                            this.$dialog
+                                .alert({
+                                    title: '提示',
+                                    message: '订单存在已售罄的藏品'
+                                })
+                                .then(res => {
+                                    this.collectionIdLis = newCollectionIds.split(',');
+                                    this.collectionList = [];
+                                    this.price = 0;
+                                    this.collectionIdLis.forEach(item => {
+                                        this.$http.get('/collection/get/' + item).then(res => {
+                                            this.collectionList.push(res);
+                                            this.price += Number(res.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);
+                                    }
+                                    this.payName = '1';
+                                });
+                            return;
+                        }
                         this.id = res.id;
                         this.id = res.id;
                         if (this.payType != 'BALANCE') {
                         if (this.payType != 'BALANCE') {
                             this.pay();
                             this.pay();
@@ -287,6 +317,7 @@ export default {
                         if (e) {
                         if (e) {
                             this.showPwdDialog = false;
                             this.showPwdDialog = false;
                             this.$toast.clear();
                             this.$toast.clear();
+                            console.log('sdgdfvdgvd');
                             this.$dialog
                             this.$dialog
                                 .alert({
                                 .alert({
                                     title: '提示',
                                     title: '提示',