orderAlarm.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view>
  3. <!-- tab -->
  4. <view class="tab-box ddflex">
  5. <view class="fflex ddflex">
  6. <view :class="'tab-item fflex '+(queryType==''?'tab-item-active':'')" @click="queryTypeChange(0)">
  7. <view>待处理</view>
  8. <image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
  9. </view>
  10. <view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
  11. <view>已处理</view>
  12. <image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
  13. </view>
  14. </view>
  15. </view>
  16. <view style="height: 110rpx;"></view>
  17. <!-- 订单 -->
  18. <view>
  19. <view class="order-item" v-for="item,index in groupList"
  20. @click="jumpUrl('/pages/orderDetail/orderDetail?id='+item)">
  21. <view class="ddflex order-item-header">
  22. <view class="order-time">类型:{{item.exceptionCause}}</view>
  23. <block>
  24. <view v-if="item.isException==0" class="order-state">待处理</view>
  25. <view v-else class="order-state" style="color: #0FCB27;border: 2rpx solid #0FCB27;">已处理</view>
  26. </block>
  27. </view>
  28. <view class="order-item-body">
  29. <view class="order-item-content ddflex">
  30. <view class="order-item-content-label">订单编号:</view>
  31. <view class="order-item-content-data fflex tover">{{item.orderNo}}</view>
  32. </view>
  33. <view class="order-item-content ddflex">
  34. <view class="order-item-content-label">订单状态:</view>
  35. <view class="order-item-content-data fflex tover">
  36. {{item.finishStatus==0?'未结束':item.finishStatus==1?'自动结束':'人工结束'}}</view>
  37. </view>
  38. <view class="order-item-content ddflex">
  39. <view class="order-item-content-label">机柜编号:</view>
  40. <view class="order-item-content-data fflex tover">{{item.leaseDevId}}</view>
  41. </view>
  42. <view class="order-item-content ddflex">
  43. <view class="order-item-content-label">电池编号:</view>
  44. <view class="order-item-content-data fflex tover">{{item.batteryId}}</view>
  45. </view>
  46. <view class="order-item-content ddflex">
  47. <view class="order-item-content-label">描述:</view>
  48. <view class="order-item-content-data fflex tover">{{item.exceptionCause}}</view>
  49. </view>
  50. </view>
  51. <view v-if="item.isException!==0" class="order-btns ddflex">
  52. <view class="order-btn-time">2022-12-31 17:16:37</view>
  53. <view style="justify-content: flex-end;" class="ddflex">
  54. <view class="order-btn" v-if="item.status>1&&item.refundStatus==0" @click.stop="openPop(item)">退款</view>
  55. <view class="order-btn" v-else @click.stop="finishOrder">结束订单</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <bottom-pop v-if="showPop" :showPop='showPop' :btnColor="'#11BB8B'" :showBtn='true' title="退款"
  61. @closePop="closePop()" @popSubmit="popSubmit()">
  62. <view class="apply-info-box">
  63. <view class="reason-input">
  64. <input v-model="tempData.rmoney" placeholder="请填写退款金额"></input>
  65. </view>
  66. <view>请填写退款金额,最多可退¥{{tempData.payMoney}}</view>
  67. </view>
  68. </bottom-pop>
  69. </view>
  70. </template>
  71. <script>
  72. const app = getApp();
  73. const req = require("../../utils/request.js");
  74. import bottomPop from "../../components/bottom-pop/index";
  75. export default {
  76. components: {
  77. bottomPop
  78. },
  79. props: {},
  80. data() {
  81. return {
  82. queryType: 0,
  83. groupList: [],
  84. page: 1,
  85. limit: 10,
  86. searchValue: '',
  87. isQuerying: false, //正在查询数据
  88. // 筛选弹窗
  89. showPop: false,
  90. tempData: null,
  91. }
  92. },
  93. onLoad(options) {
  94. this.getMachineList()
  95. },
  96. onShow() {
  97. },
  98. onReachBottom() {
  99. this.getMachineList(true)
  100. },
  101. methods: {
  102. jumpUrl(url) {
  103. if (req.isLogins(true)) {
  104. uni.navigateTo({
  105. url: url
  106. })
  107. }
  108. },
  109. queryTypeChange(val) {
  110. if (this.queryType == val) return false
  111. this.queryType = val
  112. this.getMachineList()
  113. },
  114. // 获取机柜列表
  115. getMachineList(isPage) {
  116. if (this.isQuerying) return
  117. else this.isQuerying = true
  118. if (!isPage) {
  119. this.page = 1
  120. }
  121. let queryParams = {
  122. page: this.page,
  123. limit: this.limit,
  124. }
  125. queryParams.status = this.queryType
  126. req.getRequest(
  127. '/admin/v2/alarm/exceptionOrderPage',
  128. queryParams,
  129. data => {
  130. if (data != null && data.list.length > 0) {
  131. if (!isPage) {
  132. this.groupList = data.list
  133. } else {
  134. this.groupList = this.groupList.concat(data.list)
  135. }
  136. this.page++
  137. } else {
  138. if (!isPage)
  139. this.groupList = data.list
  140. else {}
  141. }
  142. uni.hideLoading()
  143. this.isQuerying = false
  144. }
  145. )
  146. },
  147. // 弹窗打开
  148. openPop(item,index) {
  149. this.tempData = item;
  150. this.tempData.rmoney = item.payMoney
  151. this.showPop = true
  152. },
  153. // 弹窗关闭
  154. closePop() {
  155. this.showPop = false
  156. this.tempData = null
  157. },
  158. // 弹窗确认
  159. popSubmit() {
  160. if(Number(this.tempData.rmoney)>Number(this.tempData.payMoney)) return req.msg('退款金额超出支付金额')
  161. uni.showModal({
  162. title: '提示',
  163. content: "确定退款?",
  164. success: (res) => {
  165. if (res.confirm) {
  166. req.getRequest('/admin/v2/order/refund', {
  167. id: this.tempData.id,
  168. refundMoney:this.tempData.rmoney
  169. }, data => {
  170. this.tempData = null
  171. this.showPop = false
  172. res.msg('订单已退款')
  173. this.getMachineList()
  174. })
  175. }
  176. }
  177. })
  178. },
  179. // 结束订单
  180. finishOrder(item) {
  181. uni.showModal({
  182. title: '提示',
  183. content: "确定结束该订单?",
  184. success: (res) => {
  185. if (res.confirm) {
  186. req.getRequest('/admin/v2/order/settle', {
  187. id: item.id
  188. }, data => {
  189. res.msg('订单已结束')
  190. this.getMachineList()
  191. })
  192. }
  193. }
  194. })
  195. }
  196. },
  197. mounted() {},
  198. onPageScroll: function(e) {}
  199. }
  200. </script>
  201. <style>
  202. @import "./orderAlarm.css";
  203. </style>