confirm_list.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  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. this.options = option;
  260. this.disCode ? this.getFxDetail() : this.getDetail();
  261. },
  262. onShow() {
  263. /* if(this.current === 2 && this.$method.isLogin()){
  264. this.$refs.refMy.init();
  265. } */
  266. },
  267. methods: {
  268. getExamine(id) {
  269. let self = this;
  270. this.$api.getExamine({ projectId: id }).then((res) => {
  271. if (res.data.code == 200) {
  272. self.examine = res.data.rows;
  273. }
  274. });
  275. },
  276. getCityList(id) {
  277. let self = this;
  278. this.$api.getCityList({ parentId: id }).then((res) => {
  279. if (res.data.code == 200) {
  280. self.cityList = res.data.rows;
  281. }
  282. });
  283. },
  284. getProvinceList() {
  285. let self = this;
  286. if (self.provinceList.length > 0) {
  287. return;
  288. }
  289. this.$api.getProvinceList().then((res) => {
  290. if (res.data.code == 200) {
  291. self.provinceList = res.data.rows;
  292. if (self.provinceList.length > 0) {
  293. self.getCityList(self.provinceList[0].areaId);
  294. }
  295. }
  296. });
  297. },
  298. //弹出框确定
  299. okPopup(index) {
  300. if (index == 0) {
  301. if (!this.checkData()) {
  302. return;
  303. }
  304. this.gradeIndex = this.gradeValue;
  305. this.detail.gradObj = this.gradeList[this.gradeIndex];
  306. this.show = false;
  307. } else {
  308. if (!this.checkAreaData()) {
  309. return;
  310. }
  311. this.examDate = this.examine[this.examIndex];
  312. let pData = this.provinceList[this.pAreaIndex];
  313. let cData = this.cityList[this.cAreaIndex];
  314. this.applyAreas = {
  315. areaName: pData.areaName,
  316. areaId: pData.areaId,
  317. cityId: cData.areaId,
  318. cityName: cData.areaName,
  319. };
  320. this.applyObj.applyAreasJson = JSON.stringify(this.applyAreas);
  321. this.applyObj.examDateJson = JSON.stringify(this.examDate);
  322. this.detail.examDate = this.examDate;
  323. this.detail.applyAreas = this.applyAreas;
  324. this.show1 = false;
  325. }
  326. },
  327. checkAreaData() {
  328. if (this.examine.length == 0) {
  329. uni.showModal({
  330. title: "提示",
  331. content: "请选择考期",
  332. showCancel: false,
  333. });
  334. return false;
  335. }
  336. // if(this.provinceList.length==0){
  337. // uni.showModal({
  338. // title: "提示",
  339. // content: '请选择报考地区',
  340. // showCancel: false
  341. // })
  342. // return false
  343. // }
  344. // if(this.cityList.length==0){
  345. // uni.showModal({
  346. // title: "提示",
  347. // content: '请选择报考地区',
  348. // showCancel: false
  349. // })
  350. // return false
  351. // }
  352. return true;
  353. },
  354. isAble() {
  355. if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
  356. if (this.gradeValue < 0) {
  357. return false;
  358. }
  359. } else if (
  360. this.detail.templateType == "apply" &&
  361. this.detail.goodsType == 1
  362. ) {
  363. /* if(!this.applyObj.examDateJson){
  364. uni.showModal({
  365. title: "提示",
  366. content: '请选择考期',
  367. showCancel: false
  368. })
  369. return false
  370. } */
  371. }
  372. return true;
  373. },
  374. checkData() {
  375. if (this.detail.templateType == "class" && this.detail.goodsType == 1) {
  376. if (this.gradeValue < 0) {
  377. uni.showModal({
  378. title: "提示",
  379. content: "请选择班级",
  380. showCancel: false,
  381. });
  382. return false;
  383. }
  384. } else if (
  385. this.detail.templateType == "apply" &&
  386. this.detail.goodsType == 1
  387. ) {
  388. // if(!this.applyObj.applyAreasJson){
  389. // uni.showModal({
  390. // title: "提示",
  391. // content: '请选择报考地区',
  392. // showCancel: false
  393. // })
  394. // return false
  395. // }
  396. /* if(!this.applyObj.examDateJson){
  397. uni.showModal({
  398. title: "提示",
  399. content: '请选择考期',
  400. showCancel: false
  401. })
  402. return false
  403. } */
  404. }
  405. return true;
  406. },
  407. radioGroupChange(e) {
  408. console.log(e);
  409. },
  410. goodsGradeList() {
  411. let self = this;
  412. this.$api.goodsGradeList({ goodsId: this.id }).then((res) => {
  413. if (res.data.code == 200) {
  414. self.gradeList = res.data.rows;
  415. if (self.gradeList.length == 0) {
  416. let item = {
  417. className: "系统分班",
  418. gradeId: 0,
  419. };
  420. self.gradeList.push(item);
  421. } else {
  422. let isGradeFull = self.gradeList.every(
  423. (item) =>
  424. item.studentNum > 0 && item.studentNum == item.studentUpper
  425. );
  426. //所有班级都满了
  427. if (isGradeFull) {
  428. let item = {
  429. className: "系统分班",
  430. gradeId: 0,
  431. };
  432. self.gradeList.unshift(item);
  433. }
  434. }
  435. }
  436. });
  437. },
  438. goBuy() {
  439. if (!this.checkData()) {
  440. return;
  441. }
  442. let checkGoodsList = [];
  443. checkGoodsList.push(this.detail);
  444. this.$store.commit("setShoppingCartList", {
  445. shoppingCartList: checkGoodsList,
  446. });
  447. if (this.isBK == "1") {
  448. this.$navTo.togo("/pages2/order/confirm_pay", {
  449. isBK: "1",
  450. ...this.addParam(),
  451. });
  452. } else {
  453. this.$navTo.togo("/pages2/order/confirm_pay", {
  454. ...this.addParam(),
  455. });
  456. }
  457. },
  458. addParam() {
  459. let data = { fromCart: this.fromCart };
  460. if (this.disCode) {
  461. data.distributionCode = this.disCode;
  462. }
  463. if (this.options.linkCode) {
  464. data.linkCode = this.options.linkCode;
  465. }
  466. return data;
  467. },
  468. getDetail() {
  469. let self = this;
  470. this.$api.commonGoodsDetail(this.id).then((res) => {
  471. if (res.data.code == 200) {
  472. self.detail = res.data.data;
  473. self.getExamine(self.detail.projectId);
  474. }
  475. });
  476. },
  477. getFxDetail() {
  478. let self = this;
  479. this.$api
  480. .fxGoodsDetail({
  481. goodsId: this.id,
  482. disCode: this.disCode,
  483. })
  484. .then((res) => {
  485. if (res.data.code == 200) {
  486. self.detail = res.data.data;
  487. self.getExamine(self.detail.projectId);
  488. }
  489. });
  490. },
  491. bindChangeE(e) {
  492. console.log(e.detail.value);
  493. this.examIndex = e.detail.value[0];
  494. },
  495. bindChange(e) {
  496. const val = e.detail.value;
  497. if (this.pAreaIndex != e.detail.value[0]) {
  498. this.pAreaIndex = e.detail.value[0];
  499. this.getCityList(this.provinceList[this.pAreaIndex].areaId);
  500. }
  501. if (this.cAreaIndex != e.detail.value[1]) {
  502. this.cAreaIndex = e.detail.value[1];
  503. }
  504. },
  505. openPopup(index) {
  506. if (index == 0) {
  507. this.show = true;
  508. this.goodsGradeList();
  509. } else {
  510. this.show1 = true;
  511. this.getProvinceList();
  512. }
  513. },
  514. closePop(index) {
  515. if (index == 0) {
  516. this.show = false;
  517. } else {
  518. this.show1 = false;
  519. }
  520. },
  521. },
  522. onReachBottom() {},
  523. computed: {
  524. ...mapGetters(["userInfo"]),
  525. disCode() {
  526. return this.options.distributionCode;
  527. },
  528. },
  529. };
  530. </script>
  531. <style>
  532. page {
  533. background-color: #fff;
  534. }
  535. </style>
  536. <style scoped lang="scss">
  537. .confirms {
  538. width: 100%;
  539. height: 100vh;
  540. // background: #fff;
  541. .contents {
  542. padding: 32rpx 32rpx 132rpx 32rpx;
  543. }
  544. .right_con {
  545. width: 450rpx;
  546. }
  547. }
  548. .picker-item {
  549. height: 50px;
  550. align-items: center;
  551. justify-content: center;
  552. text-align: center;
  553. }
  554. .picker-view {
  555. width: 100%;
  556. height: 420rpx;
  557. text-align: center;
  558. }
  559. .topTxt {
  560. font-size: 30rpx;
  561. color: #666666;
  562. text-align: center;
  563. padding: 20rpx 0;
  564. }
  565. .blackTxt {
  566. font-size: 30rpx;
  567. font-family: PingFang SC;
  568. font-weight: bold;
  569. color: #333333;
  570. }
  571. .blue-box {
  572. background: #ebf5ff;
  573. }
  574. .white-box {
  575. width: 646rpx;
  576. border-radius: 24rpx;
  577. align-items: center;
  578. display: flex;
  579. padding-left: 15rpx;
  580. }
  581. .okBtn {
  582. width: 232rpx;
  583. height: 92rpx;
  584. line-height: 92rpx;
  585. background: #fc3f3f;
  586. border-radius: 120rpx;
  587. color: #ffffff;
  588. text-align: center;
  589. font-size: 32rpx;
  590. font-weight: 500;
  591. }
  592. .confrim-btn {
  593. // border-top:1px solid #eee;
  594. height: 98rpx;
  595. width: 100%;
  596. display: flex;
  597. align-items: center;
  598. justify-content: center;
  599. }
  600. .grade {
  601. // height: 23rpx;
  602. font-size: 32rpx;
  603. color: #222;
  604. // margin: 0 auto;
  605. // margin-top: 15rpx;
  606. font-weight: 500;
  607. text-align: center;
  608. }
  609. .line1 {
  610. width: 80rpx;
  611. height: 8rpx;
  612. background: #999999;
  613. border-radius: 4rpx;
  614. margin: 0 auto;
  615. margin-top: 15rpx;
  616. }
  617. .popup_box {
  618. height: 824rpx;
  619. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  620. border-radius: 28rpx 28rpx 0rpx 0rpx;
  621. .check_head {
  622. padding: 0rpx 32rpx;
  623. display: flex;
  624. align-items: center;
  625. justify-content: space-between;
  626. height: 104rpx;
  627. background: #f2f2f2;
  628. }
  629. .items_c {
  630. padding: 0rpx 32rpx;
  631. }
  632. .border_c {
  633. display: flex;
  634. align-items: center;
  635. padding: 20rpx 0rpx;
  636. border-bottom: 1rpx solid #f2f2f2;
  637. }
  638. }
  639. .item {
  640. width: 100%;
  641. background: #ffffff;
  642. border-radius: 16rpx;
  643. margin-bottom: 20rpx;
  644. }
  645. .priceTag {
  646. font-size: 28rpx;
  647. font-family: PingFang SC;
  648. font-weight: bold;
  649. color: #fc3f3f;
  650. margin-top: 6rpx;
  651. margin-bottom: 16rpx;
  652. }
  653. .input_c {
  654. background: #f8f8f8;
  655. }
  656. .btn2 {
  657. width: 232rpx;
  658. height: 92rpx;
  659. background: #fc3f3f;
  660. border-radius: 120rpx;
  661. // width: 200rpx;
  662. // height: 64rpx;
  663. // background: linear-gradient(0deg, #015EEA, #00C0FA);
  664. text-align: center;
  665. line-height: 92rpx;
  666. &.able {
  667. opacity: 1;
  668. }
  669. }
  670. .bottomBox {
  671. position: fixed;
  672. bottom: 0;
  673. width: 100%;
  674. left: 0;
  675. height: 132rpx;
  676. background-color: #ffffff;
  677. display: flex;
  678. justify-content: space-between;
  679. align-items: center;
  680. box-sizing: unset;
  681. box-shadow: 0px -2px 6px 0px rgba(0, 0, 0, 0.1);
  682. > view {
  683. margin: 0 30rpx;
  684. }
  685. .sums {
  686. display: flex;
  687. }
  688. .all_sum {
  689. font-size: 28rpx;
  690. font-weight: 500;
  691. color: #303030;
  692. }
  693. }
  694. </style>