confirmOrder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <view>
  3. <u-navbar title="课程报名"></u-navbar>
  4. <!-- 课程信息 -->
  5. <view class="class-infos">
  6. <view class="picture">
  7. <img src="../../../assets/img/picture1.png" alt="">
  8. </view>
  9. <view class="infos">
  10. <view class="title">
  11. {{classDetail.className}}
  12. </view>
  13. <!-- <view class="else">
  14. <text>春季班</text>
  15. <text>36课时</text>
  16. <text>x1</text>
  17. </view> -->
  18. </view>
  19. </view>
  20. <!-- 班级信息 -->
  21. <view class="infos" style="margin-top: 24rpx;">
  22. <view class="item">
  23. <view class="title">
  24. <text class="asterisk">*</text>
  25. <text>报名班级</text>
  26. </view>
  27. <view class="value" @click="classSelect">
  28. <text>{{className}}</text>
  29. <text class="icon"><u-icon name="arrow-right" color="#c8c8c8"></u-icon></text>
  30. </view>
  31. </view>
  32. <view class="item">
  33. <view class="title">
  34. <text class="asterisk">*</text>
  35. <text>选择套餐</text>
  36. </view>
  37. <view class="value" @click="packageSelect">
  38. <text class="placeholder" v-if="!packageName">请选择套餐</text>
  39. <text v-else>{{packageName}}</text>
  40. <text class="icon"><u-icon name="arrow-right" color="#c8c8c8"></u-icon></text>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 学员信息 -->
  45. <view class="infos">
  46. <view class="item">
  47. <view class="title">
  48. <text class="asterisk">*</text>
  49. <text>学员姓名</text>
  50. </view>
  51. <view class="value">
  52. <text class="add" v-if="!studentId" @click="toAddChildInformation">请先添加子女信息</text>
  53. <text v-else @click="studentSelect">{{stuDetail.studentName}}</text>
  54. <text class="icon"><u-icon name="arrow-right" color="#c8c8c8"></u-icon></text>
  55. </view>
  56. </view>
  57. <u-select v-model="show" mode="single-column" :list="list" @confirm="confirm"></u-select>
  58. <view class="item">
  59. <view class="title">
  60. <text>年龄</text>
  61. </view>
  62. <view class="value">
  63. <text class="placeholder" v-if="!studentId">选择学员后自动显示</text>
  64. <text v-else>{{stuDetail.age}}</text>
  65. </view>
  66. </view>
  67. <view class="item">
  68. <view class="title">
  69. <text class="asterisk">*</text>
  70. <text>联系人手机号</text>
  71. </view>
  72. <view class="value">
  73. <text>{{stuDetail.firstContactPhone}}</text>
  74. </view>
  75. </view>
  76. <view class="item">
  77. <view class="title">
  78. <text>第二联系人手机号</text>
  79. </view>
  80. <view class="value">
  81. <text>
  82. <input type="text" placeholder="请填写手机号">
  83. </text>
  84. </view>
  85. </view>
  86. <view class="item">
  87. <view class="title">
  88. <text>接送家长姓名</text>
  89. </view>
  90. <view class="value">
  91. <text>
  92. <input type="text" placeholder="请填写家长姓名">
  93. </text>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 家长信息 -->
  98. <!-- <view class="infos">
  99. </view> -->
  100. <!-- 金额 -->
  101. <view class="amount" style="margin-top: 12px;">
  102. <view class="amount-payable">
  103. <view class="title">
  104. 应付金额
  105. </view>
  106. <view class="value" v-if="packageId == '1'">
  107. 1200.00元
  108. </view>
  109. <view class="value" v-if="packageId == '2'">
  110. 4600.00元
  111. </view>
  112. </view>
  113. <view class="discount-amount">
  114. <view class="title">
  115. 优惠金额
  116. </view>
  117. <view class="value" v-if="packageId == '1'">
  118. 0.00元
  119. </view>
  120. <view class="value" v-if="packageId == '2'">
  121. 0.00元
  122. </view>
  123. </view>
  124. <view class="amount-paid">
  125. <view class="title">
  126. 实付金额
  127. </view>
  128. <view class="value" v-if="packageId == '1'">
  129. 1200.00元
  130. </view>
  131. <view class="value" v-if="packageId == '2'">
  132. 4600.00元
  133. </view>
  134. </view>
  135. </view>
  136. <view class="amount">
  137. <view class="amount-paid">
  138. <view class="title">
  139. 老师信息
  140. </view>
  141. <view class="value">
  142. {{classDetail.teacherName}}
  143. </view>
  144. </view>
  145. <view class="amount-paid">
  146. <view class="title">
  147. 教室
  148. </view>
  149. <view class="value">
  150. 三楼{{className}}
  151. </view>
  152. </view>
  153. <view class="amount-paid">
  154. <view class="title">
  155. 上课时间
  156. </view>
  157. <view class="value" v-if="classId == '1'">
  158. 周一 周三 周五
  159. </view>
  160. <view class="value" v-if="classId == '2'">
  161. 周二 周四 周六
  162. </view>
  163. </view>
  164. <view class="amount-paid">
  165. <view class="title">
  166. 联系电话
  167. </view>
  168. <view class="value" v-if="classDetail.consultPhone != null">
  169. {{classDetail.consultPhone.slice(0,11)}}
  170. </view>
  171. </view>
  172. </view>
  173. <!-- 确认订单 -->
  174. <view class="confirm">
  175. <view class="money">
  176. <view class="title">实付金额</view>
  177. <view class="value" v-if="packageId == '1'">1200.00元</view>
  178. <view class="value" v-if="packageId == '2'">4600.00元</view>
  179. </view>
  180. <view class="pay">
  181. <button @click="topayResult">去支付</button>
  182. </view>
  183. </view>
  184. </view>
  185. </template>
  186. <script>
  187. import * as mineApi from '@/apis/parents/mine.js'
  188. import * as homePageApi from '@/apis/parents/homePage.js'
  189. export default {
  190. data() {
  191. return {
  192. studentId: '',
  193. stuDetail: {},
  194. show: false,
  195. list: [],
  196. studentList: [],
  197. classList: [
  198. {
  199. value: '1',
  200. label: ''
  201. },
  202. {
  203. value: '2',
  204. label: ''
  205. }
  206. ],
  207. packageList: [
  208. {
  209. value: '1',
  210. label: '暑期班 24课时'
  211. },
  212. {
  213. value: '2',
  214. label: '全年 92课时'
  215. }
  216. ],
  217. selectNum: '',
  218. packageId: '',
  219. packageName: '',
  220. classId: '1',
  221. className: '',
  222. classDetail: {},
  223. id: ''
  224. }
  225. },
  226. onLoad(op) {
  227. if(op.id) {
  228. this.id = op.id;
  229. this.getReCoursesList();
  230. }
  231. },
  232. onReady() {
  233. if (this.carhelp.getStudentId()) {
  234. this.studentId = this.carhelp.getStudentId().studentId;
  235. this.getStudentDetail();
  236. }
  237. this.getStudentList();
  238. },
  239. methods: {
  240. topayResult() {
  241. uni.navigateTo({
  242. url: '/pages/parents/course/payResult'
  243. })
  244. },
  245. getReCoursesList() {
  246. uni.showLoading({
  247. title: "加载中",
  248. mask: true,
  249. })
  250. homePageApi.loadCoursesForHomeShow({
  251. tag: '',
  252. pageNum: 1,
  253. pageSize: 10000
  254. }).then((res) => {
  255. uni.hideLoading();
  256. var list = res.data.data;
  257. for (var i = 0; i < list.length; i++) {
  258. if(list[i].class_id == this.id) {
  259. this.classDetail = list[i];
  260. }
  261. }
  262. this.classList[0].label = this.classDetail.className + '一班';
  263. this.classList[1].label = this.classDetail.className + '二班';
  264. this.className = this.classList[0].label;
  265. }).catch(error => {
  266. uni.showToast({
  267. title: error,
  268. icon: "none"
  269. })
  270. })
  271. },
  272. classSelect() {
  273. this.selectNum = 'class';
  274. this.list = this.classList;
  275. this.show = true;
  276. },
  277. packageSelect() {
  278. this.selectNum = 'package';
  279. this.list = this.packageList;
  280. this.show = true;
  281. },
  282. studentSelect() {
  283. this.selectNum = 'student';
  284. this.list = this.studentList;
  285. this.show = true;
  286. },
  287. confirm(e) {
  288. if(this.selectNum == 'class') {
  289. this.classId = e[0].value;
  290. this.className = e[0].label;
  291. } else if(this.selectNum == 'package') {
  292. this.packageId = e[0].value;
  293. this.packageName = e[0].label;
  294. } else if(this.selectNum == 'student') {
  295. this.studentId = e[0].value;
  296. this.getStudentDetail();
  297. } else {
  298. }
  299. },
  300. getStudentList() {
  301. uni.showLoading({
  302. title: "加载中",
  303. mask: true,
  304. })
  305. mineApi.studentList().then((res) => {
  306. uni.hideLoading();
  307. var list1 = res.data.studentList;
  308. var list2 = [];
  309. for (var i = 0; i < list1.length; i++) {
  310. list2.push({
  311. value: list1[i].studentId,
  312. label: list1[i].studentName
  313. })
  314. }
  315. this.studentList = list2;
  316. }).catch(error => {
  317. uni.showToast({
  318. title: error,
  319. icon: "none"
  320. })
  321. })
  322. },
  323. toAddChildInformation() {
  324. uni.navigateTo({
  325. url: '/pages/parents/mine/addChildInformation'
  326. })
  327. },
  328. getStudentDetail() {
  329. uni.showLoading({
  330. title: "加载中",
  331. mask: true,
  332. })
  333. mineApi.getStudentDtl({
  334. studentId: this.studentId
  335. }).then((response) => {
  336. uni.hideLoading();
  337. this.stuDetail = response.data;
  338. }).catch(error => {
  339. uni.showToast({
  340. title: error,
  341. icon: "none"
  342. })
  343. })
  344. },
  345. }
  346. }
  347. </script>
  348. <style lang="scss" scoped>
  349. // 课程信息
  350. .class-infos {
  351. padding: 24rpx 32rpx;
  352. background-color: #fff;
  353. display: flex;
  354. .picture {
  355. width: 160rpx;
  356. height: 160rpx;
  357. border-radius: 8rpx;
  358. overflow: hidden;
  359. img {
  360. width: 100%;
  361. height: 100%;
  362. }
  363. }
  364. .infos {
  365. margin-left: 16rpx;
  366. .title {
  367. color: rgba(51, 51, 51, 1);
  368. font-size: 36rpx;
  369. font-weight: bold;
  370. }
  371. .else {
  372. margin-top: 8rpx;
  373. text {
  374. margin-right: 8rpx;
  375. color: #8c8c8c;
  376. font-size: 12px;
  377. }
  378. }
  379. }
  380. }
  381. // 金额
  382. .amount {
  383. background-color: #fff;
  384. padding: 20rpx 32rpx;
  385. border-top: 1px solid rgba(244, 244, 244, 1);
  386. .title {
  387. color: #777777;
  388. }
  389. .amount-payable,
  390. .discount-amount,
  391. .amount-paid {
  392. display: flex;
  393. justify-content: space-between;
  394. margin-bottom: 16rpx;
  395. .value {
  396. color: rgba(119, 119, 119, 1);
  397. }
  398. }
  399. .discount-amount {
  400. .value {
  401. color: #E60012;
  402. }
  403. }
  404. .amount-paid {
  405. margin-bottom: 0;
  406. .value {
  407. color: #101010
  408. }
  409. }
  410. }
  411. .infos {
  412. padding: 0px 30rpx;
  413. background-color: #fff;
  414. // margin-top: 24rpx;
  415. .item {
  416. display: flex;
  417. justify-content: space-between;
  418. border-bottom: 1px solid rgba(244, 244, 244, 1);
  419. padding: 24rpx 0;
  420. .title {
  421. color: #333333;
  422. font-weight: bold;
  423. .asterisk {
  424. color: rgba(244, 68, 68, 1);
  425. }
  426. }
  427. .value {
  428. color: rgba(51, 51, 51, 1);
  429. font-weight: bold;
  430. .icon {
  431. margin-left: 8rpx;
  432. }
  433. .add {
  434. color: #FF3D00;
  435. }
  436. .placeholder {
  437. color: #CCCCCC;
  438. }
  439. }
  440. }
  441. }
  442. /deep/uni-input {
  443. width: 300rpx;
  444. text-align: right !important;
  445. }
  446. /deep/.uni-input-placeholder {
  447. color: #cccccc !important;
  448. }
  449. // 确认订单
  450. .confirm {
  451. background-color: #fff;
  452. display: flex;
  453. justify-content: space-between;
  454. position: fixed;
  455. bottom: 0;
  456. left: 0;
  457. right: 0;
  458. padding: 40rpx 32rpx;
  459. .money {
  460. display: flex;
  461. font-size: 18px;
  462. align-items: center;
  463. font-weight: bold;
  464. .title {
  465. color: #101010;
  466. }
  467. .value {
  468. color: #0DBAC7;
  469. margin-left: 8rpx;
  470. }
  471. }
  472. uni-button {
  473. width: 256rpx;
  474. height: 80rpx;
  475. border-radius: 50px;
  476. background-color: rgba(13, 186, 199, 1);
  477. color: rgba(255, 255, 255, 1);
  478. font-size: 16px;
  479. }
  480. }
  481. </style>