谢杰标 2 年 前
コミット
146005f3fc

+ 1 - 1
common/config.js

@@ -1,6 +1,6 @@
 // test 测试环境
 const test = {
-  BASE_URL: "http://192.168.1.24:5055",
+  BASE_URL: "http://120.79.166.78:19012",
   BASE_IMG_URL: "https://file-dev.xyyxt.net/",
   domain: "h.xyyxt.net",
   tenantId: "867735392558919680", //详粤云学堂

+ 177 - 0
components/common/selectGradeBox.vue

@@ -0,0 +1,177 @@
+<template>
+  <view>
+    <u-popup v-model="isShow" @close="close" 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="close"
+          ></u-icon>
+        </view>
+        <view class="check_con">
+          <scroll-view scroll-y="true" style="height: 580rpx">
+            <view>
+              <u-radio-group v-model="gradeValue">
+                <view
+                  v-for="(item, index) in gradeList"
+                  :key="index"
+                  class="items_c"
+                >
+                  <view class="border_c">
+                    <view>
+                      <u-radio
+                        shape="circle"
+                        active-color="#FC3F3F"
+                        :name="index"
+                        :disabled="
+                          item.studentNum > 0 &&
+                          item.studentNum == item.studentUpper
+                        "
+                      >
+                        <view
+                          :class="
+                            index == gradeValue
+                              ? 'white-box blue-box'
+                              : 'white-box'
+                          "
+                        >
+                          <view>
+                            <view class="blackTxt">{{ item.className }}</view>
+                            <Class-time-tip :classInfo="item"></Class-time-tip>
+                          </view>
+                        </view>
+                      </u-radio>
+                    </view>
+                  </view>
+                </view>
+              </u-radio-group>
+            </view>
+          </scroll-view>
+        </view>
+        <view class="confrim-btn">
+          <view class="okBtn" @click="okPopup()">确定</view>
+        </view>
+      </view>
+    </u-popup>
+  </view>
+</template>
+
+<script>
+import ClassTimeTip from "@/components/common/ClassTimeTip.vue";
+export default {
+  name: "SaasMiniprogramSelectGradeBox",
+  data() {
+    return {
+      gradeValue: 0,
+      gradeList: [],
+      isShow: false,
+    };
+  },
+
+  mounted() {},
+
+  methods: {
+    goodsGradeList(id) {
+      return this.$api.goodsGradeList({ goodsId: id }).then((res) => {
+        let { code, rows } = res.data;
+        if (code == 200) {
+          if (rows.length == 0) {
+            let item = {
+              className: "系统分班",
+              gradeId: 0,
+            };
+            rows.push(item);
+          } else {
+            let isGradeFull = rows.every(
+              (item) =>
+                item.studentNum > 0 && item.studentNum == item.studentUpper
+            );
+            //所有班级都满了
+            if (isGradeFull) {
+              let item = {
+                className: "系统分班",
+                gradeId: 0,
+              };
+              rows.unshift(item);
+            }
+          }
+          return Promise.resolve(rows);
+        }
+      });
+    },
+    async open(data, selectGradeId) {
+      console.log(data, selectGradeId, "data, selectGradeId");
+      this.isShow = true;
+      this.gradeValue = 0;
+      if (Array.isArray(data)) {
+        this.gradeList = data;
+      } else {
+        this.gradeList = await this.goodsGradeList(data);
+      }
+      if (selectGradeId) {
+        this.gradeValue = this.gradeList.findIndex(
+          (e) => e.gradeId == selectGradeId
+        );
+      }
+      console.log(this.gradeValue, "this.gradeValue");
+    },
+    okPopup() {
+      this.isShow = false;
+      this.$emit("submit", this.gradeList[this.gradeValue]);
+    },
+    close() {
+      this.isShow = false;
+      console.log(this.isShow, "this.isShow");
+      //   this.$emit("close");
+    },
+  },
+  components: { ClassTimeTip },
+};
+</script>
+
+<style lang="scss" scoped>
+.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;
+    align-items: center;
+    justify-content: space-between;
+    height: 104rpx;
+    background: #f2f2f2;
+  }
+  .items_c {
+    padding: 0rpx 32rpx;
+  }
+  .border_c {
+    display: flex;
+    align-items: center;
+    padding: 20rpx 0rpx;
+    border-bottom: 1rpx solid #f2f2f2;
+  }
+  .okBtn {
+    width: 232rpx;
+    height: 92rpx;
+    line-height: 92rpx;
+    background: #fc3f3f;
+    border-radius: 120rpx;
+    color: #ffffff;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 500;
+  }
+  .confrim-btn {
+    // border-top:1px solid #eee;
+    height: 98rpx;
+    width: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+}
+</style>

+ 167 - 281
pages2/order/confirm_list.vue

@@ -3,107 +3,87 @@
     <nav-bar title="确认订单"></nav-bar>
     <view class="contents">
       <!-- <view  > -->
-      <view class="item">
-        <view style="display: flex; justify-content: space-between">
-          <image
-            :src="$method.splitImgHost(detail.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">
-              {{ detail.goodsName }}
-            </view>
-            <view class="priceTag"> ¥ {{ detail.standPrice }} </view>
-            <view
-              class="input_c"
-              v-if="detail.templateType != null && detail.goodsType == 1"
-            >
-              <view
-                v-if="detail.templateType == 'class'"
-                style="
-                  display: flex;
-                  justify-content: space-between;
-                  align-items: center;
-                  height: 56rpx;
-                  padding: 8rpx;
-                  border-radius: 8rpx;
-                "
-                @click="openPopup(0)"
-              >
-                <view style="color: #666666; font-size: 24rpx">{{
-                  gradeIndex < 0 ? "选择班级" : gradeList[gradeIndex].className
-                }}</view>
-                <view
-                  ><u-icon name="arrow-right" color="#999999" size="28"></u-icon
-                ></view>
-              </view>
-              <view
-                v-if="detail.templateType == 'apply'"
-                style="
-                  display: flex;
-                  justify-content: space-between;
-                  align-items: center;
-                  height: 56rpx;
-                  padding: 8rpx;
-                  border-radius: 8rpx;
-                "
-                @click="openPopup(1)"
-              >
-                <view style="color: #666666; font-size: 24rpx">{{
-                  !applyAreas.areaName
-                    ? "报考地区"
-                    : examDate.examineName +
-                      "-" +
-                      applyAreas.areaName +
-                      "-" +
-                      applyAreas.cityName
-                }}</view>
-                <view
-                  ><u-icon name="arrow-right" color="#999999" size="28"></u-icon
-                ></view>
+      <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>
+            <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>
-            <view class="input_c" v-if="detail.sevenYear">
+              <view class="priceTag"> ¥ {{ item.standPrice }} </view>
               <view
-                style="
-                  display: flex;
-                  justify-content: space-between;
-                  align-items: center;
-                  height: 56rpx;
-                  padding: 8rpx;
-                  border-radius: 8rpx;
-                "
-                @click="openPopup(2)"
+                class="input_c"
+                v-if="item.templateType != null && item.goodsType == 1"
               >
                 <view
-                  style="color: #666666; font-size: 24rpx"
-                  v-if="detail.selectYearList && detail.selectYearList.length"
+                  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)"
                 >
-                  {{ detail.selectYearList.toString() }}
-                </view>
-                <view v-else style="color: #666666; font-size: 24rpx">
-                  选择年份
+                  <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>
-                <view>
-                  <u-icon name="arrow-right" color="#999999" size="28">
-                  </u-icon>
+                <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)"
+                >
+                  <view style="color: #666666; font-size: 24rpx">{{
+                    !applyAreas.areaName
+                      ? "报考地区"
+                      : examDate.examineName +
+                        "-" +
+                        applyAreas.areaName +
+                        "-" +
+                        applyAreas.cityName
+                  }}</view>
+                  <view
+                    ><u-icon
+                      name="arrow-down"
+                      color="#999999"
+                      size="28"
+                    ></u-icon
+                  ></view>
                 </view>
               </view>
             </view>
           </view>
         </view>
       </view>
+
       <!-- </view> -->
     </view>
     <view class="bottomBox safeArea">
       <view class="sums">
         <text class="all_sum">订单金额:</text>
-        <text class="priceTag"
-          >¥{{
-            detail.standPrice *
-            (detail.selectYearList ? detail.selectYearList.length || 1 : 1)
-          }}</text
-        >
+        <text class="priceTag">¥ {{ totalPrice }}</text>
       </view>
 
       <view style="display: flex; color: #ffffff; align-items: center">
@@ -112,65 +92,6 @@
         >
       </view>
     </view>
-
-    <u-popup v-model="show" mode="bottom" border-radius="40">
-      <view class="popup_box">
-        <view class="check_head">
-          <!-- <view class="line1"></view> -->
-          <view class="grade">选择班级</view>
-          <u-icon
-            name="close"
-            color="#CFCFCF"
-            size="30"
-            @click="closePop(0)"
-          ></u-icon>
-        </view>
-        <!-- <u-line color="#D6D6DB" /> -->
-        <view class="check_con">
-          <scroll-view scroll-y="true" style="height: 580rpx">
-            <view>
-              <u-radio-group v-model="gradeValue" @change="radioGroupChange">
-                <view
-                  v-for="(item, index) in gradeList"
-                  :key="index"
-                  class="items_c"
-                >
-                  <view class="border_c">
-                    <view>
-                      <u-radio
-                        shape="circle"
-                        active-color="#FC3F3F"
-                        :name="index"
-                        :disabled="
-                          item.studentNum > 0 &&
-                          item.studentNum == item.studentUpper
-                        "
-                      >
-                        <view
-                          :class="
-                            index == gradeValue
-                              ? 'white-box blue-box'
-                              : 'white-box'
-                          "
-                        >
-                          <view>
-                            <view class="blackTxt">{{ item.className }}</view>
-                            <Class-time-tip :classInfo="item"></Class-time-tip>
-                          </view>
-                        </view>
-                      </u-radio>
-                    </view>
-                  </view>
-                </view>
-              </u-radio-group>
-            </view>
-          </scroll-view>
-        </view>
-        <view class="confrim-btn">
-          <view class="okBtn" @click="okPopup(0)">确定</view>
-        </view>
-      </view>
-    </u-popup>
     <u-popup v-model="show1" mode="bottom" border-radius="40">
       <view class="popup_box">
         <view class="check_head">
@@ -238,47 +159,16 @@
         </view>
       </view>
     </u-popup>
-    <u-popup v-model="show2" mode="bottom" border-radius="40">
-      <view class="popup_box" style="height: 500rpx">
-        <view class="check_head">
-          <view class="grade">选择年份</view>
-          <u-icon
-            name="close"
-            color="#CFCFCF"
-            size="30"
-            @click="closePop(2)"
-          ></u-icon>
-        </view>
-        <view>
-          <scroll-view scroll-y="true" style="height: 236rpx">
-            <view style="padding: 16rpx 30rpx">
-              <u-checkbox-group :wrap="true">
-                <u-checkbox
-                  shape="circle"
-                  v-for="(item, index) in yearList"
-                  :key="index"
-                  v-model="item.checked"
-                  :name="item.name"
-                >
-                  {{ item.name }}
-                </u-checkbox>
-              </u-checkbox-group>
-            </view>
-          </scroll-view>
-        </view>
-        <view class="confrim-btn"
-          ><view class="okBtn" @click="okPopup(2)">确定</view></view
-        >
-      </view>
-    </u-popup>
+    <select-grade-box ref="grade" @submit="submitSelect" />
   </view>
 </template>
 
 <script>
 import ClassTimeTip from "../../components/common/ClassTimeTip.vue";
+import selectGradeBox from "@/components/common/selectGradeBox.vue";
 import { mapGetters } from "vuex";
 export default {
-  components: { ClassTimeTip },
+  components: { ClassTimeTip, selectGradeBox },
   data() {
     return {
       gradeValue: 0,
@@ -287,12 +177,9 @@ export default {
       indicatorStyle: `height: 50px;`,
       showArea: true,
       show1: false,
-      show2: false,
-      value1: "",
+      value: "",
       show: false,
       detail: {},
-      gradeList: [],
-      yearList: [],
       provinceList: [],
       cityList: [],
       pAreaIndex: 0,
@@ -307,23 +194,34 @@ export default {
       },
       fromCart: "",
       isBK: "", //是不是补考商品
+      goodsList: [],
+      gradeListObj: {},
+      activeItem: {},
     };
   },
   onPullDownRefresh() {},
-  onLoad(option) {
+  async onLoad(option) {
     this.id = option.id;
     this.isBK = option.isBK;
     if (option.fromCart) {
       this.fromCart = option.fromCart;
     }
     this.options = option;
-    this.disCode ? this.getFxDetail() : this.getDetail();
-  },
-  onShow() {
-    /* if(this.current === 2 && this.$method.isLogin()){
-			this.$refs.refMy.init();
-		} */
+    if (this.id) {
+      this.goodsList = this.disCode
+        ? await this.getFxDetail()
+        : await this.getDetail();
+    } else {
+      this.goodsList = this.shoppingCartList;
+    }
+    this.goodsList.forEach((e, i) => {
+      if (e.templateType == "class") {
+        this.$set(e, "gradObj", {});
+        this.goodsGradeList(e);
+      }
+    });
   },
+  onShow() {},
   methods: {
     getExamine(id) {
       let self = this;
@@ -355,22 +253,15 @@ export default {
         }
       });
     },
+    submitSelect(gradObj) {
+      this.$set(this.activeItem, "gradObj", gradObj);
+    },
     //弹出框确定
     okPopup(index) {
       if (index == 0) {
         if (!this.checkData()) {
           return;
         }
-        this.gradeIndex = this.gradeValue;
-        this.detail.gradObj = this.gradeList[this.gradeIndex];
-        this.show = false;
-      } else if (index == 2) {
-        this.$set(
-          this.detail,
-          "selectYearList",
-          this.yearList.filter((e) => e.checked).map((e) => e.name)
-        );
-        this.show2 = false;
       } else {
         if (!this.checkAreaData()) {
           return;
@@ -424,53 +315,45 @@ export default {
       return true;
     },
     checkData() {
-      if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
-        if (this.gradeValue < 0) {
-          uni.showModal({
-            title: "提示",
-            content: "请选择班级",
-            showCancel: false,
-          });
-          return false;
+      this.goodsList.forEach((item) => {
+        if (item.templateType == "class" && item.goodsType == 1) {
+          if (!item.gradObj.className) {
+            uni.showModal({
+              title: "提示",
+              content: "请选择班级",
+              showCancel: false,
+            });
+            return false;
+          }
         }
-      } else if (
-        this.detail.templateType == "apply" &&
-        this.detail.goodsType == 1
-      ) {
-        // if(!this.applyObj.applyAreasJson){
-        // 	uni.showModal({
-        // 		title: "提示",
-        // 		content: '请选择报考地区',
-        // 		showCancel: false
-        // 	})
-        // 	return false
-        // }
-        /* if(!this.applyObj.examDateJson){
-					uni.showModal({
-						title: "提示",
-						content: '请选择考期',
-						showCancel: false
-					})
-					return false
-				} */
-      }
+        if (item.templateType == "apply" && item.goodsType == 1) {
+          // if (!item.applyAreas.areaName) {
+          // 	uni.showModal({
+          // 		title: '提示',
+          // 		content: '请选择报考地区',
+          // 		showCancel: false
+          // 	});
+          // 	return false;
+          // }
+        }
+      });
       return true;
     },
     radioGroupChange(e) {
       console.log(e);
     },
-    goodsGradeList() {
-      this.$api.goodsGradeList({ goodsId: this.id }).then((res) => {
-        if (res.data.code == 200) {
-          this.gradeList = res.data.rows;
-          if (this.gradeList.length == 0) {
-            let item = {
+    goodsGradeList(item) {
+      this.$api.goodsGradeList({ goodsId: item.goodsId }).then((res) => {
+        let { code, rows } = res.data;
+        if (code == 200) {
+          let gradeList = rows;
+          if (gradeList.length == 0) {
+            gradeList.push({
               className: "系统分班",
               gradeId: 0,
-            };
-            this.gradeList.push(item);
+            });
           } else {
-            let isGradeFull = this.gradeList.every(
+            let isGradeFull = gradeList.every(
               (item) =>
                 item.studentNum > 0 && item.studentNum == item.studentUpper
             );
@@ -480,29 +363,39 @@ export default {
                 className: "系统分班",
                 gradeId: 0,
               };
-              this.gradeList.unshift(item);
+              gradeList.unshift(item);
             }
           }
-          this.detail.gradObj = this.gradeList[this.gradeIndex];
+          this.$set(item, "gradObj", gradeList[0]);
+          this.gradeListObj[item.goodsId] = gradeList;
         }
       });
     },
     goBuy() {
-      if (!this.checkData()) {
-        return;
-      }
-      if (this.detail.sevenYear && !this.detail.selectYearList) {
+      if (this.goodsList.length == 0) {
         uni.showModal({
           title: "提示",
-          content: "请选择年份",
+          content: "请选择商品",
           showCancel: false,
         });
-        return false;
+        return;
       }
-      let checkGoodsList = [];
-      checkGoodsList.push(this.detail);
+      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: checkGoodsList,
+        shoppingCartList: this.goodsList,
       });
       if (this.isBK == "1") {
         this.$navTo.togo("/pages2/order/confirm_pay", {
@@ -526,28 +419,28 @@ export default {
       return data;
     },
     getDetail() {
-      let self = this;
-      this.$api.commonGoodsDetail(this.id).then((res) => {
-        if (res.data.code == 200) {
-          self.detail = res.data.data;
-          if (self.detail.templateType != null && self.detail.goodsType == 1) {
-            this.goodsGradeList();
-          }
-          self.getExamine(self.detail.projectId);
+      return this.$api.commonGoodsDetail(this.id).then((res) => {
+        let { code, data } = res.data;
+        if (code == 200) {
+          this.detail = data;
+          this.goodsList = [data];
+          // self.getExamine(data.projectId);
+          return Promise.resolve([data]);
         }
       });
     },
     getFxDetail() {
-      let self = this;
-      this.$api
+      return this.$api
         .fxGoodsDetail({
           goodsId: this.id,
           disCode: this.disCode,
         })
         .then((res) => {
-          if (res.data.code == 200) {
-            self.detail = res.data.data;
-            self.getExamine(self.detail.projectId);
+          let { code, data } = res.data;
+          if (code == 200) {
+            this.goodsList = [data];
+            // self.getExamine(self.detail.projectId);
+            return Promise.resolve([data]);
           }
         });
     },
@@ -565,18 +458,14 @@ export default {
         this.cAreaIndex = e.detail.value[1];
       }
     },
-    openPopup(index) {
+    openPopup(index, item) {
+      this.activeItem = item || {};
       if (index == 0) {
-        this.show = true;
-      } else if (index == 2) {
-        this.show2 = true;
-        let selectYearList = this.detail.selectYearList || "";
-        this.yearList = this.detail.sevenYear.split(",").map((e) => {
-          return {
-            name: e,
-            checked: selectYearList.includes(e),
-          };
-        });
+        // this.show = true;
+        this.$refs["grade"].open(
+          this.gradeListObj[item.goodsId],
+          item.gradObj.gradeId
+        );
       } else {
         this.getProvinceList();
         this.show1 = true;
@@ -585,8 +474,6 @@ export default {
     closePop(index) {
       if (index == 0) {
         this.show = false;
-      } else if (index == 2) {
-        this.show2 = false;
       } else {
         this.show1 = false;
       }
@@ -594,16 +481,19 @@ export default {
   },
   onReachBottom() {},
   computed: {
-    ...mapGetters(["userInfo"]),
+    ...mapGetters(["userInfo", "shoppingCartList"]),
     disCode() {
       return this.options.distributionCode;
     },
+    totalPrice() {
+      return this.goodsList.reduce((a, b) => a + Number(b.standPrice), 0);
+    },
   },
 };
 </script>
 <style>
 page {
-  background-color: #fff;
+  background-color: #eaeef1;
 }
 </style>
 <style scoped lang="scss">
@@ -687,11 +577,6 @@ page {
   margin: 0 auto;
   margin-top: 15rpx;
 }
-.popup_box1 {
-  height: 400rpx;
-  box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
-  border-radius: 32rpx 32rpx 0rpx 0rpx;
-}
 .popup_box {
   height: 824rpx;
   box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
@@ -717,8 +602,9 @@ page {
 .item {
   width: 100%;
   background: #ffffff;
-  border-radius: 16rpx;
+  border-radius: 24rpx;
   margin-bottom: 20rpx;
+  padding: 15rpx;
 }
 .priceTag {
   font-size: 28rpx;

+ 14 - 25
pages2/order/confirm_pay.vue

@@ -5,6 +5,16 @@
       <view>
         <view class="box2">
           <view class="title2">支付信息</view>
+          <!-- <view style="padding:10rpx 30rpx;" v-for="(item,index) in shoppingCartList" :key="index">
+						<view class="list_title">
+							<view class="txt_left">商品名称</view>
+							<view class="txt_right">{{item.goodsName}}</view>
+						</view>
+						<view class="list_item">
+							<view class="txt_left">应付金额</view>
+							<view class="txt_right_price">¥ {{item.standPrice}}</view>
+						</view>
+					</view> -->
           <view
             v-for="(item, index) in shoppingCartList"
             :key="index"
@@ -23,9 +33,6 @@
                 {{ item.goodsName }}
               </view>
               <view class="priceTag"> ¥ {{ item.standPrice }} </view>
-              <view class="priceTag" v-if="item.sevenYear">{{
-                item.selectYearList.toString()
-              }}</view>
               <Class-time-tip
                 v-if="item.gradObj && item.gradObj.gradeId"
                 :classInfo="item.gradObj"
@@ -103,7 +110,6 @@
 import { mapGetters } from "vuex";
 import { getQueryString } from "../../common/navTo";
 import ClassTimeTip from "../../components/common/ClassTimeTip.vue";
-import { forEach } from "../../pages3/static/polyv-sdk/common/chat/emotionList";
 export default {
   data() {
     return {
@@ -147,7 +153,6 @@ export default {
     // #ifdef H5
     this.authorize();
     // #endif
-    console.log(this.shoppingCartList, 798);
   },
   methods: {
     authorize() {
@@ -222,20 +227,6 @@ export default {
           item.distributionCode = this.options.distributionCode;
         }
       }
-      // 处理七大员多年份==>多商品
-      list
-        .filter((item) => item.sevenYear)
-        .forEach((item) => {
-          let yearList = item.selectYearList;
-          if (item.sevenYear && yearList) {
-            item.sevenYear = yearList[0];
-            for (let j = 1; j < yearList.length; j++) {
-              let cItem = JSON.parse(JSON.stringify(item));
-              cItem.sevenYear = yearList[j];
-              list.push(cItem);
-            }
-          }
-        });
       let data = { goodsList: list };
       // 邀请码
       if (this.sac) {
@@ -465,12 +456,10 @@ export default {
   computed: {
     ...mapGetters(["userInfo", "shoppingCartList", "sac", "config"]),
     totalPrice() {
-      let price = 0;
-      this.shoppingCartList.forEach((e) => {
-        let multiple = e.selectYearList?.length || 1;
-        price += e.standPrice * multiple;
-      });
-      return price;
+      return this.shoppingCartList.reduce(
+        (a, b) => a + Number(b.standPrice),
+        0
+      );
     },
   },
   components: { ClassTimeTip },

+ 10 - 2
pages3/course/detail.vue

@@ -456,6 +456,7 @@ export default {
       selectGoodIndex: 0,
       specAttrPriceList: [],
       options: {},
+      isQdy: 0,
     };
   },
   computed: {
@@ -541,7 +542,6 @@ export default {
       ];
       this.current = 3;
     }
-
     // #ifdef MP-WEIXIN
     wx.showShareMenu({
       withShareTicket: true,
@@ -1094,6 +1094,7 @@ export default {
           this.toggleSkuShow = true;
           this.specAttrPriceList = data.specAttrPriceList;
           this.specList = this.changeData(data.specList || []);
+          this.isQdy = data.sign;
         } else {
           if (this.isCarOrBuy == 1) {
             // 加入购物车
@@ -1314,11 +1315,18 @@ export default {
           } else {
             let data = [];
             goodsIds.forEach((id) => {
-              data.push(this.specAttrPriceList.find((e) => e.goodsId == id));
+              data.push({
+                ...this.specAttrPriceList.find((e) => e.goodsId == id),
+                templateType: "class",
+              });
             });
             this.$store.commit("setShoppingCartList", {
               shoppingCartList: data,
             });
+            if (this.isQdy == 1) {
+              this.toConfirmList("");
+              return;
+            }
             this.$navTo.togo("/pages2/order/confirm_pay" + this.addParam("?"));
           }
         }

+ 16 - 97
pages4/shopping/shoppingCart.vue

@@ -35,9 +35,12 @@
                               ></image>
                             </view>
                             <view class="flex__auto">
-                              <view class="goods-title">{{
-                                item.goodsName
-                              }}</view>
+                              <view class="goods-title"
+                                >{{ item.goodsName }}
+                                <text v-if="item.sevenYear">
+                                  ({{ item.sevenYear }})
+                                </text>
+                              </view>
                               <view class="priceTag"
                                 >¥ {{ item.standPrice }}</view
                               >
@@ -65,43 +68,17 @@
                           @click="openPopup(0, item, index)"
                         >
                           <view style="color: #666666; font-size: 24rpx">{{
-                            !item.gradObj && !item.gradObj.className
+                            !item.gradObj.className
                               ? "选择班级"
                               : item.gradObj.className
                           }}</view>
-                          <view>
-                            <u-icon
-                              name="arrow-right"
-                              color="#999999"
-                              size="28"
-                            >
-                            </u-icon>
-                          </view>
-                        </view>
-                        <view
-                          class="goods-select__type"
-                          v-if="item.sevenYear"
-                          @click="openPopup(2, item, index)"
-                        >
                           <view
-                            style="color: #666666; font-size: 24rpx"
-                            v-if="
-                              item.selectYearList && item.selectYearList.length
-                            "
-                          >
-                            {{ item.selectYearList.toString() }}
-                          </view>
-                          <view v-else style="color: #666666; font-size: 24rpx">
-                            选择年份
-                          </view>
-                          <view>
-                            <u-icon
+                            ><u-icon
                               name="arrow-right"
                               color="#999999"
                               size="28"
-                            >
-                            </u-icon>
-                          </view>
+                            ></u-icon
+                          ></view>
                         </view>
                         <view
                           v-if="item.gradObj.gradeId"
@@ -255,35 +232,6 @@
           >
         </view>
       </u-popup>
-      <u-popup v-model="show2" mode="bottom" border-radius="40">
-        <view class="popup_box" style="height: 400rpx">
-          <view style="margin-bottom: 20rpx">
-            <view class="line1"></view>
-            <view class="grade">选择年份</view>
-          </view>
-          <u-line color="#D6D6DB" />
-          <view>
-            <scroll-view scroll-y="true" style="height: 236rpx">
-              <view style="padding: 16rpx 30rpx">
-                <u-checkbox-group :wrap="true">
-                  <u-checkbox
-                    shape="circle"
-                    v-for="(item, index) in yearList"
-                    :key="index"
-                    v-model="item.checked"
-                    :name="item.name"
-                  >
-                    {{ item.name }}
-                  </u-checkbox>
-                </u-checkbox-group>
-              </view>
-            </scroll-view>
-          </view>
-          <view class="confrim-btn"
-            ><view class="okBtn" @click="okPopup(2)">确定</view></view
-          >
-        </view>
-      </u-popup>
     </view>
     <view v-show="!isLogin">
       <view
@@ -346,7 +294,6 @@ export default {
       value: "",
       show: false,
       show1: false,
-      show2: false,
       allChecked: false,
       isOld: false,
       gradeList: [],
@@ -355,7 +302,6 @@ export default {
       cityList: [],
       detail: {},
       detailIndex: -1,
-      yearList: [],
       applyObj: {
         applyAreasJson: null,
         examDateJson: null,
@@ -371,10 +317,7 @@ export default {
     ...mapGetters(["userInfo", "hideBuyState", "config"]),
     totalPrice() {
       let price = 0;
-      this.checkList.forEach((e) => {
-        let multiple = e.selectYearList?.length || 1;
-        price += e.standPrice * multiple;
-      });
+      this.checkList.forEach((e) => (price += e.standPrice));
       return price;
     },
     canCheckList() {
@@ -467,13 +410,6 @@ export default {
         //   this.gradeList[this.gradeIndex]
         // );
         this.show = false;
-      } else if (index == 2) {
-        this.$set(
-          this.detail,
-          "selectYearList",
-          this.yearList.filter((e) => e.checked).map((e) => e.name)
-        );
-        this.show2 = false;
       } else {
         if (!this.checkAreaData()) {
           return;
@@ -544,19 +480,11 @@ export default {
     },
     openPopup(index, item, itemIndex) {
       this.detail = item;
+      console.log(this.detail, 798);
       this.detailIndex = itemIndex;
       if (index == 0) {
         this.show = true;
         this.goodsGradeList(item.goodsId);
-      } else if (index == 2) {
-        this.show2 = true;
-        let selectYearList = item.selectYearList || "";
-        this.yearList = item.sevenYear.split(",").map((e) => {
-          return {
-            name: e,
-            checked: selectYearList.includes(e),
-          };
-        });
       } else {
         this.applyObj = {
           applyAreasJson: null,
@@ -604,16 +532,15 @@ export default {
               item.checked = choiceStatus == 1;
               if (templateType === "class" && goodsType == 1) {
                 // 无返回就默认系统分班
-                if (!gradeList || gradeList.length === 0) {
+                if (gradeList || gradeList.length === 0) {
                   gradeList = [
                     {
                       className: "系统分班",
                       gradeId: 0,
                     },
                   ];
-                  item.gradeList = gradeList;
                 }
-                item.gradObj = gradeList[0];
+                item.gradObj = item.gradeList[0];
               }
             }
           }
@@ -649,7 +576,7 @@ export default {
         });
         return;
       }
-      for (const item of this.checkList) {
+      this.checkList.forEach((item) => {
         if (item.templateType == "class" && item.goodsType == 1) {
           if (!item.gradObj.className) {
             uni.showModal({
@@ -659,14 +586,6 @@ export default {
             });
             return false;
           }
-          if (!item.selectYearList) {
-            uni.showModal({
-              title: "提示",
-              content: "请选择年份",
-              showCancel: false,
-            });
-            return false;
-          }
         }
         if (item.templateType == "apply" && item.goodsType == 1) {
           // if (!item.applyAreas.areaName) {
@@ -678,7 +597,7 @@ export default {
           // 	return false;
           // }
         }
-      }
+      });
       this.$store.commit("setShoppingCartList", {
         shoppingCartList: this.checkList,
       });