confirm_list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <view>
  3. <view style="padding: 30rpx;padding-bottom: 98rpx;">
  4. <view >
  5. <view class="item">
  6. <view style="display: flex;justify-content: space-between;padding-bottom: 15rpx;">
  7. <image :src="$method.splitImgHost(detail.coverUrl)" style="height: 134rpx;width: 278rpx;border-radius: 16rpx;"></image>
  8. <view style="margin-left: 20rpx;">
  9. <view style="color: #333333;font-size: 30rpx;font-weight: bold;">
  10. {{detail.goodsName}}
  11. </view>
  12. <view class="priceTag">
  13. ¥ {{detail.standPrice}}
  14. </view>
  15. </view>
  16. </view>
  17. <view v-if="detail.templateType!=null">
  18. <u-line color="#D6D6DB" />
  19. <view v-if="detail.templateType=='class'" style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(0)">
  20. <view style="color: #666666;font-size: 24rpx;">{{gradeIndex<0?'选择班级':gradeList[gradeIndex].className}}</view>
  21. <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
  22. </view>
  23. <view v-if="detail.templateType=='apply'" style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(1)">
  24. <view style="color: #666666;font-size: 24rpx;" >{{!applyAreas.areaName?'报考地区':examDate.examineName+'-'+applyAreas.areaName+'-'+applyAreas.cityName}}</view>
  25. <view><u-icon name="arrow-right" color="#999999" size="28"></u-icon></view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="bottomBox safeArea">
  32. <view class="priceTag">¥ {{detail.standPrice}}</view>
  33. <view style="display: flex;color: #FFFFFF;align-items: center;">
  34. <view class="btn2" @click="goBuy()">确认购买</view>
  35. </view>
  36. </view>
  37. <u-popup v-model="show" mode="bottom"border-radius="40">
  38. <view class="popup_box">
  39. <view style="margin-bottom: 20rpx;">
  40. <view class="line1"></view>
  41. <view class="grade">选择班级</view>
  42. </view>
  43. <u-line color="#D6D6DB" />
  44. <view>
  45. <scroll-view scroll-y="true" style="height: 500rpx;">
  46. <view>
  47. <u-radio-group v-model="gradeValue" @change="radioGroupChange">
  48. <view v-for="(item, index) in gradeList" :key="index" >
  49. <view style="display: flex;align-items: center;padding: 20rpx;">
  50. <view>
  51. <u-radio
  52. shape="circle"
  53. :name="index"
  54. ></u-radio>
  55. </view>
  56. <view :class="item.checked?'white-box blue-box':'white-box'" >
  57. <view>
  58. <view class="blackTxt">{{item.className}}</view>
  59. <view class="redTxt" v-if="item.classEndTime">有效期至:{{$method.timestampToTime(item.classEndTime)}}</view>
  60. <view class="redTxt" v-if="item.classEndTime">本班还剩{{$method.GetRTime(item.classEndTime)}}天将结束学习</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </u-radio-group>
  66. </view>
  67. </scroll-view>
  68. </view>
  69. <view class="confrim-btn">
  70. <view class="okBtn" @click="okPopup(0)">确定</view>
  71. </view>
  72. </view>
  73. </u-popup>
  74. <u-popup v-model="show1" mode="bottom"border-radius="40">
  75. <view class="popup_box">
  76. <view style="margin-bottom: 20rpx;">
  77. <view class="line1"></view>
  78. <view class="grade">选择考期/地区</view>
  79. </view>
  80. <u-line color="#D6D6DB" />
  81. <view style="display: flex;height: 500rpx;">
  82. <view style="width: 50%;">
  83. <view class="topTxt">考期</view>
  84. <view>
  85. <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChangeE" class="picker-view">
  86. <picker-view-column>
  87. <view class="picker-item" v-for="(item,index) in examine" :key="index">{{item.examineName}}</view>
  88. </picker-view-column>
  89. </picker-view>
  90. </view>
  91. </view>
  92. <view style="width: 50%;">
  93. <view class="topTxt">地区</view>
  94. <view>
  95. <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view">
  96. <picker-view-column>
  97. <view class="picker-item" v-for="(item,index) in provinceList" :key="index">{{item.areaName}}</view>
  98. </picker-view-column>
  99. <picker-view-column>
  100. <view class="picker-item" v-for="(item,index) in cityList" :key="index">{{item.areaName}}</view>
  101. </picker-view-column>
  102. </picker-view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="confrim-btn">
  107. <view class="okBtn" @click="okPopup(1)">确定</view>
  108. </view>
  109. </view>
  110. </u-popup>
  111. </view>
  112. </template>
  113. <script>
  114. import { mapGetters } from 'vuex';
  115. export default {
  116. components: {
  117. },
  118. data() {
  119. return {
  120. gradeValue:-1,
  121. gradeIndex:-1,
  122. id:0,
  123. indicatorStyle: `height: 50px;`,
  124. showArea:true,
  125. show1:false,
  126. value1:'',
  127. show:false,
  128. detail:{},
  129. gradeList:[],
  130. provinceList:[],
  131. cityList:[],
  132. pAreaIndex:0,
  133. cAreaIndex:0,
  134. examine:[],
  135. examIndex:0,
  136. applyAreas:{},
  137. examDate:{},
  138. applyObj:{
  139. applyAreasJson:null,
  140. examDateJson:null
  141. }
  142. };
  143. },
  144. onPullDownRefresh(){
  145. },
  146. onLoad(option) {
  147. this.id = option.id;
  148. this.getDetail()
  149. },
  150. onShow() {
  151. /* if(this.current === 2 && this.$method.isLogin()){
  152. this.$refs.refMy.init();
  153. } */
  154. },
  155. methods: {
  156. getExamine(id) {
  157. let self = this
  158. this.$api.getExamine({projectId:id}).then(res => {
  159. if(res.data.code==200){
  160. self.examine = res.data.rows
  161. }
  162. });
  163. },
  164. getCityList(id) {
  165. let self = this
  166. this.$api.getCityList({parentId:id}).then(res => {
  167. if(res.data.code==200){
  168. self.cityList = res.data.rows
  169. }
  170. });
  171. },
  172. getProvinceList() {
  173. let self = this
  174. if(self.provinceList.length>0){
  175. return
  176. }
  177. this.$api.getProvinceList().then(res => {
  178. if(res.data.code==200){
  179. self.provinceList = res.data.rows
  180. if(self.provinceList.length>0){
  181. self.getCityList(self.provinceList[0].areaId)
  182. }
  183. }
  184. });
  185. },
  186. //弹出框确定
  187. okPopup(index){
  188. if(index==0){
  189. if(!this.checkData()){
  190. return
  191. }
  192. this.gradeIndex = this.gradeValue
  193. this.show = false
  194. }else{
  195. if(!this.checkAreaData()){
  196. return
  197. }
  198. this.examDate = this.examine[this.examIndex]
  199. let pData = this.provinceList[this.pAreaIndex]
  200. let cData = this.cityList[this.cAreaIndex]
  201. this.applyAreas = {areaName:pData.areaName,areaId:pData.areaId,cityId:cData.areaId,cityName:cData.areaName}
  202. this.applyObj.applyAreasJson = JSON.stringify(this.applyAreas)
  203. this.applyObj.examDateJson = JSON.stringify(this.examDate)
  204. this.show1 = false
  205. }
  206. },
  207. checkAreaData(){
  208. if(this.examine.length==0){
  209. uni.showModal({
  210. title: "提示",
  211. content: '请选择考期',
  212. showCancel: false
  213. })
  214. return false
  215. }
  216. if(this.provinceList.length==0){
  217. uni.showModal({
  218. title: "提示",
  219. content: '请选择报考地区',
  220. showCancel: false
  221. })
  222. return false
  223. }
  224. if(this.cityList.length==0){
  225. uni.showModal({
  226. title: "提示",
  227. content: '请选择报考地区',
  228. showCancel: false
  229. })
  230. return false
  231. }
  232. return true
  233. },
  234. checkData(){
  235. if(this.detail.templateType=='class'){
  236. if(this.gradeValue<0){
  237. uni.showModal({
  238. title: "提示",
  239. content: '请选择班级',
  240. showCancel: false
  241. })
  242. return false
  243. }
  244. }
  245. else if(this.detail.templateType=='apply'){
  246. if(!this.applyObj.applyAreasJson){
  247. uni.showModal({
  248. title: "提示",
  249. content: '请选择报考地区',
  250. showCancel: false
  251. })
  252. return false
  253. }
  254. if(!this.applyObj.examDateJson){
  255. uni.showModal({
  256. title: "提示",
  257. content: '请选择考期',
  258. showCancel: false
  259. })
  260. return false
  261. }
  262. }
  263. return true;
  264. },
  265. radioGroupChange(e){
  266. console.log(e);
  267. },
  268. goodsGradeList() {
  269. let self = this
  270. this.$api.goodsGradeList({goodsId:this.id}).then(res => {
  271. if(res.data.code==200){
  272. self.gradeList = res.data.rows
  273. if(self.gradeList.length==0){
  274. let item = {
  275. className:'系统分班',
  276. gradeId:0
  277. }
  278. self.gradeList.push(item)
  279. }
  280. }
  281. });
  282. },
  283. goBuy(){
  284. if(!this.checkData()){
  285. return
  286. }
  287. this.$navTo.togo('/pages2/order/confirm_pay');
  288. },
  289. getDetail() {
  290. let self = this
  291. this.$api.goodsDetail(this.id).then(res => {
  292. if(res.data.code==200){
  293. self.detail = res.data.data
  294. self.getExamine(self.detail.projectId)
  295. }
  296. });
  297. },
  298. bindChangeE(e){
  299. console.log(e.detail.value)
  300. this.examIndex = e.detail.value[0]
  301. },
  302. bindChange(e) {
  303. const val = e.detail.value
  304. if(this.pAreaIndex!=e.detail.value[0]){
  305. this.pAreaIndex = e.detail.value[0]
  306. this.getCityList(this.provinceList[this.pAreaIndex].areaId)
  307. }
  308. if(this.cAreaIndex!=e.detail.value[1]){
  309. this.cAreaIndex = e.detail.value[1]
  310. }
  311. },
  312. openPopup(index){
  313. if(index==0){
  314. this.show = true
  315. this.goodsGradeList()
  316. }else{
  317. this.show1 = true
  318. this.getProvinceList()
  319. }
  320. }
  321. },
  322. onReachBottom() {},
  323. computed: { ...mapGetters(['userInfo']) }
  324. };
  325. </script>
  326. <style >
  327. page{
  328. background-color: #EAEEF1;
  329. }
  330. </style>
  331. <style scoped lang="scss">
  332. .picker-item {
  333. height: 50px;
  334. align-items: center;
  335. justify-content: center;
  336. text-align: center;
  337. }
  338. .picker-view {
  339. width: 100%;
  340. height: 420rpx;
  341. text-align: center;
  342. }
  343. .topTxt{
  344. font-size: 30rpx;
  345. color: #666666;
  346. text-align: center;
  347. padding: 20rpx 0;
  348. }
  349. .blackTxt{
  350. font-size: 30rpx;
  351. font-family: PingFang SC;
  352. font-weight: bold;
  353. color: #333333;
  354. }
  355. .redTxt{
  356. font-size: 30rpx;
  357. font-family: PingFang SC;
  358. color: #FF2D55;
  359. margin-top: 13rpx;
  360. }
  361. .blue-box{
  362. background: #EBF5FF;
  363. }
  364. .white-box{
  365. width: 646rpx;
  366. border-radius: 24rpx;
  367. align-items: center;
  368. display: flex;
  369. padding-left: 15rpx;
  370. }
  371. .okBtn{
  372. width: 200rpx;
  373. height: 64rpx;
  374. background: linear-gradient(0deg, #015EEA, #00C0FA);
  375. border-radius: 32rpx;
  376. color: #FFFFFF;
  377. text-align: center;
  378. line-height: 64rpx;
  379. }
  380. .confrim-btn{
  381. height: 98rpx;
  382. width: 100%;
  383. display: flex;
  384. align-items: center;
  385. justify-content:center;
  386. }
  387. .grade{
  388. height: 23rpx;
  389. font-size: 24rpx;
  390. color: #999999;
  391. margin: 0 auto;
  392. margin-top: 15rpx;
  393. text-align: center;
  394. }
  395. .line1{
  396. width: 80rpx;
  397. height: 8rpx;
  398. background: #999999;
  399. border-radius: 4rpx;
  400. margin: 0 auto;
  401. margin-top: 15rpx;
  402. }
  403. .popup_box {
  404. height: 700rpx;
  405. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  406. border-radius: 32rpx 32rpx 0rpx 0rpx;
  407. }
  408. .item{
  409. width: 100%;
  410. background: #FFFFFF;
  411. border-radius: 16rpx;
  412. margin-bottom: 20rpx;
  413. padding: 15rpx;
  414. }
  415. .priceTag{
  416. font-size: 30rpx;
  417. font-family: PingFang SC;
  418. font-weight: bold;
  419. color: #FF2D55;
  420. display: flex;
  421. flex-direction: row-reverse;
  422. }
  423. .btn2{
  424. width: 200rpx;
  425. height: 64rpx;
  426. background: linear-gradient(0deg, #015EEA, #00C0FA);
  427. opacity: 0.6;
  428. border-radius: 32rpx;
  429. text-align: center;
  430. line-height: 64rpx;
  431. }
  432. .bottomBox{
  433. position: fixed;
  434. bottom: 0;
  435. width: 100%;
  436. left: 0;
  437. height:98rpx ;
  438. background-color: #FFFFFF;
  439. display: flex;
  440. justify-content: space-between;
  441. align-items: center;
  442. box-sizing: unset;
  443. >view{
  444. margin: 0 30rpx;
  445. }
  446. }
  447. </style>