提交 5789949f 编写于 作者: vino's avatar vino

设置分佣

上级 a5f6d8bf
...@@ -26,6 +26,20 @@ ...@@ -26,6 +26,20 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="分佣方式" v-if="commissionFlag == 2">
<el-select
v-model="searchForm.commissionType"
placeholder="请选择分佣方式"
size="small"
clearable>
<el-option
v-for="item in commissionTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col> </el-col>
<el-col :span="6" style="text-align: right"> <el-col :span="6" style="text-align: right">
<el-button type="primary" size="small" @click="searchList">查询</el-button> <el-button type="primary" size="small" @click="searchList">查询</el-button>
...@@ -39,6 +53,7 @@ ...@@ -39,6 +53,7 @@
</el-col> </el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button v-if="commissionFlag == 2" type="primary" size="small" @click="batchSetPrice()">批量设置分佣</el-button>
<el-button type="primary" size="small" @click="exportOpt">批量导出商品</el-button> <el-button type="primary" size="small" @click="exportOpt">批量导出商品</el-button>
<el-button v-if="isSSO" type="primary" size="small" @click="batchOpt(3)">批量导入商品</el-button> <el-button v-if="isSSO" type="primary" size="small" @click="batchOpt(3)">批量导入商品</el-button>
<el-button type="primary" size="small" @click="edit('add')">新建单个商品</el-button> <el-button type="primary" size="small" @click="edit('add')">新建单个商品</el-button>
...@@ -76,12 +91,25 @@ ...@@ -76,12 +91,25 @@
<span>{{scope.row.costPrice | rangePrice}}</span> <span>{{scope.row.costPrice | rangePrice}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="commissionType" v-if="commissionFlag == 2" label="分佣方式" width="150" align="center">
<template slot-scope="scope">
<span>{{ scope.row.commissionType | commissionTypeFormat}}</span>
</template>
</el-table-column>
<el-table-column prop="commissionPrice" v-if="commissionFlag == 2" label="商品分佣" width="150" align="center">
<template slot-scope="scope">
<span v-if="scope.row.commissionType == 1">{{scope.row.commissionPrice | priceNum}}%</span>
<span v-if="scope.row.commissionType == 2">{{scope.row.commissionPrice | priceNum}}</span>
</template>
</el-table-column>
<el-table-column prop="saleTime" label="发布时间" width="150" align="center"> <el-table-column prop="saleTime" label="发布时间" width="150" align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200" align="center" fixed="right"> <el-table-column label="操作" width="200" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.commissionFlag == 2">
<el-button @click="setPrice(scope.row, false)" type="text" size="small">设置分佣</el-button>
</div>
<div v-if="scope.row.goodsStatus == 0"> <div v-if="scope.row.goodsStatus == 0">
<el-button @click="edit(scope.row)" type="text" size="small">编辑</el-button> <el-button @click="edit(scope.row)" type="text" size="small">编辑</el-button>
<el-button @click="shelfOpt(scope.row,2)" type="text" size="small">上架销售</el-button> <el-button @click="shelfOpt(scope.row,2)" type="text" size="small">上架销售</el-button>
...@@ -169,9 +197,48 @@ ...@@ -169,9 +197,48 @@
<el-button type="primary" @click="batchDialog = false">完成</el-button> <el-button type="primary" @click="batchDialog = false">完成</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 设置分佣 -->
<el-dialog
title="店铺设置分佣"
:visible.sync="setPriceVisible"
width="55%">
<!-- <el-row :gutter="30" class="row search" type="flex" style="margin-bottom:0;">-->
<el-form ref="setPriceForm"
:rules="setPriceRules"
:model="setPriceForm"
label-width="250px"
label-suffix=":"
label-position="right"
size="mini"
style="width: 100%;">
<el-form-item label="分佣方式" prop="commissionType">
<el-col :span="18">
<el-radio-group v-model="setPriceForm.commissionType" size="small" style="line-height: 45px;">
<div>
<el-radio :label="1" style="float: left;margin-top: 5px;line-height: 20px;">按比例分佣(%)</el-radio>
<span style="float: right;width: 100px;"><el-input-number v-model="setPriceForm.commissionPrice1" size="small" :precision="2" :min="0"></el-input-number></span>
</div>
<div>
<el-radio :label="2" style="float: left;margin-top: 30px;line-height: 20px;">固定分佣金额(元)</el-radio>
<span style="float: right;width: 100px;margin-left: 14px;"><el-input-number v-model="setPriceForm.commissionPrice2" size="small" :precision="2" :min="0" :max="9999.99"></el-input-number></span>
</div>
</el-radio-group>
</el-col>
</el-form-item>
</el-form>
<!-- </el-row>-->
<span slot="footer" class="dialog-footer">
<el-button @click="setPriceVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmSetPrice">确 定</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
let vm = null;
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils/utils";
import BreadCrumb from "@/components/breadcrumb.vue"; import BreadCrumb from "@/components/breadcrumb.vue";
import { getRangeList,updateRangeStatus, getGoodsExportUrl, getOrdersExportUrl } from "../../utils/yqrange/yqrangeApi"; import { getRangeList,updateRangeStatus, getGoodsExportUrl, getOrdersExportUrl } from "../../utils/yqrange/yqrangeApi";
...@@ -215,6 +282,7 @@ ...@@ -215,6 +282,7 @@
pageNo:1, pageNo:1,
pageSize: 10, pageSize: 10,
storeId:0, storeId:0,
commissionType: ''
}, },
innerVisible:false, innerVisible:false,
selectList:[], selectList:[],
...@@ -229,18 +297,51 @@ ...@@ -229,18 +297,51 @@
totalRows: 0, totalRows: 0,
tableData: [], tableData: [],
goodsTypes:[], goodsTypes:[],
commissionTypeList: [
{
value: 0,
label: "全部"
},
{
value: 1,
label: "按比例分佣"
},
{
value: 2,
label: "固定分佣金额"
}],
typeList: [], typeList: [],
//uploadUrl:getBaseUrl('store/goods/import'), //uploadUrl:getBaseUrl('store/goods/import'),
postData:{}, postData:{},
validateFailedList:[], validateFailedList:[],
isSSO: 0, // 是否是sso后台管理员 1是 0否 isSSO: 0, // 是否是sso后台管理员 1是 0否
multipleSelection: [],
batchUpdatePriceFlag: false,
commissionFlag: 2,
setPriceVisible: false,
setPriceForm:{
commissionType: 1,
commissionPrice: '',
commissionPrice1: '',
commissionPrice2: '',
storeId: '',
goodsId: '',
maxPrice: ''
},
setPriceRules: {
commissionType: [
{required: true, message: "请选择分佣方式", trigger: 'blur'}
]
},
} }
}, },
created() { created() {
vm = this;
this.getLists() this.getLists()
this.getLever() this.getLever()
const {storeId} = this.$route.query; const {storeId,commissionFlag} = this.$route.query;
this.searchForm.storeId = Number(storeId) || 0; this.searchForm.storeId = Number(storeId) || 0;
this.commissionFlag = commissionFlag;
// if(storeId){ // if(storeId){
// this.searchForm.storeId = storeId // this.searchForm.storeId = storeId
// } // }
...@@ -273,8 +374,30 @@ ...@@ -273,8 +374,30 @@
let str = '¥' let str = '¥'
str += price/100 str += price/100
return str return str
},
commissionTypeFormat(value) {
if (!value && value != 0) {
return "-";
} else {
let hash = {
1: "按比例分佣",
2: "固定分佣",
};
return hash[value];
}
},
priceNum (value) {
if(value != "" && value != null && value != "null"){
return (value/100).toFixed(2);
}
else if(value == 0){
return (value/100).toFixed(2);
}
else {
return value;
} }
}, },
},
methods: { methods: {
handlePreview(){}, handlePreview(){},
handleRemove(){}, handleRemove(){},
...@@ -377,8 +500,8 @@ ...@@ -377,8 +500,8 @@
type: 'error' type: 'error'
}); });
} }
this.tableData = res.data.goodsList this.tableData = res.data.goodsList;
this.totalRows = res.data.totalCount this.totalRows = res.data.totalCount;
this.isSSO = res.data.isSSO; this.isSSO = res.data.isSSO;
}) })
}, },
...@@ -554,7 +677,152 @@ ...@@ -554,7 +677,152 @@
} }
window.open(res.data); window.open(res.data);
}); });
},
batchSetPrice(){
if(this.selectList.length == 0){
this.$message({
message: '请先选择要操作的数据',
type: "warning"
});
return;
}
this.setPrice(this.selectList[0], true);
},
setPrice(row, batchUpdatePriceFlag){
if(this.$refs.setPriceForm) {
this.$refs.setPriceForm.resetFields()
}
this.batchUpdatePriceFlag = batchUpdatePriceFlag;
this.setPriceForm.storeId = row.storeId;
this.setPriceForm.goodsId = row.goodsId;
this.setPriceForm.commissionType = "";
this.setPriceForm.commissionPrice1 = undefined;
this.setPriceForm.commissionPrice2 = undefined;
this.setPriceForm.commissionType = row.commissionType;
if(this.setPriceForm.commissionType == 1){
this.setPriceForm.commissionPrice1 = row.commissionPrice/100;
}
else if(this.setPriceForm.commissionType == 2){
this.setPriceForm.commissionPrice2 = row.commissionPrice/100;
}
this.setPriceVisible = true;
// this.setPriceForm.price = row.price;
this.setPriceVisible = true;
// if(this.$refs.setPriceForm) {
// this.$refs.setPriceForm.resetFields()
// }
// this.getProfit(row);
},
confirmSetPrice() {
if(this.setPriceForm.commissionType == null || this.setPriceForm.commissionType == ""){
this.$message({
message: '请选择分佣方式',
type: "warning"
});
return;
}
if(this.setPriceForm.commissionType == 1 && this.setPriceForm.commissionPrice1 == undefined ){
this.$message({
message: '请输入按比例分佣',
type: "warning"
});
return;
}
else if(this.setPriceForm.commissionType == 1 && this.setPriceForm.commissionPrice1 > 100){
this.$message({
message: '请输入按比例分佣0-100',
type: "warning"
});
return;
}
if(this.setPriceForm.commissionType == 2 && this.setPriceForm.commissionPrice2 == undefined ){
this.$message({
message: '请输入固定分佣金额',
type: "warning"
});
return;
} }
let timeoutId = null
timeoutId && clearTimeout(timeoutId)
timeoutId = setTimeout(() => {
this.clickHandle()
}, 500)
},
// 防止按钮多次点击
clickHandle() {
this.$refs.setPriceForm.validate((valid) => {
if(valid) {
vm.loading = true
// 批量设置价格
if(vm.batchUpdatePriceFlag){
let setPriceList = [];
if(vm.setPriceForm.commissionType == 1){
vm.setPriceForm.commissionPriceStr = vm.setPriceForm.commissionPrice1;
}
else if(vm.setPriceForm.commissionType == 2){
vm.setPriceForm.commissionPriceStr = vm.setPriceForm.commissionPrice2;
}
let parm = {
commissionPrice: vm.setPriceForm.commissionPriceStr * 100,
commissionType: vm.setPriceForm.commissionType,
goodsIdList:[],
storeId: vm.setPriceForm.storeId
}
for(let i = 0; i < vm.selectList.length; i++){
parm.goodsIdList.push(vm.selectList[i].goodsId);
}
vm.POST('/store/commission/admin/batch/goods/save', parm).then(res => {
vm.loading = false
// closeLoading(this);
if (res.code == "000000") {
vm.$message({
message: '设置价格成功',
type: "success"
});
vm.setPriceVisible = false
vm.searchList()
}else {
vm.$message({
message: res.message,
type: "error"
})
}
});
}
else {
if(vm.setPriceForm.commissionType == 1){
vm.setPriceForm.commissionPriceStr = vm.setPriceForm.commissionPrice1;
}
else if(vm.setPriceForm.commissionType == 2){
vm.setPriceForm.commissionPriceStr = vm.setPriceForm.commissionPrice2;
}
vm.setPriceForm.commissionPrice = vm.setPriceForm.commissionPriceStr * 100;
vm.POST('/store/commission/admin/goods/save', vm.setPriceForm).then(res => {
vm.loading = false
// closeLoading(this);
if (res.code == "000000") {
vm.$message({
message: '设置价格成功',
type: "success"
});
vm.setPriceVisible = false
vm.searchList()
}else {
vm.$message({
message: res.message,
type: "error"
})
}
});
}
}
})
},
}, },
} }
</script> </script>
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
<span>{{ scope.row.amount | toFixed2}}</span> <span>{{ scope.row.amount | toFixed2}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="prescriberName" label="创建人" min-width="100" align="center"></el-table-column>
<el-table-column prop="receiver" label="买家" min-width="100" align="center"></el-table-column> <el-table-column prop="receiver" label="买家" min-width="100" align="center"></el-table-column>
<el-table-column prop="goodsQuantityList" label="数量" min-width="100" align="center"> <el-table-column prop="goodsQuantityList" label="数量" min-width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
......
...@@ -26,6 +26,20 @@ ...@@ -26,6 +26,20 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="分佣方式">
<el-select
v-model="searchForm.commissionType"
placeholder="请选择分佣方式"
size="small"
clearable>
<el-option
v-for="item in commissionTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col> </el-col>
<el-col :span="6" style="text-align: right"> <el-col :span="6" style="text-align: right">
<el-button type="primary" size="small" @click="searchList">查询</el-button> <el-button type="primary" size="small" @click="searchList">查询</el-button>
...@@ -71,9 +85,21 @@ ...@@ -71,9 +85,21 @@
<span>{{ scope.row.tradeStore.createdTime }}</span> <span>{{ scope.row.tradeStore.createdTime }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="commissionType" label="分佣方式" width="150" align="center">
<template slot-scope="scope">
<span>{{ scope.row.tradeStore.commissionType | commissionTypeFormat}}</span>
</template>
</el-table-column>
<el-table-column prop="commissionPrice" label="店铺分佣" width="150" align="center">
<template slot-scope="scope">
<span v-if="scope.row.tradeStore.commissionType == 1">{{scope.row.tradeStore.commissionPrice | priceNum}}%</span>
<span v-if="scope.row.tradeStore.commissionType == 2">{{scope.row.tradeStore.commissionPrice | priceNum}}</span>
</template>
</el-table-column>
<el-table-column label="操作" min-width="230" align="center" fixed="right"> <el-table-column label="操作" min-width="230" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<el-button v-if="scope.row.tradeStore.commissionFlag == 2" @click="setPrice(scope.row, false)" type="text" size="small">设置分佣</el-button>
<el-button @click="editShop(scope.row)" type="text" size="small">{{scope.row.tradeStore.storeType == 3 ? '查看' : '编辑'}}</el-button> <el-button @click="editShop(scope.row)" type="text" size="small">{{scope.row.tradeStore.storeType == 3 ? '查看' : '编辑'}}</el-button>
<el-button @click="shopManage(scope.row)" type="text" size="small">商品管理</el-button> <el-button @click="shopManage(scope.row)" type="text" size="small">商品管理</el-button>
<el-button @click="orderManage(scope.row)" type="text" size="small">订单管理</el-button> <el-button @click="orderManage(scope.row)" type="text" size="small">订单管理</el-button>
...@@ -94,10 +120,49 @@ ...@@ -94,10 +120,49 @@
:total="totalRows" :total="totalRows"
></el-pagination> ></el-pagination>
</div> </div>
<!-- 设置分佣 -->
<el-dialog
title="店铺设置分佣"
:visible.sync="setPriceVisible"
width="55%">
<!-- <el-row :gutter="30" class="row search" type="flex" style="margin-bottom:0;">-->
<el-form ref="setPriceForm"
:rules="setPriceRules"
:model="setPriceForm"
label-width="250px"
label-suffix=":"
label-position="right"
size="mini"
style="width: 100%;">
<el-form-item label="分佣方式" prop="commissionType">
<el-col :span="18">
<el-radio-group v-model="setPriceForm.commissionType" size="small" style="line-height: 45px;">
<div>
<el-radio :label="1" style="float: left;margin-top: 5px;line-height: 20px;">按比例分佣(%)</el-radio>
<span style="float: right;width: 100px;"><el-input-number v-model="setPriceForm.commissionPrice1" size="small" :precision="2" :min="0"></el-input-number></span>
</div>
<div>
<el-radio :label="2" style="float: left;margin-top: 30px;line-height: 20px;">固定分佣金额(元)</el-radio>
<span style="float: right;width: 100px;margin-left: 14px;"><el-input-number v-model="setPriceForm.commissionPrice2" size="small" :precision="2" :min="0" :max="9999.99"></el-input-number></span>
</div>
</el-radio-group>
</el-col>
</el-form-item>
</el-form>
<!-- </el-row>-->
<span slot="footer" class="dialog-footer">
<el-button @click="setPriceVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmSetPrice">确 定</el-button>
</span>
</el-dialog>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
let vm = null;
import { openLoading, closeLoading } from "../../utils/utils"; import { openLoading, closeLoading } from "../../utils/utils";
import BreadCrumb from "@/components/breadcrumb.vue"; import BreadCrumb from "@/components/breadcrumb.vue";
import { queryStore, queryShopAuth, closeShop } from '@/utils/shop'; import { queryStore, queryShopAuth, closeShop } from '@/utils/shop';
...@@ -118,6 +183,7 @@ ...@@ -118,6 +183,7 @@
pageSize: 10, pageSize: 10,
id: null, id: null,
type: null, type: null,
commissionType: ''
}, },
canAdd: false, canAdd: false,
totalRows: 0, totalRows: 0,
...@@ -146,9 +212,38 @@ ...@@ -146,9 +212,38 @@
}], }],
idType: 0, idType: 0,
storageIdType: 0, storageIdType: 0,
commissionTypeList: [
{
value: 0,
label: "全部"
},
{
value: 1,
label: "按比例分佣"
},
{
value: 2,
label: "固定分佣金额"
}],
setPriceVisible: false,
setPriceForm:{
commissionType: 1,
commissionPrice: '',
commissionPrice1: '',
commissionPrice2: '',
storeId: '',
goodsId: '',
maxPrice: ''
},
setPriceRules: {
commissionType: [
{required: true, message: "请选择分佣方式", trigger: 'blur'}
]
},
} }
}, },
created() { created() {
vm = this;
// this.idType = localStorage.getItem("storageIdType"); // this.idType = localStorage.getItem("storageIdType");
this.storageIdType = localStorage.getItem("storageIdType") - 0; this.storageIdType = localStorage.getItem("storageIdType") - 0;
console.log(this.storageIdType); console.log(this.storageIdType);
...@@ -214,6 +309,7 @@ ...@@ -214,6 +309,7 @@
path: '/goods-manage', path: '/goods-manage',
query: { query: {
storeId: row.tradeStore.id, storeId: row.tradeStore.id,
commissionFlag:row.tradeStore.commissionFlag
} }
}) })
}, },
...@@ -267,6 +363,101 @@ ...@@ -267,6 +363,101 @@
// this.$message.error('操作失败'); // this.$message.error('操作失败');
}) })
}, },
confirmSetPrice() {
if(this.setPriceForm.commissionType == null || this.setPriceForm.commissionType == ""){
this.$message({
message: '请选择接诊服务费结算方式(上级医生)',
type: "warning"
});
return;
}
if(this.setPriceForm.commissionType == 1 && this.setPriceForm.commissionPrice1 == undefined ){
this.$message({
message: '请输入按比例分佣',
type: "warning"
});
return;
}
else if(this.setPriceForm.commissionType == 1 && this.setPriceForm.commissionPrice1 > 100){
this.$message({
message: '请输入按比例分佣0-100',
type: "warning"
});
return;
}
if(this.setPriceForm.commissionType == 2 && this.setPriceForm.commissionPrice2 == undefined ){
this.$message({
message: '请输入固定分佣金额',
type: "warning"
});
return;
}
let timeoutId = null
timeoutId && clearTimeout(timeoutId)
timeoutId = setTimeout(() => {
this.clickHandle()
}, 500)
},
// 防止按钮多次点击
clickHandle() {
this.$refs.setPriceForm.validate((valid) => {
if(valid) {
vm.loading = true;
if(vm.setPriceForm.commissionType == 1){
vm.setPriceForm.commissionPriceStr = vm.setPriceForm.commissionPrice1;
}
else if(vm.setPriceForm.commissionType == 2){
vm.setPriceForm.commissionPriceStr = vm.setPriceForm.commissionPrice2;
}
vm.setPriceForm.commissionPrice = vm.setPriceForm.commissionPriceStr * 100;
vm.POST('/store/commission/admin/store/save', vm.setPriceForm).then(res => {
vm.loading = false
// closeLoading(this);
if (res.code == "000000") {
vm.$message({
message: '设置分佣成功',
type: "success"
});
vm.setPriceVisible = false
vm.searchList();
}else {
vm.$message({
message: res.message,
type: "error"
})
}
});
}
})
},
setPrice(row, batchUpdatePriceFlag){
if(this.$refs.setPriceForm) {
this.$refs.setPriceForm.resetFields()
}
// this.batchUpdatePriceFlag = batchUpdatePriceFlag;
this.setPriceForm.storeId = row.tradeStore.id;
this.setPriceForm.goodsId = row.tradeStore.goodsId;
this.setPriceForm.commissionType = "";
this.setPriceForm.commissionPrice1 = undefined;
this.setPriceForm.commissionPrice2 = undefined;
this.setPriceForm.commissionType = row.tradeStore.commissionType;
if(this.setPriceForm.commissionType == 1){
this.setPriceForm.commissionPrice1 = row.tradeStore.commissionPrice/100;
}
else if(this.setPriceForm.commissionType == 2){
this.setPriceForm.commissionPrice2 = row.tradeStore.commissionPrice/100;
}
this.setPriceVisible = true;
// if(this.$refs.setPriceForm) {
// this.$refs.setPriceForm.resetFields()
// }
// this.getProfit(row);
},
}, },
filters: { filters: {
storeTypeFormat: function(value){ storeTypeFormat: function(value){
...@@ -292,6 +483,28 @@ ...@@ -292,6 +483,28 @@
return hash[value]; return hash[value];
} }
}, },
commissionTypeFormat(value) {
if (!value && value != 0) {
return "-";
} else {
let hash = {
1: "按比例分佣",
2: "固定分佣",
};
return hash[value];
}
},
priceNum (value) {
if(value != "" && value != null && value != "null"){
return (value/100).toFixed(2);
}
else if(value == 0){
return (value/100).toFixed(2);
}
else {
return value;
}
},
}, },
} }
</script> </script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册