riderOrderRecord.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <a-card :bordered="false" class="cleanDetail-container">
  3. <!-- 搜索条件 -->
  4. <div class="cleanDetail-container-searchForm">
  5. <a-form-model
  6. ref="queryParam"
  7. :model="queryParam"
  8. layout="inline"
  9. @keyup.enter.native="refresh"
  10. v-bind="formItemLayout">
  11. <a-row :gutter="24">
  12. <a-col :xs="24" :sm="12" :md="6" >
  13. <a-form-model-item label="下单时间" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  14. <a-range-picker
  15. id="netWorkCleanRecord-time"
  16. v-model="time"
  17. style="width: 100%;"
  18. :format="dateFormat"
  19. :placeholder="['开始时间','结束时间']"
  20. :disabledDate="disabledDate"
  21. @change="onChange" />
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :xs="24" :sm="12" :md="6">
  25. <a-form-model-item label="单号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  26. <a-input allowClear v-model.trim="queryParam.orderReserveNo" placeholder="请输入单号" @pressEnter="$refs.table.refresh(true)"/>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :xs="24" :sm="12" :md="6" >
  30. <a-form-model-item label="联系人信息" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  31. <a-input allowClear v-model.trim="queryParam.UserphoneOrName" placeholder="请输入名称或电话" @pressEnter="$refs.table.refresh(true)"/>
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :xs="24" :sm="12" :md="6" >
  35. <a-form-model-item label="骑手信息" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  36. <a-input allowClear v-model.trim="queryParam.phoneOrName" placeholder="请输入名称或电话" @pressEnter="$refs.table.refresh(true)"/>
  37. </a-form-model-item>
  38. </a-col>
  39. </a-row>
  40. <a-row :gutter="24">
  41. <a-col :xs="24" :sm="12" :md="6" >
  42. <a-form-model-item label="状态" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
  43. <v-select code="ORDER_RESERVE_STATUS" v-model="queryParam.orderStatus" allowClear placeholder="请选择状态" id="userList-check-enable-state"></v-select>
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :xs="24" :sm="12" :md="6" >
  47. <a-button type="primary" @click="refreshSearch" id="netWorkCleanRecord-refresh" style="margin: 4px 10px 0 20px">查询</a-button>
  48. <a-button type="" @click="reset" id="netWorkCleanRecord-reset" style="margin-top: 4px">重置</a-button>
  49. </a-col>
  50. </a-row>
  51. </a-form-model>
  52. </div>
  53. <!-- 合计 -->
  54. <a-alert type="info" showIcon style="margin-bottom:15px">
  55. <div class="ftext" slot="message">总计<span> {{ totalNum }} </span>条,回收重量 <span> {{ weightTotal }} </span>kg,交易金额 <span>{{ moneyTotal }}</span>元</div>
  56. </a-alert>
  57. <!-- 列表 -->
  58. <s-table
  59. ref="table"
  60. :rowKey="(record) => record.id"
  61. :columns="columns"
  62. :data="loadData"
  63. bordered
  64. >
  65. <template slot="contact" slot-scope="text,record">
  66. <div>{{ record.contactName }}</div>
  67. <div>{{ record.contactMobile }}</div>
  68. <div v-if="!record.contactName && !record.contactMobile">--</div>
  69. </template>
  70. <template slot="rider" slot-scope="text,record">
  71. <div>{{ record.name }}</div>
  72. <div>{{ record.phone }}</div>
  73. <div v-if="!record.name && !record.phone">--</div>
  74. </template>
  75. <!-- 查看详情 -->
  76. <template slot="detail" slot-scope="text, record">
  77. <a-icon
  78. type="eye"
  79. title="详情"
  80. v-if="$hasPermissions('B_power_user_resetPsd')"
  81. class="actionBtn icon-blues"
  82. @click="handelDetail(record)" />
  83. </template>
  84. </s-table>
  85. <!-- 详情弹窗 -->
  86. <riderOrderModal :visible="isOpenModal" :itemOrderNo="recordOrderNo" @close="isOpenModal=false"></riderOrderModal>
  87. </a-card>
  88. </template>
  89. <script>
  90. import { STable, VSelect } from '@/components'
  91. import { getOrderList, getOrderTotal } from '@/api/recoveryManage.js'
  92. import moment from 'moment'
  93. import riderOrderModal from './riderOrderModal.vue'
  94. export default {
  95. components: { STable, VSelect, riderOrderModal },
  96. data () {
  97. return {
  98. formItemLayout: {
  99. labelCol: {
  100. span: 7
  101. },
  102. wrapperCol: {
  103. span: 17
  104. }
  105. },
  106. // 查询参数
  107. queryParam: {
  108. orderReserveNo: '', // 骑手信息
  109. orderStatus: '', // 骑手信息
  110. phoneOrName: '', // 骑手信息
  111. UserphoneOrName: ''
  112. },
  113. totalNum: 0, // 总条数
  114. weightTotal: 0, // 回收物总计
  115. moneyTotal: 0, // 金额总计
  116. isOpenModal: false,
  117. recordOrderNo: '', // 行订单编号
  118. // 将默认近一周时间日期回显在时间选择框中
  119. time: [],
  120. dateFormat: 'YYYY-MM-DD',
  121. columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
  122. { title: '下单时间', dataIndex: 'createDate', width: 200, align: 'center', customRender: (text) => { return text || '--' } },
  123. { title: '单号', dataIndex: 'orderReserveNo', width: 200, align: 'center', customRender: (text) => { return text || '--' } },
  124. { title: '下单账号', dataIndex: 'mobile', width: 200, align: 'center', customRender: (text) => { return text || '--' } },
  125. { title: '联系人信息', dataIndex: 'contact', width: 180, align: 'center', scopedSlots: { customRender: 'contact' } },
  126. { title: '骑手信息', dataIndex: 'rider', width: 200, align: 'center', scopedSlots: { customRender: 'rider' } },
  127. { title: '回收重量(kg)', dataIndex: 'totalWeight', width: 150, align: 'center', customRender: (text) => { return (text / 1000).toFixed(3) / 1 || 0 } },
  128. { title: '交易金额(元)', dataIndex: 'originalAmount', width: 150, align: 'center', customRender: (text) => { return text || 0 } },
  129. { title: '状态', dataIndex: 'orderStatusDictValue', width: 100, align: 'center', customRender: (text) => { return text || '--' } },
  130. { title: '详情', width: 80, align: 'center', scopedSlots: { customRender: 'detail' } }],
  131. // 加载数据方法 必须为 Promise 对象
  132. loadData: parameter => {
  133. const searchData = Object.assign(parameter, this.queryParam)
  134. if (this.time && this.time.length) {
  135. searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
  136. searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
  137. } else {
  138. searchData.beginDate = null
  139. searchData.endDate = null
  140. }
  141. return getOrderList(searchData).then(res => {
  142. if (res.status == 200) {
  143. const no = (res.data.pageNo - 1) * res.data.pageSize
  144. for (let i = 0; i < res.data.list.length; i++) {
  145. const _item = res.data.list[i]
  146. _item.no = no + i + 1
  147. if (_item.cleanWeight != null || 0) {
  148. _item.cleanWeight = (_item.cleanWeight / 1000).toFixed(3) / 1
  149. }
  150. }
  151. this.getTotal()
  152. return res.data
  153. }
  154. })
  155. }
  156. }
  157. },
  158. methods: {
  159. // 不可选日期
  160. disabledDate (date, dateStrings) {
  161. return date && date.valueOf() > Date.now()
  162. },
  163. // 创建时间change
  164. onChange (dates, dateStrings) {
  165. if ((dates, dateStrings)) {
  166. this.queryParam.beginDate = dateStrings[0]
  167. this.queryParam.endDate = dateStrings[1]
  168. }
  169. },
  170. filterOption (input, option) {
  171. return (
  172. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  173. )
  174. },
  175. // 总计
  176. getTotal () {
  177. const params = this.queryParam
  178. if (this.time && this.time.length) {
  179. params.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
  180. params.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
  181. } else {
  182. params.beginDate = null
  183. params.endDate = null
  184. }
  185. getOrderTotal(params).then(res => {
  186. if (res.status == 200) {
  187. if (res.data) {
  188. this.totalNum = res.data.orderCount || 0 // 总条数
  189. this.weightTotal = (res.data.totalAllWeight / 1000).toFixed(3) / 1 || 0// 回收物总计
  190. this.moneyTotal = res.data.originalAllAmount || 0 // 金额总计
  191. }
  192. }
  193. })
  194. },
  195. // 查看详情
  196. handelDetail (row) {
  197. this.recordOrderNo = row.orderReserveNo
  198. this.isOpenModal = true
  199. },
  200. // 查询
  201. refreshSearch () {
  202. this.$refs.table.refresh(true)
  203. this.getTotal()
  204. },
  205. // 重置
  206. reset () {
  207. this.queryParam = {
  208. beginDate: null, // 开始时间
  209. endDate: null, // 结束时间
  210. orderReserveNo: '', // 骑手信息
  211. orderStatus: '', // 骑手信息
  212. phoneOrName: '', // 骑手信息
  213. UserphoneOrName: ''
  214. }
  215. this.time = []
  216. this.refreshSearch()
  217. }
  218. }
  219. }
  220. </script>
  221. <style lang='less' scoped>
  222. .cleanDetail-container {
  223. .cleanDetail-container-searchForm {
  224. .ant-form-inline .ant-form-item {
  225. width: 100%;
  226. margin-bottom: 15px;
  227. }
  228. }
  229. }
  230. </style>