| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <style>
- .el-table th>.cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .table1 .el-table__footer-wrapper,
- .table1 .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- </style>
- <div id="app">
- <div class="table-body" style="min-width: 1000px;">
- <div slot="header" class="clearfix" style="height: 20px;">
- <span>活动列表</span>
- <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>
- </div>
- <div slot="header" class="clearfix" style="margin-top: 20px;">
- <div class="demo-input-suffix" style="margin-top: 20px;margin-bottom: 10px;">
- <el-input @keyup.enter.native="toSearchActivity" size="small" style="width:300px;margin-right: 20px;" placeholder="搜索商品名称" v-model="search.goods_name" clearable>
- </el-input>
- <el-button type="primary" size="small" @click="toSearchActivity">搜索</el-button>
- </div>
- <div style="padding:15px 0 15px 15px;background-color:#D6D6D6">
- <el-button :type="LoadDataType==-1?'primary':''" size="small" @click="getLoadData(-1)">全部({{statistics.all_activity_number}})</el-button>
- <el-button :type="LoadDataType==0?'primary':''" size="small" @click="getLoadData(0)">待开始({{statistics.not_start_activity_number}})</el-button>
- <el-button :type="LoadDataType==1?'primary':''" size="small" @click="getLoadData(1)">进行中({{statistics.doing_activity_number}})</el-button>
- <el-button :type="LoadDataType==2?'primary':''" size="small" @click="getLoadData(2)">已结束({{statistics.end_activity_number}})</el-button>
- </div>
- </div>
- <template>
- <el-table :data="list" stripe style="width: 100%" v-loading="listLoading" class="table1">
- <el-table-column prop="id" label="编号" width="100" align="center"></el-table-column>
- <el-table-column prop="presale_name" label="活动名称" width="100" align="center"></el-table-column>
- <el-table-column prop="goods.name,goods.cover_pic" label="商品信息" width="210">
- <template slot-scope="scope">
- <div flex="box:first cross:top cross:center" v-if="scope.row.goods">
- <div style="padding-right: 5px;">
- <com-image mode="aspectFill" :src="scope.row.goods.cover_pic"></com-image>
- </div>
- <div>
- {{scope.row.goods.goods_name}}
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="start_at,end_at" label="预售时间" width="300" align="center">
- <template slot-scope="scope">
- <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>
- </template>
- </el-table-column>
- <el-table-column prop="goods_stock" label="库存" align="center"></el-table-column>
- <el-table-column prop="cate_name" label="预售分类" align="center"></el-table-column>
- <el-table-column prop="deposit_price,presale_price" label="定金/尾款" width="300" align="center">
- <template slot-scope="scope">
- <div>
- <p>定金:{{scope.row.deposit_price}}</p>
- <p>尾款:{{(scope.row.presale_price - scope.row.deposit_price).toFixed(2)}}</p>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="presale_total" label="预定人数" align="center"></el-table-column>
- <el-table-column prop="group_status" label="状态" align="center">
- <template slot-scope="scope">
- <el-tag effect="dark" size="small" type="warning" v-if="scope.row.status == -1">已关闭</el-tag>
- <div v-else>
- <el-tag effect="dark" size="small" type="info" v-if="scope.row.group_status == 0">未开始</el-tag>
- <el-tag effect="dark" size="small" type="success" v-if="scope.row.group_status == 1">活动中</el-tag>
- <el-tag effect="dark" size="small" type="warning" v-if="scope.row.group_status == 2">已结束</el-tag>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="start_at,end_at" label="添加时间" width="150" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.status != -1">
- <!-- <el-button @click="toGroupList(scope.row.id)" type="text" size="mini">开团列表</el-button>-->
- <el-button @click="del(scope.row.id)" type="text" size="mini">关闭</el-button> |
- </span>
- <el-button @click="toDetail(scope.row.id)" type="text" size="mini">详情</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div flex="main:right cross:center" style="margin-top: 20px;">
- <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">
- </el-pagination>
- </div>
- </template>
- </div>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- listLoading: false,
- list: [],
- pagination: {
- total: 0
- },
- loading: false,
- LoadDataType: -1, //默认显示全部数据
- dialogFormVisible: false, //默认不显示弹窗
- deposit_presale_attr_list: [],
- goodsDetail: {},
- dialogLoading: false,
- search: {
- goods_name: '',
- group_status: -1,
- page: 1,
- },
- commander_level_limit_text: '',
- user_level_limit_text: '',
- statistics: {
- all_activity_number: 0,
- doing_activity_number: 0,
- not_start_activity_number: 0,
- end_activity_number: 0,
- },
- }
- },
- methods: {
- // 页面跳转
- toPageAdd() {
- navigateTo({
- r: 'deposit-presale/default/add',
- })
- },
- toDetail(id) {
- navigateTo({
- r: 'deposit-presale/default/add',
- activity_id: id
- })
- },
- // 跳转到当前商品活动的开团列表
- toGroupList(id) {
- navigateTo({
- r: 'deposit-presale/default/open-list',
- deposit_presale_active_id: id
- })
- },
- //状态按钮的点击事件
- getLoadData(e) {
- this.search.group_status = e;
- this.loadData()
- this.LoadDataType = e;
- },
- toSearchActivity() {
- this.loadData()
- },
- // 查看商品详情
- groupGoodsDetail(id) {
- this.dialogFormVisible = true;
- this.dialogLoading = true;
- request({
- params: {
- r: 'deposit-presale/default/detail',
- id: id,
- },
- method: 'GET',
- }).then(e => {
- let res = e.data;
- this.dialogLoading = false;
- if (res.code === 0) {
- this.deposit_presale_attr_list = res.data.list;
- this.commander_level_limit_text = res.data.commander_level_limit_text;
- this.user_level_limit_text = res.data.user_level_limit_text;
- } else {
- this.$message.error(res.msg);
- }
- }).catch(e => {});
- },
- // 删除定金预售商品
- del(id) {
- this.$confirm('此操作将删除该定金预售商品, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.delGroupGoods(id);
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- pageChange(page) {
- this.search.page = page;
- this.loadData();
- },
- delGroupGoods(id) {
- this.loading = true;
- request({
- params: {
- r: 'deposit-presale/default/del',
- id: id
- },
- method: 'get',
- }).then(e => {
- let res = e.data;
- this.listLoading = false;
- if (res.code === 0) {
- this.$message.success(res.msg);
- this.loadData();
- } else {
- this.$message.error(res.msg);
- }
- }).catch(e => {});
- },
- // 请求获取数据--获取定金预售商品列表
- loadData() {
- this.listLoading = true;
- let params = {
- r: 'deposit-presale/default/index'
- };
- params = Object.assign(params, this.search);
- request({
- params: params,
- method: 'get',
- }).then(e => {
- let res = e.data;
- this.listLoading = false;
- if (res.code === 0) {
- this.list = res.data.list;
- this.pagination = res.data.pagination; //拿到关于页码页容量的数据
- this.statistics = Object.assign(this.statistics, res.data.statistics);
- } else {
- this.$message.error(res.msg);
- }
- }).catch(e => {});
- },
- formatEffectiveTime(value) {
- var h = parseInt(value / 60);
- var m = value % 60;
- return h + '小时' + m + '分';
- }
- },
- // 加载的时候获取到列表页
- mounted() {
- // 数据初始化
- this.LoadDataType = -1;
- this.loadData();
- }
- })
- </script>
|