| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- <template>
- <div id="deliverDialo">
- <div class="deliverDialogBox">
- <div class="top">
- <div class="address CityTapBox">
- <img
- src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images%2FtaskPackage%2Ffontclass-dizhi%402x.png"
- alt=""
- />
- <div>
- {{ city_name }}
- <i class="el-icon-arrow-down"></i>
- </div>
- <el-cascader
- class="cascader"
- ref="refSubCat"
- v-model="district_select"
- :options="district"
- :props="props"
- @change="handleChange"
- ></el-cascader>
- </div>
- <div class="deleverAndAdress">
- <el-select v-model="optionsSelectValue" placeholder="请选择" @change="selectChange">
- <el-option
- v-for="item in optionsSelect"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- <div class="inp">
- <el-input
- v-if="optionsSelectValue == 1"
- v-model="deliverDialogInput"
- placeholder="搜索自提点a名称"
- ></el-input>
- <el-input
- v-if="optionsSelectValue == 2"
- id="suggestId"
- v-model="deliverDialogInput"
- placeholder="请输入详细的地点"
- @focus="focusInp"
- ></el-input>
- </div>
- <div class="searchBtn" @click="search">搜索</div>
- </div>
- <div class="contenBox">
- <div class="list" v-for="(item, index) in info" :key="index" @click="tapChild(item.id)">
- <div class="top">
- <div class="name">{{ item.deliver_name }}</div>
- <div class="btn" @click.stop="checkMore(index)">
- {{ !item.close ? "查看" : "收起" }}
- <i class="el-icon-arrow-down"></i>
- </div>
- </div>
- <div class="adddress">{{ item.full_address }} 562号</div>
- <div class="distance" v-if="item.distance">{{ item.distance }}{{ item.unit }}</div>
- <div class="timeContact">
- <div class="time">
- 营业时间:{{ item.business_hours_start }}-{{
- item.business_hours_end
- }}
- </div>
- <div class="phone" v-if="item.close">
- 联系电话:{{ item.deliver_mobile }}
- </div>
- </div>
- <div class="thumbBox" v-if="item.close && item.thumb.length > 0">
- <div class="txt">图片</div>
- <div class="thumbLis">
- <template v-for="(items, index) in item.thumb">
- <el-image
- :key="index"
- style="width: 70px; height: 70px"
- :src="items"
- :preview-src-list="setSrcList(items)"
- >
- </el-image>
- </template>
- </div>
- </div>
- </div>
- </div>
- <pagination
- v-show="total"
- :total="total"
- :pageSize="per_page"
- @pagination="monitorPage"
- :page="page"
- />
- </div>
- </div>
- </template>
- <script>
- import pagination from "~/components/default/pagination";
- export default {
- props: ["deliverDialogVisible", "city", "pointInfo", "goods", "district"],
- data() {
- return {
- optionsSelect: [
- {
- value: "1",
- label: "自提点",
- },
- {
- value: "2",
- label: "地址",
- },
- ],
- optionsSelectValue: "1",
- deliverDialogInput: "",
- goodsInfo: "",
- deliverName: "",
- info: "",
- srcList: [],
- props: {
- value: "v",
- children: "c",
- label: "n",
- },
- district_select: [],
- city_name:'',
- point:'',
- per_page: 15,
- total: 0,
- page: 1,
- };
- },
- components: { pagination },
- watch: {
- deliverDialogVisible: function (nval, oval) {
- console.log(nval,oval, "dddddd");
- if (nval) {
- this.city_name = this.city;
- this.point = this.pointInfo;
- this.getList(
- this.city_name,
- this.point.lat,
- this.point.lng,
- this.deliverDialogInput
- );
- }else{
- this.city_name = this.city;
- this.point = this.pointInfo;
- this.optionsSelectValue = "1";
- this.deliverDialogInput = ''
- }
- },
- },
- mounted() {
- this.city_name = this.city;
- this.point = this.pointInfo;
- this.getList(
- this.city_name,
- this.point.lat,
- this.point.lng,
- this.deliverDialogInput
- );
- },
- methods: {
- tapChild(_id){
- // plugin.package-deliver.frontend.decorate-deliver.getNowPackageDeliver
- let _url = "plugin.package-deliver.frontend.decorate-deliver.getNowPackageDeliver";
- if (!_id) {
- console.log("自提点id不能为空!");
- return;
- }
- this.fun.$get(_url, {deliver_id: _id}, ".").then(
- (response) => {
- if (response.result === 1) {
- this.$emit('childDeliver',response.data)
- } else {
- this.$message.error(response.msg);
- }
- },
- function (response) {
- console.log(response);
- }
- );
- },
- selectChange(){
- this.deliverDialogInput = ''
- },
- handleChange() {
- if (this.$refs["refSubCat"].getCheckedNodes()[0].parent) {
- if (this.$refs["refSubCat"].getCheckedNodes()[0].parent.parent) {
- let district =
- this.$refs["refSubCat"].getCheckedNodes()[0].label;
- let city =
- this.$refs["refSubCat"].getCheckedNodes()[0].parent.label;
- let province =
- this.$refs["refSubCat"].getCheckedNodes()[0].parent.parent.label;
- console.log(district,city,province,this.$refs["refSubCat"].getCheckedNodes()[0].parent, "dddddddd");
- this.city_name = city;
- this.point.lat = '';
- this.point.lng = '';
- }
- }
- },
- setSrcList(items) {
- return (this.srcList = [items]);
- },
- checkMore(index) {
- console.log(this.info[index]);
- if (this.info[index].close) {
- this.$set(this.info[index], "close", false);
- } else {
- this.$set(this.info[index], "close", true);
- }
- },
- focusInp() {
- let that = this;
- AMap.plugin("AMap.Autocomplete", function () {
- // 实例化Autocomplete
- var autoOptions = {
- //city 限定城市,默认全国
- city: that.city_name,
- input: "suggestId",
- };
- var autoComplete = new AMap.Autocomplete(autoOptions);
- AMap.event.addListener(autoComplete, "select", select); //注册监听,当选中某条记录时会触发
- });
- function select(e) {
- AMap.plugin("AMap.Geocoder", function () {
- var geocoder = new AMap.Geocoder({
- // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
- city: that.city,
- });
- //var lnglat = [116.396574, 39.992706]
- geocoder.getAddress(e.poi.location, function (status, result) {
- if (status === "complete" && result.info === "OK") {
- // result为对应的地理位置详细信息
- var point = {
- lat: e.poi.location.lat,
- lng: e.poi.location.lng,
- };
- var pos;
- if (result.regeocode.addressComponent.city == "") {
- pos = {
- address: e.poi.address,
- city: result.regeocode.addressComponent.province,
- province: result.regeocode.addressComponent.province,
- title: e.poi.name,
- point: point,
- };
- } else {
- pos = {
- address: e.poi.address,
- city: result.regeocode.addressComponent.city,
- province: result.regeocode.addressComponent.province,
- title: e.poi.name,
- point: point,
- };
- }
- // that.$store.commit("updateLocation", pos);
- // that.$store.commit("setLocation", pos);
- // myLocation = pos || {};
- that.getList(pos.city, point.lat, point.lng, "");
- } else {
- this.$message.error("请输入更详细的地址");
- }
- });
- });
- }
- },
- search() {
- if (this.optionsSelectValue == 2) {
- if(!this.deliverDialogInput) this.$message.error("请输入详细的地址");
- this.focusInp();
- } else {
- this.getList(
- this.city_name,
- this.point.lat,
- this.point.lng,
- this.deliverDialogInput
- );
- }
- },
- monitorPage() {
- this.page = val.page;
- this.getList(
- this.city_name,
- this.point.lat,
- this.point.lng,
- this.deliverDialogInput
- );
- },
- //高德坐标转百度(传入经度、纬度)
- bd_encrypt(gg_lng, gg_lat) {
- var X_PI = (Math.PI * 3000.0) / 180.0;
- var x = gg_lng,
- y = gg_lat;
- var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * X_PI);
- var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * X_PI);
- var bd_lng = z * Math.cos(theta) + 0.0065;
- var bd_lat = z * Math.sin(theta) + 0.006;
- return {
- lat: bd_lat,
- lng: bd_lng,
- };
- },
- getList(city, lat, lng, kwd) {
- let that = this;
- let p = {};
- if (lng) {
- p = this.bd_encrypt(lng, lat);
- }
- let json = {
- city_name: city,
- lat: p.lat || "",
- lng: p.lng || "",
- goods: that.$route.params.goods || [],
- kwd: kwd,
- };
- let _url = "plugin.package-deliver.frontend.deliver.getList";
- // const { store_id, groupStoreID } = this.$route.params;
- // if (this.$route.params.dispatch_id == 12 && (store_id || groupStoreID)) {
- // // 门店自提点,只返回该门店创建的自提点
- // json.store_id = store_id || groupStoreID;
- // _url = "plugin.package-deliver.frontend.store.deliver.getList";
- // }
- this.fun.$get(_url, json, ".").then(
- (response) => {
- if (response.result === 1) {
- // that.fun.setWXTitle(response.data.name);
- // that.isLoadMore = true;
- // that.total_page = response.data.list.last_page;
- // if (!that.total_page) {
- // that.total_page = 0;
- // }
- this.total = response.data.list.total;
- this.per_page = response.data.list.per_page;
- this.deliverName = response.data.name;
- this.optionsSelect[0].label = this.deliverName;
- this.info = response.data.list.data;
- } else {
- this.$message.error(response.msg);
- }
- },
- function (response) {
- console.log(response);
- }
- );
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .deliverDialogBox {
- background: #fff;
- padding: 0 10px;
- .top {
- display: flex;
- align-items: center;
- .searchBtn {
- width: 102px;
- height: 42px;
- background: #29ba9c;
- border-radius: 4px;
- font-size: 16px;
- color: #ffffff;
- text-align: center;
- line-height: 42px;
- margin-left: 20px;
- }
- .inp {
- width: 340px;
- }
- .deleverAndAdress {
- margin-right: 32px;
- }
- .CityTapBox {
- position: relative;
- .cascader {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- opacity: 0;
- }
- }
- .address {
- display: flex;
- align-items: center;
- margin-right: 20px;
- position: relative;
- img {
- width: 16px;
- height: 18px;
- margin-right: 8px;
- }
- }
- }
- .contenBox {
- padding: 35px 0;
- box-sizing: border-box;
- overflow: hidden;
- display: flex;
- flex-wrap: wrap;
- align-items: flex-start;
- .redListColor{
- border: 1px solid red;
- }
- .list {
- width: 472px;
- overflow: hidden;
- padding: 15px 22px;
- border: 1px solid #f0f0f0;
- border-radius: 4px;
- box-sizing: border-box;
- margin-right: 15px;
- margin-bottom: 15px;
- .top {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .name {
- font-size: 18px;
- color: #333333;
- }
- .btn {
- font-size: 16px;
- color: #29ba9c;
- .el-icon-arrow-down {
- color: #29ba9c;
- }
- }
- }
- .adddress {
- width: 100%;
- text-align: left;
- color: #333333;
- margin-top: 10px;
- margin-bottom: 10px;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .distance {
- font-size: 16px;
- color: #d7ab4b;
- text-align: right;
- }
- .timeContact {
- display: flex;
- justify-content: space-between;
- margin-top: 10px;
- .time,
- .phone {
- flex: 1;
- font-size: 14px;
- color: #666666;
- text-align: left;
- }
- }
- .thumbBox {
- margin-top: 10px;
- display: flex;
- .txt {
- font-size: 14px;
- color: #666666;
- margin-right: 11px;
- }
- .thumbLis {
- flex: 1;
- overflow-x: scroll;
- img {
- width: 70px;
- height: 70px;
- background: #e1e1e1;
- border-radius: 4px;
- }
- }
- .thumbLis::-webkit-scrollbar {
- width: 0 !important;
- }
- }
- }
- }
- }
- </style>
|