提交 84ca0eef authored 作者: 吴德鹏's avatar 吴德鹏

Merge remote-tracking branch 'origin/master'

<!DOCTYPE html>
<html>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<head>
<title></title>
#parse("sys/header.html")
<style>
.activityEdit{
margin-left: -40px;
border: 1px solid #e3e3e3;
width: 400px;
padding: 20px;
text-align: center;
border-radius:6px ;
}
.activityEdit ul{
}
.activityEdit ul li{
margin-bottom: 10px;
}
.activityEdit ul li span{
display:inline-block;
padding:0 15px;
border: 1px solid red;
border-radius: 6px;
color: red;
cursor:pointer;
margin-left: 5px;
}
.activityAdd{
margin-top: 20px;
display:inline-block;
border: 1px dashed #e3e3e3;
cursor:pointer;
padding: 0px 50px;
border-radius: 6px;
}
</style>
</head>
<body>
<div id="rrapp" v-cloak style="height: calc(100% - 15px);">
......@@ -20,10 +55,10 @@
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
#end
#if($shiro.hasPermission("activity:update"))
<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
<i-button type="warning" @click="update(null)"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
#end
#if($shiro.hasPermission("activity:delete"))
<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
<i-button type="error" @click="del(null)"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
#end
</div>
</Row>
......@@ -36,39 +71,206 @@
<Form-item label="活动名称" prop="name">
<i-input v-model="activity.name" placeholder="活动名称"/>
</Form-item>
<Form-item label="活动类型 1:满减 2:满折 3:满件打折" prop="type">
<i-input v-model="activity.type" placeholder="活动类型 1:满减 2:满折 3:满件打折"/>
<!-- <Form-item label="活动图片" prop="picture">-->
<!-- <i-input v-model="activity.picture" placeholder="活动图片"/>-->
<!-- </Form-item>-->
<Form-item label="活动内容" prop="content">
<i-input v-model="activity.content" placeholder="活动内容"/>
</Form-item>
<Form-item label="活动图片" prop="picture" >
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
multiple
action="../api/osstest/uploadtest"
:before-upload="handleBeforeUpload"
:on-success="vhandleSuccess" :show-upload-list="false" accept="image/jpeg, image/png">
<i-button icon="ios-cloud-upload-outline">请选择图片</i-button>
</upload>
<div id="imgWrapper" style="display: flex;position: relative;">
<div v-show="activity.picture" style="margin-left: 5px;" :data-img-path="activity.picture">
<img :src="activity.picture" width="100" height="100" id="itemImg">
<i class="ivu-icon ivu-icon-ios-trash-outline"
style="cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"
@click="delImg1(activity.picture)"></i>
</div>
</div>
</Form-item>
<Form-item label="活动类型" prop="type">
<!-- <i-input v-model="activity.type" placeholder="活动类型 1:满减 2:满折 3:满件打折"/>-->
<Radio-group v-model="activity.type" @on-change="ChangeClear">
<Radio label="1">
<span>满减</span>
</Radio>
<Radio label="2">
<span>满折</span>
</Radio>
<Radio label="3">
<span>满件打折</span>
</Radio>
</Radio-group>
</Form-item>
<Form-item>
<div v-if="activity.type==1" class="activityEdit">
<ul>
<li v-for="(item,index) in activity.condition" :key="index">
当满&nbsp;&nbsp;<i-input v-model="item.key" style="width: 77px"></i-input>&nbsp;&nbsp;
&nbsp;&nbsp;<i-input v-model="item.value" style="width: 77px"></i-input>
<span @click="delCondition(item)">删除</span>
</li>
</ul>
<span @click="addCondition" class="activityAdd">添加</span>
</div>
<div v-if="activity.type==2" class="activityEdit">
<ul>
<li v-for="(item,index) in activity.condition" :key="index">
当满&nbsp;&nbsp;<i-input v-model="item.key" style="width: 77px"></i-input>&nbsp;&nbsp;
&nbsp;&nbsp;<i-input v-model="item.value" style="width: 77px"></i-input>&nbsp;%
<span @click="delCondition(item)">删除</span>
</li>
</ul>
<span @click="addCondition" class="activityAdd">添加</span>
</div>
<div v-if="activity.type==3" class="activityEdit">
<ul>
<li v-for="(item,index) in activity.condition" :key="index">
当满&nbsp;&nbsp;<i-input v-model="item.key" style="width: 77px"></i-input>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i-input v-model="item.value" style="width: 77px"></i-input>&nbsp;%
<span @click="delCondition(item)">删除</span>
</li>
</ul>
<span @click="addCondition" class="activityAdd">添加</span>
</div>
</Form-item>
<Form-item label="使用类型" prop="useType">
<!-- <i-input v-model="activity.useType" placeholder="使用类型 1:全场 2:分类商品 3:特定商品"/>-->
<Radio-group v-model="activity.useType" @on-change="ChangeClear2">
<Radio label="1">
<span>全场</span>
</Radio>
<Radio label="2">
<span>分类商品</span>
</Radio>
<Radio label="3">
<span>特定商品</span>
</Radio>
</Radio-group>
</Form-item>
<Form-item label="使用类型 1:全场 2:分类商品 3:特定商品" prop="useType">
<i-input v-model="activity.useType" placeholder="使用类型 1:全场 2:分类商品 3:特定商品"/>
<Form-item label="一级商品分类" prop="categoryIdOne" v-if="activity.useType==2" style="width:300px">
<i-select placeholder="请选择" v-model="categoryIdOne" @on-change="changeGoodstype">
<i-option v-for="(el,i) in Goodstype" :key='i'
:value="el.goodstypeId">{{el.goodstypeTitle}}
</i-option>
</i-select>
</Form-item>
<Form-item label="商品分类ID" prop="categoryId">
<i-input v-model="activity.categoryId" placeholder="商品分类ID"/>
<Form-item label="二级商品分类" prop="categoryIdTwo" v-if="activity.useType==2" style="width:300px">
<i-select placeholder="请选择" v-model="categoryIdTwo" @on-change="changeGoodstype2">
<i-option v-for="(el,i) in GoodstypeTwo" :key='i'
:value="el.goodstwotypeId">{{el.goodstwotypeTitle}}
</i-option>
</i-select>
</Form-item>
<Form-item label="活动图片" prop="picture">
<i-input v-model="activity.picture" placeholder="活动图片"/>
<Form-item label="三级商品分类" prop="categoryIdThree" v-if="activity.useType==2" style="width:300px">
<i-select placeholder="请选择" v-model="categoryIdThree">
<i-option v-for="(el,i) in GoodstypeThree" :key='i'
:value="el.descripitionId">{{el.descripitionName}}
</i-option>
</i-select>
</Form-item>
<Form-item label="活动条件(json)" prop="condition">
<i-input v-model="activity.condition" placeholder="活动条件(json)"/>
<!-- <Form-item label="商品分类ID" prop="categoryId" v-if="activity.useType==2">-->
<!-- <i-input v-model="activity.categoryId" placeholder="商品分类ID"/>-->
<!-- </Form-item>-->
<!-- <Form-item label="活动条件(json)" prop="condition">-->
<!-- <i-input v-model="activity.condition" placeholder="活动条件(json)"/>-->
<!-- </Form-item>-->
<Form-item label="一级商品分类" prop="categoryIdOne" v-if="activity.useType==3" style="width:300px">
<i-select placeholder="请选择" v-model="categoryIdOne" @on-change="changeGoodstype">
<i-option v-for="(el,i) in Goodstype" :key='i'
:value="el.goodstypeId">{{el.goodstypeTitle}}
</i-option>
</i-select>
</Form-item>
<Form-item label="特定商品链接" prop="link">
<i-input v-model="activity.link" placeholder="特定商品链接"/>
<Form-item label="二级商品分类" prop="categoryIdTwo" v-if="activity.useType==3" style="width:300px">
<i-select placeholder="请选择" v-model="categoryIdTwo" @on-change="changeGoodstype2">
<i-option v-for="(el,i) in GoodstypeTwo" :key='i'
:value="el.goodstwotypeId">{{el.goodstwotypeTitle}}
</i-option>
</i-select>
</Form-item>
<Form-item label="活动状态 0:关闭 1:开启" prop="status">
<i-input v-model="activity.status" placeholder="活动状态 0:关闭 1:开启"/>
<Form-item label="三级商品分类" prop="categoryIdThree" v-if="activity.useType==3" style="width:300px">
<i-select placeholder="请选择" v-model="categoryIdThree">
<i-option v-for="(el,i) in GoodstypeThree" :key='i'
:value="el.descripitionId">{{el.descripitionName}}
</i-option>
</i-select>
</Form-item>
<Form-item label="活动开始时间" prop="startTime">
<i-input v-model="activity.startTime" placeholder="活动开始时间"/>
<Form-item label="特定商品" prop="itemIds" v-if="activity.useType==3">
<div class="search">
<i-Input v-model="search"
placeholder="请输入搜索内容(可选)" style="width:300px"></i-Input>
<i-Button
type="primary"
style="width:100px;"
@click='handleSearch()'
>搜索</i-Button>
<!-- <i-Button style="width:100px;" @click="resetSelectedCategory('commodity')">重置</i-Button>-->
<i-button type="info" @click="addItems">添加商品</i-button>
</div>
<section id="showItems">
<table id="searchjqGrid"></table>
</section>
<section>
<table id="adItemjqGrid"></table>
</section>
</Form-item>
<Form-item label="活动结束时间" prop="endTime">
<i-input v-model="activity.endTime" placeholder="活动结束时间"/>
<Form-item label="活动状态" prop="status">
<Radio-group v-model="activity.status">
<Radio label="1">
<span>开启</span>
</Radio>
<Radio label="0">
<span>关闭</span>
</Radio>
</Radio-group>
</Form-item>
<Form-item label="创建时间" prop="createTime">
<i-input v-model="activity.createTime" placeholder="创建时间"/>
<!-- <Form-item label="活动开始时间" prop="startTime">-->
<!-- <i-input v-model="activity.startTime" placeholder="活动开始时间"/>-->
<!-- </Form-item>-->
<Form-item label="活动开始时间" prop="startTime">
<template>
<div class="block">
<el-date-picker
v-model="activity.startTime"
type="datetime"
placeholder="活动开始时间">
</el-date-picker>
</div>
</template>
<!-- <i-input v-model="tbCfCoupon.startTime" placeholder="发放开始时间"/>-->
</Form-item>
<Form-item label="更新时间" prop="updateTime">
<i-input v-model="activity.updateTime" placeholder="更新时间"/>
<!-- <Form-item label="活动结束时间" prop="endTime">-->
<!-- <i-input v-model="activity.endTime" placeholder="活动结束时间"/>-->
<!-- </Form-item>-->
<Form-item label="活动结束时间" prop="endTime">
<template>
<div class="block">
<el-date-picker
v-model="activity.endTime"
type="datetime"
placeholder="活动结束时间">
</el-date-picker>
</div>
</template>
<!-- <i-input v-model="tbCfCoupon.startTime" placeholder="发放开始时间"/>-->
</Form-item>
<!-- <Form-item label="更新时间" prop="updateTime">-->
<!-- <i-input v-model="activity.updateTime" placeholder="更新时间"/>-->
<!-- </Form-item>-->
<Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
......@@ -77,7 +279,7 @@
</i-form>
</Card>
</div>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="${rc.contextPath}/js/sys/activity.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
......@@ -704,24 +704,24 @@
<Form-item label="成本价" prop="costPrice" style="width: 800px">
<i-input v-model="tbCfStationItem.costPrice" placeholder="成本价"/>
</Form-item>
<Form-item label="商品图片" prop="itemImg" >
<!-- <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> -->
<upload
multiple
action="../api/osstest/uploadtest"
:before-upload="handleBeforeUpload"
:on-success="vhandleSuccess" :show-upload-list="false" accept="image/jpeg, image/png">
<i-button icon="ios-cloud-upload-outline">请选择图片</i-button>
</upload>
<div id="imgWrapper" style="display: flex;position: relative;">
<div v-for="item in uploadList" style="margin-left: 5px;" :data-img-path="item">
<img :src="item" width="100" height="100" id="itemImg">
<i class="ivu-icon ivu-icon-ios-trash-outline"
style="cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"
@click="delImg1(item)"></i>
</div>
</div>
</Form-item>
<!-- <Form-item label="商品图片" prop="itemImg" >-->
<!-- &lt;!&ndash; <i-input v-model="xPicture.pictureUrl" placeholder="图片地址"/> &ndash;&gt;-->
<!-- <upload-->
<!-- multiple-->
<!-- action="../api/osstest/uploadtest"-->
<!-- :before-upload="handleBeforeUpload"-->
<!-- :on-success="vhandleSuccess" :show-upload-list="false" accept="image/jpeg, image/png">-->
<!-- <i-button icon="ios-cloud-upload-outline">请选择图片</i-button>-->
<!-- </upload>-->
<!-- <div id="imgWrapper" style="display: flex;position: relative;">-->
<!-- <div v-for="item in uploadList" style="margin-left: 5px;" :data-img-path="item">-->
<!-- <img :src="item" width="100" height="100" id="itemImg">-->
<!-- <i class="ivu-icon ivu-icon-ios-trash-outline"-->
<!-- style="cursor:pointer;display: flex;font-size: 24px;position: relative;left:11px"-->
<!-- @click="delImg1(item)"></i>-->
<!-- </div>-->
<!-- </div>-->
<!-- </Form-item>-->
<Form-item label="商品链接" prop="itemUrl" style="width: 800px">
<i-input v-model="tbCfStationItem.itemUrl" placeholder="商品链接"/>
</Form-item>
......
......@@ -854,6 +854,21 @@ itemStatusFormatEn = function (cellvalue) {
}
return returnStr;
}
activityStatusFormat = function (cellvalue) {
var returnStr;
if (cellvalue == '0') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-warning\" style='border-radius:25px;' type=\"info\">活动关闭</i-button>";
} else if (cellvalue == '1') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-info\" style='border-radius:25px;' type=\"warning\">活动开启</i-button>";
}
return returnStr;
}
shows = function (cellvalue, options, rowObject) {
let returnStr;
returnStr = "<i-button class=\"ivu-btn ivu-btn-info\" onclick=showWord('" + rowObject.id + "') type=\"info\">查看</i-button>";
......
......@@ -4,17 +4,64 @@ $(function () {
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '活动名称', name: 'name', index: 'name', width: 80},
{label: '活动类型 1:满减 2:满折 3:满件打折', name: 'type', index: 'type', width: 80},
{label: '使用类型 1:全场 2:分类商品 3:特定商品', name: 'useType', index: 'use_type', width: 80},
{label: '商品分类ID', name: 'categoryId', index: 'category_id', width: 80},
{label: '活动图片', name: 'picture', index: 'picture', width: 80},
{label: '活动条件(json)', name: 'condition', index: 'condition', width: 80},
{label: '特定商品链接', name: 'link', index: 'link', width: 80},
{label: '活动状态 0:关闭 1:开启', name: 'status', index: 'status', width: 80},
{label: '活动类型 1:满减 2:满折 3:满件打折', name: 'type', index: 'type', width: 80,formatter:function (value, grid, rows){
var returnStr;
if (value == '1') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-primary\" style='border-radius:25px;' type=\"info\">满减</i-button>";
} else if (value == '2') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-success\" style='border-radius:25px;' type=\"warning\">满折</i-button>";
}else if (value == '3') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-warning\" style='border-radius:25px;' type=\"error\">满件打折</i-button>";
}
return returnStr;
}},
{label: '使用类型 1:全场 2:分类商品 3:特定商品', name: 'useType', index: 'use_type', width: 80,formatter:function (value, grid, rows){
var returnStr;
if (value == '1') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-primary\" style='border-radius:25px;' type=\"info\">全场</i-button>";
} else if (value == '2') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-success\" style='border-radius:25px;' type=\"warning\">分类商品</i-button>";
}else if (value == '3') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-warning\" style='border-radius:25px;' type=\"error\">特定商品</i-button>";
}
return returnStr;
}},
// {label: '商品分类ID', name: 'categoryId', index: 'category_id', width: 80},
// {label: '活动图片', name: 'picture', index: 'picture', width: 80},
{
label: '活动图片', name: 'picture', index: 'picture', width: 80, formatter: function (value, grid, rows) {
if (value.indexOf(';')) {
let firstImg = value.split(';')[0];
return '<img src="' + firstImg + '" style="width:100px;height:100px;" id="picture"/>'
}
return '<img src="' + value + '" style="width:100px;height:100px;" id="picture"//>'
}
},
// {label: '活动条件(json)', name: 'condition', index: 'condition', width: 80},
{label: '活动开始时间', name: 'startTime', index: 'start_time', width: 80},
{label: '活动结束时间', name: 'endTime', index: 'end_time', width: 80},
// {label: '特定商品链接', name: 'link', index: 'link', width: 80},
// {label: '活动状态 0:关闭 1:开启', name: 'status', index: 'status', width: 80},
{label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
{label: '更新时间', name: 'updateTime', index: 'update_time', width: 80}]
{label: '活动状态 0:关闭 1:开启', name: 'status', index: 'status', width: 80,formatter:function (value, grid, rows){
var returnStr;
if (value == '0') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-error\" style='border-radius:25px;' type=\"info\">活动关闭</i-button>";
} else if (value == '1') {
returnStr = "<i-button class=\"ivu-btn ivu-btn-info\" style='border-radius:25px;' type=\"warning\">活动开启</i-button>";
}
return returnStr;
}
},
{
label: '操作', index: 'operate', width: 130, formatter: function (value, grid, rows) {
return '<span class="label label-primary pointer" onclick="">开启/关闭</span>&nbsp;&nbsp;&nbsp;' +
'<span class="label label-danger pointer" onclick="vm.del(\'' + rows.id + '\')">删除</span>&nbsp;&nbsp;&nbsp;' +
'<span class="label label-info pointer" onclick="vm.update(\'' + rows.id + '\')">编辑</span>'
}
},
]
});
});
......@@ -23,7 +70,11 @@ let vm = new Vue({
data: {
showList: true,
title: null,
activity: {},
activity: {
status:0,
picture:'',
condition:[]
},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
......@@ -31,7 +82,16 @@ let vm = new Vue({
},
q: {
name: ''
}
},
uploadList: [],
Goodstype:null,
categoryIdOne:null,
GoodstypeTwo:null,
categoryIdTwo:null,
GoodstypeThree:null,
categoryIdThree:null,
search:null,
Allitemids:[]
},
methods: {
query: function () {
......@@ -40,11 +100,28 @@ let vm = new Vue({
add: function () {
vm.showList = false;
vm.title = "新增";
vm.activity = {};
vm.activity = {condition:[]};
this.activity.picture = '';
vm.categoryIdOne=null;
vm.GoodstypeTwo=null;
vm.categoryIdTwo=null;
vm.GoodstypeThree=null;
vm.categoryIdThree=null;
// $("#adItemjqGrid").jqGrid("clearGridData");
// $("#searchjqGrid").jqGrid("clearGridData");
},
update: function (event) {
let id = getSelectedRow("#jqGrid");
if (id == null) {
update: function (ids) {
// console.log(ids)
// let id = getSelectedRow("#jqGrid");
// if (id == null) {
// return;
// }
let id = this.getSelectedRows1("#jqGrid",ids)
console.log(ids)
if (id == null&&ids){
id = ids
}else if(id == null&&!ids){
return;
}
vm.showList = false;
......@@ -54,6 +131,7 @@ let vm = new Vue({
},
saveOrUpdate: function (event) {
let url = vm.activity.id == null ? "../activity/save" : "../activity/update";
console.log(vm.activity)
Ajax.request({
url: url,
params: JSON.stringify(vm.activity),
......@@ -66,12 +144,15 @@ let vm = new Vue({
}
});
},
del: function (event) {
let ids = getSelectedRows("#jqGrid");
if (ids == null){
del: function (id) {
let ids = this.getSelectedRows1("#jqGrid",id)
console.log(ids)
if (ids == null&&id){
ids = [id]
}else if(ids == null&&!id){
return;
}
console.log(ids)
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../activity/delete",
......@@ -92,6 +173,13 @@ let vm = new Vue({
async: true,
successCallback: function (r) {
vm.activity = r.activity;
console.log(vm.activity)
vm.clearActivity();
vm.clearCondition();
vm.changeGoodstype();
vm.changeGoodstype2();
vm.clearItemids(1);
vm.AllItems();
}
});
},
......@@ -111,12 +199,299 @@ let vm = new Vue({
vm.reload();
},
handleSubmit: function (name) {
vm.categoryIdClear();
vm.conditionClear();
vm.clearItemids(0);
handleSubmitValidate(this, name, function () {
vm.saveOrUpdate()
});
},
categoryIdClear(){
let catregoryIdarr = null
if(this.categoryIdOne&&!this.categoryIdTwo&&!this.categoryIdThree){
catregoryIdarr = [this.categoryIdOne]
}
if(this.categoryIdOne&&this.categoryIdTwo&&!this.categoryIdThree){
catregoryIdarr = [this.categoryIdOne,this.categoryIdTwo]
}
if(this.categoryIdOne&&this.categoryIdTwo&&this.categoryIdThree){
catregoryIdarr = [this.categoryIdOne,this.categoryIdTwo,this.categoryIdThree]
}
if(catregoryIdarr&&vm.activity.useType==2){
vm.activity.categoryId = catregoryIdarr.toString()
}else {
vm.activity.categoryId = null
}
},
handleReset: function (name) {
handleResetForm(this, name);
},
handleBeforeUpload(file) {
// 上传图片大小不超过5M
if (file.size > 5 * 1024 * 1024) {
alert('请上传不超过5M的图片');
return false;
}
// const check = this.uploadList.length < 1;
// if (!check) {
// this.$Notice.warning({
// title: '最多只能上传一张图片'
// });
// return false;
// }
// 限制上传文件的宽高
// return this.checkImageWH(file,750,320);
},
clearActivity(){
if(vm.activity.useType==2){
vm.activity.condition = JSON.parse(vm.activity.condition)
vm.categoryIdOne = vm.activity.categoryId.split(',')[0]
vm.categoryIdTwo = vm.activity.categoryId.split(',')[1]
vm.categoryIdThree = vm.activity.categoryId.split(',')[2]
}
},
clearCondition(){
this.activity.condition = JSON.parse(this.activity.condition)
},
delCondition(index){
vm.activity.condition.remove(index)
},
ChangeClear(){
vm.activity.condition = [{'key':'','value':''}]
},
vhandleSuccess(response, file, fileList) {
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
console.log('shangchuan', response)
vm.activity.picture=response;
console.log('shangchuan', vm.activity.picture)
$("#itemImg").show();
},
getSelectedRows1(gridId,id) {
var grid = $(gridId);
var rowKey = grid.getGridParam("selrow");
if (!rowKey&&!id) {
iview.Message.error("请选择一条记录");
return;
}else if(!rowKey){
return;
}
return grid.getGridParam("selarrrow");
},
clearItemids(i){
if(i==1){
vm.activity.itemIds = vm.activity.itemIds.split(',')
}else if(i==0){
vm.activity.itemIds = vm.activity.itemIds.toString()
}
},
addCondition(){
// var conditionKey = 'key'+vm.activity.condition.length
// var conditionValue = 'value'+vm.activity.condition.length
var conditionNew = {'key':'','value':''}
vm.activity.condition.push(conditionNew)
},
delImg1: function (url) {
if (vm.title != "详情") {
vm.activity.picture = '';
console.log(url);
Ajax.request({
url: "../api/upload/delFile?url=" + url,
async: false,
type: "POST",
contentType: "application/json",
successCallback: function (resultData) {
// console.log(resultData);
iview.Message.success(resultData.success);
}
});
}
},
changeGoodstype(e){
let url;
if (e != null) {
url = "../tbcfstationitem/queryByItemType?typeId=" + e;
} else {
url = "../tbcfstationitem/queryByItemType?typeId=" + this.categoryIdOne;
}
// console.log('url',url)
let that = this;
Ajax.request({
url: url,
type: "get",
contentType: "application/json",
successCallback: function (r) {
if (r.code === 0) {
that.GoodstypeTwo = r.list
e ? setTimeout(() => {
that.changeGoodstype2()
}, 0) : void (0);
if (r.list.length === 0) {
that.categoryIdTwo = null
// that.q.itemCategorytwo = null
}
}
}
});
},
changeGoodstype2(e){
let url;
if (e != null) {
url = "../tbcfstationitem/queryByItemTypeTwo?typeTwoId=" + e;
} else {
url = "../tbcfstationitem/queryByItemTypeTwo?typeTwoId=" + this.categoryIdTwo;
}
let that = this;
Ajax.request({
url: url,
type: "get",
contentType: "application/json",
successCallback: function (r) {
if (r.code === 0) {
that.GoodstypeThree = r.descripiton
if (r.descripiton.length === 0) {
that.categoryIdThree = null
// that.q.itemDescritionId = null
}
}
}
});
},
conditionClear(){
// parseFloat()
this.activity.useType = parseInt(this.activity.useType)
this.activity.condition.forEach(item=>{
item.key = parseFloat(item.key);
item.value = parseFloat(item.value);
})
this.activity.condition = JSON.stringify(this.activity.condition)
},
ChangeClear2(){
console.log("改变")
this.categoryIdOne=null
this.GoodstypeTwo=null
this.categoryIdTwo=null
this.GoodstypeThree=null
this.categoryIdThree=null
// categoryId
vm.activity.categoryId = null
},
handleSearch(e) {
1==1 ? (()=>{
$('#showItems').children().remove();
$('#showItems').append(`<table id="searchjqGrid"></table>`);
function beforeSelectRow(){
$("#searchjqGrid").jqGrid('resetSelection');
return(true);
}
let _this = this;
$(function () {
$("#searchjqGrid").Grid({
url: `../tbcfstationitem/list?itemCategory=${_this.categoryIdOne||''}&typeTwo=${_this.categoryIdTwo||''}&typeThree=${_this.categoryIdThree||''}&name=${vm.search||e||''}`,
colModel: [
{label: 'itemId', name: 'itemId', index: 'item_id', key: true, hidden: true},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 50, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
/* {label: '商品标题', name: 'itemBrief', index: 'item_brief', width: 120},*/
/*{label: '商品链接', name: 'itemUrl', index: 'item_url', width: 80,formatter:linkFormat},*/
{label: '商品原价', name: 'itemPrice', index: 'item_price', width: 65},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 55},
{label: '库存', name: 'itemCount', index: 'item_count', width: 55},
{label: '点击量', name: 'itemNum', index: 'item_num', width: 55},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 80},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 80},
{label: '商品二级分类', name: 'title', index: 'title', width: 80},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{label: '状态', name: 'enableFlag', index: 'enable_flag', width: 120, formatter: itemStatusFormat},
{label: '创建日期', name: 'createTime', index: 'create_time', width: 160}
],
multiselect: true,
multiboxonly:true,
beforeSelectRow: beforeSelectRow,
});
});
})() : alert('未输入搜索内容~');
},
addItems(){
$("#adItemjqGrid").jqGrid("clearGridData");
let ids = getSelectedRows("#searchjqGrid");
if (ids == null) {
return;
}
console.log(ids)
//
ids.forEach(item=>{
vm.activity.itemIds.push(item)
})
// vm.Allitemids.push()
console.log(vm.Allitemids)
vm.AllItems()
// let id = vm.advertisement.id;
// if (id == null || id == '' || id == 'undefined') {
// id = vm.tempId;
// }
// Ajax.request({
// url: "../advertisementitem/saveBatch?aId=" + id + '&itemIds=' + ids,
// type: "POST",
// contentType: "application/json",
// successCallback: function () {
// alert('操作成功', function (index) {
// $("#searchjqGrid").jqGrid('resetSelection');
// // let page = $("#adItemjqGrid").jqGrid('getGridParam', 'page');
// // $("#adItemjqGrid").jqGrid('setGridParam', {
// // page: page
// // }).trigger("reloadGrid");
//
// vm.btn_Search(id);
// });
// }
// });
},
AllItems(){
console.log(vm.Allitemids)
$("#adItemjqGrid").Grid({
url: '../tbcfstationitem/queryItemByIds',
colModel: [
{label: 'itemId', name: 'itemId', key: true, index: 'item_id', hidden: true},
{label: '序号', name: 'itemSort', index: 'itemSort', width: 100},
{label: '商品图片', name: 'itemImg', index: 'item_img', width: 100, formatter: imageFormat},
{label: '商品编号', name: 'itemCode', index: 'item_code', width: 160},
{label: '商品名称', name: 'itemName', index: 'item_name', width: 160},
/* {label: '商品标题', name: 'itemBrief', index: 'item_brief', width: 120},*/
/*{label: '商品链接', name: 'itemUrl', index: 'item_url', width: 80,formatter:linkFormat},*/
{label: '商品原价', name: 'itemPrice', index: 'item_price', width: 100},
{label: '商品现价', name: 'discountPrice', index: 'discount_price', width: 100},
/*{label: '所属平台', name: 'platformCode', index: 'platform_code', width: 80},
{label: '平台名', name: 'platformName', index: 'platform_name', width: 80},*/
{label: '供应商', name: 'supplier', index: 'supplier', width: 120},
{label: '商品一级分类', name: 'goodtype', index: 'goodtype', width: 120},
{label: '商品二级分类', name: 'title', index: 'title', width: 120},
{label: '商品品名', name: 'dname', index: 'itemDescritionId', width: 120},
{
label: '操作', index: 'operate', width: 160, formatter: function (value, grid, rows) {
return '<span class="label label-info pointer" onclick="vm.delItem(\'' + rows.itemId + '\')">移除</span>&nbsp;&nbsp;'
// '<span class="label label-info pointer" onclick="vm.sortItem(\'' + rows.itemId + '\')">排序</span>&nbsp;&nbsp;'
}
} // beforeSelectRow: beforeSelectRow,
],
multiboxonly: true,
postData: {"value":vm.activity.itemIds.toString()},
mtype:"POST",
datatype:'json',
// beforeSelectRow: beforeSelectRow,
});
}
},
created(){
$.get('../tbcfgoodstype/queryAll', res => {
this.Goodstype = res.list;
// console.log(this.Goodstype)
})
}
});
......@@ -5251,7 +5251,9 @@ a.label:focus, a.label:hover {
.label-default {
background-color: #777
}
.label-defaultNew {
background-color: red
}
.label-default[href]:focus, .label-default[href]:hover {
background-color: #5e5e5e
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论