页面提交
This commit is contained in:
parent
78c6170ef0
commit
649470558e
@ -94,6 +94,7 @@
|
|||||||
"@dcloudio/uni-mp-xhs": "3.0.0-4060620250520001",
|
"@dcloudio/uni-mp-xhs": "3.0.0-4060620250520001",
|
||||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4060620250520001",
|
"@dcloudio/uni-quickapp-webview": "3.0.0-4060620250520001",
|
||||||
"@tanstack/vue-query": "^5.62.16",
|
"@tanstack/vue-query": "^5.62.16",
|
||||||
|
"@vant/area-data": "^2.1.0",
|
||||||
"abortcontroller-polyfill": "^1.7.8",
|
"abortcontroller-polyfill": "^1.7.8",
|
||||||
"dayjs": "1.11.10",
|
"dayjs": "1.11.10",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
|
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
@ -70,6 +70,9 @@ importers:
|
|||||||
'@tanstack/vue-query':
|
'@tanstack/vue-query':
|
||||||
specifier: ^5.62.16
|
specifier: ^5.62.16
|
||||||
version: 5.62.16(vue@3.5.15(typescript@5.7.2))
|
version: 5.62.16(vue@3.5.15(typescript@5.7.2))
|
||||||
|
'@vant/area-data':
|
||||||
|
specifier: ^2.1.0
|
||||||
|
version: 2.1.0
|
||||||
abortcontroller-polyfill:
|
abortcontroller-polyfill:
|
||||||
specifier: ^1.7.8
|
specifier: ^1.7.8
|
||||||
version: 1.7.8
|
version: 1.7.8
|
||||||
@ -2502,6 +2505,9 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0
|
vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0
|
||||||
|
|
||||||
|
'@vant/area-data@2.1.0':
|
||||||
|
resolution: {integrity: sha512-wx9PrUX7wSUJiFcz8UrcvZfTjV6sTc+7SHcbjGQQzEcv5y+EwOo5uV4ZKdfrR5Hzcw4MA08LQdvXPSEb4nWbug==}
|
||||||
|
|
||||||
'@vitejs/plugin-legacy@5.3.2':
|
'@vitejs/plugin-legacy@5.3.2':
|
||||||
resolution: {integrity: sha512-8moCOrIMaZ/Rjln0Q6GsH6s8fAt1JOI3k8nmfX4tXUxE5KAExVctSyOBk+A25GClsdSWqIk2yaUthH3KJ2X4tg==}
|
resolution: {integrity: sha512-8moCOrIMaZ/Rjln0Q6GsH6s8fAt1JOI3k8nmfX4tXUxE5KAExVctSyOBk+A25GClsdSWqIk2yaUthH3KJ2X4tg==}
|
||||||
engines: {node: ^18.0.0 || >=20.0.0}
|
engines: {node: ^18.0.0 || >=20.0.0}
|
||||||
@ -9678,6 +9684,8 @@ snapshots:
|
|||||||
- vue
|
- vue
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@vant/area-data@2.1.0': {}
|
||||||
|
|
||||||
'@vitejs/plugin-legacy@5.3.2(terser@5.36.0)(vite@5.2.8(@types/node@20.17.9)(sass@1.77.8)(terser@5.36.0))':
|
'@vitejs/plugin-legacy@5.3.2(terser@5.36.0)(vite@5.2.8(@types/node@20.17.9)(sass@1.77.8)(terser@5.36.0))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/core': 7.26.0
|
'@babel/core': 7.26.0
|
||||||
|
@ -37,14 +37,14 @@ export function login(loginForm: ILoginForm) {
|
|||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
export function getUserInfo() {
|
export function getUserInfo() {
|
||||||
return http.get<IUserInfoVo>('/user/info')
|
return http.get('/api/user/info')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录
|
* 退出登录
|
||||||
*/
|
*/
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return http.get<void>('/user/logout')
|
return http.get<void>('/api/user/logout')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
38
src/hooks/area-data/index.ts
Normal file
38
src/hooks/area-data/index.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// 可以将此代码放置于项目src/hooks/useColPickerData.ts中
|
||||||
|
import { useCascaderAreaData } from '@vant/area-data'
|
||||||
|
|
||||||
|
export type CascaderOption = {
|
||||||
|
text: string
|
||||||
|
value: string
|
||||||
|
children?: CascaderOption[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用'@vant/area-data'作为数据源,构造ColPicker组件的数据
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export default function useColPickerData() {
|
||||||
|
// '@vant/area-data' 数据源
|
||||||
|
const colPickerData: CascaderOption[] = useCascaderAreaData()
|
||||||
|
|
||||||
|
// 根据code查找子节点,不传code则返回所有节点
|
||||||
|
function findChildrenByCode(data: CascaderOption[], code?: string): CascaderOption[] | null {
|
||||||
|
if (!code) {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
for (const item of data) {
|
||||||
|
if (item.value === code) {
|
||||||
|
return item.children || null
|
||||||
|
}
|
||||||
|
if (item.children) {
|
||||||
|
const childrenResult = findChildrenByCode(item.children, code)
|
||||||
|
if (childrenResult) {
|
||||||
|
return childrenResult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return { colPickerData, findChildrenByCode }
|
||||||
|
}
|
3
src/hooks/index.ts
Normal file
3
src/hooks/index.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import useColPickerData from './area-data'
|
||||||
|
|
||||||
|
export { useColPickerData }
|
@ -80,9 +80,11 @@ const httpInterceptor = {
|
|||||||
// 3. 添加 token 请求头标识
|
// 3. 添加 token 请求头标识
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const { token } = userStore.userInfo as unknown as IUserInfo
|
const { token } = userStore.userInfo as unknown as IUserInfo
|
||||||
if (token) {
|
// console.log('token', token)
|
||||||
options.header.Authorization = `Bearer ${token}`
|
// if (token) {
|
||||||
}
|
// options.header.Authorization = `Bearer ${token.access_token}`
|
||||||
|
// }
|
||||||
|
options.header.Authorization = `Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3ZWJtYW4udGlueXdhbi5jbiIsImF1ZCI6IndlYm1hbi50aW55d2FuLmNuIiwiaWF0IjoxNzU2ODAyMTM3LCJuYmYiOjE3NTY4MDIxMzcsImV4cCI6MTc1NjgwOTMzNywiZXh0ZW5kIjp7ImlkIjoyMX19.3Zp61BOC34ZC919a2ifNUoZJb2RAYZxNjH7j_Enj1P0`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</wd-grid>
|
</wd-grid>
|
||||||
</wd-card>
|
</wd-card>
|
||||||
<!-- <button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button> -->
|
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -44,10 +44,9 @@
|
|||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { http } from '@/utils/http'
|
import { http } from '@/utils/http'
|
||||||
import WxLogin from './components/wx-login.vue'
|
import WxLogin from './components/wx-login.vue'
|
||||||
|
const userStore = useUserStore()
|
||||||
const hasLogin = computed(() => userStore.userInfo?.nickname)
|
const hasLogin = computed(() => userStore.userInfo?.nickname)
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
const openId = ref('')
|
const openId = ref('')
|
||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
|
@ -4,33 +4,70 @@
|
|||||||
}
|
}
|
||||||
</route>
|
</route>
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="p-2">
|
||||||
<wx-login />
|
<view class="p-2 detail-box bg-white">
|
||||||
<!-- <view class="ml-4">wx的openid:</view> -->
|
|
||||||
<!-- <view class="ml-4">{{ openId }}</view> -->
|
|
||||||
|
|
||||||
<view class="p-2">
|
|
||||||
<wd-card>
|
<wd-card>
|
||||||
<wd-cell-group>
|
<wd-cell-group>
|
||||||
<!-- <wd-cell title="标题文字" center>
|
<wd-cell
|
||||||
<wd-button custom-class="custom-value" size="small" plain>按钮</wd-button>
|
icon=""
|
||||||
</wd-cell>
|
title="昵称"
|
||||||
<wd-cell title="标题文字" center>
|
right-icon="lock"
|
||||||
<view class="custom-value" style="height: 32px">
|
:value="userInfo.nickname"
|
||||||
<wd-switch v-model="switchValue" change="handleSwitchChange" />
|
:border="false"
|
||||||
</view>
|
size="large"
|
||||||
</wd-cell> -->
|
custom-style="padding:20rpx;font-size:28rpx"
|
||||||
<wd-cell title="我的钱包" is-link to="/pages/index/index">
|
/>
|
||||||
|
<wd-cell
|
||||||
|
icon=""
|
||||||
|
title="角色"
|
||||||
|
right-icon="lock"
|
||||||
|
:value="userInfo.group_name"
|
||||||
|
:border="false"
|
||||||
|
size="large"
|
||||||
|
custom-style="padding:20rpx;font-size:28rpx"
|
||||||
|
/>
|
||||||
|
<wd-cell
|
||||||
|
icon=""
|
||||||
|
title="手机号"
|
||||||
|
is-link
|
||||||
|
right-icon="lock"
|
||||||
|
:value="userInfo.phone"
|
||||||
|
:border="false"
|
||||||
|
size="large"
|
||||||
|
custom-style="padding:20rpx;font-size:28rpx"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<wd-cell
|
||||||
|
icon="order"
|
||||||
|
title="我的订单"
|
||||||
|
is-link
|
||||||
|
value=""
|
||||||
|
:border="false"
|
||||||
|
size="large"
|
||||||
|
custom-style="padding:20rpx;font-size:28rpx"
|
||||||
|
@click="myOrder"
|
||||||
|
/>
|
||||||
|
<wd-cell
|
||||||
|
title="我的钱包"
|
||||||
|
is-link
|
||||||
|
to="/pages/index/index"
|
||||||
|
:border="false"
|
||||||
|
size="large"
|
||||||
|
custom-style="padding:20rpx;font-size:28rpx"
|
||||||
|
>
|
||||||
<view class="custom-text"></view>
|
<view class="custom-text"></view>
|
||||||
</wd-cell>
|
</wd-cell>
|
||||||
<wd-col-picker
|
<wd-col-picker
|
||||||
label="做宴地址"
|
label="做宴地址"
|
||||||
v-model="orderInfo.district_name"
|
v-model="address"
|
||||||
prop="district_name"
|
prop="address"
|
||||||
:columns="area"
|
:columns="area"
|
||||||
:column-change="columnChange"
|
:column-change="columnChange"
|
||||||
placeholder="请填写做宴地址"
|
placeholder="请填写做宴地址"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleConfirm"
|
||||||
|
:border="false"
|
||||||
|
size="large"
|
||||||
|
custom-style="padding:20rpx;font-size:28rpx"
|
||||||
:rules="[
|
:rules="[
|
||||||
{
|
{
|
||||||
required: false,
|
required: false,
|
||||||
@ -44,82 +81,40 @@
|
|||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
></wd-col-picker>
|
></wd-col-picker>
|
||||||
<!-- <wd-cell>
|
|
||||||
<template #title>
|
|
||||||
<view>
|
|
||||||
<view style="display: inline-block">标题文字</view>
|
|
||||||
<view class="end-time">25天后到期</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</wd-cell> -->
|
|
||||||
</wd-cell-group>
|
</wd-cell-group>
|
||||||
</wd-card>
|
</wd-card>
|
||||||
|
|
||||||
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
|
|
||||||
</view>
|
</view>
|
||||||
|
<button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<style>
|
|
||||||
.cell-icon {
|
|
||||||
display: block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 4px 0;
|
|
||||||
width: 16px;
|
|
||||||
height: 24px;
|
|
||||||
margin-right: 4px;
|
|
||||||
background: url('https://img10.360buyimg.com/jmadvertisement/jfs/t1/71075/7/3762/1820/5d1f26d1E0d600b9e/a264c901943080ac.png')
|
|
||||||
no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
:deep(.custom-value) {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
right: 0;
|
|
||||||
transform: translate(0, -50%);
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.custom-text {
|
|
||||||
color: #f0883a;
|
|
||||||
}
|
|
||||||
.end-time {
|
|
||||||
display: inline-block;
|
|
||||||
margin-left: 8px;
|
|
||||||
border: 1px solid #faa21e;
|
|
||||||
padding: 0 4px;
|
|
||||||
font-size: 10px;
|
|
||||||
color: #faa21e;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
const switchValue = ref('')
|
const switchValue = ref('')
|
||||||
function handleSwitchChange({ value }) {
|
function handleSwitchChange({ value }) {
|
||||||
console.log(value)
|
console.log(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// import { useUserStore } from '@/store'
|
// import { useUserStore } from '@/store'
|
||||||
// import { http } from '@/utils/http'
|
// import { http } from '@/utils/http'
|
||||||
// import WxLogin from './components/wx-login.vue'
|
// import WxLogin from './components/wx-login.vue'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const hasLogin = computed(() => userStore.userInfo?.nickname)
|
import { useColPickerData, useModal } from '@/hooks'
|
||||||
|
|
||||||
// const userStore = useUserStore()
|
|
||||||
// const openId = ref('')
|
|
||||||
|
|
||||||
// const logout = () => {
|
|
||||||
// uni.showModal({
|
|
||||||
// title: '确认退出当前账号?',
|
|
||||||
// success: (res) => {
|
|
||||||
// if (res.confirm) {
|
|
||||||
// userStore.logout()
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
const { colPickerData, findChildrenByCode } = useColPickerData()
|
||||||
import { defineComponent } from 'vue'
|
import { defineComponent } from 'vue'
|
||||||
|
import {
|
||||||
|
getInfoAPI,
|
||||||
|
getCityAPI,
|
||||||
|
getDistrictAPI,
|
||||||
|
getStreetAPI,
|
||||||
|
getVillageAPI,
|
||||||
|
} from '@/service/crmeb/product.ts'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
hasLogin: false,
|
||||||
totalPrice: 0,
|
totalPrice: 0,
|
||||||
pre_price: 0,
|
pre_price: 0,
|
||||||
server_user: {
|
server_user: {
|
||||||
@ -134,37 +129,63 @@ export default defineComponent({
|
|||||||
area: [],
|
area: [],
|
||||||
value: [],
|
value: [],
|
||||||
order_type: 1, //厨师 2 酒店
|
order_type: 1, //厨师 2 酒店
|
||||||
orderInfo: {
|
userInfo: {
|
||||||
district_name: [],
|
nickname: '',
|
||||||
street_name: '',
|
|
||||||
cart_ids: 0, //酒店
|
|
||||||
customer_name: '',
|
|
||||||
phone: '',
|
phone: '',
|
||||||
address: '',
|
group_name: '',
|
||||||
remark: '',
|
district_name: [],
|
||||||
banquet_type: '1',
|
|
||||||
reservation_type: 1,
|
|
||||||
server_user_id: 0,
|
|
||||||
table_number: 1, //酒店
|
|
||||||
banquet_date: null, //酒店
|
|
||||||
},
|
},
|
||||||
matchedItems_sp: [],
|
|
||||||
|
address: [],
|
||||||
|
// district: 0, //区
|
||||||
|
// street: 0, //街道
|
||||||
|
// village: 0, //村
|
||||||
|
|
||||||
showDatePicker: false,
|
showDatePicker: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
async onLoad(option) {
|
||||||
this.server_user_id = option.id
|
|
||||||
this.orderInfo.cart_ids = option.cart_ids || 0
|
|
||||||
if (this.orderInfo.cart_ids) {
|
|
||||||
this.order_type = 2 //酒店
|
|
||||||
}
|
|
||||||
this.orderInfo.server_user_id = option.id
|
|
||||||
this.getCartCheck()
|
|
||||||
this.getArea()
|
this.getArea()
|
||||||
|
this.getUserInfo()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
logout() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '确认退出当前账号?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
userStore.logout()
|
||||||
|
this.goBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
async getDistrict() {
|
||||||
|
const res = await getDistrictAPI()
|
||||||
|
if (res.code === 1) {
|
||||||
|
const areaData = res.data
|
||||||
|
this.area = [
|
||||||
|
areaData.map((item) => ({
|
||||||
|
value: item.code,
|
||||||
|
label: item.name,
|
||||||
|
grade: 1,
|
||||||
|
})),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async getUserInfo() {
|
||||||
|
this.hasLogin = userStore.userInfo?.nickname
|
||||||
|
const res = await getInfoAPI()
|
||||||
|
if (res.code === 1) {
|
||||||
|
console.log('用户信息:', res.data)
|
||||||
|
this.userInfo = res.data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
pickDate(e) {
|
pickDate(e) {
|
||||||
this.orderInfo.banquet_date = e[0]
|
// this.userInfo.banquet_date = e[0]
|
||||||
this.showDatePicker = false
|
this.showDatePicker = false
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
@ -172,12 +193,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
//表单验证
|
//表单验证
|
||||||
handleSubmit(reservation_type) {
|
handleSubmit(reservation_type) {
|
||||||
this.orderInfo.reservation_type = reservation_type //付款类型
|
this.userInfo.reservation_type = reservation_type //付款类型
|
||||||
this.$refs.form
|
this.$refs.form
|
||||||
.validate()
|
.validate()
|
||||||
.then(({ valid, errors }) => {
|
.then(({ valid, errors }) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.orderInfo.address = this.address_string + this.orderInfo.street_name
|
this.userInfo.address = this.address_string + this.userInfo.street_name
|
||||||
this.addOrder()
|
this.addOrder()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -186,74 +207,55 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// //提交订单
|
//获取地址--直接到泸州市区级
|
||||||
// addOrder() {
|
|
||||||
// CommonApi.commonPost('/api/banquet/order/createOrder', this.orderInfo).catch((res) => {
|
|
||||||
// if (res.code === 1) {
|
|
||||||
// this.order_id = res.data.order_id
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: `/pages/banquet/order/detail?order_id=${res.data.order_id}`,
|
|
||||||
// })
|
|
||||||
// } else if (res.code === 0) {
|
|
||||||
// uni.$u.toast('请求错误,请从新下单!')
|
|
||||||
// this.goBack()
|
|
||||||
// } else {
|
|
||||||
// uni.$u.toast(res.msg)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
|
|
||||||
// // 微信支付
|
|
||||||
// payOrder() {
|
|
||||||
// CommonApi.commonPost('/api/banquet/order/pay', {
|
|
||||||
// order_id: this.order_id,
|
|
||||||
// }).catch((res) => {
|
|
||||||
// if (res.code === 1) {
|
|
||||||
// wx.requestPayment({
|
|
||||||
// timeStamp: res.data.timeStamp,
|
|
||||||
// nonceStr: res.data.nonceStr,
|
|
||||||
// package: res.data.package,
|
|
||||||
// signType: res.data.signType,
|
|
||||||
// paySign: res.data.paySign,
|
|
||||||
// success: function (res) {
|
|
||||||
// console.log('success:' + JSON.stringify(res))
|
|
||||||
// },
|
|
||||||
// fail: function (err) {
|
|
||||||
// console.log('fail:' + JSON.stringify(err))
|
|
||||||
// },
|
|
||||||
// complete: function (res) {
|
|
||||||
// console.log('complete:' + JSON.stringify(res))
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// uni.$u.toast(res.msg)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
//获取地址
|
|
||||||
getArea() {
|
getArea() {
|
||||||
this.area = [
|
this.getDistrict()
|
||||||
colPickerData.map((item) => ({
|
|
||||||
value: item.value,
|
|
||||||
label: item.text,
|
|
||||||
})),
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
//选择地址后--记录地址字符串
|
//选择地址后--记录地址字符串
|
||||||
handleConfirm(value) {
|
handleConfirm(value) {
|
||||||
|
// console.log(value.value.length)
|
||||||
|
this.addressNumber = value.value.length
|
||||||
this.address_string = value.selectedItems.map((item) => item.label).join('')
|
this.address_string = value.selectedItems.map((item) => item.label).join('')
|
||||||
},
|
},
|
||||||
//地址改版事件
|
//地址改版事件
|
||||||
columnChange({ selectedItem, resolve, finish }) {
|
async columnChange({ selectedItem, resolve, finish }) {
|
||||||
try {
|
try {
|
||||||
const areaData = findChildrenByCode(colPickerData, selectedItem.value)
|
if (selectedItem.grade === 1) {
|
||||||
if (areaData && areaData.length) {
|
// 获取街道数据
|
||||||
resolve(
|
const res = await getStreetAPI(selectedItem.value)
|
||||||
areaData.map((item) => ({
|
if (res.code === 1) {
|
||||||
value: item.value,
|
const areaData = res.data
|
||||||
label: item.text,
|
if (areaData && areaData.length) {
|
||||||
})),
|
resolve(
|
||||||
)
|
areaData.map((item) => ({
|
||||||
|
value: item.code,
|
||||||
|
label: item.name,
|
||||||
|
grade: 2,
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (selectedItem.grade === 2) {
|
||||||
|
// 获取村数据
|
||||||
|
const res = await getVillageAPI(selectedItem.value)
|
||||||
|
if (res.code === 1) {
|
||||||
|
const areaData = res.data
|
||||||
|
if (areaData && areaData.length) {
|
||||||
|
resolve(
|
||||||
|
areaData.map((item) => ({
|
||||||
|
value: item.code,
|
||||||
|
label: item.name,
|
||||||
|
grade: 3,
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
@ -262,42 +264,7 @@ export default defineComponent({
|
|||||||
finish() // 确保在发生错误时也能完成操作以避免卡顿
|
finish() // 确保在发生错误时也能完成操作以避免卡顿
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// //宴席类型
|
myOrder() {},
|
||||||
// getBanquetType() {
|
|
||||||
// CommonApi.commonGet('/api/banquet/dishes/banquetType').catch((res) => {
|
|
||||||
// if (res.code === 1) {
|
|
||||||
// res.data.forEach((item) => {
|
|
||||||
// item.label = item.name
|
|
||||||
// })
|
|
||||||
// this.banquetType = res.data
|
|
||||||
// } else {
|
|
||||||
// uni.$u.toast(res.msg)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
// //购物车验证
|
|
||||||
getCartCheck() {
|
|
||||||
let query = {
|
|
||||||
server_user_id: this.server_user_id,
|
|
||||||
cart_ids: 0,
|
|
||||||
}
|
|
||||||
if (this.order_type == 2 && this.orderInfo.cart_ids > 0) {
|
|
||||||
query.cart_ids = this.orderInfo.cart_ids
|
|
||||||
}
|
|
||||||
// CommonApi.commonPost('/api/banquet/order/check', query).catch((res) => {
|
|
||||||
// if (res.code === 1) {
|
|
||||||
// this.matchedItems_sp = res.data.cart_list
|
|
||||||
// this.totalPrice = res.data.total_price
|
|
||||||
// this.pre_price = this.totalPrice >= 1000 ? 1000 : this.totalPrice
|
|
||||||
// this.server_user.phone = res.data.server_user.certification.phone
|
|
||||||
// this.server_user.public_name = res.data.server_user.certification.public_name
|
|
||||||
// this.$refs.pagingRefSP?.complete(res.data)
|
|
||||||
// // console.log(res);
|
|
||||||
// } else {
|
|
||||||
// uni.$u.toast(res.msg)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
},
|
|
||||||
|
|
||||||
// 返回上一级
|
// 返回上一级
|
||||||
goBack() {
|
goBack() {
|
||||||
|
@ -5,25 +5,56 @@ export interface IFooItem {
|
|||||||
// name: string
|
// name: string
|
||||||
// any: any
|
// any: any
|
||||||
}
|
}
|
||||||
|
// /** GET 请求;支持 传递 header 的范例 */
|
||||||
|
// export function getFooAPI2(name: string) {
|
||||||
|
// return http.get<IFooItem>('/foo', { name }, { 'Content-Type-100': '100' })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /** POST 请求 */
|
||||||
|
// export function postFooAPI(name: string) {
|
||||||
|
// return http.post<IFooItem>('/foo', { name })
|
||||||
|
// }
|
||||||
|
// /** POST 请求;需要传递 query 参数的范例;微信小程序经常有同时需要query参数和body参数的场景 */
|
||||||
|
// export function postFooAPI2(name: string) {
|
||||||
|
// return http.post<IFooItem>('/foo', { name })
|
||||||
|
// }
|
||||||
|
// /** POST 请求;支持 传递 header 的范例 */
|
||||||
|
// export function postFooAPI3(name: string) {
|
||||||
|
// return http.post<IFooItem>('/foo', { name }, { name }, { 'Content-Type-100': '100' })
|
||||||
|
// }
|
||||||
|
|
||||||
/** GET 请求 */
|
/** GET 请求 */
|
||||||
export function getProductAPI(cate_pid: string) {
|
export function getProductAPI(cate_pid: string) {
|
||||||
return http.get<IFooItem>(getUrlCrmebProxy() + '/api/product/spu/lst', { cate_pid })
|
return http.get<IFooItem>(getUrlCrmebProxy() + '/api/product/spu/lst', { cate_pid })
|
||||||
}
|
}
|
||||||
/** GET 请求;支持 传递 header 的范例 */
|
export function getInfoAPI() {
|
||||||
export function getFooAPI2(name: string) {
|
return http.post('/api/user/info', {})
|
||||||
return http.get<IFooItem>('/foo', { name }, { 'Content-Type-100': '100' })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** POST 请求 */
|
export function setInfoPI() {
|
||||||
export function postFooAPI(name: string) {
|
return http.get('/api/user/setInfo', {})
|
||||||
return http.post<IFooItem>('/foo', { name })
|
|
||||||
}
|
}
|
||||||
/** POST 请求;需要传递 query 参数的范例;微信小程序经常有同时需要query参数和body参数的场景 */
|
|
||||||
export function postFooAPI2(name: string) {
|
export function setPhoneAPI() {
|
||||||
return http.post<IFooItem>('/foo', { name })
|
return http.get('/api/user/setPhone', {})
|
||||||
}
|
}
|
||||||
/** POST 请求;支持 传递 header 的范例 */
|
|
||||||
export function postFooAPI3(name: string) {
|
export function setGroupAPI() {
|
||||||
return http.post<IFooItem>('/foo', { name }, { name }, { 'Content-Type-100': '100' })
|
return http.get('/api/user/setGroup', {})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCityAPI() {
|
||||||
|
return http.get('/api/location/getCity', {})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDistrictAPI() {
|
||||||
|
return http.get('/api/location/getDistrict', {})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStreetAPI(code: string) {
|
||||||
|
return http.get('/api/location/getStreet', { code })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getVillageAPI(code: string) {
|
||||||
|
return http.get('/api/location/getVillage', { code })
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user