index.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-attachment');
  4. ComponentHelper::loadComponentView('com-image');
  5. ComponentHelper::loadComponentView('com-map');
  6. ComponentHelper::loadComponentView('com-dialog-store');
  7. ?>
  8. <div id="app" v-cloak>
  9. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  10. <div slot="header">
  11. <span>核销员管理</span>
  12. <div style="float: right; margin: -5px 0">
  13. <el-button type="primary" @click="addUser(true)" size="small">
  14. 添加核销员
  15. </el-button>
  16. <!-- <el-button type="primary" @click="$navigate({r:'happiness/store-clerk/add'})" size="small">-->
  17. <!-- 添加核销员-->
  18. <!-- </el-button>-->
  19. </div>
  20. </div>
  21. <div class="table-body">
  22. <el-form size="small" :inline="true">
  23. <el-form-item>
  24. <el-input style="width: 200px" v-model="searchData.user_id" placeholder="请输入用户ID进行搜索" clearable></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-input style="width: 200px" v-model="searchData.keyword" placeholder="请输入用户昵称/手机号进行搜索" clearable></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button type="primary" @click="searchs" style="padding: 9px 15px !important">搜索</el-button>
  31. </el-form-item>
  32. </el-form>
  33. <el-tabs v-model="activeName" >
  34. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;" >
  35. <el-table-column prop="user_id" label="会员ID" align="center"></el-table-column>
  36. <el-table-column label="会员" >
  37. <template slot-scope="scope">
  38. <div class="table-info-img-text">
  39. <el-image class="table-info-img circle" :src="scope.row.user.avatar_url">
  40. <div slot="error" class="image-slot">
  41. <com-image src="/resources/img/common/default-avatar.png"></com-image>
  42. </div>
  43. </el-image>
  44. <div class="table-info-text">
  45. <div style="color:#000;">{{scope.row.user.nickname}}</div>
  46. <div style="font-size: 12px;">{{scope.row.mobile}}</div>
  47. </div>
  48. </div>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="手机" prop="name" align="center" >
  52. <template slot-scope="scope">{{scope.row.user.mobile}}</template>
  53. </el-table-column>
  54. <el-table-column label="所属门店" align="center">
  55. <template slot-scope="scope">
  56. {{scope.row.store.store_name}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="入驻时间" align="center">
  60. <template slot-scope="scope">
  61. 成为核销员时间:<br/>
  62. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="操作" align="center">
  66. <template slot-scope="scope">
  67. <el-button type="text" @click="editUser(scope.row)" class="all_text">编辑</el-button>
  68. <el-button type="text" @click="onDelete(scope.row, scope.$index)" class="all_text" style="margin-left: 10px">删除</el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </el-tabs>
  73. <div flex="box:last cross:center">
  74. <div></div>
  75. <div>
  76. <el-pagination v-if="pagination" :page-size="page_size"
  77. style="float: right;" background @current-change="pageChange"
  78. layout="prev, pager, next" :total="pagination.totalCount">
  79. </el-pagination>
  80. </div>
  81. </div>
  82. </div>
  83. </el-card>
  84. <div class="level-edit">
  85. <?= ComponentHelper::loadComponentView('edit', __DIR__) ?>
  86. </div>
  87. </div>
  88. <script>
  89. const app = new Vue({
  90. el: '#app',
  91. data: {
  92. searchData: {
  93. user_id: '',
  94. keyword: '', //会员昵称/手机号
  95. },
  96. form: {
  97. id: '',
  98. user_id: '',
  99. mobile: '',
  100. store_id: '',
  101. },
  102. store_data: [],
  103. search_store_url: 'happiness/store-clerk/search-store',
  104. list: [],
  105. loading: false,
  106. btnLoading: false,
  107. activeName: '-1',
  108. pagination: null,
  109. page_size: 10,
  110. currentItem: null,
  111. drawer: false,
  112. direction: 'rtl',
  113. rules: {
  114. store_id: [{
  115. required: true,
  116. message: '请选择门店',
  117. trigger: 'blur'
  118. }, ],
  119. },
  120. levels: [],
  121. add: true,
  122. origin_level: '',
  123. user: {
  124. keyword: ''
  125. },
  126. lng_lat: '',
  127. page: 1,
  128. custom_text: '',
  129. dialogVisibleAssociation: false,
  130. dialogVisibleAssociationAdd: false,
  131. gridData:[],
  132. gridDataGoodsList:[],
  133. multipleSelection: [2096],
  134. searchGoodsData: {
  135. keyword: '',
  136. },
  137. checkedList:[],
  138. paginationAdd: null,
  139. user_id:'',
  140. selectedGoodsIds:[],
  141. },
  142. computed: {
  143. },
  144. mounted() {
  145. this.loadData();
  146. },
  147. methods: {
  148. loadData() {
  149. this.loading = true;
  150. let params = {
  151. r: 'happiness/store-clerk/index',
  152. page: this.page,
  153. };
  154. params = Object.assign(params, this.searchData);
  155. request({
  156. params: params,
  157. method: 'get',
  158. }).then(e => {
  159. this.loading = false;
  160. if (e.data.code == 0) {
  161. this.list = e.data.data.list;
  162. this.pagination = e.data.data.pagination;
  163. this.page_size = e.data.data.page_size;
  164. } else {
  165. this.$message.error(e.data.msg);
  166. }
  167. }).catch(e => {
  168. this.loading = false;
  169. });
  170. },
  171. searchs() {
  172. this.page = 1;
  173. this.loadData();
  174. },
  175. pageChange(page) {
  176. this.page = page;
  177. this.loadData();
  178. },
  179. onDelete(item, index) {
  180. this.$confirm(`您是否真的要移除该核销员, 是否继续?`, '删除提醒', {
  181. type: 'warning'
  182. }).then(() => {
  183. this.btnLoading = false;
  184. request({
  185. params: {
  186. r: 'happiness/store-clerk/delete'
  187. },
  188. method: 'post',
  189. data: {
  190. id: item.id,
  191. }
  192. }).then(e => {
  193. this.btnLoading = false;
  194. if (e.data.code == 0) {
  195. // this.list.splice(index, 1)
  196. this.$message.success(e.data.msg);
  197. this.loadData();
  198. } else {
  199. this.$message.error(e.data.msg);
  200. }
  201. }).catch(e => {
  202. this.btnLoading = false;
  203. });
  204. })
  205. },
  206. submitForm(formName) {
  207. let _this = this;
  208. this.$refs[formName].validate((valid) => {
  209. if (valid) {
  210. if (_this.form.user_id == '') {
  211. this.$message.error('请选择用户');
  212. return true;
  213. }
  214. _this.btnLoading = true;
  215. request({
  216. params: {
  217. r: 'happiness/store-clerk/edit'
  218. },
  219. method: 'post',
  220. data: _this.form
  221. }).then(e => {
  222. _this.btnLoading = false
  223. if (e.data.code == 0) {
  224. _this.drawer = false
  225. _this.$message.success(e.data.msg)
  226. this.page = 1;
  227. _this.loadData()
  228. } else {
  229. _this.$message.error(e.data.msg);
  230. }
  231. }).catch(e => {
  232. _this.$message.error(e.data.msg);
  233. _this.btnLoading = false;
  234. });
  235. } else {
  236. console.log('error submit!!');
  237. return false;
  238. }
  239. });
  240. },
  241. addUser(add) {
  242. this.form = {
  243. id: '',
  244. mobile: '',
  245. user_id: '',
  246. store_id: '',
  247. };
  248. this.store_data = [];
  249. this.add = add
  250. this.drawer = true
  251. // this.getLevels()
  252. },
  253. editUser(val) {
  254. this.form = {
  255. id: val.id,
  256. mobile: val.user.mobile,
  257. user_id: val.user_id,
  258. store_id: val.store_id,
  259. };
  260. this.store_data = val.store;
  261. this.drawer = true
  262. },
  263. handleClose(done) {
  264. this.drawer = false
  265. done()
  266. },
  267. querySearchAsync(queryString, cb) {
  268. this.user.keyword = queryString;
  269. this.getUser(cb);
  270. },
  271. getUser(cb) {
  272. request({
  273. params: {
  274. r: 'happiness/store-clerk/search-user',
  275. keyword: this.user.keyword
  276. }
  277. }).then(res => {
  278. if (res.data.code == 0) {
  279. cb(res.data.data.list)
  280. } else {
  281. this.$message.error(res.data.msg);
  282. }
  283. });
  284. },
  285. agentClick(row) {
  286. this.form.user_id = row.id
  287. this.form.mobile = row.mobile
  288. // this.handleBlur();
  289. },
  290. storeSelect(params) {
  291. // console.log(params);
  292. this.form.store_id = params.id;
  293. this.store_data = params;
  294. },
  295. selectedImg(e, key) {
  296. this.form[key] = e[0].url;
  297. },
  298. delPic(key) {
  299. this.form[key] = '';
  300. },
  301. mapEvent(e) {
  302. this.form.longitude = e.long;
  303. this.form.latitude = e.lat;
  304. this.form.address = e.address;
  305. this.lng_lat = e.lat + '-' + e.long;
  306. },
  307. handleSelectionChange(val) {
  308. this.multipleSelection = val;
  309. },
  310. handleBlur(){
  311. request({
  312. params: {
  313. r: 'happiness/store-clerk/check-staff-user',
  314. user_id: this.form.user_id
  315. }
  316. }).then(res => {
  317. if (res.data.code == 0) {
  318. this.form = res.data.data.user;
  319. this.form.gender = this.form.gender.toString();
  320. this.lng_lat = res.data.data.user.longitude+'-'+res.data.data.user.latitude;
  321. } else {
  322. this.$message.error(res.data.msg);
  323. }
  324. });
  325. }
  326. }
  327. });
  328. </script>
  329. <style>
  330. .el-tabs__header {
  331. font-size: 16px;
  332. }
  333. .table-body {
  334. padding: 20px;
  335. background-color: #fff;
  336. }
  337. .table-body .el-button {
  338. padding: 0 !important;
  339. border: 0;
  340. margin: 0 5px;
  341. }
  342. .input-item {
  343. width: 250px;
  344. margin: 0 0 20px;
  345. display: inline-block;
  346. }
  347. /*.input-item .el-input__inner {*/
  348. /* border-right: 0;*/
  349. /*}*/
  350. .input-item .el-input__inner:hover {
  351. border: 1px solid #dcdfe6;
  352. /*border-right: 0;*/
  353. outline: 0;
  354. }
  355. .input-item .el-input__inner:focus {
  356. border: 1px solid #dcdfe6;
  357. /*border-right: 0;*/
  358. outline: 0;
  359. }
  360. .input-item .el-input-group__append {
  361. background-color: #fff;
  362. border-left: 0;
  363. width: 10%;
  364. padding: 0;
  365. }
  366. .input-item .el-input-group__append .el-button {
  367. padding: 0;
  368. }
  369. .input-item .el-input-group__append .el-button {
  370. margin: 0;
  371. }
  372. .batch {
  373. margin: 0 0 20px;
  374. display: inline-block;
  375. }
  376. .batch .el-button {
  377. padding: 9px 15px !important;
  378. }
  379. .el-table th>.cell{
  380. color: #333;
  381. font-weight: bold;
  382. font-size: 14px;
  383. }
  384. .el-table__footer-wrapper, .el-table__header-wrapper{
  385. border-bottom: 1.4px solid #D6D6D6;
  386. }
  387. .el-table th>.cell {
  388. color: #333;
  389. font-weight: bold;
  390. font-size: 14px;
  391. }
  392. .table1 .el-table__footer-wrapper,
  393. .table1 .el-table__header-wrapper {
  394. border-bottom: 1.4px solid #D6D6D6;
  395. }
  396. .user_img{
  397. position: relative;
  398. margin-right: 8px;
  399. /* height: 50px;
  400. width: 50px; */
  401. }
  402. .default-avatar{
  403. width: 50px;
  404. height: 50px;
  405. border-radius: 50%;
  406. margin-right: 8px;
  407. }
  408. .uer-nickname {
  409. flex: 1;
  410. }
  411. .v-modal {
  412. z-index: 200 !important;
  413. }
  414. .add-image-btn {
  415. width: 100px;
  416. height: 100px;
  417. color: #419EFB;
  418. border: 1px solid #e2e2e2;
  419. cursor: pointer;
  420. }
  421. .del-btn {
  422. position: absolute;
  423. right: -14px;
  424. top: -14px;
  425. }
  426. .width-300 {
  427. max-width: 320px;
  428. }
  429. .card-covers {
  430. display: grid;
  431. grid-template-columns: repeat(3, 1fr);
  432. grid-gap: 10px;
  433. grid-auto-rows: minmax(100px, auto);
  434. grid-auto-flow: dense;
  435. }
  436. </style>