orderSearch.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="mainContent">
  3. <el-row class="order_tab">
  4. <el-col :span="12" class="search">
  5. <div class="header_serch">
  6. <div class="search_inp">
  7. <el-input size="medium" class="inp" clearable v-model="params.searchKey" placeholder="请输入手机号/姓名/地址/订单编号"></el-input>
  8. <!-- <el-button size="medium" @click="search" type="primary" slot="append" icon="el-icon-search"></el-button> -->
  9. </div>
  10. <!-- 1.0.0版本暂不开发该功能 -->
  11. <!-- <div class="Manual">手动发单</div> -->
  12. </div>
  13. </el-col>
  14. <el-col :span="24">
  15. <div class="order_list_sel">
  16. <div class="sel_item">
  17. <span class="name">门店:</span>
  18. <el-select size="small" class="item1" v-model="params.shopId" placeholder="请选择门店">
  19. <el-option v-for="(v,i) in shopList" :key="i" :label="v.name" :value="v.shopId"></el-option>
  20. </el-select>
  21. </div>
  22. <div class="sel_item">
  23. <span class="name">订单来源:</span>
  24. <el-select size="small" class="item1" v-model="params.orderType" placeholder="请选择订单来源">
  25. <el-option v-for="(v,i) in originList" :key="i" :label="v.name" :value="v.status"></el-option>
  26. </el-select>
  27. </div>
  28. <div class="sel_item">
  29. <span class="name">订单状态:</span>
  30. <el-select size="small" class="item2" v-model="params.status" placeholder="请选择订单状态">
  31. <el-option v-for="(v,i) in tabList" :key="i" :label="v.name" :value="v.status"></el-option>
  32. </el-select>
  33. </div>
  34. <div class="sel_item sel_item2">
  35. <span class="name">日期:</span>
  36. <el-date-picker size="small" v-model="value1" class="item3" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  37. </el-date-picker>
  38. </div>
  39. <el-button size='small' @click="search" style="background: #0D1E40;color:#fff">查询</el-button>
  40. </div>
  41. </el-col>
  42. </el-row>
  43. <el-row class="order_list">
  44. <el-col :span="24" v-loading="isLoading">
  45. <order-list :list='orderList' :tabNum='tabNum'></order-list>
  46. <div style="text-align: center;">
  47. <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>
  48. </el-pagination>
  49. </div>
  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: 96,
  107. },
  108. {
  109. name: "已完成",
  110. status: 97,
  111. },
  112. {
  113. name: "已取消",
  114. status: -1,
  115. },
  116. {
  117. name: "其他平台完成",
  118. status: 98,
  119. },
  120. ],
  121. tabNum: -1,
  122. isLoading: false,
  123. total: 0,
  124. orderList: [],
  125. needTrack: false,
  126. orderDetailStutus: 1,
  127. markerNum: "",
  128. clickBool: false,
  129. };
  130. },
  131. components: {
  132. sendOrderPopup,
  133. OrderList,
  134. },
  135. created() {
  136. let searchKey = this.$route.query.searchKey;
  137. if (searchKey) {
  138. this.params.searchKey = searchKey;
  139. }
  140. this.getShopList();
  141. this.init();
  142. this.getOrder();
  143. },
  144. destroyed() {
  145. bus.$off("pullData");
  146. bus.$off("refreshData");
  147. },
  148. methods: {
  149. init() {
  150. bus.$on("pullData", (index) => {
  151. this.tabNum = index;
  152. this.params.status = this.tab_list[index].status;
  153. this.params.pageNum = 1;
  154. this.orderList = [];
  155. Promise.all([this.getOrder(), this.getMarker()]);
  156. });
  157. bus.$on("refreshData", () => {
  158. console.log("执行refreshData");
  159. this.params.pageNum = 1;
  160. this.orderList = [];
  161. Promise.all([this.getOrder(), this.getMarker()]);
  162. });
  163. },
  164. search() {
  165. if (this.value1 && this.value1.length) {
  166. this.params.startDate = this.$tool.formatDateTime(this.value1[0]);
  167. this.params.endtDate = this.$tool.formatDateTime(this.value1[1]);
  168. } else {
  169. this.params.startDate = "";
  170. this.params.endDate = "";
  171. }
  172. this.params.pageNum = 1;
  173. this.orderList = [];
  174. this.getOrder();
  175. },
  176. handleSizeChange(val) {
  177. this.params.pageNum = 1;
  178. this.params.pageSize = val;
  179. this.orderList = [];
  180. this.getOrder();
  181. },
  182. handleCurrentChange(val) {
  183. this.params.pageNum = val;
  184. this.orderList = [];
  185. this.getOrder();
  186. },
  187. getOrder() {
  188. let _this = this;
  189. var minute = 1000 * 60;
  190. var hour = minute * 60;
  191. var day = hour * 24;
  192. this.isLoading = true;
  193. getOrderList(this.params).then((res) => {
  194. this.isLoading = false;
  195. if (res.code == 200) {
  196. this.total = res.data.totalNums || 0;
  197. this.params.pageNum = res.data.pageNum;
  198. res.data.data.forEach((element) => {
  199. element.takeTimeTxt = this.$tool.timeago(
  200. new Date(element.takeTime).getTime()
  201. );
  202. if (_this.tabNum == 1) {
  203. if (element.exceptTime) {
  204. element.timeTxt = _this.$tool.eosFormatTime2(
  205. element.exceptTime,
  206. element.delayTime
  207. );
  208. } else {
  209. element.timeTxt = "";
  210. }
  211. }
  212. this.orderList.push(element);
  213. });
  214. } else {
  215. this.$message({
  216. message: res.msg,
  217. type: "error",
  218. });
  219. }
  220. });
  221. },
  222. getShopList() {
  223. getShopList().then((res) => {
  224. if (res.code === 200) {
  225. this.shopList = res.data.map((v) => {
  226. return { name: v.name, shopId: v.id };
  227. });
  228. this.shopList.unshift({ name: "全部", shopId: "" });
  229. } else {
  230. this.$message({
  231. type: "error",
  232. message: res.msg,
  233. });
  234. }
  235. });
  236. },
  237. },
  238. };
  239. </script>
  240. <style lang="scss" scoped="scoped">
  241. /deep/ .el-input__inner {
  242. padding-right: 30px;
  243. }
  244. .mainContent {
  245. width: 100%;
  246. .order_tab {
  247. width: 100%;
  248. background: #fff;
  249. .search {
  250. display: flex;
  251. margin-left: 20px;
  252. .header_serch {
  253. width: 80%;
  254. height: 74px;
  255. padding-right: 25px;
  256. box-sizing: border-box;
  257. display: flex;
  258. align-items: center;
  259. .Manual {
  260. width: 118px;
  261. height: 44px;
  262. background: #fc7200;
  263. border-radius: 6px;
  264. font-size: 16px;
  265. font-weight: 500;
  266. color: #ffffff;
  267. text-align: center;
  268. line-height: 44px;
  269. margin-left: 18px;
  270. }
  271. .search_inp {
  272. width: 380px;
  273. height: 44px;
  274. display: flex;
  275. align-items: center;
  276. position: relative;
  277. .inp {
  278. width: 100%;
  279. // height: 44px;
  280. border: none;
  281. }
  282. .btn {
  283. font-size: 22px;
  284. position: absolute;
  285. right: 15px;
  286. }
  287. }
  288. }
  289. }
  290. .order_list_sel {
  291. display: flex;
  292. align-items: center;
  293. margin: 0 0 10px 20px;
  294. .sel_item {
  295. display: flex;
  296. align-items: center;
  297. margin-right: 10px;
  298. .name {
  299. font-size: 14px;
  300. flex-shrink: 0;
  301. color: #999;
  302. }
  303. }
  304. }
  305. }
  306. .order_list {
  307. width: 100%;
  308. margin-top: 10px;
  309. }
  310. }
  311. </style>