积分订单

This commit is contained in:
yanran200730
2023-04-14 14:04:32 +08:00
parent c72eb9c40e
commit 7d72023ad7
4 changed files with 219 additions and 85 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<ai-list v-if="!isShowDetail"> <ai-list v-if="!isShowDetail">
<template slot="title"> <template slot="title">
<ai-title title="订单管理" :isShowBottomBorder="false"> <ai-title title="订单管理" :isShowBottomBorder="false" v-model="areaId" :isShowArea="currIndex === '1'" :hideLevel="hideLevel - 1" @change="onAreaChange">
</ai-title> </ai-title>
</template> </template>
<template slot="tabs"> <template slot="tabs">
@@ -43,6 +43,10 @@
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
hideLevel () {
return this.user.info.areaList?.length || 0
},
tabs () { tabs () {
const tabList = [ const tabList = [
{label: '网格积分订单', name: 'GirdList', comp: GirdList, permission: ''}, {label: '网格积分订单', name: 'GirdList', comp: GirdList, permission: ''},
@@ -73,7 +77,7 @@
methods: { methods: {
onAreaChange () { onAreaChange () {
if (this.currIndex === '0') { if (this.currIndex === '1') {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs[this.currIndex][0].getList() this.$refs[this.currIndex][0].getList()
}) })

View File

@@ -104,8 +104,7 @@
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
permissions: Function, permissions: Function
areaId: String,
}, },
data() { data() {
@@ -153,7 +152,8 @@
getList () { getList () {
this.instance.post(`/app/appintegralsupermarketorder/list`, null, { this.instance.post(`/app/appintegralsupermarketorder/list`, null, {
params: { params: {
...this.search ...this.search,
type: 0
} }
}).then((res) => { }).then((res) => {
if (res.code == 0) { if (res.code == 0) {

View File

@@ -6,27 +6,70 @@
</template> </template>
<template slot="content"> <template slot="content">
<ai-card title="基本信息"> <ai-card title="基本信息">
<template #right>
<el-button type="primary" v-if="info.status === '0'" @click="isShow = true">订单核销</el-button>
<el-button type="danger" v-if="info.status === '0' || info.status === '1'" @click="cancelOrder">取消订单</el-button>
</template>
<template #content> <template #content>
<ai-wrapper <ai-wrapper
label-width="120px"> label-width="120px">
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item> <ai-info-item label="订单编号" :value="info.serialNumber"></ai-info-item>
<ai-info-item label="发布地区" isLine :value="info.areaName"></ai-info-item> <ai-info-item label="订单状态" :value="dict.getLabel('integralSGOStatus', info.status)"></ai-info-item>
<ai-info-item label="文章类型" isLine :value="info.contentType === '0' ? '文章' : '视频'"></ai-info-item> <ai-info-item label="兑换人" :value="info.integralUserName"></ai-info-item>
<ai-info-item label="分类" v-if="info.categoryName" isLine :value="info.categoryName"></ai-info-item> <ai-info-item label="创建时间" :value="info.createTime"></ai-info-item>
<ai-info-item label="正文" v-if="info.contentType === '0'" isLine> <ai-info-item label="备注" :value="info.remarks" isLine></ai-info-item>
<AiArticle :value="info.content"></AiArticle>
</ai-info-item>
<ai-info-item label="附件" isLine>
<div class="files">
<div class="file-item" v-for="(item, index) in info.files" :key="index">
<img :src="item.url" v-if="item.postfix !== '.mp4'">
<video controls v-else :src="item.url"></video>
</div>
</div>
</ai-info-item>
</ai-wrapper> </ai-wrapper>
</template> </template>
</ai-card> </ai-card>
<ai-card title="操作信息" v-if="info.status === '1'">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="核销人" :value="info.examineUserName"></ai-info-item>
<ai-info-item label="时间" :value="info.examineTime"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="商品信息">
<template #content>
<ai-table
:isShowPagination="false"
:tableData="[info]"
:col-configs="colConfigs"
@getList="() => {}">
<el-table-column
label="商品"
slot="goods"
align="left"
width="250">
<template v-slot="{ row }">
<div class="goods">
<ai-uploader
:disabled="true"
:instance="instance"
:value="[{url: row.goodsPicUrl}]"
:limit="1">
</ai-uploader>
<p>{{ row.goodsTitle }}</p>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-card>
<ai-dialog
title="订单核销"
:visible.sync="isShow"
:destroyOnClose="true"
width="650px"
@onConfirm="onConfirm"
@close="form.verificationCode = '', id = ''">
<el-form style="height: 200px" class="ai-form" ref="form" :model="form" label-width="120px">
<el-form-item label="核销码" style="width: 100%" prop="verificationCode" :rules="[{required: true, message: '请输入核销码', trigger: 'blur'}]">
<el-input v-model="form.verificationCode" placeholder="请输入核销码" size="small"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template> </template>
</ai-detail> </ai-detail>
</template> </template>
@@ -38,14 +81,26 @@
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
params: Object, params: Object
moduleId: String
}, },
data () { data () {
return { return {
info: {}, info: {},
id: '' isShow: false,
id: '',
form: {
verificationCode: ''
},
colConfigs: [
{ prop: 'goodsSerialNumber', label: '商品ID', align: 'left' },
{ slot: 'goods' },
{ prop: 'goodsType', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v) },
{ prop: 'integralPrice', label: '兑换所需积分', align: 'center' },
{ prop: 'payMoney', label: '兑换后补差价金额', align: 'center' },
{ prop: 'quantity', label: '数量', align: 'center' },
{ prop: 'usedIntegral', label: '消耗积分', align: 'center' }
]
} }
}, },
@@ -58,29 +113,48 @@
methods: { methods: {
getInfo (id) { getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => { this.instance.post(`/app/appintegralsupermarketorder/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.info = res.data
this
this.info = { this.info = {
...res.data, ...res.data
pictureUrl: res.data.pictureUrl ? [{ }
url: res.data.pictureUrl
}] : [],
files: res.data.files.map(v => {
return {
...v,
postfix: v.postfix.toLowerCase()
} }
}) })
},
cancelOrder () {
this.$confirm('确定取消该订单吗?').then(() => {
this.instance.post(`/app/appintegralsupermarketorder/cancel?id=${this.params.id}`).then(res => {
if (res.code == 0) {
this.$message.success('取消成功!')
this.getInfo(this.params.id)
} }
})
})
},
onConfirm () {
this.$refs.form.validate((valid)=> {
if(valid) {
this.instance.post(`/app/appintegralsupermarketorder/examine`, null, {
params: {
...this.form,
id: this.params.id
}
}).then(res => {
if(res.code == 0) {
this.isShow = false
this.getInfo(this.params.id)
this.$message.success('核销成功')
}
})
} }
}) })
}, },
cancel (isRefresh) { cancel (isRefresh) {
this.$emit('change', { this.$emit('change', {
type: 'List', type: 'ResidentList',
isRefresh: !!isRefresh isRefresh: !!isRefresh
}) })
} }

View File

@@ -1,21 +1,36 @@
<template> <template>
<ai-list isTabs class="order_management"> <ai-list isTabs class="GoodsList">
<template slot="content"> <template slot="content">
<ai-search-bar> <ai-search-bar>
<template slot="left"> <template slot="left">
<ai-select <ai-select
v-model="search.type" v-model="search.type"
@change="(search.current = 1), getList()" @change="(search.current = 1), getList()"
placeholder="请选择店铺类型" placeholder="请选择商品类型"
:selectList="dict.getDict('integralSSType')"> :selectList="dict.getDict('integralSGType')">
</ai-select> </ai-select>
<ai-select <ai-select
v-model="search.status" v-model="search.status"
@change="(search.current = 1), getList()" @change="(search.current = 1), getList()"
placeholder="请选择类型" placeholder="请选择订单状态"
:selectList="dict.getDict('integralSGStatus')"> :selectList="dict.getDict('integralSGOStatus')">
</ai-select> </ai-select>
<el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button> <el-date-picker
v-model="search.startTime"
type="date"
size="small"
value-format="yyyy-MM-dd"
placeholder="选择订单开始日期"
@change="search.current = 1, getList()">
</el-date-picker>
<el-date-picker
v-model="search.endTime"
type="date"
size="small"
value-format="yyyy-MM-dd"
placeholder="选择订单结束日期"
@change="search.current = 1, getList()">
</el-date-picker>
</template> </template>
<template slot="right"> <template slot="right">
<el-input <el-input
@@ -23,7 +38,7 @@
class="search-input" class="search-input"
size="small" size="small"
v-throttle="() => {search.current = 1, getList()}" v-throttle="() => {search.current = 1, getList()}"
placeholder="请输入店铺名称" placeholder="请输入商品名称"
clearable clearable
@clear="search.current = 1, search.title = '', getList()" @clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch"> suffix-icon="iconfont iconSearch">
@@ -38,26 +53,46 @@
:current.sync="search.current" :current.sync="search.current"
:size.sync="search.size" :size.sync="search.size"
@getList="getList"> @getList="getList">
<el-table-column label="网格店铺服务网格" slot="grid" align="center"> <el-table-column
label="商品"
slot="goods"
align="left"
width="350">
<template v-slot="{ row }"> <template v-slot="{ row }">
<span>{{ row.serviceType === '1' ? row.visibleNames || '-' : '-' }}</span> <div class="goods">
<ai-uploader
:disabled="true"
:instance="instance"
:value="[{url: row.goodsPicUrl}]"
:limit="1">
</ai-uploader>
<p>{{ row.goodsTitle }}</p>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="居民店铺服务地区" slot="area" align="center"> <el-table-column label="操作" slot="options" align="center" width="210" fixed="right">
<template v-slot="{ row }">
<span>{{ row.serviceType === '0' ? row.visibleNames || '-' : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" slot="options" align="center" width="160" fixed="right">
<template v-slot="{ row }"> <template v-slot="{ row }">
<div class="table-options"> <div class="table-options">
<el-button type="text" title="编辑" @click="toAdd(row.id)">编辑</el-button> <el-button type="text" title="取消订单" v-if="row.status === '0' || row.status === '1'" @click="cancel(row.id)">取消订单</el-button>
<el-button type="text" :title="row.status === '0' ? '上架' : '下架'" @click="changeStatus(row)">{{ row.status === '0' ? '上架' : '下架' }}</el-button> <el-button type="text" title="订单核销" v-if="row.status === '0'" @click="id = row.id, isShow = true">订单核销</el-button>
<el-button type="text" title="删除" @click="remove(row.id)">删除</el-button> <el-button type="text" title="详情" @click="toDetail(row.id)">详情</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
</ai-table> </ai-table>
<ai-dialog
title="订单核销"
:visible.sync="isShow"
:destroyOnClose="true"
width="650px"
@onConfirm="onConfirm"
@close="form.verificationCode = '', id = ''">
<el-form style="height: 200px" class="ai-form" ref="form" :model="form" label-width="120px">
<el-form-item label="核销码" style="width: 100%" prop="verificationCode" :rules="[{required: true, message: '请输入核销码', trigger: 'blur'}]">
<el-input v-model="form.verificationCode" placeholder="请输入核销码" size="small"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template> </template>
</ai-list> </ai-list>
</template> </template>
@@ -80,19 +115,27 @@
title: '', title: '',
current: 1, current: 1,
status: '', status: '',
size: 10 size: 10,
startTime: '',
endTime: ''
}, },
isShow: false,
form: {
verificationCode: ''
},
id: '',
total: 0, total: 0,
tableData: [], tableData: [],
shopList: [],
colConfigs: [ colConfigs: [
{ prop: 'serialNumber', label: '店铺ID', align: 'left' }, { prop: 'goodsSerialNumber', label: '商品ID', align: 'left' },
{ prop: 'title', label: '店铺名称', align: 'center' }, { slot: 'goods', align: 'center' },
{ prop: 'type', label: '店铺类型', align: 'center', format: v => this.dict.getLabel('integralSSType', v) }, { prop: 'type', label: '商品类型', align: 'center', format: v => this.dict.getLabel('integralSGType', v) },
{ slot: 'grid', label: '网格店铺服务网格', align: 'center' }, { prop: 'quantity', label: '数量', align: 'center', format: v => `x${v}` },
{ slot: 'area', label: '居民店铺服务地区', align: 'center' }, { prop: 'usedIntegral', label: '消耗积分', align: 'center' },
{ prop: 'goodsCount', label: '店铺商品数', align: 'center' }, { prop: 'payMoney', label: '兑换后再付', align: 'center' },
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSSStatus', v) } { prop: 'integralUserName', label: '兑换人', align: 'center' },
{ prop: 'createTime', width: 150, label: '创建时间', align: 'center' },
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('integralSGOStatus', v) }
] ]
} }
}, },
@@ -101,17 +144,18 @@
}, },
created () { created () {
this.dict.load('integralSSType', 'integralSSStatus', 'integralSSSType').then(() => { this.dict.load('integralSGType', 'integralSGOStatus').then(() => {
this.getList() this.getList()
}) })
}, },
methods: { methods: {
getList () { getList () {
this.instance.post(`/app/appintegralsupermarketshop/list`, null, { this.instance.post(`/app/appintegralsupermarketorder/list`, null, {
params: { params: {
...this.search, ...this.search,
areaId: this.areaId, type: 1,
areaId: this.areaId
} }
}).then((res) => { }).then((res) => {
if (res.code == 0) { if (res.code == 0) {
@@ -121,31 +165,39 @@
}) })
}, },
toAdd (id) { onConfirm () {
this.$emit('change', { this.$refs.form.validate((valid)=> {
type: 'AddStore', if(valid) {
this.instance.post(`/app/appintegralsupermarketorder/examine`, null, {
params: { params: {
id: id || '' ...this.form,
id: this.id
} }
}) }).then(res => {
}, if(res.code == 0) {
this.isShow = false
remove (id) {
this.$confirm('确定删除该商品吗?').then(() => {
this.instance.post(`/app/appintegralsupermarketgoods/delete?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList() this.getList()
this.$message.success('核销成功')
} }
}) })
}
}) })
}, },
changeStatus (row) { toDetail (id) {
this.$confirm(`确定${row.status === '0' ? '上架' : '下架'}该商品?`).then(() => { this.$emit('change', {
this.instance.post(`/app/appintegralsupermarketgoods/online?id=${id}`).then(res => { type: 'ResidentDetail',
params: {
id
}
})
},
cancel (id) {
this.$confirm('确定取消该订单吗?').then(() => {
this.instance.post(`/app/appintegralsupermarketorder/cancel?id=${id}`).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$message.success(`${row.status === '0' ? '上架' : '下架'}成功`) this.$message.success('取消成功!')
this.getList() this.getList()
} }
}) })
@@ -156,6 +208,10 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.order_management { .GoodsList {
.goods {
display: flex;
align-items: center;
}
} }
</style> </style>