Browse Source

pairing complete

StephenArk30 6 years ago
parent
commit
d7d50f3363

BIN
sourcecode/h5app/vue/src/assets/mysterious gift.jpg


+ 7 - 7
sourcecode/h5app/vue/src/components/giftCard.vue

@@ -11,11 +11,11 @@
                     <van-col class="c"><p><strong>{{owner ? '对方' : '我'}}的礼物</strong></p></van-col>
                     <van-col class="c"><p>{{place[placeId]}}</p></van-col>
                 </van-row>
-                <van-row type="flex" justify="space-between">
-                    <van-col class="c"><p>匹配性别</p></van-col>
+                <van-row type="flex" justify="space-between" v-if="gender !== -1">
+                    <van-col class="c"><p>{{owner ? '对方' : '匹配'}}性别</p></van-col>
                     <van-col class="c"><p>{{genders[gender]}}</p></van-col>
                 </van-row>
-                <van-row type="flex" justify="space-between">
+                <van-row type="flex" justify="space-between" v-if="status !== -1">
                     <van-col class="c"><p>礼物状态</p></van-col>
                     <van-col class="c" ><p :style="{ color: statusColor[status] }">{{statusString[status]}}</p></van-col>
                 </van-row>
@@ -40,7 +40,7 @@
 </template>
 
 <script>
-    import { Card, Row, Col, Button } from 'vant';
+    import {Card, Row, Col, Button, Toast} from 'vant';
     export default {
         name: "giftCard",  //gift-card
         // luaOps 'lua-ops
@@ -68,7 +68,7 @@
             },
             presentDesc: {
                 type: String,
-                default: '这是一本我很喜欢的书,我曾经把这本书反反复复看了三遍,真的非常推荐。如果你也是科幻迷,你肯定会喜欢哒。圣诞快乐,喜欢这本书可以和我一起讨论哦!'
+                default: '没有获取到对方的礼物!'
             },
             owner: {
                 type: Number,
@@ -93,10 +93,10 @@
         },
         methods: {
             onCopy: function (e) {
-                alert('You just copied: ' + e.text)
+                Toast.success('复制成功: ' + e.text)
             },
             onError: function (e) {
-                alert('Failed to copy texts')
+                Toast.fail('复制失败')
             },
             toMe: function () {
                 if (this.owner === 0) this.$router.push('me');

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

@@ -114,8 +114,7 @@
                         let t = response.model.list;
                         that.assessDo=t[0];
                     } else Toast.fail("读取失败,请检查网络");
-                }, [{}]
-            );
+            }, [{}]);
         }
     }
 </script>

+ 143 - 33
sourcecode/h5app/vue/src/views/giftDetail.vue

@@ -2,21 +2,22 @@
     <div>
         <nav-bar path="index" title="礼品卡"/>
         <!--对方的礼物信息-->
+        <!--<p>{{myPresent.name}}-{{receivedPresent.name}}</p>-->
         <gift-card
                 v-if="myPresent.status === 2 || myPresent.status === 3"
-                :present-img="recievedPresent.imgUrl"
-                :present-name="recievedPresent.name"
-                :present-desc="recievedPresent.desc_long"
+                :present-img="receivedPresent.img"
+                :present-name="receivedPresent.name"
+                :present-desc="receivedPresent.desc"
                 :owner="1"
-                :placeId="recievedPresent.placeId"
-                :gender="recievedPresent.gender"
-                :status="recievedPresent.status"
-                :wechat="recievedPresent.wechat"
+                :placeId="receivedPresent.placeId"
+                :gender="receivedPresent.gender"
+                :status="-1"
+                :wechat="receivedPresent.wechat"
         />
         <!--我写的感谢信-->
-        <div class="letter" v-if="recievedPresent.comment.length !== 0">
+        <div class="letter" v-if="RcommentDo.length !== 0">
             <p style="font-size: 110%"><strong>我送出的感谢信</strong></p>
-            <p>{{recievedPresent.comment}}</p>
+            <p>{{RcommentDo}}</p>
         </div>
         <!--我的礼物信息-->
         <gift-card
@@ -29,9 +30,9 @@
                 :status="myPresent.status"
                 :wechat="myPresent.wechat"
         />
-        <div class="letter" v-if="myPresent.comment.length !== 0">
+        <div class="letter" v-if="commentDo.length !== 0">
             <p style="font-size: 110%"><strong>我收到的感谢信</strong></p>
-            <p>{{myPresent.comment}}</p>
+            <p>{{commentDo}}</p>
         </div>
         <div class="letter" v-if="myPresent.status === 4">
             <p><strong>审核未通过,请前往首页重新发布礼物!</strong></p>
@@ -86,15 +87,15 @@
         },
         data() {
             return {
-                myPresent: {
-                    placeId: 1,
-                    comment: '',
-                },
+                myPresent: {},
                 reason: '',
-                recievedPresent: {
-                    comment: ''
-                },
-                giftDo : {}
+                receivedPresent: {},
+                giftDo: {},
+                identityDo: {},
+                commentDo: '',
+                RgiftDo: {},
+                RidentityDo: {},
+                RcommentDo: ''
             }
         },
         methods:{
@@ -111,8 +112,7 @@
                 Dialog.confirm({
                     message: '确认删除礼物吗?'
                 }).then(() => {
-                    // on confirm
-                    // TODO: 考虑 updateBatch, 就是需要 将isDel设为1, 配合首页查找进行过滤
+                    // 删除礼物:将isDel设为1
                     Toast.loading({
                         mask: true,
                         message: '加载中...',
@@ -172,35 +172,145 @@
                     }
                 }, {});
             },
-            onloadGift(){
-                let that = this;
+            initGifts() {
+                if (this.RgiftDo.goodid !== undefined) {
+                    let rpresent = {};
+                    let ridentity = this.RidentityDo;
+                    rpresent.id = this.RgiftDo.goodid;
+                    rpresent.name = this.RgiftDo.name;
+                    rpresent.desc = this.RgiftDo.description;
+                    rpresent.gender = ridentity.userSex;
+                    rpresent.placeId = ridentity.dormDistrict;
+                    rpresent.wechat = ridentity.userWxAccount;
+                    rpresent.img = "http://pjczv6ygf.bkt.clouddn.com/mysterious%20gift.jpg";
+                    this.receivedPresent = rpresent;
+                }
                 let present = {};
-                let identity = this.identityDo;
+                let identity = {};
+                identity = this.identityDo;
                 present.id = this.giftDo.goodid;
                 present.name = this.giftDo.name;
                 present.desc = this.giftDo.description;
                 present.status = this.giftDo.sort;
                 present.gender = this.giftDo.goodFirstKind;
-                present.comment = '';
                 present.placeId = identity.dormDistrict;
                 present.wechat = identity.userWxAccount;
                 present.img = "http://gift.fogice.com" + this.giftDo.img;
-                that.myPresent = present;
+                this.myPresent = present;
+            },
+            onloadGift(){
+                let that = this;
+                let status = this.giftDo.sort;
+                let id = this.giftDo.goodid;
                 // console.log(that.myPresent);
-                if (present.status === 3) BasicFunction.get_data('smartOrderFeedback/list?goodid=' + present.id, function (res) {
-                    // console.log(res);
+                if (status >= 2) {
+                    if (status === 4) that.onloadReview(id);
+                    let userid = localStorage.getItem('frontend-userid');
+                    BasicFunction.get_data('smartOrder/list?userId=' + userid, function (orderRes) {
+                        try {
+                            console.log('----- order res -----');
+                            console.log(orderRes);
+                            if (orderRes.ret === '10000' && orderRes.model.list !== undefined && orderRes.model.list.length !== 0) {
+                                let order = orderRes.model.list[0];
+                                let receiverId = parseInt(order.note);
+                                BasicFunction.get_data('smartGoods/list?goodid=' + receiverId, function (receiverRes) {
+                                    console.log('----- received gift -----');
+                                    try {
+                                        console.log(receiverRes);
+                                        if (receiverRes.ret === '10000') {
+                                            if (receiverRes.model === undefined || receiverRes.model == null || receiverRes.model.list == undefined || receiverRes.model.list.length <= 0) {
+                                                Toast.fail('礼物查看遇到问题,请稍等一下再试吧');
+                                                that.$router.push('index');
+                                                return;
+                                            }
+                                            that.RgiftDo = receiverRes.model.list[0];
+                                            that.onloadReceiveGift(id, status);
+                                        }
+                                    } catch (e) {
+                                        console.warn(e);
+                                        Toast.fail('获取数据失败,请重试');
+                                    }
+                                }, {});
+                            }
+                        } catch (e) {
+                            console.warn(e);
+                            Toast.fail('数据异常!请重试');
+                        }
+                    }, {})
+                } else this.initGifts();
+            },
+            onloadReceiveGift(myid, status) {
+                let receiverId = this.RgiftDo.ownerId;
+                let that = this;
+                BasicFunction.get_data('smartIdentity/list?userId=' + receiverId, function (recvRes) {
+                    try {
+                        console.log("----- receiver's identity");
+                        console.log(recvRes);
+                        if (recvRes.ret === '10000' && recvRes.model !== undefined && recvRes.model.list.length !== 0) {
+                            that.RidentityDo = recvRes.model.list[0];
+                            if (status === 3) that.onloadFeedback(myid, receiverId);
+                            else that.initGifts();
+                        } else {
+                            Toast.fail('获取数据失败,请重试');
+                        }
+                    } catch (e) {
+                        console.log(e);
+                        Toast.fail('获取数据失败,请重试');
+                    }
+                }, {});
+            },
+            onloadFeedback(myid, receiverId) {
+                let that = this;
+                BasicFunction.get_data('smartOrderFeedback/list?goodId=' + myid, function (res) {
+                    console.log('----- received feedback -----');
+                    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('获取信息失败');
+                            let comment = {
+                                content: '暂未收到'
+                            };
+                            if (res.model.list !== undefined && res.model.list.length !== 0) {
+                                comment = res.model.list[0];
+                            }
+                            that.commentDo = comment.content;
+                            // 对方的评价
+                            BasicFunction.get_data('smartOrderFeedback/list?goodId=' + receiverId, function (recvRes) {
+                                console.log('----- sent feedback -----');
+                                console.log(res);
+                                try {
+                                    if (recvRes.ret === '10000') {
+                                        let comment = {
+                                            content: '感谢信未发送或发送失败'
+                                        };
+                                        if (recvRes.model.list !== undefined && recvRes.model.list.length !== 0) {
+                                            comment = recvRes.model.list[0];
+                                        }
+                                        that.RcommentDo = comment.content;
+                                        that.initGifts();
+                                    } else {
+                                        Toast.fail('获取信息失败');
+                                        that.initGifts();
+                                    }
+                                } catch (e) {
+                                    console.warn(e);
+                                    Toast.fail('获取信息失败');
+                                    that.initGifts();
+                                }
+                            }, {});
+                        } else {
+                            Toast.fail('获取信息失败');
+                            that.initGifts();
+                        }
                     } catch (e) {
                         console.warn(e);
                         Toast.fail('获取信息失败');
+                        that.initGifts();
                     }
                 }, {});
-                if (present.status === 4) BasicFunction.get_data('smartGoodReview/list?goodId=' + present.id, function (res) {
+            },
+            onloadReview(goodid) {
+                let that = this;
+                BasicFunction.get_data('smartGoodReview/list?goodId=' + goodid, function (res) {
                     if (res.ret === '10000' && res.model.list !== undefined) {
                         if (res.model.list.length !== 0) {
                             let i = sortReason(res.model.list);