com-search.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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 style="width: 120px;" size="small" v-model="search.platform" @change='toSearch'>-->
  35. <!-- <el-option key="all" label="全部平台" value=""></el-option>-->
  36. <!-- <el-option key="wxapp" label="微信" value="wxapp"></el-option>-->
  37. <!-- <el-option key="aliapp" label="支付宝" value="aliapp"></el-option>-->
  38. <!-- <el-option key="ttapp" label="抖音/头条" value="ttapp"></el-option>-->
  39. <!-- <el-option key="bdapp" label="百度" value="bdapp"></el-option>-->
  40. <!-- </el-select>-->
  41. <!-- </div>-->
  42. <!-- <div v-if="isShowOrderPlugin" class="item-box" flex="dir:left cross:center">
  43. <div class="label">订单类型</div>
  44. <el-select size="small" style="width: 120px" v-model="search.plugin" @change="toSearch"
  45. placeholder="订单类型">
  46. <el-option v-for="item in plugins" :key="item.sign" :label="item.name"
  47. :value="item.sign">
  48. </el-option>
  49. </el-select>
  50. </div> -->
  51. <div class="item-box" v-if="isShowOrderType" flex="dir:left cross:center">
  52. <div class="label">配送方式</div>
  53. <el-select size="small" style="width: 120px" v-model="search.send_type" @change="toSearch"
  54. placeholder="配送方式">
  55. <el-option label="全部订单" :value="-1"></el-option>
  56. <el-option label="快递配送" :value="0"></el-option>
  57. <!-- <el-option label="到店核销" :value="1"></el-option>-->
  58. <!-- <el-option label="同城配送" :value="2"></el-option>-->
  59. </el-select>
  60. </div>
  61. <div class="item-box" class="label">
  62. <el-input style="width: 350px" size="small" v-model="search.keyword" placeholder="请输入搜索内容" clearable
  63. @clear="toSearch"
  64. @keyup.enter.native="toSearch">
  65. <el-select style="width: 120px" slot="prepend" v-model="search.keyword_1">
  66. <el-option v-for="item in selectList" :key="item.value"
  67. :label="item.name"
  68. :value="item.value">
  69. </el-option>
  70. </el-select>
  71. </el-input>
  72. </div>
  73. <div class="item-box" flex="cross:center">
  74. <div v-if="isShowClear" @click="clearWhere" class="div-box clear-where">清空筛选条件</div>
  75. </div>
  76. </div>
  77. <div class="tabs">
  78. <el-tabs v-model="newActiveName" @tab-click="handleClick">
  79. <el-tab-pane v-for="(item, index) in tabs" :key="index" :label="item.name"
  80. :name="item.value"></el-tab-pane>
  81. </el-tabs>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. Vue.component('com-search', {
  87. template: '#com-search',
  88. props: {
  89. selectList: {
  90. type: Array,
  91. default: function () {
  92. return [
  93. {value: '1', name: '订单号'},
  94. {value: '9', name: '商户单号'},
  95. {value: '2', name: '用户名'},
  96. {value: '4', name: '用户ID'},
  97. {value: '5', name: '商品名称'},
  98. {value: '3', name: '收件人'},
  99. {value: '6', name: '收件人电话'},
  100. {value: '7', name: '门店名称'}
  101. ]
  102. }
  103. },
  104. tabs: {
  105. type: Array,
  106. default: function () {
  107. return [
  108. {value: '-1', name: '全部'},
  109. {value: '0', name: '未付款'},
  110. {value: '8', name: '拼单中'},
  111. {value: '1', name: '待发货'},
  112. {value: '2', name: '待收货'},
  113. {value: '3', name: '已完成'},
  114. {value: '4', name: '待处理'},
  115. {value: '5', name: '已取消'},
  116. {value: '7', name: '回收站'},
  117. ]
  118. }
  119. },
  120. activeName: {
  121. type: String,
  122. default: '-1',
  123. },
  124. plugins: {
  125. type: Array,
  126. default: function () {
  127. return [
  128. {
  129. name: '全部订单',
  130. sign: 'all',
  131. }
  132. ];
  133. }
  134. },
  135. isShowOrderType: {
  136. type: Boolean,
  137. default: true
  138. },
  139. isShowOrderPlugin: {
  140. type: Boolean,
  141. default: false
  142. },
  143. newSearch: {
  144. type: Object,
  145. default: function () {
  146. return {
  147. time: null,
  148. keyword: '',
  149. keyword_1: '1',
  150. date_start: '',
  151. date_end: '',
  152. platform: '',
  153. status: '',
  154. plugin: 'all',
  155. send_type: -1,
  156. }
  157. }
  158. },
  159. dateLabel: {
  160. type: String,
  161. default: '下单时间'
  162. }
  163. },
  164. data() {
  165. return {
  166. search: {},
  167. newActiveName: null,
  168. isShowClear: false,
  169. }
  170. },
  171. methods: {
  172. // 日期搜索
  173. changeTime() {
  174. if (this.search.time) {
  175. this.search.date_start = this.search.time[0];
  176. this.search.date_end = this.search.time[1];
  177. } else {
  178. this.search.date_start = null;
  179. this.search.date_end = null;
  180. }
  181. this.toSearch();
  182. },
  183. toSearch() {
  184. this.search.page = 1;
  185. this.$emit('search', this.search);
  186. this.checkSearch();
  187. },
  188. handleClick(res) {
  189. if(this.newActiveName==8){
  190. this.search.status = '1';
  191. this.search.active_status = 1;
  192. this.$set(this.search, `status`, '1')
  193. this.$set(this.search, `active_status`, 1)
  194. }else if(this.newActiveName==1){
  195. this.search.status = '1';
  196. this.search.active_status = 2;
  197. this.$set(this.search, `status`, '1')
  198. this.$set(this.search, `active_status`, 2)
  199. }else{
  200. this.search.status = this.newActiveName;
  201. this.$set(this.search, `status`, this.newActiveName)
  202. this.search.active_status?delete this.search.active_status:'';
  203. }
  204. // console.log(this.search.status);
  205. // return
  206. this.toSearch();
  207. },
  208. clearWhere() {
  209. this.search.keyword = '';
  210. this.search.date_start = null;
  211. this.search.date_end = null;
  212. this.search.time = null;
  213. this.search.platform = '';
  214. this.search.send_type = -1;
  215. this.search.plugin = 'all';
  216. this.toSearch();
  217. },
  218. checkSearch() {
  219. if (this.search.keyword || (this.search.date_start && this.search.date_end)
  220. || this.search.plugin != 'all' || this.search.send_type != -1
  221. || this.search.platform) {
  222. this.isShowClear = true;
  223. } else {
  224. this.isShowClear = false;
  225. }
  226. }
  227. },
  228. created() {
  229. this.search = this.newSearch;
  230. this.newActiveName = this.activeName;
  231. this.checkSearch();
  232. }
  233. })
  234. </script>