更新预售相关逻辑

feature/0423
Wayne 9 months ago
parent a8477d88b9
commit 3aed4c2270
  1. 437
      src/views/market/presale/Index copy 2.vue
  2. 14
      src/views/market/presale/Index.vue
  3. 126
      src/views/market/presale/Log.vue
  4. 185
      src/views/market/presale/modules/Log.vue

@ -0,0 +1,437 @@
<template>
<a-card :bordered="false">
<a-spin :spinning="isLoading">
<div class="card-title">{{ $route.meta.title }}</div>
<!-- 列表内容 -->
<div class="ant-table ant-table-scroll-position-left ant-table-default ant-table-bordered">
<div class="ant-table-content">
<div class="ant-table-scroll">
<div class="ant-table-body" style="overflow-x: scroll;">
<table style="width: 1450px;">
<thead class="ant-table-thead">
<tr>
<th v-for="(item, index) in columns" :key="index">
<span class="ant-table-header-column">
<div>
<span class="ant-table-column-title">{{ item.title }}</span>
</div>
</span>
</th>
</tr>
</thead>
<tbody class="ant-table-tbody">
<template v-for="(item) in orderList.data">
<tr class="order-empty" :key="`order_${item.id}_1`">
<td colspan="8"></td>
</tr>
<tr :key="`order_${item.id}_2`">
<td colspan="8">
<span class="mr-20">预售ID{{ item.id }}</span>
<span class="mr-20">创建时间{{ item.ctime }}</span>
</td>
</tr>
<tr
v-for="(goodsItm, goodsIdx) of item.goods_list"
:key="`orderGoods_${item.id}_${goodsIdx}`"
>
<td>
<p>{{ goodsItm.goods_name }}</p>
<!-- <GoodsItem
:data="{
image: goodsItm.goods_image,
imageAlt: '商品图片',
title: goodsItm.goods_name,
goodsProps: goodsItm.goods_props
}"
/> -->
</td>
<td>
<p>{{ goodsItm.goods_price }}</p>
<p>×{{ goodsItm.total_num }}</p>
</td>
<!-- <template v-if="goodsIdx===0">
<td :rowspan="item.goods_list.length">
<p>{{ item.pay_price }}</p>
<p class="c-muted-1">(含运费{{ item.express_price }})</p>
</td>
<td :rowspan="item.goods_list.length">
<UserItem :user="item.user" />
</td>
<td :rowspan="item.goods_list.length">
<a-tag
v-if="item.pay_method"
>{{ PaymentMethodEnum[item.pay_method].name }}</a-tag>
<span v-else>--</span>
</td>
<td :rowspan="item.goods_list.length">
<a-tag>{{ DeliveryTypeEnum[item.delivery_type].name }}</a-tag>
</td>
<td :rowspan="item.goods_list.length">
<p class="mtb-2">
<span class="f-13">付款状态</span>
<a-tag
:color="item.pay_status == PayStatusEnum.SUCCESS.value ? 'green' : ''"
>{{ PayStatusEnum[item.pay_status].name }}</a-tag>
</p>
<p class="mtb-2">
<span class="f-13">发货状态</span>
<a-tag
:color="item.delivery_status == DeliveryStatusEnum.DELIVERED.value ? 'green' : ''"
>{{ DeliveryStatusEnum[item.delivery_status].name }}</a-tag>
</p>
<p class="mtb-2">
<span class="f-13">收货状态</span>
<a-tag
:color="item.receipt_status == ReceiptStatusEnum.RECEIVED.value ? 'green' : ''"
>{{ ReceiptStatusEnum[item.receipt_status].name }}</a-tag>
</p>
<p
v-if="[OrderStatusEnum.CANCELLED.value,OrderStatusEnum.APPLY_CANCEL.value].includes(item.order_status)"
class="mtb-2"
>
<span class="f-13">订单状态</span>
<a-tag
:color="renderOrderStatusColor(item.order_status)"
>{{ OrderStatusEnum[item.order_status].name }}</a-tag>
</p>
</td>
<td :rowspan="item.goods_list.length">
<div class="actions">
<router-link
v-if="$auth('/order/detail')"
:to="{ path: '/order/detail', query: { orderId: item.order_id } }"
target="_blank"
>详情</router-link>
<a
v-action:deliver
v-if="(
item.pay_status == PayStatusEnum.SUCCESS.value
&& inArray(item.delivery_type, [ DeliveryTypeEnum.EXPRESS.value, DeliveryTypeEnum.NOTHING.value])
&& item.delivery_status != DeliveryStatusEnum.DELIVERED.value
&& !inArray(item.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
)"
@click="handleDelivery(item)"
>发货</a>
<a
v-action:extract
v-if="(
item.pay_status == PayStatusEnum.SUCCESS.value
&& item.delivery_type == DeliveryTypeEnum.EXTRACT.value
&& item.delivery_status != DeliveryStatusEnum.DELIVERED.value
&& !inArray(item.order_status, [OrderStatusEnum.CANCELLED.value, OrderStatusEnum.APPLY_CANCEL.value])
)"
@click="handleExtract(item)"
>自提核销</a>
<a
v-action:cancel
v-if="item.order_status == OrderStatusEnum.APPLY_CANCEL.value"
@click="handleCancel(item)"
>审核取消</a>
<a v-action:delete @click="handleDelete(item)">删除</a>
</div>
</td>
</template> -->
</tr>
</template>
</tbody>
</table>
</div>
<!-- 空状态 -->
<a-empty v-if="!orderList.data.length" :image="simpleImage" />
</div>
</div>
</div>
<!-- 分页器 -->
<div v-if="orderList.data.length" class="pagination">
<a-pagination
:current="page"
:pageSize="orderList.per_page"
:total="orderList.total"
@change="onChangePage"
/>
</div>
</a-spin>
</a-card>
</template>
<script>
import { Empty } from 'ant-design-vue'
import { inArray, assignment } from '@/utils/util'
import * as Api from '@/api/market/presale'
import * as EventApi from '@/api/order/event'
import * as ShopApi from '@/api/store/shop'
import PlatformIcon from '@/components/PlatformIcon'
import { GoodsItem, UserItem } from '@/components/Table'
import {
DeliveryStatusEnum,
DeliveryTypeEnum,
OrderSourceEnum,
OrderStatusEnum,
PayStatusEnum,
ReceiptStatusEnum
} from '@/common/enum/order'
import { PaymentMethodEnum } from '@/common/enum/payment'
//
const columns = [
{
title: '商品信息',
align: 'center',
dataIndex: 'goods',
scopedSlots: { customRender: 'goods' }
},
{
title: '单价/数量',
align: 'center',
scopedSlots: { customRender: 'unit_price' }
},
{
title: '实付款',
align: 'center',
dataIndex: 'pay_price',
scopedSlots: { customRender: 'pay_price' }
},
{
title: '买家',
dataIndex: 'user',
scopedSlots: { customRender: 'user' }
},
{
title: '支付方式',
dataIndex: 'pay_method',
scopedSlots: { customRender: 'pay_method' }
},
{
title: '配送方式',
dataIndex: 'delivery_type',
scopedSlots: { customRender: 'delivery_type' }
},
{
title: '交易状态',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '操作',
dataIndex: 'action',
width: '180px',
scopedSlots: { customRender: 'action' }
}
]
//
const SearchTypeEnum = [
{ name: '订单号', value: 10 },
{ name: '会员昵称', value: 20 },
{ name: '会员ID', value: 30 },
{ name: '收货人姓名', value: 40 },
{ name: '收货人电话', value: 50 }
]
export default {
name: 'Index',
components: {
PlatformIcon,
GoodsItem,
UserItem
},
data () {
return {
//
dataType: this.getDataType(),
//
searchForm: this.$form.createForm(this),
//
queryParam: {},
//
isLoading: false,
//
columns,
//
page: 1,
//
orderList: { data: [], total: 0, per_page: 10 },
//
shopList: []
}
},
beforeCreate () {
//
assignment(this, {
inArray,
DeliveryStatusEnum,
DeliveryTypeEnum,
OrderSourceEnum,
OrderStatusEnum,
PayStatusEnum,
ReceiptStatusEnum,
PaymentMethodEnum,
SearchTypeEnum,
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE
})
},
watch: {
//
$route () {
this.init()
}
},
created () {
//
this.init()
//
this.getShopList()
},
methods: {
//
init () {
this.dataType = this.getDataType()
this.searchForm.resetFields()
this.queryParam = {}
this.handleRefresh(true)
},
//
getShopList () {
ShopApi.all().then(result => this.shopList = result.data.list)
},
//
getDataType () {
return this.$route.path.split('/')[3].replace('-', '_')
},
//
getList () {
const { dataType, queryParam, page } = this
this.isLoading = true
return Api.list({ dataType, ...queryParam, page })
.then(response => {
this.orderList = response.data.list
console.log('🚀 ~ file: Index.vue:312 ~ getList ~ this.orderList:', this.orderList)
})
.finally(() => this.isLoading = false)
},
//
renderOrderStatusColor (orderStatus) {
const { OrderStatusEnum } = this
const ColorEnum = {
[OrderStatusEnum.NORMAL.value]: '',
[OrderStatusEnum.CANCELLED.value]: 'red',
[OrderStatusEnum.APPLY_CANCEL.value]: 'red',
[OrderStatusEnum.COMPLETED.value]: 'green'
}
return ColorEnum[orderStatus]
},
/**
* 刷新列表
* @param Boolean bool 强制刷新到第一页
*/
handleRefresh (bool = false) {
bool && (this.page = 1)
this.getList()
},
//
handleSearch (e) {
e.preventDefault()
this.searchForm.validateFields((error, values) => {
if (!error) {
this.queryParam = { ...this.queryParam, ...values }
this.handleRefresh(true)
}
})
},
//
handleReset () {
this.searchForm.resetFields()
},
//
onChangePage (current) {
this.page = current
this.handleRefresh()
},
//
handleDelete (item) {
const app = this
const modal = app.$confirm({
title: '您确定要删除该订单记录吗?',
content: '删除后不可恢复,请谨慎操作',
onOk () {
return EventApi.deleted(item.order_id)
.then(result => {
app.$message.success(result.message, 1.5)
app.handleRefresh()
})
.finally(result => modal.destroy())
}
})
},
//
handleDelivery (record) {
this.$refs.DeliveryForm.show(record)
},
//
handleExtract (record) {
this.$refs.ExtractForm.show(record)
},
//
handleCancel (record) {
this.$refs.CancelForm.show(record)
}
}
}
</script>
<style lang="less" scoped>
//
.pagination {
margin-top: 16px;
.ant-pagination {
float: right;
}
}
.ant-table {
table {
border: none;
border-collapse: collapse;
}
.ant-table-thead > tr {
border: 1px solid #e8e8e8;
}
tr.order-empty {
height: 15px;
border: 1px solid #fff;
td {
padding: 0;
border-right: none;
border-left: none;
background: none !important;
}
}
}
.ant-table-thead > tr > th {
border-right: none;
border-bottom: none;
padding: 12px 12px;
font-weight: bold;
}
.ant-table-tbody > tr > td {
border-right: 1px solid #e8e8e8;
border-left: 1px solid #e8e8e8;
padding: 12px 12px;
// text-align: center;
}
</style>

@ -34,17 +34,21 @@
<a @click="handleDetail(item)">详情</a>
</span>
</s-table>
<Log ref="Log" />
</a-card>
</template>
<script>
import * as Api from '@/api/market/presale'
import { STable } from '@/components'
import Log from './modules/Log.vue'
export default {
name: 'Index',
components: {
STable
STable,
Log
},
data () {
return {
@ -58,6 +62,10 @@ export default {
title: '预售ID',
dataIndex: 'id'
},
{
title: '预售名称',
dataIndex: 'name'
},
{
title: '状态',
dataIndex: 'status',
@ -93,8 +101,8 @@ export default {
},
methods: {
handleDetail () {
handleDetail (item) {
this.$refs.Log.visibleLog(item.id)
},
/**

@ -1,126 +0,0 @@
<template>
<a-card :bordered="false">
<div class="card-title">{{ $route.meta.title }}</div>
<s-table
ref="table"
rowKey="id"
:loading="isLoading"
:columns="columns"
:data="loadData"
:pageSize="15"
>
<!-- 活动入口图片 -->
<span slot="index_image_url" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank">
<img height="50" :src="text" alt="活动入口图片" />
</a>
</span>
<!-- Banner图 -->
<span slot="theme_image_url" slot-scope="text">
<a title="点击查看原图" :href="text" target="_blank">
<img height="50" :src="text" alt="活动主题图" />
</a>
</span>
<!-- 状态 -->
<span slot="status" slot-scope="text">
<a-tag :color="text == 1 ? 'green' : ''">{{ text ? '开启' : '关闭' }}</a-tag>
</span>
</s-table>
</a-card>
</template>
<script>
import * as Api from '@/api/market/presale'
import { STable } from '@/components'
export default {
name: 'Index',
components: {
STable
},
data () {
return {
//
queryParam: {},
//
isLoading: false,
//
columns: [
{
title: '活动ID',
dataIndex: 'id'
},
{
title: '活动名称',
dataIndex: 'name'
},
{
title: '活动标题',
dataIndex: 'title'
},
{
title: '活动入口图片',
dataIndex: 'index_image_url',
scopedSlots: { customRender: 'index_image_url' }
},
{
title: '活动主题标题',
dataIndex: 'theme_title'
},
{
title: '活动主题图',
dataIndex: 'theme_image_url',
scopedSlots: { customRender: 'theme_image_url' }
},
{
title: '状态',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '创建时间',
width: '180px',
dataIndex: 'create_time'
},
{
title: '更新时间',
width: '180px',
dataIndex: 'update_time'
},
{
title: '操作',
dataIndex: 'action',
width: '180px',
scopedSlots: { customRender: 'action' }
}
],
// Promise
loadData: param => {
return Api.log({ ...param, ...this.queryParam })
.then(response => {
return response.data.list
})
}
}
},
created () {
},
methods: {
/**
* 刷新列表
* @param Boolean bool 强制刷新到第一页
*/
handleRefresh (bool = false) {
this.$refs.table.refresh(bool)
},
//
onSearch () {
this.handleRefresh(true)
}
}
}
</script>

@ -0,0 +1,185 @@
<template>
<a-modal
:title="title"
:width="980"
:visible="visible"
:maskClosable="false"
:destroyOnClose="true"
:footer="null"
@cancel="handleCancel"
>
<div class="table-wrapper">
<div class="ant-table ant-table-scroll-position-left ant-table-default ant-table-bordered">
<div class="ant-table-content">
<div class="ant-table-scroll">
<div class="ant-table-body" style="overflow-x: scroll;">
<table style="width: 1450px;">
<tbody class="ant-table-tbody">
<template v-for="(item) in orderList.data">
<tr class="order-empty" :key="`order_${item.id}_1`">
<td colspan="8"></td>
</tr>
<tr :key="`order_${item.id}_2`">
<td colspan="8">
<span class="mr-20">记录ID{{ item.id }}</span>
<span class="mr-20">创建时间{{ item.ctime }}</span>
</td>
</tr>
<tr
v-for="(goodsItm, goodsIdx) of item.goods"
:key="`orderGoods_${item.id}_${goodsIdx}`"
>
<td>
<p>{{ goodsItm.goods_name }}</p>
</td>
</tr>
</template>
</tbody>
</table>
</div>
<a-empty v-if="!orderList.data.length" :image="simpleImage" />
</div>
</div>
</div>
<!-- 分页器 -->
<div v-if="orderList.data.length" class="pagination">
<a-pagination
:current="page"
:pageSize="orderList.per_page"
:total="orderList.total"
@change="onChangePage"
/>
</div>
</div>
</a-modal>
</template>
<script>
import pick from 'lodash.pick'
import * as Api from '@/api/market/presale'
import { STable } from '@/components'
import { Empty } from 'ant-design-vue'
export default {
components: {
STable
},
data () {
return {
//
title: '预售记录',
// modal()
visible: false,
// ID
activeId: null,
//
queryParam: {},
//
isLoading: false,
//
columns: [],
preId: null,
//
page: 1,
orderList: { data: [], total: 0, per_page: 10 },
simpleImage: Empty.PRESENTED_IMAGE_SIMPLE
}
},
methods: {
visibleLog (preId) {
//
this.visible = true
// ID
this.preId = preId
this.queryParam = { pre_id: preId }
this.getList()
},
//
getList () {
const { queryParam, page } = this
this.isLoading = true
return Api.log({ ...queryParam, page })
.then(response => {
this.orderList = response.data.list
})
.finally(() => this.isLoading = false)
},
//
handleCancel () {
this.visible = false
},
/**
* 刷新列表
* @param Boolean bool 强制刷新到第一页
*/
handleRefresh (bool = false) {
bool && (this.page = 1)
this.getList()
},
//
onChangePage (current) {
this.page = current
this.handleRefresh()
}
}
}
</script>
<style lang="less" scoped>
.table-wrapper {
width: 100%;
overflow-x: auto;
padding-bottom: 20px;
}
//
.pagination {
margin-top: 16px;
.ant-pagination {
float: right;
}
}
.ant-table {
table {
border: none;
border-collapse: collapse;
}
.ant-table-thead > tr {
border: 1px solid #e8e8e8;
}
tr.order-empty {
height: 15px;
border: 1px solid #fff;
td {
padding: 0;
border-right: none;
border-left: none;
background: none !important;
}
}
}
.ant-table-thead > tr > th {
border-right: none;
border-bottom: none;
padding: 12px 12px;
font-weight: bold;
}
.ant-table-tbody > tr > td {
border-right: 1px solid #e8e8e8;
border-left: 1px solid #e8e8e8;
padding: 12px 12px;
// text-align: center;
}
</style>
Loading…
Cancel
Save