123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772 |
- <template>
- <view class="confirms">
- <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>
- </view>
- <view class="input_c" v-if="detail.sevenYear">
- <view
- style="
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 56rpx;
- padding: 8rpx;
- border-radius: 8rpx;
- "
- @click="openPopup(2)"
- >
- <view
- style="color: #666666; font-size: 24rpx"
- v-if="detail.selectYearList && detail.selectYearList.length"
- >
- {{ detail.selectYearList.toString() }}
- </view>
- <view v-else style="color: #666666; font-size: 24rpx">
- 选择年份
- </view>
- <view>
- <u-icon name="arrow-right" color="#999999" size="28">
- </u-icon>
- </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
- >
- </view>
- <view style="display: flex; color: #ffffff; align-items: center">
- <view class="btn2" :class="{ able: isAble() }" @click="goBuy()"
- >确认购买</view
- >
- </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">
- <view class="grade">选择考期/地区</view>
- <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-column>
- <view
- class="picker-item"
- v-for="(item, index) in examine"
- :key="index"
- >{{ item.examineName }}</view
- >
- </picker-view-column>
- </picker-view>
- </view>
- </view>
- <view style="width: 50%">
- <view class="topTxt">地区</view>
- <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
- >
- </picker-view-column>
- <picker-view-column>
- <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>
- </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>
- </view>
- </template>
- <script>
- import ClassTimeTip from "../../components/common/ClassTimeTip.vue";
- import { mapGetters } from "vuex";
- export default {
- components: { ClassTimeTip },
- data() {
- return {
- gradeValue: 0,
- gradeIndex: 0,
- id: 0,
- indicatorStyle: `height: 50px;`,
- showArea: true,
- show1: false,
- show2: false,
- value1: "",
- show: false,
- detail: {},
- gradeList: [],
- yearList: [],
- provinceList: [],
- cityList: [],
- pAreaIndex: 0,
- cAreaIndex: 0,
- examine: [],
- examIndex: 0,
- applyAreas: {},
- examDate: {},
- applyObj: {
- applyAreasJson: null,
- examDateJson: null,
- },
- fromCart: "",
- isBK: "", //是不是补考商品
- };
- },
- onPullDownRefresh() {},
- 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();
- } */
- },
- methods: {
- getExamine(id) {
- let self = this;
- this.$api.getExamine({ projectId: id }).then((res) => {
- if (res.data.code == 200) {
- self.examine = res.data.rows;
- }
- });
- },
- getCityList(id) {
- let self = this;
- this.$api.getCityList({ parentId: id }).then((res) => {
- if (res.data.code == 200) {
- self.cityList = res.data.rows;
- }
- });
- },
- getProvinceList() {
- let self = this;
- if (self.provinceList.length > 0) {
- return;
- }
- this.$api.getProvinceList().then((res) => {
- if (res.data.code == 200) {
- self.provinceList = res.data.rows;
- if (self.provinceList.length > 0) {
- self.getCityList(self.provinceList[0].areaId);
- }
- }
- });
- },
- //弹出框确定
- 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;
- }
- 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() {
- if (this.examine.length == 0) {
- uni.showModal({
- title: "提示",
- content: "请选择考期",
- showCancel: false,
- });
- return false;
- }
- return true;
- },
- isAble() {
- if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
- if (this.gradeValue < 0) {
- return false;
- }
- } else if (
- this.detail.templateType == "apply" &&
- this.detail.goodsType == 1
- ) {
- /* if(!this.applyObj.examDateJson){
- uni.showModal({
- title: "提示",
- content: '请选择考期',
- showCancel: false
- })
- return false
- } */
- }
- return true;
- },
- checkData() {
- if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
- if (this.gradeValue < 0) {
- 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
- } */
- }
- 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 = {
- className: "系统分班",
- gradeId: 0,
- };
- this.gradeList.push(item);
- } else {
- let isGradeFull = this.gradeList.every(
- (item) =>
- item.studentNum > 0 && item.studentNum == item.studentUpper
- );
- //所有班级都满了
- if (isGradeFull) {
- let item = {
- className: "系统分班",
- gradeId: 0,
- };
- this.gradeList.unshift(item);
- }
- }
- this.detail.gradObj = this.gradeList[this.gradeIndex];
- }
- });
- },
- goBuy() {
- if (!this.checkData()) {
- return;
- }
- if (this.detail.sevenYear && !this.detail.selectYearList) {
- uni.showModal({
- title: "提示",
- content: "请选择年份",
- showCancel: false,
- });
- return false;
- }
- let checkGoodsList = [];
- checkGoodsList.push(this.detail);
- this.$store.commit("setShoppingCartList", {
- shoppingCartList: checkGoodsList,
- });
- if (this.isBK == "1") {
- this.$navTo.togo("/pages2/order/confirm_pay", {
- isBK: "1",
- ...this.addParam(),
- });
- } else {
- this.$navTo.togo("/pages2/order/confirm_pay", {
- ...this.addParam(),
- });
- }
- },
- addParam() {
- let data = { fromCart: this.fromCart };
- if (this.disCode) {
- data.distributionCode = this.disCode;
- }
- if (this.options.linkCode) {
- data.linkCode = this.options.linkCode;
- }
- 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);
- }
- });
- },
- getFxDetail() {
- let self = this;
- 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);
- }
- });
- },
- bindChangeE(e) {
- console.log(e.detail.value);
- this.examIndex = e.detail.value[0];
- },
- bindChange(e) {
- const val = e.detail.value;
- if (this.pAreaIndex != e.detail.value[0]) {
- this.pAreaIndex = e.detail.value[0];
- this.getCityList(this.provinceList[this.pAreaIndex].areaId);
- }
- if (this.cAreaIndex != e.detail.value[1]) {
- this.cAreaIndex = e.detail.value[1];
- }
- },
- openPopup(index) {
- 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),
- };
- });
- } else {
- this.getProvinceList();
- this.show1 = true;
- }
- },
- closePop(index) {
- if (index == 0) {
- this.show = false;
- } else if (index == 2) {
- this.show2 = false;
- } else {
- this.show1 = false;
- }
- },
- },
- onReachBottom() {},
- computed: {
- ...mapGetters(["userInfo"]),
- disCode() {
- return this.options.distributionCode;
- },
- },
- };
- </script>
- <style>
- page {
- background-color: #fff;
- }
- </style>
- <style scoped lang="scss">
- .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;
- align-items: center;
- display: flex;
- padding-left: 15rpx;
- }
- .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;
- }
- .grade {
- // height: 23rpx;
- font-size: 32rpx;
- color: #222;
- // margin: 0 auto;
- // margin-top: 15rpx;
- font-weight: 500;
- text-align: center;
- }
- .line1 {
- width: 80rpx;
- height: 8rpx;
- background: #999999;
- border-radius: 4rpx;
- 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);
- 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;
- }
- }
- .item {
- width: 100%;
- background: #ffffff;
- border-radius: 16rpx;
- margin-bottom: 20rpx;
- }
- .priceTag {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #fc3f3f;
- margin-top: 6rpx;
- margin-bottom: 16rpx;
- }
- .input_c {
- background: #f8f8f8;
- }
- .btn2 {
- width: 232rpx;
- height: 92rpx;
- background: #fc3f3f;
- border-radius: 120rpx;
- // width: 200rpx;
- // height: 64rpx;
- // background: linear-gradient(0deg, #015EEA, #00C0FA);
- text-align: center;
- line-height: 92rpx;
- &.able {
- opacity: 1;
- }
- }
- .bottomBox {
- position: fixed;
- bottom: 0;
- width: 100%;
- left: 0;
- height: 132rpx;
- background-color: #ffffff;
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: unset;
- box-shadow: 0px -2px 6px 0px rgba(0, 0, 0, 0.1);
- > view {
- margin: 0 30rpx;
- }
- .sums {
- display: flex;
- }
- .all_sum {
- font-size: 28rpx;
- font-weight: 500;
- color: #303030;
- }
- }
- </style>
|