Compare commits
6 Commits
18ba70b0c3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e2c0ac190 | |||
| a6e80328f1 | |||
| d5d8f12c9e | |||
| bb7bf06ea7 | |||
| 805b1e3b26 | |||
| bfb208d7eb |
+5
-3
@@ -1,3 +1,5 @@
|
||||
/.hbuilderx
|
||||
/node_modules
|
||||
/unpackage
|
||||
/.hbuilderx/launch.json
|
||||
/unpackage/dist/*
|
||||
/node_modules/*
|
||||
**/node_modules/
|
||||
package-lock.json
|
||||
|
||||
@@ -144,6 +144,9 @@
|
||||
{
|
||||
"path": "pages/finance/balance/list"
|
||||
},
|
||||
{
|
||||
"path": "pages/points/log/list"
|
||||
},
|
||||
{
|
||||
"path": "pages/login/index",
|
||||
"style": {
|
||||
|
||||
@@ -146,6 +146,7 @@ export default {
|
||||
{value: 13, label: '金久信签约宝次数'},
|
||||
{value: 14, label: '金久信签约宝'},
|
||||
{value: 15, label: '金久信自营询价'},
|
||||
{value: 20, label: 'AI积分充值'},
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -275,6 +276,7 @@ export default {
|
||||
{value: 13, label: '金久信签约宝次数'},
|
||||
{value: 14, label: '金久信签约宝'},
|
||||
{value: 15, label: '金久信自营询价'},
|
||||
{value: 20, label: 'AI积分充值'},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<view class="page-body">
|
||||
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
|
||||
@search="search"></vk-data-table-query>
|
||||
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
|
||||
:pagination="true"
|
||||
@current-change="currentChange"
|
||||
@selection-change="selectionChange"></vk-data-table>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var that;
|
||||
var vk = uni.vk;
|
||||
|
||||
const typeData = [
|
||||
{ value: "spend", label: "消耗" },
|
||||
{ value: "earn", label: "充值/收入" }
|
||||
];
|
||||
|
||||
const bizTypeData = [
|
||||
{ value: "contract_review", label: "合同审查" },
|
||||
{ value: "recharge", label: "积分充值" },
|
||||
{ value: "other", label: "其他" }
|
||||
];
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
table1: {
|
||||
action: "admin/points/sys/getList",
|
||||
columns: [
|
||||
{
|
||||
key: "userInfo",
|
||||
title: "用户",
|
||||
type: "html",
|
||||
align: "left",
|
||||
width: 200,
|
||||
formatter: (val, row) => {
|
||||
// vk 联表 limit:1 返回对象而非数组,两种形态兼容
|
||||
const raw = row.userInfo;
|
||||
const user = Array.isArray(raw) ? (raw[0] || null) : (raw || null);
|
||||
const mobile = user && user.mobile ? user.mobile : "-";
|
||||
if (user) {
|
||||
const name = user.nickname || user.username || "未设置昵称";
|
||||
return `<div>${name}</div><div style="color:#999;font-size:12px;">${mobile}</div>`;
|
||||
}
|
||||
// 联表未匹配:显示 user_id 原值便于排查(anonymous 为历史脏数据)
|
||||
const uid = row.user_id || "-";
|
||||
const label = uid === "anonymous" ? "未登录(anonymous)" : uid.slice(0, 12) + "…";
|
||||
return `<div style="color:#f56c6c;">未匹配用户</div><div style="color:#999;font-size:12px;">${label}</div>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "type",
|
||||
title: "类型",
|
||||
type: "select",
|
||||
align: "center",
|
||||
width: 110,
|
||||
data: typeData
|
||||
},
|
||||
{
|
||||
key: "amount",
|
||||
title: "变动积分",
|
||||
type: "html",
|
||||
align: "center",
|
||||
width: 120,
|
||||
formatter: (val) => {
|
||||
const num = Number(val || 0);
|
||||
const color = num >= 0 ? "#67c23a" : "#f56c6c";
|
||||
return `<span style="color:${color};font-weight:bold;">${num >= 0 ? "+" : ""}${num}</span>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "balance_after",
|
||||
title: "变动后余额",
|
||||
type: "text",
|
||||
align: "center",
|
||||
width: 120
|
||||
},
|
||||
{
|
||||
key: "reason",
|
||||
title: "事由",
|
||||
type: "text",
|
||||
align: "left",
|
||||
minWidth: 260
|
||||
},
|
||||
{
|
||||
key: "biz_type",
|
||||
title: "业务类型",
|
||||
type: "select",
|
||||
align: "center",
|
||||
width: 120,
|
||||
data: bizTypeData
|
||||
},
|
||||
{
|
||||
key: "_add_time",
|
||||
title: "时间",
|
||||
type: "time",
|
||||
width: 180,
|
||||
sortable: "custom"
|
||||
}
|
||||
],
|
||||
multipleSelection: [],
|
||||
selectItem: ""
|
||||
},
|
||||
queryForm1: {
|
||||
formData: {},
|
||||
columns: [
|
||||
{
|
||||
key: "type",
|
||||
title: "类型",
|
||||
type: "select",
|
||||
mode: "=",
|
||||
data: typeData
|
||||
},
|
||||
{
|
||||
key: "biz_type",
|
||||
title: "业务类型",
|
||||
type: "select",
|
||||
mode: "=",
|
||||
data: bizTypeData
|
||||
},
|
||||
{
|
||||
key: "_add_time",
|
||||
title: "时间",
|
||||
type: "datetimerange",
|
||||
width: 380,
|
||||
mode: "[]"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(options = {}) {
|
||||
that = this;
|
||||
vk = that.vk;
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
that.$refs.table1.search();
|
||||
},
|
||||
currentChange(val) {
|
||||
that.table1.selectItem = val;
|
||||
},
|
||||
selectionChange(list) {
|
||||
that.table1.multipleSelection = list;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-body {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
@@ -113,6 +113,23 @@
|
||||
<el-button @click="showInviteList = false">关闭</el-button>
|
||||
</template>
|
||||
</vk-data-dialog>
|
||||
|
||||
<el-dialog
|
||||
title="赠送签约次数"
|
||||
:visible.sync="giftDialog.show"
|
||||
width="420px"
|
||||
@closed="giftDialog.giftNum = 1; giftDialog.user = null"
|
||||
>
|
||||
<view v-if="giftDialog.user" style="margin-bottom: 16px;">
|
||||
用户:{{ giftDialog.user.nickname || '未设置' }}({{ giftDialog.user.mobile || '未绑定' }})
|
||||
</view>
|
||||
<view style="margin-bottom: 8px;">请输入赠送次数</view>
|
||||
<el-input-number v-model="giftDialog.giftNum" :min="1" :precision="0" :step="1" style="width: 100%;"/>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="giftDialog.show = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="giftDialog.loading" @click="submitGiftQybNum">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -143,6 +160,12 @@ export default {
|
||||
return {
|
||||
showInviteList: false,
|
||||
inviteList: [],
|
||||
giftDialog: {
|
||||
show: false,
|
||||
loading: false,
|
||||
giftNum: 1,
|
||||
user: null
|
||||
},
|
||||
// 页面是否请求中或加载中
|
||||
loading: false,
|
||||
// init请求返回的数据
|
||||
@@ -163,6 +186,14 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "赠送",
|
||||
onClick: function (item) {
|
||||
that.giftDialog.user = item;
|
||||
that.giftDialog.giftNum = 1;
|
||||
that.giftDialog.show = true;
|
||||
}
|
||||
}
|
||||
],
|
||||
// 表格数据请求地址
|
||||
@@ -177,6 +208,7 @@ export default {
|
||||
{key: "qybUsedNum", title: "已消费次数", type: "text", width: 120, defaultValue: 0},
|
||||
{key: "qybNum", title: "剩余签约次数", type: "text", width: 120, defaultValue: 0},
|
||||
{key: "qybGiftNum", title: "优惠政策赠送次数", type: "text", width: 150, defaultValue: 0},
|
||||
{key: "qybTotalGiftNum", title: "累计赠送次数", type: "text", width: 120, defaultValue: 0},
|
||||
{
|
||||
key: "userLevel",
|
||||
title: "用户等级",
|
||||
@@ -604,6 +636,30 @@ export default {
|
||||
dcloudAppidData
|
||||
}
|
||||
};
|
||||
},
|
||||
// 提交赠送签约次数
|
||||
submitGiftQybNum() {
|
||||
const user = that.giftDialog.user;
|
||||
const giftNum = Number(that.giftDialog.giftNum);
|
||||
if (!user || !user._id) return vk.toast('请选择用户');
|
||||
if (!Number.isInteger(giftNum) || giftNum <= 0) return vk.toast('赠送次数必须为正整数');
|
||||
that.giftDialog.loading = true;
|
||||
vk.callFunction({
|
||||
url: 'admin/system/user/sys/giftQybNum',
|
||||
title: '赠送中...',
|
||||
data: {
|
||||
user_id: user._id,
|
||||
giftNum
|
||||
},
|
||||
success: () => {
|
||||
that.giftDialog.show = false;
|
||||
that.$notify({ message: '赠送成功', type: 'success' });
|
||||
that.refresh();
|
||||
},
|
||||
complete: () => {
|
||||
that.giftDialog.loading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
|
||||
@@ -173,6 +173,11 @@ export default {
|
||||
// {key: "username", title: "用户名", type: "text", width: 180, defaultValue: '未设置'},
|
||||
{key: "nickname", title: "昵称", type: "text", width: 180, defaultValue: '未设置'},
|
||||
{key: "mobile", title: "手机号", type: "text", width: 120, defaultValue: "未绑定"},
|
||||
{key: "qybBuyNum", title: "累计购买", type: "text", width: 100, defaultValue: 0},
|
||||
{key: "qybUsedNum", title: "已消费", type: "text", width: 100, defaultValue: 0},
|
||||
{key: "qybNum", title: "剩余签约", type: "text", width: 100, defaultValue: 0},
|
||||
{key: "qybGiftNum", title: "赠送", type: "text", width: 100, defaultValue: 0},
|
||||
{key: "qybTotalGiftNum", title: "总共赠送次数", type: "text", width: 120, defaultValue: 0},
|
||||
{
|
||||
key: "userLevel",
|
||||
title: "用户等级",
|
||||
|
||||
Generated
-257
@@ -1,257 +0,0 @@
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
async-validator: ^4.2.5
|
||||
babel-helper-vue-jsx-merge-props: ^2.0.3
|
||||
dayjs: ^1.11.11
|
||||
element-ui: 2.15.13
|
||||
normalize-wheel: ^1.0.1
|
||||
resize-observer-polyfill: ^1.5.1
|
||||
sortablejs: ^1.15.0
|
||||
throttle-debounce: ^1.1.0
|
||||
umy-table: ^1.1.8
|
||||
umy-ui: 1.1.6
|
||||
vk-unicloud-admin-ui: ^1.17.45
|
||||
vue: '2'
|
||||
vue-tianditu: 1.2.11
|
||||
vuedraggable: ^2.24.3
|
||||
xe-utils: ^3.5.14
|
||||
|
||||
dependencies:
|
||||
async-validator: 4.2.5
|
||||
babel-helper-vue-jsx-merge-props: 2.0.3
|
||||
dayjs: 1.11.11
|
||||
element-ui: 2.15.13_vue@2.7.15
|
||||
normalize-wheel: 1.0.1
|
||||
resize-observer-polyfill: 1.5.1
|
||||
sortablejs: 1.15.0
|
||||
throttle-debounce: 1.1.0
|
||||
umy-table: 1.1.8_vue@2.7.15+xe-utils@3.5.14
|
||||
umy-ui: 1.1.6_vue@2.7.15+xe-utils@3.5.14
|
||||
vk-unicloud-admin-ui: 1.17.52
|
||||
vue: 2.7.15
|
||||
vue-tianditu: 1.2.11
|
||||
vuedraggable: 2.24.3
|
||||
xe-utils: 3.5.14
|
||||
|
||||
packages:
|
||||
|
||||
/@babel/helper-string-parser/7.23.4:
|
||||
resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dev: false
|
||||
|
||||
/@babel/helper-validator-identifier/7.22.20:
|
||||
resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dev: false
|
||||
|
||||
/@babel/parser/7.23.4:
|
||||
resolution: {integrity: sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/parser/-/parser-7.23.4.tgz}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@babel/types': 7.23.4
|
||||
dev: false
|
||||
|
||||
/@babel/types/7.23.4:
|
||||
resolution: {integrity: sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/types/-/types-7.23.4.tgz}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.23.4
|
||||
'@babel/helper-validator-identifier': 7.22.20
|
||||
to-fast-properties: 2.0.0
|
||||
dev: false
|
||||
|
||||
/@vue/compiler-sfc/2.7.15:
|
||||
resolution: {integrity: sha512-FCvIEevPmgCgqFBH7wD+3B97y7u7oj/Wr69zADBf403Tui377bThTjBvekaZvlRr4IwUAu3M6hYZeULZFJbdYg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@vue/compiler-sfc/-/compiler-sfc-2.7.15.tgz}
|
||||
dependencies:
|
||||
'@babel/parser': 7.23.4
|
||||
postcss: 8.4.31
|
||||
source-map: 0.6.1
|
||||
dev: false
|
||||
|
||||
/async-validator/1.11.5:
|
||||
resolution: {integrity: sha512-XNtCsMAeAH1pdLMEg1z8/Bb3a8cdCbui9QbJATRFHHHW5kT6+NPI3zSVQUXgikTFITzsg+kYY5NTWhM2Orwt9w==}
|
||||
dev: false
|
||||
|
||||
/async-validator/1.8.5:
|
||||
resolution: {integrity: sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/async-validator/-/async-validator-1.8.5.tgz}
|
||||
dependencies:
|
||||
babel-runtime: 6.26.0
|
||||
dev: false
|
||||
|
||||
/async-validator/4.2.5:
|
||||
resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/async-validator/-/async-validator-4.2.5.tgz}
|
||||
dev: false
|
||||
|
||||
/babel-helper-vue-jsx-merge-props/2.0.3:
|
||||
resolution: {integrity: sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz}
|
||||
dev: false
|
||||
|
||||
/babel-runtime/6.26.0:
|
||||
resolution: {integrity: sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/babel-runtime/-/babel-runtime-6.26.0.tgz}
|
||||
dependencies:
|
||||
core-js: 2.6.12
|
||||
regenerator-runtime: 0.11.1
|
||||
dev: false
|
||||
|
||||
/core-js/2.6.12:
|
||||
resolution: {integrity: sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/core-js/-/core-js-2.6.12.tgz}
|
||||
deprecated: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
|
||||
/core-js/3.37.0:
|
||||
resolution: {integrity: sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==}
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
|
||||
/csstype/3.1.2:
|
||||
resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/csstype/-/csstype-3.1.2.tgz}
|
||||
dev: false
|
||||
|
||||
/dayjs/1.11.11:
|
||||
resolution: {integrity: sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==}
|
||||
dev: false
|
||||
|
||||
/deepmerge/1.5.2:
|
||||
resolution: {integrity: sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/deepmerge/-/deepmerge-1.5.2.tgz}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/element-ui/2.15.13_vue@2.7.15:
|
||||
resolution: {integrity: sha512-LJoatEYX6WV74FqXBss8Xfho9fh9rjDSzrDrTyREdGb1h1R3uRvmLh5jqp2JU137aj4/BgqA3K06RQpQBX33Bg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/element-ui/-/element-ui-2.15.13.tgz}
|
||||
peerDependencies:
|
||||
vue: ^2.5.17
|
||||
dependencies:
|
||||
async-validator: 1.8.5
|
||||
babel-helper-vue-jsx-merge-props: 2.0.3
|
||||
deepmerge: 1.5.2
|
||||
normalize-wheel: 1.0.1
|
||||
resize-observer-polyfill: 1.5.1
|
||||
throttle-debounce: 1.1.0
|
||||
vue: 2.7.15
|
||||
dev: false
|
||||
|
||||
/nanoid/3.3.7:
|
||||
resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/nanoid/-/nanoid-3.3.7.tgz}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/normalize-wheel/1.0.1:
|
||||
resolution: {integrity: sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz}
|
||||
dev: false
|
||||
|
||||
/picocolors/1.0.0:
|
||||
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/picocolors/-/picocolors-1.0.0.tgz}
|
||||
dev: false
|
||||
|
||||
/postcss/8.4.31:
|
||||
resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/postcss/-/postcss-8.4.31.tgz}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
dependencies:
|
||||
nanoid: 3.3.7
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
dev: false
|
||||
|
||||
/regenerator-runtime/0.11.1:
|
||||
resolution: {integrity: sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz}
|
||||
dev: false
|
||||
|
||||
/resize-observer-polyfill/1.5.1:
|
||||
resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz}
|
||||
dev: false
|
||||
|
||||
/sortablejs/1.10.2:
|
||||
resolution: {integrity: sha512-YkPGufevysvfwn5rfdlGyrGjt7/CRHwvRPogD/lC+TnvcN29jDpCifKP+rBqf+LRldfXSTh+0CGLcSg0VIxq3A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/sortablejs/-/sortablejs-1.10.2.tgz}
|
||||
dev: false
|
||||
|
||||
/sortablejs/1.15.0:
|
||||
resolution: {integrity: sha512-bv9qgVMjUMf89wAvM6AxVvS/4MX3sPeN0+agqShejLU5z5GX4C75ow1O2e5k4L6XItUyAK3gH6AxSbXrOM5e8w==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/sortablejs/-/sortablejs-1.15.0.tgz}
|
||||
dev: false
|
||||
|
||||
/source-map-js/1.0.2:
|
||||
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/source-map-js/-/source-map-js-1.0.2.tgz}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/source-map/0.6.1:
|
||||
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/source-map/-/source-map-0.6.1.tgz}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/throttle-debounce/1.1.0:
|
||||
resolution: {integrity: sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz}
|
||||
engines: {node: '>=4'}
|
||||
dev: false
|
||||
|
||||
/to-fast-properties/2.0.0:
|
||||
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz}
|
||||
engines: {node: '>=4'}
|
||||
dev: false
|
||||
|
||||
/umy-table/1.1.8_vue@2.7.15+xe-utils@3.5.14:
|
||||
resolution: {integrity: sha512-yqPMFwZ6MUNqI73KamsNKBTbHRA7VuVZDEWobaySghtf4n/s7INuTNQoADB/ROVK57WOXr99Xpnol0aMqGlASA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/umy-table/-/umy-table-1.1.8.tgz}
|
||||
peerDependencies:
|
||||
vue: '>= 2.6.0 < 3'
|
||||
xe-utils: '>= 3'
|
||||
dependencies:
|
||||
async-validator: 1.8.5
|
||||
deepmerge: 1.5.2
|
||||
normalize-wheel: 1.0.1
|
||||
resize-observer-polyfill: 1.5.1
|
||||
throttle-debounce: 1.1.0
|
||||
vue: 2.7.15
|
||||
vuedraggable: 2.24.3
|
||||
xe-utils: 3.5.14
|
||||
dev: false
|
||||
|
||||
/umy-ui/1.1.6_vue@2.7.15+xe-utils@3.5.14:
|
||||
resolution: {integrity: sha512-wX0S29B5sFn8q0MvU9PEl8DGZeQmZXOJlLrwaCJ2UHiIQZCANWgXMBjjQgpaequ1gRZ8BekEu7Sn7hJccm9YMQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/umy-ui/-/umy-ui-1.1.6.tgz}
|
||||
peerDependencies:
|
||||
vue: '>= 2.6.0 < 3'
|
||||
xe-utils: '>= 3'
|
||||
dependencies:
|
||||
async-validator: 1.8.5
|
||||
deepmerge: 1.5.2
|
||||
normalize-wheel: 1.0.1
|
||||
resize-observer-polyfill: 1.5.1
|
||||
throttle-debounce: 1.1.0
|
||||
umy-table: 1.1.8_vue@2.7.15+xe-utils@3.5.14
|
||||
vue: 2.7.15
|
||||
vuedraggable: 2.24.3
|
||||
xe-utils: 3.5.14
|
||||
dev: false
|
||||
|
||||
/vk-unicloud-admin-ui/1.17.52:
|
||||
resolution: {integrity: sha512-nNzN5EOFDYIp2TF6dQT7kcfxEVZJzBeRR8FuLLyeKkoHnglOa5pKjgAdWf1/RzgxZfv3Aje9sV1zvNH33Jt8ww==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/vk-unicloud-admin-ui/-/vk-unicloud-admin-ui-1.17.52.tgz}
|
||||
dev: false
|
||||
|
||||
/vue-tianditu/1.2.11:
|
||||
resolution: {integrity: sha512-yE80uENFI3be2Fh9gIjQ7R+H5y0fl7sNw8+MhkUpB7VDEnwiT4som93n+1kroMs9fNwMiSVXAMeBsJ+YrmGjIg==}
|
||||
dependencies:
|
||||
async-validator: 1.11.5
|
||||
core-js: 3.37.0
|
||||
element-ui: 2.15.13_vue@2.7.15
|
||||
vue: 2.7.15
|
||||
dev: false
|
||||
|
||||
/vue/2.7.15:
|
||||
resolution: {integrity: sha512-a29fsXd2G0KMRqIFTpRgpSbWaNBK3lpCTOLuGLEDnlHWdjB8fwl6zyYZ8xCrqkJdatwZb4mGHiEfJjnw0Q6AwQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/vue/-/vue-2.7.15.tgz}
|
||||
dependencies:
|
||||
'@vue/compiler-sfc': 2.7.15
|
||||
csstype: 3.1.2
|
||||
dev: false
|
||||
|
||||
/vuedraggable/2.24.3:
|
||||
resolution: {integrity: sha512-6/HDXi92GzB+Hcs9fC6PAAozK1RLt1ewPTLjK0anTYguXLAeySDmcnqE8IC0xa7shvSzRjQXq3/+dsZ7ETGF3g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/vuedraggable/-/vuedraggable-2.24.3.tgz}
|
||||
dependencies:
|
||||
sortablejs: 1.10.2
|
||||
dev: false
|
||||
|
||||
/xe-utils/3.5.14:
|
||||
resolution: {integrity: sha512-Xq6mS8dWwHBQsQUEBXcZYSaBV0KnNLoVWd0vRRDI3nKpbNxfs/LSCK0W21g1edLFnXYfKqg7hh5dakr3RtYY0A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/xe-utils/-/xe-utils-3.5.14.tgz}
|
||||
dev: false
|
||||
@@ -63,6 +63,11 @@
|
||||
"menu_id": "jjx-finance-balance",
|
||||
"name": "资金明细",
|
||||
"url": "/pages/finance/balance/list"
|
||||
},
|
||||
{
|
||||
"menu_id": "jjx-finance-points",
|
||||
"name": "积分明细",
|
||||
"url": "/pages/points/log/list"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
/**
|
||||
* 积分流水列表(所有用户)
|
||||
* @url admin/points/sys/getList 前端调用的url参数地址
|
||||
* data 请求参数说明
|
||||
* @param {Number} pageIndex 当前页码
|
||||
* @param {Number} pageSize 每页显示数量
|
||||
* @param {Object} formData 查询条件数据源
|
||||
* @param {Array} columns 查询条件规则
|
||||
*/
|
||||
main: async (event) => {
|
||||
let { data = {}, util } = event;
|
||||
let { vk, _ } = util;
|
||||
let res = { code: 0, msg: '' };
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
res = await vk.baseDao.getTableData({
|
||||
dbName: "jjx-points-log",
|
||||
data,
|
||||
whereJson: {},
|
||||
sortArr: [{ name: "_add_time", type: "desc" }],
|
||||
foreignDB: [{
|
||||
dbName: "uni-id-users",
|
||||
localKey: "user_id",
|
||||
foreignKey: "_id",
|
||||
as: "userInfo",
|
||||
limit: 1,
|
||||
fieldJson: {
|
||||
nickname: true,
|
||||
username: true,
|
||||
mobile: true
|
||||
}
|
||||
}]
|
||||
});
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
};
|
||||
@@ -1,59 +1,230 @@
|
||||
module.exports = {
|
||||
/**
|
||||
* 查询用户列表(可登录后台的)
|
||||
* @url admin/system/user/sys/getList 前端调用的url参数地址
|
||||
* data 请求参数 说明
|
||||
* @param {Number} pageIndex 当前页码
|
||||
* @param {Number} pageSize 每页显示数量
|
||||
* @param {Array<Object>} sortRule 排序规则
|
||||
* @param {object} formData 查询条件数据源
|
||||
* @param {Array<Object>} columns 查询条件规则
|
||||
* res 返回参数说明
|
||||
* @param {Number} code 错误码,0表示成功
|
||||
* @param {String} msg 详细信息
|
||||
*/
|
||||
main: async (event) => {
|
||||
let { data = {}, userInfo, util, filterResponse, originalParam } = event;
|
||||
let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
|
||||
let { uid } = data;
|
||||
let res = { code: 0, msg: '' };
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
let { dcloud_appid, appids } = data.formData || {};
|
||||
let whereJson = {};
|
||||
if (dcloud_appid) {
|
||||
if (dcloud_appid === "___empty-array___") {
|
||||
whereJson["dcloud_appid"] = [];
|
||||
} else if (dcloud_appid === "___error___") {
|
||||
whereJson["dcloud_appid"] = _.and(_.exists(true), _.nin(appids));
|
||||
} else if (dcloud_appid === "___non-existent___") {
|
||||
whereJson["dcloud_appid"] = _.exists(false);
|
||||
} else {
|
||||
whereJson["dcloud_appid"] = _.or(_.eq(dcloud_appid), _.exists(false));
|
||||
}
|
||||
}
|
||||
let dbName = "uni-id-users";
|
||||
res = await vk.baseDao.getTableData({
|
||||
dbName,
|
||||
data,
|
||||
whereJson,
|
||||
sortArr: [{ "name": "register_date", "type": "desc" }],
|
||||
// 副表列表
|
||||
foreignDB: [{
|
||||
dbName: "opendb-app-list",
|
||||
localKey: "dcloud_appid",
|
||||
foreignKey: "appid",
|
||||
localKeyType: "array",
|
||||
as: "appList",
|
||||
limit: 500
|
||||
}],
|
||||
});
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
if (res.rows[i].isNotaryBusiness === undefined || res.rows[i].isNotaryBusiness === null) {
|
||||
res.rows[i].isNotaryBusiness = res.rows[i].notaryUnionPayProfile && res.rows[i].notaryUnionPayProfile.status === 1 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* 查询用户列表(可登录后台的)
|
||||
* @url admin/system/user/sys/getList 前端调用的url参数地址
|
||||
* data 请求参数 说明
|
||||
* @param {Number} pageIndex 当前页码
|
||||
* @param {Number} pageSize 每页显示数量
|
||||
* @param {Array<Object>} sortRule 排序规则
|
||||
* @param {object} formData 查询条件数据源
|
||||
* @param {Array<Object>} columns 查询条件规则
|
||||
* res 返回参数说明
|
||||
* @param {Number} code 错误码,0表示成功
|
||||
* @param {String} msg 详细信息
|
||||
*/
|
||||
main: async (event) => {
|
||||
let {data = {}, userInfo, util, filterResponse, originalParam} = event;
|
||||
let {customUtil, uniID, config, pubFun, vk, db, _} = util;
|
||||
let {uid} = data;
|
||||
let res = {code: 0, msg: ''};
|
||||
// 业务逻辑开始-----------------------------------------------------------
|
||||
let {dcloud_appid, appids, type} = data.formData || {};
|
||||
let whereJson = {};
|
||||
if (dcloud_appid) {
|
||||
if (dcloud_appid === "___empty-array___") {
|
||||
whereJson["dcloud_appid"] = [];
|
||||
} else if (dcloud_appid === "___error___") {
|
||||
whereJson["dcloud_appid"] = _.and(_.exists(true), _.nin(appids));
|
||||
} else if (dcloud_appid === "___non-existent___") {
|
||||
whereJson["dcloud_appid"] = _.exists(false);
|
||||
} else {
|
||||
whereJson["dcloud_appid"] = _.or(_.eq(dcloud_appid), _.exists(false));
|
||||
}
|
||||
}
|
||||
if (type) {
|
||||
whereJson["accountType"] = type;
|
||||
}
|
||||
if (data.type) {
|
||||
whereJson["accountType"] = data.type;
|
||||
}
|
||||
if (data.isCompanyQuote) {
|
||||
whereJson["isCompanyQuote"] = 1;
|
||||
}
|
||||
if (data.isProductQuote) {
|
||||
whereJson["isProductQuote"] = 1;
|
||||
}
|
||||
if (data.isCostQuote) {
|
||||
whereJson["isCostQuote"] = 1;
|
||||
}
|
||||
|
||||
if (data.formData) {
|
||||
if (data.formData.address && data.formData.address.province) {
|
||||
whereJson["company.addressRegion.province.code"] = data.formData.address.province.code
|
||||
}
|
||||
if (data.formData.type) whereJson["accountType"] = data.formData.type;
|
||||
if (data.formData.isSignOnly) whereJson["isSignOnly"] = true;
|
||||
if (data.formData.onlyNotaryUnionPayProfile) {
|
||||
whereJson["notaryUnionPayProfile.status"] = _.in([0, 1, 2]);
|
||||
}
|
||||
if (data.formData.hasOwnProperty('profileStatus') && data.formData.profileStatus !== '' && data.formData.profileStatus !== null && data.formData.profileStatus !== undefined) {
|
||||
if (parseInt(data.formData.profileStatus) === -1) {
|
||||
whereJson["notaryUnionPayProfile.status"] = _.exists(false);
|
||||
} else {
|
||||
whereJson["notaryUnionPayProfile.status"] = parseInt(data.formData.profileStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('whereJson', whereJson)
|
||||
let dbName = "uni-id-users";
|
||||
res = await vk.baseDao.getTableData({
|
||||
dbName,
|
||||
data,
|
||||
whereJson,
|
||||
sortArr: [{"name": "register_date", "type": "desc"}],
|
||||
// 副表列表
|
||||
foreignDB: [
|
||||
{
|
||||
dbName: "opendb-app-list",
|
||||
localKey: "dcloud_appid",
|
||||
foreignKey: "appid",
|
||||
localKeyType: "array",
|
||||
as: "appList",
|
||||
limit: 500
|
||||
},
|
||||
{
|
||||
dbName: "uni-id-users",
|
||||
localKey: "inviter_uid",
|
||||
foreignKey: "_id",
|
||||
localKeyType: "array",
|
||||
as: "parent",
|
||||
limit: 1
|
||||
}
|
||||
],
|
||||
});
|
||||
const toNum = (value, defaultValue = 0) => {
|
||||
const num = Number(value);
|
||||
return Number.isNaN(num) ? defaultValue : num;
|
||||
};
|
||||
if (res.rows && res.rows.length > 0) {
|
||||
const userIds = res.rows.map(item => item._id).filter(Boolean);
|
||||
const qybStatMap = {};
|
||||
userIds.forEach(userId => {
|
||||
qybStatMap[userId] = {
|
||||
qybBuyNum: 0,
|
||||
qybUsedNum: 0,
|
||||
qybPackageGiftNum: 0,
|
||||
qybTotalGetNum: 0
|
||||
};
|
||||
});
|
||||
|
||||
if (userIds.length > 0) {
|
||||
const payRes = await vk.baseDao.select({
|
||||
dbName: "jjx-sign-pay_list",
|
||||
pageSize: 5000,
|
||||
whereJson: {
|
||||
userId: _.in(userIds)
|
||||
}
|
||||
});
|
||||
(payRes.rows || []).forEach(item => {
|
||||
if (item.userId && qybStatMap[item.userId]) qybStatMap[item.userId].qybUsedNum += 1;
|
||||
});
|
||||
|
||||
const orderRes = await vk.baseDao.select({
|
||||
dbName: "jjx-order",
|
||||
pageSize: 5000,
|
||||
whereJson: {
|
||||
uid: _.in(userIds),
|
||||
type: 13,
|
||||
orderStatus: 4
|
||||
}
|
||||
});
|
||||
const orderUserMap = {};
|
||||
const orderIds = [];
|
||||
(orderRes.rows || []).forEach(item => {
|
||||
if (item._id && item.uid && qybStatMap[item.uid]) {
|
||||
orderUserMap[item._id] = item.uid;
|
||||
orderIds.push(item._id);
|
||||
}
|
||||
});
|
||||
|
||||
if (orderIds.length > 0) {
|
||||
const goodsRes = await vk.baseDao.select({
|
||||
dbName: "jjx-order-goods",
|
||||
pageSize: 5000,
|
||||
whereJson: {
|
||||
orderId: _.in(orderIds)
|
||||
}
|
||||
});
|
||||
const goodsRows = goodsRes.rows || [];
|
||||
const qybIds = [...new Set(goodsRows.map(item => item.goodsId).filter(Boolean))];
|
||||
const qybMap = {};
|
||||
if (qybIds.length > 0) {
|
||||
const qybRes = await vk.baseDao.select({
|
||||
dbName: "jjx-qyb",
|
||||
pageSize: 5000,
|
||||
whereJson: {
|
||||
_id: _.in(qybIds)
|
||||
}
|
||||
});
|
||||
(qybRes.rows || []).forEach(item => {
|
||||
qybMap[item._id] = item;
|
||||
});
|
||||
}
|
||||
|
||||
goodsRows.forEach(item => {
|
||||
const userId = orderUserMap[item.orderId];
|
||||
if (userId && qybStatMap[userId]) {
|
||||
const buyNum = Math.max(toNum(item.num, 1), 1);
|
||||
const qyb = qybMap[item.goodsId];
|
||||
const getNum = qyb ? toNum(qyb.getNum, 1) : 1;
|
||||
qybStatMap[userId].qybBuyNum += buyNum;
|
||||
qybStatMap[userId].qybTotalGetNum += getNum * buyNum;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Object.keys(qybStatMap).forEach(userId => {
|
||||
qybStatMap[userId].qybPackageGiftNum = Math.max(qybStatMap[userId].qybTotalGetNum - qybStatMap[userId].qybBuyNum, 0);
|
||||
});
|
||||
res.rows.forEach(item => {
|
||||
const qybStat = qybStatMap[item._id] || {};
|
||||
const adminGiftNum = toNum(item.qybTotalGiftNum, 0);
|
||||
// 用户表上的 qybGiftNum 为后台赠送累加值;套餐优惠政策赠送从订单统计
|
||||
const storedGiftNum = toNum(item.qybGiftNum, 0);
|
||||
item.qybBuyNum = qybStat.qybBuyNum || 0;
|
||||
item.qybUsedNum = qybStat.qybUsedNum || 0;
|
||||
item.qybNum = toNum(item.qybNum, 0);
|
||||
item.qybGiftNum = (qybStat.qybPackageGiftNum || 0) + storedGiftNum;
|
||||
item.qybTotalGiftNum = adminGiftNum || storedGiftNum;
|
||||
});
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < res.rows.length; i++) {
|
||||
if (res.rows[i].isNotaryBusiness === undefined || res.rows[i].isNotaryBusiness === null) {
|
||||
res.rows[i].isNotaryBusiness = res.rows[i].notaryUnionPayProfile && res.rows[i].notaryUnionPayProfile.status === 1 ? 1 : 0
|
||||
}
|
||||
res.rows[i].profileStatus = res.rows[i].notaryUnionPayProfile ? res.rows[i].notaryUnionPayProfile.status : -1
|
||||
if (res.rows[i].accountType === 1) {
|
||||
if (res.rows[i].person && res.rows[i].person.mainSpotCategoryIds && res.rows[i].person.mainSpotCategoryIds.length > 0) {
|
||||
const goodsRes = await vk.baseDao.select({
|
||||
dbName: "jjx-spot-category",
|
||||
whereJson: {
|
||||
_id: _.in(res.rows[i].person.mainSpotCategoryIds)
|
||||
}
|
||||
});
|
||||
console.log('goodsRes', goodsRes)
|
||||
if (goodsRes.rows && goodsRes.rows.length > 0) {
|
||||
res.rows[i].person.mainSpotCategoryNames = goodsRes.rows.map(item => item.name).join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (res.rows[i].accountType === 2) {
|
||||
if (res.rows[i].company && res.rows[i].company.mainSpotCategoryIds && res.rows[i].company.mainSpotCategoryIds.length > 0) {
|
||||
const goodsRes = await vk.baseDao.select({
|
||||
dbName: "jjx-spot-category",
|
||||
whereJson: {
|
||||
_id: _.in(res.rows[i].company.mainSpotCategoryIds)
|
||||
}
|
||||
});
|
||||
console.log('goodsRes', goodsRes)
|
||||
if (goodsRes.rows && goodsRes.rows.length > 0) {
|
||||
res.rows[i].company.mainSpotCategoryNames = goodsRes.rows.map(item => item.name).join(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 业务逻辑结束-----------------------------------------------------------
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
/**
|
||||
* 后台赠送签约宝次数
|
||||
* @url admin/system/user/sys/giftQybNum
|
||||
* @param {String} user_id 用户ID
|
||||
* @param {Number} giftNum 赠送次数
|
||||
*/
|
||||
main: async (event) => {
|
||||
let { data = {}, util } = event;
|
||||
let { vk, _ } = util;
|
||||
let res = { code: 0, msg: '' };
|
||||
|
||||
const { user_id, giftNum } = data;
|
||||
const num = Number(giftNum);
|
||||
|
||||
if (!user_id) {
|
||||
return { code: -1, msg: '用户ID不能为空' };
|
||||
}
|
||||
if (!Number.isInteger(num) || num <= 0) {
|
||||
return { code: -1, msg: '赠送次数必须为正整数' };
|
||||
}
|
||||
|
||||
const user = await vk.baseDao.findById({
|
||||
dbName: 'uni-id-users',
|
||||
id: user_id
|
||||
});
|
||||
if (!user) {
|
||||
return { code: -1, msg: '用户不存在' };
|
||||
}
|
||||
|
||||
// 剩余签约次数、优惠政策赠送次数、累计赠送次数同步累加
|
||||
await vk.baseDao.updateById({
|
||||
dbName: 'uni-id-users',
|
||||
id: user_id,
|
||||
dataJson: {
|
||||
qybNum: _.inc(num),
|
||||
qybGiftNum: _.inc(num),
|
||||
qybTotalGiftNum: _.inc(num)
|
||||
}
|
||||
});
|
||||
|
||||
res.msg = '赠送成功';
|
||||
return res;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user