浏览代码

达达增加打印二维码开关

zangbin 3 年之前
父节点
当前提交
57146c85d0

+ 4 - 0
lb-app/src/main/java/com/ydd/app/service/impl/ApiShopServiceImpl.java

@@ -153,6 +153,10 @@ public class ApiShopServiceImpl implements ApiShopService {
         shop.setBizLicenseIdcard(shopReq.getBizLicenseIdcard());
         shop.setFoodLicensePic(shopReq.getFoodLicensePic());
         shop.setPoiAddress(shopReq.getPoiAddress());
+        // 如果商家打印二维码开启,新增门店也打开
+        if (merchant.getOpenQrCode() == 1) {
+          shop.setOpenQrCode(1);
+        }
         iShopService.save(shop);
         //绑定最新门店到账户
 //        member.setShopId(shop.getId());

+ 5 - 0
lb-module/src/main/java/com/ydd/module/domain/DadaDsp.java

@@ -100,4 +100,9 @@ public class DadaDsp implements Serializable {
     @Version
     private Integer version;
 
+    /**
+     * 打印二维码:1->打印,0->不打印
+     */
+    private Integer openQrCode;
+
 }

+ 5 - 0
lb-module/src/main/java/com/ydd/module/domain/Merchant.java

@@ -230,6 +230,11 @@ private static final long serialVersionUID=1L;
     @TableField(exist = false)
     private Date endTime;
 
+    /**
+     * 打印二维码:1->打印,0->不打印
+     */
+    private Integer openQrCode;
+
     @TableField(exist = false)
     private Integer merchantId;
 

+ 5 - 0
lb-module/src/main/java/com/ydd/module/dto/DadaDspDto.java

@@ -87,4 +87,9 @@ public class DadaDspDto {
      */
     private String endTime;
 
+    /**
+     * 打印二维码:1->打印,0->不打印
+     */
+    private Integer openQrCode;
+
 }

+ 5 - 0
lb-module/src/main/java/com/ydd/module/dto/DadaDspMerchantInfoDto.java

@@ -118,4 +118,9 @@ public class DadaDspMerchantInfoDto {
      */
     private String idcardNo;
 
+    /**
+     * 打印二维码:1->打印,0->不打印
+     */
+    private Integer openQrCode;
+
 }

+ 5 - 0
lb-module/src/main/java/com/ydd/module/dto/ShopDto.java

@@ -33,4 +33,9 @@ public class ShopDto extends Shop {
 
     private Integer isPic;
 
+    /**
+     * 打印二维码类型:1->达达配送商  2->商家  3->门店
+     */
+    private Integer qrCodeType;
+
 }

+ 6 - 0
lb-module/src/main/java/com/ydd/module/service/IShopService.java

@@ -175,4 +175,10 @@ public interface IShopService extends IService<Shop> {
      */
     List<ShopSelectDto> findShopSelectList(Member member);
 
+    /**
+     * 打印二维码状态修改
+     * @param shopDto 请求参数
+     * @return 修改结果
+     */
+    boolean updateQrCodeStatus(ShopDto shopDto);
 }

+ 52 - 0
lb-module/src/main/java/com/ydd/module/service/impl/ShopServiceImpl.java

@@ -83,6 +83,9 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IS
     private IDspDeliveryService iDspDeliveryService;
 
     @Resource
+    private IDadaDspService iDadaDspService;
+
+    @Resource
     private DeliveryService deliveryClient;
 
     @Override
@@ -811,4 +814,53 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements IS
         return baseMapper.findShopSelectList(member);
     }
 
+    @Override
+    public boolean updateQrCodeStatus(ShopDto shopDto) {
+      if (shopDto.getQrCodeType() == 1) {
+        DadaDsp dadaDsp = iDadaDspService.getById(shopDto.getId());
+        dadaDsp.setOpenQrCode(shopDto.getOpenQrCode());
+        iDadaDspService.updateById(dadaDsp);
+
+        List<Merchant> merchantList = iMerchantService.list(new QueryWrapper<Merchant>().eq("deleted", 0).eq("dada_dsp_id", shopDto.getId()));
+        if (merchantList != null && !merchantList.isEmpty()) {
+            merchantList.forEach(merchant -> {
+              merchant.setOpenQrCode(shopDto.getOpenQrCode());
+            });
+            iMerchantService.saveOrUpdateBatch(merchantList);
+
+          List<Long> merchantIds = merchantList.stream().map(Merchant::getId).collect(Collectors.toList());
+          List<Shop> shopList = baseMapper.selectList(new QueryWrapper<Shop>().eq("deleted", 0).in("merchant_id", merchantIds));
+          if (shopList != null && !shopList.isEmpty()) {
+            shopList.forEach(shop -> {
+              shop.setOpenQrCode(shopDto.getOpenQrCode());
+              baseMapper.updateById(shop);
+            });
+          }else {
+            throw new CustomException("门店为空,操作失败!");
+          }
+        }else {
+          throw new CustomException("商户为空,操作失败!");
+        }
+      }else if (shopDto.getQrCodeType() == 2) {
+        Merchant merchant = iMerchantService.getById(shopDto.getId());
+        merchant.setOpenQrCode(shopDto.getOpenQrCode());
+        iMerchantService.updateById(merchant);
+
+        List<Shop> shopList = baseMapper.selectList(new QueryWrapper<Shop>().eq("deleted", 0).eq("merchant_id", shopDto.getId()));
+        if (shopList != null && !shopList.isEmpty()) {
+          shopList.forEach(shop -> {
+            shop.setOpenQrCode(shopDto.getOpenQrCode());
+            baseMapper.updateById(shop);
+          });
+        }else {
+          throw new CustomException("门店为空,操作失败!");
+        }
+      }else if (shopDto.getQrCodeType() == 3) {
+        Shop oldShop = baseMapper.selectById(shopDto.getId());
+        oldShop.setOpenQrCode(shopDto.getOpenQrCode());
+        baseMapper.updateById(oldShop);
+      }
+      return true;
+    }
+
 }

+ 1 - 0
lb-module/src/main/resources/mapper/module/DadaDspMapper.xml

@@ -22,6 +22,7 @@
             dd.status,
             dd.qr_code,
             dd.remark,
+            dd.open_qr_code,
             u.user_name
         FROM lb_dada_dsp dd
         LEFT JOIN sys_user u

+ 1 - 0
lb-module/src/main/resources/mapper/module/merchantMapper.xml

@@ -236,6 +236,7 @@
             mc.create_time,
             mc.merchant_type,
             mc.freight_package_id,
+            mc.open_qr_code,
             dd.name as dspName,
             lm.amount as accountAmount,
             pf.name as freightPackageName

+ 12 - 0
lb-web/src/main/java/com/ydd/web/controller/ShopController.java

@@ -5,6 +5,7 @@ import java.util.Arrays;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ydd.common.core.domain.entity.SysUser;
+import com.ydd.module.dto.ShopDto;
 import com.ydd.module.enums.StatusEnum;
 import com.ydd.module.request.ShopBindRulePackageRequest;
 import lombok.RequiredArgsConstructor;
@@ -164,4 +165,15 @@ public class ShopController extends BaseController {
         return Result.success();
     }
 
+    /**
+     * 打印二维码状态修改
+     */
+//    @PreAuthorize("@ss.hasPermi('system:user:edit')")
+    @Log(title = "打印二维码状态修改", businessType = BusinessType.UPDATE)
+    @PutMapping("/changeQrCode")
+    public Result changeQrCode(@RequestBody ShopDto shopDto)
+    {
+        return toAjax(iShopService.updateQrCodeStatus(shopDto) ? 1 : 0);
+    }
+
 }

+ 14 - 0
web-ui/src/api/module/shop.js

@@ -67,4 +67,18 @@ export function listShopWaimai(query) {
     method: 'get',
     params: query
   })
+}
+
+// 打印二维码状态修改
+export function changeQrCode(id, openQrCode, qrCodeType) {
+  const data = {
+    id,
+    openQrCode,
+    qrCodeType
+  }
+  return request({
+    url: '/module/shop/changeQrCode',
+    method: 'put',
+    data: data
+  })
 }

+ 510 - 0
web-ui/src/views/module/dadaDsp/index.vue

@@ -0,0 +1,510 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
+      <el-form-item label="配送商名称" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入配送商名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="联系人" prop="contactName">
+        <el-input
+          v-model="queryParams.contactName"
+          placeholder="请输入联系人"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="手机号" prop="mobile">
+        <el-input
+          v-model="queryParams.mobile"
+          placeholder="请输入手机号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="服务商角色" prop="dspRole">
+        <el-select v-model="queryParams.dspRole" placeholder="请选择服务商角色" clearable >
+          <el-option
+              v-for="item in dspRoleList"
+              :key="item.value"
+              :label="item.name"
+              :value="item.value"
+            ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker v-model="date" type="datetimerange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
+          :default-time="['00:00:00', '23:59:59']" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search"  @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh"  @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          v-if="this.userType == 3"
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          @click="handleAdd"
+        >新增</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="dadaDspList" stripe border highlight-current-row style="width: 100%">
+      <el-table-column label="配送商名称" align="center" prop="name" />
+      <el-table-column label="联系人" align="center" prop="contactName" />
+      <el-table-column label="手机号" align="center" prop="mobile" />
+      <el-table-column label="账号" align="center" prop="userName" />
+      <el-table-column label="所在地区" align="center" prop="districtName">
+          <template slot-scope="scope">
+              <span>
+                  {{scope.row.provinceName}}{{scope.row.cityName}}{{scope.row.districtName}}
+              </span>
+          </template>
+      </el-table-column>
+      <el-table-column label="二维码" align="center" prop="qrCode" >
+        <template slot-scope="scope">
+         <img style="width: 50px;height: 50px" :src="scope.row.qrCode">
+        </template>
+      </el-table-column>
+      <el-table-column label="角色" align="center" prop="dspRole">
+          <template slot-scope="scope">
+            <span v-if="scope.row.dspRole == 0">配送服务商</span>
+            <span v-if="scope.row.dspRole == 1">配送服务商(收付)</span>
+          </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime" />
+      <el-table-column label="打印二维码" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-switch 
+            v-model="scope.row.openQrCode"
+            @change="updateQrCode(scope.row)" 
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            :active-value="1"
+            :inactive-value="0"
+            ></el-switch>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="gotoInfo(scope.row.id)"
+          >详情</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+          >修改</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改配送服务商对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="230px">
+        <el-form-item label="配送商名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入配送商名称" style="width:450px" />
+        </el-form-item>
+        <el-form-item label="联系人" prop="contactName">
+          <el-input v-model="form.contactName" placeholder="请输入联系人" style="width:250px" />
+        </el-form-item>
+        <el-form-item label="联系手机" prop="mobile">
+          <el-input v-model="form.mobile" placeholder="请输入联系手机" style="width:250px" />
+        </el-form-item>
+        <el-form-item label="角色" prop="dspRole">
+          <el-select v-model="form.dspRole" placeholder="请选择服务商角色" clearable >
+            <el-option
+                v-for="item in dspRoleList"
+                :key="item.value"
+                :label="item.name"
+                :value="item.value"
+              ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="所在地区">
+          <span style="color: #f56c6c;float: left;position: absolute;left: -77px;">*</span>
+          <Area :provinceAndCity="areaProp" @changeArea="changeArea" ref="area"/>
+        </el-form-item>
+        <el-form-item label="登录账号" prop="userName">
+          <el-input v-model="form.userName" placeholder="请输入登录账号" maxlength="50" style="width:450px" />
+        </el-form-item> 
+        <el-form-item label="密码" prop="password">
+          <el-input placeholder="请输入密码" v-model="form.password" maxlength="50" v-if="this.addFlag == 1" style="width:450px" />
+          <el-input placeholder="为空时不修改密码" v-model="form.password" maxlength="50" v-if="this.addFlag == 0" style="width:450px" />
+        </el-form-item> 
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" style="width:450px" />
+        </el-form-item> 
+      </el-form>
+      <div slot="footer" class="dialog-footer" style="text-align: center;">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listDadaDsp, getDadaDsp, delDadaDsp, addDadaDsp, updateDadaDsp, exportDadaDsp } from "@/api/module/dadaDsp";
+import Area from '@/components/area';
+import area from "@/api/city";
+import OldSend from '@/components/area/oldSend';
+import { changeQrCode } from '@/api/module/shop';
+
+export default {
+  name: "DadaDsp",
+  components: {
+    Area,
+    OldSend
+  },
+  data() {
+    return {
+      date:[],
+      // 登录用户
+      user: {},
+      dspRoleList: [
+          {
+              value: 0,
+              name: '配送服务商'
+          },{
+              value: 1,
+              name: '配送服务商(收付)'
+          }
+      ],
+      areaProp: {},
+      startArea: {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      },
+      sendAreaProp: {},
+      sendStartArea: {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      },
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 服务商表格数据
+      dadaDspList: [],
+      // 弹出层标题
+      title: "",
+      // 登录用户类型
+      userType: undefined,
+      // 是否显示弹出层
+      open: false,
+      // 新增标识
+      addFlag: undefined,
+      // 打印二维码类型
+      qrCodeType: 1,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: undefined,
+        provinceId: undefined,
+        cityId: undefined,
+        districtId: undefined,
+        dspRole: undefined,
+        contactName: undefined,
+        mobile: undefined,
+        startTime: undefined,
+        endTime: undefined,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        name: [
+          { required: true, message: "配送服务商名称不能为空", trigger: "blur" }
+        ],
+        dspRole: [
+          { required: true, message: "角色不能为空", trigger: "blur" }
+        ],
+        provinceId: [
+          { required: true, message: "所在省不能为空", trigger: "blur" }
+        ],
+        cityId: [
+          { required: true, message: "所在城市不能为空", trigger: "blur" }
+        ],
+        districtId: [
+          { required: true, message: "所在区不能为空", trigger: "blur" }
+        ],
+        contactName: [
+          { required: true, message: "联系人不能为空", trigger: "blur" }
+        ],
+        mobile: [
+          { required: true, message: "联系手机不能为空", trigger: "blur" }
+        ],
+        userName: [
+          { required: true, message: "登录账号不能为空", trigger: "blur" }
+        ]
+      }
+    };
+  },
+  created() {
+    // 配送服务商登录跳转到配送服务商详情
+    this.user = {type: '',name: ''}
+    this.userType = localStorage.getItem("SYS_USER_TYPE")
+    if (this.user.type == 4){
+      this.$router.push({ path: '/dadaDsp/dadaDsp/info' })
+    } else {
+      // this.getUser()
+      // alert(this.user.type)
+    }
+
+    this.getList();
+  },
+  methods: {
+    updateQrCode(row) {
+      console.log('row', row)
+      var qrCodeType = this.qrCodeType
+      let text = row.openQrCode === 1 ? "启用" : "停用";
+      this.$confirm('确认要"' + text + '""' + row.name + '"达达配送服务商吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return changeQrCode(row.id, row.openQrCode, qrCodeType);       
+      }).then(() => {
+         this.msgSuccess(text + "成功");
+      }).catch(function () {
+        row.openQrCode = row.openQrCode === 1 ? 0: 1;
+      });
+    },
+
+    changeSendArea(e) {
+      this.sendStartArea = e
+    },
+
+    gotoInfo(id){
+      this.$router.push({ path: '/dadaDsp/dadaDsp/info', query: { id: id } })
+    },
+    // 选择区域
+    changeArea (e) {
+      this.startArea = e
+    },
+    /** 查询配送服务商列表 */
+    getList() {
+      if (this.user.type == 4){
+        this.$router.push({ path: '/dadaDsp/dadaDsp/info' })
+      }
+      this.loading = true;
+      if (this.date !== null && this.date !== "") {
+        if (this.date[0] !== undefined) {
+          this.queryParams.startTime = this.date[0];
+          this.queryParams.endTime = this.date[1];
+        }
+      } else {
+        this.queryParams.startTime = "";
+        this.queryParams.endTime = "";
+      }
+      listDadaDsp(this.queryParams).then(response => {
+        this.dadaDspList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: undefined,
+        name: undefined,
+        provinceId: undefined,
+        cityId: undefined,
+        districtId: undefined,
+        dspRole: undefined,
+        contactName: undefined,
+        mobile: undefined,
+        address: undefined,
+        provinceName: undefined,
+        cityName: undefined,
+        districtName: undefined,
+        remark: undefined,
+        userName: undefined,
+        password: undefined
+      };
+      this.resetForm("form");
+      this.startArea = {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      };
+      this.areaProp = {}
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.queryParams.provinceName = this.sendStartArea.provinceName
+      this.queryParams.cityName = this.sendStartArea.cityName
+      this.queryParams.districtName = this.sendStartArea.districtName
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.sendStartArea = {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      };
+      this.sendAreaProp = {}
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.addFlag = 1;
+      this.open = true;
+      this.title = "添加配送服务商";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      this.addFlag = 0;
+      const id = row.id || this.ids
+      getDadaDsp(id).then(response => {
+        this.form = response.data;
+        this.startArea.province = response.data.provinceId
+        this.startArea.district = response.data.districtId
+        this.startArea.city = response.data.cityId
+
+        this.startArea.provinceName = response.data.provinceName
+        this.startArea.cityName = response.data.cityName
+        this.startArea.districtName = response.data.districtName
+
+        this.startArea.district = this.startArea.district.split(",");
+        area.area.forEach(v => {
+          if (v.id === this.startArea.province) {
+            this.startArea.cityValues = v.childs
+          }
+        })
+        this.startArea.cityValues.forEach(v =>{
+          if (v.id === this.startArea.city) {
+            this.startArea.districtValues = v.childs
+          }
+        })
+        this.areaProp = JSON.parse(JSON.stringify(this.startArea))
+        this.open = true;
+        this.title = "修改配送服务商";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          console.log("===========", this.startArea);
+          if (!this.startArea.province || !this.startArea.city || !this.startArea.district) {
+            this.$message({
+              message: '请选择地区',
+              type: 'error',
+              duration: 1500
+            })
+            return
+          }
+          console.log(this.form)
+          this.form.provinceId = this.startArea.province
+          this.form.cityId = this.startArea.city
+          this.form.districtId = this.startArea.district.join(",")
+          this.form.provinceName = this.startArea.provinceName
+          this.form.cityName = this.startArea.cityName
+          this.form.districtName = this.startArea.districtName
+          if (this.form.id != null) {
+            updateDadaDsp(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addDadaDsp(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除配送服务商编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delDadaDsp(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+  }
+};
+</script>

+ 987 - 0
web-ui/src/views/module/dadaDspMerchant/index.vue

@@ -0,0 +1,987 @@
+<template>
+  <div class="app-container">
+    <!-- <el-card style="margin-bottom: 20px" class="box-card" v-if="this.dadaDspId">
+      <div>
+        <div class="dada_dsp_info_top">
+          <span> 配送商名称:{{ dataForm.name }}</span>
+        </div>
+        <div class="dada_dsp_info_top">
+          <span> 联系人: {{ dataForm.contactName }}</span>
+        </div>
+        <div class="dada_dsp_info_top">
+          <span> 归属: 达达</span>
+        </div>
+      </div>
+
+      <div style="margin-top: 15px">
+        <div class="dada_dsp_info_top"><span> 二维码: <img @click="showImages(dataForm.qrCode)" :src="dataForm.qrCode" style="display: block; max-width: 100%; margin: 0 auto;margin-top: -11%; height: 50px; width: 50px; margin-left: 22%;cursor:pointer"></span></div>
+      </div>
+
+      <div style="margin-top: 15px">
+        <div class="dada_dsp_info_top">
+          <span> 联系电话: {{ dataForm.mobile }}</span>
+        </div>
+        <div class="dada_dsp_info_top">
+          <span>
+            所在地区: {{ dataForm.provinceName }} >> {{ dataForm.cityName }} >>
+            {{ dataForm.districtName }}</span
+          >
+        </div>
+      </div>
+    </el-card> -->
+    <div style="flex: 1;padding-bottom: 25px;">
+    <el-form ref="dataForm" :model="form" :rules="rules" v-if="this.dadaDspId">
+      <div>
+        <div class="dada_dsp_info_top">
+          <span> 配送商名称:{{ dataForm.name }}</span>
+        </div>
+        <div class="dada_dsp_info_top">
+          <span> 联系人: {{ dataForm.contactName }}</span>
+        </div>
+        <div class="dada_dsp_info_top">
+          <span> 归属: 达达</span>
+        </div>
+      </div>
+
+      <div style="margin-top: 15px">
+        <div class="dada_dsp_info_top"><span> 二维码: <img @click="showImages(dataForm.qrCode)" :src="dataForm.qrCode" style="display: block; max-width: 100%; margin: 0 auto;margin-top: -11%; height: 50px; width: 50px; margin-left: 22%;cursor:pointer"></span></div>
+      </div>
+
+      <div style="margin-top: 15px">
+        <div class="dada_dsp_info_top">
+          <span> 联系电话: {{ dataForm.mobile }}</span>
+        </div>
+        <div class="dada_dsp_info_top">
+          <span>
+            所在地区: {{ dataForm.provinceName }} >> {{ dataForm.cityName }} >>
+            {{ dataForm.districtName }}</span
+          >
+        </div>
+      </div>
+    </el-form>
+    </div>
+
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
+      <el-form-item label="商户名称" prop="merchantName">
+        <el-input
+          v-model="queryParams.merchantName"
+          placeholder="请输入商户名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="联系人" prop="contactName">
+        <el-input
+          v-model="queryParams.contactName"
+          placeholder="请输入联系人"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="联系手机" prop="mobile">
+        <el-input
+          v-model="queryParams.mobile"
+          placeholder="请输入联系手机"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="商家类型" prop="type">
+        <el-select v-model="queryParams.merchantType" placeholder="请选择商家类型" clearable >
+          <el-option v-for="item in merchantTypeOption" :key="item.value" :label="item.label" :value="item.value" />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="运费包" prop="freightPackageId" v-if="this.userType == 4">
+        <el-select v-model="queryParams.freightPackageId" placeholder="请选择运费包" filterable clearable >
+          <el-option v-for="item in filterPackageFreightList" :key="item.id" :value="item.id" :label="item.name"/>
+        </el-select>
+      </el-form-item>
+        <el-form-item label="余额(元)" prop="amountStart">
+        <el-input v-model.number="queryParams.amountStart" @keyup.enter.native="handleQuery" clearable></el-input>
+      </el-form-item>
+      <el-form-item label="~" label-width="10px" prop="amountEnd">
+        <el-input v-model.number="queryParams.amountEnd" @keyup.enter.native="handleQuery" clearable></el-input>
+      </el-form-item>
+
+      <el-form-item label="创建时间" prop="createTime">
+        <el-date-picker v-model="date" type="datetimerange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间"
+          :default-time="['00:00:00', '23:59:59']" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search"  @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh"  @click="resetQuery">重置</el-button>
+        <!-- <el-button icon="el-icon-download" @click="handleExport()" type="primary">导出</el-button> -->
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          v-if="this.userType == 4 || this.userType == 5"
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          @click="handleAdd"
+        >新增</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="merchantList" @selection-change="handleSelectionChange" stripe border highlight-current-row style="width: 100%">
+      <el-table-column label="商家名称" align="center" prop="merchantName" />
+      <el-table-column label="联系人/电话" align="center" prop="merchantName">
+        <template slot-scope="scope">
+          <span>{{scope.row.contactName}} / {{scope.row.contactMobile}}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="所属配送商" align="center" prop="dspName" />
+      <el-table-column label="商家类型" align="center" prop="merchantType">
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.merchantType == 1">单店</el-tag>
+          <el-tag type="success" v-if="scope.row.merchantType == 2">连锁店</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime" />
+      <el-table-column label="账户余额" align="center" prop="accountAmount" />
+      <el-table-column label="运费包类型" align="center" v-if="this.userType == 4">
+        <template slot-scope="scope">
+          <span>{{ scope.row.dimensionName || '- -' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="运费包" align="center" v-if="this.userType == 4">
+      <template slot-scope="scope">
+          <span>{{ scope.row.freightPackageName || '- -' }}</span>
+        </template>
+    </el-table-column>
+      <!-- <el-table-column label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-switch @change="updateStatus(scope.row.id,scope.row.status)" :active-value="2" :inactive-value="0"
+            v-model="scope.row.status" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
+        </template>
+      </el-table-column> -->
+      <el-table-column label="打印二维码" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-switch 
+            v-model="scope.row.openQrCode"
+            @change="updateQrCode(scope.row)" 
+            active-color="#13ce66"
+            inactive-color="#ff4949"
+            active-value="1"
+            inactive-value="0"
+            ></el-switch>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+          v-if="userType == 4 || userType == 5"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="gotoInfo(scope.row)"
+          >详情</el-button>
+          <el-button
+            v-if="userType == 4"
+            size="mini"
+            type="text"
+            @click="handleDelivery(scope.row.id)"
+          >绑定运费包</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改客户商家对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body close="close">
+      <el-form ref="form" :model="form" :rules="rules" label-width="140px">
+        <el-tabs v-model="activeName" type="card">
+          <el-tab-pane label="主要信息" name="first">
+            <el-form-item label="商家名称" prop="merchantName">
+              <el-input style="width:300px" v-model="form.merchantName" placeholder="请输入商家名称" />
+            </el-form-item>
+            <el-form-item label="代理商"  v-if="user.type == 1">
+              <el-select v-model="form.agentId" placeholder="请选择" filterable @change="changeAgent" clearable>
+                <el-option v-for="item in agentOption" :key="item.id" :label="item.name" :value="item.id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="达达配送服务商"  v-if="user.type == 1">
+              <el-select v-model="form.dadaDspId" placeholder="请选择" filterable @change="changeAgent" clearable>
+                <el-option v-for="item in dadaDspOption" :key="item.id" :label="item.name" :value="item.id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="所属员工"  v-if="user.type == 1">
+              <el-select v-model="form.personnelId" placeholder="请选择" filterable clearable>
+                <el-option v-for="item in personnelOption" :key="item.id" :label="item.name" :value="item.id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="所在地区">
+              <span style="color: #f56c6c;float: left;position: absolute;left: -77px;">*</span>
+              <Area :areaProp="areaProp" @changeArea="changeArea" ref="area"/>
+            </el-form-item>
+            <el-form-item label="详细地址" prop="address">
+              <el-input style="width:500px" v-model="form.address" placeholder="请输入商家地址" />
+            </el-form-item>
+             <el-form-item label="门牌号" prop="street">
+              <el-input style="width:500px" v-model="form.street" placeholder="请输入门牌号" />
+            </el-form-item>
+            <el-form-item label="商家类型" prop="merchantType">
+              <el-radio-group v-model="form.merchantType">
+                <el-radio :label="1">单店</el-radio>
+                <el-radio :label="2">连锁店</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item label="商户营业执照类型" prop="licenseType">
+              <el-select v-model="form.licenseType" placeholder="商户营业执照类型" clearable >
+                <el-option
+                    v-for="item in licenseTypeOption"
+                    :key="item.value"
+                    :label="item.name"
+                    :value="item.value"
+                  ></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="商家分类" prop="categoryId">
+              <el-select v-model="form.categoryId" placeholder="商家分类" clearable >
+                <el-option
+                    v-for="item in merchantCategoryList"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  ></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="联系人名称" prop="contactName">
+              <el-input style="width:300px" v-model="form.contactName" placeholder="请输入联系人名称" />
+            </el-form-item>
+            <el-form-item label="手机号码" prop="contactMobile">
+              <span style="color: #f56c6c;float: left;position: absolute;left: -77px;">*</span>
+              <el-input style="width:300px" v-model="form.contactMobile" placeholder="请输入手机号码" />
+            </el-form-item>
+            <el-form-item label="法人姓名" prop="legalPerson">
+              <el-input style="width:300px" v-model="form.legalPerson" placeholder="请输入法人姓名" />
+            </el-form-item>
+            <el-form-item label="身份证号码" prop="idcardNo">
+              <el-input style="width:300px" v-model="form.idcardNo" placeholder="请输入身份证号码" maxlength="18" />
+            </el-form-item>
+          </el-tab-pane>
+        </el-tabs>
+
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm" v-if="this.userType == 4 || this.userType == 5">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog title="绑定运费包" :visible.sync="packageRequestOpen" width="700px" append-to-body>
+      <el-form ref="packageRequest" :model="packageRequest" :rules="packageRequestRules" label-width="130px">
+        <el-form-item label="选择包" prop="packageId">
+          <el-select v-model="packageRequest.packageId" placeholder="请选择运费包" filterable clearable>
+                <el-option v-for="item in this.packageFreightList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+            </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFormPackage">确 定</el-button>
+        <el-button @click="cancelPackage">取 消</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :visible.sync="images" title="预览配送商二维码" width="30%" append-to-body>
+      <img :src="value" style="display: block; max-width: 100%; margin: 0 auto;">
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { delMerchant, exportMerchant, getMerchantCategoryList } from "@/api/module/merchant";
+import { getDadaDsp, listDadaMerchant } from "@/api/module/dadaDsp";
+import { addMerchant, getDadaMerchant, listPackageFreight, filterListPackageFreight, updateMerchant } from "@/api/module/dadaDspMerchant";
+import Area from '@/components/area/oldArea'
+import area from '@/api/oldCity'
+import wditor from '@/components/Wditor';
+import user from '@/store/modules/user'
+import OldSend from '@/components/area/oldSend'
+import { getPersonnelByAgent } from "@/api/module/personnel";
+import { changeQrCode } from '@/api/module/shop';
+
+
+export default {
+  name: "Merchant",
+  components: {
+    Area,
+    wditor,
+    OldSend
+  },
+  data() {
+    return {
+      value:undefined,
+      images: false,
+      // 开关
+      date:[],
+      agentList: [],
+      personnelList: [],
+      personnelOption: [],
+      activeName: 'first',
+      merchantTypeOption:[{
+        value: 1,
+        label:'单店'
+      },{
+        value:2,
+        label:'连锁店'
+      }],
+      merchantCategoryList: [],
+      licenseTypeOption: [{
+        value: 1,
+        name: '个体'
+      },{
+        value: 3,
+        name: '公司'
+      }],
+      areaProp: {},
+      startArea: {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      },
+      sendAreaProp: {},
+      sendStartArea: {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      },
+      user: {},
+      dadaDspId: '',
+      agentOption: [],
+      dadaDspOption: [],
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 客户商家表格数据
+      merchantList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 登录用户类型
+      userType: undefined,
+      // 打印二维码类型
+      qrCodeType: 2,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        merchantName: undefined,
+        agentId: undefined,
+        provinceId: undefined,
+        cityId: undefined,
+        districtId: undefined,
+        merchantType: undefined,
+        licenseType: undefined,
+        categoryId: undefined,
+        logo: undefined,
+        contactName: undefined,
+        contactMobile: undefined,
+        intro: undefined,
+        photoAlbum: undefined,
+        bizLicense: undefined,
+        bizLicenseNo: undefined,
+        legalPerson: undefined,
+        idcardNo: undefined,
+        idcardFront: undefined,
+        idcardBack: undefined,
+        lng: undefined,
+        lat: undefined,
+        address: undefined,
+        errorMsg: undefined,
+        status: undefined,
+        memberName: undefined,
+        memberMobile: undefined,
+        aId: undefined,
+        bindDeliveryAmount: undefined,
+        personnelName: undefined,
+        personnelId: undefined,
+        dadaDspId: undefined,
+        startTime: undefined,
+        endTime: undefined,
+        freightPackageId: undefined,
+        amountStart: undefined,
+        amountEnd: undefined,
+        merchantType: undefined
+      },
+      exportParams: {
+      },
+      packageRequest: {
+        packageType: undefined,
+        packageId: undefined,
+        merchantId: undefined
+      },
+      packageRequestRules: {},
+      packageRequestOpen: false,
+       // 弹框运费包
+      packageFreightList: [],
+      // 筛选运费包
+      filterPackageFreightList: [],
+      // 表单参数
+      form: {
+      },
+      dataForm: {
+        id: "",
+      },
+      // 表单校验
+      rules: {
+        merchantName: [
+          { required: true, message: "商家名称不能为空", trigger: "blur" }
+        ],
+        address: [
+          { required: true, message: "详细地址不能为空", trigger: "blur" }
+        ],
+        street: [
+          { required: true, message: "门牌号不能为空", trigger: "blur" }
+        ],
+        agentId: [
+          { required: true, message: "代理商Id不能为空", trigger: "blur" }
+        ],
+        selectedArea: [
+          { required: true, message: "地区不能为空", trigger: "blur" }
+        ],
+        provinceId: [
+          { required: true, message: "省id不能为空", trigger: "blur" }
+        ],
+        cityId: [
+          { required: true, message: "市id不能为空", trigger: "blur" }
+        ],
+        categoryId: [
+          { required: true, message: "商家分类不能为空", trigger: "blur" }
+        ],
+        districtId: [
+          { required: true, message: "区县ID不能为空", trigger: "blur" }
+        ],
+        merchantType: [
+          { required: true, message: "商家类型 1->单店,2->连锁店不能为空", trigger: "change" }
+        ],
+        licenseType: [
+          { required: true, message: "商户营业执照类型 1->个体, 3->公司不能为空", trigger: "change" }
+        ],
+        status: [
+          { required: true, message: "状态:0->禁用,1->待认证, 2->已认证不能为空", trigger: "blur" }
+        ],
+        contactName: [
+          { required: true, message: "联系人名称不能为空", trigger: "blur" }
+        ],
+        contactMobile: [
+          { required: true, message: "手机号码不能为空", trigger: "blur" }
+        ]
+      }
+    };
+  },
+  created() {
+    this.user = user.actions.getSysUser()
+    this.userType = localStorage.getItem("SYS_USER_TYPE")
+    this.dadaDspId = user.state.dadaDspId;
+    if (typeof this.dadaDspId !== 'undefined') {
+      getDadaDsp(this.dadaDspId).then((response) => {
+          this.dataForm = response.data;
+      });
+    }
+    this.getList();
+
+    getMerchantCategoryList().then(response => {
+      this.merchantCategoryList = response.data
+    });
+    listPackageFreight().then(response => {
+      this.packageFreightList = response.data
+    });
+    filterListPackageFreight().then(response => {
+      this.filterPackageFreightList = response.data
+    });
+  },
+  methods: {
+    updateQrCode(row) {
+      console.log('row', row)
+      var qrCodeType = this.qrCodeType
+      let text = row.openQrCode === 1 ? "启用" : "停用";
+      this.$confirm('确认要"' + text + '""' + row.name + '"达达配送服务商吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function () {
+        return changeQrCode(row.id, row.openQrCode, qrCodeType);       
+      }).then(() => {
+         this.msgSuccess(text + "成功");
+      }).catch(function () {
+        row.openQrCode = row.openQrCode === 1 ? 0: 1;
+      });
+    },
+
+    showImages(qrCode){
+      console.log('ddd',qrCode)
+      this.images = true
+      this.value = qrCode
+    },
+
+    handleDelivery(merchantId) {
+      this.packageRequest.merchantId = merchantId;
+      getDadaMerchant(merchantId).then(response => {
+        this.packageRequest.packageId = response.data.freightPackageId
+      });
+      this.packageRequestOpen = true;
+    },
+
+    cancelPackage() {
+      this.packageRequestOpen = false;
+      this.packageRequest = {
+        packageType: undefined,
+        packageId: undefined,
+        merchantId: undefined
+      };
+    },
+
+    submitFormPackage() {
+      this.$refs["packageRequest"].validate(valid => {
+        if (valid) {
+          this.$http.post('/module/dadaDsp/merchant/bindFreightPackage', this.packageRequest).then(( { data }) => {
+            if(data) {
+              this.$message.success('绑定成功!')
+              this.packageRequestOpen = false
+              this.getList();
+            }
+          })
+        }
+      })
+    },
+
+    changeAgent() {
+      this.personnelOption = [];
+      this.form.personnelId = undefined;
+      getPersonnelByAgent(this.form.agentId).then(response => {
+        this.personnelOption = response.data
+        console.log("option2", this.personnelOption)
+      });
+
+    },
+
+    changeSendArea(e) {
+      this.sendStartArea = e
+    },
+    close(){
+      this.reset()
+    },
+    updateStatus(id, status) {
+      this.$http
+        .get(`/module/merchant/updateStatus?id=` + id)
+        .then(({
+          data
+        }) => {
+          let msg = '启用'
+          if (status === 0) {
+            msg = '禁用'
+          }
+          if (data && data === 'OK') {
+            this.$message({
+              message: msg + '成功',
+              type: 'success',
+              duration: 1500
+            })
+            this.handleQuery()
+          }
+        })
+    },
+    gotoInfo(row){
+      this.$router.push({ path: '/dadaDspMerchant/dadaDspMerchant/info', query: { merchantId: row.id } })
+    },
+    introChange(data) {
+      this.form.intro = data
+    },
+    // 选择区域
+    changeArea (e) {
+      this.startArea = e
+    },
+    /** 查询客户商家列表 */
+    getList() {
+      this.loading = true;
+      this.queryParams.dadaDspId = this.dadaDspId;
+      if (this.date !== null && this.date !== "") {
+        if (this.date[0] !== undefined) {
+          this.queryParams.startTime = this.date[0];
+          this.queryParams.endTime = this.date[1];
+        }
+      } else {
+        this.queryParams.startTime = "";
+        this.queryParams.endTime = "";
+      }
+      listDadaMerchant(this.queryParams).then(response => {
+        this.merchantList = response.data.data;
+        this.total = response.data.totalNums;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: undefined,
+        merchantName: undefined,
+        agentId: undefined,
+        personnelId: undefined,
+        provinceId: undefined,
+        provinceName: undefined,
+        cityId: undefined,
+        cityName: undefined,
+        districtId: undefined,
+        districtName: undefined,
+        merchantType: undefined,
+        licenseType: undefined,
+        categoryId: undefined,
+        logo: undefined,
+        contactName: undefined,
+        contactMobile: undefined,
+        intro: undefined,
+        photoAlbum: undefined,
+        photoList: [],
+        bizLicense: undefined,
+        bizLicenseNo: undefined,
+        legalPerson: undefined,
+        idcardNo: undefined,
+        idcardFront: undefined,
+        idcardBack: undefined,
+        lng: undefined,
+        lat: undefined,
+        address: undefined,
+        errorMsg: undefined,
+        status: 0,
+        bindDeliveryAmount: undefined,
+      };
+      this.personnelOption = [];
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      // this.queryParams.pageNum = 1;
+      this.queryParams.provinceName = this.sendStartArea.provinceName
+      this.queryParams.cityName = this.sendStartArea.cityName
+      this.queryParams.districtName = this.sendStartArea.districtName
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.date = []
+      this.queryParams.startTime = ""
+      this.queryParams.endTime = ""
+      this.sendStartArea = {
+        province: '',
+        city: '',
+        district: '',
+        provinceName: '',
+        cityName: '',
+        districtName: '',
+        cityValues: [],
+        districtValues: [],
+        districtNames: [],
+      };
+      this.sendAreaProp = {}
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.areaProp = {},
+      this.open = true;
+      this.title = "添加客户商家";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getDadaMerchant(id).then(response => {
+        this.startArea.provinceName = response.data.provinceName
+        this.startArea.districtName = response.data.districtName
+        this.startArea.cityName = response.data.cityName
+        if(response.data.provinceName == undefined && response.data.districtName == undefined && response.data.cityName == undefined) {
+          this.startArea.provinceName = response.data.provinceName
+          this.startArea.districtName = response.data.districtName
+          this.startArea.cityName = response.data.cityName
+        } else {
+            const func = array => {
+            // 如果传入的不是数组 则返回
+            if (!Array.isArray(array)) return
+            // 使用reduce遍历数组,给定义一个初始值空数组,如果遍历的当前子元素是数组,那么拼接它继续递归后的结果,如果不是数组那么就是值,直接concat添加到数组尾部
+            return array.reduce(
+              (prev, curr) =>
+                Array.isArray(curr.childs) ? prev.concat(curr).concat(func(curr.childs)) : prev.concat(curr),
+              []
+            )
+          }
+          console.log('变化前:',area)
+          console.log('变化后:',func(area))
+
+          this.startArea.province = (func(area).find(item => {return item.name === this.startArea.provinceName && item.level === 1}) || {}).id
+          console.log('this.startArea.province:', this.startArea.province)
+
+          this.startArea.city = (func(area).find(item => {return item.name === this.startArea.cityName && item.level === 2}) || {}).id
+          console.log('this.startArea.city:', this.startArea.city)
+
+          var cityId = this.startArea.city.substr(0,4)
+          console.log('var cityId', cityId)
+          this.startArea.district = (func(area).find(item => {return item.name === this.startArea.districtName && item.id.includes(cityId) && item.level === 3}) || {}).id
+          console.log('this.startArea.district:', this.startArea.district)
+        }
+
+        this.areaProp = JSON.parse(JSON.stringify(this.startArea))
+        this.form = Object.assign({}, { personnelId: '' }, response.data);
+
+        console.log('form', this.form)
+        this.open = true;
+        this.title = "修改客户商家";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      if(!this.form.photoList == undefined){
+        if (this.form.photoList.length > 0){
+          for (var i=0; i<this.form.photoList.length; i++){
+            if (i==0){
+              this.form.photoAlbum = this.form.photoList[i]
+            } else {
+              this.form.photoAlbum = this.form.photoAlbum + ',' + this.form.photoList[i]
+            }
+          }
+        }
+      }
+      this.activeName = 'first'
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.startArea.province === undefined || this.startArea.city === undefined || this.startArea.district === undefined ||
+              this.startArea.province === "" || this.startArea.city === "" || this.startArea.district === "") {
+            this.$message({
+              message: '请选择地区',
+              type: 'error',
+              duration: 1500
+            })
+            return
+          }
+          this.form.provinceId = this.startArea.province
+          this.form.cityId = this.startArea.city
+          this.form.districtId = this.startArea.district
+
+          this.form.provinceName = this.startArea.provinceName
+          this.form.cityName = this.startArea.cityName
+          this.form.districtName = this.startArea.districtName
+
+          console.log('form', this.form)
+          if (this.form.id != null) {
+            // updateMerchant(this.form).then(response => {
+            //   this.msgSuccess("修改成功");
+            //   this.open = false;
+            //   this.getList();
+            // });
+
+            this.$confirm("确定修改数据吗?", "警告", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            }).then(() => {
+              updateMerchant(this.form).then(response => {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            })
+          } else {
+            // addMerchant(this.form).then(response => {
+            //   this.msgSuccess("新增成功");
+            //   this.open = false;
+            //   this.getList();
+            // });
+
+            this.$confirm("确定新增数据吗?", "警告", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            }).then(() => {
+              addMerchant(this.form).then(response => {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            })
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除客户商家编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delMerchant(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.exportParams.merchantName = this.queryParams.merchantName
+      this.exportParams.merchantType = this.queryParams.merchantType
+      this.exportParams.licenseType = this.queryParams.licenseType
+      this.exportParams.contactName = this.queryParams.contactName
+      this.exportParams.mobile = this.queryParams.mobile
+      this.exportParams.memberName = this.queryParams.memberName
+      this.exportParams.memberMobile = this.queryParams.memberMobile
+      this.exportParams.personnelName = this.queryParams.personnelName
+      this.exportParams.personnelId = this.queryParams.personnelId
+      if (this.date !== null && this.date !== '') {
+        if (this.date[0] !== undefined) {
+          this.exportParams.startTime = this.date[0]
+          this.exportParams.endTime = this.date[1]
+        }
+      } else {
+        this.exportParams.startTime = ''
+        this.exportParams.endTime = ''
+      }
+
+      const params = this.exportParams;
+
+      this.$confirm('是否确认导出所有客户商家数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportMerchant(params);
+        }).then(response => {
+          this.download(response.data);
+        })
+    }
+  }
+};
+</script>
+<style lang="scss">
+  .onlyOne.el-input-number {
+    width: 100%;
+    background-color: rgb(251, 251, 251);
+    height: calc(100% - 2px);
+
+    .el-input__inner {
+      background: rgb(251, 251, 251);
+      border: none;
+    }
+  }
+</style>
+<style lang="scss" scoped>
+  .table {
+  border: 1px solid #eeeeee;
+  border-right: 0;
+  display: inline-block;
+
+  .table-header {
+    display: flex;
+    height: 40px;
+    border-right: 1px solid #eeeeee;
+    background: #f5f5f5;
+
+    .table-header-item {
+      width: 196px;
+      height: 40px;
+      line-height: 40px;
+      padding-left: 14px;
+      font-size: 12px;
+      color: #666666;
+    }
+  }
+
+  .table-list {
+    display: flex;
+    height: 40px;
+    border-top: 1px solid #eeeeee;
+    text-align: center;
+
+    &:nth-of-type(2n + 2) {
+      background: #fbfbfb;
+    }
+
+    .table-list-item {
+      width: 196px;
+      height: 40px;
+      line-height: 40px;
+      padding-left: 14px;
+      font-size: 12px;
+      color: #333333;
+      border-right: 1px solid #eeeeee;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      padding: 0;
+      white-space: nowrap;
+      // input {
+      //   width: 100%;
+      //   height: 100%;
+      //   border: none;
+      //   background: none;
+      //   outline: none;
+      //   font-size: 12px;
+      //   color: #333333;
+      // }
+    }
+  }
+}
+</style>
+
+<style>
+.dada_dsp_info_top {
+  width: 300px;
+  display: inline-block;
+}
+</style>