open-list.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('group-list-search', dirname(__DIR__) . '/components');
  4. ?>
  5. <style>
  6. .el-table th>.cell {
  7. color: #333;
  8. font-weight: bold;
  9. font-size: 14px;
  10. }
  11. .el-table__footer-wrapper,
  12. .el-table__header-wrapper {
  13. border-bottom: 1.4px solid #D6D6D6;
  14. }
  15. .default-avatar{
  16. width: 50px;
  17. height: 50px;
  18. border-radius: 50%;
  19. }
  20. .user_img{
  21. position: relative;
  22. margin-right: 8px;
  23. height: 50px;
  24. width: 50px;
  25. }
  26. </style>
  27. <!-- 这个是定金预售列表 -->
  28. <div id="app">
  29. <el-card class="box-card">
  30. <div slot="header" class="clearfix">
  31. <span>开团列表</span>
  32. </div>
  33. <com-search @search="toSearch" @download="download" :is-show-order-type="true" :is-show-order-plugin="true">
  34. </com-search>
  35. </el-card>
  36. <div class="table-body">
  37. <template>
  38. <el-table
  39. v-loading="listLoading"
  40. :data="list"
  41. stripe
  42. style="width: 100%">
  43. <el-table-column
  44. fixed
  45. label="开团id"
  46. prop="id"
  47. show-overflow-tooltip
  48. min-width="100"
  49. align="center">
  50. </el-table-column>
  51. <el-table-column label="团长" min-width="150">
  52. <template slot-scope="scope">
  53. <div class="user_img">
  54. <image style="width: 50px;height: 50px; border-radius: 50%;" :src="scope.row.user.avatar_url? scope.row.user.avatar_url:'resources/img/mall/default_avatar_url.png'"></image>
  55. </div>
  56. <div>
  57. <div style="color:#000;">{{scope.row.user.nickname}}</div>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="手机号" width="120" align="center">
  62. <template slot-scope="scope">
  63. <div flex="cross:top cross:center">
  64. {{scope.row.user.mobile}}
  65. </div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="开团时间" width="200" align="center">
  69. <template slot-scope="scope">
  70. <span> {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="成团时间" width="200" align="center">
  74. <template slot-scope="scope">
  75. <span >{{scope.row.win_time|dateTimeFormat('Y-m-d H:i:s')}}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="实际参团人数" width="120" align="center">
  79. <template slot-scope="scope">
  80. <!-- <span> {{scope.row.groupBuyActive.group_size - scope.row.groupBuyActive.virtual_group_size}}</span>-->
  81. <span> {{scope.row.counts}}</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="虚拟定金预售人数" width="120" align="center">
  85. <template slot-scope="scope">
  86. <span> {{scope.row.groupBuyActive.virtual_group_size}}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="order_status" label="定金预售状态" min-width="120" align="center">
  90. <template slot-scope="scope">
  91. <el-tag effect="dark" type="info" v-if="scope.row.order_status==0">待支付</el-tag>
  92. <el-tag effect="dark" type="" v-if="scope.row.order_status==1">参团中</el-tag>
  93. <el-tag effect="dark" type="success" v-if="scope.row.order_status==2">定金预售成功</el-tag>
  94. <el-tag effect="dark" type="warning" v-if="scope.row.order_status==3">定金预售失败</el-tag>
  95. <el-tag effect="dark" type="danger" v-if="scope.row.order_status==4">已关闭</el-tag>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="操作" min-width="260" align="center">
  99. <template slot-scope="scope">
  100. <el-button v-if="scope.row.order_status==1||scope.row.order_status==2" @click="groupMemberList(scope.row)" type="text" size="small">定金预售成员</el-button>
  101. <el-button v-if="scope.row.groupBuyActive.is_virtual==1&&scope.row.order_status==1" @click="finish(scope.row)" type="text" size="small">结束定金预售</el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <div flex="main:right cross:center" style="margin-top: 20px;">
  106. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  107. style="display: inline-block;float: right;" background @current-change="pageChange"
  108. layout="prev, pager, next" :total="pagination.totalCount">
  109. </el-pagination>
  110. </div>
  111. </template>
  112. </div>
  113. <!-- 定金预售成员列表弹窗组件 -->
  114. <el-dialog title="定金预售成员" :visible.sync="dialogFormVisible">
  115. <el-table :data="memberList" v-loading="dialogLoading">
  116. <el-table-column label="用户头像" width="150" align="center">
  117. <template slot-scope="scope">
  118. <div class="user_img">
  119. <image style="width: 50px;height: 50px; border-radius: 50%;" :src="scope.row.user.avatar_url? scope.row.user.avatar_url:'resources/img/mall/default_avatar_url.png'"></image>
  120. </div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column property="user.nickname" label="昵称" width="100" align="center"></el-table-column>
  124. <el-table-column property="is_creator" label="角色" width="80" align="center">
  125. <template slot-scope="scope">
  126. <span v-html="scope.row.is_commander=='1'?'团长':'团员'"></span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column property="total_price" label="订单金额" width="100" align="center">
  130. <template slot-scope="scope">
  131. <span>¥{{scope.row.deposit_presale_price*scope.row.num}}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="状态" width="100" align="center">
  135. <template slot-scope="scope">
  136. <el-tag effect="dark" type="info" v-if="scope.row.order_status==0">待支付</el-tag>
  137. <el-tag effect="dark" type="" v-if="scope.row.order_status==1">参团中</el-tag>
  138. <el-tag effect="dark" type="success" v-if="scope.row.order_status==2">定金预售成功</el-tag>
  139. <el-tag effect="dark" type="warning" v-if="scope.row.order_status==3">定金预售失败</el-tag>
  140. <el-tag effect="dark" type="danger" v-if="scope.row.order_status==4">已关闭</el-tag>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="下单时间" width="150" align="center">
  144. <template slot-scope="scope">
  145. <span> {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column property="order_id" label="操作" align="center">
  149. <template slot-scope="scope">
  150. <el-button v-if="scope.row.order_status==2" @click="toOrderDetail(scope.row.order_id)" type="text" size="small">订单详情</el-button>
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. </el-dialog>
  155. </div>
  156. <script>
  157. const app = new Vue({
  158. el: '#app',
  159. data() {
  160. return {
  161. listLoading:false,
  162. list: [],
  163. pagination: {total: 0},
  164. loading: false,
  165. dialogLoading:false,
  166. deposit_presale_active_id : '', //定金预售活动id
  167. pageCount: 0, //总的页面数
  168. current_page: 1, //默认显示第一页
  169. search : {}, //这个是搜索来的字段
  170. memberList: [],
  171. dialogFormVisible: false,
  172. }
  173. },
  174. methods: {
  175. // 0.1 点击搜索--这个也是要发请求
  176. toSearch(e){
  177. console.log('e==',e);
  178. let searchData = e;
  179. let others = {deposit_presale_active_id : this.deposit_presale_active_id}
  180. let search={};
  181. searchData.nickname?search['nickname']=searchData.nickname:'';
  182. searchData.begin_time?search['begin_time']=searchData.begin_time:'';
  183. searchData.end_time?search['end_time']=searchData.end_time:'';
  184. searchData.order_status=="选择定金预售状态"?'':search['order_status']=searchData.order_status;
  185. this.current_page = 1;
  186. this.search = search;
  187. this.loadData(this.current_page,others,search);
  188. },
  189. download(e){
  190. let searchData = e;
  191. let others = {deposit_presale_active_id : this.deposit_presale_active_id}
  192. // 创建一个search请求对象--可以用es6方法const {a1,b1} = a; const b ={a1,b1}
  193. let search={};
  194. searchData.nickname?search['nickname']=searchData.nickname:'';
  195. searchData.begin_time?search['begin_time']=searchData.begin_time:'';
  196. searchData.end_time?search['end_time']=searchData.end_time:'';
  197. searchData.status=="选择定金预售状态"?'':search['status']=searchData.status;
  198. this.search = search;
  199. this.toDownload(others,search);
  200. },
  201. toDownload(others,search) {
  202. request({
  203. params: {
  204. r: 'deposit-presale/default/open-list',
  205. ...others,
  206. ...search
  207. },
  208. method: 'GET',
  209. }).then(e => {
  210. let res = e.data;
  211. if (res.code == 0) {
  212. console.log(res.data.url);
  213. window.open(res.data.url, '_blank').location;
  214. }else{
  215. this.$message.error(res.msg);
  216. }
  217. }).catch(e => {
  218. });
  219. },
  220. // 页面跳转
  221. toPageAdd() {
  222. navigateTo({
  223. r: 'plugin/deposit_presale/mall/index/add',
  224. })
  225. },
  226. // 跳转定金预售订单列表
  227. toOrderList() {
  228. navigateTo({
  229. r: 'plugin/deposit_presale/mall/order/list',
  230. })
  231. },
  232. // 跳转定金预售订单列表
  233. toGroupList(){
  234. navigateTo({
  235. r: 'plugin/deposit_presale/mall/group/list',
  236. })
  237. },
  238. // 跳转到订单详情
  239. toOrderDetail(order_id){
  240. navigateTo({
  241. r: 'mall/order/detail',
  242. id:order_id, //直接跳转到订单详情页,但是要确保获取时字段统一
  243. })
  244. },
  245. //页面数变化,获取新的数据--获取到页面数,发请求就完事了
  246. changePagination(e) {
  247. console.log(e);
  248. this.current_page = e; //当前页
  249. let others = {deposit_presale_active_id : this.deposit_presale_active_id}
  250. this.loadData(this.current_page,others,this.search);
  251. },
  252. // 结束该团
  253. finish(row) {
  254. this.loading = true;
  255. request({
  256. params: {
  257. r: 'deposit-presale/default/finish',
  258. open_group_id: row.id
  259. },
  260. method: 'get',
  261. }).then(e => {
  262. let res = e.data;
  263. this.listLoading = false;
  264. if (res.code === 0) {
  265. let others = {deposit_presale_active_id : this.deposit_presale_active_id}
  266. this.loadData(this.current_page,others,this.search);
  267. this.$message.success(res.msg);
  268. } else {
  269. this.$message.error(res.msg);
  270. }
  271. }).catch(e => {
  272. });
  273. },
  274. // 请求获取数据--获取活动的开团列表
  275. loadData(page,others,search) {
  276. this.listLoading = true;
  277. request({
  278. params: {
  279. r: 'deposit-presale/default/open-list',
  280. page: page,
  281. ...others,
  282. ...search
  283. },
  284. method: 'get',
  285. }).then(e => {
  286. let res = e.data;
  287. this.listLoading = false;
  288. if (res.code === 0) {
  289. this.list = res.data.list;
  290. this.pageCount = res.data.pagination.page_count; //返回了总的页面数
  291. this.pagination = res.data.pagination; //拿到关于页码页容量的数据
  292. } else {
  293. this.$message.error(res.msg);
  294. }
  295. }).catch(e => {
  296. });
  297. },
  298. // 获取该团下的定金预售成员列表
  299. groupMemberList(row) {
  300. this.dialogFormVisible = true;
  301. this.dialogLoading = true;
  302. request({
  303. params: {
  304. r: 'deposit-presale/default/deposit-presale-team',
  305. open_group_id : row.open_group_id,
  306. deposit_presale_active_id : row.deposit_presale_active_id,
  307. commander_id : row.commander_id,
  308. },
  309. method: 'get',
  310. }).then(e => {
  311. let res = e.data;
  312. this.dialogLoading = false;
  313. if (res.code === 0) {
  314. this.memberList = res.data.list;
  315. } else {
  316. this.$message.error(res.msg);
  317. }
  318. }).catch(e => {
  319. });
  320. },
  321. pageChange(page) {
  322. let others = {deposit_presale_active_id : this.deposit_presale_active_id}
  323. this.loadData(page,others,this.search);
  324. },
  325. formatStatus: function (row) {
  326. switch (row.status) {
  327. case '0':
  328. return '全部';
  329. case '1':
  330. return '开团中';
  331. case '2':
  332. return '已结束';
  333. default:
  334. return '未知';
  335. }
  336. },
  337. },
  338. // 加载的时候获取到列表页
  339. created(){
  340. // 获取到活动id
  341. if(getQuery('deposit_presale_active_id')){
  342. this.deposit_presale_active_id = getQuery('deposit_presale_active_id');
  343. }
  344. },
  345. mounted(){
  346. // 数据初始化
  347. this.current_page = 1;
  348. this.pageCount = 0;
  349. // 默认是拿到对应定金预售id下的列表数据
  350. let others = {deposit_presale_active_id : this.deposit_presale_active_id}
  351. this.loadData(this.current_page,others,this.search);
  352. },
  353. })
  354. </script>