index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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="searchText">
  12. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  13. </el-input>
  14. <el-button type="primary" class="searchButton" @click="getOrderList()"
  15. >搜索</el-button
  16. >
  17. </div>
  18. <div class="user-list">
  19. <el-table
  20. ref="multipleTable"
  21. :data="tableData"
  22. tooltip-effect="dark"
  23. height="500"
  24. style="width: 100%; border-radius: 8px"
  25. @row-click="handleSelectionChange"
  26. >
  27. <el-table-column label="头像" width="60">
  28. <template slot-scope="scope">
  29. <div @click.stop="goUserDetail(scope.row)" class="head-img">
  30. <img :src="scope.row.avatar_url" alt />
  31. </div>
  32. </template>
  33. </el-table-column>
  34. <el-table-column
  35. prop="nickname"
  36. label="昵称"
  37. width="120"
  38. ></el-table-column>
  39. <el-table-column
  40. prop="real_name"
  41. label="真实姓名"
  42. width="80"
  43. ></el-table-column>
  44. <el-table-column
  45. prop="mobile"
  46. label="联系电话"
  47. show-overflow-tooltip
  48. ></el-table-column>
  49. <el-table-column
  50. prop="create_time"
  51. label="下单时间"
  52. show-overflow-tooltip
  53. ></el-table-column>
  54. <el-table-column
  55. prop="date"
  56. label="订单状态"
  57. show-overflow-tooltip
  58. width="100"
  59. >
  60. <template slot-scope="scope">
  61. <div
  62. :style="
  63. scope.row.status == 2 || scope.row.status == 3
  64. ? 'color: #61D09D;'
  65. : scope.row.status == 5
  66. ? 'color: #A999EA'
  67. : 'color: #A999EA'
  68. "
  69. >
  70. {{
  71. scope.row.status == 2 || scope.row.status == 3
  72. ? "已取货"
  73. : scope.row.status == 1
  74. ? "待取货"
  75. : ""
  76. }}
  77. <!-- 1是待取货 2,3是已取货 -1已取消,0待支付-->
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column
  82. width="100"
  83. prop="cosmeticianName"
  84. label="美容师"
  85. show-overflow-tooltip
  86. ></el-table-column>
  87. <el-table-column
  88. class="amendTop"
  89. width="80"
  90. prop=""
  91. label="分配"
  92. show-overflow-tooltip
  93. v-if="level == 10"
  94. >
  95. <template slot-scope="scope">
  96. <el-button
  97. @click.stop="selectType(scope.row)"
  98. type="primary"
  99. class="amend"
  100. size="mini"
  101. >
  102. 分配
  103. </el-button>
  104. </template>
  105. </el-table-column>
  106. </el-table>
  107. <div class="pagin">
  108. <el-pagination
  109. background
  110. layout="prev, pager, next"
  111. @size-change="handleSizeChange"
  112. @current-change="handleCurrentChange"
  113. :current-page.sync="currentPage1"
  114. :total="total"
  115. ></el-pagination>
  116. </div>
  117. </div>
  118. <minePupop :show="selectPup">
  119. <div class="selectBox">
  120. <div class="image">
  121. <img
  122. src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
  123. alt
  124. @click="closeSelect"
  125. />
  126. </div>
  127. <div class="selectTitle">分配美容师</div>
  128. <div class="selectFinish">
  129. <div class="selecrFinishTop">分配给:</div>
  130. <div class="selecrFinishBottom">
  131. <div
  132. class="item"
  133. v-for="(item, index) in selectNameList"
  134. :key="index"
  135. @click="delectCosmetician(item)"
  136. >
  137. {{ item.realname }}
  138. <img
  139. src="https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/icon/slices/delete.png"
  140. alt=""
  141. />
  142. </div>
  143. </div>
  144. </div>
  145. <div class="selectList">
  146. <div class="selecrListTop">可选择:</div>
  147. <div class="selecrListBottom">
  148. <div
  149. class="item"
  150. @click="selectCosmetician(item)"
  151. v-for="(item, index) in nameList"
  152. :key="index"
  153. >
  154. {{ item.realname }}
  155. </div>
  156. </div>
  157. </div>
  158. <div class="selectBox-btn" @click="confirmSelect">确认</div>
  159. </div>
  160. </minePupop>
  161. </div>
  162. </template>
  163. <script>
  164. import api from "../../server/home";
  165. import minePupop from "../../components/minePupop/index.vue";
  166. export default {
  167. components: { minePupop },
  168. data() {
  169. return {
  170. level: "", //等级权限
  171. searchText: "",
  172. dates: "",
  173. coupon: "",
  174. limit: 10,
  175. total: 0,
  176. product: "",
  177. coupon: "",
  178. couponList: [
  179. {
  180. value: "选项1",
  181. label: "黄金糕",
  182. },
  183. {
  184. value: "选项2",
  185. label: "双皮奶",
  186. },
  187. ],
  188. tableData: [
  189. {
  190. date: "2022.04.25 14:30",
  191. name: "滴滴滴",
  192. headImg:
  193. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png",
  194. phone: "13346783645",
  195. status: "已完成",
  196. },
  197. {
  198. date: "2022.04.25 14:30",
  199. name: "滴滴滴",
  200. headImg:
  201. "https://we-spa.oss-cn-shenzhen.aliyuncs.com/pad_clerk/home/unpaid.png",
  202. phone: "13346783645",
  203. status: "已完成",
  204. },
  205. ],
  206. currentPage1: 1,
  207. multipleSelection: "",
  208. nameListAll: [],
  209. nameList: [], //员工列表
  210. selectNameList: [], //已选员工列表
  211. level: "", //店员等级
  212. selectPup: false, //分配弹窗
  213. order_id: "", //订单ID
  214. };
  215. },
  216. computed: {},
  217. watch: {},
  218. methods: {
  219. // 跳入用户详情
  220. goUserDetail(e) {
  221. console.log(e);
  222. this.$router.push({
  223. path: "/customerMan/details",
  224. query: {
  225. id: e.user_id,
  226. },
  227. });
  228. },
  229. // 关闭分配弹窗
  230. closeSelect() {
  231. this.selectPup = false;
  232. },
  233. // 选择美容师
  234. selectCosmetician(e) {
  235. this.selectNameList.push(e);
  236. this.nameList.forEach((item, index) => {
  237. if (item.id == e.id) {
  238. console.log(index);
  239. this.nameList.splice(index, 1);
  240. }
  241. });
  242. },
  243. // 删除美容师
  244. delectCosmetician(e) {
  245. this.nameList.push(e);
  246. this.selectNameList.forEach((item, index) => {
  247. if (item.id == e.id) {
  248. this.selectNameList.splice(index, 1);
  249. }
  250. });
  251. },
  252. // 打开分配弹窗
  253. selectType(e) {
  254. this.selectPup = true;
  255. this.order_id = e.id;
  256. this.nameList = JSON.parse(JSON.stringify(this.nameListAll)); //重置数据
  257. this.selectNameList = []; //重置数据
  258. // 筛选出已分配的美容师
  259. if (e.assign) {
  260. e.assign.forEach((item, index) => {
  261. this.nameList.forEach((item1, index1) => {
  262. if (item.id == item1.id) {
  263. this.selectNameList.push(item);
  264. this.nameList.splice(index1, 1);
  265. }
  266. });
  267. });
  268. }
  269. },
  270. // 分配美容师
  271. confirmSelect() {
  272. let user_id = [];
  273. this.selectNameList.forEach((item) => {
  274. user_id.push(item.id);
  275. });
  276. let params = {
  277. user_id: user_id.toString(),
  278. type: 1, //1项目 2次卡 3美妆产品 4充值
  279. order_id: this.order_id,
  280. };
  281. // 店长分配
  282. api.orderAllocation(params).then((res) => {
  283. if (res.code == 200) {
  284. this.selectPup = false;
  285. this.getOrderList();
  286. }
  287. });
  288. },
  289. // 获取订单列表
  290. getOrderList() {
  291. let start_date = "",
  292. end_date = "";
  293. if (this.dates && this.dates.length > 0) {
  294. start_date = utils.formatTime(this.dates[0], "yyyy-MM-dd");
  295. end_date = utils.formatTime(this.dates[1], "yyyy-MM-dd");
  296. }
  297. let params = {
  298. page: this.currentPage1,
  299. limit: this.limit,
  300. keywords: this.searchText,
  301. start_time: start_date,
  302. end_time: end_date,
  303. };
  304. api.getGoodsOrderList(params).then((res) => {
  305. if (res.code == 200) {
  306. // 将用户手机号中间四位变成****
  307. res.data.list.map((item) => {
  308. item.mobile =
  309. item.mobile.substring(0, 3) + "****" + item.mobile.substring(7);
  310. // 整理已选的美容师
  311. if (item.assign) {
  312. let nameList = [];
  313. let cosmeticianName = [];
  314. item.assign.forEach((item1) => {
  315. console.log(item1);
  316. let list = {};
  317. list.realname = item1.realname;
  318. list.id = item1.suser_id;
  319. nameList.push(list);
  320. cosmeticianName.push(item1.realname);
  321. });
  322. item.assign = nameList;
  323. item.cosmeticianName = cosmeticianName.toString();
  324. }
  325. });
  326. this.tableData = res.data.list;
  327. this.total = res.data.total;
  328. }
  329. });
  330. },
  331. handleCurrentChange(e) {
  332. this.currentPage1 = e;
  333. this.getOrderList();
  334. console.log(this.tableData);
  335. },
  336. handleSizeChange(val) {},
  337. handleSelectionChange(row, column, event) {
  338. // this.$router.push({
  339. // path: "/productOrder/details",
  340. // query: {
  341. // id: row.id,
  342. // },
  343. // });
  344. },
  345. // 获取美容师列表
  346. getStaffList() {
  347. api.getStaffList().then((res) => {
  348. if (res.code == 200) {
  349. this.nameList = res.data;
  350. this.nameListAll = JSON.parse(JSON.stringify(res.data))
  351. }
  352. });
  353. },
  354. },
  355. created() {
  356. this.level = localStorage.getItem("level");
  357. this.getOrderList();
  358. // 获取员工列表
  359. this.getStaffList();
  360. },
  361. mounted() {},
  362. };
  363. </script>
  364. <style lang='less' scoped>
  365. .mine {
  366. .condition {
  367. display: flex;
  368. .coupon-select {
  369. width: 174px;
  370. margin-left: 18px;
  371. }
  372. .search {
  373. width: 535px;
  374. margin-left: 18px;
  375. }
  376. .searchButton {
  377. margin-left: 18px;
  378. width: 68px;
  379. background: #fa7d22;
  380. border-radius: 2px;
  381. border-color: #fa7d22;
  382. }
  383. }
  384. .user-list {
  385. margin-top: 18px;
  386. padding: 0 12px;
  387. width: 100%;
  388. background: #ffffff;
  389. box-shadow: 0px 2px 4px 0px rgba(184, 191, 198, 0.2);
  390. border-radius: 8px;
  391. .head-img {
  392. width: 36px;
  393. height: 36px;
  394. border-radius: 50%;
  395. img {
  396. width: 100%;
  397. height: 100%;
  398. }
  399. }
  400. .pagin {
  401. padding: 20px 0;
  402. .el-pagination {
  403. text-align: center;
  404. }
  405. }
  406. /deep/ .el-table th > .cell {
  407. font-size: 14px !important;
  408. font-family: PingFangSC-Regular, PingFang SC;
  409. font-weight: 400;
  410. color: #999999;
  411. line-height: 20px;
  412. }
  413. /deep/ .el-table td,
  414. .el-table th.is-leaf {
  415. border-bottom: none;
  416. }
  417. .amend {
  418. background-color: #fa7d22;
  419. color: white;
  420. font-size: 14px;
  421. border: #fa7d22;
  422. }
  423. /deep/ th.el-table_1_column_7.is-leaf.el-table__cell {
  424. text-align: center;
  425. }
  426. /deep/ td.el-table_1_column_7.el-table__cell {
  427. text-align: center;
  428. }
  429. }
  430. // 分配弹窗
  431. .selectBox {
  432. width: 540px;
  433. height: 400px;
  434. background: #ffffff;
  435. border-radius: 8px;
  436. padding-left: 40px;
  437. position: relative;
  438. .image {
  439. height: 30px;
  440. width: 100%;
  441. display: flex;
  442. justify-content: flex-end;
  443. margin-top: 5px;
  444. margin-right: 5px;
  445. img {
  446. width: 30px;
  447. }
  448. }
  449. .selectTitle {
  450. font-size: 14px;
  451. color: #333;
  452. text-align: center;
  453. margin-top: 5px;
  454. }
  455. .selectFinish {
  456. margin-top: 20px;
  457. .selecrFinishTop {
  458. font-size: 14px;
  459. color: #333;
  460. }
  461. .selecrFinishBottom {
  462. height: auto;
  463. width: 100%;
  464. display: flex;
  465. flex-wrap: wrap;
  466. .item {
  467. height: 40px;
  468. padding: 0px 16px;
  469. background: #f9f9f9;
  470. border-radius: 3px;
  471. margin-right: 10px;
  472. text-align: center;
  473. line-height: 40px;
  474. flex-shrink: 0;
  475. box-sizing: border-box;
  476. margin-top: 20px;
  477. position: relative;
  478. img {
  479. width: 14px;
  480. height: 14px;
  481. position: absolute;
  482. top: 0;
  483. right: 0;
  484. }
  485. }
  486. .item:first-child {
  487. margin-left: 0;
  488. }
  489. }
  490. }
  491. .selectList {
  492. margin-top: 20px;
  493. .selecrListTop {
  494. font-size: 14px;
  495. color: #333;
  496. }
  497. .selecrListBottom {
  498. height: auto;
  499. width: 100%;
  500. display: flex;
  501. flex-wrap: wrap;
  502. .item {
  503. height: 40px;
  504. padding: 0px 16px;
  505. background: #f9f9f9;
  506. border-radius: 3px;
  507. margin-right: 10px;
  508. text-align: center;
  509. line-height: 40px;
  510. flex-shrink: 0;
  511. box-sizing: border-box;
  512. margin-top: 20px;
  513. }
  514. }
  515. }
  516. .selectBox-btn {
  517. width: 176px;
  518. height: 28px;
  519. background: #fa7d22;
  520. border-radius: 14px;
  521. color: #fff;
  522. line-height: 28px;
  523. font-size: 14px;
  524. text-align: center;
  525. position: absolute;
  526. bottom: 40px;
  527. left: 50%;
  528. transform: translateX(-50%);
  529. }
  530. }
  531. .color0 {
  532. color: #fc3019;
  533. }
  534. .color1 {
  535. color: #3ef3ed;
  536. }
  537. .color2 {
  538. color: #00eeee;
  539. }
  540. .color3 {
  541. color: #61d09d;
  542. }
  543. .color4 {
  544. color: #3115cc;
  545. }
  546. .color5 {
  547. color: #fc3019;
  548. }
  549. .color6 {
  550. color: #a999ea;
  551. }
  552. }
  553. </style>