设置不同角色 显示
This commit is contained in:
@@ -44,6 +44,23 @@
|
|||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 设置所有页面最大宽度为 650px */
|
||||||
|
.uni-app {
|
||||||
|
max-width: 650px;
|
||||||
|
margin: 0 auto;
|
||||||
|
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保页面内容也受最大宽度限制 */
|
||||||
|
uni-page-body {
|
||||||
|
max-width: 650px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background-color: #F5F5F5 !important;
|
||||||
|
min-height: 100% !important;
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* 顶栏通栏样式 */
|
/* 顶栏通栏样式 */
|
||||||
/* .uni-top-window {
|
/* .uni-top-window {
|
||||||
@@ -51,16 +68,19 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
uni-page-body {
|
|
||||||
background-color: #F5F5F5 !important;
|
|
||||||
min-height: 100% !important;
|
|
||||||
height: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-top-window uni-tabbar .uni-tabbar {
|
.uni-top-window uni-tabbar .uni-tabbar {
|
||||||
background-color: #fff !important;
|
background-color: #fff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 隐藏默认 tabBar(使用自定义 tabBar 时) */
|
||||||
|
/* #ifdef H5 */
|
||||||
|
.uni-tabbar,
|
||||||
|
.uni-tabbar__bd,
|
||||||
|
uni-tabbar {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
.uni-app--showleftwindow .hideOnPc {
|
.uni-app--showleftwindow .hideOnPc {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* TabBar 配置管理
|
||||||
|
* 根据用户角色动态显示不同的 tabbar
|
||||||
|
*
|
||||||
|
* 使用说明:
|
||||||
|
* 1. 在 tabBarConfig 中配置所有 tabbar 项
|
||||||
|
* 2. 通过 roles 数组配置哪些角色可以看到该 tabbar
|
||||||
|
* - roles: [] 或 roles: undefined 表示所有角色都可以看到
|
||||||
|
* - roles: ['user', 'admin'] 表示只有 user 和 admin 角色可以看到
|
||||||
|
* 3. 用户角色通过 getUserRole() 函数获取
|
||||||
|
* - 默认从 uni.getStorageSync('userInfo').role 获取
|
||||||
|
* - 也可以从 uni.getStorageSync('userRole') 或 uni.getStorageSync('role') 获取
|
||||||
|
* - 如果都没有,默认返回 'user'
|
||||||
|
* 4. 修改用户角色后,需要重新调用 getVisibleTabBar() 来刷新 tabbar
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 所有可用的 tabbar 配置
|
||||||
|
export const tabBarConfig = [
|
||||||
|
{
|
||||||
|
pagePath: 'pages/index/index',
|
||||||
|
iconPath: '/static/image/home1.png',
|
||||||
|
selectedIconPath: '/static/image/home.png',
|
||||||
|
text: '首页',
|
||||||
|
roles: [] // 空数组表示所有角色都可以看到
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pagePath: 'pages/index/publish',
|
||||||
|
iconPath: '/static/image/publish1.png',
|
||||||
|
selectedIconPath: '/static/image/publish.png',
|
||||||
|
text: '发布',
|
||||||
|
roles: ['2'] // 只有 user 和 admin 角色可以看到,可以根据实际需求修改
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pagePath: 'pages/index/mine',
|
||||||
|
iconPath: '/static/image/mine1.png',
|
||||||
|
selectedIconPath: '/static/image/mine.png',
|
||||||
|
text: '我的',
|
||||||
|
roles: [] // 所有角色都可以看到
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户角色获取可见的 tabbar 列表
|
||||||
|
* @param {string} userRole - 用户角色,如 'user', 'admin', 'guest' 等
|
||||||
|
* @returns {Array} 过滤后的 tabbar 列表
|
||||||
|
*/
|
||||||
|
export function getVisibleTabBar(userRole = '2') {
|
||||||
|
return tabBarConfig.filter(item => {
|
||||||
|
// 如果没有配置 roles 或 roles 为空数组,表示所有角色都可以看到
|
||||||
|
if (!item.roles || item.roles.length === 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 检查用户角色是否在允许的角色列表中
|
||||||
|
return item.roles.includes(userRole)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户角色
|
||||||
|
* @returns {string} 用户角色
|
||||||
|
*/
|
||||||
|
export function getUserRole() {
|
||||||
|
try {
|
||||||
|
// 方式1: 从存储中获取
|
||||||
|
const userInfo = uni.getStorageSync('userInfo')
|
||||||
|
if (userInfo && userInfo.role) {
|
||||||
|
return userInfo.role
|
||||||
|
}
|
||||||
|
|
||||||
|
// 方式2: 从其他存储字段获取(根据实际项目调整)
|
||||||
|
// 可能存储在 userRole、user_role、role 等字段
|
||||||
|
const role = uni.getStorageSync('userRole') || uni.getStorageSync('role')
|
||||||
|
if (role) {
|
||||||
|
return role
|
||||||
|
}
|
||||||
|
|
||||||
|
// 方式3: 从 token 或其他地方获取
|
||||||
|
// const token = uni.getStorageSync('token')
|
||||||
|
// 可以解析 token 获取角色信息
|
||||||
|
|
||||||
|
// 默认返回 'user'(可以根据实际需求调整默认角色)
|
||||||
|
return '2'
|
||||||
|
} catch (e) {
|
||||||
|
return '2'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前 tabbar 的索引
|
||||||
|
* @param {string} currentPath - 当前页面路径
|
||||||
|
* @returns {number} tabbar 索引,-1 表示不在 tabbar 中
|
||||||
|
*/
|
||||||
|
export function getCurrentTabIndex(currentPath) {
|
||||||
|
const userRole = getUserRole()
|
||||||
|
const visibleTabs = getVisibleTabBar(userRole)
|
||||||
|
|
||||||
|
// 移除路径前缀的 / 进行匹配
|
||||||
|
const path = currentPath.startsWith('/') ? currentPath.slice(1) : currentPath
|
||||||
|
|
||||||
|
const index = visibleTabs.findIndex(item => {
|
||||||
|
const itemPath = item.pagePath.startsWith('/') ? item.pagePath.slice(1) : item.pagePath
|
||||||
|
return itemPath === path
|
||||||
|
})
|
||||||
|
|
||||||
|
return index
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* TabBar Mixin
|
||||||
|
* 用于在页面中自动显示/隐藏自定义 tabbar
|
||||||
|
*/
|
||||||
|
import { getVisibleTabBar, getCurrentTabIndex } from '@/common/tabbar.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showTabBar: false,
|
||||||
|
tabBarCurrent: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.checkShowTabBar()
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.checkShowTabBar()
|
||||||
|
this.updateTabBarCurrent()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkShowTabBar() {
|
||||||
|
// 获取当前页面路径
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const currentPage = pages[pages.length - 1]
|
||||||
|
const currentPath = currentPage.route || currentPage.$route?.path || ''
|
||||||
|
|
||||||
|
// 获取可见的 tabbar 列表
|
||||||
|
const visibleTabs = getVisibleTabBar()
|
||||||
|
|
||||||
|
// 检查当前页面是否在 tabbar 列表中
|
||||||
|
const path = currentPath.startsWith('/') ? currentPath.slice(1) : currentPath
|
||||||
|
const isTabBarPage = visibleTabs.some(item => {
|
||||||
|
const itemPath = item.pagePath.startsWith('/') ? item.pagePath.slice(1) : item.pagePath
|
||||||
|
return itemPath === path
|
||||||
|
})
|
||||||
|
|
||||||
|
this.showTabBar = isTabBarPage
|
||||||
|
},
|
||||||
|
updateTabBarCurrent() {
|
||||||
|
if (this.showTabBar) {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const currentPage = pages[pages.length - 1]
|
||||||
|
const currentPath = currentPage.route || currentPage.$route?.path || ''
|
||||||
|
this.tabBarCurrent = getCurrentTabIndex(currentPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,6 +52,9 @@
|
|||||||
<view class="action-btn" @tap.stop="handleShare">
|
<view class="action-btn" @tap.stop="handleShare">
|
||||||
<u-icon name="share" size="18" />
|
<u-icon name="share" size="18" />
|
||||||
</view>
|
</view>
|
||||||
|
<view class="action-btn" @tap.stop="handleSet(item)" v-if="item.status==1">
|
||||||
|
<u-icon name="setting" size="18" />
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -89,6 +92,33 @@
|
|||||||
pdfchanges() {
|
pdfchanges() {
|
||||||
this.$emit('pdfchange')
|
this.$emit('pdfchange')
|
||||||
},
|
},
|
||||||
|
handleSet(item){
|
||||||
|
const that = this
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确认标记已售出?',
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
request({
|
||||||
|
url:'common/usedcar/update/status',
|
||||||
|
method:'post',
|
||||||
|
data: {id:item.id,status:2}
|
||||||
|
}).then(res => {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.data.message,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
that.$emit('restchange')
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
handleCardTap() {
|
handleCardTap() {
|
||||||
// 直接处理跳转,避免事件传递问题
|
// 直接处理跳转,避免事件传递问题
|
||||||
if (this.item && this.item.id) {
|
if (this.item && this.item.id) {
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<template>
|
||||||
|
<view class="custom-tabbar" :style="{ paddingBottom: safeAreaInsets.bottom + 'px' }">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in tabList"
|
||||||
|
:key="index"
|
||||||
|
class="tab-item"
|
||||||
|
:class="{ active: current === index }"
|
||||||
|
@tap="switchTab(item, index)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="tab-icon"
|
||||||
|
:src="current === index ? item.selectedIconPath : item.iconPath"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<text class="tab-text">{{ item.text }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getVisibleTabBar, getCurrentTabIndex, getUserRole } from '@/common/tabbar.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CustomTabBar',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
current: 0,
|
||||||
|
safeAreaInsets: {
|
||||||
|
bottom: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tabList() {
|
||||||
|
// 根据权限获取可见的 tabbar 列表
|
||||||
|
const userRole = getUserRole()
|
||||||
|
return getVisibleTabBar(userRole)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.updateCurrent()
|
||||||
|
this.initSafeArea()
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
// 页面显示时更新当前 tab 索引
|
||||||
|
this.updateCurrent()
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听 tabList 变化,当角色改变导致 tabbar 列表变化时,更新当前索引
|
||||||
|
tabList: {
|
||||||
|
handler() {
|
||||||
|
this.updateCurrent()
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initSafeArea() {
|
||||||
|
// 获取安全区域信息(适配 iPhone X 等)
|
||||||
|
// #ifdef APP-PLUS || H5
|
||||||
|
try {
|
||||||
|
const systemInfo = uni.getSystemInfoSync()
|
||||||
|
this.safeAreaInsets = systemInfo.safeAreaInsets || { bottom: 0 }
|
||||||
|
} catch (e) {
|
||||||
|
this.safeAreaInsets = { bottom: 0 }
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
updateCurrent() {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
if (pages.length === 0) return
|
||||||
|
|
||||||
|
const currentPage = pages[pages.length - 1]
|
||||||
|
const currentPath = currentPage.route || currentPage.$route?.path || ''
|
||||||
|
const index = getCurrentTabIndex(currentPath)
|
||||||
|
// 如果当前页面不在可见的 tabbar 列表中,保持当前索引或设为 0
|
||||||
|
this.current = index >= 0 ? index : 0
|
||||||
|
},
|
||||||
|
switchTab(item, index) {
|
||||||
|
if (this.current === index) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/' + item.pagePath,
|
||||||
|
fail: (err) => {
|
||||||
|
// 如果 switchTab 失败,可能是该页面不在 tabBar 中,使用 navigateTo
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/' + item.pagePath,
|
||||||
|
fail: () => {
|
||||||
|
console.error('导航失败:', err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.custom-tabbar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 100rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
z-index: 999;
|
||||||
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item.active {
|
||||||
|
.tab-text {
|
||||||
|
color: #3F435B;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-icon {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #7A7E83;
|
||||||
|
transition: color 0.2s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<template>
|
||||||
|
<view class="custom-tabbar" :style="{ paddingBottom: safeAreaInsets.bottom + 'px' }">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in tabList"
|
||||||
|
:key="index"
|
||||||
|
class="tab-item"
|
||||||
|
:class="{ active: current === index }"
|
||||||
|
@tap="switchTab(item, index)"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="tab-icon"
|
||||||
|
:src="current === index ? item.selectedIconPath : item.iconPath"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<text class="tab-text">{{ item.text }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getVisibleTabBar, getCurrentTabIndex, getUserRole } from '@/common/tabbar.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CustomTabBar',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
current: 0,
|
||||||
|
safeAreaInsets: {
|
||||||
|
bottom: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
tabList() {
|
||||||
|
// 根据权限获取可见的 tabbar 列表
|
||||||
|
const userRole = getUserRole()
|
||||||
|
return getVisibleTabBar(userRole)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initSafeArea()
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.updateCurrent()
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
// 页面显示时更新当前 tab 索引
|
||||||
|
this.updateCurrent()
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听 tabList 变化,当角色改变导致 tabbar 列表变化时,更新当前索引
|
||||||
|
tabList: {
|
||||||
|
handler() {
|
||||||
|
this.updateCurrent()
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initSafeArea() {
|
||||||
|
// 获取安全区域信息(适配 iPhone X 等)
|
||||||
|
// #ifdef APP-PLUS || H5
|
||||||
|
try {
|
||||||
|
const systemInfo = uni.getSystemInfoSync()
|
||||||
|
this.safeAreaInsets = systemInfo.safeAreaInsets || { bottom: 0 }
|
||||||
|
} catch (e) {
|
||||||
|
this.safeAreaInsets = { bottom: 0 }
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
updateCurrent() {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
if (pages.length === 0) return
|
||||||
|
|
||||||
|
const currentPage = pages[pages.length - 1]
|
||||||
|
const currentPath = currentPage.route || currentPage.$route?.path || ''
|
||||||
|
const index = getCurrentTabIndex(currentPath)
|
||||||
|
// 如果当前页面不在可见的 tabbar 列表中,保持当前索引或设为 0
|
||||||
|
this.current = index >= 0 ? index : 0
|
||||||
|
},
|
||||||
|
switchTab(item, index) {
|
||||||
|
if (this.current === index) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/' + item.pagePath,
|
||||||
|
fail: (err) => {
|
||||||
|
// 如果 switchTab 失败,可能是该页面不在 tabBar 中,使用 navigateTo
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/' + item.pagePath,
|
||||||
|
fail: () => {
|
||||||
|
console.error('导航失败:', err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.custom-tabbar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 100rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
z-index: 999;
|
||||||
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-item.active {
|
||||||
|
.tab-text {
|
||||||
|
color: #3F435B;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-icon {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #7A7E83;
|
||||||
|
transition: color 0.2s;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+9
-7
@@ -94,6 +94,12 @@
|
|||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"navigationStyle":"custom"
|
"navigationStyle":"custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/index/ywPublish",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages":[],
|
"subPackages":[],
|
||||||
@@ -115,26 +121,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
|
"custom": true,
|
||||||
"color": "#7A7E83",
|
"color": "#7A7E83",
|
||||||
"selectedColor": "#3F435B",
|
"selectedColor": "#3F435B",
|
||||||
"borderStyle": "white",
|
"borderStyle": "white",
|
||||||
"backgroundColor": "#fff",
|
"backgroundColor": "#fff",
|
||||||
"list": [{
|
"list": [
|
||||||
|
{
|
||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"iconPath": "/static/image/home1.png",
|
|
||||||
"selectedIconPath": "static/image/home.png",
|
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/index/publish",
|
"pagePath": "pages/index/publish",
|
||||||
"iconPath": "/static/image/publish1.png",
|
|
||||||
"selectedIconPath": "static/image/publish.png",
|
|
||||||
"text": "发布"
|
"text": "发布"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/index/mine",
|
"pagePath": "pages/index/mine",
|
||||||
"iconPath": "/static/image/mine1.png",
|
|
||||||
"selectedIconPath": "/static/image/mine.png",
|
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+37
-22
@@ -4,28 +4,41 @@
|
|||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="topimg">
|
<view class="topimg">
|
||||||
<uni-file-picker fileMediatype="image" limit="1" :list-styles="imageStyles" :del-icon="false" disable-preview @select="select" @delete="delfn('picture')">
|
<uni-file-picker fileMediatype="image" limit="1" :list-styles="imageStyles" :del-icon="false" disable-preview @select="select" @delete="delfn('picture')">
|
||||||
<image class="user" :src="userinfo.avatar"mode=""></image>
|
<image class="user" :src="userinfo.avatar_pull"mode=""></image>
|
||||||
</uni-file-picker>
|
</uni-file-picker>
|
||||||
<view>点击更换头像</view>
|
<view>点击更换头像</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="cell1">
|
||||||
|
<view class="item">英文名</view>
|
||||||
|
<view class="right">
|
||||||
|
<input placeholder="请输入英文名" type="text" v-model="userinfo.name_en"></input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="cell1">
|
<view class="cell1">
|
||||||
<view class="item">手机号</view>
|
<view class="item">手机号</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<input placeholder="请输入手机号" type="number" v-model="userinfo.email"></input>
|
<input placeholder="请输入手机号" type="number" v-model="userinfo.phone"></input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-divider text=""></u-divider>
|
<u-divider text=""></u-divider>
|
||||||
<view class="cell1">
|
<view class="cell1">
|
||||||
<view class="item">邮箱</view>
|
<view class="item">邮箱</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<input placeholder="请输入邮箱" type="text" v-model="userinfo.position"></input>
|
<input placeholder="请输入邮箱" type="text" v-model="userinfo.email"></input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<u-divider text=""></u-divider>
|
||||||
|
<view class="cell1">
|
||||||
|
<view class="item">whatsapp</view>
|
||||||
|
<view class="right">
|
||||||
|
<input placeholder="请输入whatsapp" type="text" v-model="userinfo.whatsapp"></input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-divider text=""></u-divider>
|
<u-divider text=""></u-divider>
|
||||||
<view class="cell1">
|
<view class="cell1">
|
||||||
<view class="item">二维码</view>
|
<view class="item">二维码</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<u-radio-group v-model="userinfo.socialize">
|
<u-radio-group v-model="userinfo.social">
|
||||||
<u-radio name="微信" class="m-r-10">微信</u-radio>
|
<u-radio name="微信" class="m-r-10">微信</u-radio>
|
||||||
<u-radio name="WhatsApp">WhatsApp</u-radio>
|
<u-radio name="WhatsApp">WhatsApp</u-radio>
|
||||||
</u-radio-group>
|
</u-radio-group>
|
||||||
@@ -35,7 +48,7 @@
|
|||||||
<view class="item">上传二维码</view>
|
<view class="item">上传二维码</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<uni-file-picker style="margin: 10px 0px;" fileMediatype="image" limit="1" :list-styles="imageStyles" :del-icon="false" disable-preview @select="selectewm" >
|
<uni-file-picker style="margin: 10px 0px;" fileMediatype="image" limit="1" :list-styles="imageStyles" :del-icon="false" disable-preview @select="selectewm" >
|
||||||
<image class="user" :src="userinfo.socialize_pic_url==null?'/static/image/mine/erwm.png':userinfo.socialize_pic_url " mode=""></image>
|
<image class="user" :src="userinfo.social_code_pull==null?'/static/image/mine/erwm.png':userinfo.social_code_pull " mode=""></image>
|
||||||
</uni-file-picker>
|
</uni-file-picker>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -71,12 +84,13 @@
|
|||||||
that.userinfo = res.data.data;
|
that.userinfo = res.data.data;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
uploadfn(imgUrl,scene){
|
uploadfn(imgUrl,name,name1){
|
||||||
|
const that = this
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '上传中'
|
title: '上传中'
|
||||||
});
|
});
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: 'https://userdcar-server.hnxinyouhe.com/upload?scene='+scene,
|
url: 'https://userdcar-server.hnxinyouhe.com/upload?scene=usedCarimg',
|
||||||
filePath: imgUrl,
|
filePath: imgUrl,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header:{'Fdesk-Auth-Token': uni.getStorageSync('token'),'Fdesk-Login-Type': 'feishu','Fdesk-System-Code':'fdesk'},
|
header:{'Fdesk-Auth-Token': uni.getStorageSync('token'),'Fdesk-Login-Type': 'feishu','Fdesk-System-Code':'fdesk'},
|
||||||
@@ -88,44 +102,45 @@
|
|||||||
icon:'none'
|
icon:'none'
|
||||||
})
|
})
|
||||||
if(res && res.data && res.data.file_name){
|
if(res && res.data && res.data.file_name){
|
||||||
that.userinfo[name1] = path.data.image_url
|
that.userinfo[name1] = res.data.file_url
|
||||||
that.userinfo[name] = path.data.path
|
that.userinfo[name] = res.data.file_name
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => reject(err)
|
fail: (err) => reject(err)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
selectewm(e){
|
||||||
|
const tempFilePaths = e.tempFilePaths;
|
||||||
|
const imgUrl=tempFilePaths[0]
|
||||||
|
this.uploadfn(imgUrl,'social_code','social_code_pull')
|
||||||
|
},
|
||||||
select(e){
|
select(e){
|
||||||
const tempFilePaths = e.tempFilePaths;
|
const tempFilePaths = e.tempFilePaths;
|
||||||
const imgUrl=tempFilePaths[0]
|
const imgUrl=tempFilePaths[0]
|
||||||
this.uploadfn(imgUrl,'avatar')
|
this.uploadfn(imgUrl,'avatar','avatar_url')
|
||||||
},
|
},
|
||||||
leftClick(){
|
leftClick(){
|
||||||
uni.navigateBack({})
|
uni.navigateBack({})
|
||||||
},
|
},
|
||||||
bcFn(){
|
bcFn(){
|
||||||
request({
|
request({
|
||||||
url:'user/save',
|
url:'common/user/edit',
|
||||||
method:'POST',
|
method:'POST',
|
||||||
data:{
|
data:{
|
||||||
avatar:this.userinfo.avatar,
|
avatar:this.userinfo.avatar,
|
||||||
avatar_url:this.userinfo.avatar_url,
|
phone:this.userinfo.phone,
|
||||||
sex:this.userinfo.sex,
|
email:this.userinfo.email,
|
||||||
name:this.userinfo.name,
|
whatsapp:this.userinfo.whatsapp,
|
||||||
mobile:this.userinfo.mobile,
|
social:this.userinfo.social,
|
||||||
position:this.userinfo.position,
|
social_code:this.userinfo.social_code,
|
||||||
country_id:this.userinfo.country_id,
|
name_en:this.userinfo.name_en
|
||||||
sign:this.userinfo.sign,
|
|
||||||
socialize:this.userinfo.socialize,
|
|
||||||
socialize_pic:this.userinfo.socialize_pic,
|
|
||||||
socialize_pic_url:this.userinfo.socialize_pic_url,
|
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.data.message,
|
title: res.data.message,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
if(res.data.code ==0){
|
if(res.data.code ==0||res.data.code ==200){
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/mine',// 替换为你要跳转的页面路径
|
url: '/pages/index/mine',// 替换为你要跳转的页面路径
|
||||||
|
|||||||
@@ -1,374 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="page">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 列表 -->
|
|
||||||
<z-paging ref="paging" v-model="list" @query="queryList" empty-view-text="暂无数据!">
|
|
||||||
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="首页"></uni-nav-bar> -->
|
|
||||||
<!-- 顶部:标题 + 搜索(不想要搜索可直接删除这一块) -->
|
|
||||||
<view class="page-head">
|
|
||||||
<view class="head-search">
|
|
||||||
<u-search
|
|
||||||
v-model="keyword"
|
|
||||||
placeholder="请输入关键词"
|
|
||||||
:show-action="false"
|
|
||||||
shape="round"
|
|
||||||
@change="onKeywordChange"
|
|
||||||
@search="onSearch"
|
|
||||||
@clear="onSearch"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="list-wrap">
|
|
||||||
<CarCard
|
|
||||||
v-for="item in list"
|
|
||||||
:key="item.id"
|
|
||||||
:item="item"
|
|
||||||
@pdfchange="onSearch"
|
|
||||||
@request-price="onRequestPrice"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</z-paging>
|
|
||||||
<uni-popup ref="inputDialog" type="dialog">
|
|
||||||
<uni-popup-dialog
|
|
||||||
mode="input"
|
|
||||||
title="请输入价格"
|
|
||||||
:value="priceDialogValue"
|
|
||||||
placeholder="请输入车辆价格"
|
|
||||||
@confirm="dialogInputConfirm"
|
|
||||||
/>
|
|
||||||
</uni-popup>
|
|
||||||
<!-- <uni-popup ref="inputDialog" type="dialog">
|
|
||||||
<view class="popup-dialog">
|
|
||||||
<view class="popup-title">请输入价格</view>
|
|
||||||
<view class="popup-input-wrap">
|
|
||||||
<input
|
|
||||||
class="popup-input"
|
|
||||||
type="number"
|
|
||||||
v-model="priceDialogValue"
|
|
||||||
placeholder="请输入车辆价格"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
<view class="popup-btns">
|
|
||||||
<view class="popup-btn cancel" @click="close">取消</view>
|
|
||||||
<view class="popup-btn confirm" @click="dialogInputConfirm">确定</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-popup> -->
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { request } from '@/api/apiT.js'
|
|
||||||
import CarCard from '@/components/CarCard/CarCard.vue'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
CarCard
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
priceDialogItem: null,
|
|
||||||
priceDialogIndex: -1,
|
|
||||||
priceDialogValue: '',
|
|
||||||
keyword: '',
|
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
loading: false,
|
|
||||||
finished: false,
|
|
||||||
list: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
this.initFeishuShare()
|
|
||||||
// H5:处理分享兜底参数 r(如果路由没命中/经历登录回跳,会先落到首页)
|
|
||||||
// #ifdef H5
|
|
||||||
try {
|
|
||||||
const u = new URL(window.location.href)
|
|
||||||
const r = u.searchParams.get('r')
|
|
||||||
if (r) {
|
|
||||||
const target = decodeURIComponent(r)
|
|
||||||
// 清理地址栏的 r,避免反复跳转
|
|
||||||
u.searchParams.delete('r')
|
|
||||||
window.history.replaceState({}, '', u.toString())
|
|
||||||
// 让首页加载完再跳
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.navigateTo({ url: target })
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
// #endif
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
isFeishuEnv() {
|
|
||||||
// 飞书/ Lark 客户端内置浏览器 UA 通常包含 Feishu / Lark
|
|
||||||
try {
|
|
||||||
const ua = (navigator.userAgent || '').toLowerCase()
|
|
||||||
return ua.includes('feishu') || ua.includes('lark')
|
|
||||||
} catch (e) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
loadFeishuJSSDK() {
|
|
||||||
// 动态加载飞书 H5 JS-SDK(避免你还要改 public/index.html)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
// 已加载
|
|
||||||
if (typeof window !== 'undefined' && window.h5sdk && window.tt) return resolve(true)
|
|
||||||
// H5 才有 document
|
|
||||||
if (typeof document === 'undefined') return reject(new Error('not in h5 environment'))
|
|
||||||
// 已插入但未 ready
|
|
||||||
const existed = document.querySelector('script[data-feishu-h5sdk="1"]')
|
|
||||||
if (existed) {
|
|
||||||
existed.addEventListener('load', () => resolve(true))
|
|
||||||
existed.addEventListener('error', () => reject(new Error('feishu sdk load error')))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const s = document.createElement('script')
|
|
||||||
s.async = true
|
|
||||||
s.src = 'https://lf-scm-cn.feishucdn.com/lark/op/h5-js-sdk-1.5.44.js'
|
|
||||||
s.onload = () => resolve(true)
|
|
||||||
s.onerror = () => reject(new Error('feishu sdk load error'))
|
|
||||||
document.head.appendChild(s)
|
|
||||||
} catch (e) {
|
|
||||||
reject(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getFeishuSignUrl() {
|
|
||||||
// 飞书签名通常要求“去掉 hash 的完整 URL”
|
|
||||||
try {
|
|
||||||
return window.location.href.split('#')[0]
|
|
||||||
} catch (e) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initFeishuShare() {
|
|
||||||
try {
|
|
||||||
// 确保在飞书环境
|
|
||||||
// if (!this.isFeishuEnv()) return
|
|
||||||
// 动态加载 SDK
|
|
||||||
this.loadFeishuJSSDK()
|
|
||||||
|
|
||||||
// 这里需要后端提供签名接口:返回 { appId, timestamp, nonceStr, signature }
|
|
||||||
// 你可以按你后端习惯改成:request({ url: 'xxx', ... })
|
|
||||||
// const signUrl = encodeURIComponent(this.getFeishuSignUrl())
|
|
||||||
const signUrl = this.getFeishuSignUrl()
|
|
||||||
|
|
||||||
request({
|
|
||||||
url:'common/auth/feishu/signature',
|
|
||||||
method:'get',
|
|
||||||
data: {url:signUrl,app_id:uni.getStorageSync('fsappid')}
|
|
||||||
}).then(res => {
|
|
||||||
var cfg = res.data.data;
|
|
||||||
window.h5sdk.config({
|
|
||||||
appId: cfg.appId || uni.getStorageSync('fsappid'),
|
|
||||||
timestamp: cfg.timestamp,
|
|
||||||
nonceStr: cfg.nonceStr,
|
|
||||||
signature: cfg.signature,
|
|
||||||
jsApiList: ['shareWebContent','share']
|
|
||||||
})
|
|
||||||
|
|
||||||
window.h5sdk.ready(() => {
|
|
||||||
this._feishuReady = true
|
|
||||||
})
|
|
||||||
window.h5sdk.error((err) => {
|
|
||||||
this._feishuReady = false
|
|
||||||
console.error('Feishu JSSDK error:', err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} catch (e) {
|
|
||||||
// 不要阻塞页面,失败就走 H5 的兜底分享
|
|
||||||
console.error('initFeishuShare failed:', e)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.$refs.inputDialog.close()
|
|
||||||
},
|
|
||||||
onRequestPrice(payload) {
|
|
||||||
// payload: { item, index }
|
|
||||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
|
||||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
|
||||||
this.priceDialogValue = ''
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// H5 下载:用 a 标签触发
|
|
||||||
downloadByAnchor(url, filename) {
|
|
||||||
try {
|
|
||||||
const a = document.createElement('a')
|
|
||||||
a.href = url
|
|
||||||
a.download = filename || ''
|
|
||||||
a.target = '_blank'
|
|
||||||
document.body.appendChild(a)
|
|
||||||
a.click()
|
|
||||||
document.body.removeChild(a)
|
|
||||||
} catch (e) {
|
|
||||||
// 兜底:直接打开
|
|
||||||
if (typeof window !== 'undefined') window.open(url, '_blank')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
downloadpdf(item) {
|
|
||||||
request({
|
|
||||||
url: 'common/usedcar/pdf',
|
|
||||||
method: 'get',
|
|
||||||
data: { id: item.id }
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code == 200) {
|
|
||||||
this.downloadByAnchor(res.data.data.pdf_url, res.data.data.file_name)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
dialogInputConfirm(val) {
|
|
||||||
const item = this.priceDialogItem
|
|
||||||
const index = this.priceDialogIndex
|
|
||||||
const price = String(val || '').trim()
|
|
||||||
|
|
||||||
if (!item) return
|
|
||||||
if (!price) {
|
|
||||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (isNaN(price) || Number(price) <= 0) {
|
|
||||||
uni.showToast({ title: '请输入有效的价格', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
request({
|
|
||||||
url: 'common/usedcar/produce/pdf',
|
|
||||||
method: 'get',
|
|
||||||
data: { id: item.id, price }
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code == 200) {
|
|
||||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
|
||||||
this.onSearch()
|
|
||||||
|
|
||||||
this.downloadpdf(item)
|
|
||||||
} else {
|
|
||||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onKeywordChange(val) {
|
|
||||||
// val 是输入值(uView 通常会传)
|
|
||||||
this.keyword = val
|
|
||||||
|
|
||||||
// 防抖:300ms 内持续输入只触发一次
|
|
||||||
if (this._kwTimer) clearTimeout(this._kwTimer)
|
|
||||||
this._kwTimer = setTimeout(() => {
|
|
||||||
this.onSearch()
|
|
||||||
}, 300)
|
|
||||||
},
|
|
||||||
onSearch() {
|
|
||||||
this.queryList(this.page,this.pageSize)
|
|
||||||
},
|
|
||||||
queryList(pageNo, pageSize, from) {
|
|
||||||
this.loading = true;
|
|
||||||
var that = this;
|
|
||||||
const params = {
|
|
||||||
current:pageNo,
|
|
||||||
status:1,
|
|
||||||
size:10
|
|
||||||
};
|
|
||||||
params.keyword = this.keyword;
|
|
||||||
request({
|
|
||||||
url:'common/usedcar/list',
|
|
||||||
method:'get',
|
|
||||||
data: params
|
|
||||||
}).then(res => {
|
|
||||||
if(res.data.code ==200){
|
|
||||||
var datas = res.data.data.records;
|
|
||||||
this.$refs.paging.complete(datas);
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
//
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.page {
|
|
||||||
min-height: 100vh;
|
|
||||||
background: #f4f6f8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-head {
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
bottom: 50px;
|
|
||||||
z-index: 99;
|
|
||||||
// padding: 28rpx 24rpx 18rpx;
|
|
||||||
// background: linear-gradient(180deg, rgba(255, 151, 47, 0.22) 0%, rgba(255, 151, 47, 0.06) 55%, #f4f6f8 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-search {
|
|
||||||
background: rgba(255, 255, 255, 1);
|
|
||||||
border-radius: 9px 9px 0px 0px;
|
|
||||||
padding: 20rpx 10px;
|
|
||||||
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-wrap {
|
|
||||||
padding: 18rpx 24rpx 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loadmore {
|
|
||||||
padding: 18rpx 0 6rpx;
|
|
||||||
}
|
|
||||||
.popup-dialog {
|
|
||||||
width: 620rpx;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 24rpx;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-title {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
// font-weight: 600;
|
|
||||||
color: #656565;
|
|
||||||
padding: 32rpx 20rpx 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-input-wrap {
|
|
||||||
padding: 0 40rpx 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-input {
|
|
||||||
height: 88rpx;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
border: 1px solid #dfdfdf;
|
|
||||||
padding: 0 24rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-btns {
|
|
||||||
display: flex;
|
|
||||||
border-top: 1rpx solid #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-btn {
|
|
||||||
flex: 1;
|
|
||||||
height: 96rpx;
|
|
||||||
line-height: 96rpx;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 32rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-btn.cancel {
|
|
||||||
color: #666;
|
|
||||||
border-right: 1rpx solid #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-btn.confirm {
|
|
||||||
color: #007aff; /* uni 主色 */
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
+59
-4
@@ -17,7 +17,12 @@
|
|||||||
@search="onSearch"
|
@search="onSearch"
|
||||||
@clear="onSearch"
|
@clear="onSearch"
|
||||||
/>
|
/>
|
||||||
|
<view class="statussearch" @click="show=true">
|
||||||
|
<text class="year-text">{{status_name || '状态'}}</text>
|
||||||
|
<u-icon name="arrow-down" size="14" color="#999"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-picker :show="show" :columns="columns" keyName="label" @confirm="onstatus" @cancel="show = false"></u-picker>
|
||||||
</view>
|
</view>
|
||||||
<view class="list-wrap">
|
<view class="list-wrap">
|
||||||
<CarCard
|
<CarCard
|
||||||
@@ -26,6 +31,7 @@
|
|||||||
:item="item"
|
:item="item"
|
||||||
@pdfchange="onSearch"
|
@pdfchange="onSearch"
|
||||||
@request-price="onRequestPrice"
|
@request-price="onRequestPrice"
|
||||||
|
@restchange="onSearch"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</z-paging>
|
</z-paging>
|
||||||
@@ -95,18 +101,39 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<CustomTabBar class="h5-custom-tabbar" />
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { request } from '@/api/apiT.js'
|
import { request } from '@/api/apiT.js'
|
||||||
import CarCard from '@/components/CarCard/CarCard.vue'
|
import CarCard from '@/components/CarCard/CarCard.vue'
|
||||||
|
import CustomTabBar from '@/custom-tab-bar/index.vue'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
CarCard
|
CarCard,
|
||||||
|
CustomTabBar
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
show: false,
|
||||||
|
status_id:1,
|
||||||
|
status_name:'',
|
||||||
|
columns: [
|
||||||
|
[{
|
||||||
|
label: '正常',
|
||||||
|
id: 1
|
||||||
|
}, {
|
||||||
|
label: '已售出',
|
||||||
|
id: 2
|
||||||
|
}, {
|
||||||
|
label: '已归档',
|
||||||
|
id: 3
|
||||||
|
}]
|
||||||
|
],
|
||||||
priceDialogItem: null,
|
priceDialogItem: null,
|
||||||
priceDialogIndex: -1,
|
priceDialogIndex: -1,
|
||||||
priceDialogValue: '',
|
priceDialogValue: '',
|
||||||
@@ -379,15 +406,15 @@
|
|||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
onSearch() {
|
onSearch() {
|
||||||
this.queryList(this.page,this.pageSize)
|
this.$refs.paging && this.$refs.paging.reload()
|
||||||
},
|
},
|
||||||
queryList(pageNo, pageSize, from) {
|
queryList(pageNo, pageSize, from) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
var that = this;
|
var that = this;
|
||||||
const params = {
|
const params = {
|
||||||
current:pageNo,
|
current:pageNo,
|
||||||
status:1,
|
status:this.status_id,
|
||||||
size:10
|
size:pageSize
|
||||||
};
|
};
|
||||||
params.keyword = this.keyword;
|
params.keyword = this.keyword;
|
||||||
request({
|
request({
|
||||||
@@ -403,6 +430,15 @@
|
|||||||
uni.stopPullDownRefresh();
|
uni.stopPullDownRefresh();
|
||||||
//
|
//
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
onstatus(e){
|
||||||
|
if (e.value && e.value[0]) {
|
||||||
|
const selectedItem = typeof e.value[0] === 'object' ? e.value[0] : { value: e.value[0], label: e.value[0].toString() };
|
||||||
|
this.status_name = selectedItem.label;
|
||||||
|
this.status_id = selectedItem.id;
|
||||||
|
this.show = false;
|
||||||
|
this.$refs.paging && this.$refs.paging.reload()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,6 +454,13 @@
|
|||||||
background: #f4f6f8;
|
background: #f4f6f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* #ifdef H5 */
|
||||||
|
.page {
|
||||||
|
/* 给自定义 TabBar 预留空间,避免内容被遮挡 */
|
||||||
|
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
.page-head {
|
.page-head {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -428,11 +471,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.head-search {
|
.head-search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
background: rgba(255, 255, 255, 1);
|
background: rgba(255, 255, 255, 1);
|
||||||
border-radius: 9px 9px 0px 0px;
|
border-radius: 9px 9px 0px 0px;
|
||||||
padding: 20rpx 10px;
|
padding: 20rpx 10px;
|
||||||
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.06);
|
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
.statussearch{
|
||||||
|
border: 1px solid #eae9e9;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.list-wrap {
|
.list-wrap {
|
||||||
padding: 18rpx 24rpx 40rpx;
|
padding: 18rpx 24rpx 40rpx;
|
||||||
|
|||||||
+314
-51
@@ -26,6 +26,7 @@
|
|||||||
>
|
>
|
||||||
<CarCard
|
<CarCard
|
||||||
:item="item"
|
:item="item"
|
||||||
|
:ismy="true"
|
||||||
@pdfchange="onSearch"
|
@pdfchange="onSearch"
|
||||||
@request-price="onRequestPrice"
|
@request-price="onRequestPrice"
|
||||||
/>
|
/>
|
||||||
@@ -33,24 +34,78 @@
|
|||||||
</view>
|
</view>
|
||||||
</z-paging>
|
</z-paging>
|
||||||
<uni-popup ref="inputDialog" type="dialog">
|
<uni-popup ref="inputDialog" type="dialog">
|
||||||
<uni-popup-dialog
|
<view class="price-dialog">
|
||||||
mode="input"
|
<view class="pd-title">设置价格</view>
|
||||||
title="请输入价格"
|
<view class="pd-row">
|
||||||
:value="priceDialogValue"
|
<view class="pd-label">贸易条款</view>
|
||||||
placeholder="请输入车辆价格"
|
<view class="pd-price-line">
|
||||||
@confirm="dialogInputConfirm"
|
<uni-data-select
|
||||||
/>
|
v-model="priceForm.trade_term"
|
||||||
|
class="tradeTerm"
|
||||||
|
:localdata="tradeTermOptions"
|
||||||
|
:clear="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="pd-row">
|
||||||
|
<view class="pd-label">价格</view>
|
||||||
|
<view class="pd-price-line">
|
||||||
|
<view class="pd-input-suffix-wrap">
|
||||||
|
<input
|
||||||
|
class="pd-input pd-input-price pd-input-with-suffix"
|
||||||
|
v-model="priceForm.price"
|
||||||
|
type="number"
|
||||||
|
inputmode="decimal"
|
||||||
|
placeholder="请输入数字"
|
||||||
|
@input="onPriceInput"
|
||||||
|
/>
|
||||||
|
<!-- 币种下拉:放在输入框内部右侧(无边框) -->
|
||||||
|
<view class="pd-currency-suffix">
|
||||||
|
<uni-data-select
|
||||||
|
class="pd-currency-select-suffix"
|
||||||
|
v-model="priceForm.currency"
|
||||||
|
:localdata="currencyOptions"
|
||||||
|
:clear="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 语言单选 -->
|
||||||
|
<view class="pd-row">
|
||||||
|
<view class="pd-label">语言</view>
|
||||||
|
<radio-group class="pd-radio-group" @change="onLangChange">
|
||||||
|
<label class="pd-radio" v-for="l in langOptions" :key="l.value">
|
||||||
|
<radio :value="l.value" :checked="priceForm.lang === l.value" />
|
||||||
|
<text class="pd-radio-text">{{ l.text }}</text>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="pd-actions">
|
||||||
|
<view class="pd-btn pd-cancel" @tap="closePriceDialog">取消</view>
|
||||||
|
<view class="pd-btn pd-confirm" @tap="confirmPriceDialog">确认</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<CustomTabBar class="h5-custom-tabbar" />
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { request } from '@/api/apiT.js'
|
import { request } from '@/api/apiT.js'
|
||||||
import CarCard from '@/components/CarCard/CarCard.vue'
|
import CarCard from '@/components/CarCard/CarCard.vue'
|
||||||
|
import CustomTabBar from '@/custom-tab-bar/index.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
CarCard
|
CarCard,
|
||||||
|
CustomTabBar
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -62,12 +117,6 @@
|
|||||||
style: {
|
style: {
|
||||||
backgroundColor: '#007aff'
|
backgroundColor: '#007aff'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '删除',
|
|
||||||
style: {
|
|
||||||
backgroundColor: '#F56C6C'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
keyword: '',
|
keyword: '',
|
||||||
@@ -75,7 +124,35 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
loading: false,
|
loading: false,
|
||||||
finished: false,
|
finished: false,
|
||||||
list: []
|
list: [],
|
||||||
|
priceForm: {
|
||||||
|
trade_term:'',
|
||||||
|
price: "", // 只存数字字符串
|
||||||
|
currency: "USD", // USD | RUB | AED | EUR
|
||||||
|
lang: "en" // en | ru | es | ar
|
||||||
|
},
|
||||||
|
currencyOptions: [
|
||||||
|
{ value: "USD", text: "美元" },
|
||||||
|
{ value: "CNY", text: "人民币" },
|
||||||
|
{ value: "RUB", text: "卢布" },
|
||||||
|
{ value: "AED", text: "迪拉姆" },
|
||||||
|
{ value: "EUR", text: "欧元" }
|
||||||
|
],
|
||||||
|
langOptions: [
|
||||||
|
{ text: "英语", value: "en" },
|
||||||
|
{ text: "俄语", value: "ru" },
|
||||||
|
{ text: "西班牙语", value: "es" },
|
||||||
|
{ text: "阿拉伯语", value: "ar" }
|
||||||
|
],
|
||||||
|
tradeTermOptions: [
|
||||||
|
{ value: "FOB", text: "FOB" },
|
||||||
|
{ value: "CIF", text: "CIF" },
|
||||||
|
{ value: "EXW", text: "EXW" },
|
||||||
|
{ value: "DDP", text: "DDP" },
|
||||||
|
{ value: "CIP", text: "CIP" },
|
||||||
|
{ value: "FCA", text: "FCA" },
|
||||||
|
{ value: "CFR", text: "CFR" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -187,6 +264,12 @@
|
|||||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
this.priceDialogItem = payload && payload.item ? payload.item : null
|
||||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
||||||
this.priceDialogValue = ''
|
this.priceDialogValue = ''
|
||||||
|
this.priceForm = {
|
||||||
|
trade_term:'',
|
||||||
|
price:"",
|
||||||
|
currency: "USD",
|
||||||
|
lang: "en"
|
||||||
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
||||||
})
|
})
|
||||||
@@ -217,29 +300,77 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
closePriceDialog() {
|
||||||
|
this.$refs.inputDialog.close()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 只允许数字 + 可选1个小数点(你要“纯整数”也行,我后面给你一行改法)
|
||||||
|
onPriceInput(e) {
|
||||||
|
let v = (e.detail && e.detail.value) ? String(e.detail.value) : String(this.priceForm.price || "")
|
||||||
|
|
||||||
|
// 过滤掉非数字和点
|
||||||
|
v = v.replace(/[^\d.]/g, "")
|
||||||
|
|
||||||
|
// 只保留第一个小数点
|
||||||
|
const parts = v.split(".")
|
||||||
|
if (parts.length > 2) {
|
||||||
|
v = parts[0] + "." + parts.slice(1).join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 去掉开头多余 0(保留 0.xxx)
|
||||||
|
v = v.replace(/^0+(\d)/, "$1")
|
||||||
|
if (v.startsWith(".")) v = "0" + v
|
||||||
|
|
||||||
|
this.priceForm.price = v
|
||||||
|
},
|
||||||
|
|
||||||
|
onCurrencyPickerChange(e) {
|
||||||
|
const idx = Number(e.detail.value || 0)
|
||||||
|
this.currencyIndex = idx
|
||||||
|
this.priceForm.currency = this.currencyOptions[idx]?.value || "USD"
|
||||||
|
},
|
||||||
|
|
||||||
|
onLangChange(e) {
|
||||||
|
this.priceForm.lang = e.detail.value
|
||||||
|
},
|
||||||
|
|
||||||
|
confirmPriceDialog() {
|
||||||
|
if (!this.priceForm.trade_term) {
|
||||||
|
return uni.showToast({ title: "请选择贸易条款", icon: "none" })
|
||||||
|
}
|
||||||
|
// 校验
|
||||||
|
if (!this.priceForm.price) {
|
||||||
|
return uni.showToast({ title: "请输入价格", icon: "none" })
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
trade_term:this.priceForm.trade_term,
|
||||||
|
price: this.priceForm.price, // 数字字符串
|
||||||
|
currency: this.priceForm.currency, // USD/RUB/AED/EUR
|
||||||
|
lang: this.priceForm.lang // en/ru/es/ar
|
||||||
|
}
|
||||||
|
console.log(payload)
|
||||||
|
this.closePriceDialog()
|
||||||
|
this.dialogInputConfirm(payload)
|
||||||
|
},
|
||||||
dialogInputConfirm(val) {
|
dialogInputConfirm(val) {
|
||||||
const item = this.priceDialogItem
|
const item = this.priceDialogItem
|
||||||
const index = this.priceDialogIndex
|
const index = this.priceDialogIndex
|
||||||
const price = String(val || '').trim()
|
|
||||||
|
|
||||||
if (!item) return
|
if (!item) return
|
||||||
if (!price) {
|
if (!val.price) {
|
||||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
uni.showToast({ title: '请输入价格', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (isNaN(price) || Number(price) <= 0) {
|
|
||||||
uni.showToast({ title: '请输入有效的价格', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: 'common/usedcar/produce/pdf',
|
url: 'common/usedcar/produce/pdf',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: { id: item.id, price }
|
data: { id: item.id, price:val.price,currency:val.currency,lang:val.lang,trade_term:val.trade_term }
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
// 通知刷新列表(你原来就是靠这个事件刷新)
|
||||||
this.onSearch()
|
this.onSearch()
|
||||||
|
|
||||||
this.downloadpdf(item)
|
this.downloadpdf(item)
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
||||||
@@ -287,45 +418,59 @@
|
|||||||
let {
|
let {
|
||||||
content
|
content
|
||||||
} = e;
|
} = e;
|
||||||
if (content.text === '删除') {
|
const id = item.id
|
||||||
uni.showModal({
|
uni.navigateTo({
|
||||||
title: '提示',
|
url: `/pages/index/publishedit?id=${id}`
|
||||||
content: '是否删除',
|
})
|
||||||
success: res => {
|
// if (content.text === '删除') {
|
||||||
if (res.confirm) {
|
// uni.showModal({
|
||||||
request({
|
// title: '提示',
|
||||||
url:'common/usedcar/destroy',
|
// content: '是否删除',
|
||||||
method:'post',
|
// success: res => {
|
||||||
data: {id:item.id}
|
// if (res.confirm) {
|
||||||
}).then(res => {
|
// request({
|
||||||
uni.showToast({
|
// url:'common/usedcar/destroy',
|
||||||
title: res.data.message,
|
// method:'post',
|
||||||
icon: 'none'
|
// data: {id:item.id}
|
||||||
});
|
// }).then(res => {
|
||||||
this.queryList()
|
// uni.showToast({
|
||||||
})
|
// title: res.data.message,
|
||||||
} else if (res.cancel) {
|
// icon: 'none'
|
||||||
console.log('用户点击取消');
|
// });
|
||||||
}
|
// this.queryList()
|
||||||
}
|
// })
|
||||||
});
|
// } else if (res.cancel) {
|
||||||
} else {
|
// console.log('用户点击取消');
|
||||||
const id = item.id
|
// }
|
||||||
uni.navigateTo({
|
// }
|
||||||
url: `/pages/index/publishedit?id=${id}`
|
// });
|
||||||
})
|
// } else {
|
||||||
}
|
// const id = item.id
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: `/pages/index/publishedit?id=${id}`
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.tradeTerm{
|
||||||
|
border: 1px solid #eae9e9;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
.page {
|
.page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f4f6f8;
|
background: #f4f6f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* #ifdef H5 */
|
||||||
|
.page {
|
||||||
|
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
.page-head {
|
.page-head {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -349,4 +494,122 @@
|
|||||||
.loadmore {
|
.loadmore {
|
||||||
padding: 18rpx 0 6rpx;
|
padding: 18rpx 0 6rpx;
|
||||||
}
|
}
|
||||||
|
.price-dialog{
|
||||||
|
width: 640rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-title{
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-row{
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-row-col{
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-label{
|
||||||
|
width: 120rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-input{
|
||||||
|
flex:1;
|
||||||
|
height: 66rpx;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
.pd-input-suffix-wrap{
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-input-with-suffix{
|
||||||
|
padding-right: 180rpx; /* 给右侧币种留空间 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-currency-suffix{
|
||||||
|
position: absolute;
|
||||||
|
right: 14rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 140rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
::v-deep .uni-select{
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
.pd-radio-group{
|
||||||
|
display:flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16rpx 22rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-radio{
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-radio-text{
|
||||||
|
margin-left: 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-actions{
|
||||||
|
display:flex;
|
||||||
|
gap: 18rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-btn{
|
||||||
|
flex:1;
|
||||||
|
height: 84rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-cancel{
|
||||||
|
background:#f5f5f5;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-confirm{
|
||||||
|
background:#3F435B; /* 你喜欢绿色风格 */
|
||||||
|
color:#fff;
|
||||||
|
font-weight:600;
|
||||||
|
}
|
||||||
|
.pd-price-line{
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-input-price{
|
||||||
|
flex: 1;
|
||||||
|
min-width: 240rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+126
-546
@@ -1,603 +1,183 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<!-- 列表 -->
|
<!-- 用户信息卡片 -->
|
||||||
<z-paging ref="paging" v-model="list" @query="queryList" empty-view-text="暂无数据!">
|
<view class="user-card" @click="goToChanginfo">
|
||||||
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="首页"></uni-nav-bar> -->
|
<view class="user-info">
|
||||||
<!-- 顶部:标题 + 搜索(不想要搜索可直接删除这一块) -->
|
<image
|
||||||
<view class="page-head">
|
class="avatar"
|
||||||
<view class="head-search">
|
:src="userInfo.avatar_pull || '/static/image/user.png'"
|
||||||
<u-search
|
mode="aspectFill"
|
||||||
v-model="keyword"
|
/>
|
||||||
placeholder="请输入关键词"
|
<view class="user-details">
|
||||||
:show-action="false"
|
<text class="nickname">{{ userInfo.name}}</text>
|
||||||
shape="round"
|
<text class="phone">{{ userInfo.name_en}}</text>
|
||||||
@change="onKeywordChange"
|
|
||||||
@search="onSearch"
|
|
||||||
@clear="onSearch"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="list-wrap">
|
</view>
|
||||||
<uni-swipe-action-item
|
|
||||||
v-for="item in list"
|
<!-- 功能入口 -->
|
||||||
:key="item.id"
|
<view class="menu-section">
|
||||||
:right-options="options1"
|
<view class="menu-item" @tap="goToMyPublish" v-if="this.userInfo.role==2">
|
||||||
@click="swipeClick($event, item)"
|
<view class="menu-icon">
|
||||||
>
|
<u-icon name="list-dot" size="24" color="#3F435B"></u-icon>
|
||||||
<CarCard
|
</view>
|
||||||
:item="item"
|
<text class="menu-text">我的发布</text>
|
||||||
:ismy="true"
|
<view class="menu-arrow">
|
||||||
@pdfchange="onSearch"
|
<u-icon name="arrow-right" size="18" color="#999"></u-icon>
|
||||||
@request-price="onRequestPrice"
|
|
||||||
/>
|
|
||||||
</uni-swipe-action-item>
|
|
||||||
</view>
|
|
||||||
</z-paging>
|
|
||||||
<uni-popup ref="inputDialog" type="dialog">
|
|
||||||
<view class="price-dialog">
|
|
||||||
<view class="pd-title">设置价格</view>
|
|
||||||
<view class="pd-row">
|
|
||||||
<view class="pd-label">贸易条款</view>
|
|
||||||
<view class="pd-price-line">
|
|
||||||
<uni-data-select
|
|
||||||
v-model="priceForm.trade_term"
|
|
||||||
class="tradeTerm"
|
|
||||||
:localdata="tradeTermOptions"
|
|
||||||
:clear="false"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="pd-row">
|
<view class="menu-item" @tap="goToMyPublish" v-if="this.userInfo.role==1">
|
||||||
<view class="pd-label">价格</view>
|
<view class="menu-icon">
|
||||||
<view class="pd-price-line">
|
<u-icon name="list-dot" size="24" color="#3F435B"></u-icon>
|
||||||
<view class="pd-input-suffix-wrap">
|
</view>
|
||||||
<input
|
<text class="menu-text">我的车库</text>
|
||||||
class="pd-input pd-input-price pd-input-with-suffix"
|
<view class="menu-arrow">
|
||||||
v-model="priceForm.price"
|
<u-icon name="arrow-right" size="18" color="#999"></u-icon>
|
||||||
type="number"
|
|
||||||
inputmode="decimal"
|
|
||||||
placeholder="请输入数字"
|
|
||||||
@input="onPriceInput"
|
|
||||||
/>
|
|
||||||
<!-- 币种下拉:放在输入框内部右侧(无边框) -->
|
|
||||||
<view class="pd-currency-suffix">
|
|
||||||
<uni-data-select
|
|
||||||
class="pd-currency-select-suffix"
|
|
||||||
v-model="priceForm.currency"
|
|
||||||
:localdata="currencyOptions"
|
|
||||||
:clear="false"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
<!-- 语言单选 -->
|
<CustomTabBar class="h5-custom-tabbar" />
|
||||||
<view class="pd-row">
|
|
||||||
<view class="pd-label">语言</view>
|
|
||||||
<radio-group class="pd-radio-group" @change="onLangChange">
|
|
||||||
<label class="pd-radio" v-for="l in langOptions" :key="l.value">
|
|
||||||
<radio :value="l.value" :checked="priceForm.lang === l.value" />
|
|
||||||
<text class="pd-radio-text">{{ l.text }}</text>
|
|
||||||
</label>
|
|
||||||
</radio-group>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 操作按钮 -->
|
|
||||||
<view class="pd-actions">
|
|
||||||
<view class="pd-btn pd-cancel" @tap="closePriceDialog">取消</view>
|
|
||||||
<view class="pd-btn pd-confirm" @tap="confirmPriceDialog">确认</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-popup>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { request } from '@/api/apiT.js'
|
import { request } from '@/api/apiT.js'
|
||||||
import CarCard from '@/components/CarCard/CarCard.vue'
|
import CustomTabBar from '@/custom-tab-bar/index.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
CarCard
|
CustomTabBar
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
priceDialogItem: null,
|
userInfo: {}
|
||||||
priceDialogIndex: -1,
|
|
||||||
priceDialogValue: '',
|
|
||||||
options1: [{
|
|
||||||
text: '编辑',
|
|
||||||
style: {
|
|
||||||
backgroundColor: '#007aff'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
keyword: '',
|
|
||||||
page: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
loading: false,
|
|
||||||
finished: false,
|
|
||||||
list: [],
|
|
||||||
priceForm: {
|
|
||||||
trade_term:'',
|
|
||||||
price: "", // 只存数字字符串
|
|
||||||
currency: "USD", // USD | RUB | AED | EUR
|
|
||||||
lang: "en" // en | ru | es | ar
|
|
||||||
},
|
|
||||||
currencyOptions: [
|
|
||||||
{ value: "USD", text: "美元" },
|
|
||||||
{ value: "CNY", text: "人民币" },
|
|
||||||
{ value: "RUB", text: "卢布" },
|
|
||||||
{ value: "AED", text: "迪拉姆" },
|
|
||||||
{ value: "EUR", text: "欧元" }
|
|
||||||
],
|
|
||||||
langOptions: [
|
|
||||||
{ text: "英语", value: "en" },
|
|
||||||
{ text: "俄语", value: "ru" },
|
|
||||||
{ text: "西班牙语", value: "es" },
|
|
||||||
{ text: "阿拉伯语", value: "ar" }
|
|
||||||
],
|
|
||||||
tradeTermOptions: [
|
|
||||||
{ value: "FOB", text: "FOB" },
|
|
||||||
{ value: "CIF", text: "CIF" },
|
|
||||||
{ value: "EXW", text: "EXW" },
|
|
||||||
{ value: "DDP", text: "DDP" },
|
|
||||||
{ value: "CIP", text: "CIP" },
|
|
||||||
{ value: "FCA", text: "FCA" },
|
|
||||||
{ value: "CFR", text: "CFR" }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.initFeishuShare()
|
},
|
||||||
// H5:处理分享兜底参数 r(如果路由没命中/经历登录回跳,会先落到首页)
|
onShow() {
|
||||||
// #ifdef H5
|
// 页面显示时刷新用户信息
|
||||||
try {
|
this.getUserInfo()
|
||||||
const u = new URL(window.location.href)
|
|
||||||
const r = u.searchParams.get('r')
|
|
||||||
if (r) {
|
|
||||||
const target = decodeURIComponent(r)
|
|
||||||
// 清理地址栏的 r,避免反复跳转
|
|
||||||
u.searchParams.delete('r')
|
|
||||||
window.history.replaceState({}, '', u.toString())
|
|
||||||
// 让首页加载完再跳
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.navigateTo({ url: target })
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isFeishuEnv() {
|
// 获取用户信息
|
||||||
// 飞书/ Lark 客户端内置浏览器 UA 通常包含 Feishu / Lark
|
getUserInfo() {
|
||||||
try {
|
|
||||||
const ua = (navigator.userAgent || '').toLowerCase()
|
|
||||||
return ua.includes('feishu') || ua.includes('lark')
|
|
||||||
} catch (e) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
loadFeishuJSSDK() {
|
|
||||||
// 动态加载飞书 H5 JS-SDK(避免你还要改 public/index.html)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
// 已加载
|
|
||||||
if (typeof window !== 'undefined' && window.h5sdk && window.tt) return resolve(true)
|
|
||||||
// H5 才有 document
|
|
||||||
if (typeof document === 'undefined') return reject(new Error('not in h5 environment'))
|
|
||||||
// 已插入但未 ready
|
|
||||||
const existed = document.querySelector('script[data-feishu-h5sdk="1"]')
|
|
||||||
if (existed) {
|
|
||||||
existed.addEventListener('load', () => resolve(true))
|
|
||||||
existed.addEventListener('error', () => reject(new Error('feishu sdk load error')))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const s = document.createElement('script')
|
|
||||||
s.async = true
|
|
||||||
s.src = 'https://lf-scm-cn.feishucdn.com/lark/op/h5-js-sdk-1.5.44.js'
|
|
||||||
s.onload = () => resolve(true)
|
|
||||||
s.onerror = () => reject(new Error('feishu sdk load error'))
|
|
||||||
document.head.appendChild(s)
|
|
||||||
} catch (e) {
|
|
||||||
reject(e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getFeishuSignUrl() {
|
|
||||||
// 飞书签名通常要求“去掉 hash 的完整 URL”
|
|
||||||
try {
|
|
||||||
return window.location.href.split('#')[0]
|
|
||||||
} catch (e) {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initFeishuShare() {
|
|
||||||
try {
|
|
||||||
// 确保在飞书环境
|
|
||||||
// if (!this.isFeishuEnv()) return
|
|
||||||
// 动态加载 SDK
|
|
||||||
this.loadFeishuJSSDK()
|
|
||||||
|
|
||||||
// 这里需要后端提供签名接口:返回 { appId, timestamp, nonceStr, signature }
|
|
||||||
// 你可以按你后端习惯改成:request({ url: 'xxx', ... })
|
|
||||||
// const signUrl = encodeURIComponent(this.getFeishuSignUrl())
|
|
||||||
const signUrl = this.getFeishuSignUrl()
|
|
||||||
|
|
||||||
request({
|
|
||||||
url:'common/auth/feishu/signature',
|
|
||||||
method:'get',
|
|
||||||
data: {url:signUrl,app_id:uni.getStorageSync('fsappid')}
|
|
||||||
}).then(res => {
|
|
||||||
var cfg = res.data.data;
|
|
||||||
window.h5sdk.config({
|
|
||||||
appId: cfg.appId || uni.getStorageSync('fsappid'),
|
|
||||||
timestamp: cfg.timestamp,
|
|
||||||
nonceStr: cfg.nonceStr,
|
|
||||||
signature: cfg.signature,
|
|
||||||
jsApiList: ['shareWebContent','share']
|
|
||||||
})
|
|
||||||
|
|
||||||
window.h5sdk.ready(() => {
|
|
||||||
this._feishuReady = true
|
|
||||||
})
|
|
||||||
window.h5sdk.error((err) => {
|
|
||||||
this._feishuReady = false
|
|
||||||
console.error('Feishu JSSDK error:', err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} catch (e) {
|
|
||||||
// 不要阻塞页面,失败就走 H5 的兜底分享
|
|
||||||
console.error('initFeishuShare failed:', e)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onRequestPrice(payload) {
|
|
||||||
// payload: { item, index }
|
|
||||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
|
||||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
|
||||||
this.priceDialogValue = ''
|
|
||||||
this.priceForm = {
|
|
||||||
trade_term:'',
|
|
||||||
price:"",
|
|
||||||
currency: "USD",
|
|
||||||
lang: "en"
|
|
||||||
}
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// H5 下载:用 a 标签触发
|
|
||||||
downloadByAnchor(url, filename) {
|
|
||||||
try {
|
|
||||||
const a = document.createElement('a')
|
|
||||||
a.href = url
|
|
||||||
a.download = filename || ''
|
|
||||||
a.target = '_blank'
|
|
||||||
document.body.appendChild(a)
|
|
||||||
a.click()
|
|
||||||
document.body.removeChild(a)
|
|
||||||
} catch (e) {
|
|
||||||
// 兜底:直接打开
|
|
||||||
if (typeof window !== 'undefined') window.open(url, '_blank')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
downloadpdf(item) {
|
|
||||||
request({
|
request({
|
||||||
url: 'common/usedcar/pdf',
|
url: 'common/user/info',
|
||||||
method: 'get',
|
method: 'get'
|
||||||
data: { id: item.id }
|
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 0 || res.data.code == 200) {
|
||||||
this.downloadByAnchor(res.data.data.pdf_url, res.data.data.file_name)
|
this.userInfo = res.data.data
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// 获取失败时使用默认值
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closePriceDialog() {
|
// 跳转到我的发布列表
|
||||||
this.$refs.inputDialog.close()
|
goToMyPublish() {
|
||||||
},
|
|
||||||
|
|
||||||
// 只允许数字 + 可选1个小数点(你要“纯整数”也行,我后面给你一行改法)
|
|
||||||
onPriceInput(e) {
|
|
||||||
let v = (e.detail && e.detail.value) ? String(e.detail.value) : String(this.priceForm.price || "")
|
|
||||||
|
|
||||||
// 过滤掉非数字和点
|
|
||||||
v = v.replace(/[^\d.]/g, "")
|
|
||||||
|
|
||||||
// 只保留第一个小数点
|
|
||||||
const parts = v.split(".")
|
|
||||||
if (parts.length > 2) {
|
|
||||||
v = parts[0] + "." + parts.slice(1).join("")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 去掉开头多余 0(保留 0.xxx)
|
|
||||||
v = v.replace(/^0+(\d)/, "$1")
|
|
||||||
if (v.startsWith(".")) v = "0" + v
|
|
||||||
|
|
||||||
this.priceForm.price = v
|
|
||||||
},
|
|
||||||
|
|
||||||
onCurrencyPickerChange(e) {
|
|
||||||
const idx = Number(e.detail.value || 0)
|
|
||||||
this.currencyIndex = idx
|
|
||||||
this.priceForm.currency = this.currencyOptions[idx]?.value || "USD"
|
|
||||||
},
|
|
||||||
|
|
||||||
onLangChange(e) {
|
|
||||||
this.priceForm.lang = e.detail.value
|
|
||||||
},
|
|
||||||
|
|
||||||
confirmPriceDialog() {
|
|
||||||
if (!this.priceForm.trade_term) {
|
|
||||||
return uni.showToast({ title: "请选择贸易条款", icon: "none" })
|
|
||||||
}
|
|
||||||
// 校验
|
|
||||||
if (!this.priceForm.price) {
|
|
||||||
return uni.showToast({ title: "请输入价格", icon: "none" })
|
|
||||||
}
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
trade_term:this.priceForm.trade_term,
|
|
||||||
price: this.priceForm.price, // 数字字符串
|
|
||||||
currency: this.priceForm.currency, // USD/RUB/AED/EUR
|
|
||||||
lang: this.priceForm.lang // en/ru/es/ar
|
|
||||||
}
|
|
||||||
console.log(payload)
|
|
||||||
this.closePriceDialog()
|
|
||||||
this.dialogInputConfirm(payload)
|
|
||||||
},
|
|
||||||
dialogInputConfirm(val) {
|
|
||||||
const item = this.priceDialogItem
|
|
||||||
const index = this.priceDialogIndex
|
|
||||||
|
|
||||||
if (!item) return
|
|
||||||
if (!val.price) {
|
|
||||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
request({
|
|
||||||
url: 'common/usedcar/produce/pdf',
|
|
||||||
method: 'get',
|
|
||||||
data: { id: item.id, price:val.price,currency:val.currency,lang:val.lang,trade_term:val.trade_term }
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.code == 200) {
|
|
||||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
|
||||||
this.onSearch()
|
|
||||||
|
|
||||||
this.downloadpdf(item)
|
|
||||||
} else {
|
|
||||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onKeywordChange(val) {
|
|
||||||
// val 是输入值(uView 通常会传)
|
|
||||||
this.keyword = val
|
|
||||||
|
|
||||||
// 防抖:300ms 内持续输入只触发一次
|
|
||||||
if (this._kwTimer) clearTimeout(this._kwTimer)
|
|
||||||
this._kwTimer = setTimeout(() => {
|
|
||||||
this.onSearch()
|
|
||||||
}, 300)
|
|
||||||
},
|
|
||||||
onSearch() {
|
|
||||||
this.queryList(this.page,this.pageSize)
|
|
||||||
},
|
|
||||||
queryList(pageNo, pageSize, from) {
|
|
||||||
this.loading = true;
|
|
||||||
var that = this;
|
|
||||||
const params = {
|
|
||||||
current:pageNo,
|
|
||||||
status:1,
|
|
||||||
size:10
|
|
||||||
};
|
|
||||||
params.keyword = this.keyword;
|
|
||||||
params.scene = 'self';
|
|
||||||
request({
|
|
||||||
url:'common/usedcar/list',
|
|
||||||
method:'get',
|
|
||||||
data: params
|
|
||||||
}).then(res => {
|
|
||||||
if(res.data.code ==200){
|
|
||||||
var datas = res.data.data.records;
|
|
||||||
this.$refs.paging.complete(datas);
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
uni.stopPullDownRefresh();
|
|
||||||
//
|
|
||||||
})
|
|
||||||
},
|
|
||||||
swipeClick(e,item){
|
|
||||||
let {
|
|
||||||
content
|
|
||||||
} = e;
|
|
||||||
const id = item.id
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/index/publishedit?id=${id}`
|
url: '/pages/index/myPublish'
|
||||||
})
|
})
|
||||||
// if (content.text === '删除') {
|
},
|
||||||
// uni.showModal({
|
// 跳转到个人信息
|
||||||
// title: '提示',
|
goToChanginfo() {
|
||||||
// content: '是否删除',
|
uni.navigateTo({
|
||||||
// success: res => {
|
url: '/pages/index/changinfo'
|
||||||
// if (res.confirm) {
|
})
|
||||||
// request({
|
},
|
||||||
// url:'common/usedcar/destroy',
|
|
||||||
// method:'post',
|
|
||||||
// data: {id:item.id}
|
|
||||||
// }).then(res => {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: res.data.message,
|
|
||||||
// icon: 'none'
|
|
||||||
// });
|
|
||||||
// this.queryList()
|
|
||||||
// })
|
|
||||||
// } else if (res.cancel) {
|
|
||||||
// console.log('用户点击取消');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// const id = item.id
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: `/pages/index/publishedit?id=${id}`
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.tradeTerm{
|
|
||||||
border: 1px solid #eae9e9;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
.page {
|
.page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f4f6f8;
|
background: #f4f6f8;
|
||||||
|
padding: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head {
|
.user-card {
|
||||||
position: fixed;
|
background: rgba(255, 255, 255, 0.95);
|
||||||
width: 100%;
|
|
||||||
bottom: 50px;
|
|
||||||
z-index: 99;
|
|
||||||
// padding: 28rpx 24rpx 18rpx;
|
|
||||||
// background: linear-gradient(180deg, rgba(255, 151, 47, 0.22) 0%, rgba(255, 151, 47, 0.06) 55%, #f4f6f8 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.head-search {
|
|
||||||
background: rgba(255, 255, 255, 1);
|
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
padding: 20rpx 10px;
|
padding: 40rpx 30rpx;
|
||||||
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.06);
|
margin-bottom: 20rpx;
|
||||||
|
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-wrap {
|
.user-info {
|
||||||
padding: 18rpx 24rpx 40rpx;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loadmore {
|
.avatar {
|
||||||
padding: 18rpx 0 6rpx;
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #eef2f7;
|
||||||
|
margin-right: 30rpx;
|
||||||
}
|
}
|
||||||
.price-dialog{
|
|
||||||
width: 640rpx;
|
.user-details {
|
||||||
background: #fff;
|
flex: 1;
|
||||||
border-radius: 24rpx;
|
display: flex;
|
||||||
padding: 28rpx;
|
flex-direction: column;
|
||||||
|
gap: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-title{
|
.nickname {
|
||||||
font-size: 34rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: #111;
|
color: #111827;
|
||||||
margin-bottom: 20rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-row{
|
.phone {
|
||||||
display:flex;
|
font-size: 26rpx;
|
||||||
align-items:center;
|
color: #6b7280;
|
||||||
margin-top: 40rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-row-col{
|
.menu-section {
|
||||||
flex-direction: column;
|
background: rgba(255, 255, 255, 0.95);
|
||||||
align-items: flex-start;
|
border-radius: 18rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-label{
|
.menu-item {
|
||||||
width: 120rpx;
|
display: flex;
|
||||||
font-size: 28rpx;
|
align-items: center;
|
||||||
color:#333;
|
padding: 30rpx;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
transition: background-color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-input{
|
.menu-item:last-child {
|
||||||
flex:1;
|
border-bottom: none;
|
||||||
height: 66rpx;
|
|
||||||
border: 1px solid #eee;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
padding: 0 18rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
}
|
}
|
||||||
.pd-input-suffix-wrap{
|
|
||||||
position: relative;
|
.menu-item:active {
|
||||||
flex: 1;
|
background-color: #f9fafb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-input-with-suffix{
|
.menu-icon {
|
||||||
padding-right: 180rpx; /* 给右侧币种留空间 */
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 24rpx;
|
||||||
|
// background: #f3f4f6;
|
||||||
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pd-currency-suffix{
|
.menu-text {
|
||||||
position: absolute;
|
flex: 1;
|
||||||
right: 14rpx;
|
font-size: 30rpx;
|
||||||
top: 50%;
|
color: #111827;
|
||||||
transform: translateY(-50%);
|
font-weight: 500;
|
||||||
width: 140rpx;
|
|
||||||
height: 80rpx;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
}
|
||||||
::v-deep .uni-select{
|
|
||||||
border: none !important;
|
.menu-arrow {
|
||||||
}
|
display: flex;
|
||||||
.pd-radio-group{
|
align-items: center;
|
||||||
display:flex;
|
justify-content: center;
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 16rpx 22rpx;
|
|
||||||
margin-top: 12rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-radio{
|
|
||||||
display:flex;
|
|
||||||
align-items:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-radio-text{
|
|
||||||
margin-left: 10rpx;
|
|
||||||
font-size: 26rpx;
|
|
||||||
color:#333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-actions{
|
|
||||||
display:flex;
|
|
||||||
gap: 18rpx;
|
|
||||||
margin-top: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-btn{
|
|
||||||
flex:1;
|
|
||||||
height: 84rpx;
|
|
||||||
border-radius: 18rpx;
|
|
||||||
display:flex;
|
|
||||||
align-items:center;
|
|
||||||
justify-content:center;
|
|
||||||
font-size: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-cancel{
|
|
||||||
background:#f5f5f5;
|
|
||||||
color:#333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-confirm{
|
|
||||||
background:#3F435B; /* 你喜欢绿色风格 */
|
|
||||||
color:#fff;
|
|
||||||
font-weight:600;
|
|
||||||
}
|
|
||||||
.pd-price-line{
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pd-input-price{
|
|
||||||
flex: 1;
|
|
||||||
min-width: 240rpx;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+608
-53
@@ -2,6 +2,13 @@
|
|||||||
<view class="page">
|
<view class="page">
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<z-paging ref="paging" v-model="list" @query="queryList" empty-view-text="暂无数据!">
|
<z-paging ref="paging" v-model="list" @query="queryList" empty-view-text="暂无数据!">
|
||||||
|
<template #top>
|
||||||
|
<!-- 搜索抓取懂车帝 -->
|
||||||
|
<view class="dcd-search">
|
||||||
|
<u-search v-model="urls" placeholder="请输入抓取链接" :show-action="false" shape="round"></u-search>
|
||||||
|
<view class="bind-btn" @tap.stop="onBindByName">抓取</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="首页"></uni-nav-bar> -->
|
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="首页"></uni-nav-bar> -->
|
||||||
<!-- 顶部:标题 + 搜索(不想要搜索可直接删除这一块) -->
|
<!-- 顶部:标题 + 搜索(不想要搜索可直接删除这一块) -->
|
||||||
<view class="page-head">
|
<view class="page-head">
|
||||||
@@ -15,7 +22,12 @@
|
|||||||
@search="onSearch"
|
@search="onSearch"
|
||||||
@clear="onSearch"
|
@clear="onSearch"
|
||||||
/>
|
/>
|
||||||
|
<view class="statussearch" @click="show=true">
|
||||||
|
<text class="year-text">{{status_name || '状态'}}</text>
|
||||||
|
<u-icon name="arrow-down" size="14" color="#999"></u-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-picker :show="show" :columns="columns" keyName="label" @confirm="onstatus" @cancel="show = false"></u-picker>
|
||||||
</view>
|
</view>
|
||||||
<view class="list-wrap">
|
<view class="list-wrap">
|
||||||
<uni-swipe-action-item
|
<uni-swipe-action-item
|
||||||
@@ -26,20 +38,121 @@
|
|||||||
>
|
>
|
||||||
<CarCard
|
<CarCard
|
||||||
:item="item"
|
:item="item"
|
||||||
|
:ismy="true"
|
||||||
@pdfchange="onSearch"
|
@pdfchange="onSearch"
|
||||||
@request-price="onRequestPrice"
|
@request-price="onRequestPrice"
|
||||||
|
@restchange="onSearch"
|
||||||
/>
|
/>
|
||||||
</uni-swipe-action-item>
|
</uni-swipe-action-item>
|
||||||
</view>
|
</view>
|
||||||
</z-paging>
|
</z-paging>
|
||||||
<uni-popup ref="inputDialog" type="dialog">
|
<uni-popup ref="inputDialog" type="dialog">
|
||||||
<uni-popup-dialog
|
<view class="price-dialog">
|
||||||
mode="input"
|
<view class="pd-title">设置价格</view>
|
||||||
title="请输入价格"
|
<view class="pd-row">
|
||||||
:value="priceDialogValue"
|
<view class="pd-label">贸易条款</view>
|
||||||
placeholder="请输入车辆价格"
|
<view class="pd-price-line">
|
||||||
@confirm="dialogInputConfirm"
|
<uni-data-select
|
||||||
/>
|
v-model="priceForm.trade_term"
|
||||||
|
class="tradeTerm"
|
||||||
|
:localdata="tradeTermOptions"
|
||||||
|
:clear="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="pd-row">
|
||||||
|
<view class="pd-label">价格</view>
|
||||||
|
<view class="pd-price-line">
|
||||||
|
<view class="pd-input-suffix-wrap">
|
||||||
|
<input
|
||||||
|
class="pd-input pd-input-price pd-input-with-suffix"
|
||||||
|
v-model="priceForm.price"
|
||||||
|
type="number"
|
||||||
|
inputmode="decimal"
|
||||||
|
placeholder="请输入数字"
|
||||||
|
@input="onPriceInput"
|
||||||
|
/>
|
||||||
|
<!-- 币种下拉:放在输入框内部右侧(无边框) -->
|
||||||
|
<view class="pd-currency-suffix">
|
||||||
|
<uni-data-select
|
||||||
|
class="pd-currency-select-suffix"
|
||||||
|
v-model="priceForm.currency"
|
||||||
|
:localdata="currencyOptions"
|
||||||
|
:clear="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 语言单选 -->
|
||||||
|
<view class="pd-row">
|
||||||
|
<view class="pd-label">语言</view>
|
||||||
|
<radio-group class="pd-radio-group" @change="onLangChange">
|
||||||
|
<label class="pd-radio" v-for="l in langOptions" :key="l.value">
|
||||||
|
<radio :value="l.value" :checked="priceForm.lang === l.value" />
|
||||||
|
<text class="pd-radio-text">{{ l.text }}</text>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="pd-actions">
|
||||||
|
<view class="pd-btn pd-cancel" @tap="closePriceDialog">取消</view>
|
||||||
|
<view class="pd-btn pd-confirm" @tap="confirmPriceDialog">确认</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
<!-- 抓取信息弹出层 -->
|
||||||
|
<uni-popup ref="crawlDialog" type="dialog">
|
||||||
|
<view class="crawl-dialog">
|
||||||
|
<view class="crawl-title">抓取信息</view>
|
||||||
|
<view class="crawl-content" v-if="crawlLoading">
|
||||||
|
<view class="crawl-loading">正在抓取中...</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-content" v-else-if="crawlData">
|
||||||
|
<view class="crawl-item" v-if="crawlData.product_name">
|
||||||
|
<view class="crawl-label">车辆名称</view>
|
||||||
|
<view class="crawl-value">{{ crawlData.product_name }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-item" v-if="crawlData.source_place">
|
||||||
|
<view class="crawl-label">车源地</view>
|
||||||
|
<view class="crawl-value">{{ crawlData.source_place }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-item" v-if="crawlData.body_color">
|
||||||
|
<view class="crawl-label">车身颜色</view>
|
||||||
|
<view class="crawl-value">{{ crawlData.body_color }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-item" v-if="crawlData.plate_time">
|
||||||
|
<view class="crawl-label">上牌时间</view>
|
||||||
|
<view class="crawl-value">{{ crawlData.plate_time }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-item" v-if="crawlData.mileage">
|
||||||
|
<view class="crawl-label">里程</view>
|
||||||
|
<view class="crawl-value">{{ crawlData.mileage }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-item" v-if="crawlData.price">
|
||||||
|
<view class="crawl-label">价格</view>
|
||||||
|
<view class="crawl-value">{{ crawlData.price }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-item" v-if="crawlData.image_pull && crawlData.image_pull.length > 0">
|
||||||
|
<view class="crawl-label">图片</view>
|
||||||
|
<view class="crawl-images">
|
||||||
|
<image
|
||||||
|
v-for="(img, idx) in crawlData.image_pull"
|
||||||
|
:key="idx"
|
||||||
|
:src="img"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="crawl-image"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="crawl-actions">
|
||||||
|
<view class="crawl-btn crawl-confirm1" @tap="closeCrawlDialog">关闭</view>
|
||||||
|
<view class="crawl-btn crawl-confirm" @tap="saveCrawlDialog">保存</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -54,6 +167,24 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
urls:'',
|
||||||
|
show: false,
|
||||||
|
status_id:1,
|
||||||
|
status_name:'',
|
||||||
|
crawlData: null,
|
||||||
|
crawlLoading: false,
|
||||||
|
columns: [
|
||||||
|
[{
|
||||||
|
label: '正常',
|
||||||
|
id: 1
|
||||||
|
}, {
|
||||||
|
label: '已售出',
|
||||||
|
id: 2
|
||||||
|
}, {
|
||||||
|
label: '已归档',
|
||||||
|
id: 3
|
||||||
|
}]
|
||||||
|
],
|
||||||
priceDialogItem: null,
|
priceDialogItem: null,
|
||||||
priceDialogIndex: -1,
|
priceDialogIndex: -1,
|
||||||
priceDialogValue: '',
|
priceDialogValue: '',
|
||||||
@@ -62,12 +193,6 @@
|
|||||||
style: {
|
style: {
|
||||||
backgroundColor: '#007aff'
|
backgroundColor: '#007aff'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
text: '删除',
|
|
||||||
style: {
|
|
||||||
backgroundColor: '#F56C6C'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
keyword: '',
|
keyword: '',
|
||||||
@@ -75,7 +200,35 @@
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
loading: false,
|
loading: false,
|
||||||
finished: false,
|
finished: false,
|
||||||
list: []
|
list: [],
|
||||||
|
priceForm: {
|
||||||
|
trade_term:'',
|
||||||
|
price: "", // 只存数字字符串
|
||||||
|
currency: "USD", // USD | RUB | AED | EUR
|
||||||
|
lang: "en" // en | ru | es | ar
|
||||||
|
},
|
||||||
|
currencyOptions: [
|
||||||
|
{ value: "USD", text: "美元" },
|
||||||
|
{ value: "CNY", text: "人民币" },
|
||||||
|
{ value: "RUB", text: "卢布" },
|
||||||
|
{ value: "AED", text: "迪拉姆" },
|
||||||
|
{ value: "EUR", text: "欧元" }
|
||||||
|
],
|
||||||
|
langOptions: [
|
||||||
|
{ text: "英语", value: "en" },
|
||||||
|
{ text: "俄语", value: "ru" },
|
||||||
|
{ text: "西班牙语", value: "es" },
|
||||||
|
{ text: "阿拉伯语", value: "ar" }
|
||||||
|
],
|
||||||
|
tradeTermOptions: [
|
||||||
|
{ value: "FOB", text: "FOB" },
|
||||||
|
{ value: "CIF", text: "CIF" },
|
||||||
|
{ value: "EXW", text: "EXW" },
|
||||||
|
{ value: "DDP", text: "DDP" },
|
||||||
|
{ value: "CIP", text: "CIP" },
|
||||||
|
{ value: "FCA", text: "FCA" },
|
||||||
|
{ value: "CFR", text: "CFR" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
@@ -187,6 +340,12 @@
|
|||||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
this.priceDialogItem = payload && payload.item ? payload.item : null
|
||||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
||||||
this.priceDialogValue = ''
|
this.priceDialogValue = ''
|
||||||
|
this.priceForm = {
|
||||||
|
trade_term:'',
|
||||||
|
price:"",
|
||||||
|
currency: "USD",
|
||||||
|
lang: "en"
|
||||||
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
||||||
})
|
})
|
||||||
@@ -217,29 +376,77 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
closePriceDialog() {
|
||||||
|
this.$refs.inputDialog.close()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 只允许数字 + 可选1个小数点(你要“纯整数”也行,我后面给你一行改法)
|
||||||
|
onPriceInput(e) {
|
||||||
|
let v = (e.detail && e.detail.value) ? String(e.detail.value) : String(this.priceForm.price || "")
|
||||||
|
|
||||||
|
// 过滤掉非数字和点
|
||||||
|
v = v.replace(/[^\d.]/g, "")
|
||||||
|
|
||||||
|
// 只保留第一个小数点
|
||||||
|
const parts = v.split(".")
|
||||||
|
if (parts.length > 2) {
|
||||||
|
v = parts[0] + "." + parts.slice(1).join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 去掉开头多余 0(保留 0.xxx)
|
||||||
|
v = v.replace(/^0+(\d)/, "$1")
|
||||||
|
if (v.startsWith(".")) v = "0" + v
|
||||||
|
|
||||||
|
this.priceForm.price = v
|
||||||
|
},
|
||||||
|
|
||||||
|
onCurrencyPickerChange(e) {
|
||||||
|
const idx = Number(e.detail.value || 0)
|
||||||
|
this.currencyIndex = idx
|
||||||
|
this.priceForm.currency = this.currencyOptions[idx]?.value || "USD"
|
||||||
|
},
|
||||||
|
|
||||||
|
onLangChange(e) {
|
||||||
|
this.priceForm.lang = e.detail.value
|
||||||
|
},
|
||||||
|
|
||||||
|
confirmPriceDialog() {
|
||||||
|
if (!this.priceForm.trade_term) {
|
||||||
|
return uni.showToast({ title: "请选择贸易条款", icon: "none" })
|
||||||
|
}
|
||||||
|
// 校验
|
||||||
|
if (!this.priceForm.price) {
|
||||||
|
return uni.showToast({ title: "请输入价格", icon: "none" })
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
trade_term:this.priceForm.trade_term,
|
||||||
|
price: this.priceForm.price, // 数字字符串
|
||||||
|
currency: this.priceForm.currency, // USD/RUB/AED/EUR
|
||||||
|
lang: this.priceForm.lang // en/ru/es/ar
|
||||||
|
}
|
||||||
|
console.log(payload)
|
||||||
|
this.closePriceDialog()
|
||||||
|
this.dialogInputConfirm(payload)
|
||||||
|
},
|
||||||
dialogInputConfirm(val) {
|
dialogInputConfirm(val) {
|
||||||
const item = this.priceDialogItem
|
const item = this.priceDialogItem
|
||||||
const index = this.priceDialogIndex
|
const index = this.priceDialogIndex
|
||||||
const price = String(val || '').trim()
|
|
||||||
|
|
||||||
if (!item) return
|
if (!item) return
|
||||||
if (!price) {
|
if (!val.price) {
|
||||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
uni.showToast({ title: '请输入价格', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (isNaN(price) || Number(price) <= 0) {
|
|
||||||
uni.showToast({ title: '请输入有效的价格', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
request({
|
request({
|
||||||
url: 'common/usedcar/produce/pdf',
|
url: 'common/usedcar/produce/pdf',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: { id: item.id, price }
|
data: { id: item.id, price:val.price,currency:val.currency,lang:val.lang,trade_term:val.trade_term }
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.data.code == 200) {
|
if (res.data.code == 200) {
|
||||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
// 通知刷新列表(你原来就是靠这个事件刷新)
|
||||||
this.onSearch()
|
this.onSearch()
|
||||||
|
|
||||||
this.downloadpdf(item)
|
this.downloadpdf(item)
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
||||||
@@ -257,15 +464,15 @@
|
|||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
onSearch() {
|
onSearch() {
|
||||||
this.queryList(this.page,this.pageSize)
|
this.$refs.paging && this.$refs.paging.reload()
|
||||||
},
|
},
|
||||||
queryList(pageNo, pageSize, from) {
|
queryList(pageNo, pageSize, from) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
var that = this;
|
var that = this;
|
||||||
const params = {
|
const params = {
|
||||||
current:pageNo,
|
current:pageNo,
|
||||||
status:1,
|
status:this.status_id,
|
||||||
size:10
|
size:pageSize
|
||||||
};
|
};
|
||||||
params.keyword = this.keyword;
|
params.keyword = this.keyword;
|
||||||
params.scene = 'self';
|
params.scene = 'self';
|
||||||
@@ -283,49 +490,167 @@
|
|||||||
//
|
//
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
onstatus(e){
|
||||||
|
if (e.value && e.value[0]) {
|
||||||
|
const selectedItem = typeof e.value[0] === 'object' ? e.value[0] : { value: e.value[0], label: e.value[0].toString() };
|
||||||
|
this.status_name = selectedItem.label;
|
||||||
|
this.status_id = selectedItem.id;
|
||||||
|
this.show = false;
|
||||||
|
this.$refs.paging && this.$refs.paging.reload()
|
||||||
|
}
|
||||||
|
},
|
||||||
swipeClick(e,item){
|
swipeClick(e,item){
|
||||||
let {
|
let {
|
||||||
content
|
content
|
||||||
} = e;
|
} = e;
|
||||||
if (content.text === '删除') {
|
const id = item.id
|
||||||
uni.showModal({
|
uni.navigateTo({
|
||||||
title: '提示',
|
url: `/pages/index/publishedit?id=${id}`
|
||||||
content: '是否删除',
|
})
|
||||||
success: res => {
|
// if (content.text === '删除') {
|
||||||
if (res.confirm) {
|
// uni.showModal({
|
||||||
request({
|
// title: '提示',
|
||||||
url:'common/usedcar/destroy',
|
// content: '是否删除',
|
||||||
method:'post',
|
// success: res => {
|
||||||
data: {id:item.id}
|
// if (res.confirm) {
|
||||||
}).then(res => {
|
// request({
|
||||||
uni.showToast({
|
// url:'common/usedcar/destroy',
|
||||||
title: res.data.message,
|
// method:'post',
|
||||||
icon: 'none'
|
// data: {id:item.id}
|
||||||
});
|
// }).then(res => {
|
||||||
this.queryList()
|
// uni.showToast({
|
||||||
})
|
// title: res.data.message,
|
||||||
} else if (res.cancel) {
|
// icon: 'none'
|
||||||
console.log('用户点击取消');
|
// });
|
||||||
}
|
// this.queryList()
|
||||||
}
|
// })
|
||||||
});
|
// } else if (res.cancel) {
|
||||||
} else {
|
// console.log('用户点击取消');
|
||||||
const id = item.id
|
// }
|
||||||
uni.navigateTo({
|
// }
|
||||||
url: `/pages/index/publishedit?id=${id}`
|
// });
|
||||||
})
|
// } else {
|
||||||
|
// const id = item.id
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: `/pages/index/publishedit?id=${id}`
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
onBindByName(){
|
||||||
|
if (!this.urls || !this.urls.trim()) {
|
||||||
|
uni.showToast({ title: '请输入抓取链接', icon: 'none' })
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.crawlLoading = true
|
||||||
|
this.crawlData = null
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.crawlDialog && this.$refs.crawlDialog.open()
|
||||||
|
})
|
||||||
|
|
||||||
|
request({
|
||||||
|
url:'common/usedcar/url_crawl',
|
||||||
|
method:'get',
|
||||||
|
data: {url:this.urls}
|
||||||
|
}).then(res => {
|
||||||
|
this.crawlLoading = false
|
||||||
|
if (res.data.code == 200) {
|
||||||
|
this.crawlData = res.data.data || res.data
|
||||||
|
uni.showToast({ title: '抓取成功', icon: 'success' })
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.data.msg || '抓取失败', icon: 'none' })
|
||||||
|
this.crawlData = null
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
this.crawlLoading = false
|
||||||
|
this.crawlData = null
|
||||||
|
console.error('抓取失败', err)
|
||||||
|
uni.showToast({ title: '抓取失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeCrawlDialog() {
|
||||||
|
this.$refs.crawlDialog && this.$refs.crawlDialog.close()
|
||||||
|
this.crawlData = null
|
||||||
|
this.crawlLoading = false
|
||||||
|
},
|
||||||
|
saveCrawlDialog(){
|
||||||
|
function formatCnYearMonth(str) {
|
||||||
|
const match = str.match(/(\d{4})年(\d{1,2})月/)
|
||||||
|
if (!match) return str
|
||||||
|
|
||||||
|
const year = match[1]
|
||||||
|
const month = match[2].padStart(2, '0')
|
||||||
|
|
||||||
|
return `${year}-${month}-01`
|
||||||
|
}
|
||||||
|
const payload = {
|
||||||
|
...this.crawlData,
|
||||||
|
plate_time:formatCnYearMonth(this.crawlData.plate_time),
|
||||||
|
// images 数组 => "url1,url2,url3"
|
||||||
|
images: (this.crawlData.images || [])
|
||||||
|
.map(s => String(s || '').trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(',')
|
||||||
|
}
|
||||||
|
request({
|
||||||
|
url:'common/usedcar/store',
|
||||||
|
method:'post',
|
||||||
|
data:payload
|
||||||
|
}).then(res => {
|
||||||
|
this.$refs.crawlDialog && this.$refs.crawlDialog.close()
|
||||||
|
this.crawlData = null
|
||||||
|
this.crawlLoading = false
|
||||||
|
uni.showToast({
|
||||||
|
title: res.data.message,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.paging && this.$refs.paging.reload()
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.tradeTerm{
|
||||||
|
border: 1px solid #eae9e9;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
.page {
|
.page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f4f6f8;
|
background: #f4f6f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* #ifdef H5 */
|
||||||
|
.page {
|
||||||
|
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
|
.dcd-search{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-btn {
|
||||||
|
padding: 8px 24px;
|
||||||
|
background: #3F435B;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 28rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bind-btn:active {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
.page-head {
|
.page-head {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -336,12 +661,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.head-search {
|
.head-search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
background: rgba(255, 255, 255, 1);
|
background: rgba(255, 255, 255, 1);
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
padding: 20rpx 10px;
|
padding: 20rpx 10px;
|
||||||
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.06);
|
box-shadow: 0 10rpx 28rpx rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
.statussearch{
|
||||||
|
border: 1px solid #eae9e9;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
font-size: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
.list-wrap {
|
.list-wrap {
|
||||||
padding: 18rpx 24rpx 40rpx;
|
padding: 18rpx 24rpx 40rpx;
|
||||||
}
|
}
|
||||||
@@ -349,4 +685,223 @@
|
|||||||
.loadmore {
|
.loadmore {
|
||||||
padding: 18rpx 0 6rpx;
|
padding: 18rpx 0 6rpx;
|
||||||
}
|
}
|
||||||
|
.price-dialog{
|
||||||
|
width: 640rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-title{
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-row{
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-row-col{
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-label{
|
||||||
|
width: 120rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-input{
|
||||||
|
flex:1;
|
||||||
|
height: 66rpx;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
.pd-input-suffix-wrap{
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-input-with-suffix{
|
||||||
|
padding-right: 180rpx; /* 给右侧币种留空间 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-currency-suffix{
|
||||||
|
position: absolute;
|
||||||
|
right: 14rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 140rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
::v-deep .uni-select{
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
.pd-radio-group{
|
||||||
|
display:flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16rpx 22rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-radio{
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-radio-text{
|
||||||
|
margin-left: 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-actions{
|
||||||
|
display:flex;
|
||||||
|
gap: 18rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-btn{
|
||||||
|
flex:1;
|
||||||
|
height: 84rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-cancel{
|
||||||
|
background:#f5f5f5;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-confirm{
|
||||||
|
background:#3F435B; /* 你喜欢绿色风格 */
|
||||||
|
color:#fff;
|
||||||
|
font-weight:600;
|
||||||
|
}
|
||||||
|
.pd-price-line{
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pd-input-price{
|
||||||
|
flex: 1;
|
||||||
|
min-width: 240rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 抓取信息弹出层样式 */
|
||||||
|
.crawl-dialog {
|
||||||
|
width: 680rpx;
|
||||||
|
max-height: 80vh;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 28rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-content {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 60vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-loading {
|
||||||
|
text-align: center;
|
||||||
|
padding: 60rpx 0;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-item {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
padding-bottom: 24rpx;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-label {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-value {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333;
|
||||||
|
word-break: break-all;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-images {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-image {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 18rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
padding-top: 30rpx;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crawl-btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 84rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
.crawl-confirm1 {
|
||||||
|
border:1px solid #3F435B;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.crawl-confirm {
|
||||||
|
background: #3F435B;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -176,11 +176,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- #ifdef H5 -->
|
||||||
|
<CustomTabBar class="h5-custom-tabbar" />
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { request,showToast } from '@/api/apiT.js'
|
import { request,showToast } from '@/api/apiT.js'
|
||||||
|
import CustomTabBar from '@/custom-tab-bar/index.vue'
|
||||||
export default {
|
export default {
|
||||||
|
components:{
|
||||||
|
CustomTabBar
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
maxMedia:20,
|
maxMedia:20,
|
||||||
@@ -508,6 +516,11 @@
|
|||||||
.pages{
|
.pages{
|
||||||
max-width: 650px;
|
max-width: 650px;
|
||||||
}
|
}
|
||||||
|
/* #ifdef H5 */
|
||||||
|
.pages{
|
||||||
|
padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
.uniui-right{
|
.uniui-right{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 2px;
|
top: 2px;
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -102,6 +102,16 @@
|
|||||||
|
|
||||||
uni.setStorageSync('token', token)
|
uni.setStorageSync('token', token)
|
||||||
|
|
||||||
|
// ===== 角色/权限:用于动态 TabBar =====
|
||||||
|
// 兼容多种后端返回结构:role / user.role / userInfo.role
|
||||||
|
const role = res?.data?.data?.role
|
||||||
|
if (role) {
|
||||||
|
// 1) 给 tabbar.js 直接读取
|
||||||
|
uni.setStorageSync('userRole', role)
|
||||||
|
// 通知自定义 TabBar 立刻刷新
|
||||||
|
uni.$emit && uni.$emit('userRoleChanged')
|
||||||
|
}
|
||||||
|
|
||||||
this.title = '登录成功'
|
this.title = '登录成功'
|
||||||
this.desc = '正在进入页面'
|
this.desc = '正在进入页面'
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Reference in New Issue
Block a user