placeOrderDialog.vue 14.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
<template>
  <div :class="[placeOrderForm.type=='代客下单'?'':'changeTypeSty','memberInfoDialogSty']">
    <el-dialog
      :title="placeOrderForm.title"
      :visible.sync="dialogVisible"
      :width="dialogWidth"
      height="500px"
      @close="handleClose">
      <el-form :model="placeOrderForm" ref="placeOrderForm" :inline="true" label-width="100px">
        <el-row v-if="placeOrderForm.type=='代客下单'">
          <el-col :span="24">
            <el-divider content-position="left" style="font-size: 18px">会员信息</el-divider>
          </el-col>
          <el-col :span="24">
            <el-form-item label="是否会员:">
              <el-radio-group v-model="placeOrderForm.sfhy">
                <el-radio :label="'是'">是</el-radio>
                <el-radio :label="'否'">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="placeOrderForm.sfhy=='是'">
            <el-form-item label="选择会员:">
              <el-select
                v-model="placeOrderForm.hyList"
                multiple
                filterable
                remote
                clearable
                reserve-keyword
                placeholder="请输入关键词"
                :remote-method="remoteMethod"
                :loading="loading">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-else>
            <el-form-item label="姓名:">
              <el-input v-model="placeOrderForm.name" clearable placeholder="请输入姓名"></el-input>
            </el-form-item>
            <el-form-item label="手机号:">
              <el-input v-model="placeOrderForm.phone" clearable placeholder="请输入手机号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-divider content-position="left" style="font-size: 18px">购买类型</el-divider>
          </el-col>
          <el-col :span="24" style="margin-bottom: 5px;">
              <el-button style="float: right" type="primary" @click="selectType">选择气瓶类型</el-button>
          </el-col>
          <el-col :span="24">
            <el-table
              :data="placeOrderForm.tableData"
              border
              style="width: 100%">
              <el-table-column type="index" label="序号" width="80">
              </el-table-column>
              <el-table-column
                prop="name"
                label="图片"
                width="180">
                <template slot-scope="scope">
                  <el-image
                    style="width: 50px; height: 50px"
                    :src="scope.row.url"
                    :preview-src-list="exchangeImg(scope.row.url)">
                  </el-image>
                </template>
              </el-table-column>
              <el-table-column
                prop="name"
                label="名称">
              </el-table-column>
              <el-table-column
                prop="description"
                label="介绍"
                width="180">
              </el-table-column>
              <el-table-column
                prop="dj"
                label="单价">
              </el-table-column>
              <el-table-column
                prop="num"
                label="数量"
                width="180">
                <template slot-scope="scope">
                  <el-input v-model="scope.row.num" clearable placeholder="请输入数量"></el-input>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
          <el-col :span="24" style="display: flex;justify-content: end; margin: 10px 0px;">
              <div> 数量:{{placeOrderForm.allnum}}</div>
              <div style="margin-left: 10px;"> 总金额:{{placeOrderForm.allmoney}}</div>
          </el-col>
          <el-col :span="24">
            <el-divider content-position="left" style="font-size: 18px">订单配送</el-divider>
          </el-col>
          <el-col :span="24">
            <el-form-item label="配送方式:">
              <el-radio-group v-model="placeOrderForm.psfs">
                <el-radio :label="'门店配送'">门店配送</el-radio>
                <el-radio :label="'会员自提'">会员自提</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="placeOrderForm.sfhy=='是'">
            <el-form-item label="选择地址:">
              <el-select
                v-model="placeOrderForm.hydz"
                multiple
                filterable
                remote
                clearable
                reserve-keyword
                placeholder="请输入关键词"
                :remote-method="remoteMethod"
                :loading="loading">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="联系人:">
              <el-input v-model="placeOrderForm.lxr" clearable placeholder="请输入联系人姓名"></el-input>
            </el-form-item>
            <el-form-item label="联系电话:">
              <el-input v-model="placeOrderForm.lxrdh" clearable placeholder="请输入联系人手机号"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="配送地址:">
              <el-input v-model="placeOrderForm.psdz" clearable placeholder="请输入联系人姓名"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-else class="selectTypeSty infinite-list"  v-infinite-scroll="load"
                infinite-scroll-disabled="disabled"
                infinite-scroll-immediate="false" >
          <el-col class="infinite-list-item" style="border: 1px dashed black; margin-bottom: 5px; padding: 10px" :span="24" v-for="(item,index) of selectTypeList" :key="index">
            <div class="selectTypeMain">
              <div class="left">
                <el-image  style="width: 50px; height: 50px"
                           :src="item.imgUrl"
                           :preview-src-list="changeImgList(item.imgUrl)"
                ></el-image>
              </div>
              <div class="right">
                <div class="top">
                  <div>价格:{{item.jg}}</div>
                  <div>名称:{{item.name}}</div>
                  <el-checkbox  :model="item.id" :label="item.id">
                  </el-checkbox>
                </div>
                <div class="bottom">
                  描述:{{item.description}}
                </div>
              </div>
            </div>
          </el-col>
          <p v-if="listParams.loading">Loading...</p>
          <p v-if="listParams.finished">No More</p>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleCancel">取 消</el-button>
        <el-button type="primary" @click="handleSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>

</template>

<script>
export default {
  name:'memberInfoDialog',
  components: {},
  data() {
    return {
      dialogWidth:'1200px',
      dialogVisible: false,
      loading:false,
      options:[],
      listParams: {
        pageNum: 1,
        pageSize: 10,
        loading: false,
        error: false,
        finished: false,
      },
      selectTypeList:[
        {
          imgUrl:'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg',
          name:'111',
          jg:'1',
          js:'1212',
          id:'1'
        },
        {
          imgUrl:'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
          name:'111',
          jg:'1',
          js:'1212',
          id:'2'
        }
      ],
      checkedType:[],
      states: ["Alabama", "Alaska", "Arizona",
        "Arkansas", "California", "Colorado",
        "Connecticut", "Delaware", "Florida",
        "Georgia", "Hawaii", "Idaho", "Illinois",
        "Indiana", "Iowa", "Kansas", "Kentucky",
        "Louisiana", "Maine", "Maryland",
        "Massachusetts", "Michigan", "Minnesota",
        "Mississippi", "Missouri", "Montana",
        "Nebraska", "Nevada", "New Hampshire",
        "New Jersey", "New Mexico", "New York",
        "North Carolina", "North Dakota", "Ohio",
        "Oklahoma", "Oregon", "Pennsylvania",
        "Rhode Island", "South Carolina",
        "South Dakota", "Tennessee", "Texas",
        "Utah", "Vermont", "Virginia",
        "Washington", "West Virginia", "Wisconsin",
        "Wyoming"],
      placeOrderForm:{
        type:'代客下单',
        title:'代客下单',
        lxr:'',
        lxrdh:'',
        psdz:'',
        hyList:[],
        sfhy:'是',
        phone:'',
        allmoney:'121',
        allnum:'1212',
        name:'',
        hydz:'',
        psfs:'门店配送',
        tableData:[
          {
            name:'111',
            description:'1111',
            dj:'9',
            num:'1',
            url:'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
          }
        ]
      },
      showGasBottleForm:{
        showGasBottleDialog:false
      }
    }
  },
  mounted() {
    this.list = this.states.map(item => {
      return { value: `value:${item}`, label: `label:${item}` };
    });
  },
  computed: {
    disabled() {
      console.log(
        this.listParams.loading || this.listParams.finished
      );
      return this.listParams.loading || this.listParams.finished;
    },
  },
  methods: {
    //选择气瓶类型
    selectType(){
      this.placeOrderForm.type = '选择气瓶类型';
      this.placeOrderForm.title ='选择购买类型';
      this.dialogWidth = '500px';
    },
    load () {
      this.listParams.loading = true;
      if (this.listParams.finished == false) {
        this.listParams.pageNum++;
        this.getSelectTypeList();
      }
    },
    getSelectTypeList(){
      var that = this;
      var params = {
        pageNum: that.listParams.pageNum,
        pageSize: that.listParams.pageSize,
      };
      // this.$api.myHistoryController
      //   .getDemoList(params)
      //   .then((res) => {
      //     if (res.status == 1000) {
      //       if (res.body.list.length > 0) {
      //         that.demoList = that.demoList.concat(res.body.list);
      //         that.listParams.loading = false;
      //         if (res.body.list.length < that.listParams.pageSize) {
      //           that.listParams.finished = true;
      //         }
      //       } else {
      //         that.listParams.loading = false;
      //         that.listParams.finished = true;
      //       }
      //     }
      //     that.listParams.loading = false;
      //   })
      //   .catch(function () {
      //     that.listParams.error = true;
      //     that.listParams.loading = false;
      //   });
    },
    //图片预览
    changeImgList( val) {
      let list =[];
      if(val){
        list.push(val);
      }
      return list
    },
    //选择气瓶的事件
    handleCheckedCitiesChange(value){
      console.log('打印value',value);

    },
    handleClick(tab, event) {
      console.log(tab, event);
    },
    //图片大图预览
    exchangeImg(row){
      let list =[];
      if(row){
        list.push(row);
      }
      return list
    },
    //远程搜索
    remoteMethod(query) {
      if (query !== '') {
        this.loading = true;
        setTimeout(() => {
          this.loading = false;
          this.options = this.list.filter(item => {
            return item.label.toLowerCase()
              .indexOf(query.toLowerCase()) > -1;
          });
        }, 200);
      } else {
        this.options = [];
      }
    },
    open(row) {
      let openThis = this;
      this.dialogVisible = true;
      // openThis.memberInfoForm.title = openThis.memberInfoForm.title + row.whyxxfhync;
      console.log('打印row',row);
    },
    handleClose(done) {
      this.memberInfoForm.title ='会员详情-';
      done();
      this.$emit('handleRefresh');
    },
    handleCancel(){
      switch (this.placeOrderForm.type){
        case "选择气瓶类型":
          this.placeOrderForm.type = '代客下单';
          this.placeOrderForm.title ='代客下单';
          this.dialogWidth = '1200px';
          break;
        case '代客下单':
          this.dialogVisible = false;
          break;
      }
    },
    handleSubmit() {
      switch (this.placeOrderForm.type){
        case "选择气瓶类型":
          this.placeOrderForm.type = '代客下单';
          this.placeOrderForm.title ='代客下单';
          this.dialogWidth = '1200px';
          break;
        case '代客下单':
          this.dialogVisible = false;
          this.memberInfoForm.title ='会员详情-';
          this.$emit('handleRefresh');
          break;
      }

    }
  }
}
</script>
<style lang="scss" scoped>
.changeTypeSty{
  ::v-deep.el-dialog__body .el-form, html body .el-message-box__body .el-form{
    padding-right: 0px!important;
    height: 100%;
  }
}
.memberInfoDialogSty{

  ::v-deep.el-dialog__body{
    border-top: 1px solid transparent !important;
    padding: 0px 20px;
    height: 590px;
  }
  ::v-deep.el-dialog__footer{
    border-top: 1px solid transparent !important;
  }
  .selectTypeSty{
    height: 100%;
    overflow-y: auto;
    .selectTypeMain{
      display: flex;
      width: 100%;
      .right{
        display: flex;
        flex-wrap: wrap;
        width: calc(100% - 50px);
        margin-left: 15px;
        .top{
          width: 100%;
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
        .bottom{
          width: 100%;
          display: flex;
          align-items: center;
        }
      }
    }
    ::v-deep.el-checkbox__label{
      display: none!important;
    }
  }
}
</style>