Browse Source

Merge branch '03/18VipActive' into dev

lex 2 years ago
parent
commit
ab2baf821c
3 changed files with 46 additions and 15 deletions
  1. 15 14
      package-lock.json
  2. 1 0
      package.json
  3. 30 1
      src/views/service/GoodsSale.vue

+ 15 - 14
package-lock.json

@@ -26,6 +26,7 @@
         "numeral": "^2.0.6",
         "plyr": "^3.7.2",
         "qs": "^6.8.0",
+        "query-string": "^5.1.1",
         "vant": "^2.12.21",
         "vconsole": "^3.3.4",
         "vue": "^2.6.10",
@@ -5655,8 +5656,8 @@
     },
     "node_modules/decode-uri-component": {
       "version": "0.2.0",
-      "resolved": "https://registry.npmmirror.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
-      "integrity": "sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og==",
+      "resolved": "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
+      "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
       "engines": {
         "node": ">=0.10"
       }
@@ -12208,9 +12209,9 @@
       }
     },
     "node_modules/query-string": {
-      "version": "4.3.4",
-      "resolved": "https://registry.npmmirror.com/query-string/-/query-string-4.3.4.tgz",
-      "integrity": "sha512-O2XLNDBIg1DnTOa+2XrIwSiXEV8h2KImXUnjhhn2+UsvZ+Es2uyd5CCRTNQlDGbzUQOW3aYCBx9rVA6dzsiY7Q==",
+      "version": "5.1.1",
+      "resolved": "https://registry.npm.taobao.org/query-string/download/query-string-5.1.1.tgz?cache=0&sync_timestamp=1564173124567&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-5.1.1.tgz",
+      "integrity": "sha1-p4wBK3HBfgXy4/ojGd0zBoLvs8s=",
       "dependencies": {
         "object-assign": "^4.1.0",
         "strict-uri-encode": "^1.0.0"
@@ -13794,8 +13795,8 @@
     },
     "node_modules/strict-uri-encode": {
       "version": "1.1.0",
-      "resolved": "https://registry.npmmirror.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
-      "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==",
+      "resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz",
+      "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
       "engines": {
         "node": ">=0.10.0"
       }
@@ -21512,8 +21513,8 @@
     },
     "decode-uri-component": {
       "version": "0.2.0",
-      "resolved": "https://registry.npmmirror.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
-      "integrity": "sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og=="
+      "resolved": "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
+      "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
     },
     "decompress-response": {
       "version": "6.0.0",
@@ -26974,9 +26975,9 @@
       }
     },
     "query-string": {
-      "version": "4.3.4",
-      "resolved": "https://registry.npmmirror.com/query-string/-/query-string-4.3.4.tgz",
-      "integrity": "sha512-O2XLNDBIg1DnTOa+2XrIwSiXEV8h2KImXUnjhhn2+UsvZ+Es2uyd5CCRTNQlDGbzUQOW3aYCBx9rVA6dzsiY7Q==",
+      "version": "5.1.1",
+      "resolved": "https://registry.npm.taobao.org/query-string/download/query-string-5.1.1.tgz?cache=0&sync_timestamp=1564173124567&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-5.1.1.tgz",
+      "integrity": "sha1-p4wBK3HBfgXy4/ojGd0zBoLvs8s=",
       "requires": {
         "object-assign": "^4.1.0",
         "strict-uri-encode": "^1.0.0"
@@ -28322,8 +28323,8 @@
     },
     "strict-uri-encode": {
       "version": "1.1.0",
-      "resolved": "https://registry.npmmirror.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
-      "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ=="
+      "resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz",
+      "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
     },
     "string_decoder": {
       "version": "1.1.1",

+ 1 - 0
package.json

@@ -26,6 +26,7 @@
     "numeral": "^2.0.6",
     "plyr": "^3.7.2",
     "qs": "^6.8.0",
+    "query-string": "^5.1.1",
     "vant": "^2.12.21",
     "vconsole": "^3.3.4",
     "vue": "^2.6.10",

+ 30 - 1
src/views/service/GoodsSale.vue

@@ -265,6 +265,7 @@ import Protocol from "@/components/Protocol";
 import MRefund from "@/components/MRefund";
 import MEmpty from "@/components/MEmpty";
 import Search from "@/components/Search";
+import qs from "query-string";
 import {
   addGoodsSellOrder,
   queryGoodsPage,
@@ -394,8 +395,34 @@ export default {
       this.headerStatus = false;
     }
     this.__init();
+
+    window.addEventListener("hashchange", this.onHash, false);
   },
   methods: {
+    onHash() {
+      this.refundStatus = false;
+    },
+    hashState() {
+      // 打开弹窗
+      if (this.refundStatus) {
+        this.isDestroy = false;
+        const splitUrl = window.location.hash.slice(1).split("?");
+        const query = qs.parse(splitUrl[1]);
+        let times = 0;
+        for (let key in query) {
+          times++;
+        }
+        const origin = window.location.href;
+        const url = times > 0 ? "&cPop=" + +new Date() : "?cPop=" + +new Date();
+        history.pushState("", "", `${origin}${url}`);
+      } else {
+        const splitUrl = window.location.hash.slice(1).split("?");
+        const query = qs.parse(splitUrl[1]);
+        if (query.cPop) {
+          window.history.go(-1);
+        }
+      }
+    },
     onConfirm(value, index) {
       this.orderText = value;
       if (index == 0) {
@@ -561,6 +588,7 @@ export default {
       // 确认退费规则
       if (!this.refundSure && this.payCountMoney - this.marketAmount > 0) {
         this.refundStatus = true;
+        this.hashState();
         return;
       }
       let form = {
@@ -604,7 +632,7 @@ export default {
               this.$toast(res.msg);
             }
           })
-          .catch((e) => {
+          .catch(() => {
             // console.log(e);
             setLoading(false);
           });
@@ -679,6 +707,7 @@ export default {
       // 确认退费规则
       if (!this.refundSure && this.payCountMoney - this.marketAmount > 0) {
         this.refundStatus = true;
+        this.hashState();
         return;
       }