index.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('group-edit', dirname(__DIR__) . '/components');
  4. ?>
  5. <div id="app" v-cloak>
  6. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  7. <div slot="header">
  8. <div>
  9. <span>团长列表</span>
  10. <div style="float: right;margin: -5px 10px;">
  11. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="editClick">添加团长
  12. </el-button>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="table-body">
  17. <el-form size="small" :inline="true" flex="dir:left cross:center" style="margin-bottom: 20px;">
  18. <div class="item-box" flex="dir:left cross:center">
  19. <div style="margin-right: 5px; margin-left: 25px;">会员 ID</div>
  20. <el-input size="small" style="width: 200px" v-model="searchData.user_id" placeholder="请输入会员ID"></el-input>
  21. </div>
  22. <div class="item-box" flex="dir:left cross:center">
  23. <div style="margin-right: 5px; margin-left: 25px;">会员昵称</div>
  24. <el-input size="small" style="width: 200px" v-model="searchData.user_keyword" placeholder="请输入用户昵称 / 手机号"></el-input>
  25. </div>
  26. <div class="item-box" flex="dir:left cross:center">
  27. <div style="margin-right: 5px; margin-left: 25px;">创建时间</div>
  28. <el-date-picker @change="selectedDateTime" size="small" v-model="date" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  29. </el-date-picker>
  30. </div>
  31. <div class="item-box" flex="dir:left cross:center">
  32. <el-button size="small" type="primary" style="padding: 9px 15px !important;margin-right: 5px; margin-left: 25px;" @click="search">搜索
  33. </el-button>
  34. </div>
  35. <div class="item-box" flex="dir:left cross:center">
  36. <el-button size="small" type="warning" v-if="searchData.user_id || searchData.user_keyword || searchData.start_time || searchData.end_time" @click="resetForm">清除搜索条件
  37. </el-button>
  38. </div>
  39. </el-form>
  40. <el-table class="table-info" :data="form" stripe style="width: 100%" v-loading="listLoading">
  41. <el-table-column prop="user_id" label="会员ID" width="160" align="center"></el-table-column>
  42. <el-table-column label="会员" width="180">
  43. <!-- <template slot-scope="scope">
  44. <div style="display: flex;align-items: center;">
  45. <com-image style="margin-right: 5px;display: block;flex-shrink: 0;border-radius:5px" mode="aspectFill" :src="scope.row.avatar_url ? scope.row.avatar_url : ''"></com-image>
  46. <div v-if="scope.row" style="line-height: 18px;">
  47. <div>昵称:{{scope.row.nickname}}</div>
  48. <div>ID:{{scope.row.user_id}}</div>
  49. </div>
  50. </div>
  51. </template> -->
  52. <template slot-scope="scope">
  53. <div style="display: flex;align-items: center;">
  54. <com-image style="margin-right: 5px;display: block;flex-shrink: 0;border-radius:80px;overflow: hidden;" mode="aspectFill" :src="scope.row.avatar_url"></com-image>
  55. <div style="line-height: 18px;">
  56. <div>昵称:{{scope.row.nickname}}</div>
  57. <!-- <div v-else>{{scope.row.parent_mobile}}</div> -->
  58. <div>ID:{{scope.row.user_id}}</div>
  59. </div>
  60. </div>
  61. <div style="display: flex;align-items: center;" v-else align="center">--</div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="mobile" label="联系电话" width="120" align="center">
  65. <template slot-scope="scope">{{scope.row.mobile ? scope.row.mobile :'--'}}</template>
  66. </el-table-column>
  67. <el-table-column label="上级推荐人" width="180">
  68. <template slot-scope="scope">
  69. <div style="display: flex;align-items: center;" v-if="scope.row.parent_id">
  70. <com-image style="margin-right: 5px;display: block;flex-shrink: 0;border-radius:80px;overflow: hidden;" mode="aspectFill" :src="scope.row.parent_avatar_url"></com-image>
  71. <div style="line-height: 18px;">
  72. <div>昵称:{{scope.row.parent_nickname}}</div>
  73. <!-- <div v-else>{{scope.row.parent_mobile}}</div> -->
  74. <div>ID:{{scope.row.parent_id}}</div>
  75. </div>
  76. </div>
  77. <div style="display: flex;align-items: center;" v-else align="center">--</div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="" label="拼团等级" width="120" align="center">
  81. <template slot-scope="scope">
  82. <el-tag v-if="scope.row.level_name">{{scope.row.level_name}}</el-tag>
  83. <el-tag v-else-if="scope.row.level == 0">普通用户</el-tag>
  84. <el-tag v-else>游客</el-tag>
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="has_attend_times" label="已参团次数" width="120" align="center">
  88. </el-table-column>
  89. <el-table-column prop="attend_times" label="剩余参团次数" width="120" align="center">
  90. <template slot-scope="scope">
  91. {{scope.row.attend_times}}
  92. </template>
  93. </el-table-column>
  94. <el-table-column prop="win_num" label="拼中次数" width="120" align="center">
  95. </el-table-column>
  96. <el-table-column prop="score" label="加入时间" width="160px" align="center">
  97. <template slot-scope="scope">
  98. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="操作" align="center">
  102. <template slot-scope="scope">
  103. <el-button type="text" size="mini" circle style="margin-left: 10px;margin-top: 10px" @click="handleIntegral(scope.row)">增加参团次数</el-button>
  104. <el-button type="text" size="mini" circle style="margin-left: 10px;margin-top: 10px" @click.native="editLevel(scope.row)">修改等级</el-button>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <div style="text-align: right;margin: 20px 0;">
  109. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  110. </div>
  111. </div>
  112. <!-- 增加参团次数 -->
  113. <el-dialog title="增加参团次数" :visible.sync="dialogIntegral" width="30%">
  114. <el-form :model="integralForm" label-width="110px" :rules="integralFormRules" ref="integralForm">
  115. <el-form-item label="会员" prop="type">
  116. <com-image mode="aspectFill" style="float: left;margin-right: 8px" :src="integralForm.avatar_url"></com-image>
  117. <div>{{integralForm.nickname}}(id:{{integralForm.user_id}})</div>
  118. </el-form-item>
  119. <el-form-item label="增加参团次数" prop="num" size="small">
  120. <el-input oninput="this.value = this.value.replace(/[^-0-9]/g, '');" v-model="integralForm.num" :max="999999999" style="width: 80%;"></el-input> 次
  121. </el-form-item>
  122. </el-form>
  123. <div slot="footer" class="dialog-footer">
  124. <el-button @click="dialogIntegral = false">取消</el-button>
  125. <el-button :loading="btnLoading" type="primary" @click="integralSubmit">确定</el-button>
  126. </div>
  127. </el-dialog>
  128. <!-- 修改等级 -->
  129. <el-dialog :visible.sync="level.show" width="20%" title="修改拼团等级">
  130. <div v-loading="edit.loading">
  131. <el-form size="small" label-width="150px">
  132. <el-form-item label="等级名称">
  133. <el-select size="small" v-model="level.current_level" class="select">
  134. <el-option :key="index" :label="item.name" :value="item.level"
  135. v-for="(item, index) in level_list"></el-option>
  136. </el-select>
  137. </el-form-item>
  138. </el-form>
  139. </div>
  140. <span slot="footer" class="dialog-footer">
  141. <el-button @click="level.show = false" type="default" size="small">取消</el-button>
  142. <el-button type="primary" :loading="edit.btnLoading" style="margin-bottom: 10px;" size="small" @click="editLevelSubmit">保存</el-button>
  143. </span>
  144. </el-dialog>
  145. </el-card>
  146. <group-edit v-model="edit.show"></group-edit>
  147. </div>
  148. <script>
  149. const app = new Vue({
  150. el: '#app',
  151. data() {
  152. return {
  153. level_list:{},
  154. searchData: {
  155. user_id:'',
  156. user_keyword:'',
  157. start_time:'',
  158. end_time:''
  159. },
  160. date: [],
  161. form: [],
  162. member: [],
  163. pageCount: 0,
  164. page: 1,
  165. member_page: 1,
  166. currentPage: null,
  167. listLoading: false,
  168. btnLoading: false,
  169. // 导出
  170. exportList: [],
  171. //积分
  172. dialogIntegral: false,
  173. integralForm: {
  174. type: '1',
  175. num: '',
  176. pic_url: '',
  177. remark: '',
  178. user_id: '',
  179. },
  180. integralFormRules: {
  181. type: [{
  182. required: true,
  183. message: '操作不能为空',
  184. trigger: 'blur'
  185. }, ],
  186. num: [{
  187. required: true,
  188. message: '参团次数不能为空',
  189. trigger: 'blur'
  190. }, ],
  191. },
  192. edit: {
  193. show: false,
  194. },
  195. level: {
  196. show: false,
  197. group_user: null,
  198. current_level:null
  199. },
  200. };
  201. },
  202. methods: {
  203. openId(index) {
  204. let item = this.form;
  205. item[index].is_open_id = !item[index].is_open_id;
  206. this.form = JSON.parse(JSON.stringify(this.form));
  207. },
  208. //积分
  209. integralPicUrl(e) {
  210. if (e.length) {
  211. this.integralForm.pic_url = e[0].url;
  212. }
  213. },
  214. handleIntegral(row) {
  215. console.log(row);
  216. this.integralForm = Object.assign(this.integralForm, {
  217. user_id: row.user_id,
  218. nickname: row.nickname,
  219. avatar_url: row.avatar_url
  220. });
  221. this.dialogIntegral = true;
  222. },
  223. integralSubmit() {
  224. this.$refs.integralForm.validate((valid) => {
  225. if (valid) {
  226. let para = Object.assign({}, this.integralForm);
  227. this.btnLoading = true;
  228. request({
  229. params: {
  230. r: 'lucky-group/group-team/add-attend-times',
  231. },
  232. method: 'post',
  233. data: para,
  234. }).then(e => {
  235. if (e.data.code === 0) {
  236. // console.log(e.data);
  237. this.$message.success(e.data.msg);
  238. location.reload();
  239. this.dialogIntegral = false;
  240. } else {
  241. this.$message.error(e.data.msg);
  242. }
  243. this.btnLoading = false;
  244. }).catch(e => {
  245. this.btnLoading = false;
  246. });
  247. }
  248. });
  249. },
  250. editLevel(row) {
  251. this.level.show = true;
  252. this.level.group_user = row;
  253. this.level.current_level = row.level;
  254. },
  255. editLevelSubmit(){
  256. request({
  257. params: {
  258. r: 'lucky-group/group-team/edit-level',
  259. },
  260. method: 'post',
  261. data: {
  262. id:this.level.group_user.id,
  263. level:this.level.current_level
  264. },
  265. }).then(e => {
  266. if (e.data.code === 0) {
  267. // console.log(e.data);
  268. this.$message.success(e.data.msg);
  269. location.reload();
  270. this.dialogIntegral = false;
  271. } else {
  272. this.$message.error(e.data.msg);
  273. }
  274. this.btnLoading = false;
  275. }).catch(e => {
  276. this.btnLoading = false;
  277. });
  278. },
  279. //搜索
  280. search() {
  281. this.page = 1;
  282. this.getList();
  283. },
  284. pagination(currentPage) {
  285. this.page = currentPage;
  286. this.getList();
  287. },
  288. getList() {
  289. this.listLoading = true;
  290. request({
  291. params: {
  292. r: 'lucky-group/group-team/index',
  293. page: this.page,
  294. pagesize:10 ,
  295. ...this.searchData,
  296. },
  297. }).then(e => {
  298. if (e.data.code === 0) {
  299. this.form = e.data.data.list;
  300. this.pageCount = e.data.data.page_count;
  301. this.currentPage = e.data.data.pagination.current_page;
  302. this.exportList = e.data.data.exportList;
  303. this.mall_members = e.data.data.mall_members;
  304. this.level_list = e.data.data.level_list;
  305. } else {
  306. this.$message.error(e.data.msg);
  307. }
  308. this.listLoading = false;
  309. }).catch(e => {
  310. this.listLoading = false;
  311. });
  312. },
  313. // 时间搜索触发
  314. selectedDateTime(e) {
  315. console.log(e);
  316. if (e != null) {
  317. this.searchData.start_time = e[0];
  318. this.searchData.end_time = e[1];
  319. } else {
  320. this.searchData.start_time = '';
  321. this.searchData.end_time = '';
  322. this.date = [];
  323. }
  324. this.search();
  325. },
  326. //重置
  327. resetForm() {
  328. this.searchData.user_id = '';
  329. this.searchData.user_keyword = '';
  330. this.searchData.start_time = '';
  331. this.searchData.end_time = '';
  332. this.date = [];
  333. this.search();
  334. },
  335. editClick() {
  336. this.edit.show = true;
  337. },
  338. },
  339. mounted: function() {
  340. this.page = getQuery('page') ? getQuery('page') : 1;
  341. this.getList();
  342. }
  343. });
  344. </script>
  345. <style>
  346. .table-body {
  347. padding: 20px;
  348. background-color: #fff;
  349. }
  350. /* .table-info .el-button {
  351. padding: 0 !important;
  352. border: 0;
  353. margin: 0 5px;
  354. } */
  355. .input-item {
  356. display: inline-block;
  357. width: 150px;
  358. margin: 0 15px 20px 0;
  359. }
  360. .input-item .el-input__inner {
  361. border-right: 1px solid #dcdfe6;
  362. }
  363. .input-item .el-input__inner:hover {
  364. border: 1px solid #dcdfe6;
  365. border-right: 0;
  366. outline: 0;
  367. }
  368. .input-item .el-input__inner:focus {
  369. border: 1px solid #dcdfe6;
  370. border-right: 0;
  371. outline: 0;
  372. }
  373. .input-item .el-input-group__append {
  374. background-color: #fff;
  375. border-left: 0;
  376. width: 10%;
  377. padding: 0;
  378. }
  379. .input-item .el-input-group__append .el-button {
  380. padding: 0;
  381. }
  382. .input-item .el-input-group__append .el-button {
  383. margin: 0;
  384. }
  385. .select {
  386. float: left;
  387. width: 100px;
  388. margin-right: 10px;
  389. }
  390. .el-table th>.cell {
  391. color: #333;
  392. font-weight: bold;
  393. font-size: 14px;
  394. }
  395. .el-table__footer-wrapper,
  396. .el-table__header-wrapper {
  397. border-bottom: 1.4px solid #D6D6D6;
  398. }
  399. </style>