tianyi 3 weeks ago
parent
commit
01aeb02627
  1. 247
      src/views/app/business/logiticsCompany/addEdit.vue
  2. 315
      src/views/app/business/logiticsCompany/dictManage.vue
  3. 1008
      src/views/app/business/logiticsCompany/transferStation.vue

247
src/views/app/business/logiticsCompany/addEdit.vue

@ -0,0 +1,247 @@
<template>
<div class="company-edit">
<!-- Drawer抽屉 -->
<Drawer :title="title" v-model="visible" width="500" draggable :mask-closable="type == '0'">
<div :style="{ maxHeight: maxHeight }" class="drawer-content">
<div class="drawer-header">
<div style="margin-right: 16px">优惠券配置</div>
</div>
<Form ref="form" :model="form" :rules="formValidate" label-position="top">
<Row :gutter="32">
<Col span="24">
<FormItem label="优惠券名称" prop="name">
<Input v-model="form.name" />
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="发券总数" prop="totalCount">
<Input v-model="form.totalCount" />
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="适用范围" prop="applyScene">
<RadioGroup v-model="form.applyScene">
<Radio label="0">全部</Radio>
<Radio label="1">外卖/买饭</Radio>
<Radio label="2">快递/跑腿</Radio>
<Radio label="3">二手物品交易</Radio>
</RadioGroup>
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="使用门槛">
<RadioGroup v-model="form.type">
<Radio label="2">无门槛</Radio>
<Radio label="1"><Input v-model='form.minAmount' style="width: 50px;"></Input >使</Radio>
</RadioGroup>
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="优惠金额">
<Input v-model='form.discountAmount'></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="每人限领数量">
<Input v-model='form.limitPerUser'></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="32">
<Col span="24">
<FormItem label="有效期">
<RadioGroup v-model="form.validType" vertical>
<Radio label="1">固定日期</Radio>
<DatePicker @on-change="changeDate" v-if="form.validType == '1'" type="daterange" split-panels placeholder="选择起始时间" style="width: 200px"></DatePicker>
<Radio label="2">领券后<Input v-model='form.validDays' style="width: 50px;"></Input ></Radio>
</RadioGroup>
</FormItem>
</Col>
</Row>
</Form>
</div>
<div class="drawer-footer br" v-show="type != '0'">
<Button type="primary" :loading="submitLoading" @click="submit">提交</Button>
<Button @click="visible = false">取消</Button>
</div>
</Drawer>
</div>
</template>
<script>
import {
addCoupon,
editCoupon
} from "@/api/app";
import dict from "@/views/my-components/hiver/dict";
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input";
import regionTreeChoose from "@/views/my-components/hiver/region-tree-choose";
export default {
name: "company",
components: {
dict,
uploadPicInput,
regionTreeChoose
},
props: {
value: {
type: Boolean,
default: false,
},
data: {
type: Object,
},
type: {
type: String,
default: "0",
},
},
data() {
return {
menkan:'',
xianzhi:'',
youxiao:'',
roleList: [],
visible: this.value,
title: "",
data: [],
passColor: "",
submitLoading: false,
maxHeight: 510,
form: {
name: '', //
applyScene:'', //0-1-/2-/3-
type:'', //1-2-
minAmount:'', //使
discountAmount:'', //
totalCount:'', //
limitPerUser:1, //
validType:'', //1-2-
validStartTime:'', //
validEndTime:'', //
validDays:'', //
issuerType:1, //1-2-
issuerId:0, //ID 0-
status:1, //0-/1-
regionId:JSON.parse(this.getStore("user")).departmentId, //id
},
formValidate: {
//
name: [{
required: true,
message: "请输入优惠券名称",
trigger: "change"
}, ],
contacts: [{
required: true,
message: "请输入联系人",
trigger: "change"
}, ],
mobile: [{
required: true,
message: "请输入手机号",
trigger: "change"
}, ],
},
};
},
methods: {
init() {
},
changeDate(v){
console.log(v)
this.form.validStartTime = v[0]
this.form.validEndTime = v[1]
},
submit() {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.type == "1") {
//
this.submitLoading = true;
editCoupon(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.$emit("on-submit", true);
this.visible = false;
}
});
} else {
// 1
this.submitLoading = true;
addCoupon(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.$emit("on-submit", true);
this.visible = false;
}
});
}
}
});
},
setCurrentValue(value) {
if (value === this.visible) {
return;
}
if (this.type == "1") {
this.title = "编辑优惠券信息";
this.maxHeight =
Number(document.documentElement.clientHeight - 121) + "px";
} else if (this.type == "2") {
this.title = "新增优惠券";
this.maxHeight =
Number(document.documentElement.clientHeight - 121) + "px";
} else {
this.title = "优惠券详情";
this.maxHeight = "100%";
}
//
this.$refs.form.resetFields();
if (this.type == "0" || this.type == "1") {
//
let data = this.data;
//
this.form = data;
this.form.applyScene = JSON.stringify(this.form.applyScene)
this.form.type = JSON.stringify(this.form.type)
this.form.validType = JSON.stringify(this.form.validType)
console.log('优惠券',this.form)
}
this.visible = value;
},
},
watch: {
value(val) {
this.setCurrentValue(val);
},
visible(value) {
this.$emit("input", value);
},
},
mounted() {
this.init();
},
};
</script>
<style lang="less">
@import "@/styles/drawer-common.less";
</style>

315
src/views/app/business/logiticsCompany/dictManage.vue

@ -0,0 +1,315 @@
<template>
<div class="search">
<Button @click="findAllRecords" type="primary" icon="md-add">新增商品</Button>
<Card>
<Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" ref="table"
sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNum" :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>
<Modal :title="商品维护" v-model="tranVisiable" :mask-closable="false" :scrollabele="true" :width="1000">
<transfer-station v-if="tranVisiable" ref="dialog"></transfer-station>
<div slot="footer" v-show=tranVisiable>
<Button type="text" @click="tranVisiable = false">关闭</Button>
</div>
</Modal>
</div>
</template>
<script>
import {
addLogisticsStation,
updateLogisticsStation,
deleteLogisticsStation,
getLogisticsStationPageList
} from "@/api/app";
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input";
import transferStation from "@/views/app/business/lineManage/transferStation.vue";
import {
shortcuts
} from "@/libs/shortcuts";
export default {
name: "logisticsAddress",
components: {
uploadPicInput,
transferStation
},
data() {
return {
exportTitle: "商品",
tableSize: "default",
showType: "0",
tranVisiable:false,
stationModalVisible: false,
openSearch: true, //
openTip: true, //
loading: true, //
modalType: 0, //
modalVisible: false, //
modalTitle: "", //
searchForm: {
pageNum: 1,
pageSize: 10,
circuitId:"",
stationName:""
},
selectDate: null,
options: {
shortcuts: shortcuts,
},
form: {
circuitId:'',
stationName:'',
freightRules:'',
landingFeeRules:'',
deliveryFeeRules:''
},
submitLoading: false, //
selectList: [], //
columns: [
{
type: "index",
width: 60,
align: "center",
fixed: "left",
},
{
title: "线路id",
key: "circuitId",
minWidth: 125,
sortable: true,
fixed: "left",
},
{
title: "商品名称",
key: "stationName",
minWidth: 125,
sortable: true,
fixed: "left",
},
{
title: "运费规则",
key: "freightRules",
minWidth: 125,
sortable: true,
fixed: "left",
},
{
title: "落地费规则",
key: "landingFeeRules",
minWidth: 125,
sortable: true,
fixed: "left",
},
{
title: "送货费规则",
key: "deliveryFeeRules",
minWidth: 125,
sortable: true,
fixed: "left",
},
{
title: "操作",
key: "action",
width: 200,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"a", {
on: {
click: () => {
this.edit(params.row);
},
},
},
"编辑"
),
h("Divider", {
props: {
type: "vertical",
},
}),
h(
"a", {
on: {
click: () => {
this.edit(params.row);
},
},
},
"下架"
),
h("Divider", {
props: {
type: "vertical",
},
}),
h(
"a", {
on: {
click: () => {
this.remove(params.row);
},
},
},
"删除"
),
]);
},
},
],
data: [], //
total: 0, //
rechargeWorkerId: "",
};
},
methods: {
init() {
// this.getDataList();
},
initRecharge(data) {
//data
console.log(data);
this.searchForm.circuitId = data.id;
this.getDataList();
},
changePage(v) {
this.searchForm.pageNum = v;
this.getDataList();
this.clearSelectAll();
},
exportCustomData() {
this.loading = true;
if(this.showType == 1){ //
addLogisticsStation(this.form).then((res) => {
this.loading = false;
if (res.code == 200) {
this.$Message.success("保存成功");
this.getDataList();
}
});
}else if(this.showType == 2){ //
updateLogisticsStation(this.form).then((res) => {
this.loading = false;
if (res.code == 200) {
this.$Message.success("保存成功");
this.getDataList();
}
});
}
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
remove(v) {
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除该商品吗?",
loading: true,
onOk: () => {
deleteLogisticsStation({
id: v.id
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.clearSelectAll();
this.$Message.success("删除成功");
this.getDataList();
}
});
},
});
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
findAllRecords(v) {
this.tranVisiable = true;
console.log(v)
this.$nextTick(() => {
this.$refs.dialog.initRecharges(v);
});
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
addStation() {
this.form = {
circuitId:'',
stationName:'',
freightRules:'',
landingFeeRules:'',
deliveryFeeRules:''
}
this.showType = "1";
this.form.circuitId = this.searchForm.circuitId
this.stationModalVisible = true
},
edit(v) {
// null""
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
this.showType = "2";
this.stationModalVisible = true;
},
changeTableSize(v) {
this.tableSize = v;
},
exportData() {
this.$refs.table.exportCsv({
filename: "数据",
});
},
getDataList(params) {
this.loading = true;
//
getLogisticsStationPageList(this.searchForm).then((res) => {
debugger;
this.loading = false;
if (res.code == 200) {
this.data = res.result.records;
this.total = res.result.total;
if (this.data && this.data.length == 0 && this.searchForm.pageNum > 1) {
this.searchForm.pageNum -= 1;
this.getDataList();
}
}
});
},
},
mounted() {
//this.init();
},
};
</script>
<style lang="less">
//@import "@/styles/table-common.less";
</style>

1008
src/views/app/business/logiticsCompany/transferStation.vue

File diff suppressed because it is too large
Loading…
Cancel
Save