index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <div class="mine">
  3. <div class="condition">
  4. <el-date-picker
  5. v-model="dates"
  6. type="daterange"
  7. range-separator="->"
  8. start-placeholder="开始日期"
  9. end-placeholder="结束日期"
  10. ></el-date-picker>
  11. <el-input placeholder="请输入项目" class="search" v-model="product">
  12. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  13. </el-input>
  14. <el-input placeholder="请输入优惠券" class="search" v-model="coupon">
  15. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  16. </el-input>
  17. <el-input placeholder="请输入内容" class="search" v-model="searchText">
  18. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  19. </el-input>
  20. <el-button type="primary" class="searchButton" @click="getOrderList()"
  21. >搜索</el-button
  22. >
  23. </div>
  24. <div class="user-list">
  25. <el-table
  26. ref="multipleTable"
  27. :data="tableData"
  28. tooltip-effect="dark"
  29. height="500"
  30. style="width: 100%; border-radius: 8px"
  31. @row-click="handleSelectionChange"
  32. >
  33. <el-table-column label="头像" width="120">
  34. <template slot-scope="scope">
  35. <div class="head-img">
  36. <img :src="scope.row.avatar_url" alt />
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="user_id" label="用户ID" width="120"></el-table-column>
  41. <el-table-column
  42. prop="nickname"
  43. label="昵称"
  44. width="120"
  45. ></el-table-column>
  46. <el-table-column
  47. prop="mobile"
  48. label="联系电话"
  49. show-overflow-tooltip
  50. ></el-table-column>
  51. <el-table-column
  52. prop="order_time"
  53. label="预约时间"
  54. show-overflow-tooltip
  55. ></el-table-column>
  56. <el-table-column prop="date" label="状态" show-overflow-tooltip>
  57. <template slot-scope="scope">
  58. <div
  59. :style="
  60. scope.row.status == 0
  61. ? 'color: #FC3019'
  62. : scope.row.status == 5
  63. ? 'color: #A999EA'
  64. : 'color: #61D09D;'
  65. "
  66. >
  67. {{
  68. scope.row.status == 0
  69. ? "未支付"
  70. : scope.row.status == 5
  71. ? "已取消"
  72. : scope.row.status == 1
  73. ? "待使用"
  74. : scope.row.status == 2
  75. ? "正在使用"
  76. : scope.row.status == 3
  77. ? "已结算"
  78. : ""
  79. }}
  80. </div>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. <div class="pagin">
  85. <el-pagination
  86. background
  87. layout="prev, pager, next"
  88. @size-change="handleSizeChange"
  89. @current-change="handleCurrentChange"
  90. :current-page.sync="currentPage1"
  91. :total="total"
  92. ></el-pagination>
  93. </div>
  94. </div>
  95. </div>
  96. </template>
  97. <script>
  98. import api from "../../server/home";
  99. export default {
  100. components: {},
  101. data() {
  102. return {
  103. searchText: "",
  104. dates: "",
  105. coupon: "",
  106. limit: 10,
  107. total: 0,
  108. product: "",
  109. coupon: "",
  110. couponList: [
  111. {
  112. value: "选项1",
  113. label: "黄金糕",
  114. },
  115. {
  116. value: "选项2",
  117. label: "双皮奶",
  118. },
  119. ],
  120. tableData: [
  121. {
  122. date: "2022.04.25 14:30",
  123. name: "滴滴滴",
  124. headImg:
  125. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png",
  126. phone: "13346783645",
  127. status: "已完成",
  128. },
  129. {
  130. date: "2022.04.25 14:30",
  131. name: "滴滴滴",
  132. headImg:
  133. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png",
  134. phone: "13346783645",
  135. status: "已完成",
  136. },
  137. ],
  138. currentPage1: 1,
  139. multipleSelection: "",
  140. };
  141. },
  142. computed: {},
  143. watch: {},
  144. methods: {
  145. // 获取订单列表
  146. getOrderList() {
  147. let start_date = "",
  148. end_date = "";
  149. if (this.dates && this.dates.length > 0) {
  150. start_date = utils.formatTime(this.dates[0], "yyyy-MM-dd");
  151. end_date = utils.formatTime(this.dates[1], "yyyy-MM-dd");
  152. }
  153. let params = {
  154. page: this.currentPage1,
  155. limit: this.limit,
  156. keywords: this.searchText,
  157. project_name: this.product,
  158. coupon_name: this.coupon,
  159. start_date: start_date,
  160. end_date: end_date,
  161. };
  162. api.getOrderList(params).then((res) => {
  163. if (res.code == 200) {
  164. // 将用户手机号中间四位变成****
  165. res.data.list.map((item) => {
  166. item.mobile =
  167. item.mobile.substring(0, 3) + "****" + item.mobile.substring(7);
  168. });
  169. this.tableData = res.data.list;
  170. this.total = res.data.total;
  171. }
  172. });
  173. },
  174. handleCurrentChange(e) {
  175. this.currentPage1 = e;
  176. this.getOrderList();
  177. },
  178. handleSizeChange(val) {},
  179. handleSelectionChange(row, column, event) {
  180. this.$router.push({
  181. path: "/historicalOrder/details",
  182. query: {
  183. id: row.id,
  184. },
  185. });
  186. },
  187. },
  188. created() {
  189. this.getOrderList();
  190. },
  191. mounted() {},
  192. };
  193. </script>
  194. <style lang='less' scoped>
  195. .mine {
  196. .condition {
  197. display: flex;
  198. .coupon-select {
  199. width: 174px;
  200. margin-left: 18px;
  201. }
  202. .search {
  203. width: 152px;
  204. margin-left: 18px;
  205. }
  206. .searchButton {
  207. margin-left: 18px;
  208. width: 68px;
  209. background: #fa7d22;
  210. border-radius: 2px;
  211. border-color: #fa7d22;
  212. }
  213. }
  214. .user-list {
  215. margin-top: 18px;
  216. padding: 0 12px;
  217. width: 100%;
  218. background: #ffffff;
  219. box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
  220. border-radius: 8px;
  221. .head-img {
  222. width: 36px;
  223. height: 36px;
  224. border-radius: 50%;
  225. img {
  226. width: 100%;
  227. height: 100%;
  228. }
  229. }
  230. .pagin {
  231. padding: 20px 0;
  232. .el-pagination {
  233. text-align: center;
  234. }
  235. }
  236. /deep/ .el-table th > .cell {
  237. font-size: 14px !important;
  238. font-family: PingFangSC-Regular, PingFang SC;
  239. font-weight: 400;
  240. color: #999999;
  241. line-height: 20px;
  242. }
  243. /deep/ .el-table td,
  244. .el-table th.is-leaf {
  245. border-bottom: none;
  246. }
  247. }
  248. .color0 {
  249. color: #fc3019;
  250. }
  251. .color1 {
  252. color: #3ef3ed;
  253. }
  254. .color2 {
  255. color: #00eeee;
  256. }
  257. .color3 {
  258. color: #61d09d;
  259. }
  260. .color4 {
  261. color: #3115cc;
  262. }
  263. .color5 {
  264. color: #fc3019;
  265. }
  266. .color6 {
  267. color: #a999ea;
  268. }
  269. }
  270. </style>