confirm_list.vue 15 KB

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