作者 何书鹏

后台管理整理

... ... @@ -270,6 +270,9 @@ class Dealer extends Backend
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 商品规格
*/
public function sku($id)
{
$skuList = \app\admin\model\shopro\goods\Sku::all(['pid' => 0, 'goods_id' => $id]);
... ...
<link rel="stylesheet" href="__CDN__/assets/addons/shopro/libs/element/element.css">
<link rel="stylesheet" href="__CDN__/assets/addons/shopro/libs/common.css">
<style>
#goodsSelect {
background: #fff;
overflow: auto;
color: #444;
margin: -15px;
}
.dialog-left {
width: 220px;
border-right: 1px solid #e6e6e6;
height: 100vh;
padding: 9px 20px;
overflow: auto;
}
.dialog-left::-webkit-scrollbar {
width: 6px;
}
.dialog-left::-webkit-scrollbar-thumb {
width: 6px;
background: #e6e6e6;
height: 20px;
border-radius: 3px;
}
.dialog-right {
height: 100vh;
flex: 1;
}
.dialog-search {
/* height: 50px;
border-bottom: 1px solid #e6e6e6;
padding-left: 20px; */
padding: 9px 0;
justify-content: space-between;
}
.dialog-search .el-input {
width: 240px;
}
.dialog-search .el-input__inner {
background: #F9F9F9;
border: none;
}
.dialog-right-body {
padding: 0 20px;
height: calc(100vh - 62px);
overflow: auto;
}
.dialog-footer {
padding: 15px 20px;
justify-content: space-between;
}
.operation-button {
width: 60px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
font-size: 12px;
margin-left: 10px;
cursor: pointer;
}
.cancel-button {
border: 1px solid #E6E6E6;
color: #C4C4C4;
}
.define-button {
background: #6E3DC8;
color: #fff;
}
.dialog-right-body-title {
height: 50px;
justify-content: space-between;
font-size: 12px;
margin-bottom: 10px;
}
.dialog-right-body-title .el-icon-tickets {
font-size: 13px;
color: #7438D5;
margin-right: 10px;
}
.select-container {
flex-wrap: wrap;
}
.goods-item {
width: 240px;
height: 60px;
background: #FFFFFF;
border: 1px solid #E6E6E6;
box-sizing: border-box;
border-radius: 4px;
padding: 8px;
margin-right: 14px;
margin-bottom: 14px;
position: relative;
}
.goods-item-active {
border-color: #7438D5;
}
.active-icon {
width: 22px;
height: 22px;
position: absolute;
right: -1px;
top: -1px;
display: none;
}
.goods-image {
width: 44px;
height: 44px;
border: 1px solid #E6E6E6;
border-radius: 3px;
margin-right: 10px;
}
.goods-message {
display: flex;
flex-direction: column;
justify-content: space-between;
flex: 1;
height: 100%;
}
.goods-bodys {
justify-content: space-between;
height: 20px;
}
.goods-price {
color: #ED655F;
}
.goods-stock {
color: #999;
}
.goods-container {
flex-wrap: wrap;
/* padding-top: 20px; */
}
.el-pagination.is-background .el-pager li:not(.disabled).active {
background: #7438D5;
}
.el-image {
height: 100%;
width: 100%;
}
.image-slot {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.level-item-1,
.level-item-2,
.level-item-3,
.level-item-4 {
height: 26px;
line-height: 26px;
display: flex;
align-items: center;
}
.level-item-2 {
padding-left: 20px;
}
.level-item-3 {
padding-left: 40px;
}
.level-item-4 {
padding-left: 73px;
}
.el-icon-arrow-down {
color: #666;
}
.arrow-open {
transform: rotateZ(90deg);
transition: transform .25s linear;
}
.arrow-selected {
color: #7438D5;
background: rgba(116, 56, 213, 0.14);
border-radius: 4px;
}
.item-name {
cursor: pointer;
flex: 1;
}
.el-icon-caret-right {
color: #666;
}
.i-container {
/* width: 13px;
height: 13px; */
margin-right: 6px;
}
[v-cloak] {
display: none
}
</style>
<script src="__CDN__/assets/addons/shopro/libs/vue.js"></script>
<script src="__CDN__/assets/addons/shopro/libs/element/element.js"></script>
<div id="goodsSelect" v-cloak>
<div class="dialog-body display-flex">
<div class="dialog-left">
<div v-for="(level1,p) in goodsData" :key="p">
<div class="level-item-1" :class="level1.selected?'arrow-selected':''">
<div class="i-container">
<i v-if="level1.children && level1.children.length>0" class="el-icon-caret-right"
:class="level1.show?'arrow-open':''" @click="showLeft(p, null, null,null)"></i>
</div>
<span class="item-name" @click="selectCategoryLeft(p, null, null,null)">{{level1.name}}</span>
</div>
<el-collapse-transition v-for="(level2,c) in level1.children">
<div :key="c" v-show="level1.show">
<div class="level-item-2" :class="level2.selected?'arrow-selected':''">
<div class="i-container">
<i v-if="level2.children && level2.children.length>0" class="el-icon-caret-right"
:class="level2.show?'arrow-open':''" @click="showLeft(p, c, null,null)"></i></div>
<span class="item-name" @click="selectCategoryLeft(p, c, null,null)">{{level2.name}}</span>
</div>
<el-collapse-transition v-for="(level3,a) in level2.children">
<div :key="a" v-show="level2.show">
<div class="level-item-3" :class="level3.selected?'arrow-selected':''">
<div class="i-container">
<i v-if="level3.children && level3.children.length>0"
class="el-icon-caret-right" :class="level3.show?'arrow-open':''"
@click="showLeft(p, c, a,null)"></i></div>
<span class="item-name"
@click="selectCategoryLeft(p, c, a,null)">{{level3.name}}</span>
</div>
<el-collapse-transition v-for="(level4,s) in level3.children">
<div :key="s" v-show="level3.show">
<div class="level-item-4" :class="level4.selected?'arrow-selected':''">
<!-- <i class="el-icon-caret-right" @click="showLeft(p, c, a,s)"></i> -->
<span class="item-name"
@click="selectCategoryLeft(p, c, a,s)">{{level4.name}}</span>
</div>
</div>
</el-collapse-transition>
</div>
</el-collapse-transition>
</div>
</el-collapse-transition>
</div>
</div>
<div class="dialog-right">
<div class="dialog-right-body">
<div class="dialog-search display-flex">
<div>
<span v-if="!isAll && multiple=='true'" class="theme-color cursor-pointer"
@click="checkedAll(true)">全选</span>
<span v-if="isAll && multiple=='true'" class="cursor-pointer"
@click="checkedAll(false)">全不选</span>
</div>
<el-input size="small" placeholder="请输入搜索内容" v-model="searchWhere">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
</div>
<!-- -->
<div class="goods-container display-flex">
<div class="goods-item display-flex" :class="(selectedIdsArr.includes(item.id) || item.id==selectedItem.id)?'goods-item-active':''"
v-for="(item,index) in goodsList" @click="selectGoods(item,index)">
<div class="goods-image">
<el-image :src="Fast.api.cdnurl(item.image)" fit="contain">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
<div class="goods-message">
<div class="display-flex">
<div style="margin-right:10px">{{item.id}}</div>
<div class="goods-title ellipsis-item">{{item.title}}</div>
</div>
<div class="goods-bodys display-flex">
<div v-if="item.activity_type">
<div class="goods-price" v-if="item.activity_type=='seckill'" style="width: 36px;
height: 20px;text-align: center;
background: rgba(255, 132, 118, 0.1);
border: 1px solid rgba(255, 132, 118, 0.5);font-size: 12px;
line-height: 20px;color: #FF8476;border-radius: 4px;">{{item.activity_type_text}}</div>
<div class="goods-price" v-if="item.activity_type=='groupon'" style="width: 36px;
height: 20px;text-align: center;
background: rgba(162, 104, 255, 0.1);
border: 1px solid rgba(162, 104, 255, 0.5);font-size: 12px;
line-height: 20px;color: #A268FF;border-radius: 4px;">{{item.activity_type_text}}</div>
</div>
<div v-if="!item.activity_type && item.app_type=='score'" style="width: 36px;
height: 20px;text-align: center;
background: rgba(251, 175, 61, 0.1);
border: 1px solid rgba(251, 175, 61, 0.5);font-size: 12px;
line-height: 20px;color: #FBAF3D;border-radius: 4px;">{{item.app_type_text}}</div>
<div></div>
<div class="goods-stock">库存:{{item.stock}}</div>
</div>
</div>
<img :style="{display:(selectedIdsArr.includes(item.id) || item.id==selectedItem.id)?'block':'none'}" class="active-icon"
src="/assets/addons/shopro/img/goods/active.png">
</div>
</div>
</div>
<div class="dialog-footer display-flex">
<div>
<el-pagination background layout="prev, pager, next" :total="totalPage" pager-count="12"
@prev-click="changeClick" @next-click="changeClick" @current-change="changeClick"
:current-page="currentPage" page-size="12">
</el-pagination>
</div>
<div class="display-flex">
<div @click="operation('define')" class="operation-button define-button">确定</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
... ... @@ -52,52 +52,44 @@
}
</style>
<script src="__CDN__/assets/addons/shopro/libs/vue.js"></script>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="panel panel-default panel-intro">
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="basic">
<div class="widget-body no-padding">
<table class="table" id="skuPrce" v-cloak>
<thead>
<tr>
<th v-for="(item, i) in skuList" :key="i">
{{item.name}}
</th>
<th width="80">库存</th>
<th width="80">价格</th>
<!--<th width="80">活动销量</th>
<th width="80">活动库存</th>
<th width="80">活动价格</th>
<th width="80">操作</th>-->
</tr>
</thead>
<tbody>
<tr v-for="(item, i) in skuPrice" :key="i" >
<td width="80" v-for="(v, j) in item.goods_sku_text" :key="j">
{{v}}
</td>
<td width="80"><input type="text" v-model="item.stock" class="input-sm form-control"
disabled>
</td>
<td width="80">
<input type="text" v-model="item.price" class="input-sm form-control" disabled>
</td>
<td width="80">
<span class="input-sm form-control status"
:class="item.opt?'status-s':''"
@click="goDealer(i)">经销商列表</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="basic">
<div class="widget-body no-padding">
<table class="table" id="skuPrce" v-cloak>
<thead>
<tr>
<th v-for="(item, i) in skuList" :key="i">
{{item.name}}
</th>
<th width="80">库存</th>
<th width="80">价格</th>
<!--<th width="80">活动销量</th>
<th width="80">活动库存</th>
<th width="80">活动价格</th>
<th width="80">操作</th>-->
</tr>
</thead>
<tbody>
<tr v-for="(item, i) in skuPrice" :key="i" >
<td width="80" v-for="(v, j) in item.goods_sku_text" :key="j">
{{v}}
</td>
<td width="80">
<input type="text" v-model="item.stock" class="input-sm form-control"
disabled>
</td>
<td width="80">
<input type="text" v-model="item.price" class="input-sm form-control" disabled>
</td>
<td width="80">
<span class="input-sm form-control status"
:class="item.opt?'status-s':''"
@click="goDealer(i)">经销商分配库存</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="button" class="btn btn-success btn-embossed" id="activitySub">{:__('OK')}</button>
</div>
</div>
</form>
\ No newline at end of file
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -29,7 +29,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'admin.username', title: __('Admin.username'), operate: 'LIKE'},
{field: 'dealer_name', title: __('Dealer_name'), operate: 'LIKE'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
//操作栏,默认有编辑、删除或排序按钮,可自定义配置buttons来扩展按钮
{
field: 'operate',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'orderlist',
text: __('订单'),
title: __('订单'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: 'shopro/order/order?dealer_id={id}',
}
],
formatter: Table.api.formatter.operate
}
]
]
});
... ... @@ -112,32 +129,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
is_edit: false
}
},
mounted() {
},
methods: {
goDealer(i) {
let sku_price_id = this.skuPrice[i].id;
Fast.api.open('dealer/dealer_stock?sku_price_id=' + sku_price_id, '设置经销商')
Fast.api.open('dealer/dealer_stock?sku_price_id=' + sku_price_id, '经销商分配库存')
},
},
})
$(document).on("click", "#activitySub", function () {
Layer.confirm('确认提交吗', {
btn: ['确认', '取消']
}, function () {
if (isSubmit) {
return true;
} else {
layer.msg('请把信息填写完整');
}
return true;
}, function () {
Layer.closeAll();
return false;
});
})
Controller.api.bindevent();
},
api: {
... ...