封装钱包规则下拉框
This commit is contained in:
1 parent
c23f369a77
commit
7da1bb9a05
12 files changed
+194
-79
No files matched your search
+57
-57
@@ -5,19 +5,19 @@ module.exports = {
|
||||
es2021: true,
|
||||
node: true,
|
||||
},
|
||||
parser: 'vue-eslint-parser',
|
||||
parser: "vue-eslint-parser",
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
parser: '@typescript-eslint/parser',
|
||||
sourceType: 'module',
|
||||
parser: "@typescript-eslint/parser",
|
||||
sourceType: "module",
|
||||
},
|
||||
extends: ['plugin:vue/vue3-essential', 'plugin:vue/essential', 'eslint:recommended'],
|
||||
plugins: ['vue', '@typescript-eslint'],
|
||||
extends: ["plugin:vue/vue3-essential", "plugin:vue/essential", "eslint:recommended"],
|
||||
plugins: ["vue", "@typescript-eslint"],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.tsx', '*.vue'],
|
||||
files: ["*.ts", "*.tsx", "*.vue"],
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
"no-undef": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -25,54 +25,54 @@ module.exports = {
|
||||
// http://eslint.cn/docs/rules/
|
||||
// https://eslint.vuejs.org/rules/
|
||||
// https://typescript-eslint.io/rules/no-unused-vars/
|
||||
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [2],
|
||||
'vue/custom-event-name-casing': 'off',
|
||||
'vue/attributes-order': 'off',
|
||||
'vue/one-component-per-file': 'off',
|
||||
'vue/html-closing-bracket-newline': 'off',
|
||||
'vue/max-attributes-per-line': 'off',
|
||||
'vue/multiline-html-element-content-newline': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'vue/attribute-hyphenation': 'off',
|
||||
'vue/html-self-closing': 'off',
|
||||
'vue/no-multiple-template-root': 'off',
|
||||
'vue/require-default-prop': 'off',
|
||||
'vue/no-v-model-argument': 'off',
|
||||
'vue/no-arrow-functions-in-watch': 'off',
|
||||
'vue/no-template-key': 'off',
|
||||
'vue/no-v-html': 'off',
|
||||
'vue/comment-directive': 'off',
|
||||
'vue/no-mutating-props': 'off',
|
||||
'vue/no-parsing-error': 'off',
|
||||
'vue/no-deprecated-v-on-native-modifier': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'no-useless-escape': 'off',
|
||||
'no-sparse-arrays': 'off',
|
||||
'no-prototype-builtins': 'off',
|
||||
'no-constant-condition': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'generator-star-spacing': 'off',
|
||||
'no-unreachable': 'off',
|
||||
'no-multiple-template-root': 'off',
|
||||
'no-unused-vars': 'error',
|
||||
'no-v-model-argument': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
'no-console': 'error',
|
||||
'no-redeclare': 'off',
|
||||
'no-mixed-spaces-and-tabs': 'off',
|
||||
"@typescript-eslint/ban-ts-ignore": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-redeclare": "error",
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
|
||||
"@typescript-eslint/no-unused-vars": [2],
|
||||
"vue/custom-event-name-casing": "off",
|
||||
"vue/attributes-order": "off",
|
||||
"vue/one-component-per-file": "off",
|
||||
"vue/html-closing-bracket-newline": "off",
|
||||
"vue/max-attributes-per-line": "off",
|
||||
"vue/multiline-html-element-content-newline": "off",
|
||||
"vue/singleline-html-element-content-newline": "off",
|
||||
"vue/attribute-hyphenation": "off",
|
||||
"vue/html-self-closing": "off",
|
||||
"vue/no-multiple-template-root": "off",
|
||||
"vue/require-default-prop": "off",
|
||||
"vue/no-v-model-argument": "off",
|
||||
"vue/no-arrow-functions-in-watch": "off",
|
||||
"vue/no-template-key": "off",
|
||||
"vue/no-v-html": "off",
|
||||
"vue/comment-directive": "off",
|
||||
"vue/no-mutating-props": "off",
|
||||
"vue/no-parsing-error": "off",
|
||||
"vue/no-deprecated-v-on-native-modifier": "off",
|
||||
"vue/multi-word-component-names": "off",
|
||||
"no-useless-escape": "off",
|
||||
"no-sparse-arrays": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-constant-condition": "off",
|
||||
"no-use-before-define": "off",
|
||||
"no-restricted-globals": "off",
|
||||
"no-restricted-syntax": "off",
|
||||
"generator-star-spacing": "off",
|
||||
"no-unreachable": "off",
|
||||
"no-multiple-template-root": "off",
|
||||
"no-unused-vars": "error",
|
||||
"no-v-model-argument": "off",
|
||||
"no-case-declarations": "off",
|
||||
"no-console": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-mixed-spaces-and-tabs": "off",
|
||||
},
|
||||
};
|
||||
}
|
||||
File renamed without changes.
@@ -2,7 +2,7 @@ import request from "/@/utils/request"
|
||||
|
||||
export function pageJoin(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config/page-join",
|
||||
url: "/wallet/mch-rule-join/page-join",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
@@ -10,7 +10,7 @@ export function pageJoin(query?: Object) {
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config/page",
|
||||
url: "/wallet/mch-rule-join/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
@@ -18,7 +18,7 @@ export function fetchList(query?: Object) {
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config",
|
||||
url: "/wallet/mch-rule-join",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
@@ -26,14 +26,14 @@ export function addObj(obj?: Object) {
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config/" + id,
|
||||
url: "/wallet/mch-rule-join/" + id,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config",
|
||||
url: "/wallet/mch-rule-join",
|
||||
method: "delete",
|
||||
data: ids,
|
||||
})
|
||||
@@ -41,7 +41,7 @@ export function delObjs(ids?: Object) {
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-mch-config",
|
||||
url: "/wallet/mch-rule-join",
|
||||
method: "put",
|
||||
data: obj,
|
||||
})
|
||||
+13
-5
@@ -2,7 +2,15 @@ import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-price-config/page",
|
||||
url: "/wallet/mch-rule-price-config/page",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function pageSelect(query?: Object) {
|
||||
return request({
|
||||
url: "/wallet/mch-rule-price-config/page-select",
|
||||
method: "get",
|
||||
params: query,
|
||||
})
|
||||
@@ -10,7 +18,7 @@ export function fetchList(query?: Object) {
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-price-config",
|
||||
url: "/wallet/mch-rule-price-config",
|
||||
method: "post",
|
||||
data: obj,
|
||||
})
|
||||
@@ -18,14 +26,14 @@ export function addObj(obj?: Object) {
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-price-config/" + id,
|
||||
url: "/wallet/mch-rule-price-config/" + id,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-price-config",
|
||||
url: "/wallet/mch-rule-price-config",
|
||||
method: "delete",
|
||||
data: ids,
|
||||
})
|
||||
@@ -33,7 +41,7 @@ export function delObjs(ids?: Object) {
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: "/wallet/wallet-rule-price-config",
|
||||
url: "/wallet/mch-rule-price-config",
|
||||
method: "put",
|
||||
data: obj,
|
||||
})
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
v-model="state.selectId"
|
||||
:placeholder="props.placeholder"
|
||||
clearable
|
||||
remote-show-suffix
|
||||
filterable
|
||||
remote
|
||||
:remote-method="remoteSearch"
|
||||
:loading="state.loading"
|
||||
@visible-change="(e: boolean) => e && getOptions()"
|
||||
>
|
||||
<el-option v-for="v in state.options" :key="v.id" :label="getDictById(v.rulePriceType, v)" :value="v.rulePriceType">
|
||||
<div class="flex items-center">
|
||||
<div class="flex items-center ml5">
|
||||
<dict-tag :options="state.walletRulePriceType" :value="v.rulePriceType" />
|
||||
<div class="ml-2">
|
||||
<span>超过</span>
|
||||
<span class="color-success">{{ displayPrice(v.basePrice) }}</span>
|
||||
<span>额外支付</span>
|
||||
<span class="color-danger">{{ v.multiple }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="select-mch-rule">
|
||||
import { reactive } from "vue"
|
||||
import * as mchRulePriceConfigApi from "/@/api/wallet/mch-rule-price-config"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
const selectId = defineModel()
|
||||
|
||||
export type Props = {
|
||||
placeholder?: string
|
||||
apiParams?: any
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
placeholder: "请选择",
|
||||
apiParams: {},
|
||||
})
|
||||
|
||||
const queryForm = reactive<any>({
|
||||
name: null,
|
||||
current: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
||||
const state = reactive<any>({
|
||||
loading: true,
|
||||
selectId: selectId,
|
||||
options: [],
|
||||
walletRulePriceType: [],
|
||||
})
|
||||
|
||||
watch(
|
||||
selectId,
|
||||
(newVal, oldValue) => {
|
||||
if (newVal == oldValue) return
|
||||
state.selectId = newVal
|
||||
getOptions()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
async function getOptions() {
|
||||
try {
|
||||
state.loading = true
|
||||
const _pa = {
|
||||
...queryForm,
|
||||
...props.apiParams,
|
||||
}
|
||||
const { data } = await mchRulePriceConfigApi.pageSelect(_pa)
|
||||
state.options = data.records ?? []
|
||||
|
||||
const { wallet_rule_price_type } = useDict("wallet_rule_price_type")
|
||||
state.walletRulePriceType = wallet_rule_price_type
|
||||
} finally {
|
||||
setTimeout(() => (state.loading = false), 500)
|
||||
}
|
||||
}
|
||||
|
||||
function remoteSearch(params: string) {
|
||||
if (params != queryForm.name) {
|
||||
queryForm.name = params
|
||||
getOptions()
|
||||
}
|
||||
}
|
||||
|
||||
function getDictById(value: any, v) {
|
||||
if (!value) return ""
|
||||
const target = state.walletRulePriceType.find((v: any) => v.value == value)
|
||||
if (!target) return ""
|
||||
return `${target.label} 超过${displayPrice(v.basePrice)},额外支付${v.multiple}%`
|
||||
}
|
||||
|
||||
function clear() {
|
||||
state.selectId = null
|
||||
getOptions()
|
||||
}
|
||||
</script>
|
||||
@@ -24,6 +24,7 @@ import SelectCtcgol from "/@/components/Select/SelectCtcgol.vue"
|
||||
import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
|
||||
import SelectHandlerUser from "/@/components/Select/SelectHandlerUser.vue"
|
||||
import SelectSupplier from "/@/components/Select/SelectSupplier.vue"
|
||||
import SelectMchRule from "/@/components/Select/SelectMchRule.vue"
|
||||
|
||||
// 第三方组件
|
||||
import ElementPlus from "element-plus"
|
||||
@@ -70,6 +71,7 @@ export default {
|
||||
app.component("SelectHardGroup", SelectHardGroup)
|
||||
app.component("SelectHandlerUser", SelectHandlerUser)
|
||||
app.component("SelectSupplier", SelectSupplier)
|
||||
app.component("SelectMchRule", SelectMchRule)
|
||||
|
||||
// 导入全部的elmenet-plus的图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MchDeptUserDialog">
|
||||
<script setup lang="ts" name="MchDeptDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/wallet/mch-dept-user"
|
||||
import { getObj, addObj, putObj } from "/@/api/wallet/mch-dept"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
@@ -86,9 +86,9 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemMchDeptUser">
|
||||
<script setup lang="ts" name="systemMchDept">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import * as mchDeptUserApi from "/@/api/wallet/mch-dept-user"
|
||||
import * as mchDeptUserApi from "/@/api/wallet/mch-dept"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { ro } from "element-plus/es/locale"
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" width="30%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="规则" prop="rulePriceConfigId">
|
||||
<el-input v-model="form.rulePriceConfigId" placeholder="规则" />
|
||||
<select-mch-rule v-model="form.rulePriceConfigId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="目标商户" prop="tragetDeptId">
|
||||
<el-input v-model="form.tragetDeptId" placeholder="请输入目标商户id" />
|
||||
<select-mch v-model="form.tragetDeptId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -26,7 +26,7 @@
|
||||
<script setup lang="ts" name="WalletRuleMchConfigFormDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import * as walletRuleMchConfigApi from "/@/api/wallet/wallet-rule-mch-config"
|
||||
import * as walletRuleMchConfigApi from "../../../api/wallet/mch-rule-join"
|
||||
import { rule } from "/@/utils/validate"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="mchRuleConfigDialog">
|
||||
import * as walletRuleMchConfigApi from "/@/api/wallet/wallet-rule-mch-config"
|
||||
import * as walletRuleMchConfigApi from "../../../api/wallet/mch-rule-join"
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<script setup lang="ts" name="WalletRulePriceConfigDialog">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj } from "/@/api/wallet/wallet-rule-price-config"
|
||||
import { getObj, addObj, putObj } from "../../../api/wallet/mch-rule-price-config"
|
||||
import { storePrice, displayPrice } from "/@/utils/formatMoney"
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
<script setup lang="ts" name="systemWalletRulePriceConfig">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/wallet/wallet-rule-price-config"
|
||||
import { fetchList, delObjs } from "../../../api/wallet/mch-rule-price-config"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
Reference in new issue
Block a user