lex %!s(int64=3) %!d(string=hai) anos
pai
achega
02dfdc3a79
Modificáronse 3 ficheiros con 34 adicións e 9 borrados
  1. 3 8
      package-lock.json
  2. 1 0
      package.json
  3. 30 1
      src/views/service/GoodsSale.vue

+ 3 - 8
package-lock.json

@@ -23,6 +23,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",
@@ -4782,7 +4783,6 @@
       "version": "0.2.0",
       "resolved": "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
       "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
-      "dev": true,
       "engines": {
         "node": ">=0.10"
       }
@@ -11454,7 +11454,6 @@
       "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=",
-      "dev": true,
       "dependencies": {
         "decode-uri-component": "^0.2.0",
         "object-assign": "^4.1.0",
@@ -12911,7 +12910,6 @@
       "version": "1.1.0",
       "resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz",
       "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
-      "dev": true,
       "engines": {
         "node": ">=0.10.0"
       }
@@ -18969,8 +18967,7 @@
     "decode-uri-component": {
       "version": "0.2.0",
       "resolved": "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
-      "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
-      "dev": true
+      "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
     },
     "decompress-response": {
       "version": "6.0.0",
@@ -24368,7 +24365,6 @@
       "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=",
-      "dev": true,
       "requires": {
         "decode-uri-component": "^0.2.0",
         "object-assign": "^4.1.0",
@@ -25624,8 +25620,7 @@
     "strict-uri-encode": {
       "version": "1.1.0",
       "resolved": "https://registry.npm.taobao.org/strict-uri-encode/download/strict-uri-encode-1.1.0.tgz",
-      "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=",
-      "dev": true
+      "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
     },
     "string_decoder": {
       "version": "1.1.1",

+ 1 - 0
package.json

@@ -23,6 +23,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;
       }