kongdeqiang
2023-03-14 a0654f2c21511a0e16b977427a563a3ccdfd1fba
src/views/your/area-manage/areaManage.vue
@@ -13,9 +13,9 @@
          openTip ? "关闭提示" : "开启提示"
        }}</Button>
        <Input
          v-model="searchForm.name"
          v-model="searchForm2.name"
          suffix="ios-search"
          @on-change="getDataList"
          @on-change="getDataList2"
          placeholder="输入配送地区搜索"
          clearable
          style="width: 250px"
@@ -66,9 +66,16 @@
        <FormItem label="片区描述" prop="description">
          <Input v-model="areaForm.description" />
        </FormItem>
        <FormItem label="配送员" prop="userId">
          <Select v-model="areaForm.userId" filterable>
            <Option v-for="item in userList" :value="item.id">{{ item.nickname }}</Option>
        <!--<FormItem label="配送员" prop="userId">-->
          <!--<Select v-model="areaForm.userId" filterable>-->
            <!--<Option :value="0" :key="0" selected>请选择</Option>-->
            <!--<Option v-for="item in userList" :value="item.id">{{ item.nickname }}</Option>-->
          <!--</Select>-->
        <!--</FormItem>-->
        <FormItem label="配送车辆" prop="carId">
          <Select v-model="areaForm.carId" filterable>
            <Option value="" key="" selected>请选择</Option>
            <Option v-for="item in carList" :value="item.id">{{ item.carNo }}</Option>
          </Select>
        </FormItem>
      </Form>
@@ -92,22 +99,21 @@
      <Row class="operation" style="padding-bottom: 20px">
        <Button @click="addCustomer" type="primary" icon="md-add">添加</Button>
        <Button @click="init" icon="md-refresh">刷新</Button>
        <Input v-model="searchForm.name" suffix="ios-search" @on-change="getCustList" placeholder="输入商户名称搜索" clearable style="width: 250px"
        <Input v-model="searchForm.customerName" suffix="ios-search" @on-change="getCustList" placeholder="输入商户名称搜索" clearable style="width: 250px"
        />
      </Row>
      <Table :loading="loading" border :columns="columns3" :data="data3" ref="table" style="height: 350px"
      <Table :loading="loading" border :columns="columns3" :data="data3" ref="table"
             sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect">
      </Table>
      <Row type="flex" justify="end" class="page">
        <Page :current="searchForm.pageNumber" :total="total2"
        <Page :current.sync="searchForm.pageNumber" :total="total2"
                :page-size="searchForm.pageSize"
                @on-change="changePage"
                @on-change="changePage1"
                @on-page-size-change="changePageSize"
                :page-size-opts="[10, 20, 50]"
                size="small"
                show-total
                show-elevator
                show-sizer
        ></Page>
      </Row>
    </Modal>
@@ -130,9 +136,9 @@
        <FormItem label="商户名称" prop="name">
          <Input v-model="customerForm.name" />
        </FormItem>
        <FormItem label="商户编号" prop="code">
          <Input v-model="customerForm.code" />
        </FormItem>
        <!--<FormItem label="商户编号" prop="code">-->
          <!--<Input v-model="customerForm.code" />-->
        <!--</FormItem>-->
        <Row :gutter="0">
          <Col span="12">
@@ -147,18 +153,18 @@
          </Col>
        </Row>
        <Row :gutter="0">
          <Col span="12">
            <Form-item label="上次配送日期" prop="lastTime">
              <Row>
                <Col>
                  <Date-picker @on-change="change1" type="date" value="yyyy-MM-dd" placeholder="选择日期" v-model="customerForm.lastTime"></Date-picker>
                </Col>
              </Row>
            </Form-item>
          </Col>
          <!--<Col span="12">-->
            <!--<Form-item label="上次配送日期" prop="lastTime">-->
              <!--<Row>-->
                <!--<Col>-->
                  <!--<Date-picker @on-change="change1" type="date" value="yyyy-MM-dd" placeholder="选择日期" v-model="customerForm.lastTime"></Date-picker>-->
                <!--</Col>-->
              <!--</Row>-->
            <!--</Form-item>-->
          <!--</Col>-->
          <Col span="12">
            <FormItem label="联系方式" prop="phone">
              <Input v-model="customerForm.phone" type="number"/>
              <Input v-model="customerForm.phone"/>
            </FormItem>
          </Col>
        </Row>
@@ -316,7 +322,16 @@
      modalTitle: "",
      modalTitle2: "",
      modalTitle3: "",
      carList:[],
      searchForm: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 10, // 页面大小
        sort: "createTime", // 默认排序字段
        order: "desc", // 默认排序方式
        key: "",
      },
      searchForm2: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 10, // 页面大小
@@ -327,7 +342,6 @@
      areaForm: {
      },
      customerForm: {
        kstatus : 1
      },
      areaSectionForm: {
      },
@@ -361,10 +375,13 @@
          title: "片区描述",
          key: "description",
          width: 442,
          render: (h, params) => {
            return h("div",params.row.description=="undefined" ? '':params.row.description);
          }
        },
        {
          title: "配送人",
          key: "nickName",
          title: "配送车辆",
          key: "carNo",
          width: 200,
        },
        {
@@ -440,7 +457,6 @@
          title: "操作",
          key: "action",
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
@@ -504,56 +520,46 @@
        {
          title: "商户名称",
          key: "name",
          width: 100,
          tooltip:true,
          width: 200,
        },
        {
          title: "商户编号",
          key: "code",
          minWidth: 120,
          key: "licence",
          minWidth: 140,
        },
        {
          title: "联系方式",
          key: "phone",
          width: 140,
          width: 135,
        },
        {
          title: "状态",
          key: "status",
          width:100,
          sortable: true,
          render: (h, params) => {
            let re = "";
            if (params.row.status == 0) {
              return h("div", [
                h("Badge", {
                  props: {
                    status: "success",
                    text: "正常",
                  },
                }),
              ]);
            } else if (params.row.status == 1) {
              return h("div", [
                h("Badge", {
                  props: {
                    status: "error",
                    text: "不活跃",
                  },
                }),
              ]);
            }
          },
        },
        {
          title: "上次配送日期",
          key: "lastTime",
          width: 150,
        },
        {
          title: "商户注册地址",
          key: "registeredAddress",
          width: 180,
        },
        // {
        //   title: "状态",
        //   key: "status",
        //   width:100,
        //   render: (h, params) => {
        //     let re = "";
        //     if (params.row.status == 0) {
        //       return h("div", [
        //         h("Badge", {
        //           props: {
        //             status: "success",
        //             text: "正常",
        //           },
        //         }),
        //       ]);
        //     } else if (params.row.status == 1) {
        //       return h("div", [
        //         h("Badge", {
        //           props: {
        //             status: "error",
        //             text: "不活跃",
        //           },
        //         }),
        //       ]);
        //     }
        //   },
        // },
        {
          title: "联系人",
          key: "linker",
@@ -676,6 +682,10 @@
      this.getDataList();
      this.clearSelectAll();
    },
    changePage1(v) {
      this.searchForm.pageNumber = v;
      this.getCustomerList(this.areaSectionId);
    },
    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.getDataList();
@@ -698,8 +708,19 @@
        }
      });
    },
    getDataList2() {
      this.loading = true;
      getArea(this.searchForm2).then((res) => {
        this.loading = false;
        if (res.success) {
          this.data = res.result.records;
          this.total = res.result.total;
        }
      });
    },
    getCustList() {
      this.loading = true;
      this.searchForm.pageNumber=1;
      getCustomer(this.searchForm).then((res) => {
        this.loading = false;
        if (res.success) {
@@ -707,11 +728,19 @@
          this.total2 = res.result.total;
        }
      });
      this.$emit('update:current',this.searchForm.pageNumber);
    },
    getAllUser(){
      getDriver(this.type).then((res)=>{
      getDriver({type:1}).then((res)=>{
        if (res.success){
          this.userList=res.result;
        }
      });
    },
    getAllCar(){
      getAll().then((res)=>{
        if (res.success){
          this.carList=res.result;
        }
      });
    },
@@ -719,6 +748,16 @@
      this.loading = true;
      this.searchForm.areaId=areaId;
      getAreaSection(this.searchForm).then((res) => {
        this.loading = false;
        if (res.success) {
          this.data2 = res.result.records;
        }
      });
    },
    getAreaSectionList2(areaId) {
      this.loading = true;
      this.searchForm2.areaId=areaId;
      getAreaSection(this.searchForm2).then((res) => {
        this.loading = false;
        if (res.success) {
          this.data2 = res.result.records;
@@ -764,6 +803,15 @@
      this.roleModalVisible = false;
    },
    submitArea() {
      if(this.areaForm.userId==undefined){
        this.areaForm.userId=0;
      }
      if(this.areaForm.description==undefined){
        this.areaForm.description="";
      }
      if(this.areaForm.carId==undefined){
        this.areaForm.carId="";
      }
      this.$refs.areaForm.validate((valid) => {
        if (valid) {
          if (this.modalType == 0) {
@@ -775,16 +823,19 @@
                this.$Message.success("操作成功");
                this.getDataList();
                this.roleModalVisible = false;
                this.areaForm={};
              }
            });
          } else {
            this.submitLoading = true;
            this.$delete(this.areaForm,'children')
            addArea(this.areaForm).then((res) => {
              this.submitLoading = false;
              if (res.success) {
                this.$Message.success("操作成功");
                this.getDataList();
                this.roleModalVisible = false;
                this.areaForm={};
              }
            });
          }
@@ -793,14 +844,16 @@
    },
    submitCustomer() {
      this.$refs.areaSectionForm.validate((valid) => {
        this.customerForm.lastTime = this.lastTime;
        //this.customerForm.lastTime = this.lastTime;
        this.customerForm.areaSectionId = this.areaSectionId;
        this.customerForm.areaId = this.areaId;
        this.customerForm.kstatus = 1;
        if (valid) {
            this.$delete(this.customerForm,'receives')
          if (this.modalType == 0) {
            // 添加
            this.submitLoading = true;
            this.customerForm.kstatus = 0;
            addCustomer(this.customerForm).then((res) => {
              this.submitLoading = false;
              if (res.success) {
@@ -871,7 +924,7 @@
    },
    equipment(row) {
      this.areaId = row.id
      this.getAreaSectionList(row.id);
      this.getAreaSectionList2(row.id);
      this.modalType = 0;
      this.modalTitle2 = "片区段信息";
      this.$refs.areaForm.resetFields();
@@ -886,9 +939,11 @@
      this.$refs.areaForm.resetFields();
      delete this.areaForm.id;
      this.customerVisible = true;
      console.log(this.areaSectionId);
    },
    addCar() {
      this.getAllUser();
      //this.getAllUser();
      this.getAllCar();
      this.modalType = 0;
      this.modalTitle = "添加";
      this.$refs.areaForm.resetFields();
@@ -912,7 +967,8 @@
      this.addCustomerVisible = true;
    },
    edit(v) {
      this.getAllUser();
      //this.getAllUser();
      this.getAllCar()
      this.modalType = 1;
      this.modalTitle = "编辑";
      this.$refs.areaForm.resetFields();
@@ -925,6 +981,7 @@
      let str = JSON.stringify(v);
      let roleInfo = JSON.parse(str);
      this.areaForm = roleInfo;
      console.log(this.areaForm);
      this.roleModalVisible = true;
    },
    editEquipment(v) {
@@ -1303,4 +1360,4 @@
    this.init();
  },
};
</script>
</script>