自提点添加电话

This commit is contained in:
wangxiaowei 2024-10-09 17:34:27 +08:00
parent 542abae906
commit 2aae9027a0
5 changed files with 207 additions and 66 deletions

@ -8,6 +8,10 @@ export function addPostStation(data) {
return request.post("LocalStore/addPostStation", data);
}
export function editPostStationPhone(data) {
return request.post("LocalStore/editPostStationPhone", data);
}
export function delPostStation(data) {
return request.post("LocalStore/delPostStation", data);
}

@ -14,12 +14,20 @@
<view class="choose">
<view class="flex">
<view class="title" @click="showRegion = true">
<u-icon name="map-fill" size="28"></u-icon>
<u-icon class="m-r-10" name="map-fill" size="28"></u-icon>
{{area || '选择'}}
</view>
<view class="desc flex row-between">
<u-input class="input" v-model="address" placeholder="详细地址: 小区、门牌号等" />
<!-- <u-icon name="search" size="28" @tap="search"></u-icon> -->
</view>
</view>
<view class="flex m-t-20">
<view class="title">
<u-icon class="m-r-10" name="phone-fill" size="28"></u-icon>
电话
</view>
<view class="desc flex row-between">
<u-input class="input" v-model="phone" placeholder="自提点联系电话" />
</view>
</view>
<view class="text-center m-t-20 bold xxl" @tap="search">
@ -32,13 +40,28 @@
<view class="bold">自提点列表</view>
<view class="m-t-20 m-b-20">
<view v-if="postStationList" v-for="(item, index) in postStationList" :key="index"
class="m-b-20 flex row-between">
class="m-b-20">
<view class="flex">
<u-icon name="map-fill" size="28"></u-icon>
<text class="bold ">{{item.province}} {{item.city}} {{item.area}} {{item.address}}</text>
<text class="bold m-l-10">{{item.province}} {{item.city}} {{item.area}} {{item.address}}</text>
</view>
<view class="bold del" @tap="delItem(index, item.id)">
删除
<view class="flex" v-if="item.phone">
<u-icon name="phone-fill" size="28"></u-icon>
<text class="bold m-l-10">{{item.phone}}</text>
</view>
<view class="flex m-t-10">
<view class="bold" @tap="delItem(index, item.id)">
<u-icon name="trash" size="28"></u-icon>
<text class="m-l-10">
删除
</text>
</view>
<view class="bold m-l-20" @tap="editItem(index, item.id)">
<u-icon name="edit-pen" size="28"></u-icon>
<text class="m-l-10">
编辑电话
</text>
</view>
</view>
</view>
</view>
@ -46,6 +69,17 @@
</u-popup>
<u-modal v-model="showModel" :content="content" :show-cancel-button="true" @confirm="submit"></u-modal>
<u-picker v-model="showRegion" mode="region" @confirm="selCity"></u-picker>
<u-popup v-model="showEdit" :closeable="true" :maskCloseAble="false" mode="center" border-radius="14">
<view class="modify-container bg-white" style="width: 70vw;padding: 24rpx">
<view class="xl text-center">修改电话</view>
<form @submit="changeNameConfirm">
<u-form-item label="电话" :labelWidth="120">
<input style="height: 60rpx;" :value="editPhone" name="editPhone" placeholder="请输入电话"></input>
</u-form-item>
<button class="btn bg-primary white flex row-center" form-type="submit">确定</button>
</form>
</view>
</u-popup>
</view>
</template>
@ -63,21 +97,13 @@
getPostStationList,
getLocation,
addPostStation,
editPostStationPhone,
delPostStation
} from '@/api/local_store.js'
export default {
data() {
return {
// poiList: [{
// id: 1,
// latitude: 0,
// longitude: 0,
// iconPath: '/bundle_b/static/mark.png',
// width: 40,
// height: 40,
// alpha: 1
// }],
poiList: [],
lat: 0,
lng: 0,
@ -92,7 +118,12 @@
lstore_id: 0,
location: [],
info: [],
postStationList: []
postStationList: [],
phone: '',
showEdit: false,
editId: 0,
editPhone: '',
editIndex: 0
}
},
onLoad(e) {
@ -167,13 +198,18 @@
if (!this.address) return this.$toast({
title: "请输入地址"
})
if (!this.phone) return this.$toast({
title: "请输入自提点联系电话"
})
const address = `${this.province}${this.city}${this.area}${this.address}`
const {
code,
data
} = await getLocation({
address
address,
phone: this.phone
})
if (code == 1) {
@ -240,9 +276,35 @@
})
}
})
}
});
},
editItem(index, id) {
this.editIndex = index
this.editId = id
this.showEdit = true
this.editPhone = this.postStationList[index].phone
},
changeNameConfirm(e) {
if (!e.detail.value.editPhone) return this.$toast({
title: '请输入联系电话'
})
const phone = e.detail.value.editPhone
editPostStationPhone({
id: this.editId,
phone
}).then((res) => {
if (res.code == 1) {
this.$toast({
title: '修改成功'
})
this.postStationList[this.editIndex].phone = phone
this.editPhone = phone
}
})
}
},
computed: {
@ -299,8 +361,4 @@
border-radius: 50%;
box-shadow: 8rpx 8rpx 28rpx rgba(0, 0, 0, 0.4);
}
.del {
text-decoration: underline;
}
</style>

@ -10,7 +10,8 @@
<view class="flex pay">
<view class="m-r-20" style="font-size: 62rpx;">¥</view>
<input class="pay-money" v-model="money" type="digit" placeholder="请输入支付金额"
placeholder-style="font-size:28rpx;color: #6c757d;font-weight:normal;" style="height: 120rpx;">
placeholder-style="font-size:28rpx;color: #6c757d;font-weight:normal;"
style="height: 120rpx;">
</view>
</view>
</view>
@ -121,7 +122,13 @@
@click="changePostStation(index)">
<view class="flex row-between">
<view class="area lg text-left m-r-16">
{{item.province}} {{item.city}} {{item.area}} {{item.address}}
<view>
{{item.province}} {{item.city}} {{item.area}} {{item.address}}
</view>
<view class="m-t-10" @tap="call(item.phone)">
<u-icon name="phone" class="m-r-10" size="28"></u-icon>
{{item.phone}}
</view>
</view>
<u-radio shape="circle" :name="item.id" :active-color="colorConfig.primary" />
</view>
@ -309,7 +316,7 @@
if (this.goods_id && !this.post_station_id) return this.$toast({
title: "请选择自提点"
})
if (this.goods_id && !this.post_station_time) return this.$toast({
title: "请选择自提时间"
})
@ -499,20 +506,26 @@
yesterday.setDate(today.getDate() - 1);
const year = yesterday.getFullYear()
const date1 = yesterday.toISOString().split('T')[0]
const date2 = `${year}-${e.month}-${e.day}`
const yeateray = new Date(date1).getTime(); // 使用一个固定的年份
const chooseday = new Date(date2).getTime(); // 使用一个固定的年份
if (chooseday <= yeateray) {
return this.$toast({
title: '所选日期不能小于今日日期'
})
}
}
this.post_station_time_text = `${e.month}月${e.day}日`
this.post_station_time = `${e.month}-${e.day}`
},
call(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
}
}
}

@ -44,6 +44,9 @@
<u-image :src="aliOSSDomain + 'uniapp/dh.png'" width="32rpx" height="32rpx"></u-image>
</view>
</view>
<view class="item flex row-between" v-if="item.post_station" @tap.stop="call(item.post_station.phone)">
<view class="bold sm">自提点联系电话: {{item.post_station.phone}}</view>
</view>
<view class="item flex row-between">
<view class="bold sm">自提时间: {{item.post_station_time}}</view>
</view>
@ -272,6 +275,12 @@
this.ercodeUrl = data.url
this.showPopup = true
}
},
call(phone) {
uni.makePhoneCall({
phoneNumber: phone
});
}
},
computed: {

@ -1,5 +1,6 @@
<template>
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
:up="upOption">
<view class="index">
<u-sticky offset-top="0" h5-nav-height="0" bg-color="transparent">
<view class="index-bg">
@ -13,24 +14,26 @@
</router-link>
</view>
<view class="flex-1 m-t-30 flex">
<u-search wrap-bg-color="transparent" :hideRight="true" :show-action="true" action-text="取消" :action-style="{color: '#fff'}" :animation="true" @focus="hideRight=false"
@blur="hideRight=true" @custom="handleCancel" placeholder="搜索商家名称" height="64" @search="search"
v-model="keyword"></u-search>
<u-search wrap-bg-color="transparent" :hideRight="true" :show-action="true" action-text="取消"
:action-style="{color: '#fff'}" :animation="true" @focus="hideRight=false"
@blur="hideRight=true" @custom="handleCancel" placeholder="搜索商家名称" height="64"
@search="search" v-model="keyword"></u-search>
</view>
</u-navbar>
</view>
</u-sticky>
<view class="swiper">
<ad-swipers :pid="7" height="312rpx" radius="20rpx"></ad-swipers>
</view>
<view>
<view class="nav bg-white m-t-20" v-if="navList.length != ''">
<swiper :style="'height:' + navSwiperH + 'rpx;'" @change="swiperChange">
<swiper-item v-for="(items, index) in navList" :key="index">
<view class="flex flex-wrap">
<view v-for="(item, index2) in items" :key="index2" class="nav-item m-t-30" @tap="menuJump(item)">
<view v-for="(item, index2) in items" :key="index2" class="nav-item m-t-30"
@tap="menuJump(item)">
<view class="flex-col col-center">
<image class="nav-icon m-b-15" :src="item.image"></image>
<view class="name xs">{{item.name}}</view>
@ -45,7 +48,7 @@
</view>
</view>
</view>
<!-- <view class="filter">
<!-- <view class="filter">
<view :class="active == 1 ? 'active': ''">推荐</view>
<view :class="active == 2 ? 'active': ''">销量</view>
<view :class="'flex ' + (active == 3 ? 'active': '')">
@ -58,7 +61,7 @@
</view>
</view>
</view> -->
<view class="list">
<view class="list-block m-t-20" v-for="(item, index) in list" :key="index" style="width: 346rpx;height: 100%;">
<router-link :to="{path: '/bundle_b/pages/local_shop/local_shop_detail', query: {id: item.lstore_id}}">
@ -74,6 +77,28 @@
</router-link>
</view>
</view>
<!-- <view>
<u-waterfall v-model="list" ref="uWaterfall">
<template v-slot:left="{leftList}">
<view class="demo-warter" v-for="(item, index) in leftList" :key="index" @click="toPage(item.lstore_id)">
<u-lazy-load border-radius="10" :image="item.shopLogo"
:index="index"></u-lazy-load>
<view class="demo-title">
{{item.shopName}}
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view class="demo-warter" v-for="(item, index) in rightList" :key="index" @click="toPage(item.lstore_id)">
<u-lazy-load border-radius="10" :image="item.shopLogo"
:index="index"></u-lazy-load>
<view class="demo-title">
{{item.shopName}}
</view>
</view>
</template>
</u-waterfall>
</view> -->
</view>
<tabbar></tabbar>
</mescroll-body>
@ -94,7 +119,7 @@
getLocalHome,
getLocalList
} from '@/api/store.js'
export default {
mixins: [MescrollMixin],
data() {
@ -131,7 +156,7 @@
} catch (e) {}
// 选择城市后是否刷新
if (options?.refresh) await this.getHomeFun()
this.getLocal()
},
onShow(options) {
@ -145,28 +170,30 @@
methods: {
...mapActions(['initLocationFunc', 'getCartNum']),
...mapMutations(['setCityInfo']),
handleCancel() {
this.keyword = '';
this.mescroll.resetUpScroll()
this.keyword = '';
this.mescroll.resetUpScroll()
},
async getLocal() {
const {data} = await getLocalHome()
const {
data
} = await getLocalHome()
this.navList = [data]
if (this.navList[0].length == 0) {
this.navSwiperH = 0
if (this.navList[0].length == 0) {
this.navSwiperH = 0
return
}
if (this.navList[0].length <= 5) {
this.navSwiperH = 200
} else {
this.navSwiperH = 374
}
},
// 位置
async reLocationFunc() {
await this.initLocationFunc();
@ -185,9 +212,13 @@
menuJump(item)
},
upCallback(page) {
// 下拉刷新
downCallback() {
this.getLocal()
this.mescroll.resetUpScroll()
},
upCallback(page) {
const pageNum = page.num;
const pageSize = page.size;
if (this.cityInfo && this.cityInfo.gcj02_lng) {
@ -195,7 +226,7 @@
page_size: pageSize,
page_no: pageNum,
type: 'all',
c_name: this.cityInfo.name,
c_name: this.cityInfo.name,
longitude: this.cityInfo.gcj02_lng ?? 0,
latitude: this.cityInfo.gcj02_lat ?? 0,
keyword: this.keyword
@ -208,14 +239,31 @@
const hasNext = !!data.more;
this.list = this.list.concat(curPageData);
this.mescroll.endSuccess(curPageLen, hasNext);
// if (page.num == 1) this.list = [];
// const curPageData = data.list;
// const curPageLen = curPageData.length;
// const hasNext = !!data.more;
// this.list = this.list.concat(JSON.parse(JSON.stringify(curPageData)));
// this.mescroll.endSuccess(curPageLen, hasNext);
}).catch(() => {
this.mescroll.endErr()
})
}
},
search() {
this.$refs.uWaterfall.clear()
this.mescroll.resetUpScroll()
},
toPage(id) {
this.$Router.push({
path: '/bundle_b/pages/local_shop/local_shop_detail',
query: {
id
}
})
}
},
computed: {
@ -241,6 +289,14 @@
padding: 0;
}
.demo-warter {
border-radius: 8px;
margin: 5px;
background-color: #ffffff;
padding: 8px;
position: relative;
}
.index {
min-height: calc(100vh - var(--window-bottom));
@ -303,24 +359,24 @@
.swiper {
margin: 20rpx 0;
}
.filter {
display: flex;
align-items: center;
padding: 30rpx;
.arrow-icon {
transform: scale(0.5);
}
view {
margin-right: 20rpx;
}
.mr-0 {
margin-right: 0;
}
.active {
color: $-color-primary;
}
@ -334,13 +390,13 @@
align-items: stretch;
margin-top: 20rpx;
padding: 0 20rpx 20rpx 20rpx;
.list-block {
background-color: #fff;
.goods-image {
position: relative;
.goods-distance {
position: absolute;
bottom: 0;
@ -352,16 +408,17 @@
border-radius: 6rpx;
}
}
.shop-name {
padding: 20rpx 0 2rpx 10rpx;
}
}
.info {
background-color: #fff;
padding: 0 20rpx;
margin-bottom: 20rpx;
.info-header {
padding: 20rpx 0;
}
@ -390,7 +447,7 @@
}
}
}
.search {
color: #fff;
margin-right: 20rpx;