feat: 修改门店手机号保留一天和核销码显示逻辑,优化位置授权获取功能
This commit is contained in:
parent
20013124b9
commit
4e1768fa58
|
@ -3,9 +3,9 @@ let WSS_URL
|
|||
import store from "@/store/user.js"
|
||||
// 环境
|
||||
// let env = "dev"
|
||||
let env = "prod"
|
||||
// let env = "prod"
|
||||
// let env = "release";
|
||||
// let env = "local";
|
||||
let env = "local";
|
||||
|
||||
switch (env) {
|
||||
case 'dev':
|
||||
|
|
|
@ -225,7 +225,10 @@
|
|||
if (res.code == 1) {
|
||||
uni.$u.toast(res.msg);
|
||||
uni.$u.sleep(1500).then(res => {
|
||||
uni.navigateBack();
|
||||
// uni.navigateBack();
|
||||
uni.redirectTo({
|
||||
url: '/pagesOrder/order/order'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
uni.$u.toast(res.msg);
|
||||
|
|
|
@ -23,12 +23,16 @@
|
|||
<template #left>
|
||||
<view class="store-info">
|
||||
<view style="display: flex;font-size: 30rpx;font-weight: bold;">
|
||||
<text v-if=" vipList.includes(userStore.userInfo.user_ship) || shareInfo.store_id"
|
||||
<!-- <text v-if=" vipList.includes(userStore.userInfo.user_ship) || shareInfo.store_id"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
<text v-if="vipList.includes(userStore.userInfo.user_ship)">
|
||||
{{ (userStore.userInfo.real_name || userStore.userInfo.nickname) + '的供销个人门店' }}</text>
|
||||
{{ (userStore.userInfo.real_name || userStore.userInfo.nickname) + '的个人门店' }}</text>
|
||||
<text v-else>
|
||||
{{(shareInfo.real_name || (userStore.userInfo.real_name || userStore.userInfo.nickname)) + '的供销个人门店' }}</text>
|
||||
{{(shareInfo.real_name || (userStore.userInfo.real_name || userStore.userInfo.nickname)) + '的供销店' }}</text>
|
||||
</text> -->
|
||||
<text v-if="shareInfo.uid"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
{{shareInfo.real_name}}
|
||||
</text>
|
||||
<text v-else
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{
|
||||
|
@ -330,11 +334,11 @@
|
|||
onShareAppMessage(() => {
|
||||
let shareStr = '?id=' + STORE_INFO.id;
|
||||
if (vipList.includes(userStore.userInfo.user_ship)) {
|
||||
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo
|
||||
.real_name || userStore.userInfo.nickname)
|
||||
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo.share_name)
|
||||
}
|
||||
let shareInfo = {
|
||||
title: (userStore.userInfo.real_name || userStore.userInfo.nickname) + '的供销个人门店',
|
||||
// title: (userStore.userInfo.real_name || userStore.userInfo.nickname) + '的供销个人门店',
|
||||
title: STORE_INFO.store_name,
|
||||
path: '/pages/index/index' + shareStr,
|
||||
imageUrl: STORE_INFO.image || '',
|
||||
success() {
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon color="#fff"
|
||||
size="28"></up-icon>手机号快捷登录</up-button>
|
||||
</view>
|
||||
<view class="btn" v-if="config.ENV !='prod'">
|
||||
<view class="btn" style="width: 7rem; margin: 1rem auto;">
|
||||
<up-button @click="navgo('/pages/login/test')" color="#20B128" size="large"><up-icon
|
||||
name="account-fill" color="#fff" size="28"></up-icon>真-手机号快捷登录</up-button>
|
||||
name="account-fill" color="#fff" size="28"></up-icon>账号登录</up-button>
|
||||
</view>
|
||||
<!-- <view class="btn">
|
||||
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
|
||||
|
|
|
@ -8,21 +8,14 @@
|
|||
|
||||
<view class='card'>
|
||||
<view style="display: flex;align-items: center;">
|
||||
<text>手机号:</text>
|
||||
<up-input v-model="formData.account" placeholder="请输入手机号"></up-input>
|
||||
<text>账号:</text>
|
||||
<up-input v-model="formData.account" placeholder="请输入账号或手机号"></up-input>
|
||||
</view>
|
||||
<view style="margin: 30rpx 0;">
|
||||
</view>
|
||||
<view style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<text style="margin-right: 20rpx;">验证码:</text>
|
||||
<up-input v-model="formData.code" placeholder="请输入验证码" type='number'></up-input>
|
||||
<view class="code-btn">
|
||||
<view style="margin: 0 20rpx;">
|
||||
<up-line color="grey" direction="col" length="30rpx"></up-line>
|
||||
</view>
|
||||
<text class='btn-text' style="color: grey;" v-if='cutDown'>重新获取({{cutDown}})</text>
|
||||
<text @click="getCode" class='btn-text' v-else> {{flag?'获取验证码':'重新获取' }} </text>
|
||||
</view>
|
||||
<text style="margin-right: 20rpx;">密码:</text>
|
||||
<up-input v-model="formData.password" placeholder="请输入密码" password="true"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-btn">
|
||||
|
@ -55,8 +48,9 @@
|
|||
const formData = reactive({
|
||||
account: "",
|
||||
code: "",
|
||||
password:'',
|
||||
terminal: 1,
|
||||
scene: 2
|
||||
scene: 1
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -2,42 +2,82 @@
|
|||
<view class="">
|
||||
<view class="card">
|
||||
<up-form labelPosition="left" :model="formData" :rules="rules" ref="uForm" labelWidth="100">
|
||||
<up-form-item label="收货人" prop="real_name" borderBottom>
|
||||
<up-form-item label="联系人" prop="real_name" borderBottom>
|
||||
<up-input v-model="formData.real_name" disabledColor="#ffffff" border="none"
|
||||
placeholder="请填写收货人姓名"></up-input>
|
||||
placeholder="请填写联系人姓名"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="联系电话" prop="phone" borderBottom>
|
||||
<up-input v-model="formData.phone" disabledColor="#ffffff" type="number" placeholder="请填写联系电话"
|
||||
border="none"></up-input>
|
||||
</up-form-item>
|
||||
<!-- <up-form-item label="所在位置" prop="address" borderBottom>
|
||||
<up-input v-model="formData.address" disabledColor="#ffffff" type="number"
|
||||
@click='showAddressPop=true' placeholder="点击选择位置" border="none"></up-input>
|
||||
<template #right>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</template>
|
||||
</up-form-item> -->
|
||||
<up-form-item label="详细地址" prop="detail" borderBottom>
|
||||
<up-form-item label="所在位置" prop="address" borderBottom>
|
||||
<view @click="showPop = true" style="width: 100%;">
|
||||
<up-input style="pointer-events: none" v-model="formData.address" border="none" prefixIcon="map"
|
||||
readonly placeholder="点击选择地址" :customStyle="{
|
||||
background: '#F3F3F3', padding: '20rpx',
|
||||
'border-radius': '30rpx'
|
||||
}" :placeholderStyle="{ color: '#444444' }" :prefixIconStyle="{ 'margin-right': '40rpx' }"
|
||||
suffixIcon='arrow-down'></up-input>
|
||||
</view>
|
||||
</up-form-item>
|
||||
<!-- <up-form-item label="详细地址" prop="detail" borderBottom>
|
||||
<up-input v-model="formData.detail" disabledColor="#ffffff" placeholder="请填写详细地址"
|
||||
border="none"></up-input>
|
||||
</up-form-item>
|
||||
</up-form-item> -->
|
||||
</up-form>
|
||||
</view>
|
||||
<view class="card">
|
||||
<!-- <view class="card">
|
||||
<view class="is-default">
|
||||
<view>设置为默认地址</view>
|
||||
<up-switch v-model="formData.is_default" :activeValue="1" :inactiveValue="0"
|
||||
activeColor="#20B128"></up-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="bottom-fixed">
|
||||
<up-button color="#20B128" shape="circle" @click="submit">保存</up-button>
|
||||
</view>
|
||||
<!-- 地址选择器 -->
|
||||
<up-popup :show="showAddressPop" @close="showAddressPop=false" @open="showAddressPop=true" :round="10">
|
||||
<view class='address-pop'>
|
||||
<view class="title">
|
||||
收货地址
|
||||
<up-popup :show="showPop" @close="showPop = false" @open="showPop = true" :round="10">
|
||||
<view style="padding: 20rpx;">
|
||||
<up-tabs :list="tabsList" @change='addressTbasChange' :current='currentAddressIndex' lineColor='#20B128'
|
||||
:activeStyle="{ color: '#20B128' }"></up-tabs>
|
||||
<up-line style="margin-top:20rpx "></up-line>
|
||||
<view class="address-content" v-if='currentAddressIndex == 0'>
|
||||
<view class="address-li" :class='{ act: item.city_code == formData.city }'
|
||||
v-for="item in addressList.city" :key="item.city_code" @click="addressLiClick(0, item)">
|
||||
<text>{{ item.city_name }}</text>
|
||||
<up-icon name="arrow-right" :color="item.city_code == formData.city ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-content" v-else-if='currentAddressIndex == 1'>
|
||||
<view class="address-li" v-for="item in addressList.area" @click="addressLiClick(1, item)"
|
||||
:key="item.area_code" :class='{ act: item.area_code == formData.area }'>
|
||||
<text>{{ item.area_name }}</text>
|
||||
<up-icon name="arrow-right" :color="item.area_code == formData.area ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-content" v-else-if='currentAddressIndex == 2'>
|
||||
<view class="address-li" v-for="item in addressList.street" @click="addressLiClick(2, item)"
|
||||
:key="item.street_code" :class='{ act: item.street_code == formData.street }'>
|
||||
<text>{{ item.street_name }}</text>
|
||||
<up-icon name="arrow-right"
|
||||
:color="item.street_code == formData.street ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-content" v-else-if='currentAddressIndex == 3'>
|
||||
<view class="address-li" v-for="item in addressList.village" @click="addressLiClick(3, item)"
|
||||
:key="item.village_code" :class='{ act: item.village_code == formData.village }'>
|
||||
<text>{{ item.village_name }}</text>
|
||||
<up-icon name="arrow-right"
|
||||
:color="item.village_code == formData.village ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-content" v-else-if='currentAddressIndex == 4'>
|
||||
<view class="address-li" :class='{ act: item.id == formData.brigade }'
|
||||
v-for="item in addressList.brigade" :key="item.id" @click="addressLiClick(4, item)">
|
||||
<text>{{ item.brigade_name }}</text>
|
||||
<up-icon name="arrow-right" :color="item.id == formData.brigade ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
|
@ -51,6 +91,7 @@
|
|||
onLoad
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from "vue"
|
||||
import {
|
||||
|
@ -58,17 +99,38 @@
|
|||
addressEditApi,
|
||||
addressDetailApi
|
||||
} from "@/api/user.js"
|
||||
import {
|
||||
provinceListApi,
|
||||
cityListApi,
|
||||
areaListApi,
|
||||
streetListApi,
|
||||
villageListApi,
|
||||
brigadeListApi
|
||||
} from "@/api/address.js"
|
||||
import useUserStore from "@/store/user";
|
||||
|
||||
const mode = ref('add');
|
||||
const type = ref('');
|
||||
const showAddressPop = ref(false)
|
||||
|
||||
const formData = ref({
|
||||
real_name: '',
|
||||
phone: '',
|
||||
detail: '',
|
||||
is_default: 0,
|
||||
is_default: 1,
|
||||
province: 510000,
|
||||
city: '',
|
||||
area: "",
|
||||
street: "",
|
||||
village: "",
|
||||
brigade: "",
|
||||
address: ""
|
||||
})
|
||||
const userInfo = useUserStore().userInfo;
|
||||
if (userInfo) {
|
||||
formData.value.phone = userInfo.mobile
|
||||
formData.value.real_name = userInfo.real_name
|
||||
}
|
||||
const rules = ref({
|
||||
real_name: [{
|
||||
required: true,
|
||||
|
@ -95,19 +157,30 @@
|
|||
const uForm = ref(null);
|
||||
const submit = () => {
|
||||
uForm.value.validate().then(() => {
|
||||
console.log('验证通过');
|
||||
if (mode.value == 'add') {
|
||||
addressCreateApi(formData.value).then(res => {
|
||||
uni.$u.toast(res.msg);
|
||||
uni.$u.sleep(800).then(res => {
|
||||
uni.navigateBack();
|
||||
if (type.value == 'settle') {
|
||||
uni.redirectTo({
|
||||
url: '/pagesOrder/settle/settle'
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
addressEditApi(formData.value).then(res => {
|
||||
uni.$u.toast(res.msg);
|
||||
uni.$u.sleep(800).then(res => {
|
||||
uni.navigateBack();
|
||||
if (type.value == 'settle') {
|
||||
uni.redirectTo({
|
||||
url: '/pagesOrder/settle/settle'
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -123,8 +196,106 @@
|
|||
formData.value = res.data;
|
||||
})
|
||||
}
|
||||
// 地址选择
|
||||
const showPop = ref(false)
|
||||
const currentAddressIndex = ref(0)
|
||||
const currentAddressList = () => {
|
||||
if (!formData.city) return [0, 'city'];
|
||||
else if (formData.area) return [1, 'area'];
|
||||
else if (formData.street) return [2, 'street'];
|
||||
else if (formData.village) return [3, 'village'];
|
||||
else if (formData.brigade) return [4, 'brigade'];
|
||||
}
|
||||
|
||||
const addressTbasChange = (e) => {
|
||||
currentAddressIndex.value = e.index
|
||||
}
|
||||
|
||||
const addressList = reactive({
|
||||
city: [],
|
||||
area: [],
|
||||
street: [],
|
||||
village: [],
|
||||
brigade: []
|
||||
})
|
||||
const addressLiClick = async (i, item) => {
|
||||
if (i == 0) {
|
||||
formData.value.city = item.city_code
|
||||
tabsList[0].name = item.city_name
|
||||
let res = await areaListApi({
|
||||
city_code: formData.value.city
|
||||
})
|
||||
addressList.area = res.data
|
||||
}
|
||||
if (i == 1) {
|
||||
formData.value.area = item.area_code
|
||||
tabsList[1].name = item.area_name
|
||||
let res = await streetListApi({
|
||||
area_code: formData.value.area
|
||||
})
|
||||
addressList.street = res.data
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
formData.value.street = item.street_code
|
||||
tabsList[2].name = item.street_name
|
||||
let res = await villageListApi({
|
||||
street_code: formData.value.street
|
||||
})
|
||||
addressList.village = res.data
|
||||
}
|
||||
if (i == 3) {
|
||||
formData.value.village = item.village_code
|
||||
tabsList[3].name = item.village_name
|
||||
let res = await brigadeListApi({
|
||||
village_code: formData.value.village
|
||||
})
|
||||
addressList.brigade = res.data
|
||||
}
|
||||
if (i == 4) {
|
||||
formData.value.brigade = item.id
|
||||
tabsList[4].name = item.brigade_name
|
||||
|
||||
formData.value.address = tabsList[0].name + tabsList[1].name + tabsList[2].name + tabsList[3].name +
|
||||
tabsList[4].name
|
||||
return showPop.value = false
|
||||
}
|
||||
formData.value.address = tabsList[0].name + tabsList[1].name + tabsList[2].name + tabsList[3].name +
|
||||
tabsList[4]
|
||||
.name
|
||||
return currentAddressIndex.value++
|
||||
}
|
||||
const getCityList = async () => {
|
||||
let res = await cityListApi({
|
||||
province_code: formData.value.province
|
||||
})
|
||||
addressList.city = res.data
|
||||
}
|
||||
const tabsList = reactive(
|
||||
[{
|
||||
name: "请选择"
|
||||
},
|
||||
{
|
||||
name: '请选择',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: '请选择',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: '请选择',
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
name: '请选择',
|
||||
disabled: false
|
||||
},
|
||||
]);
|
||||
onLoad((options) => {
|
||||
if (options.type) {
|
||||
type.value = options.type
|
||||
}
|
||||
if (options.mode == 'edit' && options.address_id) {
|
||||
mode.value = 'edit';
|
||||
uni.setNavigationBarTitle({
|
||||
|
@ -134,6 +305,8 @@
|
|||
} else uni.setNavigationBarTitle({
|
||||
title: '新增地址'
|
||||
})
|
||||
getCityList()
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -171,15 +344,22 @@
|
|||
/* 适用于Android设备 */
|
||||
}
|
||||
|
||||
.address-pop {
|
||||
height: 60vh;
|
||||
.address-content {
|
||||
padding: 20rpx;
|
||||
height: 60vh;
|
||||
overflow-y: auto;
|
||||
|
||||
.title {
|
||||
.address-li {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 32rpx;
|
||||
color: black;
|
||||
text-align: center;
|
||||
color: #777777;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
|
||||
.act {
|
||||
color: #20B128;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -107,7 +107,7 @@
|
|||
<view class="mask" v-if='showVerifyPop' @click="showVerifyPop=false">
|
||||
<view
|
||||
style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);background-color: white;padding: 20rpx;">
|
||||
<up-image :src="orderData.verify_base64" width="710rpx" height="105rpx"></up-image>
|
||||
<up-image :src="orderData.verify_base64" mode="aspectFit" height="105rpx"></up-image>
|
||||
<view style="font-weight: bold;color: #333;font-size: 26;text-align: center;margin-top: 20rpx;">
|
||||
核销码 {{orderData.verify_code}}
|
||||
</view>
|
||||
|
|
|
@ -202,8 +202,8 @@
|
|||
@change="changeAddress" />
|
||||
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList" @close="shopListShow = false"
|
||||
@change="changeShop" @search="searchShop" />
|
||||
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
|
||||
@close="addAddress" @change="goPay" />
|
||||
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="取消" confirmText="添加地址" :show="toastAddressShow"
|
||||
@close="toastAddressoff" @change="addAddress" />
|
||||
<ZyPasswordboard v-if='passwordBoardVisible' v-model:visible="passwordBoardVisible" v-bind="passwordBoardProps"
|
||||
@close='closeKeyBord' />
|
||||
<up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton
|
||||
|
@ -288,7 +288,7 @@
|
|||
const openAddress = () => {
|
||||
if (addressList.length > 0) showAddress.value = true;
|
||||
else uni.navigateTo({
|
||||
url: '/pagesOrder/addressEdit/addressEdit'
|
||||
url: '/pagesOrder/addressEdit/addressEdit?type=settle'
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -379,9 +379,12 @@
|
|||
|
||||
// 选择地址
|
||||
const addAddress = () => {
|
||||
toastAddressShow.value = false;
|
||||
nextTick(() => {
|
||||
showAddress.value = true;
|
||||
// toastAddressShow.value = false;
|
||||
// nextTick(() => {
|
||||
// showAddress.value = true;
|
||||
// })
|
||||
uni.navigateTo({
|
||||
url: '/pagesOrder/addressEdit/addressEdit?type=settle'
|
||||
})
|
||||
}
|
||||
// 继续支付
|
||||
|
@ -398,7 +401,8 @@
|
|||
return uni.$u.toast('当前支付金额为0,暂不能使用微信支付')
|
||||
}
|
||||
|
||||
if (!isAddress.value && orderInfo.value.shipping_type == 1) return toastAddressShow.value = true;
|
||||
// if (!isAddress.value && orderInfo.value.shipping_type == 1) return toastAddressShow.value = true;
|
||||
if (orderInfo.value.address_id == 0) return toastAddressShow.value = true;
|
||||
createOrder();
|
||||
}
|
||||
|
||||
|
@ -560,6 +564,12 @@
|
|||
price = price + '';
|
||||
return price.split('.')[index] || (index ? '00' : '0');
|
||||
}
|
||||
const toastAddressoff=()=>{
|
||||
toastAddressShow.value=false;
|
||||
uni.redirectTo({
|
||||
url: '/pagesOrder/settle/settle'
|
||||
});
|
||||
}
|
||||
|
||||
onLoad(options => {
|
||||
// if (uni.getStorageSync('location')) {
|
||||
|
@ -570,7 +580,7 @@
|
|||
// getLocation()
|
||||
// }
|
||||
// } else {
|
||||
getLocation()
|
||||
getLocation()
|
||||
// }
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue