Browse Source

pairing complete

StephenArk30 6 years ago
parent
commit
17d34011d1
2 changed files with 119 additions and 24 deletions
  1. 109 22
      sourcecode/h5app/vue/src/views/Assess.vue
  2. 10 2
      sourcecode/h5app/vue/src/views/giftDetail.vue

+ 109 - 22
sourcecode/h5app/vue/src/views/Assess.vue

@@ -23,7 +23,7 @@
                         icon="like"
                         void-icon="like-o"
                 />
-                <van-button round type="primary" class='assess' @click="Assess">送出感谢信</van-button>
+                <van-button round type="primary" class='assess' @click="assessPresent">送出感谢信</van-button>
             </div>
 
         </div>
@@ -60,7 +60,9 @@
                 assessDo:{},
                 active: 0,
                 Assessimage: "http://pjczv6ygf.bkt.clouddn.com/thanks.png",
-
+                myId: -1,
+                goodId: -1,
+                orderid: -1
             }
         },
         methods: {
@@ -80,22 +82,65 @@
                     this.$router.push('login');
                     return;
                 }
-                this.assessDo.content=this.substance;
-                this.assessDo.ratingMajor=this.value;
-                let orderId=BasicFunction.utils_get_param("orderId");
-                // assess_present()
-                // console.log(present);
-                BasicFunction.get_data("smartOrderFeedback/saveBatch?orderId="+orderId, function (response) {
-                        // console.log("------ Data Rcvd in assessPersent --------");
-                        // console.log(response);
+                let assessDo = {
+                    feedbackId: '',
+                    orderId: this.orderId,
+                    goodId: this.goodId,
+                    ratingStatus: 1000,
+                    ratingMajor: this.value,
+                    ratingMinor: 5000,
+                    content: this.substance,
+                    ratingTime: getNowFormatDate()
+                };
+                let that = this;
+                BasicFunction.get_data("smartOrderFeedback/saveBatch", function (response) {
+                        console.log("------ save feedback --------");
+                        console.log(response);
                     if(response.ret === "10000"){
-                        Toast.success("上传成功");
+                        that.updateGood();
                     } else Toast.fail("上传失败,请检查网络");
-                }, [this.assessDo]
+                    }, [assessDo]
                 );
+                // this.assessDo.content=this.substance;
+                // this.assessDo.ratingMajor=this.value;
+                // let orderId=BasicFunction.utils_get_param("orderId");
+                // // assess_present()
+                // // console.log(present);
+                // BasicFunction.get_data("smartOrderFeedback/saveBatch?orderId="+orderId, function (response) {
+                //         // console.log("------ Data Rcvd in assessPersent --------");
+                //         // console.log(response);
+                //     if(response.ret === "10000"){
+                //         Toast.success("上传成功");
+                //     } else Toast.fail("上传失败,请检查网络");
+                // }, [this.assessDo]
+                // );
 
                 // this.$router.push('index');
             },
+            updateGood() {
+                let goodid = this.myId;
+                BasicFunction.get_data('smartGoods/list?goodid=' + goodid, function (res) {
+                    try {
+                        if (res.ret === '10000' && res.model.list !== undefined && res.model.list.length !== 0) {
+                            let gift = res.model.list[0];
+                            gift.sort = 3;
+                            BasicFunction.get_data('smartGoods/updateBatch', function (updateRes) {
+                                if (updateRes.ret === '10000') {
+                                    Toast.success('发布成功');
+                                    window.history.back();
+                                } else {
+                                    Toast.fail('上传失败!请联系小编');
+                                }
+                            }, [gift]);
+                        } else {
+                            Toast.fail('上传失败!请联系小编');
+                        }
+                    } catch (e) {
+                        console.warn(e);
+                        Toast.fail('上传失败!请联系小编');
+                    }
+                }, {});
+            },
             Assess() {
                 this.$router.push('index');
             },
@@ -105,17 +150,59 @@
                 this.$router.push('login');
                 return;
             }
-            let that=this;
-            let orderId=BasicFunction.utils_get_param("orderId");
-            BasicFunction.get_data("smartOrderFeedback/list?orderId="+orderId, function (response) {
-                // console.log("------ Data Rcvd in assessPersent --------");
-                // console.log(response);
-                    if(response.ret === "10000"){
-                        let t = response.model.list;
-                        that.assessDo=t[0];
-                    } else Toast.fail("读取失败,请检查网络");
-            }, [{}]);
+            if (this.$route.query.goodId && this.$route.query.orderId && this.$route.query.myId) {
+                this.myId = this.$route.query.myId;
+                this.goodId = this.$route.query.goodId;
+                this.orderId = this.$route.query.orderId;
+            }
+            else {
+                this.myId = BasicFunction.utils_get_param("myId");
+                this.goodId = BasicFunction.utils_get_param("goodId");
+                this.orderId = BasicFunction.utils_get_param("orderId");
+            }
+            if (this.goodId === -1 || this.orderId === -1 || this.myId === -1) {
+                Toast.fail('获取信息失败,请重新进入');
+            }
+            // let that=this;
+            // let orderId=BasicFunction.utils_get_param("orderId");
+            // BasicFunction.get_data("smartOrderFeedback/list?orderId="+orderId, function (response) {
+            //     // console.log("------ Data Rcvd in assessPersent --------");
+            //     // console.log(response);
+            //         if(response.ret === "10000"){
+            //             let t = response.model.list;
+            //             that.assessDo=t[0];
+            //         } else Toast.fail("读取失败,请检查网络");
+            // }, [{}]);
+        }
+    }
+
+    function getNowFormatDate() {
+        let date = new Date();
+        let seperator = "-";
+        let year = date.getFullYear();
+        let month = date.getMonth() + 1;
+        let strDate = date.getDate();
+        let hour = date.getHours();
+        let minutes = date.getMinutes();
+        let seconds = date.getSeconds();
+        if (month >= 1 && month <= 9) {
+            month = "0" + month;
+        }
+        if (strDate >= 0 && strDate <= 9) {
+            strDate = "0" + strDate;
+        }
+        if (hour >= 0 && hour <= 9) {
+            hour = "0" + hour;
+        }
+        if (minutes >= 0 && minutes <= 9) {
+            minutes = "0" + minutes;
+        }
+        if (seconds >= 0 && seconds <= 9) {
+            seconds = "0" + seconds;
         }
+        let currentdate = year + seperator + month + seperator + strDate;
+        currentdate = currentdate + ' ' + hour + ':' + minutes + ':' + seconds;
+        return currentdate;
     }
 </script>
 

+ 10 - 2
sourcecode/h5app/vue/src/views/giftDetail.vue

@@ -95,7 +95,8 @@
                 commentDo: '',
                 RgiftDo: {},
                 RidentityDo: {},
-                RcommentDo: ''
+                RcommentDo: '',
+                orderId: -1
             }
         },
         methods:{
@@ -147,7 +148,13 @@
                 });
             },
             toWriteComment: function () {
-                this.$router.push('assess');
+                let myId = this.myPresent.id;
+                let goodid = this.receivedPresent.id;
+                let orderId = this.orderId;
+                this.$router.push({
+                    path: 'assess',
+                    query: {myId: myId, goodId: goodid, orderId: orderId}
+                });
             },
             loadGift(){
                 let presentId = this.$route.query.presentId;
@@ -213,6 +220,7 @@
                             if (orderRes.ret === '10000' && orderRes.model.list !== undefined && orderRes.model.list.length !== 0) {
                                 let order = orderRes.model.list[0];
                                 let receiverId = parseInt(order.note);
+                                that.orderId = receiverId;
                                 BasicFunction.get_data('smartGoods/list?goodid=' + receiverId, function (receiverRes) {
                                     console.log('----- received gift -----');
                                     try {