forget.js 6.0 KB

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