Commit b6b36fd7 by wangzhihui

```

feat(api): 增加积分调整相关API接口

- 添加手动积分增加、减少功能
- 新增验证码获取、管理员查询等接口
- 增加手机号变更及操作记录查询功能
- 添加批量导入功能

refactor(components): 重构对话框组件代码格式

- 更新relateProDialog.vue和glsk-form-dialog/index.vue的代码风格
- 统一代码缩进和格式规范
- 优化组件结构和属性排序

style(api): 格式化point.js文件注释和语句结尾

- 修复注释中缺少空格的问题
- 统一所有函数调用的语句结尾格式
- 规范代码格式以提高可读性
```
1 parent 131bc7f6
import request from "./request"
import request from "./request";
// const path = 'dj.api.'
const path2 = "dj.api.smartcarlife."
const path2 = "dj.api.smartcarlife.";
/** 积分管理-积分审批列表*/
/** 积分管理-积分审批列表 */
export function getList(data) {
data.method = `${path2}staff.motivation.page`
return request(data)
data.method = `${path2}staff.motivation.page`;
return request(data);
}
/** 积分管理-积分审批*/
/** 积分管理-积分审批 */
export function pointCheck(data) {
data.method = `${path2}staff.motivation.audit`
return request(data)
data.method = `${path2}staff.motivation.audit`;
return request(data);
}
/**积分管理-积分审批列表导出*/
/** 积分管理-积分审批列表导出 */
export function exportFile(data) {
data.method = `${path2}staff.motivation.list.export`
return request(data)
data.method = `${path2}staff.motivation.list.export`;
return request(data);
}
/**积分管理-积分审批详情*/
/** 积分管理-积分审批详情 */
export function getPointDetail(data) {
data.method = `${path2}staff.motivation.detail`
return request(data)
data.method = `${path2}staff.motivation.detail`;
return request(data);
}
/**积分管理-积分明细列表*/
/** 积分管理-积分明细列表 */
export function getScorePage(data) {
data.method = `${path2}staff.score.page`
return request(data)
data.method = `${path2}staff.score.page`;
return request(data);
}
/**积分管理-积分明细列表导出*/
/** 积分管理-积分明细列表导出 */
export function exportScore(data) {
data.method = `${path2}staff.score.export`
return request(data)
data.method = `${path2}staff.score.export`;
return request(data);
}
// 积分管理-积分明细收益列表
export function getDetailList(data) {
data.method = `${path2}staff.score.detail.list`
return request(data)
data.method = `${path2}staff.score.detail.list`;
return request(data);
}
// 积分管理-积分明细收益列表导出
export function exportDetailScore(data) {
data.method = `${path2}staff.score.detail.list.export`
return request(data)
data.method = `${path2}staff.score.detail.list.export`;
return request(data);
}
// 积分管理-积分明细收益记录详情
export function getScoreDetail(data) {
data.method = `${path2}staff.score.detail`
return request(data)
data.method = `${path2}staff.score.detail`;
return request(data);
}
export function getShopMerchantList(data) {
data.method = `dj.smartcarlife.api.shopMerchant.list`
return request(data, "post")
data.method = `dj.smartcarlife.api.shopMerchant.list`;
return request(data, "post");
}
//订单阳光激励标记退款
// 订单阳光激励标记退款
export function markAsRefunded(data) {
data.method = `dj.api.smartcarlife.goodsOrder.points.markAsRefunded`
return request(data)
data.method = `dj.api.smartcarlife.goodsOrder.points.markAsRefunded`;
return request(data);
}
//积分管理-手动抵扣
// 积分管理-手动抵扣
export function manualDeduct(data) {
data.method = `dj.api.smartcarlife.staff.score.manual.deduct`
return request(data)
data.method = `dj.api.smartcarlife.staff.score.manual.deduct`;
return request(data);
}
// 查询可手动抵扣的订单列表
export function deductOrderPage(data) {
data.method = `dj.api.smartcarlife.merchant.score.deduct.order.page`
return request(data)
data.method = `dj.api.smartcarlife.merchant.score.deduct.order.page`;
return request(data);
}
// 积分管理-撤销抵扣【参数:scoreId(必传)、remark、orderCode】
export function cancelDeduct(data) {
data.method = `dj.api.smartcarlife.staff.score.cancel.deduct`
return request(data)
data.method = `dj.api.smartcarlife.staff.score.cancel.deduct`;
return request(data);
}
// 积分审批列表同步
export function refreshData(data) {
data.method = `dj.api.smartcarlife.staff.motivation.page.sync`
return request(data)
data.method = `dj.api.smartcarlife.staff.motivation.page.sync`;
return request(data);
}
//查询指定订单的操作记录
// 查询指定订单的操作记录
export function getOperationRecord(data) {
data.method = `dj.api.smartcarlife.staff.motivation.order.operation`
return request(data)
data.method = `dj.api.smartcarlife.staff.motivation.order.operation`;
return request(data);
}
//根据订单号查询剩余积分
// 根据订单号查询剩余积分
// export function getScoreByscore(data) {
// data.method = `dj.api.smartcarlife.staff.motivation.order.score`
// return request(data)
// }
//获取到总积分
// 获取到总积分
export function getOrderByScore(data) {
data.method = `dj.api.smartcarlife.staff.motivation.order.score`
return request(data)
data.method = `dj.api.smartcarlife.staff.motivation.order.score`;
return request(data);
}
/** 积分退款订单详情查询 */
export function getGoodsSubOrder(data) {
data.method = 'dj.api.smartcarlife.goodsOrder.goodsSubOrder.list'
return request(data)
}
\ No newline at end of file
data.method = "dj.api.smartcarlife.goodsOrder.goodsSubOrder.list";
return request(data);
}
/** 积分调整 -积分增加 */
export function manualAdd(data) {
data.method = "dj.api.smartcarlife.staff.score.manual.add";
return request(data);
}
/** 积分调整-积分减少 */
export function manualSubtract(data) {
data.method = "dj.api.smartcarlife.staff.score.manual.subtract";
return request(data);
}
/** 验证码 */
export function getSms(data) {
data.method = "dj.api.smartcarlife.staff.score.admin.sms";
return request(data);
}
/* 获取管理员 */
export function getAdmin(data = {}) {
data.method = "dj.api.smartcarlife.staff.score.getAdmin";
return request(data);
}
/** 变更手机号 */
export function changePhone(data) {
data.method = "dj.api.smartcarlife.staff.score.change.phone";
return request(data);
}
/** 积分审批 */
export function motivationAudit(data) {
data.method = "dj.api.smartcarlife.staff.motivation.audit";
return request(data);
}
/** 更改手机号操作记录 */
export function changePhoneRecord(data = {}) {
data.method = "dj.api.smartcarlife.staff.score.change.phone.list";
return request(data);
}
// 批量导入
export function governingImport(data) {
data.method = `dj.api.smartcarlife.staff.score.manual.import`;
return request(data, "post", ["file"]);
}
<!-- 通用表单弹窗组件 -->
<template>
<div class="glsk-form-dialog">
<d2-dialog
:title="dialogConfig.title"
:is-visible="selectVisible"
:width="dialogWidth"
:btn-ok-label="dialogConfig.okText"
@closeDialog="handleClose"
:appendToBody="appendToBody"
@confirmDialog="handleConfirm"
>
<glsx-combi-form
class="edit-form-container"
ref="editFormRef"
:label-width="labelWidth"
:default-width="defaultWidth"
:is-block="isBlock"
:form-ref="editChildRef"
:form-obj="editData"
:form-data="editFormData"
:form-rules="formRules"
@handleAddSelectTypeConfirm="handleAddSelectTypeConfirm"
@handleEditSelectTypeConfirm="handleEditSelectTypeConfirm"
>
<template v-for="name in slotArr" #[name]>
<slot :name="name"></slot>
</template>
</glsx-combi-form>
</d2-dialog>
</div>
<div class="glsk-form-dialog">
<d2-dialog :append-to-body="appendToBody"
:btn-ok-label="dialogConfig.okText"
:is-visible="selectVisible"
:title="dialogConfig.title"
:width="dialogWidth"
@closeDialog="handleClose"
@confirmDialog="handleConfirm">
<glsx-combi-form ref="editFormRef"
class="edit-form-container"
:default-width="defaultWidth"
:form-data="editFormData"
:form-obj="editData"
:form-ref="editChildRef"
:form-rules="formRules"
:is-block="isBlock"
:label-width="labelWidth"
@handleAddSelectTypeConfirm="handleAddSelectTypeConfirm"
@handleEditSelectTypeConfirm="handleEditSelectTypeConfirm">
<template v-for="name in slotArr" #[name]>
<slot :name="name"></slot>
</template>
</glsx-combi-form>
</d2-dialog>
</div>
</template>
<script>
import { deepClone } from "@/common/util"
import { deepClone } from "@/common/util";
export default {
name: "GlskFormDialog",
data() {
return {
isBlock: true,
editChildRef: "editChildRef"
}
},
name: "GlskFormDialog",
props: {
slotArr: {
type: Array,
default: () => ["resumeUrlHtml"]
},
dialogWidth: {
type: String,
default: "700px"
},
labelWidth: {
type: String,
default: "100px"
},
defaultWidth: {
type: String,
default: "314px"
},
dialogConfig: {
type: Object,
default: () => {
return {
title: "提示",
okText: "确定"
}
}
},
selectVisible: {
type: Boolean,
default: false
},
formRules: {
type: Object,
default: () => ({})
},
editData: {
type: Object,
default: () => ({})
},
editFormData: {
type: Array,
default: () => []
},
baseData: {
type: Object,
default: () => ({})
},
appendToBody: {
type: Boolean,
default: false
}
},
props: {
slotArr: {
type: Array,
default: () => ["resumeUrlHtml"],
},
dialogWidth: {
type: String,
default: "700px",
},
labelWidth: {
type: String,
default: "100px",
},
defaultWidth: {
type: String,
default: "314px",
},
dialogConfig: {
type: Object,
default: () => {
return {
title: "提示",
okText: "确定",
};
},
},
selectVisible: {
type: Boolean,
default: false,
},
formRules: {
type: Object,
default: () => ({}),
},
editData: {
type: Object,
default: () => ({}),
},
editFormData: {
type: Array,
default: () => [],
},
baseData: {
type: Object,
default: () => ({}),
},
appendToBody: {
type: Boolean,
default: false,
},
},
data() {
return {
isBlock: true,
editChildRef: "editChildRef",
};
},
mounted() {
this.getOptionsList("editFormData", false)
},
mounted() {
this.getOptionsList("editFormData", false);
},
methods: {
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find((k) => k.name == refreshSigle)
var index = this[formName].findIndex((k) => k.name == refreshSigle)
this.$set(
this[formName][index],
"optionList",
deepClone(this.baseData[item.optionsName])
)
if (
hasAll &&
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this[formName][index].optionLabel
] !== "全部"
) {
const temp = {}
temp[this[formName][index].optionId] = ""
temp[this[formName][index].optionLabel] = "全部"
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (
["select", "radio"].includes(item.type) &&
this.baseData[item.optionsName].length
) {
this.$set(
this[formName][index],
"optionList",
deepClone(this.baseData[item.optionsName])
)
if (
hasAll &&
this.baseData[item.optionsName].length &&
this.baseData[item.optionsName][0][
this[formName][index].optionLabel
] !== "全部"
) {
const temp = {}
temp[this[formName][index].optionId] = ""
temp[this[formName][index].optionLabel] = "全部"
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
handleConfirm() {
console.log(this.editFormData, this.editData)
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid) => {
if (valid) {
this.$emit("handleConfirm", this.editData)
}
})
},
handleAddSelectTypeConfirm(data) {
this.$emit("handleAddSelectTypeConfirm", data)
},
handleEditSelectTypeConfirm(data) {
this.$emit("handleEditSelectTypeConfirm", data)
},
handleClose() {
this.$emit("handleClose")
}
}
}
methods: {
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
let item = this[formName].find(k => k.name == refreshSigle);
let index = this[formName].findIndex(k => k.name == refreshSigle);
this.$set(
this[formName][index],
"optionList",
deepClone(this.baseData[item.optionsName]),
);
if (
hasAll
&& this.baseData[item.optionsName].length
&& this.baseData[item.optionsName][0][
this[formName][index].optionLabel
] !== "全部"
) {
const temp = {};
temp[this[formName][index].optionId] = "";
temp[this[formName][index].optionLabel] = "全部";
this[formName][index].optionList.unshift(temp);
}
} else {
this[formName].forEach((item, index) => {
if (
["select", "radio"].includes(item.type)
&& this.baseData[item.optionsName].length
) {
this.$set(
this[formName][index],
"optionList",
deepClone(this.baseData[item.optionsName]),
);
if (
hasAll
&& this.baseData[item.optionsName].length
&& this.baseData[item.optionsName][0][
this[formName][index].optionLabel
] !== "全部"
) {
const temp = {};
temp[this[formName][index].optionId] = "";
temp[this[formName][index].optionLabel] = "全部";
this[formName][index].optionList.unshift(temp);
}
}
});
}
},
handleConfirm() {
console.log(this.editFormData, this.editData);
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid) => {
if (valid) {
this.$emit("handleConfirm", this.editData);
}
});
},
handleAddSelectTypeConfirm(data) {
this.$emit("handleAddSelectTypeConfirm", data);
},
handleEditSelectTypeConfirm(data) {
this.$emit("handleEditSelectTypeConfirm", data);
},
handleClose() {
this.$emit("handleClose");
},
},
};
</script>
<style lang="scss" scoped>
.glsk-form-dialog {
::v-deep {
.el-dialog__header {
border-bottom: 1px solid #e5e5e5 !important;
}
}
::v-deep {
.el-dialog__footer {
border-top: 1px solid #e5e5e5 !important;
.el-button {
width: 80px;
}
}
}
::v-deep {
.el-dialog__header {
border-bottom: 1px solid #e5e5e5 !important;
}
}
::v-deep {
.el-dialog__footer {
border-top: 1px solid #e5e5e5 !important;
.el-button {
width: 80px;
}
}
}
}
</style>
const _import = require("@/libs/util.import." + process.env.NODE_ENV)
const _import = require("@/libs/util.import." + process.env.NODE_ENV);
export const routerName = {
914: {
path: "/pointManagement",
name: "pointManagement",
meta: {
title: "积分管理",
authId: "914",
parentId: "1",
cache: false
}
},
91401: {
path: "/pointExamine",
name: "pointExamine",
meta: {
title: "积分审批",
authId: "91401",
parentId: "914",
cache: false
},
auth: [
{
authId: "9140101",
parentId: "91401",
label: "审核",
handle: "handleCheck"
},
{
authId: "9140104",
parentId: "91401",
label: "标记退款",
handle: "openRefundDetail"
},
{
authId: "9140102",
parentId: "91401",
label: "查看",
handle: "handleDetail"
},
{
authId: "9140103",
parentId: "91401",
label: "导出",
category: "Button",
type: "primary",
handle: "handleExport"
},
{
authId: "9140105",
parentId: "91401",
label: "刷新",
category: "Button",
type: "primary",
handle: "handleRefresh"
}
],
component: _import("pointManagement/pointExamine")
},
91402: {
path: "/pointParticulars",
name: "pointParticulars",
meta: {
title: "积分明细",
authId: "91402",
parentId: "914",
cache: false
},
auth: [
{
authId: "9140201",
parentId: "91402",
label: "明细",
handle: "handleDetail",
addRoutePath: [
{
authId: "91403",
name: "详情",
parentId: "91402"
}
]
},
914: {
path: "/pointManagement",
name: "pointManagement",
meta: {
title: "积分管理",
authId: "914",
parentId: "1",
cache: false,
},
},
91401: {
path: "/pointExamine",
name: "pointExamine",
meta: {
title: "积分审批",
authId: "91401",
parentId: "914",
cache: false,
},
auth: [
{
authId: "9140101",
parentId: "91401",
label: "审核",
handle: "handleCheck",
},
{
authId: "9140104",
parentId: "91401",
label: "标记退款",
handle: "openRefundDetail",
},
{
authId: "9140102",
parentId: "91401",
label: "查看",
handle: "handleDetail",
},
{
authId: "9140103",
parentId: "91401",
label: "导出",
category: "Button",
handle: "handleExport",
},
{
authId: "9140105",
parentId: "91401",
label: "刷新",
category: "Button",
handle: "handleRefresh",
},
{
authId: "9140106",
parentId: "91401",
label: "一键审批",
category: "Button",
type: "primary",
handle: "handleApproveAll",
},
{
authId: "9140107",
parentId: "91401",
label: "审批",
handle: "handleApproveAll",
},
],
component: _import("pointManagement/pointExamine"),
},
91402: {
path: "/pointParticulars",
name: "pointParticulars",
meta: {
title: "积分明细",
authId: "91402",
parentId: "914",
cache: false,
},
auth: [
{
authId: "9140201",
parentId: "91402",
label: "明细",
handle: "handleDetail",
addRoutePath: [
{
authId: "91403",
name: "详情",
parentId: "91402",
},
],
},
{
authId: "9140205",
parentId: "91402",
label: "更换手机号",
handle: "handleChangePhone",
},
{
authId: "9140202",
parentId: "91402",
label: "导出",
category: "Button",
type: "primary",
handle: "handleExport"
},
{
authId: "9140203",
parentId: "91402",
label: "新增",
handle: "handleDetail",
addRoutePath: [
{
authId: "91404",
name: "新增手动抵扣",
parentId: "91402"
}
]
}
],
component: _import("pointManagement/pointParticulars")
},
91403: {
path: "/pointDetail",
name: "pointDetail",
meta: {
title: "详情",
authId: "91403",
parentId: "91402",
cache: false,
activePath: "/pointParticulars"
},
component: _import("pointManagement/pointDetail")
},
//新增抵扣
91404: {
path: "/deduction",
name: "deduction",
meta: {
title: "新增抵扣",
authId: "91403",
parentId: "91402",
cache: false,
activePath: "/pointParticulars"
},
component: _import("pointManagement/addDeduction")
}
}
{
authId: "9140202",
parentId: "91402",
label: "导出",
category: "Button",
handle: "handleExport",
},
{
authId: "9140204",
parentId: "91402",
label: "批量积分调整",
category: "Button",
type: "primary",
handle: "handleGoverning",
},
{
authId: "9140203",
parentId: "91402",
label: "新增",
handle: "handleDetail",
addRoutePath: [
{
authId: "91404",
name: "新增手动抵扣",
parentId: "91402",
},
],
},
],
component: _import("pointManagement/pointParticulars"),
},
91403: {
path: "/pointDetail",
name: "pointDetail",
meta: {
title: "详情",
authId: "91403",
parentId: "91402",
cache: false,
activePath: "/pointParticulars",
},
component: _import("pointManagement/pointDetail"),
},
// 新增抵扣
91404: {
path: "/deduction",
name: "deduction",
meta: {
title: "新增抵扣",
authId: "91403",
parentId: "91402",
cache: false,
activePath: "/pointParticulars",
},
component: _import("pointManagement/addDeduction"),
},
};
<!-- 积分调整 -->
<template>
<d2-dialog btn-ok-label="提交审核"
class="adjustDialog"
:is-visible.sync="visible"
title="积分调整"
width="640px"
@closeDialog="handleClose"
@confirmDialog="handleConfirm">
<div class="tip-text">
提交审核通过后,积分将自动更新
</div>
<glsx-combi-form ref="editFormRef"
class="edit-form-container"
:default-width="defaultWidth"
:form-data="editFormData"
:form-obj="editData"
:form-ref="editChildRef"
:form-rules="formRules"
:is-block="isBlock"
:label-width="labelWidth">
<template #scoreHtml>
<div class="scroe-wrap">
<el-input v-model="editData.score"
placeholder="请输入"
:prefix-icon="prefixIcon"
style="width: 136px;">
</el-input>
</div>
</template>
<template #captcha>
<div class="captcha-wrap">
<el-input v-model="editData.captcha"
placeholder="请输入"
style="width: 338px;">
</el-input>
<div class="captcha-text" @click.prevent="getCode">
{{ !isCodeDisabled ? '获取验证码' : `${count}s` }}
</div>
</div>
</template>
</glsx-combi-form>
</d2-dialog>
</template>
<script>
// import { limitPrice } from "@/common/format";
import { getAdmin, getSms, manualAdd, manualSubtract } from "@/api/point";
import { deepClone, Util } from "@/common/util";
export default {
name: "AdjustDialog",
props: {
visible: {
type: Boolean,
default: false,
},
infoData: {
type: Object,
default: () => {},
},
},
data() {
return {
prefixIcon: "el-icon-plus",
labelWidth: "110px",
editChildRef: "editChildRef",
isBlock: true,
defaultWidth: "338px",
isCodeDisabled: false,
count: "",
timer: null,
editData: {
type: 1,
score: "",
captcha: "",
phone: "",
orderCode: "",
admin: "",
},
editFormData: [
{
label: "积分变更",
name: "type",
type: "radio",
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "pointChangeOpt",
handleRadioChange: (val) => {
this.prefixIcon = val === 1 ? "el-icon-plus" : "el-icon-minus";
},
},
{
label: "",
name: "score",
addHtml: "scoreHtml",
style: {
marginLeft: "110px",
},
},
{
label: "关联订单编号",
name: "orderCode",
type: "input",
maxlength: "20",
placeholder: "请输入",
isClear: true,
},
{
label: "管理员",
name: "admin",
type: "select",
optionsName: "adminList",
optionId: "adminId",
optionLabel: "adminName",
changeAttr: (val) => {
this.editData.phone = val;
this.isCodeDisabled = false;
clearInterval(this.timer);
this.timer = null;
this.editData.captcha = "";
},
},
{
label: "验证码",
addHtml: "captcha",
name: "captcha",
},
{
label: "备注",
name: "remark",
type: "input",
inputType: "textarea",
maxlength: "200",
width: "436px",
rows: 4,
showLimit: true,
},
],
formRules: {
orderCode: [{ required: true, message: "请输入关联订单编号", trigger: "blur" }],
score: [
{ required: true, message: "请输入积分", trigger: "blur" },
{
validator(rule, value, callback) {
if (value === "" || value === null || value === undefined) {
callback(new Error("请输入积分"));
return;
}
const str = String(value).trim();
// 仅允许:0 或非0开头的整数,且可选最多两位小数
const pattern = /^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/;
if (!pattern.test(str)) {
callback(new Error("积分必须为非负数,最多保留两位小数"));
return;
}
const num = Number(str);
if (!isFinite(num) || num < 0) {
callback(new Error("积分必须为非负数"));
return;
}
callback();
},
trigger: ["blur", "change"],
},
],
captcha: [{ required: true, message: "请输入验证码", trigger: "blur" }, {
validator(rule, value, callback) {
const str = String(value || "").trim();
if (str === "") {
// 空值交给 required 规则处理
callback();
return;
}
if (!/^\d+$/.test(str)) {
callback(new Error("验证码只能输入数字"));
return;
}
callback();
},
trigger: ["blur", "change"],
}],
admin: [{ required: true, message: "请选择管理员", trigger: "change" }],
remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
},
baseData: {
pointChangeOpt: [
{
confId: 1,
confValue: "积分增加",
},
{
confId: 2,
confValue: "积分减少",
},
],
},
};
},
created() {
this.getAdminData();
},
methods: {
getAdminData() {
getAdmin().then((res) => {
if (res) {
this.baseData.adminList = res.map((item) => {
return {
adminId: `${item.phone}`,
adminName: `${item.name} ${item.phone}`,
name: item.name,
phone: item.phone,
};
});
this.getOptionsList(this, "editFormData", false);
if (this.baseData.adminList.length == 0) {
this.editData.admin = "";
this.editData.phone = "";
} else {
this.editData.admin = this.baseData.adminList[0].adminId;
this.editData.phone = this.baseData.adminList[0].phone;
}
}
});
},
getCode() {
if (!this.editData.phone) {
this.$message.error("请选择管理员");
return;
}
if (this.isCodeDisabled)
return;
if (!this.timer) {
this.count = 60;
getSms({
phone: this.editData.phone,
})
.then((res) => {
console.log(res, "res");
if (res) {
this.$message.success("短信验证码发送成功");
this.isCodeDisabled = true;
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= 60) {
this.count--;
} else {
this.isCodeDisabled = false;
clearInterval(this.timer);
this.timer = null;
}
}, 1000);
} else {
this.$message.error(res.message);
}
});
}
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid1) => {
console.log(valid1);
if (valid1) {
let Methods = this.editData.type === 1 ? manualAdd : manualSubtract;
let params = {
phone: this.editData.phone,
score: this.editData.score,
orderCode: this.editData.orderCode,
remark: this.editData.remark,
captcha: this.editData.captcha,
merchantId: this.infoData.merchantId,
staffPhone: this.infoData.staffPhone,
};
Methods(params).then((res) => {
if (res) {
this.$message.success("积分调整成功");
this.$emit("handleConfirm");
}
});
}
});
},
handleClose() {
this.$emit("handleClose");
},
getOptionsList(that, formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
let item = that[formName].find(k => k.name == refreshSigle);
let index = that[formName].findIndex(k => k.name == refreshSigle);
that.$set(
that[formName][index],
"optionList",
deepClone(that.baseData[item.optionsName]),
);
if (
hasAll
&& that.baseData[item.optionsName].length
&& that.baseData[item.optionsName][0][
that[formName][index].optionLabel
] !== "全部"
) {
const temp = {};
temp[that[formName][index].optionId] = "";
temp[that[formName][index].optionLabel] = "全部";
that[formName][index].optionList.unshift(temp);
}
} else {
that[formName].forEach((item, index) => {
if (
that.baseData[item.optionsName]?.length
) {
that.$set(
that[formName][index],
"optionList",
deepClone(that.baseData[item.optionsName]),
);
if (
hasAll
&& that.baseData[item.optionsName].length
&& that.baseData[item.optionsName][0][
that[formName][index].optionLabel
] !== "全部"
) {
const temp = {};
temp[that[formName][index].optionId] = "";
temp[that[formName][index].optionLabel] = "全部";
that[formName][index].optionList.unshift(temp);
}
}
});
}
},
},
};
</script>
<style scoped lang="scss">
.adjustDialog {
::v-deep {
.el-dialog__header {
border-bottom: 1px solid #e5e5e5;
}
.el-dialog__footer {
border-top: 1px solid #e5e5e5;
}
.el-input__count {
right: 12px;
bottom: 1px;
}
}
}
.tip-text {
border-radius: 4px;
background: #f7f7f7;
color: #333333;
font-size: 14px;
padding: 8px 0;
text-align: center;
margin-bottom: 26px;
margin-top: -10px;
}
.captcha-wrap {
.captcha-text {
font-size: 12px;
color: #2a58ad;
position: absolute;
right: 0;
top: 2px;
margin-right: 10px;
cursor: pointer;
width: 100px;
height: 32px;
text-align: right;
}
}
</style>
<!-- 批量积分调整审批 -->
<template>
<d2-dialog btn-ok-label="提交审核"
class="adjustDialog"
:is-visible.sync="visible"
:title="dataInfo && dataInfo.id ? '积分调整审批' : '批量积分调整审批'"
width="640px"
@closeDialog="handleClose"
@confirmDialog="handleConfirm">
<div class="tip-text">
审批通过后,将更新对应人员积分了;<br />
审核驳回后,不更新对应人员积分,需要新提交审核
</div>
<glsx-combi-form ref="editFormRef"
class="edit-form-container"
:default-width="defaultWidth"
:form-data="editFormData"
:form-obj="editData"
:form-ref="editChildRef"
:form-rules="formRules"
:is-block="isBlock"
:label-width="labelWidth">
</glsx-combi-form>
</d2-dialog>
</template>
<script>
import { motivationAudit } from "@/api/point";
import { deepClone } from "@/common/util";
export default {
name: "AdjustDialog",
props: {
visible: {
type: Boolean,
default: false,
},
dataInfo: {
type: Object,
default: () => {},
},
},
data() {
return {
title: "",
labelWidth: "110px",
editChildRef: "editChildRef",
isBlock: true,
defaultWidth: "338px",
isCodeDisabled: false,
count: "",
timer: null,
editData: {
auditResult: 0,
operatorRemark: "",
},
editFormData: [
{
label: "审核结果",
name: "auditResult",
type: "radio",
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "approveOpt",
handleRadioChange: (val) => {
},
},
{
label: "备注",
name: "operatorRemark",
type: "input",
inputType: "textarea",
maxlength: "200",
width: "436px",
rows: 4,
showLimit: true,
},
],
formRules: {
auditResult: [{ required: true, message: "请选择审核结果", trigger: "change" }],
operatorRemark: [{ required: true, message: "请输入备注", trigger: "blur" }],
},
baseData: {
approveOpt: [
{
confId: 0,
confValue: "审核通过",
},
{
confId: 1,
confValue: "审核驳回",
},
],
},
};
},
mounted() {
this.getOptionsList(this, "editFormData", false);
},
methods: {
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate((valid1) => {
console.log(valid1);
if (valid1) {
let params = {
auditResult: this.editData.auditResult,
operatorRemark: this.editData.operatorRemark,
};
if (this.dataInfo && this.dataInfo.id) {
params.id = this.dataInfo.id;
}
motivationAudit(params).then((res) => {
if (res) {
this.$message.success("操作成功");
this.$emit("handleConfirm");
}
});
}
});
},
handleClose() {
this.$emit("handleClose");
},
getOptionsList(that, formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
let item = that[formName].find(k => k.name == refreshSigle);
let index = that[formName].findIndex(k => k.name == refreshSigle);
that.$set(
that[formName][index],
"optionList",
deepClone(that.baseData[item.optionsName]),
);
if (
hasAll
&& that.baseData[item.optionsName].length
&& that.baseData[item.optionsName][0][
that[formName][index].optionLabel
] !== "全部"
) {
const temp = {};
temp[that[formName][index].optionId] = "";
temp[that[formName][index].optionLabel] = "全部";
that[formName][index].optionList.unshift(temp);
}
} else {
that[formName].forEach((item, index) => {
if (
that.baseData[item.optionsName]?.length
) {
that.$set(
that[formName][index],
"optionList",
deepClone(that.baseData[item.optionsName]),
);
if (
hasAll
&& that.baseData[item.optionsName].length
&& that.baseData[item.optionsName][0][
that[formName][index].optionLabel
] !== "全部"
) {
const temp = {};
temp[that[formName][index].optionId] = "";
temp[that[formName][index].optionLabel] = "全部";
that[formName][index].optionList.unshift(temp);
}
}
});
}
},
},
};
</script>
<style scoped lang="scss">
.adjustDialog {
::v-deep {
.el-dialog__header {
border-bottom: 1px solid #e5e5e5;
}
.el-dialog__footer {
border-top: 1px solid #e5e5e5;
}
.el-input__count {
right: 12px;
bottom: 1px;
}
}
}
.tip-text {
border-radius: 4px;
background: #f7f7f7;
color: #333333;
font-size: 14px;
padding: 8px 0;
text-align: center;
margin-bottom: 26px;
margin-top: -10px;
}
</style>
<template>
<el-dialog title="请选择退款明细" :visible.sync="refundVisible" :before-close="handleClose"
:close-on-click-modal="false" width="70%" class="relateStore">
<div>
<el-table ref="seletingTable" :data="tableData" class="table" border @select="handleChange"
@select-all="handleAll">
<el-table-column :selectable="selectableFn" type="selection" width="55" align="center" />
<template v-for="item in tableColumn">
<el-table-column :prop="item.prop" :label="item.label" align="center">
<span slot-scope="scope">
{{ scope.row[item.prop] ? item.unit ? item.unit + scope.row[item.prop] : scope.row[item.prop] : "-" }}
<el-dialog :before-close="handleClose"
class="relateStore"
:close-on-click-modal="false"
title="请选择退款明细"
:visible.sync="refundVisible"
width="70%">
<div>
<el-table ref="seletingTable"
border
class="table"
:data="tableData"
@select="handleChange"
@select-all="handleAll">
<el-table-column align="center"
:selectable="selectableFn"
type="selection"
width="55" />
<template v-for="item in tableColumn">
<el-table-column align="center"
:label="item.label"
:prop="item.prop">
<template #default="scope">
<span>
{{ scope.row[item.prop] ? item.unit ? item.unit + scope.row[item.prop] : scope.row[item.prop] : "-" }}
</span>
</template>
</el-table-column>
</template>
</el-table>
<div class="total">
可选可退总价:<div class="price">
¥{{ total }}
</div>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button :disabled="!refundSubOrderCode"
type="primary"
@click="handleConfirm">
下一步
</el-button>
</span>
</el-table-column>
</template>
</el-table>
<div class="total">可选可退总价:<div class="price">¥{{ total }}</div></div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="handleConfirm" :disabled="!refundSubOrderCode">下一步</el-button>
</span>
</el-dialog>
</el-dialog>
</template>
<script>
import { getGoodsSubOrder } from "@api/point"
import { getGoodsSubOrder } from "@api/point";
export default {
name: 'refundDetail',
data() {
return {
tableData: [],
tableColumn: [
{
label: '子订单编码',
prop: 'subOrderCode'
},
{
label: '商品名称',
prop: 'goodsName'
},
{
label: '商品别名',
prop: 'goodsAlias'
},
{
label: '商品ID',
prop: 'goodsCommodityCode'
},
{
label: '分类',
prop: 'upgradeGoodsTypeName'
},
{
label: '售价',
prop: 'upgradePrice',
unit: '¥'
},
{
label: '数量/件',
prop: 'number'
},
{
label: '支付金额',
prop: 'totalPrice',
unit: '¥'
}
],
total: 0,
refundSubOrderCode: '',
refundApplyDetailList: [],
isAll: false,
// 是否只有一个子订单并且未退过款的
isOneSubFirst: false
}
},
props: {
refundVisible: {
type: Boolean,
default: false
},
dataInfo: {
type: Object,
default: {}
}
},
watch: {
dataInfo(val) {
console.log(val)
if (val && val.orderCode) this.getList(val.orderCode)
}
},
methods: {
// 设置禁用
selectableFn(row) {
console.log(row)
if (row.status == 2) return false
else return true
},
async getList(orderCode) {
const res = await getGoodsSubOrder({ orderCode })
this.tableData = res
this.isOneSubFirst = this.tableData.length == 1 && this.tableData.every(item => item.status == 1)
this.$refs.seletingTable.toggleAllSelection()
},
handleChange(selection) {
console.log(selection)
this.isAll = selection.length ==this.tableData.length
this.getParams(selection)
},
handleAll(selection) {
console.log(selection)
this.isAll = selection.length ==this.tableData.length
this.getParams(selection)
},
getParams(selection) {
let _total = 0
let _refundSubOrderCode = []
selection.forEach(item => {
_total += item.totalPrice
_refundSubOrderCode.push(item.subOrderCode)
})
this.total = parseFloat(_total.toFixed(2))
this.refundSubOrderCode = _refundSubOrderCode.join('/')
this.refundApplyDetailList = selection
console.log(this.refundSubOrderCode)
},
handleConfirm() {
const {refundSubOrderCode, refundApplyDetailList, total, isAll, isOneSubFirst} = this
this.$emit("handleConfirm", {
total,
refundSubOrderCode,
isAll,
refundApplyDetailList,
isOneSubFirst
})
},
handleClose() {
this.$emit("handleClose")
}
}
}
name: "RefundDetail",
props: {
refundVisible: {
type: Boolean,
default: false,
},
dataInfo: {
type: Object,
default: {},
},
},
data() {
return {
tableData: [],
tableColumn: [
{
label: "子订单编码",
prop: "subOrderCode",
},
{
label: "商品名称",
prop: "goodsName",
},
{
label: "商品别名",
prop: "goodsAlias",
},
{
label: "商品ID",
prop: "goodsCommodityCode",
},
{
label: "分类",
prop: "upgradeGoodsTypeName",
},
{
label: "售价",
prop: "upgradePrice",
unit: "¥",
},
{
label: "数量/件",
prop: "number",
},
{
label: "支付金额",
prop: "totalPrice",
unit: "¥",
},
],
total: 0,
refundSubOrderCode: "",
refundApplyDetailList: [],
isAll: false,
// 是否只有一个子订单并且未退过款的
isOneSubFirst: false,
};
},
watch: {
dataInfo(val) {
console.log(val);
if (val && val.orderCode)
this.getList(val.orderCode);
},
},
methods: {
// 设置禁用
selectableFn(row) {
console.log(row);
if (row.status == 2)
return false;
else return true;
},
async getList(orderCode) {
const res = await getGoodsSubOrder({ orderCode });
this.tableData = res;
this.isOneSubFirst = this.tableData.length == 1 && this.tableData.every(item => item.status == 1);
this.$refs.seletingTable.toggleAllSelection();
},
handleChange(selection) {
console.log(selection);
this.isAll = selection.length == this.tableData.length;
this.getParams(selection);
},
handleAll(selection) {
console.log(selection);
this.isAll = selection.length == this.tableData.length;
this.getParams(selection);
},
getParams(selection) {
let _total = 0;
let _refundSubOrderCode = [];
selection.forEach((item) => {
_total += item.totalPrice;
_refundSubOrderCode.push(item.subOrderCode);
});
this.total = Number.parseFloat(_total.toFixed(2));
this.refundSubOrderCode = _refundSubOrderCode.join("/");
this.refundApplyDetailList = selection;
console.log(this.refundSubOrderCode);
},
handleConfirm() {
const { refundSubOrderCode, refundApplyDetailList, total, isAll, isOneSubFirst } = this;
this.$emit("handleConfirm", {
total,
refundSubOrderCode,
isAll,
refundApplyDetailList,
isOneSubFirst,
});
},
handleClose() {
this.$emit("handleClose");
},
},
};
</script>
<style lang="scss" scoped>
.total {
display: flex;
align-items: center;
color: #666666;
font-size: 14px;
.price {
color: #2A58AD;
margin-left: 10px;
}
display: flex;
align-items: center;
color: #666666;
font-size: 14px;
.price {
color: #2a58ad;
margin-left: 10px;
}
}
</style>
<!-- 驳回 -->
<template>
<d2-dialog
title="提示"
:is-visible="visible"
@closeDialog="handleClose"
@confirmDialog="handleAddConfirm"
>
<div class="reject-dialog">
<glsx-combi-form
class="edit-form-container"
ref="formRef"
label-width="112px"
default-width="390px"
:form-ref="rejectRef"
:form-obj="infoForm"
:form-data="editFormData"
:form-rules="formRules"
></glsx-combi-form>
</div>
</d2-dialog>
<d2-dialog :is-visible="visible"
title="提示"
@closeDialog="handleClose"
@confirmDialog="handleAddConfirm">
<div class="reject-dialog">
<glsx-combi-form ref="formRef"
class="edit-form-container"
default-width="390px"
:form-data="editFormData"
:form-obj="infoForm"
:form-ref="rejectRef"
:form-rules="formRules"
label-width="112px">
</glsx-combi-form>
</div>
</d2-dialog>
</template>
<script>
import { cancelDeduct, getScoreDetail } from "@api/point"
<script>
import { cancelDeduct, getScoreDetail } from "@api/point";
export default {
name: "RejectDialog",
data() {
return {
infoForm: {
remark: ""
},
dialogConfig: {
title: "提示",
width: "576px",
height: "315px"
},
rejectRef: "rejectRef",
formRules: {
// remark: [{ required: true, message: "请输入撤销原因", trigger: "blur" }]
},
editFormData: [
{
label: "撤销原因",
name: "remark",
type: "input",
maxlength: 20,
inputType: "textarea",
showLimit: true,
rows: 4
}
],
baseData: {}
}
},
name: "RejectDialog",
props: {
visible: {
type: Boolean,
default: false
},
id: {
type: Number,
default: ""
}
},
computed: {
isVisible: {
get() {
return this.visible
},
set(newVal) {}
}
},
props: {
visible: {
type: Boolean,
default: false,
},
id: {
type: Number,
default: "",
},
},
data() {
return {
infoForm: {
remark: "",
},
dialogConfig: {
title: "提示",
width: "576px",
height: "315px",
},
rejectRef: "rejectRef",
formRules: {
// remark: [{ required: true, message: "请输入撤销原因", trigger: "blur" }]
},
editFormData: [
{
label: "撤销原因",
name: "remark",
type: "input",
maxlength: 20,
inputType: "textarea",
showLimit: true,
rows: 4,
},
],
baseData: {},
};
},
computed: {
isVisible: {
get() {
return this.visible;
},
set(newVal) {},
},
},
mounted() {},
mounted() {},
methods: {
handleAddConfirm() {
this.$refs.formRef.$refs[this.rejectRef].validate(async (valid) => {
if (valid) {
let detailData = await getScoreDetail({ id: this.id })
let params = {}
params.remark = this.infoForm.remark
params.orderCode = detailData.orderCode
params.scoreId = this.id
cancelDeduct(params).then((res) => {
console.log(res)
if (res) {
this.$emit("handleConfirm", false)
this.notice.okTips("操作成功")
}
})
}
})
},
handleClose() {
this.$emit("dialogClose", false)
}
}
}
methods: {
handleAddConfirm() {
this.$refs.formRef.$refs[this.rejectRef].validate(async (valid) => {
if (valid) {
let detailData = await getScoreDetail({ id: this.id });
let params = {};
params.remark = this.infoForm.remark;
params.orderCode = detailData.orderCode;
params.scoreId = this.id;
cancelDeduct(params).then((res) => {
console.log(res);
if (res) {
this.$emit("handleConfirm", false);
this.notice.okTips("操作成功");
}
});
}
});
},
handleClose() {
this.$emit("dialogClose", false);
},
},
};
</script>
<style lang="scss" scoped>
.reject-dialog {
margin: 21px 0 83px;
margin: 21px 0 83px;
::v-deep .el-textarea__inner {
height: 70px;
}
::v-deep .el-input__count {
right: 15px !important;
bottom: 3px !important;
font-size: 12px;
color: #999999;
}
::v-deep .el-textarea__inner {
height: 70px;
}
::v-deep .el-input__count {
right: 15px !important;
bottom: 3px !important;
font-size: 12px;
color: #999999;
}
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!