物流板块页面完善

This commit is contained in:
THK3121 2023-08-09 09:11:05 +08:00
parent 8e88c21e94
commit 84c9fee1e1
12 changed files with 2738 additions and 1139 deletions

16
api/logistics.js Normal file
View File

@ -0,0 +1,16 @@
import oahttp from "@/utils/logistics.js";
/**
* 订单列表
*/
export const getList = (data) => oahttp.get('/courierLstData', data)
// 订单详情
export const getDetil = (data) => oahttp.get('/lstDetail', data)
// 取货
export const takeGoods = (data) => oahttp.post('/takeGoods', data)
// 送达
export const doneDelivery = (data) => oahttp.post('/doneDelivery', data)
/**
* 更新商机
*/
export const informationOpportunityUpdate = (data) => oahttp.post('/information/opportunity_update', data)

View File

@ -0,0 +1,72 @@
<template>
<view class="card" @click="goDetil(goodsInfo.id)">
<u-button type="primary" class="custom-style" style="background-color: #34A853;"
v-if='goodsInfo.status==0'>待取货</u-button>
<u-button type="primary" class="custom-style" v-if='goodsInfo.status==1'>待送货</u-button>
<p>{{goodsInfo.shop_name}}</p>
<view class="address">地址:&nbsp;&nbsp;{{goodsInfo.shop_address}}</view>
<view class="date">日期:&nbsp;&nbsp;{{goodsInfo.create_time}}</view>
</view>
</template>
<script>
import {
navigateTo
} from '../../../libs/uniApi'
export default {
props: ['goodsInfo'],
data() {
return {
}
},
mounted() {
console.log(this.goodsInfo)
},
methods: {
goDetil(id) {
uni.navigateTo({
url: `/pages/logistics/deliveryDetil?id=${id}`,
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss" scoped>
.card {
width: 92vw;
height: AUTO;
background-color: #fff;
border-radius: 1vw;
position: relative;
padding: 2vh 2vw;
margin: 0 0 20rpx 0;
.custom-style {
border: 0;
width: 20vw;
position: absolute;
top: 0;
right: 0;
height: 4vh;
border-radius: 0 7px 0 7px;
}
P {
font-size: 32rpx;
font-weight: bold;
}
.address {
font-weight: bold;
margin: 15rpx 0;
}
}
</style>

View File

@ -0,0 +1,264 @@
<template>
<view class="order">
<!-- <u-notify message="成功" duration="2000" show="true"></u-notify> -->
<view v-if='goodsInfo.status !==2'>
<view class="" @click="goDetil">
<p>{{goodsInfo.shop_name}}</p>
<view class='phone'>联系方式 :{{goodsInfo.shop_phone}} </view>
<view class="content_box">
<view class="left">
<view class="">
商家地址
</view>
<view style="margin: 20rpx 0;">
订单编号
</view>
<view class="">
采购商品
</view>
</view>
<view class="right">
<view class="goods_tit">
{{goodsInfo.shop_address}}
</view>
<view style="margin: 20rpx 0;">
{{goodsInfo.order_sn}}
</view>
<view class='product' v-for="(item,index) in list" :key="index">
<text class="goods_tit">{{item.goods_name}}</text>
<text>X{{item.product_num}}{{item.goods_unit}}</text>
</view>
</view>
</view>
</view>
<view class="icon" @click='getMore' v-if="flag">
<image style="width: 70rpx;height: 70rpx;text-align: center;" src="@/static/img/logistics/more.png"
alt="">
</view>
</view>
<view v-else class='finishOrder' @click="goDetil">
<view>
<text style="color:#999">订单编号</text> <text> {{goodsInfo.order_sn}}</text>
</view>
<view class="phone">
<text style="color:#999">联系方式</text> {{goodsInfo.user_phone}}
</view>
<view style="margin: 20rpx 0;">
<text style="color:#999">收货时间</text> {{goodsInfo.xd_time||"无"}}
</view>
<view style="margin: 20rpx 0;">
<text style="color:#999">送达时间</text> {{goodsInfo.pc_time||"无"}}
</view>
<view style="margin: 20rpx 0;">
<text style="color:#999">取货时间</text> {{goodsInfo.qh_time||"无"}}
</view>
</view>
<view class="total">
共计{{goodsInfo.product_count}}件商品
</view>
<view class="cil_left">
</view>
<view class="cil_right">
</view>
<u-modal :show="showPop" @confirm="confirm" :content="popContent[goodsInfo.status]" @close="showPop=false"
:closeOnClickOverlay="true"></u-modal>
<u-button type="primary" @click="showPop = true" v-if='goodsInfo.status==0'>已取货</u-button>
<u-button type="primary" @click="showPop = true" style="background-color: #34A853;border: none;"
v-if='goodsInfo.status==1'>已送达</u-button>
<u-button type="primary" @click="goDetil" style="background-color: red;border:none"
v-if='goodsInfo.status==2'>查看详情</u-button>
</view>
</template>
<script scoped>
import {
takeGoods,
doneDelivery
} from "@/api/logistics.js"
export default {
props: ['goodsInfo'],
data() {
return {
tost: 0,
list: [],
flag: undefined,
showPop: false,
popContent: ["请确认已经收到货", "请确认已送达"]
}
},
methods: {
goDetil() {
let status = this.goodsInfo.status
uni.navigateTo({
url: `/pages/logistics/${status==0?"deliveryDetil":"logisticDetil"}?id=${this.goodsInfo.id}`
})
},
//
takeGood() {
takeGoods({
user_id: this.goodsInfo.courier_id,
logistics_id: this.goodsInfo.id
})
},
async confirm() {
await this.goodsInfo.status == 0 ? this.takeGood() : this.doneGood()
this.showPop = false
this.tost = true
this.$emit('getlist')
},
//
doneGood() {
doneDelivery({
user_id: this.goodsInfo.courier_id,
// user_id: 167,
logistics_id: this.goodsInfo.id
})
},
showMore() {
if (this.goodsInfo.products.length <= 3) {
this.list = this.goodsInfo.products
} else {
this.flag = true
for (let i = 0; i < 3; i++) {
this.list.push(this.goodsInfo.products[i])
}
}
},
getMore() {
if (this.flag) {
for (let i = 3; i < this.goodsInfo.products.length; i++) {
this.list.push(this.goodsInfo.products[i])
}
this.flag = false
}
}
},
mounted() {
this.showMore()
}
}
</script>
<style lang='scss' scoped>
.order {
position: relative;
background-color: white;
margin: 20rpx 0;
border-radius: 15rpx;
height: auto;
padding: 2vh 3vw;
box-sizing: border-box;
.custom-style {
border: 0;
width: 25vw;
position: absolute;
top: 0;
right: 0;
height: 4vh;
border-radius: 0 7px 0 7px;
}
.goods_tit {
width: 60vw;
color: red;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
white-space: nowrap;
}
p {
font-family: "PingFang SC-Medium";
font-size: 32rpx;
font-weight: bold;
}
.phone {
color: #999999;
padding: 10rpx 0;
border-bottom: 1px dashed blue;
}
.content_box {
display: flex;
justify-content: space-between;
margin: 15rpx 0;
.left {
flex: 1;
color: #999999;
}
.right {
flex: 4;
.product {
margin: 10rpx 0;
display: flex;
justify-content: space-between;
}
.icon_a {
/* transform: translateX(180deg); */
transform: rotate(90deg);
display: inline-block;
/* font-family: ; */
}
}
}
.cil_left {
width: 30rpx;
height: 30rpx;
background-color: #F5F5F5;
border-radius: 30rpx;
position: absolute;
top: 110rpx;
left: -15rpx;
}
.cil_right {
width: 30rpx;
height: 30rpx;
background-color: #F5F5F5;
border-radius: 30rpx;
position: absolute;
top: 110rpx;
right: -15rpx;
}
.total {
text-align: right;
color: #3274F9;
font-weight: bold;
font-size: 32rpx;
margin: 20rpx 0;
}
.icon {
text-align: center;
}
}
.finishOrder {
text {
display: inline-block;
margin-right: 30rpx
}
}
</style>

View File

@ -20,7 +20,8 @@
"modules": {
"Payment": {},
"Barcode": {},
"Camera" : {}
"Camera": {},
"Maps": {}
},
/* */
"distribute": {
@ -59,7 +60,13 @@
"UniversalLinks": ""
}
},
"ad" : {}
"ad": {},
"maps": {
"amap": {
"appkey_ios": "0799f37420c0784f1e6cba230a68bdb1",
"appkey_android": "0799f37420c0784f1e6cba230a68bdb1"
}
}
},
"splashscreen": {
"useOriginalMsgbox": true
@ -118,6 +125,15 @@
}
}
}
},
"sdkConfigs": {
"maps": {
"amap": {
"key": "275cd3601b1b2d6414f6c988e7911664",
"securityJsCode": "d2d7c56801819e8bdf71b8a71846f235",
"serviceHost": ""
}
}
}
},
/* */

View File

@ -80,7 +80,44 @@
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/logistics/index",
"style": {
"navigationBarTitleText": "订单列表",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#3175f9",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/logistics/logisticDetil",
"style": {
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#3175f9",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/logistics/t",
"style": {
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#3175f9",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/logistics/deliveryDetil",
"style": {
"navigationBarTitleText": "配送信息",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#3175f9",
"navigationBarTextStyle": "white"
}
}
],
"subPackages": [{
"root": "pages/views",

View File

@ -0,0 +1,352 @@
<template>
<view class="content">
<view class="map">
<map id="map" :markers='markers' :scale="scale" :enable-zoom="true" :polyline="polyline"
style="width:100%;height: 100%;" :latitude="latitude" :enable-scroll="false"
:longitude="longitude"></map>
</view>
<view class="order_info">
<u-modal :show="showPop" @confirm="confirm" content="56565撒大苏打撒旦" @close="showPop=false"
:closeOnClickOverlay="true"></u-modal>
<button @click="getDriverLine">线路规划</button>
<p class='tit'>订单号: {{goodsDetil.logistics.order_sn}}</p>
<view class="store_name">
商户名称 {{goodsDetil.logistics.shop_name}}
</view>
<view class="store_time">
{{goodsDetil.logistics.shop_address}}
</view>
<view class="tit_a">
<text>物流信息</text>
</view>
<view class="info" v-for="(item,index) in goodsDetil.record">
<view style="margin: 20rpx 0;">
{{item.content }}
</view>
<view style="margin: 20rpx 0;">
{{item.create_time }}
</view>
</view>
<view class="pro_info">
<view style="color: #999; flex:1">
商品信息
</view>
<view style="flex:4">
<view v-for="(item,index) in goodsDetil.product" class="goods_tit">
<text style="width: 60vw;">{{item.goods_name}}</text>
<text style="float: right;">X{{item.product_num}}{{item.goods_unit}}</text>
</view>
</view>
</view>
<view class="total">
共计{{goodsDetil.product_count}}件商品
</view>
<u-button type="primary" v-if='goodsDetil.logistics.status==0' @click="showPop=true"
class="custom-style">已取货</u-button>
</view>
</view>
</template>
<script>
import {
getDetil
} from "@/api/logistics.js"
import {
takeGoods
} from "@/api/logistics.js"
export default {
data() {
return {
showPop: false,
goodsDetil: undefined,
scale: 17,
latitude: 28.908854,
longitude: 105.43639400000002,
markers: [],
polyline: [],
// https://p4.itc.cn/images03/20200518/90137c12bbac485dbc5bb0fe9d8cf4bd.jpeg
// https://t9.baidu.com/it/u=414099140,1072313909&fm=193
// mark: [{
// id: 0,
// latitude: 28.908854,
// longitude: 105.43639400000002,
// iconPath: 'https://img2.baidu.com/it/u=3116155797,2219949885&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', //
// width: 40, //
// height: 40, //
// title: '', //
// alpha: 0.5, //
// callout: { //
// content: '', //
// color: '#ffffff', //
// fontSize: 14, //
// borderRadius: 15, //
// borderWidth: '10',
// bgColor: '#3274F9', //
// display: 'ALWAYS', //
// },
// },
// {
// id: 2,
// latitude: 28.908447, //
// longitude: 105.439304,
// //
// iconPath: '../../static/img/contract/company.png', //
// rotate: 0, //
// width: 20, //
// height: 30, //
// alpha: 0.5, //
// callout: { //
// content: '', //
// color: 'white', //
// fontSize: 14, //
// borderRadius: 15, //
// borderWidth: '10',
// bgColor: '#3274F9', //
// display: 'ALWAYS', //
// },
// },
// ],
// polyline: [{
// points: [{
// latitude: 28.908854,
// longitude: 105.43639400000002,
// }, {
// latitude: 28.908447, //
// longitude: 105.439304,
// }],
// color: "#0091ff",
// // dottedLine: true,
// // colorList: true,
// // dottedLine: true,
// width: 15,
// // arrowLine: true,
// // colorList: true,
// // colorList: true
// }
// ]
}
},
methods: {
confirm() {
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
takeGoods({
user_id: id,
logistics_id: this.goodsDetil.logistics.id
})
this.showPop = false
uni.navigateBack()
},
/*
地图相关
*/
// 线
getDriverLine() {
const that = this;
const key = "997c9a3d88154fa78f4d28bebc1dd84f";
//
const origin = "28.908854,105.43639400000002,";
//
this.startingPoint()
//
this.endPoint()
//
const destination = "28.908447,105.439304,";
uni.request({
// url: `https://restapi.amap.com/v3/direction/walking?key=${key}&origin=105.43639400000002,28.908854&destination=105.439304,28.908447`,
url: `https:restapi.amap.com/v4/direction/bicycling?key=${key}&origin=105.43639400000002,28.908854&destination=105.439304,28.908447`,
success: (res) => {
const data = res.data.data;
var points = [];
if (data.paths && data.paths[0] && data.paths[0].steps) {
var steps = data.paths[0].steps;
for (var i = 0; i < steps.length; i++) {
//points
var poLen = steps[i].polyline.split(";");
for (var j = 0; j < poLen.length; j++) {
points.push({
longitude: parseFloat(poLen[j].split(",")[0]),
latitude: parseFloat(poLen[j].split(",")[1]),
});
}
}
console.log(data.paths[0].steps[0].instruction)
that.runningRoute = data.paths[0].steps[0].instruction;
console.log('行驶路线-----------', that.runningRoute)
}
that.polyline = [{
points: points,
color: "#0091ff",
dottedLine: true,
width: 15,
arrowLine: true,
colorList: true,
}, ];
},
fail: function(res) {
console.log("获取路线失败", res);
},
});
},
// 线marker
startingPoint() {
let point = [{
id: 1,
width: 40,
height: 40,
latitude: 28.908854,
longitude: 105.43639400000002,
iconPath: "https://p4.itc.cn/images03/20200518/90137c12bbac485dbc5bb0fe9d8cf4bd.jpeg",
anchor: {
x: 0.5,
y: 1,
},
}, ];
this.markers = this.markers.concat(point);
},
// 线marker
endPoint() {
let point = [{
id: 2,
width: 40,
height: 40,
latitude: 28.908447, //
longitude: 105.439304,
//
iconPath: 'https://t9.baidu.com/it/u=414099140,1072313909&fm=193',
anchor: {
x: 0.5,
y: 1,
},
}, ];
this.markers = this.markers.concat(point);
},
//
},
onLoad(options) {
getDetil({
logistics_id: options.id
}).then(res => {
this.goodsDetil = res.data
console.log(this.goodsDetil)
})
},
// onShow() {
// let that = this
// // uni.getLocation({
// // type: 'wgs84',
// // success: function(res) {
// // that.mark[0].latitude = res.latitude
// // that.mark[0].longitude = res.longitude
// // console.log(that.mark[0])
// // console.log(res)
// // }
// // });
// }
}
</script>
<style lang='scss' scoped>
.map {
height: 40vh;
width: 100vw;
}
.custom-style {
width: 100%;
background-color: red;
border: none;
color: white;
height: 90rpx;
line-height: 90rpx;
}
.order_info {
height: auto;
background-color: white;
border-radius: 6vw 6vw 0 0;
transform: translateY(-5vh);
padding: 5vh 3vw;
box-sizing: border-box;
.tit {
font-weight: bold;
font-size: 35rpx
}
.tit_a {
display: flex;
justify-content: space-between;
font-weight: bold;
font-size: 35rpx
}
.total {
text-align: right;
color: #3274F9;
font-weight: bold;
font-size: 32rpx;
margin: 20rpx 0;
}
.store_name {
color: #999999;
margin: 18rpx 0;
}
.store_time {
color: #999999;
padding: 0 0 20rpx 0;
border-bottom: 1px solid #999999;
margin-bottom: 20rpx;
}
.info {
margin: 10rpx 0;
}
.pro_info {
display: flex;
justify-content: space-between;
}
}
.goods_tit {
display: flex;
justify-content: space-between;
}
.icon {
text-align: center;
font-size: 50rpx;
text {
display: block;
transform: rotate(90deg);
}
}
</style>

78
pages/logistics/index.vue Normal file
View File

@ -0,0 +1,78 @@
<template>
<view class="content">
<u-search placeholder="搜索你的订单" @search="getOrderList" :show-action='false' bg-color='white'
v-model="keywords"></u-search>
<view style="margin: 10rpx 0 0 0;">
</view>
<u-sticky bgColor="#F5F5F5">
<u-subsection :list="list" :current="curNow" @change="sectionChange"></u-subsection>
</u-sticky>
<view v-if="!orderlist.length">
<u-empty mode="data" icon="../../static/img/empty/data.png">
</u-empty>
</view>
<view v-else>
<logistiCard v-for='(item,index) in orderlist' @getlist="getOrderList" :goodsInfo="item" :key="index">
</logistiCard>
</view>
</view>
</template>
<script>
import {
getList
} from "@/api/logistics.js"
import {
informationAdd
} from "@/api/logistics.js"
import logistiCard from "@/components/logistiComptent/logistiCard/logistiCard.vue"
export default {
components: {
logistiCard
},
data() {
return {
keywords: "",
list: ['待取货', '已取货', '已送达'],
curNow: 0,
orderlist: []
}
},
methods: {
sectionChange(index) {
this.curNow = index;
this.getOrderList()
// console.log(this.curNow)
},
getOrderList() {
// console.log(9999)
// return
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
getList({
status: this.curNow,
// courier_id: id,
courier_id: id,
keywords: this.keywords
}).then(res => {
this.orderlist = res.data.data
console.log(this.orderlist)
})
}
},
onShow() {
// this.curNow = 1
this.getOrderList()
}
}
</script>
<style lang='scss'>
.content {
background-color: #F5F5F5;
padding: 1vh 2vw;
}
</style>

View File

@ -0,0 +1,299 @@
<template>
<view class="content">
<view v-if='showLoading'>
<u-loading-page :loading="showLoading"></u-loading-page>
</view>
<view v-else>
<view class="order">
<u-loading-page :loading="showLoading"></u-loading-page>
<p>订单号:{{goodsDetil.logistics.order_sn}}</p>
<view class='phone'>收货时间 : &nbsp;{{goodsDetil.record[0].create_time}} </view>
<!-- 已送达 -->
<view class="left" v-if="goodsDetil.logistics.status>=2">
<view class="list">
<text>
收货时间
</text>
<view>
{{goodsDetil.record[0].create_time}}
</view>
</view>
<view class="list">
<text>
收获详情
</text>
<view>
<view>
{{goodsDetil.logistics.user_address}}
</view>
<view>
{{goodsDetil.logistics.user_name||"顾客电话"}}
</view>
<view>
{{goodsDetil.record[0].create_time}}
</view>
</view>
</view>
<view class="list">
<text>
取货详情
</text>
<view>
<view>
{{goodsDetil.logistics.shop_address||"商家地址"}}
</view>
<view>
{{goodsDetil.logistics.shop_phone||"商家电话"}}
</view>
<view>
{{goodsDetil.record[1].create_time}}
</view>
</view>
</view>
<view class="list">
<text>
订单详情
</text>
<view>
<view v-for="(item,index) in goodsDetil.record" :key="item.create_time">
<view>
{{item.content}}
</view>
<view>
{{item.create_time}}
</view>
</view>
</view>
</view>
<view class="pro_list">
<text style="color: #999;width: 15vw;">
商品信息
</text>
<view>
<view class="goods_tit" v-for="(item,index) in goodsDetil.product">
<text style="width: 60vw;margin: 0;padding: 0;">{{item.goods_name}}</text>
<text>X{{item.product_num}}{{item.goods_unit}}</text>
</view>
</view>
</view>
</view>
<!-- 已取货 -->
<view class="left" v-else>
<view class="list">
<text>
用户名称
</text>
<view>
{{goodsDetil.logistics.user_name}}
</view>
</view>
<view class="list" style="margin: 10rpx 0;">
<text style="width: 16vw;">
收货地址
</text>
<view>
<view>
{{goodsDetil.logistics.user_address}}
</view>
</view>
</view>
<view class="list">
<text>
物流信息
</text>
<view>
<view v-for="(item,index) in goodsDetil.record">
{{item.content}}
<view>
{{item.create_time}}
</view>
</view>
</view>
</view>
<view class="pro_list">
<text style="color: #999;width: 15vw;">
商品信息
</text>
<view>
<view class="goods_tit" v-for="(item,index) in goodsDetil.product">
<text style="width: 60vw;margin: 0;padding: 0;">{{item.goods_name}}</text>
<text>X{{item.product_num}}{{item.goods_unit}}</text>
</view>
</view>
</view>
</view>
<view class="total">
<text>共计{{goodsDetil.product_count}}件商品 </text>
</view>
<u-button v-if='goodsDetil.logistics.status==1' @click="showPop=true" type="primary"
style="background-color: #34A853;border: none;">已送达</u-button>
</view>
<view class="cil_left">
</view>
<view class="cil_right">
</view>
<u-modal :show="showPop" @confirm="confirm" content="56565撒大苏打撒旦" @close="showPop=false"
:closeOnClickOverlay="true"></u-modal>
</view>
</view>
</view>
</template>
<script>
import {
doneDelivery
} from "@/api/logistics.js"
import {
getDetil
} from "@/api/logistics.js"
export default {
data() {
return {
showPop: false,
showLoading: true,
goodsDetil: undefined,
flag: 0,
}
},
methods: {
confirm() {
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
doneDelivery({
user_id: id,
// user_id: id,
logistics_id: this.goodsDetil.logistics.id
})
this.showPop = false
uni.navigateBack()
},
},
onLoad(options) {
// console.log(options.id)
getDetil({
logistics_id: options.id
}).then(res => {
this.showLoading = false
this.goodsDetil = res.data
console.log(this.goodsDetil)
})
},
}
</script>
<style lang='scss' scoped>
.content {
background-color: #F5F5F5;
padding: 2vh 2vw;
}
.order {
position: relative;
background-color: white;
margin: 20rpx 0;
border-radius: 15rpx;
height: auto;
padding: 2vh 3vw;
box-sizing: border-box;
p {
font-family: "PingFang SC-Medium";
font-size: 32rpx;
font-weight: bold;
}
.phone {
color: #999999;
padding: 10rpx 0;
border-bottom: 1px dashed blue;
font-size: 20rpx;
}
.left {
.list {
display: flex;
view {
flex: 8;
view {
margin-bottom: 10rpx;
}
}
text {
flex: 2;
}
/* view {
view {
margin-bottom: 10rpx;
}
}
text {
margin-right: 20rpx;
width: 30vw;
color: #999;
} */
}
}
.pro_list {
display: flex;
text {
margin-right: 20rpx;
}
}
.total {
/* font-family: "宋体"; */
margin: 20rpx 0;
color: #3274F9;
font-weight: bold;
font-size: 32rpx;
text-align: right;
}
.cil_left {
width: 30rpx;
height: 30rpx;
background-color: #F5F5F5;
border-radius: 30rpx;
position: absolute;
top: 110rpx;
left: -15rpx;
}
.cil_right {
width: 30rpx;
height: 30rpx;
background-color: #F5F5F5;
border-radius: 30rpx;
position: absolute;
top: 110rpx;
right: -15rpx;
}
.goods_tit {
display: flex;
justify-content: space-between;
}
}
</style>

311
pages/logistics/t.vue Normal file
View File

@ -0,0 +1,311 @@
<template>
<view class="content">
<view class="map">
<map id="map" :markers='markers' :scale="scale" :enable-zoom="true" :polyline="polyline"
style="width:100%;height: 100%;" :latitude="latitude" :enable-scroll="false"
:longitude="longitude"></map>
</view>
<button @click="getDriverLine">叫我按钮</button>
</view>
</template>
<script>
import {
getDetil
} from "@/api/logistics.js"
import {
takeGoods
} from "@/api/logistics.js"
export default {
data() {
return {
showPop: false,
goodsDetil: undefined,
scale: 17,
latitude: 28.908854,
longitude: 105.43639400000002,
markers: [],
polyline: [],
// https://p4.itc.cn/images03/20200518/90137c12bbac485dbc5bb0fe9d8cf4bd.jpeg
// https://t9.baidu.com/it/u=414099140,1072313909&fm=193
// mark: [{
// id: 0,
// latitude: 28.908854,
// longitude: 105.43639400000002,
// iconPath: 'https://img2.baidu.com/it/u=3116155797,2219949885&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500', //
// width: 40, //
// height: 40, //
// title: '', //
// alpha: 0.5, //
// callout: { //
// content: '', //
// color: '#ffffff', //
// fontSize: 14, //
// borderRadius: 15, //
// borderWidth: '10',
// bgColor: '#3274F9', //
// display: 'ALWAYS', //
// },
// },
// {
// id: 2,
// latitude: 28.908447, //
// longitude: 105.439304,
// //
// iconPath: '../../static/img/contract/company.png', //
// rotate: 0, //
// width: 20, //
// height: 30, //
// alpha: 0.5, //
// callout: { //
// content: '', //
// color: 'white', //
// fontSize: 14, //
// borderRadius: 15, //
// borderWidth: '10',
// bgColor: '#3274F9', //
// display: 'ALWAYS', //
// },
// },
// ],
// polyline: [{
// points: [{
// latitude: 28.908854,
// longitude: 105.43639400000002,
// }, {
// latitude: 28.908447, //
// longitude: 105.439304,
// }],
// color: "#0091ff",
// // dottedLine: true,
// // colorList: true,
// // dottedLine: true,
// width: 15,
// // arrowLine: true,
// // colorList: true,
// // colorList: true
// }
// ]
}
},
methods: {
confirm() {
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
takeGoods({
user_id: id,
logistics_id: this.goodsDetil.logistics.id
})
this.showPop = false
},
/*
地图相关
*/
// 线
getDriverLine() {
const that = this;
const key = "997c9a3d88154fa78f4d28bebc1dd84f";
//
const origin = "105.43639400000002,28.908854";
//
this.startingPoint()
//
this.endPoint()
//
const destination = "105.439304,28.908447";
uni.request({
// url: `https://restapi.amap.com/v3/direction/walking?key=${key}&origin=105.43639400000002,28.908854&destination=105.439304,28.908447`,
url: `https:restapi.amap.com/v4/direction/bicycling?key=${key}&origin=${origin}&destination=${destination}`,
success: (res) => {
const data = res.data.data;
var points = [];
if (data.paths && data.paths[0] && data.paths[0].steps) {
var steps = data.paths[0].steps;
for (var i = 0; i < steps.length; i++) {
//points
var poLen = steps[i].polyline.split(";");
for (var j = 0; j < poLen.length; j++) {
points.push({
longitude: parseFloat(poLen[j].split(",")[0]),
latitude: parseFloat(poLen[j].split(",")[1]),
});
}
}
console.log(data.paths[0].steps[0].instruction)
that.runningRoute = data.paths[0].steps[0].instruction;
console.log('行驶路线-----------', that.runningRoute)
}
that.polyline = [{
points: points,
color: "#0091ff",
dottedLine: true,
width: 15,
arrowLine: true,
colorList: true,
}, ];
},
fail: function(res) {
console.log("获取路线失败", res);
},
});
},
// 线marker
startingPoint() {
let point = [{
id: 1,
width: 40,
height: 40,
latitude: 28.908854,
longitude: 105.43639400000002,
iconPath: "https://p4.itc.cn/images03/20200518/90137c12bbac485dbc5bb0fe9d8cf4bd.jpeg",
anchor: {
x: 0.5,
y: 1,
},
}, ];
this.markers = this.markers.concat(point);
},
// 线marker
endPoint() {
let point = [{
id: 2,
width: 40,
height: 40,
latitude: 28.908447, //
longitude: 105.439304,
//
iconPath: 'https://t9.baidu.com/it/u=414099140,1072313909&fm=193',
anchor: {
x: 0.5,
y: 1,
},
}, ];
this.markers = this.markers.concat(point);
},
//
},
onLoad(options) {
// getDetil({
// logistics_id: options.id
// }).then(res => {
// this.goodsDetil = res.data
// console.log(this.goodsDetil)
// })
},
// onShow() {
// let that = this
// // uni.getLocation({
// // type: 'wgs84',
// // success: function(res) {
// // that.mark[0].latitude = res.latitude
// // that.mark[0].longitude = res.longitude
// // console.log(that.mark[0])
// // console.log(res)
// // }
// // });
// }
}
</script>
<style lang='scss' scoped>
.map {
height: 40vh;
width: 100vw;
}
.custom-style {
width: 100%;
background-color: red;
border: none;
color: white;
height: 90rpx;
line-height: 90rpx;
}
.order_info {
height: auto;
background-color: white;
border-radius: 6vw 6vw 0 0;
transform: translateY(-5vh);
padding: 5vh 3vw;
box-sizing: border-box;
.tit {
font-weight: bold;
font-size: 35rpx
}
.tit_a {
display: flex;
justify-content: space-between;
font-weight: bold;
font-size: 35rpx
}
.total {
text-align: right;
color: #3274F9;
font-weight: bold;
font-size: 32rpx;
margin: 20rpx 0;
}
.store_name {
color: #999999;
margin: 18rpx 0;
}
.store_time {
color: #999999;
padding: 0 0 20rpx 0;
border-bottom: 1px solid #999999;
margin-bottom: 20rpx;
}
.info {
margin: 10rpx 0;
}
.pro_info {
display: flex;
justify-content: space-between;
}
}
.goods_tit {
display: flex;
justify-content: space-between;
}
.icon {
text-align: center;
font-size: 50rpx;
text {
display: block;
transform: rotate(90deg);
}
}
</style>

View File

@ -9,8 +9,8 @@
<!-- #endif -->
<view class="my_info flex_a_c">
<view class="">
<u--image :showLoading="true" :src="myOaInfo.avatar||'../../static/img/public/avatar.png'" width="130.28rpx"
height="130.28rpx" shape="circle"></u--image>
<u--image :showLoading="true" :src="myOaInfo.avatar||'../../static/img/public/avatar.png'"
width="130.28rpx" height="130.28rpx" shape="circle"></u--image>
</view>
<view v-if="!$store.state.app.token" @click="login" class="mesg_box">
<view class="name">
@ -49,7 +49,8 @@
<view class="backlog" :class="!ApproveList.length>0?'backlog_no_data':''">
<view class="head_title flex_a_c_j_sb">
<view class="title">公告列表</view>
<view class="flex_a_c" @click="navTo('/subpkg/noticeList/noticeList')">更多 <view class="iconfont icon-you">
<view class="flex_a_c" @click="navTo('/subpkg/noticeList/noticeList')">更多 <view
class="iconfont icon-you">
<uni-icons type="forward"></uni-icons>
</view>
</view>
@ -80,15 +81,21 @@
<view class="my_task">
<view class="task_title flex_a_c_j_sb">
<view class="title">配送信息</view>
<view class="flex_a_c" @click="navTo('')">更多 <view class="iconfont icon-you">
<view class="flex_a_c" @click='goOrderList'>更多 <view class="iconfont icon-you">
<uni-icons type="forward"></uni-icons>
</view>
</view>
</view>
<block v-if="myTaskList.length>0">
<!-- <block v-if="myTaskList.length>0">
<taskCard></taskCard>
</block>
</block> -->
<view v-if="orderList.length>0">
<logistiBriefCard v-for="(item,index) in orderList" :key="index" :goodsInfo='item'>
</logistiBriefCard>
</view>
<view v-else class="no_task">
<view class="title">暂无配送信息</view>
<view class="tips" v-if="!$store.state.app.token">登录后查看配送信息详情</view>
@ -130,17 +137,33 @@
</template>
<script>
import { Toast } from '@/libs/uniApi.js'
import { oaHomeData } from '@/static/server/server.js'
import { noticeList } from "@/api/notice.js"
import {
getList
} from "@/api/logistics.js"
import {
Toast
} from '@/libs/uniApi.js'
import {
oaHomeData
} from '@/static/server/server.js'
import {
noticeList
} from "@/api/notice.js"
// import tabbar from '../components/tabbar'
import { getIndexListAPI, getTaskListAPI, getMyTaskListAPI, getApproveListAPI, getUserIndexAPI } from '@/api/oaApi.js'
import {
getIndexListAPI,
getTaskListAPI,
getMyTaskListAPI,
getApproveListAPI,
getUserIndexAPI
} from '@/api/oaApi.js'
export default {
components: {
// tabbar
},
data() {
return {
orderList: [],
oaHomeData: [],
src: 'https://cdn.uviewui.com/uview/album/1.jpg',
assessData: [{
@ -205,8 +228,24 @@
// }
// })
// },
async getOrderList() {
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
console.log(id)
let res = await getList({
courier_id: id
// courier_id: 167
})
this.orderList = res.data.data
},
goOrderList() {
uni.navigateTo({
url: "/pages/logistics/index"
})
},
initUserInfo() {
this.$store.state.app.userInfo ? this.myOaInfo = this.$store.state.app.userInfo : this.myOaInfo.avatar = '';
this.$store.state.app.userInfo ? this.myOaInfo = this.$store.state.app.userInfo : this.myOaInfo.avatar =
'';
},
initOaHomeDada() {
if (this.$store.state.app.userInfo.admin_id == 0) { //
@ -233,7 +272,10 @@
this.ApproveList = res.data.lists
},
async getIndexList() {
const { project, task } = await getIndexListAPI()
const {
project,
task
} = await getIndexListAPI()
console.log(task, '222');
this.assessData[0].num = project.count
this.assessData[1].num = project.count_ok

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

112
utils/logistics.js Normal file
View File

@ -0,0 +1,112 @@
import {
HTTP_REQUEST_URL_THREE,
HEADER,
TOKENNAME,
} from '@/config/app';
import {
Toast
} from '../libs/uniApi';
// import { checkLogin } from '../libs/login';
import store from '../store';
function toLogin() {
uni.showToast({
title: '请先登录',
icon: 'none',
duration: 1000
});
}
function baseRequestTwo(url, method, data, {
noAuth = false,
noVerify = false
}) {
let Url = "http://logistics.lihaink.cn",
header = HEADER;
if (!noAuth) {
// 已经未登录了,禁止请求
if (!store.state.config.request) return Promise.reject({
msg: '未登录'
});
//登录过期自动登录
if (!store.state.app.token) {
toLogin();
store.commit("SET_REQUEST", false);
return Promise.reject({
msg: '未登录'
});
}
}
// if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
// header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv';
return new Promise((reslove, reject) => {
// uni.showLoading({
// title: '加载中'
// })
uni.request({
// url: Url + '/api/v1' + url,
url: Url + '/api' + url,
method: method || 'GET',
header: header,
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
// uni.hideLoading()
if (noVerify)
// reslove(res.data, res);
reslove(res.data);
else if (res.data.code == -1) {
store.commit("LOGOUT");
store.commit("SET_REQUEST", false);
reject(res.data);
} else if (res.data.code == 0) {
// uni.hideLoading();
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none'
})
reject(res.data);
} else if (res.data.code == 1) {
store.commit("SET_REQUEST");
reslove(res.data);
} else if (res.data.code == 200) {
store.commit("SET_REQUEST");
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
toLogin();
reject(res.data);
} else if (res.data.code == 501) {
// uni.reLaunch({
// url: '/pages/error/index'
// })
reject(res.data);
} else {
// uni.hideLoading();
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none'
})
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
// uni.hideLoading()
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
}
const oahttp = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
oahttp[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {})
});
export default oahttp;