index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="page flex-col">
  3. <view class="group_1 flex-col">
  4. <!-- <image class="image_1" referrerpolicy="no-referrer" src="/static/lanhu_record/ps8pzn4zlg6msqasg8gjmp6oqt1rhjhx4q7bb20938-5f91-446e-853a-08a4a97e4406.png" /> -->
  5. <!-- <view class="text-wrapper_2 flex-row justify-between">
  6. <text class="text_3">收款方式</text>
  7. <picker class="text_3" @change="bindPickerChange" :value="index" :range="array">
  8. <view class="uni-input">{{ array[index] }}</view>
  9. </picker>
  10. </view> -->
  11. <!-- <image class="image_2" referrerpolicy="no-referrer" src="/static/lanhu_record/pshv0mmbha3hqgycdm25qcsoi99tglg3vvbd334f95-3265-43d9-a16b-5391abaab2b1.png" />
  12. <view class="text-wrapper_2 flex-row justify-between" v-if="index > 1">
  13. <text class="text_3">银行名称</text>
  14. <input class="text_4" style="width: 200px;margin-left: 60px;" placeholder="请输入银行完整名称xx支行" v-model="data.payaccountname" />
  15. </view> -->
  16. <image class="image_2" referrerpolicy="no-referrer" src="/static/lanhu_record/pshv0mmbha3hqgycdm25qcsoi99tglg3vvbd334f95-3265-43d9-a16b-5391abaab2b1.png" />
  17. <view class="text-wrapper_3 flex-row justify-between">
  18. <text class="text_5">支付宝帐号</text>
  19. <input class="text_6" placeholder="请输入收款帐号" v-model="data.payaccount" />
  20. </view>
  21. <image class="image_3" referrerpolicy="no-referrer" src="/static/lanhu_record/ps896c5etqrer2pa5o17g8gdpc1yu3d6c96124b8dc-5877-464b-9baa-6a8454ae2d29.png" />
  22. <view class="box_1 flex-row justify-between">
  23. <text class="text_7">微信收款码</text>
  24. <view class="image-wrapper_1 flex-col" style="background: none;">
  25. <image
  26. v-if="data.payaccountimg"
  27. style="width: 150px;height: 50px;"
  28. class="image_4"
  29. referrerpolicy="no-referrer"
  30. :src="data.payaccountimg"
  31. @click="uploadimg('payaccountimg')"
  32. />
  33. <image v-else style="width: 50px;height: 50px;" class="image_4" referrerpolicy="no-referrer" :src="noimg" @click="uploadimg('payaccountimg')" />
  34. </view>
  35. </view>
  36. <image class="image_5" referrerpolicy="no-referrer" src="/static/lanhu_record/psuqgye8xemeeyyhuy0s00d9cscwkd2dlnpd8d71f8e-26c6-4324-a31c-943b803a1647.png" />
  37. <button class="button_1 flex-col" @click="onClick_1"><text class="text_9">提交保存</text></button>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. constants: {},
  46. noimg: '/static/lanhu_record/ps3lynngrkw77ya7zb5jydv23q6xcffyj53c6fe453-54c4-4078-b021-8c1b292a08c2.png',
  47. data: {
  48. uid: '0',
  49. realname: '',
  50. idcard: '',
  51. idcardimg1: '',
  52. idcardimg2: '',
  53. paytype: '',
  54. payaccountimg: '',
  55. payaccount: '',
  56. payaccountname: ''
  57. },
  58. userinfo: null,
  59. array: ['微信', '支付宝', '银行'],
  60. index: 0
  61. };
  62. },
  63. onShow() {
  64. var user = this.$api.getUserinfo();
  65. if (user) {
  66. this.userinfo = user;
  67. this.data.uid = this.userinfo.id;
  68. this.data.realname = this.userinfo.realname;
  69. this.data.idcard = this.userinfo.idcard;
  70. this.data.idcardimg1 = this.userinfo.idcardimg1;
  71. this.data.idcardimg2 = this.userinfo.idcardimg2;
  72. if(this.userinfo.paytype=="微信"){
  73. this.index = 0;
  74. }else if(this.userinfo.paytype=="支付宝"){
  75. this.index = 1;
  76. }else{
  77. this.index = 2;
  78. this.data.payaccountname=this.userinfo.paytype;
  79. }
  80. this.data.payaccountimg = this.userinfo.weixin;
  81. this.data.payaccount = this.userinfo.zfb;
  82. } else {
  83. this.userinfo = null;
  84. }
  85. },
  86. methods: {
  87. bindPickerChange: function(e) {
  88. // console.log('picker发送选择改变,携带值为', e.detail.value);
  89. this.index = e.detail.value;
  90. if (this.index <= 1) {
  91. this.data.paytype = this.array[this.index];
  92. } else {
  93. this.data.paytype = this.array[this.index];
  94. }
  95. },
  96. onClick_1() {
  97. // data.paytype=this.array[this.index];
  98. // if(this.index>1){
  99. // data.paytype=data.payaccountname;
  100. // }
  101. if (this.data.uid == '0') {
  102. uni.showToast({
  103. title: '请重新登录',
  104. icon: 'none'
  105. });
  106. uni.switchTab({
  107. url: '/pages/my/index'
  108. });
  109. return;
  110. }
  111. var data = new Object();
  112. data.uid=this.data.uid;
  113. data.zfb=this.data.payaccount;
  114. data.weixin=this.data.payaccountimg;
  115. this.$api
  116. .MhPostModel(data, 'user/shoukuan')
  117. .then(res => {
  118. // console.log('user/shoukuan信息', JSON.stringify(res));
  119. if (res.data.code != 1) {
  120. uni.showToast({
  121. title: res.data.msg,
  122. icon: 'none'
  123. });
  124. this.getCode();
  125. return;
  126. } else {
  127. uni.showToast({
  128. title: res.data.msg,
  129. icon: 'none'
  130. });
  131. }
  132. })
  133. .catch(err => {
  134. // console.log('request fail', JSON.stringify(err));
  135. });
  136. },
  137. uploadimg(id) {
  138. var that = this;
  139. uni.chooseImage({
  140. count: 1, //默认9
  141. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  142. sourceType: ['album'], //从相册选择
  143. success: function(res) {
  144. // console.log(JSON.stringify(res.tempFilePaths));
  145. uni.uploadFile({
  146. url: that.$api.getUploadurl2,
  147. filePath: res.tempFilePaths[0],
  148. name: 'file',
  149. success: function(res) {
  150. // console.log(res.data);
  151. var img=JSON.parse(res.data);
  152. // console.log(img.data);
  153. that.data.payaccountimg = img.data.url;
  154. }
  155. });
  156. }
  157. });
  158. }
  159. }
  160. };
  161. </script>
  162. <style lang="css">
  163. @import '../common/common.css';
  164. @import './assets/style/index.rpx.css';
  165. </style>