orderSearch.vue 11 KB

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