This commit is contained in:
mkm 2024-08-02 20:27:06 +08:00
commit 6864e75be3
8 changed files with 251 additions and 60 deletions

View File

@ -2,10 +2,10 @@ let BASE_URL
let WSS_URL let WSS_URL
import store from "@/store/user.js" import store from "@/store/user.js"
// 环境 // 环境
let env = "dev" // let env = "dev"
// let env = "prod" // let env = "prod"
// let env = "release"; // let env = "release";
// let env = "local"; let env = "local";
switch (env) { switch (env) {
case 'dev': case 'dev':

View File

@ -225,7 +225,10 @@
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg); uni.$u.toast(res.msg);
uni.$u.sleep(1500).then(res => { uni.$u.sleep(1500).then(res => {
uni.navigateBack(); // uni.navigateBack();
uni.redirectTo({
url: '/pagesOrder/order/order'
})
}) })
} else { } else {
uni.$u.toast(res.msg); uni.$u.toast(res.msg);

View File

@ -23,12 +23,16 @@
<template #left> <template #left>
<view class="store-info"> <view class="store-info">
<view style="display: flex;font-size: 30rpx;font-weight: bold;"> <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;"> style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
<text v-if="vipList.includes(userStore.userInfo.user_ship)"> <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> <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>
<text v-else <text v-else
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{
@ -330,11 +334,11 @@
onShareAppMessage(() => { onShareAppMessage(() => {
let shareStr = '?id=' + STORE_INFO.id; let shareStr = '?id=' + STORE_INFO.id;
if (vipList.includes(userStore.userInfo.user_ship)) { if (vipList.includes(userStore.userInfo.user_ship)) {
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo.share_name)
.real_name || userStore.userInfo.nickname)
} }
let shareInfo = { 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, path: '/pages/index/index' + shareStr,
imageUrl: STORE_INFO.image || '', imageUrl: STORE_INFO.image || '',
success() { success() {
@ -717,7 +721,7 @@
store_id: where.value.store_id store_id: where.value.store_id
}); });
// //
if (opt.spread_uid) { if (opt.spread_uid) {
shareInfo.value.uid = opt.spread_uid; shareInfo.value.uid = opt.spread_uid;
shareInfo.value.real_name = opt.real_name; shareInfo.value.real_name = opt.real_name;
shareInfo.value.store_id = opt.id; shareInfo.value.store_id = opt.id;

View File

@ -16,9 +16,9 @@
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon color="#fff" <up-button @click="weixinLogin" color="#20B128" size="large"><up-icon color="#fff"
size="28"></up-icon></up-button> size="28"></up-icon></up-button>
</view> </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 <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>
<!-- <view class="btn"> <!-- <view class="btn">
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff" <up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"

View File

@ -8,21 +8,14 @@
<view class='card'> <view class='card'>
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<text>手机</text> <text></text>
<up-input v-model="formData.account" placeholder="请输入手机号"></up-input> <up-input v-model="formData.account" placeholder="请输入账号或手机号"></up-input>
</view> </view>
<view style="margin: 30rpx 0;"> <view style="margin: 30rpx 0;">
</view> </view>
<view style="display: flex;justify-content: space-between;align-items: center;"> <view style="display: flex;justify-content: space-between;align-items: center;">
<text style="margin-right: 20rpx;">验证码:</text> <text style="margin-right: 20rpx;">密码:</text>
<up-input v-model="formData.code" placeholder="请输入验证码" type='number'></up-input> <up-input v-model="formData.password" placeholder="请输入密码" password="true"></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>
</view> </view>
</view> </view>
<view class="submit-btn"> <view class="submit-btn">
@ -55,8 +48,9 @@
const formData = reactive({ const formData = reactive({
account: "", account: "",
code: "", code: "",
password:'',
terminal: 1, terminal: 1,
scene: 2 scene: 1
}) })

View File

@ -2,42 +2,82 @@
<view class=""> <view class="">
<view class="card"> <view class="card">
<up-form labelPosition="left" :model="formData" :rules="rules" ref="uForm" labelWidth="100"> <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" <up-input v-model="formData.real_name" disabledColor="#ffffff" border="none"
placeholder="请填写收货人姓名"></up-input> placeholder="请填写联系人姓名"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="联系电话" prop="phone" borderBottom> <up-form-item label="联系电话" prop="phone" borderBottom>
<up-input v-model="formData.phone" disabledColor="#ffffff" type="number" placeholder="请填写联系电话" <up-input v-model="formData.phone" disabledColor="#ffffff" type="number" placeholder="请填写联系电话"
border="none"></up-input> border="none"></up-input>
</up-form-item> </up-form-item>
<!-- <up-form-item label="所在位置" prop="address" borderBottom> <up-form-item label="所在位置" prop="address" borderBottom>
<up-input v-model="formData.address" disabledColor="#ffffff" type="number" <view @click="showPop = true" style="width: 100%;">
@click='showAddressPop=true' placeholder="点击选择位置" border="none"></up-input> <up-input style="pointer-events: none" v-model="formData.address" border="none" prefixIcon="map"
<template #right> readonly placeholder="点击选择地址" :customStyle="{
<up-icon name="arrow-right"></up-icon> background: '#F3F3F3', padding: '20rpx',
</template> 'border-radius': '30rpx'
</up-form-item> --> }" :placeholderStyle="{ color: '#444444' }" :prefixIconStyle="{ 'margin-right': '40rpx' }"
<up-form-item label="详细地址" prop="detail" borderBottom> 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="请填写详细地址" <up-input v-model="formData.detail" disabledColor="#ffffff" placeholder="请填写详细地址"
border="none"></up-input> border="none"></up-input>
</up-form-item> </up-form-item> -->
</up-form> </up-form>
</view> </view>
<view class="card"> <!-- <view class="card">
<view class="is-default"> <view class="is-default">
<view>设置为默认地址</view> <view>设置为默认地址</view>
<up-switch v-model="formData.is_default" :activeValue="1" :inactiveValue="0" <up-switch v-model="formData.is_default" :activeValue="1" :inactiveValue="0"
activeColor="#20B128"></up-switch> activeColor="#20B128"></up-switch>
</view> </view>
</view> </view> -->
<view class="bottom-fixed"> <view class="bottom-fixed">
<up-button color="#20B128" shape="circle" @click="submit">保存</up-button> <up-button color="#20B128" shape="circle" @click="submit">保存</up-button>
</view> </view>
<!-- 地址选择器 --> <!-- 地址选择器 -->
<up-popup :show="showAddressPop" @close="showAddressPop=false" @open="showAddressPop=true" :round="10"> <up-popup :show="showPop" @close="showPop = false" @open="showPop = true" :round="10">
<view class='address-pop'> <view style="padding: 20rpx;">
<view class="title"> <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>
</view> </view>
</up-popup> </up-popup>
@ -51,6 +91,7 @@
onLoad onLoad
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
import { import {
reactive,
ref ref
} from "vue" } from "vue"
import { import {
@ -58,17 +99,38 @@
addressEditApi, addressEditApi,
addressDetailApi addressDetailApi
} from "@/api/user.js" } 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 mode = ref('add');
const type = ref('');
const showAddressPop = ref(false) const showAddressPop = ref(false)
const formData = ref({ const formData = ref({
real_name: '', real_name: '',
phone: '', phone: '',
detail: '', detail: '',
is_default: 0, is_default: 1,
province: 510000,
city: '',
area: "",
street: "",
village: "",
brigade: "",
address: "" address: ""
}) })
const userInfo = useUserStore().userInfo;
if (userInfo) {
formData.value.phone = userInfo.mobile
formData.value.real_name = userInfo.real_name
}
const rules = ref({ const rules = ref({
real_name: [{ real_name: [{
required: true, required: true,
@ -95,19 +157,30 @@
const uForm = ref(null); const uForm = ref(null);
const submit = () => { const submit = () => {
uForm.value.validate().then(() => { uForm.value.validate().then(() => {
console.log('验证通过');
if (mode.value == 'add') { if (mode.value == 'add') {
addressCreateApi(formData.value).then(res => { addressCreateApi(formData.value).then(res => {
uni.$u.toast(res.msg); uni.$u.toast(res.msg);
uni.$u.sleep(800).then(res => { uni.$u.sleep(800).then(res => {
uni.navigateBack(); if (type.value == 'settle') {
uni.redirectTo({
url: '/pagesOrder/settle/settle'
});
} else {
uni.navigateBack();
}
}) })
}) })
} else { } else {
addressEditApi(formData.value).then(res => { addressEditApi(formData.value).then(res => {
uni.$u.toast(res.msg); uni.$u.toast(res.msg);
uni.$u.sleep(800).then(res => { 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; 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) => { onLoad((options) => {
if (options.type) {
type.value = options.type
}
if (options.mode == 'edit' && options.address_id) { if (options.mode == 'edit' && options.address_id) {
mode.value = 'edit'; mode.value = 'edit';
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
@ -134,6 +305,8 @@
} else uni.setNavigationBarTitle({ } else uni.setNavigationBarTitle({
title: '新增地址' title: '新增地址'
}) })
getCityList()
}) })
</script> </script>
@ -171,15 +344,22 @@
/* 适用于Android设备 */ /* 适用于Android设备 */
} }
.address-pop { .address-content {
height: 60vh;
padding: 20rpx; padding: 20rpx;
height: 60vh;
overflow-y: auto; overflow-y: auto;
.title { .address-li {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx; font-size: 32rpx;
color: black; color: #777777;
text-align: center; margin: 30rpx 0;
}
.act {
color: #20B128;
} }
} }
</style> </style>

View File

@ -107,7 +107,7 @@
<view class="mask" v-if='showVerifyPop' @click="showVerifyPop=false"> <view class="mask" v-if='showVerifyPop' @click="showVerifyPop=false">
<view <view
style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);background-color: white;padding: 20rpx;"> 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;"> <view style="font-weight: bold;color: #333;font-size: 26;text-align: center;margin-top: 20rpx;">
核销码 {{orderData.verify_code}} 核销码 {{orderData.verify_code}}
</view> </view>

View File

@ -202,8 +202,8 @@
@change="changeAddress" /> @change="changeAddress" />
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList" @close="shopListShow = false" <shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList" @close="shopListShow = false"
@change="changeShop" @search="searchShop" /> @change="changeShop" @search="searchShop" />
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow" <modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="取消" confirmText="添加地址" :show="toastAddressShow"
@close="addAddress" @change="goPay" /> @close="toastAddressoff" @change="addAddress" />
<ZyPasswordboard v-if='passwordBoardVisible' v-model:visible="passwordBoardVisible" v-bind="passwordBoardProps" <ZyPasswordboard v-if='passwordBoardVisible' v-model:visible="passwordBoardVisible" v-bind="passwordBoardProps"
@close='closeKeyBord' /> @close='closeKeyBord' />
<up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton <up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton
@ -288,7 +288,7 @@
const openAddress = () => { const openAddress = () => {
if (addressList.length > 0) showAddress.value = true; if (addressList.length > 0) showAddress.value = true;
else uni.navigateTo({ else uni.navigateTo({
url: '/pagesOrder/addressEdit/addressEdit' url: '/pagesOrder/addressEdit/addressEdit?type=settle'
}) })
} }
@ -379,9 +379,12 @@
// //
const addAddress = () => { const addAddress = () => {
toastAddressShow.value = false; // toastAddressShow.value = false;
nextTick(() => { // nextTick(() => {
showAddress.value = true; // showAddress.value = true;
// })
uni.navigateTo({
url: '/pagesOrder/addressEdit/addressEdit?type=settle'
}) })
} }
// //
@ -392,13 +395,14 @@
} }
// //
const submitOrder = () => { const submitOrder = () => {
if (orderInfo.value.pay_price == 0) { if (orderInfo.value.pay_price == 0) {
pay_type.value = 3; pay_type.value = 3;
return uni.$u.toast('当前支付金额为0暂不能使用微信支付') 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(); createOrder();
} }
@ -560,6 +564,12 @@
price = price + ''; price = price + '';
return price.split('.')[index] || (index ? '00' : '0'); return price.split('.')[index] || (index ? '00' : '0');
} }
const toastAddressoff=()=>{
toastAddressShow.value=false;
uni.redirectTo({
url: '/pagesOrder/settle/settle'
});
}
onLoad(options => { onLoad(options => {
// if (uni.getStorageSync('location')) { // if (uni.getStorageSync('location')) {
@ -570,7 +580,7 @@
// getLocation() // getLocation()
// } // }
// } else { // } else {
getLocation() getLocation()
// } // }
}) })