refundList.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="column hb flex-1" >
  3. <view class="searchbox">
  4. <view class="searchbox-bar x-ac">
  5. <view :class="queryParam.type == index ? 'searchbox-item searchbox-active':'searchbox-item'"
  6. v-for="(item,index) in typeOption" :key="index" @click="handleType(index)">{{item.label}}</view>
  7. </view>
  8. <view class="x-ac ss mt20" v-show="queryParam.type == 4">
  9. <view class="calendar-day x-c" @click="showCalendar = true"><u-icon name="calendar" color="#999"
  10. size="20"></u-icon>{{startTime}}</view>
  11. <view class="calendar-day x-c" @click="showCalendar = true"><u-icon name="calendar" color="#999"
  12. size="20"></u-icon>{{endTime}}</view>
  13. </view>
  14. </view>
  15. <view >
  16. <u-calendar :show="showCalendar" :mode="mode" @confirm="confirmCalendar" style="flex: 0; overflow: hidden;"
  17. @close="closeCalendar" :minDate="new Date().getTime()-(3600*1000*24*60)" :maxDate="new Date().getTime()"
  18. ></u-calendar>
  19. </view>
  20. <view class="justify-between p40 align-center">
  21. <view>{{PaymentData.statPeriod}}</view>
  22. <view class='base-color-6 fs24'>
  23. <text class="base-color-dark fs32">{{queryParam.type != 4?'已退款':'拒绝退款'}}{{PaymentData.count}}</text>笔
  24. </view>
  25. <!-- <view>
  26. <view class='fs28 base-color-6'>已退款:
  27. <text class="base-success">¥{{PaymentData.count?PaymentData.count:'0.00'}}</text></view>
  28. </view> -->
  29. </view>
  30. <view class="column scrolly">
  31. <scroll-view :scroll-y="true" class="hb pb40" :refresher-enabled="isEnabled" :refresher-triggered="triggered"
  32. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh"
  33. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  34. @refresherabort="triggered = false" @scrolltolower="reachBottom">
  35. <view class="bgf p40 m4 " v-for="(item,index) in paymentList" :key="index">
  36. <view class="justify-between align-center" @click="tolineDetails(item)">
  37. <!-- <view class="justify-between align-center"> -->
  38. <view>
  39. <view class="fs28 base-color-6 mt4" v-if="item.remark">备注:{{item.remark}}</view>
  40. <view class="fs24 base-color-9">支付时间:{{item.payTime}}</view>
  41. </view>
  42. <view class="column centerV">
  43. <view class="base-success fs40 bold">{{item.payMoney.toFixed(2)}}</view>
  44. <view class="base-price fs24" v-if="item.refundAuditStatus==1">已退款</view>
  45. <view class="orangecol fs24" v-if="item.refundAuditStatus==0" @click="topaymentId(item.paymentId)">待审核</view>
  46. <view class="base-price fs24" v-else-if="item.refundAuditStatus==2">拒绝退款</view>
  47. </view>
  48. <!-- </view> -->
  49. </view>
  50. </view>
  51. <u-loadmore :status="status" />
  52. <view class="pb120" v-if="queryParam.type==1"></view>
  53. </scroll-view>
  54. </view>
  55. <view>
  56. <u-modal :show="showReview" :title="titleReview" :content='contentReview' cancelText='拒绝' confirmText='通过'
  57. :showCancelButton='true' @cancel='toReview(2)' @confirm='toReview(1)'></u-modal>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import {getPendingRefundList,getRefundAuditCount,auditRefund } from '@/api/payment'
  63. export default {
  64. data() {
  65. return {
  66. typeOption: [{
  67. label: '全部',
  68. value: 0
  69. }, {
  70. label: '待审核',
  71. value: 1
  72. }, {
  73. label: '已审核',
  74. value: 2
  75. }, {
  76. label: '已拒绝',
  77. value: 4
  78. }],
  79. queryParam: {
  80. type: 0
  81. },
  82. showCalendar:false,
  83. mode: 'range',
  84. startTime:uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  85. endTime:uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  86. companyId:'',
  87. companyUserId:'',
  88. pageSize:10,
  89. pageNum:1,
  90. triggered: false,
  91. status: 'loadmore',
  92. isEnabled: true,
  93. paymentList:[],
  94. PaymentData:[],
  95. selectedUsers:[],
  96. isSelectAll:false,
  97. titleReview:'审核',
  98. contentReview:'确认退款金额并同意当前订单退款!',
  99. showReview:false,
  100. getpaymentId:null
  101. }
  102. },
  103. onLoad(option) {
  104. this.companyUserId=option.companyUserId
  105. this.companyId=option.companyId
  106. this.getlistDiscount()
  107. this.getPaymentDatas("refresh")
  108. },
  109. methods:{
  110. // 全选
  111. selectAll() {
  112. this.isSelectAll = !this.isSelectAll;
  113. this.selectedUsers = []; // 清空已选列表
  114. // 遍历所有用户项,更新 checked 状态
  115. this.paymentList = this.paymentList.map(group => {
  116. // group = group.map(user => {
  117. if (this.isSelectAll) {
  118. this.selectedUsers.push(group.paymentId); // 添加用户ID到选中列表
  119. }
  120. return {
  121. ...group,
  122. checked: this.isSelectAll,
  123. };
  124. // });
  125. return group;
  126. });
  127. // 如果取消全选,清空 selectedUsers
  128. if (!this.isSelectAll) {
  129. this.selectedUsers = [];
  130. }
  131. },
  132. // 单选 /反选
  133. changeitem(paymentId) {
  134. const index = this.selectedUsers.indexOf(paymentId);
  135. if (index === -1) {
  136. this.selectedUsers.push(paymentId); // 选中
  137. } else {
  138. this.selectedUsers.splice(index, 1); // 取消选中
  139. }
  140. // 更新全选状态
  141. this.isSelectAll = this.selectedUsers.length === this.getTotalUsers();
  142. },
  143. // 计算总用户数
  144. getTotalUsers() {
  145. return this.paymentList.reduce((total, group) => total + group.length, 0);
  146. },
  147. tolineDetails(item){
  148. uni.navigateTo({
  149. url:'/pages_company/order/lineDetails?paymentId='+item.paymentId
  150. })
  151. },
  152. paymentId(id){
  153. this.getpaymentId=id
  154. },
  155. toReview(type){
  156. if(this.queryParam.type!=1){
  157. this.selectedUsers[0]=this.getpaymentId
  158. }else{
  159. }
  160. const data={
  161. paymentId:this.getpaymentId,
  162. refundStatus:type
  163. }
  164. auditRefund(data).then(res=>{
  165. if(res.code==200){
  166. uni.showToast({
  167. icon:'none',
  168. title: '操作成功!',
  169. });
  170. this.showReview=false
  171. this.getlistDiscount('refresh')
  172. }else{
  173. uni.showToast({
  174. icon:'none',
  175. title: res.msg,
  176. });
  177. }
  178. })
  179. },
  180. getPaymentDatas(){
  181. const data={
  182. companyUserId:this.companyUserId,
  183. auditStatus:this.queryParam.type,
  184. // startDate:this.startTime,
  185. // endDate:this.endTime,
  186. companyId:this.companyId,
  187. appId:wx.getAccountInfoSync().miniProgram.appId
  188. }
  189. getRefundAuditCount(data).then(res=>{
  190. if(res.code==200){
  191. this.PaymentData=res.data
  192. }else{
  193. uni.showToast({
  194. icon:'none',
  195. title: res.msg,
  196. });
  197. }
  198. })
  199. },
  200. handleType(type) {
  201. this.queryParam.type = type
  202. // if(this.queryParam.type != 4){
  203. this.pageNum=1
  204. this.paymentList=[]
  205. this.getlistDiscount()
  206. this.getPaymentDatas("refresh")
  207. // }
  208. // if (this.queryParam.type == 4) {
  209. // }
  210. },
  211. confirmCalendar(e) {
  212. this.startTime = e[0]
  213. this.endTime = e[e.length - 1]
  214. this.paymentList=[]
  215. this.getlistDiscount()
  216. this.getPaymentDatas("refresh")
  217. this.showCalendar = false
  218. },
  219. closeCalendar() {
  220. this.showCalendar = false
  221. },
  222. pullDownRefresh() {
  223. // 下拉刷新
  224. this.triggered = true; //下拉了状态为true
  225. setTimeout(() => {
  226. this.triggered = false;
  227. uni.stopPullDownRefresh()
  228. this.pageNum = 1;
  229. this.paymentList=[]
  230. this.getlistDiscount('refresh') //触底 不穿执行else
  231. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  232. // 请求接口
  233. }, 1000)
  234. },
  235. reachBottom() {
  236. // status这个是加载状态
  237. console.log(111);
  238. if (this.status === 'loadmore') {
  239. this.status = 'loading'
  240. uni.showNavigationBarLoading()
  241. setTimeout(() => {
  242. this.pageNum++
  243. this.getlistDiscount() //触底 不穿执行else
  244. uni.hideNavigationBarLoading()
  245. }, 1000);
  246. }
  247. },
  248. getlistDiscount(type){
  249. const data={
  250. companyUserId:this.companyUserId,
  251. companyId:this.companyId,
  252. auditStatus:this.queryParam.type,
  253. // startDate:this.startTime,
  254. // endDate:this.endTime,
  255. pageSize:this.pageSize,
  256. pageNum:this.pageNum,
  257. appId:wx.getAccountInfoSync().miniProgram.appId
  258. }
  259. getPendingRefundList(data).then(res=>{
  260. if(res.code==200){
  261. // refresh 下拉
  262. // let list=res.data.list
  263. let list = res.data.list.map(item => {
  264. return {
  265. ...item,
  266. checked: false,
  267. }
  268. })
  269. if (type == 'refresh') {
  270. this.paymentList = list
  271. } else {
  272. // 加载更多 当前页和下一页合并
  273. this.paymentList = [...this.paymentList, ...list]
  274. }
  275. if (res.data.isLastPage) {
  276. this.status = 'nomore'
  277. } else {
  278. this.status = 'loadmore'
  279. }
  280. }else{
  281. uni.showToast({
  282. icon:'none',
  283. title: res.msg,
  284. });
  285. }
  286. })
  287. }
  288. }
  289. }
  290. </script>
  291. <style lang="scss" scoped>
  292. .foot-select {
  293. width:100%;
  294. padding: 20rpx 20rpx;
  295. padding-bottom: 60rpx;
  296. z-index: 10000 !important;
  297. position: fixed;
  298. bottom: 0;
  299. }
  300. .orangecol{
  301. background-color: #ffa006;
  302. color: #fff;
  303. border-radius: 40rpx;
  304. padding: 10rpx 20rpx;
  305. text-align: center;
  306. }
  307. .searchbox {
  308. background-color: #fff;
  309. border-radius: 8rpx 8rpx 0 0;
  310. padding: 15px;
  311. &-item {
  312. height: 23px;
  313. line-height: 23px;
  314. width: 65px;
  315. background: #f5f5f5;
  316. text-align: center;
  317. border-radius: 5px;
  318. font-family: PingFang SC, PingFang SC;
  319. font-weight: 400;
  320. font-size: 12px;
  321. color: #888;
  322. }
  323. &-active {
  324. color: #fff !important;
  325. background-color: #1677ff !important;
  326. }
  327. }
  328. </style>