index.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. //more 上拉加载更多
  7. //loading 加载中
  8. //no-more 没有更多数据
  9. status: "no-more",
  10. //订单编号
  11. orderNo: "",
  12. //点击手机号查看还是订单号查看
  13. tabFlag: "phone",
  14. //手机号
  15. phone: "",
  16. code: "",
  17. verification: null,
  18. //时间标志
  19. time: null,
  20. //倒计时数字
  21. timeCount: 60,
  22. //显示倒计时还是发送验证码
  23. sendCodeFlag: "发送验证码",
  24. historyList: [],
  25. pageNum: 1,
  26. pageSize: 10
  27. };
  28. },
  29. onReachBottom() {
  30. console.log("滑动到距离底部100px的时候触发,可以放 。。业务逻辑");
  31. },
  32. methods: {
  33. tabClick(val) {
  34. if (val == 1) {
  35. this.tabFlag = "phone";
  36. } else {
  37. this.tabFlag = "order";
  38. }
  39. },
  40. //对订单号进行校验
  41. checkOrder() {
  42. if (this.orderNo == null || this.orderNo == "") {
  43. common_vendor.index.showToast({
  44. title: "订单编号不能为空",
  45. icon: "error"
  46. });
  47. return;
  48. }
  49. },
  50. //对手机号进行校验
  51. checkPhone() {
  52. var phoneReg = /^[1][3,4,5,7,8][0-9]{9}$/;
  53. if (phoneReg.test(this.phone)) {
  54. return true;
  55. } else {
  56. common_vendor.index.showToast({
  57. title: "请输入正确手机号",
  58. icon: "error"
  59. });
  60. return false;
  61. }
  62. },
  63. // 校验短信验证码
  64. checkCode() {
  65. let reg = /^[0-9]\d{5}$/;
  66. if (reg.test(this.code)) {
  67. return true;
  68. } else {
  69. common_vendor.index.showToast({
  70. title: "请输入6位短信验证码",
  71. icon: "error"
  72. });
  73. return false;
  74. }
  75. },
  76. sendCode() {
  77. if (!this.checkPhone()) {
  78. return;
  79. }
  80. if (this.sendCodeFlag == "重新发送" || this.sendCodeFlag == "发送验证码") {
  81. this.timeCount = 60;
  82. clearInterval(this.time);
  83. this.sendCodeFlag = this.timeCount + "s";
  84. this.time = setInterval(() => {
  85. this.timeCount -= 1;
  86. this.sendCodeFlag = this.timeCount + "s";
  87. if (this.timeCount == 0) {
  88. clearInterval(this.time);
  89. this.sendCodeFlag = "重新发送";
  90. }
  91. }, 1e3);
  92. this.$request.get({
  93. url: "user/authCode",
  94. loadingTip: "加载中...",
  95. data: {
  96. phone: this.phone
  97. }
  98. }).then((res) => {
  99. if (res.code == 200) {
  100. this.verification = res.data;
  101. common_vendor.index.showToast({
  102. title: "验证码已发送",
  103. icon: "success"
  104. });
  105. }
  106. });
  107. }
  108. },
  109. immediateQuery(val) {
  110. if (val == "1") {
  111. this.queryByphone();
  112. } else {
  113. this.queryByorder();
  114. }
  115. },
  116. queryByphone() {
  117. if (this.checkPhone() && this.checkCode()) {
  118. this.$request.post({
  119. url: "record/getRecordByModelPhone",
  120. loadingTip: "加载中...",
  121. data: {
  122. modelPhone: this.phone,
  123. authCode: this.code,
  124. pageNum: this.pageNum,
  125. pageSize: this.pageSize,
  126. verification: this.verification
  127. }
  128. }).then((res) => {
  129. if (res.data) {
  130. this.historyList = res.data.orderList;
  131. } else {
  132. this.historyList = [];
  133. common_vendor.index.showToast({
  134. title: res.msg,
  135. icon: "none"
  136. });
  137. }
  138. }).catch((err) => {
  139. err = JSON.parse(err);
  140. common_vendor.index.showToast({
  141. title: err.msg,
  142. icon: "none"
  143. });
  144. });
  145. }
  146. },
  147. queryByorder() {
  148. if (!this.orderNo) {
  149. common_vendor.index.showToast({
  150. icon: "none",
  151. title: "请输入订单号"
  152. });
  153. return;
  154. }
  155. this.$request.get({
  156. url: `api/orderInfo/queryOrderDetail/${this.orderNo}`,
  157. loadingTip: "加载中...",
  158. data: {}
  159. }).then((res) => {
  160. if (res.data) {
  161. this.historyList = [res.data];
  162. } else {
  163. this.historyList = [];
  164. }
  165. });
  166. },
  167. goResult(id) {
  168. common_vendor.index.navigateTo({
  169. url: `/scaleTestResults/testResults/index?resultId=${id}&messageShare=1`
  170. });
  171. },
  172. dialogToggle(type) {
  173. this.msgType = type;
  174. this.$refs.alertDialog.open();
  175. }
  176. }
  177. };
  178. if (!Array) {
  179. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  180. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  181. const _easycom_uni_popup_dialog2 = common_vendor.resolveComponent("uni-popup-dialog");
  182. const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  183. (_easycom_uni_easyinput2 + _easycom_uni_load_more2 + _easycom_uni_popup_dialog2 + _easycom_uni_popup2)();
  184. }
  185. const _easycom_uni_easyinput = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput.js";
  186. const _easycom_uni_load_more = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-load-more/uni-load-more.js";
  187. const _easycom_uni_popup_dialog = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.js";
  188. const _easycom_uni_popup = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.js";
  189. if (!Math) {
  190. (_easycom_uni_easyinput + _easycom_uni_load_more + _easycom_uni_popup_dialog + _easycom_uni_popup)();
  191. }
  192. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  193. return {
  194. a: $data.tabFlag == "phone" ? 1 : "",
  195. b: $data.tabFlag == "order" ? 1 : "",
  196. c: $data.tabFlag == "phone" ? 1 : "",
  197. d: $data.tabFlag == "order" ? 1 : "",
  198. e: common_vendor.o(($event) => $options.tabClick(1)),
  199. f: $data.tabFlag == "order" ? 1 : "",
  200. g: $data.tabFlag == "phone" ? 1 : "",
  201. h: $data.tabFlag == "order" ? 1 : "",
  202. i: $data.tabFlag == "phone" ? 1 : "",
  203. j: common_vendor.o(($event) => $options.tabClick(2)),
  204. k: common_vendor.o(($event) => $data.phone = $event),
  205. l: common_vendor.p({
  206. trim: "all",
  207. placeholder: "请输入手机号",
  208. ["placeholder-style"]: "font-size:28rpx",
  209. modelValue: $data.phone
  210. }),
  211. m: common_vendor.t($data.sendCodeFlag),
  212. n: common_vendor.o(($event) => $options.sendCode()),
  213. o: common_vendor.o(common_vendor.m(($event) => $data.code = $event, {
  214. number: true
  215. }, true)),
  216. p: common_vendor.p({
  217. placeholder: "请输入验证码",
  218. ["placeholder-style"]: "font-size:28rpx",
  219. modelValue: $data.code
  220. }),
  221. q: common_vendor.o(($event) => $options.immediateQuery(1)),
  222. r: $data.tabFlag == "phone",
  223. s: common_vendor.o(($event) => $data.orderNo = $event),
  224. t: common_vendor.p({
  225. trim: "all",
  226. placeholder: "请输入订单号号",
  227. ["placeholder-style"]: "font-size:28rpx",
  228. modelValue: $data.orderNo
  229. }),
  230. v: common_vendor.o((...args) => $options.dialogToggle && $options.dialogToggle(...args)),
  231. w: common_vendor.o(($event) => $options.immediateQuery(2)),
  232. x: $data.tabFlag == "order",
  233. y: common_vendor.f($data.historyList, (item, index, i0) => {
  234. return {
  235. a: common_vendor.t(item.title),
  236. b: common_vendor.t(item.orderNo),
  237. c: common_vendor.t(item.orderStatus),
  238. d: common_vendor.o(($event) => $options.goResult(item.resultId)),
  239. e: index
  240. };
  241. }),
  242. z: common_vendor.p({
  243. status: $data.status
  244. }),
  245. A: common_vendor.o(_ctx.dialogConfirm),
  246. B: common_vendor.o(_ctx.dialogClose),
  247. C: common_vendor.p({
  248. type: _ctx.msgType,
  249. confirmText: "确定",
  250. title: "提示"
  251. }),
  252. D: common_vendor.sr("alertDialog", "c0552341-4"),
  253. E: common_vendor.p({
  254. type: "dialog"
  255. })
  256. };
  257. }
  258. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c0552341"], ["__file", "E:/psy_web_share/paymentPage/queryByPhone/index.vue"]]);
  259. tt.createPage(MiniProgramPage);