confirm_list.vue 18 KB

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