forget.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. var content = {
  2. 'cn':{
  3. item1:'订单',
  4. btn:'订单确定',
  5. btn1:'订单取消',
  6. serial:'订单号:',
  7. merchantSerial:'商户流水号:',
  8. amount:'金额:',
  9. cny:"人民币:",
  10. UserName: "户名:",
  11. BankName: "银行名称:",
  12. BankCardNum: "银行卡号:",
  13. bankBranchName: "开户支行名称:",
  14. BankAddr: "支行地址:",
  15. SwiftCode: "Swift Code:",
  16. BankCode: "银行Code:",
  17. expireTime: "过期时间:",
  18. success:'成功',
  19. timeout:'订单已过期!',
  20. orderTip:'找不到该订单或订单已过期!',
  21. },
  22. 'en':{
  23. item1:'Order',
  24. btn:'Order Confirmation',
  25. btn1:'Order Cancellation',
  26. serial:'Serial:',
  27. merchantSerial:'Merchant Serial:',
  28. amount:'Amount:',
  29. cny:"CNY:",
  30. UserName: "User Name:",
  31. BankName: "Bank Name:",
  32. BankCardNum: "Bank Card Number:",
  33. bankBranchName: "Bank Branch Name:",
  34. BankAddr: "Bank Addr:",
  35. SwiftCode: "Swift Code:",
  36. BankCode: "Bank Code:",
  37. expireTime: "ExpireTime:",
  38. success:'success',
  39. timeout:'订单已过期!',
  40. orderTip:'找不到该订单或订单已过期!',
  41. }
  42. };
  43. let config = {
  44. Pattern: {
  45. Password: /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\\(\\)#_]).*\\1.*\\1.*\\1)[A-Za-z0-9~!@&%$^\\(\\)#_]{8,16}$/,
  46. }
  47. };
  48. let vm = new Vue({
  49. el: "#forget",
  50. data(){
  51. return{
  52. ho:'',
  53. //多语言
  54. langList: {
  55. en: "ENGLISH",
  56. cn: "中文简体"
  57. },
  58. language: "cn",
  59. lang:{},
  60. flag:false,
  61. serial:'',
  62. pictLoading:false,
  63. params: {
  64. amount: "",
  65. bankAddr:'',
  66. bankBranchName:'',
  67. bankCardNum:'',
  68. bankCode:'',
  69. bankName:'',
  70. bankUname:'',
  71. cny:'',
  72. expireTime:'',
  73. merchantSerial:'',
  74. pickupUrl:'',
  75. serial:'',
  76. swiftCode:'',
  77. payType:'ALIPAY',
  78. alipayUrl:'',
  79. payMsg:'',
  80. },
  81. time:'',
  82. timer:null,
  83. timeStatus:0,
  84. rules: {
  85. }
  86. }
  87. },
  88. computed: {
  89. },
  90. methods: {
  91. // 语言切换函数
  92. chooseLang (key) {
  93. this.lang = content[key];
  94. this.language = key;
  95. },
  96. // 复制分享链接
  97. CopyShareLink (val) {
  98. // 模拟 输入框
  99. var cInput = document.createElement("input");
  100. cInput.value = val;
  101. document.body.appendChild(cInput);
  102. cInput.select(); // 选取文本框内容
  103. // 执行浏览器复制命令
  104. // 复制命令会将当前选中的内容复制到剪切板中(这里就是创建的input标签)
  105. // Input要在正常的编辑状态下原生复制方法才会生效
  106. document.execCommand("copy");
  107. this.$message({
  108. type: "success",
  109. message: "复制成功"
  110. });
  111. // 复制成功后再将构造的标签 移除
  112. document.body.removeChild(cInput);
  113. },
  114. // 发送
  115. send: async function () {
  116. this.pictLoading = true;
  117. axios.get(this.ho + '/pay/order/get?serial=' + this.serial, {
  118. //参数
  119. }).then(res => {//请求成功后的处理函数
  120. if (res.data.code == 200) {
  121. this.$message({
  122. message: this.lang.success,
  123. type: 'success'
  124. });
  125. this.params = res.data.data;
  126. } else {
  127. // 过期或者单号不对前端来提示不用后端的字段
  128. // this.$message.error(res.data.msg);
  129. this.$message.error(this.lang['orderTip']);
  130. }
  131. this.timer = setInterval(() => {this.getDate()}, 1000);
  132. }).catch(err => {
  133. //请求失败后的处理函数
  134. })
  135. setTimeout(() => {
  136. this.pictLoading = false;
  137. }, 1000);
  138. },
  139. confirm: async function (val) {
  140. if (this.flag) {
  141. return
  142. } else {
  143. this.flag = true;
  144. }
  145. axios.post(this.ho + '/pay/order/submit', {
  146. serial:this.params.serial,
  147. customStatus:val,
  148. //参数
  149. }).then(res => {//请求成功后的处理函数
  150. if (res.data.code == 200) {
  151. this.$message({
  152. message: this.lang.success,
  153. type: 'success'
  154. });
  155. setTimeout(() => {
  156. window.location.href = this.params.pickupUrl
  157. }, 2000);
  158. } else {
  159. this.$message.error(res.data.msg);
  160. }
  161. this.flag = false;
  162. }).catch(err => { //请求失败后的处理函数
  163. })
  164. },
  165. //时间
  166. getDate () {
  167. var newyear=new Date(this.params.expireTime.replace(/-/g,"/"));
  168. var date1=new Date();
  169. var now=newyear-date1;
  170. let mm = 0, ss = 0;
  171. if( now > 0 ) {
  172. mm = Math.floor( now/1000/60%60 );
  173. ss = Math.floor( now/1000%60 );
  174. this.timeStatus = 1;
  175. } else {
  176. this.timeStatus = 2;
  177. clearInterval(this.timer)
  178. }
  179. let clock;
  180. if (mm < 10) {
  181. mm = "0" + mm;
  182. }
  183. if (ss < 10) {
  184. ss = "0" + ss;
  185. }
  186. clock = mm + ":" + ss;
  187. this.time = clock;
  188. },
  189. },
  190. mounted() {
  191. this.ho ='http://192.168.0.21:15233';
  192. // this.ho = window.location.origin;
  193. // this.params.token = window.location.search.split('?token=')[1];
  194. this.serial = window.location.search.split('?serial=')[1];
  195. this.lang = content['cn'];
  196. this.send();
  197. },
  198. destroyed() {
  199. clearInterval(this.timer)
  200. }
  201. });