jason.lu 6 роки тому
батько
коміт
b3be2804c2

+ 2 - 1
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -112,7 +112,8 @@
                 ],
                 tag: 0,
                 photo: null,
-                loading: false
+                loading: false,
+                giftDo: {}
             }
         },
         methods: {

+ 57 - 27
sourcecode/h5app/vue/src/views/giftDetail.vue

@@ -76,6 +76,7 @@
     import {Button, Dialog, Toast} from 'vant'
     import NavBar from "../components/navBar";
     import {BasicFunction} from "../connector/basic-service";
+
     export default {
         name: "giftDetail",
         components: {
@@ -92,7 +93,8 @@
                 reason: '',
                 recievedPresent: {
                     comment: ''
-                }
+                },
+                giftDo : {}
             }
         },
         methods:{
@@ -146,6 +148,57 @@
             },
             toWriteComment: function () {
                 this.$router.push('assess');
+            },
+            loadGift(){
+                let presentId = this.$route.query.presentId;
+                if(presentId == null || presentId == undefined){
+                    presentId = BasicFunction.utils_get_parm("presentId");
+                }
+                if(presentId == undefined || presentId == null){
+                    Toast.fail('请重新进入礼物页哦');
+                    this.$router.push('index');
+                }
+
+                let that = this;
+                BasicFunction.get_data('smartGoods/list?goodId=' + presentId, function (res) {
+                    if (res.ret === '10000') {
+                        if(res.model === undefined || res.model == null || res.model.list == undefined || res.model.list.length <= 0){
+                            Toast.fail('礼物查看遇到问题,请稍等一下再试吧');
+                            that.$router.push('index');
+                            return;
+                        }
+                        that.giftDo = res.model.list[0];
+                        that.onloadGift(that.giftDo);
+                    }
+                }, {});
+            },
+            onloadGift(){
+                let that = this;
+                let present = this.giftDo;
+                let identity = this.identityDo;
+                present.comment = '';
+                present.placeId = identity.dormDistrict;
+                present.wechat = identity.userWxAccount;
+                that.myPresent = present;
+                // console.log(that.myPresent);
+                if (present.status === 3) BasicFunction.get_data('smartOrderFeedback/list?goodId=' + present.id, function (res) {
+                    // console.log(res);
+                    try {
+                        let comment = res.model.list[0];
+                        if (res.ret === '10000') {
+                            if (comment.length === 0) that.myPresent.comment = '暂未收到';
+                            else that.myPresent.comment = comment.content;
+                        } else Toast.fail('获取信息失败');
+                    } catch (e) {
+                        console.warn(e);
+                        Toast.fail('获取信息失败');
+                    }
+                }, {});
+                if (present.status === 4) BasicFunction.get_data('smartGoodReview/list?goodId=' + present.id, function (res) {
+                    if (res.ret === '10000') {
+                        if (res.model.list.length !== 0) that.reason = res.model.list[0].displayNote;
+                    } else Toast.fail('获取信息失败');
+                }, {});
             }
         },
         created: function () {
@@ -157,35 +210,12 @@
             // console.log(this.$route.query.present);
             let userid = localStorage.getItem('frontend-userid');
             let that = this;
-            present.comment = '';
             BasicFunction.get_data('smartIdentity/list?userId=' + userid, function (res) {
                 // console.log(res);
                 try {
-                    let identity = res.model.list[0];
-                    if (res.ret === '10000') {
-                        present.placeId = identity.dormDistrict;
-                        present.wechat = identity.userWxAccount;
-                        that.myPresent = present;
-                        // console.log(that.myPresent);
-                        if (present.status === 3) BasicFunction.get_data('smartOrderFeedback/list?goodId=' + present.id, function (res) {
-                            // console.log(res);
-                            try {
-                                let comment = res.model.list[0];
-                                if (res.ret === '10000') {
-                                    if (comment.length === 0) that.myPresent.comment = '暂未收到';
-                                    else that.myPresent.comment = comment.content;
-                                } else Toast.fail('获取信息失败');
-                            } catch (e) {
-                                console.warn(e);
-                                Toast.fail('获取信息失败');
-                            }
-                        }, {});
-                        if (present.status === 4) BasicFunction.get_data('smartGoodReview/list?goodId=' + present.id, function (res) {
-                            // console.log(res);
-                            if (res.ret === '10000') {
-                                if (res.model.list.length !== 0) that.reason = res.model.list[0].displayNote;
-                            } else Toast.fail('获取信息失败');
-                        }, {});
+                    if (res.ret === '10000' && !(res.model === undefined || res.model == null || res.model.list == undefined || res.model.list.length <= 0)){
+                        that.identityDo = res.model.list[0];
+                        this.loadGift();
                     } else Toast.fail('获取信息失败');
                 } catch (e) {
                     console.warn(e);