clerk-log.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-attachment');
  4. ComponentHelper::loadComponentView('com-image');
  5. ComponentHelper::loadComponentView('com-map');
  6. ?>
  7. <div id="app" v-cloak>
  8. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  9. <div slot="header">
  10. <span>核销明细</span>
  11. </div>
  12. <div class="table-body">
  13. <el-form size="small" :inline="true">
  14. <el-form-item>
  15. <el-input style="width: 200px" v-model="searchData.clerk_id" placeholder="请输入核销员ID" clearable></el-input>
  16. </el-form-item>
  17. <el-form-item>
  18. <el-input style="width: 200px" v-model="searchData.user_id" placeholder="请输入用户ID" clearable></el-input>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-input style="width: 200px" v-model="searchData.order_no" placeholder="请输入订单编号" clearable></el-input>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="primary" @click="searchs" style="padding: 9px 15px !important">搜索</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-tabs v-model="activeName" >
  28. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;" >
  29. <el-table-column prop="id" label="ID" align="center"></el-table-column>
  30. <el-table-column label="用户" >
  31. <template slot-scope="scope">
  32. <div class="table-info-img-text">
  33. <el-image class="table-info-img circle" :src="scope.row.user.avatar_url">
  34. <div slot="error" class="image-slot">
  35. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  36. </div>
  37. </el-image>
  38. <div class="table-info-text">
  39. <div style="color:#000;">ID: {{scope.row.user.id}}</div>
  40. <div style="font-size: 12px;">昵称:{{scope.row.user.nickname}}</div>
  41. </div>
  42. </div>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="核销员" >
  46. <template slot-scope="scope">
  47. <div class="table-info-img-text">
  48. <el-image class="table-info-img circle" :src="scope.row.clerkUser.avatar_url">
  49. <div slot="error" class="image-slot">
  50. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  51. </div>
  52. </el-image>
  53. <div class="table-info-text">
  54. <div style="color:#000;">ID:{{scope.row.clerkUser.id}}</div>
  55. <div style="font-size: 12px;">昵称:{{scope.row.clerkUser.nickname}}</div>
  56. </div>
  57. </div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="商品" prop="name" align="center" >
  61. <template slot-scope="scope">
  62. <div>
  63. {{scope.row.detail[0].goods_name}}
  64. <div style="display:flex;justify-content:center;">
  65. <div>
  66. 等{{scope.row.detail.length}}个商品
  67. </div>
  68. <div>
  69. <el-popover
  70. placement="right"
  71. width="300"
  72. trigger="click" style="width:100px;">
  73. <div v-for="(item, index) in scope.row.detail">
  74. <div style="display:flex;">
  75. <el-image :src="item.cover_pic" style="width:50px;"></el-image>
  76. <div style="margin-left:10px;width:90%;">
  77. <div style="display:flex;justify-content:space-between;">
  78. <div>{{item.goods_name}}</div>
  79. <div>x {{item.num}}</div>
  80. </div>
  81. <div style="display:flex;justify-content:space-between;margin-top:5px;">
  82. <div>{{item.goods_attr_name || '默认规格'}}</div>
  83. <div>¥{{item.goods_price}}</div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <el-button type="text" slot="reference">更多</el-button>
  89. </el-popover>
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="订单实付" prop="order.pay_money" align="center"></el-table-column>
  96. <el-table-column label="电话" prop="order.mobile" align="left"></el-table-column>
  97. <el-table-column label="订单编号" prop="order.order_no" align="left"></el-table-column>
  98. <el-table-column label="创建时间" align="center">
  99. <template slot-scope="scope">
  100. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. </el-tabs>
  105. <div flex="box:last cross:center">
  106. <div></div>
  107. <div>
  108. <el-pagination v-if="pagination" :page-size="page_size"
  109. style="float: right;" background @current-change="pageChange"
  110. layout="prev, pager, next" :total="pagination.totalCount">
  111. </el-pagination>
  112. </div>
  113. </div>
  114. </div>
  115. </el-card>
  116. </div>
  117. <script>
  118. const app = new Vue({
  119. el: '#app',
  120. data: {
  121. searchData: {
  122. user_id: '',
  123. clerk_id: '',
  124. order_no: '',
  125. },
  126. form: {
  127. user_id: '',
  128. level: '',
  129. idcard: '',
  130. idcard_front: '',
  131. idcard_back: '',
  132. address: '',
  133. longitude: '',
  134. latitude: '',
  135. nickname: '',
  136. name: '',
  137. mobile: '',
  138. qualification_certificate: [],
  139. avatar: '',
  140. age: '',
  141. gender: '1',
  142. },
  143. list: [],
  144. loading: false,
  145. btnLoading: false,
  146. activeName: '-1',
  147. pagination: null,
  148. page_size: 10,
  149. currentItem: null,
  150. drawer: false,
  151. direction: 'rtl',
  152. rules: {},
  153. levels: [],
  154. add: true,
  155. origin_level: '',
  156. user: {
  157. keyword: ''
  158. },
  159. lng_lat: '',
  160. page: 1,
  161. custom_text: '',
  162. dialogVisibleAssociation: false,
  163. dialogVisibleAssociationAdd: false,
  164. gridData:[],
  165. gridDataGoodsList:[],
  166. multipleSelection: [2096],
  167. searchGoodsData: {
  168. keyword: '',
  169. },
  170. checkedList:[],
  171. paginationAdd: null,
  172. user_id:'',
  173. selectedGoodsIds:[],
  174. },
  175. computed: {
  176. },
  177. mounted() {
  178. this.searchData.clerk_id = getQuery('clerk_id');
  179. this.loadData();
  180. },
  181. methods: {
  182. loadData() {
  183. this.loading = true;
  184. let params = {
  185. r: 'happiness/client/clerk/clerk-log',
  186. page: this.page,
  187. };
  188. console.log(this.searchData);
  189. params = Object.assign(params, this.searchData);
  190. request({
  191. params: params,
  192. method: 'get',
  193. }).then(e => {
  194. this.loading = false;
  195. if (e.data.code == 0) {
  196. this.list = e.data.data.list;
  197. this.pagination = e.data.data.pagination;
  198. this.page_size = e.data.data.page_size;
  199. this.custom_text = e.data.data.custom_text;
  200. } else {
  201. this.$message.error(e.data.msg);
  202. }
  203. }).catch(e => {
  204. this.loading = false;
  205. });
  206. },
  207. searchs() {
  208. this.page = 1;
  209. this.loadData();
  210. },
  211. pageChange(page) {
  212. this.page = page;
  213. this.loadData();
  214. },
  215. onDelete(item, index) {
  216. this.$confirm(`您是否真的要移除当前${this.custom_text}, 是否继续?`, '删除提醒', {
  217. type: 'warning'
  218. }).then(() => {
  219. this.btnLoading = false;
  220. request({
  221. params: {
  222. r: 'happiness/client/reserve-staff/delete'
  223. },
  224. method: 'post',
  225. data: {
  226. id: item.user_id,
  227. }
  228. }).then(e => {
  229. this.btnLoading = false;
  230. if (e.data.code == 0) {
  231. this.list.splice(index, 1)
  232. this.$message.success(e.data.msg);
  233. } else {
  234. this.$message.error(e.data.msg);
  235. }
  236. }).catch(e => {
  237. this.btnLoading = false;
  238. });
  239. })
  240. },
  241. submitForm(formName) {
  242. let _this = this;
  243. this.$refs[formName].validate((valid) => {
  244. if (valid) {
  245. _this.btnLoading = true;
  246. request({
  247. params: {
  248. r: 'happiness/client/reserve-staff/add'
  249. },
  250. method: 'post',
  251. data: {
  252. form: _this.form,
  253. }
  254. }).then(e => {
  255. _this.btnLoading = false
  256. if (e.data.code == 0) {
  257. _this.drawer = false
  258. _this.$message.success(e.data.msg)
  259. this.page = 1;
  260. _this.loadData()
  261. } else {
  262. _this.$message.error(e.data.msg);
  263. }
  264. }).catch(e => {
  265. _this.$message.error(e.data.msg);
  266. _this.btnLoading = false;
  267. });
  268. } else {
  269. console.log('error submit!!');
  270. return false;
  271. }
  272. });
  273. },
  274. addUser(add) {
  275. this.add = add
  276. this.drawer = true
  277. this.getLevels()
  278. },
  279. getLevels() {
  280. let _this = this;
  281. _this.btnLoading = true
  282. let basic_params = {
  283. r: 'happiness/client/reserve-staff/get-levels',
  284. };
  285. request({
  286. params: basic_params,
  287. method: 'get',
  288. }).then(e => {
  289. _this.btnLoading = false
  290. _this.levels = e.data.data
  291. }).catch(e => {
  292. console.log(e);
  293. });
  294. },
  295. handleClose(done) {
  296. this.drawer = false
  297. done()
  298. },
  299. querySearchAsync(queryString, cb) {
  300. this.user.keyword = queryString;
  301. this.getUser(cb);
  302. },
  303. getUser(cb) {
  304. request({
  305. params: {
  306. r: 'happiness/client/reserve-staff/search-user',
  307. keyword: this.user.keyword
  308. }
  309. }).then(res => {
  310. if (res.data.code == 0) {
  311. cb(res.data.data.list)
  312. } else {
  313. this.$message.error(res.data.msg);
  314. }
  315. });
  316. },
  317. agentClick(row) {
  318. this.form.user_id = row.id
  319. this.form.nickname = row.nickname
  320. this.handleBlur();
  321. },
  322. selectedImg(e, key) {
  323. this.form[key] = e[0].url;
  324. },
  325. delPic(key) {
  326. this.form[key] = '';
  327. },
  328. mapEvent(e) {
  329. this.form.longitude = e.long;
  330. this.form.latitude = e.lat;
  331. this.form.address = e.address;
  332. this.lng_lat = e.lat + '-' + e.long;
  333. },
  334. association(item) {
  335. this.dialogVisibleAssociation = true;
  336. this.user_id = item.user_id;
  337. let params = {
  338. r: 'happiness/client/reserve-staff/get-association-store-goods',
  339. user_id:item.user_id
  340. };
  341. request({
  342. params: params,
  343. method: 'get',
  344. }).then(e => {
  345. if (e.data.code == 0) {
  346. this.gridData = e.data.data;
  347. this.gridData.forEach((row)=>{
  348. this.selectedGoodsIds.push(row.id);
  349. });
  350. } else {
  351. this.$message.error(e.data.msg);
  352. }
  353. }).catch(e => {
  354. });
  355. },
  356. associationAdd() {
  357. this.dialogVisibleAssociationAdd = true;
  358. this.getAssociationAddList(1);
  359. },
  360. // 获取待添加商品列表
  361. getAssociationAddList(page){
  362. let params = {
  363. r: 'happiness/client/reserve-staff/get-store-goods',
  364. page: page,
  365. };
  366. params = Object.assign(params, this.searchGoodsData);
  367. request({
  368. params: params,
  369. method: 'get',
  370. }).then(e => {
  371. if (e.data.code == 0) {
  372. this.gridDataGoodsList = e.data.data.list;
  373. this.paginationAdd = e.data.data.pagination;
  374. this.paginationAdd.pageSize = e.data.data.page_size;
  375. this.paginationAdd.total_count = this.paginationAdd.totalCount;
  376. this.gridData.forEach((item)=>{
  377. this.gridDataGoodsList.forEach((row)=>{
  378. if(row.id == item.id){
  379. this.$nextTick(() => {
  380. this.$refs.multipleTable.toggleRowSelection(row, true);
  381. });
  382. }
  383. })
  384. })
  385. } else {
  386. this.$message.error(e.data.msg);
  387. }
  388. }).catch(e => {
  389. });
  390. },
  391. handleSelectionChange(val) {
  392. this.multipleSelection = val;
  393. },
  394. associationAddSelected(){
  395. if(this.gridData.length<=0){
  396. this.gridData = this.multipleSelection;
  397. this.multipleSelection.forEach((row)=>{
  398. this.selectedGoodsIds.push(row.id);
  399. });
  400. }else{
  401. this.gridData.forEach((item)=>{
  402. this.selectedGoodsIds.push(item.id);
  403. });
  404. this.multipleSelection.forEach((row)=>{
  405. if(!this.selectedGoodsIds.includes(row.id)){
  406. this.selectedGoodsIds.push(row.id);
  407. this.gridData.push(row);
  408. }
  409. });
  410. }
  411. this.dialogVisibleAssociationAdd = false;
  412. },
  413. handleAssociationStoreGoods(){
  414. request({
  415. params: {
  416. r: 'happiness/client/reserve-staff/handle-association-store-goods',
  417. },
  418. method: 'post',
  419. data: {
  420. goods_ids: this.selectedGoodsIds,
  421. user_id:this.user_id
  422. }
  423. }).then(e => {
  424. if (e.data.code == 0) {
  425. this.$message.success(e.data.msg)
  426. this.dialogVisibleAssociation = false;
  427. this.selectedGoodsIds = [];
  428. this.user_id = '';
  429. this.page = 1;
  430. this.loadData()
  431. } else {
  432. this.$message.error(e.data.msg);
  433. }
  434. }).catch(e => {
  435. this.$message.error(e.data.msg);
  436. });
  437. },
  438. delFun(index) {
  439. this.gridData.splice(index, 1)
  440. this.selectedGoodsIds.splice(index, 1)
  441. },
  442. qualificationCertificatePic(e) {
  443. if (e.length) {
  444. e.forEach((item, index) => {
  445. if (this.form.qualification_certificate.length >= 9) return;
  446. this.form.qualification_certificate.push(item.url);
  447. })
  448. }
  449. },
  450. delQualificationCertificatePic( index) { // 删除图片
  451. this.form.qualification_certificate.splice(index, 1)
  452. },
  453. handleBlur(){
  454. request({
  455. params: {
  456. r: 'happiness/client/reserve-staff/check-staff-user',
  457. user_id: this.form.user_id
  458. }
  459. }).then(res => {
  460. if (res.data.code == 0) {
  461. this.form = res.data.data.user;
  462. this.form.gender = this.form.gender.toString();
  463. this.lng_lat = res.data.data.user.longitude+'-'+res.data.data.user.latitude;
  464. } else {
  465. this.$message.error(res.data.msg);
  466. }
  467. });
  468. }
  469. }
  470. });
  471. </script>
  472. <style>
  473. .el-tabs__header {
  474. font-size: 16px;
  475. }
  476. .table-body {
  477. padding: 20px;
  478. background-color: #fff;
  479. }
  480. .table-body .el-button {
  481. padding: 0 !important;
  482. border: 0;
  483. margin: 0 5px;
  484. }
  485. .input-item {
  486. width: 250px;
  487. margin: 0 0 20px;
  488. display: inline-block;
  489. }
  490. /*.input-item .el-input__inner {*/
  491. /* border-right: 0;*/
  492. /*}*/
  493. .input-item .el-input__inner:hover {
  494. border: 1px solid #dcdfe6;
  495. /*border-right: 0;*/
  496. outline: 0;
  497. }
  498. .input-item .el-input__inner:focus {
  499. border: 1px solid #dcdfe6;
  500. /*border-right: 0;*/
  501. outline: 0;
  502. }
  503. .input-item .el-input-group__append {
  504. background-color: #fff;
  505. border-left: 0;
  506. width: 10%;
  507. padding: 0;
  508. }
  509. .input-item .el-input-group__append .el-button {
  510. padding: 0;
  511. }
  512. .input-item .el-input-group__append .el-button {
  513. margin: 0;
  514. }
  515. .batch {
  516. margin: 0 0 20px;
  517. display: inline-block;
  518. }
  519. .batch .el-button {
  520. padding: 9px 15px !important;
  521. }
  522. .el-table th>.cell{
  523. color: #333;
  524. font-weight: bold;
  525. font-size: 14px;
  526. }
  527. .el-table__footer-wrapper, .el-table__header-wrapper{
  528. border-bottom: 1.4px solid #D6D6D6;
  529. }
  530. .el-table th>.cell {
  531. color: #333;
  532. font-weight: bold;
  533. font-size: 14px;
  534. }
  535. .table1 .el-table__footer-wrapper,
  536. .table1 .el-table__header-wrapper {
  537. border-bottom: 1.4px solid #D6D6D6;
  538. }
  539. .user_img{
  540. position: relative;
  541. margin-right: 8px;
  542. /* height: 50px;
  543. width: 50px; */
  544. }
  545. .default-avatar{
  546. width: 50px;
  547. height: 50px;
  548. border-radius: 50%;
  549. margin-right: 8px;
  550. }
  551. .uer-nickname {
  552. flex: 1;
  553. }
  554. .v-modal {
  555. z-index: 200 !important;
  556. }
  557. .add-image-btn {
  558. width: 100px;
  559. height: 100px;
  560. color: #419EFB;
  561. border: 1px solid #e2e2e2;
  562. cursor: pointer;
  563. }
  564. .del-btn {
  565. position: absolute;
  566. right: -14px;
  567. top: -14px;
  568. }
  569. .width-300 {
  570. max-width: 320px;
  571. }
  572. .card-covers {
  573. display: grid;
  574. grid-template-columns: repeat(3, 1fr);
  575. grid-gap: 10px;
  576. grid-auto-rows: minmax(100px, auto);
  577. grid-auto-flow: dense;
  578. }
  579. </style>