Commit 789b4d77 authored by 贺世双's avatar 贺世双

新增菜单

parent dcd21c31
<template>
<u-tabbar :value="tabIndex" :safeAreaInsetBottom="false" :activeColor="activeColor" :inactiveColor="inactiveColor">
<u-tabbar-item v-for="(tab,index) in tabList" :key="index" :text="tab.text" @click="onClick">
<!-- 选中图标 -->
<image class="tabIcon" slot="active-icon" :src="tab.selectedIconPath" />
<!-- 未选中图标 -->
<image class="tabIcon" slot="inactive-icon" :src="tab.iconPath" />
</u-tabbar-item>
</u-tabbar>
</template>
<script>
export default {
name: "customTabBar",
options: { styleIsolation: 'shared' },
props: {
tabIndex: {
type: Number,
default: 0
},
},
data() {
return {
activeColor: "#3670E7", //选中颜色
inactiveColor: "#8C8C8C", //未选中颜色
tabList: []
};
},
created() {
const { tabList } = getApp().globalData
this.tabList = [...tabList]
},
methods: {
//路由跳转
onClick(index) {
const pagePath = this.tabList[index].pagePath
uni.switchTab({ url: `/${pagePath}`, })
}
}
}
</script>
<style lang="scss">
.u-tabbar {
padding: 0;
/deep/.u-tabbar__content__item-wrapper{
justify-content: space-between;
}
.u-tabbar-item {
margin: auto;
/deep/.u-tabbar-item__icon {
.tabIcon {
width: 48rpx !important;
height: 48rpx !important;
}
}
/deep/.u-tabbar-item__text {
font-size: 20rpx !important;
margin-top: 6rpx !important;
}
}
}
</style>
......@@ -13,18 +13,7 @@
"enablePullDownRefresh": false,
"disableScroll": true
}
}, {
"path": "pages/order/order",
"style": {
"enablePullDownRefresh": false
}
}, {
"path": "pages/index/index",
"style": {
"enablePullDownRefresh": true
}
}, {
}, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "个人中心",
......@@ -32,12 +21,20 @@
"disableScroll": true
}
},{
"path": "pages/order_pod/order_pod",
"path": "pages/dirverMenu/dirverMenu",
"style": {
"navigationBarBackgroundColor": "#005BB5",
"navigationBarTitleText": "司机",
"enablePullDownRefresh": false
}
}],
},{
"path": "pages/carrierMenu/carrierMenu",
"style": {
"navigationBarBackgroundColor": "#005BB5",
"navigationBarTitleText": "承运商",
"enablePullDownRefresh": false
}
}],
"subPackages": [{
"root": "subpkg",
"pages": [{
......@@ -52,18 +49,6 @@
"navigationBarTitleText": "运单详情",
"enablePullDownRefresh": false
}
}, {
"path": "allotDetail/allotDetail",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "allotTruck/allotTruck",
"style": {
"navigationBarTitleText": "配车",
"enablePullDownRefresh": false
}
}, {
"path": "orderDetail/orderDetail",
"style": {
......@@ -76,12 +61,6 @@
"navigationBarTitleText": "整单签收",
"enablePullDownRefresh": false
}
}, {
"path": "transferAddressDetail/transferAddressDetail",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "viewDriverTruck/viewDriverTruck",
"style": {
......@@ -151,7 +130,26 @@
"enablePullDownRefresh": false,
"disableScroll": true
}
}
} ,{
"path": "shipment/shipment",
"style": {
"navigationBarTitleText": "运单管理",
"enablePullDownRefresh": false
}
} ,{
"path": "orderPod/orderPod",
"style": {
"navigationBarTitleText": "回单管理",
"enablePullDownRefresh": false
}
},
{
"path": "orderBase/orderBase",
"style": {
"navigationBarTitleText": "委托单",
"enablePullDownRefresh": false
}
}
]
}],
"globalStyle": {
......@@ -167,26 +165,34 @@
}
},
"tabBar": {
"custom": true,
"color": "#999999",
"selectedColor": "#2E75E6",
"backgroundColor": "#fff",
"list": [
{
/*{
"pagePath": "pages/order/order",
"text": "订单",
"iconPath": "static/img/tabbar/order.png",
"selectedIconPath": "static/img/tabbar/order-active.png"
},{
"pagePath": "pages/index/index",
"pagePath": "pages/order/shipment",
"text": "运单",
"iconPath": "static/img/tabbar/shipment.png",
"selectedIconPath": "static/img/tabbar/shipment-active.png"
},
{
"pagePath": "pages/order_pod/order_pod",
"pagePath": "pages/order/order_pod",
"text": "回单",
"iconPath": "static/img/tabbar/receivebill.png",
"selectedIconPath": "static/img/tabbar/receivebill-active.png"
},*/
{
"pagePath": "pages/dirverMenu/dirverMenu"
},{
"pagePath": "pages/carrierMenu/carrierMenu"
},
{
"pagePath": "pages/user/user",
......
<template>
<view class="park_content">
<view class="park_header">
<image class="header-bg" src="../../static/img/bg/souye.png">
</image>
</view>
<view class="shipment_code" style=" display: flex; align-items: center;padding-top:10px;">
<span class="toutitle">运输执行</span>
</view>
<view class="park_body flex_sb flex_wrap">
<view class="park_card" v-for="(item,index) in cardList" :key="index" @click="openCard(item.path)">
<image class="image_2" referrerpolicy="no-referrer" :src="item.src" />
<view class="card_title">{{item.title}}</view>
</view>
</view>
<customTabBar tabIndex="0" />
</view>
</template>
<script>
import {} from '../../api/apiList.js'
import {
getLoginInfo
} from '../../mixins/loginBehavior'
export default {
data() {
return {
code: "",
cardList: [{
title: "委托单",
path: "/subpkg/orderBase/orderBase",
src: "../../static/img/bg/prebookOrder.png"
},{
title: "运单管理",
path: "/subpkg/shipment/shipment",
src: "../../static/img/bg/drivers.png"
},{
title:"回单管理",
path:"/subpkg/orderPod/orderPod",
src: "../../static/img/bg/shipmentOrder.png"
}
],
isAgree: false,
visible: false,
};
},
onLoad() {},
methods: {
openCard(path) {
uni.navigateTo({
url: path,
})
},
}
}
</script>
<style lang="scss">
.park_content {
.mask {
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
width: 100%;
height: 100%;
}
.model_box {
width: 80%;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1000;
background: #fff;
height: 25%;
border-radius: 15rpx;
}
.mb-content {
padding: 10rpx 20rpx 10rpx 25rpx;
box-sizing: border-box;
height: 55%;
overflow: scroll;
}
.mb-tit {
padding: 15rpx 0rpx;
box-sizing: border-box;
font-size: 34rpx;
text-align: center;
}
.mb-con {
font-size: 30rpx;
text-indent: 1rem;
line-height: 1.5;
}
.shipment_code {
line-height: 40rpx;
font-weight: bolder;
text-shadow: 1rpx 3rpx 12rpx rgba(0, 0, 0, 0.04);
}
.toutitle {
font-size: 16px;
padding-left: 10px;
font-weight: 540;
}
.park_header {
background-color: #E9EEF6;
height: 288rpx;
.header-bg {
width: 100%;
height: 100%;
}
}
.text_2 {
overflow-wrap: break-word;
color: rgba(89, 89, 89, 1);
font-size: 38rpx;
font-family: PingFangSC-Medium;
font-weight: 500;
text-align: left;
white-space: nowrap;
line-height: 44px;
margin-right: 201px;
}
.park_body {
padding: 0 21rpx;
display: flex;
.park_card {
margin-top: 25rpx;
width: 310rpx;
height: 252rpx;
background-color: #F2F3F8;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
border-radius: 8rpx;
.image_5 {
width: 199rpx;
height: 199rpx;
margin-top: -14px;
}
.card_title {
margin-top: -10rpx;
font-size: 30rpx;
font-weight: 1000;
color: #005bb5;
}
&:after {
content: "";
}
}
}
.image_2 {
width: 199rpx;
height: 199rpx;
margin-top: -14px;
}
}
</style>
<template>
<view class="park_content">
<view class="park_header">
<image class="header-bg" src="../../static/img/bg/souye.png">
</image>
</view>
<view class="shipment_code" style=" display: flex; align-items: center;padding-top:10px;">
<span class="toutitle">运输执行</span>
</view>
<view class="park_body flex_sb flex_wrap">
<view class="park_card" v-for="(item,index) in cardList" :key="index" @click="openCard(item.path)">
<image class="image_2" referrerpolicy="no-referrer" :src="item.src" />
<view class="card_title">{{item.title}}</view>
</view>
</view>
<customTabBar tabIndex="0" />
</view>
</template>
<script>
import {} from '../../api/apiList.js'
import {
getLoginInfo
} from '../../mixins/loginBehavior'
export default {
data() {
return {
code: "",
cardList: [{
title: "运单管理",
path: "/subpkg/shipment/shipment",
src: "../../static/img/bg/drivers.png"
},{
title:"回单管理",
path:"/subpkg/orderPod/orderPod",
src: "../../static/img/bg/shipmentOrder.png"
}
],
isAgree: false,
visible: false,
};
},
onLoad() {},
methods: {
openCard(path) {
uni.navigateTo({
url: path,
})
},
}
}
</script>
<style lang="scss">
.park_content {
.mask {
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
width: 100%;
height: 100%;
}
.model_box {
width: 80%;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1000;
background: #fff;
height: 25%;
border-radius: 15rpx;
}
.mb-content {
padding: 10rpx 20rpx 10rpx 25rpx;
box-sizing: border-box;
height: 55%;
overflow: scroll;
}
.mb-tit {
padding: 15rpx 0rpx;
box-sizing: border-box;
font-size: 34rpx;
text-align: center;
}
.mb-con {
font-size: 30rpx;
text-indent: 1rem;
line-height: 1.5;
}
.shipment_code {
line-height: 40rpx;
font-weight: bolder;
text-shadow: 1rpx 3rpx 12rpx rgba(0, 0, 0, 0.04);
}
.toutitle {
font-size: 16px;
padding-left: 10px;
font-weight: 540;
}
.park_header {
background-color: #E9EEF6;
height: 288rpx;
.header-bg {
width: 100%;
height: 100%;
}
}
.text_2 {
overflow-wrap: break-word;
color: rgba(89, 89, 89, 1);
font-size: 38rpx;
font-family: PingFangSC-Medium;
font-weight: 500;
text-align: left;
white-space: nowrap;
line-height: 44px;
margin-right: 201px;
}
.park_body {
padding: 0 21rpx;
display: flex;
.park_card {
margin-top: 25rpx;
width: 310rpx;
height: 252rpx;
background-color: #F2F3F8;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
border-radius: 8rpx;
.image_5 {
width: 199rpx;
height: 199rpx;
margin-top: -14px;
}
.card_title {
margin-top: -10rpx;
font-size: 30rpx;
font-weight: 1000;
color: #005bb5;
}
&:after {
content: "";
}
}
}
.image_2 {
width: 199rpx;
height: 199rpx;
margin-top: -14px;
}
}
</style>
......@@ -41,7 +41,8 @@
<script>
import { MINI, ENV_MODEL, TokenPrefix } from '../../publicConfig/config.js'
import { userLogin,userCarrierLogin, SendMessage } from '../../api/apiList.js'
import { userLogin,userCarrierLogin,
SendMessage,userMobileOperation } from '../../api/apiList.js'
const loginBehavior = require('../../mixins/loginBehavior.js')
export default {
......@@ -199,11 +200,27 @@
title: '登录成功!',
duration: 1000
})
setTimeout(() => {
/*setTimeout(() => {
uni.switchTab({
url: "/pages/order/order",
})
}, 1500)
}, 1500)*/
getApp().globalData.tabList = [{
"pagePath": "pages/carrierMenu/carrierMenu",
"text": "承运商",
"iconPath": "../../static/img/tabbar/receivebill.png",
"selectedIconPath": "../../static/img/tabbar/receivebill-active.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "../../static/img/tabbar/user.png",
"selectedIconPath": "../../static/img/tabbar/user-active.png"
}
]
uni.switchTab({
url: "/pages/carrierMenu/carrierMenu",
})
}
}).catch(err => {
uni.showToast({
......@@ -214,7 +231,9 @@
})
}else{
userLogin(loginAction, res.code, reqData).then(res => {
console.log('222=======')
console.log(res)
let token = res.data.renewedToken
if (res.header['Set-Cookie']) {
const XSRFToken = res.header['Set-Cookie'].split(';')[0].split('=')[1]
......@@ -231,11 +250,27 @@
title: '登录成功!',
duration: 1000
})
setTimeout(() => {
/*setTimeout(() => {
uni.switchTab({
url: "/pages/order/order",
})
}, 1500)
}, 1500)*/
getApp().globalData.tabList = [{
"pagePath": "pages/dirverMenu/dirverMenu",
"text": "司机",
"iconPath": "../../static/img/tabbar/receivebill.png",
"selectedIconPath": "../../static/img/tabbar/receivebill-active.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "../../static/img/tabbar/user.png",
"selectedIconPath": "../../static/img/tabbar/user-active.png"
}
]
uni.switchTab({
url: "/pages/dirverMenu/dirverMenu",
})
}
}).catch(err => {
uni.showToast({
......
......@@ -15,7 +15,7 @@
<!-- 修改密码 -->
<view class="edit-password ">
<u-cell-group :border="false">
<u-cell title-style="font-weight: bolder" rightIconStyle="font-size: 40rpx" isLink :border="false"
<!-- <u-cell title-style="font-weight: bolder" rightIconStyle="font-size: 40rpx" isLink :border="false"
title="我的司机" url="/subpkg/viewDriverTruck/viewDriverTruck?action=driver">
<view slot="icon" class="t-icon t-icon-driver" />
</u-cell>
......@@ -23,7 +23,7 @@
<u-cell title-style="font-weight: bolder" rightIconStyle="font-size: 40rpx" isLink :border="false"
title="我的车辆" url="/subpkg/viewDriverTruck/viewDriverTruck?action=truck">
<view slot="icon" class="t-icon t-icon-truck" />
</u-cell>
</u-cell> -->
<u-line color="#F0F0F0" />
<u-cell title-style="font-weight: bolder" rightIconStyle="font-size: 40rpx" isLink :border="false"
title="修改密码" :url="'/subpkg/editPwd/editPwd?userName=' + userInfo.name">
......
<template>
<view class="allotDetail content_box">
<view class="search-input flex_center">
<u-search searchIconSize="50" searchIconColor="#FFFFFF" placeholderColor='#FFFFFF' color="#FFFFFF"
:showAction="false" :placeholder="isAllotTruck ? '请输入车牌号' : '请输入司机姓名'" v-model="searchValue"
@clickIcon="onSearch" @search="onSearch" @clear="onSearch" />
</view>
<view class="select-options">
<u-empty mode="data" textSize='32' iconSize="160" text="暂无数据" v-if="!datas.length" />
<!-- 分配车辆 -->
<template v-if="isAllotTruck">
<bs-customCell v-for="item in datas" :key="item.id" :label="item['driver1.name']"
:value="item['driver1.tel']" labelCol="4" wrapCol="7"
:class="['truck-custom-cell', {'active-class': item.id === currentAllot.truckId}]" @click.native="onSelect(item)">
<view slot="label" class="custom-cell"> {{item.name}}</view>
<view slot="value" class="custom-cell"> {{item['facilityMode.name'] || ''}}
</view>
<view slot="right-icon">
<u-radio-group :value="currentAllot.truckId" placement="column" iconPlacement="right">
<u-radio :size="40" :iconSize="32" :name="item.id" @change="onSelect(item)" />
</u-radio-group>
</view>
</bs-customCell>
</template>
<!-- 分配司机 -->
<template v-else>
<bs-customCell v-for="item in datas" :key="item.id" :label="item.name" :value="item.tel || '暂无'"
labelCol="3.5" wrapCol="7.5" :class="{'active-class': item.id === currentAllot.driver1Id}"
@click.native="onSelect(item)">
<view slot="right-icon">
<u-radio-group :value="currentAllot.driver1Id" placement="column" iconPlacement="right">
<u-radio :size="40" :iconSize="32" :name="item.id" @change="onSelect(item)" />
</u-radio-group>
</view>
</bs-customCell>
</template>
</view>
<view class="operation-btn">
<button class="submitBtn common_btn" @click="onConfirm">分配{{isAllotTruck ? '车辆' : '司机'}}</button>
</view>
</view>
</template>
<script>
import { searchDriverList, searchTruckList } from '../../api/apiList'
export default {
options: { styleIsolation: 'shared' },
data() {
return {
datas: [], //候选项列表
searchValue: "", //搜索值
currentAllot: {}, //当前分配信息
isAllotTruck: false, //是否为分配车辆
pageNum: 1, //页码
pageSize: 20, //每页条数
loadMore: true, //加载更多
}
},
onLoad(options) {
const isAllotTruck = options.action === 'allotTruck' //判断是否为分配车辆
const title = isAllotTruck ? '分配车辆' : '分配司机'
this.setNavTitle(title)
this.isAllotTruck = isAllotTruck
this.initData()
},
onReachBottom() {
if (this.loadMore) {
this.initData();
this.loadMore = false
}
},
methods: {
//设置页面头部标题
setNavTitle(title) {
uni.setNavigationBarTitle({
title: title,
})
},
//初始化数据
initData() {
const { pageNum, pageSize } = this
const reqData = {
args: { pageNum, pageSize }
}
if(this.searchValue){
reqData.args.restrictions = [{
"field": 'name',
"type": "LK", //EQ精准匹配,LK模糊匹配
"value": this.searchValue
}]
}
const requestFun = this.isAllotTruck ? searchTruckList : searchDriverList
requestFun(reqData).then(res => {
const datas = res.data.data.datas
if (datas.length) {
const newData = this.datas.concat(datas)
this.datas = [...newData]
this.pageNum += 1
this.loadMore = true
}
})
},
//确认选择
onConfirm() {
const app = getApp()
const { currentAllot, isAllotTruck } = this
if (!Object.keys(currentAllot).length) {
uni.showToast({
title: `请选择分配${isAllotTruck ? '车辆' : '司机'}`,
icon: 'none',
duration: 1500
})
return
}
app.globalData.allotInfo = currentAllot
uni.navigateBack()
},
//当前选择项
onSelect(info) {
let newInfo = {}
newInfo.allotMode = this.isAllotTruck ? 'allotTruck' : 'allotDriver'
if (this.isAllotTruck) {
newInfo.truckId = info.id
newInfo.truckName = info.name
newInfo.truckMode = info['facilityMode.name']
newInfo.driver1Id = info['driver1.id']
newInfo.driverName = info['driver1.name']
newInfo.driverTel = info['driver1.tel']
} else {
newInfo.driver1Id = info.id
newInfo.driverName = info.name
newInfo.driverTel = info.tel
}
this.currentAllot = newInfo
},
// 搜索功能
onSearch() {
this.pageNum = 1
this.datas = []
this.initData()
},
}
}
</script>
<style lang="scss">
.allotDetail {
.search-input {
width: 100%;
position: fixed;
top: 0;
z-index: 999;
height: 128rpx;
background: linear-gradient(90deg, #2E75E6 0%, #5E58EE 100%);
/deep/.u-search__content {
height: 80rpx;
margin: 24rpx;
background-color: rgba(240, 240, 240, .5) !important;
.u-search__content__input {
letter-spacing: 4rpx;
background-color: transparent !important;
}
.uicon-close{
font-size: 28rpx !important;
}
}
}
/deep/.select-options {
margin: 130rpx 0 15vh;
background-color: #fff;
min-height: 600rpx;
.custom-cell-row {
border-bottom: 2rpx solid #F0F0F0;
margin-top: 0;
padding: 20rpx;
.custom-cell {
margin-bottom: 10rpx;
color: #434343;
}
}
.truck-custom-cell{
color: #8C8C8C;
}
.active-class {
color: #2E75E6;
.custom-cell {
color: #2E75E6;
}
}
}
.u-radio {
background-color: #fff;
}
.operation-btn {
position: fixed;
bottom: 0;
.submitBtn {
width: 90%;
}
}
}
</style>
<template>
<view class="allotTruck content_box">
<bs-pageHeader-orderNo :shipmentNo="shipmentNo" />
<view class="allot-detail">
<u--form>
<u-form-item required label="车牌号" labelWidth="20%">
<view @click="onNavAllotDetail('allotTruck')">
<u-input border="none" readonly placeholder="选择车辆" placeholderClass="input-tip"
v-model="truckName" />
</view>
<view slot="right" class="t-icon t-icon-rightArrow" @click="onNavAllotDetail('allotTruck')" />
</u-form-item>
<u-form-item label="车型" labelWidth="20%" v-if="truckMode">
<u-input border="none" readonly v-model="truckMode" />
</u-form-item>
<u-form-item required label="司机名" labelWidth="20%">
<view @click="onNavAllotDetail('allotDriver')">
<u-input border="none" readonly placeholder="选择司机" placeholderClass="input-tip"
v-model="driverName" />
</view>
<view slot="right" class="t-icon t-icon-rightArrow" @click="onNavAllotDetail('allotDriver')" />
</u-form-item>
<u-form-item label="手机号" labelWidth="20%" v-if="driverTel">
<u-input border="none" readonly v-model="driverTel" />
</u-form-item>
</u--form>
</view>
<view class="operation-btn">
<button class="submitBtn common_btn" @click="onConfirmAllot">确认分配</button>
</view>
</view>
</template>
<script>
import { reportInfo } from '../../api/apiList'
const app = getApp()
export default {
data() {
return {
driver1Id: "", //司机ID
truckId: '', //车辆id
driverName: "", //司机姓名
driverTel: "", //司机电话
truckName: "", //车牌
truckMode: "", //车型
shipmentNo: '', //运单号
shipmentId: '', //运单ID
}
},
onLoad(options) {
const { shipmentData } = JSON.parse(options.data)
const { shipmentNo, shipmentId } = app.globalData.shipmentInfo
this.onSetGlobalData(shipmentData)
this.shipmentNo = shipmentNo
this.shipmentId = shipmentId
},
onShow() { //自定义分配信息
const { allotMode, truckId, truckName, truckMode, driver1Id, driverName, driverTel } = app.globalData.allotInfo
if (allotMode === 'allotDefault') {
this.truckId = truckId
this.truckName = truckName
this.truckMode = truckMode
this.driver1Id = driver1Id
this.driverName = driverName
this.driverTel = driverTel
return
}
if (allotMode === 'allotDriver') { //分配司机
this.driver1Id = driver1Id
this.driverName = driverName
this.driverTel = driverTel || '暂无'
} else {
this.truckId = truckId
this.truckName = truckName
this.truckMode = truckMode || '暂无'
this.driver1Id = driver1Id
this.driverName = driverName
this.driverTel = driverTel || '暂无'
}
},
methods: {
//重置分配信息
onSetGlobalData(shipmentData) {
app.globalData.allotInfo = {
'allotMode': 'allotDefault', //分配模式
'truckId': shipmentData.header['truck.id'],
'truckName': shipmentData.header['truck.name'],
'truckMode': shipmentData.header['truck.facilityMode.name'],
'driver1Id': shipmentData.header['driver1.id'],
'driverName': shipmentData.header['driver1.name'],
'driverTel': shipmentData.header['driver1.tel'],
}
},
//确认分配
onConfirmAllot() {
const { driver1Id, truckId } = this
if (!driver1Id || !truckId) {
uni.showToast({
title: '请完善必填信息',
icon: 'error',
duration: 3000
})
return
}
const data = {
"aux": { driver1Id, truckId },
'args': {
"selectedIds": [this.shipmentId]
}
}
reportInfo('assign', data).then(res => {
if (res.data.messageType === 'success') {
uni.showToast({
title: '分配成功',
duration: 3000
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
},
//跳转分配明细
onNavAllotDetail(action) {
uni.navigateTo({
url: `/subpkg/allotDetail/allotDetail?action=${action}`,
})
},
}
}
</script>
<style lang="scss">
.allotTruck {
/deep/.allot-detail {
padding: 0 40rpx;
background-color: #ffffff;
margin: 25rpx 0;
.input-tip {
font-size: 28rpx;
color: #BFBFBF;
}
.u-form-item__body__left__content__label {
color: #8C8C8C;
font-size: 28rpx;
}
.u-form-item__body {
padding: 30rpx 0;
}
.u-icon {
margin-left: 20rpx;
}
}
.submitBtn {
width: 90%;
}
}
</style>
<template>
<view class="content_box">
<view class="search-input flex_center">
<u-search searchIconSize="50" searchIconColor="#FFFFFF" placeholderColor='#FFFFFF' color="#FFFFFF"
:showAction="false" :placeholder="placeholder" v-model="searchValue" @clickIcon="onSearch" @search="onSearch" @clear="onSearch" />
</view>
<view class="options">
<u-radio-group v-model="currentAddressId" placement="column" iconPlacement="right">
<u-radio :customStyle="{padding: '22rpx 40rpx'}" :size="40" :iconSize="32" :labelSize="32"
:labelColor="currentAddressId === item.id ? '#2E75E6' : '#262626'"
v-for="(item, index) in datas" :key="index" :label="item.name" :name="item.id"
@change="onSelect(item.id)">
</u-radio>
</u-radio-group>
</view>
<!-- 底部按钮 -->
<view class="operation-btn flex_sb">
<button class="backBtn common_btn" @click="onNavBack">返回</button>
<button class="submitBtn common_btn" @click="onConfirm">确认</button>
</view>
</view>
</template>
<script>
import { searchTransferAddress } from '../../api/apiList'
export default {
data() {
return {
datas: [], //候选项列表
placeholder: "请输入搜索地址", //默认提示
searchValue: "", //搜索值
currentAddressId: '', // 当前地址ID
pageNum: 1, //页码
pageSize: 20, //每页条数
loadMore: true, //加载更多
}
},
onLoad(options) {
const { title, id } = JSON.parse(options.data)
this.setNavTitle(title)
this.currentAddressId = id
this.initData()
},
onReachBottom() {
if (this.loadMore) {
this.initData();
this.loadMore = false
}
},
methods: {
//设置页面头部标题
setNavTitle(title) {
uni.setNavigationBarTitle({ title })
},
//初始化数据
initData() {
const { pageNum, pageSize } = this
const reqData = {
args: { pageNum, pageSize }
}
if(this.searchValue){
reqData.args.restrictions = [{
"field": 'name',
"type": "LK", //EQ精准匹配,LK模糊匹配
"value": this.searchValue
}]
}
searchTransferAddress(reqData).then(res => {
const datas = res.data.data.datas
if (datas.length) {
const newData = this.datas.concat(datas)
this.datas = [...newData]
this.pageNum += 1
this.loadMore = true
}
})
},
onSelect(id) {
this.currentAddressId = id
},
//确认选择
onConfirm() {
const app = getApp()
const { currentAddressId, datas } = this
if (!currentAddressId) {
uni.showToast({
title: `请选择地址`,
icon: 'none',
duration: 1500
})
return
}
const info = datas.find(item => item.id === currentAddressId)
app.globalData.transferAddress = info
this.onNavBack()
},
// 搜索功能
onSearch() {
this.pageNum = 1
this.datas = []
this.initData()
},
//返回上一级页面
onNavBack() {
uni.navigateBack()
},
}
}
</script>
<style lang="scss">
.content_box {
.search-input {
width: 100%;
position: fixed;
top: 0;
z-index: 999;
height: 128rpx;
background: linear-gradient(90deg, #2E75E6 0%, #5E58EE 100%);
/deep/.u-search__content {
height: 80rpx;
margin: 24rpx;
background-color: rgba(240, 240, 240, .5) !important;
.u-search__content__input {
letter-spacing: 4rpx;
background-color: transparent !important;
}
.uicon-close{
font-size: 28rpx !important;
}
}
}
.u-radio {
background-color: #fff;
.u-radio__text{
line-height: 44rpx !important;
margin-right: 24rpx;
}
}
.options {
margin: 130rpx 0 15vh;
}
.operation-btn {
position: fixed;
bottom: 0;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment