index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="refund-wrapper">
  3. <view class="item" v-for="item in orderDetail">
  4. <view class="img-box">
  5. <image :src="item.cart_info.product.image"></image>
  6. </view>
  7. <view class="info">
  8. <view class="name line1">{{item.cart_info.product.store_name}}</view>
  9. <view class="tips">{{item.cart_info.productAttr.sku}}</view>
  10. <view class="price">¥{{item.cart_info.productAttr.price}} ×{{item.refund_num}}</view>
  11. </view>
  12. <view class="check-box" @click="bindCheck(item)">
  13. <view v-if="item.check" class="iconfont icon-xuanzhong1"></view>
  14. <view v-else class="iconfont icon-weixuanzhong"></view>
  15. </view>
  16. </view>
  17. <view class="btn-box" @click="confirm">申请退款</view>
  18. </view>
  19. </template>
  20. <script>
  21. import { refundBatch } from '@/api/order.js'
  22. export default{
  23. data(){
  24. return {
  25. // 订单id
  26. order_id:'',
  27. // 退款退货类型
  28. refund_type:2,
  29. //单个还是多个
  30. type:2,
  31. orderDetail:[],
  32. activeId:[]
  33. }
  34. },
  35. onLoad(options) {
  36. this.order_id = options.order_id
  37. this.refund_type = options.refund_type
  38. this.type = options.type
  39. this.getList()
  40. },
  41. methods:{
  42. // 获取退款列表
  43. getList(){
  44. refundBatch(this.order_id).then(({data})=>{
  45. data.forEach(el=>{
  46. el.check = false
  47. })
  48. this.orderDetail = data
  49. }).catch(error=>{
  50. this.$util.Tips({
  51. title:error
  52. },{
  53. tab:3
  54. })
  55. })
  56. },
  57. // 是否选中
  58. bindCheck(item){
  59. item.check = !item.check
  60. this.arrFilter()
  61. },
  62. // 筛选
  63. arrFilter(){
  64. let tempArr = this.orderDetail.filter(el=>{
  65. return el.check == true
  66. })
  67. this.activeId = []
  68. tempArr.map(item =>{
  69. this.activeId.push(item.order_product_id)
  70. })
  71. },
  72. // 确认
  73. confirm(){
  74. if(this.activeId.length == 0){
  75. uni.showToast({
  76. title:'请选择商品',
  77. icon:'none'
  78. })
  79. }else{
  80. uni.navigateTo({
  81. url:'/pages/users/refund/confirm?ids='+this.activeId.join(',')+'&refund_type='+this.refund_type+'&type='+this.type+'&order_id='+this.order_id
  82. })
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .refund-wrapper{
  90. background-color: #fff;
  91. .item{
  92. position: relative;
  93. display: flex;
  94. padding: 25rpx 30rpx;
  95. &:after{
  96. content: ' ';
  97. position: absolute;
  98. right: 0;
  99. bottom: 0;
  100. width: 657rpx;
  101. height: 1px;
  102. background: #F0F0F0;
  103. }
  104. .img-box{
  105. width: 130rpx;
  106. height: 130rpx;
  107. image{
  108. width: 130rpx;
  109. height: 130rpx;
  110. border-radius:16rpx;
  111. }
  112. }
  113. .info{
  114. display: flex;
  115. flex-direction: column;
  116. justify-content: space-between;
  117. width: 440rpx;
  118. margin-left: 26rpx;
  119. .tips{
  120. color: #868686;
  121. font-size: 20rpx;
  122. }
  123. .price{
  124. font-size: 26rpx;
  125. }
  126. }
  127. .check-box{
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. flex: 1;
  132. .iconfont{
  133. font-size: 40rpx;
  134. color: #CCCCCC;
  135. }
  136. .icon-xuanzhong1{
  137. color: $theme-color;
  138. }
  139. }
  140. }
  141. .btn-box{
  142. position: fixed;
  143. left: 50%;
  144. bottom: 60rpx;
  145. width:690rpx;
  146. height:86rpx;
  147. transform: translateX(-50%);
  148. line-height: 86rpx;
  149. text-align: center;
  150. color: #fff;
  151. background:$theme-color;
  152. border-radius:43rpx;
  153. font-size: 32rpx;
  154. }
  155. }
  156. </style>