| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- <?php
- /**
- * @link:http://www.goodmall.com/
- * @copyright: Copyright (c) 2020
- * 名片
- * Author: james
- * Date: 2020-07-10
- * Time: 15:48
- */
- ?>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>类目管理</span>
- <div style="float: right; margin: -5px 0">
- <el-button type="primary" size="small" @click="onEdit(0)">添加类目</el-button>
- </div>
- </div>
- <div class="table-body">
- <el-form size="small" :inline="true" flex="dir:left cross:center">
- <div class="item-box">
- <el-select v-model="search.shop_id" placeholder="请选择所属店铺进行搜索" clearable size="small">
- <el-option v-for="(name, index) in shops" :key="index" :label="name" :value="index"></el-option>
- </el-select>
- </div>
- <div class="item-box">
- <el-select v-model="search.status" placeholder="请选择审核状态进行搜索" clearable size="small">
- <el-option v-for="(name, index) in status_map" :key="index" :label="name" :value="index"></el-option>
- </el-select>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <el-button size="small" type="primary" style="padding: 9px 15px !important;" @click="searchs">搜索</el-button>
- </div>
- </el-form>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;"
- @selection-change="handleSelectionChange">
- <el-table-column label="所属店铺" align="left">
- <template slot-scope="scope">
- {{scope.row.shop.name}}
- </template>
- </el-table-column>
- <el-table-column label="一级类目" align="left">
- <template slot-scope="scope">
- {{scope.row.catOne.name}}
- </template>
- </el-table-column>
- <el-table-column label="二级类目" align="left">
- <template slot-scope="scope">
- {{scope.row.catTwo.name}}
- </template>
- </el-table-column>
- <el-table-column label="三级类目" align="left">
- <template slot-scope="scope">
- {{scope.row.catThree.name}}
- </template>
- </el-table-column>
- <el-table-column label="审核状态" width="160" align="center">
- <template slot-scope="scope">
- {{status_map[scope.row.audit_status] ? status_map[scope.row.audit_status] : '审核中'}}
- </template>
- </el-table-column>
- <el-table-column label="审核失败原因" align="left">
- <template slot-scope="scope">
- {{scope.row.audit_status == 2 ? scope.row.audit_reason : '-'}}
- </template>
- </el-table-column>
- <el-table-column label="更新时间" width="160" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.updated_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
- </template>
- </el-table-column>
- </el-table>
- </el-tabs>
- <!-- 分页器 -->
- <div flex="box:last cross:center">
- <div></div>
- <div>
- <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>
- </div>
- </div>
- <!-- 这个是复制用的容器,已隐藏 -->
- <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">这是幕后黑手</textarea>
- <el-dialog
- title="添加类目"
- :visible.sync="catDialogVisible"
- width="60%">
- <el-form size="small" ref="catForm" :model="catForm" label-position="top">
- <el-form-item label="请选择店铺" prop="shop_id" :rules="[{required: true, message: '请选择店铺'}]">
- <el-select v-model="catForm.shop_id" placeholder="请选择店铺" clearable size="small">
- <el-option v-for="(name, index) in shops" :key="index" :label="name" :value="index"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="请选择类目" prop="cats" :rules="[{required: true, message: '请选择类目'}]">
- <el-cascader-panel v-model="catForm.cats" :options="wxList" :props="{
- value: 'id',
- label: 'name'
- }" @change="onChangeWxCat"></el-cascader-panel>
- </el-form-item>
- <div v-if="currentQua && currentQua.tips_list" style="padding-bottom: 10px">
- <div v-for="(item, index) in currentQua.tips_list" :key="index" style="margin-top: 10px; color: red">
- {{item}}
- </div>
- <h4>上传资质</h4>
- <el-form-item label="上传资质" prop="certificate">
- <div flex="dir:left">
- <div class="card-coverimg" v-for="(item, index) in catForm.certificate" :key="index">
- <el-image class="elImages" style="width: 80px; height: 80px;cursor: move;" :src="item"></el-image>
- <el-button @click="delCertificate(index)" class="icon-close" type="primary" size="mini" icon="el-icon-close" circle></el-button>
- </div>
- <com-attachment v-if="catForm.certificate.length < 11" :multiple="true" :max="9" type="images" @selected="certificatePic">
- <div class="card-upload">
- <i class="el-icon-plus"></i>
- </div>
- </com-attachment>
- </div>
- </el-form-item>
- </div>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="catDialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="onSubmitCat" :disabled="btnLoading" v-loading="btnLoading">确 定</el-button>
- </span>
- </el-dialog>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- page:1,
- search: {
- status: '',
- },
- loading: false,
- activeName: '-1',
- list: [], //列表数据
- pagination: null,
- status_map: {},
- wxList: [],
- catDialogVisible: false,
- selectedCats: [],
- currentQua: null,
- certificate: [],
- btnLoading: false,
- shops: {},
- catForm: {
- cats: [],
- shop_id: '',
- certificate: [],
- cat: ''
- }
- },
- mounted() {
- // 获取列表首页数据
- this.loadData(this.page,this.search); //获取列表数据
- this.getWxCat()
- },
- methods: {
- // 1.0 获取视频列表
- loadData(page,others) {
- this.loading = true;
- request({
- method: 'get',
- params: {
- r: 'wechat-video-shop/cate/index',
- page: page,
- limit: 10,
- ...others, //其他搜索字段
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- this.list = e.data.data.list;
- this.shops = e.data.data.shop;
- this.status_map = e.data.data.status_map;
- this.pagination = e.data.data.pagination;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- });
- },
- getWxCat() {
- // 获取所有类目
- request({
- method: 'get',
- params: {
- r: 'wechat-video-shop/cate/wx-list',
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- this.wxList = e.data.data
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- });
- },
- handleClick(tab, event) {
- this.page = 1;
- this.search.status = this.activeName;
- this.loadData(this.page,this.search)
- },
- handleSelectionChange(val) {
- let self = this;
- self.choose_list = [];
- val.forEach(function (item) {
- self.choose_list.push(item.id);
- })
- },
- searchs() {
- this.page = 1;
- this.loadData(this.page,this.search);
- },
- onEdit(id) {
- this.currentQua = null
- this.catDialogVisible = true;
- },
- pageChange(page) {
- this.page = page;
- this.loadData(this.page,this.search);
- },
- pageChangeDataPop(page) {
- },
- onChangeWxCat(val) {
- if (val.length === 3) {
- for (let i in this.wxList) {
- if (this.wxList[i].id == val[0]) {
- for (let childrenKey in this.wxList[i].children) {
- if (this.wxList[i].children[childrenKey].id == val[1]) {
- for (let childrenKey1 in this.wxList[i].children[childrenKey].children) {
- if (this.wxList[i].children[childrenKey].children[childrenKey1].id == val[2]) {
- this.currentQua = JSON.parse(this.wxList[i].children[childrenKey].children[childrenKey1].qua)
- if (this.currentQua.tips) {
- this.currentQua.tips_list = this.currentQua.tips.split(';')
- }
- }
- }
- }
- }
- }
- }
- this.catForm.cat = val[2]
- this.catForm.cats = val
- }
- },
- onSubmitCat() {
- // if (this.selectedCats.length < 3) {
- // this.$message.error('类目不能为空');
- // return;
- // }
- // if (this.currentQua && this.currentQua.tips_list && this.certificate.length <= 0) {
- // this.$message.error('资质不能为空');
- // return;
- // }
- this.$refs['catForm'].validate((valid) => {
- if (valid) {
- this.btnLoading = true;
- request({
- method: 'post',
- params: {
- r: 'wechat-video-shop/cate/create',
- },
- data: this.catForm
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code === 0) {
- this.$message.success(e.data.msg);
- this.loadData(1, {})
- this.catDialogVisible = false
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.btnLoading = false;
- });
- }
- })
- },
- certificatePic(e) { // 选择轮播图
- if (e.length) {
- e.forEach((item, index) => {
- if (this.catForm.certificate.length >= 10) return;
- this.catForm.certificate.push(item.url);
- })
- }
- },
- delCertificate(type, index) { // 删除图片
- this.catForm.certificate.splice(index, 1)
- },
- }
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- display: inline-block;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .batch {
- margin: 0 0 20px;
- display: inline-block;
- }
- .batch .el-button {
- padding: 9px 15px !important;
- }
- .item-box{
- margin-right: 20px;
- }
- .item-box .label{
- margin-right: 8px;
- }
- .item-box .symbol{
- margin: 0 6px;
- }
- .form-nickname{
- width: 180px;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- }
- .index-video-url{
- width: 300px;
- }
- .index-video-url video{
- width: 100%;
- }
- .index-related-info{
- width: 500px;
- }
- .video-top{
- width: 100%;
- display: flex;
- align-items: flex-start;
- box-sizing: border-box;
- padding: 20px;
- /* opacity: .5; */
- background-color: #FFFFFF;
- }
- .video-top .top-right{
- line-height: 26px;
- }
- .video-top .top-right .top-title{
- font-size: 18px;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- width: 360px;
- }
- .video-top .top-right .wrapper{
- display: flex;
- /* align-items: flex-start; */
- }
- .video-top .top-right .wrapper .to-copy{
- /* color: #03C5FF; */
- margin-left: 20px;
- }
- .video-top .top-right .detail-price{
- color: #BC0100;
- font-size: 18px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- }
- /* .atooltip {
- background: #FFFFFF !important;
- border: none !important;
- } */
- .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;
- }
- .price_col{
- color: #FF5D05;
- }
- </style>
|