小牛集卡web 客户端
chenwei
2021-06-04 7f5659967e4b5864d1c56a6072ebfe3abe4702dc
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
<template>
  <div class="left-main">
    <div class="content">
      <div class="nav">
        <div
          v-for="(item, index) in nav"
          :key="index + 1"
          @click="changeType(index + 1)"
          :class="{ meactive: index + 1 == isType }"
        >
          {{ item }}
        </div>
      </div>
      <div class="form">
        <el-form ref="form" :model="submitForm" label-width="160px">
          <el-form-item>
            <template slot="label">
              <div class="form-label">
                <i class="iconfont icon-listmatou"></i>
 
                <span>提箱地 : </span>
              </div>
            </template>
            <div class="form-input">
              <div class="tibox-adres">
                <el-input
                  @focus="tiFocus"
                  readonly
                  v-model="playBox"
                ></el-input>
                <div class="select-tibox" v-if="isTShow">
                  <div v-if="pickPlaceList.length == 0">暂 无 数 据</div>
                  <el-tabs v-model="submitForm.CityId" @tab-click="handleClick">
                    <el-tab-pane
                      v-for="item in pickPlaceList"
                      :key="item.CityId"
                      :label="item.CityName"
                      :name="item.CityId"
                    >
                      <el-radio-group v-model="radio" @change="selectPort">
                        <el-radio
                          @change="boxRadio"
                          v-for="ritem in item.PortList"
                          :key="ritem.PortId"
                          :label="ritem"
                          >{{ ritem.PortName }}</el-radio
                        >
                      </el-radio-group>
                    </el-tab-pane>
                  </el-tabs>
                </div>
              </div>
 
              <div class="suffix-txt">
                <div v-for="(item, pindex) in pickPlaceList" :key="pindex">
                  <div
                    class="shortcut"
                    v-for="(shortcut, sindex) in item.PortList"
                    :key="sindex"
                    @click="shortCut(item, shortcut)"
                  >
                    <span v-if="sindex < 3">{{ shortcut.PortName }}</span>
                  </div>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item>
            <template slot="label">
              <div class="form-label">
                <i
                  class="iconfont icon-diaoyun_lift_jizhuangxiang_container"
                ></i>
                <span>装卸地 : </span>
              </div>
            </template>
            <div class="form-input enter-text">
              <el-input
                v-model="mapVal"
                @focus="mapAdre"
                id="tipinput"
                clearable
              ></el-input>
 
              <div class="suffix-txt">
                <div @click="usualAdrDialog = true">常用地址</div>
              </div>
            </div>
          </el-form-item>
          <el-form-item>
            <template slot="label">
              <div class="form-label">
                <i class="iconfont icon-components-full"></i>
                <span>还箱地 : </span>
              </div>
            </template>
            <box-adress
              :boxaddress="retrunPlaceList"
              @acceptreturn="acceptReturnAdress"
            ></box-adress>
          </el-form-item>
          <el-form-item>
            <template slot="label">
              <div class="form-label">
                <i class="iconfont icon-express-package-full"></i>
                <span>箱型 : </span>
              </div>
            </template>
            <div class="form-input">
              <div class="box-type">
                <div v-for="(box, bindex) in boxType" :key="bindex + 3">
                  <label :for="box.CntrId">
                    <input
                      type="checkbox"
                      v-model="box.select"
                      :id="box.CntrId"
                      hidden
                    />
                    <div
                      class="default"
                      @click="selectBoxType($event, box.CntrId)"
                    >
                      <i class="iconfont icon-jizhuangxiang_container"></i>
                      <span>{{ box.CntrName }}</span>
                      <span> {{ box.CntrSubtitle }}</span>
                    </div>
                  </label>
 
                  <!-- <div v-if="box.CntrType == 1">
                    <label :for="box.CntrId + 1">
                      <div class="carpool-moneny">
                        <input
                          type="checkbox"
                          v-model="box.pinche"
                          :id="box.CntrId + 1"
                        />
                        <span>同意拼车更省钱</span>
                      </div>
                    </label>
                  </div> -->
                </div>
 
                <div>
                  <div class="default special-container" @click="chooseSpecial">
                    <i class="iconfont icon-jizhuangxiang_container"></i>
                    <span>特种箱</span>
                  </div>
                  <div class="special-box" v-if="isSpecial">
                    <div>
                      <el-input
                        v-model="specialVal"
                        
                      ></el-input>
                    </div>
                    <div
                      class="show-spe"
                      v-for="item in SpecialContainerList"
                      :key="item.CntrId"
                    >
                      <label
                        :for="item.CntrId"
                        style="display: flex; align-items: center"
                      >
                        <input
                          type="checkbox"
                          v-model="item.select"
                          :id="item.CntrId"
                        />
                        <div class="spe-type">
                          <i class="iconfont icon-jizhuangxiang_container"></i>
                          <span>{{ item.CntrName }}</span>
                        </div>
                      </label>
 
                      <!-- <el-switch
                        v-if="item.CntrType == 1"
                        v-model="item.pinche"
                        active-text="拼车"
                      >
                      </el-switch> -->
                    </div>
                    <div class="public-btn spe-btn">
                      <button @click="specialSure">确 定</button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item>
            <template slot="label">
              <div class="form-label">
                <i class="iconfont icon-shijian"></i>
                <span>到达时间 : </span>
              </div>
            </template>
            <div class="form-input">
              <el-date-picker
                
                v-if="!timeUrgent"
                v-model="submitForm.ArriveTime"
                type="datetime"
                placeholder="选择日期时间"
               :picker-options="urgentTime"
                value-format="yyyy-MM-dd HH:mm"
              >
              </el-date-picker>
              <!-- <div v-if="timeUrgent">
                   <el-date-picker
                @change=urgentTimeChange
              
                v-model="submitForm.ArriveTime"
                type="date"
                placeholder="选择日期时间"
                :picker-options="urgentTime"
                value-format="yyyy-MM-dd HH:mm"
              >
              </el-date-picker>
              </div> -->
              <!-- <el-checkbox v-model="timeUrgent" @change="urgentChange"
                >加急</el-checkbox
              > -->
            </div>
          </el-form-item>
          <el-form-item>
            <template slot="label">
              <div class="form-label">
                <i class="iconfont icon-express-package-full"></i>
                <span>物品 : </span>
              </div>
            </template>
            <div class="form-input">
              <div
                class="product"
                v-for="(item, indexp) in productData"
                :key="indexp"
                :class="{ activebox: activeProduct == item }"
                @click="selProeuct(item)"
              >
                {{ item }}
              </div>
              <div class="pro-input">
                <el-input
                  placeholder="输入物品"
                  v-model="productVal"
                  @focus="proInput"
                ></el-input>
              </div>
            </div>
          </el-form-item>
        </el-form>
        <div class="undeter">
          <img src="../../../../public/img/index/tuidan.svg" alt="" />
          <span>箱子具体信息[智能输入]</span>
        </div>
      </div>
    </div>
    <div class="btns">
      <div v-if="1 == 2">
        <div class="mill" v-for="(fitem, findex) in factory" :key="findex">
          {{ fitem }}
        </div>
        <div class="change-mill">
          <i class="el-icon-refresh"></i>
          <span>换一换</span>
        </div>
      </div>
      <div class="place-order">
        <button @click="inquiryOrder">
          <i class="el-icon-search"></i>询价下单
        </button>
      </div>
    </div>
 
    <!-- 常用地址弹窗 -->
    <el-dialog
      title="常用地址"
      :visible.sync="usualAdrDialog"
      width="30%"
      :before-close="handleClose"
    >
      <div
        class="common-adress"
        v-for="(item, index) in CommonAdressList"
        :key="index"
        @click="selAdress(item)"
      >
        <i class="iconfont icon-zb"></i>
        <span>{{ item.ComAdress }}</span>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import BoxAdress from "../comment/BoxAdress";
export default {
  data() {
    return {
      nav: ["我要装", "我要卸"],
      CommonAdressList: [
        { ComAdress: "重庆果园港", ComLongitude: "109", ComLatitude: "22" },
      ],
      isType: "1",
      submitForm: {
        CityId: "5dc90c98-475e-4529-bb3a-c3010a82b0e1",
        OrderType: 1,
        PickPlace: "",
        ReturnPlace: "",
        OrderAddress: "",
        OrderAddressLongitude: "",
        OrderAddressLatitude: "",
        TempOrderContainerList: [],
        ArriveTime: "",
        TransportGoods: "",
        // OnlyInput:""
      },
      timeUrgent: false,
      value1: "",
      radio1: "",
      value4: "",
      productData: ["汽车类", "钢材类"],
      factory: [],
 
      boxType: [], //普通箱子列表
      SpecialContainerList: [],
      isTShow: false,
      playBox: "",
      radio: "",
      activeName: "5dc90c98-475e-4529-bb3a-c3010a82b0e1",
      isMap: false,
      mapVal: "",
      usualAdrDialog: false,
      specialVal: "",
      former:[],
      isSpecial: false,
      pickPlaceList: [],
      retrunPlaceList: [],
      activeProduct: "",
      productVal: "",
      isSelect: "",
      urgentBeginTime:"",
      urgentEndTime:"",
      urgentTime: {
        disabledDate(time,urgentFinshTime) {
          // let test = "2021-06-03";
          // // test  = urgentFinshTime;
 
          //  let Y = (new Date()).getFullYear();
          //   let M = (new Date()).getMonth();
          //   let D = (new Date()).getDate();
          //   let curDate = (new Date()).getTime();
          //   let defDate = (new Date(Y,M,D)).getTime() - new Date(test).getTime(); // 14 * 24 * 3600 * 1000;因为月份取出来的值小1,所以直接用了new Date(2019,3,11).getTime()
            // let chooseDate = curDate - defDate;
            // let chooseDate =curDate-defDate; ||chooseDate<time.getTime()
           
            return time.getTime() < Date.now() - 8.64e7;
        }
      },
    };
  },
  components: { BoxAdress },
  props: ["alldata"],
  watch: {
    alldata(val) {
      this.productData = val.GoodList;
      for (var i = 0; i < val.ContainerList.length; i++) {
        val.ContainerList[i].select = false;
        val.ContainerList[i].pinche = false;
      }
      this.boxType = val.ContainerList;
      val.SpecialContainerList.forEach((item) => {
        item.select = false;
        item.pinche = false;
      });
      this.SpecialContainerList = val.SpecialContainerList;
      this.former = val.SpecialContainerList;
      this.pickPlaceList = val.PickPlaceList;
      this.CommonAdressList = val.CommonAdressList;
      this.retrunPlaceList = val.RetrunPlaceList;
      this.urgentBeginTime = val.GetUrgentBeginTime;
      this.urgentEndTime = val.GetUrgentEndTime;
      console.log(val);
    },
    specialVal(val){
       console.log(val)
        this.searchSpecial(val);
    },
  },
  mounted() {
   
  },
  methods: {
  
    acceptReturnAdress(e) {
      this.submitForm.ReturnPlace = e;
    },
    selectBoxType(e, id) {
      console.log(id);
      if (e.target.localName == "div") {
        if (e.target.className.indexOf("activebox") == -1) {
          e.target.className = "default  activebox";
        } else {
          e.target.className = "default";
        }
      } else {
        if (e.target.parentNode.className.indexOf("activebox") == -1) {
          e.target.parentNode.className = "default  activebox";
        } else {
          e.target.parentNode.className = "default";
        }
      }
    },
    chooseSpecial() {
      this.isSpecial = !this.isSpecial;
    },
    specialSure() {
      this.isSpecial = false;
    },
    boxRadio(val) {
      this.submitForm.PickPlace = val.PortId;
      this.submitForm.ReturnPlace = val.PortId;
      this.playBox = val.PortName;
      console.log(val);
    },
    handleClick(tab, event) {
      this.submitForm.CityId = tab.name;
      console.log(tab.name);
    },
    //选择快捷方式的提箱地
    shortCut(content, short) {
      this.submitForm.CityId = content.CityId;
      this.submitForm.PickPlace = short.PortId;
      this.submitForm.ReturnPlace = short.PortId;
      this.playBox = short.PortName;
    },
    //搜索触发的事件
    searchSpecial(val) {
      var arr = [];
      if (val != "") {
        for (var i = 0; i < this.former.length; i++) {
          if (this.former[i].CntrName.indexOf(val) != -1) {
            arr.push(this.former[i]);
          } else if (this.former[i].CntrName == val) {
            arr = [];
            arr.push(this.former[i]);
          }
        }
         this.SpecialContainerList = arr;
      }else{
        this.SpecialContainerList = this.former;
      }
    },
    changeType(item) {
      this.submitForm.OrderType = item;
      this.isType = item;
    },
    //循环取到已经选择的箱子
    getForBox(arr) {
      for (var i = 0; i < arr.length; i++) {
        if (arr[i].select) {
          if (arr[i].pinche) {
            this.submitForm.TempOrderContainerList.push({
              CntrId: arr[i].CntrId,
              CntrName: arr[i].CntrName,
              IsCarpooling: 1,
            });
          } else {
            this.submitForm.TempOrderContainerList.push({
              CntrId: arr[i].CntrId,
              CntrName: arr[i].CntrName,
              IsCarpooling: 0,
            });
          }
        }
      }
    },
    inquiryOrder() {
      if (this.activeProduct == "") {
        this.submitForm.TransportGoods = this.productVal;
      }
      // this.submitForm.ArriveTime = this.value1;
      this.getForBox(this.boxType);
      this.getForBox(this.SpecialContainerList);
      console.log(this.submitForm);
      this.$axios
        .post("/api/Order/SaveTempOrder", this.$qs.stringify(this.submitForm))
        .then((res) => {
          console.log(res);
          console.log(this.value4);
          this.$router.push("/inquiry");
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //选中物品
    selProeuct(content) {
      this.productVal = "";
      this.activeProduct = content;
      this.submitForm.TransportGoods = content;
    },
    //输入物品
    proInput() {
      this.activeProduct = "";
    },
    // urgentChange(val) {
    //   if (val) {
    //      let year = this.urgentEndTime.slice(0,10)
    //      console.log(year)
    //             this.urgentTime.disabledDate(new Date() ,"2021-06-03");
    //   }
    // },
    //选取常用地址
    selAdress(content) {
      this.submitForm.OrderAddressLongitude = content.ComLongitude;
      this.submitForm.OrderAddressLatitude = content.ComLatitude;
      this.mapVal = content.ComAdress;
      this.usualAdrDialog = false;
    },
    tiFocus() {
      this.isTShow = true;
    },
    tBlur() {
      this.isTShow = false;
    },
    TiLose() {
      this.isTShow = false;
    },
    selectPort() {
      this.isTShow = false;
    },
    mapAdre() {
      // var map = new AMap.Map("container", {
      
      //   resizeEnable: true,
      // });
      //输入提示
      var auto = new AMap.Autocomplete({
       
        input: "tipinput",
         city:"重庆"
      });
      // var placeSearch = new AMap.PlaceSearch({
      //   map: map,
      // }); //构造地点查询类
      AMap.event.addListener(auto, "select", select);
 
      //注册监听,当选中某条记录时会触发
      var $this = this;
      function select(e) {
        $this.submitForm.OrderAddressLongitude = e.poi.location.lng;
        $this.submitForm.OrderAddressLatitude = e.poi.location.lat;
        $this.submitForm.OrderAddress = e.poi.name;
        console.log(e.poi);
      }
    },
    handleClose(done) {
      this.$confirm("确认关闭?")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
  },
};
</script>
<style lang="less" scoped>
.common-adress {
  padding: 3px 0px;
  cursor: pointer;
}
.common-adress:hover {
  color: #409eff;
}
.special-box {
  padding: 6px;
  position: absolute;
  z-index: 3;
  width: 245px;
  background-color: #fff;
  border: 1px solid #aaaaaa;
  border-radius: 3px;
}
.spe-type {
  border: 1px solid #aaaaaa;
  border-radius: 3px;
  padding: 0px 10px;
  height: 30px;
  line-height: 30px;
  margin: 0 6px;
  color: #aaaaaa;
}
.spe-type i {
  font-size: 25px;
  margin-right: 3px;
}
.spe-type span {
  font-weight: bold;
  font-size: 16px;
}
.show-spe {
  display: flex;
  align-items: center;
  margin-top: 6px;
}
.spe-btn {
  text-align: center;
}
.carpool-moneny {
  display: flex;
  align-items: center;
  color: #a30014;
}
.carpool-moneny span {
  margin-left: 3px;
}
.box-type {
  display: flex;
  flex-wrap: wrap;
}
.default i {
  font-size: 25px;
}
.default span:nth-child(2) {
  font-weight: bold;
  font-size: 16px;
  margin: 0 5px;
}
.default {
  display: flex;
  border-radius: 3px;
  padding: 3px;
  border: 1px solid #c3c3c3;
  background-color: #fff;
  color: #aaaaaa;
  margin-right: 6px;
  margin-bottom: 10px;
}
.special-container{
  margin-bottom: 0px;
}
.activebox {
  border: 1px solid #e6a23c;
  background-color: #e6a23c;
  color: #fff;
}
 
.fronthome-top {
  margin-top: 20px;
}
.left-main .content {
  display: flex;
}
.nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.nav div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  width: 16px;
  padding: 0 10px;
  background-color: #000;
  color: #fff;
  border: 1px solid #efefef;
}
.meactive {
  background-color: #fff !important;
  color: #000 !important;
}
.meactive::before {
  content: url("../../../../public/img/index/gouxuan2.svg");
}
.left-main .content {
  margin: 10px;
}
.content .form {
  width: 100%;
  border: 1px solid #aaaaaa;
  padding: 10px;
  box-sizing: border-box;
}
.form-label {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.form-label i {
  font-size: 30px;
  margin-right: 10px;
}
.form-label span {
  font-weight: 900;
  font-size: 18px;
  color: #000;
  width: 90px;
}
.form-input {
  display: flex;
  flex-wrap: wrap;
}
.enter-text {
  /deep/.el-input {
    width: 300px;
  }
}
.suffix-txt {
  display: flex;
  margin-left: 50px;
  color: #aaaaaa;
}
.suffix-txt div {
  margin-right: 20px;
  display: flex;
  cursor: pointer;
}
.suffix-txt .shortcut:hover {
  color: #409eff;
}
.product {
  padding: 0px 40px;
  border: 1px solid #e4e4e4;
  margin-right: 30px;
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 3px;
}
.pro-input {
  /deep/.el-input {
    width: 117px;
  }
}
.undeter {
  display: flex;
  align-items: center;
}
.undeter span {
  text-decoration: underline;
  color: #aaaaaa;
  margin-left: 15px;
  cursor: pointer;
}
.btns {
  display: flex;
  // justify-content: space-between;
  justify-content: flex-end;
  padding: 0 10px;
  box-sizing: border-box;
  padding-left: 48px;
  padding-bottom: 10px;
  color: #8b8b8b;
}
.btns .mill {
  border: 1px solid #e4e4e4;
  padding: 5px 20px;
  cursor: pointer;
}
.btns .change-mill,
.btns .place-order {
  display: flex;
  align-items: center;
}
.btns .change-mill span {
  cursor: pointer;
  margin-left: 3px;
}
.place-order button {
  padding: 5px 20px;
  color: #fff;
  font-weight: bold;
  background-color: #f59a23;
  cursor: pointer;
  outline: none;
  border: none;
  border-radius: 3px;
}
.place-order button i {
  margin-right: 5px;
}
.place-order button:hover {
  background-color: #f3a53f;
}
.select-tibox {
  border: 1px solid #c3c3c3;
  position: absolute;
  z-index: 10;
  background-color: #fff;
  padding: 10px;
  border-radius: 6px;
  width: 300px;
}
.select-tibox {
  /deep/.el-radio__input {
    display: none;
  }
}
</style>