123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <template>
- <div class="shopAdd">
- <el-dialog width="40%" :title="title" destroy-on-close center :visible.sync="showVisible">
- <el-form :model="form">
- <el-form-item label="门店名称" label-width="103px">
- <el-input v-model="form.name" placeholder="请输入店铺名称" autocomplete="off" style="width: 100%"></el-input>
- </el-form-item>
- <el-form-item label="主营类别" label-width="103px">
- <div class="category_box">
- <div class="item" :class="form.categoryId == item.id ? 'active':''" v-for="(item,i) in products" :key="i" @click="$set(form,'categoryId',item.id)">
- {{item.name}}
- </div>
- </div>
- </el-form-item>
- <el-form-item label="详细地址" label-width="103px">
- <el-input v-model="form.address" placeholder="请点击地图选择具体地址" disabled autocomplete="off" style="width: 100%">
- <el-image @click="showMap" slot="append" class="map" src="../../../static/image/icon_map.png"></el-image>
- </el-input>
- </el-form-item>
- <el-form-item label="门牌号" label-width="103px">
- <el-input v-model="form.street" placeholder="请填写门牌号" autocomplete="off" style="width: 100%">
- </el-input>
- </el-form-item>
- <el-form-item label="联系人姓名" label-width="103px">
- <el-input v-model="form.contactName" placeholder="请填写姓名" autocomplete="off" style="width: 40%"></el-input>
- </el-form-item>
- <el-form-item label="联系人电话" label-width="103px">
- <el-input v-model="form.mobile" placeholder="请填写手机号" autocomplete="off" style="width: 40%"></el-input>
- </el-form-item>
- <el-form-item label="已获运力" label-width="103px" v-if="form.id">
- <div class="logo_box">
- <div v-for="(item,i) in form.deliveries" :key="i">
- <img v-if="item.bindStatus == 1" :src="item.logo" alt="">
- </div>
- </div>
- <div class="line"></div>
- </el-form-item>
- <el-form-item label="审核中运力" label-width="103px" v-if="form.id && revieweds.length">
- <div class="reviewed">
- <div class="item" v-for="(item, i) in revieweds" :key="i">
- <div class="left">
- <img class="logo" :src="item.logo">
- <span class="label">{{item.name}}</span>
- </div>
- <div class="tip">审核中</div>
- </div>
- </div>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button class="btn" @click="save">保存</el-button>
- </div>
- </el-dialog>
- <!-- 通过地图选择地理位置 -->
- <order-map @getAddressDetail="getAddressDetail" ref="orderMap"></order-map>
- </div>
- </template>
- <script>
- import orderMap from "../orderComponents/orderAMap.vue";
- import { shopAdd } from "../../api/shop.js";
- export default {
- props: {
- products: {
- type: Array,
- default: function () {
- return [];
- },
- },
- },
- data() {
- return {
- title: "新增门店",
- showVisible: false,
- form: {},
- revieweds: [],
- };
- },
- components: {
- orderMap,
- },
- methods: {
- init(e) {
- if (e) {
- console.log(e);
- this.title = "编辑门店";
- for (let i = 0; i < e.deliveries.length; i++) {
- if (e.deliveries[i].bindStatus == 2) {
- this.revieweds.push(e.deliveries[i]);
- }
- }
- this.form = e;
- } else {
- this.title = "新增门店";
- this.form = {};
- }
- this.showVisible = true;
- },
- showMap() {
- this.$refs.orderMap.chooseLocation();
- },
- getAddressDetail(v, lng, lat) {
- this.form.address = v.formattedAddress;
- this.form.provinceName = v.province;
- this.form.cityName = v.city;
- this.form.cityCode = v.citycode;
- this.form.districtName = v.district;
- this.form.lng = lng;
- this.form.lat = lat;
- },
- save() {
- shopAdd(this.form).then((res) => {
- if (res.code === 200) {
- this.$message({
- type: "success",
- message: `${this.form.id ? "保存" : "新增"}成功!`,
- });
- this.$emit("getData");
- } else {
- this.$message({
- type: "error",
- message: res.msg,
- });
- }
- });
- },
- },
- };
- </script>
- <style lang="scss">
- .shopAdd {
- .map {
- height: 25px;
- width: 25px;
- cursor: pointer;
- }
- .el-dialog {
- border-radius: 16px;
- overflow: hidden;
- }
- .el-dialog__headerbtn .el-dialog__close:hover {
- color: #909399;
- }
- .el-dialog__header {
- /*height: 48px;*/
- background: #f7f7f7;
- padding: 16px 20px;
- }
- .el-dialog__title {
- font-size: 16px;
- font-weight: 500;
- color: #000000;
- }
- .el-form-item__label {
- text-align: left;
- color: #000000;
- }
- .el-input__inner:focus {
- border-color: #fc7b0f;
- }
- .el-input__inner {
- color: #222222;
- }
- .category_box {
- display: flex;
- flex-wrap: wrap;
- width: 100%;
- margin-top: -10px;
- .item {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 92px;
- height: 38px;
- margin: 10px 10px 0 0;
- background: #f4f4f4;
- border-radius: 2px;
- cursor: pointer;
- &.active {
- color: #ffffff;
- background: #fc7200;
- }
- }
- }
- .line {
- position: absolute;
- left: -103px;
- right: 0;
- bottom: -12px;
- border: 0.5px dashed #e0e0e0;
- }
- .logo_box {
- width: 100%;
- height: 40px;
- display: flex;
- align-items: center;
- line-height: 0;
- img {
- width: 20px;
- height: 20px;
- border-radius: 50%;
- margin-right: 10px;
- vertical-align: top;
- }
- }
- .reviewed {
- .item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 40px;
- .left {
- display: flex;
- align-items: center;
- line-height: 0;
- .logo {
- width: 20px;
- height: 20px;
- border-radius: 50%;
- margin-right: 10px;
- }
- .label {
- font-size: 14px;
- color: #000000;
- }
- }
- .tip {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 60px;
- height: 22px;
- border-radius: 22px;
- background: #f74141;
- font-size: 12px;
- color: #ffffff;
- }
- }
- }
- .btn {
- width: 220px;
- }
- }
- </style>
|