订单管理列表页面ui 接口接入; 订单多选selection控件编写 ;地图长按事件获取经纬度(点飞控件)

This commit is contained in:
szdot 2023-11-07 13:28:53 +08:00
parent 020c40d834
commit 207cf684d5
9 changed files with 162 additions and 204 deletions

View File

@ -82,6 +82,29 @@ export default {
// })
// this.map.setTerrain({ source: 'mapbox-dem', exaggeration: 1.5 })
})
// longPress
let pressTimer
this.map.on('mousedown', (event) => { // pc
pressTimer = setTimeout(() => {
const lngLat = this.map.unproject(event.point)
//
this.$emit('longPress', lngLat)
}, 1000) //
})
this.map.on('touchstart', (event) => { //
pressTimer = setTimeout(() => {
const lngLat = this.map.unproject(event.point)
//
this.$emit('longPress', lngLat)
}, 1000) //
})
//
const clearPressTimer = () => {
clearTimeout(pressTimer)
}
this.map.on('mouseup', clearPressTimer)
this.map.on('touchend', clearPressTimer)
})
},
methods: {

View File

@ -0,0 +1,31 @@
<template>
<el-select class="w-360px" v-model="value" multiple placeholder="退款状态:请选择,可多选">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
<script>
export default {
data () {
return {
options: [{
value: 'normal',
label: '无申请'
}, {
value: 'requested',
label: '申请退款'
}, {
value: 'refunded',
label: '已退款'
}, {
value: 'rejected',
label: '拒绝退款'
}],
value: []
}
}
}
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,37 @@
<template>
<el-select class="w-500px" v-model="value" multiple placeholder="订单状态:请选择,可多选">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
<script>
export default {
data () {
return {
options: [{
value: 'unpaid',
label: '未付款'
}, {
value: 'pending',
label: '待处理'
}, {
value: 'processing',
label: '处理中'
}, {
value: 'shipped',
label: '已发货'
}, {
value: 'completed',
label: '已送达'
}, {
value: 'closed',
label: '交易关闭'
}],
value: []
}
}
}
</script>
<style lang="scss" scoped></style>

View File

@ -397,6 +397,29 @@ const routes = [
}
]
},
{
path: '/order',
component: Layout,
redirect: '/order/index',
meta: {
title: '订单管理',
icon: 'iconfont icon-a-SalesOrderManagement',
roles: ['admin', 'editor'],
tapName: 'admin'
},
children: [
{
path: '/order/index',
component: () => import('@/views/layout/components/main/order/index'),
meta: {
title: '订单管理',
icon: 'iconfont icon-a-SalesOrderManagement',
roles: ['admin', 'editor'],
tapName: 'admin'
}
}
]
},
{
path: '*',
redirect: '/404',

View File

@ -18,7 +18,7 @@ const store = new Vuex.Store({
categoryList: [], // 分类列表(小程序)
spuList: [], // 商品spu列表
skuList: [], // 商品sku列表
questList: [], // 订单列表
orderList: [], // 订单列表
logList: [], // 操作日志列表
crosFrequency: null // 对频macadd
},
@ -74,8 +74,8 @@ const store = new Vuex.Store({
/**
* @description: 设置订单列表
*/
setQuestList (state, list) {
state.questList = list
setOrderList (state, list) {
state.orderList = list
},
/**
* @description: 向操作日志列表最后插入新的信息
@ -889,12 +889,12 @@ const store = new Vuex.Store({
* @description: 获取订单列表 ps:待发货及待收货 并且不是退款成功状态
* @return {*} 列表
*/
async fetchQuestList ({ commit }) {
const res = await api.get('getQuestList')
async fetchOrderList ({ commit }) {
const res = await api.get('getOrderList', 'Admin')
if (res.data.status === 1) {
commit('setQuestList', res.data.questList)
commit('setOrderList', res.data.orderList)
} else {
commit('setQuestList', [])
commit('setOrderList', [])
}
return res
},

View File

@ -1 +1 @@
@import 'https://at.alicdn.com/t/c/font_3703467_3t3ax3urzwi.css'; //iconfont阿里巴巴
@import 'https://at.alicdn.com/t/c/font_3703467_d1m3z2xkd1v.css'; //iconfont阿里巴巴

View File

@ -1,6 +1,6 @@
<template>
<div class="h-100">
<map-box ref="mapbox" :key="mapBoxKey" />
<map-box ref="mapbox" :key="mapBoxKey" @longPress="handleDemo" />
</div>
</template>
@ -29,6 +29,11 @@ export default {
}
},
methods: {
//
handleDemo (lngLat) {
console.log('经度:', lngLat.lng)
console.log('维度:', lngLat.lat)
},
/**
* @description: 创建飞机图标
*/

View File

@ -1,247 +1,86 @@
<template>
<div class="app-container">
<!-- 组合按钮 -->
<el-button-group>
<el-button type="primary" icon="el-icon-plus" @click="$router.replace('/spu/add')">添加</el-button>
<el-button type="danger" icon="el-icon-delete" @click="deleteSpu(countSelIdArr($refs.myTable.selection))">删除
</el-button>
<el-button type="warning" icon="el-icon-edit" @click="toEditPage()">编辑</el-button>
</el-button-group>
<!-- 用户select选项 -->
<el-button-group class="m-l-20">
<el-button-group class="m-b-15">
<SelectionOrderStatus class="m-r-20" />
<SelectionOrderBack />
</el-button-group>
<el-button-group class="m-r-20">
<SelectionShopId v-model="form.shop_id" :allSel="true" />
</el-button-group>
<!-- 分类select选项 -->
<el-button-group class="m-l-20">
<SelectionPath v-model="form.path" :shop_id="form.shop_id" :allSel="true" />
</el-button-group>
<!-- 商品spu表格 -->
<!-- 订单列表 -->
<el-table class="m-t-20 w-100" ref="myTable"
:data="spuListArr.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
:data="orderList.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
<el-table-column align="center" type="selection" width="40">
</el-table-column>
<el-table-column align="center" label="排序" width="70">
<template slot-scope="scope">
<el-input v-model="scope.row.sort" @focus="tempSort = scope.row.sort"
@blur="blurOrder(scope.row.id, scope.row.sort)"></el-input>
</template>
</el-table-column>
<el-table-column align="center" prop="id" label="id" width="50">
</el-table-column>
<el-table-column prop="name" label="名称" width="150" min-width="150">
<el-table-column prop="order_sn" label="订单号" width="150" min-width="150">
</el-table-column>
<el-table-column prop="spu_number" label="编号" min-width="120">
<el-table-column prop="tel" label="客户电话" min-width="150">
</el-table-column>
<el-table-column label="图片" width="120" min-width="120">
<template v-if="scope.row.photo != ''" slot-scope="scope">
<el-image :src="$store.state.settings.host + '/Data/UploadFiles/spu/' + scope.row.photo"
:preview-src-list="[$store.state.settings.host + '/Data/UploadFiles/spu/' + scope.row.photo]">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<el-table-column label="下单时间" width="140" min-width="140">
<template slot-scope="scope">
{{ scope.row.addtime | parseTime('{y}-{m}-{d} {h}:{i}') }}
</template>
</el-table-column>
<el-table-column prop="controler" label="操作" width="380" min-width="380">
<el-table-column prop="controler" label="操作" width="200" min-width="200">
<template slot-scope="scope">
<el-button-group>
<el-button :type="scope.row.recommend == '1' ? 'success' : 'info'" class="iconfont icon-tuijian"
@click="handeleRecommend(scope.row.id, scope.row.recommend)"><span class="m-l-5">推荐</span></el-button>
<el-button :type="scope.row.show == '1' ? 'primary' : 'info'"
:class="scope.row.show == '1' ? 'iconfont icon-yanjing' : 'iconfont icon-biyanjing'"
@click="handeleShow(scope.row.id, scope.row.show)"><span class="m-l-5">显示</span></el-button>
<el-button type="warning" icon="el-icon-edit"
@click="$router.replace(`/spu/edit/${scope.row.id}`)">编辑</el-button>
<el-button type="danger" icon="el-icon-delete" @click="deleteSpu([scope.row.id])">删除</el-button>
@click="$router.replace(`/admin/edit/${scope.row.id}`)">编辑</el-button>
<el-button type="danger" icon="el-icon-delete" @click="deleteAdmin([scope.row.id])">删除</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination class="m-t-20" layout="prev, pager, next" :current-page.sync="currentPage" :page-size="pageSize"
:total="spuListArr.length">
:total="orderList.length">
</el-pagination>
</div>
</template>
<script>
import { countSelIdArr } from '@/utils'
import { countSelIdArr, parseTime } from '@/utils'
import SelectionShopId from '@/components/SelectionShopId'
import SelectionPath from '@/components/SelectionPath'
import SelectionOrderStatus from '@/components/SelectionOrderStatus'
import SelectionOrderBack from '@/components/SelectionOrderBack'
export default {
name: 'Spu',
name: 'Order',
data () {
return {
pageSize: 30, //
pageSize: 50, //
currentPage: 1, //
form: {
shop_id: '',
path: ''
},
tempSort: ''//
shop_id: ''
}
}
},
components: {
SelectionShopId,
SelectionPath
SelectionOrderStatus,
SelectionOrderBack
},
computed: {
//
spuList () {
return this.$store.state.spuList
},
//
categoryList () {
return this.$store.state.categoryList
},
/**
* @description: 按照shop_id path条件过滤 商品列表
* @return: 商品列表
*/
spuListArr () {
//
let pList = this.spuList
if (this.form.shop_id !== '') { // "" shop_id
pList = pList.filter((item) => item.shop_id === this.form.shop_id)
}
//
if (this.form.path === 'none') {
const list = pList.filter((item) => {
let t = true
for (let index = 0; index < this.categoryList.length; index++) {
if (this.categoryList[index].path === item.path) {
t = false
break
}
}
return t
})
return list
} else if (this.form.path !== '') {
var pattern = this.form.path // selection path
//
var escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
//
var regexPattern = new RegExp('^' + escapedPattern + '(-|$)')
const list = pList.filter((item) => {
let t = false
for (let index = 0; index < this.categoryList.length; index++) { // path path
if (this.categoryList[index].path === item.path) {
t = true
break
}
}
if (t) {
return regexPattern.test(item.path)
} else {
return false
}
})
return list
} else {
return pList //
}
//
orderList () {
return this.$store.state.orderList
}
},
methods: {
countSelIdArr,
//
handleClose (tag) {
this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1)
},
showInput () {
this.inputVisible = true
this.$nextTick(_ => {
this.$refs.saveTagInput.$refs.input.focus()
})
},
handleInputConfirm () {
const inputValue = this.inputValue
if (inputValue) {
this.dynamicTags.push(inputValue)
}
this.inputVisible = false
this.inputValue = ''
},
/**
* @description: 跳转到编辑页面
*/
toEditPage () {
const selId = this.countSelIdArr(this.$refs.myTable.selection)
switch (selId.length) {
case 0:
this.$message.error('请选择一条需要编辑的记录')
break
case 1:
this.$router.push('/register/edit/' + selId['0'])
break
default:
this.$message.error('只能选择一条记录')
}
},
/**
* @description: 删除spu
*/
deleteSpu (idArr) {
this.$store.dispatch('fetchDelSpu', idArr)
},
/**
* @description: 排序input失焦 更新数据库的排序
* @param {*} id 商品id
* @param {*} sort 排序序号
*/
async blurOrder (id, sort) {
if (this.tempSort !== sort) { // api
this.form.id = id
this.form.sort = sort
const res = await this.$store.dispatch('fetchOrderSpu', this.form)
if (res.data.status === 1) {
this.$router.push({ path: '/spu/index', query: { refresh: Date.now() } })
}
}
},
/**
* @description: 设置前端是否显示 商品
* @param {*} id 商品id
* @param {*} show 0隐藏 1显示
*/
async handeleShow (id, show) {
this.form.id = id
if (show === '0') {
this.form.show = '1'
} else {
this.form.show = '0'
}
const res = await this.$store.dispatch('fetchShowSpu', this.form)
if (res.data.status === 1) {
this.$router.push({ path: '/spu/index', query: { refresh: Date.now() } })
}
},
/**
* @description: 设置前端是否推荐 商品
* @param {*} id 商品id
* @param {*} recommend 0推荐 1不推荐
*/
async handeleRecommend (id, recommend) {
this.form.id = id
if (recommend === '0') {
this.form.recommend = '1'
} else {
this.form.recommend = '0'
}
const res = await this.$store.dispatch('fetchRecommendSpu', this.form)
if (res.data.status === 1) {
this.$router.push({ path: '/spu/index', query: { refresh: Date.now() } })
}
}
countSelIdArr
},
watch: {
},
created () {
},
filters: {
countSelIdArr
countSelIdArr,
parseTime
}
}
</script>

View File

@ -67,7 +67,7 @@ export default {
this.$store.dispatch('fetchCategoryList')//
this.$store.dispatch('fetchSpuList')// spu
this.$store.dispatch('fetchSkuList')// sku
this.$store.dispatch('fetchQuestList')// ps: 退
this.$store.dispatch('fetchOrderList')//
},
watch: {
/**