add.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view style="padding: 20rpx;font-size: 30rpx;">
  3. <view class="tit">类型</view>
  4. <view style="background: #fff;border-radius: 10rpx;height:60rpx;">
  5. <picker @change="bindPickerChange" :value="index" :range="array">
  6. <view class="uni-input" style="color: #000;line-height: 60rpx;padding-left: 20rpx;">{{array[index]}}
  7. </view>
  8. </picker>
  9. </view>
  10. <view class="tit" v-if="data.type=='银行卡支付'">开户行</view>
  11. <view style="background: #fff;border-radius: 10rpx;height:60rpx;" v-if="data.type=='银行卡支付'">
  12. <picker @change="bindPickerChange1" :value="khhindex" :range="khh">
  13. <view class="uni-input" style="color: #000;line-height: 60rpx;padding-left: 20rpx;">{{khh[khhindex]}}
  14. </view>
  15. </picker>
  16. </view>
  17. <view class="tit">账户名称</view>
  18. <input class="srk" placeholder="姓名需要和实名信息一致" v-model="data.zhmc" />
  19. <view class="tit" v-if="data.type=='USDT支付'">手机账号</view>
  20. <input class="srk" placeholder="请输入手机号,需要和实名信息一致" v-model="data.sjh" v-if="data.type=='USDT支付'"/>
  21. <view class="tit" v-if="data.type=='银行卡支付' || data.type=='支付宝支付' || data.type=='拍拍宝'">账号</view>
  22. <input class="srk" placeholder="请输入手机号,需要和实名信息一致" v-model="data.skzh" v-if="data.type=='银行卡支付' || data.type=='支付宝支付' || data.type=='拍拍宝'"/>
  23. <view class="tit" v-if="data.type=='银行卡支付'">开户行地址</view>
  24. <input class="srk" placeholder="请输入手机号,需要和实名信息一致" v-model="data.fhh" v-if="data.type=='银行卡支付'"/>
  25. <view class="tit" v-if="data.type=='微信支付'">收款码</view>
  26. <view v-if="data.type=='微信支付'">
  27. <image
  28. v-if="data.skm"
  29. style="width: 150px;height: 150px;"
  30. class="image_4"
  31. referrerpolicy="no-referrer"
  32. :src="data.skm"
  33. @click="uploadimg('payaccountimg')"
  34. />
  35. <image v-else style="width: 150px;height: 150px;" class="image_4" referrerpolicy="no-referrer" src="/static/xj.png" @click="uploadimg('payaccountimg')" />
  36. </view>
  37. <button type="warn" style="margin-top: 40rpx;" @click="add">确认添加</button>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. array: ['拍拍宝','支付宝支付', '微信支付', 'USDT支付', '银行卡支付'],
  45. khh: ['中国银行', '徽商银行', '中信银行', '中国招商银行', '中国建设银行', '中国农业银行', '中国工商银行', '中国交通银行', '中国邮政储蓄银行', '农村信用合作社', '浦发银行', '华夏银行', '宁波银行', '广发银行', '湖州银行', '深圳农村商业银行', '杭州银行','其他银行'],
  46. data: {
  47. 'zhmc': '',
  48. 'sjh': '',
  49. 'skzh':'',
  50. 'khh':'',
  51. 'type':'拍拍宝',
  52. 'skm':'',
  53. 'fhh':''
  54. },
  55. index: 0,
  56. khhindex: 0
  57. }
  58. },
  59. methods: {
  60. bindPickerChange: function(e) {
  61. this.index = e.detail.value
  62. this.data.type=this.array[this.index]
  63. this.data.zhmc='';
  64. this.data.sjh='';
  65. this.data.skzh='';
  66. this.data.khh='';
  67. this.data.skm='';
  68. this.data.fhh='';
  69. if(this.index==3){
  70. this.data.khh='中国银行';
  71. }
  72. },
  73. bindPickerChange1: function(e) {
  74. this.khhindex = e.detail.value
  75. this.data.khh=this.khh[this.khhindex]
  76. this.khhindex = e.detail.value
  77. },
  78. sklist() {
  79. var data = new Object();
  80. data.uid = this.userinfo.id;
  81. this.$api
  82. .MhGetModel(data, 'user/sklist')
  83. .then(res => {
  84. this.goodlist = res.data.data;
  85. })
  86. .catch(err => {
  87. // console.log('request fail', JSON.stringify(err));
  88. });
  89. },
  90. add() {
  91. var data = this.data;
  92. data.uid = this.userinfo.id;
  93. this.$api
  94. .MhGetModel(data, 'user/skadd')
  95. .then(res => {
  96. if (res.data.code != 1) {
  97. uni.showToast({
  98. title: res.data.msg,
  99. icon: 'none'
  100. });
  101. this.getCode();
  102. return;
  103. } else {
  104. uni.showModal({
  105. title: '提示',
  106. content: res.data.msg,
  107. showCancel:false,
  108. success: function (res) {
  109. if (res.confirm) {
  110. uni.navigateBack({
  111. delta: 1
  112. });
  113. } else if (res.cancel) {
  114. console.log('用户点击取消');
  115. }
  116. }
  117. });
  118. uni.showToast({
  119. title: res.data.msg,
  120. icon: 'none'
  121. });
  122. }
  123. })
  124. .catch(err => {
  125. // console.log('request fail', JSON.stringify(err));
  126. });
  127. // console.log(333)
  128. },
  129. uploadimg(id) {
  130. var that = this;
  131. uni.chooseImage({
  132. count: 1, //默认9
  133. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  134. sourceType: ['album'], //从相册选择
  135. success: function(res) {
  136. // console.log(JSON.stringify(res.tempFilePaths));
  137. uni.uploadFile({
  138. url: that.$api.getUploadurl2,
  139. filePath: res.tempFilePaths[0],
  140. name: 'file',
  141. success: function(res) {
  142. var img=JSON.parse(res.data);
  143. that.data.skm = img.data.url;
  144. }
  145. });
  146. }
  147. });
  148. }
  149. },
  150. onLoad() {
  151. var user = this.$api.getUserinfo();
  152. this.userinfo = user;
  153. }
  154. }
  155. </script>
  156. <style>
  157. page {
  158. padding: 15rpx;
  159. background: #98a737;
  160. background-attachment: fixed !important;
  161. background-repeat: no-repeat !important;
  162. }
  163. .srk {
  164. color: #000;
  165. height: 60rpx;
  166. line-height: 60rpx;
  167. background: #fff;
  168. border-radius: 10rpx;
  169. padding-left: 20rpx;
  170. font-size: 30rpx;
  171. }
  172. .tit {
  173. color: #fff;
  174. height: 60rpx;
  175. line-height: 60rpx;
  176. margin-top: 10rpx;
  177. }
  178. </style>