index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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 @click.stop="goUserDetail(scope.row)" class="head-img">
  36. <img :src="scope.row.avatar_url" alt />
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column
  41. prop="user_id"
  42. label="用户ID"
  43. width="80"
  44. ></el-table-column>
  45. <el-table-column
  46. prop="real_name"
  47. label="真实姓名"
  48. width="100"
  49. ></el-table-column>
  50. <el-table-column
  51. prop="nickname"
  52. label="昵称"
  53. width="120"
  54. ></el-table-column>
  55. <el-table-column
  56. prop="mobile"
  57. label="联系电话"
  58. show-overflow-tooltip
  59. ></el-table-column>
  60. <el-table-column
  61. prop="order_time"
  62. label="预约时间"
  63. show-overflow-tooltip
  64. ></el-table-column>
  65. <el-table-column prop="date" label="状态" show-overflow-tooltip>
  66. <template slot-scope="scope">
  67. <div
  68. :style="
  69. scope.row.status == 0
  70. ? 'color: #FC3019'
  71. : scope.row.status == 5
  72. ? 'color: #A999EA'
  73. : 'color: #61D09D;'
  74. "
  75. >
  76. {{
  77. scope.row.status == 0
  78. ? "未支付"
  79. : scope.row.status == 5
  80. ? "已取消"
  81. : scope.row.status == 1
  82. ? "待使用"
  83. : scope.row.status == 2
  84. ? "正在使用"
  85. : scope.row.status == 3
  86. ? "已结算"
  87. : ""
  88. }}
  89. </div>
  90. </template>
  91. </el-table-column>
  92. <el-table-column
  93. width="80"
  94. prop="realname"
  95. label="美容师"
  96. show-overflow-tooltip
  97. ></el-table-column>
  98. <el-table-column
  99. class="amendTop"
  100. width="140"
  101. prop=""
  102. label="分配"
  103. show-overflow-tooltip
  104. v-if="level == 10"
  105. >
  106. <template slot-scope="scope">
  107. <el-dropdown
  108. @command="(command) => selectType(command, scope.$index)"
  109. trigger="click"
  110. >
  111. <el-button @click.stop type="primary" class="amend" size="mini">
  112. 分配
  113. </el-button>
  114. <el-dropdown-menu slot="dropdown">
  115. <el-dropdown-item
  116. v-for="(item, index) in nameList"
  117. :key="index"
  118. :command="item.realname"
  119. >{{ item.realname }}</el-dropdown-item
  120. >
  121. </el-dropdown-menu>
  122. </el-dropdown>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <div class="pagin">
  127. <el-pagination
  128. background
  129. layout="prev, pager, next"
  130. @size-change="handleSizeChange"
  131. @current-change="handleCurrentChange"
  132. :current-page.sync="currentPage1"
  133. :total="total"
  134. ></el-pagination>
  135. </div>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import api from "../../server/home";
  141. export default {
  142. components: {},
  143. data() {
  144. return {
  145. searchText: "",
  146. dates: "",
  147. coupon: "",
  148. limit: 10,
  149. total: 0,
  150. product: "",
  151. coupon: "",
  152. couponList: [
  153. {
  154. value: "选项1",
  155. label: "黄金糕",
  156. },
  157. {
  158. value: "选项2",
  159. label: "双皮奶",
  160. },
  161. ],
  162. tableData: [
  163. {
  164. date: "2022.04.25 14:30",
  165. name: "滴滴滴",
  166. headImg:
  167. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png",
  168. phone: "13346783645",
  169. status: "已完成",
  170. },
  171. {
  172. date: "2022.04.25 14:30",
  173. name: "滴滴滴",
  174. headImg:
  175. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png",
  176. phone: "13346783645",
  177. status: "已完成",
  178. },
  179. ],
  180. currentPage1: 1,
  181. multipleSelection: "",
  182. nameList: "", //员工列表
  183. level: "",
  184. };
  185. },
  186. computed: {},
  187. watch: {},
  188. methods: {
  189. // 跳入用户详情
  190. goUserDetail(e) {
  191. console.log(e);
  192. this.$router.push({
  193. path: "/customerMan/details",
  194. query: {
  195. id: e.user_id,
  196. },
  197. });
  198. },
  199. // 分配美容师
  200. selectType(type, index) {
  201. // 给表单添加美容师
  202. this.$set(this.tableData[index], ["realname"], type);
  203. let user_id = "";
  204. this.nameList.map((item) => {
  205. if (item.realname == type) {
  206. user_id = item.id;
  207. }
  208. });
  209. let order_id = this.tableData[index].id;
  210. let params = {
  211. user_id,
  212. type: 1, //1项目 2次卡 3美妆产品 4充值
  213. order_id,
  214. };
  215. // 店长分配
  216. api.orderAllocation(params).then((res) => {
  217. if (res.code == 200) {
  218. }
  219. });
  220. },
  221. // 获取订单列表
  222. getOrderList() {
  223. let start_date = "",
  224. end_date = "";
  225. if (this.dates && this.dates.length > 0) {
  226. start_date = utils.formatTime(this.dates[0], "yyyy-MM-dd");
  227. end_date = utils.formatTime(this.dates[1], "yyyy-MM-dd");
  228. }
  229. let params = {
  230. page: this.currentPage1,
  231. limit: this.limit,
  232. keywords: this.searchText,
  233. project_name: this.product,
  234. coupon_name: this.coupon,
  235. start_date: start_date,
  236. end_date: end_date,
  237. };
  238. api.getOrderList(params).then((res) => {
  239. if (res.code == 200) {
  240. // 将用户手机号中间四位变成****
  241. res.data.list.map((item) => {
  242. item.mobile =
  243. item.mobile.substring(0, 3) + "****" + item.mobile.substring(7);
  244. });
  245. this.tableData = res.data.list;
  246. this.total = res.data.total;
  247. }
  248. });
  249. },
  250. handleCurrentChange(e) {
  251. this.currentPage1 = e;
  252. this.getOrderList();
  253. },
  254. handleSizeChange(val) {},
  255. handleSelectionChange(row, column, event) {
  256. this.$router.push({
  257. path: "/historicalOrder/details",
  258. query: {
  259. id: row.id,
  260. },
  261. });
  262. },
  263. // 获取美容师列表
  264. getStaffList() {
  265. api.getStaffList().then((res) => {
  266. if (res.code == 200) {
  267. this.nameList = res.data;
  268. }
  269. });
  270. },
  271. },
  272. created() {
  273. this.level = localStorage.getItem("level");
  274. this.getOrderList();
  275. // 获取员工列表
  276. this.getStaffList();
  277. },
  278. mounted() {},
  279. };
  280. </script>
  281. <style lang='less' scoped>
  282. .mine {
  283. .condition {
  284. display: flex;
  285. .coupon-select {
  286. width: 174px;
  287. margin-left: 18px;
  288. }
  289. .search {
  290. width: 152px;
  291. margin-left: 18px;
  292. }
  293. .searchButton {
  294. margin-left: 18px;
  295. width: 68px;
  296. background: #fa7d22;
  297. border-radius: 2px;
  298. border-color: #fa7d22;
  299. }
  300. }
  301. .user-list {
  302. margin-top: 18px;
  303. padding: 0 12px;
  304. width: 100%;
  305. background: #ffffff;
  306. box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
  307. border-radius: 8px;
  308. .head-img {
  309. width: 36px;
  310. height: 36px;
  311. border-radius: 50%;
  312. img {
  313. width: 100%;
  314. height: 100%;
  315. }
  316. }
  317. .pagin {
  318. padding: 20px 0;
  319. .el-pagination {
  320. text-align: center;
  321. }
  322. }
  323. /deep/ .el-table th > .cell {
  324. font-size: 14px !important;
  325. font-family: PingFangSC-Regular, PingFang SC;
  326. font-weight: 400;
  327. color: #999999;
  328. line-height: 20px;
  329. }
  330. /deep/ .el-table td,
  331. .el-table th.is-leaf {
  332. border-bottom: none;
  333. }
  334. .amend {
  335. background-color: #fa7d22;
  336. color: white;
  337. font-size: 14px;
  338. border: #fa7d22;
  339. }
  340. /deep/ th.el-table_1_column_7.is-leaf.el-table__cell {
  341. text-align: center;
  342. }
  343. /deep/ td.el-table_1_column_7.el-table__cell {
  344. text-align: center;
  345. }
  346. }
  347. .color0 {
  348. color: #fc3019;
  349. }
  350. .color1 {
  351. color: #3ef3ed;
  352. }
  353. .color2 {
  354. color: #00eeee;
  355. }
  356. .color3 {
  357. color: #61d09d;
  358. }
  359. .color4 {
  360. color: #3115cc;
  361. }
  362. .color5 {
  363. color: #fc3019;
  364. }
  365. .color6 {
  366. color: #a999ea;
  367. }
  368. }
  369. </style>