index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="refund-wrapper" :style="viewColor">
  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. // +----------------------------------------------------------------------
  22. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  23. // +----------------------------------------------------------------------
  24. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  25. // +----------------------------------------------------------------------
  26. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  27. // +----------------------------------------------------------------------
  28. // | Author: CRMEB Team <admin@crmeb.com>
  29. // +----------------------------------------------------------------------
  30. import { refundBatch } from '@/api/order.js'
  31. import { mapGetters } from "vuex";
  32. export default{
  33. computed: mapGetters(['viewColor']),
  34. data(){
  35. return {
  36. // 订单id
  37. order_id:'',
  38. // 退款退货类型
  39. refund_type:2,
  40. //单个还是多个
  41. type:2,
  42. orderDetail:[],
  43. activeId:[]
  44. }
  45. },
  46. onLoad(options) {
  47. this.order_id = options.order_id
  48. this.refund_type = options.refund_type
  49. this.type = options.type
  50. this.getList()
  51. },
  52. methods:{
  53. // 获取退款列表
  54. getList(){
  55. refundBatch(this.order_id).then(({data})=>{
  56. data.forEach(el=>{
  57. el.check = false
  58. })
  59. this.orderDetail = data
  60. }).catch(error=>{
  61. this.$util.Tips({
  62. title:error
  63. },{
  64. tab:3
  65. })
  66. })
  67. },
  68. // 是否选中
  69. bindCheck(item){
  70. item.check = !item.check
  71. this.arrFilter()
  72. },
  73. // 筛选
  74. arrFilter(){
  75. let tempArr = this.orderDetail.filter(el=>{
  76. return el.check == true
  77. })
  78. this.activeId = []
  79. tempArr.map(item =>{
  80. this.activeId.push(item.order_product_id)
  81. })
  82. },
  83. // 确认
  84. confirm(){
  85. if(this.activeId.length == 0){
  86. uni.showToast({
  87. title:'请选择商品',
  88. icon:'none'
  89. })
  90. }else{
  91. uni.redirectTo({
  92. url:'/pages/users/refund/confirm?ids='+this.activeId.join(',')+'&refund_type='+this.refund_type+'&type='+this.type+'&order_id='+this.order_id
  93. })
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .refund-wrapper{
  101. background-color: #fff;
  102. padding-bottom: 150rpx;
  103. .item{
  104. position: relative;
  105. display: flex;
  106. padding: 25rpx 30rpx;
  107. &:after{
  108. content: ' ';
  109. position: absolute;
  110. right: 0;
  111. bottom: 0;
  112. width: 657rpx;
  113. height: 1px;
  114. background: #F0F0F0;
  115. }
  116. .img-box{
  117. width: 130rpx;
  118. height: 130rpx;
  119. image{
  120. width: 130rpx;
  121. height: 130rpx;
  122. border-radius:16rpx;
  123. }
  124. }
  125. .info{
  126. display: flex;
  127. flex-direction: column;
  128. justify-content: space-between;
  129. width: 500rpx;
  130. margin-left: 26rpx;
  131. .tips{
  132. color: #868686;
  133. font-size: 20rpx;
  134. }
  135. .price{
  136. font-size: 26rpx;
  137. }
  138. }
  139. .check-box{
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. flex: 1;
  144. .iconfont{
  145. font-size: 40rpx;
  146. color: #CCCCCC;
  147. }
  148. .icon-xuanzhong1{
  149. color: var(--view-theme);
  150. }
  151. }
  152. }
  153. .btn-box{
  154. position: fixed;
  155. left: 50%;
  156. bottom: 60rpx;
  157. width:690rpx;
  158. height:86rpx;
  159. transform: translateX(-50%);
  160. line-height: 86rpx;
  161. text-align: center;
  162. color: #fff;
  163. background: var(--view-theme);
  164. border-radius:43rpx;
  165. font-size: 32rpx;
  166. }
  167. }
  168. </style>