xiejiebiao před 2 roky
rodič
revize
61e37e3a5c
1 změnil soubory, kde provedl 91 přidání a 138 odebrání
  1. 91 138
      pages2/order/confirm_list.vue

+ 91 - 138
pages2/order/confirm_list.vue

@@ -6,71 +6,46 @@
       <view v-for="(item, index) in goodsList" :key="item.id">
         <view class="item">
           <view style="display: flex; justify-content: space-between">
-            <image
-              :src="$method.splitImgHost(item.coverUrl)"
-              style="height: 120rpx; width: 204rpx; border-radius: 16rpx"
-            ></image>
+            <image :src="$method.splitImgHost(item.coverUrl)" style="height: 120rpx; width: 204rpx; border-radius: 16rpx">
+            </image>
             <view class="right_con" style="margin-left: 20rpx">
               <view style="color: #333333; font-size: 30rpx; font-weight: bold">
                 {{ item.goodsName }}
                 <text v-if="item.sevenYear"> ({{ item.sevenYear }}) </text>
               </view>
               <view class="priceTag"> ¥ {{ item.standPrice }} </view>
-              <view
-                class="input_c"
-                v-if="item.templateType != null && item.goodsType == 1"
-              >
-                <view
-                  v-if="item.templateType == 'class'"
-                  style="
+              <view class="input_c" v-if="item.templateType != null && item.goodsType == 1">
+                <view v-if="item.templateType == 'class'" style="
                     display: flex;
                     justify-content: space-between;
                     align-items: center;
                     height: 56rpx;
                     padding: 8rpx;
                     border-radius: 8rpx;
-                  "
-                  @click="openPopup(0, item)"
-                >
+                  " @click="openPopup(0, item)">
                   <view style="color: #666666; font-size: 24rpx">{{
                     item.gradObj ? item.gradObj.className : "选择班级"
                   }}</view>
-                  <view
-                    ><u-icon
-                      name="arrow-down"
-                      color="#999999"
-                      size="28"
-                    ></u-icon
-                  ></view>
+                  <view><u-icon name="arrow-down" color="#999999" size="28"></u-icon></view>
                 </view>
-                <view
-                  v-if="item.templateType == 'apply'"
-                  style="
+                <view v-if="item.templateType == 'apply'" style="
                     display: flex;
                     justify-content: space-between;
                     align-items: center;
                     height: 56rpx;
                     padding: 8rpx;
                     border-radius: 8rpx;
-                  "
-                  @click="openPopup(1)"
-                >
+                  " @click="openPopup(1, item)">
                   <view style="color: #666666; font-size: 24rpx">{{
                     !applyAreas.areaName
-                      ? "报考地区"
-                      : examDate.examineName +
-                        "-" +
-                        applyAreas.areaName +
-                        "-" +
-                        applyAreas.cityName
+                    ? "报考地区"
+                    : examDate.examineName +
+                    "-" +
+                    applyAreas.areaName +
+                    "-" +
+                    applyAreas.cityName
                   }}</view>
-                  <view
-                    ><u-icon
-                      name="arrow-down"
-                      color="#999999"
-                      size="28"
-                    ></u-icon
-                  ></view>
+                  <view><u-icon name="arrow-down" color="#999999" size="28"></u-icon></view>
                 </view>
               </view>
             </view>
@@ -87,40 +62,23 @@
       </view>
 
       <view style="display: flex; color: #ffffff; align-items: center">
-        <view class="btn2" :class="{ able: isAble() }" @click="goBuy()"
-          >确认购买</view
-        >
+        <view class="btn2" :class="{ able: isAble() }" @click="goBuy()">确认购买</view>
       </view>
     </view>
     <u-popup v-model="show1" mode="bottom" border-radius="40">
       <view class="popup_box">
         <view class="check_head">
           <view class="grade">选择考期/地区</view>
-          <u-icon
-            name="close"
-            color="#CFCFCF"
-            size="30"
-            @click="closePop(1)"
-          ></u-icon>
+          <u-icon name="close" color="#CFCFCF" size="30" @click="closePop(1)"></u-icon>
         </view>
 
         <view style="display: flex; height: 550rpx">
           <view style="width: 50%">
             <view class="topTxt">考期</view>
             <view>
-              <picker-view
-                :indicator-style="indicatorStyle"
-                :value="value"
-                @change="bindChangeE"
-                class="picker-view"
-              >
+              <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChangeE" class="picker-view">
                 <picker-view-column>
-                  <view
-                    class="picker-item"
-                    v-for="(item, index) in examine"
-                    :key="index"
-                    >{{ item.examineName }}</view
-                  >
+                  <view class="picker-item" v-for="(item, index) in examine" :key="index">{{ item.examineName }}</view>
                 </picker-view-column>
               </picker-view>
             </view>
@@ -128,34 +86,19 @@
           <view style="width: 50%">
             <view class="topTxt">地区</view>
             <view>
-              <picker-view
-                :indicator-style="indicatorStyle"
-                :value="value"
-                @change="bindChange"
-                class="picker-view"
-              >
+              <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view">
                 <picker-view-column>
-                  <view
-                    class="picker-item"
-                    v-for="(item, index) in provinceList"
-                    :key="index"
-                    >{{ item.areaName }}</view
-                  >
+                  <view class="picker-item" v-for="(item, index) in provinceList" :key="index">{{ item.areaName }}</view>
                 </picker-view-column>
                 <picker-view-column>
-                  <view
-                    class="picker-item"
-                    v-for="(item, index) in cityList"
-                    :key="index"
-                    >{{ item.areaName }}</view
-                  >
+                  <view class="picker-item" v-for="(item, index) in cityList" :key="index">{{ item.areaName }}</view>
                 </picker-view-column>
               </picker-view>
             </view>
           </view>
         </view>
         <view class="confrim-btn">
-          <view class="okBtn" @click="okPopup(1)">确定</view>
+          <view class="okBtn" @click="okPopup">确定</view>
         </view>
       </view>
     </u-popup>
@@ -199,7 +142,7 @@ export default {
       activeItem: {},
     };
   },
-  onPullDownRefresh() {},
+  onPullDownRefresh() { },
   async onLoad(option) {
     this.id = option.id;
     this.isBK = option.isBK;
@@ -221,7 +164,7 @@ export default {
       }
     });
   },
-  onShow() {},
+  onShow() { },
   methods: {
     getExamine(id) {
       let self = this;
@@ -258,29 +201,24 @@ export default {
     },
     //弹出框确定
     okPopup(index) {
-      if (index == 0) {
-        if (!this.checkData()) {
-          return;
-        }
-      } else {
-        if (!this.checkAreaData()) {
-          return;
-        }
-        this.examDate = this.examine[this.examIndex];
-        let pData = this.provinceList[this.pAreaIndex];
-        let cData = this.cityList[this.cAreaIndex];
-        this.applyAreas = {
-          areaName: pData.areaName,
-          areaId: pData.areaId,
-          cityId: cData.areaId,
-          cityName: cData.areaName,
-        };
-        this.applyObj.applyAreasJson = JSON.stringify(this.applyAreas);
-        this.applyObj.examDateJson = JSON.stringify(this.examDate);
-        this.detail.examDate = this.examDate;
-        this.detail.applyAreas = this.applyAreas;
-        this.show1 = false;
+      if (!this.checkAreaData()) {
+        return;
       }
+      this.examDate = this.examine[this.examIndex];
+      let pData = this.provinceList[this.pAreaIndex];
+      let cData = this.cityList[this.cAreaIndex];
+      this.applyAreas = {
+        areaName: pData.areaName,
+        areaId: pData.areaId,
+        cityId: cData.areaId,
+        cityName: cData.areaName,
+      };
+      this.applyObj.applyAreasJson = JSON.stringify(this.applyAreas);
+      this.applyObj.examDateJson = JSON.stringify(this.examDate);
+      this.detail.examDate = this.examDate;
+      this.detail.applyAreas = this.applyAreas;
+      this.show1 = false;
+
     },
 
     checkAreaData() {
@@ -304,18 +242,26 @@ export default {
         this.detail.goodsType == 1
       ) {
         /* if(!this.applyObj.examDateJson){
-					uni.showModal({
-						title: "提示",
-						content: '请选择考期',
-						showCancel: false
-					})
-					return false
-				} */
+          uni.showModal({
+            title: "提示",
+            content: '请选择考期',
+            showCancel: false
+          })
+          return false
+        } */
       }
       return true;
     },
     checkData() {
-      this.goodsList.forEach((item) => {
+      if (this.goodsList.length == 0) {
+        uni.showModal({
+          title: "提示",
+          content: "请选择商品",
+          showCancel: false,
+        });
+        return false;
+      }
+      return this.goodsList.some(item => {
         if (item.templateType == "class" && item.goodsType == 1) {
           if (!item.gradObj.className) {
             uni.showModal({
@@ -336,8 +282,9 @@ export default {
           // 	return false;
           // }
         }
-      });
-      return true;
+        return true
+      })
+
     },
     radioGroupChange(e) {
       console.log(e);
@@ -372,28 +319,9 @@ export default {
       });
     },
     goBuy() {
-      if (this.goodsList.length == 0) {
-        uni.showModal({
-          title: "提示",
-          content: "请选择商品",
-          showCancel: false,
-        });
-        return;
+      if (!this.checkData()) {
+        return
       }
-      this.goodsList.forEach((item) => {
-        if (item.templateType == "class" && item.goodsType == 1) {
-          if (!item.gradObj.className) {
-            uni.showModal({
-              title: "提示",
-              content: "请选择班级",
-              showCancel: false,
-            });
-            return false;
-          }
-        }
-        if (item.templateType == "apply" && item.goodsType == 1) {
-        }
-      });
       this.$store.commit("setShoppingCartList", {
         shoppingCartList: this.goodsList,
       });
@@ -424,7 +352,6 @@ export default {
         if (code == 200) {
           this.detail = data;
           this.goodsList = [data];
-          // self.getExamine(data.projectId);
           return Promise.resolve([data]);
         }
       });
@@ -467,6 +394,7 @@ export default {
           item.gradObj.gradeId
         );
       } else {
+        this.getExamine(item.projectId)
         this.getProvinceList();
         this.show1 = true;
       }
@@ -479,7 +407,7 @@ export default {
       }
     },
   },
-  onReachBottom() {},
+  onReachBottom() { },
   computed: {
     ...mapGetters(["userInfo", "shoppingCartList"]),
     disCode() {
@@ -500,40 +428,48 @@ page {
 .confirms {
   width: 100%;
   height: 100vh;
+
   // background: #fff;
   .contents {
     padding: 32rpx 32rpx 132rpx 32rpx;
   }
+
   .right_con {
     width: 450rpx;
   }
 }
+
 .picker-item {
   height: 50px;
   align-items: center;
   justify-content: center;
   text-align: center;
 }
+
 .picker-view {
   width: 100%;
   height: 420rpx;
   text-align: center;
 }
+
 .topTxt {
   font-size: 30rpx;
   color: #666666;
   text-align: center;
   padding: 20rpx 0;
 }
+
 .blackTxt {
   font-size: 30rpx;
   font-family: PingFang SC;
   font-weight: bold;
   color: #333333;
 }
+
 .blue-box {
   background: #ebf5ff;
 }
+
 .white-box {
   width: 646rpx;
   border-radius: 24rpx;
@@ -541,6 +477,7 @@ page {
   display: flex;
   padding-left: 15rpx;
 }
+
 .okBtn {
   width: 232rpx;
   height: 92rpx;
@@ -552,6 +489,7 @@ page {
   font-size: 32rpx;
   font-weight: 500;
 }
+
 .confrim-btn {
   // border-top:1px solid #eee;
   height: 98rpx;
@@ -560,6 +498,7 @@ page {
   align-items: center;
   justify-content: center;
 }
+
 .grade {
   // height: 23rpx;
   font-size: 32rpx;
@@ -569,6 +508,7 @@ page {
   font-weight: 500;
   text-align: center;
 }
+
 .line1 {
   width: 80rpx;
   height: 8rpx;
@@ -577,10 +517,12 @@ page {
   margin: 0 auto;
   margin-top: 15rpx;
 }
+
 .popup_box {
   height: 824rpx;
   box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
   border-radius: 28rpx 28rpx 0rpx 0rpx;
+
   .check_head {
     padding: 0rpx 32rpx;
     display: flex;
@@ -589,9 +531,11 @@ page {
     height: 104rpx;
     background: #f2f2f2;
   }
+
   .items_c {
     padding: 0rpx 32rpx;
   }
+
   .border_c {
     display: flex;
     align-items: center;
@@ -599,6 +543,7 @@ page {
     border-bottom: 1rpx solid #f2f2f2;
   }
 }
+
 .item {
   width: 100%;
   background: #ffffff;
@@ -606,6 +551,7 @@ page {
   margin-bottom: 20rpx;
   padding: 15rpx;
 }
+
 .priceTag {
   font-size: 28rpx;
   font-family: PingFang SC;
@@ -614,9 +560,11 @@ page {
   margin-top: 6rpx;
   margin-bottom: 16rpx;
 }
+
 .input_c {
   background: #f8f8f8;
 }
+
 .btn2 {
   width: 232rpx;
   height: 92rpx;
@@ -627,10 +575,12 @@ page {
   // background: linear-gradient(0deg, #015EEA, #00C0FA);
   text-align: center;
   line-height: 92rpx;
+
   &.able {
     opacity: 1;
   }
 }
+
 .bottomBox {
   position: fixed;
   bottom: 0;
@@ -643,12 +593,15 @@ page {
   align-items: center;
   box-sizing: unset;
   box-shadow: 0px -2px 6px 0px rgba(0, 0, 0, 0.1);
-  > view {
+
+  >view {
     margin: 0 30rpx;
   }
+
   .sums {
     display: flex;
   }
+
   .all_sum {
     font-size: 28rpx;
     font-weight: 500;