|
|
@@ -14,6 +14,11 @@
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <el-button @click="openOrderDialog">
|
|
|
+ <el-icon><Sort /></el-icon>调整显示顺序
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -21,37 +26,6 @@
|
|
|
<el-table-column label="操作" width="280" fixed="left">
|
|
|
<template #default="scope">
|
|
|
<div class="row-actions">
|
|
|
- <el-popover
|
|
|
- placement="bottom"
|
|
|
- trigger="click"
|
|
|
- width="240"
|
|
|
- @show="onAdjustOrderShow(scope.$index)"
|
|
|
- :ref="`adjustPopover-${scope.$index}`"
|
|
|
- >
|
|
|
- <div class="adjust-order-form">
|
|
|
- <div class="adjust-order-title">调整显示顺序</div>
|
|
|
- <div class="adjust-order-tip">移动端权益首页和列表页按照该顺序展示</div>
|
|
|
- <div class="adjust-order-input">
|
|
|
- <span>调整到第</span>
|
|
|
- <el-input-number
|
|
|
- v-model.number="adjustOrderPosition"
|
|
|
- :min="1"
|
|
|
- :max="tableData.length"
|
|
|
- size="small"
|
|
|
- :controls="false"
|
|
|
- style="width: 70px;margin: 0 6px;"
|
|
|
- />
|
|
|
- <span>位</span>
|
|
|
- </div>
|
|
|
- <div class="adjust-order-actions">
|
|
|
- <el-button size="small" @click="closeAdjustOrder(scope.$index)">取消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="confirmAdjustOrder(scope.$index)">确定</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <template #reference>
|
|
|
- <el-button v-if="scope.row.shelfStatus === '已上架'" type="text" size="small">调整显示顺序</el-button>
|
|
|
- </template>
|
|
|
- </el-popover>
|
|
|
<el-button type="text" size="small" @click="openShowPagesDialog(scope.row)">编辑</el-button>
|
|
|
<el-popover
|
|
|
placement="bottom"
|
|
|
@@ -116,17 +90,24 @@
|
|
|
path-name="equity/credit"
|
|
|
title="生成信用卡权益链接"
|
|
|
></equity-link-dialog>
|
|
|
+
|
|
|
+ <equity-order-dialog
|
|
|
+ v-model="orderDialogVisible"
|
|
|
+ :items="orderableItems"
|
|
|
+ @confirm="onOrderConfirm"
|
|
|
+ ></equity-order-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import ShowPagesDialog from '@/components/ShowPagesDialog.vue'
|
|
|
import EquityLinkDialog from '@/components/EquityLinkDialog.vue'
|
|
|
+import EquityOrderDialog from '@/components/EquityOrderDialog.vue'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
|
export default {
|
|
|
name: 'CreditCardEquity',
|
|
|
- components: { ShowPagesDialog, EquityLinkDialog },
|
|
|
+ components: { ShowPagesDialog, EquityLinkDialog, EquityOrderDialog },
|
|
|
data() {
|
|
|
return {
|
|
|
searchForm: {
|
|
|
@@ -136,7 +117,8 @@ export default {
|
|
|
showPagesRow: null,
|
|
|
linkDialogVisible: false,
|
|
|
linkTargetId: '',
|
|
|
- adjustOrderPosition: 1,
|
|
|
+ orderDialogVisible: false,
|
|
|
+ displayOrder: [],
|
|
|
tableData: [
|
|
|
{
|
|
|
equityName: '白金卡机场贵宾厅',
|
|
|
@@ -148,7 +130,8 @@ export default {
|
|
|
enabled: '不启用',
|
|
|
showOnHome: '显示',
|
|
|
showOnAssembly: '不显示',
|
|
|
- assemblyPages: []
|
|
|
+ assemblyPages: [],
|
|
|
+ whitelistCrowds: []
|
|
|
},
|
|
|
{
|
|
|
equityName: '钻石卡高尔夫体验',
|
|
|
@@ -160,7 +143,8 @@ export default {
|
|
|
enabled: '不启用',
|
|
|
showOnHome: '显示',
|
|
|
showOnAssembly: '不显示',
|
|
|
- assemblyPages: []
|
|
|
+ assemblyPages: [],
|
|
|
+ whitelistCrowds: []
|
|
|
},
|
|
|
{
|
|
|
equityName: '金卡洗车服务',
|
|
|
@@ -172,7 +156,8 @@ export default {
|
|
|
enabled: '不启用',
|
|
|
showOnHome: '显示',
|
|
|
showOnAssembly: '不显示',
|
|
|
- assemblyPages: []
|
|
|
+ assemblyPages: [],
|
|
|
+ whitelistCrowds: []
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
@@ -193,6 +178,15 @@ export default {
|
|
|
if (this.searchForm.equityName && !item.equityName.includes(this.searchForm.equityName)) return false
|
|
|
return true
|
|
|
})
|
|
|
+ },
|
|
|
+ orderableItems() {
|
|
|
+ const qualifying = this.tableData.filter(row => row.shelfStatus === '已上架')
|
|
|
+ if (!this.displayOrder.length) return qualifying
|
|
|
+ const rank = id => {
|
|
|
+ const i = this.displayOrder.indexOf(id)
|
|
|
+ return i === -1 ? Number.MAX_SAFE_INTEGER : i
|
|
|
+ }
|
|
|
+ return [...qualifying].sort((a, b) => rank(a.productId) - rank(b.productId))
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -225,6 +219,7 @@ export default {
|
|
|
this.showPagesRow.showOnHome = values.showOnHome
|
|
|
this.showPagesRow.showOnAssembly = values.showOnAssembly
|
|
|
this.showPagesRow.assemblyPages = [...values.assemblyPages]
|
|
|
+ this.showPagesRow.whitelistCrowds = [...values.whitelistCrowds]
|
|
|
this.showPagesRow.equityName = values.equityName
|
|
|
this.showPagesRow.equityIcon = values.equityIcon
|
|
|
ElMessage.success('已保存')
|
|
|
@@ -235,28 +230,12 @@ export default {
|
|
|
if (!ref) return null
|
|
|
return Array.isArray(ref) ? ref[0] : ref
|
|
|
},
|
|
|
- onAdjustOrderShow(index) {
|
|
|
- this.adjustOrderPosition = index + 1
|
|
|
+ openOrderDialog() {
|
|
|
+ this.orderDialogVisible = true
|
|
|
},
|
|
|
- closeAdjustOrder(index) {
|
|
|
- const adjustRef = this.getPopoverInstance(`adjustPopover-${index}`)
|
|
|
- if (adjustRef) {
|
|
|
- adjustRef.hide()
|
|
|
- }
|
|
|
- },
|
|
|
- confirmAdjustOrder(index) {
|
|
|
- const target = Number(this.adjustOrderPosition)
|
|
|
- if (!target || target < 1 || target > this.tableData.length) {
|
|
|
- ElMessage.warning('请输入有效的顺序位置')
|
|
|
- return
|
|
|
- }
|
|
|
- const targetIndex = target - 1
|
|
|
- if (targetIndex !== index) {
|
|
|
- const moved = this.tableData.splice(index, 1)[0]
|
|
|
- this.tableData.splice(targetIndex, 0, moved)
|
|
|
- }
|
|
|
- ElMessage.success('顺序已调整')
|
|
|
- this.closeAdjustOrder(index)
|
|
|
+ onOrderConfirm(productIds) {
|
|
|
+ this.displayOrder = productIds
|
|
|
+ ElMessage.success('显示顺序已保存')
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -333,38 +312,4 @@ export default {
|
|
|
background: #f5f7fa;
|
|
|
color: #409eff;
|
|
|
}
|
|
|
-
|
|
|
-.adjust-order-form {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- gap: 12px;
|
|
|
-}
|
|
|
-
|
|
|
-.adjust-order-title {
|
|
|
- font-size: 14px;
|
|
|
- font-weight: 500;
|
|
|
- color: #303133;
|
|
|
-}
|
|
|
-
|
|
|
-.adjust-order-tip {
|
|
|
- font-size: 12px;
|
|
|
- color: #909399;
|
|
|
- line-height: 1.5;
|
|
|
- padding: 8px 10px;
|
|
|
- background: #f5f7fa;
|
|
|
- border-radius: 4px;
|
|
|
-}
|
|
|
-
|
|
|
-.adjust-order-input {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- font-size: 14px;
|
|
|
- color: #606266;
|
|
|
-}
|
|
|
-
|
|
|
-.adjust-order-actions {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
- gap: 8px;
|
|
|
-}
|
|
|
</style>
|