index.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <style>
  2. .el-table th>.cell {
  3. color: #333;
  4. font-weight: bold;
  5. font-size: 14px;
  6. }
  7. .table1 .el-table__footer-wrapper,
  8. .table1 .el-table__header-wrapper {
  9. border-bottom: 1.4px solid #D6D6D6;
  10. }
  11. </style>
  12. <div id="app">
  13. <div class="table-body" style="min-width: 1000px;">
  14. <div slot="header" class="clearfix" style="height: 20px;">
  15. <span>活动列表</span>
  16. <el-button style="float: right; padding: 3px 12px;margin-left: 20px;height: 34px;font-size:14px;font-weight:normal;" type="primary" @click="toPageAdd">添加预售</el-button>
  17. </div>
  18. <div slot="header" class="clearfix" style="margin-top: 20px;">
  19. <div class="demo-input-suffix" style="margin-top: 20px;margin-bottom: 10px;">
  20. <el-input @keyup.enter.native="toSearchActivity" size="small" style="width:300px;margin-right: 20px;" placeholder="搜索商品名称" v-model="search.goods_name" clearable>
  21. </el-input>
  22. <el-button type="primary" size="small" @click="toSearchActivity">搜索</el-button>
  23. </div>
  24. <div style="padding:15px 0 15px 15px;background-color:#D6D6D6">
  25. <el-button :type="LoadDataType==-1?'primary':''" size="small" @click="getLoadData(-1)">全部({{statistics.all_activity_number}})</el-button>
  26. <el-button :type="LoadDataType==0?'primary':''" size="small" @click="getLoadData(0)">待开始({{statistics.not_start_activity_number}})</el-button>
  27. <el-button :type="LoadDataType==1?'primary':''" size="small" @click="getLoadData(1)">进行中({{statistics.doing_activity_number}})</el-button>
  28. <el-button :type="LoadDataType==2?'primary':''" size="small" @click="getLoadData(2)">已结束({{statistics.end_activity_number}})</el-button>
  29. </div>
  30. </div>
  31. <template>
  32. <el-table :data="list" stripe style="width: 100%" v-loading="listLoading" class="table1">
  33. <el-table-column prop="id" label="编号" width="100" align="center"></el-table-column>
  34. <el-table-column prop="presale_name" label="活动名称" width="100" align="center"></el-table-column>
  35. <el-table-column prop="goods.name,goods.cover_pic" label="商品信息" width="210">
  36. <template slot-scope="scope">
  37. <div flex="box:first cross:top cross:center" v-if="scope.row.goods">
  38. <div style="padding-right: 5px;">
  39. <com-image mode="aspectFill" :src="scope.row.goods.cover_pic"></com-image>
  40. </div>
  41. <div>
  42. {{scope.row.goods.goods_name}}
  43. </div>
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="start_at,end_at" label="预售时间" width="300" align="center">
  48. <template slot-scope="scope">
  49. <div>{{scope.row.deposit_start_at|dateTimeFormat('Y-m-d H:i:s')}} ~ {{scope.row.deposit_end_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="goods_stock" label="库存" align="center"></el-table-column>
  53. <el-table-column prop="cate_name" label="预售分类" align="center"></el-table-column>
  54. <el-table-column prop="deposit_price,presale_price" label="定金/尾款" width="300" align="center">
  55. <template slot-scope="scope">
  56. <div>
  57. <p>定金:{{scope.row.deposit_price}}</p>
  58. <p>尾款:{{(scope.row.presale_price - scope.row.deposit_price).toFixed(2)}}</p>
  59. </div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="presale_total" label="预定人数" align="center"></el-table-column>
  63. <el-table-column prop="group_status" label="状态" align="center">
  64. <template slot-scope="scope">
  65. <el-tag effect="dark" size="small" type="warning" v-if="scope.row.status == -1">已关闭</el-tag>
  66. <div v-else>
  67. <el-tag effect="dark" size="small" type="info" v-if="scope.row.group_status == 0">未开始</el-tag>
  68. <el-tag effect="dark" size="small" type="success" v-if="scope.row.group_status == 1">活动中</el-tag>
  69. <el-tag effect="dark" size="small" type="warning" v-if="scope.row.group_status == 2">已结束</el-tag>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="start_at,end_at" label="添加时间" width="150" align="center">
  74. <template slot-scope="scope">
  75. <div>{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="操作" width="200" align="center">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.status != -1">
  81. <!-- <el-button @click="toGroupList(scope.row.id)" type="text" size="mini">开团列表</el-button>-->
  82. <el-button @click="del(scope.row.id)" type="text" size="mini">关闭</el-button> |
  83. </span>
  84. <el-button @click="toDetail(scope.row.id)" type="text" size="mini">详情</el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <div flex="main:right cross:center" style="margin-top: 20px;">
  89. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize" style="display: inline-block;float: right;" background @current-change="pageChange" layout="prev, pager, next" :total="pagination.totalCount">
  90. </el-pagination>
  91. </div>
  92. </template>
  93. </div>
  94. </div>
  95. <script>
  96. const app = new Vue({
  97. el: '#app',
  98. data() {
  99. return {
  100. listLoading: false,
  101. list: [],
  102. pagination: {
  103. total: 0
  104. },
  105. loading: false,
  106. LoadDataType: -1, //默认显示全部数据
  107. dialogFormVisible: false, //默认不显示弹窗
  108. deposit_presale_attr_list: [],
  109. goodsDetail: {},
  110. dialogLoading: false,
  111. search: {
  112. goods_name: '',
  113. group_status: -1,
  114. page: 1,
  115. },
  116. commander_level_limit_text: '',
  117. user_level_limit_text: '',
  118. statistics: {
  119. all_activity_number: 0,
  120. doing_activity_number: 0,
  121. not_start_activity_number: 0,
  122. end_activity_number: 0,
  123. },
  124. }
  125. },
  126. methods: {
  127. // 页面跳转
  128. toPageAdd() {
  129. navigateTo({
  130. r: 'deposit-presale/default/add',
  131. })
  132. },
  133. toDetail(id) {
  134. navigateTo({
  135. r: 'deposit-presale/default/add',
  136. activity_id: id
  137. })
  138. },
  139. // 跳转到当前商品活动的开团列表
  140. toGroupList(id) {
  141. navigateTo({
  142. r: 'deposit-presale/default/open-list',
  143. deposit_presale_active_id: id
  144. })
  145. },
  146. //状态按钮的点击事件
  147. getLoadData(e) {
  148. this.search.group_status = e;
  149. this.loadData()
  150. this.LoadDataType = e;
  151. },
  152. toSearchActivity() {
  153. this.loadData()
  154. },
  155. // 查看商品详情
  156. groupGoodsDetail(id) {
  157. this.dialogFormVisible = true;
  158. this.dialogLoading = true;
  159. request({
  160. params: {
  161. r: 'deposit-presale/default/detail',
  162. id: id,
  163. },
  164. method: 'GET',
  165. }).then(e => {
  166. let res = e.data;
  167. this.dialogLoading = false;
  168. if (res.code === 0) {
  169. this.deposit_presale_attr_list = res.data.list;
  170. this.commander_level_limit_text = res.data.commander_level_limit_text;
  171. this.user_level_limit_text = res.data.user_level_limit_text;
  172. } else {
  173. this.$message.error(res.msg);
  174. }
  175. }).catch(e => {});
  176. },
  177. // 删除定金预售商品
  178. del(id) {
  179. this.$confirm('此操作将删除该定金预售商品, 是否继续?', '提示', {
  180. confirmButtonText: '确定',
  181. cancelButtonText: '取消',
  182. type: 'warning'
  183. }).then(() => {
  184. this.delGroupGoods(id);
  185. }).catch(() => {
  186. this.$message({
  187. type: 'info',
  188. message: '已取消删除'
  189. });
  190. });
  191. },
  192. pageChange(page) {
  193. this.search.page = page;
  194. this.loadData();
  195. },
  196. delGroupGoods(id) {
  197. this.loading = true;
  198. request({
  199. params: {
  200. r: 'deposit-presale/default/del',
  201. id: id
  202. },
  203. method: 'get',
  204. }).then(e => {
  205. let res = e.data;
  206. this.listLoading = false;
  207. if (res.code === 0) {
  208. this.$message.success(res.msg);
  209. this.loadData();
  210. } else {
  211. this.$message.error(res.msg);
  212. }
  213. }).catch(e => {});
  214. },
  215. // 请求获取数据--获取定金预售商品列表
  216. loadData() {
  217. this.listLoading = true;
  218. let params = {
  219. r: 'deposit-presale/default/index'
  220. };
  221. params = Object.assign(params, this.search);
  222. request({
  223. params: params,
  224. method: 'get',
  225. }).then(e => {
  226. let res = e.data;
  227. this.listLoading = false;
  228. if (res.code === 0) {
  229. this.list = res.data.list;
  230. this.pagination = res.data.pagination; //拿到关于页码页容量的数据
  231. this.statistics = Object.assign(this.statistics, res.data.statistics);
  232. } else {
  233. this.$message.error(res.msg);
  234. }
  235. }).catch(e => {});
  236. },
  237. formatEffectiveTime(value) {
  238. var h = parseInt(value / 60);
  239. var m = value % 60;
  240. return h + '小时' + m + '分';
  241. }
  242. },
  243. // 加载的时候获取到列表页
  244. mounted() {
  245. // 数据初始化
  246. this.LoadDataType = -1;
  247. this.loadData();
  248. }
  249. })
  250. </script>