Compare commits
916 Commits
temp
..
fea#sytopic
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f4027fd61 | |||
| 44ba39352d | |||
| ea7917245e | |||
| 64aa50fd09 | |||
| 1a1169fe11 | |||
| 9d3b44175c | |||
| cf68c97f8f | |||
| 0d6a2e9ead | |||
| e01ac5a20f | |||
| e3f8aca9e2 | |||
| e6a2722321 | |||
| 07cf724038 | |||
| 19e3a6994b | |||
| 5e1e0cd4d2 | |||
| 19682cfcef | |||
| d554a0233d | |||
| 3c5fc44632 | |||
| 7dd6612c26 | |||
| ad16229b21 | |||
| b8e256fdcb | |||
| 52536af755 | |||
| 46cc957b91 | |||
| f3acb1b354 | |||
| 2a3b42c434 | |||
| 66c96b85fd | |||
| fe7c2f57f9 | |||
| 1583c81360 | |||
| f972ab2b2b | |||
| 67d57b9bcb | |||
| 05b273c4a3 | |||
| 4efcce905c | |||
| 4e0ab69a5d | |||
| 704f8fd6f5 | |||
| 836e02fd46 | |||
| c64f7db0c1 | |||
| abc1e47cfa | |||
| 7948744e69 | |||
| 9ed04e5cbd | |||
| a7937d9b73 | |||
| d6d06df38c | |||
| 2bb53b90f0 | |||
| e3bb2d6dde | |||
| d5e19798d2 | |||
| 4091650b06 | |||
| eff7244cdd | |||
| 30b3321bcc | |||
| b75e0f2232 | |||
| af70a7e94d | |||
| f160297b22 | |||
| 99b743c34d | |||
| a11c841985 | |||
| 8de775f9e8 | |||
| afb40c9d5b | |||
| 1c2f97666b | |||
| 313d8fd7bf | |||
| 5cf674d585 | |||
| a8b13eb170 | |||
| ec8f0d7088 | |||
| 4862bb72d4 | |||
| 0f004e5c6f | |||
| 2f7298daa2 | |||
| b4ef47ae49 | |||
| 5929fb9694 | |||
| 2d93a54596 | |||
| 9a4d620c5a | |||
| 677d22900a | |||
| 154972341a | |||
| 5ac2b693bc | |||
| 6b54922c88 | |||
| 4d1e6d3a0f | |||
| 1445572abc | |||
| f70065109b | |||
| 01caa45b39 | |||
| 772923ffce | |||
| ce0acff18b | |||
| d0847adfe5 | |||
| f680e2da0e | |||
| 01041445e5 | |||
| 0a46d41d57 | |||
| 2227925c92 | |||
| a9e4159038 | |||
| ca106994f4 | |||
| e36e5b2560 | |||
| 77224176f9 | |||
| 6fc3e8e87b | |||
| 8add10dfa9 | |||
| 320c030396 | |||
| 93ec3288eb | |||
| 3b9e0467d1 | |||
| c071b912aa | |||
| e11c06271b | |||
| 026bfc9274 | |||
| 903ff760b6 | |||
| 34131c0526 | |||
| 068e016701 | |||
| 6934c38ec5 | |||
| 45a7133ac7 | |||
| ea000490b8 | |||
| 4f41117a9e | |||
| 45cd64669a | |||
| 292c2f01ce | |||
| 32d41d6e78 | |||
| 4fe61d370e | |||
| a49bb4cbad | |||
| 18623d1c8d | |||
| 42fff71177 | |||
| f760da0097 | |||
| 437e00974d | |||
| ba8e138381 | |||
| 9bc6bd6f81 | |||
| 19bbce0e3c | |||
| ecbbcd43b7 | |||
| 12f13b564c | |||
| 514eabb3c2 | |||
| a6a81c376d | |||
| d8d9119598 | |||
| 5bb77c22ee | |||
| d8cfe1b8f4 | |||
| c200848180 | |||
| 7e18c320f7 | |||
| 84b572c285 | |||
| 561f987cf5 | |||
| a264dc1ecb | |||
| 0ac3b7180a | |||
| 50c44599c2 | |||
| 9cfd8c6f3d | |||
| 81d56f9650 | |||
| 7d4cb3452c | |||
| 46c98d5af1 | |||
| 12dd080bf0 | |||
| 22cefd9289 | |||
| a929adf738 | |||
| 610828fe78 | |||
| d7755d0ea8 | |||
| 97908cee90 | |||
| 8bc57b8300 | |||
| d2b6b73e7c | |||
| 3656a641ce | |||
| a2934fb01b | |||
| 709fe5a5f3 | |||
| d8a5d1eb36 | |||
| e7aa9142b5 | |||
| 495ef25dce | |||
| 7ae54dd2fa | |||
| f500447683 | |||
| 9e4e8cae04 | |||
| 097a00e980 | |||
| 86f52bfe38 | |||
| 06b4891a4b | |||
| 443a331e32 | |||
| 7dbbe30807 | |||
| 300a4910d0 | |||
| 4a7821ed09 | |||
| 276fd5e592 | |||
| e6a2d773bf | |||
| 374e8239ed | |||
| 12d26acd8b | |||
| f07bee02cc | |||
| 56656a66b2 | |||
| f97a3bef37 | |||
| be77d9c53e | |||
| 3f8997bc7e | |||
| 817cf2a999 | |||
| 1512ffdf99 | |||
| 968393c350 | |||
| adf795774e | |||
| 7c2fb94c0a | |||
| 7fd8f794bd | |||
| 7b5296e905 | |||
| d223cfbca2 | |||
| 2e907c53fe | |||
| 10a5346eb1 | |||
| 22c1ef83a4 | |||
| d1a91d34c2 | |||
| 9a18e31978 | |||
| 11dafef6ea | |||
| 123c89d495 | |||
| e34e9115a7 | |||
| a87d22afc1 | |||
| da5ab5cf1c | |||
| d6c722b7d7 | |||
| d18e6bf2af | |||
| ab568222e0 | |||
| fd76e114fc | |||
| 670489a89b | |||
| 521659c64a | |||
| f425ae68ef | |||
| cd4dae7f7f | |||
| 7a524e1e32 | |||
| 40b921ca16 | |||
| cbf8c6cd9b | |||
| f7af5c59ad | |||
| b0cf350bbd | |||
| 19c64016fb | |||
| be19ba28c9 | |||
| fd90bd5bf0 | |||
| 0cea129541 | |||
| dc9f0c21cd | |||
| 8e8f0342d7 | |||
| 5be647ea08 | |||
| e33314c92e | |||
| 62b6efb3d2 | |||
| f5e7fb21a7 | |||
| 0545eadf8b | |||
| 428bfe54f2 | |||
| 1f4e37f6f8 | |||
| be5d18a123 | |||
| 1073b24692 | |||
| ebeb748cc4 | |||
| c76ad35344 | |||
| 34286f37d9 | |||
| e14c8d984c | |||
| f534b7be65 | |||
| e55ea26767 | |||
| 7d43757135 | |||
| 870a19fb1b | |||
| 85de7fce07 | |||
| 8426025969 | |||
| 5377248d3c | |||
| 582bcdb27f | |||
| e16e0efff9 | |||
| eb5cb58925 | |||
| c47e150681 | |||
| 08d053c7d0 | |||
| 8aac432673 | |||
| d048525c79 | |||
| 8bba2e75f6 | |||
| b7267260a2 | |||
| 2e91f779b4 | |||
| 61450335f4 | |||
| f28211194c | |||
| 59e5b996c6 | |||
| c88dbf0a70 | |||
| 5e947de24b | |||
| 994a7a6e8f | |||
| e8d4b80811 | |||
| 8df928e5bb | |||
| f4a8ec7380 | |||
| de7d497f5b | |||
| 02d4a671b1 | |||
| 23e8ec97bb | |||
| 7971a8d861 | |||
| d3f03c7c65 | |||
| 4ca0013968 | |||
| ce150e2e78 | |||
| 2f697e40aa | |||
| 58b0c56462 | |||
| b14a66cd84 | |||
| 2ebb7eb262 | |||
| 8f17416510 | |||
| 33627a9c53 | |||
| 761848b9d9 | |||
| 4eda14c853 | |||
| 678b7cf37c | |||
| 9c45beba85 | |||
| 1831089200 | |||
| dc3ae76d0c | |||
| b7310c0916 | |||
| ccc63aa530 | |||
| c8371c524a | |||
| 09493138f9 | |||
| a7f3af47a7 | |||
| aac9677e1f | |||
| fdc1332319 | |||
| 6a52a680bc | |||
| f84272bb12 | |||
| 6f5d1d3196 | |||
| a94cf41cdf | |||
| 2c5cf829ee | |||
| 7d503d6fc4 | |||
| a80929632f | |||
| d5fdf943f6 | |||
| fe26174582 | |||
| 15be428cc9 | |||
| 637c329b7d | |||
| 7e3d329a9a | |||
| e91b2be754 | |||
| 3092dee7f1 | |||
| 4ecd61506e | |||
| 5448d0cd4e | |||
| acec22291f | |||
| e777e81e44 | |||
| 2eb338c42e | |||
| 9292d4635d | |||
| 59b22aac80 | |||
| da3d7dc26b | |||
| e3aed3f45c | |||
| b1a61b9274 | |||
| 9c4c4b6ac6 | |||
| 544f9d7f19 | |||
| 72a7c3a0b6 | |||
| 1810b6a478 | |||
| fabe410daa | |||
| 3c454b0818 | |||
| baf47fbe3c | |||
| 88d27cccf9 | |||
| 71acb64283 | |||
| b989c791cd | |||
| 09ea12a452 | |||
| 87511ece07 | |||
| 984875b0fe | |||
| f6f17c4e21 | |||
| 5c341c997d | |||
| 1544e239bc | |||
| 961b57090d | |||
| 9afc059182 | |||
| 140a2ccef3 | |||
| 4172c31bbb | |||
| d9b99d5606 | |||
| 3785bc6d4b | |||
| 182e44014c | |||
| 684fa4e6fe | |||
| 6c4473c13d | |||
| b5a7c2fd19 | |||
| 37b7f13d78 | |||
| 65dbf502cc | |||
| a51140c766 | |||
| 707b918889 | |||
| 775bb75180 | |||
| 528b0e165e | |||
| 4c23e18b20 | |||
| 36f42a33e8 | |||
| 4859f39d32 | |||
| 65c54deb86 | |||
| 1e2ca4c0c3 | |||
| f2c5d12f87 | |||
| 81bff0f50e | |||
| fb488701cf | |||
| 3ffc35343a | |||
| 84d535a763 | |||
| 095349fdf9 | |||
| bf233ef568 | |||
| e0df382080 | |||
| c3fb975ead | |||
| 39a7b373dc | |||
| 9e0d0bfbdf | |||
| 71ae42ae1c | |||
| 0580ab059e | |||
| 73172f2bb1 | |||
| ce2b0c1bf4 | |||
| 0de1c4519f | |||
| de91a9d520 | |||
| e7b401f210 | |||
| e8cf6ee246 | |||
| 7efc7134e3 | |||
| 4ea0f740b1 | |||
| 068b7399c2 | |||
| 29a3f89b41 | |||
| d98db6c872 | |||
| f873b17c84 | |||
| 54b6685b40 | |||
| 3fd4172e2a | |||
| b97e317e3d | |||
| 24f96333ad | |||
| 63489aeb08 | |||
| 79db0134be | |||
| b8d47f9e4d | |||
| 3651e82958 | |||
| d201eb2132 | |||
| 98ccf9a0f3 | |||
| f2ca56e3e4 | |||
| 65436186a6 | |||
| 4d14ffd53c | |||
| 089588d819 | |||
| e5b692963d | |||
| 3dd06352b8 | |||
| ca0eb36153 | |||
| fb58935867 | |||
| a8ff536406 | |||
| 166c04d4a6 | |||
| 52e1380293 | |||
| 4c45bfd64d | |||
| 2d42f8dc38 | |||
| 1f583d1967 | |||
| 113a7d1864 | |||
| 849895052f | |||
| 0dd8779612 | |||
| 62bd5338ac | |||
| 3e1160ae0a | |||
| 1d85744d64 | |||
| 067bb9642f | |||
| 66e2116a7a | |||
| d6b95754e7 | |||
| 22075e5ea4 | |||
| 8b0665bbe0 | |||
| 6cd55a0e21 | |||
| 8aa8bae804 | |||
| 04b9b0a79a | |||
| 6f19305883 | |||
| 47adbfe625 | |||
| c3d64ae769 | |||
| 09f3fe812b | |||
| 77d4bce21b | |||
| 804bef8edd | |||
| 4282e37d74 | |||
| ce66514b08 | |||
| bbf379fb44 | |||
| 66d905f8b9 | |||
| 545f1f2e73 | |||
| 1e0570443f | |||
| a40c58be11 | |||
| 0bf3c31cbc | |||
| 2e3ba09cbc | |||
| 2b409860ce | |||
| 8aadd39e79 | |||
| 964bf7f26b | |||
| d010bd864f | |||
| 0205ee703e | |||
| ab3d76486b | |||
| eb2058633d | |||
| 483134edf9 | |||
| c397ed6efd | |||
| e4712f0f79 | |||
| 97dda9fc2e | |||
| 0cdb594cb2 | |||
| c0d46339ee | |||
| 85bbbd6499 | |||
| da4ceecbd1 | |||
| da9cf1c300 | |||
| 09fde723a1 | |||
| 66b75790db | |||
| 5aa03aeea3 | |||
| 4e8213a4db | |||
| 3812ca8ef0 | |||
| f04612598e | |||
| 9e8ffc83ae | |||
| ec0097397d | |||
| c078c7381a | |||
| f907c6d1a9 | |||
| 4f392cb38d | |||
| 9c8b0a7e57 | |||
| 93ba721d6a | |||
| ba7d2103de | |||
| 2243de4922 | |||
| fa46f794b0 | |||
| 14f4f075c1 | |||
| 86ea9a3586 | |||
| 11c226ce88 | |||
| 25bec471b4 | |||
| c143031c98 | |||
| a4d820107a | |||
| e401352839 | |||
| f95a884227 | |||
| 89aa47f583 | |||
| 1154141c79 | |||
| 0b019660a4 | |||
| 71a48ad040 | |||
| a316b55fbe | |||
| a04518df3a | |||
| e89610c5bc | |||
| 2347125590 | |||
| 3d98a62723 | |||
| 62920f9f14 | |||
| 8aedcbf5d1 | |||
| 8b8cdbbcfb | |||
| 962091996e | |||
| a16b19535a | |||
| ad19050604 | |||
| 62e8b79218 | |||
| cbbbb52c24 | |||
| c653b48e4d | |||
| b0a28b3d6b | |||
| 9ee601a805 | |||
| 31da1299b3 | |||
| 5000396893 | |||
| da6df4e67f | |||
| d2c0f24ccc | |||
| 3d0fab681d | |||
| 505913f426 | |||
| 7f94e5cc89 | |||
| cbead42b24 | |||
| 1e2148c3ea | |||
| 020690af54 | |||
| 5a19da4c0d | |||
| 5c6cb22989 | |||
| a24500c883 | |||
| 0fbe65971e | |||
| 225addec15 | |||
| 53bd59d797 | |||
| 3f865f1fbf | |||
| ea72ce7256 | |||
| 77927e93e1 | |||
| 7a26c158c0 | |||
| 35a3e718ac | |||
| cff48f852e | |||
| 3a634e99d7 | |||
| ca287f8ec8 | |||
| 5a25c48bdb | |||
| 344f7dc190 | |||
| 6fbcc68f92 | |||
| 512e1525f9 | |||
| 759d842801 | |||
| cd342ae48c | |||
| c6a2f8b4ec | |||
| b9aab9d9af | |||
| 21b9b27787 | |||
| f901ce5dbd | |||
| 260bb7d36f | |||
| e69db7d48c | |||
| 8d4762836e | |||
| d7fb62cb69 | |||
| 6e6970ef97 | |||
| f4c2ab9939 | |||
| 04a4eae82f | |||
| f3ae9b45f9 | |||
| 857b64e522 | |||
| 36a2daabdb | |||
| 5ca24bf88d | |||
| 80e6889256 | |||
| 033db943c5 | |||
| dd09a47f75 | |||
| e1dab648db | |||
| 9aace089a9 | |||
| a4cef41ae2 | |||
| a54f57f6af | |||
| 06c0f071e3 | |||
| 44a8767c46 | |||
| b990d3af0f | |||
| cfa22ad792 | |||
| af14d7b7c2 | |||
| c1858fceca | |||
| d03f8268e9 | |||
| b7983daa57 | |||
| 7658b253af | |||
| 8b2010012b | |||
| df59a7eb9a | |||
| 4278f811f5 | |||
| 412798a32e | |||
| ecbc256558 | |||
| e4fea001d4 | |||
| 111408d5b8 | |||
| 09c3e67674 | |||
| 9c65a70991 | |||
| 6bd260f904 | |||
| da45e3a48c | |||
| aa0a9050b6 | |||
| 0c0e4560ac | |||
| 3166695a61 | |||
| 567c77cff7 | |||
| 55ae54cad4 | |||
| 61a7186653 | |||
| c5cee4aa65 | |||
| 8b29965bf4 | |||
| 2f1ebbbec1 | |||
| ddc3b5e390 | |||
| 7374a2cb21 | |||
| 06489b9ce6 | |||
| 915edf165a | |||
| 1201bf7bd2 | |||
| 41dca1f908 | |||
| 711c45e155 | |||
| a6b78b0bde | |||
| ff05d9c314 | |||
| 851c75b370 | |||
| 700a5263f7 | |||
| 7d455b045c | |||
| 4e735c6533 | |||
| 5d7fa060ba | |||
| 20a023b784 | |||
| cdfdf8ba71 | |||
| f8d8e0f63b | |||
| e06d19bf6a | |||
| c2c3eae1e8 | |||
| 9a49d718b8 | |||
| 35994d6ffd | |||
| 94ea827baa | |||
| b6356904bf | |||
| 5a80e5b979 | |||
| 2e7d6e5805 | |||
| f457136e65 | |||
| 8a49fb4916 | |||
| 0363450584 | |||
| 44083f7ccd | |||
| 27fca64e88 | |||
| 6002fd44df | |||
| 3df36e22a9 | |||
| 9210fb2a00 | |||
| 8d54060656 | |||
| 8fcdf5b640 | |||
| 51e3fd272b | |||
| a6b6c4ebb2 | |||
| 5a65bb5de2 | |||
| bea4c7423a | |||
| a1a4bd4c03 | |||
| dd7da03a82 | |||
| 74dd2d10df | |||
| e25a08dbc1 | |||
| 6865016393 | |||
| 4961848b90 | |||
| 0c67382dcc | |||
| 3589efbd37 | |||
| 4aa3951f54 | |||
| fe5d6b1c48 | |||
| 5dba9b000a | |||
| 6ddafabcb5 | |||
| 4e3f039d27 | |||
| d5f7b860ab | |||
| ae8e8e1099 | |||
| ea97e919a6 | |||
| bd923e92bc | |||
| 92d14f62d7 | |||
| 148820a9e2 | |||
| e9e2de3360 | |||
| c95526e955 | |||
| 52219b9a86 | |||
| 6bd6e7d501 | |||
| 94c3b935f2 | |||
| 6f422653a8 | |||
| 62ad6fceab | |||
| 1a4284b215 | |||
| a866842969 | |||
| 5f94eb7cc6 | |||
| f9efcb4cc6 | |||
| 39d5da091f | |||
| 4aa3acc5ba | |||
| 9fadfc4837 | |||
| af09a0b2e9 | |||
| d11f6a1186 | |||
| 97fd9e8d50 | |||
| 828a6a8f29 | |||
| 205e880e2e | |||
| 928b40a31a | |||
| 755159b068 | |||
| 6dc5550e8b | |||
| 857aae6fc5 | |||
| 7ebba3c9d0 | |||
| 310aaa01fe | |||
| d219eff999 | |||
| dceee41c31 | |||
| 2b300d95e2 | |||
| 9bc904cbce | |||
| 6d1e96faee | |||
| 9830c82770 | |||
| 1bd5871a20 | |||
| 8d174859d8 | |||
| 9db0611a84 | |||
| 32b308f41e | |||
| e827bdb450 | |||
| eeb9b205dc | |||
| c427774cfd | |||
| c84ed523c9 | |||
| abcd2d4767 | |||
| f10588e946 | |||
| 0cc4fd3f3a | |||
| eade31060a | |||
| a8927d5b5d | |||
| e900f4d603 | |||
| 9ac612d62a | |||
| 215d40d38f | |||
| 9c1e3935f8 | |||
| 889cfde8b8 | |||
| 69b416f276 | |||
| 798b7b9fca | |||
| 09713afb0e | |||
| 142b660728 | |||
| 793ccc968c | |||
| adea94484a | |||
| 851b4c22ed | |||
| 7d4fb0a10d | |||
| b6f37af195 | |||
| 13fa5f1138 | |||
| f2ebf58d0a | |||
| 3e7b2eee87 | |||
| 8f7f658544 | |||
| fe940dbf2d | |||
| f71c6e9fa8 | |||
| d23f06999b | |||
| ae05fae058 | |||
| b0726b6bef | |||
| 3e7e7555b5 | |||
| 6991fa5847 | |||
| b65a4e3068 | |||
| 4c4250883b | |||
| 95e988aa1c | |||
| f73099c0ef | |||
| 93f7a8e955 | |||
| 49be457e6f | |||
| 6d56878b75 | |||
| a5ee2c060e | |||
| a6fc743d77 | |||
| 5cf46d0de5 | |||
| 679f54151b | |||
| 1acc172360 | |||
| 3d6b4d1b6d | |||
| d58e1e5347 | |||
| 4c9ba9c93f | |||
| 0eb0d1f656 | |||
| 4918a3685d | |||
| e90c5e1b9b | |||
| 636e2d8ff8 | |||
| 26777c650c | |||
| 1e77d682d3 | |||
| 19e6759221 | |||
| 32929f48ad | |||
| f52de34685 | |||
| 6f855faad9 | |||
| 639bce66bd | |||
| edb036e1dc | |||
| 534a86f644 | |||
| a11e41eb48 | |||
| a60ebdf2a7 | |||
| 30880ad1ca | |||
| 764403f107 | |||
| 6abfbfabc5 | |||
| 344dfacc02 | |||
| c9bc965f4a | |||
| 502b47be90 | |||
| 930f85ab3b | |||
| 0859a84b5f | |||
| 66f9303676 | |||
| 280cfbb3cc | |||
| 670e6a7aa2 | |||
| 9cc15c55e6 | |||
| 0d4e88d482 | |||
| e9154ddd5a | |||
| e83b3b156e | |||
| f72c7abe14 | |||
| 132f29f610 | |||
| 5179eb8772 | |||
| 3e62791c7b | |||
| bf7d7fcb0f | |||
| 35ea9a655c | |||
| 029b1eac93 | |||
| 0693ba8c55 | |||
| 166216444a | |||
| 14d380e99e | |||
| 0fb5b0c399 | |||
| 19f55ea06a | |||
| b7a1c797f5 | |||
| ffff07504f | |||
| f46d285785 | |||
| b80ae5d22c | |||
| 343f537167 | |||
| 51db1ae852 | |||
| 26e84ea01e | |||
| 504cb7385a | |||
| a95267c9c7 | |||
| aed4fda7cc | |||
| 9f3ddf0e3e | |||
| a1e2640b5b | |||
| f72c218dc0 | |||
| cbe9ff63bf | |||
| 25a188a4f4 | |||
| 82cb12a9e1 | |||
| 5d578b0b81 | |||
| f4d461f36e | |||
| 0983683942 | |||
| 1361622d17 | |||
| c5cbe28f2a | |||
| 8f8bb5dfab | |||
| 6ce9062075 | |||
| 45470f4a7d | |||
| b1362b9f34 | |||
| 8c7c6eb116 | |||
| 82ab65912e | |||
| ffbd56a580 | |||
| a48e5ecb07 | |||
| 1871b460e5 | |||
| dd05e086f7 | |||
| f0351ab79a | |||
| f8404557cd | |||
| 2f0865cd66 | |||
| c9cc727c7b | |||
| 94b5647b6b | |||
| 64419e1d6a | |||
| 851cd92695 | |||
| 14511424e2 | |||
| 31c366e3b8 | |||
| f68dc8b40a | |||
| 8e083c38d0 | |||
| 605f6fcedc | |||
| bbf8ba77f8 | |||
| d05604c51f | |||
| 2c26b65070 | |||
| 33c807e803 | |||
| 36514e3760 | |||
| 421499894c | |||
| cfa5299b15 | |||
| 31b6efe082 | |||
| 0a8ec5a325 | |||
| d6f9c9ae1d | |||
| d9b94057d0 | |||
| 6785816d40 | |||
| 3d52dcf044 | |||
| 051ca7ddf2 | |||
| 1674e94d50 | |||
| bfc961ee5f | |||
| 4888f1bd38 | |||
| 344efcd220 | |||
| a8173f9f35 | |||
| c6a481ec7b | |||
| 6ec9081b1b | |||
| 51b2e62ee7 | |||
| bd9e409968 | |||
| 3413f12b93 | |||
| dbc4e0cbf8 | |||
| f7569c0821 | |||
| 13840acf3a | |||
| a8fd83659d | |||
| fbf7a67404 | |||
| 7ea05c699d | |||
| 543e3dfd0d | |||
| 0f79129d0f | |||
| cc28ff85f1 | |||
| 66bc826f7a | |||
| 26b88210f5 | |||
| 172faa058f | |||
| 3b8e470c79 | |||
| 87403485e3 | |||
| 0d90a41dd1 | |||
| 710b4fc73e | |||
| 428eebc00b | |||
| 479a15f198 | |||
| 5a4ec397b5 | |||
| e3bf78a739 | |||
| 9cf1162fde | |||
| 758b4bb3b3 | |||
| 881848eb82 | |||
| 1d9519c64b | |||
| 190d1c5b4b | |||
| fbe3b6ad45 | |||
| 89b6bdd9f6 | |||
| 5bcf4605ff | |||
| f89be0cd97 | |||
| 4a25860a26 | |||
| d60a123a46 | |||
| fb250b8205 | |||
| 474f0f0437 | |||
| 8208567b04 | |||
| 23ee1050bc | |||
| 65d6f2d81a | |||
| 8d969c5501 | |||
| f437825a90 | |||
| 1b5a42bdd4 | |||
| 9f4f06a5cc | |||
| 6cab9464b3 | |||
| f9d7a54ea2 | |||
| 00148941b6 | |||
| 02adc4c941 | |||
| 2b916c6582 | |||
| c338a3a704 | |||
| b7184dc34f | |||
| 98be1d1d2b | |||
| 14fb995468 | |||
| e2ee13c9a0 | |||
| a1dd4a9406 | |||
| fe95139663 | |||
| 54cb413de1 | |||
| f1ced873c0 | |||
| b1f9ac0d98 | |||
| fbc8cf5201 | |||
| 4fe20fe080 | |||
| 8770c45e88 | |||
| 5e75b4a25d | |||
| 4ad70aa3e0 | |||
| 4e37d7c030 | |||
| b251602e23 | |||
| b0f72e8cbb | |||
| b9ca13112b | |||
| 51bc96b533 | |||
| b2aa7e442b | |||
| c3f5bf517b | |||
| 1ce223973a | |||
| 0fa7ac6f9a | |||
| efd7fa067b | |||
| e08d7ccc3b | |||
| 318bae5479 | |||
| 9ff99fb6cb | |||
| 447d1efade | |||
| c3ae0a96bf | |||
| f109f6a301 | |||
| a61e877c9b | |||
| a5d8e735f1 | |||
| af45e7fb51 | |||
| 1c342eb2cc | |||
| 25ae328f5f | |||
| 7c2a0e1ff9 | |||
| 83c8897821 | |||
| a0cde2aaf3 | |||
| 392479cc3b | |||
| 1de6600801 | |||
| e6a23fb412 | |||
| 5e719c1ddd | |||
| 0f486d34ad | |||
| 7e7624befc | |||
| 0c06a3a337 | |||
| fec1514411 | |||
| 964cb2740a | |||
| 47b285a813 | |||
| 46b6114e31 | |||
| 2050a1af3c | |||
| c60df3a071 | |||
| 75984d8b8a | |||
| 229e288277 | |||
| 7ed7e90fb8 | |||
| 3defc6963a | |||
| 03c904e34f | |||
| 78230170fa | |||
| e4d93cb9d2 | |||
| d2f9575b00 | |||
| 84a91699c2 | |||
| 4dadb81b12 | |||
| d72b5d998c | |||
| cbda16740b | |||
| 66e9b85252 | |||
| 5e9f5579b7 | |||
| 740604a2bd | |||
| 430fb9519f | |||
| ad42177a67 | |||
| 29f11b4f50 | |||
| 4ee2359830 | |||
| 7db088250d | |||
| 723215c34f | |||
| 4b7825d2a2 | |||
| 7e971cb3af | |||
| e44b2d17d0 |
@@ -11,6 +11,5 @@ $config['app_id'] = 1206;
|
||||
$config['app_key'] = 'WX6HDVZX3AYSZDR1739332ZM';
|
||||
|
||||
$config['mobile_list'] = array(
|
||||
'13391247942','13391407003','13391416119','13391416302',
|
||||
'13391416570',
|
||||
'13391419510',
|
||||
);
|
||||
|
||||
@@ -16,6 +16,19 @@ class Common extends CI_Controller
|
||||
|
||||
public $data = array();
|
||||
|
||||
//获取门店类型数组
|
||||
public function biz_type_ary()
|
||||
{
|
||||
$this->load->model('biz/biz_model', 'mdBiz');
|
||||
$list = [];
|
||||
$type_ary = $this->mdBiz->type_ary();
|
||||
foreach ($type_ary as $key => $value) {
|
||||
$list[] = ['id' => $key, 'name' => $value];
|
||||
}
|
||||
$this->data = $list;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取车系
|
||||
* Created on: 2022/3/18 17:09
|
||||
@@ -478,7 +491,12 @@ class Common extends CI_Controller
|
||||
$city_id && $where['city_id'] = $city_id;
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
$type && $where['type'] = $type;
|
||||
$types = $this->input->post('types');
|
||||
$types && $where['type in (' . $types . ')'] = null;
|
||||
$ids && $where['id not in (' . $ids . ')'] = null;
|
||||
$typeAry = $this->mdBiz->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$type_ids && $where["type in ($type_ids)"] = null;
|
||||
$count = $this->mdBiz->count($where);
|
||||
if ($count) {
|
||||
$resBiz = $this->mdBiz->select($where, 'id desc', $page, $size);
|
||||
@@ -1061,9 +1079,12 @@ class Common extends CI_Controller
|
||||
} else if ($type == 'customer') {
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$re = $this->mdCustomers->get(array('id' => $id));
|
||||
} else if ($type == 'owners') {
|
||||
$this->load->model('receiver/receiver_owners_model', 'mdOwners');
|
||||
$re = $this->mdOwners->get(array('id' => $id));
|
||||
}
|
||||
if (!$re['mobile']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '客户不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机不存在!');
|
||||
}
|
||||
$mobile = $re['mobile'];
|
||||
$content = '';
|
||||
@@ -1095,9 +1116,12 @@ class Common extends CI_Controller
|
||||
} else if ($type == 'customer') {
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$re = $this->mdCustomers->get(array('id' => $id));
|
||||
} else if ($type == 'owners') {
|
||||
$this->load->model('receiver/receiver_owners_model', 'mdOwners');
|
||||
$re = $this->mdOwners->get(array('id' => $id));
|
||||
}
|
||||
if (!$re['mobile']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '客户不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机不存在!');
|
||||
}
|
||||
$mobile = $re['mobile'];
|
||||
if (!$content) {
|
||||
@@ -1140,6 +1164,9 @@ class Common extends CI_Controller
|
||||
} else if ($type == 'customer') {
|
||||
$this->load->model('receiver/receiver_customer_oplogs_model', 'mdOplogs');
|
||||
$data['customer_id'] = $id;
|
||||
} else if ($type == 'owners') {
|
||||
$this->load->model('receiver/receiver_owners_oplogs_model', 'mdOplogs');
|
||||
$data['own_id'] = $id;
|
||||
}
|
||||
$this->mdOplogs->add($data);//增加操作记录
|
||||
}
|
||||
@@ -1170,9 +1197,12 @@ class Common extends CI_Controller
|
||||
} else if ($type == 'customer') {
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$re = $this->mdCustomers->get(array('id' => $id));
|
||||
} else if ($type == 'owners') {
|
||||
$this->load->model('receiver/receiver_owners_model', 'mdOwners');
|
||||
$re = $this->mdOwners->get(array('id' => $id));
|
||||
}
|
||||
if (!$re['mobile']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '客户不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机不存在!');
|
||||
}
|
||||
$mobile = $re['mobile'];
|
||||
$cache = &load_cache('redis');
|
||||
@@ -1451,24 +1481,38 @@ class Common extends CI_Controller
|
||||
$pid = intval($this->input->get('pid'));
|
||||
$name = $this->input->get('name');
|
||||
$tp = intval($this->input->get('tp'));//0搜索使用,1修改使用
|
||||
$status = intval($this->input->get('status'));
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdAutoSeries');
|
||||
$this->load->model('auto/auto_attr_model', 'mdAutoAttr');
|
||||
$res = $lists = array();
|
||||
$res = $lists = $where = [];
|
||||
if ($status == 3) {//搜索专用
|
||||
$where['status'] = 1;
|
||||
} else {
|
||||
$where['status>'] = -1;
|
||||
}
|
||||
if ($type == 1) {
|
||||
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择品牌');
|
||||
$res = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
#$res = $this->mdAutoBrand->select($where, 'id desc', 0, 0, 'id,name');
|
||||
$res = array();
|
||||
$rows = $this->mdAutoBrand->select($where, 'status desc, id asc', 0, 0, 'id,name');
|
||||
foreach($rows as $v){
|
||||
$res[] = array(
|
||||
'id' => strlen($status) > 0 ? $v['id'] : " " . $v['id'],
|
||||
'name' => $v['name'],
|
||||
);
|
||||
}
|
||||
} else if ($type == 2) {
|
||||
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择车系');
|
||||
$res = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $pid), 'id desc', 0, 0, 'id,name');
|
||||
$res = $this->mdAutoSeries->select(array_merge($where, ['brand_id' => $pid]), 'id desc', 0, 0, 'id,name');
|
||||
} else if ($type == 3) {
|
||||
$tp == 0 && $lists[] = array('id' => 0, 'name' => $name ? $name : '选择车型');
|
||||
$res = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $pid), 'id desc', 0, 0, 'id,title as name');
|
||||
$res = $this->mdAutoAttr->select(array_merge($where, ['type' => 1, 's_id' => $pid]), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
if ($tp == 1 && $type == 3) {
|
||||
$lists[3] = $res;//车型
|
||||
$lists[4] = $this->mdAutoAttr->select(array('type' => 0, 's_id' => $pid), 'id desc', 0, 0, 'id,title as name');//车身颜色
|
||||
$lists[5] = $this->mdAutoAttr->select(array('type' => 2, 's_id' => $pid), 'id desc', 0, 0, 'id,title as name');//内饰颜色
|
||||
$lists[4] = $this->mdAutoAttr->select(array_merge($where, ['type' => 0, 's_id' => $pid]), 'id desc', 0, 0, 'id,title as name');//车身颜色
|
||||
$lists[5] = $this->mdAutoAttr->select(array_merge($where, ['type' => 2, 's_id' => $pid]), 'id desc', 0, 0, 'id,title as name');//内饰颜色
|
||||
} else {
|
||||
foreach ($res as $key => $value) {
|
||||
$lists[] = array('id' => $value['id'], 'name' => $value['name']);
|
||||
@@ -1519,7 +1563,7 @@ class Common extends CI_Controller
|
||||
|
||||
$count = $this->items_model->count($fhwhere);
|
||||
if ($count) {
|
||||
$rows = $this->items_model->select($fhwhere, "id desc", $page, $size, 'id,brand_id,s_id,v_id,cor_id,incor_id,vin');
|
||||
$rows = $this->items_model->select($fhwhere, "id desc", $page, $size, 'id,brand_id,s_id,v_id,cor_id,incor_id,vin,buy_price,estimated_rebate');
|
||||
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
@@ -1536,7 +1580,9 @@ class Common extends CI_Controller
|
||||
foreach ($rows as $key => $val) {
|
||||
$setval = [
|
||||
'id' => $val['id'],
|
||||
'vin' => $val['vin']
|
||||
'vin' => $val['vin'],
|
||||
'buy_price' => $val['buy_price'],
|
||||
'estimated_rebate' => $val['estimated_rebate'],
|
||||
];
|
||||
$setval['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
$setval['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
|
||||
@@ -28,4 +28,138 @@ class Img extends CI_Controller
|
||||
$data = '/liche/0f48c61017285abc0cff63f59ea5a25f.jpg,/liche/be842659e04f9b5b7bf3f9ab1459c611.jpg';
|
||||
echo base64_encode($data);
|
||||
}
|
||||
|
||||
//下载合同图片
|
||||
public function down_contracts(){
|
||||
$this->load->library('Ordersv2List');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_contracts_model', 'order_contracts_model');
|
||||
require_once COMMPATH.'/third_party/TCPDF/tcpdf.php';
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$sid = $this->input->get('sid');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 5;
|
||||
$params = [
|
||||
'status_pid' => 0,
|
||||
'status' => 1,
|
||||
'brand_id' => $brand_id,
|
||||
'page' => $page,
|
||||
'size' => $size,
|
||||
// 'order_time' => "2022-03-01 ~ 2022-05-22",
|
||||
];
|
||||
$sid && $params['sid'] = $sid;
|
||||
$result = $this->ordersv2list->lists($params['status_pid'], $params);
|
||||
$lists = $result['lists'];
|
||||
$type_arr = [0=>'汽车购车协议',1=>'委托服务协议',2=>'车辆确定',3=>'车辆交付'];
|
||||
$old_type_arr = [0=>'整车合同',1=>'委托服务协议',2=>'车辆确定',3=>'交车信息',4=>'车辆买卖合同补充协议',5=>'委托服务补充协议'];
|
||||
if($lists){
|
||||
foreach ($lists as $key => $val) {
|
||||
echo "开始订单:{$val['o_id']}<br>";
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$val['o_id']],'sid,owner_mobile,owner_name');
|
||||
$contract = $this->order_contracts_model->select(['o_id'=>$val['o_id'],"imgs <> ''",'type'=>0],'','','','id,o_id,file,imgs,type');
|
||||
if($contract){
|
||||
foreach ($contract as $v) {
|
||||
$path = FCPATH."pdf/{$row['owner_name']}";
|
||||
$row['owner_mobile'] && $path .= "({$row['owner_mobile']})";
|
||||
if($val['o_id']>=10000){
|
||||
$file_name = $type_arr[$v['type']] ? $type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
|
||||
}else{
|
||||
$file_name = $old_type_arr[$v['type']] ? $old_type_arr[$v['type']].'.pdf' : '其它_'.time().'.pdf';
|
||||
}
|
||||
if(file_exists($path.'/'.$file_name)){
|
||||
echo "合同id:{$v['id']},已生成<br>";
|
||||
continue;
|
||||
}
|
||||
$imgs = json_decode($v['imgs'],true);
|
||||
if(is_array($imgs)){
|
||||
if (!file_exists($path)) {
|
||||
$oldumask = umask(0);
|
||||
mkdir($path, 0777, true);
|
||||
umask($oldumask);
|
||||
}
|
||||
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,true, 'UTF-8', false);
|
||||
$pdf->SetCreator(PDF_CREATOR);
|
||||
//删除预定义的打印 页眉/页尾
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
//设置默认等宽字体
|
||||
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
||||
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||
$pdf->SetFont('stsongstdlight', '', 20);
|
||||
$pdf->AddPage();
|
||||
$options = array(
|
||||
// 解决SSL证书验证失败的问题
|
||||
"ssl"=>array(
|
||||
"verify_peer"=>false,
|
||||
"verify_peer_name"=>false,
|
||||
)
|
||||
);
|
||||
//设置文件信息
|
||||
foreach ($imgs as $item) {
|
||||
$img_url = build_qiniu_image_url($item);
|
||||
$res = file_get_contents($img_url,false, stream_context_create($options));
|
||||
$pdf->Ln();
|
||||
$pdf->Image('@'.$res, '', '', '', '', '', $img_url,'' , false, 300, '', false, false, 0.05, false, false, false);
|
||||
}
|
||||
|
||||
$pdf->Output( $path.'/'.$file_name,'F');
|
||||
echo "合同id:{$v['id']},保存成功{$path}/{$file_name}<br>";
|
||||
}else{
|
||||
file_get_contents("https://api.liche.cn/wxapp/licheb/protocol/pdf_img?id={$v['id']}");
|
||||
echo "合同id:{$v['id']},没有图片<br>";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo "订单:{$val['o_id']},没有合同<br>";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo "执行结束";
|
||||
}
|
||||
}
|
||||
//修改文件名
|
||||
public function change_dir_name(){
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$path = FCPATH."pdf/";
|
||||
//PHP遍历所有文件夹
|
||||
$handle=opendir($path.".");
|
||||
$array_file = array();
|
||||
while (false !== ($file = readdir($handle)))
|
||||
{
|
||||
if ($file != "." && $file != "..") {
|
||||
$array_file[] = $file; //输出文件名
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
if(is_array($array_file)){
|
||||
foreach ($array_file as $item) {
|
||||
if(is_numeric($item)){
|
||||
$dir = $path.$item;
|
||||
$arr = scandir($dir);
|
||||
$len = count($arr)-2;
|
||||
if($len>0){
|
||||
$row = $this->receiver_orders_v2_model->get(['sid'=>$item],'owner_mobile,owner_name');
|
||||
if($row){
|
||||
$rename = $path.$row['owner_name'];
|
||||
$row['owner_mobile'] && $rename.="({$row['owner_mobile']})";
|
||||
if(rename($dir,$rename)){
|
||||
echo "更名成功{$rename}<br>";
|
||||
}else{
|
||||
echo "更名失败{$item}<br>";
|
||||
}
|
||||
}else{
|
||||
echo "订单不存在{$item}<br>";
|
||||
}
|
||||
}else{
|
||||
@unlink($dir);
|
||||
echo "删除文件夹:{$dir}<br>";
|
||||
}
|
||||
}else{
|
||||
echo "无需改名:{$item}.<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
-22
@@ -18,7 +18,11 @@ class Login extends CI_Controller
|
||||
header('Location:/welcome');
|
||||
}
|
||||
|
||||
$this->load->view('login_sms');
|
||||
$arr = array();
|
||||
if ($this->input->get('need_code') == 'logsms'){
|
||||
$arr['need_code'] = 'logsms';
|
||||
}
|
||||
$this->load->view('login', $arr);
|
||||
}
|
||||
|
||||
public function post()
|
||||
@@ -33,20 +37,21 @@ class Login extends CI_Controller
|
||||
return false;
|
||||
}
|
||||
$log = 0;//加日志
|
||||
if ($this->input->post('need_code') == 'login') {
|
||||
if ($this->input->post('need_code') == 'login' || $this->input->post('need_code') == 'logsms') {
|
||||
$code = $this->input->post('code');
|
||||
$mobile = $this->input->post('mobile');
|
||||
$this->input->post('need_code') == 'logsms' && $mobile = $this->input->post('number');
|
||||
$cookie = $this->input->cookie(LOGIN_CODE_COOKIE);
|
||||
$code_cookie = $this->encryption->decrypt($cookie);
|
||||
if (!$code_cookie) {
|
||||
return $this->show_json(0, '请输入正确验证码');
|
||||
return $this->show_json(0, '验证码已过期');
|
||||
}
|
||||
if ($code_cookie != $code) {
|
||||
return $this->show_json(0, '验证码错误');
|
||||
}
|
||||
$this->load->model('sys/sys_admin_model');
|
||||
$admin_user = $this->sys_admin_model->get(array("mobile" => $mobile, 'status' => 1));
|
||||
if(!$admin_user){
|
||||
$admin_user = $this->sys_admin_model->get(array("mobile = '{$mobile}'" => null, 'status' => 1));
|
||||
if (!$admin_user['id']) {
|
||||
return $this->show_json(0, '用户不存在');
|
||||
}
|
||||
$log = 1;
|
||||
@@ -69,16 +74,16 @@ class Login extends CI_Controller
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], "admin.dev.liche.cn") || false !== strpos($_SERVER['HTTP_HOST'], "admin.lc.haodian.cn")) {
|
||||
//开发测试不校验IP
|
||||
} elseif (filter_var($ip, FILTER_VALIDATE_IP)) {
|
||||
$this->load->model('sys/sys_config_model');
|
||||
$config_ip = $this->sys_config_model->select(array("v LIKE '%\"status\":\"1\"%'" => NULL, "k" => "site"));
|
||||
foreach ($config_ip as $key => $value) {
|
||||
$ip_arr[] = json_decode($value['v'])->ip;
|
||||
}
|
||||
$ip_arr = array_merge($ip_arr, array_column($this->sys_admin_model->select(array(), '', '', '', 'login_ip'), 'login_ip'));
|
||||
if (!in_array($ip, $ip_arr)) {
|
||||
$check_view = true;
|
||||
$log = 1;
|
||||
}
|
||||
// $this->load->model('sys/sys_config_model');
|
||||
// $config_ip = $this->sys_config_model->select(array("v LIKE '%\"status\":\"1\"%'" => NULL, "k" => "site"));
|
||||
// foreach ($config_ip as $key => $value) {
|
||||
// $ip_arr[] = json_decode($value['v'])->ip;
|
||||
// }
|
||||
// $ip_arr = array_merge($ip_arr, array_column($this->sys_admin_model->select(array(), '', '', '', 'login_ip'), 'login_ip'));
|
||||
// if (!in_array($ip, $ip_arr)) {
|
||||
// $check_view = true;
|
||||
// $log = 1;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,10 +124,13 @@ class Login extends CI_Controller
|
||||
{
|
||||
if ($this->input->method() == 'post') {
|
||||
$mobile = $this->input->post('mobile', true);
|
||||
if (!$mobile){
|
||||
return false;
|
||||
}
|
||||
$this->load->model('sys/sys_admin_model');
|
||||
$admin_user = $this->sys_admin_model->get(array("mobile" => $mobile, 'status' => 1));
|
||||
if(!$admin_user){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入正确手机号');
|
||||
$admin_user = $this->sys_admin_model->get(array("mobile = '{$mobile}'" => null, 'status' => 1));
|
||||
if (!$admin_user['id']) {
|
||||
return false;
|
||||
}
|
||||
$code = rand(100000, 999999);
|
||||
|
||||
@@ -131,10 +139,7 @@ class Login extends CI_Controller
|
||||
$domain = implode('.', $domain);
|
||||
|
||||
$this->input->set_cookie(LOGIN_CODE_COOKIE, $this->encryption->encrypt(json_encode($code)), 60 * 5, $domain);
|
||||
// send_sms($mobile, $code);
|
||||
$content = "【东创宝】您的验证码为:{$code},请勿泄露于他人!";
|
||||
b2m_send_sms($mobile,$content);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '验证码已发送');
|
||||
send_sms($mobile, $code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class Outer extends CI_Controller {
|
||||
public function index()
|
||||
{
|
||||
$this->load->model('sys/sys_menu_model');
|
||||
$list = $this->sys_menu_model->select(array('status' => 1,'type'=>0), 'sort desc', 0, 0);
|
||||
$list = $this->sys_menu_model->select(array('status' => 1), 'sort desc', 0, 0);
|
||||
$this->load->model('sys/sys_role_model');
|
||||
$role = $this->sys_role_model->get(array('id' => $this->role));
|
||||
$menu_ids = explode(',', $role['menu_ids']);
|
||||
@@ -46,7 +46,7 @@ class Outer extends CI_Controller {
|
||||
unset($map);
|
||||
|
||||
//获取面包屑
|
||||
$menus = $this->sys_menu_model->select(array("url like '" . $url . "%'" => null, 'status' => 1, 'outer_link' => 1,'type'=>0));
|
||||
$menus = $this->sys_menu_model->select(array("url like '" . $url . "%'" => null, 'status' => 1, 'outer_link' => 1));
|
||||
$menu = array();
|
||||
foreach($menus as $item){
|
||||
if(!$menu){
|
||||
@@ -65,7 +65,7 @@ class Outer extends CI_Controller {
|
||||
$spm_arr1 = explode('-', $spm);
|
||||
$spm_arr1 && !is_numeric($spm_arr1[0]) && $spm_arr1 = array_slice($spm_arr1, 1);
|
||||
if($spm_arr1){
|
||||
$rows = $this->sys_menu_model->select(array("id in (" . implode(",",$spm_arr1) . ")" => null, 'status' => 1,'type'=>0), 'sort desc');
|
||||
$rows = $this->sys_menu_model->select(array("id in (" . implode(",",$spm_arr1) . ")" => null, 'status' => 1), 'sort desc');
|
||||
$menu_arr = array();
|
||||
$breads = array();
|
||||
foreach($rows as $row){
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:盲盒抽奖
|
||||
* Created on: 2022/07/14 13:38
|
||||
* Created by: dengbw
|
||||
*/
|
||||
|
||||
class Blindbox extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/liche/app_liche_blind_box_model', 'mdBlindBox');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$lists = array();
|
||||
$where = array('status>' => -1);
|
||||
$count = $this->mdBlindBox->count($where);
|
||||
if ($count) {
|
||||
$this->load->library('MyEncryption');
|
||||
$res = $this->mdBlindBox->select($where, 'id desc', $params['page'], $params['size']);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['title'] = $value['title'];
|
||||
$setValue['s_time'] = $value['s_time'];
|
||||
$setValue['e_time'] = $value['e_time'];
|
||||
$setValue['c_time'] = date('Y-m-d H:i', $value['c_time']);
|
||||
$setValue['status_name'] = $this->mdBlindBox->statusAry($value['status']);
|
||||
$url = http_host_com('home') . "/h5/syt/blindbox?skey=" . $this->myencryption->base64url_encode("id=" . $value['id']);
|
||||
$setValue['url'] = urlencode($url);
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['_title'] = '盲盒抽奖列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
return $this->show_view('/app/liche/blindbox/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$id = intval($params['id']);
|
||||
$title = $time = $rule = $prizes_content = $prizes_note = $prizes_winning_ins = $share_desc = $bottom_word =
|
||||
$bg_color = $lottery_num = '';
|
||||
$bg_img = $share_img = ['value' => '', 'src' => ''];
|
||||
$prizes_list = [];
|
||||
if ($id > 0) {
|
||||
$re = $this->mdBlindBox->get(array('id' => $id));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$_title = '编辑盲盒抽奖';
|
||||
$dataInfo['editType'] = 0;
|
||||
$dataInfo['edit_url'] = '/app/liche/blindbox/edit';
|
||||
$dataInfo['status'] = $re['status'];
|
||||
$title = $re['title'];
|
||||
$re['s_time'] && $time = $re['s_time'] . " ~ " . $re['e_time'];
|
||||
$lottery_num = $re['lottery_num'];
|
||||
if ($re['jsondata']) {
|
||||
$jsondata = json_decode($re['jsondata'], true);
|
||||
if ($jsondata['bg_img']) {
|
||||
$bg_img['value'] = $jsondata['bg_img'];
|
||||
$bg_img['src'] = build_qiniu_image_url($jsondata['bg_img']);
|
||||
}
|
||||
$jsondata['bg_color'] && $bg_color = $jsondata['bg_color'];
|
||||
$jsondata['share_desc'] && $share_desc = $jsondata['share_desc'];
|
||||
if ($jsondata['share_img']) {
|
||||
$share_img['value'] = $jsondata['share_img'];
|
||||
$share_img['src'] = build_qiniu_image_url($jsondata['share_img']);
|
||||
}
|
||||
$jsondata['bottom_word'] && $bottom_word = $jsondata['bottom_word'];
|
||||
$jsondata['rule'] && $rule = $jsondata['rule'];
|
||||
}
|
||||
if ($re['prizes']) {//奖品配置
|
||||
$prizes = json_decode($re['prizes'], true);
|
||||
$prizes_content = $prizes['content'];
|
||||
$prizes_note = $prizes['note'];
|
||||
$prizes_winning_ins = $prizes['winning_ins'];
|
||||
foreach ($prizes['list'] as $key => $value) {
|
||||
$value['img_src'] = $value['img_value'] ? build_qiniu_image_url($value['img_value']) : '';
|
||||
$prizes_list[] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_title = '新增盲盒抽奖';
|
||||
$dataInfo['editType'] = 2;
|
||||
$dataInfo['edit_url'] = '/app/liche/blindbox/add';
|
||||
$dataInfo['status'] = 0;
|
||||
}
|
||||
$status_list = [];
|
||||
foreach ($this->mdBlindBox->statusAry() as $key => $value) {
|
||||
$status_list[] = array("id" => $key, "name" => $value);
|
||||
}
|
||||
$dataInfo['id'] = $id;
|
||||
$dataInfo['title'] = $title;
|
||||
$dataInfo['bg_img'] = $bg_img;
|
||||
$dataInfo['bg_color'] = $bg_color;
|
||||
$dataInfo['time'] = $time;
|
||||
$dataInfo['lottery_num'] = $lottery_num;
|
||||
$dataInfo['share_desc'] = $share_desc;
|
||||
$dataInfo['share_img'] = $share_img;
|
||||
$dataInfo['bottom_word'] = $bottom_word;
|
||||
$dataInfo['rule'] = $rule;
|
||||
$dataInfo['prizes_content'] = $prizes_content;
|
||||
$dataInfo['prizes_note'] = $prizes_note;
|
||||
$dataInfo['prizes_winning_ins'] = $prizes_winning_ins;
|
||||
$this->data['info'] = $dataInfo;
|
||||
$this->data['status_list'] = $status_list;
|
||||
$this->data['prizes_list'] = $prizes_list;
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view('/app/liche/blindbox/edit', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$checkData = $this->checkData($info);
|
||||
if (!$checkData['code']) {
|
||||
return $this->show_json($checkData['code'], $checkData['msg']);
|
||||
}
|
||||
$re = $this->mdBlindBox->get(array("title" => $info['title'], "status<>" => -1));
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '该标题已存在!');
|
||||
}
|
||||
$json_data['bg_img'] = $info['bg_img']['value'];
|
||||
$json_data['bg_color'] = $info['bg_color'];
|
||||
$json_data['share_desc'] = $info['share_desc'];
|
||||
$json_data['share_img'] = $info['share_img']['value'];
|
||||
$json_data['bottom_word'] = $info['bottom_word'];
|
||||
$json_data['rule'] = $info['rule'];
|
||||
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$prizes['content'] = $info['prizes_content'];
|
||||
$prizes['note'] = $info['prizes_note'];
|
||||
$prizes['winning_ins'] = $info['prizes_winning_ins'];
|
||||
$prizes_list = [];
|
||||
foreach ($info['prizes_list'] as $key => $value) {
|
||||
unset($value['img_src']);
|
||||
$prizes_list[] = $value;
|
||||
}
|
||||
$prizes['list'] = $prizes_list;
|
||||
$prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE);
|
||||
$addData = ["title" => $info['title'], "lottery_num" => $info['lottery_num'], "jsondata" => $jsondata, "prizes" => $prizes
|
||||
, "status" => $info['status'], "c_time" => time()];
|
||||
if ($info['time']) {
|
||||
$time = explode(' ~ ', $info['time']);
|
||||
$addData['s_time'] = $time[0];
|
||||
$addData['e_time'] = $time[1];
|
||||
}
|
||||
$id = $this->mdBlindBox->add($addData);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '新增失败!');
|
||||
}
|
||||
$this->data['type'] = 'add';
|
||||
$this->data['id'] = $id;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '新增成功!');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$checkData = $this->checkData($info);
|
||||
if (!$checkData['code']) {
|
||||
return $this->show_json($checkData['code'], $checkData['msg']);
|
||||
}
|
||||
if (!$info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$json_data['bg_img'] = $info['bg_img']['value'];
|
||||
$json_data['bg_color'] = $info['bg_color'];
|
||||
$json_data['share_desc'] = $info['share_desc'];
|
||||
$json_data['share_img'] = $info['share_img']['value'];
|
||||
$json_data['bottom_word'] = $info['bottom_word'];
|
||||
$json_data['rule'] = $info['rule'];
|
||||
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$prizes['content'] = $info['prizes_content'];
|
||||
$prizes['note'] = $info['prizes_note'];
|
||||
$prizes['winning_ins'] = $info['prizes_winning_ins'];
|
||||
$prizes_list = [];
|
||||
foreach ($info['prizes_list'] as $key => $value) {
|
||||
unset($value['img_src']);
|
||||
$prizes_list[] = $value;
|
||||
}
|
||||
$prizes['list'] = $prizes_list;
|
||||
$prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE);
|
||||
$updateData = ["title" => $info['title'], "lottery_num" => $info['lottery_num'], "jsondata" => $jsondata, "prizes" => $prizes];
|
||||
if ($info['time']) {
|
||||
$time = explode(' ~ ', $info['time']);
|
||||
$updateData['s_time'] = $time[0];
|
||||
$updateData['e_time'] = $time[1];
|
||||
}
|
||||
$this->mdBlindBox->update($updateData, ['id' => $info['id']]);
|
||||
$this->data['type'] = 'edit';
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:修改状态
|
||||
* Created on: 2020/8/24 11:12
|
||||
* Created by: dengbw
|
||||
* @return bool|void
|
||||
*/
|
||||
public function edit_status()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
if (!$info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$this->mdBlindBox->update(array("status" => intval($info['status'])), array('id' => $info['id']));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes:检查新增/修改数据
|
||||
* Created on: 2020/8/20 11:59
|
||||
* Created by: dengbw
|
||||
* @param $info
|
||||
* @return array
|
||||
*/
|
||||
private function checkData($info)
|
||||
{
|
||||
$msg = '';
|
||||
$code = SYS_CODE_FAIL;
|
||||
if (!$info) {
|
||||
$msg = '非法参数';
|
||||
} else if (!$info['title']) {
|
||||
$msg = '请输入标题';
|
||||
} else if (!$info['bg_img']) {
|
||||
$msg = '请上传背景图片';
|
||||
} else if (!$info['bg_color']) {
|
||||
$msg = '请上传背景颜色';
|
||||
} else if (!$info['time']) {
|
||||
$msg = '请选择活动时间';
|
||||
} else if (!$info['rule']) {
|
||||
$msg = '请输入其它事项';
|
||||
} else {
|
||||
$code = SYS_CODE_SUCCESS;
|
||||
}
|
||||
return array('code' => $code, 'msg' => $msg);
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ class Main extends HD_Controller
|
||||
$this->load->model('bobing/bobing_user_model', 'mdBobingUser');
|
||||
$this->load->model('app/user_accountlog_model');
|
||||
$this->load->model('app/liche/app_liche_luckybag_users_model', 'mdLuckyBagUsers');
|
||||
$this->load->model('app/liche/app_liche_blind_box_model', 'mdBlindBox');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -57,6 +58,28 @@ class Main extends HD_Controller
|
||||
),
|
||||
);
|
||||
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$value = $this->mdAutoIntroduce->count(["status<>-1" => null, 'brand_id in (select id from lc_auto_brand where status > -1)' => null]);
|
||||
$list[] = array(
|
||||
'title' => '车型介绍(条)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/auto/introduce'),
|
||||
),
|
||||
);
|
||||
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
$list = [];
|
||||
$value = $this->mdBlindBox->count(['status>' => -1]);
|
||||
$list[] = array(
|
||||
'title' => '盲盒抽奖(个)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/liche/blindbox'),
|
||||
),
|
||||
);
|
||||
|
||||
$value = $this->mdTopics->count(array('app_id' => $this->app_id));
|
||||
$list[] = array(
|
||||
'title' => '专题(个)',
|
||||
@@ -99,7 +122,7 @@ class Main extends HD_Controller
|
||||
);
|
||||
|
||||
//消费订单
|
||||
$this->load->model('apporder/order_purchase_model');
|
||||
/*$this->load->model('apporder/order_purchase_model');
|
||||
$value = $this->order_purchase_model->count(array('app_id' => $this->app_id));
|
||||
$list[] = array(
|
||||
'title' => '消费订单(笔)',
|
||||
@@ -107,7 +130,7 @@ class Main extends HD_Controller
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/order/purchase?app_id=' . $this->app_id),
|
||||
),
|
||||
);
|
||||
);*/
|
||||
|
||||
//分销体现
|
||||
$value = $this->user_accountlog_model->count_log(array('lc_app_user_account.app_id' => $this->app_id,'lc_app_user_accountlog.trade_type'=>2));
|
||||
@@ -120,7 +143,7 @@ class Main extends HD_Controller
|
||||
);
|
||||
|
||||
//购车
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
/*$this->load->model('app/liche/app_liche_orders_model');
|
||||
$value = $this->app_liche_orders_model->count(['pid'=>0]);
|
||||
$list[] = array(
|
||||
'title' => '购车订单(笔)',
|
||||
@@ -128,17 +151,7 @@ class Main extends HD_Controller
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/liche/order'),
|
||||
),
|
||||
);
|
||||
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$value = $this->mdAutoIntroduce->count(["status<>-1" => null]);
|
||||
$list[] = array(
|
||||
'title' => '车型介绍(条)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/auto/introduce'),
|
||||
),
|
||||
);
|
||||
);*/
|
||||
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
@@ -224,7 +237,7 @@ class Main extends HD_Controller
|
||||
$order = $this->receiver_orders_model->get(['id'=>$val['item_id']]);
|
||||
if($order && $order['brand_id']!=3){
|
||||
if(!$p_row){
|
||||
$p_sid = create_order_no(350200,'liche',1,0);
|
||||
$p_sid = create_order_no(350200,'liche');
|
||||
$p_data = [
|
||||
'o_id' => $val['item_id'],
|
||||
'uid' => $val['app_uid'],
|
||||
@@ -247,7 +260,7 @@ class Main extends HD_Controller
|
||||
$su_p_row = $this->app_liche_orders_model->get(['pid'=>$p_id,'type'=>$order_type]);
|
||||
if(!$su_p_row){
|
||||
$money = $this->order_purchase_model->sum('total_price',['type'=>6,'app_uid'=>$val['app_uid'],'item_id'=>$val['item_id']]);
|
||||
$sub_p_sid = create_order_no(350200,'liche',1,$order_type);
|
||||
$sub_p_sid = create_order_no(350200,'liche');
|
||||
$p_data = [
|
||||
'o_id' => $val['item_id'],
|
||||
'uid' => $val['app_uid'],
|
||||
|
||||
@@ -7,6 +7,8 @@ class Member extends HD_Controller{
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/liche/App_liche_users_model', 'userM');
|
||||
$this->load->model('app/liche/app_liche_credits_log_model');
|
||||
$this->load->library('entity/credits_entity');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
@@ -149,4 +151,134 @@ class Member extends HD_Controller{
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//冻结资金
|
||||
public function get_freeze(){
|
||||
$uid = $this->input->get_post('uid');
|
||||
$user = $this->userM->get(['id'=>$uid]);
|
||||
if(!$user){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if($this->input->method() == 'post'){
|
||||
$credit = abs(intval($this->input->post('credits')));
|
||||
$result = $this->credits_entity->freeze($uid,$credit,1);
|
||||
if($result['code']){
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, $result['msg']);
|
||||
}
|
||||
}
|
||||
$this->data['uid'] = $uid;
|
||||
$this->data['user'] = $user;
|
||||
return $this->show_view('app/liche/member/get_freeze');
|
||||
}
|
||||
|
||||
//增加积分
|
||||
public function add_credit(){
|
||||
$uid = $this->input->get_post('uid');
|
||||
$user = $this->userM->get(['id'=>$uid]);
|
||||
if(!$user){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if($this->input->method() == 'post'){
|
||||
$credits = abs(intval($this->input->post('credits')));
|
||||
$remark = $this->input->post('remark');
|
||||
$type = $this->input->post('type');
|
||||
$jsondata['admin_id'] = $this->uid;
|
||||
$result = $this->credits_entity->change($uid,$credits,4,0,$remark,$jsondata);
|
||||
if($result['code']){
|
||||
if($type==2){
|
||||
$this->credits_entity->freeze($uid,$credits);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, $result['msg']);
|
||||
}
|
||||
}
|
||||
$this->data['uid'] = $uid;
|
||||
$this->data['user'] = $user;
|
||||
return $this->show_view('app/liche/member/add_credit');
|
||||
}
|
||||
|
||||
public function get_credit_log(){
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'];
|
||||
$size = $params['size'];
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 40;
|
||||
|
||||
$where = [];
|
||||
|
||||
if(strlen($params['type'])){
|
||||
$where['type'] = $params['type'];
|
||||
}else{
|
||||
$params['type'] = '';
|
||||
}
|
||||
|
||||
$params['uid'] && $where['uid'] = $params['uid'];
|
||||
|
||||
$type_arr = $this->app_liche_credits_log_model->get_type();
|
||||
$count = $this->app_liche_credits_log_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->app_liche_credits_log_model->select($where,'id desc',$page,$size);
|
||||
$uids_arr = array_unique(array_column($rows,'uid'));
|
||||
$users = [];
|
||||
if($uids_arr){
|
||||
$uids_str = implode(',',$uids_arr);
|
||||
$u_where = [
|
||||
"id in ({$uids_str})" => null
|
||||
];
|
||||
$users = $this->userM->map('id','nickname',$u_where,'id desc',0,0,'id,nickname');
|
||||
}
|
||||
foreach($rows as $item){
|
||||
$item['type_cn'] = $type_arr[$item['type']];
|
||||
$item['nickname'] = $users[$item['uid']];
|
||||
$lists[] = $item;
|
||||
}
|
||||
}
|
||||
$this->data['params'] = $params;
|
||||
$this->data['type_arr'] = $type_arr;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['_title'] = '积分日志';
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
|
||||
return $this->show_view('app/liche/member/credit_log_lists',true);
|
||||
}
|
||||
|
||||
//兑换积分
|
||||
public function add_items(){
|
||||
$uid = $this->input->get_post('uid');
|
||||
$user = $this->userM->get(['id'=>$uid]);
|
||||
if(!$user){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if(!$user['mobile']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '兑换失败,用户未授权手机号');
|
||||
}
|
||||
if($this->input->method() == 'post'){
|
||||
$credits = -1 * abs(intval($this->input->post('credits')));
|
||||
$remark = $this->input->post('remark');
|
||||
$item_title = $this->input->post('item_title');
|
||||
$item_code = $this->input->post('item_code');
|
||||
$jsondata['admin_id'] = $this->uid;
|
||||
$jsondata['item_title'] = $item_title;
|
||||
$jsondata['item_code'] = $item_code;
|
||||
$result = $this->credits_entity->change($uid,$credits,5,0,$remark,$jsondata);
|
||||
if($result['code']){
|
||||
//发短信通知
|
||||
$params = [
|
||||
'goods' => $item_title,
|
||||
'code' => $item_code
|
||||
];
|
||||
send_alisms(array('mobile' => $user['mobile'], 'template' => 'SMS_246545017', 'param' => $params));
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '兑换成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, $result['msg']);
|
||||
}
|
||||
}
|
||||
$this->data['uid'] = $uid;
|
||||
$this->data['user'] = $user;
|
||||
return $this->show_view('app/liche/member/add_items');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class Order extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '需支付金额必须大于0');
|
||||
}
|
||||
$this->load->helper('order');
|
||||
$sid = create_order_no(350200,'liche',1,$row['type']);
|
||||
$sid = create_order_no(350200,'liche');
|
||||
$sub_data = [
|
||||
'o_id' => $row['o_id'],
|
||||
'sid' => $sid,
|
||||
|
||||
@@ -26,9 +26,9 @@ class Channel extends HD_Controller
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 50;
|
||||
$lists = [];
|
||||
$where = ['group_id' => 4, 'status' => 1];
|
||||
$where = ['group_id' => 4, 'status' => 1, 'biz_id<>' => 0];
|
||||
if ($params['uname']) {
|
||||
$where['uname like "%' . $params['uname'] . '%"'] = null;
|
||||
}
|
||||
@@ -45,12 +45,16 @@ class Channel extends HD_Controller
|
||||
->join('lc_biz', 'lc_biz.id = lc_app_licheb_channel_biz.biz_id', 'left')
|
||||
->where(['lc_app_licheb_channel_biz.uid' => $value['id'], 'lc_biz.status' => 1])
|
||||
->count_all_results('lc_app_licheb_channel_biz');
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['uname'] = $value['uname'];
|
||||
$setValue['mobile'] = $value['mobile'];
|
||||
$setValue['bizs'] = $bizs;
|
||||
$setValue['c_time'] = date('Y-m-d H:i:s', $value['c_time']);
|
||||
$lists[] = $setValue;
|
||||
if ($bizs > 0) {
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['uname'] = $value['uname'];
|
||||
$setValue['mobile'] = $value['mobile'];
|
||||
$setValue['bizs'] = $bizs;
|
||||
$setValue['c_time'] = date('Y-m-d H:i:s', $value['c_time']);
|
||||
$lists[] = $setValue;
|
||||
} else {
|
||||
$count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
@@ -79,13 +83,15 @@ class Channel extends HD_Controller
|
||||
|
||||
private function dataSelect($params)
|
||||
{
|
||||
$channel_biz_table = $params['group_id1'] ? 'lc_app_licheb_channel_biz1' : 'lc_app_licheb_channel_biz';
|
||||
$lists = [];
|
||||
$where['lc_biz.status'] = 1;
|
||||
$_title = '门店列表';
|
||||
if ($params['uid']) {
|
||||
$where['lc_app_licheb_channel_biz.uid'] = $params['uid'];
|
||||
$where[$channel_biz_table.'.uid'] = $params['uid'];
|
||||
$re = $this->mdUsers->get(array('id' => $params['uid']));
|
||||
$re['uname'] && $_title = $re['uname'] . '_门店列表';
|
||||
$group = $params['group_id1'] ? ' (第二角色)' :'';
|
||||
$re['uname'] && $_title = $re['uname'] .$group. '_门店列表';
|
||||
}
|
||||
!$params['city_id'] && $params['city_id'] = '';
|
||||
!$params['county_id'] && $params['county_id'] = '';
|
||||
@@ -98,20 +104,20 @@ class Channel extends HD_Controller
|
||||
if ($params['county_id']) {
|
||||
$where['lc_biz.county_id'] = $params['county_id'];
|
||||
}
|
||||
$count = $this->db->select('lc_app_licheb_channel_biz.biz_id')
|
||||
->join('lc_biz', 'lc_biz.id = lc_app_licheb_channel_biz.biz_id', 'left')
|
||||
$count = $this->db->select($channel_biz_table.'.biz_id')
|
||||
->join('lc_biz', 'lc_biz.id = '.$channel_biz_table.'.biz_id', 'left')
|
||||
->where($where)
|
||||
->count_all_results('lc_app_licheb_channel_biz');
|
||||
->count_all_results($channel_biz_table);
|
||||
if ($count) {
|
||||
$offset = ($params['page'] - 1) * $params['size'];
|
||||
$limit = $params['size'];
|
||||
$this->db->from('lc_app_licheb_channel_biz');
|
||||
$this->db->join('lc_biz', "lc_biz.id = lc_app_licheb_channel_biz.biz_id", 'left');
|
||||
$this->db->from($channel_biz_table);
|
||||
$this->db->join('lc_biz', "lc_biz.id = ".$channel_biz_table.".biz_id", 'left');
|
||||
$this->db->select('lc_biz.id,lc_biz.biz_name,lc_biz.county_id,lc_biz.c_time');
|
||||
$this->db->where($where);
|
||||
$this->db->order_by('lc_app_licheb_channel_biz.id Desc');
|
||||
$this->db->order_by($channel_biz_table.'.id Desc');
|
||||
$this->db->limit($limit, $offset);
|
||||
!$params['uid'] && $this->db->group_by('lc_app_licheb_channel_biz.biz_id');
|
||||
!$params['uid'] && $this->db->group_by($channel_biz_table.'.biz_id');
|
||||
$res = $this->db->get()->result_array();
|
||||
$county_id_arr = array_unique(array_column($res, 'county_id'));
|
||||
$Areas = $this->mdArea->get_map_by_county_ids($county_id_arr, 'city_name,county_name,county_id', 'county_id');
|
||||
@@ -127,10 +133,10 @@ class Channel extends HD_Controller
|
||||
$setValue['orders'] = $this->mdOrders->count(['biz_id' => $value['id'], 'status>=' => 0, 'brand_id<>' => 3, 'biz_id<>' => 1]);
|
||||
$setValue['days'] = round((time() - $value['c_time']) / 3600 / 24) . '天';
|
||||
if (!$params['uid']) {
|
||||
$this->db->from('lc_app_licheb_channel_biz');
|
||||
$this->db->join('lc_app_licheb_users', "lc_app_licheb_users.id = lc_app_licheb_channel_biz.uid", 'left');
|
||||
$this->db->from($channel_biz_table);
|
||||
$this->db->join('lc_app_licheb_users', "lc_app_licheb_users.id = ".$channel_biz_table.".uid", 'left');
|
||||
$this->db->select('lc_app_licheb_users.uname');
|
||||
$this->db->where(['lc_app_licheb_channel_biz.biz_id' => $value['id']]);
|
||||
$this->db->where([$channel_biz_table.'.biz_id' => $value['id']]);
|
||||
$res_u = $this->db->get()->result_array();
|
||||
$unames = $res_u ? implode(',', array_column($res_u, 'uname')) : '';
|
||||
$setValue['uname'] = $unames;
|
||||
|
||||
@@ -20,7 +20,8 @@ class Main extends HD_Controller
|
||||
$this->load->model('app/material/Material_biz_model', 'mdMaterialBiz');
|
||||
$this->load->model('topics/topics_model', 'mdTopics');
|
||||
$this->load->model('live/Live_polyv_session_model', 'mdPolyvSession');
|
||||
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
|
||||
$this->load->model('app/licheb/app_licheb_bizs_log_model', 'mdBizsLog');
|
||||
$this->load->model('app/licheb/syt_live_model', 'mdSytLive');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -36,7 +37,7 @@ class Main extends HD_Controller
|
||||
'title' => '用户(人)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/licheb/member/index'),
|
||||
array('name' => '查看详情', 'url' => '/app/licheb/member/index?status=1'),
|
||||
),
|
||||
);
|
||||
$value = $this->userM->count(['group_id' => 4, 'status' => 1]);
|
||||
@@ -65,7 +66,15 @@ class Main extends HD_Controller
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-home', 'list' => $list);
|
||||
|
||||
$list = array();
|
||||
/*$list = array();
|
||||
$value = $this->mdSytLive->count(['status>' => -1]);
|
||||
$list[] = array(
|
||||
'title' => '私域通-直播(个)',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => '/app/licheb/sytlive'),
|
||||
),
|
||||
);
|
||||
$value = $this->mdTopics->count(array('app_id' => $this->app_id));
|
||||
$list[] = array(
|
||||
'title' => '专题(个)',
|
||||
@@ -90,16 +99,16 @@ class Main extends HD_Controller
|
||||
array('name' => '查看详情', 'url' => '/live/polyv'),
|
||||
),
|
||||
);
|
||||
$value = $this->mdUsersLog->count();
|
||||
$value = $this->mdBizsLog->count();
|
||||
$list[] = array(
|
||||
'title' => '顾问日志',
|
||||
'title' => '门店日志',
|
||||
'value' => $value,
|
||||
'btns' => array(
|
||||
array('name' => '查看详情', 'url' => 'app/licheb/userslog'),
|
||||
),
|
||||
);
|
||||
$conditions[] = array('icon' => 'am-icon-user', 'list' => $list);
|
||||
|
||||
*/
|
||||
/*小程序设置 end*/
|
||||
|
||||
/*实时数据 end*/
|
||||
|
||||
@@ -12,6 +12,7 @@ class Member extends HD_Controller
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/App_licheb_users_model', 'userM');
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz1_model', 'mdChannelBiz1');
|
||||
$this->load->model("biz/biz_model");
|
||||
}
|
||||
|
||||
@@ -48,7 +49,9 @@ class Member extends HD_Controller
|
||||
$params['county_id'] = '';
|
||||
$params['biz_id'] = '';
|
||||
}
|
||||
|
||||
if(strlen($params['status'])){
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
$count = $this->userM->count($where);
|
||||
$lists = $this->userM->select($where, 'id desc', $page, $size);
|
||||
foreach ($lists as $key => $val) {
|
||||
@@ -56,11 +59,22 @@ class Member extends HD_Controller
|
||||
if ($val['group_id'] == 4) {
|
||||
$biz_name = ' <a href="javascript:void(0)" data-open="/app/licheb/channel/lists_biz?uid=' . $val['id'] . '">门店列表</a>';
|
||||
} else if ($val['biz_id']) {
|
||||
$re_biz = $this->biz_model->get(['id' => $val['biz_id'], 'status' => 1], 'biz_name');
|
||||
$re_biz = $this->biz_model->get(['id' => $val['biz_id']], 'biz_name');
|
||||
$re_biz && $biz_name = $re_biz['biz_name'];
|
||||
}
|
||||
$lists[$key]['biz_name'] = $biz_name;
|
||||
$lists[$key]['group_name'] = $this->groups[$val['group_id']];
|
||||
|
||||
$biz_name = '';
|
||||
if ($val['group_id1'] == 4) {
|
||||
$biz_name = ' <a href="javascript:void(0)" data-open="/app/licheb/channel/lists_biz?group_id1=1&uid=' . $val['id'] . '">门店列表</a>';
|
||||
} else if ($val['biz_id1']) {
|
||||
$re_biz = $this->biz_model->get(['id' => $val['biz_id1']], 'biz_name');
|
||||
$re_biz && $biz_name = $re_biz['biz_name'];
|
||||
}
|
||||
$lists[$key]['biz_name1'] = $biz_name;
|
||||
$lists[$key]['group_name1'] = $this->groups[$val['group_id1']];
|
||||
|
||||
if (SUPER_ADMIN == $this->role) {//超级管理员才允许操作用户的披上超级马甲
|
||||
$majia = array();
|
||||
if ($val['jsondata']) {
|
||||
@@ -88,6 +102,7 @@ class Member extends HD_Controller
|
||||
$id = $this->input->get('id');
|
||||
$row = $this->userM->get(['id' => $id]);
|
||||
$selectedBrands = [];
|
||||
$selectedBrands1 = [];
|
||||
if ($id) {
|
||||
$info = array(
|
||||
'id' => $row['id'],
|
||||
@@ -96,6 +111,9 @@ class Member extends HD_Controller
|
||||
'group_id' => $row['group_id'],
|
||||
'biz_id' => $row['biz_id'],
|
||||
'city_id' => $row['city_id'],
|
||||
'group_id1' => $row['group_id1'],
|
||||
'biz_id1' => $row['biz_id1'],
|
||||
'city_id1' => $row['city_id1'],
|
||||
);
|
||||
if ($row['group_id'] == 4) {
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz_model', 'mdChannelBiz');
|
||||
@@ -104,7 +122,9 @@ class Member extends HD_Controller
|
||||
if ($res_biz) {
|
||||
$biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
|
||||
$ids = implode(',', $biz_id_arr);
|
||||
$selectedBrands = $this->biz_model->select(["id in ($ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$selectedBrands = $this->biz_model->select(["id in ($ids)" => null, "type in ($type_ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
|
||||
}
|
||||
} else if ($row['biz_id']) {
|
||||
$re_biz = $this->biz_model->get(["id" => $row['biz_id'], 'status' => 1], 'id ,biz_name');
|
||||
@@ -112,15 +132,44 @@ class Member extends HD_Controller
|
||||
$selectedBrands[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
|
||||
}
|
||||
}
|
||||
# group_id1
|
||||
if ($row['group_id1'] == 4) {
|
||||
$this->load->model('app/licheb/App_licheb_channel_biz1_model', 'mdChannelBiz1');
|
||||
$res_biz = $this->mdChannelBiz1->select(['uid' => $id], 'id desc', 0, 0, 'biz_id');
|
||||
$res_biz && $biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
|
||||
if ($res_biz) {
|
||||
$biz_id_arr = array_unique(array_column($res_biz, 'biz_id'));
|
||||
$ids = implode(',', $biz_id_arr);
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$selectedBrands1 = $this->biz_model->select(["id in ($ids)" => null, "type in ($type_ids)" => null, 'status' => 1], '', 0, 0, 'id as biz_id,biz_name as name');
|
||||
}
|
||||
} else if ($row['biz_id1']) {
|
||||
$re_biz = $this->biz_model->get(["id" => $row['biz_id1'], 'status' => 1], 'id ,biz_name');
|
||||
if ($re_biz) {
|
||||
$selectedBrands1[] = ['biz_id' => $re_biz['id'], 'name' => $re_biz['biz_name']];
|
||||
}
|
||||
}
|
||||
$action = '/app/licheb/member/edit';
|
||||
$_title = '编辑用户';
|
||||
} else {
|
||||
$info = array('biz_id' => '', 'group_id' => '', 'city_id' => 0);
|
||||
$info = array('biz_id' => '', 'group_id' => '', 'city_id' => 0, 'biz_id1' => '', 'group_id1' => 0, 'city_id1' => 0);
|
||||
$action = '/app/licheb/member/add';
|
||||
$_title = '添加用户';
|
||||
}
|
||||
$type_ary = $this->biz_model->type_ary();
|
||||
$typeStr = '1,2,3';//品牌 合伙 代理
|
||||
$typeAry = [];
|
||||
foreach ($type_ary as $k => $v) {
|
||||
if (strstr($typeStr . ',', $k . ',')) {
|
||||
$typeAry[$k] = $v;
|
||||
}
|
||||
}
|
||||
$show_info['typeAry'] = $typeAry;
|
||||
#$show_info['typeAry'] = $this->biz_model->type_ary();
|
||||
$show_info['cityList'] = $this->mdSysCity->select(['status' => 1], 'id desc', 0, 0, 'city_id,name');
|
||||
$this->data['selectedBrands'] = $selectedBrands;
|
||||
$this->data['selectedBrands1'] = $selectedBrands1;
|
||||
$this->data['show_info'] = $show_info;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['groups'] = $this->groups;
|
||||
@@ -139,6 +188,10 @@ class Member extends HD_Controller
|
||||
$bizs = $info['bizs'];
|
||||
$city_id = $info['city_id'];
|
||||
$biz_id_arr = array_column($bizs, 'biz_id');
|
||||
$group_id1 = $info['group_id1'];
|
||||
$bizs1 = $info['bizs1'];
|
||||
$city_id1 = $info['city_id1'];
|
||||
$biz_id_arr1 = is_array($bizs1) ? array_column($bizs1, 'biz_id') : '';
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
|
||||
@@ -147,7 +200,7 @@ class Member extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入姓名');
|
||||
}
|
||||
|
||||
$exist = $this->userM->get(array('mobile' => $mobile));
|
||||
$exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null));
|
||||
if ($exist) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
|
||||
}
|
||||
@@ -156,15 +209,22 @@ class Member extends HD_Controller
|
||||
'mobile' => $mobile,
|
||||
'uname' => $uname,
|
||||
'city_id' => $city_id,
|
||||
'city_id1' => $city_id1,
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
);
|
||||
$group_id && $add['group_id'] = $group_id;
|
||||
$biz_id_arr && $add['biz_id'] = implode(',', $biz_id_arr);
|
||||
$add['group_id1'] = $group_id1 ? $group_id1 : 0;
|
||||
$biz_id_arr1 && $add['biz_id1'] = implode(',', $biz_id_arr1);
|
||||
|
||||
$id = $this->userM->add($add);
|
||||
if ($id && $group_id == 4 && $biz_id_arr) {//加狸车宝渠道门店
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr]);
|
||||
}
|
||||
if ($id && $group_id1 == 4 && $biz_id_arr1) {//加狸车宝渠道门店 group_id1
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr1, 'edit' => 1, 'group_id1'=>true]);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功', '/app/licheb/member');
|
||||
}
|
||||
|
||||
@@ -180,12 +240,19 @@ class Member extends HD_Controller
|
||||
$bizs = $info['bizs'];
|
||||
$city_id = $info['city_id'];
|
||||
$biz_id_arr = is_array($bizs) ? array_column($bizs, 'biz_id') : '';
|
||||
$group_id1 = $info['group_id1'];
|
||||
$bizs1 = $info['bizs1'];
|
||||
$city_id1 = $info['city_id1'];
|
||||
$biz_id_arr1 = is_array($bizs1) ? array_column($bizs1, 'biz_id') : '';
|
||||
|
||||
if (!mobile_valid($mobile)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '输入正确手机号');
|
||||
}
|
||||
if (!$uname) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入姓名');
|
||||
}
|
||||
|
||||
$exist = $this->userM->get(array('mobile' => $mobile, 'id <>' => $id));
|
||||
$exist = $this->userM->get(array('mobile' => $mobile, 'status in (0, 1)' => null, 'id <>' => $id));
|
||||
if ($exist) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号的用户存在');
|
||||
}
|
||||
@@ -193,10 +260,13 @@ class Member extends HD_Controller
|
||||
$upd = array(
|
||||
'mobile' => $mobile,
|
||||
'city_id' => $city_id,
|
||||
'city_id1' => $city_id1,
|
||||
);
|
||||
|
||||
$upd['group_id'] = $group_id ? $group_id : 0;
|
||||
$upd['biz_id'] = $biz_id_arr ? implode(',', $biz_id_arr) : 0;
|
||||
$upd['group_id1'] = $group_id1 ? $group_id1 : 0;
|
||||
$upd['biz_id1'] = $biz_id_arr1 ? implode(',', $biz_id_arr1) : 0;
|
||||
|
||||
$nickname && $upd['nickname'] = $nickname;
|
||||
$uname && $upd['uname'] = $uname;
|
||||
@@ -205,6 +275,9 @@ class Member extends HD_Controller
|
||||
if ($id && $group_id == 4) {//加狸车宝渠道门店
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr, 'edit' => 1]);
|
||||
}
|
||||
if ($id && $group_id1 == 4) {//加狸车宝渠道门店 group_id1
|
||||
$this->channel_biz(["uid" => $id, 'biz_id_arr' => $biz_id_arr1, 'edit' => 1, 'group_id1'=>true]);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
@@ -305,10 +378,12 @@ class Member extends HD_Controller
|
||||
function channel_biz($json = [])
|
||||
{
|
||||
$biz_ids = $json['biz_id_arr'] ? implode(',', $json['biz_id_arr']) : 0;
|
||||
$group_id1 = $json['group_id1'] ? true : false;
|
||||
if ($json['edit'] == 1) {//编辑删除未添加的
|
||||
$where_d['uid'] = $json['uid'];
|
||||
$biz_ids && $where_d["biz_id not in({$biz_ids})"] = null;
|
||||
$this->mdChannelBiz->delete($where_d);
|
||||
!$group_id1 && $this->mdChannelBiz->delete($where_d);
|
||||
$group_id1 && $this->mdChannelBiz1->delete($where_d);
|
||||
}
|
||||
if (!$biz_ids) {
|
||||
return;
|
||||
@@ -316,10 +391,12 @@ class Member extends HD_Controller
|
||||
$res_b = $this->biz_model->select(["id in({$biz_ids})" => null], '', 0, 0, 'id as biz_id');
|
||||
foreach ($res_b as $key => $value) {
|
||||
$where = ["uid" => $json['uid'], 'biz_id' => $value['biz_id']];
|
||||
$re_cb = $this->mdChannelBiz->get($where);
|
||||
!$group_id1 && $re_cb = $this->mdChannelBiz->get($where);
|
||||
$group_id1 && $re_cb = $this->mdChannelBiz1->get($where);
|
||||
if (!$re_cb) {
|
||||
$where['c_time'] = time();
|
||||
$this->mdChannelBiz->add($where);
|
||||
!$group_id1 && $this->mdChannelBiz->add($where);
|
||||
$group_id1 && $this->mdChannelBiz1->add($where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ class Sytlive extends HD_Controller
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$id = intval($params['id']);
|
||||
$title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = '';
|
||||
$title = $session_id = $img = $img_url = $share_title = $share_img = $share_img_url = $time = $rule = $prizes_note = '';
|
||||
$img = $share_img = ['value' => '', 'src' => ''];
|
||||
$prizes_list = [];
|
||||
if ($id > 0) {
|
||||
$re = $this->mdSytLive->get(array('id' => $id));
|
||||
if (!$re || empty($re)) {
|
||||
@@ -70,19 +72,27 @@ class Sytlive extends HD_Controller
|
||||
$re['title'] && $title = $re['title'];
|
||||
$re['session_id'] && $session_id = $re['session_id'];
|
||||
if ($re['img']) {
|
||||
$img = $re['img'];
|
||||
$img_url = build_qiniu_image_url($re['img']);
|
||||
$img['value'] = $re['img'];
|
||||
$img['src'] = build_qiniu_image_url($re['img']);
|
||||
}
|
||||
$re['s_time'] && $time = $re['s_time'] . " ~ " . $re['e_time'];
|
||||
if ($re['jsondata']) {
|
||||
$jsondata = json_decode($re['jsondata'], true);
|
||||
$jsondata['share_title'] && $share_title = $jsondata['share_title'];
|
||||
$jsondata['share_desc'] && $share_desc = $jsondata['share_desc'];
|
||||
if ($jsondata['share_img']) {
|
||||
$share_img = $jsondata['share_img'];
|
||||
$share_img_url = build_qiniu_image_url($jsondata['share_img']);
|
||||
$share_img['value'] = $jsondata['share_img'];
|
||||
$share_img['src'] = build_qiniu_image_url($jsondata['share_img']);
|
||||
}
|
||||
$jsondata['rule'] && $rule = $jsondata['rule'];
|
||||
}
|
||||
if ($re['prizes']) {//奖品配置
|
||||
$prizes = json_decode($re['prizes'], true);
|
||||
$prizes_note = $prizes['note'];
|
||||
foreach ($prizes['list'] as $key => $value) {
|
||||
$value['img_src'] = $value['img_value'] ? build_qiniu_image_url($value['img_value']) : '';
|
||||
$prizes_list[] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_title = '新增私域通-直播';
|
||||
$dataInfo['editType'] = 2;
|
||||
@@ -97,14 +107,14 @@ class Sytlive extends HD_Controller
|
||||
$dataInfo['title'] = $title;
|
||||
$dataInfo['session_id'] = $session_id;
|
||||
$dataInfo['img'] = $img;
|
||||
$dataInfo['img_url'] = $img_url;
|
||||
$dataInfo['time'] = $time;
|
||||
$dataInfo['share_title'] = $share_title;
|
||||
$dataInfo['share_desc'] = $share_desc;
|
||||
$dataInfo['share_img'] = $share_img;
|
||||
$dataInfo['share_img_url'] = $share_img_url;
|
||||
$dataInfo['rule'] = $rule;
|
||||
$dataInfo['prizes_note'] = $prizes_note;
|
||||
$this->data['info'] = $dataInfo;
|
||||
$this->data['status_list'] = $status_list;
|
||||
$this->data['prizes_list'] = $prizes_list;
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view('/app/licheb/syt/live_edit', true);
|
||||
}
|
||||
@@ -120,13 +130,20 @@ class Sytlive extends HD_Controller
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '该直播场次已存在!');
|
||||
}
|
||||
//$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE);
|
||||
$json_data['share_title'] = $info['share_title'];
|
||||
$json_data['share_img'] = $info['share_img'];
|
||||
$json_data['share_desc'] = $info['share_desc'];
|
||||
$json_data['share_img'] = $info['share_img']['value'];
|
||||
$json_data['rule'] = $info['rule'];
|
||||
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$addData = array("title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img'],
|
||||
"jsondata" => $jsondata, "status" => $info['status'], "c_time" => time());
|
||||
$prizes['note'] = $info['prizes_note'];
|
||||
$prizes_list = [];
|
||||
foreach ($info['prizes_list'] as $key => $value) {
|
||||
unset($value['img_src']);
|
||||
$prizes_list[] = $value;
|
||||
}
|
||||
$prizes['list'] = $prizes_list;
|
||||
$prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE);
|
||||
$addData = ["title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img']['value'],
|
||||
"jsondata" => $jsondata, "prizes" => $prizes, "status" => $info['status'], "c_time" => time()];
|
||||
if ($info['time']) {
|
||||
$time = explode(' ~ ', $info['time']);
|
||||
$addData['s_time'] = $time[0];
|
||||
@@ -151,32 +168,28 @@ class Sytlive extends HD_Controller
|
||||
if (!$info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$jsonkpi = json_encode($info['kpi_list'], JSON_UNESCAPED_UNICODE);
|
||||
$json_data['share_title'] = $info['share_title'];
|
||||
$json_data['remark'] = $info['remark'];
|
||||
$json_data['share_desc'] = $info['share_desc'];
|
||||
$json_data['share_img'] = $info['share_img']['value'];
|
||||
$json_data['rule'] = $info['rule'];
|
||||
$json_data['bg_color'] = $info['bg_color'];
|
||||
$json_data['btn_color'] = $info['btn_color'];
|
||||
//海报
|
||||
$posters = array();
|
||||
if ($info['posters']) {
|
||||
foreach ($info['posters'] as $key => $value) {
|
||||
$posters[] = array('url' => $value['value'], 'width' => $value['width'], 'height' => $value['height']);
|
||||
}
|
||||
}
|
||||
$json_data['posters'] = $posters;
|
||||
$jsondata = json_encode($json_data, JSON_UNESCAPED_UNICODE);
|
||||
$brand_id = $info['brand_id'] ? implode(',', $info['brand_id']) : 0;
|
||||
$updateData = array("brand_id" => $brand_id, "title" => $info['title'], "z_id" => $info['z_id'], "img" => $info['img']
|
||||
, "jsonkpi" => $jsonkpi, "jsondata" => $jsondata);
|
||||
$prizes['note'] = $info['prizes_note'];
|
||||
$prizes_list = [];
|
||||
foreach ($info['prizes_list'] as $key => $value) {
|
||||
unset($value['img_src']);
|
||||
$prizes_list[] = $value;
|
||||
}
|
||||
$prizes['list'] = $prizes_list;
|
||||
$prizes = json_encode($prizes, JSON_UNESCAPED_UNICODE);
|
||||
$updateData = ["title" => $info['title'], "session_id" => $info['session_id'], "img" => $info['img']['value'],
|
||||
"jsondata" => $jsondata, "prizes" => $prizes];
|
||||
if ($info['time']) {
|
||||
$time = explode(' ~ ', $info['time']);
|
||||
$updateData['s_time'] = $time[0];
|
||||
$updateData['e_time'] = $time[1];
|
||||
}
|
||||
$this->mdSytLive->update($updateData, array('id' => $info['id']));
|
||||
$this->mdSytLive->update($updateData, ['id' => $info['id']]);
|
||||
$this->data['type'] = 'edit';
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改活动成功!');
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改直播成功!');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,8 +298,8 @@ class Sytlive extends HD_Controller
|
||||
$msg = '请输入活动标题';
|
||||
} else if (!$info['img']) {
|
||||
$msg = '请上传头部图片';
|
||||
} else if (!$info['session_id']) {
|
||||
$msg = '请输入直播场次';
|
||||
// } else if (!$info['session_id']) {
|
||||
// $msg = '请输入直播场次';
|
||||
} else if (!$info['time']) {
|
||||
$msg = '请选择直播时间';
|
||||
} else if (!$info['rule']) {
|
||||
|
||||
@@ -8,13 +8,20 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
*/
|
||||
class Userslog extends HD_Controller
|
||||
{
|
||||
private $tabAry = [1 => '客户统计', 2 => '回访统计'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdUsers');
|
||||
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
|
||||
$this->load->model('app/licheb/app_licheb_bizs_log_model', 'mdBizsLog');
|
||||
$this->load->model('receiver/receiver_customers_visit_sales_model', 'mdCustomerVisitSales');
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model', 'orders_model');
|
||||
$this->load->model('receiver/order/receiver_order_deliverys_model', 'order_deliverys_model');
|
||||
$this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model');
|
||||
$this->load->model('app/app_lichene_qy_log_model', 'mdWechatqyLog');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$this->load->model('area_model', 'mdArea');
|
||||
}
|
||||
@@ -29,40 +36,253 @@ class Userslog extends HD_Controller
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$data = $this->dataSelect($params);
|
||||
$data = $this->dataBizSelect($params);
|
||||
$data['typeAry'] = $this->mdBiz->type_ary();
|
||||
$this->data = $data;
|
||||
$this->show_view('app/licheb/userslog/lists', true);
|
||||
}
|
||||
|
||||
private function dataSelect($params)
|
||||
public function lists_users()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$params['tab'] = $params['tab'] ? intval($params['tab']) : 1;
|
||||
if ($params['tab'] == 2) {
|
||||
$view = 'app/licheb/userslog/lists_visit';
|
||||
$data = $this->visitSelect($params);
|
||||
} else {
|
||||
$view = 'app/licheb/userslog/lists_users';
|
||||
$data = $this->dataUsersSelect($params);
|
||||
}
|
||||
$data['tabAry'] = $this->tabAry;
|
||||
$this->data = $data;
|
||||
$this->show_view($view, true);
|
||||
}
|
||||
|
||||
private function dataBizSelect($params)
|
||||
{
|
||||
!$params['type'] && $params['type'] = '';
|
||||
!$params['biz_id'] && $params['biz_id'] = '';
|
||||
!$params['city_id'] && $params['city_id'] = '';
|
||||
!$params['county_id'] && $params['county_id'] = '';
|
||||
$lists = $where_c = $where_dt = $where = $where_order = $where_order_del = $where_gr = [];
|
||||
$where_gr['type'] = 10;
|
||||
$same_day = 0;
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] == $time[1] && $same_day = 1;
|
||||
if ($time[0]) {
|
||||
$where["log_date>="] = $time[0];
|
||||
$where_c["c_time>="] = strtotime("{$time[0]} 00:00:00");
|
||||
$where_dt["dt_time>="] = "{$time[0]} 00:00:00";
|
||||
$where_order_del["c_time>="] = strtotime("{$time[0]} 00:00:00");
|
||||
$where_gr["c_time>="] = strtotime("{$time[0]} 00:00:00");
|
||||
}
|
||||
if ($time[1]) {
|
||||
$where["log_date<="] = $time[1];
|
||||
$where_c["c_time<="] = strtotime("{$time[1]} 23:59:59");
|
||||
$where_dt["dt_time<="] = "{$time[1]} 23:59:59";
|
||||
$where_order_del["c_time<="] = strtotime("{$time[1]} 23:59:59");
|
||||
$where_gr["c_time<="] = strtotime("{$time[1]} 23:59:59");
|
||||
}
|
||||
} else {
|
||||
$where_c["c_time>="] = strtotime("2022-04-15 00:00:00");
|
||||
$where_dt["dt_time>="] = "2022-04-15 00:00:00";
|
||||
$where_order_del["c_time>="] = strtotime("2022-04-15 00:00:00");
|
||||
}
|
||||
$where_qy = $where_c;//企微数
|
||||
$where_qy['change_type'] = 'add_external_contact';
|
||||
$where_user = $str_ids = '';
|
||||
if ($params['type'] || $params['biz_id'] || $params['city_id'] || $params['county_id']) {
|
||||
$where_cdt['status'] = 1;
|
||||
if ($params['biz_id']) {
|
||||
$where_cdt['id'] = $params['biz_id'];
|
||||
} else {
|
||||
$params['type'] && $where_cdt['type'] = $params['type'];
|
||||
$params['city_id'] && $where_cdt['city_id'] = $params['city_id'];
|
||||
$params['county_id'] && $where_cdt['county_id'] = $params['county_id'];
|
||||
}
|
||||
$res_biz = $this->mdBiz->select($where_cdt, 'id desc', 0, 0, 'id');
|
||||
if ($res_biz) {
|
||||
$str_ids = implode(',', array_column($res_biz, 'id'));
|
||||
$where["biz_id in ({$str_ids})"] = null;
|
||||
$where_user = "biz_id in ({$str_ids})";
|
||||
if (!$same_day) {//不是搜索一天
|
||||
$where_c["biz_id in ({$str_ids})"] = null;
|
||||
$where_dt["biz_id in ({$str_ids})"] = null;
|
||||
}
|
||||
$where_order["biz_id in ({$str_ids})"] = null;
|
||||
$where_gr["customer_id in (select id from lc_receiver_customers where biz_id in ({$str_ids}))"] = null;
|
||||
} else {
|
||||
$where['biz_id'] = -2;
|
||||
$where_user = "biz_id = -2";
|
||||
if (!$same_day) {//不是搜索一天
|
||||
$where_c['biz_id'] = -2;
|
||||
$where_dt['biz_id'] = -2;
|
||||
}
|
||||
$where_order['biz_id'] = -2;
|
||||
$where_gr['type'] = -2;
|
||||
}
|
||||
}
|
||||
$total = $this->mdBizsLog->count($where);
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
if ($total) {
|
||||
$res = $this->mdBizsLog->select($where, "id desc", $params['page'], $params['size']);
|
||||
if ($res) {
|
||||
$str_ids = implode(',', array_unique(array_column($res, 'biz_id')));
|
||||
$map_biz = $this->mdBiz->map('id', 'biz_name', ["id in ({$str_ids})" => null]);
|
||||
foreach ($res as $v) {
|
||||
$biz_name = $biz_type = $customer_info = $c_num_info = $order_info = '';
|
||||
$customers = $c_num = $orders = 0;
|
||||
$map_biz[$v['biz_id']] && $biz_name = $params['size'] == 10000 ? $map_biz[$v['biz_id']] : "<a href=\"javascript:void(0);\"
|
||||
data-open=\"/app/licheb/userslog/lists_users?tab=1&biz_id={$v['biz_id']}&time={$v['log_date']} ~ {$v['log_date']}\">
|
||||
{$map_biz[$v['biz_id']]}</a>";
|
||||
$temp = ['biz_name' => $biz_name, 'defeats' => $v['defeats']
|
||||
, 't_num' => $v['t_num'], 'orders' => $v['orders']
|
||||
, 'bills' => $v['bills'], 'reassigns' => $v['reassigns'], 'receives' => $v['receives']
|
||||
, 'qy_adds' => $v['qy_adds'], 'log_date' => $v['log_date']];
|
||||
$customer_json = $v['customer_json'] ? json_decode($v['customer_json'], true) : [];
|
||||
$c_num_json = $v['c_num_json'] ? json_decode($v['c_num_json'], true) : [];
|
||||
$order_json = $v['order_json'] ? json_decode($v['order_json'], true) : [];
|
||||
foreach ($offlineSources as $key1 => $value1) {
|
||||
$nums = intval($v['customer_' . $key1]);
|
||||
$nums_c_num = intval($v['c_num_' . $key1]);
|
||||
$nums_orders = intval($v['order_' . $key1]);
|
||||
if ($nums) {
|
||||
$customers += $nums;
|
||||
if ($params['size'] != 10000) {
|
||||
if ($customer_info) {
|
||||
$customer_info .= "<br>{$value1['name']}:{$nums}";
|
||||
} else {
|
||||
$customer_info = "<br>{$value1['name']}:{$nums}";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nums_c_num) {
|
||||
$c_num += $nums_c_num;
|
||||
if ($params['size'] != 10000) {
|
||||
if ($c_num_info) {
|
||||
$c_num_info .= "<br>{$value1['name']}:{$nums_c_num}";
|
||||
} else {
|
||||
$c_num_info = "<br>{$value1['name']}:{$nums_c_num}";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($nums_orders) {
|
||||
$orders += $nums_orders;
|
||||
if ($params['size'] != 10000) {
|
||||
if ($order_info) {
|
||||
$order_info .= "<br>{$value1['name']}:{$nums_orders}";
|
||||
} else {
|
||||
$order_info = "<br>{$value1['name']}:{$nums_orders}";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($params['size'] == 10000) {//导出使用
|
||||
$temp['customer_' . $key1] = $nums;
|
||||
$temp['c_num_' . $key1] = $nums_c_num;
|
||||
$temp['order_' . $key1] = $nums_orders;
|
||||
foreach ($value1['list'] as $key2 => $value2) {
|
||||
$temp['customer_' . $key2] = intval($customer_json[$key1]['list'][$key2]['num']);
|
||||
$temp['c_num_' . $key2] = intval($c_num_json[$key1]['list'][$key2]['num']);
|
||||
$temp['order_' . $key2] = intval($order_json[$key1]['list'][$key2]['num']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$temp['customers'] = $customer_info ? "总数:{$customers}{$customer_info}" : $customers;
|
||||
$temp['c_num'] = $c_num_info ? "总数:{$c_num}{$c_num_info}" : $c_num;
|
||||
$temp['orders'] = $order_info ? "总数:{$orders}{$order_info}" : $orders;
|
||||
$lists[] = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($params['size'] != 10000) {
|
||||
$customers = $c_num = $orders = 0;
|
||||
$customers_info = $c_num_info = $orders_info = '';
|
||||
foreach ($offlineSources as $k => $v) {
|
||||
if ($same_day) {
|
||||
$sum2 = $this->mdUsersLog->sum("customer_{$k}", $where);//客户数
|
||||
if ($sum2['customer_' . $k]) {//客户数
|
||||
$customers += $sum2['customer_' . $k];
|
||||
$customers_info .= "<br>{$v['name']}:{$sum2['customer_'.$k]}";
|
||||
}
|
||||
$sum2 = $this->mdUsersLog->sum("c_num_{$k}", $where);//进店人数
|
||||
if ($sum2['c_num_' . $k]) {
|
||||
$c_num += $sum2['c_num_' . $k];
|
||||
$c_num_info .= "<br>{$v['name']}:{$sum2['c_num_'.$k]}";
|
||||
}
|
||||
} else {
|
||||
$count2 = $this->mdCustomers->count(array_merge($where_c, ['of_id' => $k]));//客户数
|
||||
if ($count2) {
|
||||
$customers += $count2;
|
||||
$customers_info .= "<br>{$v['name']}:{$count2}";
|
||||
}
|
||||
$count2 = $this->mdCustomers->count(array_merge($where_dt, ['of_id' => $k]));//进店人数
|
||||
if ($count2) {
|
||||
|
||||
$c_num += $count2;
|
||||
$c_num_info .= "<br>{$v['name']}:{$count2}";
|
||||
}
|
||||
}
|
||||
$sum2 = $this->mdUsersLog->sum("order_{$k}", $where);//订单数
|
||||
if ($sum2['order_' . $k]) {
|
||||
$orders += $sum2['order_' . $k];
|
||||
$orders_info .= "<br>{$v['name']}:{$sum2['order_'.$k]}";
|
||||
}
|
||||
}
|
||||
$menus[] = ['title' => "客户数", 'note' => $customers ? "总数:{$customers}{$customers_info}" : '0人'];
|
||||
$menus[] = ['title' => "进店人数", 'note' => $c_num ? "总数:{$c_num}{$c_num_info}" : '0人'];
|
||||
$menus[] = ['title' => "订单数", 'note' => $orders ? "总数:{$orders}{$orders_info}" : '0个'];
|
||||
$sum = $this->mdUsersLog->sum('t_num', $where);
|
||||
$menus[] = ['title' => "试驾数", 'value' => intval($sum['t_num']), 'tag' => '次'];
|
||||
$sum = $this->mdUsersLog->sum('defeats', $where);
|
||||
$menus[] = ['title' => "战败数", 'value' => intval($sum['defeats']), 'tag' => '个'];
|
||||
$sum = $this->mdUsersLog->sum('bills', $where);
|
||||
$menus[] = ['title' => "开票数", 'value' => intval($sum['bills']), 'tag' => '个'];
|
||||
|
||||
$where_user && $where_qy["userid in(select userid from lc_app_licheb_users where $where_user)"] = null;
|
||||
$qy_adds = $this->mdWechatqyLog->count($where_qy);
|
||||
#$menus[] = ['title' => "企微数", 'value' => $qy_adds, 'tag' => '人'];
|
||||
$qy_dts = $this->mdCustomers->count(array_merge($where_dt, ['wxqy' => 1]));
|
||||
$this->order_deliverys_model->get(array_merge($where_order_del, ['status in (1, 2)'=> null]), 'o_id');
|
||||
$del_sql = $this->order_deliverys_model->db->last_query();
|
||||
$this->orders_model->get(array_merge($where_order, ["id in ($del_sql)" => null]), 'customer_id');
|
||||
$order_sql = $this->orders_model->db->last_query();
|
||||
$qy_deliverys = $this->mdCustomers->count(array_merge($where_order, ['wxqy' => 1, "id in ($order_sql)" => null]));
|
||||
$qy_info = "<br>进店数:{$qy_dts}<br>交付数:{$qy_deliverys}";
|
||||
$menus[] = ['title' => "企微数", 'note' => $qy_adds ? "新增数:{$qy_adds}{$qy_info}" : '0人'];
|
||||
|
||||
$gr_adds = $this->customer_oplogs_model->count($where_gr);
|
||||
$gr_dts = $this->mdCustomers->count(array_merge($where_dt, ['wxgr' => 1]));
|
||||
$gr_deliverys = $this->mdCustomers->count(array_merge($where_order, ['wxgr' => 1, "id in ($order_sql)" => null]));
|
||||
$gr_info = "<br>进店数:{$gr_dts}<br>交付数:{$gr_deliverys}";
|
||||
$menus[] = ['title' => "个微数", 'note' => $gr_adds ? "新增数:{$gr_adds}{$gr_info}" : '0人'];
|
||||
|
||||
$sum = $this->mdUsersLog->sum('reassigns', $where);
|
||||
$menus[] = ['title' => "改派数", 'value' => intval($sum['reassigns']), 'tag' => '个'];
|
||||
$sum = $this->mdUsersLog->sum('receives', $where);
|
||||
$menus[] = ['title' => "接收数", 'value' => intval($sum['receives']), 'tag' => '个'];
|
||||
$data['menus'] = $menus;
|
||||
}
|
||||
$data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
||||
$data['lists'] = $lists;
|
||||
$data['params'] = $params;
|
||||
$data['_title'] = "门店日志";
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function dataUsersSelect($params)
|
||||
{
|
||||
$_title = '顾问日志';
|
||||
$lists = $where = [];
|
||||
if ($params['uname']) {
|
||||
$where["sale_id in(select id from lc_app_licheb_users where uname like '%{$params['uname']}%')"] = null;
|
||||
}
|
||||
if ($params['biz_id']) {
|
||||
$where['biz_id'] = $params['biz_id'];
|
||||
} else if ($params['city_id']) {
|
||||
$where_biz['status'] = 1;
|
||||
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
|
||||
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
|
||||
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
if ($res_biz) {
|
||||
$str_ids = implode(',', array_column($res_biz, 'id'));
|
||||
$where["biz_id in ({$str_ids})"] = null;
|
||||
} else {
|
||||
$where['biz_id'] = -2;
|
||||
}
|
||||
} else {
|
||||
$params['city_id'] = '';
|
||||
$params['county_id'] = '';
|
||||
$params['biz_id'] = '';
|
||||
}
|
||||
if ($params['type']) {
|
||||
$where["type"] = $params['type'];
|
||||
} else {
|
||||
$params['type'] = '';
|
||||
$re_biz = $this->mdBiz->get(['id' => $params['biz_id']]);
|
||||
$re_biz && $_title = $re_biz['biz_name'] . '_顾问日志';
|
||||
}
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
@@ -71,54 +291,46 @@ class Userslog extends HD_Controller
|
||||
}
|
||||
$total = $this->mdUsersLog->count($where);
|
||||
if ($total) {
|
||||
$res = $this->mdUsersLog->select($where, "id desc", $params['page'], $params['size']);
|
||||
$sale_ids = $biz_ids = [];
|
||||
$res = $this->mdUsersLog->select($where, "log_date desc,id desc", $params['page'], $params['size']);
|
||||
$sale_ids = [];
|
||||
foreach ($res as $v) {
|
||||
$v['sale_id'] && !in_array($v['sale_id'], $sale_ids) && $sale_ids[] = $v['sale_id'];
|
||||
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id'];
|
||||
}
|
||||
$map_sale = $map_biz = $map_city = [];
|
||||
$map_sale = [];
|
||||
if ($sale_ids) {
|
||||
$str_ids = implode(',', $sale_ids);
|
||||
$map_sale = $this->mdUsers->map('id', 'uname', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
if ($biz_ids) {
|
||||
$str_ids = implode(',', $biz_ids);
|
||||
$map_biz = $this->mdBiz->map('id', 'biz_name,type', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
$typeAry = $this->mdBiz->type_ary();
|
||||
foreach ($res as $v) {
|
||||
$uname = $biz_name = $biz_type = $customers_info = '';
|
||||
$customers = 0;
|
||||
$map_sale[$v['sale_id']] && $uname = $map_sale[$v['sale_id']];
|
||||
$map_biz[$v['biz_id']]['biz_name'] && $biz_name = $map_biz[$v['biz_id']]['biz_name'];
|
||||
$map_biz[$v['biz_id']]['type'] && $biz_type = $typeAry[$map_biz[$v['biz_id']]['type']];
|
||||
$temp = ['uname' => $uname, 'biz_type' => $biz_type, 'biz_name' => $biz_name, 'defeats' => $v['defeats']
|
||||
, 'c_num' => $v['c_num'], 'a_num' => $v['a_num'], 't_num' => $v['t_num'], 'orders' => $v['orders'], 'bills' => $v['bills']
|
||||
, 'follows' => $v['follows'], 'qy_adds' => $v['qy_adds'], 'qy_dels' => $v['qy_dels'], 'log_date' => $v['log_date']];
|
||||
$uname = $map_sale[$v['sale_id']] ? $map_sale[$v['sale_id']] : '';
|
||||
$temp = ['uname' => $uname, 't_num' => $v['t_num'], 'defeats' => $v['defeats'], 'bills' => $v['bills']
|
||||
, 'qy_adds' => $v['qy_adds'], 'qy_dels' => $v['qy_dels'], 'log_date' => $v['log_date']];
|
||||
$customer_json = $v['customer_json'] ? json_decode($v['customer_json'], true) : [];
|
||||
$c_num_json = $v['customer_json'] ? json_decode($v['c_num_json'], true) : [];
|
||||
$order_json = $v['customer_json'] ? json_decode($v['order_json'], true) : [];
|
||||
$customers = $c_num = $orders = 0;
|
||||
foreach ($offlineSources as $key1 => $value1) {
|
||||
$nums = intval($v['customer_' . $key1]);
|
||||
$nums_c_num = intval($v['c_num_' . $key1]);
|
||||
$nums_orders = intval($v['order_' . $key1]);
|
||||
$nums && $customers += $nums;
|
||||
$nums_c_num && $c_num += $nums_c_num;
|
||||
$nums_orders && $orders += $nums_orders;
|
||||
if ($params['size'] == 10000) {//导出使用
|
||||
$temp['customer_' . $key1] = $nums;
|
||||
$temp['c_num_' . $key1] = $nums_c_num;
|
||||
$temp['order_' . $key1] = $nums_orders;
|
||||
foreach ($value1['list'] as $key2 => $value2) {
|
||||
$temp['customer_' . $key2] = intval($customer_json[$key1]['list'][$key2]['num']);
|
||||
}
|
||||
}
|
||||
if ($nums) {
|
||||
$customers += $nums;
|
||||
if ($params['size'] != 10000) {
|
||||
if ($customers_info) {
|
||||
$customers_info = $customers_info . '+' . $value1['name'] . '(' . $nums . ')';
|
||||
} else {
|
||||
$customers_info = $value1['name'] . '(' . $nums . ')';
|
||||
}
|
||||
$temp['c_num_' . $key2] = intval($c_num_json[$key1]['list'][$key2]['num']);
|
||||
$temp['order_' . $key2] = intval($order_json[$key1]['list'][$key2]['num']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$customers_info && $customers = $customers . '=' . $customers_info;
|
||||
$temp['customers'] = $customers;
|
||||
$temp['c_num'] = $c_num;
|
||||
$temp['orders'] = $orders;
|
||||
$lists[] = $temp;
|
||||
}
|
||||
}
|
||||
@@ -126,14 +338,11 @@ class Userslog extends HD_Controller
|
||||
$sum = $this->mdUsersLog->sum('customers', $where);
|
||||
$menus[] = ['title' => "客户数", 'value' => intval($sum['customers']), 'tag' => '人'];
|
||||
$sum_c = $this->mdUsersLog->sum('c_num', $where);
|
||||
$sum = $this->mdUsersLog->sum('a_num', $where);
|
||||
$menus[] = ['title' => "进店人数/进店次数", 'value' => intval($sum_c['c_num']) . '人 / ' . intval($sum['a_num']), 'tag' => '人次'];
|
||||
$sum = $this->mdUsersLog->sum('t_num', $where);
|
||||
$menus[] = ['title' => "试驾数", 'value' => intval($sum['t_num']), 'tag' => '次'];
|
||||
$sum = $this->mdUsersLog->sum('follows', $where);
|
||||
$menus[] = ['title' => "跟进数", 'value' => intval($sum['follows']), 'tag' => '个'];
|
||||
$menus[] = ['title' => "进店人数", 'value' => intval($sum_c['c_num']), 'tag' => '人'];
|
||||
$sum = $this->mdUsersLog->sum('orders', $where);
|
||||
$menus[] = ['title' => "订单数", 'value' => intval($sum['orders']), 'tag' => '个'];
|
||||
$sum = $this->mdUsersLog->sum('t_num', $where);
|
||||
$menus[] = ['title' => "试驾数", 'value' => intval($sum['t_num']), 'tag' => '次'];
|
||||
$sum = $this->mdUsersLog->sum('defeats', $where);
|
||||
$menus[] = ['title' => "战败数", 'value' => intval($sum['defeats']), 'tag' => '个'];
|
||||
$sum = $this->mdUsersLog->sum('bills', $where);
|
||||
@@ -147,7 +356,63 @@ class Userslog extends HD_Controller
|
||||
$data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
||||
$data['lists'] = $lists;
|
||||
$data['params'] = $params;
|
||||
$data['_title'] = "顾问日志";
|
||||
$data['_title'] = $_title;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function visitSelect($params)
|
||||
{
|
||||
$_title = '顾问日志';
|
||||
$lists = $where = [];
|
||||
if ($params['uname']) {
|
||||
$where["sales_id in(select id from lc_app_licheb_users where uname like '%{$params['uname']}%')"] = null;
|
||||
}
|
||||
if ($params['biz_id']) {
|
||||
$where['biz_id'] = $params['biz_id'];
|
||||
$re_biz = $this->mdBiz->get(['id' => $params['biz_id']]);
|
||||
$re_biz && $_title = $re_biz['biz_name'] . '_顾问日志';
|
||||
}
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] && $where["t_day>="] = $time[0];
|
||||
$time[1] && $where["t_day<="] = $time[1];
|
||||
}
|
||||
$total = $this->mdCustomerVisitSales->count($where);
|
||||
if ($total) {
|
||||
$res = $this->mdCustomerVisitSales->select($where, "t_day desc,id desc", $params['page'], $params['size']);
|
||||
$sales_ids = [];
|
||||
foreach ($res as $v) {
|
||||
$v['sales_id'] && !in_array($v['sales_id'], $sales_ids) && $sales_ids[] = $v['sales_id'];
|
||||
}
|
||||
$map_sale = [];
|
||||
if ($sales_ids) {
|
||||
$str_ids = implode(',', $sales_ids);
|
||||
$map_sale = $this->mdUsers->map('id', 'uname', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
foreach ($res as $v) {
|
||||
$uname = '';
|
||||
$map_sale[$v['sales_id']] && $uname = $map_sale[$v['sales_id']];
|
||||
$follows = $v['t_follows'] + $v['h_follows'] + $v['w_follows'];
|
||||
$temp = ['id'=>$v['id'], 'uname' => $uname, 'follows' => $follows, 't_follows' => $v['t_follows']
|
||||
, 'h_follows' => $v['h_follows'], 'w_follows' => $v['w_follows'], 't_day' => $v['t_day']];
|
||||
$lists[] = $temp;
|
||||
}
|
||||
}
|
||||
if ($params['size'] != 10000) {
|
||||
$sum_h = $this->mdCustomerVisitSales->sum('h_follows', $where);
|
||||
$sum_t = $this->mdCustomerVisitSales->sum('t_follows', $where);
|
||||
$sum_w = $this->mdCustomerVisitSales->sum('w_follows', $where);
|
||||
$sum = $sum_h['h_follows'] + $sum_t['t_follows'] + $sum_w['w_follows'];
|
||||
$menus[] = ['title' => "计划跟进数", 'value' => intval($sum), 'tag' => '个'];
|
||||
$menus[] = ['title' => "已跟进数", 'value' => intval($sum_h['h_follows']), 'tag' => '个'];
|
||||
$menus[] = ['title' => "新增未跟进数", 'value' => intval($sum_t['t_follows']), 'tag' => '个'];
|
||||
$menus[] = ['title' => "逾期未跟进数", 'value' => intval($sum_w['w_follows']), 'tag' => '个'];
|
||||
$data['menus'] = $menus;
|
||||
}
|
||||
$data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
||||
$data['lists'] = $lists;
|
||||
$data['params'] = $params;
|
||||
$data['_title'] = $_title;
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -177,32 +442,108 @@ class Userslog extends HD_Controller
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$data = $indexs = array();
|
||||
$res = $this->dataSelect($params);
|
||||
$fileName = $res['_title'];
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$data[] = $value;
|
||||
}
|
||||
$indexs = ['biz_name' => '门店', 'uname' => '顾问', 'customers' => '客户数'];
|
||||
foreach ($offlineSources as $key1 => $value1) {
|
||||
$indexs['customer_' . $key1] = '【' . $value1['name'] . '】';
|
||||
foreach ($value1['list'] as $key2 => $value2) {
|
||||
$indexs['customer_' . $key2] = $value2;
|
||||
}
|
||||
}
|
||||
$indexs['c_num'] = '进店人数';
|
||||
$indexs['a_num'] = '进店次数';
|
||||
$indexs['t_num'] = '试驾数';
|
||||
$indexs['follows'] = '跟进数';
|
||||
$indexs['orders'] = '订单数';
|
||||
$indexs['defeats'] = '战败数';
|
||||
$indexs['bills'] = '开票数';
|
||||
$indexs['qy_adds'] = '新增企微';
|
||||
$indexs['qy_dels'] = '删除企微';
|
||||
$indexs['log_date'] = '日期';
|
||||
array_unshift($data, $indexs);
|
||||
$data = $indexs = [];
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
if ($params['tab'] == 1) {//客户统计
|
||||
$res = $this->dataUsersSelect($params);
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
$fileName = $res['_title'] . '_' . $this->tabAry[$params['tab']] . "_" . date('YmdHis');
|
||||
$list[1] = ['顾问', '日期', '客户数', '进店人数', '订单数', '试驾数', '战败数', '开票数', '新增企微', '删除企微'];
|
||||
$list[2] = ['顾问', '日期', '客户数'];
|
||||
$list[3] = ['顾问', '日期', '进店人数'];
|
||||
$list[4] = ['顾问', '日期', '订单数'];
|
||||
foreach ($offlineSources as $k1 => $v1) {
|
||||
$list[2][] = "【{$v1['name']}】";
|
||||
$list[3][] = "【{$v1['name']}】";
|
||||
$list[4][] = "【{$v1['name']}】";
|
||||
foreach ($v1['list'] as $k2 => $v2) {
|
||||
$list[2][] = $v2;
|
||||
$list[3][] = $v2;
|
||||
$list[4][] = $v2;
|
||||
}
|
||||
}
|
||||
//第一条标题
|
||||
$sheet['总览'][] = $list[1];
|
||||
$sheet['客户'][] = $list[2];
|
||||
$sheet['进店'][] = $list[3];
|
||||
$sheet['订单'][] = $list[4];
|
||||
foreach ($res['lists'] as $k => $v) {
|
||||
$list[1] = [$v['uname'], $v['log_date'], $v['customers'], $v['c_num'], $v['orders'], $v['t_num'], $v['defeats']
|
||||
, $v['bills'], $v['qy_adds'], $v['qy_dels']];
|
||||
$list[2] = [$v['uname'], $v['log_date'], $v['customers']];
|
||||
$list[3] = [$v['uname'], $v['log_date'], $v['c_num']];
|
||||
$list[4] = [$v['uname'], $v['log_date'], $v['orders']];
|
||||
foreach ($offlineSources as $k2 => $v2) {
|
||||
$list[2][] = $v['customer_' . $k2];
|
||||
$list[3][] = $v['c_num_' . $k2];
|
||||
$list[4][] = $v['order_' . $k2];
|
||||
foreach ($v2['list'] as $k3 => $v3) {
|
||||
$list[2][] = $v['customer_' . $k3];
|
||||
$list[3][] = $v['c_num_' . $k3];
|
||||
$list[4][] = $v['order_' . $k3];
|
||||
}
|
||||
}
|
||||
$sheet['总览'][] = $list[1];
|
||||
$sheet['客户'][] = $list[2];
|
||||
$sheet['进店'][] = $list[3];
|
||||
$sheet['订单'][] = $list[4];
|
||||
}
|
||||
$this->excel->exportExcel($sheet, $fileName);
|
||||
} else if ($params['tab'] == 2) {//回访统计
|
||||
$res = $this->visitSelect($params);
|
||||
$indexs = ['biz_name' => '门店', 'uname' => '顾问', 'follows' => '计划跟进数', 'h_follows' => '已跟进数'
|
||||
, 't_follows' => '今日新增未跟进数', 'w_follows' => '逾期未跟进数', 't_day' => '日期'];
|
||||
$fileName = $res['_title'] . '_' . $this->tabAry[$params['tab']];
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$data[] = $value;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
} else {//门店统计
|
||||
$res = $this->dataBizSelect($params);
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
$fileName = $res['_title'] . "_" . date('YmdHis');
|
||||
$list[1] = ['门店', '日期', '客户数', '进店人数', '订单数', '试驾数', '战败数', '开票数', '企微数', '改派数', '接收数'];
|
||||
$list[2] = ['门店', '日期', '客户数'];
|
||||
$list[3] = ['门店', '日期', '进店人数'];
|
||||
$list[4] = ['门店', '日期', '订单数'];
|
||||
foreach ($offlineSources as $k1 => $v1) {
|
||||
$list[2][] = "【{$v1['name']}】";
|
||||
$list[3][] = "【{$v1['name']}】";
|
||||
$list[4][] = "【{$v1['name']}】";
|
||||
foreach ($v1['list'] as $k2 => $v2) {
|
||||
$list[2][] = $v2;
|
||||
$list[3][] = $v2;
|
||||
$list[4][] = $v2;
|
||||
}
|
||||
}
|
||||
//第一条标题
|
||||
$sheet['总览'][] = $list[1];
|
||||
$sheet['客户'][] = $list[2];
|
||||
$sheet['进店'][] = $list[3];
|
||||
$sheet['订单'][] = $list[4];
|
||||
foreach ($res['lists'] as $k => $v) {
|
||||
$list[1] = [$v['biz_name'], $v['log_date'], $v['customers'], $v['c_num'], $v['orders'], $v['t_num'], $v['defeats']
|
||||
, $v['bills'], $v['qy_adds'], $v['reassigns'], $v['receives']];
|
||||
$list[2] = [$v['biz_name'], $v['log_date'], $v['customers']];
|
||||
$list[3] = [$v['biz_name'], $v['log_date'], $v['c_num']];
|
||||
$list[4] = [$v['biz_name'], $v['log_date'], $v['orders']];
|
||||
foreach ($offlineSources as $k2 => $v2) {
|
||||
$list[2][] = $v['customer_' . $k2];
|
||||
$list[3][] = $v['c_num_' . $k2];
|
||||
$list[4][] = $v['order_' . $k2];
|
||||
foreach ($v2['list'] as $k3 => $v3) {
|
||||
$list[2][] = $v['customer_' . $k3];
|
||||
$list[3][] = $v['c_num_' . $k3];
|
||||
$list[4][] = $v['order_' . $k3];
|
||||
}
|
||||
}
|
||||
$sheet['总览'][] = $list[1];
|
||||
$sheet['客户'][] = $list[2];
|
||||
$sheet['进店'][] = $list[3];
|
||||
$sheet['订单'][] = $list[4];
|
||||
}
|
||||
$this->excel->exportExcel($sheet, $fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ class Template extends HD_Controller
|
||||
$setValue['title'] = $value['title'];
|
||||
$setValue['type_name'] = $this->mdTemplate->typeAry()[$value['type']];
|
||||
$setValue['status_name'] = $this->mdTemplate->statusAry()[$value['status']];
|
||||
$setValue['status'] = $value['status'];
|
||||
$brands = '';
|
||||
if ($value['brand_ids']) {
|
||||
$res_b = $this->mdAutoBrand->select(array("id in ({$value['brand_ids']})" => null, 'status' => 1), "id desc", 0, 0, 'name');
|
||||
@@ -391,7 +392,27 @@ class Template extends HD_Controller
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
$field = $this->input->post('field');
|
||||
if ($field === 'ifcheck') {
|
||||
$status = intval($this->input->post('value'));
|
||||
$ids = $this->input->post('id');
|
||||
$ids = explode(',', $ids);
|
||||
if (!$ids || count($ids) < 1) {
|
||||
$this->show_json(0, '请选择要操作的选项');
|
||||
}
|
||||
$ids_str = implode(',', $ids);
|
||||
$where = ["id in({$ids_str})" => null];
|
||||
} else {
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = intval($this->input->post('value'));
|
||||
if (!$id) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$where['id'] = $id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$this->mdTemplate->update($data, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
|
||||
@@ -7,20 +7,25 @@
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Attr extends HD_Controller{
|
||||
class Attr extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct(){
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model('auto/auto_option_model');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$page = $this->input->get('page');
|
||||
!$page && $page = 1;
|
||||
@@ -28,12 +33,14 @@ class Attr extends HD_Controller{
|
||||
$where["status > -1"] = null;
|
||||
$params['title'] && $where["title like '%{$params['title']}%'"] = null;
|
||||
|
||||
if($params['s_id']){
|
||||
$where['s_id in (select id from lc_auto_series where brand_id in (select id from lc_auto_brand where status > -1))'] = null;
|
||||
if ($params['s_id']) {
|
||||
$where['s_id'] = $params['s_id'];
|
||||
}if($params['brand_id']){
|
||||
}
|
||||
if ($params['brand_id']) {
|
||||
$where_sery = array('status > -1' => null, 'brand_id' => $params['brand_id']);
|
||||
$rows_sery = $this->auto_series_model->select($where_sery, 'id desc', 0, 0, 'id');
|
||||
if($rows_sery){
|
||||
if ($rows_sery) {
|
||||
$sery_ids = array_column($rows_sery, 'id');
|
||||
$str_ids = implode(',', $sery_ids);
|
||||
$where["s_id in ({$str_ids})"] = null;
|
||||
@@ -41,72 +48,96 @@ class Attr extends HD_Controller{
|
||||
$where['s_id'] = -1;
|
||||
}
|
||||
}
|
||||
strlen($params['type']) && $where['type'] = $params['type'];
|
||||
if (!strlen($params['status'])){
|
||||
$params['status'] = $where['status'] = 1;
|
||||
}
|
||||
elseif ($params['status'] == -9){
|
||||
# pass
|
||||
}
|
||||
else{
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
|
||||
!$params['s_id'] && $params['s_id'] = '';
|
||||
!$params['brand_id'] && $params['brand_id'] = '';
|
||||
!strlen($params['type']) && $params['type'] = '';
|
||||
|
||||
$count = $this->auto_attr_model->count($where);
|
||||
$rows = $this->auto_attr_model->select($where, 'id desc', $page, $size);
|
||||
$rows = $this->auto_attr_model->select($where, 'id desc', $page, $size, '*, (select brand_id from lc_auto_series where id=lc_auto_attr.s_id) as brand_id');
|
||||
$type_arr = $this->auto_attr_model->get_type();
|
||||
$status_arr = $this->auto_brand_model->get_status();
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
|
||||
$list = [];
|
||||
if($rows){
|
||||
$series_arr = array_column($rows,'s_id');
|
||||
$series_rows = $this->auto_series_model->get_map_by_ids($series_arr,'id,name');
|
||||
foreach($rows as $key=>$val){
|
||||
if ($rows) {
|
||||
$series_arr = array_column($rows, 's_id');
|
||||
$series_rows = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
foreach ($rows as $key => $val) {
|
||||
$list[] = [
|
||||
'id' => $val['id'],
|
||||
'title' => $val['title'],
|
||||
'brand_name' => $map_brand[$val['brand_id']] ? $map_brand[$val['brand_id']] : '',
|
||||
's_name' => $series_rows[$val['s_id']] ? $series_rows[$val['s_id']][0]['name'] : '',
|
||||
'status_name' => $status_arr[$val['status']],
|
||||
'status' => $val['status'],
|
||||
'type_cn' => $type_arr[$val['type']],
|
||||
'c_time' => date('Y-m-d H:i:s',$val['c_time'])
|
||||
'c_time' => date('Y-m-d H:i:s', $val['c_time'])
|
||||
];
|
||||
}
|
||||
}
|
||||
$status_arr_list = $status_arr;
|
||||
unset($status_arr_list[-1]);
|
||||
$this->data['status_arr'] = $status_arr_list;
|
||||
$this->data['type_arr'] = $type_arr;
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['_title'] = '属性管理';
|
||||
$this->show_view('auto/attr/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$info = [
|
||||
'title' => ''
|
||||
'title' => '',
|
||||
'options' => [],
|
||||
];
|
||||
if ($id) {
|
||||
$info = $this->auto_attr_model->get(array('id' => $id));
|
||||
if (!$info || empty($info)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$info['jsondata'] = json_decode($info['jsondata'],true);
|
||||
$info['jsondata'] = json_decode($info['jsondata'], true);
|
||||
$info['jsondata']['img'] && $info['jsondata']['s_img'] = build_qiniu_image_url($info['jsondata']['img']);
|
||||
$info['options'] = $info['jsondata']['options'] ? $info['jsondata']['options'] : [];
|
||||
}
|
||||
$brand_id= '';
|
||||
if($info['s_id']){
|
||||
$brand_id = '';
|
||||
if ($info['s_id']) {
|
||||
$row_sery = $this->auto_series_model->get(array('id' => $info['s_id']));
|
||||
$brand_id = $row_sery['brand_id'];
|
||||
}
|
||||
$options = $this->auto_option_model->select(['status'=>1],'id desc',0,0,'id,title,price');
|
||||
$type_arr = $this->auto_attr_model->get_type();
|
||||
!$info['type'] && $info['type'] = 0;
|
||||
$info['brand_id'] = $brand_id;
|
||||
!$info['s_id'] && $info['s_id'] = '';
|
||||
!$info['jsondata']['img'] && $info['jsondata']['img'] = '';
|
||||
$this->data['options'] = $options;
|
||||
$this->data['type_arr'] = $type_arr;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = $id ? '编辑' : '新增';
|
||||
return $this->show_view('auto/attr/edit',true);
|
||||
return $this->show_view('auto/attr/edit', true);
|
||||
}
|
||||
|
||||
public function add(){
|
||||
public function add()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
@@ -120,7 +151,8 @@ class Attr extends HD_Controller{
|
||||
'type' => $post['type'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$post['jsondata'] && $add_data['jsondata'] = json_encode($post['jsondata'],JSON_UNESCAPED_UNICODE);
|
||||
$post['jsondata']['options'] = $post['options'] ? $post['options'] : [];
|
||||
$post['jsondata'] && $add_data['jsondata'] = json_encode($post['jsondata'], JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->auto_attr_model->add($add_data);
|
||||
if (!$result) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
@@ -128,13 +160,14 @@ class Attr extends HD_Controller{
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
public function edit()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
$post = $this->input->post();
|
||||
$row = $this->auto_attr_model->get(['id'=>$post['id']]);
|
||||
if(!$row){
|
||||
$row = $this->auto_attr_model->get(['id' => $post['id']]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在');
|
||||
}
|
||||
if (!$post['title']) {
|
||||
@@ -145,22 +178,34 @@ class Attr extends HD_Controller{
|
||||
's_id' => $post['s_id'],
|
||||
'type' => $post['type'],
|
||||
];
|
||||
$post['jsondata'] && $update['jsondata'] = json_encode($post['jsondata'],JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->auto_attr_model->update($update,['id'=>$row['id']]);
|
||||
$post['jsondata']['options'] = $post['options'] ? $post['options'] : [];
|
||||
$post['jsondata'] && $update['jsondata'] = json_encode($post['jsondata'], JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->auto_attr_model->update($update, ['id' => $row['id']]);
|
||||
if (!$result) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del(){
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$stauts = $this->input->post('status');
|
||||
$where = ['id' => $id];
|
||||
$this->auto_attr_model->update(['status' => $stauts], $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function batch(){
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export(){
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -168,39 +213,49 @@ class Attr extends HD_Controller{
|
||||
* 属性选项列表
|
||||
* @return bool
|
||||
*/
|
||||
function json_lists(){
|
||||
function json_lists()
|
||||
{
|
||||
$s_id = $this->input->get_post('s_id');
|
||||
$status = $this->input->get_post('status');
|
||||
$type = $this->input->get_post('type');
|
||||
$page = $this->input->get_post('page');
|
||||
$size = $this->input->get_post('size');
|
||||
|
||||
$where = array();
|
||||
$s_id && $where['s_id'] = $s_id;
|
||||
strlen($type) > 0 && $where['type'] = $type;
|
||||
if(strlen($status) > 0){
|
||||
$where['status'] = $status;
|
||||
/*if ($status == 3) {//搜索专用
|
||||
$where['status'] = 1;
|
||||
} else {
|
||||
$where['status>-1'] = null;
|
||||
$where['status>'] = -1;
|
||||
}*/
|
||||
if(strlen($status) > 0){
|
||||
if (strpos($status,'>') !== false || strpos($status,'<') !== false || strpos($status,'in') !== false){
|
||||
$where["status {$status}"] = null;
|
||||
}
|
||||
else{
|
||||
if ($status == 3) {//搜索专用
|
||||
$where['status'] = 1;
|
||||
} else {
|
||||
$where['status>'] = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$where['status > -1'] = null;
|
||||
}
|
||||
|
||||
$where['status>-1'] = null;
|
||||
$total = $this->auto_attr_model->count($where);
|
||||
|
||||
|
||||
$lists = array();
|
||||
if($total){
|
||||
if ($total) {
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, title';
|
||||
$rows = $this->auto_attr_model->select($where, $orderby, $page, $size, $select);
|
||||
|
||||
foreach($rows as $v){
|
||||
foreach ($rows as $v) {
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'title' => $v['title'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = array('total' => $total, 'list' => $lists);
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ class Brand extends HD_Controller{
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_brand_biz_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
@@ -25,8 +27,18 @@ class Brand extends HD_Controller{
|
||||
$size = 20;
|
||||
$where["status > -1"] = null;
|
||||
$params['title'] && $where["name like '%{$params['title']}%'"] = null;
|
||||
if (!strlen($params['status'])){
|
||||
$params['status'] = $where['status'] = 1;
|
||||
}
|
||||
elseif ($params['status'] == -9){
|
||||
# pass
|
||||
}
|
||||
else{
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
|
||||
$count = $this->auto_brand_model->count($where);
|
||||
$rows = $this->auto_brand_model->select($where, 'id desc', $page, $size);
|
||||
$rows = $this->auto_brand_model->select($where, 'status desc, id asc', $page, $size);
|
||||
$status_arr = $this->auto_brand_model->get_status();
|
||||
$list = [];
|
||||
if($rows){
|
||||
@@ -35,11 +47,15 @@ class Brand extends HD_Controller{
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'status' => $val['status'],
|
||||
't_biz' => $this->auto_brand_biz_model->count(['brand_id'=>$val['id']]),
|
||||
'status_name' => $status_arr[$val['status']],
|
||||
'c_time' => date('Y-m-d H:i:s',$val['c_time'])
|
||||
];
|
||||
}
|
||||
}
|
||||
$status_arr_list = $status_arr;
|
||||
unset($status_arr_list[-1]);
|
||||
$this->data['status_arr'] = $status_arr_list;
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
@@ -126,6 +142,20 @@ class Brand extends HD_Controller{
|
||||
$stauts = $this->input->post('status');
|
||||
$where = array('id' => $id);
|
||||
$this->auto_brand_model->update(array('status' => $stauts), $where);
|
||||
if ($stauts == -1){
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
# 车型库
|
||||
$this->auto_cars_model->update(array('status' => $stauts), array('brand_id' => $id));
|
||||
# 车系
|
||||
$this->auto_series_model->update(array('status' => $stauts), array('brand_id' => $id));
|
||||
# 车辆属性
|
||||
$this->auto_attr_model->update(array('status' => $stauts), array("s_id in (select id from lc_auto_series where brand_id = {$id})" => null));
|
||||
# 车型介绍
|
||||
$this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce');
|
||||
$this->mdAutoIntroduce->update(array('status' => $stauts), array('brand_id' => $id));
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
@@ -154,22 +184,27 @@ class Brand extends HD_Controller{
|
||||
$title && $where["name like '%{$title}%'"] = null;
|
||||
$un_ids && $where["id not in({$un_ids})"] = null;
|
||||
if(strlen($status) > 0){
|
||||
$where['status'] = $status;
|
||||
if (strpos($status,'>') !== false || strpos($status,'<') !== false || strpos($status,'in') !== false){
|
||||
$where["status {$status}"] = null;
|
||||
}
|
||||
else{
|
||||
$where['status'] = $status;
|
||||
}
|
||||
} else {
|
||||
$whre['status > -1'] = null;
|
||||
$where['status > -1'] = null;
|
||||
}
|
||||
|
||||
$total = $this->auto_brand_model->count($where);
|
||||
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$orderby = 'status desc, id asc';
|
||||
$select = 'id, name';
|
||||
$rows = $this->auto_brand_model->select($where, $orderby, $page, $size, $select);
|
||||
|
||||
foreach($rows as $v){
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'id' => strlen($status) > 0 ? $v['id'] : " " . $v['id'],
|
||||
'name' => $v['name'],
|
||||
);
|
||||
}
|
||||
@@ -178,5 +213,153 @@ class Brand extends HD_Controller{
|
||||
$this->data = array('total' => $total, 'list' => $lists);
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
//授权门店
|
||||
public function get_biz(){
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$info = $this->auto_brand_model->get(array('id' => $id));
|
||||
if (!$info) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$cate_lists = $this->biz_model->type_ary();
|
||||
$params = [
|
||||
'id' => $id,
|
||||
'cate_id' => 1
|
||||
];
|
||||
$this->data['params'] = $params;
|
||||
$this->data['cate_lists'] = $cate_lists;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = '授权品牌';
|
||||
return $this->show_view('auto/brand/edit_biz',true);
|
||||
}
|
||||
//授权门店
|
||||
public function edit_biz(){
|
||||
$brand_id = $this->input->post('id');
|
||||
$type = intval($this->input->post('type'));
|
||||
$brand_biz = $this->input->post('brand_biz');
|
||||
|
||||
$info = $this->auto_brand_model->get(array('id' => $brand_id));
|
||||
if (!$info) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$biz_ids = '';
|
||||
$brand_biz && $biz_ids = implode(',',array_unique(array_keys($brand_biz)));
|
||||
if($brand_biz && $biz_ids){
|
||||
$where = [
|
||||
"biz_id not in ({$biz_ids})" => null,
|
||||
'brand_id' => $brand_id
|
||||
];
|
||||
$type && $where['type'] = $type;
|
||||
if($this->auto_brand_biz_model->count($where)){
|
||||
$this->auto_brand_biz_model->delete($where);
|
||||
}
|
||||
$add_datas = [];
|
||||
foreach ($brand_biz as $key => $val) {
|
||||
$where = [
|
||||
'biz_id' => $key,
|
||||
'brand_id' => $brand_id
|
||||
];
|
||||
$type && $where['type'] = $type;
|
||||
if(!$this->auto_brand_biz_model->count($where)){
|
||||
if(!$type){
|
||||
$biz_row = $this->biz_model->get(['id'=>$key],'type');
|
||||
$type = $biz_row['type'];
|
||||
}
|
||||
$add_datas[] = [
|
||||
'biz_id' => $key,
|
||||
'type' => $type,
|
||||
'brand_id' => $brand_id,
|
||||
'c_time' => time()
|
||||
];
|
||||
}
|
||||
}
|
||||
$add_datas && $this->auto_brand_biz_model->add_batch($add_datas);
|
||||
}else{
|
||||
$where = [
|
||||
'brand_id' => $brand_id,
|
||||
];
|
||||
$type && $where['type'] = $type;
|
||||
if($this->auto_brand_biz_model->count($where)){
|
||||
$this->auto_brand_biz_model->delete($where);
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function ajax_biz(){
|
||||
$type = intval($this->input->get('type'));
|
||||
$brand_id = intval($this->input->get('id'));
|
||||
if($type){
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => $type,
|
||||
"id not in (select biz_id from lc_auto_brand_biz where brand_id={$brand_id} and type={$type})" => null
|
||||
];
|
||||
}else{
|
||||
$where = [
|
||||
'status' => 1,
|
||||
"id not in (select biz_id from lc_auto_brand_biz where brand_id={$brand_id})" => null
|
||||
];
|
||||
}
|
||||
$biz_lists = $this->biz_model->map('id','biz_name',$where,'',0,0,'id,biz_name');
|
||||
if($type){
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'type' => $type,
|
||||
"id in (select biz_id from lc_auto_brand_biz where brand_id={$brand_id} and type={$type})" => null
|
||||
];
|
||||
}else{
|
||||
$where = [
|
||||
'status' => 1,
|
||||
"id in (select biz_id from lc_auto_brand_biz where brand_id={$brand_id})" => null
|
||||
];
|
||||
}
|
||||
$brand_biz = $this->biz_model->map('id','biz_name',$where,'',0,0,'id,biz_name');
|
||||
$this->data['biz_lists'] = $biz_lists;
|
||||
$this->data['brand_biz'] = $brand_biz;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
//旧门店授权品牌脚本
|
||||
public function change(){
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'status' => 1
|
||||
];
|
||||
$rows = $this->biz_model->select($where,'id asc',$page,$size,'id,type,jsondata');
|
||||
if($rows){
|
||||
foreach ($rows as $key=>$val) {
|
||||
$jsondata = json_decode($val['jsondata'],true);
|
||||
$add_datas = [];
|
||||
if($jsondata['auto_brands'] && is_array($jsondata['auto_brands'])){
|
||||
foreach ($jsondata['auto_brands'] as $v) {
|
||||
$where = [
|
||||
'biz_id'=>$val['id'],
|
||||
'type'=>$val['type'],
|
||||
'brand_id'=>$v
|
||||
];
|
||||
if(!$this->auto_brand_biz_model->count($where)){
|
||||
$add_datas[] = [
|
||||
'biz_id' => $val['id'],
|
||||
'type' => $val['type'],
|
||||
'brand_id' => $v,
|
||||
'c_time' => time()
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
$add_datas && $this->auto_brand_biz_model->add_batch($add_datas);
|
||||
echo "门店id:{$val['id']},添加数据:".json_encode($add_datas,JSON_UNESCAPED_UNICODE).'<br>';
|
||||
}else{
|
||||
echo "门店id:{$val['id']},无授权品牌<br>";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo '执行完毕';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,43 @@ class Business extends HD_Controller{
|
||||
public function index()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$where = $this->get_where($params);
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $params['size'];
|
||||
$size = !$size ? 20 : $size;
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status = 1' => null);
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
//状态
|
||||
$statusAry = array('0' => '关闭', '1' => '开启');
|
||||
|
||||
$total = $this->auto_business_model->count($where);
|
||||
$lists = array();
|
||||
$total && $lists = $this->get_data($where, $page, $size, $map_brand);
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
|
||||
$this->data['cityAry'] = $this->sys_city_model->select(['status'=>1],'id desc',0,0,'city_id,name');
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
|
||||
$this->data['_title'] = '商务政策管理';
|
||||
$this->show_view('auto/business/lists',true);
|
||||
}
|
||||
|
||||
private function get_where(&$params){
|
||||
!isset($params['status']) && $params['status'] = 1;
|
||||
!isset($params['if_effect']) && $params['if_effect'] = 1;
|
||||
!isset($params['month']) && $params['month'] = '';
|
||||
|
||||
$where = array();
|
||||
$where['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where['s_id in (select id from lc_auto_series where status = 1)'] = null;
|
||||
$where['v_id in (select id from lc_auto_attr where status = 1 and type = 1)'] = null;
|
||||
if($params['brand_id']){
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
} else{
|
||||
@@ -60,85 +95,83 @@ class Business extends HD_Controller{
|
||||
}
|
||||
if($params['month']){
|
||||
$where['month'] = $params['month'];
|
||||
}elseif(!isset($params['month'])){
|
||||
$where['month'] = $params['month'] = intval(date('m'));
|
||||
}
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $params['size'];
|
||||
$size = !$size ? 20 : $size;
|
||||
return $where;
|
||||
}
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
//状态
|
||||
$statusAry = array('0' => '关闭', '1' => '开启');
|
||||
|
||||
$total = $this->auto_business_model->count($where);
|
||||
private function get_data($where, $page, $size, $map_brand, $export=false){
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$select = '*';
|
||||
$rows = $this->auto_business_model->select($where, $orderby, $page, $size, $select);
|
||||
if($rows){
|
||||
$s_ids = array_unique(array_column($rows,'s_id'));
|
||||
$attr_ids = array_unique(array_column($rows,'v_id'));
|
||||
$city_ids = array_unique(array_column($rows,'city_id'));
|
||||
//获取车系列表
|
||||
$map_sery = array();
|
||||
if($s_ids){
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where_sery = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->auto_series_model->map('id', 'name', $where_sery, 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
$map_attr = array();
|
||||
if($attr_ids){
|
||||
$str_ids = implode(',', $attr_ids);
|
||||
$where_attr = array("id in ({$str_ids})" => null);
|
||||
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type');
|
||||
}
|
||||
if($city_ids){
|
||||
$str_ids = implode(',', $city_ids);
|
||||
$where_city = array("city_id in ({$str_ids})" => null);
|
||||
$map_city = $this->sys_city_model->map('city_id', 'name', $where_city, 'id desc', 0 , 0, 'city_id, name');
|
||||
}
|
||||
//属性按'车型-车身颜色-内饰颜色'排序
|
||||
foreach($rows as $v){
|
||||
$title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]}";
|
||||
$city_cn = $map_city[$v['city_id']];
|
||||
$month = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'title' => $title,
|
||||
'status' => $v['status'],
|
||||
'price_car' => $v['price_car'] > 0 ? $v['price_car'] : '0.00',
|
||||
'price_floor' => $v['price_floor'] > 0 ? $v['price_floor'] : '0.00',
|
||||
'price_coplus' => $v['price_coplus'] > 0 ? $v['price_coplus'] : '0.00',
|
||||
'price_color' => $v['price_color'] > 0 ? $v['price_color'] : '0.00',
|
||||
'profix_car' => $v['profix_car'],
|
||||
'profix_insure' => $v['profix_insure'],
|
||||
'profix_carno' => $v['profix_carno'],
|
||||
'profix_loan' => $v['profix_loan'],
|
||||
'city_cn'=> $city_cn,
|
||||
'month' => $month,
|
||||
's_effect_time' => $v['s_effect_time'] ? date('Y-m-d',$v['s_effect_time']) : '',
|
||||
'effect_status' => $v['if_effect'] ? '生效中' : '未生效',
|
||||
'if_effect' => $v['if_effect'],
|
||||
$orderby = 'id desc';
|
||||
$select = '*';
|
||||
$rows = $this->auto_business_model->select($where, $orderby, $page, $size, $select);
|
||||
if($rows){
|
||||
$s_ids = array_unique(array_column($rows,'s_id'));
|
||||
$attr_ids = array_unique(array_column($rows,'v_id'));
|
||||
$city_ids = array_unique(array_column($rows,'city_id'));
|
||||
//获取车系列表
|
||||
$map_sery = array();
|
||||
if($s_ids){
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where_sery = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->auto_series_model->map('id', 'name', $where_sery, 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
$map_attr = array();
|
||||
if($attr_ids){
|
||||
$str_ids = implode(',', $attr_ids);
|
||||
$where_attr = array("id in ({$str_ids})" => null);
|
||||
$map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title, type');
|
||||
}
|
||||
if($city_ids){
|
||||
$str_ids = implode(',', $city_ids);
|
||||
$where_city = array("city_id in ({$str_ids})" => null);
|
||||
$map_city = $this->sys_city_model->map('city_id', 'name', $where_city, 'id desc', 0 , 0, 'city_id, name');
|
||||
}
|
||||
//属性按'车型-车身颜色-内饰颜色'排序
|
||||
foreach($rows as $v){
|
||||
$title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]}";
|
||||
$city_cn = $map_city[$v['city_id']];
|
||||
$month = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$row = array(
|
||||
'id' => $v['id'],
|
||||
'title' => $title,
|
||||
'status' => $v['status'],
|
||||
'price_car' => $v['price_car'] > 0 ? $v['price_car'] : '0.00',
|
||||
'price_floor' => $v['price_floor'] > 0 ? $v['price_floor'] : '0.00',
|
||||
'price_coplus' => $v['price_coplus'] > 0 ? $v['price_coplus'] : '0.00',
|
||||
'price_color' => $v['price_color'] > 0 ? $v['price_color'] : '0.00',
|
||||
'profix_car' => $v['profix_car'],
|
||||
'proxy_type' => $v['proxy_type'] == 0 ? '返佣' : '票折',
|
||||
'proxy_profix_price' => $v['proxy_profix_price'] != 0.0 ? $v['proxy_profix_price'] :'',
|
||||
'proxy_profix_lower' => $v['proxy_profix_lower'] != 0.0 ? $v['proxy_profix_lower'] : '',
|
||||
'proxy_profix_rebate' => $v['proxy_profix_rebate'] != 0.0 ? $v['proxy_profix_rebate'] : '',
|
||||
'proxy_profix_car' => $v['proxy_profix_car'],
|
||||
'profix_insure' => $v['profix_insure'],
|
||||
'profix_carno' => $v['profix_carno'],
|
||||
'profix_loan' => $v['profix_loan'],
|
||||
'city_cn'=> $city_cn,
|
||||
'month' => $month,
|
||||
's_effect_time' => $v['s_effect_time'] ? date('Y-m-d',$v['s_effect_time']) : '',
|
||||
'effect_status' => $v['if_effect'] ? '生效中' : '未生效',
|
||||
'if_effect' => $v['if_effect'],
|
||||
'delivery_day' => $v['delivery_day']
|
||||
);
|
||||
|
||||
if ($export){
|
||||
$export_arr = array(
|
||||
'brand_name' => $map_brand[$v['brand_id']],
|
||||
'sery_name' => $map_sery[$v['s_id']],
|
||||
'attr_name' => $map_attr[$v['v_id']],
|
||||
'year' => $v['year'],
|
||||
'month' => $v['month'],
|
||||
'status_name' => $v['status'] ? '开启' : '关闭',
|
||||
);
|
||||
$row = array_merge($row, $export_arr);
|
||||
}
|
||||
$lists[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['cityAry'] = $this->sys_city_model->select(['status'=>1],'id desc',0,0,'city_id,name');
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
|
||||
$this->data['_title'] = '商务政策管理';
|
||||
$this->show_view('auto/business/lists',true);
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function lists()
|
||||
@@ -149,20 +182,26 @@ class Business extends HD_Controller{
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', ['status>'=>-1], 'id desc', 0 , 0, 'id, name');
|
||||
#$map_brand = $this->auto_brand_model->map('id', 'name', ['status>'=>-1], 'id desc', 0 , 0, 'id, name');
|
||||
$map_brand = $this->auto_brand_model->map_brand_list($this->auto_brand_model->map_brand(array('status = 1' => null)));
|
||||
$city_rows = $this->sys_city_model->select(['status'=>1],'id desc',0,0,'city_id,name');
|
||||
$row = $this->auto_business_model->get(['id'=>$id]);
|
||||
if($id && $row){
|
||||
$info = [
|
||||
'id' => $row['id'],
|
||||
'city_id' => $row['city_id'],
|
||||
'brand_id' => $row['brand_id'],
|
||||
'brand_id' => ' '.$row['brand_id'],
|
||||
's_id' => $row['s_id'],
|
||||
'v_id' => $row['v_id'],
|
||||
'price_car' => $row['price_car'],
|
||||
'price_floor' => $row['price_floor'],
|
||||
'price_color' => $row['price_color'],
|
||||
'price_coplus' => $row['price_coplus'],
|
||||
'proxy_type' => intval($row['proxy_type']),
|
||||
'proxy_profix_price' => $row['proxy_profix_price'],
|
||||
'proxy_profix_lower' => $row['proxy_profix_lower'],
|
||||
'proxy_profix_rebate' => $row['proxy_profix_rebate'],
|
||||
'proxy_profix_car' => $row['proxy_profix_car'],
|
||||
'profix_car' => $row['profix_car'],
|
||||
'profix_carno' => $row['profix_carno'],
|
||||
'profix_insure' => $row['profix_insure'],
|
||||
@@ -190,6 +229,11 @@ class Business extends HD_Controller{
|
||||
'price_floor' => 0.00,
|
||||
'price_color' => 0.00,
|
||||
'price_coplus' => 0.00,
|
||||
'proxy_type' => 0,
|
||||
'proxy_profix_price' => 0.00,
|
||||
'proxy_profix_lower' => 0.00,
|
||||
'proxy_profix_rebate' => 0.00,
|
||||
'proxy_profix_car' => 0.00,
|
||||
'profix_car' => 0.00,
|
||||
'profix_carno' => 0.00,
|
||||
'profix_insure' => 0.00,
|
||||
@@ -246,6 +290,11 @@ class Business extends HD_Controller{
|
||||
$info['price_floor'] && $data['price_floor'] = $info['price_floor'];
|
||||
$info['price_coplus'] && $data['price_coplus'] = $info['price_coplus'];
|
||||
$info['price_color'] && $data['price_color'] = $info['price_color'];
|
||||
$data['proxy_type'] = $info['proxy_type'];
|
||||
$data['proxy_profix_price'] = $info['proxy_profix_price'];
|
||||
$data['proxy_profix_lower'] = $info['proxy_profix_lower'];
|
||||
$data['proxy_profix_rebate'] = $info['proxy_profix_rebate'];
|
||||
$info['proxy_profix_car'] && $data['proxy_profix_car'] = $info['proxy_profix_car'];
|
||||
$info['profix_car'] && $data['profix_car'] = $info['profix_car'];
|
||||
$info['profix_carno'] && $data['profix_carno'] = $info['profix_carno'];
|
||||
$info['profix_insure'] && $data['profix_insure'] = $info['profix_insure'];
|
||||
@@ -260,6 +309,186 @@ class Business extends HD_Controller{
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
}
|
||||
|
||||
function add_excel()
|
||||
{
|
||||
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
|
||||
$res = $this->upload();
|
||||
if (!$res['code']) {
|
||||
return $this->show_json(0, $res['message']);
|
||||
}
|
||||
$file = $res['path'];
|
||||
if ($res['file_ext'] == '.xls') {
|
||||
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
|
||||
} elseif ($res['file_ext'] == '.xlsx') {
|
||||
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '文件无法识别');
|
||||
}
|
||||
$PHPExcel = $reader->load($file); // 文档名称
|
||||
$objWorksheet = $PHPExcel->getActiveSheet();
|
||||
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
|
||||
if ($rowCnt > 800) {
|
||||
@unlink($file);
|
||||
return $this->show_json(0, '数据大于800请拆分多个表格导入');
|
||||
}
|
||||
$data = array();
|
||||
$yearary = $this->auto_business_model->year();
|
||||
$monthary = $this->auto_business_model->month();
|
||||
$c_time = time();
|
||||
$count = $rowCnt - 1;
|
||||
$count_ignore = 0;
|
||||
$msg_debug = "file: {$file};count: {$count};";
|
||||
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
|
||||
$brand_name = $objWorksheet->getCell('A' . $_row)->getValue();
|
||||
$res = $this->auto_brand_model->get(array('status'=>1, 'name'=>$brand_name), 'id');
|
||||
if (!$res){
|
||||
$count_ignore += 1;
|
||||
$msg_debug .= 'no brand_id;';
|
||||
continue;
|
||||
}
|
||||
$brand_id = $res['id'];
|
||||
|
||||
$s_name = $objWorksheet->getCell('B' . $_row)->getValue();
|
||||
$res = $this->auto_series_model->get(array('status'=>1, 'brand_id'=> $brand_id, 'name'=>$s_name), 'id');
|
||||
if (!$res){
|
||||
$count_ignore += 1;
|
||||
$msg_debug .= 'no s_id;';
|
||||
continue;
|
||||
}
|
||||
$s_id = $res['id'];
|
||||
|
||||
$v_name = $objWorksheet->getCell('C' . $_row)->getValue();
|
||||
$res = $this->auto_attr_model->get(array('status'=>1, 's_id'=> $s_id, 'title'=>$v_name), 'id');
|
||||
if (!$res){
|
||||
$count_ignore += 1;
|
||||
$msg_debug .= 'no v_id;';
|
||||
continue;
|
||||
}
|
||||
$v_id = $res['id'];
|
||||
|
||||
$city_name = $objWorksheet->getCell('D' . $_row)->getValue();
|
||||
if (!$city_name){
|
||||
$count_ignore += 1;
|
||||
$msg_debug .= 'no city_name;';
|
||||
continue;
|
||||
}
|
||||
$res = $this->sys_city_model->get(array('status'=>1, "name like '%{$city_name}%'"=>null), 'city_id');
|
||||
if (!$res){
|
||||
$count_ignore += 1;
|
||||
$sql = $this->sys_city_model->db->last_query();
|
||||
$msg_debug .= "no city_id: {$sql};";
|
||||
continue;
|
||||
}
|
||||
$city_id = $res['city_id'];
|
||||
|
||||
$s_effect_date = $objWorksheet->getCell('E' . $_row)->getValue(); # 此处得到是距离1900-01-01天数
|
||||
$s_effect_date && $s_effect_date = gmdate("Y-m-d", \PHPExcel_Shared_Date::ExcelToPHP($s_effect_date));
|
||||
$s_effect_time = 0;
|
||||
$if_effect = 0;
|
||||
if ($s_effect_date) {
|
||||
$s_effect_time = strtotime($s_effect_date);
|
||||
if($c_time>$s_effect_time){
|
||||
$if_effect = 1;
|
||||
}
|
||||
}
|
||||
$msg_debug .= "s_effect_date:{$s_effect_date};s_effect_time:{$s_effect_time};if_effect:{$if_effect};";
|
||||
|
||||
$year = $objWorksheet->getCell('F' . $_row)->getValue();
|
||||
$month = $objWorksheet->getCell('G' . $_row)->getValue();
|
||||
$year = intval($year);
|
||||
$month = intval($month);
|
||||
if (!in_array($year, $yearary) || !in_array($month, $monthary)){
|
||||
$count_ignore += 1;
|
||||
$msg_debug .= 'year or month exception;';
|
||||
continue;
|
||||
}
|
||||
|
||||
$where = [
|
||||
'brand_id' => $brand_id,
|
||||
's_id' => $s_id,
|
||||
'v_id' => $v_id,
|
||||
'city_id' => $city_id,
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status' => 1,
|
||||
];
|
||||
if($this->auto_business_model->get($where)){
|
||||
$count_ignore += 1;
|
||||
$sql = $this->auto_business_model->db->last_query();
|
||||
$msg_debug .= "exists business: {$sql};";
|
||||
continue;
|
||||
}
|
||||
|
||||
$price_car = $objWorksheet->getCell('H' . $_row)->getValue();
|
||||
$price_floor = $objWorksheet->getCell('I' . $_row)->getValue();
|
||||
$delivery_day = $objWorksheet->getCell('J' . $_row)->getValue();
|
||||
$delivery_day = intval($delivery_day);
|
||||
$delivery_day = $delivery_day < 0 ? 0 : $delivery_day;
|
||||
//$price_color = $objWorksheet->getCell('K' . $_row)->getValue();
|
||||
$proxy_name = $objWorksheet->getCell('K' . $_row)->getValue();
|
||||
$proxy_type = $proxy_name == '票折' ? 1 : 0;
|
||||
$proxy_profix_price = $objWorksheet->getCell('L' . $_row)->getValue();
|
||||
$proxy_profix_lower = $objWorksheet->getCell('M' . $_row)->getValue();
|
||||
$proxy_profix_rebate = $objWorksheet->getCell('N' . $_row)->getValue();
|
||||
//$proxy_profix_car = $objWorksheet->getCell('M' . $_row)->getValue();
|
||||
//$profix_car = $objWorksheet->getCell('N' . $_row)->getValue();
|
||||
//$profix_cardno = $objWorksheet->getCell('O' . $_row)->getValue();
|
||||
//$profix_insure = $objWorksheet->getCell('P' . $_row)->getValue();
|
||||
//$profix_loan = $objWorksheet->getCell('Q' . $_row)->getValue();
|
||||
|
||||
$info = [
|
||||
'brand_id' => $brand_id,
|
||||
's_id' => $s_id,
|
||||
'v_id' => $v_id,
|
||||
'city_id' => $city_id,
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
'status' => 1,
|
||||
'c_time' => $c_time,
|
||||
];
|
||||
|
||||
$info['price_car'] = $price_car;
|
||||
$info['price_floor'] = $price_floor;
|
||||
//$info['price_color'] = $price_color;
|
||||
$info['proxy_type'] = $proxy_type;
|
||||
$info['proxy_profix_price'] = $proxy_profix_price;
|
||||
$info['proxy_profix_lower'] = $proxy_profix_lower;
|
||||
$info['proxy_profix_rebate'] = $proxy_profix_rebate;
|
||||
//$info['proxy_profix_car'] = $proxy_profix_car;
|
||||
//$info['profix_car'] = $profix_car;
|
||||
//$info['profix_carno'] = $profix_cardno;
|
||||
//$info['profix_insure'] = $profix_insure;
|
||||
//$info['profix_loan'] = $profix_loan;
|
||||
$info['s_effect_time'] = $s_effect_time;
|
||||
$info['if_effect'] = $if_effect;
|
||||
$info['delivery_day'] = $delivery_day;
|
||||
$data[] = $info;
|
||||
}
|
||||
$msg_debug .= "count_ignore:{$count_ignore}";
|
||||
$done = 0;
|
||||
$data && $done = $this->auto_business_model->add_batch($data);
|
||||
@unlink($file);
|
||||
$this->data['load_num'] = count($data);
|
||||
$this->data['done'] = $done;
|
||||
#$this->data['msg_debug'] = $msg_debug;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, "共{$count}条,成功导入{$done}条");
|
||||
}
|
||||
|
||||
private function upload()
|
||||
{
|
||||
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
|
||||
$config['allowed_types'] = 'xls|xlsx';
|
||||
$config['max_size'] = 5120;
|
||||
$config['file_name'] = 'receiver_clues' . time() . rand(1, 99999);
|
||||
$this->load->library('upload', $config);
|
||||
if (!$this->upload->do_upload('file')) {
|
||||
return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', ''));
|
||||
} else {
|
||||
$data = $this->upload->data();
|
||||
return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']);
|
||||
}
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
@@ -293,14 +522,19 @@ class Business extends HD_Controller{
|
||||
'year' => $year,
|
||||
'month' => $month,
|
||||
];
|
||||
$info['price_car'] && $data['price_car'] = $info['price_car'];
|
||||
$info['price_floor'] && $data['price_floor'] = $info['price_floor'];
|
||||
$info['price_coplus'] && $data['price_coplus'] = $info['price_coplus'];
|
||||
$info['price_color'] && $data['price_color'] = $info['price_color'];
|
||||
$info['profix_car'] && $data['profix_car'] = $info['profix_car'];
|
||||
$info['profix_carno'] && $data['profix_carno'] = $info['profix_carno'];
|
||||
$info['profix_insure'] && $data['profix_insure'] = $info['profix_insure'];
|
||||
$info['profix_loan'] && $data['profix_loan'] = $info['profix_loan'];
|
||||
$data['price_car'] = $info['price_car'];
|
||||
$data['price_floor'] = $info['price_floor'];
|
||||
$data['price_coplus'] = $info['price_coplus'];
|
||||
$data['price_color'] = $info['price_color'];
|
||||
$data['proxy_type'] = $info['proxy_type'];
|
||||
$data['proxy_profix_price'] = $info['proxy_profix_price'];
|
||||
$data['proxy_profix_lower'] = $info['proxy_profix_lower'];
|
||||
$data['proxy_profix_rebate'] = $info['proxy_profix_rebate'];
|
||||
$data['proxy_profix_car'] = $info['proxy_profix_car'];
|
||||
$data['profix_car'] = $info['profix_car'];
|
||||
$data['profix_carno'] = $info['profix_carno'];
|
||||
$data['profix_insure'] = $info['profix_insure'];
|
||||
$data['profix_loan'] = $info['profix_loan'];
|
||||
$info['colors'] && $data['colors'] = json_encode($info['colors'],JSON_UNESCAPED_UNICODE);
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = strtotime($info['s_effect_time']);
|
||||
$info['delivery_day'] && $data['delivery_day'] = $info['delivery_day'];
|
||||
@@ -323,8 +557,47 @@ class Business extends HD_Controller{
|
||||
|
||||
public function export()
|
||||
{
|
||||
// TODO: Implement export() method.
|
||||
$params = $this->input->get();
|
||||
$where = $this->get_where($params);
|
||||
$page = 1;
|
||||
$size = 10000;
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status = 1' => null);
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
$data = $this->get_data($where, $page, $size, $map_brand, true);
|
||||
|
||||
$fileName = '商务政策';
|
||||
$indexs = [
|
||||
'brand_name' => '品牌',
|
||||
'sery_name' => '车系',
|
||||
'attr_name' => '车型',
|
||||
'city_cn' => '城市',
|
||||
's_effect_time' => '生效日期',
|
||||
'year' => '时间-年',
|
||||
'month' => '时间-月',
|
||||
'price_car' => '裸车报价',
|
||||
'price_floor' => '展厅最低限价',
|
||||
'delivery_day' => '交车工作日',
|
||||
//'price_color' => '颜色加价',
|
||||
'proxy_type' => '代理店返用方式',
|
||||
'proxy_profix_price' => '代理店结算价',
|
||||
'proxy_profix_lower' => '代理店最低限价',
|
||||
'proxy_profix_rebate' => '代理店佣金',
|
||||
//'proxy_profix_car' => '代理店单车毛利',
|
||||
//'profix_car' => '品牌店单车毛利',
|
||||
//'profix_carno' => '上牌毛利',
|
||||
//'profix_insure' => '保险毛利',
|
||||
//'profix_loan' => '按揭毛利', # 以上次序与导入一致,方便导出后编辑再导入
|
||||
'status_name' => '状态',
|
||||
'effect_status' => '是否生效',
|
||||
'id' => 'ID',
|
||||
];
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
function edit_status(){
|
||||
$id = $this->input->post('id');
|
||||
$field = $this->input->post('field');
|
||||
|
||||
@@ -29,6 +29,9 @@ class Cars extends HD_Controller{
|
||||
$params = $this->input->get();
|
||||
|
||||
$where = array();
|
||||
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
|
||||
$where['s_id in (select id from lc_auto_series where status > -1)'] = null;
|
||||
$where['v_id in (select id from lc_auto_attr where status > -1 and type = 1)'] = null;
|
||||
if($params['brand_id']){
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
} else{
|
||||
@@ -58,7 +61,7 @@ class Cars extends HD_Controller{
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
//状态
|
||||
$statusAry = array('0' => '关闭', '1' => '开启');
|
||||
|
||||
@@ -109,7 +112,7 @@ class Cars extends HD_Controller{
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
|
||||
$this->data['_title'] = '车型库管理';
|
||||
$this->show_view('auto/cars/lists',true);
|
||||
@@ -120,7 +123,8 @@ class Cars extends HD_Controller{
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
#$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
$map_brand = $this->auto_brand_model->map_brand_list($this->auto_brand_model->map_brand($where_brand));
|
||||
//状态
|
||||
$statusAry = array('0' => '关闭', '1' => '开启');
|
||||
if($id){
|
||||
@@ -344,6 +348,7 @@ class Cars extends HD_Controller{
|
||||
// 'price_car' => $row['price_car']
|
||||
// );
|
||||
|
||||
$row['price_floor'] && $row['price_floor'] = 0;
|
||||
$this->data = $row;
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
|
||||
@@ -16,7 +16,8 @@ class Finance extends HD_Controller{
|
||||
$this->load->model('auto/auto_cars_model');
|
||||
$this->load->model('auto/auto_finance_model');
|
||||
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
//$this->load->model('sys/sys_finance_model');
|
||||
$this->load->model('sys/sys_supplier_model');
|
||||
}
|
||||
|
||||
public function index(){
|
||||
@@ -42,7 +43,11 @@ class Finance extends HD_Controller{
|
||||
$params['brand_id'] && $where["$t2.brand_id"] = $params['brand_id'];
|
||||
$params['s_id'] && $where["$t2.s_id"] = $params['s_id'];
|
||||
$params['v_id'] && $where["$t2.v_id"] = $params['v_id'];
|
||||
$params['cor_id'] && $where["$t2.cor_id"] = $params['cor_id'];
|
||||
#$params['cor_id'] && $where["$t2.cor_id"] = $params['cor_id'];
|
||||
#$where[$t2.'.color_id in (select id from lc_auto_attr where status = 1 and type = 0)'] = null;
|
||||
$where[$t2.'.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where[$t2.'.s_id in (select id from lc_auto_series where status = 1)'] = null;
|
||||
$where[$t2.'.v_id in (select id from lc_auto_attr where status = 1 and type = 1)'] = null;
|
||||
|
||||
$total = $this->auto_finance_model->count_finance($where);
|
||||
$lists = array();
|
||||
@@ -50,7 +55,8 @@ class Finance extends HD_Controller{
|
||||
$select = "$t1.id,$t1.car_id,$t1.fin_id,$t1.num,$t1.month_pay,$t1.first_pay,$t1.srv_pay,$t1.status";
|
||||
$rows = $this->auto_finance_model->select_finance($where, 'id desc', $page, $size, $select);
|
||||
$fin_id_arr = array_column($rows,'fin_id');
|
||||
$fin_rows = $this->sys_finance_model->get_map_by_ids($fin_id_arr,'id,title');
|
||||
//$fin_rows = $this->sys_finance_model->get_map_by_ids($fin_id_arr,'id,title');
|
||||
$fin_rows = $this->sys_supplier_model->get_map_by_ids($fin_id_arr,'id,title');
|
||||
foreach($rows as $key=>$val){
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
@@ -94,7 +100,8 @@ class Finance extends HD_Controller{
|
||||
$info['status'] = $row['status'];
|
||||
}
|
||||
$nums = $this->auto_finance_model->get_nums();
|
||||
$finance = $this->sys_finance_model->select(['status'=>1],'id desc',1,20,'id,title');
|
||||
//$finance = $this->sys_finance_model->select(['status'=>1],'id desc',1,20,'id,title');
|
||||
$finance = $this->sys_supplier_model->select(['status'=>1, 'type'=>3],'id desc',0,0,'id,title');
|
||||
!$info['fin_id'] && $info['fin_id'] = $finance[0]['id'];
|
||||
!$info['num'] && $info['num'] = $nums[0];
|
||||
!isset($info['status']) && $info['status'] = 1;
|
||||
@@ -120,8 +127,9 @@ class Finance extends HD_Controller{
|
||||
}
|
||||
$row = $this->auto_finance_model->get(['car_id'=>$info['car_id'],'num'=>$info['num'],'fin_id'=>$info['fin_id']]);
|
||||
if($row){
|
||||
$finance = $this->sys_finance_model->get(['id'=>$info['fin_id']]);
|
||||
return $this->show_json(SYS_CODE_FAIL, "该车已配置:{$finance['title']}金融-{$info['num']}期");
|
||||
//$finance = $this->sys_finance_model->get(['id'=>$info['fin_id']]);
|
||||
$finance = $this->sys_supplier_model->get(['id'=>$info['fin_id']]);
|
||||
return $this->show_json(SYS_CODE_FAIL, "该车已配置:{$finance['title']}-{$info['num']}期");
|
||||
}
|
||||
$adata = [
|
||||
'car_id' => $info['car_id'],
|
||||
@@ -154,8 +162,9 @@ class Finance extends HD_Controller{
|
||||
}
|
||||
$row = $this->auto_finance_model->get(['car_id'=>$info['car_id'],'num'=>$info['num'],'fin_id'=>$info['fin_id'],'id !='=>$info['id']]);
|
||||
if($row){
|
||||
$finance = $this->sys_finance_model->get(['id'=>$info['fin_id']]);
|
||||
return $this->show_json(SYS_CODE_FAIL, "该车已配置:{$finance['title']}金融-{$info['num']}期");
|
||||
//$finance = $this->sys_finance_model->get(['id'=>$info['fin_id']]);
|
||||
$finance = $this->sys_supplier_model->get(['id'=>$info['fin_id']]);
|
||||
return $this->show_json(SYS_CODE_FAIL, "该车已配置:{$finance['title']}-{$info['num']}期");
|
||||
}
|
||||
$adata = [
|
||||
'car_id' => $info['car_id'],
|
||||
|
||||
@@ -35,6 +35,8 @@ class Introduce extends HD_Controller
|
||||
if (strlen($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
|
||||
$where['s_id in (select id from lc_auto_series where status > -1)'] = null;
|
||||
$count = $this->mdAutoIntroduce->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdAutoIntroduce->select($where, "id desc", $params['page'], $params['size']);
|
||||
@@ -151,7 +153,8 @@ class Introduce extends HD_Controller
|
||||
);
|
||||
$showInfo = ['title' => '请选择车型', 'url' => '/auto/introduce/add'];
|
||||
}
|
||||
$showInfo['brandList'] = $this->mdAutoBrand->select(["status<>-1" => null], 'id desc', 0, 0, 'id, name');
|
||||
#$showInfo['brandList'] = $this->mdAutoBrand->select(["status<>-1" => null], 'id desc', 0, 0, 'id, name');
|
||||
$showInfo['brandList'] = $this->mdAutoBrand->map_brand_list($this->mdAutoBrand->map_brand(array('status > -1' => null), false));
|
||||
$this->data['_title'] = $_title;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['showInfo'] = $showInfo;
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Vim
|
||||
* User: lcc
|
||||
* Date: 2023/03/14
|
||||
* Time: 10:19
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Options extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_option_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
!$params['s_id'] && $params['s_id'] = '';
|
||||
!$params['brand_id'] && $params['brand_id'] = '';
|
||||
$page = $this->input->get('page');
|
||||
!$page && $page = 1;
|
||||
$size = 20;
|
||||
$where["status > -1"] = null;
|
||||
$params['title'] && $where["title like '%{$params['title']}%'"] = null;
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
|
||||
$params['brand_id'] && $where['brand_id'] = intval($params['brand_id']);
|
||||
$params['s_id'] && $where['s_id'] = intval($params['s_id']);
|
||||
$count = $this->auto_option_model->count($where);
|
||||
|
||||
$list = [];
|
||||
if($count){
|
||||
$status_arr = $this->auto_option_model->get_status();
|
||||
$rows = $this->auto_option_model->select($where,'id desc',$page,$size);
|
||||
$b_rows = $this->auto_brand_model->get_map_by_ids(array_column($rows,'brand_id'));
|
||||
$s_rows = $this->auto_series_model->get_map_by_ids(array_column($rows,'s_id'));
|
||||
foreach ($rows as $item) {
|
||||
$b_row = $b_rows[$item['brand_id']][0];
|
||||
$s_row = $s_rows[$item['s_id']][0];
|
||||
$list[] = [
|
||||
'id' => $item['id'],
|
||||
'brand_cn' => $b_row['name'],
|
||||
'series_cn' => $s_row['name'],
|
||||
'title' => $item['title'],
|
||||
'price' => $item['price'],
|
||||
'status_name' => $status_arr[$item['status']],
|
||||
'status' => $item['status'],
|
||||
'c_time' => date('Y-m-d H:i:s',$item['c_time'])
|
||||
];
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['_title'] = '选装管理';
|
||||
$this->show_view('auto/options/lists', true);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$info = [
|
||||
'title' => '',
|
||||
'options' => [],
|
||||
'brand_id' => 0,
|
||||
's_id' => 0
|
||||
];
|
||||
if ($id) {
|
||||
$info = $this->auto_option_model->get(array('id' => $id));
|
||||
if (!$info) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$info['brand_id'] = " {$info['brand_id']}";
|
||||
}
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = $id ? '编辑' : '新增';
|
||||
return $this->show_view('auto/options/edit',true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
$post = $this->input->post();
|
||||
if (!$post['title']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标题不能为空');
|
||||
}
|
||||
$add_data = [
|
||||
'title' => $post['title'],
|
||||
'price' => floatval($post['price']),
|
||||
'brand_id' => intval($post['brand_id']),
|
||||
's_id' => intval($post['s_id']),
|
||||
'descrip' => $post['descrip'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$result = $this->auto_option_model->add($add_data);
|
||||
if (!$result) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
|
||||
}
|
||||
$post = $this->input->post();
|
||||
$row = $this->auto_option_model->get(['id' => $post['id']]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在');
|
||||
}
|
||||
if (!$post['title']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标题不能为空');
|
||||
}
|
||||
$update = [
|
||||
'title' => $post['title'],
|
||||
'price' => floatval($post['price']),
|
||||
'descrip' => $post['descrip'],
|
||||
'brand_id' => intval($post['brand_id']),
|
||||
's_id' => intval($post['s_id']),
|
||||
];
|
||||
$result = $this->auto_option_model->update($update, ['id' => $row['id']]);
|
||||
if (!$result) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$stauts = $this->input->post('status');
|
||||
$where = ['id' => $id];
|
||||
$this->auto_option_model->update(['status' => $stauts], $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function json_lists()
|
||||
{
|
||||
$brand_id = $this->input->get('brand_id');
|
||||
$s_id = $this->input->get('s_id');
|
||||
$where = [
|
||||
'status'=>1,
|
||||
'brand_id' => intval($brand_id)
|
||||
];
|
||||
$s_id && $where['s_id'] = $s_id;
|
||||
$lists = [];
|
||||
$rows = $this->auto_option_model->select($where,'','','','id,title,price');
|
||||
if($rows){
|
||||
foreach ($rows as $items) {
|
||||
$lists[] = $items;
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->show_json(SYS_CODE_SUCCESS,'');
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,22 @@ class Series extends HD_Controller{
|
||||
$size = 20;
|
||||
$where["status > -1"] = null;
|
||||
$params['title'] && $where["name like '%{$params['title']}%'"] = null;
|
||||
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
|
||||
if($params['brand_id']){
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
} else {
|
||||
$params['brand_id'] = '';
|
||||
}
|
||||
if (!strlen($params['status'])){
|
||||
$params['status'] = $where['status'] = 1;
|
||||
}
|
||||
elseif ($params['status'] == -9){
|
||||
# pass
|
||||
}
|
||||
else{
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
|
||||
$count = $this->auto_series_model->count($where);
|
||||
$rows = $this->auto_series_model->select($where, 'id desc', $page, $size);
|
||||
$status_arr = $this->auto_series_model->get_status();
|
||||
@@ -38,7 +49,7 @@ class Series extends HD_Controller{
|
||||
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
$map_brand = $this->auto_brand_model->map_brand($where_brand);
|
||||
|
||||
if($rows){
|
||||
foreach($rows as $key=>$val){
|
||||
@@ -53,9 +64,12 @@ class Series extends HD_Controller{
|
||||
];
|
||||
}
|
||||
}
|
||||
$status_arr_list = $status_arr;
|
||||
unset($status_arr_list[-1]);
|
||||
$this->data['status_arr'] = $status_arr_list;
|
||||
$this->data['lists'] = $list;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['_title'] = '车系列表';
|
||||
$this->show_view('auto/series/lists', true);
|
||||
@@ -67,11 +81,22 @@ class Series extends HD_Controller{
|
||||
*/
|
||||
public function json_lists(){
|
||||
$brand_id = $this->input->get_post('brand_id');
|
||||
$status = $this->input->get_post('status');
|
||||
$page = $this->input->get_post('page');
|
||||
$size = $this->input->get_post('size');
|
||||
|
||||
$where = array('status > -1' => null);
|
||||
$brand_id && $where['brand_id'] = $brand_id;
|
||||
if(strlen($status) > 0){
|
||||
if (strpos($status,'>') !== false || strpos($status,'<') !== false || strpos($status,'in') !== false){
|
||||
$where["status {$status}"] = null;
|
||||
}
|
||||
else{
|
||||
$where['status'] = $status;
|
||||
}
|
||||
} else {
|
||||
$where['status > -1'] = null;
|
||||
}
|
||||
$orderby = 'id desc';
|
||||
|
||||
$total = $this->auto_series_model->count($where);
|
||||
@@ -103,7 +128,8 @@ class Series extends HD_Controller{
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
}
|
||||
$brands = $this->auto_brand_model->select([],'','','','id,name');
|
||||
#$brands = $this->auto_brand_model->select([],'','','','id,name');
|
||||
$brands = $this->auto_brand_model->map_brand_list($this->auto_brand_model->map_brand(array('status > -1' => null), false));
|
||||
$this->data['brands'] = $brands;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = $id ? '编辑车系' : '新增车系';
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Fine extends HD_Controller{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_fine_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
$params = $this->input->get();
|
||||
$params['id'] && $_SESSION['srv_biz_id'] = $params['id'];
|
||||
$re_biz = $this->biz_model->get(['id' => $_SESSION['srv_biz_id']]);
|
||||
!strlen($params['status']) && $params['status'] = '';
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$pagesize = 20;
|
||||
$where = [
|
||||
'status>=' => 0,
|
||||
'biz_id' => $_SESSION['srv_biz_id']
|
||||
];
|
||||
strlen($params['status']) && $where['status'] = $params['status'];
|
||||
$params['title'] && $where['title'] = $params['title'];
|
||||
$count = $this->receiver_fine_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->receiver_fine_model->select($where, 'id desc', $page, $pagesize);
|
||||
$biz_ids = array_unique(array_column($rows,'biz_id'));
|
||||
$map_biz = [];
|
||||
if(is_array($biz_ids)){
|
||||
$biz_ids = implode(',',array_filter($biz_ids));
|
||||
$where_biz = ["id in ({$biz_ids})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
}
|
||||
foreach ($rows as $val) {
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'biz_id' => $val['biz_id'],
|
||||
'biz_name' => $map_biz[$val['biz_id']],
|
||||
'title' => $val['title'],
|
||||
'price' => $val['price'],
|
||||
'status_cn' => $this->receiver_fine_model->get_status($val['status']),
|
||||
'c_time' => date('Y-m-d H:i',$val['c_time']),
|
||||
'status' => $val['status'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['_title'] = $re_biz['biz_name'].'-精品配置';
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
$this->show_view('biz/fine/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$biz_id = $_SESSION['srv_biz_id'];
|
||||
$id = $this->input->get('id');
|
||||
if(!$biz_id){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$row = $this->receiver_fine_model->get(['id'=>$id]);
|
||||
$info = [
|
||||
'biz_id' => $biz_id,
|
||||
'title' => '',
|
||||
'price' => '',
|
||||
'action' => 'biz/fine/add',
|
||||
];
|
||||
if($row){
|
||||
$info['id'] = $row['id'];
|
||||
$info['title'] = $row['title'];
|
||||
$info['price'] = $row['price'];
|
||||
$info['action'] = 'biz/fine/edit';
|
||||
}
|
||||
$this->data['info'] = $info;
|
||||
$this->show_view('biz/fine/get');
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
$data = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'title' => $info['title'],
|
||||
'price' => $info['price'],
|
||||
'status' => 1,
|
||||
'c_time' => time(),
|
||||
];
|
||||
$res = $this->receiver_fine_model->add($data);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
$row = $this->receiver_fine_model->get(['id'=>$info['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$data = [
|
||||
'title' => $info['title'],
|
||||
'price' => $info['price'],
|
||||
];
|
||||
$res = $this->receiver_fine_model->update($data,['id'=>$info['id']]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
$field = $this->input->post('field');
|
||||
if ($field === 'ifcheck') {
|
||||
$status = intval($this->input->post('value'));
|
||||
$ids = $this->input->post('id');
|
||||
$ids = explode(',', $ids);
|
||||
if (!$ids || count($ids) < 1) {
|
||||
$this->show_json(0, '请选择要操作的选项');
|
||||
}
|
||||
$ids_str = implode(',', $ids);
|
||||
$where = ["id in({$ids_str})" => null];
|
||||
} else {
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = intval($this->input->post('value'));
|
||||
if (!$id) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$where['id'] = $id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$this->receiver_fine_model->update($data, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function export(){
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Seprice extends HD_Controller
|
||||
{
|
||||
private $employee_price_arr = ['3000.00','4000.00','5000.00'];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model("biz/biz_info_model");
|
||||
$this->load->model('biz/biz_settle_price_model');
|
||||
|
||||
$this->load->model('auto/auto_business_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$size = $params['size'] ? $params['size'] : 50;
|
||||
!strlen($params['status']) && $params['status'] = '';
|
||||
!strlen($params['year']) && $params['year'] = date('Y');
|
||||
!strlen($params['month']) && $params['month'] = '';
|
||||
$biz_row = $this->biz_model->get(['id'=>$params['biz_id']]);
|
||||
if(!$biz_row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
|
||||
$where = [
|
||||
'biz_id' => $biz_row['id'],
|
||||
'status>=' => 0,
|
||||
'year' => date('Y')
|
||||
];
|
||||
strlen($params['status']) && $where['status'] = $params['status'];
|
||||
strlen($params['year']) && $where['year'] = $params['year'];
|
||||
strlen($params['month']) && $where['month'] = $params['month'];
|
||||
$lists = [];
|
||||
$total = $this->biz_settle_price_model->count($where);
|
||||
if($total){
|
||||
$rows = $this->biz_settle_price_model->select($where,'id desc',$page,$size);
|
||||
foreach ($rows as $item) {
|
||||
$temp = [
|
||||
'id' => $item['id'],
|
||||
'money_json' => $this->biz_settle_price_model->get_jsondata($item['money_json']),
|
||||
'show_time' => "{$item['year']}-{$item['month']}",
|
||||
'status' => $item['status'],
|
||||
'status_cn' => $item['status'] ? '正常' : '禁用',
|
||||
'c_time' => date('Y-m-d H:i',$item['c_time'])
|
||||
];
|
||||
$lists[] = $temp;
|
||||
}
|
||||
}
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page,'totle'=>$total);
|
||||
$this->data['_title'] = "{$biz_row['biz_name']}-费用管理";
|
||||
$this->show_view('biz/seprice/lists',true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$params = $this->input->get();
|
||||
$row = $this->biz_settle_price_model->get(['id'=>$params['id']]);
|
||||
$info = [];
|
||||
if($row){
|
||||
$info['id'] = $row['id'];
|
||||
$info['money_json'] = json_decode($row['money_json'],true);
|
||||
$info['year'] = $row['year'];
|
||||
$info['month'] = $row['month'];
|
||||
$info['action'] = '/biz/seprice/edit';
|
||||
$biz_id = $params['biz_id'];
|
||||
}else{
|
||||
$biz_row = $this->biz_model->get(['id'=>$params['biz_id']]);
|
||||
if(!$biz_row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$biz_id = $biz_row['id'];
|
||||
$biz_info_row = $this->biz_info_model->get(['biz_id'=>$biz_id]);
|
||||
$jsondata = json_decode($biz_info_row['jsondata'],true);
|
||||
$info['money_json'] = [
|
||||
'rent' => $biz_info_row['rent'] ? $biz_info_row['rent'] : '',
|
||||
'base_manager' => $biz_info_row['manager_wage'] ? $biz_info_row['manager_wage'] : '',
|
||||
'employee_wage' => $biz_info_row['employee_wage'] ? $biz_info_row['employee_wage'] : '',
|
||||
'wat_ele' => $biz_info_row['wat_ele'] ? $biz_info_row['wat_ele'] : '',
|
||||
'media' => $biz_info_row['margin'] ? $biz_info_row['margin'] : '',
|
||||
'commission' => $biz_info_row['commission'] ? $biz_info_row['commission'] : '',
|
||||
'num' => $biz_info_row['num'],
|
||||
'trucking' => '',
|
||||
'drive' => $jsondata['car_rent'] ? $jsondata['car_rent'] : '',
|
||||
'marketing' => $jsondata['marketing'] ? $jsondata['marketing'] : '',
|
||||
'door_step' => $jsondata['door_step'] ? $jsondata['door_step'] : '',
|
||||
];
|
||||
$info['year'] = date('Y');
|
||||
$info['month'] = intval(date('m'));
|
||||
$info['action'] = '/biz/seprice/add';
|
||||
}
|
||||
$info['biz_id'] = $biz_id;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['employee_price_arr'] = $this->employee_price_arr;
|
||||
$this->show_view('biz/seprice/get');
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
$employee_price_list = $this->input->post('employee_price_list');
|
||||
$biz_row = $this->biz_model->get(['id'=>$info['biz_id']]);
|
||||
if(!$biz_row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$data = [
|
||||
'money_json' => json_encode($info['money_json'],JSON_UNESCAPED_UNICODE),
|
||||
'biz_id' => $info['biz_id'],
|
||||
'year' => $info['year'],
|
||||
'month' => $info['month'],
|
||||
'c_time' => time()
|
||||
];
|
||||
$res = $this->biz_settle_price_model->add($data);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
$row = $this->biz_settle_price_model->get(['id'=>$info['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$data = [
|
||||
'money_json' => json_encode($info['money_json'],JSON_UNESCAPED_UNICODE),
|
||||
'year' => $info['year'],
|
||||
'month' => $info['month'],
|
||||
];
|
||||
$res = $this->biz_settle_price_model->update($data,['id'=>$info['id']]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit_status(){
|
||||
$id = $this->input->post('id');
|
||||
$value = $this->input->post('value');
|
||||
$row = $this->biz_settle_price_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$update = [
|
||||
'status' => $value ? 0 : 1
|
||||
];
|
||||
$res = $this->biz_settle_price_model->update($update,['id'=>$id]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
public function export(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,11 +5,6 @@ require_once COMMPATH.'third_party/PHPExcel.php';
|
||||
class Settle extends HD_Controller
|
||||
{
|
||||
|
||||
private $biz_type = [
|
||||
1 => ['liche' => 0.25 , 'partner' => 0.75],
|
||||
2 => ['liche' => 0.35 , 'partner' => 0.65],
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
@@ -20,12 +15,18 @@ class Settle extends HD_Controller
|
||||
|
||||
$this->load->model('items/items_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_datas_model');
|
||||
$this->load->model('receiver/order/receiver_order_loans_model','order_loans_model');
|
||||
$this->load->model('receiver/receiver_fine_model');
|
||||
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_settle_model');
|
||||
$this->load->model('biz/biz_settle_srv_model');
|
||||
$this->load->model('biz/biz_settle_static_model');
|
||||
$this->load->model('biz/biz_info_model');
|
||||
$this->load->model('biz/biz_trucking_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
$this->load->library('receiver/settle_entity');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -36,7 +37,6 @@ class Settle extends HD_Controller
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
|
||||
$where = array();
|
||||
$t1 = 'lc_biz_settle';
|
||||
$t2 = 'lc_receiver_orders_v2';
|
||||
@@ -86,7 +86,7 @@ class Settle extends HD_Controller
|
||||
$lists = array();
|
||||
if($total){
|
||||
$orderby = "$t1.id desc";
|
||||
$select = "$t1.*,$t2.sid,$t2.name,$t2.mobile,$t2.s_id,$t2.v_id,$t2.brand_id,$t2.cor_id,$t2.item_id";
|
||||
$select = "$t1.*,$t2.sid,$t2.name,$t2.mobile,$t2.s_id,$t2.v_id,$t2.brand_id,$t2.cor_id,$t2.item_id,$t2.money_json as o_money_json,$t2.srv_ids";
|
||||
$rows = $this->biz_settle_model->selectOrders($where, $orderby, $page, $size,0, $select);
|
||||
if($rows){
|
||||
$s_ids = array_unique(array_filter(array_column($rows,'s_id')));
|
||||
@@ -123,34 +123,54 @@ class Settle extends HD_Controller
|
||||
foreach($rows as $v){
|
||||
$title = "{$map_brand[$v['brand_id']]} {$map_sery[$v['s_id']]} {$map_attr[$v['v_id']]} {$map_attr[$v['cor_id']]}";
|
||||
$month = date('Y-m',strtotime("{$v['year']}-{$v['month']}"));
|
||||
$money_json = json_decode($v['money_json'],true);
|
||||
$o_money_json = json_decode($v['o_money_json'],true);
|
||||
$sum_srv = $v['profix_insure']+$v['profix_carno']+$v['profix_loan']+$v['profix_fine'];
|
||||
$srv_json = json_decode($v['srv_ids'],true);
|
||||
$srv_loan = 0;
|
||||
if($v['profix_loan']>0 && $srv_json){
|
||||
foreach ($srv_json as $v2) {
|
||||
if($v2['key']=='price_finance'){
|
||||
$srv_loan = $v2['price'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'o_id' => $v['o_id'],
|
||||
'title' => $title,
|
||||
'biz_name' => $map_biz[$v['biz_id']],
|
||||
'profix_car' => $v['profix_car'],
|
||||
'profix_car_after' => sprintf("%.2f",$v['profix_car']/1.13),
|
||||
'profix_insure' => $v['profix_insure'],
|
||||
'profix_carno' => $v['profix_carno'],
|
||||
'profix_loan' => $v['profix_loan'],
|
||||
'srv_json' => $srv_loan,
|
||||
'profix_fine' => $v['profix_fine'],
|
||||
'sum_srv' => $sum_srv,
|
||||
'sum_srv_after' => $params['_biz_type']==1 ? sprintf("%.2f",$sum_srv/1.13) : sprintf("%.2f",$sum_srv/1.06),
|
||||
'price_trucking' => $v['price_trucking'],
|
||||
'name' => $v['name'],
|
||||
'mobile' => $v['mobile'],
|
||||
'sid' => $v['sid'],
|
||||
'month' => $month,
|
||||
'vin' => $map_item[$v['item_id']]
|
||||
'vin' => $map_item[$v['item_id']],
|
||||
'money_json' => is_array($money_json) ? $money_json : [],
|
||||
'o_money_json' => $o_money_json
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['brandAry'] = $map_brand;
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page,'totle'=>$total);
|
||||
$this->data['_title'] = '商家结算管理';
|
||||
$this->show_view('biz/settle/lists',true);
|
||||
$this->data['_title'] = '门店结算管理';
|
||||
$view = $params['_biz_type']==1 ? 'biz/settle/lists_brand' : 'biz/settle/lists';
|
||||
$this->show_view($view,true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
@@ -178,7 +198,7 @@ class Settle extends HD_Controller
|
||||
$biz_id = $this->input->get('id');
|
||||
$month = $this->input->get('month');
|
||||
$year = date('Y');
|
||||
!$month && $month = intval(date('m'));
|
||||
!$month && $month = intval(date('m',strtotime("-1 month")));;
|
||||
$where = [
|
||||
'biz_id' => $biz_id,
|
||||
'year' => $year,
|
||||
@@ -235,12 +255,15 @@ class Settle extends HD_Controller
|
||||
$all_rows = $this->biz_settle_model->selectOrders($where, $orderby, 0, 0,0, $select);
|
||||
$sheet_data2 = [];
|
||||
if($all_rows){
|
||||
$sheet_data2[] = ['门店','订单信息','品牌车型','车架号','单车利润','保险利润','贷款利润','挂牌利润','拖车费','时间'];
|
||||
$sheet_data2[] = ['门店','订单信息','品牌车型','车架号','单车利润','保险利润','贷款利润','挂牌利润','水平业务合计','拖车费','时间'];
|
||||
$s_ids = array_unique(array_filter(array_column($all_rows,'s_id')));
|
||||
$cor_ids = array_unique(array_filter(array_column($all_rows,'cor_id')));
|
||||
$v_ids = array_unique(array_filter(array_column($all_rows,'v_id')));
|
||||
$attr_ids = array_merge($cor_ids,$v_ids);
|
||||
$item_ids = array_unique(array_filter(array_column($all_rows,'item_id')));
|
||||
//获取品牌map
|
||||
$where_brand = array('status > -1' => null);
|
||||
$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name');
|
||||
//获取车系列表
|
||||
$map_sery = array();
|
||||
if($s_ids){
|
||||
@@ -273,6 +296,7 @@ class Settle extends HD_Controller
|
||||
$v['profix_insure'],
|
||||
$v['profix_loan'],
|
||||
$v['profix_carno'],
|
||||
$v['profix_insure']+$v['profix_loan']+$v['profix_carno'],
|
||||
$v['price_trucking'],
|
||||
$month_str,
|
||||
);
|
||||
@@ -333,8 +357,10 @@ class Settle extends HD_Controller
|
||||
}elseif(!isset($params['month'])){
|
||||
$where['month'] = $params['month'] = intval(date('m',strtotime("-1 month")));
|
||||
}
|
||||
$re_biz = array();
|
||||
if($params['id']){
|
||||
$where['biz_id'] = $params['id'];
|
||||
$re_biz = $this->biz_model->get(array('id' => $params['id']));
|
||||
}
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
@@ -364,6 +390,8 @@ class Settle extends HD_Controller
|
||||
$temp['total_need'] = $v['rent'] + $v['wat_ele'] + $v['manager_wage'] + $v['employee_wage'] + $v['commission'] + $v['price_trucking'];
|
||||
$temp['price_ml'] = $v['price_total'] - $temp['total_need'];
|
||||
$temp['profix_partner'] = $v['profix_partner'] + $v['profix_partner_oflow'];
|
||||
$temp['money_json'] = json_decode($v['money_json'],true);
|
||||
$temp['price_all_after'] = sprintf("%.2f",$v['price_all']/1.13);
|
||||
$lists[] = $temp;
|
||||
}
|
||||
}
|
||||
@@ -374,72 +402,35 @@ class Settle extends HD_Controller
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['type_arr'] = $this->biz_settle_static_model->other_price_type();
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page,'totle'=>$total);
|
||||
$this->data['_title'] = '商家结算管理';
|
||||
$this->show_view('biz/settle/lists_static',true);
|
||||
$this->data['_title'] = $re_biz ? $re_biz['biz_name'].'-结算统计' : '门店结算统计';
|
||||
$view = $params['_biz_type']==1 ? 'biz/settle/lists_static_brand' : 'biz/settle/lists_static';
|
||||
$this->show_view($view,true);
|
||||
|
||||
}
|
||||
|
||||
//重新统计
|
||||
public function edit_static(){
|
||||
$id = $this->input->post('id');
|
||||
$type = $this->input->post('type');
|
||||
$row = $this->biz_settle_static_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$all_other = 0; //共同承担其它费用
|
||||
$liche_other = 0; //狸车承担其它费用
|
||||
$partner_other = 0; //合伙人承担其它费用
|
||||
$price_other = json_decode($row['price_other'],true);
|
||||
if($price_other){
|
||||
foreach($price_other as $item){
|
||||
if($item['type']==2){
|
||||
$partner_other += $item['money'];
|
||||
}elseif($item['type']==1){
|
||||
$liche_other += $item['money'];
|
||||
}else{
|
||||
$all_other += $item['money'];
|
||||
}
|
||||
if($type){ //品牌
|
||||
$res = $this->settle_entity->brand_static($row['id']);
|
||||
if($res['code']){
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
}else{ //合伙人
|
||||
$res = $this->settle_entity->re_static($row['id']);
|
||||
if($res['code']){
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败');
|
||||
}
|
||||
}
|
||||
$car_total = $this->biz_settle_model->count(['stic_id'=>$row['id']]);
|
||||
$biz_info = $this->biz_info_model->get(['biz_id'=>$row['biz_id']]);
|
||||
$type_config = $this->biz_type[$biz_info['type']];
|
||||
$update = [
|
||||
'rent' => $biz_info['rent'],
|
||||
'wat_ele' => $biz_info['wat_ele'],
|
||||
'manager_wage' => $biz_info['manager_wage'],
|
||||
'commission' => $biz_info['commission']*$car_total,
|
||||
];
|
||||
$employee_wage = $biz_info['num'] ? ceil($car_total/$biz_info['num']) : 0;
|
||||
$update['employee_wage'] = $employee_wage;
|
||||
|
||||
$settle_rows = $this->biz_settle_model->select(['stic_id'=>$row['id']],'id asc',0,0,'id,o_id');
|
||||
if(is_array($settle_rows)){
|
||||
$o_id_str = implode(',',array_column($settle_rows,'o_id'));
|
||||
$order_rows = [];
|
||||
if($o_id_str){
|
||||
$where = [
|
||||
"id in ($o_id_str)" => null
|
||||
];
|
||||
$order_rows = $this->receiver_orders_v2_model->map('id','brand_id',$where,0,0,'id,brand_id');
|
||||
}
|
||||
foreach($settle_rows as $val){
|
||||
$auto_b_id = $order_rows[$val['o_id']] ? $order_rows[$val['o_id']] : 0;
|
||||
$truck_row = $this->biz_trucking_model->get(['biz_id'=>$row['biz_id'],'auto_b_id'=>$auto_b_id,'status'=>1]);
|
||||
$price = $truck_row ? $truck_row['money'] : 0;
|
||||
$this->biz_settle_model->update(['price_trucking'=>$price],['id'=>$val['id']]);
|
||||
}
|
||||
}
|
||||
$truck_sum = $this->biz_settle_model->sum('price_trucking',['stic_id' => $row['id']]);
|
||||
$update['price_trucking'] = $truck_sum['price_trucking'];
|
||||
|
||||
$price_need = $update['rent'] + $update['wat_ele'] + $update['employee_wage'] + $update['manager_wage'] + $update['commission'] + $update['price_trucking'];
|
||||
$price_ml = $row['price_total'] - $price_need - $all_other;
|
||||
$update['profix_liche'] = $price_ml*$type_config['liche']-$liche_other;
|
||||
$update['profix_partner'] = $price_ml*$type_config['partner']-$partner_other;
|
||||
$this->biz_settle_static_model->update($update,['id'=>$row['id']]);
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function add_price(){
|
||||
@@ -473,4 +464,251 @@ class Settle extends HD_Controller
|
||||
$this->data['type_arr'] = $this->biz_settle_static_model->other_price_type();
|
||||
$this->show_view('biz/settle/add');
|
||||
}
|
||||
|
||||
//更新品牌结算
|
||||
public function edit_js(){
|
||||
$params = $this->input->post();
|
||||
$where = [
|
||||
'biz_id' => $params['biz_id'],
|
||||
'year' => $params['year'],
|
||||
'month' => $params['month']
|
||||
];
|
||||
$rows = $this->biz_settle_model->select($where,'id desc');
|
||||
if($rows){
|
||||
$order_ids = implode(',',array_column($rows,'o_id'));
|
||||
$order_rows = [];
|
||||
if($order_ids){
|
||||
$o_where = [
|
||||
"id in ({$order_ids})" => null
|
||||
];
|
||||
$order_rows = $this->receiver_orders_v2_model->map('id','',$o_where,'','','');
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$order = $order_rows[$val['o_id']][0];
|
||||
if(!$order){
|
||||
continue;
|
||||
}
|
||||
$info_json = json_decode($order['info_json'],true);
|
||||
$money_json = json_decode($order['money_json'],true);
|
||||
$bill_time_month = date('Y-m-d',strtotime($order['bill_time']));
|
||||
$settle_money_json = [];
|
||||
$settle_money_json['in'] = [ //收入
|
||||
'profix_car' => 0, //整车
|
||||
'srv_price' => $this->orders_v2_entity->order_srv_money($order['id']), //服务费
|
||||
'commission' => 0, //佣金
|
||||
];
|
||||
$settle_money_json['out'] = [ //成本
|
||||
'apply_price' => 0, //申请成本
|
||||
'fine_price' => 0, //赠送精品成本
|
||||
];
|
||||
//获取创建订单时商务政策
|
||||
$where = [
|
||||
'id' => $info_json['business_id'],
|
||||
];
|
||||
$b_row_one = $this->auto_business_model->get($where);
|
||||
$settle_money_json['in']['profix_car'] = $b_row_one['profix_car'] ? $b_row_one['profix_car']-$money_json['price_discount'] : 0;
|
||||
//挂牌利润 = 实收 - 成本
|
||||
$profix_carno = 0;
|
||||
if($money_json['fee_carno']>0){
|
||||
$where = [
|
||||
'biz_id' => $order['biz_id'],
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
's_effect_time>=' => date('Y-m-01',strtotime($order['bill_time'])),
|
||||
's_effect_time<=' => date('Y-m-t',strtotime($order['bill_time'])),
|
||||
];
|
||||
$free_row = $this->biz_settle_srv_model->get($where);
|
||||
if(!$free_row){
|
||||
$free_row = $this->biz_settle_srv_model->get(['biz_id'=>$order['biz_id'],'is_def'=>1,'status'=>1,'type'=>1]);
|
||||
}
|
||||
$free_jsondata = json_decode($free_row['jsondata'],true);
|
||||
$cb_fee_carno = $free_jsondata['price'] ? $free_jsondata['price'] : 0;
|
||||
$profix_carno = $money_json['fee_carno'] - $cb_fee_carno;
|
||||
}
|
||||
//保险利润 = 金额(是否含税) * 返点百分比(保险类型):保险生效日
|
||||
$data_row = $this->receiver_order_datas_model->get(['o_id'=>$order['id']]);
|
||||
$insurance_img = json_decode($data_row['insurance_img'],true);
|
||||
$business_img = json_decode($data_row['business_img'],true);
|
||||
$profix_insuer_ins = 0;
|
||||
if($insurance_img){
|
||||
//强险
|
||||
$time = strtotime($insurance_img['date']);
|
||||
$where = [
|
||||
'biz_id' => $order['biz_id'],
|
||||
'title' => $insurance_img['product'],
|
||||
'type' => 2,
|
||||
"json_extract(jsondata, '$.type') = '2'" => null,
|
||||
"json_extract(jsondata, '$.s_time') >= '{$time}'" => null,
|
||||
"json_extract(jsondata, '$.e_time') <= '{$time}'" => null
|
||||
];
|
||||
$fd_row = $this->biz_settle_srv_model->get($where);
|
||||
if(!$fd_row){
|
||||
$where = [
|
||||
'biz_id' => $order['biz_id'],
|
||||
'title' => $insurance_img['product'],
|
||||
'type' => 2,
|
||||
'is_def' => 1,
|
||||
"json_extract(jsondata, '$.type') = '2'" => null,
|
||||
];
|
||||
$fd_row = $this->biz_settle_srv_model->get($where);
|
||||
}
|
||||
$fd_jsondata = json_decode($fd_row['jsondata'],true);
|
||||
$qx_fd = $fd_jsondata['rebate']/100;
|
||||
$profix_insuer_ins = floatval($insurance_img['price']) * $qx_fd;
|
||||
}
|
||||
$profix_insuer_bis = 0;
|
||||
if($business_img){
|
||||
//商业险
|
||||
$time = strtotime($business_img['date']);
|
||||
$where = [
|
||||
'biz_id' => $order['biz_id'],
|
||||
'title' => $business_img['product'],
|
||||
'type' => 2,
|
||||
"json_extract(jsondata, '$.type') = '1'" => null,
|
||||
"json_extract(jsondata, '$.s_time') >= '{$time}'" => null,
|
||||
"json_extract(jsondata, '$.e_time') <= '{$time}'" => null
|
||||
];
|
||||
$bis_fd_row = $this->biz_settle_srv_model->get($where);
|
||||
if(!$bis_fd_row){
|
||||
$where = [
|
||||
'biz_id' => $order['biz_id'],
|
||||
'title' => $business_img['product'],
|
||||
'type' => 2,
|
||||
'is_def' => 1,
|
||||
"json_extract(jsondata, '$.type') = '1'" => null,
|
||||
];
|
||||
$bis_fd_row = $this->biz_settle_srv_model->get($where);
|
||||
}
|
||||
$bis_fd_jsondata = json_decode($bis_fd_row['jsondata'],true);
|
||||
$bis_fd = $bis_fd_jsondata['rebate']/100;
|
||||
$profix_insuer_bis = floatval($business_img['price'])*$bis_fd;
|
||||
}
|
||||
$profix_insuer = $profix_insuer_ins + $profix_insuer_bis;
|
||||
//贷款利润 = 手续费 + 贷款金额 * 返点(对应产品)
|
||||
// $profix_loan = floatval($money_json['price_finance']);
|
||||
//贷款佣金 = 贷款金额 * 返点(对应产品)
|
||||
$profix_loan = 0;
|
||||
if($money_json['price_loan']>=0){
|
||||
$loan_row = $this->order_loans_model->get(['o_id'=>$order['id']]);
|
||||
$finance_id = $order['finance_id'];
|
||||
$finance_num = $loan_row['num'] ? $loan_row['num'] : 0;
|
||||
$where = [
|
||||
'biz_id' => $order['biz_id'],
|
||||
'type' => 3,
|
||||
's_effect_time' => $bill_time_month,
|
||||
"json_extract(jsondata, '$.finance_id') = '{$finance_id}'" => null,
|
||||
"json_extract(jsondata, '$.finance_num') = '{$finance_num}'" => null,
|
||||
];
|
||||
$fd_row = $this->biz_settle_srv_model->get($where);
|
||||
if(!$fd_row){
|
||||
$fd_row = $this->biz_settle_srv_model->get(['biz_id'=>$order['biz_id'],'is_def'=>1,'status'=>1,'type'=>3]);
|
||||
}
|
||||
$fd_jsondata = json_decode($fd_row['jsondata'],true);
|
||||
$loan_fd = $fd_jsondata['rebate'] ? $fd_jsondata['rebate']/100:0;
|
||||
$profix_loan = $money_json['price_loan']*$loan_fd;
|
||||
//获取贷款手续费
|
||||
$srv_loan = 0;
|
||||
$srv_json = json_decode($order['srv_ids'],true);
|
||||
if($srv_json){
|
||||
foreach ($srv_json as $v2) {
|
||||
if($v2['key']=='price_finance'){
|
||||
$srv_loan = $v2['price'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$profix_loan += $srv_loan;
|
||||
}
|
||||
$settle_money_json['profix_insuer_ins'] = $profix_insuer_ins;
|
||||
$settle_money_json['profix_insuer_bis'] = $profix_insuer_bis;
|
||||
$settle_money_json['in']['commission'] = $profix_loan+$profix_insuer;
|
||||
//精品成本(赠送的也要算)
|
||||
$profix_fine = 0;
|
||||
$fines = json_decode($order['fines'],true);
|
||||
$fines_ids = array_column($fines,'id');
|
||||
if($fines){
|
||||
$fines_ids = implode(',',$fines_ids);
|
||||
$where = [
|
||||
"id in ({$fines_ids})" => null
|
||||
];
|
||||
$fines_ids && $cb_sum = $this->receiver_fine_model->sum('price',$where);
|
||||
$cb = $cb_sum['price'] ? $cb_sum['price'] : 0; //成本
|
||||
$profix_fine = $cb;
|
||||
}
|
||||
$settle_money_json['out']['biz_price'] = $profix_fine;
|
||||
$add_data = [
|
||||
'profix_car' => $settle_money_json['in']['profix_car'],
|
||||
'profix_insure' => $profix_insuer,
|
||||
'profix_loan' => $profix_loan,
|
||||
'profix_carno' => $profix_carno,
|
||||
'profix_fine' => $money_json['price_fine_select'] - $profix_fine,
|
||||
'money_json' => json_encode($settle_money_json,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
if($money_json['price_car']>$b_row_one['price_floor']){
|
||||
$add_data['oflow_profix_car'] = $money_json['price_car'] - $b_row_one['price_floor'];
|
||||
}
|
||||
$this->biz_settle_model->update($add_data,['id'=>$val['id']]);
|
||||
}
|
||||
$this->settle_entity->brand_static('',$params['biz_id'],$params['year'],$params['month']);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '更新完成!');
|
||||
}
|
||||
//更新合伙结算列表
|
||||
public function edit_settle(){
|
||||
$params = $this->input->post();
|
||||
$where = [
|
||||
'biz_id' => $params['biz_id'],
|
||||
'year' => $params['year'],
|
||||
'month' => $params['month']
|
||||
];
|
||||
$rows = $this->biz_settle_model->select($where,'id desc');
|
||||
if($rows){
|
||||
$order_ids = implode(',',array_column($rows,'o_id'));
|
||||
$order_rows = [];
|
||||
if($order_ids){
|
||||
$o_where = [
|
||||
"id in ({$order_ids})" => null
|
||||
];
|
||||
$order_rows = $this->receiver_orders_v2_model->map('id','',$o_where,'','','');
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$order = $order_rows[$val['o_id']][0];
|
||||
if(!$order){
|
||||
continue;
|
||||
}
|
||||
$info_json = json_decode($order['info_json'],true);
|
||||
$money_json = json_decode($order['money_json'],true);
|
||||
//获取创建订单时商务政策
|
||||
$where = [
|
||||
'id' => $info_json['business_id'],
|
||||
];
|
||||
$b_row_one = $this->auto_business_model->get($where);
|
||||
//获取开票日期商务政策
|
||||
$b_where = [
|
||||
'city_id' => $order['city_id'],
|
||||
'brand_id' => $order['brand_id'],
|
||||
's_id' => $order['s_id'],
|
||||
'v_id' => $order['v_id'],
|
||||
'if_effect' => 1,
|
||||
];
|
||||
$b_row_two = $this->auto_business_model->select($b_where,'id desc',1,1);
|
||||
$b_row_two = $b_row_two[0];
|
||||
$truck_row = $this->biz_trucking_model->get(['auto_b_id'=>$order['brand_id'],'biz_id'=>$order['biz_id'],'status'=>1]);
|
||||
$price_trucking = $truck_row['money'] ? $truck_row['money'] : 0;
|
||||
$add_data = [
|
||||
'profix_car' => $b_row_one['profix_car'] ? $b_row_one['profix_car'] : 0,
|
||||
'profix_insure' => $b_row_two['profix_insure'] ? $b_row_two['profix_insure'] : 0,
|
||||
'profix_loan' => $b_row_two['profix_loan'] ? $b_row_two['profix_loan'] : 0,
|
||||
'profix_carno' => $b_row_two['profix_carno'] ? $b_row_two['profix_carno'] : 0,
|
||||
'price_trucking' => $price_trucking,
|
||||
];
|
||||
if($money_json['price_car']>$b_row_one['price_floor']){
|
||||
$add_data['oflow_profix_car'] = $money_json['price_car'] - $b_row_one['price_floor'];
|
||||
}
|
||||
$this->biz_settle_model->update($add_data,['id'=>$val['id']]);
|
||||
}
|
||||
$this->settle_entity->re_static('',$params['biz_id'],$params['year'],$params['month']);
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '更新完成!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:店铺概况
|
||||
* Notes:门店概况
|
||||
* Created on: 2022/1/7 14:52
|
||||
* Created by: dengbw
|
||||
*/
|
||||
@@ -40,14 +40,15 @@ class Situation extends HD_Controller
|
||||
public function get()
|
||||
{
|
||||
$biz_id = $this->input->get('id');
|
||||
$re_biz = $this->mdBiz->get(['id' => $biz_id, 'status' => 1]);
|
||||
$re_biz = $this->mdBiz->get(['id' => $biz_id]);
|
||||
if (!$re_biz || empty($re_biz)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
|
||||
}
|
||||
$base_info = [];
|
||||
//店铺概况
|
||||
//门店概况
|
||||
$re_base = $this->mdBizBase->get(['biz_id' => $biz_id]);
|
||||
$fields = $this->mdBizBase->get_fields();
|
||||
unset($fields['company']); # 230220close
|
||||
foreach ($fields as $key => $value) {
|
||||
$list = '';
|
||||
if ($key == 'county_id' && $re_biz['county_id']) {//县区
|
||||
@@ -98,7 +99,7 @@ class Situation extends HD_Controller
|
||||
}
|
||||
$showInfo['y_month_ary'] = $y_month_ary;
|
||||
$this->data['showInfo'] = $showInfo;
|
||||
$this->data['_title'] = $re_biz['biz_name'];
|
||||
$this->data['_title'] = $re_biz['biz_name']."-概况";
|
||||
return $this->show_view('biz/situation/get', true);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Srv extends HD_Controller{
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('auto/auto_business_model');
|
||||
$this->load->model('auto/auto_finance_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
$this->load->model('biz/biz_settle_srv_model');
|
||||
//$this->load->model('sys/sys_finance_model');
|
||||
$this->load->model('sys/sys_supplier_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
$params = $this->input->get();
|
||||
$params['id'] && $_SESSION['srv_biz_id'] = $params['id'];
|
||||
$re_biz = $this->biz_model->get(['id' => $_SESSION['srv_biz_id']]);
|
||||
!$params['insure_type'] && $params['insure_type'] = '';
|
||||
!$params['type'] && $params['type'] = '';
|
||||
!$params['title'] && $params['title'] = '';
|
||||
!strlen($params['status']) && $params['status'] = '';
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$pagesize = 20;
|
||||
$where = [
|
||||
'status>=' => 0,
|
||||
'biz_id' => $_SESSION['srv_biz_id']
|
||||
];
|
||||
strlen($params['status']) && $where['status'] = $params['status'];
|
||||
$params['insure_type'] && $where["json_extract(jsondata, '$.type') = '{$params['insure_type']}'"] = null;
|
||||
$params['type'] && $where['type'] = $params['type'];
|
||||
$params['title'] && $where['title'] = $params['title'];
|
||||
$count = $this->biz_settle_srv_model->count($where);
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->biz_settle_srv_model->select($where, 'status desc, title, is_def desc, id desc', $page, $pagesize);
|
||||
$biz_ids = array_unique(array_column($rows,'biz_id'));
|
||||
$map_biz = [];
|
||||
if(is_array($biz_ids)){
|
||||
$biz_ids = implode(',',array_filter($biz_ids));
|
||||
$where_biz = ["id in ({$biz_ids})" => null];
|
||||
$map_biz = $this->biz_model->map('id', 'biz_name', $where_biz, '', 0, 0, 'id,biz_name');
|
||||
}
|
||||
foreach ($rows as $val) {
|
||||
$other_data = $this->biz_settle_srv_model->get_jsondata($val['type'],$val['jsondata']);
|
||||
$s_effect_time = $val['s_effect_time'] == '0000-00-00' ? '长期' : $val['s_effect_time'];
|
||||
$s_effect_time = $other_data['时间区间'] ? $other_data['时间区间'] : $s_effect_time;
|
||||
unset($other_data['时间区间']);
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'biz_id' => $val['biz_id'],
|
||||
'biz_name' => $map_biz[$val['biz_id']],
|
||||
'title' => $val['title'],
|
||||
'other_data' => $other_data,
|
||||
's_effect_time' => $s_effect_time,
|
||||
'is_def' => $val['is_def'] ? '是':'否',
|
||||
'type_cn' => $this->biz_settle_srv_model->get_type($val['type']),
|
||||
'status_cn' => $this->biz_settle_srv_model->get_status($val['status']),
|
||||
'c_time' => date('Y-m-d H:i',$val['c_time']),
|
||||
'status' => $val['status'],
|
||||
];
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['typeAry'] = $this->biz_settle_srv_model->get_type();
|
||||
$this->data['insure_typeAry'] = $this->biz_settle_srv_model->get_insure_type();
|
||||
$this->data['_title'] = $re_biz['biz_name'].'-水平业务配置';
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
$this->show_view('biz/srv/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$biz_id = $_SESSION['srv_biz_id'];
|
||||
$id = $this->input->get('id');
|
||||
$type = $this->input->get('type');
|
||||
!$type && $type = 1;
|
||||
if(!$biz_id){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误,请刷新列表再重新操作');
|
||||
}
|
||||
$row = $this->biz_settle_srv_model->get(['id'=>$id]);
|
||||
$row && $type = $row['type'];
|
||||
$supplier = $this->sys_supplier_model->select(['status' => 1, 'type' => $type], '', 0, 0, 'id,title');
|
||||
//$finances_num = $this->sys_finance_model->get_nums();
|
||||
$finances_num = $this->auto_finance_model->get_nums();
|
||||
$info = [
|
||||
'biz_id' => $biz_id,
|
||||
'type' => $type,
|
||||
'is_def' => 0,
|
||||
's_effect_time' => date('Y-m-d') ,
|
||||
'action' => 'biz/srv/add',
|
||||
'is_tiexi' => 0,
|
||||
'step' => 1, # 1仅用于新增时默认第一步,2为第二步
|
||||
'jsondata' => ['price'=>300,'type'=>1, 'supplier_id'=>$supplier[0] ? $supplier[0]['id'] : 0,'finance_num'=>$finances_num ? $finances_num[0]: null]
|
||||
];
|
||||
$view = 'biz/srv/get';
|
||||
if($row){
|
||||
$info['title'] = $row['title'];
|
||||
$info['id'] = $row['id'];
|
||||
$info['type'] = $row['type'];
|
||||
$info['is_def'] = $row['is_def'];
|
||||
$info['s_effect_time'] = $row['s_effect_time'];
|
||||
$info['action'] = 'biz/srv/edit';
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$jsondata['s_time'] && $jsondata['s_time'] = date('Y-m-d H:i:s',$jsondata['s_time']);
|
||||
$jsondata['e_time'] && $jsondata['e_time'] = date('Y-m-d H:i:s',$jsondata['e_time']);
|
||||
$info['is_tiexi'] = $row['type'] == 3 && floatval($jsondata['rebate']) > 0 ? 0 : 1;
|
||||
$jsondata['supplier_id'] = $jsondata['supplier_id'] ? intval($jsondata['supplier_id']) : 0;
|
||||
$info['jsondata'] = $jsondata;
|
||||
$view = 'biz/srv/edit';
|
||||
}
|
||||
$this->data['yearAry'] = $this->auto_business_model->year();
|
||||
$this->data['monthAry'] = $this->auto_business_model->month();
|
||||
$this->data['finances_num'] = $finances_num;
|
||||
$this->data['supplier'] = $supplier;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['typeAry'] = $this->biz_settle_srv_model->get_type();
|
||||
$this->data['insure_typeAry'] = $this->biz_settle_srv_model->get_insure_type();
|
||||
$this->show_view($view);
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
if (!$info['jsondata']['supplier_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误,请先配置供应商');
|
||||
}
|
||||
if ($info['type'] == 2 && !$info['is_def'] && (!$info['s_time'] || !$info['e_time'])){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误,请填写时间区间');
|
||||
}
|
||||
$data = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'c_time' => time(),
|
||||
'type' => $info['type'],
|
||||
'is_def' => $info['is_def'] ? 1 : 0,
|
||||
];
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = date('Y-m-d',strtotime($info['s_effect_time']));
|
||||
$info['type'] == 3 && $info['is_def'] && $data['s_effect_time'] = '';
|
||||
$jsondata = [];
|
||||
$jsondata['supplier_id'] = $info['jsondata']['supplier_id'];
|
||||
$supplier = $this->sys_supplier_model->get(['id'=>intval($jsondata['supplier_id'])],'title');
|
||||
$jsondata['supplier_title'] = $supplier['title'];
|
||||
$data['title'] = $jsondata['supplier_title'];
|
||||
|
||||
if($info['type']==1){
|
||||
$jsondata['price'] = floatval($info['jsondata']['price']);
|
||||
}elseif($info['type']==2){
|
||||
if ($info['is_def'] == 1){
|
||||
unset($jsondata['s_time']);
|
||||
unset($jsondata['e_time']);
|
||||
}
|
||||
else{
|
||||
$info['s_time'] && $jsondata['s_time'] = strtotime($info['s_time']);
|
||||
$info['e_time'] && $jsondata['e_time'] = strtotime($info['e_time']);
|
||||
}
|
||||
$jsondata['rebate'] = floatval($info['jsondata']['rebate']);
|
||||
$jsondata['type'] = $info['jsondata']['type'];
|
||||
}else{
|
||||
$jsondata['rebate'] = $info['is_tiexi'] ? 0 : floatval($info['jsondata']['rebate']);
|
||||
$jsondata['finance_num'] = $info['jsondata']['finance_num'];
|
||||
}
|
||||
//只能有一条默认
|
||||
if($info['is_def']){
|
||||
$where = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'title' => $data['title'],
|
||||
'type' => $info['type'],
|
||||
'status' => 1,
|
||||
'is_def' => 1
|
||||
];
|
||||
$update = ['is_def'=>0];
|
||||
if($info['type']==2){
|
||||
$where["json_extract(jsondata, '$.type') = '{$info['jsondata']['type']}'"] = null;
|
||||
$update['status'] = 0;
|
||||
}
|
||||
if($info['type']==3){
|
||||
$where["json_extract(jsondata, '$.finance_num') = '{$info['jsondata']['finance_num']}'"] = null;
|
||||
}
|
||||
|
||||
$this->biz_settle_srv_model->update($update,$where);
|
||||
}
|
||||
$data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$res = $this->biz_settle_srv_model->add($data);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
$row = $this->biz_settle_srv_model->get(['id'=>$info['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误,请刷新列表再重新操作');
|
||||
}
|
||||
if (!$info['jsondata']['supplier_id']){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误,请先配置供应商');
|
||||
}
|
||||
if ($info['type'] == 2 && !$info['is_def'] && (!$info['s_time'] || !$info['e_time'])){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误,请填写时间区间');
|
||||
}
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$data = [
|
||||
'type' => $info['type'],
|
||||
'is_def' => $info['is_def'] ? 1 : 0,
|
||||
];
|
||||
$info['s_effect_time'] && $data['s_effect_time'] = date('Y-m-d',strtotime($info['s_effect_time']));
|
||||
$info['type'] == 3 && $info['is_def'] && $data['s_effect_time'] = '';
|
||||
$jsondata['supplier_id'] = $info['jsondata']['supplier_id'];
|
||||
$supplier = $this->sys_supplier_model->get(['id'=>intval($jsondata['supplier_id'])],'title');
|
||||
$jsondata['supplier_title'] = $supplier['title'];
|
||||
$data['title'] = $jsondata['supplier_title'];
|
||||
|
||||
if($info['type']==1){
|
||||
$jsondata['price'] = floatval($info['jsondata']['price']);
|
||||
|
||||
}elseif($info['type']==2){
|
||||
if ($info['is_def'] == 1){
|
||||
unset($jsondata['s_time']);
|
||||
unset($jsondata['e_time']);
|
||||
}
|
||||
else{
|
||||
$info['s_time'] && $jsondata['s_time'] = strtotime($info['s_time']);
|
||||
$info['e_time'] && $jsondata['e_time'] = strtotime($info['e_time']);
|
||||
}
|
||||
$jsondata['rebate'] = floatval($info['jsondata']['rebate']);
|
||||
$jsondata['type'] = $info['jsondata']['type'];
|
||||
}else{
|
||||
$jsondata['rebate'] = $info['is_tiexi'] ? 0 : floatval($info['jsondata']['rebate']);
|
||||
$jsondata['finance_num'] = $info['jsondata']['finance_num'];
|
||||
}
|
||||
//只能有一条默认
|
||||
if($info['is_def'] && $row['status'] == 1){
|
||||
$where = [
|
||||
'biz_id' => $info['biz_id'],
|
||||
'title' => $data['title'],
|
||||
'type' => $info['type'],
|
||||
'status' => 1,
|
||||
'is_def' => 1,
|
||||
"id != {$info['id']}" => null,
|
||||
];
|
||||
$update = ['is_def'=>0];
|
||||
if($info['type']==2){
|
||||
$where["json_extract(jsondata, '$.type') = '{$info['jsondata']['type']}'"] = null;
|
||||
$update['status'] = 0;
|
||||
}
|
||||
if($info['type']==3){
|
||||
$where["json_extract(jsondata, '$.finance_num') = '{$info['jsondata']['finance_num']}'"] = null;
|
||||
}
|
||||
$this->biz_settle_srv_model->update($update,$where);
|
||||
}
|
||||
$data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$res = $this->biz_settle_srv_model->update($data,['id'=>$info['id']]);
|
||||
if($res){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
$field = $this->input->post('field');
|
||||
if ($field === 'ifcheck') {
|
||||
$status = intval($this->input->post('value'));
|
||||
$ids = $this->input->post('id');
|
||||
$ids = explode(',', $ids);
|
||||
if (!$ids || count($ids) < 1) {
|
||||
$this->show_json(0, '请选择要操作的选项');
|
||||
}
|
||||
$ids_str = implode(',', $ids);
|
||||
$where = ["id in({$ids_str})" => null];
|
||||
} else {
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = intval($this->input->post('value'));
|
||||
if (!$id) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$where['id'] = $id;
|
||||
|
||||
# 参考edit处理:修改状态为正常 + 当前数据为默认
|
||||
if ($status == 1){
|
||||
$row = $this->biz_settle_srv_model->get(['id'=>$id]);
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
if($row['is_def']){
|
||||
$where_u = [
|
||||
'biz_id' => $row['biz_id'],
|
||||
'title' => $row['title'],
|
||||
'type' => $row['type'],
|
||||
'status' => 1,
|
||||
'is_def' => 1,
|
||||
"id != {$id}" => null,
|
||||
];
|
||||
$update = ['is_def'=>0];
|
||||
if($row['type']==2){
|
||||
$where["json_extract(jsondata, '$.type') = '{$jsondata['type']}'"] = null;
|
||||
$update['status'] = 0;
|
||||
}
|
||||
if($row['type']==3){
|
||||
$where["json_extract(jsondata, '$.finance_num') = '{$jsondata['finance_num']}'"] = null;
|
||||
}
|
||||
$this->biz_settle_srv_model->update($update,$where_u);
|
||||
}
|
||||
if ($row['type']==2 && !$row['is_def'] && (!$jsondata['s_time'] || !$jsondata['e_time'])){
|
||||
return $this->show_json(SYS_CODE_FAIL,'请先修改,填写时间区间后,再操作');
|
||||
}
|
||||
}
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$this->biz_settle_srv_model->update($data, $where);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function export(){
|
||||
}
|
||||
|
||||
public function get_title(){
|
||||
$biz_id = intval($_SESSION['srv_biz_id']);
|
||||
$type = $this->input->get('type');
|
||||
!$type && $type=1;
|
||||
$where = [
|
||||
'type' => $type,
|
||||
'biz_id' => $biz_id,
|
||||
'status' => 1
|
||||
];
|
||||
$rows = $this->biz_settle_srv_model->select_groupby('title', $where, 'is_def desc, id desc', 0, 0, 'id,title');
|
||||
$this->data['lists'] = $rows;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ class Store extends HD_Controller
|
||||
$this->load->model("biz/biz_trucking_model");
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_brand_biz_model');
|
||||
|
||||
$this->load->model("biz/biz_brand_model", 'bizBrand');
|
||||
$this->load->model('area_model');
|
||||
@@ -65,13 +66,17 @@ class Store extends HD_Controller
|
||||
if ($city_id) {
|
||||
$this->data['countys'] = $this->area_model->select(array('city_id' => $city_id));
|
||||
}
|
||||
if (isset($status_arr[$status])) {
|
||||
if (isset($status)) {
|
||||
$this->data['status'] = $status;
|
||||
$where['status'] = $status_arr[$status];
|
||||
if(strlen($status_arr[$status])){
|
||||
$where['status'] = $status_arr[$status];
|
||||
}else{
|
||||
$where['status > -1'] = null;
|
||||
}
|
||||
} else {
|
||||
$where['status > -1'] = null;
|
||||
$this->data['status'] = 'on';
|
||||
$where['status'] = 1;
|
||||
}
|
||||
|
||||
$company_id && $where['company_id'] = $company_id;
|
||||
|
||||
!$page && $page = 1;
|
||||
@@ -99,13 +104,17 @@ class Store extends HD_Controller
|
||||
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
$c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
}
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$type_ids && $where["type in ($type_ids)"] = null;
|
||||
|
||||
$biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize);
|
||||
$count = $this->biz_model->count($where);
|
||||
$bizlists = [];
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
foreach ($biz_lists as $v) {
|
||||
$brand = $this->bizBrand->get(array('id' => $v['brand_id']), 'brand_name');
|
||||
$v['brand_name'] = $brand['brand_name'];
|
||||
# 230220close
|
||||
/*$brand = $this->bizBrand->get(array('id' => $v['brand_id']), 'brand_name');
|
||||
$v['brand_name'] = $brand['brand_name'];*/
|
||||
$v['c_time'] = date('Y-m-d H:i:s', $v['c_time']);
|
||||
$v['type_name'] = $typeAry[$v['type']];
|
||||
$v['type'] = $v['type'];
|
||||
@@ -120,13 +129,14 @@ class Store extends HD_Controller
|
||||
$map_company = $this->company_model->map('id', 'short', $where, $orderby, 0, 0, $select);
|
||||
|
||||
//获取品牌
|
||||
$lists = $this->bizBrand->select(array('status' => 1), '', '', '', 'brand_name,id');
|
||||
$data = array();
|
||||
# 230220close
|
||||
/*$lists = $this->bizBrand->select(array('status' => 1), '', '', '', 'brand_name,id');
|
||||
if ($lists) {
|
||||
foreach ($lists as $value) {
|
||||
$data[] = array('name' => $value['brand_name'], 'id' => $value['id']);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$qdjl_lists = [];
|
||||
$res_u = $this->mdLichebUsers->select(array('group_id' => 4, 'status' => 1), 'id desc', 0, 0, 'id,uname as name,city_id');
|
||||
if ($res_u) {
|
||||
@@ -156,20 +166,22 @@ class Store extends HD_Controller
|
||||
$id = intval($this->input->get('id'));
|
||||
$this->data['provinces'] = $this->area_model->select(array(), '', 0, 0, 'distinct(province_id), province_name');
|
||||
//获取品牌
|
||||
$lists = $this->bizBrand->select(array('status' => 1), '', '', '', 'brand_name,id');
|
||||
$data = array();
|
||||
# 230220close
|
||||
/*$lists = $this->bizBrand->select(array('status' => 1), '', '', '', 'brand_name,id');
|
||||
|
||||
if ($lists) {
|
||||
foreach ($lists as $value) {
|
||||
$data[] = array('name' => $value['brand_name'], 'id' => $value['id']);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$this->data['brand_list'] = $data;
|
||||
|
||||
if ($id) {
|
||||
$biz = $this->biz_model->get(array('id' => $id, 'status>-1' => null));
|
||||
|
||||
if (!$biz || empty($biz)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
|
||||
}
|
||||
|
||||
$this->data['citys'] = $this->area_model->select(array('province_id' => $biz['province_id']), '', 0, 0, 'distinct(city_id), city_name');
|
||||
@@ -199,9 +211,9 @@ class Store extends HD_Controller
|
||||
}
|
||||
}
|
||||
|
||||
if ($biz['jsondata']) {
|
||||
$jsondata = json_decode($biz['jsondata'], true);
|
||||
$biz['auto_brands'] = $jsondata ? $jsondata['auto_brands'] : array();
|
||||
$b_biz_rows = $this->auto_brand_biz_model->select(['biz_id'=>$biz['id']],'','','','brand_id');
|
||||
if ($b_biz_rows) {
|
||||
$biz['auto_brands'] = array_column($b_biz_rows,'brand_id');
|
||||
} else {
|
||||
$biz['auto_brands'] = array();
|
||||
}
|
||||
@@ -236,7 +248,7 @@ class Store extends HD_Controller
|
||||
|
||||
$this->data['typeAry'] = $this->biz_model->type_ary();
|
||||
$this->data['companyAry'] = $map_company;
|
||||
$this->data['_title'] = $id ? '编辑门店' : '新增门店';
|
||||
$this->data['_title'] = $id ? '编辑门店-'.$biz['biz_name'] : '新增门店';
|
||||
$this->show_view('biz/store/edit', true);
|
||||
}
|
||||
|
||||
@@ -246,7 +258,7 @@ class Store extends HD_Controller
|
||||
$biz['status'] = 1;
|
||||
$biz['biz_name'] = $this->input->post('biz_name', true);
|
||||
if (!$biz['biz_name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家名称不能为空');
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不能为空');
|
||||
}
|
||||
//中文转拼音
|
||||
$pinyin = new PinYin();
|
||||
@@ -254,9 +266,10 @@ class Store extends HD_Controller
|
||||
$biz['firstchar'] = strtoupper($py);
|
||||
|
||||
$biz['brand_id'] = intval($this->input->post('brand_id', true));
|
||||
if (!$biz['brand_id']) {
|
||||
# 230220close
|
||||
/*if (!$biz['brand_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择品牌');
|
||||
}
|
||||
}*/
|
||||
|
||||
$biz['province_id'] = $this->input->post('province_id', true);
|
||||
$biz['city_id'] = intval($this->input->post('city_id', true));
|
||||
@@ -275,14 +288,14 @@ class Store extends HD_Controller
|
||||
}
|
||||
|
||||
$auto_brands = $this->input->post('auto_brands');
|
||||
if ($auto_brands) {
|
||||
/*if ($auto_brands) {
|
||||
$jsondata = array('auto_brands' => $auto_brands);
|
||||
$biz['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}*/
|
||||
|
||||
//上传头像
|
||||
$biz['headimg'] = $this->input->post('headimg');
|
||||
//商家标签
|
||||
//门店标签
|
||||
$tag_more = $this->input->post('tag_more');
|
||||
if (!$tag_more || !is_array($tag_more)) {
|
||||
$tag_more = array();
|
||||
@@ -293,6 +306,7 @@ class Store extends HD_Controller
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
}
|
||||
$this->grant_auto_brands($auto_brands, $id, $biz['type']);
|
||||
|
||||
foreach ($tag_more as $key => $value) {
|
||||
if ($value) {
|
||||
@@ -309,6 +323,42 @@ class Store extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
private function grant_auto_brands($auto_brands, $id, $biz_type){
|
||||
if($auto_brands){
|
||||
$brand_ids = implode(',',$auto_brands);
|
||||
$where = [
|
||||
'biz_id' => $id,
|
||||
"brand_id not in ({$brand_ids})" => null,
|
||||
];
|
||||
if($this->auto_brand_biz_model->count($where)){
|
||||
$this->auto_brand_biz_model->delete($where);
|
||||
}
|
||||
$add_datas = [];
|
||||
foreach ($auto_brands as $key => $val) {
|
||||
$where = [
|
||||
'biz_id' => $id,
|
||||
'brand_id' => $val
|
||||
];
|
||||
if(!$this->auto_brand_biz_model->count($where)){
|
||||
$add_datas[] = [
|
||||
'biz_id' => $id,
|
||||
'type' => $biz_type,
|
||||
'brand_id' => $val,
|
||||
'c_time' => time()
|
||||
];
|
||||
}
|
||||
}
|
||||
$add_datas && $this->auto_brand_biz_model->add_batch($add_datas);
|
||||
}else{
|
||||
$where = [
|
||||
'biz_id' => $id,
|
||||
];
|
||||
if($this->auto_brand_biz_model->count($where)){
|
||||
$this->auto_brand_biz_model->delete($where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
if (!$this->if_ajax) {
|
||||
@@ -320,7 +370,7 @@ class Store extends HD_Controller
|
||||
|
||||
$biz['biz_name'] = $this->input->post('biz_name', true);
|
||||
if (!$biz['biz_name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家名称不能为空');
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不能为空');
|
||||
}
|
||||
//中文转拼音
|
||||
$pinyin = new PinYin();
|
||||
@@ -328,9 +378,10 @@ class Store extends HD_Controller
|
||||
$biz['firstchar'] = strtoupper($py);
|
||||
|
||||
$biz['brand_id'] = intval($this->input->post('brand_id', true));
|
||||
if (!$biz['brand_id']) {
|
||||
# 230220close
|
||||
/*if (!$biz['brand_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择品牌');
|
||||
}
|
||||
}*/
|
||||
|
||||
$biz['province_id'] = $this->input->post('province_id', true);
|
||||
$biz['city_id'] = intval($this->input->post('city_id', true));
|
||||
@@ -352,16 +403,17 @@ class Store extends HD_Controller
|
||||
|
||||
//授权品牌
|
||||
$auto_brands = $this->input->post('auto_brands');
|
||||
$old = $this->biz_model->get(array('id' => $id));
|
||||
$jsondata = json_decode($old['jsondata'], true);
|
||||
if ($auto_brands) {
|
||||
$jsondata['auto_brands'] = $auto_brands;
|
||||
} else {
|
||||
unset($jsondata['auto_brands']);
|
||||
}
|
||||
$biz['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
// $old = $this->biz_model->get(array('id' => $id));
|
||||
// $jsondata = json_decode($old['jsondata'], true);
|
||||
// if ($auto_brands) {
|
||||
// $jsondata['auto_brands'] = $auto_brands;
|
||||
// } else {
|
||||
// unset($jsondata['auto_brands']);
|
||||
// }
|
||||
// $biz['jsondata'] = json_encode($jsondata, JSON_UNESCAPED_UNICODE);
|
||||
$this->grant_auto_brands($auto_brands, $id, $biz['type']);
|
||||
|
||||
//商家标签
|
||||
//门店标签
|
||||
$tag_more = $this->input->post('tag_more');
|
||||
if (!$tag_more || !is_array($tag_more)) {
|
||||
$tag_more = array();
|
||||
@@ -397,7 +449,7 @@ class Store extends HD_Controller
|
||||
}
|
||||
$stauts = $this->input->post('status');
|
||||
$where = array('id' => $id);
|
||||
$this->bizBrand->update(array('status' => $stauts), $where);
|
||||
$this->biz_model->update(array('status' => $stauts), $where);
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
@@ -405,6 +457,7 @@ class Store extends HD_Controller
|
||||
public function batch()
|
||||
{
|
||||
$field = $this->input->post('field');
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdUsers');
|
||||
if ($field === 'ifcheck') {
|
||||
$status = intval($this->input->post('value'));
|
||||
$ids = $this->input->post('id');
|
||||
@@ -412,7 +465,9 @@ class Store extends HD_Controller
|
||||
if (!$ids || count($ids) < 1) {
|
||||
$this->show_json(0, '请选择要操作的选项');
|
||||
}
|
||||
$where = array('id in(' . implode(',', $ids) . ')' => null);
|
||||
$ids_str = implode(',', $ids);
|
||||
$where = ["id in({$ids_str})" => null];
|
||||
$this->mdUsers->update(['status' => $status], ["biz_id in({$ids_str})" => null, 'group_id < 4' => null]);//更新用户下架
|
||||
} else {
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = intval($this->input->post('value'));
|
||||
@@ -420,6 +475,7 @@ class Store extends HD_Controller
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$where['id'] = $id;
|
||||
$this->mdUsers->update(['status' => $status], ['biz_id' => $id, 'group_id < 4' => null]);//更新用户下架
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$this->biz_model->update($data, $where);
|
||||
@@ -471,7 +527,7 @@ class Store extends HD_Controller
|
||||
}
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
if (!$biz || empty($biz)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
|
||||
}
|
||||
$biz_name = $biz['biz_name'];
|
||||
$where['biz_id'] = $biz_id;
|
||||
@@ -571,7 +627,7 @@ class Store extends HD_Controller
|
||||
return $this->show_json(0, "该用户已是门店管理员了");
|
||||
}
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
//绑定门店
|
||||
$data['uid'] = $uid;
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$data['biz_id'] = $biz_id;
|
||||
@@ -627,7 +683,7 @@ class Store extends HD_Controller
|
||||
return $this->show_json(0, "该用户已是门店管理员了");
|
||||
}
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
//绑定门店
|
||||
$data['uid'] = $uid;
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$data['biz_id'] = $biz_id;
|
||||
@@ -711,7 +767,7 @@ class Store extends HD_Controller
|
||||
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page);
|
||||
$this->data['_title'] = "商家{$biz_name}管理员列表";
|
||||
$this->data['_title'] = "{$biz_name}管理员列表";
|
||||
|
||||
$this->show_view('biz/store/lists_manager', true);
|
||||
}
|
||||
@@ -737,7 +793,7 @@ class Store extends HD_Controller
|
||||
}
|
||||
|
||||
if (!$biz_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家不存在!');
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
|
||||
}
|
||||
|
||||
//店铺名称
|
||||
@@ -795,12 +851,12 @@ class Store extends HD_Controller
|
||||
// }
|
||||
//店铺名称
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
//绑门店
|
||||
$data = array('uid' => $uid);
|
||||
$data['biz_id'] = $biz_id;
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$this->$ub_model->add($data);
|
||||
//生成商家关联数据
|
||||
//生成门店关联数据
|
||||
//座上宾
|
||||
$this->load->model('app/zsb/app_zsb_user_model');
|
||||
$this->load->model('user/user_model', 'user_model');
|
||||
@@ -864,11 +920,11 @@ class Store extends HD_Controller
|
||||
}
|
||||
//店铺名称
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
//绑定商家
|
||||
//绑定门店
|
||||
$data = array('uid' => $uid);
|
||||
$data['brand_id'] = $biz['brand_id'];
|
||||
$this->$ub_model->update($data, array('id' => $id));
|
||||
//生成商家关联数据
|
||||
//生成门店关联数据
|
||||
//座上宾
|
||||
$res = $this->app_zsb_user_model->get(array('mobile' => $mobile));
|
||||
if (!$res) {
|
||||
@@ -889,7 +945,7 @@ class Store extends HD_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺可选列表
|
||||
* 获取门店可选列表
|
||||
* @return bool
|
||||
*/
|
||||
function json_lists()
|
||||
@@ -904,6 +960,9 @@ class Store extends HD_Controller
|
||||
$type = $this->input->post('type');
|
||||
|
||||
$where = array();
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$type_ids && $where["type in ($type_ids)"] = null;
|
||||
if (strlen($status) > 0) {
|
||||
$where['status'] = $status;
|
||||
} else {
|
||||
@@ -914,7 +973,7 @@ class Store extends HD_Controller
|
||||
} else {
|
||||
if ($_SESSION['admin_info']['biz_id']) {
|
||||
$biz_ids = implode(',', $_SESSION['admin_info']['biz_id']);
|
||||
$where["id in ($biz_ids)"] = null;
|
||||
$where["id in ({$biz_ids})"] = null;
|
||||
}
|
||||
}
|
||||
$province_id && $where['province_id'] = $province_id;
|
||||
@@ -942,7 +1001,7 @@ class Store extends HD_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取店铺信息
|
||||
* 获取门店信息
|
||||
* @return bool
|
||||
*/
|
||||
function json_get()
|
||||
@@ -1018,31 +1077,37 @@ class Store extends HD_Controller
|
||||
public function get_info()
|
||||
{
|
||||
$biz_id = $this->input->get('id');
|
||||
if (!$this->biz_model->get(['id' => $biz_id])) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '店铺不存在!');
|
||||
$biz = $this->biz_model->get(array('id' => $biz_id));
|
||||
if (!$biz) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '门店不存在!');
|
||||
}
|
||||
$base_info = $this->biz_info_model->get(['biz_id' => $biz_id]);
|
||||
if (!$base_info) {
|
||||
$this->biz_info_model->add(['biz_id' => $biz_id, 'c_time' => time()]);
|
||||
$base_info = $this->biz_info_model->get(['biz_id' => $biz_id]);
|
||||
}
|
||||
$jsondata = json_decode($base_info['jsondata'],true);
|
||||
$info = [
|
||||
'id' => $base_info['id'],
|
||||
'biz_id' => $base_info['biz_id'],
|
||||
'name' => $base_info['name'],
|
||||
'mobile' => $base_info['mobile'],
|
||||
'margin' => $base_info['margin'],
|
||||
'margin' => $base_info['margin']>0 ? $base_info['margin'] : '',
|
||||
'area' => $base_info['area'],
|
||||
'rent' => $base_info['rent'],
|
||||
'wat_ele' => $base_info['wat_ele'],
|
||||
'rent' => $base_info['rent']>0 ? $base_info['rent'] : '',
|
||||
'wat_ele' => $base_info['wat_ele']>0 ? $base_info['wat_ele'] : '',
|
||||
'employee_wage' => $base_info['employee_wage'],
|
||||
'manager_wage' => $base_info['manager_wage'],
|
||||
'commission' => $base_info['commission'],
|
||||
'manager_wage' => $base_info['manager_wage']>0 ? intval($base_info['manager_wage']) : 8000,
|
||||
'commission' => $base_info['commission']>0 ? $base_info['commission'] : '',
|
||||
'num' => $base_info['num'],
|
||||
's_time' => $base_info['s_time'] ? date('Y-m-d', $base_info['s_time']) : '',
|
||||
'e_time' => $base_info['e_time'] ? date('Y-m-d', $base_info['e_time']) : '',
|
||||
'type' => $base_info['type'],
|
||||
'rate' => strlen($base_info['rate']) ? $base_info['rate'] : 0,
|
||||
'biz_type' => $biz['type'],
|
||||
'car_rent' => $jsondata['car_rent'] ? $jsondata['car_rent'] : '',
|
||||
'marketing' => $jsondata['marketing'] ? $jsondata['marketing'] : '',
|
||||
'door_step' => $jsondata['door_step'] ? $jsondata['door_step'] : '',
|
||||
];
|
||||
$brands = [];
|
||||
$b_rows = $this->biz_trucking_model->select(['biz_id' => $base_info['biz_id'], 'status' => 1], '', '', '', 'auto_b_id,money');
|
||||
@@ -1062,7 +1127,7 @@ class Store extends HD_Controller
|
||||
$this->data['type_arr'] = [1 => '扩展', 2 => '新建'];
|
||||
$this->data['brands'] = $brands;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = '编辑门店基本信息';
|
||||
$this->data['_title'] = $biz['biz_name'].'-编辑基本信息';
|
||||
$this->show_view('biz/store/get_info', true);
|
||||
}
|
||||
|
||||
@@ -1070,13 +1135,14 @@ class Store extends HD_Controller
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$brands = $this->input->post('brands');
|
||||
|
||||
if (!$this->biz_info_model->get(['id' => $info['id']])) {
|
||||
$row = $this->biz_info_model->get(['id' => $info['id']]);
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '错数错误!');
|
||||
}
|
||||
if ($info['rate'] < 0 || $info['rate'] > 100) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '分佣比例请填写0~100');
|
||||
}
|
||||
$jsondata = json_decode($row['jsondata'],true);
|
||||
$up_data = [
|
||||
'name' => $info['name'],
|
||||
'mobile' => $info['mobile'],
|
||||
@@ -1093,6 +1159,10 @@ class Store extends HD_Controller
|
||||
'rate' => $info['rate'],
|
||||
'num' => $info['num']
|
||||
];
|
||||
$jsondata['car_rent'] = $info['car_rent'] ? $info['car_rent'] : '';
|
||||
$jsondata['marketing'] = $info['marketing'] ? $info['marketing'] : '';
|
||||
$jsondata['door_step'] = $info['door_step'] ? $info['door_step'] : '';
|
||||
$up_data['jsondata'] = json_encode($jsondata,JSON_UNESCAPED_UNICODE);
|
||||
$this->biz_info_model->update($up_data, ['id' => $info['id']]);
|
||||
$b_ids = array_column($brands, 'id');
|
||||
if ($b_ids) {
|
||||
@@ -1116,4 +1186,9 @@ class Store extends HD_Controller
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
public function lists_srv(){
|
||||
$biz_id = $this->input->get('id');
|
||||
echo $biz_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,958 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Cost extends HD_Controller{
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->load->model('items/items_cost_model');
|
||||
$this->load->model('auto/auto_brand_model', 'mdAutoBrand');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model');
|
||||
$this->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->load->model('items/items_model');
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model('app/licheb/app_licheb_users_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
$this->load->model('sys/sys_company_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->library('receiver/orders_v2_entity');
|
||||
}
|
||||
public function index(){
|
||||
$this->lists();
|
||||
}
|
||||
|
||||
private function get_where(&$params){
|
||||
$where = [];
|
||||
|
||||
# ref \libraries\Ordersv2List.php private function orders($params = array()), 非lc_items_cost相关组装为in查询
|
||||
//lc_items
|
||||
//品牌 车系 车型
|
||||
$where_items = $where_items_default = '1 = 1';
|
||||
$where["item_id in (select id from lc_items where brand_id in (select id from lc_auto_brand where status > -1))"] = null;
|
||||
if ($params['brand_id']) {//品牌
|
||||
//$where["brand_id"] = $params['brand_id'];
|
||||
$where_items = $where_items." and brand_id = ".$params['brand_id'];
|
||||
} else {
|
||||
if (is_product()) {
|
||||
//$where["brand_id<>"] = 3;//狸车品牌不显示
|
||||
$where_items = $where_items." and brand_id <> 3";
|
||||
}
|
||||
$params['brand_id'] = '';
|
||||
}
|
||||
if ($params['s_id']) {//车系
|
||||
//$where["s_id"] = $params['s_id'];
|
||||
$where_items = $where_items." and s_id = ".$params['s_id'];
|
||||
} else {
|
||||
$params['s_id'] = '';
|
||||
}
|
||||
if ($params['v_id']) {//车型
|
||||
//$where["v_id"] = $params['v_id'];
|
||||
$where_items = $where_items." and v_id = ".$params['v_id'];
|
||||
} else {
|
||||
$params['v_id'] = '';
|
||||
}
|
||||
|
||||
if ($params['vin']) {
|
||||
//$where["item_id in(select id from lc_items where vin like '%{$params['vin']}%')"] = null;
|
||||
$params['vin'] = trim($params['vin']);
|
||||
$where_items = $where_items." and vin like '%{$params['vin']}%'";
|
||||
}
|
||||
if ($where_items != $where_items_default){
|
||||
$where["item_id in (select id from lc_items where $where_items)"] = null;
|
||||
}
|
||||
|
||||
# lc_receiver_orders_v2
|
||||
$where_orders = $where_orders_default = '1 = 1';
|
||||
//门店类型
|
||||
!$params['biz_type'] && $params['biz_type'] = '';
|
||||
if ($params['biz_type']) {
|
||||
//$where["biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ')'] = null;
|
||||
$where_orders = $where_orders." and biz_id in (select id from lc_biz where type = {$params['biz_type']})";
|
||||
}
|
||||
//销售员筛选
|
||||
if ($params['admin_id']) {
|
||||
//$where["sale_id"] = $params['admin_id'];
|
||||
$where_orders = $where_orders.' and sale_id = '.$params['admin_id'];
|
||||
}
|
||||
else {
|
||||
if ($params['biz_id_admin']) {//指定店铺所有销售员
|
||||
//$where["biz_id"] = $params['biz_id_admin'];
|
||||
$where_orders = $where_orders.' and biz_id = '.$params['biz_id_admin'];
|
||||
}
|
||||
else {
|
||||
//指定城市的所有门店
|
||||
$where_biz = array();
|
||||
if ($params['county_id_admin']) {
|
||||
$where_biz['county_id'] = $params['county_id_admin'];
|
||||
}
|
||||
else if ($params['city_id_admin']) {
|
||||
$where_biz['city_id'] = $params['city_id_admin'];
|
||||
}
|
||||
if ($where_biz) {
|
||||
$where_biz['status>-1'] = null;
|
||||
$rows_biz = $this->biz_model->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
if ($rows_biz) {
|
||||
$str_ids = implode(',', array_column($rows_biz, 'id'));
|
||||
//$where["biz_id in({$str_ids})"] = null;
|
||||
$where_orders = $where_orders." and biz_id in ({$str_ids})";
|
||||
}
|
||||
else {
|
||||
//$where["biz_id"] = -1;
|
||||
$where_orders = $where_orders.' and biz_id = -1';
|
||||
}
|
||||
}
|
||||
}
|
||||
!$params['city_id_admin'] && $params['city_id_admin'] = '';
|
||||
!$params['county_id_admin'] && $params['county_id_admin'] = '';
|
||||
!$params['biz_id_admin'] && $params['biz_id_admin'] = '';
|
||||
$params['admin_id'] = '';
|
||||
}
|
||||
//二手车
|
||||
if (strlen($params['if_usedcar'])) {
|
||||
$where_orders = $where_orders." and if_usedcar = {$params['if_usedcar']}";
|
||||
}
|
||||
else {
|
||||
$params['if_usedcar'] = '';
|
||||
}
|
||||
|
||||
if ($where_orders != $where_orders_default){
|
||||
$where["o_id in (select id from lc_receiver_orders_v2 where $where_orders)"] = null;
|
||||
}
|
||||
|
||||
//开票时间
|
||||
if ($params['bill_time']) {
|
||||
$bill_time = explode(' ~ ', $params['bill_time']);
|
||||
if ($bill_time[0]) {
|
||||
$where["bill_time >="] = $bill_time[0] . ' 00:00:00';
|
||||
}
|
||||
if ($bill_time[1]) {
|
||||
$where["bill_time <="] = $bill_time[1] . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (!$params['bt_init']){
|
||||
$params['bt_init'] = 1;
|
||||
$time1 = date("Y-m-d",mktime(0, 0 , 0,date("m"),1,date("Y")));
|
||||
$time2 = date("Y-m-d",mktime(23,59,59,date("m"),date("t"),date("Y")));
|
||||
$params['bill_time'] = $time1 . ' ~ ' . $time2;
|
||||
$where["bill_time >="] = $time1 . ' 00:00:00';
|
||||
$where["bill_time <="] = $time2 . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$autoList = array();
|
||||
$where = $this->get_where($params);
|
||||
if ($params['brand_id']) {
|
||||
$autoList[2] = $this->auto_series_model->select(array('status > -1' => null, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$autoList[3] = $this->auto_attr_model->select(array('status > -1' => null, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
|
||||
#$count = $this->items_cost_model->count($where);var_dump($count);
|
||||
$aggs = $this->items_cost_model->get($where, 'count(*) as doc_count, sum(srv_price) as srv_price_sum, sum(car_price) as car_price_sum');
|
||||
$count = $aggs['doc_count'];
|
||||
$lists = [];
|
||||
if($count){
|
||||
$rows = $this->items_cost_model->select($where,'id desc',$page,$size);
|
||||
$item_ids = implode(',',array_column($rows,'item_id'));
|
||||
$map_item = $item_rows = [];
|
||||
if($item_ids){
|
||||
$where = ["id in ($item_ids)" => null];
|
||||
$item_rows = $this->items_model->select($where,'','','','id,brand_id,s_id,v_id,vin');
|
||||
foreach ($item_rows as $item) {
|
||||
$map_item[$item['id']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
//订单(ref export)
|
||||
$o_ids = implode(',',array_column($rows,'o_id'));
|
||||
$map_order = [];
|
||||
if($o_ids){
|
||||
$where = ["id in ($o_ids)" => null];
|
||||
$fields = "id, if_usedcar, (select biz_name from lc_biz where id = lc_receiver_orders_v2.biz_id) as biz_name, (select lc_sys_city.name from lc_biz left join lc_sys_city on lc_biz.city_id = lc_sys_city.city_id where lc_biz.id = lc_receiver_orders_v2.biz_id) as city_name ";
|
||||
$order_rows = $this->receiver_orders_v2_model->select($where,'','','',$fields);
|
||||
foreach ($order_rows as $item) {
|
||||
$map_order[$item['id']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($item_rows, 'brand_id'));
|
||||
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//车系车型
|
||||
$series_arr = array_unique(array_column($item_rows, 's_id'));
|
||||
$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
|
||||
//获取属性
|
||||
$v_arr = array_unique(array_column($item_rows, 'v_id'));
|
||||
$cor_arr = array_unique(array_column($item_rows, 'cor_id'));
|
||||
$incor_arr = array_unique(array_column($item_rows, 'incor_id'));
|
||||
$attr_arr = array_merge($v_arr, $cor_arr, $incor_arr);
|
||||
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
|
||||
foreach ($rows as $key => $val) {
|
||||
$item = $map_item[$val['item_id']];
|
||||
$brand_name = isset($brands[$item['brand_id']]) ? $brands[$item['brand_id']][0]['name'] : '';
|
||||
$series_name = isset($series[$item['s_id']]) ? $series[$item['s_id']][0]['name'] : '';
|
||||
$v_name = isset($attr[$item['v_id']]) ? $attr[$item['v_id']][0]['title'] : '';
|
||||
$srv_json = json_decode($val['srv_json'],true);
|
||||
$order = $map_order[$val['o_id']];
|
||||
$if_usedcar_name = $order['if_usedcar'] ? ' (二手车)':'';
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'city_name' => $order['city_name'],
|
||||
'biz_name' => $order['biz_name'],
|
||||
'title' => "{$brand_name} {$series_name} {$v_name}{$if_usedcar_name}",
|
||||
'vin' => $item['vin'],
|
||||
'sale_price' => $val['sale_price'],
|
||||
'buy_price' => $val['buy_price'],
|
||||
'promotion_price' => $val['promotion_price'],
|
||||
'car_buy_price' => $val['car_buy_price'],
|
||||
'car_profit_price' => $val['car_profit_price'],
|
||||
'insurance_price' => $val['insurance_price'],
|
||||
'fee_carno_price' => $val['fee_carno_price'],
|
||||
'loan_price' => $val['loan_price'],
|
||||
'loan_price0' => $val['loan_price0'], // 首付按揭
|
||||
'loan_price_total' => $val['loan_price_total'],
|
||||
'srv_price' => $val['srv_price'],
|
||||
'car_price' => $val['car_price'],
|
||||
'dl_car_price' => $val['dl_car_price'],
|
||||
'brand_car_price' => $val['brand_car_price'],
|
||||
'if_pay' => $srv_json['if_pay'] ? intval($srv_json['if_pay']) : 0,
|
||||
'if_pay_name' => $srv_json['if_pay'] == 1 ? '是' : '',
|
||||
];
|
||||
}
|
||||
}
|
||||
$show_info['bizTypeAry'] = $this->biz_model->type_ary();//门店类型
|
||||
$show_info['usedcarAry'] = array(1=>'是', 0=>'否');
|
||||
$this->data['show_info'] = $show_info;
|
||||
#$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['aggs'] = $aggs;
|
||||
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$this->data['autoList'] = $autoList;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['_title'] = '整车成本';
|
||||
return $this->show_view('items/cost/lists', true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$id = $this->input->get('id');
|
||||
$row = $this->items_cost_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$order_row = $this->receiver_orders_v2_model->get(['id'=>$row['o_id']]);
|
||||
$info_json = json_decode($order_row['info_json'],true);
|
||||
$item_row = $this->items_model->get(['id'=>$row['item_id']]);
|
||||
$biz = $this->biz_model->get(['id'=>$order_row['biz_id']]);
|
||||
$admin = $this->app_licheb_users_model->get(['id'=>$order_row['admin_id']]);
|
||||
$company = $this->sys_company_model->get(['id'=>$item_row['company_id']]);
|
||||
$promotion_json = json_decode($row['promotion_json'],true);
|
||||
!$promotion_json['sale_price'] && $promotion_json['sale_price'] = 0;
|
||||
!$promotion_json['other'] && $promotion_json['other'] = 0;
|
||||
!$promotion_json['factory_price'] && $promotion_json['factory_price'] = 0;
|
||||
$cost_json = json_decode($row['cost_json'],true);
|
||||
!$cost_json['select_price'] && $cost_json['select_price'] = 0;
|
||||
!$cost_json['labor_price'] && $cost_json['labor_price'] = 0;
|
||||
$srv_json = json_decode($row['srv_json'],true);
|
||||
!$srv_json['commission_price'] && $srv_json['commission_price'] = 0;
|
||||
!$srv_json['back_price'] && $srv_json['back_price'] = 0;
|
||||
!$srv_json['loan_srv'] && $srv_json['loan_srv'] = 0;
|
||||
!$srv_json['loan_fd'] && $srv_json['loan_fd'] = 0;
|
||||
!$srv_json['loan_offset_price'] && $srv_json['loan_offset_price'] = 0;
|
||||
!$srv_json['loan_subsidy_price'] && $srv_json['loan_subsidy_price'] = 0;
|
||||
!$srv_json['loan_in_price'] && $srv_json['loan_in_price'] = 0;
|
||||
!$srv_json['loan_out_price'] && $srv_json['loan_out_price'] = 0;
|
||||
!$srv_json['loan_srv0'] && $srv_json['loan_srv0'] = 0; // 首付按揭 // 按揭手续费
|
||||
!$srv_json['loan_fd0'] && $srv_json['loan_fd0'] = 0; // 返点
|
||||
!$srv_json['loan_srv_price0'] && $srv_json['loan_srv_price0'] = 0; // 按揭佣金
|
||||
!$srv_json['loan_offset_price0'] && $srv_json['loan_offset_price0'] = 0; // 解抵服务费
|
||||
!$srv_json['loan_subsidy_price0'] && $srv_json['loan_subsidy_price0'] = 0; // 利息补贴收入 其他收入金额
|
||||
!$srv_json['loan_in_price0'] && $srv_json['loan_in_price0'] = 0; // 其他收入金额
|
||||
!$srv_json['loan_out_price0'] && $srv_json['loan_out_price0'] = 0; // 其他支出金额
|
||||
!$srv_json['commission_price0'] && $srv_json['commission_price0'] = 0; // 按揭手续费收入
|
||||
!$srv_json['other_out_price'] && $srv_json['other_out_price'] = 0;
|
||||
!$srv_json['other_in_price'] && $srv_json['other_in_price'] = 0;
|
||||
!$srv_json['ori_price'] && $srv_json['ori_price'] = 0;
|
||||
$info = [
|
||||
'bill_name' => $row['bill_name'],
|
||||
'bill_time' => $row['bill_time'] !='0000-00-00 00:00:00' ? date('Y-m-d',strtotime($row['bill_time'])) : '',
|
||||
'price' => $row['price'],
|
||||
'bill_price' => $row['bill_price'],
|
||||
'if_usedcar_name' => $order_row['if_usedcar'] ? '是':'否',
|
||||
'vin' => $item_row['vin'],
|
||||
'ori_price' => $item_row['ori_price'],
|
||||
'buy_price' => $item_row['buy_price'],
|
||||
'company_name' => $company['short'],
|
||||
'name' => $order_row['owner_name']."({$order_row['owner_mobile']})", // 'name' => $order_row['name']."({$order_row['mobile']})",
|
||||
'payway' => $order_row['payway'],
|
||||
'biz_type' => $biz['type'],
|
||||
'biz_type_name' => $this->biz_model->type_ary($biz['type']),
|
||||
'biz_name' => $biz['biz_name'],
|
||||
'biz_type_force' => $biz['type'] == 3 && in_array($biz['city_id'], $this->receiver_orders_v2_model->get_city_ids_force()) ? 1 : 0, # 23-04-03: 按揭, 350600 代理店按所在城市的品牌店处理; 23-04-04: 加多一个城市,宁德
|
||||
'admin_name' => $admin['uname'],
|
||||
'order_time' => date('Y-m-d',$order_row['c_time']),
|
||||
'promotion_json' => $promotion_json,
|
||||
'cost_json' => $cost_json,
|
||||
'srv_json' => $srv_json,
|
||||
'row' => $row,
|
||||
'business_id' => $info_json['business_id'] ? $info_json['business_id'] : 0
|
||||
];
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$row['o_id'],'status'=>1,'pay_price <>'=>0]);
|
||||
$info['pay_price'] = $sum['total_price'] ? $sum['total_price'] : 0;
|
||||
$info['need_price'] = $this->orders_v2_entity->recevable_price($row['o_id'],$srv_price=true,$price_loan=false);
|
||||
//获取车信息
|
||||
$brand = $this->auto_brand_model->get(['id' => $item_row['brand_id']], 'name');
|
||||
$serie = $this->auto_series_model->get(['id' => $item_row['s_id']], 'name');
|
||||
$attr = $this->auto_attr_model->get(['id'=>$item_row['v_id']], 'title');
|
||||
$info['brand_name'] = $brand['name'];
|
||||
$info['s_name'] = $serie['name'];
|
||||
$info['v_name'] = $attr['title'];
|
||||
$this->data['info'] = $info;
|
||||
$this->data['_title'] = '编辑整车成本';
|
||||
return $this->show_view('items/cost/get', true);
|
||||
}
|
||||
|
||||
public function add(){
|
||||
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$post_data = $this->input->post();
|
||||
$row = $this->items_cost_model->get(['id'=>$post_data['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
|
||||
$item_row = $this->items_model->get(['id'=>$row['item_id']]);
|
||||
$buy_price = $post_data['buy_price'] ? $post_data['buy_price'] : 0;
|
||||
$res_item = 0;
|
||||
if ($item_row && $item_row['buy_price'] != $buy_price){
|
||||
$res_item = $this->items_model->update(array('buy_price'=>$buy_price),['id'=>$row['item_id']]);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'bill_name' => $post_data['bill_name'] ? $post_data['bill_name'] : '',
|
||||
'bill_price' => $post_data['bill_price'] ? $post_data['bill_price'] : 0,
|
||||
'price' => $post_data['price'] ? $post_data['price'] : 0,
|
||||
'cost_json' => json_encode($post_data['cost_json'],JSON_UNESCAPED_UNICODE),
|
||||
'promotion_json' => json_encode($post_data['promotion_json'],JSON_UNESCAPED_UNICODE),
|
||||
'srv_json' => json_encode($post_data['srv_json'],JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
|
||||
/*
|
||||
水平
|
||||
品牌店按现有逻辑 (1)
|
||||
合伙店取商务政策的固定值 (2)
|
||||
代理店没有水平业务 (3)
|
||||
*/
|
||||
$order_row = $this->receiver_orders_v2_model->get(['id'=>$row['o_id']], 'id, (select type from lc_biz where id = lc_receiver_orders_v2.biz_id) as biz_type');
|
||||
$biz_type = $order_row['biz_type'];
|
||||
if ($biz_type == 2){
|
||||
$insurance_price = $post_data['insurance_price'] ? $post_data['insurance_price'] : 0;
|
||||
$insurance_price != $row['insurance_price'] && $data['insurance_price'] = $insurance_price;
|
||||
|
||||
$fee_carno_price = $post_data['fee_carno_price'] ? $post_data['fee_carno_price'] : 0;
|
||||
$fee_carno_price != $row['fee_carno_price'] && $data['fee_carno_price'] = $fee_carno_price;
|
||||
|
||||
$loan_price = $post_data['loan_price'] ? $post_data['loan_price'] : 0;
|
||||
$loan_price != $row['loan_price'] && $data['loan_price'] = $loan_price;
|
||||
}
|
||||
|
||||
$res = $this->items_cost_model->update($data,['id'=>$row['id']]);
|
||||
if(is_numeric($res_item) || is_numeric($res)){
|
||||
$this->items_cost_model->update_total($row['id']);
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit_pay(){
|
||||
$post_data = $this->input->post();
|
||||
$row = $this->items_cost_model->get(['id'=>$post_data['id']]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL,'参数错误');
|
||||
}
|
||||
$srv_json = json_decode($row['srv_json'],true);
|
||||
$srv_json['if_pay'] = $post_data['status'] == 1 ? 1 : 0;
|
||||
$data = [
|
||||
'srv_json' => json_encode($srv_json,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
$res = $this->items_cost_model->update($data,['id'=>$row['id']]);
|
||||
if(is_numeric($res)){
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'保存成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL,'保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function del(){
|
||||
|
||||
}
|
||||
|
||||
public function batch(){
|
||||
|
||||
}
|
||||
|
||||
public function add_excel()
|
||||
{
|
||||
require_once COMMPATH . '/third_party/PHPExcel/IOFactory.php';
|
||||
$res = $this->upload();
|
||||
if (!$res['code']) {
|
||||
return $this->show_json(0, $res['message']);
|
||||
}
|
||||
$file = $res['path'];
|
||||
if ($res['file_ext'] == '.xls') {
|
||||
$reader = \PHPExcel_IOFactory::createReader('Excel5'); // 读取 excel 文档
|
||||
} elseif ($res['file_ext'] == '.xlsx') {
|
||||
$reader = \PHPExcel_IOFactory::createReader('Excel2007'); // 读取 excel 文档
|
||||
}
|
||||
$PHPExcel = $reader->load($file); // 文档名称
|
||||
$objWorksheet = $PHPExcel->getActiveSheet();
|
||||
$rowCnt = $objWorksheet->getHighestRow(); //获取总行数
|
||||
if ($rowCnt > 10000) {
|
||||
@unlink($file);
|
||||
return $this->show_json(0, '数据大于一万请拆分多个表格导入');
|
||||
}
|
||||
$s = $f = $ignore_vin = $ignore_item = $ignore_cost = 0;
|
||||
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
|
||||
$vin = $objWorksheet->getCell('A' . $_row)->getValue(); //vin码
|
||||
if (!$vin){
|
||||
$ignore_vin++;
|
||||
continue;
|
||||
}
|
||||
$item = $this->items_model->get(array('vin' => $vin));
|
||||
if (!$item){
|
||||
$ignore_item++;
|
||||
continue;
|
||||
}
|
||||
$cost = $this->items_cost_model->get(array('item_id' => $item['id']));
|
||||
if (!$cost){
|
||||
$ignore_cost++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = $cost['id'];
|
||||
$promotion_json = json_decode($cost['promotion_json'],true);
|
||||
$cost_json = json_decode($cost['cost_json'],true);
|
||||
$srv_json = json_decode($cost['srv_json'],true);
|
||||
# 读取需要更新的列,生成需更新的数据
|
||||
# 参考 edit* 更新
|
||||
$buy_price = floatval($objWorksheet->getCell('B' . $_row)->getValue()); //采购成本
|
||||
$select_price = floatval($objWorksheet->getCell('C' . $_row)->getValue()); //选装成本
|
||||
$labor_price = floatval($objWorksheet->getCell('D' . $_row)->getValue()); //选装工时费
|
||||
$sale_price = floatval($objWorksheet->getCell('E' . $_row)->getValue()); //销售佣金
|
||||
$other = floatval($objWorksheet->getCell('F' . $_row)->getValue()); //其他促销成本
|
||||
$factory_price = floatval($objWorksheet->getCell('G' . $_row)->getValue()); //厂家补贴
|
||||
$other_in_price = floatval($objWorksheet->getCell('H' . $_row)->getValue()); //其他收入
|
||||
$other_out_price = floatval($objWorksheet->getCell('I' . $_row)->getValue()); //其他支出
|
||||
$business_product = $objWorksheet->getCell('J' . $_row)->getValue(); //保险公司
|
||||
$business_price = floatval($objWorksheet->getCell('K' . $_row)->getValue()); //商业险金额
|
||||
$business_fd = floatval($objWorksheet->getCell('L' . $_row)->getValue()); //商业险返点
|
||||
$business_ins_price = floatval($objWorksheet->getCell('M' . $_row)->getValue()); //商业险佣金
|
||||
$insurance_price = floatval($objWorksheet->getCell('N' . $_row)->getValue()); //交强险金额
|
||||
$insurance_fd = floatval($objWorksheet->getCell('O' . $_row)->getValue()); //交强险返点
|
||||
$insurance_ins_price = floatval($objWorksheet->getCell('P' . $_row)->getValue()); //交强险佣金
|
||||
$accident_price = floatval($objWorksheet->getCell('Q' . $_row)->getValue()); //意外险金额
|
||||
$accident_fd = floatval($objWorksheet->getCell('R' . $_row)->getValue()); //意外险返点
|
||||
$accident_ins_price = floatval($objWorksheet->getCell('S' . $_row)->getValue()); //意外险佣金
|
||||
$back_price = floatval($objWorksheet->getCell('T' . $_row)->getValue()); //客户退点金额
|
||||
$fee_carno = floatval($objWorksheet->getCell('U' . $_row)->getValue()); //挂牌收入
|
||||
$cb_fee_carno = floatval($objWorksheet->getCell('V' . $_row)->getValue()); //挂牌成本
|
||||
$loan_product = $objWorksheet->getCell('W' . $_row)->getValue(); //按揭银行
|
||||
$loan_num = floatval($objWorksheet->getCell('X' . $_row)->getValue()); //按揭期数
|
||||
$loan_price = floatval($objWorksheet->getCell('Y' . $_row)->getValue()); //按揭金额
|
||||
$loan_fd = floatval($objWorksheet->getCell('Z' . $_row)->getValue()); //按揭返点
|
||||
$loan_srv_price = floatval($objWorksheet->getCell('AA' . $_row)->getValue()); //按揭佣金
|
||||
$loan_srv = floatval($objWorksheet->getCell('AB' . $_row)->getValue()); //按揭手续费
|
||||
$loan_offset_price = floatval($objWorksheet->getCell('AC' . $_row)->getValue()); //解抵服务费
|
||||
$loan_subsidy_price = floatval($objWorksheet->getCell('AD' . $_row)->getValue()); //利息补贴收入
|
||||
$loan_in_price = floatval($objWorksheet->getCell('AE' . $_row)->getValue()); //其他收入金额
|
||||
$loan_out_price = floatval($objWorksheet->getCell('AF' . $_row)->getValue()); //其他支出金额
|
||||
$commission_price = floatval($objWorksheet->getCell('AG' . $_row)->getValue()); //利息补贴收入
|
||||
|
||||
$res_item = 0;
|
||||
if ($item['buy_price'] != $buy_price){
|
||||
$res_item = $this->items_model->update(array('buy_price'=>$buy_price),['id'=>$item['id']]);
|
||||
}
|
||||
$cost_json['select_price'] = $select_price ? $select_price : 0;
|
||||
$cost_json['labor_price'] = $labor_price ? $labor_price : 0;
|
||||
|
||||
$promotion_json['sale_price'] = $sale_price ? $sale_price : 0;
|
||||
$promotion_json['other'] = $other ? $other : 0;
|
||||
$promotion_json['factory_price'] = $factory_price ? $factory_price : 0;
|
||||
|
||||
$srv_json['other_in_price'] = $other_in_price ? $other_in_price : 0;
|
||||
$srv_json['other_out_price'] = $other_out_price ? $other_out_price : 0;
|
||||
$srv_json['business_product'] = $business_product ? $business_product : '';
|
||||
$srv_json['business_price'] = $business_price ? $business_price : 0;
|
||||
$srv_json['business_fd'] = $business_fd ? $business_fd : 0;
|
||||
$srv_json['business_ins_price'] = $business_ins_price ? $business_ins_price : 0;
|
||||
$srv_json['insurance_price'] = $insurance_price ? $insurance_price : 0;
|
||||
$srv_json['insurance_fd'] = $insurance_fd ? $insurance_fd : 0;
|
||||
$srv_json['insurance_ins_price'] = $insurance_ins_price ? $insurance_ins_price : 0;
|
||||
$srv_json['accident_price'] = $accident_price ? $accident_price : 0;
|
||||
$srv_json['accident_fd'] = $accident_fd ? $accident_fd : 0;
|
||||
$srv_json['accident_ins_price'] = $accident_ins_price ? $accident_ins_price : 0;
|
||||
$srv_json['back_price'] = $back_price ? $back_price : 0;
|
||||
$srv_json['fee_carno'] = $fee_carno ? $fee_carno : 0;
|
||||
$srv_json['cb_fee_carno'] = $cb_fee_carno ? $cb_fee_carno : 0;
|
||||
$srv_json['loan_product'] = $loan_product ? $loan_product : '';
|
||||
$srv_json['loan_num'] = $loan_num ? $loan_num : 0;
|
||||
$srv_json['loan_price'] = $loan_price ? $loan_price : 0;
|
||||
$srv_json['loan_fd'] = $loan_fd ? $loan_fd : 0;
|
||||
$srv_json['loan_srv_price'] = $loan_srv_price ? $loan_srv_price : 0;
|
||||
$srv_json['loan_srv'] = $loan_srv ? $loan_srv : 0;
|
||||
$srv_json['loan_offset_price'] = $loan_offset_price ? $loan_offset_price : 0;
|
||||
$srv_json['loan_subsidy_price'] = $loan_subsidy_price ? $loan_subsidy_price : 0;
|
||||
$srv_json['loan_in_price'] = $loan_in_price ? $loan_in_price : 0;
|
||||
$srv_json['loan_out_price'] = $loan_out_price ? $loan_out_price : 0;
|
||||
$srv_json['commission_price'] = $commission_price ? $commission_price : 0;
|
||||
|
||||
$data = [
|
||||
'cost_json' => json_encode($cost_json,JSON_UNESCAPED_UNICODE),
|
||||
'promotion_json' => json_encode($promotion_json,JSON_UNESCAPED_UNICODE),
|
||||
'srv_json' => json_encode($srv_json,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
$res = $this->items_cost_model->update($data,['id'=>$cost['id']]);
|
||||
if(is_numeric($res_item) || is_numeric($res)){
|
||||
$this->items_cost_model->update_total($cost['id']);
|
||||
}else{
|
||||
$f++;
|
||||
}
|
||||
$s++;
|
||||
}
|
||||
@unlink($file);
|
||||
$ignore = $ignore_vin + $ignore_item + $ignore_cost;
|
||||
$msg = "导入完成,导入总条数为:" . $s;
|
||||
$f && $msg = $msg . '; 失败条数:'. $f;
|
||||
$ignore && $msg = $msg . '; 忽略条数:'. $ignore;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, $msg);
|
||||
}
|
||||
|
||||
public function export(){
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$data = $indexs = array();
|
||||
$fileName = '整车成本';
|
||||
$where = $this->get_where($params);
|
||||
$count = $this->items_cost_model->count($where);
|
||||
if($count){
|
||||
$rows = $this->items_cost_model->select($where,'id desc',$params['page'],$params['size']);
|
||||
|
||||
//车辆
|
||||
$item_ids = implode(',',array_column($rows,'item_id'));
|
||||
$map_item = $item_rows = [];
|
||||
if($item_ids){
|
||||
$where = ["id in ($item_ids)" => null];
|
||||
$item_rows = $this->items_model->select($where,'','','','id,brand_id,s_id,v_id,vin,ori_price,buy_price,(select short from lc_sys_company where id = lc_items.company_id) as cpmpany_name');
|
||||
foreach ($item_rows as $item) {
|
||||
$map_item[$item['id']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
//订单
|
||||
$o_ids = implode(',',array_column($rows,'o_id'));
|
||||
$map_order = [];
|
||||
if($o_ids){
|
||||
$where = ["id in ($o_ids)" => null];
|
||||
$fields = "id, name, mobile, owner_name, owner_mobile, c_time, biz_id, admin_id,
|
||||
payway, if(payway=1,'全款','按揭') as payway_name,
|
||||
if_usedcar, if(if_usedcar=1,'是','') as if_usedcar_name,
|
||||
(select type from lc_biz where id = lc_receiver_orders_v2.biz_id) as biz_type,
|
||||
(select biz_name from lc_biz where id = lc_receiver_orders_v2.biz_id) as biz_name,
|
||||
(select uname from lc_app_licheb_users where id = lc_receiver_orders_v2.admin_id) as admin_name,
|
||||
(select lc_sys_city.name from lc_biz left join lc_sys_city on lc_biz.city_id = lc_sys_city.city_id where lc_biz.id = lc_receiver_orders_v2.biz_id) as city_name";
|
||||
$order_rows = $this->receiver_orders_v2_model->select($where,'','','',$fields);
|
||||
foreach ($order_rows as $item) {
|
||||
$map_order[$item['id']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($item_rows, 'brand_id'));
|
||||
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
|
||||
//车系车型
|
||||
$series_arr = array_unique(array_column($item_rows, 's_id'));
|
||||
$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
|
||||
//获取属性
|
||||
$v_arr = array_unique(array_column($item_rows, 'v_id'));
|
||||
$cor_arr = array_unique(array_column($item_rows, 'cor_id'));
|
||||
$incor_arr = array_unique(array_column($item_rows, 'incor_id'));
|
||||
$attr_arr = array_merge($v_arr, $cor_arr, $incor_arr);
|
||||
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
|
||||
foreach ($rows as $key => $val) {
|
||||
$item = $map_item[$val['item_id']];
|
||||
$brand_name = isset($brands[$item['brand_id']]) ? $brands[$item['brand_id']][0]['name'] : '';
|
||||
$series_name = isset($series[$item['s_id']]) ? $series[$item['s_id']][0]['name'] : '';
|
||||
$v_name = isset($attr[$item['v_id']]) ? $attr[$item['v_id']][0]['title'] : '';
|
||||
|
||||
$order = $map_order[$val['o_id']];
|
||||
|
||||
// json字段防止为空
|
||||
$promotion_json = json_decode($val['promotion_json'],true);
|
||||
!$promotion_json['sale_price'] && $promotion_json['sale_price'] = 0;
|
||||
!$promotion_json['other'] && $promotion_json['other'] = 0;
|
||||
!$promotion_json['factory_price'] && $promotion_json['factory_price'] = 0;
|
||||
$cost_json = json_decode($val['cost_json'],true);
|
||||
!$cost_json['select_price'] && $cost_json['select_price'] = 0;
|
||||
!$cost_json['labor_price'] && $cost_json['labor_price'] = 0;
|
||||
$srv_json = json_decode($val['srv_json'],true);
|
||||
!$srv_json['commission_price'] && $srv_json['commission_price'] = 0;
|
||||
!$srv_json['back_price'] && $srv_json['back_price'] = 0;
|
||||
!$srv_json['loan_offset_price'] && $srv_json['loan_offset_price'] = 0;
|
||||
!$srv_json['loan_subsidy_price'] && $srv_json['loan_subsidy_price'] = 0;
|
||||
!$srv_json['loan_in_price'] && $srv_json['loan_in_price'] = 0;
|
||||
!$srv_json['loan_out_price'] && $srv_json['loan_out_price'] = 0;
|
||||
!$srv_json['other_out_price'] && $srv_json['other_out_price'] = 0;
|
||||
!$srv_json['other_in_price'] && $srv_json['other_in_price'] = 0;
|
||||
!$srv_json['ori_price'] && $srv_json['ori_price'] = 0;
|
||||
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$val['o_id'],'status'=>1,'pay_price <>'=>0]);
|
||||
$pay_price = $sum['total_price'] ? $sum['total_price'] : 0;
|
||||
$need_price = $this->orders_v2_entity->recevable_price($val['o_id'],$srv_price=true,$price_loan=false);
|
||||
|
||||
$data[] = [
|
||||
'id' => $val['id'],
|
||||
'city_name' => $order['city_name'],
|
||||
'bill_name' => $val['bill_name'],
|
||||
'biz_type' => $order['biz_type'],
|
||||
'biz_type_name' => $this->biz_model->type_ary($order['biz_type']),
|
||||
'vin' => $item['vin'],
|
||||
'brand_name' => $brand_name,
|
||||
'series_name' => "{$series_name} {$v_name}",
|
||||
'if_usedcar_name' => $order['if_usedcar_name'],
|
||||
'ori_price' => $srv_json['ori_price'],
|
||||
|
||||
'owner_name' => $order['owner_name']."({$order['owner_mobile']})",
|
||||
'admin_name' => $order['admin_name'],
|
||||
'biz_name' => $order['biz_name'],
|
||||
'bill_time' => date('Y-m-d',strtotime($val['bill_time'])),
|
||||
'bill_price' => $val['bill_price'],
|
||||
'bill_price_diff' => $val['price'] - $val['bill_price'],
|
||||
'price' => $val['price'],
|
||||
'price_fine_select' => $srv_json['price_fine_select'],
|
||||
'sale_price' => $val['sale_price'], // $val['price'] + $srv_json['price_fine_select']
|
||||
'order_time' => date('Y-m-d',$order['c_time']),
|
||||
|
||||
'price_floor' => $srv_json['price_floor'],
|
||||
'profix_car_1' => $order['biz_type'] == 1 ? $srv_json['profix_car'] : 0,
|
||||
'profix_car_1_not' => $order['biz_type'] != 1 ? $srv_json['profix_car'] : 0,
|
||||
|
||||
'company_name' => $item['cpmpany_name'],
|
||||
'buy_price' => $item['buy_price'],
|
||||
'select_price' => $cost_json['select_price'],
|
||||
'labor_price' => $cost_json['labor_price'],
|
||||
'buy_price_total' => $val['buy_price'],
|
||||
|
||||
'promotion_sale_price' => $promotion_json['sale_price'],
|
||||
'promotion_other' => $promotion_json['other'],
|
||||
'promotion_price' => $val['promotion_price'],
|
||||
|
||||
'factory_price' => $promotion_json['factory_price'],
|
||||
'car_buy_price' => $val['car_buy_price'],
|
||||
'car_profit_price' => $val['car_profit_price'],
|
||||
|
||||
"business_product" => $srv_json['business_product'],
|
||||
"business_price" => $srv_json['business_price'],
|
||||
"business_fd" => $srv_json['business_fd'],
|
||||
"business_ins_price" => $srv_json['business_ins_price'],
|
||||
"insurance_price" => $srv_json['insurance_price'],
|
||||
"insurance_fd" => $srv_json['insurance_fd'],
|
||||
"insurance_ins_price" => $srv_json['insurance_ins_price'],
|
||||
"accident_price" => $srv_json['accident_price'],
|
||||
"accident_fd" => $srv_json['accident_fd'],
|
||||
"accident_ins_price" => $srv_json['accident_ins_price'],
|
||||
"back_price" => $srv_json['back_price'],
|
||||
"insurance_price_pure" => $val['insurance_price'],
|
||||
|
||||
'fee_carno' => $srv_json['fee_carno'],
|
||||
'cb_fee_carno' => $srv_json['cb_fee_carno'],
|
||||
"fee_carno_price" => $val['fee_carno_price'],
|
||||
|
||||
'payway_name' => $order['payway_name'],
|
||||
|
||||
'loan_product0' => $srv_json['loan_product0'],
|
||||
'loan_is_tiexi0' => $srv_json['loan_product0'] ? ($srv_json['loan_is_tiexi0'] ? '是' : '否') : '',
|
||||
'loan_price0' => $srv_json['loan_price0'],
|
||||
'loan_num0' => $srv_json['loan_num0'],
|
||||
'loan_srv_price0' => $srv_json['loan_srv_price0'],
|
||||
'loan_srv0' => $srv_json['loan_srv0'],
|
||||
'loan_fd0' => $srv_json['loan_fd0'],
|
||||
'loan_offset_price0' => $srv_json['loan_offset_price0'],
|
||||
'loan_subsidy_price' => $srv_json['loan_subsidy_price0'],
|
||||
'commission_price0' => $srv_json['commission_price0'],
|
||||
'loan_in_price0' => $srv_json['loan_in_price0'],
|
||||
'loan_out_price0' => $srv_json['loan_out_price0'],
|
||||
'loan_price_pure0' => $val['loan_price0'],
|
||||
|
||||
'loan_product' => $srv_json['loan_product'],
|
||||
'loan_is_tiexi' => $srv_json['loan_is_tiexi'] ? '是' : '否',
|
||||
'loan_price' => $srv_json['loan_price'], // 按揭金额
|
||||
'loan_num' => $srv_json['loan_num'], // 期数
|
||||
'loan_srv_price' => $srv_json['loan_srv_price'], // 按揭佣金
|
||||
'loan_srv' => $srv_json['loan_srv'], // 按揭手续费
|
||||
'loan_fd' => $srv_json['loan_fd'], // 返点
|
||||
'loan_offset_price' => $srv_json['loan_offset_price'], // 解抵服务费
|
||||
'loan_subsidy_price' => $srv_json['loan_subsidy_price'], // 利息补贴收入
|
||||
'commission_price' => $srv_json['commission_price'], // 按揭手续费收入
|
||||
'loan_in_price' => $srv_json['loan_in_price'], // 其他收入金额
|
||||
'loan_out_price' => $srv_json['loan_out_price'], // 其他支出金额
|
||||
'loan_price_pure' => $val['loan_price'],
|
||||
|
||||
'loan_price_total' => $val['loan_price_total'],
|
||||
|
||||
'other_in_price' => $srv_json['other_in_price'],
|
||||
'other_out_price' => $srv_json['other_out_price'],
|
||||
'other_price' => $srv_json['other_in_price'] - $srv_json['other_out_price'],
|
||||
|
||||
'srv_price' => $val['srv_price'],
|
||||
'car_price' => $val['car_price'],
|
||||
'dl_car_price' => $val['dl_car_price'],
|
||||
'brand_car_price' => $val['brand_car_price'],
|
||||
|
||||
'need_price' => $need_price,
|
||||
'pay_price' => $pay_price,
|
||||
'if_pay' => $srv_json['if_pay'] == 1 ? '是' : '',
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
$headers = [
|
||||
'owner_name' => array('title'=>'销售信息', 'column_num'=>10), // 从该indexs.key开始合并第一行的单元格数及显示标题
|
||||
'price_floor' => array('title'=>'销售政策', 'column_num'=>3),
|
||||
'company_name' => array('title'=>'采购成本', 'column_num'=>5),
|
||||
'promotion_sale_price' => array('title'=>'促销成本', 'column_num'=>3),
|
||||
'business_product' => array('title'=>'保险收入', 'column_num'=>12),
|
||||
'fee_carno' => array('title'=>'挂牌收入', 'column_num'=>3),
|
||||
'loan_product0' => array('title'=>'首付按揭付款业务', 'column_num'=>12), // 首付按揭-表头, 首付按揭不需要贴息选项,所以少一列
|
||||
'loan_product' => array('title'=>'按揭付款业务', 'column_num'=>13),
|
||||
'other_in_price' => array('title'=>'其他收入及成本', 'column_num'=>3),
|
||||
'need_price' => array('title'=>'收款核对', 'column_num'=>3),
|
||||
];
|
||||
$indexs = [
|
||||
'id' => '序号',
|
||||
'city_name' => '城市',
|
||||
'bill_name' => '开票方',
|
||||
//'biz_type' => 'biz_type',
|
||||
'biz_type_name' => '门店类型',
|
||||
'vin' => '车架号',
|
||||
'brand_name' => '品牌',
|
||||
'series_name' => '车型',
|
||||
'if_usedcar_name' => '二手车',
|
||||
'ori_price' => '指导价',
|
||||
|
||||
'owner_name' => '车主', // 客户名称
|
||||
'admin_name' => '销售顾问',
|
||||
'biz_name' => '门店名称', // 销售归属地
|
||||
'bill_time' => '开票日期',
|
||||
'bill_price' => '开票价', // 开票金额
|
||||
'bill_price_diff' => '实际售价与开票差额',
|
||||
'price' => '实际售价',
|
||||
'price_fine_select' => '选装实收',
|
||||
'sale_price' => '销售收入合计',
|
||||
'order_time' => '订单日期',
|
||||
|
||||
'price_floor' => '商务政策低价', // 商务政策销售价
|
||||
'profix_car_1' => '品牌店分润',
|
||||
'profix_car_1_not' => '渠道分润',
|
||||
|
||||
'company_name' => '车辆归属', // 进货地(车辆归属)
|
||||
'buy_price' => '采购成本',
|
||||
'select_price' => '选装成本', // 选装单金额
|
||||
'labor_price' => '选装工时费',
|
||||
'buy_price_total' => '采购及加装成本合计',
|
||||
|
||||
'promotion_sale_price' => '销售佣金',
|
||||
'promotion_other' => '其他',
|
||||
'promotion_price' => '促销成本合计',
|
||||
|
||||
'factory_price' => '厂家补贴',
|
||||
"car_buy_price" => "整车采购成本",
|
||||
"car_profit_price" => "整车采购毛利",
|
||||
|
||||
"business_product" => "保险公司",
|
||||
"business_price" => "商业险金额",
|
||||
"business_fd" => "商业险返点",
|
||||
"business_ins_price" => "商业险佣金",
|
||||
"insurance_price" => "交强险金额",
|
||||
"insurance_fd" => "交强险返点",
|
||||
"insurance_ins_price" => "交强险佣金",
|
||||
"accident_price" => "意外险金额",
|
||||
"accident_fd" => "意外险返点",
|
||||
"accident_ins_price" => "意外险佣金",
|
||||
"back_price" => "客户退点金额", // 退客户保险退点
|
||||
"insurance_price_pure" => "保险收入合计", // 保险净收入
|
||||
|
||||
'fee_carno' => '挂牌收入',
|
||||
'cb_fee_carno' => '挂牌成本',
|
||||
"fee_carno_price" => "挂牌收入合计",
|
||||
|
||||
'payway_name' => '购车方式',
|
||||
|
||||
// 首付按揭-字段
|
||||
'loan_product0' => '按揭银行',
|
||||
//'loan_is_tiexi0' => '贴息', // 首付按揭不需要贴息选项
|
||||
'loan_num0' => '期数',
|
||||
'loan_price0' => '按揭金额',
|
||||
'loan_fd0' => '按揭返点',
|
||||
'loan_srv_price0' => '按揭佣金',
|
||||
'loan_srv0' => '按揭手续费',
|
||||
'loan_offset_price0' => '解抵服务费',
|
||||
'loan_subsidy_price0' => '利息补贴收入',
|
||||
'commission_price0' => '按揭手续费收入',
|
||||
'loan_in_price0' => '其他收入金额',
|
||||
'loan_out_price0' => '其他支出金额',
|
||||
'loan_price_pure0' => '按揭收入合计',
|
||||
|
||||
'loan_product' => '按揭银行',
|
||||
'loan_is_tiexi' => '贴息',
|
||||
'loan_num' => '期数',
|
||||
'loan_price' => '按揭金额',
|
||||
'loan_fd' => '按揭返点',
|
||||
'loan_srv_price' => '按揭佣金',
|
||||
'loan_srv' => '按揭手续费',
|
||||
'loan_offset_price' => '解抵服务费',
|
||||
'loan_subsidy_price' => '利息补贴收入',
|
||||
'commission_price' => '按揭手续费收入',
|
||||
'loan_in_price' => '其他收入金额',
|
||||
'loan_out_price' => '其他支出金额',
|
||||
'loan_price_pure' => '按揭收入合计',
|
||||
|
||||
'loan_price_total' => '按揭收入总合计',
|
||||
|
||||
'other_in_price' => '其他收入',
|
||||
'other_out_price' => '其他支出',
|
||||
'other_price' => '其他合计',
|
||||
|
||||
'srv_price' => '水平业务总毛利',
|
||||
'car_price' => '单车总毛利',
|
||||
'dl_car_price' => '门店单车毛利',
|
||||
'brand_car_price' => '品牌单车总毛利',
|
||||
|
||||
'need_price' => '应收款金额',
|
||||
'pay_price' => '已收款金额',
|
||||
'if_pay' => '是否齐款',
|
||||
|
||||
];
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
#$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
|
||||
$sheet_title = $fileName;
|
||||
$filename = $fileName.'_' . date('YmdHis');
|
||||
$this->excel->excel2($data, $indexs, $headers, $sheet_title, $filename);
|
||||
}
|
||||
|
||||
// export old
|
||||
public function export_(){
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$data = $indexs = array();
|
||||
$fileName = '整车成本';
|
||||
$where = [];
|
||||
$count = $this->items_cost_model->count($where);
|
||||
if($count){
|
||||
$rows = $this->items_cost_model->select($where,'id desc',$params['page'],$params['size']);
|
||||
$item_ids = implode(',',array_column($rows,'item_id'));
|
||||
$map_item = $item_rows = [];
|
||||
if($item_ids){
|
||||
$where = ["id in ($item_ids)" => null];
|
||||
$item_rows = $this->items_model->select($where,'','','','id,brand_id,s_id,v_id,vin');
|
||||
foreach ($item_rows as $item) {
|
||||
$map_item[$item['id']] = $item;
|
||||
}
|
||||
}
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($item_rows, 'brand_id'));
|
||||
$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//车系车型
|
||||
$series_arr = array_unique(array_column($item_rows, 's_id'));
|
||||
$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
|
||||
//获取属性
|
||||
$v_arr = array_unique(array_column($item_rows, 'v_id'));
|
||||
$cor_arr = array_unique(array_column($item_rows, 'cor_id'));
|
||||
$incor_arr = array_unique(array_column($item_rows, 'incor_id'));
|
||||
$attr_arr = array_merge($v_arr, $cor_arr, $incor_arr);
|
||||
$attr = $this->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
|
||||
foreach ($rows as $key => $val) {
|
||||
$item = $map_item[$val['item_id']];
|
||||
$brand_name = isset($brands[$item['brand_id']]) ? $brands[$item['brand_id']][0]['name'] : '';
|
||||
$series_name = isset($series[$item['s_id']]) ? $series[$item['s_id']][0]['name'] : '';
|
||||
$v_name = isset($attr[$item['v_id']]) ? $attr[$item['v_id']][0]['title'] : '';
|
||||
$data[] = [
|
||||
'id' => $val['id'],
|
||||
'title' => "{$brand_name} {$series_name} {$v_name}",
|
||||
'vin' => $item['vin'],
|
||||
'sale_price' => $val['sale_price'],
|
||||
'buy_price' => $val['buy_price'],
|
||||
'promotion_price' => $val['promotion_price'],
|
||||
'car_buy_price' => $val['car_buy_price'],
|
||||
'car_profit_price' => $val['car_profit_price'],
|
||||
'insurance_price' => $val['insurance_price'],
|
||||
'fee_carno_price' => $val['fee_carno_price'],
|
||||
'loan_price' => $val['loan_price'],
|
||||
'srv_price' => $val['srv_price'],
|
||||
'car_price' => $val['car_price'],
|
||||
];
|
||||
}
|
||||
}
|
||||
$indexs = [
|
||||
'title' => '车辆',
|
||||
'vin' => '车架号',
|
||||
'sale_price' => '销售收入合计',
|
||||
'buy_price' => '采购及加装成本合计',
|
||||
"promotion_price" => "促销成本合计",
|
||||
"car_buy_price" => "整车采购成本",
|
||||
"car_profit_price" => "整车采购毛利",
|
||||
"insurance_price" => "保险收入合计",
|
||||
"fee_carno_price" => "挂牌收入合计",
|
||||
"loan_price" => "按揭收入合计",
|
||||
"srv_price" => "水平业务总毛利 ",
|
||||
"car_price" => "单车总毛利",
|
||||
];
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:上传excel
|
||||
* Created on: 2021/7/14 15:06
|
||||
* Created by: dengbw
|
||||
* @return array
|
||||
*/
|
||||
private function upload()
|
||||
{
|
||||
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
|
||||
$config['allowed_types'] = '*';//xls|xlsx
|
||||
$config['max_size'] = 5 * 1024;
|
||||
$config['file_name'] = 'items_' . time() . rand(1, 99999);
|
||||
$this->load->library('upload', $config);
|
||||
if (!$this->upload->do_upload('file')) {
|
||||
return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', ''));
|
||||
} else {
|
||||
$data = $this->upload->data();
|
||||
return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,9 @@ class Inventory extends HD_Controller
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = [];
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['title'] = '盘点时间_' . date('Y-m-d', $value['c_time']);
|
||||
$jsondata = $value['jsondata'] ? json_decode($value['jsondata'], true) : array();
|
||||
$city_name = $jsondata['city_name'] ? '_'.$jsondata['city_name'] : '';
|
||||
$setValue['title'] = '盘点时间_' . date('Y-m-d', $value['c_time']).$city_name;
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
@@ -69,21 +71,21 @@ class Inventory extends HD_Controller
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车辆盘点不存在!');
|
||||
}
|
||||
$lists = $where = [];
|
||||
$lists = [];
|
||||
$where['lc_items_inventory_log.inve_id'] = $params['inve_id'];
|
||||
if (strlen($params['status'])) {
|
||||
$where['lc_items_inventory_log.status'] = $params['status'];
|
||||
} else {
|
||||
$params['lc_items_inventory_log.status in(0,1)'] = null;
|
||||
$where['lc_items_inventory_log.status in(0,1)'] = null;
|
||||
$params['status'] = '-99';
|
||||
}
|
||||
if ($params['biz_id']) {
|
||||
if ($params['biz_id'] > 0) {
|
||||
$where['lc_items_inventory_log.biz_id'] = $params['biz_id'];
|
||||
}
|
||||
if ($params['biz_id'] == -1 && $params['addr_id']) {
|
||||
} else if ($params['biz_id'] == -1 && $params['addr_id']) {
|
||||
$where['lc_items_inventory_log.addr_id'] = $params['addr_id'];
|
||||
} else if ($params['city_id']) {
|
||||
$where_biz['status'] = 1;
|
||||
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
|
||||
$where_biz['city_id'] = $params['city_id'];
|
||||
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
|
||||
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
$res_addr = $this->addr_model->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
@@ -106,6 +108,10 @@ class Inventory extends HD_Controller
|
||||
$params['addr_id'] = '';
|
||||
$params['biz_id'] = '';
|
||||
}
|
||||
$params['brand_id'] && $where['lc_items.brand_id'] = $params['brand_id'];
|
||||
$params['s_id'] && $where['lc_items.s_id'] = $params['s_id'];
|
||||
$params['v_id'] && $where['lc_items.v_id'] = $params['v_id'];
|
||||
$params['cor_id'] && $where['lc_items.cor_id'] = $params['cor_id'];
|
||||
if ($params['item_status']) {
|
||||
if ($params['item_status'] == 3) {
|
||||
$where["lc_items.bill_time<>"] = '0000-00-00 00:00:00';
|
||||
@@ -121,7 +127,7 @@ class Inventory extends HD_Controller
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
$statusAry = $this->mdInventoryLog->statusAry();
|
||||
$carImgAry = $this->mdInventoryLog->carImgAry();
|
||||
@@ -186,6 +192,7 @@ class Inventory extends HD_Controller
|
||||
$map_addr[$v['id']] = "{$v['city_name']} {$v['county_name']} 其它 {$v['title']}";
|
||||
}
|
||||
}
|
||||
$row_id = 0;
|
||||
foreach ($res as $key => $v) {
|
||||
$address = $mileage = $itemStatus_name = $car_img = $where_logs = '';
|
||||
if ($v['biz_id'] > 0) {
|
||||
@@ -213,20 +220,38 @@ class Inventory extends HD_Controller
|
||||
}
|
||||
$jsondata = $v['jsondata'] ? json_decode($v['jsondata'], true) : [];
|
||||
$jsondata['mileage'] && $mileage = $jsondata['mileage'];
|
||||
if ($jsondata['car_img']) {
|
||||
/*if ($jsondata['car_img']) {
|
||||
foreach ($carImgAry as $key2 => $value2) {
|
||||
$src = $jsondata['car_img'][$key2];
|
||||
$src && $car_img[] = ['title' => $value2, 'src' => build_qiniu_image_url($src)];
|
||||
}
|
||||
}*/
|
||||
$car_img_layer = $car_img = array();
|
||||
if ($jsondata['car_img']) {
|
||||
$car_img_layer['title'] = '';
|
||||
$car_img_layer['id'] = $v['item_id'];
|
||||
$car_img_layer['start'] = 0;
|
||||
$data = array();
|
||||
$pid = 0;
|
||||
foreach ($carImgAry as $key2 => $value2) {
|
||||
$src = $jsondata['car_img'][$key2];
|
||||
$src && $src = build_qiniu_image_url($src);
|
||||
$src && $data[] = ['alert' => $value2, 'pid' => $pid, 'src' => $src, 'thumb' => $src];
|
||||
$src && $car_img[] = ['title' => $value2, 'pid' => $pid, 'src' => $src];
|
||||
$src && $pid += 1;
|
||||
}
|
||||
$data && $car_img_layer['data'] = $data;
|
||||
}
|
||||
|
||||
$in_time = $v['in_time'];
|
||||
if ($where_logs) {
|
||||
$re_logs = $this->mdItemsOplogs->max('com_time', $where_logs);
|
||||
$re_logs['com_time'] && $in_time = $re_logs['com_time'];
|
||||
}
|
||||
$lists[] = ['item_id' => $v['item_id'], 'title' => $title, 'vin' => $v['vin'], 'address' => $address,
|
||||
'itemStatus_name' => $itemStatus_name, 'status_name' => $statusAry[$v['status']], 'mileage' => $mileage, 'car_img' => $car_img,
|
||||
$lists[] = ['row_id' => $row_id, 'item_id' => $v['item_id'], 'title' => $title, 'vin' => $v['vin'], 'address' => $address,
|
||||
'itemStatus_name' => $itemStatus_name, 'status_name' => $statusAry[$v['status']], 'mileage' => $mileage, 'car_img' => $car_img, 'car_img_layer'=>$car_img_layer,
|
||||
'in_time' => '0000-00-00 00:00:00' == $in_time ? '' : substr($in_time, 0, 10)];
|
||||
$row_id += 1;
|
||||
}
|
||||
}
|
||||
$this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
||||
@@ -244,12 +269,33 @@ class Inventory extends HD_Controller
|
||||
|
||||
public function add()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
$city_id = $params['city_id'] ? intval($params['city_id']) : 0;
|
||||
$force = $params['force'] ? intval($params['force']) : 0;
|
||||
# 如果当前(该月)有相同的盘点任务,再弹窗确认是否继续发起
|
||||
$starttime = mktime(0,0,0, date('m'),1, date('Y'));
|
||||
$endtime = mktime(23,59,59, date('m'),date('t'), date('Y'));
|
||||
$where = array('city_id' => $city_id, "c_time >= {$starttime}" => null, "c_time <= {$endtime}" => null);
|
||||
$res = $this->mdInventory->count($where);
|
||||
if (!$force && $res){
|
||||
return $this->show_json(-1, '本月已有此盘点,确认要重新发起吗?');
|
||||
}
|
||||
$c_time = time();
|
||||
$inve_id = $this->mdInventory->add(['c_time' => $c_time]);
|
||||
#$inve_id = $this->mdInventory->add(['c_time' => $c_time]);
|
||||
$jsondata = json_encode(array('city_name'=> $params['city_id'] && $params['city_name'] ? $params['city_name'] : ''));
|
||||
$inve_id = $this->mdInventory->add(['c_time' => $c_time, 'city_id' => $city_id, 'jsondata' => $jsondata]);
|
||||
if (!$inve_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '发起盘点失败');
|
||||
}
|
||||
$where = array('status>' => 0, 'bill_time' => '0000-00-00 00:00:00');
|
||||
if ($city_id){
|
||||
$where_biz['city_id'] = $params['city_id'];
|
||||
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
$res_addr = $this->addr_model->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
$str_ids = $res_biz ? implode(',', array_column($res_biz, 'id')) : '-2';
|
||||
$str_addr_ids = $res_addr ? implode(',', array_column($res_addr, 'id')) : '-2';
|
||||
$where["(biz_id in ({$str_ids}) or addr_id in ({$str_addr_ids}))"] = null;
|
||||
}
|
||||
$res = $this->mdItems->select($where, 'id asc', 0, 0, 'id,biz_id,addr_id');
|
||||
$addDate = [];
|
||||
foreach ($res as $key => $value) {
|
||||
|
||||
@@ -37,6 +37,7 @@ class Stock extends HD_Controller
|
||||
} else {
|
||||
$order = "id desc";
|
||||
}
|
||||
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
|
||||
if ($params['brand_id']) {
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
}
|
||||
@@ -69,7 +70,8 @@ class Stock extends HD_Controller
|
||||
$time[0] && $where["log_date>="] = $time[0];
|
||||
$time[1] && $where["log_date<="] = $time[1];
|
||||
}
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), "id desc", 0, 0, 'id,name');
|
||||
//$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), "id desc", 0, 0, 'id,name');
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
|
||||
if ($params['brand_id']) {
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
@@ -125,6 +127,173 @@ class Stock extends HD_Controller
|
||||
$this->show_view('items/stock/lists', true);
|
||||
}
|
||||
|
||||
public function get_month()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$this->data = $this->monthSelect($params);
|
||||
$this->show_view('items/stock/get_month', true);
|
||||
}
|
||||
|
||||
public function export_month()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['export'] = 1;
|
||||
$data = $indexs = array();
|
||||
$res = $this->monthSelect($params);
|
||||
$fileName = $res['_title'];
|
||||
foreach ($res['biz'] as $k => $v) {
|
||||
$data[] = $v;
|
||||
}
|
||||
$indexs = ['biz_name' => '门店'];
|
||||
foreach ($res['date_months'] as $v) {
|
||||
$month = date('Y年m月', strtotime($v));
|
||||
$indexs[$v] = $month;
|
||||
}
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
private function monthSelect($params)
|
||||
{
|
||||
$type_ary = $this->mdBiz->type_ary();
|
||||
$params['type'] = $params['type'] ? $params['type'] : '';
|
||||
$typeStr = '1,2,3';//品牌 合伙 代理
|
||||
$typeAry = [];
|
||||
foreach ($type_ary as $k => $v) {
|
||||
if (strstr($typeStr . ',', $k . ',')) {
|
||||
$typeAry[$k] = $v;
|
||||
}
|
||||
}
|
||||
$biz = $res_biz = $date_months = $dateMonths = [];
|
||||
if ($params['type'] || $params['biz_id'] || $params['city_id']) {
|
||||
$start_date = date('Y-m', strtotime("-11 month"));//取最近12个月
|
||||
$end_date = date('Y-m');
|
||||
$date_months = $this->dateMonths($start_date, $end_date);
|
||||
rsort($date_months);
|
||||
foreach ($date_months as $v) {
|
||||
$firstDay = $v . '-01' . ' 00:00:00';
|
||||
$lastDay = date('Y-m-d', strtotime("$firstDay +1 month -1 day"));
|
||||
$dateMonths[] = ['name' => $v, 'firstDay' => $v . '-01', 'lastDay' => $lastDay];
|
||||
}
|
||||
$type = $params['type'] ? $params['type'] : $typeStr;
|
||||
$where_biz['status'] = 1;
|
||||
$where_biz["type in({$type})"] = null;
|
||||
if ($params['biz_id']) {
|
||||
$where_biz['id'] = $params['biz_id'];
|
||||
} else {
|
||||
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
|
||||
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
|
||||
}
|
||||
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id,biz_name');
|
||||
foreach ($res_biz as $v) {
|
||||
$months = [];
|
||||
if ($params['export'] == 1) {
|
||||
$months['biz_name'] = $v['biz_name'];
|
||||
}
|
||||
foreach ($dateMonths as $v2) {
|
||||
$where2 = $where3 = ['biz_id' => $v['id'], 'log_date>=' => $v2['firstDay'], 'log_date<=' => $v2['lastDay']];
|
||||
$res_log = $this->mdStockLog->select_groupby('s_id', $where2, 'id desc', 0, 0, 'brand_id,s_id');
|
||||
$data_month = '';
|
||||
if ($res_log) {
|
||||
$str_ids = implode(',', array_unique(array_column($res_log, 'brand_id')));
|
||||
$map_brand = $this->mdAutoBrand->map('id', 'name', ["id in ({$str_ids})" => null]);
|
||||
$str_ids = implode(',', array_unique(array_column($res_log, 's_id')));
|
||||
$map_sery = $this->mdAutoSeries->map('id', 'name', ["id in ({$str_ids})" => null]);
|
||||
foreach ($res_log as $v3) {
|
||||
$where3['s_id'] = $v3['s_id'];
|
||||
$res_log2 = $this->mdStockLog->select_groupby('item_id', $where3, "total desc,id desc", 1, 1
|
||||
, "count(id) as total");
|
||||
$count = $res_log2 ? $res_log2[0]['total'] : 0;
|
||||
$title = "{$map_brand[$v3['brand_id']]}-{$map_sery[$v3['s_id']]} {$count}天";
|
||||
$data_month = $data_month ? $data_month . ',' . $title : $title;
|
||||
}
|
||||
}
|
||||
if ($params['export'] == 1) {
|
||||
$months[$v2['name']] = $data_month;
|
||||
} else {
|
||||
$months[] = ['name' => $v2['name'], 'data' => $data_month];
|
||||
}
|
||||
}
|
||||
if ($params['export'] == 1) {
|
||||
$biz[] = $months;
|
||||
} else {
|
||||
$biz[] = ['biz_name' => $v['biz_name'], 'months' => $months];
|
||||
}
|
||||
}
|
||||
}
|
||||
!$params['city_id'] && $params['city_id'] = '';
|
||||
!$params['county_id'] && $params['county_id'] = '';
|
||||
!$params['biz_id'] && $params['biz_id'] = '';
|
||||
$showData['typeAry'] = $typeAry;
|
||||
$showData['typeStr'] = $typeStr;
|
||||
$data['showData'] = $showData;
|
||||
$data['biz'] = $biz;
|
||||
$data['date_months'] = $date_months;
|
||||
$data['params'] = $params;
|
||||
$data['_title'] = '库存统计';
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:计算出两个日期之间的月份
|
||||
* Created on: 2022/8/9 14:38
|
||||
* Created by: dengbw
|
||||
* @param $start_date [开始日期,如2022-03]
|
||||
* @param $end_date [结束日期,如2022-12]
|
||||
* @param string $explode [年份和月份之间分隔符,此例为 - ]
|
||||
* @param bool $addOne [算取完之后最后是否加一月,用于算取时间戳用]
|
||||
* @return array [返回是两个月份之间所有月份字符串]
|
||||
*/
|
||||
private function dateMonths($start_date, $end_date, $explode = '-', $addOne = false)
|
||||
{
|
||||
//判断两个时间是不是需要调换顺序
|
||||
$start_int = strtotime($start_date);
|
||||
$end_int = strtotime($end_date);
|
||||
if ($start_int > $end_int) {
|
||||
$tmp = $start_date;
|
||||
$start_date = $end_date;
|
||||
$end_date = $tmp;
|
||||
}
|
||||
|
||||
//结束时间月份+1,如果是13则为新年的一月份
|
||||
$start_arr = explode($explode, $start_date);
|
||||
$start_year = intval($start_arr[0]);
|
||||
$start_month = intval($start_arr[1]);
|
||||
|
||||
$end_arr = explode($explode, $end_date);
|
||||
$end_year = intval($end_arr[0]);
|
||||
$end_month = intval($end_arr[1]);
|
||||
|
||||
$data = array();
|
||||
$data[] = $start_date;
|
||||
|
||||
$tmp_month = $start_month;
|
||||
$tmp_year = $start_year;
|
||||
|
||||
//如果起止不相等,一直循环
|
||||
while (!(($tmp_month == $end_month) && ($tmp_year == $end_year))) {
|
||||
$tmp_month++;
|
||||
//超过十二月份,到新年的一月份
|
||||
if ($tmp_month > 12) {
|
||||
$tmp_month = 1;
|
||||
$tmp_year++;
|
||||
}
|
||||
$data[] = $tmp_year . $explode . str_pad($tmp_month, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
if ($addOne == true) {
|
||||
$tmp_month++;
|
||||
//超过十二月份,到新年的一月份
|
||||
if ($tmp_month > 12) {
|
||||
$tmp_month = 1;
|
||||
$tmp_year++;
|
||||
}
|
||||
$data[] = $tmp_year . $explode . str_pad($tmp_month, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function get()
|
||||
{
|
||||
|
||||
@@ -39,12 +39,13 @@ class Transfer extends HD_Controller
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$re = $this->dataSelect($params);
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
//$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
|
||||
if ($params['brand_id']) {
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
$total = $re['total'];
|
||||
$this->data['params'] = $re['params'];
|
||||
@@ -89,15 +90,15 @@ class Transfer extends HD_Controller
|
||||
if ($params['out_type'] == 2) {
|
||||
$params['out_admin_id'] && $where['out_uid'] = $params['out_admin_id'];
|
||||
if ($params['out_addr_id']) {
|
||||
$where['addr_id'] = $params['out_addr_id'];
|
||||
$where['out_type'] = $params['out_type'];
|
||||
$where["id in (select distinct(tran_id) from lc_items_transfer_admin where type in(1,2) and addr_id={$params['out_addr_id']})"] = null;
|
||||
} else {
|
||||
$params['out_addr_id'] = '';
|
||||
}
|
||||
} else {
|
||||
if ($params['out_uid']) {
|
||||
$where['out_uid'] = $params['out_uid'];
|
||||
$where['out_type'] = $params['out_type'];
|
||||
} else if ($params['out_biz_id']) {
|
||||
$where["id in (select distinct(tran_id) from lc_items_transfer_remind where type in(1,2) and biz_id={$params['out_biz_id']})"] = null;
|
||||
} else {
|
||||
$params['out_uid'] = '';
|
||||
}
|
||||
@@ -114,14 +115,14 @@ class Transfer extends HD_Controller
|
||||
$params['in_admin_id'] && $where['in_uid'] = $params['in_admin_id'];
|
||||
if ($params['in_addr_id']) {
|
||||
$where['addr_id'] = $params['in_addr_id'];
|
||||
$where['in_type'] = $params['in_type'];
|
||||
} else {
|
||||
$params['in_addr_id'] = '';
|
||||
}
|
||||
} else {
|
||||
if ($params['in_uid']) {
|
||||
$where['in_uid'] = $params['in_uid'];
|
||||
$where['in_type'] = $params['in_type'];
|
||||
} else if ($params['in_biz_id']) {
|
||||
$where['biz_id'] = $params['in_biz_id'];
|
||||
} else {
|
||||
$params['in_uid'] = '';
|
||||
}
|
||||
@@ -151,6 +152,12 @@ class Transfer extends HD_Controller
|
||||
$in_time[0] && $where["in_time >="] = $in_time[0] . ' 00:00:00';
|
||||
$in_time[1] && $where["in_time <="] = $in_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['c_time']) {
|
||||
$c_time = explode(' ~ ', $params['c_time']);
|
||||
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
$c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
}
|
||||
$where['item_id in (select id from lc_items where brand_id in (select id from lc_auto_brand where status > -1))'] = null;
|
||||
$total = $this->mdTransfer->count($where);
|
||||
$lists = array();
|
||||
if ($total) {
|
||||
@@ -238,6 +245,7 @@ class Transfer extends HD_Controller
|
||||
$trailer_fees .= '-' . $re_biz['biz_name'];
|
||||
}
|
||||
$setValue['fees'] = $trailer_fees;
|
||||
$setValue['settlement'] = in_array('settlement', array_keys($jsondata)) ? $jsondata['settlement'] : '';
|
||||
$setValue['reason'] = $jsondata['reason'] ? $jsondata['reason'] : '';
|
||||
}
|
||||
$lists[] = $setValue;
|
||||
@@ -358,6 +366,7 @@ class Transfer extends HD_Controller
|
||||
}
|
||||
$abnormal['imgs'] = $imgs;
|
||||
}
|
||||
$jsondata['settlement'] && $fields[] = ['title' => '调拨结算价', 'value' => $jsondata['settlement']]; # 23.04.20 新增一个字段 调拨结算价
|
||||
$jsondata['reason'] && $fields[] = ['title' => '调拨理由', 'value' => $jsondata['reason']];
|
||||
if ($re['trailer_fees']) {
|
||||
$trailer_fees = $re['trailer_fees'] ? $re['trailer_fees'] . '元' : '';
|
||||
@@ -388,7 +397,7 @@ class Transfer extends HD_Controller
|
||||
$view = 'items/transfer/get_add';
|
||||
$showInfo = ['vin' => $vin, 'items_info' => ['id' => 0, 'title' => '', 'vin' => '', 'cor' => '', 'address' => ''],
|
||||
'feesTypeAry' => $this->mdTransfer->feesTypeAry(), 'feesBizList' => [], 'uidTypeAry' => $this->mdTransfer->uidTypeAry()];
|
||||
$info = ['id' => 0, 'status' => -1, 'item_id' => 0, 'arti_id' => [], 'out_bak' => 0, 'in_bak' => 0, 'trailer_fees' => '', 'fees_city' => '', 'trailer_fees' => 0,
|
||||
$info = ['id' => 0, 'status' => -1, 'item_id' => 0, 'arti_id' => [], 'out_bak' => 0, 'in_bak' => 0, 'settlement' => 0, 'trailer_fees' => '', 'fees_city' => '', 'trailer_fees' => 0,
|
||||
'fees_type' => 1, 'fees_biz_id' => '', 'transport' => ['name' => '', 'mobile' => '', 'cardid' => ''], 'reason' => ''];
|
||||
$this->data['transports'] = $this->transports(['type' => 'get']);//运输人员
|
||||
$this->data['showInfo'] = $showInfo;
|
||||
@@ -408,9 +417,10 @@ class Transfer extends HD_Controller
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车辆调拨不存在!');
|
||||
}
|
||||
if ($re['status'] == 2) {
|
||||
// 2022.12.20 原来 确认接车 的状态 不能再修改调拨单,现在需要把这个限制去掉,所有状态都允许修改
|
||||
/*if ($re['status'] == 2) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车辆已调拨完成,不能修改!');
|
||||
}
|
||||
}*/
|
||||
$item_id = $re['item_id'] ? $re['item_id'] : 0;
|
||||
$re_items = $this->mdItems->get(['id' => $item_id]);
|
||||
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
|
||||
@@ -419,6 +429,7 @@ class Transfer extends HD_Controller
|
||||
$info = ['id' => $id, 'status' => $re['status'], 'out_bak' => 0, 'in_bak' => 0
|
||||
, 'item_id' => $item_id
|
||||
, 'arti_id' => $re['arti_id'] ? explode(',', $re['arti_id']) : []
|
||||
, 'settlement' => in_array('settlement', array_keys($jsondata)) ? $jsondata['settlement'] : ''
|
||||
, 'trailer_fees' => $re['trailer_fees'] ? $re['trailer_fees'] : ''
|
||||
, 'fees_city' => $re['fees_city'] ? $re['fees_city'] : ''
|
||||
, 'fees_type' => $re['fees_type']
|
||||
@@ -513,6 +524,24 @@ class Transfer extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '短信提醒成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 货物物流信息测试
|
||||
* @return array
|
||||
*/
|
||||
public function get_aliwuliu(){
|
||||
$no = $this->input->get('no');
|
||||
/*if (!$no) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '快递单号不能为空【顺丰和丰网请输入单号 : 收件人或寄件人手机号后四位。例如:123456789:1234】');
|
||||
}*/
|
||||
$type = $this->input->get('type');
|
||||
|
||||
$this->load->library('AliWuliu');
|
||||
$res = $this->aliwuliu->kdi($no, $type, $debug=false);
|
||||
print(json_encode($res));
|
||||
#var_dump($res);var_dump($res['status']);var_dump($res['msg']);
|
||||
#var_dump($res['result']['number']);var_dump($res['result']['type']);var_dump($res['result']['deliverystatus']);var_dump($res['result']['issign']);var_dump($res['result']['expName']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/修改调拨
|
||||
* @return bool
|
||||
@@ -521,22 +550,32 @@ class Transfer extends HD_Controller
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
$takeCar = $this->input->post('takeCar');
|
||||
$settlement = $info['settlement'];
|
||||
if ($settlement == '' && $settlement != '0'){
|
||||
return $this->show_json(SYS_CODE_FAIL, '调拨结算价不能为空!');
|
||||
}
|
||||
$settlement = intval($settlement);
|
||||
$trailer_fees = intval($info['trailer_fees']);
|
||||
$remind = $info['remind'];//1提交
|
||||
$db_status = -1;
|
||||
$db_status_not2_flag = true;
|
||||
$jsondata_old = array();
|
||||
if ($info['id']) {//修改调拨
|
||||
$re_t = $this->mdTransfer->get(array('id' => $info['id']));
|
||||
if (!$re_t || empty($re_t)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车辆调拨不存在!');
|
||||
}
|
||||
$jsondata_old = $re_t['jsondata'] ? json_decode($re_t['jsondata'], true) : [];
|
||||
$db_status = $re_t['status'];
|
||||
if ($db_status == 2) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车辆已完成调拨,不能修改!');
|
||||
$db_status_not2_flag = false; // 2022.12.20 “确认接车”状态的数据,修改提交后:不改状态,不发短信
|
||||
#return $this->show_json(SYS_CODE_FAIL, '车辆已完成调拨,不能修改!');
|
||||
}
|
||||
}
|
||||
if ($remind && $db_status == -1) {//提交且状态为-1时,状态设为0调拨
|
||||
$db_status = 0;
|
||||
}
|
||||
!$db_status_not2_flag && $db_status = 2; // 2022.12.20 “确认接车”状态的数据,修改提交后:不改状态,不发短信
|
||||
if ($remind == 1) {//提交时加判断
|
||||
if (!$info['arti_id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择随车物品');
|
||||
@@ -584,7 +623,18 @@ class Transfer extends HD_Controller
|
||||
if ($re && $re['id'] != $info['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '操作失败,车辆正在调拨中...');
|
||||
}
|
||||
$jsondata['transport'] = $info['transport'];//运输人员
|
||||
$jsondata['settlement'] = $settlement;
|
||||
if ($info['id']){
|
||||
# 23.04.20修复:修改时丢失除"name", "cardid", "mobile"数据情况
|
||||
$transport = $jsondata_old['transport'] ? $jsondata_old['transport'] : [];
|
||||
$transport['name'] = $info['transport']['name'];
|
||||
$transport['cardid'] = $info['transport']['cardid'];
|
||||
$transport['mobile'] = $info['transport']['mobile'];
|
||||
$jsondata['transport'] = $transport;
|
||||
}
|
||||
else{
|
||||
$jsondata['transport'] = $info['transport'];//运输人员
|
||||
}
|
||||
$jsondata['reason'] = $info['reason'];//调拨理由
|
||||
$c_time = time();
|
||||
if ($takeCar[3]['type'] == 2) {//接收信息员
|
||||
@@ -676,22 +726,13 @@ class Transfer extends HD_Controller
|
||||
$this->mdTransferRemind->delete(['tran_id' => $id, 'type' => 2]);//删除已有备用提车人
|
||||
}
|
||||
}
|
||||
//接车人
|
||||
$results = $this->edit_remind_admin(['type' => 3, 'tran_id' => $id, 'c_time' => $c_time, 'db_status' => $db_status], $takeCar[3]);
|
||||
if ($results['add'] == 1) {
|
||||
if ($takeCar[3]['type'] == 2) {
|
||||
$results['uid'] && $send_admins[] = $results['uid'];
|
||||
$addAdmin[] = $results['addDate'];
|
||||
} else {
|
||||
$results['uid'] && $send_uids[] = $results['uid'];
|
||||
$addRemind[] = $results['addDate'];
|
||||
}
|
||||
}
|
||||
//备用接车人
|
||||
if ($info['in_bak'] == 1) {
|
||||
$results = $this->edit_remind_admin(['type' => 4, 'tran_id' => $id, 'c_time' => $c_time, 'db_status' => $db_status], $takeCar[4]);
|
||||
|
||||
// 2022.12.20 “确认接车”状态的数据,修改提交后:不改状态,不发短信
|
||||
if ($db_status_not2_flag){
|
||||
//接车人
|
||||
$results = $this->edit_remind_admin(['type' => 3, 'tran_id' => $id, 'c_time' => $c_time, 'db_status' => $db_status], $takeCar[3]);
|
||||
if ($results['add'] == 1) {
|
||||
if ($takeCar[4]['type'] == 2) {
|
||||
if ($takeCar[3]['type'] == 2) {
|
||||
$results['uid'] && $send_admins[] = $results['uid'];
|
||||
$addAdmin[] = $results['addDate'];
|
||||
} else {
|
||||
@@ -699,9 +740,22 @@ class Transfer extends HD_Controller
|
||||
$addRemind[] = $results['addDate'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->mdTransferAdmin->delete(['tran_id' => $id, 'type' => 4]);//删除已有备用接车人
|
||||
$this->mdTransferRemind->delete(['tran_id' => $id, 'type' => 4]);//删除已有备用接车人
|
||||
//备用接车人
|
||||
if ($info['in_bak'] == 1) {
|
||||
$results = $this->edit_remind_admin(['type' => 4, 'tran_id' => $id, 'c_time' => $c_time, 'db_status' => $db_status], $takeCar[4]);
|
||||
if ($results['add'] == 1) {
|
||||
if ($takeCar[4]['type'] == 2) {
|
||||
$results['uid'] && $send_admins[] = $results['uid'];
|
||||
$addAdmin[] = $results['addDate'];
|
||||
} else {
|
||||
$results['uid'] && $send_uids[] = $results['uid'];
|
||||
$addRemind[] = $results['addDate'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->mdTransferAdmin->delete(['tran_id' => $id, 'type' => 4]);//删除已有备用接车人
|
||||
$this->mdTransferRemind->delete(['tran_id' => $id, 'type' => 4]);//删除已有备用接车人
|
||||
}
|
||||
}
|
||||
} else {//新增提车人/接车人
|
||||
//提车人
|
||||
@@ -745,9 +799,9 @@ class Transfer extends HD_Controller
|
||||
}
|
||||
$item_info = $this->input->post('items_info');
|
||||
//门店调拨短信提醒
|
||||
$this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info, 'tran_id' => $id]);
|
||||
$db_status_not2_flag && $this->send_alisms(['uids' => $send_uids, 'type' => 1, 'item_info' => $item_info, 'tran_id' => $id]);
|
||||
//信息员调拨短信提醒
|
||||
$this->send_alisms(['uids' => $send_admins, 'type' => 2, 'item_info' => $item_info]);
|
||||
$db_status_not2_flag && $this->send_alisms(['uids' => $send_admins, 'type' => 2, 'item_info' => $item_info]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '提交成功', "/items/transfer");
|
||||
}
|
||||
|
||||
@@ -988,6 +1042,7 @@ class Transfer extends HD_Controller
|
||||
$temp['in_addr_name'] = $value['in_addr_name'];
|
||||
$temp['abnormal'] = $value['abnormal'];
|
||||
$temp['status_name'] = $value['status_name'];
|
||||
$temp['settlement'] = $value['settlement'];
|
||||
$temp['trailer_fees'] = $value['trailer_fees'];
|
||||
$temp['fees'] = $value['fees'];
|
||||
$temp['reason'] = $value['reason'];
|
||||
@@ -1005,6 +1060,7 @@ class Transfer extends HD_Controller
|
||||
'in_addr_name' => '存放地址',
|
||||
"abnormal" => "异常",
|
||||
"status_name" => "状态",
|
||||
"settlement" => "调拨结算价",
|
||||
"trailer_fees" => "运输费用",
|
||||
"fees" => "费用承担方",
|
||||
"reason" => "调拔理由",
|
||||
|
||||
@@ -32,8 +32,16 @@ class Goods extends HD_Controller
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$this->data = $this->dataSelect($params);
|
||||
$view = $this->data['view'];
|
||||
return $this->show_view($view, true);
|
||||
}
|
||||
|
||||
private function dataSelect($params){
|
||||
$page = $params['page'];
|
||||
$size = $params['size'];
|
||||
$where = array('id<>1' => null, 'status>' => 0);
|
||||
$where_1 = $where_2 = $where_3 = array('m.id<>1' => null);
|
||||
$autoList = array();
|
||||
@@ -58,14 +66,24 @@ class Goods extends HD_Controller
|
||||
$where_1['brand_id'] = $params['brand_id'];
|
||||
$where_2['m.brand_id'] = $params['brand_id'];
|
||||
$where_3['m.brand_id'] = $params['brand_id'];
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
if (1 == $params['sold']){
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status > -1' => null, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
else{
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$where['s_id'] = $params['s_id'];
|
||||
$where_1['s_id'] = $params['s_id'];
|
||||
$where_2['m.s_id'] = $params['s_id'];
|
||||
$where_3['m.s_id'] = $params['s_id'];
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
if (1 == $params['sold']){
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status > -1' => null, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
else{
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where['v_id'] = $params['v_id'];
|
||||
@@ -148,6 +166,10 @@ class Goods extends HD_Controller
|
||||
$where_3["m.bill_time<>'0000-00-00 00:00:00'"] = null;
|
||||
$view = '/items/goods/lists_sold';
|
||||
$_title = '已售车辆';
|
||||
$where['brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
$where_1['brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
$where_2['m.brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
$where_3['m.brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
} else {
|
||||
$where["bill_time"] = '0000-00-00 00:00:00';
|
||||
$where_1["m.bill_time"] = '0000-00-00 00:00:00';
|
||||
@@ -155,6 +177,10 @@ class Goods extends HD_Controller
|
||||
$where_3["m.bill_time"] = '0000-00-00 00:00:00';
|
||||
$view = '/items/goods/lists';
|
||||
$_title = '库存车辆';
|
||||
$where['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where_1['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where_2['m.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where_3['m.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
}
|
||||
|
||||
if ($params['vin']) {
|
||||
@@ -223,7 +249,14 @@ class Goods extends HD_Controller
|
||||
$params['sort'] = $sort;
|
||||
}
|
||||
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
#$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
if (1 == $params['sold']){
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
|
||||
}
|
||||
else{
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status = 1' => null), false);
|
||||
}
|
||||
|
||||
switch ($search_type) {
|
||||
case 1://精品筛选
|
||||
$count = $this->mdItems->count_fine($where_1);
|
||||
@@ -288,7 +321,8 @@ class Goods extends HD_Controller
|
||||
$map_item_fine[$v['item_id']][] = $v['type_id'];
|
||||
}
|
||||
//已售商品订单信息
|
||||
$this->load->model('receiver/order/receiver_orders_model', 'orders_model');
|
||||
//$this->load->model('receiver/order/receiver_orders_model', 'orders_model');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model', 'orders_model');
|
||||
$str_ids = implode(',', $items_info['ids']);
|
||||
$where = array("item_id in ({$str_ids})" => null);
|
||||
$rows_order = $this->orders_model->select($where, 'id desc', 0, 0, 'item_id, admin_id, name, mobile');
|
||||
@@ -387,7 +421,8 @@ class Goods extends HD_Controller
|
||||
$this->data['autoList'] = $autoList;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['_title'] = $_title;
|
||||
return $this->show_view($view, true);
|
||||
$this->data['view'] = $view;
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function get()
|
||||
@@ -397,6 +432,7 @@ class Goods extends HD_Controller
|
||||
$info['company_id'] = $info['brand_id'] = $info['s_id'] = $info['v_id'] = $info['cor_id'] = $info['incor_id'] = 0;
|
||||
$info['if_pack'] = $info['city_id'] = $info['county_id'] = $info['biz_id'] = $info['addr_id'] = '';
|
||||
$info['status'] = 1;
|
||||
$info['option_ids'] = [];
|
||||
$autoList[2] = $autoList[3] = $autoList[4] = $autoList[5] = array();
|
||||
$comList = $this->sys_company_model->select(['status' => 1], '', '', '', 'id,short');
|
||||
if ($id > 0) {
|
||||
@@ -405,17 +441,18 @@ class Goods extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '商品不存在!');
|
||||
}
|
||||
$info = $re;
|
||||
$info['option_ids'] = $info['option_ids'] ? json_decode($info['option_ids'],true) : [];
|
||||
$info['pro_time'] = $re['pro_time'] != '0000-00-00 00:00:00' ? $re['pro_time'] : '';
|
||||
$info['in_time'] = $re['in_time'] != '0000-00-00 00:00:00' ? $re['in_time'] : '';
|
||||
$info['out_time'] = $re['out_time'] != '0000-00-00 00:00:00' ? $re['out_time'] : '';
|
||||
$info['bill_time'] = $re['bill_time'] != '0000-00-00 00:00:00' ? $re['bill_time'] : '';
|
||||
if ($re['brand_id']) {
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $re['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status>' => -1, 'brand_id' => $re['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($re['s_id']) {
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[4] = $this->mdAutoAttr->select(array('type' => 0, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[5] = $this->mdAutoAttr->select(array('type' => 2, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status>' => -1, 'type' => 1, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[4] = $this->mdAutoAttr->select(array('status>' => -1, 'type' => 0, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[5] = $this->mdAutoAttr->select(array('status>' => -1, 'type' => 2, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
$info['city_id'] = '';
|
||||
$info['county_id'] = '';
|
||||
@@ -439,13 +476,20 @@ class Goods extends HD_Controller
|
||||
|
||||
$_title = '编辑商品';
|
||||
$edit_url = '/items/goods/goods/edit';
|
||||
$where_auto = ['status>' => -1];
|
||||
} else {
|
||||
$info['fine_ids'] = array();
|
||||
$info['in_time'] = date('Y-m-d H:i:s');
|
||||
$_title = '新增商品';
|
||||
$edit_url = '/items/goods/goods/add';
|
||||
$where_auto = ['status>' => -1];
|
||||
}
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
|
||||
if ($this->input->get('sold') != 1){
|
||||
$where_auto = ['status' => 1];
|
||||
}
|
||||
#$autoList[1] = $this->mdAutoBrand->select($where_auto, 'id desc', 0, 0, 'id,name');
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand($where_auto, false);
|
||||
$showInfo['autoList'] = $autoList;
|
||||
$showInfo['comList'] = $comList;
|
||||
$showInfo['statusAry'] = $this->statusAry;
|
||||
@@ -483,6 +527,7 @@ class Goods extends HD_Controller
|
||||
$info['dis_price'] = $re['dis_price'] . '元';
|
||||
$info['bill_price'] = $re['bill_price'] . '元';
|
||||
$info['buy_price'] = $re['buy_price'] . '元';
|
||||
$info['estimated_rebate'] = $re['estimated_rebate'] . '元';
|
||||
$info['discount'] = $re['discount'] ? $re['discount'] . '%' : '100%';
|
||||
$info['pro_time'] = $re['pro_time'] != '0000-00-00 00:00:00' ? $re['pro_time'] : '';
|
||||
$info['in_time'] = $re['in_time'] != '0000-00-00 00:00:00' ? $re['in_time'] : '';
|
||||
@@ -535,6 +580,8 @@ class Goods extends HD_Controller
|
||||
$msg = '请选择入库时间';
|
||||
} else if (!$info['company_id']) {
|
||||
$msg = '请选择公司归属';
|
||||
//} else if (!$info['buy_price'] || $info['buy_price'] <= 0.0) {
|
||||
// $msg = '请输入采购成本'; // 23.06.01 采购成本再改成 非必填
|
||||
} else {
|
||||
$code = SYS_CODE_SUCCESS;
|
||||
}
|
||||
@@ -578,6 +625,7 @@ class Goods extends HD_Controller
|
||||
$addData['bill_num'] = $info['bill_num'] ? $info['bill_num'] : '';
|
||||
$addData['bill_price'] = $info['bill_price'] ? $info['bill_price'] : 0.00;
|
||||
$addData['buy_price'] = $info['buy_price'] ? $info['buy_price'] : 0.00;
|
||||
$addData['estimated_rebate'] = $info['estimated_rebate'] ? $info['estimated_rebate'] : 0.00;
|
||||
|
||||
$addData['pro_time'] = $info['pro_time'] ? $info['pro_time'] : '0000-00-00 00:00:00';
|
||||
$addData['in_time'] = $info['in_time'] ? $info['in_time'] : date('Y-m-d H:i:s');
|
||||
@@ -592,6 +640,7 @@ class Goods extends HD_Controller
|
||||
}
|
||||
$addData['biz_id'] = $biz_id;
|
||||
$addData['addr_id'] = $addr_id;
|
||||
$addData['option_ids'] = $info['option_ids'] ? json_encode($info['option_ids']) : json_encode([]);
|
||||
$id = $this->mdItems->add($addData);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败!');
|
||||
@@ -653,14 +702,17 @@ class Goods extends HD_Controller
|
||||
}
|
||||
if (!$re_i) {
|
||||
$brand_id = $objWorksheet->getCell('A' . $_row)->getValue(); //品牌id
|
||||
$re_b = $this->mdAutoBrand->get(array('name' => $brand_id));
|
||||
$brand_id = $re_b ? $re_b['id'] : 0;
|
||||
if (!$brand_id && !$vin) {
|
||||
continue;
|
||||
}
|
||||
$s_id = $objWorksheet->getCell('B' . $_row)->getValue(); //车系id
|
||||
$v_id = $objWorksheet->getCell('C' . $_row)->getValue(); //车型id
|
||||
$cor_id = $objWorksheet->getCell('D' . $_row)->getValue(); //车身颜色id
|
||||
$incor_id = $objWorksheet->getCell('E' . $_row)->getValue(); //内饰颜色id
|
||||
$addr_name = $objWorksheet->getCell('G' . $_row)->getValue(); //存放地
|
||||
$company_name = $objWorksheet->getCell('H' . $_row)->getValue(); //归属公司
|
||||
$re_b = $this->mdAutoBrand->get(array('name' => $brand_id));
|
||||
$brand_id = $re_b ? $re_b['id'] : 0;
|
||||
$re_s = $this->mdAutoSeries->get(array('brand_id' => $brand_id, 'name' => $s_id));
|
||||
$s_id = $re_s ? $re_s['id'] : 0;
|
||||
$re_a1 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 1, 'title' => $v_id));
|
||||
@@ -745,7 +797,8 @@ class Goods extends HD_Controller
|
||||
$editData['dis_price'] = $info['dis_price'];
|
||||
$editData['bill_num'] = $info['bill_num'];
|
||||
$editData['bill_price'] = $info['bill_price'];
|
||||
$editData['buy_price'] = $info['buy_price'];
|
||||
$editData['buy_price'] = $info['buy_price'] ? $info['buy_price'] : 0;
|
||||
$editData['estimated_rebate'] = $info['estimated_rebate'] ? $info['estimated_rebate'] : 0;
|
||||
|
||||
$editData['pro_time'] = $info['pro_time'];
|
||||
$editData['in_time'] = $info['in_time'];
|
||||
@@ -761,6 +814,7 @@ class Goods extends HD_Controller
|
||||
}
|
||||
$editData['biz_id'] = $biz_id;
|
||||
$editData['addr_id'] = $addr_id;
|
||||
$editData['option_ids'] = $info['option_ids'] ? json_encode($info['option_ids']) : json_encode([]);
|
||||
$ret = $this->mdItems->update($editData, array('id' => $info['id']));
|
||||
if (!$ret) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '修改失败!');
|
||||
@@ -860,7 +914,403 @@ class Goods extends HD_Controller
|
||||
$where_1['s_id'] = $params['s_id'];
|
||||
$where_2['m.s_id'] = $params['s_id'];
|
||||
$where_3['m.s_id'] = $params['s_id'];
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where['v_id'] = $params['v_id'];
|
||||
$where_1['v_id'] = $params['v_id'];
|
||||
$where_2['m.v_id'] = $params['v_id'];
|
||||
$where_3['m.v_id'] = $params['v_id'];
|
||||
}
|
||||
//车身颜色
|
||||
if ($params['cor_id']) {
|
||||
$where['cor_id'] = $params['cor_id'];
|
||||
$where_1['cor_id'] = $params['cor_id'];
|
||||
$where_2['m.cor_id'] = $params['cor_id'];
|
||||
$where_3['m.cor_id'] = $params['cor_id'];
|
||||
} else {
|
||||
$params['cor_id'] = '';
|
||||
}
|
||||
|
||||
//地址筛选
|
||||
if ($params['biz_id']) {
|
||||
$where['biz_id'] = $params['biz_id'];
|
||||
$where_1['biz_id'] = $params['biz_id'];
|
||||
$where_2['m.biz_id'] = $params['biz_id'];
|
||||
$where_3['m.biz_id'] = $params['biz_id'];
|
||||
}
|
||||
if ($params['biz_id'] == -1 && $params['addr_id']) {
|
||||
$where['addr_id'] = $params['addr_id'];
|
||||
$where_1['addr_id'] = $params['addr_id'];
|
||||
$where_2['m.addr_id'] = $params['addr_id'];
|
||||
$where_3['m.addr_id'] = $params['addr_id'];
|
||||
} else if ($params['city_id']) {
|
||||
$where_biz['status'] = 1;
|
||||
$params['city_id'] && $where_biz['city_id'] = $params['city_id'];
|
||||
$params['county_id'] && $where_biz['county_id'] = $params['county_id'];
|
||||
$res_biz = $this->mdBiz->select($where_biz, 'id desc', 0, 0, 'id');
|
||||
if ($res_biz) {
|
||||
$str_ids = implode(',', array_column($res_biz, 'id'));
|
||||
$where["biz_id in ({$str_ids})"] = null;
|
||||
$where_1["biz_id in ({$str_ids})"] = null;
|
||||
$where_2["m.biz_id in ({$str_ids})"] = null;
|
||||
$where_3["m.biz_id in ({$str_ids})"] = null;
|
||||
} else {
|
||||
$where['biz_id'] = -2;
|
||||
$where_1['biz_id'] = -2;
|
||||
$where_2['m.biz_id'] = -2;
|
||||
$where_3['m.biz_id'] = -2;
|
||||
}
|
||||
} else {
|
||||
$params['city_id'] = '';
|
||||
$params['county_id'] = '';
|
||||
$params['addr_id'] = '';
|
||||
$params['biz_id'] = '';
|
||||
}
|
||||
|
||||
if (strlen($params['status']) > 0) {
|
||||
$where['status'] = $params['status'];
|
||||
$where_1['m.status'] = $params['status'];
|
||||
$where_2['m.status'] = $params['status'];
|
||||
$where_3['m.status'] = $params['status'];
|
||||
} else {
|
||||
$params['status'] = '';
|
||||
$where['status >'] = 0;
|
||||
$where_1['m.status >'] = 0;
|
||||
$where_2['m.status >'] = 0;
|
||||
$where_3['m.status >'] = 0;
|
||||
}
|
||||
|
||||
if (1 == $params['sold']) {//已售
|
||||
$where["bill_time<>'0000-00-00 00:00:00'"] = null;
|
||||
$where_1["m.bill_time<>'0000-00-00 00:00:00'"] = null;
|
||||
$where_2["m.bill_time<>'0000-00-00 00:00:00'"] = null;
|
||||
$where_3["m.bill_time<>'0000-00-00 00:00:00'"] = null;
|
||||
$where['brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
$where_1['brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
$where_2['m.brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
$where_3['m.brand_id in (select id from lc_auto_brand where status >- 1)'] = null;
|
||||
} else {
|
||||
$where["bill_time"] = '0000-00-00 00:00:00';
|
||||
$where_1["m.bill_time"] = '0000-00-00 00:00:00';
|
||||
$where_2["m.bill_time"] = '0000-00-00 00:00:00';
|
||||
$where_3["m.bill_time"] = '0000-00-00 00:00:00';
|
||||
$where['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where_1['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where_2['m.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$where_3['m.brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
}
|
||||
|
||||
if ($params['vin']) {
|
||||
$where["vin like '%{$params['vin']}%'"] = null;
|
||||
$where_1["m.vin like '%{$params['vin']}%'"] = null;
|
||||
$where_2["m.vin like '%{$params['vin']}%'"] = null;
|
||||
$where_3["m.vin like '%{$params['vin']}%'"] = null;
|
||||
}
|
||||
//精品筛选
|
||||
if ($params['fine_ids']) {
|
||||
$fine_num = substr_count($params['fine_ids'], ',') + 1;
|
||||
$where_1["j.type_id in ({$params['fine_ids']})"] = null;
|
||||
$where_1["having"] = "fine_num={$fine_num}";
|
||||
$where_2["j2.type_id in ({$params['fine_ids']})"] = null;
|
||||
$where_2["having"] = "fine_num={$fine_num}";
|
||||
$search_type = 0 == $search_type || 1 == $search_type ? 1 : 3;
|
||||
} else {
|
||||
$params['fine_ids'] = '';
|
||||
}
|
||||
//是否选入精品
|
||||
if (strlen($params['is_fine']) > 0) {
|
||||
if (1 == $params['is_fine']) {
|
||||
$where_1["j.type_id>0"] = null;
|
||||
$where_1["having"] = "fine_num>0";
|
||||
$where_3["j2.type_id>0"] = null;
|
||||
$where_3["having"] = "fine_num>0";
|
||||
} else {
|
||||
$where_1["j.type_id is null"] = null;
|
||||
$where_3["j2.type_id is null"] = null;
|
||||
}
|
||||
$search_type = 0 == $search_type || 1 == $search_type ? 1 : 3;
|
||||
} else {
|
||||
$params['is_fine'] = '';
|
||||
}
|
||||
|
||||
//销售员筛选
|
||||
if ($params['admin_id']) {
|
||||
$search_type = 0 == $search_type || 2 == $search_type ? 2 : 3;
|
||||
$where_2['j.admin_id'] = $params['admin_id'];
|
||||
$where_3['j.admin_id'] = $params['admin_id'];
|
||||
} else {
|
||||
$params['city_id_admin'] = '';
|
||||
$params['county_id_admin'] = '';
|
||||
$params['biz_id_admin'] = '';
|
||||
$params['admin_id'] = '';
|
||||
}
|
||||
|
||||
$order = 'id';
|
||||
if ('fine_num' == $params['order']) {//精品标签数排序
|
||||
$order = $params['order'];
|
||||
$search_type = 0 == $search_type || 1 == $search_type ? 1 : 3;
|
||||
} else if ('admin_id' == $params['order']) {//销售员ID排序
|
||||
$order = $params['order'];
|
||||
$search_type = 0 == $search_type || 2 == $search_type ? 2 : 3;
|
||||
} else if ('sold_time' == $params['order']) {//售卖时间排序
|
||||
$order = 'bill_time';
|
||||
} else if ($params['order']) {
|
||||
$order = $params['order'];
|
||||
} else {
|
||||
$params['order'] = $order;
|
||||
}
|
||||
$sort = 'desc';
|
||||
if ($params['sort']) {
|
||||
$sort = $params['sort'];
|
||||
} else {
|
||||
$params['sort'] = $sort;
|
||||
}
|
||||
|
||||
#$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
if (1 == $params['sold']){
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
|
||||
}
|
||||
else{
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status = 1' => null), false);
|
||||
}
|
||||
|
||||
switch ($search_type) {
|
||||
case 1://精品筛选
|
||||
$count = $this->mdItems->count_fine($where_1);
|
||||
break;
|
||||
case 2://订单筛选
|
||||
$count = $this->mdItems->count_order($where_2);
|
||||
break;
|
||||
case 3://精品+订单筛选
|
||||
$count = $this->mdItems->count_order_fine($where_3);
|
||||
break;
|
||||
default:
|
||||
$count = $this->mdItems->count($where);
|
||||
}
|
||||
|
||||
if ($count > 10000) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据量超过1w导出太为难我了');
|
||||
} else if (0 == $count) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '当前没有数据');
|
||||
}
|
||||
|
||||
$fileName = "车辆明细";
|
||||
$indexs = array(
|
||||
'id' => 'ID',
|
||||
'brand_name' => '品牌',
|
||||
's_name' => '车系',
|
||||
'v_name' => '车型',
|
||||
'cor_name' => '车身颜色',
|
||||
'incor_name' => '内饰颜色',
|
||||
'ori_price' => '指导价',
|
||||
'sale_price' => '售价',
|
||||
'bill_price' => '开票金额',
|
||||
'buy_price' => '采购成本',
|
||||
'estimated_rebate' => '预估返利',
|
||||
'dis_price' => '折扣价',
|
||||
'discount' => '折扣百分比',
|
||||
'city_name' => '城市名',
|
||||
'county_name' => '行政区',
|
||||
'address' => '存放地址',
|
||||
'vin' => '车架号',
|
||||
'engine_num' => '发动机号',
|
||||
'stdard_num' => '合格证号',
|
||||
'bill_num' => '开票号',
|
||||
'auto_fine' => '精品加装',
|
||||
'company_name' => '公司归属',
|
||||
'status' => '状态',
|
||||
'in_time' => '入库时间',
|
||||
'out_time' => '出库时间',
|
||||
'bill_time' => '开票时间',
|
||||
);
|
||||
|
||||
$lists = array();
|
||||
$fine_ids = array();
|
||||
if ($count) {
|
||||
switch ($search_type) {
|
||||
case 1://精品筛选
|
||||
$fileds = 'm.*,count(type_id) as fine_num';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select_fine($where_1, $orderby, 0, 0, $fileds);
|
||||
break;
|
||||
case 2://订单筛选
|
||||
$fileds = 'm.*';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select_order($where_2, $orderby, 0, 0, $fileds);
|
||||
break;
|
||||
case 3://精品+订单筛选
|
||||
$fileds = 'm.*, count(j2.type_id) as fine_num';
|
||||
if (in_array($order, array('admin_id'))) {
|
||||
$orderby = "{$order} {$sort}";
|
||||
} else {
|
||||
$orderby = "m.{$order} {$sort}";
|
||||
}
|
||||
$rows = $this->mdItems->select_order_fine($where_3, $orderby, 0, 0, $fileds);
|
||||
break;
|
||||
default:
|
||||
$fileds = '*';
|
||||
$orderby = "{$order} {$sort}";
|
||||
$rows = $this->mdItems->select($where, $orderby, 0, 0, $fileds);
|
||||
}
|
||||
|
||||
$lists[] = $indexs;
|
||||
$company_ids = $brand_ids = $s_ids = $attr_vids = $attr_corids = $attr_incorids = $biz_ids = $addr_ids = array();
|
||||
$ids = array();
|
||||
foreach ($rows as $v) {
|
||||
$ids[] = $v['id'];
|
||||
$v['brand_id'] && !in_array($v['brand_id'], $brand_ids) && $brand_ids[] = $v['brand_id'];
|
||||
$v['biz_id'] && !in_array($v['biz_id'], $biz_ids) && $biz_ids[] = $v['biz_id'];
|
||||
$v['addr_id'] && !in_array($v['addr_id'], $addr_ids) && $addr_ids[] = $v['addr_id'];
|
||||
$v['s_id'] && !in_array($v['s_id'], $s_ids) && $s_ids[] = $v['s_id'];
|
||||
$v['v_id'] && !in_array($v['v_id'], $attr_vids) && $attr_vids[] = $v['v_id'];
|
||||
$v['cor_id'] && !in_array($v['cor_id'], $attr_corids) && $attr_corids[] = $v['cor_id'];
|
||||
$v['incor_id'] && !in_array($v['incor_id'], $attr_incorids) && $attr_incorids[] = $v['incor_id'];
|
||||
$v['company_id'] && !in_array($v['company_id'], $company_ids) && $company_ids[] = $v['company_id'];
|
||||
}
|
||||
|
||||
$map_company = $map_brand = $map_sery = $map_vid = $map_corid = $map_incorid = $map_biz = $map_addr = array();
|
||||
if ($brand_ids) {
|
||||
$str_ids = implode(',', $brand_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_brand = $this->mdAutoBrand->map('id', 'name', $where);
|
||||
}
|
||||
if ($s_ids) {
|
||||
$str_ids = implode(',', $s_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_sery = $this->mdAutoSeries->map('id', 'name', $where);
|
||||
}
|
||||
if ($attr_vids) {
|
||||
$str_ids = implode(',', $attr_vids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_vid = $this->mdAutoAttr->map('id', 'title', $where);
|
||||
}
|
||||
if ($attr_corids) {
|
||||
$str_ids = implode(',', $attr_corids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_corid = $this->mdAutoAttr->map('id', 'title', $where);
|
||||
}
|
||||
if ($attr_incorids) {
|
||||
$str_ids = implode(',', $attr_incorids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_incorid = $this->mdAutoAttr->map('id', 'title', $where);
|
||||
}
|
||||
if ($biz_ids) {
|
||||
$str_ids = implode(',', $biz_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_biz = $this->mdBiz->map('id', 'biz_name', $where);
|
||||
}
|
||||
if ($addr_ids) {
|
||||
$str_ids = implode(',', $addr_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, title, city_name, county_name';
|
||||
$map_addr = $this->addr_model->map('id', '*', $where, $orderby, 0, 0, $select);
|
||||
}
|
||||
if ($company_ids) {
|
||||
$str_ids = implode(',', $company_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_company = $this->sys_company_model->map('id', 'short', $where);
|
||||
}
|
||||
//获取精品加装
|
||||
$str_ids = implode(',', $ids);
|
||||
$where = array("item_id in ({$str_ids})" => null, 'type' => 1, 'status' => 1);
|
||||
$rows_fine = $this->items_relate_model->select($where, '', 0, 0, 'item_id, type_id');
|
||||
$map_item_fine = array();//按item_id分组所属精品ID
|
||||
foreach ($rows_fine as $v) {
|
||||
!in_array($v['type_id'], $fine_ids) && $fine_ids[] = $v['type_id'];
|
||||
$map_item_fine[$v['item_id']][] = $v['type_id'];
|
||||
}
|
||||
//获取精品ID和名称映射
|
||||
$map_fine = array();
|
||||
if ($fine_ids) {
|
||||
$this->load->model('auto/auto_fine_model');
|
||||
$str_ids = implode(',', $fine_ids);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_fine = $this->auto_fine_model->map('id', 'title', $where);
|
||||
}
|
||||
|
||||
foreach ($rows as $v) {
|
||||
//获取并组装精品信息
|
||||
$fine_ids = $map_item_fine[$v['id']];
|
||||
$auto_fine = '';
|
||||
if ($fine_ids) {
|
||||
foreach ($fine_ids as $fine_id) {
|
||||
$auto_fine = $auto_fine ? "{$auto_fine} {$map_fine[$fine_id]}" : $map_fine[$fine_id];
|
||||
}
|
||||
}
|
||||
$addr = array();
|
||||
if ($v['biz_id'] > 0) {
|
||||
$re_biz = $this->mdBiz->get(array('id' => $v['biz_id']));
|
||||
if ($re_biz['county_id']) {
|
||||
$re_area = $this->mdArea->get(array('county_id' => $re_biz['county_id']));
|
||||
if ($re_area) {
|
||||
$addr = array('city_name' => $re_area['city_name'], 'county_name' => $re_area['county_name']
|
||||
, 'title' => $map_biz[$v['biz_id']]);
|
||||
}
|
||||
} else if ($re_biz['city_id']) {
|
||||
$re_area = $this->mdArea->get(array('city_id' => $re_biz['city_id']));
|
||||
if ($re_area) {
|
||||
$addr = array('city_name' => $re_area['city_name'], 'title' => $map_biz[$v['biz_id']]);
|
||||
}
|
||||
}
|
||||
} else if ($v['biz_id'] == -1 && $v['addr_id']) {
|
||||
$addr = $map_addr[$v['addr_id']];
|
||||
}
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'brand_name' => $map_brand[$v['brand_id']],
|
||||
's_name' => $map_sery[$v['s_id']],
|
||||
'v_name' => $map_vid[$v['v_id']],
|
||||
'cor_name' => $map_corid[$v['cor_id']],
|
||||
'incor_name' => $map_incorid[$v['incor_id']],
|
||||
'ori_price' => $v['ori_price'],
|
||||
'sale_price' => $v['sale_price'],
|
||||
'bill_price' => $v['bill_price'],
|
||||
'buy_price' => $v['buy_price'],
|
||||
'estimated_rebate' => $v['estimated_rebate'],
|
||||
'dis_price' => $v['dis_price'],
|
||||
'discount' => $v['discount'],
|
||||
'city_name' => $addr ? $addr['city_name'] : '',
|
||||
'county_name' => $addr ? $addr['county_name'] : '',
|
||||
'address' => $addr ? $addr['title'] : '',
|
||||
'vin' => $v['vin'],
|
||||
'engine_num' => $v['engine_num'],
|
||||
'stdard_num' => $v['stdard_num'],
|
||||
'bill_num' => $v['bill_num'],
|
||||
'auto_fine' => $auto_fine,
|
||||
'company_name' => $map_company[$v['company_id']],
|
||||
'status' => $this->statusAry[$v['status']],
|
||||
'in_time' => '0000-00-00 00:00:00' == $v['in_time'] ? '' : $v['in_time'],
|
||||
'out_time' => '0000-00-00 00:00:00' == $v['out_time'] ? '' : $v['out_time'],
|
||||
'bill_time' => '0000-00-00 00:00:00' == $v['bill_time'] ? '' : $v['bill_time'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($lists, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
|
||||
return 1;
|
||||
}
|
||||
public function export_()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$where = $where_1 = $where_2 = $where_3 = $autoList = array();
|
||||
$search_type = 0;//0不连表,1联表筛选精品,2联表筛选销售,3联表筛选精品和销售
|
||||
if ($params['brand_id']) {
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
$where_1['brand_id'] = $params['brand_id'];
|
||||
$where_2['m.brand_id'] = $params['brand_id'];
|
||||
$where_3['m.brand_id'] = $params['brand_id'];
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$where['s_id'] = $params['s_id'];
|
||||
$where_1['s_id'] = $params['s_id'];
|
||||
$where_2['m.s_id'] = $params['s_id'];
|
||||
$where_3['m.s_id'] = $params['s_id'];
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where['v_id'] = $params['v_id'];
|
||||
@@ -1228,6 +1678,7 @@ class Goods extends HD_Controller
|
||||
$this->load->model('items/items_oplogs_model', 'mdItemsOplogs');
|
||||
$fileName = '超期车辆';
|
||||
$where = ['status<>' => 0, 'bill_time' => '0000-00-00 00:00:00'];
|
||||
$where['brand_id in (select id from lc_auto_brand where status = 1)'] = null;
|
||||
$res = $this->mdItems->select($where, 'id asc', 1, 5000, 'brand_id,biz_id,addr_id,s_id,v_id,cor_id,incor_id,company_id,id,vin,in_time,status');
|
||||
$data = $list = [];
|
||||
foreach ($res as $key => $value) {
|
||||
|
||||
@@ -43,13 +43,14 @@ class Logs extends HD_Controller
|
||||
{
|
||||
$lists = $autoList = array();
|
||||
$where = array('id<>1' => null, 'status>' => 0);
|
||||
$where['brand_id in (select id from lc_auto_brand where status > -1)'] = null;
|
||||
if ($params['brand_id']) {
|
||||
$where['brand_id'] = $params['brand_id'];
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
$autoList[2] = $this->mdAutoSeries->select(array('status > -1' => null, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name');
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$where['s_id'] = $params['s_id'];
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
$autoList[3] = $this->mdAutoAttr->select(array('status > -1' => null,'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where['v_id'] = $params['v_id'];
|
||||
@@ -98,7 +99,8 @@ class Logs extends HD_Controller
|
||||
} else {
|
||||
$params['sold'] = '';
|
||||
}
|
||||
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
//$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
|
||||
$autoList[1] = $this->mdAutoBrand->map_brand(array('status > -1' => null), false);
|
||||
$statusAry = $this->statusAry;
|
||||
$soldAry = $this->soldAry;
|
||||
$count = $this->mdItems->count($where);
|
||||
|
||||
@@ -55,7 +55,7 @@ class Polyv extends HD_Controller
|
||||
$this->data['pager'] = array('count' => ceil($total / $params['size']), 'curr' => $params['page'], 'totle' => $total);
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['_title'] = "保利威频道({$this->channelId})_场次报表";
|
||||
$this->data['_title'] = "频道({$this->channelId})_场次报表";
|
||||
$this->show_view('live/polyv/lists', true);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ class Clues extends HD_Controller
|
||||
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名');
|
||||
private $cacheKeyPhone = 'xz_admin_phone';
|
||||
protected $log_dir;
|
||||
private $maintainAry = ['0-0' => '待处理', '1-10' => '已加企微', '3-7' => '明确拒绝', '2-4' => '未接通', '2-5' => '未完整触碰'];//保养客户专用
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -72,6 +73,10 @@ class Clues extends HD_Controller
|
||||
strlen($params['status2']) && $where["status2"] = $params['status2'];
|
||||
$city_id && $where['city_id'] = $city_id;
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
if ($this->role == 37) { //特殊处理,丰田店只能看到丰田保养数据
|
||||
$params['cfrom_id2'] = 37;
|
||||
$where['admin_id'] = $this->uid;
|
||||
}
|
||||
if ($params['cfrom_id'] || $params['cfrom_id2']) {
|
||||
if ($params['cfrom_id2']) {
|
||||
$where['cf_id'] = $params['cfrom_id2'];
|
||||
@@ -88,24 +93,39 @@ class Clues extends HD_Controller
|
||||
if ($count) {
|
||||
$fileds = 'id,name,mobile,cf_id,c_time,admin_id,status,status2,en_time';
|
||||
$rows = $this->clues_model->select($where, 'en_time desc,id desc', $page, $size, $fileds);
|
||||
$map_admin = $map_cf_pid = $cf_title_arr = [];
|
||||
//获取来源
|
||||
$cf_id_arr = array_unique(array_column($rows, 'cf_id'));
|
||||
$cf_rows = $this->clues_cfrom_model->get_map_by_ids($cf_id_arr, 'id,title');
|
||||
if ($cf_id_arr) {
|
||||
$cf_id_str = implode(',', $cf_id_arr);
|
||||
$res_cfrom = $this->clues_cfrom_model->select(["id in({$cf_id_str})" => null], 'id desc', 0, 0, 'id,title,pid');
|
||||
$cf_pid_arr = array_unique(array_column($res_cfrom, 'pid'));
|
||||
if ($cf_pid_arr) {
|
||||
$cf_pid_str = implode(',', $cf_pid_arr);
|
||||
$map_cf_pid = $this->clues_cfrom_model->map('id', 'title', ["id in({$cf_pid_str})" => null]);
|
||||
}
|
||||
foreach ($res_cfrom as $key => $val) {
|
||||
$title = $val['title'];
|
||||
if ($val['pid']) {//一级分类
|
||||
$map_cf_pid[$val['pid']] && $title = $map_cf_pid[$val['pid']] . '-' . $title;
|
||||
}
|
||||
$cf_title_arr[$val['id']] = $title;
|
||||
}
|
||||
}
|
||||
//获取管理员
|
||||
$this->load->model('sys/sys_admin_model', 'admin_model');
|
||||
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
|
||||
if ($admin_id_arr) {
|
||||
$str_ids = implode(',', $admin_id_arr);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_admin = $this->admin_model->map('id', 'username', $where);
|
||||
$map_admin = $this->admin_model->map('id', 'username', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$val['cf_title'] = isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '';
|
||||
$val['cf_title'] = $cf_title_arr[$val['cf_id']] ? $cf_title_arr[$val['cf_id']] : '';
|
||||
$status_name = $statusAry[$val['status']]['name'];
|
||||
$val['status2'] && $status_name .= '‒' . $statusAry[$val['status']]['list'][$val['status2']];
|
||||
$val['status_name'] = $status_name;
|
||||
$val['admin_name'] = isset($map_admin[$val['admin_id']]) ? $map_admin[$val['admin_id']] : '';
|
||||
if (SUPER_ADMIN == $this->role) {
|
||||
$val['admin_name'] = $map_admin[$val['admin_id']] ? $map_admin[$val['admin_id']] : '';
|
||||
if (SUPER_ADMIN == $this->role || $this->role == 37) {
|
||||
$val['mobile_sub'] = $val['mobile'];
|
||||
} else {
|
||||
$val['mobile_sub'] = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : '';
|
||||
@@ -117,6 +137,11 @@ class Clues extends HD_Controller
|
||||
foreach ($this->clues_model->statusAry() as $key => $value) {
|
||||
$cate = array();
|
||||
$where = array("status" => $key);
|
||||
if ($this->role == 37) {
|
||||
$where['cf_id'] = 37;
|
||||
$where['admin_id'] = $this->uid;
|
||||
}
|
||||
$this->role == 37 && $where['cf_id'] = 37;
|
||||
$count1 = $this->clues_model->count($where);
|
||||
if ($value['list']) {
|
||||
foreach ($value['list'] as $key2 => $value2) {
|
||||
@@ -132,6 +157,7 @@ class Clues extends HD_Controller
|
||||
$this->data['searchTpAry'] = $this->searchTpAry;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['statusList'] = $statusList;
|
||||
$this->data['maintainAry'] = $this->maintainAry;
|
||||
$this->data['_title'] = '线索池列表';
|
||||
return $this->show_view('receiver/clues/lists', true);
|
||||
}
|
||||
@@ -159,7 +185,12 @@ class Clues extends HD_Controller
|
||||
}
|
||||
$dataInfo['editType'] = 0;
|
||||
$re_cf = $this->clues_cfrom_model->get(array('id' => $re['cf_id']));
|
||||
$info_show['cfrom_title'] = $re_cf['title'] ? $re_cf['title'] : '';
|
||||
$re_cf_title_p = '';
|
||||
if ($re_cf && $re_cf['pid']){
|
||||
$re_cf_pid = $this->clues_cfrom_model->get(array('id' => $re_cf['pid']));
|
||||
$re_cf_title_p = $re_cf_pid['title'] ? $re_cf_pid['title'].'-' : '';
|
||||
}
|
||||
$info_show['cfrom_title'] = $re_cf['title'] ? $re_cf_title_p.$re_cf['title'] : '';
|
||||
$info_show['statusList'] = $statusList;
|
||||
$info_show['status2List'] = $status2List;
|
||||
$info_show['c_time'] = date('Y-m-d H:i', $re['c_time']);
|
||||
@@ -183,6 +214,13 @@ class Clues extends HD_Controller
|
||||
if ($row['duration']) {
|
||||
$rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0, 0, 'video') : '';
|
||||
$rec_text = '录音文件未生成';
|
||||
}else{
|
||||
$jsondata = json_decode($row['json_data'],true);
|
||||
if($row['c_time']>strtotime('2023-03-21 13:00:00')){
|
||||
$rec_text = $this->mdReceiverXz->get_xz_status($jsondata['status']);
|
||||
$answer_text = $this->mdReceiverXz->get_xz_noAnswerReason($jsondata['noAnswerReason']);
|
||||
$answer_text && $rec_text .= "($answer_text)";
|
||||
}
|
||||
}
|
||||
}
|
||||
$setValue['rec_url'] = $rec_url;
|
||||
@@ -213,7 +251,9 @@ class Clues extends HD_Controller
|
||||
if ($re['lat'] && $re['lng']) {
|
||||
$info_show['near_bizs'] = $this->biz_model->nearby($re['lat'], $re['lng'], 1, 3, 'id,biz_name');
|
||||
} else {
|
||||
$info_show['near_bizs'] = $this->biz_model->select(['city_id' => $re['city_id'], 'county_id' => $re['county_id'], 'status' => 1], 'id desc', 1, 3, 'id,biz_name');
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$info_show['near_bizs'] = $this->biz_model->select(['city_id' => $re['city_id'], 'county_id' => $re['county_id'], "type in ($type_ids)" => null, 'status' => 1], 'id desc', 1, 3, 'id,biz_name');
|
||||
}
|
||||
//获取分销用户
|
||||
$cf_user = '';
|
||||
@@ -507,7 +547,16 @@ class Clues extends HD_Controller
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = $this->input->post('value');
|
||||
if (!$id || !$status) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$status_ary = explode('-', $status);
|
||||
$up_data['status'] = intval($status_ary[0]);
|
||||
$up_data['status2'] = intval($status_ary[1]);
|
||||
$this->clues_model->update($up_data, ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
@@ -528,6 +577,9 @@ class Clues extends HD_Controller
|
||||
];
|
||||
$city_id && $where['city_id'] = $city_id;
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
$typeAry = $this->biz_model->type_ary();
|
||||
$type_ids = implode(',',array_keys($typeAry));
|
||||
$type_ids && $where["type in ($type_ids)"] = null;
|
||||
$bizList = $this->biz_model->select($where, '', '', '', 'id,biz_name');
|
||||
$this->data['bizList'] = $bizList;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
@@ -568,7 +620,7 @@ class Clues extends HD_Controller
|
||||
'biz_id' => $biz_id,
|
||||
'city_id' => $biz['city_id'],
|
||||
'county_id' => $biz['county_id'],
|
||||
'brand_id' => $clues_row['brand_id'],
|
||||
'brand_id' => 0,
|
||||
's_id' => $clues_row['s_id'],
|
||||
'if_driver' => $clues_row['if_driver'],
|
||||
'cf_title' => '平台分配',
|
||||
@@ -578,6 +630,9 @@ class Clues extends HD_Controller
|
||||
'p_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => $clues_row['en_time'] == '0000-00-00 00:00:00' ? $clues_row['c_time'] : strtotime($clues_row['en_time'])
|
||||
];
|
||||
if ($biz['type'] == 5) {//异业店
|
||||
$add_data['cf_clues'] = '异业店';
|
||||
}
|
||||
if ($jsondata['car']) {
|
||||
isset($jsondata['car']['version']) && $add_data['v_id'] = $jsondata['car']['version']['id'];
|
||||
$add_data['car_json'] = json_encode($jsondata['car'], JSON_UNESCAPED_UNICODE);
|
||||
@@ -808,6 +863,9 @@ class Clues extends HD_Controller
|
||||
'pid' => 0
|
||||
];
|
||||
$id && $where['pid'] = $id;
|
||||
if ($this->role == 37) {
|
||||
!$id && $where['id'] = 36;
|
||||
}
|
||||
$rows = $this->clues_cfrom_model->select($where, 'id desc', '', '', 'id,title');
|
||||
$this->data['data'] = $rows;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class CluesCfrom extends HD_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$lists = [];
|
||||
$where = ["status<>" => -1, 'pid' => 0];
|
||||
if (strlen($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
if ($params['title']) {
|
||||
$where["title like '%{$params['title']}%'"] = null;
|
||||
}
|
||||
$count = $this->mdCluesCfrom->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdCluesCfrom->select($where, "sort desc,id desc", $params['page'], $params['size']);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = [];
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['name'] = $value['title'];
|
||||
$setValue['sort'] = $value['sort'];
|
||||
$setValue['status'] = $value['status'];
|
||||
$setValue['status_name'] = $value['status'] == 1 ? '正常' : '禁用';
|
||||
$options = '';
|
||||
$res_cfrom = $this->mdCluesCfrom->select(["status<>" => -1, 'pid' => $value['id']], "sort desc,id desc", 1, 10, 'title');
|
||||
$res_cfrom && $options = implode(',', array_column($res_cfrom, 'title'));
|
||||
$setValue['options'] = $options;
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['_title'] = '线索来源';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
return $this->show_view('receiver/cluescfrom/lists', true);
|
||||
}
|
||||
|
||||
public function get_options()
|
||||
{
|
||||
$id = intval($this->input->post('id'));
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$res_tag = $this->mdCluesCfrom->select(["status" => 1, 'pid' => $id], "sort desc,id desc", 0, 0, 'id,title as name,sort,status');
|
||||
$this->data['lists'] = $res_tag;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
//展示单条数据
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
if ($id) {
|
||||
$url = "receiver/CluesCfrom/edit";
|
||||
$re = $this->mdCluesCfrom->get(['id' => $id]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$name = $re['title'];
|
||||
$sort = $re['sort'];
|
||||
} else {
|
||||
$url = "receiver/CluesCfrom/add";
|
||||
$sort = 50;
|
||||
$name = '';
|
||||
}
|
||||
$this->data['showInfo'] = ['id' => $id, 'name' => $name, 'sort' => $sort, 'url' => $url];
|
||||
return $this->show_view('receiver/cluescfrom/edit');
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '名称不能为空!');
|
||||
}
|
||||
$re = $this->mdCluesCfrom->get(['title' => $params['name'], 'pid' => 0, "status<>" => -1]);
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '名称已存在了!');
|
||||
}
|
||||
$id = $this->mdCluesCfrom->add(['title' => $params['name'], 'sort' => $params['sort'], 'c_time' => time()]);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$params['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入名称');
|
||||
}
|
||||
$re = $this->mdCluesCfrom->get(array('title' => $params['name'], 'pid' => 0, "status<>" => -1));
|
||||
if ($re && $re['id'] != $params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '名称已存在了!');
|
||||
}
|
||||
$this->mdCluesCfrom->update(['title' => $params['name'], 'sort' => $params['sort']], ['id' => $params['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$re = $this->mdCluesCfrom->get(['id' => $id]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
$this->mdCluesCfrom->update(['status' => -1], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//修改来源选项
|
||||
function edit_options()
|
||||
{
|
||||
$pid = $this->input->post('id');
|
||||
$options = $this->input->post('options');
|
||||
if (!$pid || !$options) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$re = $this->mdCluesCfrom->get(['id' => $pid]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
|
||||
}
|
||||
foreach ($options as $key => $value) {
|
||||
$sort = intval($value['sort']);
|
||||
$data = ['title' => $value['name'], 'status' => $value['status'], 'sort' => $sort];
|
||||
if ($value['name']) {
|
||||
if ($value['id']) {//修改
|
||||
$this->mdCluesCfrom->update($data, ['id' => $value['id']]);
|
||||
} else {//新增
|
||||
$data['pid'] = $pid;
|
||||
$data['c_time'] = time();
|
||||
$this->mdCluesCfrom->add($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
function edit_status()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$stauts = intval($this->input->post('status'));
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$this->mdCluesCfrom->update(['status' => $stauts], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:获取分类信息
|
||||
* Created on: 2023/3/27 17:39
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
function json_get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
'pid' => 0
|
||||
];
|
||||
$id && $where['pid'] = $id;
|
||||
if ($this->role == 37) {
|
||||
!$id && $where['id'] = 36;
|
||||
}
|
||||
$rows = $this->mdCluesCfrom->select($where, 'sort desc,id desc', '', '', 'id,title');
|
||||
$this->data['data'] = $rows;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,8 @@ class Orders extends HD_Controller
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
$this->load->model('auto/auto_finance_model');
|
||||
$this->load->model('sys/sys_finance_model');
|
||||
//$this->load->model('sys/sys_finance_model');
|
||||
$this->load->model('sys/sys_supplier_model');
|
||||
$this->load->model('sys/sys_company_model');
|
||||
$this->load->model('app/liche/app_liche_orders_model');
|
||||
|
||||
@@ -178,8 +179,10 @@ class Orders extends HD_Controller
|
||||
$loan['lend_file'] = $loan['lend_file'] ? build_qiniu_image_url($loan['lend_file']) : '';
|
||||
$loan['lend_file_name'] = $loan['lend_file'] ? end(explode('/', $loan['lend_file'])) : '';
|
||||
|
||||
$loan['finance_rows'] = $this->sys_finance_model->select(['status' => 1], '', 0, 0, 'id,title');
|
||||
$loan['finance_rows_nums'] = $this->sys_finance_model->get_nums();
|
||||
//$loan['finance_rows'] = $this->sys_finance_model->select(['status' => 1], '', 0, 0, 'id,title');
|
||||
//$loan['finance_rows_nums'] = $this->sys_finance_model->get_nums();
|
||||
$loan['finance_rows'] = $this->sys_supplier_model->select(['status' => 1, 'type'=>3], '', 0, 0, 'id,title');
|
||||
$loan['finance_rows_nums'] = $this->auto_finance_model->get_nums();
|
||||
$loan['price_loan'] = $money_json['price_loan'] ? $money_json['price_loan'] : '';
|
||||
$loan['first_pay'] = 0;
|
||||
if ($money_json['price_loan']) {
|
||||
@@ -868,7 +871,7 @@ class Orders extends HD_Controller
|
||||
}
|
||||
$p_row = $this->app_liche_orders_model->get(['pid'=>0,'o_id'=>$row['id']]);
|
||||
$this->load->helper('order');
|
||||
$sid = create_order_no(350200, 'liche', 1, $type);
|
||||
$sid = create_order_no(350200, 'liche');
|
||||
$data = [
|
||||
'o_id' => $row['id'],
|
||||
'sid' => $sid,
|
||||
|
||||
@@ -0,0 +1,629 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notes:车主
|
||||
* Created on: 2022/6/15 17:15
|
||||
* Created by: dengbw
|
||||
*/
|
||||
class Owners extends HD_Controller
|
||||
{
|
||||
private $searchTpAry = array('mobile' => '车主电话', 'name' => '车主姓名', 'car_num' => '车牌号');
|
||||
private $searchTimeAry = array('c_time' => '创建时间', 'order_time' => '购车时间', 'ck_time' => '交付时间', 'u_time' => '最后操作时间');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_owners_model', 'mdOwners');
|
||||
$this->load->model('receiver/receiver_owners_oplogs_model', 'mdOwnersOplogs');
|
||||
$this->load->model('receiver/receiver_owners_tag_model', 'mdOwnersTag');
|
||||
$this->load->model('receiver/receiver_owners_tagdata_model', 'mdOwnersTagdata');
|
||||
$this->load->model("biz/biz_model", 'mdBiz');
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders');
|
||||
$this->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->load->model('receiver/receiver_xz_model', 'mdXz');
|
||||
$this->load->model('auto/auto_brand_model', 'mdBrand');
|
||||
$this->load->model('auto/auto_series_model', 'mdSeries');
|
||||
$this->load->model('auto/auto_attr_model', 'mdAttr');
|
||||
$this->load->model('area_model', 'mdArea');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$this->data = $this->dataSelect($params);
|
||||
return $this->show_view('receiver/owners/lists', true);
|
||||
}
|
||||
|
||||
private function dataSelect($params)
|
||||
{
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
!$params['city_id_admin'] && $params['city_id_admin'] = '';
|
||||
!$params['county_id_admin'] && $params['county_id_admin'] = '';
|
||||
!$params['biz_id_admin'] && $params['biz_id_admin'] = '';
|
||||
!$params['admin_id'] && $params['admin_id'] = '';
|
||||
!$params['city_id'] && $params['city_id'] = '';
|
||||
!$params['county_id'] && $params['county_id'] = '';
|
||||
!$params['sex'] && $params['sex'] = '';
|
||||
!$params['brand_id'] && $params['brand_id'] = '';
|
||||
!$params['s_id'] && $params['s_id'] = '';
|
||||
!$params['v_id'] && $params['v_id'] = '';
|
||||
!$params['tags'] && $params['tags'] = '';
|
||||
if (strlen($params['status'])) {
|
||||
$where["a.status"] = $params['status'];
|
||||
} else {
|
||||
$where["a.status>=0"] = null;
|
||||
}
|
||||
if ($params['title']) {
|
||||
$where["a.{$params['search_tp']} like '%{$params['title']}%'"] = null;
|
||||
}
|
||||
!$params['search_tp'] && $params['search_tp'] = 'mobile';
|
||||
if ($params['c_time']) {
|
||||
$c_time = explode(' ~ ', $params['c_time']);
|
||||
$c_time[0] && $where["a.c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
$c_time[1] && $where["a.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
}
|
||||
if ($params['order_time']) {
|
||||
$order_time = explode(' ~ ', $params['order_time']);
|
||||
$order_time[0] && $where["a.order_time >="] = $order_time[0] . ' 00:00:00';
|
||||
$order_time[1] && $where["a.order_time <="] = $order_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['ck_time']) {
|
||||
$ck_time = explode(' ~ ', $params['ck_time']);
|
||||
$ck_time[0] && $where["a.ck_time >="] = $ck_time[0] . ' 00:00:00';
|
||||
$ck_time[1] && $where["a.ck_time <="] = $ck_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['u_time']) {
|
||||
$u_time = explode(' ~ ', $params['u_time']);
|
||||
$u_time[0] && $where["a.u_time >="] = $u_time[0] . ' 00:00:00';
|
||||
$u_time[1] && $where["a.u_time <="] = $u_time[1] . ' 23:59:59';
|
||||
}
|
||||
if (strlen($params['wxqy'])) {
|
||||
$where["a.wxqy"] = $params['wxqy'];
|
||||
} else {
|
||||
$params['wxqy'] = '';
|
||||
}
|
||||
if ($params['city_id']) {
|
||||
$where["a.city_id"] = $params['city_id'];
|
||||
}
|
||||
if ($params['county_id']) {
|
||||
$where["a.county_id"] = $params['county_id'];
|
||||
}
|
||||
if ($params['sex']) {
|
||||
$where["a.sex"] = $params['sex'];
|
||||
}
|
||||
$where['a.brand_id in (select id from lc_auto_brand where status > -1)'] = null;
|
||||
if ($params['brand_id']) {
|
||||
$where["a.brand_id"] = $params['brand_id'];
|
||||
}
|
||||
if ($params['s_id']) {
|
||||
$where["a.s_id"] = $params['s_id'];
|
||||
}
|
||||
if ($params['v_id']) {
|
||||
$where["a.v_id"] = $params['v_id'];
|
||||
}
|
||||
//销售员筛选
|
||||
if ($params['admin_id']) {
|
||||
$where['b.admin_id'] = $params['admin_id'];
|
||||
} else if ($params['biz_id_admin']) {
|
||||
$where['b.biz_id'] = $params['biz_id_admin'];
|
||||
} else if ($params['county_id_admin']) {
|
||||
$where["b.biz_id in(select id from lc_biz where county_id={$params['county_id_admin']})"] = null;
|
||||
} else if ($params['city_id_admin']) {
|
||||
$where["b.biz_id in(select id from lc_biz where city_id={$params['city_id_admin']})"] = null;
|
||||
}
|
||||
if ($params['tags']) {
|
||||
$pidAry = [];
|
||||
$res_tag = $this->mdOwnersTag->select(["id in ({$params['tags']})" => null], 'id desc', 0, 0, 'pid,id');
|
||||
foreach ($res_tag as $v) {
|
||||
$v['pid'] && $pidAry[$v['pid']][] = $v['id'];
|
||||
}
|
||||
$str_o_ids = $res_tag_data = '';
|
||||
foreach ($pidAry as $v) {
|
||||
if ($v) {
|
||||
$where_tag = [];
|
||||
$str_ids = implode(',', $v);
|
||||
$where_tag["t_id in({$str_ids})"] = null;
|
||||
if ($str_o_ids) {
|
||||
$where_tag["o_id in({$str_o_ids})"] = null;
|
||||
}
|
||||
$res_tag_data = $this->mdOwnersTagdata->select_groupby('o_id', $where_tag, "id desc", 0, 0, "o_id");
|
||||
if (!$res_tag_data) {
|
||||
break;
|
||||
}
|
||||
if ($res_tag_data) {
|
||||
$str_o_ids = implode(',', array_column($res_tag_data, 'o_id'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($res_tag_data) {
|
||||
$str_oids = implode(',', array_column($res_tag_data, 'o_id'));
|
||||
$where["a.id in({$str_oids})"] = null;
|
||||
} else {
|
||||
$where["a.id"] = -1;
|
||||
}
|
||||
}
|
||||
$lists = [];
|
||||
$wxqyAry = $this->mdOwners->wxqyAry();
|
||||
$statusAry = $this->mdOwners->statusAry();
|
||||
$count = $this->db->select('a.id')
|
||||
->from('lc_receiver_owners as a')
|
||||
->join('lc_receiver_orders_v2 as b', "b.id=a.o_id", 'left')
|
||||
->where($where)
|
||||
->count_all_results();
|
||||
if ($count) {
|
||||
$offset = ($page - 1) * $size;
|
||||
$res = $this->db->select('a.*,b.admin_id,b.biz_id')
|
||||
->from('lc_receiver_owners as a')
|
||||
->join('lc_receiver_orders_v2 as b', "b.id=a.o_id", 'left')
|
||||
->where($where)
|
||||
->order_by('a.id Desc')
|
||||
->limit($size, $offset)
|
||||
->get()->result_array();
|
||||
$str_brand_ids = implode(',', array_unique(array_column($res, 'brand_id')));
|
||||
$map_brands = $this->mdBrand->map('id', 'name', ["id in({$str_brand_ids})" => null]);
|
||||
$str_s_ids = implode(',', array_unique(array_column($res, 's_id')));
|
||||
$map_series = $this->mdSeries->map('id', 'name', ["id in({$str_s_ids})" => null]);
|
||||
$str_v_ids = implode(',', array_unique(array_column($res, 'v_id')));
|
||||
$map_attrs = $this->mdAttr->map('id', 'title', ["id in({$str_v_ids})" => null]);
|
||||
$str_county_ids = implode(',', array_unique(array_column($res, 'county_id')));
|
||||
$map_countys = $this->mdArea->map('county_id', 'city_name,county_name', ["county_id in({$str_county_ids})" => null]);
|
||||
#$str_biz_ids = implode(',', array_unique(array_column($res, 'biz_id')));
|
||||
#$map_bizs = $this->mdBiz->map('id', 'biz_name', ["id in({$str_biz_ids})" => null]);
|
||||
$arr_biz_id = array_unique(array_column($res, 'biz_id'));
|
||||
foreach ($arr_biz_id as $k => $v) {
|
||||
if ($v == null || $v == '') {
|
||||
unset($arr_biz_id[$k]);
|
||||
}
|
||||
}
|
||||
$str_biz_ids = implode(',', $arr_biz_id);
|
||||
$map_bizs = $arr_biz_id ? $this->mdBiz->map('id', 'biz_name', ["id in({$str_biz_ids})" => null]) : array();
|
||||
#$str_admin_ids = implode(',', array_unique(array_column($res, 'admin_id')));
|
||||
#$map_admins = $this->mdLichebUsers->map('id', 'uname', ["id in({$str_admin_ids})" => null]);
|
||||
$arr_admin_id = array_unique(array_column($res, 'admin_id'));
|
||||
foreach ($arr_admin_id as $k => $v) {
|
||||
if ($v == null || $v == '') {
|
||||
unset($arr_admin_id[$k]);
|
||||
}
|
||||
}
|
||||
$str_admin_ids = implode(',', $arr_admin_id);
|
||||
$map_admins = $arr_admin_id ? $this->mdLichebUsers->map('id', 'uname', ["id in({$str_admin_ids})" => null]) : array();
|
||||
foreach ($res as $key => $val) {
|
||||
$mobile_sub = $val['mobile'];
|
||||
$sex = $car_name = $city_name = '';
|
||||
$map_brands[$val['brand_id']] && $car_name = $map_brands[$val['brand_id']];
|
||||
$map_series[$val['s_id']] && $car_name = $car_name ? $car_name . '-' . $map_series[$val['s_id']] : $map_series[$val['s_id']];
|
||||
$map_attrs[$val['v_id']] && $car_name = $car_name ? $car_name . '-' . $map_attrs[$val['v_id']] : $map_attrs[$val['v_id']];
|
||||
$brand_name = isset($map_brands[$val['brand_id']]) ? $map_brands[$val['brand_id']] : '';
|
||||
$series_name = isset($map_series[$val['s_id']]) ? $map_series[$val['s_id']] : '';
|
||||
$v_name = isset($map_attrs[$val['v_id']]) ? $map_attrs[$val['v_id']] : '';
|
||||
$map_countys[$val['county_id']] && $city_name = $map_countys[$val['county_id']]['city_name'] . '-' . $map_countys[$val['county_id']]['county_name'];
|
||||
if (!$city_name && $val['city_id']) {
|
||||
$re_are = $this->mdArea->get(['city_id' => $val['city_id']]);
|
||||
$re_are && $city_name = $re_are['city_name'];
|
||||
}
|
||||
$val['sex'] && $sex = $val['sex'] == 1 ? '男' : '女';
|
||||
$biz_name = $map_bizs[$val['biz_id']] ? $map_bizs[$val['biz_id']] : '';
|
||||
$admin_name = $map_admins[$val['admin_id']] ? $map_admins[$val['admin_id']] : '';
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $val['mobile'],
|
||||
'mobile_sub' => $mobile_sub,
|
||||
'sex' => $sex,
|
||||
'age' => $this->getAgeByBirth($val['birth_day']),
|
||||
'car_name' => $car_name,
|
||||
'brand_name' => $brand_name,
|
||||
'series_name' => $series_name,
|
||||
'v_name' => $v_name,
|
||||
'city_name' => $city_name,
|
||||
'biz_name' => $biz_name,
|
||||
'admin_name' => $admin_name,
|
||||
'wxqy' => $wxqyAry[$val['wxqy']],
|
||||
'car_num' => $val['car_num'],
|
||||
'order_time' => $val['order_time'] != '0000-00-00 00:00:00' ? $val['order_time'] : '',
|
||||
'ck_time' => $val['ck_time'] != '0000-00-00 00:00:00' ? $val['ck_time'] : '',
|
||||
'u_time' => $val['u_time'] != '0000-00-00 00:00:00' ? $val['u_time'] : '',
|
||||
'status_name' => $statusAry[$val['status']]
|
||||
];
|
||||
}
|
||||
}
|
||||
$tag_data = $params['tags'] ? explode(',', $params['tags']) : '';
|
||||
$show_info['tags'] = $this->get_tag(0, $tag_data);
|
||||
$show_info['searchTpAry'] = $this->searchTpAry;
|
||||
$show_info['wxqyAry'] = $wxqyAry;
|
||||
$show_info['statusAry'] = $statusAry;
|
||||
$data['show_info'] = $show_info;
|
||||
$data['lists'] = $lists;
|
||||
$data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
|
||||
$data['searchTimeAry'] = $this->searchTimeAry;
|
||||
$data['params'] = $params;
|
||||
$data['_title'] = '车主列表';
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
$row = $this->mdOwners->get(array('id' => $id));
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车主不存在!');
|
||||
}
|
||||
//用户信息
|
||||
// if (SUPER_ADMIN == $this->role || 35 == $this->role) {
|
||||
// $mobile_sub = $row['mobile'];
|
||||
// } else {
|
||||
// $mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : '';
|
||||
// }
|
||||
$mobile_sub = $row['mobile'];
|
||||
$info = $row;
|
||||
$info['mobile'] = $mobile_sub;
|
||||
$info['edit_type'] = 0;
|
||||
$info['order_time'] = $row['order_time'] != '0000-00-00 00:00:00' ? $row['order_time'] : '';
|
||||
$info['ck_time'] = $row['ck_time'] != '0000-00-00 00:00:00' ? $row['ck_time'] : '';
|
||||
$info['c_time'] = date('Y-m-d H:i:s', $row['c_time']);
|
||||
$info['birth_day'] = $row['birth_day'] != '0000-00-00' ? $row['birth_day'] : '';
|
||||
$info['tag'] = $this->get_tag($row['id']);
|
||||
$biz_name = $admin_name = '';
|
||||
if ($row['o_id']) {
|
||||
$re_o = $this->mdOrders->get(array('id' => $row['o_id']), 'biz_id,admin_id');
|
||||
if ($re_o['biz_id']) {
|
||||
$re_b = $this->mdBiz->get(array('id' => $re_o['biz_id']), 'biz_name');
|
||||
$re_b && $biz_name = $re_b['biz_name'];
|
||||
}
|
||||
if ($re_o['admin_id']) {
|
||||
$re_u = $this->mdLichebUsers->get(array('id' => $re_o['admin_id']), 'uname');
|
||||
$re_u && $admin_name = $re_u['uname'];
|
||||
}
|
||||
}
|
||||
$info['biz_name'] = $biz_name;
|
||||
$info['admin_name'] = $admin_name;
|
||||
//操作日志
|
||||
$rows_log = $this->mdOwnersOplogs->select(['own_id' => $id], 'id desc', 0, 0);
|
||||
$logs = [];
|
||||
if ($rows_log) {
|
||||
foreach ($rows_log as $key => $value) {
|
||||
$rec_text = $rec_url = '';
|
||||
if ($value['type'] == 2) {
|
||||
$rec_row = $this->mdXz->get(['id' => $value['log']], 'rec_url,duration');
|
||||
if ($rec_row['duration']) {
|
||||
$rec_row['rec_url'] && $rec_url = $rec_row['rec_url'];
|
||||
!$rec_row['rec_url'] && $rec_text = '录音暂未生成';
|
||||
} else {
|
||||
$rec_text = '未接通';
|
||||
}
|
||||
}
|
||||
$imgs = [];
|
||||
if ($value['imgs']) {
|
||||
$json_imgs = json_decode($value['imgs'], true);
|
||||
foreach ($json_imgs as $key1 => $value1) {
|
||||
$imgs[] = build_qiniu_image_url($value1);
|
||||
}
|
||||
}
|
||||
$logs[] = array(
|
||||
'uname' => $value['uname'],
|
||||
'log' => $value['log'],
|
||||
'imgs' => $imgs,
|
||||
'rec_url' => $rec_url,
|
||||
'rec_text' => $rec_text,
|
||||
'type_name' => $this->mdOwnersOplogs->typeAry($value['type']),
|
||||
'c_time' => date('Y-m-d H:i', $value['c_time'])
|
||||
);
|
||||
}
|
||||
}
|
||||
$show_info['wxqyAry'] = $this->mdOwners->wxqyAry();
|
||||
$show_info['statusAry'] = $this->mdOwners->statusAry();
|
||||
$this->data['show_info'] = $show_info;
|
||||
$this->data['info'] = $info;
|
||||
$this->data['logs'] = $logs;
|
||||
$this->data['_title'] = '车主户详情';
|
||||
return $this->show_view('receiver/owners/get', true);
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
// TODO: Implement add() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增日志
|
||||
* @return bool
|
||||
*/
|
||||
function add_log()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
if (!$params['log']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入内容!');
|
||||
}
|
||||
$addData = array(
|
||||
'own_id' => $params['id'],
|
||||
'uid' => $this->uid,
|
||||
'uname' => $this->username,
|
||||
'type' => intval($params['type']),
|
||||
'log' => $params['log'],
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdOwnersOplogs->add($addData);
|
||||
if ($id) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
|
||||
} else {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @return bool
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$info = $this->input->post('info');
|
||||
if (!$info) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
|
||||
}
|
||||
$row = $this->mdOwners->get(array('id' => $info['id']));
|
||||
if (!$row) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车主信息不存在!');
|
||||
}
|
||||
$msg = '修改成功';
|
||||
$code = SYS_CODE_SUCCESS;
|
||||
if ($info['edit_type'] == 1) {//更新状态
|
||||
if ($row['status'] == $info['status']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '未修改状态!');
|
||||
}
|
||||
$statuAry = $this->mdOwners->statusAry();
|
||||
$status_name = $statuAry[$row['status']];
|
||||
$status_name_up = $statuAry[$info['status']];
|
||||
$log = '更新状态(' . $status_name . ')为(' . $status_name_up . ')';
|
||||
$up_data['status'] = $info['status'];
|
||||
$ret = $this->mdOwners->update($up_data, array('id' => $info['id']));
|
||||
if (!$ret) {
|
||||
$code = SYS_CODE_FAIL;
|
||||
$msg = '修改状态失败';
|
||||
} else {
|
||||
$msg = '修改状态成功';
|
||||
$this->addLog(array('own_id' => $info['id'], 'type' => 0, 'log' => $log));
|
||||
}
|
||||
} else if ($info['edit_type'] == 2) {
|
||||
//更新车主信息
|
||||
$ret = $this->mdOwners->update(['name' => $info['name'], 'mobile' => $info['mobile'], 'birth_day' => $info['birth_day'], 'sex' => $info['sex'],
|
||||
'brand_id' => $info['brand_id'], 's_id' => $info['s_id'], 'v_id' => $info['v_id'], 'car_num' => $info['car_num'],
|
||||
'order_time' => $info['order_time'], 'ck_time' => $info['ck_time'], 'wxqy' => $info['wxqy']
|
||||
, 'city_id' => $info['city_id'], 'county_id' => $info['county_id']], ['id' => $info['id']]);
|
||||
if (!$ret) {
|
||||
$code = SYS_CODE_FAIL;
|
||||
$msg = '修改车主信息失败';
|
||||
} else {
|
||||
$msg = '修改车主信息成功';
|
||||
$this->addLog(array('own_id' => $info['id'], 'type' => 0, 'log' => '更新车主信息'));
|
||||
}
|
||||
} else if ($info['edit_type'] == 3) {
|
||||
$id = $info['id'];
|
||||
//客户标签
|
||||
if (!$info['tag']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '客户画像不存在!');
|
||||
}
|
||||
$add_tag = [];
|
||||
//查找已加入标签
|
||||
$res_td = $this->mdOwnersTagdata->select(['o_id' => $id], 'id desc', 0, 0, 't_id');
|
||||
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
|
||||
foreach ($info['tag'] as $key => $val) {
|
||||
foreach ($val['list'] as $key2 => $val2) {
|
||||
if ($val['type'] == 'checkbox') {
|
||||
if ($val2['checked'] == 'true') {
|
||||
if (!$tag_data || !in_array($val2['id'], $tag_data)) {//未加标签,新增
|
||||
$add_tag[] = ['o_id' => $id, 't_id' => $val2['id'], 'c_time' => time()];
|
||||
}
|
||||
} else {
|
||||
if ($tag_data && in_array($val2['id'], $tag_data)) {//删除标签
|
||||
$this->mdOwnersTagdata->delete(['o_id' => $id, 't_id' => $val2['id']]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($val['value'] == $val2['id']) {
|
||||
if (!$tag_data || !in_array($val2['id'], $tag_data)) {//未加标签,新增
|
||||
$add_tag[] = ['o_id' => $id, 't_id' => $val2['id'], 'c_time' => time()];
|
||||
}
|
||||
} else {
|
||||
if ($tag_data && in_array($val2['id'], $tag_data)) {//删除标签
|
||||
$this->mdOwnersTagdata->delete(['o_id' => $id, 't_id' => $val2['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($add_tag && count($add_tag)) {
|
||||
$this->mdOwnersTagdata->add_batch($add_tag);
|
||||
}
|
||||
$this->addLog(array('own_id' => $info['id'], 'type' => 0, 'log' => '修改车主画像'));
|
||||
}
|
||||
return $this->show_json($code, $msg);
|
||||
}
|
||||
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
public function batch()
|
||||
{
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$data = $indexs = array();
|
||||
$res = $this->dataSelect($params);
|
||||
$fileName = $res['_title'];
|
||||
$indexs_tags = array();
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$temp['name'] = $value['name'];
|
||||
$temp['mobile'] = $value['mobile'];
|
||||
$temp['car_name'] = $value['car_name'];
|
||||
$temp['brand_name'] = $value['brand_name'];
|
||||
$temp['series_name'] = $value['series_name'];
|
||||
$temp['v_name'] = $value['v_name'];
|
||||
$temp['city_name'] = $value['city_name'];
|
||||
$temp['car_num'] = $value['car_num'];
|
||||
$temp['sex'] = $value['sex'];
|
||||
$temp['age'] = $value['age'];
|
||||
$temp['wxqy'] = $value['wxqy'];
|
||||
$temp['status_name'] = $value['status_name'];
|
||||
$temp['order_time'] = $value['order_time'];
|
||||
$temp['ck_time'] = $value['ck_time'];
|
||||
$temp['city_name'] = $value['city_name'];
|
||||
$temp['biz_name'] = $value['biz_name'];
|
||||
$temp['admin_name'] = $value['admin_name'];
|
||||
$temp['u_time'] = $value['u_time'];
|
||||
|
||||
$tag = $this->get_tag($value['id']);
|
||||
foreach ($tag as $key2 => $val2) {
|
||||
$tag_id_key = 'tag_id_' . $val2['id'];
|
||||
$tag_name = $val2['name'];
|
||||
$tag_value = $val2['value_name'];
|
||||
if (!in_array($tag_id_key, array_keys($indexs_tags))) {
|
||||
$indexs_tags[$tag_id_key] = $tag_name;
|
||||
}
|
||||
$temp[$tag_id_key] = $tag_value;
|
||||
}
|
||||
|
||||
$data[] = $temp;
|
||||
}
|
||||
$indexs = [
|
||||
'name' => '车主',
|
||||
'mobile' => '手机号',
|
||||
#'car_name' => '车辆',
|
||||
'brand_name' => '品牌',
|
||||
'series_name' => '车系',
|
||||
'v_name' => '车型',
|
||||
'city_name' => '所在城市',
|
||||
'car_num' => '车牌号',
|
||||
"sex" => "性别",
|
||||
"age" => "年龄",
|
||||
"wxqy" => "企微好友",
|
||||
"status_name" => "状态",
|
||||
"order_time" => "购车时间",
|
||||
"ck_time" => "交付时间",
|
||||
"biz_name" => "所属门店",
|
||||
"admin_name" => "销售员",
|
||||
"u_time" => "最后操作时间",
|
||||
];
|
||||
$indexs = array_merge($indexs, $indexs_tags);
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:增加日志
|
||||
* Created on: 2021/7/23 10:48
|
||||
* Created by: dengbw
|
||||
* @param array $ary
|
||||
* @return mixed
|
||||
*/
|
||||
private function addLog($ary = array())
|
||||
{
|
||||
$id = 0;
|
||||
if ($ary['log']) {
|
||||
$addData = array(
|
||||
'own_id' => $ary['own_id'],
|
||||
'uid' => $this->uid,
|
||||
'uname' => $this->username,
|
||||
'type' => intval($ary['type']),
|
||||
'log' => $ary['log'],
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdOwnersOplogs->add($addData);
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:车主标签
|
||||
* Created on: 2022/6/16 14:47
|
||||
* Created by: dengbw
|
||||
* @param $id
|
||||
* @param $tag_data
|
||||
* @return array
|
||||
*/
|
||||
private function get_tag($id, $tag_data = '')
|
||||
{
|
||||
$show = $res_td = [];
|
||||
$res = $this->mdOwnersTag->select(['status' => 1, 'pid' => 0], 'sort desc,id desc', 0, 0, 'id,name,type');
|
||||
if ($res) {
|
||||
if ($id) {
|
||||
$res_td = $this->mdOwnersTagdata->select(['o_id' => $id], 'id desc', 0, 0, 't_id');//查找用户选择
|
||||
$tag_data = $res_td ? array_unique(array_column($res_td, 't_id')) : '';
|
||||
}
|
||||
foreach ($res as $key => $val) {
|
||||
$list = [];
|
||||
$value = '';
|
||||
$value_name = '';
|
||||
$res2 = $this->mdOwnersTag->select(['status' => 1, 'pid' => $val['id']], 'sort desc,id desc', 0, 0, 'id,name');
|
||||
foreach ($res2 as $key2 => $val2) {
|
||||
//检查是否选中标签
|
||||
$setValue = ['id' => $val2['id'], 'name' => $val2['name']];
|
||||
if ($val['type'] == 'checkbox') {
|
||||
$setValue['checked'] = $tag_data && in_array($val2['id'], $tag_data) ? true : false;
|
||||
$setValue['checked'] && $value_name .= $val2['name'] . ' ';
|
||||
} else {
|
||||
if ($tag_data && in_array($val2['id'], $tag_data)) {
|
||||
$value = $val2['id'];
|
||||
$value_name .= $val2['name'];
|
||||
}
|
||||
}
|
||||
$list[] = $setValue;
|
||||
}
|
||||
$value_name = trim($value_name);
|
||||
$show[] = ['id' => $val['id'], 'name' => $val['name'], 'type' => $val['type'], 'value' => $value, 'value_name' => $value_name, 'list' => $list];
|
||||
}
|
||||
}
|
||||
return $show;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:根据生日计算年龄,年龄的格式是:2018-01-22
|
||||
* Created on: 2022/6/16 14:47
|
||||
* Created by: dengbw
|
||||
* @param $birthday
|
||||
* @return false|int|string
|
||||
*/
|
||||
private function getAgeByBirth($birthday)
|
||||
{
|
||||
$birth_year = date('Y', strtotime($birthday));
|
||||
$birth_month = date('m', strtotime($birthday));
|
||||
$birth_day = date('d', strtotime($birthday));
|
||||
if (!$birthday || $birthday == '0000-00-00') {
|
||||
return '';
|
||||
}
|
||||
if (empty($birth_year) || empty($birth_month) || empty($birth_day)) {
|
||||
return '';
|
||||
}
|
||||
$current_year = date('Y', time());
|
||||
$current_month = date('m', time());
|
||||
$current_day = date('d', time());
|
||||
if ($birth_year >= $current_year) {
|
||||
return 0;
|
||||
}
|
||||
$age = $current_year - $birth_year - 1;
|
||||
if ($current_month > $birth_month) {
|
||||
return $age + 1;
|
||||
} else if ($current_month == $birth_month && $current_day >= $birth_day) {
|
||||
return $age + 1;
|
||||
} else {
|
||||
return $age;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class OwnersTag extends HD_Controller
|
||||
{
|
||||
private $tabAry = [
|
||||
1 => ['title' => '客户标签', 'url' => '/receiver/tag'],
|
||||
2 => ['title' => '车主标签', 'url' => '/receiver/ownersTag'],
|
||||
3 => ['title' => '战败标签', 'url' => '/receiver/tag?tag_type=1'],
|
||||
4 => ['title' => '意向标签', 'url' => '/receiver/tag?tag_type=2']
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/receiver_owners_tag_model', 'mdOwnersTag');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$params['tab'] = 2;
|
||||
$statusAry = $this->mdOwnersTag->statusAry();
|
||||
$typeAry = $this->mdOwnersTag->typeAry();
|
||||
$lists = array();
|
||||
$where = ["status<>-1" => null, 'pid' => 0];
|
||||
if (strlen($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
if ($params['type']) {
|
||||
$where['type'] = $params['type'];
|
||||
}
|
||||
$count = $this->mdOwnersTag->count($where);
|
||||
if ($count) {
|
||||
$res = $this->mdOwnersTag->select($where, "sort desc,id desc", $params['page'], $params['size']);
|
||||
foreach ($res as $key => $value) {
|
||||
$setValue = array();
|
||||
$setValue['id'] = $value['id'];
|
||||
$setValue['name'] = $value['name'];
|
||||
$setValue['sort'] = $value['sort'];
|
||||
$setValue['type_name'] = $typeAry[$value['type']];
|
||||
$setValue['status'] = $value['status'];
|
||||
$setValue['status_name'] = $statusAry[$value['status']];
|
||||
$options = '';
|
||||
$res_tag = $this->mdOwnersTag->select(["status" => 1, 'pid' => $value['id']], "sort desc,id desc", 0, 0, 'id,name,sort');
|
||||
$res_tag && $options = implode(',', array_column($res_tag, 'name'));
|
||||
$setValue['options'] = $options;
|
||||
$lists[] = $setValue;
|
||||
}
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['showInfo'] = ['statusAry' => $statusAry, 'typeAry' => $typeAry, 'tabAry' => $this->tabAry];
|
||||
$this->data['_title'] = '车主标签列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
return $this->show_view('receiver/ownerstag/lists', true);
|
||||
}
|
||||
|
||||
public function get_options()
|
||||
{
|
||||
$id = intval($this->input->post('id'));
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$res_tag = $this->mdOwnersTag->select(["status" => 1, 'pid' => $id], "sort desc,id desc", 0, 0, 'id,name,sort,status');
|
||||
$this->data['lists'] = $res_tag;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
//展示单条数据
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
if ($id) {
|
||||
$url = "receiver/ownersTag/edit";
|
||||
$re = $this->mdOwnersTag->get(['id' => $id]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车主标签不存在!');
|
||||
}
|
||||
$name = $re['name'];
|
||||
$sort = $re['sort'];
|
||||
$type = $re['type'];
|
||||
} else {
|
||||
$url = "receiver/ownersTag/add";
|
||||
$name = '';
|
||||
$sort = 0;
|
||||
$type = 'checkbox';
|
||||
}
|
||||
$this->data['showInfo'] = ['id' => $id, 'name' => $name, 'sort' => $sort, 'type' => $type,
|
||||
'typeAry' => $this->mdOwnersTag->typeAry(), 'url' => $url];
|
||||
return $this->show_view('receiver/ownerstag/edit');
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称不能为空!');
|
||||
}
|
||||
$re = $this->mdOwnersTag->get(array('name' => $params['name']));
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称已存在了!');
|
||||
}
|
||||
$id = $this->mdOwnersTag->add(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']]);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
$params = $this->input->post();
|
||||
if (!$params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
if (!$params['name']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入标签名称');
|
||||
}
|
||||
$re = $this->mdOwnersTag->get(array('name' => $params['name'], 'status' => 1));
|
||||
if ($re && $re['id'] != $params['id']) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称已存在了!');
|
||||
}
|
||||
$this->mdOwnersTag->update(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']],
|
||||
['id' => $params['id']]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$re = $this->mdOwnersTag->get(['id' => $id]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签不存在!');
|
||||
}
|
||||
$this->mdOwnersTag->update(['status' => '-1'], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//修改标签选项
|
||||
function edit_options()
|
||||
{
|
||||
$pid = $this->input->post('id');
|
||||
$options = $this->input->post('options');
|
||||
if (!$pid || !$options) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$re = $this->mdOwnersTag->get(['id' => $pid]);
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '车主标签不存在!');
|
||||
}
|
||||
$add_tag = $edit_tag = [];
|
||||
foreach ($options as $key => $value) {
|
||||
$sort = intval($value['sort']);
|
||||
$data = ['name' => $value['name'], 'status' => $value['status'], 'sort' => $sort];
|
||||
if ($value['name']) {
|
||||
if ($value['id']) {//修改
|
||||
$this->mdOwnersTag->update($data, ['id' => $value['id']]);
|
||||
} else {//新增
|
||||
$add_tag[] = ['name' => $value['name'], 'order' => $sort];
|
||||
$data['pid'] = $pid;
|
||||
$this->mdOwnersTag->add($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
function edit_status()
|
||||
{
|
||||
$id = $this->input->post('id');
|
||||
$stauts = intval($this->input->post('status'));
|
||||
if (!$id) {
|
||||
$this->show_json(SYS_CODE_FAIL, '参数错误');
|
||||
}
|
||||
$this->mdOwnersTag->update(['status' => $stauts], ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,12 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Tag extends HD_Controller
|
||||
{
|
||||
private $tabAry = [
|
||||
1 => ['title' => '客户标签', 'url' => '/receiver/tag'],
|
||||
2 => ['title' => '车主标签', 'url' => '/receiver/ownersTag'],
|
||||
3 => ['title' => '战败标签', 'url' => '/receiver/tag?tag_type=1'],
|
||||
4 => ['title' => '意向标签', 'url' => '/receiver/tag?tag_type=2']
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -23,11 +29,14 @@ class Tag extends HD_Controller
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
#$params['tab'] = $params['tag_type'] ? 3 : 1;
|
||||
$params['tab'] = $params['tag_type'] ? $params['tag_type'] + 2 : 1;
|
||||
$statusAry = $this->mdCustomerTag->statusAry();
|
||||
$typeAry = $this->mdCustomerTag->typeAry();
|
||||
$showAry = $this->mdCustomerTag->showAry();
|
||||
$lists = array();
|
||||
$where = ["status<>-1" => null, 'pid' => 0];
|
||||
$where['tag_type'] = $params['tag_type'] ? $params['tag_type'] : 0;
|
||||
if (strlen($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
}
|
||||
@@ -58,7 +67,7 @@ class Tag extends HD_Controller
|
||||
}
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['showInfo'] = ['statusAry' => $statusAry, 'typeAry' => $typeAry, 'showAry' => $showAry];
|
||||
$this->data['showInfo'] = ['statusAry' => $statusAry, 'typeAry' => $typeAry, 'showAry' => $showAry, 'tabAry' => $this->tabAry];
|
||||
$this->data['_title'] = '客户标签列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
return $this->show_view('/receiver/tag/lists', true);
|
||||
@@ -79,6 +88,8 @@ class Tag extends HD_Controller
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
$tag_type = $this->input->get('tag_type');
|
||||
!$tag_type && $tag_type = 0;
|
||||
if ($id) {
|
||||
$url = "/receiver/tag/edit";
|
||||
$re = $this->mdCustomerTag->get(['id' => $id]);
|
||||
@@ -96,7 +107,7 @@ class Tag extends HD_Controller
|
||||
$type = 'checkbox';
|
||||
}
|
||||
$this->data['showInfo'] = ['id' => $id, 'name' => $name, 'sort' => $sort, 'type' => $type, 'show' => $show,
|
||||
'typeAry' => $this->mdCustomerTag->typeAry(), 'showAry' => $this->mdCustomerTag->showAry(), 'url' => $url];
|
||||
'typeAry' => $this->mdCustomerTag->typeAry(), 'showAry' => $this->mdCustomerTag->showAry(), 'url' => $url,'tag_type'=>$tag_type];
|
||||
return $this->show_view('/receiver/tag/edit');
|
||||
}
|
||||
|
||||
@@ -111,8 +122,14 @@ class Tag extends HD_Controller
|
||||
if ($re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签名称已存在了!');
|
||||
}
|
||||
$id = $this->mdCustomerTag->add(['name' => $params['name'], 'sort' => $params['sort'], 'type' => $params['type']
|
||||
, 'show' => $params['show']]);
|
||||
$add_data = [
|
||||
'name' => $params['name'],
|
||||
'sort' => $params['sort'],
|
||||
'type' => $params['type'],
|
||||
'show' => $params['show']
|
||||
];
|
||||
$params['tag_type'] && $add_data['tag_type'] = $params['tag_type'];
|
||||
$id = $this->mdCustomerTag->add($add_data);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
@@ -155,6 +172,9 @@ class Tag extends HD_Controller
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '标签不存在!');
|
||||
}
|
||||
if ($re['tag_type'] == 2) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '该标签不能删除!');
|
||||
}
|
||||
$this->mdCustomerTag->update(['status' => '-1'], ['id' => $id]);
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'admin.liche.cn') && $re['qy_id']) {//正试才能修改企业标签
|
||||
$this->load->library('wx_qyapi', ['app' => 'lichene']);
|
||||
@@ -178,7 +198,7 @@ class Tag extends HD_Controller
|
||||
$add_tag = $del_tag = $edit_tag = [];
|
||||
foreach ($options as $key => $value) {
|
||||
$sort = intval($value['sort']);
|
||||
$data = ['name' => $value['name'], 'status' => $value['status'], 'sort' => $sort];
|
||||
$data = ['name' => $value['name'], 'status' => $value['status'], 'sort' => $sort, 'tag_type' => $re['tag_type']];
|
||||
if ($value['status'] == -1 && $value['qy_id']) {//删除标签
|
||||
$del_tag[] = $value['qy_id'];
|
||||
}
|
||||
@@ -195,7 +215,7 @@ class Tag extends HD_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'admin.liche.cn')) {//正试才能修改企业标签
|
||||
if (false !== strpos($_SERVER['HTTP_HOST'], 'admin.liche.cn') && !$re['tag_type']) {//正试才能修改企业标签
|
||||
$this->load->library('wx_qyapi', ['app' => 'lichene']);
|
||||
if (count($add_tag)) {//新增标签
|
||||
if (!$re['qy_id']) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,680 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class order extends HD_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders');
|
||||
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->load->model('app/licheb/app_licheb_users_log_model', 'mdUsersLog');
|
||||
$this->load->model('biz/biz_model', 'mdBiz');
|
||||
}
|
||||
|
||||
//首页信息
|
||||
public function index()
|
||||
{
|
||||
return $this->get_dfdq();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:东风
|
||||
* Created on: 2022/8/22 15:04
|
||||
* Created by: dengbw
|
||||
* @return bool|void
|
||||
*/
|
||||
public function get_dfmc()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$config['brand_id'] = 1;
|
||||
$config['bizs'] = [
|
||||
1 => ['biz_name' => '厦门品牌店', 'ids' => '20', 'rowspan' => 1],
|
||||
2 => ['biz_name' => '泉州品牌店', 'ids' => '99'], 3 => ['biz_name' => '福州品牌店', 'ids' => '55'],
|
||||
4 => ['biz_name' => '厦门合伙店', 'type' => 2, 'city_id' => '350200'],
|
||||
5 => ['biz_name' => '泉州代理店', 'not_ids' => '99', 'city_id' => '350500'],
|
||||
6 => ['biz_name' => '福州代理店', 'type' => 3, 'city_id' => '350100'],
|
||||
7 => ['biz_name' => '龙岩代理店', 'type' => 3, 'city_id' => '350800'],
|
||||
8 => ['biz_name' => '宁德代理店', 'city_id' => '350900'],
|
||||
9 => ['biz_name' => '莆田代理店', 'type' => 3, 'city_id' => '350300'],
|
||||
10 => ['biz_name' => '三明代理店', 'type' => 3, 'city_id' => '350400'],
|
||||
11 => ['biz_name' => '漳州代理店', 'type' => 3, 'city_id' => '350600'],
|
||||
12 => ['biz_name' => '南平代理店', 'type' => 3, 'city_id' => '350700'],
|
||||
];
|
||||
$res = $this->commonSelect($params, $config);
|
||||
$this->data['info'] = $res['info'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['url'] = '/stats/order/get_dfmc';
|
||||
$this->data['_title'] = '东风';
|
||||
return $this->show_view('stats/order/common', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:零跑
|
||||
* Created on: 2022/8/22 14:19
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function get_leapmotor()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$config['brand_id'] = 5;
|
||||
$config['bizs'] = [
|
||||
1 => ['biz_name' => '泉州零跑品牌店', 'ids' => '63', 'rowspan' => 1],
|
||||
2 => ['biz_name' => '泉州渠道', 'not_ids' => '63', 'city_id' => '350500', 'show' => 'order'],
|
||||
3 => ['biz_name' => '厦门渠道', 'city_id' => '350200', 'show' => 'order'],
|
||||
4 => ['biz_name' => '福州渠道', 'city_id' => '350100', 'show' => 'order'],
|
||||
];
|
||||
$res = $this->commonSelect($params, $config);
|
||||
$this->data['info'] = $res['info'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['url'] = '/stats/order/get_leapmotor';
|
||||
$this->data['_title'] = '零跑';
|
||||
return $this->show_view('stats/order/common', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:哪吒
|
||||
* Created on: 2022/8/17 14:19
|
||||
* Created by: dengbw
|
||||
*/
|
||||
public function get_hozonauto()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$config['brand_id'] = 4;
|
||||
$config['bizs'] = [
|
||||
1 => ['biz_name' => '宁德哪吒品牌店', 'ids' => '70', 'rowspan' => 1],
|
||||
2 => ['biz_name' => '宁德哪吒代理店', 'type' => 3, 'city_id' => '350900', 'show' => 'order'],
|
||||
3 => ['biz_name' => '厦门哪吒订单中心', 'city_id' => '350200', 'show' => 'order'],
|
||||
4 => ['biz_name' => '泉州哪吒订单中心', 'city_id' => '350500', 'show' => 'order'],
|
||||
5 => ['biz_name' => '福州哪吒订单中心', 'city_id' => '350100', 'show' => 'order'],
|
||||
6 => ['biz_name' => '漳州哪吒品牌店', 'type' => 1, 'city_id' => '350600', 'show' => 'order'],
|
||||
7 => ['biz_name' => '漳州哪吒代理店', 'type' => 3, 'city_id' => '350600', 'show' => 'order'],
|
||||
];
|
||||
$res = $this->commonSelect($params, $config);
|
||||
$this->data['info'] = $res['info'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['url'] = '/stats/order/get_hozonauto';
|
||||
$this->data['_title'] = '哪吒';
|
||||
return $this->show_view('stats/order/common', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:代理店
|
||||
* Created on: 2022/8/23 14:17
|
||||
* Created by: dengbw
|
||||
* @return bool|void
|
||||
*/
|
||||
public function get_agent()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$config['brands'] = [1 => '东风ev', 4 => '哪吒', 5 => '零跑'];
|
||||
$config['bizs'] = [
|
||||
1 => ['biz_name' => '泉州代理店', 'type' => 3, 'city_id' => '350500', 'rowspan' => 1],
|
||||
2 => ['biz_name' => '福州代理店', 'type' => 3, 'city_id' => '350100'],
|
||||
3 => ['biz_name' => '龙岩代理店', 'type' => 3, 'city_id' => '350800'],
|
||||
4 => ['biz_name' => '宁德代理店', 'type' => 3, 'city_id' => '350900'],
|
||||
5 => ['biz_name' => '莆田代理店', 'type' => 3, 'city_id' => '350300'],
|
||||
6 => ['biz_name' => '三明代理店', 'type' => 3, 'city_id' => '350400'],
|
||||
7 => ['biz_name' => '南平代理店', 'type' => 3, 'city_id' => '350700'],
|
||||
8 => ['biz_name' => '漳州代理店', 'type' => 3, 'city_id' => '350600'],
|
||||
9 => ['biz_name' => '厦门代理店', 'type' => 3, 'city_id' => '350200'],
|
||||
];
|
||||
$res = $this->common2Select($params, $config);
|
||||
$this->data['info'] = $res['info'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['url'] = '/stats/order/get_agent';
|
||||
$this->data['type_name'] = '代理店';
|
||||
$this->data['_title'] = '代理店群';
|
||||
return $this->show_view('stats/order/common2', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:合伙店
|
||||
* Created on: 2022/8/23 14:17
|
||||
* Created by: dengbw
|
||||
* @return bool|void
|
||||
*/
|
||||
public function get_partner()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$config['brands'] = [1 => '东风ev', 4 => '哪吒', 5 => '零跑'];
|
||||
$config['bizs'] = [1 => ['biz_name' => '厦门合伙店', 'type' => 2, 'city_id' => '350200', 'rowspan' => 1]];
|
||||
$res = $this->common2Select($params, $config);
|
||||
$this->data['info'] = $res['info'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['url'] = '/stats/order/get_partner';
|
||||
$this->data['type_name'] = '合伙店';
|
||||
$this->data['_title'] = '合伙店群';
|
||||
return $this->show_view('stats/order/common2', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:品牌店群
|
||||
* Created on: 2022/8/17 14:17
|
||||
* Created by: dengbw
|
||||
* @return bool|void
|
||||
*/
|
||||
public function get_dfdq()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$config['brands'] = [1 => '东风ev', 4 => '哪吒', 5 => '零跑'];
|
||||
$config['bizs'] = [
|
||||
1 => ['biz_name' => '厦门东风', 'ids' => '20', 'rowspan' => 1],
|
||||
2 => ['biz_name' => '晋江东风', 'ids' => '99'],
|
||||
3 => ['biz_name' => '福州东风', 'ids' => '55'],
|
||||
4 => ['biz_name' => '厦门哪吒', 'ids' => '191'],
|
||||
5 => ['biz_name' => '宁德哪吒', 'ids' => '70'],
|
||||
6 => ['biz_name' => '漳州哪吒', 'ids' => '160'],
|
||||
7 => ['biz_name' => '泉州零跑', 'ids' => '63'],
|
||||
];
|
||||
$res = $this->common2Select($params, $config);
|
||||
$this->data['info'] = $res['info'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['url'] = '/stats/order/';
|
||||
$this->data['type_name'] = '品牌店';
|
||||
$this->data['_title'] = '品牌店群';
|
||||
return $this->show_view('stats/order/common2', true);
|
||||
}
|
||||
|
||||
private function common2Select($params, $config)
|
||||
{
|
||||
!$params['type'] && $params['type'] = 1;
|
||||
$start_date = date('Y-m', strtotime("-2 month"));//取最近3个月
|
||||
$end_date = date('Y-m');
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] && $start_date = $time[0];
|
||||
$time[1] && $end_date = $time[1];
|
||||
} else {
|
||||
$params['time'] = $start_date . ' ~ ' . $end_date;
|
||||
}
|
||||
$date_months = $this->dateMonths($start_date, $end_date);
|
||||
rsort($date_months);
|
||||
$days = [];
|
||||
foreach ($date_months as $k => $v) {
|
||||
$month = date('n', strtotime($v . '-01'));
|
||||
$days[$v] = ['month' => $month, 'num' => 0];
|
||||
}
|
||||
$brands = $config['brands'];
|
||||
$bizs = $config['bizs'];
|
||||
foreach ($bizs as $k => $v) {
|
||||
$str_ids = $v['ids'] ? $v['ids'] : '';
|
||||
if (!$str_ids) {
|
||||
$where_b = ['city_id' => $v['city_id']];
|
||||
$v['type'] && $where_b['type'] = $v['type'];
|
||||
$v['not_ids'] && $where_b["id not in({$v['not_ids']})"] = null;
|
||||
$res = $this->mdBiz->select($where_b, 'id desc', 0, 0, 'id');
|
||||
if ($res) {
|
||||
$str_ids = implode(',', array_unique(array_column($res, 'id')));
|
||||
$str_ids = $str_ids ? $str_ids : '-2';
|
||||
}
|
||||
}
|
||||
$list = [];
|
||||
foreach ($days as $k2 => $v2) {
|
||||
$order_time = $this->getTime($k2);
|
||||
$c_time = $this->getTime($k2, 1);
|
||||
if ($params['type'] == 2) {
|
||||
$num = $this->mdOrders->count(["biz_id in({$str_ids})" => null, 'status in(0,1)' => null, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']]);
|
||||
} else {
|
||||
$num = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$str_ids})" => null, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time'], 'a.order_time<=' => $order_time['e_time']
|
||||
, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']])
|
||||
->count_all_results();
|
||||
}
|
||||
$list[$k2] = $num;
|
||||
$days[$k2]['num'] = $v2['num'] + $num;
|
||||
}
|
||||
$v['list'] = $list;
|
||||
$v['ids'] = $str_ids;
|
||||
$bizs[$k] = $v;
|
||||
}
|
||||
$brands_stats = $customers_stats = $process = [];
|
||||
foreach ($bizs as $k => $v) {
|
||||
$list = [];
|
||||
foreach ($brands as $k2 => $v2) {
|
||||
$stats_per = $stats = [];
|
||||
foreach ($days as $k3 => $v3) {
|
||||
$order_time = $this->getTime($k3);
|
||||
$c_time = $this->getTime($k3, 1);
|
||||
if ($params['type'] == 2) {
|
||||
$num = $this->mdOrders->count(["biz_id in({$v['ids']})" => null, 'brand_id' => $k2, 'status in(0,1)' => null, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']]);
|
||||
} else {
|
||||
$num = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.brand_id' => $k2, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time'], 'a.order_time<=' => $order_time['e_time']
|
||||
, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']])
|
||||
->count_all_results();
|
||||
}
|
||||
$stats_per[] = $this->getPercentage(['num' => $num, 'sum' => $v['list'][$k3]]);
|
||||
$stats[] = $num;
|
||||
}
|
||||
$list[] = ['brand_name' => $v2, 'stats_per' => $stats_per, 'stats' => $stats];
|
||||
}
|
||||
$brands_stats[] = ['biz_name' => $v['biz_name'], 'list' => $list];
|
||||
}
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
$offlineSources_count = count($offlineSources);
|
||||
//线索成交情况
|
||||
foreach ($bizs as $k => $v) {
|
||||
$list = $cus_sum = $ord_sum = $cus_per = [];
|
||||
$cus_1 = $ord_1 = [];//自然到店
|
||||
foreach ($offlineSources as $k2 => $v2) {
|
||||
$stats_per_cus = $stats_cus = $stats_per_ord = $stats_ord = [];
|
||||
foreach ($days as $k3 => $v3) {
|
||||
$c_time = $this->getTime($k3, 1);
|
||||
$order_time = $this->getTime($k3);
|
||||
$num_cus = $this->mdCustomers->count(["biz_id in({$v['ids']})" => null, 'of_id' => $k2, 'status>=' => 0, 'c_time>=' => $c_time['s_time'], 'c_time<=' => $c_time['e_time']]);
|
||||
if ($params['type'] == 2) {
|
||||
$num_ord = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time']
|
||||
, 'a.order_time<=' => $order_time['e_time'], 'b.of_id' => $k2])
|
||||
->count_all_results();
|
||||
} else {
|
||||
$num_ord = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time'], 'a.order_time<=' => $order_time['e_time']
|
||||
, 'b.of_id' => $k2, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']])
|
||||
->count_all_results();
|
||||
}
|
||||
$cus_sum[$k3] += $num_cus;
|
||||
$ord_sum[$k3] += $num_ord;
|
||||
$stats_cus[] = $num_cus;
|
||||
$stats_ord[$k3] = $num_ord;
|
||||
$stats_per_cus[] = $this->getPercentage(['num' => $num_ord, 'sum' => $num_cus]);
|
||||
$stats_per_ord[$k3] = '0.00%';
|
||||
if ($k2 == 1) {//自然到店
|
||||
$cus_1[$k3] = $num_cus;
|
||||
$ord_1[$k3] = $num_ord;
|
||||
}
|
||||
}
|
||||
$list[] = ['name' => "{$v2['name']}(转化率)", 'type' => 1, 'stats_per' => $stats_per_cus, 'stats' => $stats_cus];
|
||||
$list[] = ['name' => "{$v2['name']}(订单占比)", 'type' => 2, 'stats_per' => $stats_per_ord, 'stats' => $stats_ord];
|
||||
}
|
||||
foreach ($days as $k3 => $v3) {
|
||||
$ord = $ord_1[$k3] ? $ord_sum[$k3] - $ord_1[$k3] : $ord_sum[$k3];
|
||||
$cus = $cus_1[$k3] ? $cus_sum[$k3] - $cus_1[$k3] : $cus_sum[$k3];
|
||||
$cus_per[] = $this->getPercentage(['num' => $ord, 'sum' => $cus]);
|
||||
}
|
||||
$customers_stats[] = ['biz_name' => $v['biz_name'], 'cus_sum' => $cus_sum, 'ord_sum' => $ord_sum, 'cus_per' => $cus_per, 'list' => $list];
|
||||
}
|
||||
//过程数据
|
||||
$process_cus = $process_into = $process_ord = [];
|
||||
foreach ($bizs as $k => $v) {
|
||||
$list_cus = $cus_sum = $list_into = $ord_into = $into_sum = $list_ord = $ord_sum = [];
|
||||
foreach ($offlineSources as $k2 => $v2) {
|
||||
$stats_per_cus = $stats_cus = $stats_per_into = $stats_into = $stats_per_ord = $stats_ord = [];
|
||||
foreach ($days as $k3 => $v3) {
|
||||
$order_time = $this->getTime($k3);
|
||||
$c_time = $this->getTime($k3, 1);
|
||||
//线索数
|
||||
$num_cus = 0;
|
||||
if ($k2 != 1) {//不包括自然到店
|
||||
$num_cus = $this->mdCustomers->count(["biz_id in({$v['ids']})" => null, 'of_id' => $k2, 'status>=' => 0, 'c_time>=' => $c_time['s_time'], 'c_time<=' => $c_time['e_time']]);
|
||||
$cus_sum[$k3] += $num_cus;
|
||||
$stats_cus[] = $num_cus;
|
||||
$stats_per_cus[$k3] = $num_cus;
|
||||
}
|
||||
//进店数
|
||||
if ($params['type'] == 2) {
|
||||
$num_into = $this->mdUsersLog->db->select('a.id')
|
||||
->from('lc_receiver_customer_oplogs as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(['a.type' => 4, 'a.log' => '客户到店', 'a.c_time>=' => $c_time['s_time'], 'a.c_time<=' => $c_time['e_time'],
|
||||
'b.status>=' => 0, "b.biz_id in({$v['ids']})" => null, 'b.of_id' => $k2])
|
||||
->count_all_results();
|
||||
} else {
|
||||
$num_into = $this->mdUsersLog->db->select('a.id')
|
||||
->from('lc_receiver_customer_oplogs as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(['a.type' => 4, 'a.log' => '客户到店', 'a.c_time>=' => $c_time['s_time'], 'a.c_time<=' => $c_time['e_time'],
|
||||
'b.status>=' => 0, "b.biz_id in({$v['ids']})" => null, 'b.of_id' => $k2, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']])
|
||||
->count_all_results();
|
||||
}
|
||||
$into_sum[$k3] += $num_into;
|
||||
$stats_into[] = $num_into;
|
||||
$num_into_per = '';
|
||||
if ($k2 != 1) {//转化率=进店数/客户数
|
||||
$num_into_per = $this->getPercentage(['num' => $num_into, 'sum' => $num_cus]);
|
||||
}
|
||||
$stats_per_into[$k3] = $num_into_per;
|
||||
//成交数
|
||||
if ($params['type'] == 2) {
|
||||
$num_ord = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time']
|
||||
, 'a.order_time<=' => $order_time['e_time'], 'b.of_id' => $k2])
|
||||
->count_all_results();
|
||||
} else {
|
||||
$num_ord = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time'], 'a.order_time<=' => $order_time['e_time']
|
||||
, 'b.of_id' => $k2, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']])
|
||||
->count_all_results();
|
||||
}
|
||||
$ord_sum[$k3] += $num_ord;
|
||||
$stats_ord[] = $num_ord;
|
||||
//转化率=订单数/进店数
|
||||
$stats_per_ord[$k3] = $this->getPercentage(['num' => $num_ord, 'sum' => $num_into]);
|
||||
}
|
||||
if ($k2 != 1) {//不包括自然到店
|
||||
$list_cus[] = ['name' => $v2['name'], 'stats_per' => $stats_per_cus, 'stats' => $stats_cus];
|
||||
}
|
||||
$list_into[] = ['name' => $v2['name'], 'stats_per' => $stats_per_into, 'stats' => $stats_into];
|
||||
$list_ord[] = ['name' => $v2['name'], 'stats_per' => $stats_per_ord, 'stats' => $stats_ord];
|
||||
}
|
||||
$process_cus[] = ['biz_name' => $v['biz_name'], 'num_sum' => $cus_sum, 'list' => $list_cus];
|
||||
$process_into[] = ['biz_name' => $v['biz_name'], 'num_sum' => $into_sum, 'list' => $list_into];
|
||||
$process_ord[] = ['biz_name' => $v['biz_name'], 'num_sum' => $ord_sum, 'list' => $list_ord];
|
||||
}
|
||||
$process = ['customers' => $process_cus, 'into_shop' => $process_into, 'orders' => $process_ord];
|
||||
$data['info'] = ['days' => $days, 'bizs' => $bizs, 'bizs_count' => count($bizs), 'days_count' => count($days)
|
||||
, 'brands_count' => count($brands), 'offlineSources_count' => $offlineSources_count, 'brands_stats' => $brands_stats
|
||||
, 'customers_stats' => $customers_stats, 'process' => $process, 'type_ary' => [1 => '月销售模型(当月线索)', 2 => '月销售模型']];
|
||||
$data['params'] = $params;
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function commonSelect($params, $config)
|
||||
{
|
||||
$brand_id = $config['brand_id'];//品牌id
|
||||
!$params['type'] && $params['type'] = 1;
|
||||
$start_date = date('Y-m', strtotime("-2 month"));//取最近3个月
|
||||
$end_date = date('Y-m');
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] && $start_date = $time[0];
|
||||
$time[1] && $end_date = $time[1];
|
||||
} else {
|
||||
$params['time'] = $start_date . ' ~ ' . $end_date;
|
||||
}
|
||||
$date_months = $this->dateMonths($start_date, $end_date);
|
||||
rsort($date_months);
|
||||
$days = [];
|
||||
foreach ($date_months as $k => $v) {
|
||||
$month = date('n', strtotime($v . '-01'));
|
||||
$days[$v] = ['month' => $month, 'num' => 0];
|
||||
}
|
||||
$bizs = $config['bizs'];
|
||||
foreach ($bizs as $k => $v) {
|
||||
$str_ids = $v['ids'] ? $v['ids'] : '';
|
||||
if (!$str_ids) {
|
||||
$where_b = ['city_id' => $v['city_id']];
|
||||
$v['type'] && $where_b['type'] = $v['type'];
|
||||
$v['not_ids'] && $where_b["id not in({$v['not_ids']})"] = null;
|
||||
$res = $this->mdBiz->select($where_b, 'id desc', 0, 0, 'id');
|
||||
if ($res) {
|
||||
$str_ids = implode(',', array_unique(array_column($res, 'id')));
|
||||
$str_ids = $str_ids ? $str_ids : '-2';
|
||||
}
|
||||
}
|
||||
$list = $customer_ids = [];
|
||||
foreach ($days as $k2 => $v2) {
|
||||
$order_time = $this->getTime($k2);
|
||||
$c_time = $this->getTime($k2, 1);
|
||||
if ($params['type'] == 2) {
|
||||
$where_o = ["biz_id in({$str_ids})" => null, 'brand_id' => $brand_id,
|
||||
'status in(0,1)' => null, 'order_time>=' => $order_time['s_time'], 'order_time<=' => $order_time['e_time']];
|
||||
$num = $this->mdOrders->count($where_o);
|
||||
if ($num && $v['show'] == 'order') {//按订单数来匹配
|
||||
$res_o = $this->mdOrders->select($where_o, 'id desc', 0, 0, 'customer_id');
|
||||
$customer_ids[$k2] = implode(',', array_unique(array_column($res_o, 'customer_id')));
|
||||
}
|
||||
} else {
|
||||
$where_o = ["a.biz_id in({$str_ids})" => null, 'a.brand_id' => $brand_id, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time']
|
||||
, 'a.order_time<=' => $order_time['e_time'], 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']];
|
||||
$num = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where($where_o)
|
||||
->count_all_results();
|
||||
if ($num && $v['show'] == 'order') {//按订单数来匹配
|
||||
$res_o = $this->mdOrders->db->select('a.customer_id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where($where_o)
|
||||
->get()->result_array();
|
||||
$customer_ids[$k2] = implode(',', array_unique(array_column($res_o, 'customer_id')));
|
||||
}
|
||||
}
|
||||
$list[$k2] = $num;
|
||||
$days[$k2]['num'] = $v2['num'] + $num;
|
||||
}
|
||||
$v['list'] = $list;
|
||||
$v['ids'] = $str_ids;
|
||||
$v['customer_ids'] = $customer_ids;
|
||||
$bizs[$k] = $v;
|
||||
}
|
||||
//echo json_encode($bizs,JSON_UNESCAPED_UNICODE);
|
||||
$offlineSources = $this->mdCustomers->offlineSources();
|
||||
$offlineSources_count = count($offlineSources);
|
||||
//过程数据
|
||||
$process_cus = $process_into = $process_ord = [];
|
||||
foreach ($bizs as $k => $v) {
|
||||
$list_cus = $cus_sum = $list_into = $ord_into = $into_sum = $list_ord = $ord_sum = [];
|
||||
foreach ($offlineSources as $k2 => $v2) {
|
||||
$stats_per_cus = $stats_cus = $stats_per_into = $stats_into = $stats_per_ord = $stats_ord = [];
|
||||
foreach ($days as $k3 => $v3) {
|
||||
$order_time = $this->getTime($k3);
|
||||
$c_time = $this->getTime($k3, 1);
|
||||
//成交数
|
||||
if ($params['type'] == 2) {
|
||||
$num_ord = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.brand_id' => $brand_id, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time']
|
||||
, 'a.order_time<=' => $order_time['e_time'], 'b.of_id' => $k2])
|
||||
->count_all_results();
|
||||
} else {
|
||||
$num_ord = $this->mdOrders->db->select('a.id')
|
||||
->from('lc_receiver_orders_v2 as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(["a.biz_id in({$v['ids']})" => null, 'a.brand_id' => $brand_id, 'a.status in(0,1)' => null, 'a.order_time>=' => $order_time['s_time'], 'a.order_time<=' => $order_time['e_time']
|
||||
, 'b.of_id' => $k2, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']])
|
||||
->count_all_results();
|
||||
}
|
||||
//线索数
|
||||
$num_cus = 0;
|
||||
if ($k2 != 1) {//不包括自然到店
|
||||
if ($v['show'] == 'order') {
|
||||
$num_cus = $num_ord;
|
||||
} else {
|
||||
$num_cus = $this->mdCustomers->count(["biz_id in({$v['ids']})" => null, 'of_id' => $k2, 'status>=' => 0, 'c_time>=' => $c_time['s_time'], 'c_time<=' => $c_time['e_time']]);
|
||||
}
|
||||
$cus_sum[$k3] += $num_cus;
|
||||
$stats_cus[] = $num_cus;
|
||||
$stats_per_cus[$k3] = $num_cus;
|
||||
}
|
||||
//进店数
|
||||
$num_into = 0;
|
||||
if ($params['type'] == 2) {
|
||||
$where_into = ['a.type' => 4, 'a.log' => '客户到店', 'a.c_time>=' => $c_time['s_time'], 'a.c_time<=' => $c_time['e_time'],
|
||||
'b.status>=' => 0, 'b.of_id' => $k2];
|
||||
if ($v['show'] == 'order') {
|
||||
if ($v['customer_ids'][$k3]) {
|
||||
$num_into = $this->mdUsersLog->db->select('a.id')
|
||||
->from('lc_receiver_customer_oplogs as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(array_merge($where_into, ["b.id in({$v['customer_ids'][$k3]})" => null]))
|
||||
->count_all_results();
|
||||
}
|
||||
} else {
|
||||
$num_into = $this->mdUsersLog->db->select('a.id')
|
||||
->from('lc_receiver_customer_oplogs as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(array_merge($where_into, ["b.biz_id in({$v['ids']})" => null]))
|
||||
->count_all_results();
|
||||
}
|
||||
} else {
|
||||
$where_into = ['a.type' => 4, 'a.log' => '客户到店', 'a.c_time>=' => $c_time['s_time'], 'a.c_time<=' => $c_time['e_time'],
|
||||
'b.status>=' => 0, 'b.of_id' => $k2, 'b.c_time>=' => $c_time['s_time'], 'b.c_time<=' => $c_time['e_time']];
|
||||
if ($v['show'] == 'order') {
|
||||
if ($v['customer_ids'][$k3]) {
|
||||
$num_into = $this->mdUsersLog->db->select('a.id')
|
||||
->from('lc_receiver_customer_oplogs as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(array_merge($where_into, ["b.id in({$v['customer_ids'][$k3]})" => null]))
|
||||
->count_all_results();
|
||||
}
|
||||
} else {
|
||||
$num_into = $this->mdUsersLog->db->select('a.id')
|
||||
->from('lc_receiver_customer_oplogs as a')
|
||||
->join('lc_receiver_customers as b', "b.id=a.customer_id", 'left')
|
||||
->where(array_merge($where_into, ["b.biz_id in({$v['ids']})" => null]))
|
||||
->count_all_results();
|
||||
}
|
||||
}
|
||||
$into_sum[$k3] += $num_into;
|
||||
$stats_into[] = $num_into;
|
||||
$num_into_per = '';
|
||||
if ($k2 != 1) {//转化率=进店数/客户数
|
||||
$num_into_per = $this->getPercentage(['num' => $num_into, 'sum' => $num_cus]);
|
||||
}
|
||||
$stats_per_into[$k3] = $num_into_per;
|
||||
//成交数
|
||||
$ord_sum[$k3] += $num_ord;
|
||||
$stats_ord[] = $num_ord;
|
||||
//转化率=订单数/进店数
|
||||
$stats_per_ord[$k3] = $this->getPercentage(['num' => $num_ord, 'sum' => $num_into]);
|
||||
}
|
||||
if ($k2 != 1) {//不包括自然到店
|
||||
$list_cus[] = ['name' => $v2['name'], 'stats_per' => $stats_per_cus, 'stats' => $stats_cus];
|
||||
}
|
||||
$list_into[] = ['name' => $v2['name'], 'stats_per' => $stats_per_into, 'stats' => $stats_into];
|
||||
$list_ord[] = ['name' => $v2['name'], 'stats_per' => $stats_per_ord, 'stats' => $stats_ord];
|
||||
}
|
||||
$process_cus[] = ['biz_name' => $v['biz_name'], 'num_sum' => $cus_sum, 'list' => $list_cus];
|
||||
$process_into[] = ['biz_name' => $v['biz_name'], 'num_sum' => $into_sum, 'list' => $list_into];
|
||||
$process_ord[] = ['biz_name' => $v['biz_name'], 'num_sum' => $ord_sum, 'list' => $list_ord];
|
||||
}
|
||||
$process = ['customers' => $process_cus, 'into_shop' => $process_into, 'orders' => $process_ord];
|
||||
$data['info'] = ['days' => $days, 'bizs' => $bizs, 'bizs_count' => count($bizs), 'days_count' => count($days)
|
||||
, 'brands_count' => 1, 'offlineSources_count' => $offlineSources_count, 'process' => $process,
|
||||
'type_ary' => [1 => '月销售模型(当月线索)', 2 => '月销售模型']];
|
||||
$data['params'] = $params;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:计算出两个日期之间的月份
|
||||
* Created on: 2022/8/9 14:38
|
||||
* Created by: dengbw
|
||||
* @param $start_date [开始日期,如2022-03]
|
||||
* @param $end_date [结束日期,如2022-12]
|
||||
* @param string $explode [年份和月份之间分隔符,此例为 - ]
|
||||
* @param bool $addOne [算取完之后最后是否加一月,用于算取时间戳用]
|
||||
* @return array [返回是两个月份之间所有月份字符串]
|
||||
*/
|
||||
private function dateMonths($start_date, $end_date, $explode = '-', $addOne = false)
|
||||
{
|
||||
//判断两个时间是不是需要调换顺序
|
||||
$start_int = strtotime($start_date);
|
||||
$end_int = strtotime($end_date);
|
||||
if ($start_int > $end_int) {
|
||||
$tmp = $start_date;
|
||||
$start_date = $end_date;
|
||||
$end_date = $tmp;
|
||||
}
|
||||
|
||||
//结束时间月份+1,如果是13则为新年的一月份
|
||||
$start_arr = explode($explode, $start_date);
|
||||
$start_year = intval($start_arr[0]);
|
||||
$start_month = intval($start_arr[1]);
|
||||
|
||||
$end_arr = explode($explode, $end_date);
|
||||
$end_year = intval($end_arr[0]);
|
||||
$end_month = intval($end_arr[1]);
|
||||
|
||||
$data = array();
|
||||
$data[] = $start_date;
|
||||
|
||||
$tmp_month = $start_month;
|
||||
$tmp_year = $start_year;
|
||||
|
||||
//如果起止不相等,一直循环
|
||||
while (!(($tmp_month == $end_month) && ($tmp_year == $end_year))) {
|
||||
$tmp_month++;
|
||||
//超过十二月份,到新年的一月份
|
||||
if ($tmp_month > 12) {
|
||||
$tmp_month = 1;
|
||||
$tmp_year++;
|
||||
}
|
||||
$data[] = $tmp_year . $explode . str_pad($tmp_month, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
if ($addOne == true) {
|
||||
$tmp_month++;
|
||||
//超过十二月份,到新年的一月份
|
||||
if ($tmp_month > 12) {
|
||||
$tmp_month = 1;
|
||||
$tmp_year++;
|
||||
}
|
||||
$data[] = $tmp_year . $explode . str_pad($tmp_month, 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getPercentage($params)
|
||||
{
|
||||
return number_format_com($params['num'] / $params['sum'] * 100, 2, '') . "%";
|
||||
}
|
||||
|
||||
private function getTime($day, $type = 0)
|
||||
{
|
||||
$s_time = "{$day}-01 00:00:00";//本月一日
|
||||
$e_time = date('Y-m-d', strtotime("$s_time +1 month -1 day")) . ' 23:59:59';//本月最后一日
|
||||
if ($type == 1) {
|
||||
$s_time = strtotime($s_time);
|
||||
$e_time = strtotime($e_time);
|
||||
} else if ($type == 2) {
|
||||
$s_time = "{$day}-01";
|
||||
$e_time = date('Y-m-d', strtotime("$s_time +1 month -1 day"));
|
||||
}
|
||||
return ['s_time' => $s_time, 'e_time' => $e_time];
|
||||
}
|
||||
|
||||
//数据列表
|
||||
public function lists()
|
||||
{
|
||||
}
|
||||
|
||||
//展示单条数据
|
||||
public function get()
|
||||
{
|
||||
}
|
||||
|
||||
//添加单条数据
|
||||
public function add()
|
||||
{
|
||||
}
|
||||
|
||||
//编辑单条数据
|
||||
public function edit()
|
||||
{
|
||||
}
|
||||
|
||||
//删除单条数据
|
||||
public function del()
|
||||
{
|
||||
}
|
||||
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
public function export()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* ref Finance.php
|
||||
*/
|
||||
class Supplier extends HD_Controller{
|
||||
protected $log_dir;
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model("sys/sys_supplier_model", 'supplier_model');
|
||||
$this->load->model('biz/biz_settle_srv_model');
|
||||
|
||||
$this->log_dir = 'sys_' . get_class($this);
|
||||
}
|
||||
|
||||
public function index(){
|
||||
return $this->lists();
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
$params = $this->input->get();
|
||||
|
||||
$where = array();
|
||||
if ($params['keyword']){
|
||||
$params['keyword'] = trim($params['keyword']);
|
||||
$where["(title like '%{$params['keyword']}%' or short like '%{$params['keyword']}%')"] = null;
|
||||
}
|
||||
|
||||
if(strlen($params['status']) > 0){
|
||||
$where['status'] = $params['status'];
|
||||
} else {
|
||||
$params['status'] = '';
|
||||
}
|
||||
|
||||
if($params['type']){
|
||||
$where['type'] = $params['type'];
|
||||
} else {
|
||||
$params['type'] = '';
|
||||
}
|
||||
|
||||
$page = $params['page'];
|
||||
$page = !$page ? 1 : $page;
|
||||
$size = $params['size'];
|
||||
$size = !$size ? 20 : $size;
|
||||
|
||||
$statusAry = $this->supplier_model->status_ary();
|
||||
$typeAry = $this->supplier_model->type_ary();
|
||||
|
||||
$count = $this->supplier_model->count($where);
|
||||
$lists = array();
|
||||
if($count){
|
||||
$orderby = 'status desc, id desc';
|
||||
$select = '*';
|
||||
$rows = $this->supplier_model->select($where, $orderby, $page, $size, $select);
|
||||
foreach($rows as $k => $v){
|
||||
$lists[] = array(
|
||||
'id' => $v['id'],
|
||||
'title' => $v['title'],
|
||||
'short' => $v['short'],
|
||||
'type' => $v['type'],
|
||||
'type_name' => $typeAry[$v['type']],
|
||||
'jsondata' => json_decode($v['jsondata'], true),
|
||||
'status' => $v['status'],
|
||||
'status_name' => $statusAry[$v['status']],
|
||||
'c_time' => date('Y-m-d H:i:s', $v['c_time'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['statusAry'] = $statusAry;
|
||||
$this->data['typeAry'] = $typeAry;
|
||||
$this->data['pager'] = array('count'=>ceil($count/$size),'curr'=>$page,'totle'=>$count);
|
||||
$this->data['_title'] = '供应商';
|
||||
$this->show_view('sys/supplier/lists',true);
|
||||
}
|
||||
|
||||
public function get(){
|
||||
$id = $this->input->get('id');
|
||||
if($id){
|
||||
$row = $this->supplier_model->get(array('id' => $id));
|
||||
$info = array(
|
||||
'id' => $row['id'],
|
||||
'title' => $row['title'],
|
||||
'short' => $row['short'],
|
||||
'type' => $row['type'],
|
||||
'jsondata' => json_decode($row['jsondata'], true),
|
||||
'status' => $row['status'],
|
||||
);
|
||||
$action = '/sys/supplier/edit';
|
||||
$title = '编辑供应商';
|
||||
} else {
|
||||
$info = array(
|
||||
'title' => '',
|
||||
'short' =>'',
|
||||
'type' => 1,
|
||||
'status' => 1,
|
||||
);
|
||||
$action = '/sys/supplier/add';
|
||||
$title = '新增供应商';
|
||||
}
|
||||
|
||||
$this->data['info'] = $info;
|
||||
$this->data['action'] = $action;
|
||||
$this->data['statusAry'] = $this->supplier_model->status_ary();
|
||||
$this->data['typeAry'] = $this->supplier_model->type_ary();
|
||||
$this->data['_title'] = $title;
|
||||
$this->show_view('sys/supplier/get');
|
||||
}
|
||||
|
||||
public function add(){
|
||||
$info = $this->input->post('info');
|
||||
|
||||
$type = trim($info['type']);
|
||||
if(!$type){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择供应商类型');
|
||||
}
|
||||
|
||||
$title = trim($info['title']);
|
||||
if(!$title){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入供应商名字');
|
||||
}
|
||||
$where = array("title like '%{$title}%'" => null, "type" => $type);
|
||||
$count = $this->supplier_model->count($where);
|
||||
if($count>0){
|
||||
return $this->show_json(SYS_CODE_FAIL, '供应商已经存在');
|
||||
}
|
||||
|
||||
$short = trim($info['short']);
|
||||
$short = $this->short_check($short, $type, $info['id']);
|
||||
|
||||
$add = array(
|
||||
'title' => $title,
|
||||
'short' => $short,
|
||||
'jsondata' => json_encode(array()),
|
||||
'type' => intval($type),
|
||||
'status' => intval($info['status']),
|
||||
'c_time' => time(),
|
||||
);
|
||||
|
||||
$id = $this->supplier_model->add($add);
|
||||
if(!$id){
|
||||
debug_log("[error]# " . $this->supplier_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function edit(){
|
||||
$info = $this->input->post('info');
|
||||
|
||||
$row = $this->supplier_model->get(array('id' => $info['id']));
|
||||
if (!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误:ID不存在');
|
||||
}
|
||||
|
||||
$type = trim($info['type']);
|
||||
if(!$type){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请选择供应商类型');
|
||||
}
|
||||
|
||||
$title = trim($info['title']);
|
||||
if(!$title){
|
||||
return $this->show_json(SYS_CODE_FAIL, '请输入供应商名字');
|
||||
}
|
||||
$where = array("title like '%{$title}%'" => null, "type" => $type, "id<>{$info['id']}" => null);
|
||||
$count = $this->supplier_model->count($where);
|
||||
if($count>0){
|
||||
return $this->show_json(SYS_CODE_FAIL, '供应商已经存在');
|
||||
}
|
||||
|
||||
$short = trim($info['short']);
|
||||
$short = $this->short_check($short, $type, $info['id']);
|
||||
|
||||
$upd = array(
|
||||
'title' => $title,
|
||||
'short' => $short,
|
||||
'jsondata' => json_encode(array()),
|
||||
'type' => intval($type),
|
||||
'status' => intval($info['status']),
|
||||
);
|
||||
|
||||
$ret = $this->supplier_model->update($upd, array('id' => $info['id']));
|
||||
if(!$ret){
|
||||
debug_log("[error]# " . $this->supplier_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
# title修改要同步
|
||||
if ($row['title'] != $title){
|
||||
$upd = array(
|
||||
'title' => $title,
|
||||
"jsondata = json_set(jsondata, '$.supplier_title', '{$title}')" => null,
|
||||
);
|
||||
$where = array(
|
||||
'type' => intval($type),
|
||||
"JSON_UNQUOTE(json_extract(jsondata, '$.supplier_id')) = '{$info['id']}'" => null,
|
||||
);
|
||||
$this->biz_settle_srv_model->update($upd, $where);
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
private function short_check($short='', $type=2, $id=0){
|
||||
$short = trim($short);
|
||||
if (!$short){
|
||||
return $short;
|
||||
}
|
||||
|
||||
$short = str_replace(',',',', $short);
|
||||
$short = str_replace(' ',',', $short);
|
||||
$short = str_replace(' ',',', $short);
|
||||
$shorts = explode(',', $short);
|
||||
$shorts_new = array();
|
||||
foreach ($shorts as $short){
|
||||
if (!$short){
|
||||
continue;
|
||||
}
|
||||
$shorts_new[] = $short;
|
||||
$where = array("short like '%{$short}%'" => null, "type" => $type);
|
||||
$id && $where["id<>{$id}"] = null;
|
||||
$count = $this->supplier_model->count($where);
|
||||
if($count>0){
|
||||
$this->show_json(SYS_CODE_FAIL, "简称'{$short}'已经存在");exit();
|
||||
}
|
||||
}
|
||||
$short = implode(',', $shorts_new);
|
||||
return $short;
|
||||
}
|
||||
|
||||
function edit_status(){
|
||||
$id = $this->input->post('id');
|
||||
$status = $this->input->post('status');
|
||||
|
||||
$upd = array('status' => $status);
|
||||
$where = array('id' => $id);
|
||||
|
||||
$ret = $this->supplier_model->update($upd, $where);
|
||||
if(!$ret){
|
||||
debug_log("[error]# " . $this->supplier_model->db->last_query(), __FUNCTION__, $this->log_dir);
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
public function del(){
|
||||
// TODO: Implement del() method.
|
||||
}
|
||||
|
||||
public function batch(){
|
||||
// TODO: Implement batch() method.
|
||||
}
|
||||
|
||||
public function export(){
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Notes:报名管理
|
||||
* Created on: 2020/5/18 12:45
|
||||
* Created on: 2023/3/27 12:45
|
||||
* Created by: dengbw
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
Class Enroll extends HD_Controller
|
||||
{
|
||||
private $statusAry = array(-1 => '已失效', 0 => '未核销', 1 => '已核销');
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('topics/topics_model', 'mdTopics');
|
||||
$this->load->model('topics/topic_modules_model', 'mdTopicModules');
|
||||
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
|
||||
$this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata');
|
||||
$this->load->model('topics/topic_enroll_model', 'mdEnroll');
|
||||
$this->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -29,182 +26,81 @@ Class Enroll extends HD_Controller
|
||||
$params = $this->input->get();
|
||||
$params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
$params['module_id'] = intval($params['module_id']);
|
||||
|
||||
$params['id'] = intval($params['id']);
|
||||
$res = $this->dataSelect($params);
|
||||
if ($res['code'] == 0) {
|
||||
return $this->show_json(SYS_CODE_FAIL, $res['msg']);
|
||||
}
|
||||
$lists = $res['lists'];
|
||||
$count = $res['count'];
|
||||
$this->data['params'] = $res['params'];
|
||||
$this->data['_title'] = $res['title'] . '列表';
|
||||
$this->data['type'] = $res['type'];
|
||||
$this->data['statusAry'] = $this->statusAry;
|
||||
$this->data['_title'] = $res['title'];
|
||||
$this->data['pager'] = array('count' => ceil($count / $params['size']), 'curr' => $params['page'], 'totle' => $count);
|
||||
$this->data['lists'] = $lists;
|
||||
return $this->show_view('topics/enroll/lists', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报名活动列表
|
||||
* @return bool
|
||||
*/
|
||||
public function lists_module()
|
||||
{
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$size = $params['size'] ? $params['size'] : 20;
|
||||
|
||||
$app_id = $params['app_id'];
|
||||
$search_ary = array("title" => "标题", "module_id" => "ID");
|
||||
|
||||
//根据应用获取模块
|
||||
$where = array('app_id' => $app_id);
|
||||
$rows_topic = $this->mdTopics->select($where);
|
||||
$module_ids = array();
|
||||
if ($rows_topic) {
|
||||
foreach ($rows_topic as $v) {
|
||||
if ($v['module_ids']) {
|
||||
$ids = explode(',', $v['module_ids']);
|
||||
if ($ids) {
|
||||
$module_ids = array_merge($module_ids, $ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
$lists = array();
|
||||
if ($module_ids) {
|
||||
$str_ids = implode(',', $module_ids);
|
||||
$where = array("module_id in ({$str_ids})" => null);
|
||||
if ($params['search_v']) {
|
||||
if ('title' == $params['search_k']) {
|
||||
$where["m.title like '%{$params['search_v']}%'"] = null;
|
||||
} else {
|
||||
$where["m.{$params['search_k']}"] = $params['search_v'];
|
||||
}
|
||||
}
|
||||
!$params['search_k'] && $params['search_k'] = 'title';
|
||||
|
||||
if (strlen($params['status']) > 0) {
|
||||
$where['j.status'] = $params['status'];
|
||||
} else {
|
||||
$where['j.status>=0'] = null;
|
||||
$params['status'] = '';
|
||||
}
|
||||
|
||||
$total = $this->mdModuleEnroll->count_status($where);
|
||||
if ($total) {
|
||||
$orderby = 'id desc';
|
||||
$select = "module_id, title, es_time, ee_time, as_time, ae_time, j.status";
|
||||
$rows = $this->mdModuleEnroll->select_status($where, $orderby, $page, $size, $select);
|
||||
foreach ($rows as $v) {
|
||||
$lists[] = array(
|
||||
'id' => $v['module_id'],
|
||||
'title' => $v['title'],
|
||||
'e_time' => "{$v['es_time']}~{$v['ee_time']}",
|
||||
'a_time' => "{$v['as_time']}~{$v['ae_time']}",
|
||||
'status' => $v['status'],
|
||||
'statusion' => 1 == $v['status'] ? "正常" : "下架",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->data['params'] = $params;
|
||||
$this->data['lists'] = $lists;
|
||||
$this->data['search_ary'] = $search_ary;
|
||||
$this->data['_title'] = '报名活动管理';
|
||||
$this->data['pager'] = array('count' => ceil($total / $size), 'curr' => $page, 'totle' => $total);
|
||||
|
||||
return $this->show_view('topics/enroll/lists_module', true);
|
||||
return $this->show_view('topics/lists_enroll', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:查找报名数据
|
||||
* Created on: 2020/5/19 16:37
|
||||
* Created on: 2023/3/27 16:37
|
||||
* Created by: dengbw
|
||||
* @param $params
|
||||
* @return array
|
||||
*/
|
||||
private function dataSelect($params)
|
||||
{
|
||||
$where = $lists = array();
|
||||
$title = '活动报名';
|
||||
$type = 0;
|
||||
if ($params['module_id']) {
|
||||
$where['module_id'] = $params['module_id'];
|
||||
$row_en = $this->mdModuleEnroll->get(array('module_id' => $params['module_id']), 'title,type');
|
||||
$title = $row_en['title'];
|
||||
$type = $row_en['type'];
|
||||
} else {
|
||||
//根据应用获取报名列表
|
||||
$app_id = $params['app_id'];
|
||||
$where_topic = array('app_id' => $app_id);
|
||||
$rows_topic = $this->mdTopics->select($where_topic);
|
||||
$module_ids = array();
|
||||
if ($rows_topic) {
|
||||
foreach ($rows_topic as $v) {
|
||||
if ($v['module_ids']) {
|
||||
$ids = explode(',', $v['module_ids']);
|
||||
if ($ids) {
|
||||
$module_ids = array_merge($module_ids, $ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($module_ids) {
|
||||
$str_ids = implode(',', $module_ids);
|
||||
$where["module_id in ({$str_ids})"] = null;
|
||||
} else {
|
||||
$where['module_id'] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (status_verify($params['status'])) {
|
||||
$where['status'] = $params['status'];
|
||||
} else {
|
||||
$params['status'] = -99;
|
||||
}
|
||||
|
||||
if ($params['name']) {
|
||||
$where['name like "%' . $params['name'] . '%"'] = null;
|
||||
$where['topics_id'] = $params['id'];
|
||||
if ($params['nickname']) {
|
||||
$where['nickname like "%' . $params['nickname'] . '%"'] = null;
|
||||
}
|
||||
if ($params['mobile']) {
|
||||
$where['mobile'] = $params['mobile'];
|
||||
}
|
||||
if ($params['code']) {
|
||||
$where['code'] = $params['code'];
|
||||
if ($params['cfrom_id'] || $params['cfrom_id2']) {
|
||||
if ($params['cfrom_id2']) {
|
||||
$where['cf_id'] = $params['cfrom_id2'];
|
||||
} else {
|
||||
$cf_rows = $this->mdCluesCfrom->select(['pid' => $params['cfrom_id']], '', '', '', 'id');
|
||||
$cf_ids = array_column($cf_rows, 'id');
|
||||
$cf_ids[] = $params['cfrom_id'];
|
||||
$cf_str_ids = implode(',', array_filter($cf_ids));
|
||||
$cf_str_ids && $where["cf_id in ({$cf_str_ids})"] = null;
|
||||
}
|
||||
}
|
||||
if ($params['time']) {
|
||||
$time = explode(' ~ ', $params['time']);
|
||||
$time[0] && $where["c_time >="] = strtotime($time[0] . ' 00:00:00');
|
||||
$time[1] && $where["c_time <="] = strtotime($time[1] . ' 23:59:59');
|
||||
}
|
||||
$count = $this->mdModuleEnrolldata->count($where);
|
||||
$lists = [];
|
||||
$count = $this->mdEnroll->count($where);
|
||||
if ($count) {
|
||||
$select = "id,module_id,name,mobile,code,status,c_time,jsondata";
|
||||
$lists = $this->mdModuleEnrolldata->select($where, "id desc", $params['page'], $params['size'], $select);
|
||||
$map_module = array();
|
||||
if ($lists) {
|
||||
$module_ids = array_unique(array_column($lists, 'module_id'));
|
||||
$str_ids = implode(',', $module_ids);
|
||||
$where_module = array("module_id in ({$str_ids})" => null);
|
||||
$map_module = $this->mdModuleEnroll->map('module_id', '*', $where_module, '', 0, 0, 'module_id, title, descrip');
|
||||
$res = $this->mdEnroll->select($where, "id desc", $params['page'], $params['size']);
|
||||
//获取来源
|
||||
$map_cf_pid = $cf_title_arr = [];
|
||||
$cf_id_arr = array_unique(array_column($res, 'cf_id'));
|
||||
if ($cf_id_arr) {
|
||||
$cf_id_str = implode(',', $cf_id_arr);
|
||||
$res_cfrom = $this->mdCluesCfrom->select(["id in({$cf_id_str})" => null], 'id desc', 0, 0, 'id,title,pid');
|
||||
$cf_pid_arr = array_unique(array_column($res_cfrom, 'pid'));
|
||||
if ($cf_pid_arr) {
|
||||
$cf_pid_str = implode(',', $cf_pid_arr);
|
||||
$map_cf_pid = $this->mdCluesCfrom->map('id', 'title', ["id in({$cf_pid_str})" => null]);
|
||||
}
|
||||
foreach ($res_cfrom as $key => $val) {
|
||||
$title = $val['title'];
|
||||
if ($val['pid']) {//一级分类
|
||||
$map_cf_pid[$val['pid']] && $title = $map_cf_pid[$val['pid']] . '-' . $title;
|
||||
}
|
||||
$cf_title_arr[$val['id']] = $title;
|
||||
}
|
||||
}
|
||||
foreach ($lists as $key => $value) {
|
||||
$json = json_decode($value['jsondata'], true);
|
||||
$module = $map_module[$value['module_id']];
|
||||
$lists[$key]['c_time'] = date('Y-m-d H:i', $value['c_time']);
|
||||
$lists[$key]['status_name'] = $this->statusAry[$value['status']];
|
||||
$lists[$key]['remark'] = $json['remark'] ? $json['remark'] : '';
|
||||
$lists[$key]['title'] = $module['descrip'] ? $module['descrip'] : $module['title'];
|
||||
foreach ($res as $k => $v) {
|
||||
$cf_name = $cf_title_arr[$v['cf_id']] ? $cf_title_arr[$v['cf_id']] : '-';
|
||||
$c_time = date('Y-m-d H:i', $v['c_time']);
|
||||
$lists[] = ['id' => $v['id'],'nickname' => $v['nickname'], 'mobile' => $v['mobile']
|
||||
, 'cf_name' => $cf_name, 'c_time' => $c_time];
|
||||
}
|
||||
}
|
||||
$data['code'] = SYS_CODE_SUCCESS;
|
||||
$data['type'] = $type;
|
||||
$re = $this->mdTopics->get(['id' => $params['id']]);
|
||||
$title = $re['title'] ? $re['title'] . '_报名列表' : '专题报名列表';
|
||||
$data['title'] = $title;
|
||||
$data['lists'] = $lists;
|
||||
$data['count'] = $count;
|
||||
@@ -214,30 +110,6 @@ Class Enroll extends HD_Controller
|
||||
|
||||
public function get()
|
||||
{
|
||||
$id = intval($this->input->get('id'));
|
||||
$module_id = intval($this->input->get('module_id'));
|
||||
if (!$id || !$module_id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '参数错误!');
|
||||
}
|
||||
$re = $this->mdModuleEnrolldata->get(array("id" => $id));
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '报名详情不存在!');
|
||||
}
|
||||
$reEn = $this->mdModuleEnroll->get(array('module_id' => $module_id), 'enroll_json,type');
|
||||
$enroll_json = array();
|
||||
if ($reEn['enroll_json'] && $re['jsondata']) {
|
||||
$enroll_json = json_decode($reEn['enroll_json'], true);
|
||||
$jsondata = json_decode($re['jsondata'], true);
|
||||
foreach ($enroll_json as $key => $value) {
|
||||
$jsondata[$key] && $enroll_json[$key]['value'] = $jsondata[$key];
|
||||
}
|
||||
}
|
||||
$re['enroll_json'] = $enroll_json;
|
||||
$re['type'] = $reEn['type'];
|
||||
$re['c_time'] = date('Y-m-d H:i', $re['c_time']);
|
||||
$re['status_name'] = $this->statusAry[$re['status']];
|
||||
$this->data['info'] = $re;
|
||||
return $this->show_view('topics/enroll/edit');
|
||||
}
|
||||
|
||||
public function del()
|
||||
@@ -255,63 +127,22 @@ Class Enroll extends HD_Controller
|
||||
$params = $this->input->get();
|
||||
$params['page'] = 1;
|
||||
$params['size'] = 10000;
|
||||
$params['export'] = 1;
|
||||
$data = $indexs = array();
|
||||
$data = $indexs = [];
|
||||
$res = $this->dataSelect($params);
|
||||
if ($params['module_id']) {
|
||||
if ($params['type'] == 1) {
|
||||
$fileName = '活动报名用户';
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$temp['name'] = $value['name'];
|
||||
$temp['mobile'] = $value['mobile'];
|
||||
$temp['code'] = $value['code'];
|
||||
$temp['status_name'] = $value['status_name'];
|
||||
$temp['c_time'] = $value['c_time'];
|
||||
$temp['remark'] = $value['remark'];
|
||||
$data[] = $temp;
|
||||
}
|
||||
$indexs = [
|
||||
'name' => '姓名',
|
||||
'mobile' => '手机号',
|
||||
'code' => '核销码',
|
||||
'status_name' => '状态',
|
||||
'c_time' => '报名时间',
|
||||
"remark" => "备注",
|
||||
];
|
||||
} else {
|
||||
$fileName = '报名用户';
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$temp['name'] = $value['name'];
|
||||
$temp['mobile'] = $value['mobile'];
|
||||
$temp['c_time'] = $value['c_time'];
|
||||
$temp['remark'] = $value['remark'];
|
||||
$data[] = $temp;
|
||||
}
|
||||
$indexs = [
|
||||
'name' => '姓名',
|
||||
'mobile' => '手机号',
|
||||
'c_time' => '报名时间',
|
||||
"remark" => "备注",
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$fileName = '活动报名';
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$temp['title'] = $value['title'];
|
||||
$temp['name'] = $value['name'];
|
||||
$temp['mobile'] = $value['mobile'];
|
||||
$temp['c_time'] = $value['c_time'];
|
||||
$temp['remark'] = $value['remark'];
|
||||
$data[] = $temp;
|
||||
}
|
||||
$indexs = [
|
||||
'title' => '活动名称',
|
||||
'name' => '姓名',
|
||||
'mobile' => '手机号',
|
||||
'c_time' => '报名时间',
|
||||
"remark" => "备注",
|
||||
];
|
||||
$fileName = $res['title'];
|
||||
foreach ($res['lists'] as $key => $value) {
|
||||
$temp['nickname'] = $value['nickname'];
|
||||
$temp['mobile'] = $value['mobile'];
|
||||
$temp['cf_name'] = $value['cf_name'];
|
||||
$temp['c_time'] = $value['c_time'];
|
||||
$data[] = $temp;
|
||||
}
|
||||
$indexs = [
|
||||
'nickname' => '昵称',
|
||||
'mobile' => '手机号',
|
||||
"cf_name" => "来源",
|
||||
'c_time' => '报名时间',
|
||||
];
|
||||
array_unshift($data, $indexs);
|
||||
$this->load->library('excel');
|
||||
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
|
||||
|
||||
@@ -14,7 +14,6 @@ Class Topics extends AppBase
|
||||
private $moduleAry = array(
|
||||
array('name' => '文本模块', 'tag' => 'text'),
|
||||
array('name' => '广告模块', 'tag' => 'ad'),
|
||||
array('name' => '报名模块', 'tag' => 'enroll'),
|
||||
array("name" => "按钮模块", "tag" => "button")
|
||||
);
|
||||
|
||||
@@ -26,10 +25,10 @@ Class Topics extends AppBase
|
||||
$this->load->model('topics/topic_module_text_model', 'mdModuleText');
|
||||
$this->load->model('topics/topic_module_ad_model', 'mdModuleAd');
|
||||
$this->load->model('topics/topic_module_enroll_model', 'mdModuleEnroll');
|
||||
$this->load->model('topics/topic_module_enrolldata_model', 'mdModuleEnrolldata');
|
||||
$this->load->model('topics/topic_module_button_model', 'mdModuleButton');
|
||||
$this->load->model('topics/topic_user_log_model', 'mdUserLog');
|
||||
$this->load->model("sys/sys_admin_model", 'mdSysAdmin');
|
||||
$this->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,12 +347,22 @@ Class Topics extends AppBase
|
||||
if (!$re || empty($re)) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '专题不存在!');
|
||||
}
|
||||
$re['bg_img_url'] = build_qiniu_image_url($re['bg_img']);
|
||||
$info = $re;
|
||||
$json = $info['jsondata'] ? json_decode($info['jsondata'], true) : '';
|
||||
$info['cf_id'] = $json['cf_id'] ? $json['cf_id'] : "";
|
||||
$info['mp_app_id'] = $json['mp_app_id'] ? $json['mp_app_id'] : "";
|
||||
$info['ebiz'] = $json['ebiz'] ? $json['ebiz'] : "";
|
||||
if ($re['cf_id']) {
|
||||
$re_cf = $this->mdCluesCfrom->get(['id' => $re['cf_id']]);
|
||||
if ($re_cf) {
|
||||
if ($re_cf['pid'] == 0) {
|
||||
$info['cfrom_id'] = $re_cf['id'];
|
||||
$info['cfrom_id2'] = 0;
|
||||
} else {
|
||||
$info['cfrom_id'] = $re_cf['pid'];
|
||||
$info['cfrom_id2'] = $re_cf['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$jsonData = $info['jsondata'] ? json_decode($info['jsondata'], true) : '';
|
||||
$info['bg_img_url'] = $re['bg_img'] ? build_qiniu_image_url($re['bg_img']) : '';
|
||||
$info['share_img_url'] = $jsonData['share_img'] ? build_qiniu_image_url($jsonData['share_img']) : '';
|
||||
$_title = '编辑专题';
|
||||
$edit_url = '/topics/topics/edit';
|
||||
} else {
|
||||
@@ -361,9 +370,9 @@ Class Topics extends AppBase
|
||||
$edit_url = '/topics/topics/add';
|
||||
$info['id'] = $id;
|
||||
$info['app_id'] = $app_id;
|
||||
$info['cf_id'] = "";
|
||||
$info['mp_app_id'] = "";
|
||||
$info['ebiz'] = 0;
|
||||
$info['share_img_url'] = '';
|
||||
$info['cfrom_id'] = 0;
|
||||
$info['cfrom_id2'] = 0;
|
||||
}
|
||||
$info['spm'] = $this->input->get('spm');
|
||||
$info['edit_url'] = $edit_url;
|
||||
@@ -386,13 +395,18 @@ Class Topics extends AppBase
|
||||
}
|
||||
$bg_color = $this->input->post('bg_color');
|
||||
$bg_img = $this->input->post('bg_img');
|
||||
|
||||
$share_img = $this->input->post('share_img');
|
||||
$cfrom_id = intval($this->input->post('cfrom_id'));
|
||||
$cfrom_id2 = intval($this->input->post('cfrom_id2'));
|
||||
$jsonData['share_img'] = $share_img ? $share_img : '';
|
||||
$dataItems['app_id'] = $app_id;
|
||||
$dataItems['title'] = $title;
|
||||
$dataItems['bg_color'] = $bg_color;
|
||||
$dataItems['bg_img'] = $bg_img;
|
||||
$dataItems['status'] = 1;
|
||||
$dataItems['c_time'] = time();
|
||||
$dataItems['cf_id'] = $cfrom_id2 ? $cfrom_id2 : $cfrom_id;
|
||||
$dataItems['jsondata'] = json_encode($jsonData, JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->mdTopics->add($dataItems);
|
||||
if (!$id) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '添加失败');
|
||||
@@ -412,9 +426,15 @@ Class Topics extends AppBase
|
||||
}
|
||||
$bg_color = $this->input->post('bg_color');
|
||||
$bg_img = $this->input->post('bg_img');
|
||||
$share_img = $this->input->post('share_img');
|
||||
$cfrom_id = intval($this->input->post('cfrom_id'));
|
||||
$cfrom_id2 = intval($this->input->post('cfrom_id2'));
|
||||
$jsonData['share_img'] = $share_img ? $share_img : '';
|
||||
$dataItems['title'] = $title;
|
||||
$dataItems['bg_color'] = $bg_color;
|
||||
$dataItems['bg_img'] = $bg_img;
|
||||
$dataItems['cf_id'] = $cfrom_id2 ? $cfrom_id2 : $cfrom_id;
|
||||
$dataItems['jsondata'] = json_encode($jsonData, JSON_UNESCAPED_UNICODE);
|
||||
$re = $this->mdTopics->update($dataItems, array('id' => $id));
|
||||
if (!$re) {
|
||||
return $this->show_json(SYS_CODE_FAIL, '修改失败');
|
||||
|
||||
+11
-12
@@ -33,7 +33,7 @@ class HD_Model extends CI_Model {
|
||||
$this->set_table_name($table_name);
|
||||
}
|
||||
|
||||
public function __call($func,$args)
|
||||
public function __call($func,$args)
|
||||
{
|
||||
if($func) {
|
||||
if($args) {
|
||||
@@ -42,7 +42,7 @@ class HD_Model extends CI_Model {
|
||||
return $this->db->$func();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function set_db($db_group = 'default')
|
||||
{
|
||||
if(!isset(self::$dbs[$db_group]))
|
||||
@@ -126,13 +126,13 @@ class HD_Model extends CI_Model {
|
||||
$result = $this->db->update($this->table_name, $data, $where);
|
||||
return $this->db->affected_rows() ? $this->db->affected_rows() : $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新或插入数据
|
||||
* @param $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function replace($data)
|
||||
public function replace($data)
|
||||
{
|
||||
if($data)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ class HD_Model extends CI_Model {
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param $where
|
||||
@@ -244,19 +244,18 @@ class HD_Model extends CI_Model {
|
||||
$offset = null;
|
||||
$limit = null;
|
||||
}
|
||||
|
||||
$result = $this->db->get($this->table_name, $limit, $offset)->result_array();
|
||||
|
||||
$this->db->from($this->table_name);
|
||||
$this->db->limit($limit, $offset);
|
||||
$query = $this->db->get();
|
||||
$result = $query ? $query->result_array() : [];
|
||||
if($obj && file_exists($class = APPPATH.'libraries/entity/'.ucfirst($obj).'.php'))
|
||||
{
|
||||
require_once $class;
|
||||
|
||||
if(class_exists($obj))
|
||||
{
|
||||
$result = $this->db->get($this->table_name, $limit, $offset)->custom_result_object($obj);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -555,7 +554,7 @@ class HD_Model extends CI_Model {
|
||||
* @param array $param
|
||||
* @return mixed
|
||||
*/
|
||||
public function un_file_cache($func, $param =array())
|
||||
public function un_file_cache($func, $param =array())
|
||||
{
|
||||
if(IF_FILE_CACHE)
|
||||
{
|
||||
@@ -571,7 +570,7 @@ class HD_Model extends CI_Model {
|
||||
* @param $type
|
||||
* @return bool
|
||||
*/
|
||||
public function del_cache($method, $type, $skey = '')
|
||||
public function del_cache($method, $type, $skey = '')
|
||||
{
|
||||
$cache = & load_cache($type);
|
||||
$db = $this->load->database('default', true);
|
||||
|
||||
+21
-22
@@ -47,28 +47,27 @@ class Auth {
|
||||
} elseif(false !== strpos($_SERVER['HTTP_HOST'], "admin.dev.liche.cn") || false !== strpos($_SERVER['HTTP_HOST'], "admin.lc.haodian.cn")){
|
||||
//开发测试免检
|
||||
} elseif(filter_var($ip, FILTER_VALIDATE_IP) && $ip != $admin_user['login_ip']) {
|
||||
$CI->load->model('sys/sys_config_model');
|
||||
$config_ip = $CI->sys_config_model->select(array("v LIKE '%\"status\":\"1\"%'" => NULL,"k" => "site"));
|
||||
$ip_arr = array();
|
||||
foreach ($config_ip as $key => $value)
|
||||
{
|
||||
$ip_arr[] = json_decode($value['v'])->ip;
|
||||
}
|
||||
|
||||
$ip_arr = array_merge($ip_arr, array_column($CI->sys_admin_model->select(array(),'','','','login_ip'), 'login_ip'));
|
||||
if(!in_array($ip, $ip_arr) && $dir)
|
||||
{
|
||||
if($admin_user['id'] > 10){//管理员id>10去掉验证码登录
|
||||
$admin_info = array(
|
||||
'id' => $admin_user['id'],
|
||||
);
|
||||
$domain = explode('.', $_SERVER['HTTP_HOST']);
|
||||
array_shift($domain);
|
||||
$domain = implode('.', $domain);
|
||||
$CI->input->set_cookie(LOGIN_COOKIE, $CI->encryption->encrypt(json_encode($admin_info)), time() + 86400, $domain);
|
||||
$this->returnMsg('访问IP发生变化,请重新登录', '/login/check_view');
|
||||
}
|
||||
}
|
||||
// $CI->load->model('sys/sys_config_model');
|
||||
// $config_ip = $CI->sys_config_model->select(array("v LIKE '%\"status\":\"1\"%'" => NULL,"k" => "site"));
|
||||
// $ip_arr = array();
|
||||
// foreach ($config_ip as $key => $value)
|
||||
// {
|
||||
// $ip_arr[] = json_decode($value['v'])->ip;
|
||||
// }
|
||||
// $ip_arr = array_merge($ip_arr, array_column($CI->sys_admin_model->select(array(),'','','','login_ip'), 'login_ip'));
|
||||
// if(!in_array($ip, $ip_arr) && $dir)
|
||||
// {
|
||||
// if($admin_user['id'] > 10){//管理员id>10去掉验证码登录
|
||||
// $admin_info = array(
|
||||
// 'id' => $admin_user['id'],
|
||||
// );
|
||||
// $domain = explode('.', $_SERVER['HTTP_HOST']);
|
||||
// array_shift($domain);
|
||||
// $domain = implode('.', $domain);
|
||||
// $CI->input->set_cookie(LOGIN_COOKIE, $CI->encryption->encrypt(json_encode($admin_info)), time() + 86400, $domain);
|
||||
// $this->returnMsg('访问IP发生变化,请重新登录', '/login/check_view');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//权限分类筛选
|
||||
|
||||
@@ -596,7 +596,6 @@ class OrdersList
|
||||
$count = $this->ci->order_loans_model->count_order($where, $t2);
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
$this->ci->load->model('sys/sys_finance_model');
|
||||
$fileds = "$t1.o_id,$t1.title,$t1.year,$t1.first_price,$t1.status,$t1.c_time,";
|
||||
$fileds .= "$t2.rid,$t2.id,$t2.name,$t2.mobile,$t2.sid,$t2.finance_id,$t2.money_json,$t2.bill_time,$t2.admin_id";
|
||||
$rows = $this->ci->order_loans_model->select_order($where, "$t2.c_time desc", $page, $size, $fileds);
|
||||
@@ -606,7 +605,10 @@ class OrdersList
|
||||
$customers = $this->ci->mdCustomers->map('id', 'of_id,of2_id', array("id in({$str_rids})" => null));
|
||||
$offlineSources = $this->ci->mdCustomers->offlineSources();
|
||||
$finance_arr = array_column($rows, 'finance_id');
|
||||
$finance_rows = $this->ci->sys_finance_model->get_map_by_ids($finance_arr, 'id,title');
|
||||
//$this->ci->load->model('sys/sys_finance_model');
|
||||
//$finance_rows = $this->ci->sys_finance_model->get_map_by_ids($finance_arr, 'id,title');
|
||||
$this->ci->load->model('sys/sys_supplier_model');
|
||||
$finance_rows = $this->ci->sys_supplier_model->get_map_by_ids($finance_arr, 'id,title');
|
||||
//获取销售
|
||||
$str_admin_ids = implode(',', array_unique(array_column($rows, 'admin_id')));
|
||||
!$str_admin_ids && $str_admin_ids = 0;
|
||||
|
||||
@@ -7,7 +7,7 @@ class Ordersv2List
|
||||
{
|
||||
private $ci;
|
||||
private $searchTpAry = array('owner_name' => '车主姓名', 'owner_mobile' => '车主手机号', 'name' => '客户姓名', 'mobile' => '客户手机号', 'sid' => '订单号');
|
||||
private $paywayAry = array(0 => '贷款', 1 => '全款');
|
||||
private $paywayAry = array(0 => '按揭', 1 => '全款');
|
||||
private $overAry = array(0 => '7天内', 1 => '14天内', 2=> '30天内', 3=> '大于30天');
|
||||
private $t1 = 'lc_receiver_orders_v2';
|
||||
private $t2 = 'lc_receiver_order_status';
|
||||
@@ -17,8 +17,12 @@ class Ordersv2List
|
||||
$this->ci = &get_instance();
|
||||
$this->ci->load->model('receiver/order/receiver_orders_v2_model', 'mdOrders');
|
||||
$this->ci->load->model('receiver/order/receiver_order_status_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_loans_model', 'order_loans_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_loans0_model', 'order_loans0_model');
|
||||
$this->ci->load->model('receiver/order/receiver_order_agents_model', 'order_agents_model');
|
||||
$this->ci->load->model('app/licheb/app_licheb_users_model', 'mdLichebUsers');
|
||||
$this->ci->load->model('app/licheb/app_licheb_channel_biz_model');
|
||||
$this->ci->load->model('app/liche/app_liche_orders_model');
|
||||
$this->ci->load->model('receiver/receiver_customers_model', 'mdCustomers');
|
||||
$this->ci->load->model('receiver/receiver_clues_cfrom_model', 'mdCluesCfrom');
|
||||
$this->ci->load->model("biz/biz_model");
|
||||
@@ -26,6 +30,9 @@ class Ordersv2List
|
||||
$this->ci->load->model('auto/auto_brand_model');
|
||||
$this->ci->load->model('auto/auto_attr_model');
|
||||
$this->ci->load->model('items/items_model', 'mdItems');
|
||||
$this->ci->load->model('area_model');
|
||||
//$this->ci->load->model('sys/sys_finance_model');
|
||||
$this->ci->load->model('sys/sys_supplier_model');
|
||||
|
||||
$this->ci->load->library('receiver/orders_v2_entity');
|
||||
$this->ci->load->library('receiver/orders_status_entity');
|
||||
@@ -40,11 +47,15 @@ class Ordersv2List
|
||||
!strlen($params['payway']) && $params['payway'] = '';
|
||||
!$params['biz_type'] && $params['biz_type'] = '';
|
||||
!strlen($params['over_id']) && $params['over_id'] = '';
|
||||
$fieldAry = $this->get_fields($status_pid);
|
||||
$show_info['offlineSourcesAry'] = $this->ci->mdCustomers->offlineSources();//客户来源
|
||||
!strlen($params['is_bill']) && $params['is_bill'] = '';
|
||||
!strlen($params['if_usedcar']) && $params['if_usedcar'] = '';
|
||||
$fieldAry = $this->get_fields($status_pid,0,$params['status']);
|
||||
#$show_info['offlineSourcesAry'] = $this->ci->mdCustomers->offlineSources();//客户来源
|
||||
$show_info['offlineSourcesAry'] = $this->ci->mdCustomers->offlineSources_search();
|
||||
$show_info['paywayAry'] = $this->paywayAry;//付款方式
|
||||
$show_info['overAry'] = $this->overAry;
|
||||
$show_info['bizTypeAry'] = $this->ci->biz_model->type_ary();//门店类型
|
||||
$show_info['usedcarAry'] = array(1=>'是', 0=>'否');
|
||||
//渠道经理
|
||||
$show_info['qdjl_lists'] = $this->ci->mdLichebUsers->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0')
|
||||
, 'id desc', 0, 0, 'id,uname as name');
|
||||
@@ -58,6 +69,47 @@ class Ordersv2List
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取车辆服务费, 参考 \orderv2\Orders.php public function get()
|
||||
private function get_srv_info($row){
|
||||
//获取车辆服务费
|
||||
$srv_info = $this->ci->orders_v2_entity->order_srv_money($row['id'], 2);
|
||||
$fine_title = '';
|
||||
if($row['fines']){
|
||||
$fines = json_decode($row['fines'],true);
|
||||
$split = $fine_title = '';
|
||||
foreach($fines as $key=>$val){
|
||||
$price = $val['price']>0 ? number_format(floatval($val['price']),2) : '赠送';
|
||||
$fine_title .= $split."{$val['txt']}:{$price}";
|
||||
$split = ' ';
|
||||
}
|
||||
}
|
||||
$srv_info['total'] = number_format($srv_info['total'], 2);
|
||||
$srv_detail = "";
|
||||
if ($srv_info['list']) {
|
||||
foreach ($srv_info['list'] as $key => $val) {
|
||||
$d = $srv_detail ? ',' : '';
|
||||
if($val['key']=='price_fine_select' && $fine_title){
|
||||
#$srv_detail .= $d . $val['title'] . ":" . number_format(floatval($val['money']), 2)."<span class='text-success'>[$fine_title]</span>";
|
||||
if ($val['money'] > 0){
|
||||
$srv_detail .= $d . $val['title'] . ":" . number_format(floatval($val['money']), 2)."<span class='text-success'>[$fine_title]</span>";
|
||||
$srv_info[$val['key']] = number_format(floatval($val['money']), 2);
|
||||
}
|
||||
else{
|
||||
$srv_detail .= $d . $val['title'] ."<span class='text-success'>[$fine_title]</span>";
|
||||
$srv_info[$val['key']] = '';
|
||||
}
|
||||
$srv_info[$val['key'].'_detail'] = $fine_title;
|
||||
}else{
|
||||
$srv_detail .= $d . $val['title'] . ":" . number_format(floatval($val['money']), 2);
|
||||
$srv_info[$val['key']] = $val['money'] > 0 ? number_format(floatval($val['money']), 2) : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$srv_info['fine_title'] = $fine_title;
|
||||
$srv_info['detail'] = $srv_detail;
|
||||
return $srv_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes:全部订单
|
||||
* Created on: 2021/9/18 15:13
|
||||
@@ -86,7 +138,7 @@ class Ordersv2List
|
||||
$where["{$this->t1}.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['biz_type']) {
|
||||
$where["{$this->t1}.biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ' and status=1)'] = null;
|
||||
$where["{$this->t1}.biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ')'] = null;
|
||||
}
|
||||
if ($params['of_id'] || $params['of2_id']) {
|
||||
$where_c = 'status>=0';
|
||||
@@ -133,6 +185,23 @@ class Ordersv2List
|
||||
$where["{$this->t1}.bill_time <="] = $bill_time[1] . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
//交付时间
|
||||
if ($params['ck_time']) {
|
||||
$ck_time = explode(' ~ ', $params['ck_time']);
|
||||
if ($ck_time[0]) {
|
||||
$where["{$this->t1}.ck_time >="] = $ck_time[0] . ' 00:00:00';
|
||||
}
|
||||
if ($ck_time[1]) {
|
||||
$where["{$this->t1}.ck_time <="] = $ck_time[1] . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
if(strlen($params['is_bill'])){
|
||||
if($params['is_bill']){
|
||||
$where["{$this->t1}.bill_time <> '0000-00-00 00:00:00'"] = null;
|
||||
}else{
|
||||
$where["{$this->t1}.bill_time"] = '0000-00-00 00:00:00';
|
||||
}
|
||||
}
|
||||
//交付时长
|
||||
if(strlen($params['over_id'])){
|
||||
if($params['over_id']==3){
|
||||
@@ -148,6 +217,7 @@ class Ordersv2List
|
||||
$where["{$this->t1}.over_time<="] = date('Y-m-d',time()+$e_day*24*60*60);
|
||||
}
|
||||
}
|
||||
$where["{$this->t1}.brand_id in (select id from lc_auto_brand where status > -1)"] = null;
|
||||
if ($params['brand_id']) {//品牌
|
||||
$where["{$this->t1}.brand_id"] = $params['brand_id'];
|
||||
} else {
|
||||
@@ -205,31 +275,38 @@ class Ordersv2List
|
||||
$where = ["{$this->t1}.status>=" => 0];
|
||||
$where["{$this->t1}.item_id in(select id from lc_items where vin like '%{$params['vin']}%')"] = null;
|
||||
}
|
||||
$fileds = "{$this->t1}.id,{$this->t1}.name,{$this->t1}.mobile,{$this->t1}.brand_id,{$this->t1}.s_id,{$this->t1}.v_id,
|
||||
{$this->t1}.cor_id,{$this->t1}.incor_id,{$this->t1}.money_json,{$this->t1}.payway,{$this->t1}.status,{$this->t1}.c_time,
|
||||
if (strlen($params['if_usedcar'])) {
|
||||
$where["{$this->t1}.if_usedcar"] = $params['if_usedcar'];
|
||||
}
|
||||
$fileds = "{$this->t1}.id,{$this->t1}.name,{$this->t1}.mobile,{$this->t1}.brand_id,{$this->t1}.s_id,{$this->t1}.v_id,{$this->t1}.if_usedcar,
|
||||
{$this->t1}.cor_id,{$this->t1}.incor_id,{$this->t1}.money_json,{$this->t1}.payway,{$this->t1}.status,{$this->t1}.c_time,{$this->t1}.fines,
|
||||
{$this->t1}.biz_id,{$this->t1}.bill_time,{$this->t1}.customer_id,{$this->t1}.owner_name,{$this->t1}.owner_mobile,{$this->t1}.main_type,{$this->t1}.info_json,
|
||||
{$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id,{$this->t1}.over_time";
|
||||
{$this->t1}.order_time,{$this->t1}.bill_time,{$this->t1}.item_id,{$this->t1}.over_time,{$this->t1}.sale_id,{$this->t1}.finance_id,{$this->t1}.finance_id0,{$this->t1}.refund_time,
|
||||
{$this->t1}.ck_time,{$this->t1}.admin_id";
|
||||
if(strlen($params['status_pid'])){
|
||||
$where["{$this->t1}.brand_id>"] = 0;
|
||||
}
|
||||
if (strlen($params['status_pid']) && $params['status'] == 1) { //付款-已下定
|
||||
if (strlen($params['status_pid']) && $params['status_pid'] != 21) { //付款-已下定
|
||||
$where["{$this->t1}.status <> 2"] = null;
|
||||
}
|
||||
if ($params['status_pid'] == 4) { //交付需要开票后才显示
|
||||
$where["{$this->t1}.id in (select o_id from lc_receiver_order_status where pid_status=3 and status=1)"] = null;
|
||||
}
|
||||
if (strlen($params['status_pid']) && $params['status_pid'] && $params['status_pid']!=21) {
|
||||
if (strlen($params['status_pid']) && $params['status_pid'] && !in_array($params['status_pid'],[21,5,3])) {
|
||||
$where["{$this->t1}.id>="] = Orders_v2_entity::V2_START_ID;
|
||||
}
|
||||
|
||||
if (strlen($params['status_pid']) && !$params['status_pid']) { //付款列表 下定时间排序
|
||||
$orderby = "{$this->t1}.order_time desc";
|
||||
} elseif ($params['status_pid'] == 3) { // 开票列表 开票时间排序
|
||||
$orderby = "{$this->t1}.bill_time desc";
|
||||
}elseif($params['status_pid'] == 21){ //退款时间排序
|
||||
$orderby = "{$this->t1}.refund_time desc";
|
||||
}elseif($params['status_pid']==5 || ($params['status']==2&&$params['status_pid']==4)){ //交付时间排序
|
||||
$orderby = "{$this->t1}.ck_time desc,{$this->t1}.c_time desc";
|
||||
} else {
|
||||
$orderby = "{$this->t1}.c_time desc";
|
||||
}
|
||||
if (strlen($params['status_pid']) && $params['status'] && $params['status_pid']!=21) {
|
||||
if (strlen($params['status_pid']) && $params['status'] && $params['status_pid']!=21 &&$params['status']<21) {
|
||||
$where["{$this->t2}.pid_status"] = $params['status_pid'];
|
||||
$up_key = $params['status'] + 1;
|
||||
$where["{$this->t2}.status in ({$params['status']},{$up_key})"] = null;
|
||||
@@ -240,7 +317,7 @@ class Ordersv2List
|
||||
$count = $this->ci->mdOrders->selectOrders($where, '', '', '', 1, '', $having);
|
||||
$rows = $this->ci->mdOrders->selectOrders($where, $orderby, $page, $size, '', $fileds, $having);
|
||||
} else {
|
||||
if (strlen($params['status'])) {
|
||||
if (strlen($params['status']) && $params['status']<21) {
|
||||
$where["id not in (select o_id from lc_receiver_order_status where pid_status={$params['status_pid']} and status=1)"] = null;
|
||||
}
|
||||
if ($params['status_pid'] == 3) { //开票
|
||||
@@ -251,6 +328,10 @@ class Ordersv2List
|
||||
}
|
||||
}
|
||||
$params['status_pid'] == 21 && $where['status'] = 2; //退款
|
||||
if($params['status']==21){ //特殊需求
|
||||
$where["id in (select o_id from lc_receiver_order_status where pid_status=0 and status=1)"] = null; //已付定金
|
||||
$where["id not in (select o_id from lc_receiver_order_status where pid_status=0 and status=2)"] = null; //尾款未支付
|
||||
}
|
||||
$count = $this->ci->mdOrders->count($where);
|
||||
$rows = $this->ci->mdOrders->select($where, $orderby, $page, $size, $fileds);
|
||||
}
|
||||
@@ -268,7 +349,17 @@ class Ordersv2List
|
||||
//门店
|
||||
$str_biz_ids = implode(',', array_unique(array_column($rows, 'biz_id')));
|
||||
!$str_biz_ids && $str_biz_ids = 0;
|
||||
$bizs = $this->ci->biz_model->map('id', 'biz_name', array("id in({$str_biz_ids})" => null));
|
||||
$bizs_rows = $this->ci->biz_model->select(array("id in({$str_biz_ids})" => null),'','','','id,biz_name,city_id,county_id,type');
|
||||
$bizs = [];
|
||||
if($bizs_rows){ //获取城市
|
||||
$ids = array_unique(array_column($bizs_rows, 'county_id'));
|
||||
$city_rows = $this->ci->area_model->get_map_by_county_ids($ids,'id,city_name,city_id','city_id');
|
||||
foreach ($bizs_rows as $val) {
|
||||
$val['city_name'] = $city_rows[$val['city_id']] ? $city_rows[$val['city_id']][0]['city_name'] : '';
|
||||
$bizs[$val['id']] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
//品牌车型
|
||||
$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
$brands = $this->ci->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
@@ -281,14 +372,23 @@ class Ordersv2List
|
||||
$incor_arr = array_unique(array_column($rows, 'incor_id'));
|
||||
$attr_arr = array_merge($v_arr, $cor_arr, $incor_arr);
|
||||
$attr = $this->ci->auto_attr_model->get_map_by_ids($attr_arr, 'id,title');
|
||||
$admin_ids = array_unique(array_column($rows,'admin_id'));
|
||||
$admin_ids_str = implode(',',$admin_ids);
|
||||
$admins = [];
|
||||
if($admin_ids_str){
|
||||
$where = [
|
||||
"id in ($admin_ids_str)" => null
|
||||
];
|
||||
$admins = $this->ci->mdLichebUsers->map('id','uname',$where,'id desc',0,0,'id,uname'); //顾问
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$money_json = json_decode($val['money_json'], true);
|
||||
$info_json = json_decode($val['info_json'], true);
|
||||
$fields = array();
|
||||
$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
$series_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
$v_name = isset($attr[$val['v_id']]) ? $attr[$val['v_id']][0]['title'] : '';
|
||||
$cor_name = isset($attr[$val['cor_id']]) ? $attr[$val['cor_id']][0]['title'] : '';
|
||||
$money_json = json_decode($val['money_json'],true);
|
||||
$fields['o_id'] = $val['id'];
|
||||
if (Orders_v2_entity::V2_START_ID < $val['id']) {
|
||||
if ($val['main_type']) {
|
||||
@@ -299,40 +399,118 @@ class Ordersv2List
|
||||
$mobile = $val['owner_mobile'];
|
||||
}
|
||||
$open_url = '/receiver/orderv2/orders/get?id=';
|
||||
$id_card_append = $info_json['c_owner_cardid'] ? '<br>'.$info_json['c_owner_cardid'] : '';
|
||||
$id_card = $info_json['c_owner_cardid'] ? '="'.$info_json['c_owner_cardid'].'"' : '';
|
||||
$fields['name'] = $size > 1000 ? $name
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . '</a>';
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . $id_card_append . '</a>';
|
||||
} else {
|
||||
$open_url = '/receiver/orders/get?id=';
|
||||
$mobile = $val['mobile'];
|
||||
$o_tp = '(旧订单)';
|
||||
$id_card_append = $info_json['c_cardid'] ? '<br>'.$info_json['c_cardid'] : '';
|
||||
$fields['name'] = $size > 1000 ? $val['name']
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $val['name'] . $o_tp . '<br>' . $val['mobile'] . '</a>';
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $val['name'] . $o_tp . '<br>' . $val['mobile'] . $id_card_append .'</a>';
|
||||
$id_card = $info_json['c_cardid'] ? '="'.$info_json['c_cardid'].'"' : '';
|
||||
}
|
||||
$fields['mobile'] = $mobile;
|
||||
$fields['id_card'] = $id_card;
|
||||
$fields['mobile'] = $size > 1000 ? '="'.$mobile.'"' : $mobile;
|
||||
$fields['car_name'] = "{$brand_name}-{$series_name}-{$v_name}-{$cor_name}";
|
||||
$fields['price'] = $this->paywayAry[$val['payway']]."<br>".number_format($money_json['price_car'], 2);
|
||||
$fields['price_car'] = number_format($this->ci->orders_v2_entity->total_price($val['id'],$val['money_json']),2);
|
||||
$fields['payway_name'] = $this->paywayAry[$val['payway']];
|
||||
$fields['price'] = $fields['payway_name']."<br>".$fields['price_car'];
|
||||
$fields['brand_name'] = $brand_name;
|
||||
$fields['series_name'] = $series_name;
|
||||
$fields['v_name'] = $v_name;
|
||||
$fields['cor_name'] = $cor_name;
|
||||
$fields['incor_name'] = isset($attr[$val['incor_id']]) ? $attr[$val['incor_id']][0]['title'] : '';
|
||||
if (strlen($params['status_pid']) && $params['status_pid'] != 5 && $val['status'] != 2) {
|
||||
$fields['status_name'] = $this->ci->orders_status_entity->last_status_cn($val['id'], $params['status_pid']);
|
||||
} else {
|
||||
$fields['status_name'] = $order_status_cn[$val['status']];
|
||||
|
||||
if($val['status']==2 || $val['id']<= Orders_v2_entity::V2_START_ID){
|
||||
$status_name = $order_status_cn[$val['status']];
|
||||
}else{
|
||||
$params['status_pid'] == 6 && $params['status_pid']='';
|
||||
$status_name = $this->ci->orders_status_entity->last_status_cn($val['id'], $params['status_pid']);
|
||||
!$status_name && $status_name = '未下定';
|
||||
}
|
||||
$fields['biz_name'] = $bizs[$val['biz_id']];
|
||||
$fields['status_name'] = $status_name;
|
||||
$fields['biz_name'] = $bizs[$val['biz_id']] ? $bizs[$val['biz_id']]['biz_name'].'<br>'.$admins[$val['admin_id']] : '';
|
||||
$size > 1000 && $fields['biz_name'] = $bizs[$val['biz_id']] ? $bizs[$val['biz_id']]['biz_name'] : '';
|
||||
$fields['city_name'] = $bizs[$val['biz_id']] ? $bizs[$val['biz_id']]['city_name'] : '';
|
||||
$fields['biz_type'] = $bizs[$val['biz_id']] ? $this->ci->biz_model->type_ary($bizs[$val['biz_id']]['type']) : '';
|
||||
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
|
||||
$of_title = '-';
|
||||
$of_title_1 = $of_title_2 = '';
|
||||
$of_id = $customers[$val['customer_id']]['of_id'];
|
||||
if ($of_id) {
|
||||
$of_ary = $offlineSources[$of_id];
|
||||
$of_title = $of_ary['name'];
|
||||
$of_ary['name'] && $of_title_1 = $of_ary['name'];
|
||||
$of2_id = $customers[$val['customer_id']]['of2_id'];
|
||||
$of2_id && $of_title .= '-' . $of_ary['list'][$of2_id];
|
||||
$of2_id && $of_ary['list'][$of2_id] && $of_title_2 = $of_ary['list'][$of2_id];
|
||||
}
|
||||
$fields['of_title'] = $of_title;
|
||||
$fields['of_title_1'] = $of_title_1;
|
||||
$fields['of_title_2'] = $of_title_2;
|
||||
$fields['order_time'] = $val['order_time'] != '0000-00-00 00:00:00' ? $val['order_time'] : '';
|
||||
$fields['bill_time'] = $val['bill_time'] != '0000-00-00 00:00:00' ? $val['bill_time'] : '';
|
||||
$fields['over_time'] = $val['over_time'] != '0000-00-00 00:00:00' ? date('Y-m-d',strtotime($val['over_time'])) : '';
|
||||
$fields['refund_time'] = $val['refund_time'] != '0000-00-00 00:00:00' ? date('Y-m-d',strtotime($val['refund_time'])) : '';
|
||||
$fields['vin'] = $items[$val['item_id']] ? $items[$val['item_id']] : '';
|
||||
$fields['if_usedcar_name'] = $val['if_usedcar'] ? '是':'';
|
||||
$if_usedcar_name = $val['if_usedcar'] ? ' (二手车)':'';
|
||||
$if_usedcar_name && $fields['vin'] && $size<1000 && $fields['vin'] = "{$fields['vin']}{$if_usedcar_name}";
|
||||
$fields['vin'] && $fields['car_name'] = $fields['car_name']."<br>".$fields['vin'];
|
||||
$fields['ck_time'] = $val['ck_time'];
|
||||
|
||||
if($size>1000){
|
||||
$user_info = '';
|
||||
if($bizs[$val['biz_id']]['type']==3){ //代理店显示渠道经理的姓名
|
||||
$channel_users = $this->ci->app_licheb_channel_biz_model->select(['biz_id'=>$val['biz_id']],'','','','uid');
|
||||
$user_ids = array_column($channel_users,'uid');
|
||||
$user_ids_str = implode(',',$user_ids);
|
||||
if($user_ids_str && $user_ids){
|
||||
$where = [
|
||||
'group_id' => 4,
|
||||
'status' => 1,
|
||||
"id in ($user_ids_str)" => null
|
||||
];
|
||||
$users = $this->ci->mdLichebUsers->select($where,'id desc',1,10,'uname,biz_id'); //渠道经理
|
||||
$users && $user_info = implode(' ',array_column($users,'uname'));
|
||||
}
|
||||
$fields['admin_name'] = $user_info;
|
||||
}
|
||||
if(!$user_info){
|
||||
$sale = $this->ci->mdLichebUsers->get(['id'=>$val['sale_id']],'uname');
|
||||
$fields['admin_name'] = $sale['uname'];
|
||||
}
|
||||
$fields['address'] = $info_json['c_address'];
|
||||
}
|
||||
if(!$val['payway']){ //按揭
|
||||
//$finance_row = $this->ci->sys_finance_model->get(['id' => $val['finance_id']], 'id,title');
|
||||
$finance_row = $this->ci->sys_supplier_model->get(['id' => $val['finance_id'], 'type'=>3], 'id,title');
|
||||
$is_sure = $this->ci->receiver_order_status_model->count(['o_id'=>$val['id'],'pid_status'=>1,'status'=>2]);
|
||||
$finance_row && $fields['price'] = "{$fields['payway_name']}({$finance_row['title']})<br>{$fields['price_car']}";
|
||||
$fields['pro_loan'] = $finance_row['title'];
|
||||
$fields['price_loan'] = $money_json['price_loan'];
|
||||
$fields['is_sure'] = $is_sure ? '是':'否';
|
||||
$loan = $this->ci->order_loans_model->get(['o_id' => $val['id']]);
|
||||
$fields['is_tiexi'] = intval($loan['is_tiexi']) ? '是': '';
|
||||
|
||||
// 首付按揭
|
||||
$finance_row0 = $this->ci->sys_supplier_model->get(['id' => $val['finance_id0'], 'type'=>3], 'id,title');
|
||||
$is_sure0 = $this->ci->app_liche_orders_model->count(['o_id'=>$val['id'],'type'=>8,'status'=>1]);
|
||||
$fields['pro_loan0'] = $finance_row0['title'];
|
||||
$fields['price_loan0'] = $money_json['price_loan0'];
|
||||
$fields['is_sure0'] = $is_sure0 ? '是':'否';
|
||||
$loan0 = $this->ci->order_loans0_model->get(['o_id' => $val['id']]);
|
||||
$fields['is_tiexi'] = intval($loan0['is_tiexi']) ? '是': '';
|
||||
}
|
||||
$srv_info = $this->get_srv_info($val);
|
||||
$fields['srv_info_total'] = $srv_info['total'] > 0 ? $srv_info['total'] : '';
|
||||
$fields['srv_info_fee_carno'] = $srv_info['fee_carno'] ? $srv_info['fee_carno'] : '';
|
||||
$fields['srv_info_price_finance'] = $srv_info['price_finance'] ? $srv_info['price_finance'] : '';
|
||||
$fields['srv_info_price_fine_select'] = $srv_info['price_fine_select'] ? $srv_info['price_fine_select'] : '';
|
||||
$fields['srv_info_price_fine_select_detail'] = $srv_info['price_fine_select_detail'] ? $srv_info['price_fine_select_detail'] : '';
|
||||
$lists[] = $fields;
|
||||
}
|
||||
}
|
||||
@@ -370,7 +548,7 @@ class Ordersv2List
|
||||
$where["biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['biz_type']) {
|
||||
$where["biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ' and status=1)'] = null;
|
||||
$where["biz_id in (select id from lc_biz where type = " . $params['biz_type'] . ')'] = null;
|
||||
}
|
||||
if ($params['of_id'] || $params['of2_id']) {
|
||||
$where_c = 'status>=0';
|
||||
@@ -445,7 +623,6 @@ class Ordersv2List
|
||||
!$str_biz_ids && $str_biz_ids = 0;
|
||||
$bizs = $this->ci->biz_model->map('id', 'biz_name', array("id in({$str_biz_ids})" => null));
|
||||
foreach ($rows as $key => $val) {
|
||||
$money_json = json_decode($val['money_json'], true);
|
||||
$info_json = json_decode($val['info_json'], true);
|
||||
$fields = array();
|
||||
$fields['o_id'] = $val['id'];
|
||||
@@ -457,20 +634,27 @@ class Ordersv2List
|
||||
$mobile = $val['owner_mobile'];
|
||||
}
|
||||
$open_url = '/receiver/orderv2/orders/get?id=';
|
||||
$id_card_append = $info_json['c_owner_cardid'] ? '<br>'.$info_json['c_owner_cardid'] : '';
|
||||
$fields['name'] = $size > 1000 ? $name
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . '</a>';
|
||||
$fields['mobile'] = $mobile;
|
||||
: '<a href="javascript:;" data-open="' . $open_url . $val['id'] . '">' . $name . '<br>' . $mobile . $id_card_append .'</a>';
|
||||
$fields['id_card'] = $info_json['c_owner_cardid'] ? '="'.$info_json['c_owner_cardid'].'"' : '';
|
||||
$fields['mobile'] = $size > 1000 ? '="'.$mobile.'"' : $mobile;
|
||||
$fields['biz_name'] = $bizs[$val['biz_id']];
|
||||
$fields['c_time'] = date('Y-m-d H:i:s', $val['c_time']);
|
||||
$of_title = '-';
|
||||
$of_title_1 = $of_title_2 = '';
|
||||
$of_id = $customers[$val['customer_id']]['of_id'];
|
||||
if ($of_id) {
|
||||
$of_ary = $offlineSources[$of_id];
|
||||
$of_title = $of_ary['name'];
|
||||
$of_ary['name'] && $of_title_1 = $of_ary['name'];
|
||||
$of2_id = $customers[$val['customer_id']]['of2_id'];
|
||||
$of2_id && $of_title .= '-' . $of_ary['list'][$of2_id];
|
||||
$of2_id && $of_ary['list'][$of2_id] && $of_title_2 = $of_ary['list'][$of2_id];
|
||||
}
|
||||
$fields['of_title'] = $of_title;
|
||||
$fields['of_title_1'] = $of_title_1;
|
||||
$fields['of_title_2'] = $of_title_2;
|
||||
$lists[] = $fields;
|
||||
}
|
||||
}
|
||||
@@ -489,12 +673,25 @@ class Ordersv2List
|
||||
* @param int $export
|
||||
* @return array
|
||||
*/
|
||||
public function get_fields($status_pid, $export = 0)
|
||||
public function get_fields($status_pid, $export = 0, $status)
|
||||
{
|
||||
$fields1 = $fields2 = [];
|
||||
if ($export) {
|
||||
$fields1['name'] = ['title' => '客户姓名'];
|
||||
$fields1['mobile'] = ['title' => '客户电话'];
|
||||
$fields1['id_card'] = ['title' => '证件号码'];
|
||||
$fields1['brand_name'] = ['title' => '品牌'];
|
||||
$fields1['series_name'] = ['title' => '车系'];
|
||||
$fields1['v_name'] = ['title' => '车型'];
|
||||
$fields1['cor_name'] = ['title' => '车身颜色'];
|
||||
$fields1['vin'] = ['title' => 'vin码'];
|
||||
$fields1['if_usedcar_name'] = ['title' => '二手车'];
|
||||
$fields1['city_name'] = ['title'=>'城市'];
|
||||
$fields1['biz_type'] = ['title'=>'门店类型'];
|
||||
$fields1['biz_name'] = ['title' => '门店'];
|
||||
$fields1['admin_name'] = ['title' => '销售人员'];
|
||||
$fields1['of_title_1'] = ['title' => '来源1'];
|
||||
$fields1['of_title_2'] = ['title' => '来源2'];
|
||||
} else {
|
||||
$fields1['name'] = ['title' => '客户', 'width' => '14%'];
|
||||
}
|
||||
@@ -521,12 +718,40 @@ class Ordersv2List
|
||||
'price' => ['title' => '最终售价', 'width' => '9%'],
|
||||
// 'payway_name' => ['title' => '付款方式', 'width' => '8%'],
|
||||
'of_title' => ['title' => '客户来源', 'width' => '10%'], 'status_name' => ['title' => '状态', 'width' => '9%'],
|
||||
'over_time' => ['title' => '交付截止', 'width' => '9%'],'order_time' => ['title' => '下定时间', 'width' => '9%']
|
||||
'order_time' => ['title' => '下定时间', 'width' => '9%'],'over_time' => ['title' => '交付截止', 'width' => '9%']
|
||||
];
|
||||
if($status_pid==21){
|
||||
unset($fields2['over_time']);
|
||||
$fields2['refund_time'] = ['title' => '退款时间', 'width' => '9%'];
|
||||
}
|
||||
if($status_pid==5 || ($status_pid==4 && $status==2)){
|
||||
unset($fields2['over_time']);
|
||||
$fields2['ck_time'] = ['title' => '交付时间', 'width' => '9%'];
|
||||
}
|
||||
}
|
||||
$fields = array_merge($fields1, $fields2);
|
||||
if ($export) {
|
||||
$fields['vin'] = ['title' => 'vin码'];
|
||||
unset($fields['price'],$fields['c_time'],$fields['car_name'],$fields['of_title']);
|
||||
$fields['payway_name'] = ['title'=>'付款方式'];
|
||||
$fields['pro_loan0'] = ['title'=>'首付按揭-金融机构'];
|
||||
//$fields['is_tiexi0'] = ['title'=>'首付按揭-贴息']; // 首付按揭不需要贴息选项
|
||||
$fields['price_loan0'] = ['title'=>'首付按揭-金额'];
|
||||
$fields['is_sure0'] = ['title'=>'首付按揭-确认到款(是/否)'];
|
||||
$fields['pro_loan'] = ['title'=>'金融机构'];
|
||||
$fields['is_tiexi'] = ['title'=>'贴息'];
|
||||
$fields['price_loan'] = ['title'=>'按揭金额'];
|
||||
$fields['is_sure'] = ['title'=>'确认到款(是/否)'];
|
||||
$fields['price_car'] = ['title'=>'最终售价'];
|
||||
$fields['srv_info_total'] = ['title'=>'手续费'];
|
||||
$fields['srv_info_fee_carno'] = ['title'=>'手续费-上牌'];
|
||||
$fields['srv_info_price_finance'] = ['title'=>'手续费-按揭'];
|
||||
$fields['srv_info_price_fine_select'] = ['title'=>'手续费-精品选装'];
|
||||
$fields['srv_info_price_fine_select_detail'] = ['title'=>'精品选装内容'];
|
||||
!$fields['c_time'] && $fields['c_time'] = ['title' => '订单时间'];
|
||||
!$fields['over_time'] && $fields['over_time'] = ['title' => '止交付时间'];
|
||||
!$fields['order_time'] && $fields['order_time'] = ['title' => '下定时间'];
|
||||
!$fields['bill_time'] && $fields['bill_time'] = ['title' => '开票时间'];
|
||||
$fields['address'] = ['title' => '联系人地址'];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,461 @@
|
||||
<div class="am-form am-form-horizontal" style="width: 98%;padding-top: 10px">
|
||||
<div id="vue-edit">
|
||||
<div class="am-g">
|
||||
<div class="col-sm-12" style="margin-bottom: 20px;">
|
||||
<div class="col-sm-2">
|
||||
<div class="my-panel">
|
||||
<div class="text-center">
|
||||
状态
|
||||
</div>
|
||||
<div class="text-center" style="padding-top: 5px;">
|
||||
<select v-if="info.id==0" id="status" v-model="info.status">
|
||||
<template v-for="(v,i) in status_list">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
<select v-else id="status" disabled="disabled" v-model="info.status">
|
||||
<template v-for="(v,i) in status_list">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="info.id>0" class="am-form-inline"
|
||||
style="text-align:right;padding-right: 10px;padding-top: 35px;">
|
||||
<div class="am-form-group ml10">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
|
||||
@click="editType(1)" v-if="info.editType==1">取消编辑</a>
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-default"
|
||||
@click="editType(1)" v-else>编辑状态</a>
|
||||
</div>
|
||||
<div class="am-form-group ml10" v-if="info.editType==1">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
|
||||
@click="saveStatus()">保存状态</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-u-lg-12">
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span style="font-size: 20px">活动信息</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">标题:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<input type="text" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">背景图片:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.info.bg_img">
|
||||
<i class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
:src="vue_obj.info.bg_img.src"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">背景颜色:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<input type="text" v-model="info.bg_color">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">活动时间:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<input id="time_id" value="<?= $info['time'] ?>" type="text" placeholder="开始日期 ~ 结束日期"
|
||||
autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">抽奖次数:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<input type="text" v-model="info.lottery_num">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">其它事项:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<textarea rows="4" v-model="info.rule"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">底部文字:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<input type="text" v-model="info.bottom_word">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分享描述:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<input type="text" v-model="info.share_desc">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分享图片:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.info.share_img">
|
||||
<i class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
:src="vue_obj.info.share_img.src"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">礼品说明:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<textarea rows="4" v-model="info.prizes_content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">礼品备注:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<input type="text" v-model="info.prizes_note">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">中奖说明:</label>
|
||||
<div class="am-para-input" style="width: 30%">
|
||||
<input type="text" v-model="info.prizes_winning_ins">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">礼品配置:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="col-sm-10">
|
||||
<table class="table table-hover table-middle" style="table-layout:fixed">
|
||||
<colgroup>
|
||||
<col width="80px"/>
|
||||
<col width="30%">
|
||||
<col width="15%">
|
||||
<col width="30%"/>
|
||||
<col width="">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">图片</th>
|
||||
<th class="text-center">标题</th>
|
||||
<th class="text-center">积分</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th class="text-right">
|
||||
<a href="javascript:" style="margin-top: 2px;"
|
||||
class="btn btn-primary btn-sm"
|
||||
@click='adModal()'>添加</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in prizes_list">
|
||||
<tr>
|
||||
<td><img data-tips-image :src="item.img_src"></td>
|
||||
<td class="text-center">{{item.title}}</td>
|
||||
<td class="text-center">{{item.credit}}</td>
|
||||
<td class="text-center">
|
||||
<div :id="'group_name_txt_'+index">{{item.order_view}} <a
|
||||
href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
class="fa fa-edit"></i></a></div>
|
||||
<input :id="'group_name_'+index" @blur="editGroupName(index,item.id)"
|
||||
style="display: none;" type="number" class="form-control"
|
||||
v-model="item.order_view" placeholder="请输入排序值">
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<a href="javascript:void(0);" style="margin-top:2px;"
|
||||
class="btn btn-default btn-sm" @click='adModal(item)'>编辑</a>
|
||||
<a href="javascript:void(0);" style="margin-top:2px;"
|
||||
class="btn btn-danger btn-sm" @click='removeAd(index)'>删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<template v-if="prizes_list.length <=0">
|
||||
<div style="text-align: center;">无数据</div>
|
||||
</template>
|
||||
</div>
|
||||
<div id="ad-modal" style="display: none;">
|
||||
<div class="form-horizontal" style="padding-top: 20px;">
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">标题</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="prizes_item.title"
|
||||
placeholder="请输入标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">图片</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input :value="vue_obj.prizes_img.value" type="text"
|
||||
style="width: 60%;margin-right: 5px;"
|
||||
class="form-control">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.prizes_img">
|
||||
<i class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<img data-tips-image
|
||||
style="height:auto;max-height:32px;min-width:32px;margin-left: 5px;"
|
||||
:src="vue_obj.prizes_img.src"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">积分</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="prizes_item.credit"
|
||||
placeholder="请输入积分">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">排序值</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" class="form-control" v-model="prizes_item.order_view"
|
||||
placeholder="请输入排序">
|
||||
</div>
|
||||
<div style="padding-top:7px;">
|
||||
<small class="text-muted">越大越靠前</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label"></label>
|
||||
<div class="am-para-input" style="width: 60%">
|
||||
<a href="javascript:void(0)" class="am-btn am-btn-sm am-btn-success"
|
||||
@click="saveEdit()">保存活动信息</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#time_id', range: '~', type: 'datetime'
|
||||
, done: function (value, date, endDate) {
|
||||
if (endDate.hours == "0" && endDate.minutes == "0" && endDate.seconds == "0") {
|
||||
// 改变结束时间默认值
|
||||
$(".layui-laydate-footer [lay-type='datetime'].laydate-btns-time").click();
|
||||
$(".laydate-main-list-1 .layui-laydate-content li ol li:last-child").click();
|
||||
$(".layui-laydate-footer [lay-type='date'].laydate-btns-time").click();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
var layer_open;
|
||||
var vue_obj;
|
||||
$(document).ready(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info: {},
|
||||
status_list: [],
|
||||
prizes_list: [],
|
||||
prizes_item: {},
|
||||
prizes_img: {value: '', src: ''},
|
||||
},
|
||||
mounted() {
|
||||
var that = this;
|
||||
that.info = <?=json_encode($info)?>;
|
||||
that.status_list = <?=json_encode($status_list)?>;
|
||||
that.prizes_list = <?=json_encode($prizes_list)?>;
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
},
|
||||
updated: function () {
|
||||
},
|
||||
methods: {
|
||||
// 修改排序
|
||||
showGroupEditForm: function (index) {
|
||||
$("#group_name_" + index).show();
|
||||
$("#group_name_txt_" + index).hide();
|
||||
$('#group_name_' + index).focus();
|
||||
},
|
||||
// 排序
|
||||
editGroupName: function (index, group_id) {
|
||||
var order_view = $("#group_name_" + index).val();
|
||||
if (order_view == '') {
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
this.prizes_list.sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
});
|
||||
$("#group_name_" + index).hide();
|
||||
$("#group_name_txt_" + index).show();
|
||||
},
|
||||
adModal: function (item) {
|
||||
var that = this;
|
||||
var _title = '新增礼品';
|
||||
that.prizes_item = {};
|
||||
if (item) {
|
||||
that.prizes_item = item;
|
||||
_title = '编辑礼品';
|
||||
that.prizes_img = {value: item.img_value, src: item.img_src};
|
||||
} else {
|
||||
that.prizes_item = {"order_view": 50};
|
||||
that.prizes_img = {value: '', src: ''};
|
||||
}
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%'], //宽高
|
||||
content: $('#ad-modal'),
|
||||
title: _title,
|
||||
shade: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
if (!item) {
|
||||
let timestamp = Date.parse(new Date());
|
||||
let rand = parseInt(Math.random() * 1000);
|
||||
let id = timestamp + rand;
|
||||
that.prizes_list.push({
|
||||
id: id,
|
||||
title: that.prizes_item.title,
|
||||
img_value: that.prizes_img.value,
|
||||
img_src: that.prizes_img.src,
|
||||
credit: that.prizes_item.credit,
|
||||
order_view: that.prizes_item.order_view
|
||||
});
|
||||
}
|
||||
that.prizes_list.sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
});
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
removeAd: function (index) {
|
||||
var vm = this;
|
||||
vm.prizes_list.splice(index, 1);
|
||||
},
|
||||
editType: function (index) {
|
||||
var vm = this;
|
||||
if (index == 1) {
|
||||
if (vm.info.editType == 1) {
|
||||
$("#status").attr("disabled", "disabled");
|
||||
vm.info.editType = 0;
|
||||
} else {
|
||||
$("#status").removeAttr("disabled");
|
||||
vm.info.editType = 1;
|
||||
}
|
||||
} else if (index == 2) {
|
||||
if (vm.info.editType == 2) {
|
||||
vm.info.editType = 0;
|
||||
} else {
|
||||
vm.info.editType = 2;
|
||||
}
|
||||
} else {
|
||||
vm.info.editType = 0;
|
||||
}
|
||||
},
|
||||
saveEdit: function () {
|
||||
var vm = this;
|
||||
vm.info.time = $('#time_id').val();
|
||||
vm.info.prizes_list = vm.prizes_list;
|
||||
$.ajax({
|
||||
url: vm.info.edit_url,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info,
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
if (data['data']['type'] == 'add') {
|
||||
window.location.href = "#/app/liche/blindbox/get?id=" + data['data']['id'] + "?spm=<?= $_GET['spm'] ?>";
|
||||
} else {
|
||||
$.form.reload();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
},
|
||||
});
|
||||
},
|
||||
saveStatus: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/app/liche/blindbox/edit_status',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
layer.closeAll('loading');
|
||||
},
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.my-ul ul li {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.my-panel {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.btn-group .disabled {
|
||||
background-color: #eee;
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/hd.css?v=1581252500">
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/liche/blindbox">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">活动标题:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="title" value="<?= $params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml100">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" data-open="/app/liche/blindbox/get"
|
||||
class="am-btn am-btn-success am-btn-sm w100">新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%"><span>ID</span></th>
|
||||
<th width="15%"><span>标题</span></th>
|
||||
<th width="10%"><span>开始时间</span></th>
|
||||
<th width="10%"><span>结束时间</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['s_time'] ?></td>
|
||||
<td><?= $v['e_time'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="align-r">
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-modal="/common/share_link?id=<?= $v['id'] ?>&app_id=1&pages=lantushijia"
|
||||
data-title="分享链接">分享链接</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/app/liche/blindbox/get?id=<?= $v['id'] ?>">编辑</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
<form class="am-form am-form-horizontal" action="/app/liche/member/add_credit" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">总积分:</label>
|
||||
<div class="am-para-input">
|
||||
<span class="f12 lh-default ml5 text-danger"><?=$user['credits']+$user['freeze_credits']?></span>
|
||||
(<span class="f12 clr999 lh-default ml5 text-danger">可用积分:<?=$user['credits']?>,冻结:<?=$user['freeze_credits']?></span>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">积分:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="输入积分" name="credits" style="width: 150px; display: inline;">
|
||||
<!-- <span class="f12 clr999 lh-default ml5">小于0扣除积分,大于0增加积分</span>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">积分类型:</label>
|
||||
<div class="am-para-input w140">
|
||||
<select name="type">
|
||||
<option value="1">可用</option>
|
||||
<option value="2">冻结</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">备注:</label>
|
||||
<div class="am-para-input">
|
||||
<textarea name="remark"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<input name="uid" value="<?=$uid?>" type="hidden">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="submit">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,41 @@
|
||||
<form class="am-form am-form-horizontal" action="/app/liche/member/add_items" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">总积分:</label>
|
||||
<div class="am-para-input">
|
||||
<span class="f12 lh-default ml5 text-danger"><?=$user['credits']+$user['freeze_credits']?></span>
|
||||
(<span class="f12 clr999 lh-default ml5 text-danger">可用积分:<?=$user['credits']?>,冻结:<?=$user['freeze_credits']?></span>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">消耗积分:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="输入积分" name="credits" style="width: 150px; display: inline;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">商品名称:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="输入商品名称" name="item_title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">兑换码:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="输入兑换码" name="item_code">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">备注:</label>
|
||||
<div class="am-para-input">
|
||||
<textarea name="remark"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<input name="uid" value="<?=$uid?>" type="hidden">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="submit">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/liche/member/get_credit_log">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">用户id:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<input type="text" name="uid" value="" v-model="params.uid"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">积分类型:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="type" v-model="params.type">
|
||||
<option value="">全部</option>
|
||||
<option v-for="(value,key) in type_arr" :value="key">{{value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="15%"><span>用户</span></th>
|
||||
<th width="10%"><span>收入积分</span></th>
|
||||
<th width="10%"><span>支出积分</span></th>
|
||||
<th width="10%"><span>剩余积分</span></th>
|
||||
<th width="10%"><span>类型</span></th>
|
||||
<th width=""><span>备注</span></th>
|
||||
<th width="12%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['nickname'] ?></td>
|
||||
<td><?= $v['credit_in'] ?></td>
|
||||
<td><?= $v['credit_out'] ?></td>
|
||||
<td><?= $v['credit_left'] ?></td>
|
||||
<td><?= $v['type_cn'] ?></td>
|
||||
<td><?= $v['remark'] ?></td>
|
||||
<td><?= date('Y-m-d H:i',$v['c_time']) ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
lists: [],
|
||||
params: <?=json_encode($params,JSON_UNESCAPED_UNICODE)?>,
|
||||
type_arr : <?=json_encode($type_arr,JSON_UNESCAPED_UNICODE)?>,
|
||||
},
|
||||
mounted() {
|
||||
var that = this;
|
||||
that.lists = <?=json_encode($lists,JSON_UNESCAPED_UNICODE)?>;
|
||||
},
|
||||
created: function () {
|
||||
},
|
||||
methods: {}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,22 @@
|
||||
<form class="am-form am-form-horizontal" action="/app/liche/member/get_freeze" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">总积分:</label>
|
||||
<div class="am-para-input">
|
||||
<span class="f12 lh-default ml5 text-danger"><?=$user['credits']+$user['freeze_credits']?></span>
|
||||
(<span class="f12 clr999 lh-default ml5 text-danger">可用积分:<?=$user['credits']?>,冻结:<?=$user['freeze_credits']?></span>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">积分:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="输入积分" name="credits" style="width: 150px; display: inline;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<input name="uid" value="<?=$uid?>" type="hidden">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="submit">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -24,13 +24,15 @@
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>用户名称</span></th>
|
||||
<th width="20%"><span>手机号码</span></th>
|
||||
<th width="5%"><span>是否分销</span></th>
|
||||
<th width="5%"><span>分销管理</span></th>
|
||||
<th width="20%"><span>创建时间</span></th>
|
||||
<th>操作</th>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="15%"><span>用户名称</span></th>
|
||||
<th width="15%"><span>手机号码</span></th>
|
||||
<th width="10%"><span>剩余积分</span></th>
|
||||
<th width="10%"><span>冻结积分</span></th>
|
||||
<th width="8%"><span>是否分销</span></th>
|
||||
<th width="8%"><span>分销管理</span></th>
|
||||
<th width="10%"><span>积分过期时间</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -39,14 +41,31 @@
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['nickname'] ?></td>
|
||||
<td><?= $v['mobile'] ?></td>
|
||||
<td><?= $v['credits'] ?></td>
|
||||
<td><?= $v['freeze_credits'] ?></td>
|
||||
<td>
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" <?=$v['dealer']&&!$v['up_uid']?'checked':''?> onchange="set_publish(this,<?=$v['id']?>)"/>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" <?=$v['manage']?'checked':''?> onchange="set_publish(this,<?=$v['id']?>,'manage')"/>
|
||||
</td>
|
||||
<td><?= $v['expire_time'] ? date('Y-m-d H:i',$v['expire_time']) : '' ?></td>
|
||||
<td><?= date('Y-m-d H:i:s',$v['c_time']) ?></td>
|
||||
<td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" class="align-r">
|
||||
<a class="am-btn am-btn-primary am-btn-xs" data-modal="/app/liche/member/add_items?uid=<?=$v['id']?>" data-title="兑换商品">
|
||||
兑换商品
|
||||
</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs" data-modal="/app/liche/member/add_credit?uid=<?=$v['id']?>" data-title="增加减少积分">
|
||||
增加积分
|
||||
</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs" data-modal="/app/liche/member/get_freeze?uid=<?=$v['id']?>" data-title="解冻积分">
|
||||
解冻积分
|
||||
</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs" data-open="/app/liche/member/get_credit_log?uid=<?=$v['id']?>">
|
||||
积分日志
|
||||
</a>
|
||||
<?if($v['umajia']){?>
|
||||
<a class="am-btn am-btn-primary am-btn-xs" data-open="/app/appusual/umajia/get?uid=<?=$v['id']?>&app_id=<?=$app_id?>" data-title="编辑马甲">编辑马甲</a>
|
||||
<a href="javascript:void(0)" data-ajax="post" data-action="/app/appusual/umajia/del?app_id=<?=$app_id?>"
|
||||
@@ -56,12 +75,6 @@
|
||||
<?}?>
|
||||
</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td colspan="3" class="align-r">
|
||||
</td>
|
||||
</tr>
|
||||
-->
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<input type="hidden" name="id" value="<?= $row['id'] ?>"/>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">姓名:</label>
|
||||
<div class="am-para-input w300">
|
||||
<label class="am-para-label w120">姓名:</label>
|
||||
<div class="am-para-input w300" style="margin-left: 130px">
|
||||
<input type="text" placeholder="输入姓名" name="uname" v-model="info.uname" maxlength="30"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">手机号:</label>
|
||||
<div class="am-para-input w300">
|
||||
<label class="am-para-label w120">手机号:</label>
|
||||
<div class="am-para-input w300" style="margin-left: 130px">
|
||||
<input type="text" placeholder="输入手机号" name="mobile" v-model="info.mobile" maxlength="30"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">角色:</label>
|
||||
<div class="am-para-input w100">
|
||||
<label class="am-para-label w120">默认角色:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select name="group_id" v-model="info.group_id" @change="resetBiz">
|
||||
<option value="">选择角色</option>
|
||||
<option :value="i" v-for="(v,i) in groups">{{v}}</option>
|
||||
@@ -23,8 +23,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.group_id==4">
|
||||
<label class="am-para-label">所在城市:</label>
|
||||
<div class="am-para-input w100">
|
||||
<label class="am-para-label w120">默认角色城市:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select v-model="info.city_id">
|
||||
<option value="0">选择城市</option>
|
||||
<option :value="v.city_id" v-for="(v,i) in show_info.cityList">{{v.name}}</option>
|
||||
@@ -32,8 +32,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">门店:</label>
|
||||
<div class="am-para-inline lh-default">
|
||||
<label class="am-para-label w120">默认角色门店:</label>
|
||||
<div class="am-para-input lh-default" style="margin-left: 130px">
|
||||
<button class="am-btn am-btn-default" type="button" @click="brandModal">选择门店</button>
|
||||
<div class="mt5">
|
||||
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal"
|
||||
@@ -43,6 +43,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w120">第二角色:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select name="group_id1" v-model="info.group_id1" @change="resetBiz1">
|
||||
<option value="0">选择角色</option>
|
||||
<option :value="i" v-for="(v,i) in groups">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" v-if="info.group_id1==4">
|
||||
<label class="am-para-label w120">第二角色城市:</label>
|
||||
<div class="am-para-input w100" style="margin-left: 130px">
|
||||
<select v-model="info.city_id1">
|
||||
<option value="0">选择城市</option>
|
||||
<option :value="v.city_id" v-for="(v,i) in show_info.cityList">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w120">第二角色门店:</label>
|
||||
<div class="am-para-input lh-default" style="margin-left: 130px">
|
||||
<button class="am-btn am-btn-default" type="button" @click="brandModal1">选择门店</button>
|
||||
<div class="mt5">
|
||||
<button class="am-btn am-btn-default mr5" type="button" @click="brandModal1"
|
||||
v-for="(item) in selectedBrands1">{{item.name}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-success" type="button" @click='saveEdit'>提交</button>
|
||||
@@ -69,6 +99,14 @@
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="类型" v-model="search_info.type">
|
||||
<option value="0">类型</option>
|
||||
<template v-for="(v,i) in show_info.typeAry">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<a class="am-btn am-btn-success am-btn-sm w100" @click="search()">搜索</a>
|
||||
</div>
|
||||
@@ -126,6 +164,96 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="brand-modal1" style="display:none">
|
||||
<div class="modal-body">
|
||||
<div class="header">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="城市" v-model="search_info.city_id1">
|
||||
<option value="0">城市</option>
|
||||
<template v-for="(v,i) in cityAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="行政区" v-model="search_info.county_id1">
|
||||
<option value="0">行政区</option>
|
||||
<template v-for="(v,i) in countyAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="类型" v-model="search_info.type1">
|
||||
<option value="0">类型</option>
|
||||
<template v-for="(v,i) in show_info.typeAry">
|
||||
<option :value="i">{{v}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<a class="am-btn am-btn-success am-btn-sm w100" @click="search1()">搜索</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-top: 10px;">
|
||||
<div class="vuetable-body-wrapper">
|
||||
<table class="vuetable table table-middle table-hover fixed">
|
||||
<colgroup>
|
||||
<col class="vuetable-col-title" style="width: 50%;">
|
||||
<col class="vuetable-col-actions text-right" style="width: 10%;">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="vuetable-th-slot-title">商家名</th>
|
||||
<th class="vuetable-th-slot-actions text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot></tfoot>
|
||||
<tbody class="vuetable-body">
|
||||
<tr v-for="(v,i) in brandsList1">
|
||||
<td class="vuetable-slot">
|
||||
{{v.name}}
|
||||
</td>
|
||||
<td class="vuetable-slot text-right">
|
||||
<button type='button' v-if="v.is_checked==0 || !v.is_checked"
|
||||
class="btn btn-sm btn-success"
|
||||
@click="addItem1(i)">添加
|
||||
</button>
|
||||
<button type='button' v-if="v.is_checked==1" class="btn btn-sm btn-danger"
|
||||
@click="removeItem1(v)">删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<span class="pull-left text-muted">第{{brandsPage.page}}页(每页{{brandsPage.pageLimit}}条,共{{brandsPage.pageCount}}条)</span>
|
||||
<nav class="pull-right" aria-label="Page navigation">
|
||||
<ul class="pagination pagination-sm">
|
||||
<li>
|
||||
<a href="javascript:void(0);" @click="beforeShopPage1();" aria-label="上一页">
|
||||
<span class="glyphicon glyphicon-menu-left"></span>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="brandsPage.hasNext">
|
||||
<a href="javascript:void(0);" @click="afterShopPage1();" aria-label="下一页">
|
||||
<span class="glyphicon glyphicon-menu-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
var vue_app;
|
||||
@@ -141,11 +269,13 @@
|
||||
brandsPage: [],
|
||||
bizIds: [],
|
||||
brandsList: [],
|
||||
brandsList1: [],
|
||||
selectedBrands: [],
|
||||
selectedBrands1: [],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
show_info: {cityList: []},
|
||||
search_info: {city_id: 0, county_id: 0}
|
||||
show_info: {cityList: [], typeAry: []},
|
||||
search_info: {city_id: 0, county_id: 0, type: 0, city_id1: 0, county_id1: 0, type1: 0}
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
@@ -157,6 +287,7 @@
|
||||
vm.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.groups = <?=json_encode($groups, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.selectedBrands = <?=json_encode($selectedBrands, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.selectedBrands1 = <?=json_encode($selectedBrands1, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.show_info = <?=json_encode($show_info, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.init_citys();
|
||||
},
|
||||
@@ -164,6 +295,9 @@
|
||||
resetBiz: function () {
|
||||
this.selectedBrands = [];
|
||||
},
|
||||
resetBiz1: function () {
|
||||
this.selectedBrands1 = [];
|
||||
},
|
||||
search: function () {
|
||||
this.changePage(1);
|
||||
},
|
||||
@@ -246,8 +380,10 @@
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: that.brandsThPage,
|
||||
type: that.search_info.type,
|
||||
city_id: that.search_info.city_id,
|
||||
county_id: that.search_info.county_id
|
||||
county_id: that.search_info.county_id,
|
||||
types:'1,2,3',
|
||||
},
|
||||
success: function (json) {
|
||||
var brandsList = json.data.shopList;
|
||||
@@ -268,6 +404,113 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//group_id1
|
||||
search1: function () {
|
||||
this.changePage1(1);
|
||||
},
|
||||
changePage1: function (page) {
|
||||
var that = this;
|
||||
that.brandsThPage = page;
|
||||
return this.brandModal1();
|
||||
},
|
||||
beforeShopPage1: function () {
|
||||
var vm = this;
|
||||
if (vm.brandsThPage == 1) {
|
||||
alert('已经是第一页了');
|
||||
return;
|
||||
}
|
||||
vm.brandsThPage--;
|
||||
return this.brandModal1();
|
||||
},
|
||||
afterShopPage1: function () {
|
||||
var vm = this;
|
||||
vm.brandsThPage++;
|
||||
return this.brandModal1();
|
||||
},
|
||||
addItem1: function (index) {
|
||||
var vm = this;
|
||||
var brand_id;
|
||||
var biz_id;
|
||||
biz_id = vm.brandsList1[index]['id'];
|
||||
var _shop = {
|
||||
biz_id: biz_id,
|
||||
name: vm.brandsList1[index]['name'],
|
||||
};
|
||||
if (vm.info.group_id1 == 4) {
|
||||
vm.selectedBrands1.push(_shop);
|
||||
vm.brandsList1[index]['is_checked'] = 1;
|
||||
} else {
|
||||
vm.selectedBrands1 = [];
|
||||
vm.selectedBrands1.push(_shop);
|
||||
this.brandsList1.map(function (_item, _index) {
|
||||
if (vm.brandsList1[index]['id'] == _item['id']) {
|
||||
vm.brandsList1[_index]['is_checked'] = 1;
|
||||
} else {
|
||||
vm.brandsList1[_index]['is_checked'] = 0;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
removeItem1: function (item) {
|
||||
var vm = this;
|
||||
if (vm.info.group_id1 == 4) {
|
||||
this.selectedBrands1 = this.selectedBrands1.filter(function (_item) {
|
||||
var id = _item.biz_id > 0 ? _item.biz_id : _item.brand_id;
|
||||
return id != item.id;
|
||||
})
|
||||
} else {
|
||||
vm.selectedBrands1 = [];
|
||||
}
|
||||
this.brandsList1.map(function (_item, _index) {
|
||||
if (item.id == _item.id) {
|
||||
vm.brandsList1[_index].is_checked = 0;
|
||||
}
|
||||
})
|
||||
},
|
||||
brandModal1: function () {
|
||||
var that = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['55%', '80%'], //宽高
|
||||
content: $('#brand-modal1'),
|
||||
title: '选择商家',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/common/shop_app',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: that.brandsThPage,
|
||||
type: that.search_info.type1,
|
||||
city_id: that.search_info.city_id1,
|
||||
county_id: that.search_info.county_id1,
|
||||
types:'1,2,3',
|
||||
},
|
||||
success: function (json) {
|
||||
var brandsList1 = json.data.shopList;
|
||||
that.brandsPage = json.data.shopPage;
|
||||
brandsList1.map(function (_item, _index) {
|
||||
for (var index in that.selectedBrands1) {
|
||||
var item = that.selectedBrands1[index];
|
||||
var id = that.sys_type_id == 1 ? item.brand_id : item.biz_id;
|
||||
if (id == _item.id) {
|
||||
brandsList1[_index].is_checked = 1;
|
||||
break;
|
||||
} else {
|
||||
brandsList1[_index].is_checked = 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
that.brandsList1 = brandsList1;
|
||||
}
|
||||
});
|
||||
},
|
||||
init_citys: function () {
|
||||
var vm = this;
|
||||
$.get('common/area', {id: '350', key: 'city', type: 1}, function (response) {
|
||||
@@ -290,6 +533,7 @@
|
||||
|
||||
var vm = this;
|
||||
vm.info.bizs = vm.selectedBrands;
|
||||
vm.info.bizs1 = vm.selectedBrands1;
|
||||
loading = true;
|
||||
$.ajax({
|
||||
url: '<?=$action?>',
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<input type="text" name="mobile" value="<?= $mobile ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w100">角色:</label>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">默认角色:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="group_id">
|
||||
<option value="">全部</option>
|
||||
@@ -26,8 +26,18 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label w100">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status">
|
||||
<option value="">全部</option>
|
||||
<option value="1" <?= 1 == $params['status'] ? 'selected' : '' ?>>正常</option>
|
||||
<option value="0" <?= strlen($params['status']) && 0 == $params['status'] ? 'selected' : '' ?>>禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店:</label>
|
||||
<label class="am-para-label w100">默认门店:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select title="城市" name="city_id" v-model="params.city_id">
|
||||
<option value="">城市</option>
|
||||
@@ -65,8 +75,10 @@
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>姓名</span></th>
|
||||
<th width="20%"><span>手机号码</span></th>
|
||||
<th width="20%"><span>角色</span></th>
|
||||
<th width="20%"><span>门店</span></th>
|
||||
<th width="20%"><span>默认角色</span></th>
|
||||
<th width="20%"><span>默认门店</span></th>
|
||||
<th width="20%"><span>第二角色</span></th>
|
||||
<th width="20%"><span>第二角色门店</span></th>
|
||||
<th width="20%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -78,16 +90,18 @@
|
||||
<td><?= $v['mobile'] ?></td>
|
||||
<td><?= $v['group_name'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['group_name1'] ?></td>
|
||||
<td><?= $v['biz_name1'] ?></td>
|
||||
<td><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="align-r">
|
||||
<td colspan="8" class="align-r">
|
||||
<input type="hidden" class="id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".id-<?= $v['id'] ?>"
|
||||
data-action="/app/licheb/member/batch" data-field=""
|
||||
style="height: 30px;width: 70px;">
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>下架</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>上架</option>
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>禁用</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>正常</option>
|
||||
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
|
||||
</select>
|
||||
<a data-open="/app/licheb/member/get?id=<?= $v['id'] ?>"
|
||||
|
||||
@@ -55,15 +55,13 @@
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="cover"><i class="am-icon-cloud-upload"></i> 上传封面
|
||||
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.info.img">
|
||||
<i class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
|
||||
<input type="hidden" name="cover" id="cover_id"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
value="<?= $info['img'] ?>" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
src="<?= $info['img_url'] ?>"/>
|
||||
:src="vue_obj.info.img.src"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,7 +87,7 @@
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分享描述:</label>
|
||||
<div class="am-para-input" style="width: 80%">
|
||||
<input type="text" v-model="info.share_title">
|
||||
<input type="text" v-model="info.share_desc">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
@@ -97,15 +95,12 @@
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-group am-form-file">
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="share_img"><i class="am-icon-cloud-upload"></i> 上传封面
|
||||
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.info.share_img">
|
||||
<i class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<span class="f12 clr999 lh-default ml5">建议尺寸宽度690</span>
|
||||
<input type="hidden" name="share_img" id="share_img_id"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
value="<?= $info['share_img'] ?>" class="layui-input">
|
||||
<img data-tips-image style="height:auto;max-height:32px;min-width:32px"
|
||||
src="<?= $info['share_img_url'] ?>"/>
|
||||
:src="vue_obj.info.share_img.src"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -132,28 +127,29 @@
|
||||
<th class="text-center">图片</th>
|
||||
<th class="text-center">标题</th>
|
||||
<th class="text-center">排序</th>
|
||||
<th class="text-center">链接</th>
|
||||
<th class="text-center">价格</th>
|
||||
<th class="text-right">
|
||||
<a href="javascript:" style="margin-top: 2px;" class="btn btn-primary btn-sm"
|
||||
<a href="javascript:" style="margin-top: 2px;"
|
||||
class="btn btn-primary btn-sm"
|
||||
@click='adModal()'>添加</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(item,index) in ad_list">
|
||||
<template v-for="(item,index) in prizes_list">
|
||||
<tr>
|
||||
<td><img data-tips-image :src="item.img_url"></td>
|
||||
<td><img data-tips-image :src="item.img_src"></td>
|
||||
<td class="text-center">{{item.title}}</td>
|
||||
<td class="text-center">
|
||||
<div :id="'group_name_txt_'+index">{{item.order_view}} <a href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
class="fa fa-edit"></i></a></div>
|
||||
<div :id="'group_name_txt_'+index">{{item.order_view}} <a
|
||||
href="javascript:"
|
||||
@click="showGroupEditForm(index)"><i
|
||||
class="fa fa-edit"></i></a></div>
|
||||
<input :id="'group_name_'+index" @blur="editGroupName(index,item.id)"
|
||||
style="display: none;" type="number" class="form-control"
|
||||
v-model="item.order_view" placeholder="请输入排序值">
|
||||
</td>
|
||||
<td class="text-center" v-if="item.jump_type==1">报名弹窗</td>
|
||||
<td class="text-center" v-else>{{item.link}}</td>
|
||||
<td class="text-center">{{item.price}}</td>
|
||||
<td class="text-right">
|
||||
<a href="javascript:void(0);" style="margin-top:2px;"
|
||||
class="btn btn-default btn-sm" @click='adModal(item)'>编辑</a>
|
||||
@@ -164,7 +160,7 @@
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<template v-if="ad_list.length <=0">
|
||||
<template v-if="prizes_list.length <=0">
|
||||
<div style="text-align: center;">无数据</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -173,7 +169,7 @@
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">标题</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="ad_item.title"
|
||||
<input type="text" class="form-control" v-model="prizes_item.title"
|
||||
placeholder="请输入标题">
|
||||
</div>
|
||||
</div>
|
||||
@@ -181,23 +177,31 @@
|
||||
<label class="col-sm-2 control-label">图片</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group" style="width: 100%">
|
||||
<input type="text" style="width: 60%" name="ad_img" id="ad_img"
|
||||
onchange="$(this).next('img').attr('src', $(this).data('srcs') || this.value)"
|
||||
<input :value="vue_obj.prizes_img.value" type="text"
|
||||
style="width: 60%;margin-right: 5px;"
|
||||
class="form-control">
|
||||
<img data-tips-image name="ad_img_url" id="ad_img_url"
|
||||
style="height:auto;max-height:31px;min-width:31px;margin-left: 5px;margin-right: 5px;"
|
||||
/>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm"
|
||||
data-file="1" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-field="ad_img">上传图片
|
||||
data-file="1" data-mark="" data-type="jpg,png,gif,png,jpeg"
|
||||
data-uptype="qiniu" data-params-source="vue_obj.prizes_img">
|
||||
<i class="am-icon-cloud-upload"></i> 上传图片
|
||||
</button>
|
||||
<img data-tips-image
|
||||
style="height:auto;max-height:32px;min-width:32px;margin-left: 5px;"
|
||||
:src="vue_obj.prizes_img.src"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">价格</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" v-model="prizes_item.price"
|
||||
placeholder="请输入价格">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-left: 0px;margin-right: 0px;">
|
||||
<label class="col-sm-2 control-label">排序值</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="number" class="form-control" v-model="ad_item.order_view"
|
||||
<input type="number" class="form-control" v-model="prizes_item.order_view"
|
||||
placeholder="请输入排序">
|
||||
</div>
|
||||
<div style="padding-top:7px;">
|
||||
@@ -243,13 +247,15 @@
|
||||
data: {
|
||||
info: {},
|
||||
status_list: [],
|
||||
ad_list: [],
|
||||
ad_item: {},
|
||||
prizes_list: [],
|
||||
prizes_item: {},
|
||||
prizes_img: {value: '', src: ''},
|
||||
},
|
||||
mounted() {
|
||||
var that = this;
|
||||
that.info = <?=json_encode($info)?>;
|
||||
that.status_list = <?=json_encode($status_list)?>;
|
||||
that.prizes_list = <?=json_encode($prizes_list)?>;
|
||||
},
|
||||
computed: {},
|
||||
created: function () {
|
||||
@@ -270,7 +276,7 @@
|
||||
layer.msg("排序值不能为空!", {icon: 2});
|
||||
return false;
|
||||
}
|
||||
this.ad_list.sort(function (a, b) {
|
||||
this.prizes_list.sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
});
|
||||
$("#group_name_" + index).hide();
|
||||
@@ -279,52 +285,46 @@
|
||||
adModal: function (item) {
|
||||
var that = this;
|
||||
var _title = '新增广告';
|
||||
that.ad_item = {};
|
||||
var _img = '';
|
||||
var _img_url = '';
|
||||
that.prizes_item = {};
|
||||
if (item) {
|
||||
that.ad_item = item;
|
||||
that.prizes_item = item;
|
||||
_title = '编辑广告';
|
||||
_img = item.img;
|
||||
_img_url = item.img_url;
|
||||
that.prizes_img = {value: item.img_value, src: item.img_src};
|
||||
} else {
|
||||
that.ad_item = {"order_view": 50, "jump_type": 0};
|
||||
that.prizes_item = {"order_view": 50};
|
||||
that.prizes_img = {value: '', src: ''};
|
||||
}
|
||||
$('#ad_img').val(_img);
|
||||
$("#ad_img_url").attr('src', _img_url);
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['50%', '38%'], //宽高
|
||||
area: ['50%'], //宽高
|
||||
content: $('#ad-modal'),
|
||||
title: _title,
|
||||
shade: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
_img = $('#ad_img').val();
|
||||
_img_url = $("#ad_img_url")[0].src;
|
||||
if (!item) {
|
||||
that.ad_list.push({
|
||||
title: that.ad_item.title,
|
||||
img: _img,
|
||||
img_url: _img_url,
|
||||
link: that.ad_item.link,
|
||||
order_view: that.ad_item.order_view,
|
||||
jump_type: that.ad_item.jump_type
|
||||
let timestamp = Date.parse(new Date());
|
||||
let rand = parseInt(Math.random() * 1000);
|
||||
let id = timestamp + rand;
|
||||
that.prizes_list.push({
|
||||
id: id,
|
||||
title: that.prizes_item.title,
|
||||
img_value: that.prizes_img.value,
|
||||
img_src: that.prizes_img.src,
|
||||
price: that.prizes_item.price,
|
||||
order_view: that.prizes_item.order_view
|
||||
});
|
||||
} else {
|
||||
item.img = _img;
|
||||
item.img_url = _img_url;
|
||||
}
|
||||
that.ad_list.sort(function (a, b) {
|
||||
that.prizes_list.sort(function (a, b) {
|
||||
return b.order_view - a.order_view;
|
||||
})
|
||||
});
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
},
|
||||
removeAd: function (index) {
|
||||
var vm = this;
|
||||
vm.ad_list.splice(index, 1);
|
||||
vm.prizes_list.splice(index, 1);
|
||||
},
|
||||
editType: function (index) {
|
||||
var vm = this;
|
||||
@@ -348,15 +348,14 @@
|
||||
},
|
||||
saveEdit: function () {
|
||||
var vm = this;
|
||||
vm.info.img = $('#cover_id').val();
|
||||
vm.info.time = $('#time_id').val();
|
||||
vm.info.share_img = $('#share_img_id').val();
|
||||
vm.info.prizes_list = vm.prizes_list;
|
||||
$.ajax({
|
||||
url: vm.info.edit_url,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
info: vm.info
|
||||
info: vm.info,
|
||||
},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
@@ -387,7 +386,7 @@
|
||||
saveStatus: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
url: '/app/licheb/sytactivity/edit_status',
|
||||
url: '/app/licheb/sytlive/edit_status',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
@@ -420,11 +419,6 @@
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">
|
||||
|
||||
.label-width {
|
||||
width: 150px
|
||||
}
|
||||
|
||||
.my-ul ul li {
|
||||
padding: 10px;
|
||||
}
|
||||
@@ -435,64 +429,10 @@
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.auto-content {
|
||||
width: min-content;
|
||||
min-width: 50%;
|
||||
}
|
||||
|
||||
.btn-group .disabled {
|
||||
background-color: #eee;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.photo-upload {
|
||||
position: relative;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.photo-upload:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.photo-upload-item {
|
||||
position: relative;
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
font-size: 12px; /*display:inline-block;width:120px;*/
|
||||
}
|
||||
|
||||
.photo-upload-item > img {
|
||||
}
|
||||
|
||||
.photo-upload-item-check,
|
||||
.photo-upload-item-remove {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
border: 1px solid #fff;
|
||||
background-color: #eee;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.photo-upload-item:hover .photo-upload-item-remove {
|
||||
opacity: 1;
|
||||
transition: all .4s ease
|
||||
}
|
||||
|
||||
.photo-upload-item-check {
|
||||
opacity: 1;
|
||||
background-color: #36f;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/font-awesome.min.css?v=1581252500">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/appitem/AdminLTE.min.css?v=1581252500">
|
||||
|
||||
@@ -48,12 +48,12 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="align-r">
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/receiver/customer?cfrom_id=35&t_id=<?= $v['id'] ?>">报名</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/app/licheb/sytbiz/lists?a_id=<?= $v['id'] ?>">门店</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-open="/app/licheb/sytbiz/get_achievement?a_id=<?= $v['id'] ?>">业绩报告</a>
|
||||
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
|
||||
<!-- data-open="/receiver/customer?cfrom_id=35&t_id=--><?//= $v['id'] ?><!--">报名</a>-->
|
||||
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
|
||||
<!-- data-open="/app/licheb/sytbiz/lists?a_id=--><?//= $v['id'] ?><!--">门店</a>-->
|
||||
<!-- <a class="am-btn am-btn-primary am-btn-xs"-->
|
||||
<!-- data-open="/app/licheb/sytbiz/get_achievement?a_id=--><?//= $v['id'] ?><!--">业绩报告</a>-->
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-modal="/common/share_qrcode?url=<?= $v['url'] ?>"
|
||||
data-title="分享二维码">分享二维码</a>
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
<tr>
|
||||
<? foreach ($menus as $key => $value) { ?>
|
||||
<td class="my-panel text-center">
|
||||
<?= $value['title'] ?><br><?= $value['value'] ?><?= $value['tag'] ?>
|
||||
<strong><?= $value['title'] ?></strong><br>
|
||||
<? if ($value['note']) { ?>
|
||||
<?= $value['note'] ?>
|
||||
<? } else { ?>
|
||||
<?= $value['value'] ?><?= $value['tag'] ?>
|
||||
<? } ?>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
@@ -11,16 +16,10 @@
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="app/licheb/userslog">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">顾问名字:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="uname" placeholder="顾问名字关键字" v-model="params.uname"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">门店:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="类型" name="type" v-model="params.type">
|
||||
<select title="类型" name="type" v-model="params.type" @change="set_type">
|
||||
<option value="">选择类型</option>
|
||||
<option :value="i" v-for="(v,i) in typeAry">{{v}}</option>
|
||||
</select>
|
||||
@@ -54,7 +53,7 @@
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">日期:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w250">
|
||||
<div class="am-para-inline w200">
|
||||
<input id="id-time" name="time" type="text" value="<?= $params['time'] ?>"
|
||||
placeholder="开始时间 ~ 结束时间" autocomplete="off"/>
|
||||
</div>
|
||||
@@ -87,17 +86,16 @@
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="17%"><span>门店</span></th>
|
||||
<th width="10%"><span>顾问</span></th>
|
||||
<th width="20%"><span>客户数</span></th>
|
||||
<th width="13%"><span>进店人数/进店次数</span></th>
|
||||
<th width="20%"><span>门店</span></th>
|
||||
<th width="12%"><span>客户数</span></th>
|
||||
<th width="12%"><span>进店人数</span></th>
|
||||
<th width="12%"><span>订单数</span></th>
|
||||
<th width="9%"><span>试驾数</span></th>
|
||||
<th width="9%"><span>跟进数</span></th>
|
||||
<th width="9%"><span>订单数</span></th>
|
||||
<th width="9%"><span>战败数</span></th>
|
||||
<th width="9%"><span>开票数</span></th>
|
||||
<th width="9%"><span>新增企微</span></th>
|
||||
<th width="9%"><span>删除企微</span></th>
|
||||
<th width="9%"><span>企微数</span></th>
|
||||
<th width="9%"><span>改派数</span></th>
|
||||
<th width="9%"><span>接收数</span></th>
|
||||
<th width="10%"><span>日期</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -106,16 +104,15 @@
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['uname'] ?></td>
|
||||
<td><?= $v['customers'] ?></td>
|
||||
<td><?= $v['c_num'] ?>/<?= $v['a_num'] ?></td>
|
||||
<td><?= $v['t_num'] ?></td>
|
||||
<td><?= $v['follows'] ?></td>
|
||||
<td><?= $v['c_num'] ?></td>
|
||||
<td><?= $v['orders'] ?></td>
|
||||
<td><?= $v['t_num'] ?></td>
|
||||
<td><?= $v['defeats'] ?></td>
|
||||
<td><?= $v['bills'] ?></td>
|
||||
<td><?= $v['qy_adds'] ?></td>
|
||||
<td><?= $v['qy_dels'] ?></td>
|
||||
<td><?= $v['reassigns'] ?></td>
|
||||
<td><?= $v['receives'] ?></td>
|
||||
<td><?= $v['log_date'] ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
@@ -196,15 +193,18 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
set_type: function () {
|
||||
var that = this;
|
||||
that.params.city_id = '';
|
||||
},
|
||||
set_county: function () {
|
||||
var that = this;
|
||||
that.bizAry = [];
|
||||
that.params.biz_id = that.params.addr_id = '';
|
||||
that.params.biz_id = '';
|
||||
},
|
||||
reset: function () {
|
||||
var that = this;
|
||||
that.params.city_id = '';
|
||||
that.params.uname = '';
|
||||
that.params.type = '';
|
||||
$('#id-time').val('');
|
||||
}
|
||||
@@ -240,7 +240,7 @@
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.bizAry = [];
|
||||
that.params.biz_id = that.params.addr_id = '';
|
||||
that.params.biz_id = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
@@ -249,6 +249,7 @@
|
||||
data: {
|
||||
city_id: that.params.city_id,
|
||||
county_id: that.params.county_id,
|
||||
type: that.params.type,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;margin-bottom: 20px;">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<? foreach ($tabAry as $key => $val) { ?>
|
||||
<li role="presentation"
|
||||
class="<?= strlen($params['tab']) && $params['tab'] == $key ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/app/licheb/userslog/lists_users?tab=<?= $key ?>&biz_id=<?= $params['biz_id'] ?>&time=<?= $params['time'] ?>">
|
||||
<?= $val ?>
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<? foreach ($menus as $key => $value) { ?>
|
||||
<td class="my-panel text-center">
|
||||
<?= $value['title'] ?><br><?= $value['value'] ?><?= $value['tag'] ?>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="app/licheb/userslog/lists_users">
|
||||
<input type="hidden" name="tab" v-model="params.tab"/>
|
||||
<input type="hidden" name="biz_id" v-model="params.biz_id"/>
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">顾问名字:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="uname" placeholder="顾问名字关键字" v-model="params.uname"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">日期:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w200">
|
||||
<input id="id-time" name="time" type="text" value="<?= $params['time'] ?>"
|
||||
placeholder="开始时间 ~ 结束时间" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday"
|
||||
data-source="id-time">昨日</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks"
|
||||
data-source="id-time">本周</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month"
|
||||
data-source="id-time">本月</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml30">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" id="export" class="am-btn am-btn-success am-btn-sm w100">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fl"></div>
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>顾问</span></th>
|
||||
<th width="9%"><span>客户数</span></th>
|
||||
<th width="9%"><span>进店人数</span></th>
|
||||
<th width="9%"><span>订单数</span></th>
|
||||
<th width="9%"><span>试驾数</span></th>
|
||||
<th width="9%"><span>战败数</span></th>
|
||||
<th width="9%"><span>开票数</span></th>
|
||||
<th width="9%"><span>新增企微</span></th>
|
||||
<th width="9%"><span>删除企微</span></th>
|
||||
<th width="10%"><span>日期</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['uname'] ?></td>
|
||||
<td><?= $v['customers'] ?></td>
|
||||
<td><?= $v['c_num'] ?></td>
|
||||
<td><?= $v['orders'] ?></td>
|
||||
<td><?= $v['t_num'] ?></td>
|
||||
<td><?= $v['defeats'] ?></td>
|
||||
<td><?= $v['bills'] ?></td>
|
||||
<td><?= $v['qy_adds'] ?></td>
|
||||
<td><?= $v['qy_dels'] ?></td>
|
||||
<td><?= $v['log_date'] ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time', range: '~'
|
||||
});
|
||||
$('.id-day-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', nowDate = new Date();
|
||||
var source_id = $(this).data('source') || 'id-time';
|
||||
var beginDate = '';
|
||||
var endDate = '';
|
||||
switch (type) {
|
||||
case 'yesterday':
|
||||
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
break;
|
||||
case 'weeks':
|
||||
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
|
||||
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
|
||||
nowDate.setDate(nowDate.getDate() + 6);
|
||||
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
|
||||
break;
|
||||
case 'month':
|
||||
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
|
||||
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
|
||||
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
|
||||
break;
|
||||
}
|
||||
date = beginDate + ' ~ ' + endDate;
|
||||
$('#' + source_id).val(date);
|
||||
});
|
||||
});
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: {},
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
},
|
||||
methods: {
|
||||
reset: function () {
|
||||
var that = this;
|
||||
that.params.uname = '';
|
||||
$('#id-time').val('');
|
||||
}
|
||||
},
|
||||
watch: {}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
$('#export').click(function () {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var arr = href.split('?');
|
||||
href = '/app/licheb/userslog/export?' + arr[1];
|
||||
window.location.href = href;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.my-panel {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.my-panel span {
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,194 @@
|
||||
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;margin-bottom: 20px;">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<? foreach ($tabAry as $key => $val) { ?>
|
||||
<li role="presentation"
|
||||
class="<?= strlen($params['tab']) && $params['tab'] == $key ? 'active' : '' ?>">
|
||||
<a href="javascript:void (0);"
|
||||
data-open="/app/licheb/userslog/lists_users?tab=<?= $key ?>&biz_id=<?= $params['biz_id'] ?>&time=<?= $params['time'] ?>">
|
||||
<?= $val ?>
|
||||
</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<? foreach ($menus as $key => $value) { ?>
|
||||
<td class="my-panel text-center">
|
||||
<?= $value['title'] ?><br><?= $value['value'] ?><?= $value['tag'] ?>
|
||||
</td>
|
||||
<? } ?>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form id="vue-app" class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/app/licheb/userslog/lists_users">
|
||||
<input type="hidden" name="tab" v-model="params.tab"/>
|
||||
<input type="hidden" name="biz_id" v-model="params.biz_id"/>
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">顾问名字:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="uname" placeholder="顾问名字关键字" v-model="params.uname"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">日期:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w200">
|
||||
<input id="id-time" name="time" type="text" value="<?= $params['time'] ?>"
|
||||
placeholder="开始时间 ~ 结束时间" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday"
|
||||
data-source="id-time">昨日</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks"
|
||||
data-source="id-time">本周</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month"
|
||||
data-source="id-time">本月</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml30">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" id="export" class="am-btn am-btn-success am-btn-sm w100">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fl"></div>
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>顾问</span></th>
|
||||
<th width="10%"><span>计划跟进数</span></th>
|
||||
<th width="10%"><span>已跟进数</span></th>
|
||||
<th width="10%"><span>今日新增未跟进数</span></th>
|
||||
<th width="10%"><span>逾期未跟进数</span></th>
|
||||
<th width="10%"><span>日期</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['uname'] ?></td>
|
||||
<? if($v['follows'] > 0) {?>
|
||||
<td><a href="#/receiver/customer?vsid=<?= $v['id'] ?>&vdststus=0"><?= $v['follows'] ?></a></td>
|
||||
<?}else{?>
|
||||
<td><?= $v['follows'] ?></td>
|
||||
<?}?>
|
||||
|
||||
<? if($v['h_follows'] > 0) {?>
|
||||
<td><a href="#/receiver/customer?vsid=<?= $v['id'] ?>&vdststus=2"><?= $v['h_follows'] ?></a></td>
|
||||
<?}else{?>
|
||||
<td><?= $v['h_follows'] ?></td>
|
||||
<?}?>
|
||||
|
||||
<? if($v['t_follows'] > 0) {?>
|
||||
<td><a href="#/receiver/customer?vsid=<?= $v['id'] ?>&vdststus=1"><?= $v['t_follows'] ?></a></td>
|
||||
<?}else{?>
|
||||
<td><?= $v['t_follows'] ?></td>
|
||||
<?}?>
|
||||
|
||||
<? if($v['w_follows'] > 0) {?>
|
||||
<td><a href="#/receiver/customer?vsid=<?= $v['id'] ?>&vdststus=3"><?= $v['w_follows'] ?></a></td>
|
||||
<?}else{?>
|
||||
<td><?= $v['w_follows'] ?></td>
|
||||
<?}?>
|
||||
<td><?= $v['t_day'] ?></td>
|
||||
</tr>
|
||||
<? }
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time', range: '~'
|
||||
});
|
||||
$('.id-day-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', nowDate = new Date();
|
||||
var source_id = $(this).data('source') || 'id-time';
|
||||
var beginDate = '';
|
||||
var endDate = '';
|
||||
switch (type) {
|
||||
case 'yesterday':
|
||||
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
break;
|
||||
case 'weeks':
|
||||
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
|
||||
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
|
||||
nowDate.setDate(nowDate.getDate() + 6);
|
||||
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
|
||||
break;
|
||||
case 'month':
|
||||
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
|
||||
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
|
||||
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
|
||||
break;
|
||||
}
|
||||
date = beginDate + ' ~ ' + endDate;
|
||||
$('#' + source_id).val(date);
|
||||
});
|
||||
});
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: {},
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
},
|
||||
methods: {
|
||||
reset: function () {
|
||||
var that = this;
|
||||
that.params.uname = '';
|
||||
$('#id-time').val('');
|
||||
}
|
||||
},
|
||||
watch: {}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
$('#export').click(function () {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var arr = href.split('?');
|
||||
href = '/app/licheb/userslog/export?' + arr[1];
|
||||
window.location.href = href;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.my-panel {
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.my-panel span {
|
||||
font-size: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -48,17 +48,21 @@
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="3%"><span>id</span></th>
|
||||
<th width="15%"><span>模板名称</span></th>
|
||||
<th width="10%"><span>模板分类</span></th>
|
||||
<th width="25%"><span>适用品牌</span></th>
|
||||
<th width="50"></th>
|
||||
<th width="50"><span>id</span></th>
|
||||
<th width="17%"><span>模板名称</span></th>
|
||||
<th width="13%"><span>模板分类</span></th>
|
||||
<th width=""><span>适用品牌</span></th>
|
||||
<th width="7%"><span>状态</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="12%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td rowspan="2">
|
||||
<input type="checkbox" name="ids[]" class="biz-ids" value="<?= $v['id'] ?>"/>
|
||||
</td>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['type_name'] ?></td>
|
||||
@@ -79,6 +83,13 @@
|
||||
data-title="分享连接">分享链接</a>
|
||||
<a data-open="/app/material/template/get?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">查看详情</a>
|
||||
<input type="hidden" class="biz-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".biz-id-<?= $v['id'] ?>"
|
||||
data-action="/app/material/template/batch" data-field="" style="height: 30px;width: 70px;">
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>下架</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>上架</option>
|
||||
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -87,6 +98,19 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="hander am-form">
|
||||
<label class="checkall">
|
||||
<input type="checkbox" data-check-target=".biz-ids"> 全选</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select data-update-group="" data-list-target=".biz-ids" data-action="/app/material/template/batch"
|
||||
data-field="ifcheck">
|
||||
<option value="">批量操作</option>
|
||||
<option value="0">下架</option>
|
||||
<option value="1">上架</option>
|
||||
<option value="-1">删除</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
|
||||
@@ -59,6 +59,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<!--选装-->
|
||||
<div class="am-form-group" v-if="info.type==1">
|
||||
<label class="am-para-label">选装包:</label>
|
||||
<div class="am-para-input">
|
||||
|
||||
<label class="mr10" style="margin-top: 7px" v-for="(v,i) in options">
|
||||
<input type="checkbox" name="options[]" :value="v.id" v-model="info.options"> {{v.title}}(价格:{{v.price}})
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit()">保存</button>
|
||||
@@ -73,7 +83,8 @@
|
||||
info:[],
|
||||
brandAry:[],
|
||||
seryAry:[],
|
||||
type_arr:[]
|
||||
type_arr:[],
|
||||
options:[]
|
||||
},
|
||||
mounted: function () {
|
||||
this.info = <?=json_encode($info)?>;
|
||||
@@ -87,7 +98,7 @@
|
||||
url: '/auto/brand/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {status:1},
|
||||
data: {status:'>-1'},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
@@ -150,6 +161,17 @@
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
$.get("/auto/options/json_lists",{'brand_id':nv,'s_id':vm.info.s_id},function (res){
|
||||
vm.options = res.data.lists
|
||||
},'json');
|
||||
}
|
||||
},
|
||||
'info.s_id':function(nv, ov){
|
||||
var vm = this;
|
||||
if(nv > 0){
|
||||
$.get("/auto/options/json_lists",{'brand_id':vm.info.brand_id,'s_id':nv},function (res){
|
||||
vm.options = res.data.lists
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">标题:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="title" value="<?=$params['title'] ?>"/>
|
||||
<input type="text" name="title" value="<?= $params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">品牌:</label>
|
||||
<label class="am-para-label w100">品牌:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">请选择</option>
|
||||
@@ -25,11 +25,35 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">类型:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<select name="type" v-model="params.type">
|
||||
<option value="">请选择</option>
|
||||
<option v-for="(item,index) in type_arr" :value="index">
|
||||
{{item}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="-9">请选择</option>
|
||||
<option v-for="(item,index) in status_arr" :value="index">{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<label class="am-para-label w50"></label>
|
||||
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" data-title="新增车系" data-open="/auto/attr/get" class="am-btn am-btn-success w100">新增</button>
|
||||
<button type="button" data-title="新增车系" data-open="/auto/attr/get" class="am-btn am-btn-success w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
|
||||
共有<?= $pager['totle'] ?>条数据
|
||||
@@ -42,6 +66,7 @@
|
||||
<tr>
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>标题</span></th>
|
||||
<th width="10%"><span>品牌名称</span></th>
|
||||
<th width="10%"><span>车系名称</span></th>
|
||||
<th width="10%"><span>类型</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
@@ -54,13 +79,28 @@
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['brand_name'] ?></td>
|
||||
<td><?= $v['s_name'] ?></td>
|
||||
<td><?= $v['type_cn'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
<a href="javascript:void (0);" data-title="编辑车系" data-open="/auto/attr/get?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary"><?= '编辑' ?></a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] == 1) { ?>
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/attr/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
|
||||
<?php }
|
||||
elseif ($v['status'] == 0) { ?>
|
||||
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/attr/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/attr/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@@ -76,41 +116,46 @@
|
||||
<script>
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function(){
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
brandAry:[],
|
||||
seryAry:[]
|
||||
params: [],
|
||||
brandAry: [],
|
||||
seryAry: [],
|
||||
type_arr: [],
|
||||
status_arr: [],
|
||||
},
|
||||
mounted:function() {
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.type_arr = <?=json_encode($type_arr)?>;
|
||||
vm.status_arr = <?=json_encode($status_arr)?>;
|
||||
},
|
||||
methods:{},
|
||||
watch:{
|
||||
'params.brand_id':function(nv, ov){
|
||||
methods: {},
|
||||
watch: {
|
||||
'params.brand_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if(nv > 0){
|
||||
if (nv > 0) {
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id:nv},
|
||||
beforeSend: function () {},
|
||||
data: {brand_id: nv},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists){
|
||||
for (var i in lists) {
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if(vm.params.s_id>0 && undefined == seryAry[vm.params.s_id]){
|
||||
if (vm.params.s_id > 0 && undefined == seryAry[vm.params.s_id]) {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+250
@@ -0,0 +1,250 @@
|
||||
<style type="text/css">
|
||||
.seaction-hand-area {
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf {
|
||||
min-width: 100px;
|
||||
padding: 30px 0 0;
|
||||
float: left;
|
||||
margin-right: 50px;
|
||||
position: relative;
|
||||
border: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf .caption {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
background: #f2f2f2;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf .list {
|
||||
max-height: 438px;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf .list li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf .list li.active a {
|
||||
color: #fff;
|
||||
background: #3bb4f2
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf .list li a {
|
||||
display: block;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
color: #333
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-lf .list li a:hover {
|
||||
color: #fff;
|
||||
background: #3bb4f2
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-mid, .seaction-hand-area .sec-rt {
|
||||
padding: 30px 0 40px;
|
||||
margin-right: 50px;
|
||||
float: left;
|
||||
position: relative;
|
||||
border: 1px solid #e6e6e6;
|
||||
min-width: 250px
|
||||
}
|
||||
|
||||
.seaction-hand-area .sec-mid .caption, .seaction-hand-area .sec-rt .caption {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
background: #f2f2f2;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.check-hand-box {
|
||||
padding: 10px 0;
|
||||
min-height: 200px;
|
||||
max-height: 400px;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
.check-hand-box .item-cell {
|
||||
color: #333;
|
||||
padding: 3px 15px
|
||||
}
|
||||
|
||||
.check-hand-box .item-cell label {
|
||||
font-weight: 400
|
||||
}
|
||||
|
||||
.check-hand-btns {
|
||||
background: #f2f2f2;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
padding: 5px 15px
|
||||
}
|
||||
|
||||
.check-hand-btns .check-all {
|
||||
font-size: 14px;
|
||||
font-weight: 400
|
||||
}
|
||||
|
||||
.check-hand-btns .check-all input {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-top: -2px
|
||||
}
|
||||
</style>
|
||||
<!-- table 表格样式************************************* -->
|
||||
<div id="vue-app">
|
||||
<div class="seaction-hand-area clearfix">
|
||||
<div class="sec-lf">
|
||||
<p class="caption">门店类型</p>
|
||||
<ul class="list">
|
||||
<li :class="params.cate_id > 0 ? '': 'active'" @click="get_biz(0)">
|
||||
<a href="javascript:;">所有门店</a>
|
||||
</li>
|
||||
<li :class="params.cate_id == i ? 'active': ''" v-for="(v,i) in cate_lists" @click="get_biz(i)">
|
||||
<a href="javascript:;">{{v}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sec-mid clearfix">
|
||||
<p class="caption">未授权门店</p>
|
||||
<div class="check-hand-box" id="biz_lists">
|
||||
<div class="item-cell" v-for="(v,i) in biz_lists">
|
||||
<label><input type="checkbox" :value="i" class="biz-ids">{{v}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="check-hand-btns clearfix">
|
||||
<label class="check-all fl">
|
||||
<input type="checkbox" data-check-target=".biz-ids">全选
|
||||
</label>
|
||||
<button class="am-btn am-btn-primary am-btn-xs fr" id="add_biz" @click="add_biz">选择</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sec-rt">
|
||||
<p class="caption">已授权门店</p>
|
||||
|
||||
<div class="check-hand-box" id="hz_biz_lists">
|
||||
<div class="item-cell" v-for="(v,i) in brand_biz">
|
||||
<label><input type="checkbox" :value="i" data-type="remove" class="hz_biz_lists">{{v}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="check-hand-btns clearfix">
|
||||
<label class="check-all fl">
|
||||
<input type="checkbox" data-check-target=".hz_biz_lists">全选
|
||||
</label>
|
||||
<button class="am-btn am-btn-danger am-btn-xs fr" id="remove_biz" @click="remove_biz">移除</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form class="am-form am-form-horizontal ptb20 pr20" action="" data-auto="true" method="post">
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="add_input">
|
||||
|
||||
</div>
|
||||
<div class="remove_input">
|
||||
|
||||
</div>
|
||||
<div class="am-para-input">
|
||||
<a href="javascript:;" class="am-btn am-btn-secondary" type="button" id="edit-btn" @click="save">保存</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params:[],
|
||||
cate_lists:[],
|
||||
biz_lists:new Object(),
|
||||
brand_biz:new Object(),
|
||||
},
|
||||
mounted:function() {
|
||||
this.params = <?=json_encode($params,JSON_UNESCAPED_UNICODE)?>;
|
||||
this.cate_lists = <?=json_encode($cate_lists,JSON_UNESCAPED_UNICODE)?>;
|
||||
this.get_biz(this.params.cate_id)
|
||||
},
|
||||
methods:{
|
||||
get_biz(cate_id=0){
|
||||
var that = this
|
||||
this.params.cate_id=cate_id
|
||||
this.biz_lists = new Object()
|
||||
this.brand_biz = new Object()
|
||||
var params = {
|
||||
'id' : this.params.id,
|
||||
'type' : this.params.cate_id
|
||||
}
|
||||
$.get('/auto/brand/ajax_biz',params,function (res){
|
||||
if(res.data.biz_lists && res.data.biz_lists.length!=0){
|
||||
that.biz_lists = res.data.biz_lists
|
||||
}
|
||||
if(res.data.brand_biz && res.data.brand_biz.length!=0){
|
||||
that.brand_biz = res.data.brand_biz
|
||||
}
|
||||
},'json')
|
||||
},
|
||||
add_biz(){
|
||||
var that = this
|
||||
$(".biz-ids").each(function(){
|
||||
var check = $(this).is(':checked');
|
||||
var biz_name = $(this).parent().text();
|
||||
var biz_id = $(this).val();
|
||||
if(check){
|
||||
$(this).prop("checked",false);
|
||||
delete that.biz_lists[biz_id]
|
||||
that.brand_biz[biz_id] = biz_name
|
||||
}
|
||||
});
|
||||
this.$forceUpdate()
|
||||
},
|
||||
remove_biz(){
|
||||
var that = this
|
||||
$(".hz_biz_lists").each(function(){
|
||||
var check = $(this).is(':checked');
|
||||
var biz_name = $(this).parent().text();
|
||||
var biz_id = $(this).val();
|
||||
if(check){
|
||||
$(this).prop("checked",false);
|
||||
delete that.brand_biz[biz_id]
|
||||
that.biz_lists[biz_id] = biz_name
|
||||
}
|
||||
});
|
||||
this.$forceUpdate()
|
||||
},
|
||||
save(){
|
||||
var params = {
|
||||
'id' : this.params.id,
|
||||
'brand_biz' : this.brand_biz,
|
||||
'type' : this.params.cate_id
|
||||
}
|
||||
$.post('/auto/brand/edit_biz',params,function (result){
|
||||
if(result.code){
|
||||
layer.msg(result.msg, {time: 2000,icon:1 }, function () {
|
||||
// $.form.reload();
|
||||
});
|
||||
}else{
|
||||
layer.msg(result.msg,{icon:2});
|
||||
}
|
||||
},'json')
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,19 @@
|
||||
<input type="text" name="title" value="<?=$params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status">
|
||||
<option value="-9">请选择</option>
|
||||
<?foreach($status_arr as $key=>$val){?>
|
||||
<option value="<?=$key?>" <?=$key==$params['status']?'selected':''?>><?=$val?></option>
|
||||
<?}?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<label class="am-para-label w50"></label>
|
||||
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
@@ -25,6 +37,7 @@
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>品牌名称</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width="10%"><span>授权门店数</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
<th width="35%"><span>操作</span></th>
|
||||
</tr>
|
||||
@@ -35,18 +48,27 @@
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['name'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><?= $v['t_biz'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td>
|
||||
<a href="javascript:void (0);" data-title="编辑品牌" data-modal="/auto/brand/get?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary"><?= '编辑' ?></a> |
|
||||
<a href="javascript:void (0);" data-open="/auto/brand/get_biz?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary">授权门店</a>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
| <a href="javascript:void (0);" data-title="编辑品牌" data-modal="/auto/brand/get?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary"><?= '编辑' ?></a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] == 1) { ?>
|
||||
<a href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
|
||||
<?php } else { ?>
|
||||
<a style="color: red" href="javascript:void (0);" data-ajax="post"
|
||||
data-action="/auto/brand/del"
|
||||
<?php }
|
||||
elseif ($v['status'] == 0) { ?>
|
||||
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/brand/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<form id="vue-edit-business" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active" id="swzc">
|
||||
<div class="am-form-group wp50">
|
||||
<div class="am-form-group wp80">
|
||||
<label class="am-para-label">车型:</label>
|
||||
<div class="am-para-input" style="width: 100%;">
|
||||
<select name="brand_id" style="display: inline;width: 100px" v-model="info.brand_id">
|
||||
@@ -23,7 +23,7 @@
|
||||
<option value="">车系</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="v_id" style="display: inline;width: 100px" v-model="info.v_id">
|
||||
<select name="v_id" style="display: inline;width: 200px" v-model="info.v_id">
|
||||
<option value="">车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
@@ -65,14 +65,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">车辆底价:</label>
|
||||
<label class="am-para-label w120">展厅最低限价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入底价" name="price_fine" v-model="info.price_floor" style="display: inline;width: 60%"/>
|
||||
<input type="text" placeholder="请输入展厅最低限价" name="price_fine" v-model="info.price_floor" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50">
|
||||
<div class="am-form-group wp50" style="display: none">
|
||||
<label class="am-para-label">公司加价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入公司加价" name="price_fine" v-model="info.price_coplus" style="display: inline;width: 60%"/>
|
||||
@@ -102,31 +102,67 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="jszc">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">单车毛利:</label>
|
||||
<div class="am-form-group wp70">
|
||||
<label class="am-para-label w140">代理店结佣方式:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入单车毛利" name="profix_car" v-model="info.profix_car" style="display: inline;width: 60%"/>
|
||||
<input id="proxy_type0" name="proxy_type" type="radio" value="0" v-model="info.proxy_type"/><label for="proxy_type0">返佣 (优惠额度=售价-代理店最低限价)</label><br>
|
||||
<input id="proxy_type1" name="proxy_type" type="radio" value="1" v-model="info.proxy_type"/><label for="proxy_type1">票折 (优惠额度=售价-代理店结算价)</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50" v-if="info.proxy_type==1">
|
||||
<label class="am-para-label w140">代理店结算价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入代理店结算价" name="proxy_profix_price" v-model="info.proxy_profix_price" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">上牌毛利:</label>
|
||||
<div class="am-form-group wp50" v-if="info.proxy_type==0">
|
||||
<label class="am-para-label w140">代理店最低限价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入代理店最低限价" name="proxy_profix_lower" v-model="info.proxy_profix_lower" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50" v-if="info.proxy_type==0">
|
||||
<label class="am-para-label w140">代理店佣金:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入代理店佣金" name="proxy_profix_rebate" v-model="info.proxy_profix_rebate" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50" style="display: none">
|
||||
<label class="am-para-label w140">代理店单车毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入代理店单车毛利" name="proxy_profix_car" v-model="info.proxy_profix_car" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50" style="display: none">
|
||||
<label class="am-para-label w140">品牌店单车毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入品牌店单车毛利" name="profix_car" v-model="info.profix_car" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50" style="display: none">
|
||||
<label class="am-para-label w140">上牌毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入上牌毛利" name="profix_carno" v-model="info.profix_carno" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">保险毛利:</label>
|
||||
<div class="am-form-group wp50" style="display: none">
|
||||
<label class="am-para-label w140">保险毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入保险毛利" name="profix_insure" v-model="info.profix_insure" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">贷款毛利:</label>
|
||||
<div class="am-form-group wp50" style="display: none">
|
||||
<label class="am-para-label w140">按揭毛利:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="请输入贷款毛利" name="profix_loan" v-model="info.profix_loan" style="display: inline;width: 60%"/>
|
||||
<input type="text" placeholder="请输入按揭毛利" name="profix_loan" v-model="info.profix_loan" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,7 +182,7 @@
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
el: '#vue-edit-business',
|
||||
data: {
|
||||
info:{'brand_id':'','s_id':'','v_id':''},
|
||||
statusAry:[],
|
||||
@@ -224,7 +260,7 @@
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if(nv > 0){
|
||||
$.get('/auto/series/json_lists',{brand_id:nv},function (data) {
|
||||
$.get('/auto/series/json_lists',{brand_id:nv, status:1},function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
@@ -247,12 +283,12 @@
|
||||
var old_s_id = '<?=$info['s_id']?>';
|
||||
if (nv > 0) {
|
||||
//型号
|
||||
$.get('/auto/attr/json_lists',{s_id:nv,'status':1,'type':1},function (response) {
|
||||
$.get('/auto/attr/json_lists',{s_id:nv,'status':3,'type':1},function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
},'json');
|
||||
$.get('/auto/attr/json_lists',{s_id:nv,'status':1,'type':0},function (response) {
|
||||
$.get('/auto/attr/json_lists',{s_id:nv,'status':3,'type':0},function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.colorattrvAry = response.data.list;
|
||||
if(vm.colors){
|
||||
|
||||
@@ -72,6 +72,8 @@
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
<a class="am-btn am-btn-sm am-btn-success w100" data-modal="/auto/business/get" data-title="新增">新增</a>
|
||||
<button type="button" id="export" class="am-btn am-btn-success am-btn-sm w100">导出</button>
|
||||
<button type="button" id="import" class="am-btn am-btn-success am-btn-sm w100">导入</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -86,16 +88,22 @@
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="10%"><span>裸车报价</span></th>
|
||||
<th width="10%"><span>车辆底价</span></th>
|
||||
<th width="6%"><span>单车利润</span></th>
|
||||
<th width="6%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>贷款利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<th width="10%"><span>展厅最低限价</span></th>
|
||||
<th width="6%"><span>代理店单结佣方式</span></th>
|
||||
<th width="6%"><span>代理店结算价</span></th>
|
||||
<th width="6%"><span>代理店最低限价</span></th>
|
||||
<th width="6%"><span>代理店佣金</span></th>
|
||||
<!--
|
||||
<th width="6%"><span>代理店单车毛利</span></th>
|
||||
<th width="6%"><span>品牌店单车毛利</span></th>
|
||||
<th width="6%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>按揭利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<th width="10%"><span>公司加价</span></th>
|
||||
<th width="10%"><span>颜色加价</span></th>
|
||||
-->
|
||||
<th width="7%"><span>城市</span></th>
|
||||
<th width="7%"><span>交车时长</span></th>
|
||||
<th width="7%"><span>时间</span></th>
|
||||
<th width="10%"><span>生效时间</span></th>
|
||||
<th width="7%"><span>是否生效</span></th>
|
||||
@@ -105,7 +113,7 @@
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr class="tl">
|
||||
<td colspan="12">车型:<span style="font-weight: 600;color:#FF7F50;">{{v.title}}</span></td>
|
||||
<td colspan="13">车型:<span style="font-weight: 600;color:#FF7F50;">{{v.title}}</span></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td>
|
||||
@@ -114,15 +122,21 @@
|
||||
</td>
|
||||
<td>{{v.price_car}}</td>
|
||||
<td>{{v.price_floor}}</td>
|
||||
<td>{{v.proxy_type}}</td>
|
||||
<td>{{v.proxy_profix_price}}</td>
|
||||
<td>{{v.proxy_profix_lower}}</td>
|
||||
<td>{{v.proxy_profix_rebate}}</td>
|
||||
<!--
|
||||
<td>{{v.proxy_profix_car}}</td>
|
||||
<td>{{v.profix_car}}</td>
|
||||
<td>{{v.profix_insure}}</td>
|
||||
<td>{{v.profix_loan}}</td>
|
||||
<td>{{v.profix_carno}}</td>
|
||||
<!--
|
||||
<td>{{v.price_coplus}}</td>
|
||||
<td>{{v.price_color}}</td>
|
||||
-->
|
||||
<td>{{v.city_cn}}</td>
|
||||
<td>{{v.delivery_day}}</td>
|
||||
<td>{{v.month}}</td>
|
||||
<td>{{v.s_effect_time}}</td>
|
||||
<td>{{v.effect_status}}</td>
|
||||
@@ -162,6 +176,26 @@
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="cule-modal" style="display: none;padding: 10px">
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<h2><i class="fa fa-info-circle"></i> 请上传Excel文件</h2>
|
||||
<p>Excel文件格式必须与模板保持一致,否则无法导入</p>
|
||||
<div class="form-group-action">
|
||||
<a href="/temp/business.xlsx" target="_blank" class="btn btn-default">查看模板</a>
|
||||
<label href="javascript:" class="btn btn-primary" style="margin-left: 10px;">
|
||||
<form id="import-form">
|
||||
<input type="file" id="business-file" name="file" accept=".xls,.xlsx"
|
||||
style="left:-9999px;position:absolute;" onchange="load_business()">
|
||||
</form>
|
||||
<span>上传Excel文件</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
@@ -263,7 +297,7 @@
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id:nv},
|
||||
data: {brand_id:nv, status:1},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
@@ -298,7 +332,7 @@
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
status: 3,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
@@ -315,7 +349,67 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#export').click(function () {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var arr = href.split('?');
|
||||
href = '/auto/business/export?' + arr[1];
|
||||
window.location.href = href;
|
||||
});
|
||||
|
||||
$("#import").click(function () {
|
||||
$("#business-file").val('');
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['40%'], //宽高
|
||||
content: $('#cule-modal'),
|
||||
title: '导入线索',
|
||||
shade: false,
|
||||
btn: ['完成'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
|
||||
function load_business() {
|
||||
var file = $("#business-file");
|
||||
if (file.val() == '') {
|
||||
layer.msg('文件是空的');
|
||||
return 0;
|
||||
}
|
||||
var loading = layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
|
||||
var options = {
|
||||
url: "/auto/business/add_excel",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {},
|
||||
success: function (res) {
|
||||
if (1 == res.code) {
|
||||
layer.msg(res.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
file.val('');
|
||||
layer.close(loading);
|
||||
}
|
||||
};
|
||||
$("#import-form").ajaxSubmit(options);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">车辆底价:</label>
|
||||
<div class="am-para-input">
|
||||
@@ -13,7 +14,6 @@
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">定金:</label>
|
||||
<div class="am-para-input">
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="30%"><span>裸车报价</span></th>
|
||||
<th width="30%"><span>车辆底价</span></th>
|
||||
<!--
|
||||
<th width="30%"><span>车辆底价</span></th>
|
||||
<th width="7%"><span>定金</span></th>
|
||||
<th width="7%"><span>保险报价</span></th>
|
||||
<th width="7%"><span>精品报价</span></th>
|
||||
@@ -61,13 +61,13 @@
|
||||
<th width="9%"><span>一级分销佣金</span></th>
|
||||
<th width="9%"><span>二级分销佣金</span></th>
|
||||
-->
|
||||
<th width=""><span>操作</span></th>
|
||||
<th width="7%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr class="tl">
|
||||
<td colspan="4">车型:<span style="font-weight: 600;color:#FF7F50;">{{v.title}}</span></td>
|
||||
<td colspan="3">车型:<span style="font-weight: 600;color:#FF7F50;">{{v.title}}</span></td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td>
|
||||
@@ -76,8 +76,8 @@
|
||||
</td>
|
||||
<template v-if="1==v.edit">
|
||||
<td><input style="width: 100%" type="text" name="price_car" v-model="info_edit.price_car" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_floor" v-model="info_edit.price_floor" placeholder=""></td>
|
||||
<!--
|
||||
<td><input style="width: 100%" type="text" name="price_floor" v-model="info_edit.price_floor" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_book" v-model="info_edit.price_book" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_insure" v-model="info_edit.price_insure" placeholder=""></td>
|
||||
<td><input style="width: 100%" type="text" name="price_fine" v-model="info_edit.price_fine" placeholder=""></td>
|
||||
@@ -90,8 +90,8 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<td @dblclick="set_edit(i,1)">{{v.price_car}}</td>
|
||||
<td @dblclick="set_edit(i,1)">{{v.price_floor}}</td>
|
||||
<!--
|
||||
<td @dblclick="set_edit(i,1)">{{v.price_floor}}</td>
|
||||
<td @dblclick="set_edit(i,1)">{{v.price_book}}</td>
|
||||
<td @dblclick="set_edit(i,1)">{{v.price_insure}}</td>
|
||||
<td @dblclick="set_edit(i,1)">{{v.price_fine}}</td>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
methods:{
|
||||
init_auto:function(){
|
||||
var vm = this;
|
||||
$.get('common/auto',{type:1,tp:1},function(response){
|
||||
$.get('common/auto',{type:1,tp:1,status:3},function(response){
|
||||
if (response.code == 1) {
|
||||
vm.brand_arr = response.data;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<div class="am-form-group" style="display: none">
|
||||
<div class="am-para-inline w120">
|
||||
<select name="cor_id" v-model="params.cor_id">
|
||||
<option value="">车身颜色</option>
|
||||
@@ -148,7 +148,7 @@
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id:nv},
|
||||
data: {brand_id:nv, status:1},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
@@ -183,7 +183,7 @@
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
status: 3,
|
||||
type: 0
|
||||
},
|
||||
success: function (response) {
|
||||
@@ -199,7 +199,7 @@
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
status: 3,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
<colgroup>
|
||||
<col width="70%"/>
|
||||
<col width="10%"/>
|
||||
<col width="20%"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr v-for="(v,i) in seriesList">
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"><span>ID</span></th>
|
||||
<th width="25%"><span>车型</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
@@ -46,6 +47,7 @@
|
||||
<?php if ($lists) {
|
||||
foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
|
||||
Executable
+113
@@ -0,0 +1,113 @@
|
||||
<form id="vue-app-edit" class="am-form am-form-horizontal" action="" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">标题:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="输入标题" name="title" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">品牌车系:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="brand_id" v-model="info.brand_id" style="display: inline; width: 120px;">
|
||||
<option value="0">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="s_id" v-model="info.s_id" style="display: inline; width: 120px;">
|
||||
<option value="0">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">价格:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入价格" name="number" v-model="info.price">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">描述:</label>
|
||||
<div class="am-para-input">
|
||||
<textarea name="content" id="editor" v-model="info.descrip"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
require(['ckeditor'], function (ckeditor) {
|
||||
window.createEditor('[name="content"]');
|
||||
});
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-app-edit',
|
||||
data: {
|
||||
brandAry: [],
|
||||
info:[],
|
||||
seryAry: [],
|
||||
},
|
||||
mounted: function () {
|
||||
this.info = <?=json_encode($info,JSON_UNESCAPED_UNICODE)?>;
|
||||
this.brandAry = <?=json_encode($brandAry,JSON_UNESCAPED_UNICODE)?>;
|
||||
},
|
||||
methods: {
|
||||
saveEdit: function(){
|
||||
var action = '';
|
||||
this.info.descrip = CKEDITOR.instances.editor.getData();
|
||||
if(this.info.id){
|
||||
action = 'auto/options/edit'
|
||||
}else{
|
||||
action = 'auto/options/add'
|
||||
}
|
||||
$.post(action,this.info,function(result){
|
||||
if (result.code) {
|
||||
layer.msg(result.msg, {time: 2000, icon: 1}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {icon: 2});
|
||||
}
|
||||
},'json')
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'info.brand_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if (nv > 0) {
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id: nv},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists) {
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if (vm.info.s_id > 0 && undefined == seryAry[vm.info.s_id]) {
|
||||
vm.info.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
Executable
+158
@@ -0,0 +1,158 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class="form-search" onsubmit="return false" action="/auto/options/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">标题:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="title" value="<?= $params['title'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">品牌:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">车系:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="s_id" v-model="params.s_id">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<label class="am-para-label w50"></label>
|
||||
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" data-title="新增g " data-open="/auto/options/get" class="am-btn am-btn-success w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
|
||||
共有<?= $pager['totle'] ?>条数据
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10%"><span>ID</span></th>
|
||||
<th width="20%"><span>品牌</span></th>
|
||||
<th width="20%"><span>车系</span></th>
|
||||
<th width="20%"><span>标题</span></th>
|
||||
<th width="10%"><span>价格</span></th>
|
||||
<th width="10%"><span>状态</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
<th width="15%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['brand_cn'] ?></td>
|
||||
<td><?= $v['series_cn'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['price'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
<a href="javascript:void (0);" data-title="编辑车系" data-open="/auto/options/get?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary"><?= '编辑' ?></a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] == 1) { ?>
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/options/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
|
||||
<?php }
|
||||
elseif ($v['status'] == 0) { ?>
|
||||
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/options/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/attr/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: [],
|
||||
brandAry: [],
|
||||
seryAry: [],
|
||||
type_arr: [],
|
||||
status_arr: [],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.type_arr = <?=json_encode($type_arr)?>;
|
||||
vm.status_arr = <?=json_encode($status_arr)?>;
|
||||
},
|
||||
methods: {},
|
||||
watch: {
|
||||
'params.brand_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if (nv > 0) {
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id: nv},
|
||||
beforeSend: function () {
|
||||
},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists) {
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if (vm.params.s_id > 0 && undefined == seryAry[vm.params.s_id]) {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">品牌:</label>
|
||||
<label class="am-para-label w80">品牌:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">请选择</option>
|
||||
@@ -16,7 +16,17 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="-9">请选择</option>
|
||||
<option v-for="(item,index) in status_arr" :value="index">{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<label class="am-para-label w50"></label>
|
||||
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
@@ -48,16 +58,22 @@
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
<td>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
<a href="javascript:void (0);" data-title="编辑车系" data-modal="/auto/series/get?id=<?= $v['id'] ?>"
|
||||
class="am-text-primary"><?= '编辑' ?></a> |
|
||||
class="am-text-primary"><?= '编辑' ?></a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] == 1) { ?>
|
||||
<a href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
|
||||
<?php } else { ?>
|
||||
<a style="color: red" href="javascript:void (0);" data-ajax="post"
|
||||
data-action="/auto/series/del"
|
||||
<?php }
|
||||
elseif ($v['status'] == 0) { ?>
|
||||
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
|
||||
<?php } ?>
|
||||
<?php if ($v['status'] > -1) { ?>
|
||||
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/series/del"
|
||||
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@@ -78,19 +94,20 @@
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
brandAry:[]
|
||||
brandAry:[],
|
||||
status_arr: [],
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.status_arr = <?=json_encode($status_arr)?>;
|
||||
},
|
||||
methods:{},
|
||||
watch:{}
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">名称:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="名称" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">成本价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="成本价" v-model="info.price"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info : [],
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/biz/fine/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">名称:</label>
|
||||
<div class="am-para-inline">
|
||||
<input type="text" name="title" v-model="params.title"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button data-title="新增" type="button" data-modal="/biz/fine/get" class="am-btn am-btn-success am-btn-sm w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="20%"><span>名称</span></th>
|
||||
<th width="20%"><span>成本价</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td><?= $v['price'] ?></td>
|
||||
<td><?= $v['status_cn'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5" class="align-r">
|
||||
<a data-title="修改-<?=$v['title']?>" data-modal="/biz/fine/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
|
||||
<input type="hidden" class="fine-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".fine-id-<?= $v['id'] ?>"
|
||||
data-action="/biz/fine/batch" data-field="" style="height: 30px;width: 70px;">
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>禁用</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>正常</option>
|
||||
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: [],
|
||||
typeAry:<?=$typeAry ? json_encode($typeAry) : '[]'?>
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
watch: {
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,168 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/biz/seprice/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active">
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">房租:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="房租" v-model="info.money_json.rent">
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">水电物业:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="水电物业" v-model="info.money_json.wat_ele"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">垂直媒体:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="垂直媒体" v-model="info.money_json.media"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">试驾车租金:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="试驾车租金" v-model="info.money_json.drive"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">市场营销费:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="市场营销费" v-model="info.money_json.marketing"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">门头营销:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="门头营销" v-model="info.money_json.door_step"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">店长底薪:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.money_json.base_manager">
|
||||
<option value="8000.00">8000</option>
|
||||
<option value="10000.00">10000</option>
|
||||
<option value="12000.00">12000</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">销售人数:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="销售人数" v-model="info.money_json.num"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50 fl">
|
||||
<label class="am-para-label">销售底薪:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="销售底薪" v-model="info.money_json.employee_wage"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">销售提成:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="销售提成" v-model="info.money_json.commission"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">日期:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="year" style="display: inline; width: 100px;" v-model="info.year">
|
||||
<option value="">年</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="month" style="display: inline; width: 100px;" v-model="info.month">
|
||||
<option value="">月份</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info : [],
|
||||
action:'',
|
||||
yearAry:[],
|
||||
monthAry:[],
|
||||
employee_price_arr:[],
|
||||
employee_price_list:[]
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.employee_price_arr = <?=json_encode($employee_price_arr)?>;
|
||||
},
|
||||
methods:{
|
||||
del_employee_price:function (index){
|
||||
this.employee_price_list.splice(index, 1);
|
||||
this.up_employee_price()
|
||||
},
|
||||
add_employee_price:function (){
|
||||
this.employee_price_list.push('3000.00');
|
||||
this.up_employee_price()
|
||||
},
|
||||
up_employee_price:function (){
|
||||
var price = 0
|
||||
this.employee_price_list.forEach((elem, index) => {
|
||||
price = price+Number.parseInt(elem)
|
||||
});
|
||||
this.info.money_json.base_employees = price
|
||||
},
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info,employee_price_list:vm.employee_price_list},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/biz/seprice/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">年月:</label>
|
||||
<div class="am-para-inline">
|
||||
<div class="am-para-inline w70">
|
||||
<select name="year" v-model="params.year">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w60">
|
||||
<select name="month" v-model="params.month">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" name="biz_id" v-model="params.biz_id">
|
||||
<button data-title="新增" type="button" :data-modal="'/biz/seprice/get?biz_id='+params.biz_id" class="am-btn am-btn-success am-btn-sm w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="20%"><span>费用明细</span></th>
|
||||
<th width="10%"><span>有效月份</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="10%"><span>创建时间</span></th>
|
||||
<th width="15%"><span>操作</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in lists">
|
||||
<td>{{item.id}}</td>
|
||||
<td>
|
||||
<template v-for="(val,key) in item.money_json">{{key}}:{{val}}<br></template>
|
||||
</td>
|
||||
<td>{{item.show_time}}</td>
|
||||
<td>{{item.status_cn}}</td>
|
||||
<td>{{item.c_time}}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" :data-modal="'/biz/seprice/get?id='+item.id" class="am-btn am-btn-primary am-btn-xs">编辑</a>
|
||||
<template v-if="item.status==1">
|
||||
<a :data-update="item.id" data-action="/biz/seprice/edit_status" :data-value="item.status" class="am-btn am-btn-danger am-btn-xs">禁用</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a :data-update="item.id" data-action="/biz/seprice/edit_status" :data-value="item.status" class="am-btn am-btn-success am-btn-xs">启用</a>
|
||||
</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: [],
|
||||
lists:[],
|
||||
yearAry:[],
|
||||
monthAry:[],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this
|
||||
vm.params = <?=json_encode($params,JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.lists = <?=json_encode($lists,JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
watch: {
|
||||
'params.type': function (nv, ov) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -43,6 +43,11 @@
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" value="<?=$params['biz_id']?>" name="biz_id">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
<a href="javascript:;" class="am-btn am-btn-sm am-btn-success w100" data-ajax="post"
|
||||
:data-action="'/biz/settle/edit_brand?biz_id='+params.biz_id" :data-params-year="params.year" :data-params-month="params.month"
|
||||
:data-params-biz_id="params.biz_id" >
|
||||
更新结算
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -60,6 +65,8 @@
|
||||
<th width="10%"><span>保险利润</span></th>
|
||||
<th width="6%"><span>贷款利润</span></th>
|
||||
<th width="6%"><span>挂牌利润</span></th>
|
||||
<th width="6%"><span>精品利润</span></th>
|
||||
<th width="6%"><span>水平业务合计</span></th>
|
||||
<th width="6%"><span>拖车费</span></th>
|
||||
<th width="6%"><span>时间</span></th>
|
||||
</tr>
|
||||
@@ -81,6 +88,8 @@
|
||||
<td>{{v.profix_insure}}</td>
|
||||
<td>{{v.profix_loan}}</td>
|
||||
<td>{{v.profix_carno}}</td>
|
||||
<td>{{v.profix_fine}}</td>
|
||||
<td>{{v.sum_srv}}</td>
|
||||
<td>{{v.price_trucking}}</td>
|
||||
<td>{{v.month}}</td>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
<div class="coms-table-wrap">
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/biz/settle" class="form-search" onsubmit="return false">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">车辆属性:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="brand_id" v-model="params.brand_id">
|
||||
<option value="">选择品牌</option>
|
||||
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w150">
|
||||
<select name="s_id" v-model="params.s_id">
|
||||
<option value="">选择车系</option>
|
||||
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="v_id" v-model="params.v_id">
|
||||
<option value="">选择车型</option>
|
||||
<option :value="v.id" v-for="(v,i) in attrvAry">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">年月:</label>
|
||||
<div class="am-para-inline">
|
||||
<div class="am-para-inline w70">
|
||||
<select name="year" v-model="params.year">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w60">
|
||||
<select name="month" v-model="params.month">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" value="<?=$params['biz_id']?>" name="biz_id">
|
||||
<input type="hidden" value="<?=$params['_biz_type']?>" name="_biz_type">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
<a href="javascript:;" class="am-btn am-btn-sm am-btn-success w100" data-ajax="post"
|
||||
:data-action="'/biz/settle/edit_js?biz_id='+params.biz_id" :data-params-year="params.year" :data-params-month="params.month"
|
||||
:data-params-biz_id="params.biz_id" >
|
||||
更新结算
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="10%"><span>门店</span></th>
|
||||
<th width="20%"><span>订单信息</span></th>
|
||||
<th width="10%"><span>单车毛利</span></th>
|
||||
<th width="10%"><span>单车毛利税后</span></th>
|
||||
<th width="10%"><span>保险利润</span></th>
|
||||
<th width="10%"><span>贷款利润</span></th>
|
||||
<th width="10%"><span>挂牌利润</span></th>
|
||||
<th width="10%"><span>精品利润</span></th>
|
||||
<th width="10%"><span>水平业务总毛利</span></th>
|
||||
<th width="10%"><span>水平业务税后毛利</span></th>
|
||||
<th width="6%"><span>时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr >
|
||||
<td>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.biz_name}}</td>
|
||||
<td>
|
||||
<a href="javascript:;" :data-open="'/receiver/orderv2/orders/get?id='+v.o_id">
|
||||
{{v.name}} {{v.mobile}}<br>
|
||||
{{v.title}} {{v.vin}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{v.profix_car}}<br>
|
||||
优惠金额:{{v.o_money_json.price_discount}}
|
||||
</td>
|
||||
<td>{{v.profix_car_after}}</td>
|
||||
<td>
|
||||
{{v.profix_insure}}<br>
|
||||
强险佣金:
|
||||
<span v-if="v.money_json.profix_insuer_ins">{{v.money_json.profix_insuer_ins}}</span>
|
||||
<span v-else>0</span><br>
|
||||
商业险佣金:
|
||||
<span v-if="v.money_json.profix_insuer_bis">{{v.money_json.profix_insuer_bis}}</span>
|
||||
<span v-else>0</span><br>
|
||||
</td>
|
||||
<td>
|
||||
{{v.profix_loan}}<br>
|
||||
<template v-if="v.profix_loan>0">
|
||||
手续费:
|
||||
<span v-if="v.srv_json">{{v.srv_json}}</span>
|
||||
<span v-else>0</span><br>
|
||||
利润:{{v.profix_loan-v.srv_json}}
|
||||
</template>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
{{v.profix_carno}}<br>
|
||||
<template v-if="v.profix_carno">
|
||||
挂牌:{{v.o_money_json.fee_carno}}<br>
|
||||
手续费:{{v.o_money_json.fee_carno-v.profix_carno}}
|
||||
</template>
|
||||
</td>
|
||||
<td>{{v.profix_fine}}</td>
|
||||
<td>{{v.sum_srv}}</td>
|
||||
<td>{{v.sum_srv_after}}</td>
|
||||
<td>{{v.month}}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time',
|
||||
format:'yyyy-MM'
|
||||
});
|
||||
});
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
lists:[],
|
||||
brandAry:[],
|
||||
seryAry:[],
|
||||
attrvAry:[],
|
||||
yearAry :[],
|
||||
monthAry :[],
|
||||
info_edit:{}
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
var lists = [];
|
||||
lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.brandAry = <?=json_encode($brandAry)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
|
||||
vm.lists = lists;
|
||||
},
|
||||
methods:{
|
||||
set_edit:function(index, type){
|
||||
var vm = this;
|
||||
var row = vm.lists[index];
|
||||
if(1 == type){
|
||||
if(undefined != vm.info_edit.index){
|
||||
//旧的编辑取消
|
||||
vm.lists[vm.info_edit.index].edit = 0;
|
||||
}
|
||||
row.edit = 1;
|
||||
vm.info_edit = JSON.parse(JSON.stringify(row));
|
||||
vm.info_edit.index = index;
|
||||
} else {
|
||||
row.edit = 0;
|
||||
vm.info_edit = {};
|
||||
}
|
||||
},
|
||||
save_edit:function(){
|
||||
var vm = this;
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
|
||||
$.ajax({
|
||||
url: 'auto/cars/edit',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info_edit},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'params.brand_id':function(nv, ov){
|
||||
var vm = this;
|
||||
vm.seryAry = {};
|
||||
if(nv > 0){
|
||||
$.ajax({
|
||||
url: '/auto/series/json_lists',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {brand_id:nv},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
var lists = data.data.list;
|
||||
var seryAry = {};
|
||||
for (var i in lists){
|
||||
var row = lists[i];
|
||||
seryAry[row.id] = row.name;
|
||||
}
|
||||
vm.seryAry = seryAry;
|
||||
if(vm.params.s_id>0 && undefined == seryAry[vm.params.s_id]){
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.params.s_id = '';
|
||||
}
|
||||
},
|
||||
'params.s_id':function(nv, ov){
|
||||
var vm = this;
|
||||
if (nv > 0) {
|
||||
//型号
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: nv,
|
||||
status: 1,
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrvAry = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrvAry = [];
|
||||
vm.params.v_id = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
<div class="coms-table-wrap">
|
||||
<div class="coms-table-hd clearfix no-border">
|
||||
<form action="/biz/settle/lists_static" class="form-search" onsubmit="return false">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">年月:</label>
|
||||
<div class="am-para-inline">
|
||||
<div class="am-para-inline w70">
|
||||
<select name="year" v-model="params.year">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in yearAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w60">
|
||||
<select name="month" v-model="params.month">
|
||||
<option value="">全部</option>
|
||||
<option :value="v" v-for="(v,i) in monthAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" value="<?=$params['id']?>" name="id">
|
||||
<input type="hidden" value="<?=$params['_biz_type']?>" name="_biz_type">
|
||||
<button type="submit" class="am-btn am-btn-sm am-btn-success w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button type="button" id="export" class="am-btn am-btn-sm am-btn-success w100">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</form> </div>
|
||||
<div class="coms-table-bd">
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th width="8%"><span>门店</span></th>
|
||||
<th width="6%"><span>单车总毛利</span></th>
|
||||
<th width="6%"><span>税后单车总毛利</span></th>
|
||||
<th width="6%"><span>水平业务总毛利</span></th>
|
||||
<th width="6%"><span>税后水平业务总毛利</span></th>
|
||||
<th width="6%"><span>门店费用</span></th>
|
||||
<th width="6%"><span>其它费用</span></th>
|
||||
<th width="6%"><span>总利润</span></th>
|
||||
<th width="6%"><span>分润</span></th>
|
||||
<th width="6%"><span>时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr>
|
||||
<td>
|
||||
<span>{{v.id}}</span>
|
||||
</td>
|
||||
<td>{{v.biz_name}}</td>
|
||||
<td>{{v.profix_car}}</td>
|
||||
<td>{{v.profix_car_after}}</td>
|
||||
<td>{{v.price_all}}</td>
|
||||
<td>{{v.price_all_after}}</td>
|
||||
<td>
|
||||
<template v-if="v.money_json && v.money_json.biz_price">
|
||||
<template v-for="(v2,i2) in v.money_json.biz_price_list">
|
||||
{{i2}}:{{v2}}<br>
|
||||
</template>
|
||||
总费用:{{v.money_json.biz_price}}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-for="item in v.price_other">
|
||||
{{item.name}}:{{item.money}}({{type_arr[item.type]}})<br>
|
||||
</template>
|
||||
</td>
|
||||
<td>{{v.price_ml}}</td>
|
||||
<td>
|
||||
狸车分润:{{v.profix_liche}}<br>
|
||||
合伙人分润:{{v.profix_partner}}
|
||||
</td>
|
||||
<td>{{v.month_str}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="11" class="align-r">
|
||||
<a class="am-btn am-btn-primary am-btn-xs" :data-open="'/biz/settle?_biz_type=1&biz_id='+v.biz_id+'&month='+v.month" href="javascript:;">查看明细</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs" :data-modal="'/biz/settle/add_price?id='+v.id" data-title="新增费用" href="javascript:;">新增费用</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs" data-ajax="post" data-action="biz/settle/edit_static" :data-params-id="v.id" data-params-type="1" href="javascript:;">重新结算</a>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time',
|
||||
format:'yyyy-MM'
|
||||
});
|
||||
});
|
||||
var vue_obj;
|
||||
var loading = 0;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params:[],
|
||||
lists:[],
|
||||
yearAry :[],
|
||||
monthAry :[],
|
||||
type_arr : [],
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.type_arr = <?=json_encode($type_arr)?>;
|
||||
},
|
||||
methods:{
|
||||
},
|
||||
watch:{
|
||||
}
|
||||
});
|
||||
$('#export').on('click', function () {
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var count = <?=$pager['totle']?>;
|
||||
layer.msg('导出中请耐心等待几秒钟......');
|
||||
href = href.replace("lists_static?", "export?");
|
||||
window.location.href = href;
|
||||
});
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="am-panel am-panel-default">
|
||||
<div class="am-panel-hd">
|
||||
<span href="javascript:void(0)" style="font-size: 20px">
|
||||
店铺概况
|
||||
门店概况
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd">
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active" id="swzc">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">业务类型:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="type" v-model="info.type" disabled>
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50" v-if="info.type==2">
|
||||
<label class="am-para-label">保险类型:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.type" disabled>
|
||||
<option v-for="(v,i) in insure_typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">供应商:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.supplier_id" :disabled="info.jsondata.supplier_id>0">
|
||||
<option v-for="(item,key) in supplier" :value="item.id">{{item.title}}</option>
|
||||
</select>
|
||||
<input type="hidden" placeholder="供应商" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="info.type==3">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">期数:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.finance_num" :disabled="info.jsondata.finance_num>0">
|
||||
<option v-for="item in finances_num" :value="item">{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="am-form-group wp50" v-if="info.type==1 || info.type==3 && info.is_def==0">
|
||||
<label class="am-para-label">生效时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="" id="id-time" v-model="info.s_effect_time" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp100">
|
||||
<label class="am-para-label">是否默认:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" v-model="info.is_def"/>
|
||||
</div>
|
||||
<span v-if="info.type==1">同个供应商,只能有一个默认值</span>
|
||||
<span v-if="info.type==2">同个供应商 + 保险类型,只能有一个默认值</span>
|
||||
<span v-if="info.type==3">同个供应商 + 同个期数,只能有一个默认值</span>
|
||||
</div>
|
||||
<template v-if="info.type==1">
|
||||
<div class="am-form-group wp50" >
|
||||
<label class="am-para-label">结算价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="请输入结算价" name="price_insure" v-model="info.jsondata.price" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="am-form-group wp100" v-if="info.type==3">
|
||||
<label class="am-para-label">是否贴息:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" v-model="info.is_tiexi"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="info.type==2 || info.type==3 && info.is_tiexi == 0">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">返点:</label>
|
||||
<div class="input-group am-para-input w150">
|
||||
<input type="number" placeholder="输入返点" v-model="info.jsondata.rebate">
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="input-group am-para-input">
|
||||
<span class="f12 clr999 lh-default ml5">百分比</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="am-form-group" :style="{'display':info.type==2 && info.is_def==0 ? 'block':'none'}">
|
||||
<label class="am-para-label">时间区间:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="开始时间" autocomplete="off" value="<?=$info['jsondata']['s_time']?>" name="s_time" id="s-time">
|
||||
</div>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="结束时间" autocomplete="off" value="<?=$info['jsondata']['e_time']?>" name="e_time" id="e-time">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time'
|
||||
});
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#s-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#e-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
});
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info : {jsondata:[]},
|
||||
typeAry:[],
|
||||
insure_typeAry:[],
|
||||
yearAry:[],
|
||||
monthAry:[],
|
||||
finances_num:[],
|
||||
supplier:[],
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.typeAry = <?=$typeAry ? json_encode($typeAry) : '[]'?>;
|
||||
vm.insure_typeAry = <?=$insure_typeAry ? json_encode($insure_typeAry) : '[]'?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.finances_num = <?=json_encode($finances_num)?>;
|
||||
vm.supplier = <?=json_encode($supplier)?>;
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
vm.info.s_effect_time = $("#id-time").val();
|
||||
if(vm.info.type==2){
|
||||
vm.info.s_time = $("#s-time").val();
|
||||
vm.info.e_time = $("#e-time").val();
|
||||
if (vm.info.is_def == 0){
|
||||
if (vm.info.s_time == '' || vm.info.e_time == '') {
|
||||
alert("请填写时间区间");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,215 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal tab-content" action="/auto/cars/edit" data-auto="true" method="post" style="width: 90%;padding:25px 30px 20px 0;margin: 0 auto;">
|
||||
<div class="tab-pane fade in active" id="swzc">
|
||||
<div class="am-form-group wp100" v-if="info.step<=2">
|
||||
<b>第一步:选择供应商</b>
|
||||
</div>
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">类型:</label>
|
||||
<div class="am-para-input">
|
||||
<select name="type" v-model="info.type" disabled>
|
||||
<option v-for="(v,i) in typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group wp50" v-if="info.type==2">
|
||||
<label class="am-para-label">保险类型:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.type" :disabled="info.step==2">
|
||||
<option v-for="(v,i) in insure_typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">供应商:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.supplier_id" :disabled="info.step==2">
|
||||
<option v-for="(item,key) in supplier" :value="item.id">{{item.title}}</option>
|
||||
</select>
|
||||
<input type="hidden" placeholder="供应商" v-model="info.title">
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.type==3">
|
||||
<div class="am-form-group wp50">
|
||||
<label class="am-para-label">期数:</label>
|
||||
<div class="am-para-input">
|
||||
<select v-model="info.jsondata.finance_num" :disabled="info.step==2">
|
||||
<option v-for="item in finances_num" :value="item">{{item}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="nextstep" v-if="info.step==1" :disabled="info.type==3 && info.jsondata.supplier_id==0 && info.jsondata.finance_num > 0|| info.type!=3 && info.jsondata.supplier_id==0 && info.jsondata.finance_num > 0">点击进入下一步</button></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fade in tab-pane" v-show="info.step==2" :class="info.step==2?'active':''" id="swzc2">
|
||||
<div class="am-form-group wp100" v-if="info.step<=2">
|
||||
<b>第二步:配置业务数据</b>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp50" v-if="info.type==1 || info.type==3 && info.is_def==0">
|
||||
<label class="am-para-label">生效时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" placeholder="" id="id-time" v-model="info.s_effect_time" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group wp100">
|
||||
<label class="am-para-label">是否默认:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" v-model="info.is_def"/>
|
||||
</div>
|
||||
<span v-if="info.type!=2">同个业务类型下,同个供应商只能有一个默认值</span>
|
||||
<span v-else>保险业务类型下,同个供应商只能有一个默认值,设置当前为默认值会自动下架其他</span>
|
||||
</div>
|
||||
<template v-if="info.type==1">
|
||||
<div class="am-form-group wp50" >
|
||||
<label class="am-para-label">结算价:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="number" placeholder="请输入结算价" name="price_insure" v-model="info.jsondata.price" style="display: inline;width: 60%"/>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="am-form-group wp100" v-if="info.type==3">
|
||||
<label class="am-para-label">是否贴息:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" v-model="info.is_tiexi"/>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.type==2 || info.type==3 && info.is_tiexi == 0">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">返点:</label>
|
||||
<div class="input-group am-para-input w150">
|
||||
<input type="number" placeholder="输入返点" v-model="info.jsondata.rebate">
|
||||
<div class="input-group-addon">%</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="input-group am-para-input">
|
||||
<span class="f12 clr999 lh-default ml5">百分比</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="am-form-group" :style="{'display':info.type==2 ? 'block':'none'}" v-if="info.is_def==0">
|
||||
<label class="am-para-label">时间区间:</label>
|
||||
<div class="am-para-input wp60">
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="开始时间" autocomplete="off" value="<?=$info['jsondata']['s_time']?>" name="s_time" id="s-time">
|
||||
</div>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" placeholder="结束时间" autocomplete="off" value="<?=$info['jsondata']['e_time']?>" name="e_time" id="e-time">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 2rem" v-if="info.step>=2">
|
||||
<div class="am-para-input"><button class="am-btn am-btn-secondary" type="button" @click="saveEdit">提交</button></div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
require(['laydate'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#id-time'
|
||||
});
|
||||
//日期范围
|
||||
laydate.render({
|
||||
elem: '#s-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#e-time'
|
||||
,type: 'datetime'
|
||||
});
|
||||
});
|
||||
var loading = 0;
|
||||
var vue_obj;
|
||||
$(function(){
|
||||
vue_obj = new Vue({
|
||||
el: '#vue-edit',
|
||||
data: {
|
||||
info : {jsondata:[]},
|
||||
typeAry:[],
|
||||
insure_typeAry:[],
|
||||
yearAry:[],
|
||||
monthAry:[],
|
||||
finances_num:[],
|
||||
supplier:[],
|
||||
action:''
|
||||
},
|
||||
mounted:function(){
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info)?>;
|
||||
vm.typeAry = <?=$typeAry ? json_encode($typeAry) : '[]'?>;
|
||||
vm.insure_typeAry = <?=$insure_typeAry ? json_encode($insure_typeAry) : '[]'?>;
|
||||
vm.action = '<?=$info['action']?>';
|
||||
vm.yearAry = <?=json_encode($yearAry)?>;
|
||||
vm.monthAry = <?=json_encode($monthAry)?>;
|
||||
vm.finances_num = <?=json_encode($finances_num)?>;
|
||||
vm.supplier = <?=json_encode($supplier)?>;
|
||||
},
|
||||
methods:{
|
||||
saveEdit:function(){
|
||||
var vm = this;
|
||||
|
||||
vm.info.s_effect_time = $("#id-time").val();
|
||||
if(vm.info.type==2){
|
||||
vm.info.s_time = $("#s-time").val();
|
||||
vm.info.e_time = $("#e-time").val();
|
||||
if (vm.info.is_def == 0){
|
||||
if (vm.info.s_time == '' || vm.info.e_time == '') {
|
||||
alert("请填写时间区间");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(1 == loading){
|
||||
return 0;
|
||||
}
|
||||
loading = 1;
|
||||
$.ajax({
|
||||
url: vm.action,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {info:vm.info},
|
||||
beforeSend: function () {
|
||||
layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
},
|
||||
success: function (data) {
|
||||
loading = 0;
|
||||
if (data['code']) {
|
||||
layer.msg(data.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
loading = 0;
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
});
|
||||
},
|
||||
nextstep:function(){
|
||||
var vm = this;
|
||||
vm.info.step = 2;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Executable
+139
@@ -0,0 +1,139 @@
|
||||
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;">
|
||||
<div id="recom-stat"></div>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<?foreach ($typeAry as $key=>$val){?>
|
||||
<li role="presentation" class="<?=$params['type']==$key ? 'active' : ''?>">
|
||||
<a href="javascript:void (0);" data-open="/biz/srv/lists?id=<?=$params['id']?>&type=<?=$key?>">
|
||||
<?=$val?>
|
||||
</a>
|
||||
</li>
|
||||
<?}?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="coms-table-wrap mt10" id="vue-app">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/biz/srv/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl" v-if="params.type==2">
|
||||
<label class="am-para-label w80">保险类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="insure_type" v-model="params.insure_type">
|
||||
<option value="">请选择</option>
|
||||
<option v-for="(v,i) in insure_typeAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">状态:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="status" v-model="params.status">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">正常</option>
|
||||
<option value="0">禁用</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">供应商:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="title" v-model="params.title">
|
||||
<option value="">请选择</option>
|
||||
<option v-for="(v,i) in titleAry" :value="v.title">{{v.title}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<input type="hidden" :value="params.type" name="type">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml20">
|
||||
<button :data-title="'新增-'+typeAry[params.type]" type="button" :data-modal="'/biz/srv/get?type='+params.type" class="am-btn am-btn-success am-btn-sm w100">
|
||||
新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="8%"><span>ID</span></th>
|
||||
<th width="20%"><span>门店</span></th>
|
||||
<th width="20%"><span>供应商</span></th>
|
||||
<th width="20%"><span>其它参数</span></th>
|
||||
<th width="15%"><span>生效日期</span></th>
|
||||
<th width="8%"><span>类型</span></th>
|
||||
<th width="8%"><span>是否默认</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lists as $v) { ?>
|
||||
<tr>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['title'] ?></td>
|
||||
<td style="text-align: left; margin-left: 20px">
|
||||
<?foreach ($v['other_data'] as $k2 => $v2){?>
|
||||
<?=$k2?>:<?= $v2 ?><br>
|
||||
<?}?>
|
||||
</td>
|
||||
<td><?= $v['s_effect_time'] ?></td>
|
||||
<td><?= $v['type_cn'] ?></td>
|
||||
<td><?= $v['is_def'] ?></td>
|
||||
<td><?= $v['status_cn'] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="9" class="align-r">
|
||||
<a data-title="修改-<?=$v['title']?>" data-modal="/biz/srv/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
|
||||
<input type="hidden" class="srv-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".srv-id-<?= $v['id'] ?>"
|
||||
data-action="/biz/srv/batch" data-field="" style="height: 30px;width: 70px;">
|
||||
<option value="0" <?= 0 == $v['status'] ? 'selected' : '' ?>>禁用</option>
|
||||
<option value="1" <?= 1 == $v['status'] ? 'selected' : '' ?>>正常</option>
|
||||
<option value="-1" <?= -1 == $v['status'] ? 'selected' : '' ?>>删除</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var vm = new Vue({
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
params: [],
|
||||
titleAry:[],
|
||||
typeAry:[],
|
||||
insure_typeAry:[],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.typeAry = <?=json_encode($typeAry)?>;
|
||||
vm.insure_typeAry = <?=json_encode($insure_typeAry)?>;
|
||||
$.get('/biz/srv/get_title', {"type":<?=$params['type']?>},function(result){
|
||||
if(result.code && result.data.lists){
|
||||
vm.titleAry = result.data.lists
|
||||
}
|
||||
},'json')
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
watch: {
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
<?php page_script($pager) ?>
|
||||
});
|
||||
</script>
|
||||
@@ -132,7 +132,7 @@
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<?php } ?>
|
||||
|
||||
<div class="am-form-group">
|
||||
<div class="am-form-group" style="display: none">
|
||||
<label class="am-para-label">所属品牌:</label>
|
||||
<div class="am-para-input">
|
||||
<select id="brand_id" name="brand_id" v-model="brand_id" style="display: none">
|
||||
@@ -153,12 +153,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">商家名称:</label>
|
||||
<label class="am-para-label">门店:</label>
|
||||
<div class="am-para-input"><input type="text" placeholder="(最多 30 个字符)" name="biz_name"
|
||||
value="<?= $biz['biz_name'] ?>"/></div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">商家地址:</label>
|
||||
<label class="am-para-label">门店地址:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group" style="display: none">
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
<form id="vue-edit" class="am-form am-form-horizontal" :action="action" data-auto="true" method="post"
|
||||
style="width: 90%;padding-top: 10px">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分佣比例:</label>
|
||||
<div class="am-para-input">
|
||||
<template v-if="info.biz_type==2">合伙人</template>
|
||||
<template v-else>品牌店</template>
|
||||
:<input type="text" style="width:90px;display:inline" placeholder="0~100" name="" v-model="info.rate"/>%
|
||||
狸车:<span>{{100-info.rate}}%</span> (说明:有效值0~100,输入数值的百分比)
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.biz_type==2">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">联系人:</label>
|
||||
<div class="am-para-input w300">
|
||||
@@ -20,13 +30,6 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">分佣比例:</label>
|
||||
<div class="am-para-input">
|
||||
合伙人:<input type="text" style="width:90px;display:inline" placeholder="0~100" name="" v-model="info.rate"/>%
|
||||
狸车:<span>{{100-info.rate}}%</span> (说明:有效值0~100,输入数值的百分比)
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">保证金:</label>
|
||||
<div class="am-para-input w150">
|
||||
@@ -39,6 +42,7 @@
|
||||
<input type="text" placeholder="输入面积" name="" type="number" v-model="info.area"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">租金(月):</label>
|
||||
<div class="am-para-input w150">
|
||||
@@ -51,12 +55,61 @@
|
||||
<input type="text" placeholder="输入水电" name="" type="number" v-model="info.wat_ele"/>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.biz_type==1">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">试驾车租金:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入试驾车租金" name="" type="number" v-model="info.car_rent"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">市场活动营:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入市场活动营" name="" type="number" v-model="info.marketing"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">门头营销:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入门头营销" name="" type="number" v-model="info.door_step"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">垂媒:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入垂媒" name="" type="number" v-model="info.margin"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">销售提成:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入销售提成" name="" type="number" v-model="info.commission"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">店长底薪:</label>
|
||||
<div class="am-para-input w150">
|
||||
<select v-model="info.manager_wage">
|
||||
<option value="8000">8000</option>
|
||||
<option value="10000">10000</option>
|
||||
<option value="12000">12000</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">销售人数:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入销售提成" name="" type="number" v-model="info.num"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">销售底薪:</label>
|
||||
<div class="am-para-input w150">
|
||||
<input type="text" placeholder="输入人工工资" name="" type="number" v-model="info.employee_wage"/>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="info.biz_type==2">
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">人员核定:</label>
|
||||
<div class="am-para-input">
|
||||
@@ -76,6 +129,16 @@
|
||||
<input type="text" placeholder="输入裸车抽成" name="" type="number" v-model="info.commission"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">合作时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" id="s_time" style="width:200px;display:inline" placeholder="开始时间" name=""
|
||||
autocomplete="off" v-model="info.s_time"/>
|
||||
<input type="text" id="e_time" style="width:200px;display:inline" placeholder="结束时间" name=""
|
||||
autocomplete="off" v-model="info.e_time"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">拖车费:</label>
|
||||
<div class="am-para-input w150">
|
||||
@@ -92,15 +155,6 @@
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">合作时间:</label>
|
||||
<div class="am-para-input">
|
||||
<input type="text" id="s_time" style="width:200px;display:inline" placeholder="开始时间" name=""
|
||||
autocomplete="off" v-model="info.s_time"/>
|
||||
<input type="text" id="e_time" style="width:200px;display:inline" placeholder="结束时间" name=""
|
||||
autocomplete="off" v-model="info.e_time"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<div class="am-para-input">
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit">保存</button>
|
||||
@@ -128,7 +182,7 @@
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="vuetable-th-slot-title">商家名</th>
|
||||
<th class="vuetable-th-slot-title">品牌</th>
|
||||
<th class="vuetable-th-slot-actions text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -240,14 +294,14 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
//选择商家
|
||||
//选择品牌
|
||||
brandModal: function () {
|
||||
var that = this;
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['55%', '80%'], //宽高
|
||||
content: $('#brand-modal'),
|
||||
title: '选择商家',
|
||||
title: '选择品牌',
|
||||
shade: false,
|
||||
btn: ['选好了'],
|
||||
yes: function (index) {
|
||||
@@ -255,12 +309,13 @@
|
||||
}
|
||||
});
|
||||
data = {
|
||||
//page: that.brandsThPage,
|
||||
page: that.brandsThPage,
|
||||
//ids: that.sys_type_id == 1 ? that.info.brandIds : that.info.bizIds,
|
||||
};
|
||||
$.post('/common/brands', data, function (json) {
|
||||
var brandsList = json.data.itemsList;
|
||||
that.brandsPage = json.data.itemsPage;
|
||||
that.brandsThPage = json.data.itemsPage.page;
|
||||
brandsList.map(function (_item, _index) {
|
||||
brandsList[_index]['money'] = 0.00
|
||||
for (var index in that.selectedBrands) {
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
action="/biz/store/store/lists">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">商家名称:</label>
|
||||
<label class="am-para-label w100">门店:</label>
|
||||
<div class="am-para-inline w150">
|
||||
<input type="text" name="bizname" value="<?= $bizname ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group fl" style="display: none">
|
||||
<label class="am-para-label w80">品牌:</label>
|
||||
<div class="am-para-inline w250">
|
||||
<select name="brand_id" v-model="brand_id">
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">商家地址:</label>
|
||||
<label class="am-para-label w100">门店地址:</label>
|
||||
<div class="am-form-group am-para-inline w150" style="display: none">
|
||||
<select name="province_id" data-toggle="next-select"
|
||||
data-refurl="/common/area?key=city&id={value}&url=search" data-next="#bd-hd-city">
|
||||
@@ -78,6 +78,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">公司:</label>
|
||||
<div class="am-para-input w150">
|
||||
@@ -87,8 +88,9 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">渠道经理:</label>
|
||||
<label class="am-para-label w110">渠道经理:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="qdjl_id" v-model="params.qdjl_id">
|
||||
<option value=''>请选择</option>
|
||||
@@ -130,8 +132,8 @@
|
||||
<tr>
|
||||
<th width="50"></th>
|
||||
<th width="5%"><span>ID</span></th>
|
||||
<th width="30%"><span>商家名称</span></th>
|
||||
<th width="30%"><span>品牌</span></th>
|
||||
<th><span>门店</span></th>
|
||||
<!--<th width="30%"><span>品牌</span></th>-->
|
||||
<th width="12%"><span>类型</span></th>
|
||||
<th width="12%"><span>状态</span></th>
|
||||
<th width="15%"><span>创建时间</span></th>
|
||||
@@ -146,28 +148,41 @@
|
||||
</td>
|
||||
<td><?= $v['id'] ?></td>
|
||||
<td><?= $v['biz_name'] ?></td>
|
||||
<td><?= $v['brand_name'] ?></td>
|
||||
<!-- <td><?/*= $v['brand_name'] */?></td>-->
|
||||
<td><?= $v['type_name'] ?></td>
|
||||
<td><?= $statuscn[$v['status']] ?></td>
|
||||
<td><?= $v['c_time'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6" class="align-r">
|
||||
<?if($v['type']==2){?>
|
||||
<td colspan="5" class="align-r">
|
||||
<?if($v['type']==1){?>
|
||||
<a data-open="/biz/fine/lists?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">精品配置
|
||||
</a>
|
||||
<a data-open="/biz/seprice/lists?biz_id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">费用管理
|
||||
</a>
|
||||
<a data-open="/biz/srv/lists?id=<?= $v['id'] ?>&type=1"
|
||||
class="am-btn am-btn-primary am-btn-xs">水平业务配置
|
||||
</a>
|
||||
<?}?>
|
||||
<?if(in_array($v['type'],[1,2])){?>
|
||||
<a data-open="/biz/store/store/get_info?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">基本信息</a>
|
||||
<a data-open="/biz/settle/lists_static?id=<?= $v['id'] ?>"
|
||||
<?}?>
|
||||
<?if(in_array($v['type'],[1,2,3])){?>
|
||||
<a data-open="/biz/settle/lists_static?id=<?= $v['id'] ?>&_biz_type=<?=$v['type']?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">结算统计</a>
|
||||
<?}?>
|
||||
<a data-open="/biz/situation/get?id=<?= $v['id'] ?>"
|
||||
class="am-btn am-btn-primary am-btn-xs">概况</a>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
|
||||
@click="channel_modal(<?= $v['id'] ?>)">渠道归属</a>
|
||||
@click="channel_modal(<?= $v['id'] ?>, '<?= $v['biz_name'] ?>')">渠道归属</a>
|
||||
<a href="javascript:void(0);" class="am-btn am-btn-primary am-btn-xs"
|
||||
@click="biz_manage_modal(<?= $v['id'] ?>)">门店管理员</a>
|
||||
@click="biz_manage_modal(<?= $v['id'] ?>, '<?= $v['biz_name'] ?>')">门店管理员</a>
|
||||
<a class="am-btn am-btn-primary am-btn-xs"
|
||||
data-modal="/common/share_link?id=<?= $v['id'] ?>&app_id=1&pages=storeInfo"
|
||||
data-title="狸车小程序店铺首页">分享链接</a>
|
||||
data-title="<?= $v['biz_name'] ?>-狸车小程序门店首页">分享链接</a>
|
||||
<a data-open="/biz/store/store/get?id=<?= $v['id'] ?>" class="am-btn am-btn-primary am-btn-xs">修改</a>
|
||||
<input type="hidden" class="biz-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>" checked>
|
||||
<select data-update-group="" data-list-target=".biz-id-<?= $v['id'] ?>"
|
||||
@@ -278,7 +293,7 @@
|
||||
vm.qdjl_lists = <?=json_encode($qdjl_lists)?>;
|
||||
},
|
||||
methods: {
|
||||
channel_modal: function (biz_id) {
|
||||
channel_modal: function (biz_id,biz_name) {
|
||||
//选择渠道归属
|
||||
var vm = this;
|
||||
vm.channels = [];
|
||||
@@ -297,7 +312,7 @@
|
||||
type: 1,
|
||||
area: ['50%', '40%'], //宽高
|
||||
content: $('#channel-modal'),
|
||||
title: '渠道归属',
|
||||
title: biz_name+'-渠道归属',
|
||||
shade: false,
|
||||
btn: ['保存选择'],
|
||||
yes: function (index) {
|
||||
@@ -318,7 +333,7 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
biz_manage_modal: function (biz_id) {
|
||||
biz_manage_modal: function (biz_id,biz_name) {
|
||||
//选择门店管理员
|
||||
var vm = this;
|
||||
vm.biz_manage = {admins: [], group_id: 2, admin_id: 0, biz_id: biz_id, admin_name: ''};
|
||||
@@ -327,7 +342,7 @@
|
||||
type: 1,
|
||||
area: ['50%', '50%'], //宽高
|
||||
content: $('#biz_manage-modal'),
|
||||
title: '门店管理员',
|
||||
title: biz_name+'-门店管理员',
|
||||
shade: false,
|
||||
btn: ['保存选择'],
|
||||
yes: function (index) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>东风EV</title>
|
||||
<title>狸车</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="description" content="">
|
||||
@@ -18,6 +18,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css?v=1581252500">
|
||||
<!-- 滑动按钮css -->
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/switch.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/js/plugin/viewer/viewer.css?t=3">
|
||||
|
||||
<script type="text/javascript" src="/static/js/common/jquery-3.0.0.js"></script>
|
||||
<script type="text/javascript" src="/static/js/common/vue.min.js"></script>
|
||||
@@ -32,6 +33,7 @@
|
||||
<script type="text/javascript" src="/static/js/common/Sortable.min.js?t=2020221"></script>
|
||||
<script type="text/javascript" src="/static/js/common/vuedraggable.umd.min.js?t=2020221"></script>
|
||||
<script type="text/javascript" src="/static/js/common/jquery.form.js?t=2020410"></script>
|
||||
<script type="text/javascript" src="/static/js/plugin/viewer/viewer.js?t=4"></script>
|
||||
<script>window.ROOT_URL = '';</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -39,7 +41,7 @@
|
||||
<div class="coms-layout-header">
|
||||
<div class="bars-nav"><i class="am-icon-bars"></i>导航</div>
|
||||
<a href="" class="logo" style="">
|
||||
<img src="/static/images/common/logo.png?v2" style="height:40px">
|
||||
<img src="/static/images/common/logo.png?v=1" style="height:40px">
|
||||
</a>
|
||||
<?php if ($menus) { ?>
|
||||
<ul class="header-nav">
|
||||
@@ -154,6 +156,10 @@
|
||||
<script type="text/javascript" src="/static/js/plugin/require/require.js"></script>
|
||||
<script type="text/javascript" src="/static/js/common/app.js"></script>
|
||||
<script type="text/javascript">
|
||||
//查看图片控件
|
||||
function showViewer(obj){
|
||||
new Viewer(document.getElementById(obj));
|
||||
}
|
||||
var log_data = {};
|
||||
(function ($) {
|
||||
$(".coms-layout-header .bars-nav").on("click",function(event){
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,539 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class=" form-search coms-table-hd clearfix no-border" onsubmit="return false" action="/items/cost">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">车型:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto1-id" name="brand_id" data-toggle="next-select"
|
||||
data-refurl="/common/auto?pid={value}&type=2&status=1"
|
||||
data-next="#bd-auto2-id">
|
||||
<option value="0">选择品牌</option>
|
||||
<? if ($autoList[1]) {
|
||||
foreach ($autoList[1] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['brand_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<? }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w120">
|
||||
<select id="bd-auto2-id" name="s_id" data-toggle="next-select"
|
||||
data-refurl="/common/auto?pid={value}&type=3&status=1"
|
||||
data-next="#bd-auto3-id" @change="set_sery">
|
||||
<option value="0">选择车系</option>
|
||||
<?php if ($autoList[2]) {
|
||||
foreach ($autoList[2] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['s_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w220">
|
||||
<select id="bd-auto3-id" name="v_id">
|
||||
<option value="0">选择车型</option>
|
||||
<?php if ($autoList[3]) {
|
||||
foreach ($autoList[3] as $v) { ?>
|
||||
<option value="<?= $v['id'] ?>" <?= $v['id'] == $params['v_id'] ? 'selected' : '' ?>
|
||||
><?= $v['name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">车架号:</label>
|
||||
<div class="am-para-inline w200">
|
||||
<input type="text" name="vin" placeholder="车架号关键字" v-model="params.vin"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w80">二手车:</label>
|
||||
<div class="am-para-inline w80">
|
||||
<select name="if_usedcar" v-model="params.if_usedcar">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.usedcarAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">开票时间:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="id-bill-time" name="bill_time" type="text" value="<?= $params['bill_time'] ?>"
|
||||
placeholder="开票时间范围" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today" data-btn="bill">今天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday" data-btn="bill">昨日</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks" data-btn="bill">本周</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month" data-btn="bill">本月</a>
|
||||
</div>
|
||||
<input id="id-bt-init" name="bt_init" type="hidden" value="<?= $params['bt_init'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店类型:</label>
|
||||
<div class="am-para-inline w100">
|
||||
<select name="biz_type" v-model="params.biz_type">
|
||||
<option value="">请选择</option>
|
||||
<option :value="i" v-for="(v,i) in show_info.bizTypeAry">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">归属门店:</label>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="城市" name="city_id_admin" v-model="params.city_id_admin">
|
||||
<option value="">选择城市</option>
|
||||
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select title="行政区" name="county_id_admin" v-model="params.county_id_admin">
|
||||
<option value="">选择行政区</option>
|
||||
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120">
|
||||
<select name="biz_id_admin" v-model="params.biz_id_admin">
|
||||
<option value="">门店</option>
|
||||
<template v-for="(v,i) in admins.bizAry">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-para-inline w120" style="display: none">
|
||||
<select name="admin_id" v-model="params.admin_id">
|
||||
<option value="">销售员</option>
|
||||
<template v-for="(v,i) in admins.list">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl ml50">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" id="export" class="am-btn am-btn-success am-btn-sm w100">导出</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" id="import" class="am-btn am-btn-success am-btn-sm w100">导入</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="aggs.doc_count>0">
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w200 fl"><b>水平业务总毛利:</b>{{aggs.srv_price_sum}}</label>
|
||||
<label class="am-para-label w200 fl"><b>单车总毛利:</b>{{aggs.car_price_sum}}</label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>城市</th>
|
||||
<th>门店</th>
|
||||
<th width="15%">车辆</th>
|
||||
<th>销售收入合计</th>
|
||||
<th>采购及加装成本合计</th>
|
||||
<th>促销成本合计</th>
|
||||
<th>整车采购成本</th>
|
||||
<th>整车采购毛利</th>
|
||||
<th>保险收入合计</th>
|
||||
<th>挂牌收入合计</th>
|
||||
<th>首付按揭收入合计</th>
|
||||
<th>按揭收入合计</th>
|
||||
<th>按揭收入总合计</th>
|
||||
<th>水平业务总毛利</th>
|
||||
<th>单车总毛利</th>
|
||||
<th>门店单车毛利</th>
|
||||
<th>品牌单车总毛利</th>
|
||||
<th>齐款</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-for="(v,i) in lists">
|
||||
<tr>
|
||||
<td>{{v.city_name}}</td>
|
||||
<td>{{v.biz_name}}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" :data-open="'/items/cost/get?id='+v.id">
|
||||
{{v.vin}}<br>{{v.title}}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{v.sale_price}}</td>
|
||||
<td>{{v.buy_price}}</td>
|
||||
<td>{{v.promotion_price}}</td>
|
||||
<td>{{v.car_buy_price}}</td>
|
||||
<td>{{v.car_profit_price}}</td>
|
||||
<td>{{v.insurance_price}}</td>
|
||||
<td>{{v.fee_carno_price}}</td>
|
||||
<td>{{v.loan_price0}}</td>
|
||||
<td>{{v.loan_price}}</td>
|
||||
<td>{{v.loan_price_total}}</td>
|
||||
<td>{{v.srv_price}}</td>
|
||||
<td>{{v.car_price}}</td>
|
||||
<td>{{v.dl_car_price}}</td>
|
||||
<td>{{v.brand_car_price}}</td>
|
||||
<td>
|
||||
<input v-if="v.if_pay == '1'" id="if_pay" type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" :data-id="v.id" checked onchange="edit_pay(this)"/>
|
||||
<input v-if="v.if_pay != '1'" id="if_pay" type="checkbox" class="mui-switch mui-switch-anim va-mid" true-value="1" false-value="0" :data-id="v.id" onchange="edit_pay(this)"/>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="coms-table-ft clearfix">
|
||||
<div class="coms-pagination fr mr20">
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cost-modal" style="display: none;padding: 10px">
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<h2><i class="fa fa-info-circle"></i> 请上传Excel文件</h2>
|
||||
<p>Excel文件格式必须与模板保持一致,否则无法导入</p>
|
||||
<div class="form-group-action">
|
||||
<a href="/temp/cost.xlsx" target="_blank" class="btn btn-default">查看模板</a>
|
||||
<label href="javascript:" class="btn btn-primary" style="margin-left: 10px;">
|
||||
<form id="import-form">
|
||||
<input type="file" id="cost-file" name="file" accept=".xls,.xlsx"
|
||||
style="left:-9999px;position:absolute;" onchange="load_cost()">
|
||||
</form>
|
||||
<span>上传Excel文件</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function edit_pay(obj){
|
||||
// alert($(obj).get(0).dataset.id);
|
||||
// alert($(obj).get(0).getAttribute('data-id'));
|
||||
id = $(obj).get(0).dataset.id;
|
||||
|
||||
var value = '';
|
||||
if($(obj).get(0).checked) {
|
||||
value = 1;
|
||||
}else{
|
||||
value = 0;
|
||||
}
|
||||
var data = {'id':id,'status':value};
|
||||
$.post('/items/cost/edit_pay',data,function(result){
|
||||
if(result.code){
|
||||
layer.msg(result.msg, {time: 2000,icon:1 }, function () {
|
||||
$.form.reload();
|
||||
});
|
||||
}else{
|
||||
layer.msg(result.msg,{icon:2});
|
||||
}
|
||||
},'json')
|
||||
}
|
||||
|
||||
function load_cost() {
|
||||
var file = $("#cost-file");
|
||||
if (file.val() == '') {
|
||||
layer.msg('文件是空的');
|
||||
return 0;
|
||||
}
|
||||
var loading = layer.load(1, {
|
||||
shade: [0.1, '#fff'] //0.1透明度的白色背景
|
||||
});
|
||||
|
||||
var options = {
|
||||
url: "/items/cost/add_excel",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {},
|
||||
success: function (res) {
|
||||
if (res['code']) {
|
||||
layer.msg(res.msg, {
|
||||
icon: 1,
|
||||
time: 2000
|
||||
}, function () {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
file.val('');
|
||||
layer.closeAll('loading');
|
||||
}
|
||||
};
|
||||
$("#import-form").ajaxSubmit(options);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
laydate.render({
|
||||
elem: '#order-time', range: '~'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#id-bill-time', range: '~'
|
||||
});
|
||||
$('.id-day-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', nowDate = new Date();
|
||||
var beginDate = '', endDate = '';
|
||||
switch (type) {
|
||||
case 'today':
|
||||
endDate = beginDate = nowDate.Format('yyyy-MM-dd');
|
||||
break;
|
||||
case 'yesterday':
|
||||
endDate = beginDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
|
||||
break;
|
||||
case 'weeks':
|
||||
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
|
||||
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
|
||||
nowDate.setDate(nowDate.getDate() + 6);
|
||||
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
|
||||
break;
|
||||
case 'month':
|
||||
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
|
||||
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
|
||||
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
|
||||
break;
|
||||
}
|
||||
date = beginDate + ' ~ ' + endDate;
|
||||
// $('#id-create-time').val(date);
|
||||
switch ($(this).data('btn')) {
|
||||
case 'bill':
|
||||
$('#id-bill-time').val(date);
|
||||
break;
|
||||
case 'order':
|
||||
$('#order-time').val(date);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '.coms-table-wrap',
|
||||
data: {
|
||||
params: [],
|
||||
lists: [],
|
||||
aggs: [],
|
||||
show_info: [],
|
||||
// modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0},
|
||||
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
vm.aggs = <?=json_encode($aggs)?>;
|
||||
vm.show_info = <?=json_encode($show_info)?>;
|
||||
vm.set_sery();
|
||||
vm.init_citys();
|
||||
},
|
||||
methods: {
|
||||
set_sery: function () {
|
||||
var vm = this;
|
||||
var s_id = $('#bd-auto2-id').val();
|
||||
if (s_id > 0) {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/auto/attr/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
s_id: s_id,
|
||||
status: 3,
|
||||
type: 0
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.attrs_cor = response.data.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.attrs_cor = [];
|
||||
vm.params.cor_id = '';
|
||||
}
|
||||
},
|
||||
init_citys: function () {
|
||||
var vm = this;
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: '350',
|
||||
key: 'city',
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
vm.cityAry = response.data;
|
||||
vm.admins.cityAry = JSON.parse(JSON.stringify(response.data));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
reset: function () {
|
||||
var that = this;
|
||||
$("#vin").val('');
|
||||
$("#id-bill-time").val('');
|
||||
that.params.brand_id = '';
|
||||
that.params.city_id_admin = '';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'params.city_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.countyAry = [];
|
||||
that.params.county_id_admin = '';
|
||||
} else {
|
||||
if (nv.substring(0, 4) != that.params.county_id_admin.substring(0, 4)) {
|
||||
that.params.county_id_admin = '';
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '/common/area',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
id: nv,
|
||||
key: 'county',
|
||||
type: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.countyAry = response.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.county_id_admin': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.bizAry = [];
|
||||
that.params.biz_id_admin = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/biz/store/store/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
city_id: that.params.city_id_admin,
|
||||
county_id: that.params.county_id_admin,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.bizAry = response.data.list;
|
||||
if (that.params.biz_id_admin > 0) {
|
||||
var biz_id = '';
|
||||
for (var i in that.admins.bizAry) {
|
||||
if (that.params.biz_id_admin == that.admins.bizAry[i].id) {
|
||||
biz_id = that.params.biz_id_admin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.biz_id_admin = biz_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 不虚线显示销售 biz_id_admin -> biz_id_admin_ 禁用
|
||||
'params.biz_id_admin_': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.admins.list = [];
|
||||
that.params.admin_id = '';
|
||||
} else {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/app/licheb/member/json_lists',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
biz_id: nv,
|
||||
status: 1
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.code == 1) {
|
||||
that.admins.list = response.data.list;
|
||||
if (that.params.admin_id > 0) {
|
||||
var admin_id = '';
|
||||
for (var i in that.admins.list) {
|
||||
if (that.params.admin_id == that.admins.list[i].id) {
|
||||
admin_id = that.params.admin_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
that.params.admin_id = admin_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
|
||||
$('#export').click(function () {
|
||||
var count = <?=$pager['totle']?>;
|
||||
if (count > 10000) {
|
||||
layer.msg('单次导出数据不能超过10000');
|
||||
return false;
|
||||
}
|
||||
var href = $.menu.parseUri(window.location.href);
|
||||
var arr = href.split('?');
|
||||
href = '/items/cost/export?' + arr[1];
|
||||
window.location.href = href;
|
||||
});
|
||||
|
||||
$("#import").click(function () {
|
||||
$("#cost-file").val('');
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['40%'], //宽高
|
||||
content: $('#cost-modal'),
|
||||
title: '导入整车成本',
|
||||
shade: false,
|
||||
btn: ['完成'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#bd-auto1-id').change(function () {
|
||||
$('#bd-auto2-id').empty();
|
||||
$('#bd-auto3-id').empty();
|
||||
$("#bd-auto3-id").prepend("<option value='0'>选择车型</option>");
|
||||
});
|
||||
$('#bd-auto2-id').change(function () {
|
||||
$('#bd-auto3-id').empty();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -96,6 +96,17 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td" colspan="2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">选装包</div>
|
||||
<label class="mr10" style="margin-top: 7px" v-for="(v,i) in options">
|
||||
<input type="checkbox" name="option_ids[]" :value="v.id" v-model="info.option_ids"> {{v.title}}(价格:{{v.price}})
|
||||
</label>
|
||||
<input type="hidden" name="" >
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
@@ -151,15 +162,15 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">发动机号</div>-->
|
||||
<!-- <input type="text" v-model="info.engine_num" placeholder="请输入发动机号">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td"></td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">发动机号</div>-->
|
||||
<!-- <input type="text" v-model="info.engine_num" placeholder="请输入发动机号">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td"></td>-->
|
||||
<!-- </tr>-->
|
||||
</table>
|
||||
<table width="100%" style="padding:10px 10px 10px 10px;">
|
||||
<tr>
|
||||
@@ -197,45 +208,65 @@
|
||||
<input type="text" v-model="info.ori_price" placeholder="请输入指导价">
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">采购成本</div>
|
||||
<input type="text" v-model="info.buy_price" placeholder="请输入采购成本">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">折扣%</div>-->
|
||||
<!-- <input type="text" v-model="info.discount" placeholder="请输入折扣%">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">折扣金额</div>-->
|
||||
<!-- <input type="text" v-model="info.dis_price" placeholder="请输入折扣金额">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">发票号</div>-->
|
||||
<!-- <input type="text" v-model="info.bill_num" placeholder="请输入发票号">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">发票金额</div>-->
|
||||
<!-- <input type="text" v-model="info.bill_price" placeholder="请输入发票金额">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">采购成本</div>-->
|
||||
<!-- <input type="text" v-model="info.buy_price" placeholder="请输入采购成本">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td" colspan="2"></td>-->
|
||||
<!-- </tr>-->
|
||||
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">预估返利</div>
|
||||
<input type="text" v-model="info.estimated_rebate" placeholder="请输入预估返利">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">折扣%</div>-->
|
||||
<!-- <input type="text" v-model="info.discount" placeholder="请输入折扣%">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">折扣金额</div>-->
|
||||
<!-- <input type="text" v-model="info.dis_price" placeholder="请输入折扣金额">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">发票号</div>-->
|
||||
<!-- <input type="text" v-model="info.bill_num" placeholder="请输入发票号">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">发票金额</div>-->
|
||||
<!-- <input type="text" v-model="info.bill_price" placeholder="请输入发票金额">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- </tr>-->
|
||||
<!-- <tr>-->
|
||||
<!-- <td class="table-td">-->
|
||||
<!-- <div class="input-group">-->
|
||||
<!-- <div class="input-group-addon">采购成本</div>-->
|
||||
<!-- <input type="text" v-model="info.buy_price" placeholder="请输入采购成本">-->
|
||||
<!-- </div>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="table-td" colspan="2"></td>-->
|
||||
<!-- </tr>-->
|
||||
|
||||
</table>
|
||||
<div class="am-form-group">
|
||||
<a href="javascript:void(0);" @click='saveEdit();'
|
||||
@@ -315,7 +346,8 @@
|
||||
addrAry: [],
|
||||
bizAry: [],
|
||||
fines: [],
|
||||
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}
|
||||
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0},
|
||||
options:[]
|
||||
},
|
||||
mounted: function () {
|
||||
var that = this;
|
||||
@@ -368,6 +400,7 @@
|
||||
type: type,
|
||||
pid: pid,
|
||||
tp: 1,
|
||||
status: !vm.info.id ? 3 : 0,
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.data) {
|
||||
@@ -693,6 +726,22 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
'info.brand_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
if(nv > 0){
|
||||
$.get("/auto/options/json_lists",{'brand_id':nv,'s_id':vm.info.s_id},function (res){
|
||||
vm.options = res.data.lists
|
||||
},'json');
|
||||
}
|
||||
},
|
||||
'info.s_id': function (nv, ov) {
|
||||
var vm = this;
|
||||
if(nv > 0){
|
||||
$.get("/auto/options/json_lists",{'brand_id':vm.info.brand_id,'s_id':nv},function (res){
|
||||
vm.options = res.data.lists
|
||||
},'json');
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user