index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="">
  3. <view class="h-content">
  4. <u--form
  5. labelPosition="left"
  6. :model="reqParm"
  7. ref="form1"
  8. >
  9. <u-form-item
  10. labelWidth="auto"
  11. labelAlign="right"
  12. prop="tradPassword"
  13. borderBottom
  14. >
  15. <u--input
  16. v-model="reqParm.tradPassword"
  17. disabledColor="#ffffff"
  18. placeholder="请输入交易密码"
  19. border="bottom"
  20. type="password"
  21. maxlength="6"
  22. ></u--input>
  23. </u-form-item>
  24. <u--textarea v-model="reqParm.refundReason" placeholder="请在此处输入退款原因" ></u--textarea>
  25. </u--form>
  26. <view @click="submitData" class="op-btn">
  27. <text>提交</text>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. order:{},
  37. reqParm: {
  38. auth: true,
  39. orderNo: null,
  40. tradPassword: '',
  41. refundReason: ''
  42. },
  43. rules: {
  44. tradPassword: {
  45. required: true,
  46. min: 6,
  47. max: 6,
  48. message: '请输入6位密码',
  49. trigger: ['blur', 'change'],
  50. }
  51. },
  52. };
  53. },
  54. onLoad(option) {
  55. // 判断Openid是否为空
  56. this.order = JSON.parse(option.data)
  57. this.reqParm.orderNo = this.order.orderNo;
  58. },
  59. onReady() {
  60. this.$refs.form1.setRules(this.rules)
  61. },
  62. methods: {
  63. submitData() {
  64. let that = this;
  65. // 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true
  66. this.$refs.form1.validate().then(res => {
  67. that.orderRechargeRefund();
  68. }).catch(errors => {
  69. uni.$u.toast('校验失败,请认真填写')
  70. })
  71. },
  72. // 退款
  73. orderRechargeRefund(){
  74. this.$api.orderRechargeRefund(this.reqParm).then((res)=>{
  75. uni.showToast({
  76. title: '已提交申请,请耐心等待'
  77. })
  78. uni.navigateTo({
  79. url: '/myPages/rechargeRecord/index'
  80. });
  81. }).catch((err) =>{
  82. uni.showToast({
  83. title: err.msg
  84. })
  85. });
  86. },
  87. }
  88. };
  89. </script>
  90. <style lang="scss" scoped>
  91. .h-content{
  92. // margin-top: 100px;
  93. background: #fff;
  94. padding-left: 12px;
  95. padding-right: 12px;
  96. padding-bottom: 100px;
  97. .op-btn{
  98. margin: 0 auto;
  99. margin-top: 20px;
  100. text-align: center;
  101. line-height: 42px;
  102. width: 343px;
  103. height: 42px;
  104. background: #FFE05C;
  105. border-radius: 27px;
  106. }
  107. }
  108. </style>