diff --git a/src/api/app.js b/src/api/app.js index d2ae01d..d301c29 100644 --- a/src/api/app.js +++ b/src/api/app.js @@ -440,6 +440,11 @@ export const getShopData = (params) => { return getRequest('/app/shop/getByCondition', params) } +// 提现记录分页 +export const getReturnCommissionPage = (params) => { + return getRequest('/app/returnCommission/page', params) +} + export const getAllShopData = () => { return getRequest('/app/shop/getAll') } diff --git a/src/views/app/business/courier/courier.vue b/src/views/app/business/courier/courier.vue index 82cf429..485e89b 100644 --- a/src/views/app/business/courier/courier.vue +++ b/src/views/app/business/courier/courier.vue @@ -90,6 +90,7 @@ + @@ -122,13 +123,15 @@ import excel from "@/libs/excel"; import addEdit from "./addEdit.vue"; import logisticsAddress from "@/views/app/business/courier/logisticsAddress.vue"; + import withdrawRecordModal from "@/views/app/components/withdrawRecordModal.vue"; import dict from "@/views/my-components/hiver/dict"; export default { name: "Courier", components: { addEdit, dict, - logisticsAddress + logisticsAddress, + withdrawRecordModal }, data() { return { @@ -348,7 +351,7 @@ { title: "操作", key: "action", - width: 340, + width: 420, align: "center", fixed: "right", render: (h, params) => { @@ -480,6 +483,21 @@ }, }), fullTimeAction, + h("Divider", { + props: { + type: "vertical", + }, + }), + h( + "a", { + on: { + click: () => { + this.openWithdrawRecords(params.row); + }, + }, + }, + "提现记录" + ), ]); }, }, @@ -598,6 +616,9 @@ this.$refs.dialog.initRecharge(v); }); }, + openWithdrawRecords(v) { + this.$refs.withdrawRecordModal.open(v, "worker"); + }, handleSearch() { this.searchForm.pageNum = 1; this.searchForm.pageSize = 10; diff --git a/src/views/app/business/logiticsCompany/dictManage.vue b/src/views/app/business/logiticsCompany/dictManage.vue index 0825e4e..03c6155 100644 --- a/src/views/app/business/logiticsCompany/dictManage.vue +++ b/src/views/app/business/logiticsCompany/dictManage.vue @@ -140,6 +140,18 @@ export default { key: "shopName", minWidth: 150, }, + { + title: "商家类型", + key: "merchantType", + width: 110, + render: (h, params) => { + const typeMap = { + 1: "外卖商家", + 2: "团购商家", + }; + return h("span", typeMap[params.row.merchantType] || "-"); + }, + }, { title: "原价", key: "originalPrice", @@ -263,6 +275,7 @@ export default { status: v.status, startTime: v.startTime, endTime: v.endTime, + merchantType: v.merchantType == null ? null : Number(v.merchantType), remark: v.remark || "", }; this.editDateRange = v.startTime && v.endTime ? [v.startTime, v.endTime] : []; diff --git a/src/views/app/business/logiticsCompany/transferStation.vue b/src/views/app/business/logiticsCompany/transferStation.vue index 409a1a1..99b1702 100644 --- a/src/views/app/business/logiticsCompany/transferStation.vue +++ b/src/views/app/business/logiticsCompany/transferStation.vue @@ -207,6 +207,7 @@ export default { contactPhone: item.contactPhone, regionId: item.regionId, shopArea: item.shopArea, + merchantType: item.merchantType, })); } }).catch(() => { @@ -305,6 +306,7 @@ export default { status: 1, getAreaId: this.selectNode.regionId || this.regionId, shoArea: this.selectNode.shopArea || "", + merchantType: this.selectNode.merchantType == null ? null : Number(this.selectNode.merchantType), startTime: null, endTime: null, remark: "", diff --git a/src/views/app/components/withdrawRecordModal.vue b/src/views/app/components/withdrawRecordModal.vue new file mode 100644 index 0000000..2bdbca8 --- /dev/null +++ b/src/views/app/components/withdrawRecordModal.vue @@ -0,0 +1,187 @@ + + + + diff --git a/src/views/app/shop/dictManage.vue b/src/views/app/shop/dictManage.vue index 272ec00..93df18c 100644 --- a/src/views/app/shop/dictManage.vue +++ b/src/views/app/shop/dictManage.vue @@ -356,11 +356,11 @@
- 全时段售卖 - 自定义时段 + 全时段售卖 + 自定义时段
-
+
@@ -1437,7 +1437,15 @@ this.getCateGorySon(this.categoryData[this.categoryIndex].id) }, checkSellTime(type){ - this.addGoodsForm.sellTime = type; + const sellTime = Number(type); + this.$set(this.addGoodsForm, "sellTime", sellTime); + if (sellTime === 0) { + this.$set(this.addGoodsForm, "sellBeginTime", ""); + this.$set(this.addGoodsForm, "sellEndTime", ""); + } + }, + selectDateRange(){ + this.$forceUpdate(); }, checkisMoreBuy(type){ this.addGoodsForm.isMoreBuy = type; @@ -1791,7 +1799,7 @@ }); this.specValueArr = this.addGoodsForm.attributeListPrice - this.addGoodsForm.sellTime = this.addGoodsForm.sellBeginTime != '' ? 1 : 0 + this.$set(this.addGoodsForm, "sellTime", this.addGoodsForm.sellBeginTime != "" ? 1 : 0) this.setGoodsCategoryName(this.addGoodsForm.categoryId) this.modalVisible = true; }, diff --git a/src/views/app/shop/mernage.vue b/src/views/app/shop/mernage.vue index f3ef0c4..bbd1a87 100644 --- a/src/views/app/shop/mernage.vue +++ b/src/views/app/shop/mernage.vue @@ -57,11 +57,11 @@ - + @@ -249,6 +249,7 @@ this.form.passStrength = strength; }, submit1() { + this.form.shoprank = 0 // 处理商品分类的名称 if (this.form.type != '' && this.form.type != null) { this.shopType.forEach(item => { diff --git a/src/views/app/shop/shop.vue b/src/views/app/shop/shop.vue index 7bab07c..ee4266f 100644 --- a/src/views/app/shop/shop.vue +++ b/src/views/app/shop/shop.vue @@ -101,6 +101,7 @@ + @@ -126,6 +127,7 @@ import addEdit from "./addEdit.vue"; import mernage from "./mernage.vue"; import logisticsAddress from "@/views/app/shop/logisticsAddress.vue"; + import withdrawRecordModal from "@/views/app/components/withdrawRecordModal.vue"; import dict from "@/views/my-components/hiver/dict"; import goodsList from "./dictManage.vue"; @@ -146,7 +148,8 @@ addEdit, mernage, dict, - goodsList + goodsList, + withdrawRecordModal }, data() { return { @@ -288,7 +291,7 @@ { title: "操作", key: "action", - width: 170, + width: 280, align: "center", fixed: "right", render: (h, params) => { @@ -393,6 +396,21 @@ }, "管理商品" ), + h("Divider", { + props: { + type: "vertical", + }, + }), + h( + "a", { + on: { + click: () => { + this.openWithdrawRecords(params.row); + }, + }, + }, + "提现记录" + ), ]); }, }, @@ -509,6 +527,9 @@ this.$refs.courierDialog.initRecharge(v); }); }, + openWithdrawRecords(v) { + this.$refs.withdrawRecordModal.open(v, "shop"); + }, add() { this.showType = "2"; this.showUser = true; diff --git a/src/views/app/shopArea/shopArea.vue b/src/views/app/shopArea/shopArea.vue index 992df02..8939989 100644 --- a/src/views/app/shopArea/shopArea.vue +++ b/src/views/app/shopArea/shopArea.vue @@ -126,6 +126,38 @@ + +
+ + + +
+
+ + + % + + +
+ + + +
+
+ + + % +
+ +
+ + + + + + + +
+
+ + + +
+ +
+
@@ -277,13 +396,22 @@ import { deleteShopArea, searchShopArea, } from "@/api/app"; -import userSelect from "@/views/my-components/hiver/user-select"; +import { getUserListData } from "@/api/index"; export default { name: "shopArea", - components: { - userSelect, - }, data() { + const validateCommissionRatio = (rule, value, callback) => { + if (value === "" || value == null || value === "null") { + callback(); + return; + } + const ratio = Number(value); + if (!Number.isInteger(ratio) || ratio < 0 || ratio > 100) { + callback(new Error("返佣比例需为0或1-100之间的整数")); + return; + } + callback(); + }; return { showType: "tree", loading: true, @@ -305,8 +433,21 @@ export default { sortOrder: 0, isCanteen: 0, status: 0, + parentAgentId: "", + parentAgentName: "", + commissionRatio: 0, }, formAdd: {}, + agentModalVisible: false, + agentSelectTarget: "add", + agentLoading: false, + agentSearchForm: { + mobile: "", + pageNumber: 1, + pageSize: 10, + sort: "createTime", + order: "desc", + }, formValidate: { title: [{ required: true, message: "请输入名称", trigger: "blur" }], sortOrder: [ @@ -325,10 +466,63 @@ export default { trigger: "change", }, ], + commissionRatio: [ + { + validator: validateCommissionRatio, + trigger: "change", + }, + ], }, submitLoading: false, data: [], dataEdit: [], + agentData: [], + agentTotal: 0, + agentColumns: [ + { + type: "index", + width: 60, + align: "center", + }, + { + title: "用户名", + key: "nickname", + minWidth: 130, + }, + { + title: "登录账号", + key: "username", + minWidth: 130, + }, + { + title: "手机号", + key: "mobile", + minWidth: 130, + }, + { + title: "操作", + key: "action", + width: 100, + align: "center", + render: (h, params) => { + return h( + "Button", + { + props: { + type: "primary", + size: "small", + }, + on: { + click: () => { + this.selectParentAgent(params.row); + }, + }, + }, + "选择" + ); + }, + }, + ], columns: [ { type: "selection", @@ -347,6 +541,21 @@ export default { sortable: true, tree: true, }, + { + title: "上级代理", + key: "parentAgentName", + minWidth: 120, + }, + { + title: "返佣比例", + key: "commissionRatio", + minWidth: 100, + align: "center", + render: (h, params) => { + const ratio = params.row.commissionRatio; + return h("span", ratio || ratio === 0 ? `${ratio}%` : ""); + }, + }, { title: "排序", key: "sortOrder", @@ -419,8 +628,35 @@ export default { isDepartmentAgent() { return !!this.userDepartmentId; }, + showEditParentAgent() { + return this.form && this.form.id && this.isRootArea(this.form.parentId); + }, + showAddParentAgent() { + return this.formAdd && this.isRootArea(this.formAdd.parentId); + }, }, methods: { + isRootArea(parentId) { + return parentId === 0 || parentId === "0"; + }, + clearParentAgentValue(target) { + this.$set(target, "parentAgentId", ""); + this.$set(target, "parentAgentName", ""); + }, + normalizeParentAgent(target) { + if (!this.isRootArea(target.parentId)) { + this.clearParentAgentValue(target); + this.$delete(target, "commissionRatio"); + } else if ( + target.commissionRatio === "" || + target.commissionRatio == null || + target.commissionRatio === "null" + ) { + this.$set(target, "commissionRatio", 0); + } else { + this.$set(target, "commissionRatio", Number(target.commissionRatio)); + } + }, init() { this.getParentList(); this.getParentListEdit(); @@ -534,8 +770,19 @@ export default { this.editTitle = data.title; // 回显 this.form = data; - this.$refs.mainHeader.setData(data.mainHeaders); - this.$refs.viceHeader.setData(data.viceHeaders); + if (!this.form.parentAgentId) { + this.$set(this.form, "parentAgentId", ""); + } + if (!this.form.parentAgentName) { + this.$set(this.form, "parentAgentName", ""); + } + if ( + this.form.commissionRatio === undefined || + this.form.commissionRatio === "" || + this.form.commissionRatio === "null" + ) { + this.$set(this.form, "commissionRatio", 0); + } } else { this.cancelEdit(); } @@ -546,9 +793,18 @@ export default { data.selected = false; } this.$refs.form.resetFields(); - this.$refs.mainHeader.clearData(); - this.$refs.viceHeader.clearData(); - delete this.form.id; + this.form = { + id: "", + title: null, + parentId: "", + parentTitle: "", + sortOrder: 0, + isCanteen: 0, + status: 0, + parentAgentId: "", + parentAgentName: "", + commissionRatio: 0, + }; this.editTitle = ""; }, selectTreeEdit(v) { @@ -568,6 +824,7 @@ export default { } this.form.parentId = data.id; this.form.parentTitle = data.title; + this.normalizeParentAgent(this.form); } }, cancelAdd() { @@ -579,6 +836,7 @@ export default { this.form.status = 0; }, submitEdit() { + this.normalizeParentAgent(this.form); this.$refs.form.validate((valid) => { if (valid) { if (!this.form.id) { @@ -588,6 +846,7 @@ export default { this.submitLoading = true; delete this.form.mainHeaders; delete this.form.viceHeaders; + this.normalizeParentAgent(this.form); editShopArea(this.form).then((res) => { this.submitLoading = false; if (res.success) { @@ -601,9 +860,11 @@ export default { }); }, submitAdd() { + this.normalizeParentAgent(this.formAdd); this.$refs.formAdd.validate((valid) => { if (valid) { this.submitLoading = true; + this.normalizeParentAgent(this.formAdd); addShopArea(this.formAdd).then((res) => { this.submitLoading = false; if (res.success) { @@ -626,6 +887,8 @@ export default { sortOrder: this.data.length + 1, isCanteen: null, status: 0, + parentAgentId: "", + parentAgentName: "", }; this.modalVisible = true; return; @@ -644,6 +907,8 @@ export default { sortOrder: this.form.children.length + 1, isCanteen: null, status: 0, + parentAgentId: "", + parentAgentName: "", }; this.modalVisible = true; }, @@ -659,9 +924,76 @@ export default { sortOrder: this.data.length + 1, isCanteen: null, status: 0, + parentAgentId: "", + parentAgentName: "", + commissionRatio: 0, }; this.modalVisible = true; }, + openParentAgentModal(target) { + this.agentSelectTarget = target; + this.agentModalVisible = true; + this.handleAgentReset(); + }, + handleAgentSearch() { + this.agentSearchForm.pageNumber = 1; + this.agentSearchForm.pageSize = 10; + this.getAgentDataList(); + }, + handleAgentReset() { + this.agentSearchForm.mobile = ""; + this.agentSearchForm.pageNumber = 1; + this.agentSearchForm.pageSize = 10; + this.agentData = []; + this.agentTotal = 0; + }, + changeAgentPage(v) { + this.agentSearchForm.pageNumber = v; + this.getAgentDataList(); + }, + changeAgentPageSize(v) { + this.agentSearchForm.pageSize = v; + this.getAgentDataList(); + }, + getAgentDataList() { + const mobile = (this.agentSearchForm.mobile || "").trim(); + if (!mobile) { + this.$Message.warning("请输入手机号搜索用户"); + return; + } + this.agentLoading = true; + getUserListData({ + id: "", + mobile, + status: "", + pageNumber: this.agentSearchForm.pageNumber, + pageSize: this.agentSearchForm.pageSize, + sort: this.agentSearchForm.sort, + order: this.agentSearchForm.order, + }).then((res) => { + this.agentLoading = false; + if (res.success) { + this.agentData = res.result.content; + this.agentTotal = res.result.totalElements; + } + }); + }, + selectParentAgent(v) { + const target = + this.agentSelectTarget === "edit" ? this.form : this.formAdd; + this.$set(target, "parentAgentId", v.id); + this.$set( + target, + "parentAgentName", + v.nickname || v.username || v.mobile + ); + this.agentModalVisible = false; + this.$Message.success(`选择用户 ${target.parentAgentName} 成功`); + }, + clearParentAgent(targetType) { + const target = targetType === "edit" ? this.form : this.formAdd; + this.clearParentAgentValue(target); + }, changeSelect(v) { this.selectList = v; },