index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="merchant-details">
  3. <view class="top">
  4. <image class="img" src="../static/images/successTop.png" mode=""></image>
  5. <view class="title">
  6. 恭喜,您的申请已通过!
  7. </view>
  8. </view>
  9. <view class="msg" v-if="mer_id > 0 && resData.login_url">
  10. <view class="url">
  11. <text class="head">登录地址:</text>
  12. <text class="content">{{resData.login_url}}</text>
  13. </view>
  14. <view class="phone">
  15. <view class="">
  16. <text class="head">商户账号:</text>
  17. <text class="content">{{resData.phone}}</text>
  18. </view>
  19. <text class="cope" @click="copyTBL()">复制</text>
  20. </view>
  21. </view>
  22. <view class="btn" v-if="mer_id > 0">
  23. <view class="">
  24. 温馨提示:初始密码以短信的方式已发送至申请商户入驻时的手机号
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. getGoodsDetails
  32. } from '@/api/store.js'
  33. export default {
  34. data() {
  35. return {
  36. mer_id: 0,
  37. resData: {}
  38. }
  39. },
  40. onLoad(e) {
  41. this.mer_id = e.mer_id
  42. if (this.mer_id > 0) {
  43. this.getGoodsDetails(e.mer_i_id)
  44. }
  45. },
  46. methods: {
  47. getGoodsDetails(id) {
  48. getGoodsDetails(id).then(res => {
  49. this.resData = res.data
  50. })
  51. },
  52. copyTBL(url) {
  53. let copeData = `登录地址:${this.resData.login_url} 商户账号:${this.resData.phone}`
  54. // #ifdef MP
  55. uni.setClipboardData({
  56. data: copeData,
  57. success: function() {
  58. uni.showToast({
  59. title: '复制成功',
  60. duration: 1000
  61. });
  62. }
  63. });
  64. // #endif
  65. // #ifdef H5
  66. this.copyText(copeData)
  67. // #endif
  68. },
  69. //H5复制方法
  70. webCopy(e) {
  71. let transfer = document.createElement('input');
  72. document.body.appendChild(transfer);
  73. transfer.value = e; // 这里表示想要复制的内容
  74. transfer.focus();
  75. transfer.select();
  76. if (document.execCommand('copy')) {
  77. document.execCommand('copy');
  78. }
  79. transfer.blur();
  80. this.$util.Tips({
  81. title: '复制成功'
  82. });
  83. transfer.style.display = 'none'
  84. document.body.removeChild(transfer);
  85. },
  86. // 兼容版一键复制
  87. copyText(text) {
  88. // 需要转化成字符串
  89. const textString = text.toString();
  90. let input = document.querySelector('#copy-input');
  91. if (!input) {
  92. input = document.createElement('input');
  93. input.id = "copy-input";
  94. input.readOnly = "readOnly"; // 防止ios聚焦触发键盘事件
  95. input.style.position = "absolute";
  96. input.style.left = "-1000px";
  97. input.style.zIndex = "-1000";
  98. document.body.appendChild(input)
  99. }
  100. input.value = textString;
  101. // ios必须先选中文字且不支持 input.select();
  102. selectText(input, 0, textString.length);
  103. if (document.execCommand('copy')) {
  104. document.execCommand('copy');
  105. this.$util.Tips({
  106. title: '复制成功'
  107. });
  108. }
  109. input.blur();
  110. // input自带的select()方法在苹果端无法进行选择
  111. // 选择文本。createTextRange(setSelectionRange)是input方法
  112. function selectText(textbox, startIndex, stopIndex) {
  113. if (textbox.createTextRange) { //ie
  114. const range = textbox.createTextRange();
  115. range.collapse(true);
  116. range.moveStart('character', startIndex); //起始光标
  117. range.moveEnd('character', stopIndex - startIndex); //结束光标
  118. range.select(); //不兼容苹果
  119. } else { //firefox/chrome
  120. textbox.setSelectionRange(startIndex, stopIndex);
  121. textbox.focus();
  122. }
  123. }
  124. }
  125. },
  126. }
  127. </script>
  128. <style lang="scss" scoped>
  129. .merchant-details {
  130. display: flex;
  131. flex-direction: column;
  132. align-items: center;
  133. background-color: #fff;
  134. height: 100vh;
  135. position: relative;
  136. .top {
  137. display: flex;
  138. flex-direction: column;
  139. align-items: center;
  140. .img {
  141. width: 340rpx;
  142. height: 280rpx;
  143. margin: 140rpx 0 30rpx 0;
  144. }
  145. .title {
  146. font-size: 32rpx;
  147. font-weight: bold;
  148. color: #333;
  149. }
  150. }
  151. .msg {
  152. width: 85%;
  153. padding: 30rpx;
  154. height: 150rpx;
  155. margin: 70rpx 70rpx;
  156. background-color: #F6F6F6;
  157. border-radius: 8rpx;
  158. .url {
  159. display: flex;
  160. flex-wrap: nowrap;
  161. margin-bottom: 20rpx;
  162. }
  163. .phone {
  164. display: flex;
  165. justify-content: space-between;
  166. }
  167. .head {
  168. color: #333333;
  169. font-size: 28rpx;
  170. font-weight: 500;
  171. white-space: nowrap;
  172. }
  173. .content {
  174. color: #999999;
  175. font-size: 26rpx;
  176. }
  177. .cope {
  178. padding: 5rpx 16rpx;
  179. color: #FFFFFF;
  180. border-radius: 30rpx;
  181. background-color: #999999;
  182. margin-left: 40rpx;
  183. font-size: 20rpx;
  184. }
  185. }
  186. .btn {
  187. width: 70%;
  188. position: absolute;
  189. text-align: center;
  190. color: #999999;
  191. font-size: 24rpx;
  192. bottom: 80rpx
  193. }
  194. }
  195. </style>