| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('components/com-goods-detail', \Yii::$app->controller->module->viewPath);
- ?>
- <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" :disabled="choose_list.length == 0 || btnLoading" v-loading="btnLoading" @click="onBatchWrite">
- {{btnLoading ? '导入中...' : '批量导入'}}
- </el-button>
- </div>
- </div>
- <div class="table-body">
- <el-form size="small" :inline="true" flex="dir:left cross:center">
- <div class="item-box">
- <el-input clearable size="small" style="width: 200px" v-model="search.goods_name" placeholder="请输入商品名称"></el-input>
- </div>
- <div class="item-box">
- <el-select v-model="search.cate_id" placeholder="请选择类目" clearable size="small">
- <el-option v-for="(item, index) in cats" :key="index" :label="item.cate_name" :value="item.third_cate_id"></el-option>
- </el-select>
- </div>
- <div class="item-box">
- <el-select v-model="search.imported" placeholder="是否已导入" clearable size="small">
- <el-option label="未导入" :value="0"></el-option>
- <el-option label="已导入" :value="1"></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" v-="loading">
- <el-table :data="list" stripe v-loading="loading" size="small" ref="multipleTable" style="margin-bottom: 15px;" @selection-change="handleSelectionChange">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column label="商品信息" align="left">
- <template slot-scope="scope">
- <div class="table-info-img-text">
- <el-image class="table-info-img circle" :src="scope.row.content.goods.default_image">
- <div slot="error" class="image-slot">
- <com-image src="/resources/img/common/default-avatar.png"></com-image>
- </div>
- </el-image>
- <div class="table-info-text">
- <div style="color:#000; text-align: left">{{scope.row.content.goods.goods_name}}</div>
- <div style="font-size: 12px; text-align: left">ID:{{scope.row.content.goods.goods_id}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="类目" align="center" width="120px">
- <template slot-scope="scope">
- <span v-if="scope.row.cateOne">{{scope.row.cateOne.cate_name}},</span>
- <span v-if="scope.row.cateTwo">{{scope.row.cateTwo.cate_name}}</span>
- </template>
- </el-table-column>
- <el-table-column label="库存" align="center" width="120px">
- <template slot-scope="scope">
- {{scope.row.content.goods.stock}}
- </template>
- </el-table-column>
- <el-table-column label="是否可售" align="center" width="120px">
- <template slot-scope="scope">
- <el-tag size="mini" :type="scope.row.content.goods.if_sale == 1 && scope.row.can_sale == 1 ? 'success' : 'danger'">
- {{scope.row.content.goods.if_sale == 1 && scope.row.can_sale == 1 ? '是' : '否'}}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center" width="120px">
- <template slot-scope="scope">
- <el-tag size="mini" :type="scope.row.status == 1 ? 'success' : 'danger'">
- {{scope.row.status == 1 ? '正常' : '禁用'}}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="供货价" align="center" width="120px">
- <template slot-scope="scope">
- {{scope.row.gonghuojia}}
- </template>
- </el-table-column>
- <el-table-column label="建议零售价" align="center" width="120px">
- <template slot-scope="scope">
- {{scope.row.retail_price}}
- </template>
- </el-table-column>
- <el-table-column label="商品价格" align="center" width="120px">
- <template slot-scope="scope">
- {{scope.row.price}}
- </template>
- </el-table-column>
- <el-table-column label="导入状态" align="center" width="120px">
- <template slot-scope="scope">
- <el-tag size="mini" :type="scope.row.goods_id > 0 ? 'success' : 'danger'">
- {{scope.row.goods_id > 0 ? scope.row.goods_id : '未导入'}}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="添加时间" width="160" align="center" width="150px">
- <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="160" align="center" width="150px">
- <template slot-scope="scope">
- <div v-if="scope.row.goods_id > 0">{{scope.row.import_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
- <div v-else>-</div>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <!-- v-if="scope.row.edit_status == 3"-->
- <!-- 更新库存, 修改商品, 提交审核,上架,下架,删除,取消审核 -->
- <el-button size="mini" type="text" @click="onDetail(scope.row)">详情</el-button>
- <template v-if="scope.row.goods_id == 0">
- <el-popconfirm @confirm="writeGoods(scope.row, scope.$index)" title="您真的要导入当前商品吗?">
- <el-button type="text" slot="reference" style="color: #67C23A">导入</el-button>
- </el-popconfirm>
- </template>
- <el-popconfirm @confirm="removeGoods(scope.row, scope.$index)"
- title="您真的要删除当前商品吗?">
- <el-button type="text" slot="reference"
- style="color: #F56C6C">移除</el-button>
- </el-popconfirm>
- </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;" 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>
- <com-goods-detail :goods-id="goodsDetailId"></com-goods-detail>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- page: 1,
- time: [], //本地存时间,请求时不发送
- search: {
- goods_name: '',
- imported: '',
- cate_id: '',
- },
- loading: false,
- activeName: '-1',
- list: [], //列表数据
- pagination: null,
- wxList: [],
- goodsDialogVisible: false,
- btnLoading: false,
- cats: <?= $cats ?>,
- goodsDetailId: 0,
- rate: <?= $rate ?>,
- choose_list: [],
- },
- mounted() {
- // 获取列表首页数据
- this.loadData(this.page, this.search); //获取列表数据
- },
- methods: {
- onDetail(goods) {
- this.goodsDetailId = goods.third_goods_id
- },
- // 1.0 获取视频列表
- loadData(page, others) {
- this.loading = true;
-
- request({
- method: 'get',
- params: {
- r: 'qi-shang-tong/default/index',
- page: page,
- limit: 10,
- ...others, //其他搜索字段
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- this.edit_status_map = e.data.data.edit_status_map
- this._status_map = e.data.data.status_map
- this.list = e.data.data.list;
- this.shops = e.data.data.shop;
- this.pagination = e.data.data.pagination;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {});
- },
- pageChange(page) {
- this.page = page;
- this.loadData(this.page, this.search);
- },
-
- handleClick(tab, event) {
- this.page = 1;
- this.search.status = this.activeName;
- this.loadData(this.page, this.search)
- },
- handleSelectionChange(rows) {
- this.choose_list = []
- if (rows) {
- rows.forEach(row => {
- this.choose_list.push(row.id);
- });
- }
- },
- searchs() {
- this.page = 1;
- this.loadData(this.page, this.search);
- },
- writeGoods(item, index) {
- this.btnLoading = true
- request({
- method: 'post',
- params: {
- r: 'qi-shang-tong/goods/write',
- },
- data: {id: item.id}
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code === 0) {
- // 数据重载
- this.loadData(this.page, this.search)
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.btnLoading = false;
- });
- },
- onBatchWrite() {
- if (this.choose_list.length <= 0) {
- this.$message.success('请选择需要导入的商品');
- return
- }
- this.btnLoading = true
- request({
- method: 'post',
- params: {
- r: 'qi-shang-tong/goods/batch-write',
- },
- data: {id: this.choose_list}
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code === 0) {
- // 数据重载
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.btnLoading = false;
- });
- },
- removeGoods(item, index) {
- this.btnLoading = true
- request({
- method: 'post',
- params: {
- r: 'qi-shang-tong/goods/del',
- },
- data: {id: item.id}
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code === 0) {
- this.list.splice(index, 1)
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.btnLoading = false;
- });
- },
- onSubmit() {
- this.$refs['goodsForm'].validate((valid) => {
- if (valid) {
- this.btnLoading = true
- request({
- method: 'post',
- params: {
- r: 'qi-shang-tong/goods/create',
- },
- data: this.goodsForm
- }).then(e => {
- this.btnLoading = false;
- if (e.data.code === 0) {
- this.page = 1
- this.search = {
- keyword: '',
- audit_status: '',
- }
- this.loadData(this.page, this.search);
- this.onCloseGoodsDialogVisible()
- this.$message.success(e.data.msg);
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.btnLoading = false;
- });
- } else {
- console.log(valid)
- }
- })
- },
- },
- });
- </script>
- <style>
- .set-el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .sort-input {
- width: 100%;
- background-color: #F3F5F6;
- height: 32px;
- }
- .sort-input span {
- height: 32px;
- width: 100%;
- line-height: 32px;
- display: inline-block;
- padding: 0 10px;
- font-size: 13px;
- }
- .sort-input .el-input__inner {
- height: 32px;
- line-height: 32px;
- background-color: #F3F5F6;
- float: left;
- padding: 0 10px;
- border: 0;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-info .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- margin: 0 0 20px;
- }
- .input-item-name {
- margin-right: 5px;
- }
- .input-search {
- margin-right: 30px;
- }
- .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;
- }
- .data-pop-info {
- /* padding: 18px 15px 30px; */
- color: #333;
- }
- .data-pop-mode {
- background: #F8F8F8;
- border-radius: 4px;
- margin-bottom: 10px;
- }
- .data-pop-top {
- height: 90px;
- }
- .data-price {
- width: 200px;
- flex-direction: column;
- border-right: 1px solid #E5E5E5;
- }
- .data-info {
- flex: 1;
- padding: 22px 15px;
- font-size: 16px;
- }
- .data-info-name {
- display: inline-block;
- text-align: end;
- }
- .data-pop-detail {
- padding: 15px 18px;
- }
- .data-detail-mode {
- min-width: 33%;
- flex-shrink: 0;
- text-align: center;
- margin-top: 16px;
- line-height: 26px;
- font-size: 16px;
- }
- .share-pop-model {
- margin-top: 20px;
- }
- .share-name {
- width: 90px;
- display: inline-block;
- margin-right: 18px;
- text-align: end;
- }
- .flex-y-center {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- -ms-flex-align: center;
- -ms-grid-row-align: center;
- align-items: center;
- }
- </style>
- <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>
|