group-list-search.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 class="item-box" flex="dir:left cross:center">
  21. <div class="label">团长昵称</div>
  22. <el-input size="small" @input="checkSearch()" style="width: 160px;" v-model="search.nickname" placeholder="请输入内容"></el-input>
  23. </div>
  24. <div style="height: 32px;">时间范围:</div>
  25. <el-date-picker
  26. class="item-box"
  27. size="small"
  28. @change="changeTime"
  29. v-model="search.time"
  30. type="datetimerange"
  31. value-format="yyyy-MM-dd HH:mm:ss"
  32. range-separator="至"
  33. start-placeholder="开始时间"
  34. end-placeholder="结束时间">
  35. </el-date-picker>
  36. <div v-if="isShowOrderPlugin" class="item-box" flex="dir:left cross:center">
  37. <div class="label">拼团状态</div>
  38. <el-select size="small" style="width: 160px" v-model="search.order_status" @change="toSearch" placeholder="拼团状态">
  39. <el-option v-for="item in plugins" :key="item.sign" :label="item.name"
  40. :value="item.sign">
  41. </el-option>
  42. </el-select>
  43. </div>
  44. <el-button
  45. style="float: right;margin: -10px 0 0 10px;"
  46. type="primary"
  47. size="small"
  48. @click="toSearch">搜索
  49. </el-button>
  50. <el-button
  51. style="float: right;margin: -10px 0 0 10px;"
  52. type="danger"
  53. size="small"
  54. @click="clearWhere">重置
  55. </el-button>
  56. <!-- <el-button-->
  57. <!-- style="float: right;margin: -10px 0 0 10px;"-->
  58. <!-- type="primary"-->
  59. <!-- size="small"-->
  60. <!-- @click="download">下载列表-->
  61. <!-- </el-button>-->
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. Vue.component('com-search', {
  67. template: '#com-search',
  68. props: {
  69. selectList: {
  70. type: Array,
  71. default: function () {
  72. return [
  73. {value: '1', name: '订单号'},
  74. {value: '9', name: '商户单号'},
  75. {value: '2', name: '用户名'},
  76. {value: '4', name: '用户ID'},
  77. {value: '5', name: '商品名称'},
  78. {value: '3', name: '收件人'},
  79. {value: '6', name: '收件人电话'},
  80. {value: '7', name: '门店名称'}
  81. ]
  82. }
  83. },
  84. plugins: {
  85. type: Array,
  86. default: function () {
  87. return [
  88. {
  89. name: '全部',
  90. sign: '-1',
  91. },{
  92. name: '待支付',
  93. sign: '0',
  94. },
  95. {
  96. name: '参团中',
  97. sign: '1',
  98. },
  99. {
  100. name: '拼团成功',
  101. sign: '2',
  102. },
  103. {
  104. name: '拼团失败',
  105. sign: '3',
  106. },
  107. ];
  108. }
  109. },
  110. isShowOrderType: {
  111. type: Boolean,
  112. default: true
  113. },
  114. isShowOrderPlugin: {
  115. type: Boolean,
  116. default: false
  117. },
  118. newSearch: {
  119. type: Object,
  120. default: function () {
  121. return {
  122. time: null,
  123. nickname:'',
  124. keyword_1: '1',
  125. begin_time: '',
  126. end_time: '',
  127. order_status: '选择拼团状态',
  128. }
  129. }
  130. },
  131. dateLabel: {
  132. type: String,
  133. default: '下单时间'
  134. }
  135. },
  136. data() {
  137. return {
  138. search: {},
  139. isShowClear: false,
  140. }
  141. },
  142. methods: {
  143. // 日期搜索
  144. changeTime() {
  145. if (this.search.time) {
  146. this.search.begin_time = this.search.time[0];
  147. this.search.end_time = this.search.time[1];
  148. } else {
  149. this.search.begin_time = null;
  150. this.search.end_time = null;
  151. }
  152. this.toSearch();
  153. },
  154. toSearch() {
  155. this.search.page = 1;
  156. this.$emit('search', this.search);
  157. this.checkSearch();
  158. },
  159. download() {
  160. this.search.page = 1;
  161. this.$emit('download', this.search);
  162. this.checkSearch();
  163. },
  164. //初始化搜索字段
  165. clearWhere() {
  166. this.search.nickname = '';
  167. this.search.begin_time = null;
  168. this.search.end_time = null;
  169. this.search.time = null;
  170. this.search.order_status = '选择拼团状态';
  171. this.toSearch();
  172. },
  173. // 是否显示清除按钮
  174. checkSearch() {
  175. if (this.search.nickname || (this.search.begin_time && this.search.end_time)
  176. || this.search.order_status != '选择拼团状态' ) {
  177. this.isShowClear = true;
  178. } else {
  179. this.isShowClear = false;
  180. }
  181. }
  182. },
  183. created() {
  184. // 创建一个search对象
  185. this.search = this.newSearch;
  186. this.checkSearch();
  187. }
  188. })
  189. </script>