orderSearch.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div class="mainContent">
  3. <el-row class="order_tab">
  4. <!-- <el-col :span="8" class="search">
  5. <el-input size="small" @keydown.enter.native="seachEnterFun" class="inp" clearable v-model="params.searchKey" placeholder="请输入手机号/姓名/地址/订单编号"></el-input>
  6. </el-col> -->
  7. <el-col :span="24">
  8. <div class="order_list_sel">
  9. <div class="sel_item">
  10. <el-input size="small" @keydown.enter.native="seachEnterFun" class="inp" clearable v-model="params.searchKey" placeholder="请输入手机号/姓名/地址/订单编号"></el-input>
  11. </div>
  12. <div class="sel_item" v-if="memberType !== 1">
  13. <span class="name">门店:</span>
  14. <el-select size="small" class="item1" v-model="params.shopId" placeholder="请选择门店">
  15. <el-option v-for="(v,i) in shopList" :key="i" :label="v.name" :value="v.shopId"></el-option>
  16. </el-select>
  17. </div>
  18. <div class="sel_item">
  19. <span class="name">订单来源:</span>
  20. <el-select size="small" class="item1" v-model="params.orderType" placeholder="请选择订单来源">
  21. <el-option v-for="(v,i) in originList" :key="i" :label="v.name" :value="v.status"></el-option>
  22. </el-select>
  23. </div>
  24. <div class="sel_item">
  25. <span class="name">订单状态:</span>
  26. <el-select size="small" class="item2" v-model="params.status" placeholder="请选择订单状态">
  27. <el-option v-for="(v,i) in tabList" :key="i" :label="v.name" :value="v.status"></el-option>
  28. </el-select>
  29. </div>
  30. <div class="sel_item sel_item2">
  31. <span class="name">日期:</span>
  32. <el-date-picker size="small" v-model="value1" class="item3" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
  33. </el-date-picker>
  34. </div>
  35. <el-button size='small' @click="search" style="background: #0D1E40;color:#fff">查询</el-button>
  36. <el-button size='small' @click="search" class="btn">手动发单</el-button>
  37. </div>
  38. </el-col>
  39. </el-row>
  40. <el-row class="order_list">
  41. <el-col :span="24" v-if="orderList.length" v-loading="isLoading">
  42. <order-list class="list" :list='orderList' :tabNum='tabNum'></order-list>
  43. <div style="text-align: center;">
  44. <el-pagination :current-page.sync="params.pageNum" @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="[10, 20, 50, 100]" :page-size="params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" background>
  45. </el-pagination>
  46. </div>
  47. </el-col>
  48. <el-col class="empty-data" v-else>
  49. <img src="../../static/image/empty-data.png" />
  50. </el-col>
  51. </el-row>
  52. </div>
  53. </template>
  54. <script>
  55. import bus from "../common/bus.js";
  56. import sendOrderPopup from "./orderComponents/sendOrderPopup.vue";
  57. import OrderList from "./orderComponents/orderList.vue";
  58. import { getOrderList } from "../api/order.js";
  59. import { getShopList } from "../api/shop.js";
  60. export default {
  61. data() {
  62. return {
  63. input: "",
  64. value1: "",
  65. params: {
  66. status: 99,
  67. orderType: 0,
  68. searchType: 1,
  69. searchKey: "",
  70. shopId: "",
  71. startDate: "",
  72. endDate: "",
  73. pageNum: 1,
  74. pageSize: 10,
  75. },
  76. shopList: [],
  77. originList: [
  78. {
  79. name: "全部",
  80. status: 0,
  81. },
  82. {
  83. name: "美团",
  84. status: 1,
  85. },
  86. {
  87. name: "饿了么",
  88. status: 2,
  89. },
  90. {
  91. name: "饿百",
  92. status: 3,
  93. },
  94. {
  95. name: "手动发单",
  96. status: 99,
  97. },
  98. ],
  99. tabList: [
  100. {
  101. name: "全部",
  102. status: 99,
  103. },
  104. {
  105. name: "待发单",
  106. status: 95,
  107. },
  108. {
  109. name: "进行中",
  110. status: 96,
  111. },
  112. {
  113. name: "已完成",
  114. status: 97,
  115. },
  116. {
  117. name: "已取消",
  118. status: -1,
  119. },
  120. {
  121. name: "其他平台完成",
  122. status: 98,
  123. },
  124. ],
  125. tabNum: -1,
  126. isLoading: false,
  127. total: 0,
  128. orderList: [],
  129. needTrack: false,
  130. orderDetailStutus: 1,
  131. markerNum: "",
  132. clickBool: false,
  133. memberType: this.$store.state.userInfo.memberType,
  134. pickerOptions: {
  135. shortcuts: [
  136. {
  137. text: "最近一周",
  138. onClick(picker) {
  139. const end = new Date();
  140. const start = new Date();
  141. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  142. picker.$emit("pick", [start, end]);
  143. },
  144. },
  145. {
  146. text: "最近一个月",
  147. onClick(picker) {
  148. const end = new Date();
  149. const start = new Date();
  150. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  151. picker.$emit("pick", [start, end]);
  152. },
  153. },
  154. {
  155. text: "最近三个月",
  156. onClick(picker) {
  157. const end = new Date();
  158. const start = new Date();
  159. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  160. picker.$emit("pick", [start, end]);
  161. },
  162. },
  163. ],
  164. },
  165. };
  166. },
  167. components: {
  168. sendOrderPopup,
  169. OrderList,
  170. },
  171. created() {
  172. let searchKey = this.$route.query.searchKey;
  173. if (searchKey) {
  174. this.params.searchKey = searchKey;
  175. }
  176. this.init();
  177. if (this.memberType !== 1) {
  178. this.getShopList();
  179. }
  180. this.getOrder();
  181. },
  182. mounted() {},
  183. destroyed() {
  184. bus.$off("refreshData2");
  185. },
  186. methods: {
  187. seachEnterFun(e) {
  188. var keyCode = window.event ? e.keyCode : e.which;
  189. if (keyCode == 13) {
  190. this.search();
  191. }
  192. },
  193. init() {
  194. const start = new Date().getTime() - 3600 * 1000 * 24 * 7;
  195. this.params.startDate = this.$tool.formatDateTime(start, "yyyy-MM-dd");
  196. this.params.endDate = this.$tool.formatDateTime(new Date(), "yyyy-MM-dd");
  197. this.value1 = [this.params.startDate, this.params.endDate];
  198. bus.$on("refreshData2", () => {
  199. console.log("执行refreshData2");
  200. this.params.pageNum = 1
  201. this.orderList = [];
  202. this.getOrder();
  203. });
  204. },
  205. search() {
  206. if (this.value1 && this.value1.length) {
  207. this.params.startDate = this.$tool.formatDateTime(this.value1[0]);
  208. this.params.endDate = this.$tool.formatDateTime(this.value1[1]);
  209. } else {
  210. this.params.startDate = "";
  211. this.params.endDate = "";
  212. }
  213. this.params.pageNum = 1;
  214. this.orderList = [];
  215. this.getOrder();
  216. },
  217. handleSizeChange(val) {
  218. this.params.pageNum = 1;
  219. this.params.pageSize = val;
  220. this.orderList = [];
  221. this.getOrder();
  222. },
  223. handleCurrentChange(val) {
  224. this.params.pageNum = val;
  225. this.orderList = [];
  226. this.getOrder();
  227. },
  228. getOrder() {
  229. let _this = this;
  230. var minute = 1000 * 60;
  231. var hour = minute * 60;
  232. var day = hour * 24;
  233. this.isLoading = true;
  234. getOrderList(this.params).then((res) => {
  235. this.isLoading = false;
  236. if (res.code == 200) {
  237. this.total = res.data.totalNums || 0;
  238. this.params.pageNum = res.data.pageNum;
  239. res.data.data.forEach((element) => {
  240. element.takeTimeTxt = this.$tool.timeago(
  241. new Date(element.sendTime).getTime()
  242. );
  243. if (element.exceptTime && element.delayTime) {
  244. element.timeTxt = _this.$tool.eosFormatTime2(
  245. element.exceptTime,
  246. element.delayTime
  247. );
  248. } else {
  249. element.timeTxt = "";
  250. }
  251. this.orderList.push(element);
  252. });
  253. } else {
  254. this.$message({
  255. message: res.msg,
  256. type: "error",
  257. });
  258. }
  259. });
  260. },
  261. getShopList() {
  262. getShopList().then((res) => {
  263. if (res.code === 200) {
  264. this.shopList = res.data.map((v) => {
  265. return { name: v.name, shopId: v.id };
  266. });
  267. this.shopList.unshift({ name: "全部", shopId: "" });
  268. } else {
  269. this.$message({
  270. type: "error",
  271. message: res.msg,
  272. });
  273. }
  274. });
  275. },
  276. },
  277. };
  278. </script>
  279. <style lang="scss" scoped="scoped">
  280. /deep/ .el-input__inner {
  281. padding-right: 30px;
  282. }
  283. .mainContent {
  284. width: 100%;
  285. .order_tab {
  286. display: flex;
  287. flex-direction: column;
  288. justify-content: space-around;
  289. width: 100%;
  290. background: #fff;
  291. height: 74px;
  292. .search {
  293. margin-left: 20px;
  294. }
  295. .order_list_sel {
  296. display: flex;
  297. align-items: center;
  298. margin: 0 0 0 20px;
  299. .btn {
  300. background: #fc7200;
  301. border-color: #fc7200;
  302. color: #fff !important;
  303. }
  304. .sel_item {
  305. display: flex;
  306. align-items: center;
  307. margin-right: 10px;
  308. .name {
  309. font-size: 14px;
  310. flex-shrink: 0;
  311. color: #999;
  312. }
  313. }
  314. }
  315. }
  316. .order_list {
  317. width: 100%;
  318. height: calc(100vh - 180px);
  319. margin-top: 10px;
  320. .list {
  321. position: relative;
  322. height: calc(100vh - 210px);
  323. overflow: hidden;
  324. }
  325. .empty-data {
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. background-color: #fff;
  330. height: 100%;
  331. img {
  332. width: 349px;
  333. height: 222px;
  334. }
  335. }
  336. }
  337. }
  338. </style>