index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <div class='phone-order'>
  3. <view class='query_tab'>
  4. <view :class="{'phone_query_tab':tabFlag=='phone','phone_query_tab_no':tabFlag=='order'}"
  5. @click.native='tabClick(1)'>
  6. <text
  7. :class="{'phone_query_tab_font':tabFlag=='phone','phone_query_tab_font_no':tabFlag=='order'}">用手机号查找</text>
  8. </view>
  9. <view :class="{'phone_query_tab':tabFlag=='order','phone_query_tab_no':tabFlag=='phone'}"
  10. @click.native='tabClick(2)'>
  11. <text
  12. :class="{'phone_query_tab_font':tabFlag=='order','phone_query_tab_font_no':tabFlag=='phone'}">用订单号查找</text>
  13. </view>
  14. </view>
  15. <div class='phone-class'>
  16. <div v-show="tabFlag=='phone'">
  17. <div class='phone_tip_t'>请输入支付时的手机号码,即可查看已付款的测试结果:</div>
  18. <div class='page-connent'>
  19. <div class='verification-phone'>
  20. <uni-easyinput class="uni-mt-5 verification-phone1" style='height:40px' trim="all"
  21. placeholder="请输入手机号" v-model='phone' placeholder-style="font-size:28rpx"></uni-easyinput>
  22. </div>
  23. <div class='verification-code'>
  24. <uni-easyinput class="uni-mt-5 verification-code1" placeholder="请输入验证码" v-model.number="code"
  25. placeholder-style="font-size:28rpx">
  26. <template #right><text
  27. style="margin-right:20px;background:#F8F6F7;line-height:35px;color:#03A2AD"
  28. @click='sendCode()'>{{sendCodeFlag}}</text></template>
  29. </uni-easyinput>
  30. </div>
  31. <view style='width:600rpx;text-align:right;color: #767676;font-size: 24rpx;margin-top:20rpx'>没收到验证码?
  32. </view>
  33. <!-- <div class='tip-des'>请输入您在支付时填的手机号~ 如未留下过手机号,请切换用订单号查询</div> -->
  34. <div><button class='phone-button' @click='immediateQuery(1)'>立即查询</button></div>
  35. </div>
  36. </div>
  37. <div v-show="tabFlag=='order'" style='padding-bottom:20px'>
  38. <div style='padding-top:10px;margin-left:10px;' class='order_tip_t'>请输入支付后的订单编号,即可查看已付款的测试结果:</div>
  39. <div class='verification-phone' style='padding-left:10px;padding-right: 10px;margin-top:60rpx;'>
  40. <uni-easyinput class="uni-mt-5 verification-phone1" trim="all" placeholder="请输入订单号号"
  41. v-model='orderNo' placeholder-style="font-size:28rpx"></uni-easyinput>
  42. </div>
  43. <view @click="dialogToggle"
  44. style='width: 600rpx; margin: 40rpx auto; text-align: right;color:#767676;font-size: 24rpx;'>
  45. 不知道订单编号?</view>
  46. <div style='padding-left:10px;padding-right:10px;'><button class='phone-button'
  47. @click='immediateQuery(2)'>立即查询</button></div>
  48. </div>
  49. </div>
  50. <div class="history-all">
  51. <view class='main_scale_njhd'>
  52. <img class='main_xing_left' src="/static/images/xing_left2.png" />
  53. <view class='main_scale_font_njhd'>历史订单</view>
  54. <img class='main_xing_right' src="/static/images/xing_right2.png" />
  55. </view>
  56. <div v-for="(item ,index) in historyList " :key="index" class='history-tab'>
  57. <div class='history-name'>
  58. {{item.title}}
  59. </div>
  60. <div class='history-num'>
  61. <div>订单编号:</div>
  62. <div class='history-order-des'>{{item.orderNo}}</div>
  63. </div>
  64. <div class='history-status'>
  65. <div class='history-status-font'>订单状态:</div>
  66. <div class='history-status-des'>{{item.orderStatus}}</div>
  67. </div>
  68. <div class='view-report-out'><button class='view-report' @click="goResult(item.resultId)"
  69. size='mini'>立即查看</button></div>
  70. </div>
  71. <view><uni-load-more :status="status" /></view>
  72. </div>
  73. <!-- 提示窗示例 -->
  74. <uni-popup ref="alertDialog" type="dialog">
  75. <uni-popup-dialog :type="msgType" confirmText="确定" title="提示" @confirm="dialogConfirm" @close="dialogClose">
  76. <image src="../../static/images/order_no.png" mode="widthFix" style="width: 600rpx;"></image>
  77. </uni-popup-dialog>
  78. </uni-popup>
  79. </div>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. //more 上拉加载更多
  86. //loading 加载中
  87. //no-more 没有更多数据
  88. status: 'no-more',
  89. //订单编号
  90. orderNo: '',
  91. //点击手机号查看还是订单号查看
  92. tabFlag: 'phone',
  93. //手机号
  94. phone: '',
  95. code: '',
  96. verification: null,
  97. //时间标志
  98. time: null,
  99. //倒计时数字
  100. timeCount: 60,
  101. //显示倒计时还是发送验证码
  102. sendCodeFlag: '发送验证码',
  103. historyList: [
  104. ],
  105. pageNum: 1,
  106. pageSize: 10
  107. }
  108. },
  109. onReachBottom() {
  110. console.log('滑动到距离底部100px的时候触发,可以放 。。业务逻辑');
  111. },
  112. methods: {
  113. tabClick(val) {
  114. if (val == 1) {
  115. this.tabFlag = 'phone'
  116. } else {
  117. this.tabFlag = 'order'
  118. }
  119. },
  120. //对订单号进行校验
  121. checkOrder() {
  122. if (this.orderNo == null || this.orderNo == '') {
  123. uni.showToast({
  124. title: '订单编号不能为空',
  125. icon: 'error'
  126. })
  127. return;
  128. }
  129. },
  130. //对手机号进行校验
  131. checkPhone() {
  132. var phoneReg = /^[1][3,4,5,7,8][0-9]{9}$/;
  133. if (phoneReg.test(this.phone)) {
  134. return true;
  135. } else {
  136. uni.showToast({
  137. title: '请输入正确手机号',
  138. icon: 'error'
  139. })
  140. return false;
  141. }
  142. },
  143. // 校验短信验证码
  144. checkCode() {
  145. let reg = /^[0-9]\d{5}$/;
  146. if (reg.test(this.code)) {
  147. return true;
  148. } else {
  149. uni.showToast({
  150. title: '请输入6位短信验证码',
  151. icon: 'error'
  152. })
  153. return false;
  154. }
  155. },
  156. sendCode() {
  157. if (!this.checkPhone()) {
  158. return;
  159. }
  160. if (this.sendCodeFlag == '重新发送' || this.sendCodeFlag == '发送验证码') {
  161. this.timeCount = 60;
  162. clearInterval(this.time)
  163. //起一个定时器开始倒计时
  164. this.sendCodeFlag = this.timeCount + 's'
  165. this.time = setInterval(() => {
  166. this.timeCount -= 1;
  167. this.sendCodeFlag = this.timeCount + 's'
  168. //如果倒计时为0时则停止倒计时
  169. if (this.timeCount == 0) {
  170. clearInterval(this.time)
  171. this.sendCodeFlag = '重新发送'
  172. }
  173. }, 1000)
  174. this.$request.get({
  175. url: 'user/authCode',
  176. loadingTip: "加载中...",
  177. data: {
  178. phone: this.phone
  179. },
  180. }).then((res) => {
  181. if (res.code == 200) {
  182. this.verification = res.data;
  183. uni.showToast({
  184. title: '验证码已发送',
  185. icon: 'success',
  186. })
  187. }
  188. })
  189. }
  190. },
  191. immediateQuery(val) {
  192. if (val == '1') {
  193. //参数传输手机号和验证码,然后后台进行查询
  194. this.queryByphone();
  195. } else {
  196. //参数查询订单号,然后后台进行查询
  197. this.queryByorder();
  198. }
  199. },
  200. queryByphone() {
  201. if (this.checkPhone() && this.checkCode()) {
  202. this.$request.post({
  203. url: 'record/getRecordByModelPhone',
  204. loadingTip: "加载中...",
  205. data: {
  206. modelPhone: this.phone,
  207. authCode: this.code,
  208. pageNum: this.pageNum,
  209. pageSize: this.pageSize,
  210. verification: this.verification
  211. }
  212. }).then((res) => {
  213. if (res.data) {
  214. this.historyList = res.data.orderList;
  215. } else {
  216. this.historyList = [];
  217. uni.showToast({
  218. title: res.msg,
  219. icon: 'none'
  220. })
  221. }
  222. }).catch(err => {
  223. err = JSON.parse(err);
  224. uni.showToast({
  225. title: err.msg,
  226. icon: 'none'
  227. })
  228. })
  229. }
  230. },
  231. queryByorder() {
  232. if (!this.orderNo) {
  233. uni.showToast({
  234. icon: 'none',
  235. title: '请输入订单号'
  236. })
  237. return
  238. }
  239. this.$request.get({
  240. url: `api/orderInfo/queryOrderDetail/${this.orderNo}`,
  241. loadingTip: "加载中...",
  242. data: {
  243. }
  244. }).then((res) => {
  245. if (res.data) {
  246. this.historyList = [res.data];
  247. } else {
  248. this.historyList = [];
  249. }
  250. })
  251. },
  252. goResult(id) {
  253. uni.navigateTo({
  254. url: `/scaleTestResults/testResults/index?resultId=${id}&messageShare=1`
  255. })
  256. },
  257. dialogToggle(type) {
  258. this.msgType = type
  259. this.$refs.alertDialog.open()
  260. }
  261. }
  262. }
  263. </script>
  264. <style scoped>
  265. .phone-order {
  266. max-width: 750rpx;
  267. background: linear-gradient(180deg, #D8FFF2 0%, #46E2ED 42%, #BEFFE8 98%);
  268. padding-top: 30px;
  269. padding-left: 10px;
  270. padding-right: 10px;
  271. min-height: 100vh;
  272. }
  273. .phone-order-tab {
  274. z-index: 0;
  275. position: relative;
  276. display: flex;
  277. flex-direction: row;
  278. }
  279. .phone1 {
  280. position: absolute;
  281. width: 3.5rem;
  282. height: 1.2rem;
  283. background: url(../../static/images/phone1.png) no-repeat 50%;
  284. background-size: 100% 100%;
  285. left: 0;
  286. }
  287. .phone2 {
  288. position: absolute;
  289. width: 3.5rem;
  290. height: 1.1rem;
  291. z-index: -1;
  292. background: url(../../static/images/phone2.png) no-repeat 50%;
  293. background-size: 100% 100%;
  294. left: 0;
  295. top: 0.1rem;
  296. }
  297. .order1 {
  298. position: absolute;
  299. width: 3.5rem;
  300. height: 1.2rem;
  301. background: url(../../static/images/order1.png) no-repeat 50%;
  302. background-size: 100% 100%;
  303. right: 0;
  304. }
  305. .order2 {
  306. position: absolute;
  307. width: 3.5rem;
  308. height: 1.1rem;
  309. background: url(../../static/images/order2.png) no-repeat 50%;
  310. background-size: 100% 100%;
  311. z-index: -1;
  312. top: 0.1rem;
  313. right: 0;
  314. }
  315. .phone-1 {
  316. margin-top: 20px;
  317. margin-left: 15px;
  318. font-size: 18px;
  319. font-weight: 700;
  320. }
  321. .phone-2 {
  322. color: #a95842;
  323. margin-top: 18px;
  324. margin-left: 15px;
  325. font-size: 18px;
  326. font-weight: 700;
  327. }
  328. .order-1 {
  329. text-align: center;
  330. font-size: 18px;
  331. font-weight: 700;
  332. }
  333. .order-2 {
  334. color: #a95842;
  335. margin-top: 18px;
  336. margin-left: 40px;
  337. font-size: 18px;
  338. font-weight: 700;
  339. }
  340. .phone-class {
  341. background-color: #ffffff;
  342. border-bottom-left-radius: 10px;
  343. border-bottom-right-radius: 10px;
  344. }
  345. .page-connent {
  346. padding-top: 5px;
  347. padding-bottom: 20px;
  348. padding-left: 10px;
  349. padding-right: 10px;
  350. border-radius: 10px;
  351. }
  352. .verification-phone1>>>uni-view {
  353. width: 600rpx;
  354. height: 80rpx;
  355. background: #F8F6F7 !important;
  356. border-radius: 20rpx 20rpx 20rpx 20rpx;
  357. opacity: 1;
  358. margin: 0 auto;
  359. border: none;
  360. }
  361. .verification-code1>>>uni-view {
  362. width: 600rpx;
  363. height: 80rpx;
  364. background: #F8F6F7 !important;
  365. border-radius: 20rpx 20rpx 20rpx 20rpx;
  366. opacity: 1;
  367. margin: 0 auto;
  368. border: none;
  369. }
  370. .phone-button {
  371. width: 616rpx;
  372. background: linear-gradient(270deg, #00D8E7 0%, #069EBC 100%);
  373. box-shadow: inset 0rpx 0rpx 0rpx 0rpx rgba(47, 146, 255, 0.1936);
  374. border-radius: 73rpx 73rpx 73rpx 73rpx;
  375. opacity: 1;
  376. margin: 94rpx auto 60rpx;
  377. font-size: 32rpx;
  378. font-family: Source Han Sans-Regular, Source Han Sans;
  379. font-weight: 400;
  380. color: #FFFFFF;
  381. line-height: 80rpx;
  382. }
  383. .verification-code {
  384. margin-top: 46rpx;
  385. }
  386. .verification-phone {
  387. margin-top: 20px;
  388. }
  389. .verification-phone>>>.content-clear-icon {
  390. color: #57eded !important;
  391. border: 0px;
  392. }
  393. .tip-des {
  394. padding-top: 10px;
  395. font-size: 10px;
  396. }
  397. .history-tip {
  398. display: flex;
  399. justify-content: center;
  400. margin-top: 10px;
  401. margin-bottom: 20px;
  402. }
  403. .history-name {
  404. color: #656C74;
  405. font-size: 16px;
  406. line-height: 23px;
  407. margin-bottom: 10px;
  408. }
  409. .history-tab {
  410. background-color: #ffffff;
  411. border-radius: 10px;
  412. padding-left: 10px;
  413. padding-top: 10px;
  414. padding-bottom: 10px;
  415. margin-bottom: 20px;
  416. }
  417. .history-num {
  418. display: flex;
  419. font-size: 14px;
  420. font-family: Source Han Sans-Regular, Source Han Sans;
  421. font-weight: 400;
  422. color: #656C74;
  423. line-height: 20px;
  424. }
  425. .history-status {
  426. margin-top: 5px;
  427. display: flex;
  428. }
  429. .history-status-des {
  430. margin-left: 10px;
  431. font-size: 14px;
  432. font-family: Source Han Sans-Regular, Source Han Sans;
  433. font-weight: 400;
  434. line-height: 20px;
  435. background-image: -webkit-linear-gradient(top, #bc2f08, #d75d10, #de6912);
  436. -webkit-background-clip: text;
  437. -webkit-text-fill-color: transparent;
  438. }
  439. .history-order-des {
  440. margin-left: 10px;
  441. }
  442. .view-report {
  443. margin-top: 10px;
  444. margin-left: unset;
  445. margin-right: 12px;
  446. color: #ffffff;
  447. background: #E1FDFF;
  448. border: 1px solid #069EBC;
  449. color: #069EBC;
  450. border-radius: 36px;
  451. height: 40px;
  452. font-size: 16px;
  453. }
  454. .view-report-out {
  455. display: flex;
  456. justify-content: flex-end;
  457. }
  458. .history-all {
  459. padding-bottom: 20px;
  460. }
  461. .query_tab {
  462. display: flex;
  463. }
  464. .phone_query_tab {
  465. flex: 1;
  466. background: linear-gradient(180deg, #FFFFFF, #D6F69F);
  467. height: 40px;
  468. text-align: center;
  469. }
  470. .phone_query_tab_no {
  471. flex: 1;
  472. background: linear-gradient(180deg, #FFFFFF, #E2E2E2);
  473. height: 40px;
  474. text-align: center;
  475. }
  476. .phone_query_tab_font {
  477. line-height: 40px;
  478. color: #03A2AD;
  479. font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi;
  480. font-weight: 400;
  481. font-size: 20px;
  482. }
  483. .phone_query_tab_font_no {
  484. line-height: 40px;
  485. color: #767676;
  486. font-family: AlibabaPuHuiTi-Regular, AlibabaPuHuiTi;
  487. font-weight: 400;
  488. font-size: 20px;
  489. }
  490. .phone_tip_t {
  491. font-size: 24rpx;
  492. font-family: Source Han Sans-Regular, Source Han Sans;
  493. font-weight: 400;
  494. color: #656C74;
  495. line-height: 34rpx;
  496. text-align: center;
  497. padding-top: 44rpx;
  498. }
  499. .order_tip_t {
  500. font-size: 24rpx;
  501. font-family: Source Han Sans-Regular, Source Han Sans;
  502. font-weight: 400;
  503. color: #656C74;
  504. line-height: 34rpx;
  505. text-align: center;
  506. margin: 60rpx 0;
  507. }
  508. .main_scale_njhd {
  509. margin-top: 39px;
  510. display: flex;
  511. justify-content: center;
  512. align-items: center;
  513. margin-bottom: 20px;
  514. }
  515. .main_scale_font_njhd {
  516. font-size: 16px;
  517. font-family: AlibabaPuHuiTi-Heavy, AlibabaPuHuiTi;
  518. font-weight: 900;
  519. color: #000000;
  520. line-height: 30px;
  521. }
  522. .main_xing_left {
  523. height: 30px;
  524. weight: 20px;
  525. margin-right: 20px;
  526. }
  527. .main_xing_right {
  528. height: 30px;
  529. weight: 20px;
  530. margin-left: 20px;
  531. }
  532. .history-status-font {
  533. font-size: 14px;
  534. font-family: Source Han Sans-Regular, Source Han Sans;
  535. font-weight: 400;
  536. color: #656C74;
  537. line-height: 20px;
  538. }
  539. /deep/ .uni-easyinput__content {
  540. font-size: 32rpx;
  541. }
  542. /deep/ .uni-easyinput__content-input {
  543. font-size: 32rpx;
  544. }
  545. </style>