duihuan.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view style="padding: 20rpx;font-size: 30rpx;">
  3. <view class="tit">收件人</view>
  4. <input class="srk" placeholder="请输入收件人" v-model="data.xm" />
  5. <view class="tit">联系电话</view>
  6. <input class="srk" placeholder="请输入联系电话" v-model="data.sjh" />
  7. <view class="tit">收件地址</view>
  8. <input class="srk" placeholder="请输入收件地址" v-model="data.dz" />
  9. <view class="tit">交易密码</view>
  10. <input class="srk" placeholder="请输入交易密码" v-model="data.jymm"/>
  11. <button type="warn" style="margin-top: 40rpx;" @click="add">确认兑换</button>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. data: {
  19. 'id': 0,
  20. 'xm': '',
  21. 'sjh':'',
  22. 'dz':'',
  23. 'jymm':''
  24. }
  25. }
  26. },
  27. methods: {
  28. add() {
  29. var data = this.data;
  30. if(!data.xm || !data.sjh || !data.dz || !data.jymm){
  31. uni.showToast({
  32. title:"请输入完整信息后兑换",
  33. icon:"none"
  34. })
  35. return;
  36. }
  37. data.uid = this.userinfo.id;
  38. this.$api
  39. .MhGetModel(data, 'user/duihuan')
  40. .then(res => {
  41. if (res.data.code != 1) {
  42. uni.showToast({
  43. title: res.data.msg,
  44. icon: 'none'
  45. });
  46. this.getCode();
  47. return;
  48. } else {
  49. uni.showToast({
  50. title: res.data.msg,
  51. icon: 'none'
  52. });
  53. }
  54. })
  55. .catch(err => {
  56. // console.log('request fail', JSON.stringify(err));
  57. });
  58. // console.log(333)
  59. }
  60. },
  61. onLoad(o) {
  62. var user = this.$api.getUserinfo();
  63. this.data.id=o.id
  64. this.userinfo = user;
  65. }
  66. }
  67. </script>
  68. <style>
  69. page {
  70. padding: 15rpx;
  71. background: #98a737;
  72. background-attachment: fixed !important;
  73. background-repeat: no-repeat !important;
  74. }
  75. .srk {
  76. color: #000;
  77. height: 60rpx;
  78. line-height: 60rpx;
  79. background: #fff;
  80. border-radius: 10rpx;
  81. padding-left: 20rpx;
  82. font-size: 30rpx;
  83. }
  84. .tit {
  85. color: #fff;
  86. height: 60rpx;
  87. line-height: 60rpx;
  88. margin-top: 10rpx;
  89. }
  90. </style>