index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <u-popup :show="popupShow" bgColor="transparent" :safeAreaInsetBottom="false" @close="close">
  3. <view class="popBox">
  4. <view class="popBox_title">{{title}}</view>
  5. <view class="popBox_list">
  6. <view class="popBox_item" v-for="(v,i) in reasonList" :key="i" @click="activeReason(v)">
  7. <view class="popBox_item_l" :class="{active:v.dictValue==refundReason}"></view>
  8. <view class="popBox_item_r">{{v.dictLabel}}</view>
  9. </view>
  10. </view>
  11. <view class="popBox_btn">
  12. <view class="popBox_btn_l" @click="affirm()">确认</view>
  13. <view class="popBox_btn_r" @click="close">取消</view>
  14. </view>
  15. </view>
  16. </u-popup>
  17. </template>
  18. <script>
  19. import { dictData } from "@/api/home.js"
  20. export default {
  21. data () {
  22. return {
  23. popupShow: false,
  24. reasonList: [],
  25. refundReason: ""
  26. }
  27. },
  28. props: {
  29. title: {
  30. type: String,
  31. default: "请选择退款原因"
  32. }
  33. },
  34. mounted () {
  35. this.getReasonList()
  36. },
  37. methods: {
  38. open () {
  39. this.popupShow = true
  40. },
  41. close () {
  42. this.popupShow = false;
  43. this.refundReason = ""
  44. },
  45. activeReason (item) {
  46. this.refundReason = item.dictValue
  47. },
  48. affirm () {
  49. if (!this.refundReason) {
  50. uni.$u.toast('请选择原因!');
  51. return
  52. }
  53. this.$emit("submit", this.refundReason)
  54. this.close()
  55. },
  56. // 获取退款原因列表
  57. getReasonList () {
  58. dictData('reason_refund').then(res => {
  59. this.reasonList = res.data;
  60. })
  61. },
  62. },
  63. }
  64. </script>
  65. <style lang='scss' scoped>
  66. .popBox {
  67. background: #ffffff;
  68. border-radius: 40rpx 40rpx 0rpx 0rpx;
  69. padding-top: 40rpx;
  70. .popBox_title {
  71. font-size: 40rpx;
  72. color: #1a1a1a;
  73. text-align: center;
  74. }
  75. .popBox_list {
  76. padding: 60rpx 30rpx 0;
  77. max-height: 50vh;
  78. overflow-y: scroll;
  79. .popBox_item {
  80. display: flex;
  81. align-items: center;
  82. margin-bottom: 30rpx;
  83. .popBox_item_l {
  84. width: 32rpx;
  85. height: 32rpx;
  86. background: #ffffff;
  87. border: 1rpx solid #b3b3b3;
  88. border-radius: 50%;
  89. margin-right: 10rpx;
  90. }
  91. .active {
  92. border: 1px solid #0099ff;
  93. position: relative;
  94. &::after {
  95. content: "";
  96. width: 14rpx;
  97. height: 14rpx;
  98. background: #0099ff;
  99. border-radius: 50%;
  100. position: absolute;
  101. top: 10rpx;
  102. left: 10rpx;
  103. }
  104. }
  105. .popBox_item_r {
  106. font-size: 28rpx;
  107. color: #808080;
  108. }
  109. }
  110. }
  111. .popBox_btn {
  112. display: flex;
  113. justify-content: space-between;
  114. padding: 40rpx 30rpx 100rpx;
  115. > view {
  116. width: 331rpx;
  117. height: 80rpx;
  118. border-radius: 40rpx;
  119. text-align: center;
  120. line-height: 80rpx;
  121. }
  122. .popBox_btn_l {
  123. background: #fb0b03;
  124. color: #ffffff;
  125. }
  126. .popBox_btn_r {
  127. border: 1rpx solid #fb0b03;
  128. background: #ffffff;
  129. color: #fb0b03;
  130. }
  131. }
  132. }
  133. </style>