feat: 签约宝用户赠送次数,平台用户列表展示签约次数统计

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-27 03:28:33 +08:00
parent a6e80328f1
commit 0e2c0ac190
4 changed files with 334 additions and 56 deletions
+56
View File
@@ -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;
}
});
}
},
// 监听属性