com-search.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <style>
  2. .com-search .tabs {
  3. margin-top: 20px;
  4. }
  5. .com-search .label {
  6. margin-right: 10px;
  7. }
  8. .com-search .item-box {
  9. margin-bottom: 10px;
  10. margin-right: 15px;
  11. }
  12. .com-search .clear-where {
  13. color: #419EFB;
  14. cursor: pointer;
  15. }
  16. </style>
  17. <template id="com-search">
  18. <div class="com-search">
  19. <div flex="wrap:wrap cross:center">
  20. <div style="height: 32px;">{{dateLabel}}:</div>
  21. <el-date-picker
  22. class="item-box"
  23. size="small"
  24. @change="changeTime"
  25. v-model="search.time"
  26. type="datetimerange"
  27. value-format="yyyy-MM-dd HH:mm:ss"
  28. range-separator="至"
  29. start-placeholder="开始日期"
  30. end-placeholder="结束日期">
  31. </el-date-picker>
  32. <div class="item-box" flex="dir:left cross:center">
  33. <div class="label">选择门店</div>
  34. <el-select size="small" style="width: 120px" v-model="search.store_id" @change="toSearch">
  35. <el-option label="全部" value="-99"></el-option>
  36. <el-option v-for="item in storeList" :key="item.id" :label="item.name"
  37. :value="item.id">
  38. </el-option>
  39. </el-select>
  40. </div>
  41. <div class="item-box" v-if="isShowOrderType" flex="dir:left cross:center">
  42. <div class="label">配送方式</div>
  43. <el-select size="small" style="width: 120px" v-model="search.send_type" @change="toSearch"
  44. placeholder="配送方式">
  45. <el-option label="全部订单" :value="-1"></el-option>
  46. <el-option label="快递配送" :value="0"></el-option>
  47. <el-option label="到店自提" :value="1"></el-option>
  48. <!-- <el-option label="同城配送" :value="2"></el-option>-->
  49. </el-select>
  50. </div>
  51. <div class="item-box" class="label">
  52. <el-input style="width: 350px" size="small" v-model="search.keyword" placeholder="请输入搜索内容" clearable
  53. @clear="toSearch"
  54. @keyup.enter.native="toSearch">
  55. <el-select style="width: 120px" slot="prepend" v-model="search.keyword_1">
  56. <el-option v-for="item in selectList" :key="item.value"
  57. :label="item.name"
  58. :value="item.value">
  59. </el-option>
  60. </el-select>
  61. </el-input>
  62. </div>
  63. <div class="item-box" flex="cross:center">
  64. <div v-if="isShowClear" @click="clearWhere" class="div-box clear-where">清空筛选条件</div>
  65. </div>
  66. </div>
  67. <div class="tabs">
  68. <el-tabs v-model="newActiveName" @tab-click="handleClick">
  69. <el-tab-pane v-for="(item, index) in tabs" :key="index" :label="item.name"
  70. :name="item.value"></el-tab-pane>
  71. </el-tabs>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. Vue.component('com-search', {
  77. template: '#com-search',
  78. props: {
  79. selectList: {
  80. type: Array,
  81. default: function () {
  82. return [
  83. {value: '1', name: '订单号'},
  84. {value: '9', name: '商户单号'},
  85. {value: '2', name: '用户名'},
  86. {value: '4', name: '用户ID'},
  87. {value: '5', name: '商品名称'},
  88. {value: '3', name: '收件人'},
  89. {value: '6', name: '收件人电话'},
  90. {value: '7', name: '门店名称'}
  91. ]
  92. }
  93. },
  94. tabs: {
  95. type: Array,
  96. default: function () {
  97. return [
  98. {value: '-1', name: '全部'},
  99. {value: '0', name: '未付款'},
  100. {value: '1', name: '待发货'},
  101. {value: '2', name: '待收货'},
  102. {value: '3', name: '已完成'},
  103. {value: '4', name: '待处理'},
  104. {value: '5', name: '已取消'},
  105. {value: '7', name: '回收站'},
  106. ]
  107. }
  108. },
  109. activeName: {
  110. type: String,
  111. default: '-1',
  112. },
  113. plugins: {
  114. type: Array,
  115. default: function () {
  116. return [
  117. {
  118. name: '全部订单',
  119. sign: 'all',
  120. }
  121. ];
  122. }
  123. },
  124. isShowOrderType: {
  125. type: Boolean,
  126. default: true
  127. },
  128. isShowOrderPlugin: {
  129. type: Boolean,
  130. default: false
  131. },
  132. newSearch: {
  133. type: Object,
  134. default: function () {
  135. return {
  136. time: null,
  137. keyword: '',
  138. keyword_1: '1',
  139. date_start: '',
  140. date_end: '',
  141. platform: '',
  142. status: '',
  143. plugin: 'all',
  144. send_type: -1,
  145. }
  146. }
  147. },
  148. dateLabel: {
  149. type: String,
  150. default: '下单时间'
  151. }
  152. },
  153. data() {
  154. return {
  155. search: {},
  156. newActiveName: null,
  157. isShowClear: false,
  158. storeList: []
  159. }
  160. },
  161. methods: {
  162. getStoreList() {
  163. request({
  164. params: {
  165. r: 'plugin/o2o_store/mall/store/all'
  166. // status: 1
  167. },
  168. }).then(e => {
  169. if (e.data.code === 0) {
  170. this.storeList = e.data.data;
  171. }
  172. })
  173. },
  174. // 日期搜索
  175. changeTime() {
  176. if (this.search.time) {
  177. this.search.date_start = this.search.time[0];
  178. this.search.date_end = this.search.time[1];
  179. } else {
  180. this.search.date_start = null;
  181. this.search.date_end = null;
  182. }
  183. this.toSearch();
  184. },
  185. toSearch() {
  186. this.search.page = 1;
  187. this.$emit('search', this.search);
  188. this.checkSearch();
  189. },
  190. handleClick(res) {
  191. this.search.status = this.newActiveName;
  192. this.toSearch();
  193. },
  194. clearWhere() {
  195. this.search.keyword = '';
  196. this.search.date_start = null;
  197. this.search.date_end = null;
  198. this.search.time = null;
  199. this.search.platform = '';
  200. this.search.send_type = -1;
  201. this.search.plugin = 'all';
  202. this.toSearch();
  203. },
  204. checkSearch() {
  205. if (this.search.keyword || (this.search.date_start && this.search.date_end)
  206. || this.search.plugin != 'all' || this.search.send_type != -1
  207. || this.search.platform) {
  208. this.isShowClear = true;
  209. } else {
  210. this.isShowClear = false;
  211. }
  212. }
  213. },
  214. created() {
  215. this.search = this.newSearch;
  216. this.newActiveName = this.activeName;
  217. this.checkSearch();
  218. this.getStoreList();
  219. }
  220. })
  221. </script>