| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567 |
- <style>
- .header {
- padding: 18px 20px;
- background: #fff;
- margin-bottom: 10px;
- border-radius: 5px;
- border: 1px solid #EBEEF5;
- }
- .el-card {
- box-shadow: none !important;
- }
- .inquires_box {
- flex-wrap: wrap;
- }
- .condition {
- width: 450px;
- }
- .condition2 {
- margin-right: 30px;
- margin-bottom: 20px;
- }
- .operat_btn_list .el-button {
- padding: 8px 20px;
- }
- .table_box {
- margin-top: 10px;
- }
- .give_btn {
- border-radius: 5px;
- background: #fff;
- padding: 2px 0;
- border: 1px solid #DCDFE6;
- width: 80px;
- cursor: pointer;
- }
- .el-table .cell {
- /*display: flex;*/
- justify-content: center;
- }
- .operat1 {
- color: #3399FF;
- margin-right: 20px;
- cursor: pointer;
- }
- .operat2 {
- color: #FF336E;
- cursor: pointer;
- }
- .pagination_box {
- margin-top: 30px;
- justify-content: flex-end;
- }
- .types {
- cursor: pointer;
- }
- .coupon_type_list_box {
- flex-wrap: wrap;
- }
- .coupon_type_list {
- background: #F4F4F4;
- border-radius: 4px;
- padding: 8px 6px;
- width: 110px;
- margin-bottom: 15px;
- margin-right: 15px;
- position: relative;
- }
- /* .coupon_type_list:last-child */
- .coupon_type_list_box :nth-child(5n) {
- margin-right: 0px;
- }
- .coupon_type_title {
- font-size: 16px;
- margin-bottom: 10px;
- }
- .coupon_type_content {
- font-size: 12px;
- margin-bottom: 4px;
- }
- .coupon_type_list_expired {
- width: 100px;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- opacity: 0.2;
- zoom: 1.05;
- }
- .el-dialog__body {
- padding: 20px 20px 10px;
- }
- .switchStyle .el-switch__label {
- position: absolute;
- display: none;
- color: #fff;
- }
- .switchStyle .el-switch__label--left {
- z-index: 9;
- left: 6px;
- }
- .switchStyle .el-switch__label--right {
- z-index: 9;
- left: -14px;
- }
- .switchStyle .el-switch__label.is-active {
- display: block;
- }
- .switchStyle.el-switch .el-switch__core,
- .el-switch .el-switch__label {
- width: 56px !important;
- }
- /* 公共样式 */
- .flex {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- }
- .title_bu:hover {
- cursor: pointer;
- }
- .flex-x-center {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- -ms-flex-pack: center;
- justify-content: center;
- }
- .flex-x-between {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-pack: space-between;
- -webkit-justify-content: space-between;
- -ms-flex-pack: space-between;
- justify-content: space-between;
- }
- .flex-y-center {
- display: -webkit-box;
- display: -webkit-flex;
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- -webkit-box-align: center;
- -webkit-align-items: center;
- -ms-flex-align: center;
- -ms-grid-row-align: center;
- align-items: center;
- }
- /* 溢出隐藏 */
- .over1 {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .over2 {
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .el-table th > .cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- .give-info {
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- }
- </style>
- <div id='app' v-cloak style="min-width: 1000px;">
- <!-- <div class="header">活动列表</div>-->
- <div class="header">
- <el-button style="height: 40px;" type="primary" @click="editRule(0)">添加活动</el-button>
- </div>
- <el-card v-loading='loading'>
- <!-- 条件查询 -->
- <div class="inquires_box flex">
- <div class="condition condition2 flex flex-y-center">
- <div style="width: 90px;">活动名称:</div>
- <el-input size="small" style="flex: 1;margin-left:10px" placeholder="请输入查询内容" v-model="name"></el-input>
- </div>
- <div class="flex flex-y-center condition2">
- <div style="width: 75px;">类型:</div>
- <el-select size="small" v-model="award_type" placeholder="请选择发放类型">
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
- </el-option>
- </el-select>
- </div>
- <div class="flex flex-y-center condition2">
- <div style="width: 75px;">状态:</div>
- <el-select size="small" v-model="active_status" placeholder="请选择发放类型">
- <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value">
- </el-option>
- </el-select>
- </div>
- <el-button type="primary" size="small" style="margin-bottom: 20px;" @click='query'>查询</el-button>
- </div>
- <div class="table_box">
- <el-table :data="tableData" stripe style="width: 100%;font-size:13px">
- <el-table-column prop="name" label="活动名称" width="180" align="center"></el-table-column>
- <el-table-column prop="start_at,end_at" label="活动时间" width="200" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.start_at | dateTimeFormat("Y-m-d H:i")}}</div>
- <div>至</div>
- <div>{{scope.row.end_at | dateTimeFormat("Y-m-d H:i")}}</div>
- </template>
- </el-table-column>
- <el-table-column prop="give_cond" label="赠送类型" width="150" align="center">
- <template slot-scope="scope">
- <div v-if="scope.row.give_cond == 1"> 累计充值</div>
- <div v-else>单次充值</div>
- </template>
- </el-table-column>
- <el-table-column prop="give_info" label="赠送内容" align="center">
- <template slot-scope="scope">
- <el-tooltip placement="bottom">
- <div slot="content">
- <div style="margin-bottom: 6px;" v-for="(item,index) in scope.row.give_info"
- :key="index">
- 满{{item.num}}送
- <div v-for="(dataItem,dataIndex) in item.data" :key="dataItem.type">
- <div v-if="dataItem.type == 'coupon'">
- {{dataItem.name}}:
- <div v-for="(couponItem,coupoIndex) in dataItem.data" :key="couponItem.id">
- {{couponItem.discount_method}}*{{couponItem.num}}张
- </div>
- </div>
- <span v-else>
- {{dataItem.name}}:{{dataItem.data}}
- </span>
- </div>
- </div>
- </div>
- <div class="give-info">
- <span style="margin-bottom: 6px;" v-for="(item,index) in scope.row.give_info"
- :key="index">
- 满{{item.num}}送
- <span v-for="(dataItem,dataIndex) in item.data" :key="dataItem.type">
- <span v-if="dataItem.type == 'coupon'">
- {{dataItem.name}}:
- <span v-for="(couponItem,coupoIndex) in dataItem.data" :key="couponItem.id">
- {{couponItem.discount_method}}*{{couponItem.num}}张
- </span>
- </span>
- <span v-else>
- {{dataItem.name}}:{{dataItem.data}}
- </span>
- </span>
- </span>
- </div>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column label="已赠送" width="120px" align="center">
- <template slot-scope="scope">
- <div style="color: #0A54EA" class="title_bu" @click="typeGoTo(scope.row.id)">
- {{scope.row.already_give}}
- </div>
- </template>
- </el-table-column>
- <!-- 0/未开始 1/进行中 2/已过期 3/已停用-->
- <el-table-column prop="active_status" label="状态" width="150" align="center">
- <template slot-scope="scope">
- <div v-if="scope.row.active_status == 0"> 未开始</div>
- <div v-else-if="scope.row.active_status == 1">进行中</div>
- <div v-else-if="scope.row.active_status == 2">已过期</div>
- <div v-else-if="scope.row.active_status == 3">停用</div>
- </template>
- </el-table-column>
- <el-table-column prop="created_at" label="创建时间" width='200' 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="120" align="center">
- <template slot-scope="scope">
- <el-switch :disabled="scope.row.active_status == 0||scope.row.active_status == 2"
- class="switchStyle" :value='scope.row.active_status' :active-value='1'
- inactive-value='3'
- @change='changeStatus(scope.row.id,scope.$index,scope.row.active_status)'
- active-text="启用" inactive-text="停用"></el-switch>
- </template>
- </el-table-column>
- <el-table-column label="操作" fixed="right" align="center" width='150'>
- <template slot-scope="scope">
- <div class="operat1" @click="editRule(scope.row.id)">编辑</div>
- <div class="operat1" @click="deleterRule(scope.row.id,scope.$index)">删除</div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <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>
- </el-card>
- </div>
- <script>
- new Vue({
- el: '#app',
- data() {
- return {
- pagination: {
- total: 0
- },
- loading: false,
- options: [{
- value: '',
- label: '全部'
- }, {
- value: '0',
- label: '单次充值'
- }, {
- value: '1',
- label: '累计充值'
- }],
- options2: [{
- value: '',
- label: '全部'
- }, {
- value: '0',
- label: '未开始'
- }, {
- value: '1',
- label: '进行中'
- }, {
- value: '2',
- label: '已过期'
- }, {
- value: '3',
- label: '已停用'
- }],
- value: '',
- tableData: [],
- dialogVisible: false,
- pageCount: 0,
- name: '',
- status: '',
- active_status: '',
- award_type: '',
- page: 1,
- limit: 10,
- total_count: 0,
- dialog_sum: 0,
- dialog_types: '',
- current_arr: [],
- dialogVisible2: false,
- tips_msg: "",
- operate_id: '',
- operate_status: '',
- }
- },
- mounted() {
- this.getData();
- },
- computed: {
- serialNum() {
- return function (index) {
- return this.limit * (this.page - 1) + index + 1;
- }
- },
- typeName() {
- return function (val) {
- switch (val) {
- case '0':
- return '单次充值'
- case '1':
- return '累计充值'
- }
- }
- }
- },
- methods: {
- // 页面跳转
- toPageAdd() {
- navigateTo({
- r: 'plugin/recharge/mall/index/add',
- })
- },
- query() {
- this.page = 1;
- this.getData();
- },
- getData() {
- this.loading = true;
- request({
- params: {
- r: 'recharge/default/index',
- },
- data: {
- name: this.name,
- active_status: this.active_status,
- give_cond: this.award_type,
- page: this.page,
- limit: this.limit,
- },
- method: 'post',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- this.total_count = e.data.data.pagination.total_count;
- this.tableData = e.data.data.list;
- this.pageCount = e.data.data.pagination.page_count;
- this.pagination = e.data.data.pagination; //拿到关于页码页容量的数据
- } else {
- this.$message.error(e.data.msg);
- }
- });
- },
- pageChange(page) {
- this.page = page;
- this.getData();
- },
- changeStatus(id, index, status) {
- this.loading = true;
- request({
- params: {
- r: 'recharge/default/update',
- },
- data: {
- id: id,
- active_status: status
- },
- method: 'post',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- this.getData()
- // this.tableData[index].active_status = status == '1' ? '3' : '1';
- // this.$message.success(e.data.msg);
- // console.log(this.tableData[index])
- } else {
- this.$message.error(e.data.msg);
- }
- });
- },
- typeGoTo(id) {
- let url = "recharge/default/list";
- if (!url) {
- return;
- }
- navigateTo({
- r: url,
- recharge_active_id: id
- })
- },
- ruleSwitch() {
- },
- editRule(id) {
- navigateTo({
- r: 'recharge/default/edit',
- id
- })
- },
- deleterRule(id, index) {
- this.loading = true;
- request({
- params: {
- r: 'recharge/default/delete',
- },
- data: {
- id: id,
- status: -1
- },
- method: 'post',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- this.tableData.splice(index, 1);
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- });
- },
- handleSizeChange(val) {
- this.limit = val;
- this.getData();
- },
- handleCurrentChange(val) {
- thia.page = val;
- this.getData();
- },
- showPop(key, val, obj) {
- this.dialogVisible = true;
- this.dialog_types = key;
- this.dialog_sum = val;
- this.current_arr = obj;
- },
- handleClose(done) {
- this.$confirm('确认关闭?')
- .then(_ => {
- done();
- })
- .catch(_ => {
- });
- }
- }
- })
- </script>
|