|
@@ -0,0 +1,386 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div style="padding-top: 10px;">
|
|
|
|
|
+ <i-page-header :title="pageTitle"></i-page-header>
|
|
|
|
|
+ <Card :bordered="false" dis-hover class="ivu-mt">
|
|
|
|
|
+ <Form ref="orderData" :model="orderData">
|
|
|
|
|
+ <Row :gutter="24" type="flex">
|
|
|
|
|
+ <Col>
|
|
|
|
|
+ <FormItem label="荣誉名称:" label-for="name">
|
|
|
|
|
+ <Input placeholder="荣誉名称" v-model="orderData.name" />
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ <Col>
|
|
|
|
|
+ <FormItem label="是否启用:" label-for="status">
|
|
|
|
|
+ <el-select v-model="orderData.status">
|
|
|
|
|
+ <el-option label="启用" value="1"></el-option>
|
|
|
|
|
+ <el-option label="禁用" value="0"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ <!-- <Col>
|
|
|
|
|
+ <FormItem label="购买时间:">
|
|
|
|
|
+ <DatePicker v-model="orderData.time" format="yyyy/MM/dd HH:mm:ss" type="datetimerange" placement="bottom-start" placeholder="自定义时间" style="width: 300px;" class="mr20" :options="options"></DatePicker>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ </Col> -->
|
|
|
|
|
+ <Col>
|
|
|
|
|
+ <Button label="default" type="primary" icon="ios-search" class="mr15" style="margin-top: 32px;"
|
|
|
|
|
+ @click="orderSearch()">搜索</Button>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ </Form>
|
|
|
|
|
+ <Col>
|
|
|
|
|
+ <el-button type="primary" class="export" @click="add">添加荣誉</el-button>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <Table :columns="columns" :data="orderList" ref="table" :loading="loading" highlight-row no-data-text="暂无数据"
|
|
|
|
|
+ no-filtered-data-text="暂无筛选结果" class="orderData mt25">
|
|
|
|
|
+ <template slot-scope="{ row, index }" slot="order_id">
|
|
|
|
|
+ <span v-text="row.order_id" style="display: block;"></span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template slot-scope="{ row, index }" slot="uid">
|
|
|
|
|
+ <div>{{ row.nickname || '微信用户' }}[UID:{{ row.uid }}]</div>
|
|
|
|
|
+ <div>{{ row.mobile || '未绑定手机号' }}</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template slot-scope="{ row, index }" slot="icon">
|
|
|
|
|
+ <img v-lazy="row.icon" :src="row.icon" v-image-preview style="width: 60px;cursor: pointer" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template slot-scope="{ row, index }" slot="status">
|
|
|
|
|
+ <el-tag type="success" size="mini" v-if="row.status == 1">启用</el-tag>
|
|
|
|
|
+ <el-tag type="danger" size="mini" v-else>禁用</el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template slot-scope="{row,index}" slot="operation">
|
|
|
|
|
+ <el-button type="primary" size="mini" @click="edit(row)">编辑</el-button>
|
|
|
|
|
+ <el-button type="danger" size="mini" @click="deletes(row.id)">删除</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ </Table>
|
|
|
|
|
+ <div class="acea-row row-right page">
|
|
|
|
|
+ <Page :total="page.count" show-elevator show-total @on-change="tapPage" :page-size="page.pageSize" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </Card>
|
|
|
|
|
+ <Modal v-model="addModal" title="添加荣誉" @on-ok="sendOk('sendFormValidate')" @on-cancel="sendCancel" width="800">
|
|
|
|
|
+ <Form :model="sendData" :label-width="labelWidth" :rules="ruleValidate" ref="sendFormValidate">
|
|
|
|
|
+ <FormItem label="荣誉名称" prop="name">
|
|
|
|
|
+ <Input v-model="sendData.name" type="text" placeholder="请输入荣誉名称"></Input>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem label="荣誉描述" prop="description">
|
|
|
|
|
+ <Input v-model="sendData.description" type="textarea" :autosize="{ minRows: 5, maxRows: 5 }"
|
|
|
|
|
+ placeholder="请输入荣誉描述"></Input>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem label="图标" prop="icon">
|
|
|
|
|
+ <div class="clearfix" style="width: 100%;">
|
|
|
|
|
+ <div class="upimg-item fx-r fx-bc fx-ac" style="" v-if="sendData.icon">
|
|
|
|
|
+ <img v-lazy="sendData.icon" :src="sendData.icon" v-image-preview />
|
|
|
|
|
+ <i class="el-icon-error img-remove-btn" @click="removeImgs()"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <ui-upload style="float: left;" :upUrl="upUrl" fileName="上传图片" :headers="upHeaders"
|
|
|
|
|
+ :updata="{isz:0,code:'goods'}" @onUpload="onUpload"></ui-upload>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem label="排序" prop="sort">
|
|
|
|
|
+ <Input v-model="sendData.sort" type="number" placeholder="请输入排序"></Input>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem label="是否启用" prop="status">
|
|
|
|
|
+ <el-radio-group v-model="sendData.status">
|
|
|
|
|
+ <el-radio :label="1">启用</el-radio>
|
|
|
|
|
+ <el-radio :label="0">禁用</el-radio>
|
|
|
|
|
+ </el-radio-group>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ </Form>
|
|
|
|
|
+ <div slot="footer">
|
|
|
|
|
+ <Button size="large" :loading="modal_loading" @click="sendCancel">取消</Button>
|
|
|
|
|
+ <Button type="primary" size="large" :loading="modal_loading"
|
|
|
|
|
+ @click="sendOk('sendFormValidate')">提交</Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </Modal>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+ import IPageHeader from "../../../layouts/system/page-header/index";
|
|
|
|
|
+ import UiUpload from "@/ui/upload/index";
|
|
|
|
|
+ import Setting from '@/setting';
|
|
|
|
|
+ import {
|
|
|
|
|
+ getHonorList,
|
|
|
|
|
+ saveHonor,
|
|
|
|
|
+ delHonor
|
|
|
|
|
+ } from "../../../api/system/user";
|
|
|
|
|
+
|
|
|
|
|
+ export default {
|
|
|
|
|
+ name: "chatList",
|
|
|
|
|
+ components: {
|
|
|
|
|
+ IPageHeader,
|
|
|
|
|
+ UiUpload
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {},
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ labelWidth: 120,
|
|
|
|
|
+ upUrl: '',
|
|
|
|
|
+ upHeaders: '',
|
|
|
|
|
+ modal_loading: false,
|
|
|
|
|
+ addModal: false,
|
|
|
|
|
+ pageTitle: "荣誉列表",
|
|
|
|
|
+ orderData: {
|
|
|
|
|
+ uid: "",
|
|
|
|
|
+ status: "",
|
|
|
|
|
+ time: [],
|
|
|
|
|
+ mobile: "",
|
|
|
|
|
+ show_template_id: "",
|
|
|
|
|
+ },
|
|
|
|
|
+ sendData: {
|
|
|
|
|
+ id: 0,
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ description: '',
|
|
|
|
|
+ icon: '',
|
|
|
|
|
+ sort: 0,
|
|
|
|
|
+ status: 1
|
|
|
|
|
+ },
|
|
|
|
|
+ ruleValidate: {
|
|
|
|
|
+ name: [{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入荣誉名称'
|
|
|
|
|
+ }],
|
|
|
|
|
+ description: [{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入荣誉描述'
|
|
|
|
|
+ }],
|
|
|
|
|
+ icon: [{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请选择图标'
|
|
|
|
|
+ }],
|
|
|
|
|
+ },
|
|
|
|
|
+ columns: [{
|
|
|
|
|
+ title: 'ID',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ key: 'id',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '名称',
|
|
|
|
|
+ key: 'name',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '描述',
|
|
|
|
|
+ key: 'description',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '图标',
|
|
|
|
|
+ slot: 'icon',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '排序',
|
|
|
|
|
+ key: 'sort',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '状态',
|
|
|
|
|
+ slot: 'status',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '时间',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ key: 'create_time',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '操作',
|
|
|
|
|
+ slot: 'operation',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ orderList: [],
|
|
|
|
|
+ orderDatalist: {},
|
|
|
|
|
+ orderId: 0,
|
|
|
|
|
+ page: {
|
|
|
|
|
+ total: 0, // 总条数
|
|
|
|
|
+ page: 1, // 当前页
|
|
|
|
|
+ pageSize: 10 // 每页显示条数
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ created() {
|
|
|
|
|
+ if (this.$route.query.title) {
|
|
|
|
|
+ this.pageTitle = this.$route.query.title;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.$route.query.uid) {
|
|
|
|
|
+ this.orderData.uid = parseInt(this.$route.query.uid);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.$route.query.show_template_id) {
|
|
|
|
|
+ this.orderData.show_template_id = parseInt(this.$route.query.show_template_id);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.initView();
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ initView() {
|
|
|
|
|
+ var upHeaders = {};
|
|
|
|
|
+ this.upUrl = Setting.apiBaseURL + "/systemv1/upload/index";
|
|
|
|
|
+ const token = this.$utils.util.cookies.get('system_token');
|
|
|
|
|
+ if (token) {
|
|
|
|
|
+ upHeaders['SYSTEM-ACC-TOKEN'] = token;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.upHeaders = upHeaders;
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ },
|
|
|
|
|
+ deletes(id) {
|
|
|
|
|
+ this.$confirm('确定删除吗?', '系统提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ delHonor({
|
|
|
|
|
+ id: id
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ this.$Message.success('删除成功!');
|
|
|
|
|
+ this.getData()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$Message.error(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.$Message.error(err.msg);
|
|
|
|
|
+ })
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ onUpload: function(res) {
|
|
|
|
|
+ if (res.code == -1) {
|
|
|
|
|
+ Notice.error({
|
|
|
|
|
+ title: "系统提示",
|
|
|
|
|
+ content: res.msg
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.sendData.icon = res.data.img;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ removeImgs() {
|
|
|
|
|
+ this.sendData.icon = ''
|
|
|
|
|
+ },
|
|
|
|
|
+ sendCancel() {
|
|
|
|
|
+ this.addModal = false
|
|
|
|
|
+ this.sendData = {
|
|
|
|
|
+ name: '',
|
|
|
|
|
+ description: '',
|
|
|
|
|
+ icon:'',
|
|
|
|
|
+ sort:0,
|
|
|
|
|
+ status: 1
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ sendOk(name) {
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ this.$refs[name].validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ let pdata;
|
|
|
|
|
+ if (that.sendData.id) {
|
|
|
|
|
+ pdata = this.sendData
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pdata = {
|
|
|
|
|
+ name: that.sendData.name,
|
|
|
|
|
+ description: that.sendData.description,
|
|
|
|
|
+ icon: that.sendData.icon,
|
|
|
|
|
+ sort: that.sendData.sort,
|
|
|
|
|
+ status: that.sendData.status
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ saveHonor(pdata).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ that.$message.success(res.msg)
|
|
|
|
|
+ that.sendCancel()
|
|
|
|
|
+ that.getData()
|
|
|
|
|
+ }else {
|
|
|
|
|
+ that.$message.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {}
|
|
|
|
|
+ })
|
|
|
|
|
+ // if(!that.sendData.name) {
|
|
|
|
|
+ // return that.$message.error('请输入荣誉名称')
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ add() {
|
|
|
|
|
+ this.addModal = true
|
|
|
|
|
+ },
|
|
|
|
|
+ edit(row) {
|
|
|
|
|
+ this.sendData = row
|
|
|
|
|
+ console.log(row);
|
|
|
|
|
+ this.addModal = true
|
|
|
|
|
+ },
|
|
|
|
|
+ tabsHandleClick: function(tab, event) {
|
|
|
|
|
+ this.page.page = 1;
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ },
|
|
|
|
|
+ orderSearch: function() {
|
|
|
|
|
+ this.page.page = 1;
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分页
|
|
|
|
|
+ */
|
|
|
|
|
+ tapPage: function(index) {
|
|
|
|
|
+ this.page.page = index;
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取数据
|
|
|
|
|
+ */
|
|
|
|
|
+ getData: function() {
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+ // this.loading = true;
|
|
|
|
|
+ var data = {
|
|
|
|
|
+ page: that.page.page,
|
|
|
|
|
+ ...that.orderData
|
|
|
|
|
+ };
|
|
|
|
|
+ getHonorList(data)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ that.loading = false;
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ that.orderList = res.data.list;
|
|
|
|
|
+ that.page.pageSize = res.data.pageSize;
|
|
|
|
|
+ that.page.count = res.data.pageCount;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$alert(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(err => {
|
|
|
|
|
+ that.loading = false;
|
|
|
|
|
+ that.$alert("网络繁忙,加载失败,请稍等片刻在尝试!", '系统提示');
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+</script>
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+ .upimg-item {
|
|
|
|
|
+ width: 82px;
|
|
|
|
|
+ height: 82px;
|
|
|
|
|
+ margin-right: 5px;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ float: left;
|
|
|
|
|
+ margin-bottom: 5px;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .upimg-item img {
|
|
|
|
|
+ width: 82px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .img-remove-btn {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0px;
|
|
|
|
|
+ right: 0px;
|
|
|
|
|
+ font-size: 24px;
|
|
|
|
|
+ }
|
|
|
|
|
+</style>
|