order.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <script setup lang='ts'>
  2. import { onMounted, reactive, ref } from 'vue'
  3. import { orderList, getShopList, getDeliveryList } from '@/api'
  4. import { message } from 'ant-design-vue';
  5. import dayjs, { Dayjs } from 'dayjs';
  6. let time = reactive({
  7. arr: [
  8. dayjs().subtract(7, 'day').format('YYYY-MM-DD'),
  9. dayjs().format('YYYY-MM-DD'),
  10. ]
  11. })
  12. let shopList = reactive({ arr: [{ id: 0, name: '' }] })
  13. let deliveryList = reactive({ arr: [{ id: 0, name: '' }] })
  14. let statusList = reactive({
  15. arr: [
  16. {
  17. status: 0,
  18. name: '新订单'
  19. },
  20. {
  21. status: 10,
  22. name: '预约单'
  23. },
  24. {
  25. status: 1,
  26. name: '待接单'
  27. },
  28. {
  29. status: 2,
  30. name: '取货中'
  31. },
  32. {
  33. status: 3,
  34. name: '配送中'
  35. },
  36. {
  37. status: -1,
  38. name: '已取消'
  39. },
  40. {
  41. status: -2,
  42. name: '异常单'
  43. },
  44. {
  45. status: 97,
  46. name: '本平台完成'
  47. },
  48. {
  49. status: 98,
  50. name: '其他平台完成'
  51. },
  52. ]
  53. })
  54. let searchKeyType = reactive({
  55. arr: [
  56. {
  57. type: 1,
  58. name: '订单号'
  59. },
  60. {
  61. type: 2,
  62. name: '三方订单号'
  63. },
  64. {
  65. type: 3,
  66. name: '收货人手机号'
  67. },
  68. ]
  69. })
  70. interface FormState {
  71. city?: string;
  72. shopId?: number;
  73. deliveryId?: number;
  74. status?: number;
  75. startDate?: string;
  76. endDate?: string;
  77. searchKey: string;
  78. pageNum: number;
  79. pageSize: number;
  80. type: Number
  81. }
  82. const formState = reactive<FormState>({
  83. city: '',
  84. searchKey: '',
  85. pageNum: 1,
  86. pageSize: 10,
  87. type: 1
  88. });
  89. const columns = reactive([
  90. {
  91. title: '三方订单号',
  92. dataIndex: 'outOrderSn',
  93. align: 'center',
  94. },
  95. {
  96. title: '城市',
  97. dataIndex: 'receiptCityName',
  98. align: 'center',
  99. },
  100. {
  101. title: '发件门店',
  102. dataIndex: 'shopName',
  103. align: 'center',
  104. },
  105. {
  106. title: '收件地址',
  107. dataIndex: 'receiptAddress',
  108. align: 'center',
  109. },
  110. {
  111. title: '配送平台',
  112. dataIndex: 'deliveryName',
  113. align: 'center',
  114. },
  115. {
  116. title: '订单状态',
  117. dataIndex: 'status',
  118. align: 'center',
  119. },
  120. {
  121. title: '配送费',
  122. dataIndex: 'payAmount',
  123. align: 'center',
  124. },
  125. {
  126. title: '优巨订单号',
  127. dataIndex: 'orderSn',
  128. align: 'center',
  129. }
  130. ])
  131. const pagination = reactive({
  132. total: 0,
  133. current: formState.pageNum,
  134. pageSize: formState.pageSize,
  135. })
  136. let data = reactive({
  137. arr: []
  138. })
  139. const getOrderList = () => {
  140. formState.startDate = time.arr[0]
  141. formState.endDate = time.arr[1]
  142. orderList(formState).then((res: any) => {
  143. console.log('res', res);
  144. if (res.code === 200) {
  145. data.arr = res.data.data
  146. pagination.total = res.data.totalNums
  147. } else {
  148. message.error(res.msg)
  149. }
  150. })
  151. }
  152. getOrderList()
  153. const handleGetShopList = () => {
  154. getShopList().then((res: any) => {
  155. if (res.code === 200) {
  156. shopList.arr = res.data
  157. } else {
  158. message.error(res.msg)
  159. }
  160. })
  161. }
  162. handleGetShopList()
  163. const handleGetDeliveryList = () => {
  164. getDeliveryList().then((res: any) => {
  165. if (res.code === 200) {
  166. deliveryList.arr = res.data
  167. } else {
  168. message.error(res.msg)
  169. }
  170. })
  171. }
  172. handleGetDeliveryList()
  173. const search = () => {
  174. pagination.current = 1
  175. formState.pageNum = 1
  176. getOrderList()
  177. }
  178. const handleTableChange = (e: any) => {
  179. pagination.current = e.current
  180. pagination.pageSize = e.pageSize
  181. formState.pageNum = e.current
  182. formState.pageSize = e.pageSize
  183. getOrderList()
  184. }
  185. const showOrderStatus = (status: Number) => {
  186. let statusObj: any = statusList.arr.find((v: any) => {
  187. return v.status === status
  188. })
  189. return statusObj.name
  190. }
  191. onMounted(() => {
  192. })
  193. </script>
  194. <template>
  195. <div class="text-20px text-[#222222] font-bold mb-30px">订单管理</div>
  196. <a-form :model="formState" name="horizontal_login" layout="inline" autocomplete="off" class="mb-20px">
  197. <a-form-item label="城市" name="city">
  198. <a-input v-model:value="formState.city" placeholder="请输入要查询的城市" allowClear>
  199. </a-input>
  200. </a-form-item>
  201. <a-form-item label="店铺" name="shopId">
  202. <a-select v-model:value="formState.shopId" style="width: 200px" placeholder="请选择要查询的店铺名称" allowClear>
  203. <a-select-option v-for="(v, i) in shopList.arr" :key="i" :value="v.id">{{ v.name }}</a-select-option>
  204. </a-select>
  205. </a-form-item>
  206. <a-form-item label="配送平台" name="deliveryId">
  207. <a-select v-model:value="formState.deliveryId" style="width: 200px" placeholder="请选择要查询的配送平台" allowClear>
  208. <a-select-option v-for="(v, i) in deliveryList.arr" :key="i" :value="v.id">{{ v.name }}</a-select-option>
  209. </a-select>
  210. </a-form-item>
  211. <a-form-item label="订单状态" name="status">
  212. <a-select v-model:value="formState.status" style="width: 200px" placeholder="请选择要查询的订单状态" allowClear>
  213. <a-select-option v-for="(v, i) in statusList.arr" :key="i" :value="v.status">{{ v.name }}</a-select-option>
  214. </a-select>
  215. </a-form-item>
  216. <a-form-item-rest>
  217. <a-input-group compact>
  218. <a-select v-model:value="formState.type" style="width: 130px">
  219. <a-select-option v-for="(v, i) in searchKeyType.arr" :key="i" :value="v.type">{{ v.name }}</a-select-option>
  220. </a-select>
  221. <a-input style="width: 200px" v-model:value="formState.searchKey" placeholder="请输入要查询的数据" allowClear />
  222. </a-input-group>
  223. </a-form-item-rest>
  224. <a-form-item label="日期" name="time">
  225. <a-range-picker v-model:value="time.arr" valueFormat="YYYY/MM/DD" />
  226. </a-form-item>
  227. <a-form-item>
  228. <a-button class="ml-20px" type="primary" @click="search">查 询</a-button>
  229. <!-- <a-button class="ml-20px" type="primary" ghost html-type="submit">导 出</a-button> -->
  230. </a-form-item>
  231. </a-form>
  232. <a-table :columns="columns" rowKey="id" :data-source="data.arr" :pagination="pagination" bordered
  233. @change="handleTableChange">
  234. <template #bodyCell="{ column, text, record }">
  235. <template v-if="column.dataIndex === 'outOrderSn'">
  236. <div>{{ record.outOrderSn || '- -' }}</div>
  237. </template>
  238. <template v-if="column.dataIndex === 'deliveryName'">
  239. <div>{{ record.deliveryName || '- -' }}</div>
  240. </template>
  241. <template v-if="column.dataIndex === 'status'">
  242. <div>{{ showOrderStatus(record.status) }}</div>
  243. </template>
  244. <template v-if="column.dataIndex === 'deliveries'">
  245. <div class="flex justify-center">
  246. <img :src="v.logo" alt="" v-for="(v, i) in text" :key="i" class="w-20px h-20px mr-10px">
  247. </div>
  248. </template>
  249. <!-- <template v-if="column.dataIndex === 'operation'">
  250. <a class="text-blue-500">详情</a>
  251. </template> -->
  252. </template>
  253. <template #expandedRowRender="{ record }">
  254. <div>
  255. <div class="flex items-center modal">
  256. <div class="modal-title">订单状态:</div>
  257. <div class="ml-10px mr-5px text-16px text-[#05BC51]">{{ showOrderStatus(record.status) }}</div>
  258. <a-popover placement="right">
  259. <template #content>
  260. <p class="py-5px" v-if="record.finishTime">完成时间:{{ record.finishTime }}</p>
  261. <p class="py-5px" v-if="record.shipperTakeTime">骑手取件时间:{{ record.shipperTakeTime }}</p>
  262. <p class="py-5px" v-if="record.shipperReceiveTime">骑手接单时间:{{ record.shipperReceiveTime }}</p>
  263. <p class="py-5px" v-if="record.cancelTime">取消时间:{{ record.cancelTime }}</p>
  264. <p class="py-5px" v-if="record.sendTime">发单时间:{{ record.sendTime }}</p>
  265. <p class="py-5px" v-if="record.payTime">支付时间:{{ record.payTime }}</p>
  266. </template>
  267. <img class="cursor-pointer w-14px h-14px" src="@/assets/images/21.png" alt="">
  268. </a-popover>
  269. </div>
  270. <div class="modal">
  271. <div class="modal-title">收发信息</div>
  272. <div class="cell-list">
  273. <div class="cell">
  274. <div class="title">发件门店:</div>
  275. <div>{{ record.shopName }}</div>
  276. </div>
  277. <div class="cell">
  278. <div class="title">发件人:</div>
  279. <div>{{ record.sendContactName }}</div>
  280. </div>
  281. <div class="cell">
  282. <div class="title">发件人电话:</div>
  283. <div>{{ record.sendPhone }}</div>
  284. </div>
  285. <div class="cell">
  286. <div class="title">收件地址:</div>
  287. <div>{{ record.receiptAddress }}</div>
  288. </div>
  289. <div class="cell">
  290. <div class="title">收件人:</div>
  291. <div>{{ record.receiptContactName }}</div>
  292. </div>
  293. <div class="cell">
  294. <div class="title">收件人电话:</div>
  295. <div>{{ record.receiptPhone }}</div>
  296. </div>
  297. </div>
  298. </div>
  299. <div class="modal">
  300. <div class="modal-title">配送信息</div>
  301. <div class="cell-list">
  302. <div class="cell">
  303. <div class="title">骑手姓名:</div>
  304. <div>{{ record.shipperName || '--' }}</div>
  305. </div>
  306. <div class="cell">
  307. <div class="title">配送平台:</div>
  308. <div>{{ record.deliveryName || '--' }}</div>
  309. </div>
  310. <div class="cell">
  311. <div class="title">骑手电话:</div>
  312. <div>{{ record.shipperPhone }}</div>
  313. </div>
  314. <div class="cell">
  315. <div class="title">配送距离:</div>
  316. <div>{{ record.orderDistance || '--' }}</div>
  317. </div>
  318. <div class="cell">
  319. <div class="title">{{ record.deliveryName }}客服:</div>
  320. <div>{{ record.customerPhone }}</div>
  321. </div>
  322. </div>
  323. </div>
  324. <!-- <div class="modal">
  325. <div class="modal-title">支付信息</div>
  326. <div class="cell-list">
  327. <div class="cell">
  328. <div class="title">应付费用:</div>
  329. <div>{{ record.shopName }} 元</div>
  330. </div>
  331. <div class="cell">
  332. <div class="title">实际支付:</div>
  333. <div>{{ record.payAmount }} 元</div>
  334. <img class="w-14px h-14px ml-5px" src="@/assets/images/22.png" alt="">
  335. </div>
  336. </div>
  337. </div> -->
  338. <div class="modal">
  339. <div class="modal-title">物品信息</div>
  340. <div class="cell-list">
  341. <div class="cell">
  342. <div class="title">物品类型:</div>
  343. <div>{{ record.productName }}</div>
  344. </div>
  345. <div class="cell">
  346. <div class="title">物品重量:</div>
  347. <div>{{ record.weight }} kg</div>
  348. </div>
  349. <div class="cell">
  350. <div class="title">物品价值:</div>
  351. <div>{{ record.productAmount }} 元</div>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. </template>
  357. </a-table>
  358. </template>
  359. <style lang='scss' scoped>
  360. .ant-form-inline :deep(.ant-form-item) {
  361. margin-bottom: 10px;
  362. }
  363. :deep(.ant-input-group){
  364. width: inherit;
  365. margin-right: 16px
  366. }
  367. .modal {
  368. @apply mt-20px;
  369. .modal-title {
  370. @apply text-16px text-[#333333] leading-19px font-500 ml-20px;
  371. }
  372. .cell-list {
  373. @apply flex ml-124px mt-10px flex-wrap;
  374. .cell {
  375. @apply flex items-center w-1/2 leading-30px text-[#666666] text-14px;
  376. .title {
  377. @apply w-100px text-right;
  378. }
  379. }
  380. }
  381. }
  382. </style>