xuqiaoying před 3 roky
rodič
revize
0c4176ee8b

+ 2 - 2
src/axios.js

@@ -5,8 +5,8 @@ import { Message } from 'element-ui'
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
 // export const BASE_URL = 'http://192.168.1.7:5055'    //dev
-export const BASE_URL = 'http://192.168.1.24:5055'    //dev
-// export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
+// export const BASE_URL = 'http://192.168.1.24:5055'    //dev
+export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'http://192.168.1.222:5055'    //测试
 export const tenantId = '867735392558919680'

+ 15 - 3
src/components/goodsItem/IndexSkuDialog.vue

@@ -166,10 +166,22 @@ export default {
 				this.$message.warning('请先选择所有的规格')
 				return
 			}
+			if (this.skuItem.goodsStatus == 0) {
+				this.$message.warning('商品已下架, 请重新选择')
+				return
+			}
+			
+			let sysTime = this.$tools.timest()
+			if (sysTime <= this.skuItem.validityStartTime || sysTime >= this.skuItem.validityEndTime) {
+				this.$message.warning('商品不在有效期, 请重新选择')
+				return
+			}
+
             if (this.isCarOrBuy == 1) { // 加入购物车
-                this.$emit('toShopCart')
+			// console.log('this.skuItem.goodsId', this.skuItem.goodsId)
+                this.$emit('toShopCart', this.skuItem.goodsId)
 			} else {
-				this.$emit('togoBuy')
+				this.$emit('togoBuy', this.skuItem)
 			}
             this.cancel()
         },
@@ -233,7 +245,7 @@ export default {
 			flex-wrap: wrap;
 		}
 		.course_items {
-			min-width: 190px;
+			// min-width: 190px;
             padding: 13px 16px;
             border-radius: 8px;
             margin-right: 16px;

+ 31 - 9
src/components/goodsItem/index.vue

@@ -31,7 +31,7 @@
 
     <BuyCourseModal ref="selectClassModal"></BuyCourseModal>
     <index-sku-dialog :skuModal.sync="skuModal" :specTemplateId="item.specTemplateId" :isCarOrBuy="isCarOrBuy"
-      @toShopCart='getAddCar' @togoBuy="toPayment"></index-sku-dialog>
+      @toShopCart='getAddCar($event)' @togoBuy="togoBuy($event)"></index-sku-dialog>
   </div>
 </template>
 
@@ -94,13 +94,17 @@ export default {
       // 判断有没有规格选择
 			if (this.item.specTemplateId) {
 				this.isCarOrBuy = 2
-				this.skuModal = true
+        this.getSpecDetail()
+				// this.skuModal = true
 				return
 			}
-      this.toPayment()
+      this.toPayment(this.item.goodsId)
     },
-    toPayment() {
-      this.getGoodsDetail(this.item.goodsId).then((res) => {
+    togoBuy(skuItem) {
+      this.toPayment(skuItem.goodsId)
+    },
+    toPayment(goodsId) {
+      this.getGoodsDetail(goodsId).then((res) => {
         if (res.templateType) {
           if (res.goodsType === 1) {
             this.$refs.selectClassModal.showModal(res);
@@ -134,14 +138,14 @@ export default {
       // 判断有没有规格选择
 			if (this.item.specTemplateId) {
 				this.isCarOrBuy = 1
-				this.skuModal = true
+        this.getSpecDetail()
 				return
 			}
-      this.getAddCar() 
+      this.getAddCar(this.item.goodsId) 
     },
-    getAddCar() {
+    getAddCar(goodsId) {
       this.$request
-        .addCart({ goodsId: this.item.goodsId })
+        .addCart({ goodsId: goodsId })
         .then((res) => {
           if (res) {
             this.getCartCount();
@@ -168,6 +172,24 @@ export default {
         });
       });
     },
+    getSpecDetail() {
+			this.$axios({
+				url: `/app/common/spec/${this.item.specTemplateId}`,
+				method: 'get',
+				noToken: true
+			}).then((res) => {
+          if (res.data) {
+            this.skuModal = true
+          } else {
+            if (this.isCarOrBuy == 1) {
+              this.getAddCar(this.item.goodsId)
+            } else {
+              this.toPayment(this.item.goodsId)
+            }
+
+          }
+			}).catch(() => {})
+		},
   },
 };
 </script>

+ 33 - 9
src/pages/goods-detail/bank-detail.vue

@@ -1045,7 +1045,7 @@
     <Footer></Footer>
     <!-- 规格选择 -->
     <index-sku-dialog :skuModal.sync="skuModal" :specTemplateId="goodsDetail.specTemplateId" :isCarOrBuy="isCarOrBuy"
-      @toShopCart='getAddCar' @togoBuy="toPayment"></index-sku-dialog>
+      @toShopCart='getAddCar($event)' @togoBuy="togoBuy($event)"></index-sku-dialog>
   </div>
 </template>
 
@@ -1765,19 +1765,24 @@ export default {
       // 判断有没有规格选择
       if (this.goodsDetail.specTemplateId) {
         this.isCarOrBuy = 2
-        this.skuModal = true
+        // this.skuModal = true
+        this.getSpecDetail()
         return
       }
 
-      this.toPayment()
+      this.toPayment(this.goodsDetail)
     },
-    toPayment() {
-      let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
+    toPayment(goodsDetail) {
+      // let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
+      let selectGoodsList = JSON.parse(JSON.stringify([goodsDetail]));
       localStorage.setItem("checkGoodsList", JSON.stringify(selectGoodsList));
       this.$router.push({
         path: "/payment",
       });
     },
+    togoBuy(skuItem) {
+      this.toPayment(skuItem)
+    },
     addCart() {
       if (!this.$tools.isLogin()) {
         this.setCurrentRouter(this.$route);
@@ -1789,15 +1794,16 @@ export default {
       // 判断有没有规格选择
 			if (this.goodsDetail.specTemplateId) {
 				this.isCarOrBuy = 1
-				this.skuModal = true
+				// this.skuModal = true
+        this.getSpecDetail()
 				return
 			}
 
-      this.getAddCar()
+      this.getAddCar(this.goodsId)
     },
-    getAddCar() {
+    getAddCar(goodsId) {
       this.$request
-        .addCart({ goodsId: this.goodsId })
+        .addCart({ goodsId: goodsId })
         .then((res) => {
           this.getCartCount();
           this.$message({
@@ -1814,6 +1820,24 @@ export default {
           }
         });
     },
+    getSpecDetail() {
+			this.$axios({
+				url: `/app/common/spec/${this.goodsDetail.specTemplateId}`,
+				method: 'get',
+				noToken: true
+			}).then((res) => {
+          if (res.data) {
+            this.skuModal = true
+          } else {
+            if (this.isCarOrBuy == 1) {
+              this.getAddCar(this.goodsId)
+            } else {
+              this.toPayment(this.goodsDetail)
+            }
+
+          }
+			}).catch(() => {})
+		},
     /**
      * 获取商品详情
      */

+ 33 - 9
src/pages/goods-detail/course-detail.vue

@@ -495,7 +495,7 @@
     <Footer></Footer>
     <!-- 规格选择 -->
     <index-sku-dialog :skuModal.sync="skuModal" :specTemplateId="goodsDetail.specTemplateId" :isCarOrBuy="isCarOrBuy"
-      @toShopCart='getAddCar' @togoBuy="toPayment"></index-sku-dialog>
+      @toShopCart='getAddCar($event)' @togoBuy="togoBuy($event)"></index-sku-dialog>
   </div>
 </template>
 
@@ -1392,11 +1392,12 @@ export default {
         // 判断有没有规格选择
         if (this.goodsDetail.specTemplateId) {
           this.isCarOrBuy = 2
-          this.skuModal = true
+          // this.skuModal = true
+          this.getSpecDetail()
           return
         }
 
-        this.toPayment()
+        this.toPayment(this.goodsDetail)
       } else {
         this.setCurrentRouter(this.$route);
         this.$router.push({
@@ -1405,11 +1406,15 @@ export default {
         return;
       }
     },
-    toPayment() {
+    togoBuy(skuItem) {
+      this.toPayment(skuItem)
+    },
+    toPayment(goodsDetail) {
       if (this.goodsDetail.templateType) {
           this.selectClassModal = true;
         } else {
-          let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
+          // let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
+          let selectGoodsList = JSON.parse(JSON.stringify([goodsDetail]));
           selectGoodsList.forEach((item) => {
             if (item.goodsType == 1) {
               if (item.templateType == "class") {
@@ -1529,14 +1534,15 @@ export default {
       // 判断有没有规格选择
 			if (this.goodsDetail.specTemplateId) {
 				this.isCarOrBuy = 1
-				this.skuModal = true
+				// this.skuModal = true
+        this.getSpecDetail()
 				return
 			}
 
-      this.getAddCar()
+      this.getAddCar(this.goodsId)
     },
-    getAddCar() {
-      this.$request.addCart({ goodsId: this.goodsId })
+    getAddCar(goodsId) {
+      this.$request.addCart({ goodsId: goodsId })
         .then((res) => {
           this.getCartCount();
           this.$message({
@@ -1553,6 +1559,24 @@ export default {
           }
         });
     },
+    getSpecDetail() {
+			this.$axios({
+				url: `/app/common/spec/${this.goodsDetail.specTemplateId}`,
+				method: 'get',
+				noToken: true
+			}).then((res) => {
+          if (res.data) {
+            this.skuModal = true
+          } else {
+            if (this.isCarOrBuy == 1) {
+              this.getAddCar(this.goodsId)
+            } else {
+              this.toPayment(this.goodsDetail)
+            }
+
+          }
+			}).catch(() => {})
+		},
     /**
      * 获取商品详情
      */

+ 32 - 9
src/pages/goods-detail/live-detail.vue

@@ -538,7 +538,7 @@
     <Footer></Footer>
     <!-- 规格选择 -->
     <index-sku-dialog :skuModal.sync="skuModal" :specTemplateId="goodsDetail.specTemplateId" :isCarOrBuy="isCarOrBuy"
-      @toShopCart='getAddCar' @togoBuy="toPayment"></index-sku-dialog>
+      @toShopCart='getAddCar($event)' @togoBuy="togoBuy($event)"></index-sku-dialog>
   </div>
 </template>
 
@@ -1406,11 +1406,12 @@ export default {
         // 判断有没有规格选择
         if (this.goodsDetail.specTemplateId) {
           this.isCarOrBuy = 2
-          this.skuModal = true
+          // this.skuModal = true
+          this.getSpecDetail()
           return
         }
         
-        this.toPayment()
+        this.toPayment(this.goodsDetail)
       } else {
         this.setCurrentRouter(this.$route);
         this.$router.push({
@@ -1419,8 +1420,11 @@ export default {
         return;
       }
     },
-    toPayment() {
-      let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
+    togoBuy(skuItem) {
+      this.toPayment(skuItem)
+    },
+    toPayment(goodsDetail) {
+      let selectGoodsList = JSON.parse(JSON.stringify([goodsDetail]));
         selectGoodsList.forEach((item) => {
           if (item.goodsType == 1) {
             if (item.templateType == "class") {
@@ -1534,13 +1538,14 @@ export default {
       // 判断有没有规格选择
 			if (this.goodsDetail.specTemplateId) {
 				this.isCarOrBuy = 1
-				this.skuModal = true
+				// this.skuModal = true
+        this.getSpecDetail()
 				return
 			}
-      this.getAddCar()
+      this.getAddCar(this.goodsId)
     },
-    getAddCar() {
-      this.$request.addCart({ goodsId: this.goodsId })
+    getAddCar(goodsId) {
+      this.$request.addCart({ goodsId: goodsId })
         .then((res) => {
           this.getCartCount();
           this.$message({
@@ -1557,6 +1562,24 @@ export default {
           }
         });
     },
+    getSpecDetail() {
+			this.$axios({
+				url: `/app/common/spec/${this.goodsDetail.specTemplateId}`,
+				method: 'get',
+				noToken: true
+			}).then((res) => {
+          if (res.data) {
+            this.skuModal = true
+          } else {
+            if (this.isCarOrBuy == 1) {
+              this.getAddCar(this.goodsId)
+            } else {
+              this.toPayment(this.goodsDetail)
+            }
+
+          }
+			}).catch(() => {})
+		},
     /**
      * 获取商品详情
      */

+ 20 - 20
src/pages/person-center/my-course/index.vue

@@ -1273,30 +1273,30 @@ export default {
         return;
       }
 
-      var confirmDetail = true;
-      if (item.educationName == "继续教育") {
-        if (
-          item.officialName &&
-          item.businessName == "二级" &&
-          item.projectName == "建造师"
-        ) {
-          confirmDetail = await this.userConfirmInfoDetail();
-        }
-      }
+      // var confirmDetail = true;
+      // if (item.educationName == "继续教育") {
+      //   if (
+      //     item.officialName &&
+      //     item.businessName == "二级" &&
+      //     item.projectName == "建造师"
+      //   ) {
+      //     confirmDetail = await this.userConfirmInfoDetail();
+      //   }
+      // }
 
-      // //内部系统
-      // if (item.interfacePushId > 0 && item.officialStatus != 1) {
-      //   this.$message({
-      //     type: "warning",
-      //     message: "机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!",
-      //   });
+      // // //内部系统
+      // // if (item.interfacePushId > 0 && item.officialStatus != 1) {
+      // //   this.$message({
+      // //     type: "warning",
+      // //     message: "机构正在为您报名中,请耐心等待,有疑问请联系020-87085982!",
+      // //   });
+      // //   return;
+      // // }
+
+      // if (!confirmDetail) {
       //   return;
       // }
 
-      if (!confirmDetail) {
-        return;
-      }
-
       let rebuildStatus = await this.courseGoodsRebuildStatus(
         item.goodsId,
         item.gradeId