cancellationOfAccount.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view style="margin:0 40upx;" >
  3. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff" :background="background" title-width="300" :title="i18n('Cancellation')"></u-navbar>
  4. <view class="" v-if="!accountIndex">
  5. <view class="ancellation">
  6. {{i18n('ProtectTheSecurity')}}
  7. </view>
  8. <view class="ancellation">
  9. {{i18n('AccountFinance')}}
  10. </view>
  11. <view class="ancellation">
  12. {{i18n('UnlockAccount')}}
  13. </view>
  14. <view class="ancellation">
  15. {{i18n('Theaccounthas')}}
  16. </view>
  17. <view class="ancellation2">
  18. <u-checkbox-group>
  19. <u-checkbox @change="radioChange" v-model="checked" style="vertical-align: top;" label-disabled="false">
  20. </u-checkbox>
  21. <text class="content">{{$i18n.locale=='zh'?'我已阅读并同意':'I have read and agree'}}</text>
  22. <!-- 协议地址 -->
  23. <span @click="toView('userAgreement')">
  24. {{$i18n.locale=='zh'?'《平台用户协议》':'《Platform User Agreement》'}}
  25. </span>
  26. <span @click="toView('privacyPolicy')">
  27. {{$i18n.locale=='zh'?'《隐私政策》':'《Privacy Policy》'}}
  28. </span>
  29. </u-checkbox-group>
  30. </view>
  31. <view class="ancellation">
  32. <button type="primary" :disabled="checked == false" @click="accountIndex = true">{{i18n('TheNextStep')}}</button>
  33. </view>
  34. </view>
  35. <view class="" v-else>
  36. <view class="input-code">{{i18n('EnterYourLoginPassword')}}</view>
  37. <view class="Unbundling-input">
  38. <input class="uni-input" type="password" @input="onKeyInput" :value="passwordValue" :placeholder="i18n('PleaseEnterYourLoginPassword')"/>
  39. </view>
  40. <button type="primary" style="margin-top: 50upx;" @click="submitCncel">{{i18n('submit')}}</button>
  41. <u-toast ref="uToast" />
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import listCell from '@/components/JumpBox';
  47. export default {
  48. components: {
  49. listCell
  50. },
  51. data() {
  52. return {
  53. accountIndex:false,
  54. current:null,
  55. second:60,
  56. showText:true,
  57. background: {
  58. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  59. },
  60. backStyle: {
  61. color: '#FFFFFF',
  62. },
  63. checked:false,
  64. passwordValue:'',
  65. token:'',
  66. // 8.8.20.112:19001
  67. navigate1: this.$i18n.locale == 'zh' ? 'https://m.geidcp.com:19001/#/pages/profile/profileSetUp/appUser/userAgreementZH' :
  68. 'https://m.geidcp.com/#/pages/profile/profileSetUp/appUser/userAgreementEN',
  69. navigate2: this.$i18n.locale == 'zh' ? 'https://m.geidcp.com:19001/#/pages/profile/profileSetUp/appUser/privacyPolicyZH' :
  70. 'https://m.geidcp.com/#/pages/profile/profileSetUp/appUser/privacyPolicyEN',
  71. };
  72. },
  73. onShow(){
  74. this.token = uni.getStorageSync('Auth-Token');
  75. },
  76. methods:{
  77. radioChange(evt) {
  78. console.log(evt)
  79. this.checked = evt.value;
  80. },
  81. navTo(route) {
  82. this.$mRouter.push({ route });
  83. },
  84. getCodeFor(){
  85. this.showText = false
  86. let interval = setInterval(() => {
  87. let times = --this.second
  88. // this.second = times<10?'0'+times:times //小于10秒补 0
  89. }, 1000)
  90. setTimeout(() => {
  91. clearInterval(interval)
  92. this.second=60
  93. this.showText = true
  94. }, 60000)
  95. },
  96. i18n(data) {
  97. return this.$t('common.' + data);
  98. },
  99. onKeyInput(val){
  100. this.passwordValue = val.target.value
  101. },
  102. //验证密码方法
  103. async submitCncel(){
  104. if (this.passwordValue == "" || this.passwordValue == null) {
  105. this.$refs.uToast.show({
  106. title: this.$i18n.locale == 'zh' ? '密码不能为空!' : 'The password cannot be empty!',
  107. type: "warning",
  108. })
  109. }else{
  110. let userInfo = JSON.parse(uni.getStorageSync('user'));
  111. let param = JSON.stringify({
  112. id: userInfo.umsUser.id,
  113. password: this.passwordValue,
  114. Authorization: this.token
  115. });
  116. const res = await this.$myRequest({
  117. url: '/ums/umsUsers/checkPassword',
  118. headers: {
  119. ANON: true
  120. },
  121. data: {
  122. param
  123. },
  124. method: 'post'
  125. });
  126. if(res && res.status === "200"){
  127. this.$refs.uToast.show({
  128. title: this.$i18n.locale == 'zh' ? '密码验证成功!' : 'Password verification succeeded!',
  129. type: "success",
  130. })
  131. await this.cancellationTo()
  132. }else{
  133. this.$refs.uToast.show({
  134. title: this.$i18n.locale == 'zh' ? '验证失败,请重新核实密码!' : 'Validation fails,Please verify your password again!',
  135. type: "warning",
  136. })
  137. }
  138. }
  139. },
  140. //注销账户方法
  141. async cancellationTo(){
  142. let token = this.token
  143. this.resetToken();
  144. // 接口逻辑
  145. const res = await this.$myRequest({
  146. url: '/uc/umsUserCancellations/cancellationUmsUser',
  147. headers: {
  148. token
  149. },
  150. data: {
  151. token
  152. },
  153. method: 'post'
  154. });
  155. if(res && res.status == "200"){
  156. this.$refs.uToast.show({
  157. title: this.$i18n.locale == 'zh' ? '账户注销成功!' : 'Account logout succeeded!',
  158. type: "success",
  159. })
  160. this.passwordValue = ""
  161. setTimeout(() => {
  162. this.navTo('/pages/public/login');
  163. }, 2000);
  164. }else{
  165. this.$refs.uToast.show({
  166. title: this.$i18n.locale == 'zh' ? '账户注销失败,请稍后再试!' : 'Account logout succeeded, Please try again later!',
  167. type: "success",
  168. })
  169. }
  170. },
  171. resetToken() {
  172. this.token = "";
  173. },
  174. toView(value) {
  175. if(this.$i18n.locale == 'zh'){
  176. uni.navigateTo({
  177. url: '/pages/profile/profileSetUp/appUser/'+value +'ZH'
  178. })
  179. }else{
  180. uni.navigateTo({
  181. url: '/pages/profile/profileSetUp/appUser/'+value +'EN'
  182. })
  183. }
  184. },
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. page,body.pages-profile-profileSetUp-setUp uni-page-body {
  190. background-color: #fff !important;
  191. .ancellation {
  192. margin-top: 50upx;
  193. }
  194. .ancellation2 {
  195. margin-top: 80upx;
  196. /deep/.uni-radio-input{
  197. width: 26upx!important;
  198. height: 26upx!important;
  199. }
  200. }
  201. .input-code {
  202. color: #666;
  203. font-size: 36upx;
  204. font-weight: 600;
  205. margin-top: 50upx;
  206. line-height: 100upx;
  207. }
  208. .Unbundling-input {
  209. margin-top: 30upx;
  210. .uni-input {
  211. display: inline-block;
  212. font-size: 30upx;
  213. line-height: 90upx;
  214. height: 90upx;
  215. min-height: 90upx;
  216. overflow: hidden;
  217. border: 1px solid #ccc;
  218. vertical-align: middle;
  219. text-indent: 2em;
  220. text-align: left !important;
  221. padding: 0 20upx;
  222. border-radius: 20upx;
  223. width: 100%;
  224. }
  225. .getCode {
  226. margin-left: 20upx;
  227. color: #0000ff;
  228. }
  229. .send {
  230. margin-left: 20upx;
  231. }
  232. }
  233. }
  234. </style>