confirm_list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <template>
  2. <view class="confirms">
  3. <nav-bar title="确认订单"></nav-bar>
  4. <view class="contents">
  5. <!-- <view > -->
  6. <view class="item">
  7. <view style="display: flex; justify-content: space-between">
  8. <image
  9. :src="$method.splitImgHost(detail.coverUrl)"
  10. style="height: 120rpx; width: 204rpx; border-radius: 16rpx"
  11. ></image>
  12. <view class="right_con" style="margin-left: 20rpx">
  13. <view style="color: #333333; font-size: 30rpx; font-weight: bold">
  14. {{ detail.goodsName }}
  15. </view>
  16. <view class="priceTag"> ¥ {{ detail.standPrice }} </view>
  17. <view
  18. class="input_c"
  19. v-if="detail.templateType != null && detail.goodsType == 1"
  20. >
  21. <view
  22. v-if="detail.templateType == 'class'"
  23. style="
  24. display: flex;
  25. justify-content: space-between;
  26. align-items: center;
  27. height: 56rpx;
  28. padding: 8rpx;
  29. border-radius: 8rpx;
  30. "
  31. @click="openPopup(0)"
  32. >
  33. <view style="color: #666666; font-size: 24rpx">{{
  34. gradeIndex < 0 ? "选择班级" : gradeList[gradeIndex].className
  35. }}</view>
  36. <view
  37. ><u-icon name="arrow-right" color="#999999" size="28"></u-icon
  38. ></view>
  39. </view>
  40. <view
  41. v-if="detail.templateType == 'apply'"
  42. style="
  43. display: flex;
  44. justify-content: space-between;
  45. align-items: center;
  46. height: 56rpx;
  47. padding: 8rpx;
  48. border-radius: 8rpx;
  49. "
  50. @click="openPopup(1)"
  51. >
  52. <view style="color: #666666; font-size: 24rpx">{{
  53. !applyAreas.areaName
  54. ? "报考地区"
  55. : examDate.examineName +
  56. "-" +
  57. applyAreas.areaName +
  58. "-" +
  59. applyAreas.cityName
  60. }}</view>
  61. <view
  62. ><u-icon name="arrow-right" color="#999999" size="28"></u-icon
  63. ></view>
  64. </view>
  65. </view>
  66. <view class="input_c" v-if="detail.sevenYear">
  67. <view
  68. style="
  69. display: flex;
  70. justify-content: space-between;
  71. align-items: center;
  72. height: 56rpx;
  73. padding: 8rpx;
  74. border-radius: 8rpx;
  75. "
  76. @click="openPopup(2)"
  77. >
  78. <view
  79. style="color: #666666; font-size: 24rpx"
  80. v-if="detail.selectYearList && detail.selectYearList.length"
  81. >
  82. {{ detail.selectYearList.toString() }}
  83. </view>
  84. <view v-else style="color: #666666; font-size: 24rpx">
  85. 选择年份
  86. </view>
  87. <view>
  88. <u-icon name="arrow-right" color="#999999" size="28">
  89. </u-icon>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <!-- </view> -->
  97. </view>
  98. <view class="bottomBox safeArea">
  99. <view class="sums">
  100. <text class="all_sum">订单金额:</text>
  101. <text class="priceTag"
  102. >¥{{
  103. detail.standPrice *
  104. (detail.selectYearList ? detail.selectYearList.length || 1 : 1)
  105. }}</text
  106. >
  107. </view>
  108. <view style="display: flex; color: #ffffff; align-items: center">
  109. <view class="btn2" :class="{ able: isAble() }" @click="goBuy()"
  110. >确认购买</view
  111. >
  112. </view>
  113. </view>
  114. <u-popup v-model="show" mode="bottom" border-radius="40">
  115. <view class="popup_box">
  116. <view class="check_head">
  117. <!-- <view class="line1"></view> -->
  118. <view class="grade">选择班级</view>
  119. <u-icon
  120. name="close"
  121. color="#CFCFCF"
  122. size="30"
  123. @click="closePop(0)"
  124. ></u-icon>
  125. </view>
  126. <!-- <u-line color="#D6D6DB" /> -->
  127. <view class="check_con">
  128. <scroll-view scroll-y="true" style="height: 580rpx">
  129. <view>
  130. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  131. <view
  132. v-for="(item, index) in gradeList"
  133. :key="index"
  134. class="items_c"
  135. >
  136. <view class="border_c">
  137. <view>
  138. <u-radio
  139. shape="circle"
  140. active-color="#FC3F3F"
  141. :name="index"
  142. :disabled="
  143. item.studentNum > 0 &&
  144. item.studentNum == item.studentUpper
  145. "
  146. >
  147. <view
  148. :class="
  149. index == gradeValue
  150. ? 'white-box blue-box'
  151. : 'white-box'
  152. "
  153. >
  154. <view>
  155. <view class="blackTxt">{{ item.className }}</view>
  156. <Class-time-tip :classInfo="item"></Class-time-tip>
  157. </view>
  158. </view>
  159. </u-radio>
  160. </view>
  161. </view>
  162. </view>
  163. </u-radio-group>
  164. </view>
  165. </scroll-view>
  166. </view>
  167. <view class="confrim-btn">
  168. <view class="okBtn" @click="okPopup(0)">确定</view>
  169. </view>
  170. </view>
  171. </u-popup>
  172. <u-popup v-model="show1" mode="bottom" border-radius="40">
  173. <view class="popup_box">
  174. <view class="check_head">
  175. <view class="grade">选择考期/地区</view>
  176. <u-icon
  177. name="close"
  178. color="#CFCFCF"
  179. size="30"
  180. @click="closePop(1)"
  181. ></u-icon>
  182. </view>
  183. <view style="display: flex; height: 550rpx">
  184. <view style="width: 50%">
  185. <view class="topTxt">考期</view>
  186. <view>
  187. <picker-view
  188. :indicator-style="indicatorStyle"
  189. :value="value"
  190. @change="bindChangeE"
  191. class="picker-view"
  192. >
  193. <picker-view-column>
  194. <view
  195. class="picker-item"
  196. v-for="(item, index) in examine"
  197. :key="index"
  198. >{{ item.examineName }}</view
  199. >
  200. </picker-view-column>
  201. </picker-view>
  202. </view>
  203. </view>
  204. <view style="width: 50%">
  205. <view class="topTxt">地区</view>
  206. <view>
  207. <picker-view
  208. :indicator-style="indicatorStyle"
  209. :value="value"
  210. @change="bindChange"
  211. class="picker-view"
  212. >
  213. <picker-view-column>
  214. <view
  215. class="picker-item"
  216. v-for="(item, index) in provinceList"
  217. :key="index"
  218. >{{ item.areaName }}</view
  219. >
  220. </picker-view-column>
  221. <picker-view-column>
  222. <view
  223. class="picker-item"
  224. v-for="(item, index) in cityList"
  225. :key="index"
  226. >{{ item.areaName }}</view
  227. >
  228. </picker-view-column>
  229. </picker-view>
  230. </view>
  231. </view>
  232. </view>
  233. <view class="confrim-btn">
  234. <view class="okBtn" @click="okPopup(1)">确定</view>
  235. </view>
  236. </view>
  237. </u-popup>
  238. <u-popup v-model="show2" mode="bottom" border-radius="40">
  239. <view class="popup_box" style="height: 500rpx">
  240. <view class="check_head">
  241. <view class="grade">选择年份</view>
  242. <u-icon
  243. name="close"
  244. color="#CFCFCF"
  245. size="30"
  246. @click="closePop(2)"
  247. ></u-icon>
  248. </view>
  249. <view>
  250. <scroll-view scroll-y="true" style="height: 236rpx">
  251. <view style="padding: 16rpx 30rpx">
  252. <u-checkbox-group :wrap="true">
  253. <u-checkbox
  254. shape="circle"
  255. v-for="(item, index) in yearList"
  256. :key="index"
  257. v-model="item.checked"
  258. :name="item.name"
  259. >
  260. {{ item.name }}
  261. </u-checkbox>
  262. </u-checkbox-group>
  263. </view>
  264. </scroll-view>
  265. </view>
  266. <view class="confrim-btn"
  267. ><view class="okBtn" @click="okPopup(2)">确定</view></view
  268. >
  269. </view>
  270. </u-popup>
  271. </view>
  272. </template>
  273. <script>
  274. import ClassTimeTip from "../../components/common/ClassTimeTip.vue";
  275. import { mapGetters } from "vuex";
  276. export default {
  277. components: { ClassTimeTip },
  278. data() {
  279. return {
  280. gradeValue: 0,
  281. gradeIndex: 0,
  282. id: 0,
  283. indicatorStyle: `height: 50px;`,
  284. showArea: true,
  285. show1: false,
  286. show2: false,
  287. value1: "",
  288. show: false,
  289. detail: {},
  290. gradeList: [],
  291. yearList: [],
  292. provinceList: [],
  293. cityList: [],
  294. pAreaIndex: 0,
  295. cAreaIndex: 0,
  296. examine: [],
  297. examIndex: 0,
  298. applyAreas: {},
  299. examDate: {},
  300. applyObj: {
  301. applyAreasJson: null,
  302. examDateJson: null,
  303. },
  304. fromCart: "",
  305. isBK: "", //是不是补考商品
  306. };
  307. },
  308. onPullDownRefresh() {},
  309. onLoad(option) {
  310. this.id = option.id;
  311. this.isBK = option.isBK;
  312. if (option.fromCart) {
  313. this.fromCart = option.fromCart;
  314. }
  315. this.options = option;
  316. this.disCode ? this.getFxDetail() : this.getDetail();
  317. },
  318. onShow() {
  319. /* if(this.current === 2 && this.$method.isLogin()){
  320. this.$refs.refMy.init();
  321. } */
  322. },
  323. methods: {
  324. getExamine(id) {
  325. let self = this;
  326. this.$api.getExamine({ projectId: id }).then((res) => {
  327. if (res.data.code == 200) {
  328. self.examine = res.data.rows;
  329. }
  330. });
  331. },
  332. getCityList(id) {
  333. let self = this;
  334. this.$api.getCityList({ parentId: id }).then((res) => {
  335. if (res.data.code == 200) {
  336. self.cityList = res.data.rows;
  337. }
  338. });
  339. },
  340. getProvinceList() {
  341. let self = this;
  342. if (self.provinceList.length > 0) {
  343. return;
  344. }
  345. this.$api.getProvinceList().then((res) => {
  346. if (res.data.code == 200) {
  347. self.provinceList = res.data.rows;
  348. if (self.provinceList.length > 0) {
  349. self.getCityList(self.provinceList[0].areaId);
  350. }
  351. }
  352. });
  353. },
  354. //弹出框确定
  355. okPopup(index) {
  356. if (index == 0) {
  357. if (!this.checkData()) {
  358. return;
  359. }
  360. this.gradeIndex = this.gradeValue;
  361. this.detail.gradObj = this.gradeList[this.gradeIndex];
  362. this.show = false;
  363. } else if (index == 2) {
  364. this.$set(
  365. this.detail,
  366. "selectYearList",
  367. this.yearList.filter((e) => e.checked).map((e) => e.name)
  368. );
  369. this.show2 = false;
  370. } else {
  371. if (!this.checkAreaData()) {
  372. return;
  373. }
  374. this.examDate = this.examine[this.examIndex];
  375. let pData = this.provinceList[this.pAreaIndex];
  376. let cData = this.cityList[this.cAreaIndex];
  377. this.applyAreas = {
  378. areaName: pData.areaName,
  379. areaId: pData.areaId,
  380. cityId: cData.areaId,
  381. cityName: cData.areaName,
  382. };
  383. this.applyObj.applyAreasJson = JSON.stringify(this.applyAreas);
  384. this.applyObj.examDateJson = JSON.stringify(this.examDate);
  385. this.detail.examDate = this.examDate;
  386. this.detail.applyAreas = this.applyAreas;
  387. this.show1 = false;
  388. }
  389. },
  390. checkAreaData() {
  391. if (this.examine.length == 0) {
  392. uni.showModal({
  393. title: "提示",
  394. content: "请选择考期",
  395. showCancel: false,
  396. });
  397. return false;
  398. }
  399. return true;
  400. },
  401. isAble() {
  402. if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
  403. if (this.gradeValue < 0) {
  404. return false;
  405. }
  406. } else if (
  407. this.detail.templateType == "apply" &&
  408. this.detail.goodsType == 1
  409. ) {
  410. /* if(!this.applyObj.examDateJson){
  411. uni.showModal({
  412. title: "提示",
  413. content: '请选择考期',
  414. showCancel: false
  415. })
  416. return false
  417. } */
  418. }
  419. return true;
  420. },
  421. checkData() {
  422. if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
  423. if (this.gradeValue < 0) {
  424. uni.showModal({
  425. title: "提示",
  426. content: "请选择班级",
  427. showCancel: false,
  428. });
  429. return false;
  430. }
  431. } else if (
  432. this.detail.templateType == "apply" &&
  433. this.detail.goodsType == 1
  434. ) {
  435. // if(!this.applyObj.applyAreasJson){
  436. // uni.showModal({
  437. // title: "提示",
  438. // content: '请选择报考地区',
  439. // showCancel: false
  440. // })
  441. // return false
  442. // }
  443. /* if(!this.applyObj.examDateJson){
  444. uni.showModal({
  445. title: "提示",
  446. content: '请选择考期',
  447. showCancel: false
  448. })
  449. return false
  450. } */
  451. }
  452. return true;
  453. },
  454. radioGroupChange(e) {
  455. console.log(e);
  456. },
  457. goodsGradeList() {
  458. this.$api.goodsGradeList({ goodsId: this.id }).then((res) => {
  459. if (res.data.code == 200) {
  460. this.gradeList = res.data.rows;
  461. if (this.gradeList.length == 0) {
  462. let item = {
  463. className: "系统分班",
  464. gradeId: 0,
  465. };
  466. this.gradeList.push(item);
  467. } else {
  468. let isGradeFull = this.gradeList.every(
  469. (item) =>
  470. item.studentNum > 0 && item.studentNum == item.studentUpper
  471. );
  472. //所有班级都满了
  473. if (isGradeFull) {
  474. let item = {
  475. className: "系统分班",
  476. gradeId: 0,
  477. };
  478. this.gradeList.unshift(item);
  479. }
  480. }
  481. this.detail.gradObj = this.gradeList[this.gradeIndex];
  482. }
  483. });
  484. },
  485. goBuy() {
  486. if (!this.checkData()) {
  487. return;
  488. }
  489. if (this.detail.sevenYear && !this.detail.selectYearList) {
  490. uni.showModal({
  491. title: "提示",
  492. content: "请选择年份",
  493. showCancel: false,
  494. });
  495. return false;
  496. }
  497. let checkGoodsList = [];
  498. checkGoodsList.push(this.detail);
  499. this.$store.commit("setShoppingCartList", {
  500. shoppingCartList: checkGoodsList,
  501. });
  502. if (this.isBK == "1") {
  503. this.$navTo.togo("/pages2/order/confirm_pay", {
  504. isBK: "1",
  505. ...this.addParam(),
  506. });
  507. } else {
  508. this.$navTo.togo("/pages2/order/confirm_pay", {
  509. ...this.addParam(),
  510. });
  511. }
  512. },
  513. addParam() {
  514. let data = { fromCart: this.fromCart };
  515. if (this.disCode) {
  516. data.distributionCode = this.disCode;
  517. }
  518. if (this.options.linkCode) {
  519. data.linkCode = this.options.linkCode;
  520. }
  521. return data;
  522. },
  523. getDetail() {
  524. let self = this;
  525. this.$api.commonGoodsDetail(this.id).then((res) => {
  526. if (res.data.code == 200) {
  527. self.detail = res.data.data;
  528. if (self.detail.templateType != null && self.detail.goodsType == 1) {
  529. this.goodsGradeList();
  530. }
  531. self.getExamine(self.detail.projectId);
  532. }
  533. });
  534. },
  535. getFxDetail() {
  536. let self = this;
  537. this.$api
  538. .fxGoodsDetail({
  539. goodsId: this.id,
  540. disCode: this.disCode,
  541. })
  542. .then((res) => {
  543. if (res.data.code == 200) {
  544. self.detail = res.data.data;
  545. self.getExamine(self.detail.projectId);
  546. }
  547. });
  548. },
  549. bindChangeE(e) {
  550. console.log(e.detail.value);
  551. this.examIndex = e.detail.value[0];
  552. },
  553. bindChange(e) {
  554. const val = e.detail.value;
  555. if (this.pAreaIndex != e.detail.value[0]) {
  556. this.pAreaIndex = e.detail.value[0];
  557. this.getCityList(this.provinceList[this.pAreaIndex].areaId);
  558. }
  559. if (this.cAreaIndex != e.detail.value[1]) {
  560. this.cAreaIndex = e.detail.value[1];
  561. }
  562. },
  563. openPopup(index) {
  564. if (index == 0) {
  565. this.show = true;
  566. } else if (index == 2) {
  567. this.show2 = true;
  568. let selectYearList = this.detail.selectYearList || "";
  569. this.yearList = this.detail.sevenYear.split(",").map((e) => {
  570. return {
  571. name: e,
  572. checked: selectYearList.includes(e),
  573. };
  574. });
  575. } else {
  576. this.getProvinceList();
  577. this.show1 = true;
  578. }
  579. },
  580. closePop(index) {
  581. if (index == 0) {
  582. this.show = false;
  583. } else if (index == 2) {
  584. this.show2 = false;
  585. } else {
  586. this.show1 = false;
  587. }
  588. },
  589. },
  590. onReachBottom() {},
  591. computed: {
  592. ...mapGetters(["userInfo"]),
  593. disCode() {
  594. return this.options.distributionCode;
  595. },
  596. },
  597. };
  598. </script>
  599. <style>
  600. page {
  601. background-color: #fff;
  602. }
  603. </style>
  604. <style scoped lang="scss">
  605. .confirms {
  606. width: 100%;
  607. height: 100vh;
  608. // background: #fff;
  609. .contents {
  610. padding: 32rpx 32rpx 132rpx 32rpx;
  611. }
  612. .right_con {
  613. width: 450rpx;
  614. }
  615. }
  616. .picker-item {
  617. height: 50px;
  618. align-items: center;
  619. justify-content: center;
  620. text-align: center;
  621. }
  622. .picker-view {
  623. width: 100%;
  624. height: 420rpx;
  625. text-align: center;
  626. }
  627. .topTxt {
  628. font-size: 30rpx;
  629. color: #666666;
  630. text-align: center;
  631. padding: 20rpx 0;
  632. }
  633. .blackTxt {
  634. font-size: 30rpx;
  635. font-family: PingFang SC;
  636. font-weight: bold;
  637. color: #333333;
  638. }
  639. .blue-box {
  640. background: #ebf5ff;
  641. }
  642. .white-box {
  643. width: 646rpx;
  644. border-radius: 24rpx;
  645. align-items: center;
  646. display: flex;
  647. padding-left: 15rpx;
  648. }
  649. .okBtn {
  650. width: 232rpx;
  651. height: 92rpx;
  652. line-height: 92rpx;
  653. background: #fc3f3f;
  654. border-radius: 120rpx;
  655. color: #ffffff;
  656. text-align: center;
  657. font-size: 32rpx;
  658. font-weight: 500;
  659. }
  660. .confrim-btn {
  661. // border-top:1px solid #eee;
  662. height: 98rpx;
  663. width: 100%;
  664. display: flex;
  665. align-items: center;
  666. justify-content: center;
  667. }
  668. .grade {
  669. // height: 23rpx;
  670. font-size: 32rpx;
  671. color: #222;
  672. // margin: 0 auto;
  673. // margin-top: 15rpx;
  674. font-weight: 500;
  675. text-align: center;
  676. }
  677. .line1 {
  678. width: 80rpx;
  679. height: 8rpx;
  680. background: #999999;
  681. border-radius: 4rpx;
  682. margin: 0 auto;
  683. margin-top: 15rpx;
  684. }
  685. .popup_box1 {
  686. height: 400rpx;
  687. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  688. border-radius: 32rpx 32rpx 0rpx 0rpx;
  689. }
  690. .popup_box {
  691. height: 824rpx;
  692. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  693. border-radius: 28rpx 28rpx 0rpx 0rpx;
  694. .check_head {
  695. padding: 0rpx 32rpx;
  696. display: flex;
  697. align-items: center;
  698. justify-content: space-between;
  699. height: 104rpx;
  700. background: #f2f2f2;
  701. }
  702. .items_c {
  703. padding: 0rpx 32rpx;
  704. }
  705. .border_c {
  706. display: flex;
  707. align-items: center;
  708. padding: 20rpx 0rpx;
  709. border-bottom: 1rpx solid #f2f2f2;
  710. }
  711. }
  712. .item {
  713. width: 100%;
  714. background: #ffffff;
  715. border-radius: 16rpx;
  716. margin-bottom: 20rpx;
  717. }
  718. .priceTag {
  719. font-size: 28rpx;
  720. font-family: PingFang SC;
  721. font-weight: bold;
  722. color: #fc3f3f;
  723. margin-top: 6rpx;
  724. margin-bottom: 16rpx;
  725. }
  726. .input_c {
  727. background: #f8f8f8;
  728. }
  729. .btn2 {
  730. width: 232rpx;
  731. height: 92rpx;
  732. background: #fc3f3f;
  733. border-radius: 120rpx;
  734. // width: 200rpx;
  735. // height: 64rpx;
  736. // background: linear-gradient(0deg, #015EEA, #00C0FA);
  737. text-align: center;
  738. line-height: 92rpx;
  739. &.able {
  740. opacity: 1;
  741. }
  742. }
  743. .bottomBox {
  744. position: fixed;
  745. bottom: 0;
  746. width: 100%;
  747. left: 0;
  748. height: 132rpx;
  749. background-color: #ffffff;
  750. display: flex;
  751. justify-content: space-between;
  752. align-items: center;
  753. box-sizing: unset;
  754. box-shadow: 0px -2px 6px 0px rgba(0, 0, 0, 0.1);
  755. > view {
  756. margin: 0 30rpx;
  757. }
  758. .sums {
  759. display: flex;
  760. }
  761. .all_sum {
  762. font-size: 28rpx;
  763. font-weight: 500;
  764. color: #303030;
  765. }
  766. }
  767. </style>