ソースを参照

商品已下架或删除,不能购买

gcj 3 年 前
コミット
d73f00ddb5

+ 22 - 4
src/components/Personalcenter/Mycollect.vue

@@ -171,6 +171,7 @@
                     v-html="changePrice(item.goods_price, 24, 16)"
                   ></span>
                 </div>
+                <!-- 购买 -->
                 <button
                   class="goPay"
                   v-if="item.goods_is_buy == 'false'"
@@ -178,6 +179,7 @@
                 >
                   {{ $t("Key72") }}
                 </button>
+                <!-- 已购买 -->
                 <button class="goPay hasPay" v-if="item.goods_is_buy == 'true'">
                   {{ $t("Key73") }}
                 </button>
@@ -487,10 +489,26 @@ export default {
     },
     //去购买
     reOrder(item) {
-      this.isConfirmorder = true;
-      this.goods_Data = item;
-
-      console.log(this.goods_Data);
+      if (item.goods_is_deleted == "true") {
+        this.$message({
+          showClose: true,
+          message: "商品已被删除,不能购买",
+          type: "error",
+          offset: 80,
+          duration: 2000,
+        });
+      } else if (item.goods_publish_status == 0) {
+        this.$message({
+          showClose: true,
+          message: "商品已下架,不能购买",
+          type: "error",
+          offset: 80,
+          duration: 2000,
+        });
+      } else {
+        this.isConfirmorder = true;
+        this.goods_Data = item;
+      }
     },
     closeConfirmorder() {
       this.isConfirmorder = false;

+ 41 - 5
src/components/Personalcenter/OrderManage.vue

@@ -514,14 +514,50 @@ export default {
     },
     //未支付订单,去购买
     goPay(item) {
-      this.isPayment = true;
-      this.goods_Data = item;
-      this.orderNumber = item.id;
+      if (item.goods_is_deleted == "true") {
+        this.$message({
+          showClose: true,
+          message: "商品已被删除,不能购买",
+          type: "error",
+          offset: 80,
+          duration: 2000,
+        });
+      } else if (item.goods_publish_status == 0) {
+        this.$message({
+          showClose: true,
+          message: "商品已下架,不能购买",
+          type: "error",
+          offset: 80,
+          duration: 2000,
+        });
+      } else {
+        this.isPayment = true;
+        this.goods_Data = item;
+        this.orderNumber = item.id;
+      }
     },
     //重新下单
     reOrder(item) {
-      this.isConfirmorder = true;
-      this.goods_Data = item;
+      if (item.goods_is_deleted == "true") {
+        this.$message({
+          showClose: true,
+          message: "商品已被删除,不能购买",
+          type: "error",
+          offset: 80,
+          duration: 2000,
+        });
+      } else if (item.goods_publish_status == 0) {
+        this.$message({
+          showClose: true,
+          message: "商品已下架,不能购买",
+          type: "error",
+          offset: 80,
+          duration: 2000,
+        });
+      } else {
+        this.isConfirmorder = true;
+        this.goods_Data = item;
+      }
     },
     closeConfirmorder() {
       this.isConfirmorder = false;

+ 2 - 2
vue.config.js

@@ -42,8 +42,8 @@ module.exports = {
       // change xxx-api/login => mock/login
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://gcls.utschool.cn/`,
-        // target: `http://gcls.helxsoft.cn/`,
+        //target: `http://gcls.utschool.cn/`,
+        target: `https://gcls.helxsoft.cn/`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''