orderAlarm.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view style="overflow: hidden;">
  3. <!-- tab -->
  4. <view class="tab-box ddflex">
  5. <view class="fflex ddflex">
  6. <view :class="'tab-item fflex '+(queryType==2?'tab-item-active':'')" @click="queryTypeChange(2)">
  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==3?'tab-item-active':'')" @click="queryTypeChange(3)">
  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.id)">
  21. <view class="ddflex order-item-header">
  22. <view class="order-time">类型:{{item.type==2?'按次计费':item.type==3?'按时计费':''}}</view>
  23. <block>
  24. <view v-if="item.isException==2" 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" style="color: #EB5C20">{{item.totalMoney?'¥'+item.totalMoney:'-'}}</view>
  49. </view>
  50. <view class="order-item-content ddflex">
  51. <view class="order-item-content-label">描述:</view>
  52. <view class="order-item-content-data fflex tover">
  53. <view style="color: #2A82E4;margin-left: 10rpx;text-decoration: underline;" @click.stop="jumpUrl('/warning/userAlarm/userAlarm?orderId='+item.id)">查看用户报障</view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="order-btns ddflex">
  58. <view class="order-btn-time">{{item.createDate}}</view>
  59. <view v-if="item.isException==2" style="justify-content: flex-end;" class="ddflex">
  60. <view class="order-btn" v-if="item.status==3&&item.refundStatus==0" @click.stop="openPop(item,'退款')">退款</view>
  61. <view class="order-btn" v-if="item.status==0||item.status==1" @click.stop="openPop(item,'结算')">结算</view>
  62. <view class="order-btn" @click.stop="finishOrder(item)">处理</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view v-if="groupList.length==0">
  68. <view class="nodata">
  69. <image :src="picUrlss+'empty.png'" mode="aspectFit"></image>
  70. <text>暂无订单~</text>
  71. </view>
  72. </view>
  73. <bottom-pop v-if="showPop" :showPop='showPop' :btnColor="'#11BB8B'" :showBtn='true' :title="popTitle"
  74. @closePop="closePop()" @popSubmit="popSubmit()">
  75. <view class="apply-info-box" v-if="popTitle=='退款'">
  76. <view class="reason-input">
  77. <input v-model="tempData.rmoney" type="digit" placeholder="请填写退款金额"></input>
  78. </view>
  79. <view>请填写退款金额,最多可退¥{{tempData.payMoney}}</view>
  80. </view>
  81. <view class="apply-info-box" v-if="popTitle=='结算'">
  82. <view class="reason-input">
  83. <input v-model="tempData.rmoney" type="digit" placeholder="是否调整订单金额"></input>
  84. </view>
  85. <view>如需调整订单金额,请填写调整后的订单金额,否则无需填写</view>
  86. </view>
  87. </bottom-pop>
  88. </view>
  89. </template>
  90. <script>
  91. const app = getApp();
  92. const req = require("../../utils/request.js");
  93. import bottomPop from "../../components/bottom-pop/index";
  94. export default {
  95. components: {
  96. bottomPop
  97. },
  98. props: {},
  99. data() {
  100. return {
  101. picUrlss: req.public.picUrls,
  102. queryType: 2,
  103. groupList: [],
  104. page: 1,
  105. limit: 10,
  106. searchValue: '',
  107. isQuerying: false, //正在查询数据
  108. // 筛选弹窗
  109. showPop: false,
  110. tempData: null,
  111. popTitle:''
  112. }
  113. },
  114. onLoad(options) {
  115. this.getMachineList()
  116. },
  117. onShow() {
  118. },
  119. onReachBottom() {
  120. this.getMachineList(true)
  121. },
  122. methods: {
  123. jumpUrl(url) {
  124. if (req.isLogins(true)) {
  125. uni.navigateTo({
  126. url: url
  127. })
  128. }
  129. },
  130. queryTypeChange(val) {
  131. if (this.queryType == val) return false
  132. this.queryType = val
  133. this.getMachineList()
  134. },
  135. // 获取机柜列表
  136. getMachineList(isPage) {
  137. if (this.isQuerying) return
  138. else this.isQuerying = true
  139. if (!isPage) {
  140. this.page = 1
  141. }
  142. let queryParams = {
  143. page: this.page,
  144. limit: this.limit,
  145. }
  146. queryParams.status = this.queryType
  147. req.getRequest(
  148. '/admin/v2/alarm/exceptionOrderPage',
  149. queryParams,
  150. data => {
  151. if (data != null && data.list.length > 0) {
  152. if (!isPage) {
  153. this.groupList = data.list
  154. } else {
  155. this.groupList = this.groupList.concat(data.list)
  156. }
  157. this.page++
  158. } else {
  159. if (!isPage)
  160. this.groupList = data.list
  161. else {}
  162. }
  163. uni.hideLoading()
  164. this.isQuerying = false
  165. }
  166. )
  167. },
  168. // 弹窗打开
  169. openPop(item,title) {
  170. this.popTitle = title
  171. if(title=='退款'){
  172. this.tempData = item;
  173. this.tempData.rmoney = item.payMoney
  174. this.showPop = true
  175. }else if(title=='结算'){
  176. this.tempData = item;
  177. this.tempData.rmoney = 0
  178. this.showPop = true
  179. }
  180. },
  181. // 弹窗关闭
  182. closePop() {
  183. this.showPop = false
  184. this.tempData = null
  185. },
  186. // 弹窗确认
  187. popSubmit() {
  188. if(this.popTitle=='退款'){
  189. if(Number(this.tempData.rmoney)>Number(this.tempData.payMoney)) return req.msg('退款金额超出支付金额')
  190. uni.showModal({
  191. title: '提示',
  192. content: "确定退款?",
  193. success: (res) => {
  194. if (res.confirm) {
  195. req.postRequest('/admin/v2/order/refund', {
  196. orderNo:this.tempData.orderNo,
  197. refundMoney:this.tempData.rmoney
  198. }, data => {
  199. this.tempData = null
  200. this.showPop = false
  201. req.msg('订单已退款')
  202. this.getMachineList()
  203. })
  204. }
  205. }
  206. })
  207. }else if(this.popTitle=='结算'){
  208. uni.showModal({
  209. title: '提示',
  210. content: "确定结算?",
  211. success: (res) => {
  212. if (res.confirm) {
  213. req.postRequest('/admin/v2/order/settle', {
  214. orderId: this.tempData.id,
  215. settleMoney:this.tempData.rmoney,
  216. settleType:2
  217. }, data => {
  218. this.tempData = null
  219. this.showPop = false
  220. req.msg('订单已结算')
  221. this.getMachineList()
  222. })
  223. }
  224. }
  225. })
  226. }
  227. },
  228. // 结束订单
  229. finishOrder(item) {
  230. uni.showModal({
  231. title: '提示',
  232. content: "确定直接处理该订单?如需调整订单金额请取消并点击结算操作,如需退款请取消并点击退款操作",
  233. success: (res) => {
  234. if (res.confirm) {
  235. req.postRequest('/admin/v2/order/finish', {
  236. orderId:item.id
  237. }, data => {
  238. req.msg('订单已处理')
  239. this.getMachineList()
  240. })
  241. }
  242. }
  243. })
  244. }
  245. },
  246. mounted() {},
  247. onPageScroll: function(e) {}
  248. }
  249. </script>
  250. <style>
  251. @import "./orderAlarm.css";
  252. </style>