You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

189 lines
4.3 KiB

<style lang="less">
@import "@/styles/table-common.less";
</style>
<template>
<div class="search">
<Card>
<Row>
<Form ref="searchForm" v-for="(item,index) in form.rules" :key="index" :model="searchForm" inline :label-width="100">
<FormItem label="名次" prop="name">
<Input v-model="item.orderNum"></Input>
</FormItem>
<FormItem label="奖励金额" prop="name">
<Input v-model="item.reward"></Input>
</FormItem>
<Icon type="ios-remove-circle-outline" @click="del(index)" size="30" color="red" />
</Form>
</Row>
<Row>
<Form ref="searchForm" :model="searchForm" inline :label-width="100">
<FormItem style="margin-left: -35px" class="br">
<Button @click="add">新增</Button>
<Button @click="close">关闭免单</Button>
<Button @click="submit" type="primary">保存并开启</Button>
</FormItem>
</Form>
</Row>
<Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" ref="table"
sortable="custom" ></Table>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
</Card>
</div>
</template>
<script>
import {
addJiangLi,
selectJiangLi,
JiangLiList,
closeJiangLi
} from "@/api/app";
export default {
name: "logiticsCompany",
data() {
return {
form: {
rules:[],
regionId:JSON.parse(this.getStore("user")).departmentId
},
searchForm: {
regionId:JSON.parse(this.getStore("user")).departmentId,
pageNum: 1,
pageSize: 10,
dealingsWay:'配送排名奖励'
},
columns: [{
type: "index",
width: 60,
align: "center",
},
{
title: "类型",
key: "linkType",
align: "center",
render: (h, params) => {
let re = ""
if (params.row.linkType == 0) {
re = "用户";
} else if (params.row.type == 1) {
re = "配送员";
}
return h(
"div",
re
);
}
},
{
title: "交易方式/附言",
key: "dealingsWay",
align: "center",
},
{
title: "金额",
key: "amount",
align: "center",
},
{
title: "交易时间",
key: "dealingsTime",
align: "center",
}
],
data:[],
total: 0,
};
},
methods: {
init() {
this.getDataList();
this.getJiangLiList();
},
getJiangLiList(){
JiangLiList(this.searchForm).then((res) => {
if (res.success) {
this.data = res.result
this.total = res.result.total;
if (this.data.length == 0 && this.searchForm.pageNum > 1) {
this.searchForm.pageNum -= 1;
this.getJiangLiList();
}
}
});
},
getDataList() {
selectJiangLi({
regionId:JSON.parse(this.getStore("user")).departmentId
}).then((res) => {
if (res.success) {
if(res.result == null){
this.form.rules = [{
orderNum:"",
reward:""
}]
}else{
this.form = res.result;
this.form.rules = JSON.parse(this.form.rules)
}
}
});
},
submit() {
this.form.rules = JSON.stringify(this.form.rules)
addJiangLi(this.form).then((res) => {
if (res.success) {
this.$Message.success("操作成功");
this.getDataList()
this.getJiangLiList();
}
});
},
changePage(v) {
this.searchForm.pageNum = v;
this.getJiangLiList();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getJiangLiList();
},
add(){
let rules = {
orderNum:"",
reward:""
}
this.form.rules.push(rules)
},
del(i){
this.form.rules.splice(i, 1);
},
close() {
this.$Modal.confirm({
title: "确认关闭",
content: "您确认要关闭配送员奖励吗?",
loading: true,
onOk: () => {
closeJiangLi({
regionId:JSON.parse(this.getStore("user")).departmentId
}).then((res) => {
if (res.success) {
this.$Message.success("操作成功");
this.getDataList()
}
});
this.$Modal.remove();
},
});
},
},
mounted() {
this.init();
},
};
</script>