产品更改序号

master
lion 3 years ago
parent 275d4552ec
commit 8c7a9272e3

@ -1,15 +1,16 @@
<template> <template>
<div> <div>
<Modal :width="80" :value.sync="isShow" :fullscreen='isFullScreen' @on-visible-change="$emit('update:isShow',$event)" <Modal :width="80" :value.sync="isShow" :fullscreen='isFullScreen'
> @on-visible-change="$emit('update:isShow',$event)">
<div class="ivu-modal-header ivu-modal-header-wrap"> <div class="ivu-modal-header ivu-modal-header-wrap">
<div v-solt:header> <template v-solt:header>
{{name+'订单列表'}} {{name+'订单列表'}}
<a class="ivu-modal-screen" @click="isFullScreen=!isFullScreen"><i :class="isFullScreen?'el-icon-aim':'el-icon-full-screen'"></i></a> <a class="ivu-modal-screen" @click="isFullScreen=!isFullScreen"><i
</div> :class="isFullScreen?'el-icon-aim':'el-icon-full-screen'"></i></a>
</div> </template>
</div>
<Button class="select" type="primary" style="margin-bottom: 10px;" @click="downloadExel"></Button> <Button class="select" type="primary" style="margin-bottom: 10px;" @click="downloadExel"></Button>
<xy-table id="print" :is-page="false" :list="list" :table-item="table" :height="300"> <xy-table id="print" :is-page="false" :list="list" :table-item="table" :height="300">
<template v-slot:btns> <template v-slot:btns>
<div></div> <div></div>
@ -20,25 +21,26 @@
</template> </template>
<script> <script>
import {show} from "@/api/activity" import {
show
} from "@/api/activity"
import { import {
download download
} from '@/utils/downloadRequest' } from '@/utils/downloadRequest'
export default { export default {
props:{ props: {
id:Number, id: Number,
name:String, name: String,
isShow:{ isShow: {
type:Boolean, type: Boolean,
default:false default: false
} }
}, },
data() { data() {
return { return {
isFullScreen:false, isFullScreen: false,
list:[], list: [],
table:[ table: [{
{
prop: "name", prop: "name",
label: "姓名", label: "姓名",
width: 120 width: 120
@ -51,9 +53,9 @@ export default {
{ {
label: "头像", label: "头像",
width: 80, width: 80,
prop:"members.avatar", prop: "members.avatar",
customFn: (row) => { customFn: (row) => {
return ( < div style = { return ( <div style = {
{ {
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
@ -61,7 +63,7 @@ export default {
} }
} > <el-avatar src = { } > <el-avatar src = {
row.members?.avatar row.members?.avatar
} > </el-avatar></div > ) } > </el-avatar></div> )
} }
}, },
@ -106,28 +108,28 @@ export default {
width: 120 width: 120
}, },
], ],
} }
},
methods: {
closeshowChange(){},
fullScreen(){},
async getOrder(){
await show({
id:this.id
}).then(res=>{
for(var k of res.apply){
k.wechat_nickname = k.members?k.members.wechat_nickname:""
k.used_time_name = k.used_time ? '已核销':'待核销'
k.spread_member_name = k.spread_member?k.spread_member.name:''
k.spread_member_phone = k.spread_member?k.spread_member.phone:''
}
this.list = res.apply
})
}, },
downloadExel(){ methods: {
// this.$Print('#print') closeshowChange() {},
fullScreen() {},
async getOrder() {
await show({
id: this.id
}).then(res => {
for (var k of res.apply) {
k.wechat_nickname = k.members ? k.members.wechat_nickname : ""
k.used_time_name = k.used_time ? '已核销' : '待核销'
k.spread_member_name = k.spread_member ? k.spread_member.name : ''
k.spread_member_phone = k.spread_member ? k.spread_member.phone : ''
}
this.list = res.apply
})
},
downloadExel() {
// this.$Print('#print')
this.$Export.excel({ this.$Export.excel({
title: this.name, title: this.name,
columns: this.table, columns: this.table,
@ -139,28 +141,30 @@ export default {
// id:this.id // id:this.id
// }, // },
// this.name+'.xlsx') // this.name+'.xlsx')
} }
}, },
watch:{ watch: {
isShow(newVal){ isShow(newVal) {
if(newVal){ if (newVal) {
this.getOrder() this.getOrder()
}
} }
} }
}
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.ivu-modal-header-wrap{ .ivu-modal-header-wrap {
margin-bottom:10px; margin-bottom: 10px;
padding-top: 0; padding-top: 0;
.ivu-modal-screen{
top:16px; .ivu-modal-screen {
top: 16px;
} }
} }
.ivu-modal-close{
top:7px .ivu-modal-close {
top: 7px
} }
</style> </style>

@ -236,6 +236,7 @@
id: '', id: '',
isShow: false, isShow: false,
type: 'add', type: 'add',
sortnumberNew:'',
action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`, action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
pickerOptions: { pickerOptions: {
shortcuts: [{ shortcuts: [{
@ -377,6 +378,7 @@
sortnumber: res?.sortnumber, sortnumber: res?.sortnumber,
content: res?.content content: res?.content
} }
console.log("form",this.form)
// this.$refs['tinymce'].setContent(this.form.content || ' ') // this.$refs['tinymce'].setContent(this.form.content || ' ')
}, },
@ -441,6 +443,12 @@
// return str // return str
// } // }
// }, // },
async updateSortNumber(){
await this.getDetail()
this.form.sortnumber = this.sortnumberNew
await this.submit()
},
submit() { submit() {
if (this.type === 'add'||this.type === 'copy') { if (this.type === 'add'||this.type === 'copy') {
store({ store({
@ -472,6 +480,7 @@
return return
} }
if (this.type === 'editor') { if (this.type === 'editor') {
// return
save({ save({
id: this.id, id: this.id,
name: this.form.name, name: this.form.name,
@ -496,6 +505,7 @@
type: 'success', type: 'success',
message: '编辑商品成功' message: '编辑商品成功'
}) })
this.sortnumberNew = ""
this.isShow = false this.isShow = false
this.$emit('refresh') this.$emit('refresh')
}) })

@ -37,12 +37,8 @@
类别 类别
</div> </div>
<div> <div>
<el-cascader <el-cascader clearable placeholder="类别选择" style="width: 170px;" size="small" :options="types"
clearable :show-all-levels="false" :props="{value:'id',label:'title',expandTrigger:'hover'}"
placeholder="类别选择"
style="width: 170px;" size="small"
:options="types" :show-all-levels="false"
:props="{value:'id',label:'title',expandTrigger:'hover'}"
@change="e => select.productTypeId = e.at(-1)"> @change="e => select.productTypeId = e.at(-1)">
</el-cascader> </el-cascader>
</div> </div>
@ -50,73 +46,68 @@
</template> </template>
</xy-selectors> </xy-selectors>
<Button type="primary" @click="searchProducts"></Button> <Button type="primary" @click="searchProducts"></Button>
<Button type="primary" @click="$refs['addProduct'].isShow = true,$refs['addProduct'].type = 'add'" style="margin-left: 10px;">新增</Button> <Button type="primary" @click="$refs['addProduct'].isShow = true,$refs['addProduct'].type = 'add'"
style="margin-left: 10px;">新增</Button>
</div> </div>
<!-- <div class="selector">--> <!-- <div class="selector">-->
<!-- <div class="selector-item">--> <!-- <div class="selector-item">-->
<!-- <div class="selector-item__label">产品名称</div>--> <!-- <div class="selector-item__label">产品名称</div>-->
<!-- <Input v-model="select.name" style="width: 200px;" placeholder="产品名称搜索" />--> <!-- <Input v-model="select.name" style="width: 200px;" placeholder="产品名称搜索" />-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="selector-item">--> <!-- <div class="selector-item">-->
<!-- <div class="selector-item__label">所属商户</div>--> <!-- <div class="selector-item__label">所属商户</div>-->
<!-- <Select clearable v-model="select.merchantId" style="width: 140px;" placeholder="所属商户">--> <!-- <Select clearable v-model="select.merchantId" style="width: 140px;" placeholder="所属商户">-->
<!-- <Scroll :on-reach-bottom="loadMoreMerchant">--> <!-- <Scroll :on-reach-bottom="loadMoreMerchant">-->
<!-- <Option v-for="item in merchants" :value="item.id" :key="item.id">--> <!-- <Option v-for="item in merchants" :value="item.id" :key="item.id">-->
<!-- {{item.name}}--> <!-- {{item.name}}-->
<!-- </Option>--> <!-- </Option>-->
<!-- </Scroll>--> <!-- </Scroll>-->
<!-- </Select>--> <!-- </Select>-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="selector-item">--> <!-- <div class="selector-item">-->
<!-- <div class="selector-item__label">状态选择</div>--> <!-- <div class="selector-item__label">状态选择</div>-->
<!-- <Select clearable style="width: 130px;" clearable placeholder="状态选择" v-model="select.state">--> <!-- <Select clearable style="width: 130px;" clearable placeholder="状态选择" v-model="select.state">-->
<!-- <Option v-for="item in [{value:'active',label:'已上架'},{label:'已下架',value:'inactive'}]" :value="item.value">{{item.label}}</Option>--> <!-- <Option v-for="item in [{value:'active',label:'已上架'},{label:'已下架',value:'inactive'}]" :value="item.value">{{item.label}}</Option>-->
<!-- </Select>--> <!-- </Select>-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="selector-item">--> <!-- <div class="selector-item">-->
<!-- <div class="selector-item__label">类别选择</div>--> <!-- <div class="selector-item__label">类别选择</div>-->
<!-- <el-cascader--> <!-- <el-cascader-->
<!-- clearable--> <!-- clearable-->
<!-- placeholder="类别选择"--> <!-- placeholder="类别选择"-->
<!-- style="width: 170px;"--> <!-- style="width: 170px;"-->
<!-- size="small"--> <!-- size="small"-->
<!-- :options="types"--> <!-- :options="types"-->
<!-- :show-all-levels="false"--> <!-- :show-all-levels="false"-->
<!-- :props="{value:'id',label:'title',expandTrigger:'hover'}"--> <!-- :props="{value:'id',label:'title',expandTrigger:'hover'}"-->
<!-- @change="e => select.productTypeId = e.at(-1)">--> <!-- @change="e => select.productTypeId = e.at(-1)">-->
<!-- </el-cascader>--> <!-- </el-cascader>-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="selector-item">--> <!-- <div class="selector-item">-->
<!-- <Button type="primary" @click="getProducts"></Button>--> <!-- <Button type="primary" @click="getProducts"></Button>-->
<!-- </div>--> <!-- </div>-->
<!-- <div class="selector-item">--> <!-- <div class="selector-item">-->
<!-- <Button type="primary" @click="$refs['addProduct'].isShow = true,$refs['addProduct'].type = 'add'">新增</Button>--> <!-- <Button type="primary" @click="$refs['addProduct'].isShow = true,$refs['addProduct'].type = 'add'">新增</Button>-->
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
</slot> </slot>
</lx-header> </lx-header>
</div> </div>
<xy-table :total="total" :list="list" :table-item="table" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"> <xy-table :total="total" :list="list" :table-item="table" @pageSizeChange="pageSizeChange"
@pageIndexChange="pageChange">
<template v-slot:btns> <template v-slot:btns>
<el-table-column fixed="right" label="操作" width="300" header-align="center"> <el-table-column fixed="right" label="操作" width="300" header-align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<Button type="primary" size="small" @click="editorShow(scope.row.id,'editor')"></Button> <Button type="primary" size="small" @click="editorShow(scope.row.id,'editor')"></Button>
<Button type="primary" size="small" style="margin-left: 10px;" @click="editorShow(scope.row.id,'copy')"></Button> <Button type="primary" size="small" style="margin-left: 10px;"
<Poptip @click="editorShow(scope.row.id,'copy')">复制新增</Button>
transfer <Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteProduct(scope.row)">
confirm
title="确认要删除吗?"
@on-ok="deleteProduct(scope.row)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button> <Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip> </Poptip>
<el-switch <el-switch style="margin-left: 10px;" :value="scope.row.state_name == '已上架' ? true : false"
style="margin-left: 10px;" active-color="#BF617C" inactive-color="#E5E5E5"
:value="scope.row.state_name == '已上架' ? true : false" :active-text="scope.row.state_name == '已上架' ? '已上架' : '已下架'" @change="stateChange(scope.row)">
active-color="#BF617C"
inactive-color="#E5E5E5"
:active-text="scope.row.state_name == '已上架' ? '已上架' : '已下架'"
@change="stateChange(scope.row)">
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
@ -129,237 +120,290 @@
</template> </template>
<script> <script>
import {index as typeIndex} from '@/api/type' import {
import {index,toggleActive,destroy} from '@/api/product' index as typeIndex
import {index as merchantIndex} from "@/api/merchant" } from '@/api/type'
import {
index,
toggleActive,
destroy
} from '@/api/product'
import {
index as merchantIndex
} from "@/api/merchant"
import addProduct from '@/views/productService/components/addProduct' import addProduct from '@/views/productService/components/addProduct'
import { Message } from 'element-ui' import {
export default { Message
components:{ } from 'element-ui'
addProduct export default {
}, components: {
data() { addProduct
return { },
select:{ data() {
pageIndex:1, return {
pageSize:10, select: {
name:'', pageIndex: 1,
merchantId:'', pageSize: 10,
productTypeId:'', name: '',
state:'' merchantId: '',
}, productTypeId: '',
state: ''
total:0,
list:[],
table:[
{
prop:'name',
label:'名称',
width:260,
align:'left',
fixed:'left'
},
{
prop:'product_type.name',
label:'类别',
width: 180
},
{
prop:'merchant.username',
label:"所属商家",
width: 280
},
{
prop: "price",
label:"单价",
width: 160,
align:'right'
},
{
prop:"fee",
label:"平台佣金",
width: 160,
align:'right'
},
{
prop:'sharing',
label: '分享金',
width: 160,
align:'right'
},
{
prop:'start_time',
label:'上架时间',
width: 220
},
{
prop: 'end_time',
label:"下架时间",
width: 220
},
{
prop:'sortnumber',
label:'同级排序',
width: 130
}, },
{
prop: 'state_name',
label: '状态',
customFn:(row)=>{
if(row.state_name == '已上架'){
return (<div style="color: green">{row.state_name}</div>)
}else{
return (<div style="color: red">{row.state_name}</div>)
}
}
}
],
types:[],// total: 0,
merchants:[],// list: [],
merchantSelect:{ table: [{
pageIndex:1, prop: 'name',
pageSize:10 label: '名称',
} width: 260,
} align: 'left',
}, fixed: 'left'
methods: { },
pageSizeChange(e){ {
this.select.pageSize=e; prop: 'product_type.name',
this.searchProducts(); label: '类别',
}, width: 180
},
{
prop: 'merchant.username',
label: "所属商家",
width: 280
},
{
prop: "price",
label: "单价",
width: 160,
align: 'right'
},
{
prop: "fee",
label: "平台佣金",
width: 160,
align: 'right'
},
{
prop: 'sharing',
label: '分享金',
width: 160,
align: 'right'
},
{
prop: 'start_time',
label: '上架时间',
width: 220
},
{
prop: 'end_time',
label: "下架时间",
width: 220
},
{
prop: 'sortnumber',
label: '同级排序',
width: 130,
customFn: (row) => {
return ( <input class = 'sortinput el-input__inner'
type='number'
on = {
{
["keyup"]: (e) => (this.updateSort(e, row.id, row))
}
}
value = {
row.sortnumber
}> </input>
)
}
},
{
prop: 'state_name',
label: '状态',
customFn: (row) => {
if (row.state_name == '已上架') {
return ( <div style = "color: green" > {
row.state_name
} </div>)
}
else {
return ( <div style = "color: red" > {
row.state_name
} </div>)
}
}
}
],
searchProducts(){ types: [], //
merchants: [], //
merchantSelect: {
pageIndex: 1,
pageSize: 10
}
}
},
methods: {
pageSizeChange(e) {
this.select.pageSize = e;
this.searchProducts();
},
updateSort(e, id, row, type) {
if (e.keyCode === 13) {
if(e.target.value==row.sortnumber){
return
}
this.$confirm('是否确认更改排序?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$refs['addProduct'].type = 'editor';
this.$refs['addProduct'].id = id;
this.$refs['addProduct'].sortnumberNew = e.target.value
this.$refs['addProduct'].updateSortNumber()
}).catch(() => {
e.target.value = row.sortnumber
});
}
},
searchProducts() {
this.select.pageIndex = 1 this.select.pageIndex = 1
this.getProducts() this.getProducts()
}, },
pageChange(e){ pageChange(e) {
this.select.pageIndex = e this.select.pageIndex = e
this.getProducts() this.getProducts()
}, },
stateChange(row){ stateChange(row) {
toggleActive({id:row.id}).then(res => { toggleActive({
row.state_name = row.state_name == '已上架' ? '已下架' : '已上架' id: row.id
}) }).then(res => {
}, row.state_name = row.state_name == '已上架' ? '已下架' : '已上架'
deleteProduct(row){ })
destroy({id:row.id}).then(res => { },
Message({ deleteProduct(row) {
type:'success', destroy({
message:'删除成功' id: row.id
}) }).then(res => {
this.getProducts() Message({
}) type: 'success',
}, message: '删除成功'
editorShow(id,type){ })
this.$refs['addProduct'].type = type; this.getProducts()
this.$refs['addProduct'].id = id; })
this.$refs['addProduct'].isShow = true; },
}, editorShow(id, type) {
this.$refs['addProduct'].type = type;
this.$refs['addProduct'].id = id;
this.$refs['addProduct'].isShow = true;
},
async getProducts(){ async getProducts() {
const res = await index({ const res = await index({
page_size:this.select.pageSize, page_size: this.select.pageSize,
page:this.select.pageIndex, page: this.select.pageIndex,
name:this.select.name, name: this.select.name,
merchant_id:this.select.merchantId, merchant_id: this.select.merchantId,
product_type_id:this.select.productTypeId, product_type_id: this.select.productTypeId,
state:this.select.state state: this.select.state
}) })
this.total = res.total this.total = res.total
this.list = res.rows this.list = res.rows
}, },
async getTypes(){ async getTypes() {
const res = await typeIndex() const res = await typeIndex()
let hasChild = (array) => { let hasChild = (array) => {
array.map(item => { array.map(item => {
if(item.children.length > 0){ if (item.children.length > 0) {
hasChild(item.children) hasChild(item.children)
}else{ } else {
item.children = '' item.children = ''
}
})
}
hasChild(res)
this.types = res
},
async getMerchant() {
const res = await merchantIndex({
page: this.merchantSelect.pageIndex,
page_size: this.merchantSelect.pageSize
}, false)
if (res.data.length == 0) {
this.$Message.info({
content: '没有更多商户了',
duration: 1
})
this.merchantSelect.pageIndex--
}
this.merchants.push(...res.data)
},
loadMoreMerchant() {
this.merchantSelect.pageIndex++
this.getMerchant()
} }
}) },
} mounted() {
hasChild(res) this.getTypes()
this.types = res this.getMerchant()
}, this.getProducts()
async getMerchant(){ }
const res = await merchantIndex({
page:this.merchantSelect.pageIndex,
page_size:this.merchantSelect.pageSize
},false)
if(res.data.length == 0){
this.$Message.info({
content:'没有更多商户了',
duration:1
})
this.merchantSelect.pageIndex --
} }
this.merchants.push(...res.data)
},
loadMoreMerchant(){
this.merchantSelect.pageIndex++
this.getMerchant()
}
},
mounted() {
this.getTypes()
this.getMerchant()
this.getProducts()
}
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.select-content-item{ .select-content-item {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
&-label{
width: 110px;
padding: 0 20px; &-label {
width: 110px;
padding: 0 20px;
}
} }
}
.selector{ .selector {
display: flex;
flex-wrap: wrap;
align-items: center;
align-content: center;
&-item{
display: flex; display: flex;
flex-wrap: wrap;
align-items: center; align-items: center;
align-content: center;
margin-top: 6px; &-item {
margin-right: 10px; display: flex;
align-items: center;
&__label{ margin-top: 6px;
word-break: keep-all; margin-right: 10px;
&__label {
word-break: keep-all;
}
} }
} }
}
::v-deep .ivu-select-dropdown{ ::v-deep .ivu-select-dropdown {}
}
::v-deep .ivu-scroll-container{ ::v-deep .ivu-scroll-container {
height: 180px !important; height: 180px !important;
&::after{
content: '加载更多..';
text-align: center;
font-size: 10px;
color: rgb(160,160,160);
background: #fff;
zoom: 0.8;
position: absolute; &::after {
left: 0; content: '加载更多..';
right: 0; text-align: center;
bottom: 0; font-size: 10px;
color: rgb(160, 160, 160);
background: #fff;
zoom: 0.8;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
} }
}
</style> </style>

Loading…
Cancel
Save