物流页面更新

This commit is contained in:
THK3121 2023-08-09 17:26:01 +08:00
parent a9f905f609
commit 4d299879b2
8 changed files with 516 additions and 431 deletions

View File

@ -1,11 +1,20 @@
<template> <template>
<view class="card" @click="goDetil(goodsInfo.id)"> <view class="card" @click="goDetil(goodsInfo.id)">
<u-button type="primary" class="custom-style" style="background-color: #34A853;" <u-button type="primary" class="custom-style" style="background-color: #34A853;"
v-if='goodsInfo.status==0'>待取货</u-button> v-if='goodsInfo.status==0'>待取货</u-button>
<u-button type="primary" class="custom-style" v-if='goodsInfo.status==1'>待送货</u-button> <u-button type="primary" class="custom-style" v-if='goodsInfo.status==1'>待送货</u-button>
<p>{{goodsInfo.shop_name}}</p> <view v-if="goodsInfo.status==0">
<view class="address">地址:&nbsp;&nbsp;{{goodsInfo.shop_address}}</view> <p>{{goodsInfo.shop_name}}</p>
<view class="date">日期:&nbsp;&nbsp;{{goodsInfo.create_time}}</view> <view class="address">地址:&nbsp;&nbsp;{{goodsInfo.shop_address}}</view>
<view class="date">日期:&nbsp;&nbsp;{{goodsInfo.create_time}}</view>
</view>
<view v-if="goodsInfo.status==1">
<p>{{goodsInfo.user_name}}</p>
<view class="address">地址:&nbsp;&nbsp;{{goodsInfo.user_address}}</view>
<!-- <view class="date">日期:&nbsp;&nbsp;{{goodsInfo.create_time}}</view> -->
</view>
</view> </view>
</template> </template>
<script> <script>
@ -20,13 +29,16 @@
} }
}, },
mounted() { mounted() {
console.log(this.goodsInfo) // console.log(this.goodsInfo)
// console.log(6666)
}, },
methods: { methods: {
goDetil(id) { goDetil(id) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/logistics/deliveryDetil?id=${id}`, // url: `/pages/logistics/deliveryDetil?id=${id}`,
// deliveryDetil
url: `/pages/logistics/${this.goodsInfo.status==1?"logisticDetil":"deliveryDetil"}?id=${id}`,
}) })
} }

View File

@ -1,16 +1,22 @@
<template> <template>
<view class="order"> <view class="order">
<!-- <u-notify message="成功" duration="2000" show="true"></u-notify> --> <!-- <u-notify message="成功" duration="2000" show="true"></u-notify> -->
<view v-if='goodsInfo.status !==2'> <view v-if='goodsInfo.status !==2'>
<view class="" @click="goDetil"> <view class="" @click="goDetil">
<p>{{goodsInfo.shop_name}}</p> <p v-if="goodsInfo.status==0">{{goodsInfo.shop_name}}</p>
<view class='phone'>联系方式 :{{goodsInfo.shop_phone}} </view> <p v-else>{{goodsInfo.user_name}}</p>
<view class='phone' v-if="goodsInfo.status==0">联系方式 :{{goodsInfo.shop_phone}} </view>
<view class='phone' v-else>联系方式 :{{goodsInfo.user_phone}} </view>
<view class="content_box"> <view class="content_box">
<view class="left"> <view class="left">
<view class=""> <view v-if="goodsInfo.status==0">
商家地址 商家地址
</view> </view>
<view v-if="goodsInfo.status==1">
用户地址
</view>
<view style="margin: 20rpx 0;"> <view style="margin: 20rpx 0;">
订单编号 订单编号
</view> </view>
@ -19,23 +25,26 @@
</view> </view>
</view> </view>
<view class="right"> <view class="right">
<view class="goods_tit"> <view class="goods_tit" v-if="goodsInfo.status==0">
{{goodsInfo.shop_address}} {{goodsInfo.shop_address}}
</view> </view>
<view class="goods_tit" v-else>
{{goodsInfo.user_address}}
</view>
<view style="margin: 20rpx 0;"> <view style="margin: 20rpx 0;">
{{goodsInfo.order_sn}} {{goodsInfo.order_sn}}
</view> </view>
<view class='product' v-for="(item,index) in list" :key="index"> <view class='product' v-for="(item,index) in goodsInfo.products" :key="index">
<text class="goods_tit">{{item.goods_name}}</text> <text class="goods_tit">{{item.goods_name}}</text>
<text>X{{item.product_num}}{{item.goods_unit}}</text> <text>X{{item.product_num}}{{item.goods_unit}}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="icon" @click='getMore' v-if="flag"> <!-- <view class="icon" @click='getMore' v-if="flag">
<image style="width: 70rpx;height: 70rpx;text-align: center;" src="@/static/img/logistics/more.png" <image style="width: 70rpx;height: 70rpx;text-align: center;" src="@/static/img/logistics/more.png"
alt=""> alt="">
</view> </view> -->
</view> </view>
<view v-else class='finishOrder' @click="goDetil"> <view v-else class='finishOrder' @click="goDetil">
@ -46,13 +55,13 @@
<text style="color:#999">联系方式</text> {{goodsInfo.user_phone}} <text style="color:#999">联系方式</text> {{goodsInfo.user_phone}}
</view> </view>
<view style="margin: 20rpx 0;"> <view style="margin: 20rpx 0;">
<text style="color:#999">收货时间</text> {{goodsInfo.xd_time||""}} <text style="color:#999">收货时间</text> {{goodsInfo.xd_time||"暂未收货"}}
</view> </view>
<view style="margin: 20rpx 0;"> <view style="margin: 20rpx 0;">
<text style="color:#999">送达时间</text> {{goodsInfo.pc_time||""}} <text style="color:#999">送达时间</text> {{goodsInfo.pc_time||"暂未送达"}}
</view> </view>
<view style="margin: 20rpx 0;"> <view style="margin: 20rpx 0;">
<text style="color:#999">取货时间</text> {{goodsInfo.qh_time||""}} <text style="color:#999">取货时间</text> {{goodsInfo.qh_time||"暂未取货"}}
</view> </view>
</view> </view>
@ -84,7 +93,7 @@
props: ['goodsInfo'], props: ['goodsInfo'],
data() { data() {
return { return {
tost: 0,
list: [], list: [],
flag: undefined, flag: undefined,
showPop: false, showPop: false,
@ -98,20 +107,28 @@
url: `/pages/logistics/${status==0?"deliveryDetil":"logisticDetil"}?id=${this.goodsInfo.id}` url: `/pages/logistics/${status==0?"deliveryDetil":"logisticDetil"}?id=${this.goodsInfo.id}`
}) })
}, },
//
test() {
this.showMore()
this.getMore()
},
// {}
takeGood() { takeGood() {
takeGoods({ takeGoods({
user_id: this.goodsInfo.courier_id, user_id: this.goodsInfo.courier_id,
logistics_id: this.goodsInfo.id logistics_id: this.goodsInfo.id
}).then(res => {
this.$emit('showTost')
this.$emit('getlist')
}) })
}, },
async confirm() { async confirm() {
await this.goodsInfo.status == 0 ? this.takeGood() : this.doneGood() await this.goodsInfo.status == 0 ? this.takeGood() : this.doneGood()
this.showPop = false this.showPop = false
this.tost = true this.showMore()
this.$emit('getlist')
}, },
// //
doneGood() { doneGood() {
@ -119,6 +136,9 @@
user_id: this.goodsInfo.courier_id, user_id: this.goodsInfo.courier_id,
// user_id: 167, // user_id: 167,
logistics_id: this.goodsInfo.id logistics_id: this.goodsInfo.id
}).then(res => {
this.$emit('showTost')
this.$emit('getlist')
}) })
}, },
showMore() { showMore() {
@ -142,7 +162,10 @@
}, },
mounted() { mounted() {
this.showMore() // this.showMore()
console.log(this.goodsInfo)
// console.log(this.goodsInfo)
// conso
} }
} }
@ -170,7 +193,7 @@
.goods_tit { .goods_tit {
width: 60vw; width: 60vw;
color: red;
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
word-break: break-all; word-break: break-all;

View File

@ -1,160 +1,160 @@
{ {
"name": "供销综合平台", "name" : "供销综合平台",
"appid": "__UNI__B5B1EDD", "appid" : "__UNI__B5B1EDD",
"description": "", "description" : "",
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": "100", "versionCode" : "100",
"transformPx": false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus" : {
"usingComponents": true, "usingComponents" : true,
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
/* */ /* */
"modules": { "modules" : {
"Payment": {}, "Payment" : {},
"Barcode": {}, "Barcode" : {},
"Camera": {}, "Camera" : {},
"Maps": {} "Maps" : {}
}, },
/* */ /* */
"distribute": { "distribute" : {
/* android */ /* android */
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
] ]
}, },
/* ios */ /* ios */
"ios": { "ios" : {
"dSYMs": false "dSYMs" : false
}, },
/* SDK */ /* SDK */
"sdkConfigs": { "sdkConfigs" : {
"payment": { "payment" : {
"weixin": { "weixin" : {
"__platform__": ["ios", "android"], "__platform__" : [ "ios", "android" ],
"appid": "wx4789d9f1b50390ba", "appid" : "wx4789d9f1b50390ba",
"UniversalLinks": "" "UniversalLinks" : ""
} }
}, },
"ad": {}, "ad" : {},
"maps": { "maps" : {
"amap": { "amap" : {
"appkey_ios": "0799f37420c0784f1e6cba230a68bdb1", "appkey_ios" : "0799f37420c0784f1e6cba230a68bdb1",
"appkey_android": "0799f37420c0784f1e6cba230a68bdb1" "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
} }
} }
}, },
"splashscreen": { "splashscreen" : {
"useOriginalMsgbox": true "useOriginalMsgbox" : true
}, },
"icons": { "icons" : {
"android": { "android" : {
"hdpi": "unpackage/res/icons/72x72.png", "hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png", "xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png", "xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png" "xxxhdpi" : "unpackage/res/icons/192x192.png"
}, },
"ios": { "ios" : {
"appstore": "unpackage/res/icons/1024x1024.png", "appstore" : "unpackage/res/icons/1024x1024.png",
"ipad": { "ipad" : {
"app": "unpackage/res/icons/76x76.png", "app" : "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png", "app@2x" : "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png", "notification" : "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png", "proapp@2x" : "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png", "settings" : "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png", "spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png" "spotlight@2x" : "unpackage/res/icons/80x80.png"
}, },
"iphone": { "iphone" : {
"app@2x": "unpackage/res/icons/120x120.png", "app@2x" : "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png", "app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png", "notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png", "notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png", "settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png", "settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png", "spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png" "spotlight@3x" : "unpackage/res/icons/120x120.png"
} }
} }
} }
} }
}, },
/* */ /* */
"quickapp": {}, "quickapp" : {},
"h5": { "h5" : {
"devServer": { "devServer" : {
"proxy": { "proxy" : {
"baseUrlTest/adminapi": { "baseUrlTest/adminapi" : {
"target": "https://worker-task.lihaink.cn", "target" : "https://worker-task.lihaink.cn",
"changeOrigin": true, "changeOrigin" : true,
"pathRewrite": { "pathRewrite" : {
"^/baseUrlTest/adminapi": "/adminapi" "^/baseUrlTest/adminapi" : "/adminapi"
} }
}, },
"baseUrlTest/api": { "baseUrlTest/api" : {
"target": "https://worker-task.lihaink.cn", "target" : "https://worker-task.lihaink.cn",
"changeOrigin": true, "changeOrigin" : true,
"pathRewrite": { "pathRewrite" : {
"^/baseUrlTest/api": "/api" "^/baseUrlTest/api" : "/api"
} }
} }
} }
}, },
"sdkConfigs": { "sdkConfigs" : {
"maps": { "maps" : {
"amap": { "amap" : {
"key": "275cd3601b1b2d6414f6c988e7911664", "key" : "275cd3601b1b2d6414f6c988e7911664",
"securityJsCode": "d2d7c56801819e8bdf71b8a71846f235", "securityJsCode" : "d2d7c56801819e8bdf71b8a71846f235",
"serviceHost": "" "serviceHost" : ""
} }
} }
} }
}, },
/* */ /* */
"mp-weixin": { "mp-weixin" : {
"appid": "wx6e14cb98394e36bc", "appid" : "wx6e14cb98394e36bc",
"setting": { "setting" : {
"urlCheck": false "urlCheck" : false
}, },
"usingComponents": true "usingComponents" : true
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"vueVersion": "2" "vueVersion" : "2"
} }

View File

@ -1,5 +1,6 @@
<template> <template>
<view class="content"> <view class="content">
<u-toast ref="uToast"></u-toast>
<view class="map"> <view class="map">
<map id="map" :markers='markers' :scale="scale" :enable-zoom="true" :polyline="polyline" <map id="map" :markers='markers' :scale="scale" :enable-zoom="true" :polyline="polyline"
style="width:100%;height: 100%;" :latitude="latitude" :enable-scroll="false" :longitude="longitude"> style="width:100%;height: 100%;" :latitude="latitude" :enable-scroll="false" :longitude="longitude">
@ -44,7 +45,7 @@
<view class="total"> <view class="total">
共计{{goodsDetil.product_count}}件商品 共计{{goodsDetil.product_count}}件商品
</view> </view>
<u-button type="primary" v-if='goodsDetil.logistics.status==0' @click="showPop=true" <u-button type="primary" v-if='goodsDetil.logistics.status==0' @click="confirm"
class="custom-style">已取货</u-button> class="custom-style">已取货</u-button>
</view> </view>
</view> </view>
@ -145,9 +146,22 @@
takeGoods({ takeGoods({
user_id: id, user_id: id,
logistics_id: this.goodsDetil.logistics.id logistics_id: this.goodsDetil.logistics.id
}).then(res => {
this.showToast()
setTimeout(() => {
uni.navigateBack()
}, 2000)
}) })
this.showPop = false this.showPop = false
uni.navigateBack()
},
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
}, },
/* /*
地图相关 地图相关
@ -273,7 +287,7 @@
.custom-style { .custom-style {
width: 100%; width: 100%;
background-color: red; background-color: #3C9CFF;
border: none; border: none;
color: white; color: white;
height: 90rpx; height: 90rpx;

View File

@ -12,9 +12,11 @@
</u-empty> </u-empty>
</view> </view>
<view v-else> <view v-else>
<logistiCard v-for='(item,index) in orderlist' @getlist="getOrderList" :goodsInfo="item" :key="index"> <logistiCard :ref="'logistiCard'+index" v-for='(item,index) in orderlist' @getlist="getOrderList"
@showTost='showToast' :goodsInfo="item" :key="index">
</logistiCard> </logistiCard>
</view> </view>
<u-toast ref="uToast"></u-toast>
</view> </view>
</template> </template>
@ -42,27 +44,37 @@
sectionChange(index) { sectionChange(index) {
this.curNow = index; this.curNow = index;
this.getOrderList() this.getOrderList()
// console.log(this.curNow)
}, },
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
},
getOrderList() { getOrderList() {
// console.log(9999) console.log("列表更新")
// return
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
getList({ getList({
status: this.curNow, status: this.curNow,
// courier_id: id, // courier_id: 167,
courier_id: id, courier_id: id,
keywords: this.keywords keywords: this.keywords
}).then(res => { }).then(res => {
this.orderlist = []
this.orderlist = res.data.data this.orderlist = res.data.data
console.log(this.orderlist) for (let i = 0; i < this.orderlist.length; i++) {
// this.logistiCard
}
}) })
} }
}, },
onShow() { onShow() {
// this.curNow = 1
this.getOrderList() this.getOrderList()
} }

View File

@ -138,8 +138,9 @@
</view> </view>
<view class="cil_right"> <view class="cil_right">
</view> </view>
<u-modal :show="showPop" @confirm="confirm" content="56565撒大苏打撒旦" @close="showPop=false" <u-modal :show="showPop" @confirm="confirm" content="请确认货物已送达" @close="showPop=false"
:closeOnClickOverlay="true"></u-modal> :closeOnClickOverlay="true"></u-modal>
<u-toast ref="uToast"></u-toast>
</view> </view>
</view> </view>
@ -172,9 +173,22 @@
user_id: id, user_id: id,
// user_id: id, // user_id: id,
logistics_id: this.goodsDetil.logistics.id logistics_id: this.goodsDetil.logistics.id
}).then(res => {
this.showToast()
setTimeout(() => {
uni.navigateBack()
}, 2000)
}) })
this.showPop = false this.showPop = false
uni.navigateBack()
},
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
}, },
}, },
onLoad(options) { onLoad(options) {

View File

@ -137,6 +137,7 @@
</template> </template>
<script> <script>
import logistiBriefCard from "@/components/logistiComptent/logistiCard/logistiBriefCard.vue"
import { import {
getList getList
} from "@/api/logistics.js" } from "@/api/logistics.js"
@ -160,6 +161,7 @@
export default { export default {
components: { components: {
// tabbar // tabbar
logistiBriefCard
}, },
data() { data() {
return { return {
@ -213,6 +215,7 @@
this.initUserInfo() this.initUserInfo()
this.showToask() this.showToask()
this.initOaHomeDada() this.initOaHomeDada()
this.getOrderList()
}, },
computed: {}, computed: {},
methods: { methods: {
@ -230,7 +233,6 @@
// }, // },
async getOrderList() { async getOrderList() {
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
console.log(id)
let res = await getList({ let res = await getList({
courier_id: id courier_id: id
// courier_id: 167 // courier_id: 167

View File

@ -1,259 +1,267 @@
<template> <template>
<view class="login"> <view class="login">
<image class="bg-iamge" src="../../static/img/login/login_back_img.png"></image> <image class="bg-iamge" src="../../static/img/login/login_back_img.png"></image>
<!-- #ifdef APP-PLUS||H5 --> <!-- #ifdef APP-PLUS||H5 -->
<view style="height: var(--status-bar-height);"></view> <view style="height: var(--status-bar-height);"></view>
<!-- #endif --> <!-- #endif -->
<view class="body"> <view class="body">
<view class="title">欢迎进入里海供销平台</view> <view class="title">欢迎进入里海供销平台</view>
<view class="login-card"> <view class="login-card">
<view class="top"> <view class="top">
<view class="text item"> <view class="text item">
<u-tabs :list="tabList" @click="changeTabs" lineColor="#3274F9" <u-tabs :list="tabList" @click="changeTabs" lineColor="#3274F9"
itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;font-size: 32rpx;"></u-tabs> itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;font-size: 32rpx;"></u-tabs>
</view> </view>
<input v-if="current==0" class="mobile item" v-model="formData.account" placeholder="输入账号" /> <input v-if="current==0" class="mobile item" v-model="formData.account" placeholder="输入账号" />
<input v-if="current==0" class="mobile item" v-model="formData.password" maxlength="26" placeholder="输入密码" password <input v-if="current==0" class="mobile item" v-model="formData.password" maxlength="26"
type="safe-password" /> placeholder="输入密码" password type="safe-password" />
<input v-if="current==1" class="mobile item" v-model="formData.account" placeholder="输入手机号" /> <input v-if="current==1" class="mobile item" v-model="formData.account" placeholder="输入手机号" />
<view v-if="current==1" class="code item"> <view v-if="current==1" class="code item">
<input placeholder="输入验证码" v-model="formData.code" maxlength="6" /> <input placeholder="输入验证码" v-model="formData.code" maxlength="6" />
<u-code :seconds="seconds" @end="end" @start="start" ref="uCode" <u-code :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange"></u-code>
@change="codeChange"></u-code> <view class="get-code" @click="getCode">{{tips}}</view>
<view class="get-code" @click="getCode">{{tips}}</view> </view>
</view> <view class="btn">
<view class="btn"> <!-- <view>新用户注册</view> -->
<!-- <view>新用户注册</view> --> <!-- <view @click="forgetPWD">忘记密码?</view> -->
<!-- <view @click="forgetPWD">忘记密码?</view> --> </view>
</view> </view>
</view> <button class="submit_btn" @click="login">登录</button>
<button class="submit_btn" @click="login">登录</button> </view>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
import { loginAccount, userInfo, test } from "@/api/oaUser.js" import {
import { Toast } from "../../libs/uniApi"; loginAccount,
export default { userInfo,
data() { test
return { } from "@/api/oaUser.js"
tabList: [ import {
{name:'账号登录'}, Toast
// {name:''}, } from "../../libs/uniApi";
], export default {
current: 0, data() {
formData: { return {
account: '', tabList: [{
password: '', name: '账号登录'
code: '', },
terminal: 6, //6APP // {name:''},
scene: 1 ],
}, current: 0,
tips: '获取验证码', formData: {
// refCode: null, account: '',
seconds: 60, password: '',
}; code: '',
}, terminal: 6, //6APP
methods: { scene: 1
changeTabs(e) { },
this.current = e.index; tips: '获取验证码',
this.formData.scene = e.index + 1; // refCode: null,
}, seconds: 60,
async login() { };
if(!this.formData.account)return Toast('账号不能为空'); },
if(this.formData.scene==1&&!this.formData.password)return Toast('密码不能为空'); methods: {
if(this.formData.scene==2&&!this.formData.code)return Toast('验证码不能为空'); changeTabs(e) {
let that = this; this.current = e.index;
// let res = await test(); this.formData.scene = e.index + 1;
// console.log(res); },
uni.showLoading({ async login() {
title:'正在登录中' if (!this.formData.account) return Toast('账号不能为空');
}) if (this.formData.scene == 1 && !this.formData.password) return Toast('密码不能为空');
let res = await loginAccount(that.formData); if (this.formData.scene == 2 && !this.formData.code) return Toast('验证码不能为空');
this.$store.commit('SET_USERINFO', { let that = this;
user: data, // let res = await test();
token: res.data.token // console.log(res);
}) uni.showLoading({
let { data } = await userInfo(); title: '正在登录中'
this.$store.commit('setUserInfo', data); })
uni.hideLoading() let res = await loginAccount(that.formData);
uni.switchTab({ this.$store.commit('SET_USERINFO', {
url: '/pages/oaHome/oaHome' user: data,
}) token: res.data.token
}, })
initTerminal() { let {
// #ifndef APP-PLUS data
this.formData.terminal = 6; } = await userInfo();
// #endif this.$store.commit('setUserInfo', data);
uni.getSystemInfo({ uni.hideLoading()
success: (res) => { uni.switchTab({
const platform = res.platform.toLowerCase(); url: '/pages/oaHome/oaHome'
if (platform === 'ios') { })
this.formData.terminal = 5; },
} else if (platform === 'windows') { initTerminal() {
this.formData.terminal = 4; // #ifndef APP-PLUS
} else if (platform === 'mac') { this.formData.terminal = 6;
this.formData.terminal = 4; // #endif
} uni.getSystemInfo({
} success: (res) => {
}) const platform = res.platform.toLowerCase();
// #ifdef H5 if (platform === 'ios') {
this.formData.terminal = 3; this.formData.terminal = 5;
// #endif } else if (platform === 'windows') {
// #ifdef MP-WEIXIN this.formData.terminal = 4;
this.formData.terminal = 1; } else if (platform === 'mac') {
// #endif this.formData.terminal = 4;
}, }
codeChange(text) { }
this.tips = text; })
}, // #ifdef H5
getCode() { this.formData.terminal = 3;
if(this.$refs.uCode.canGetCode) { // #endif
// // #ifdef MP-WEIXIN
uni.showLoading({ this.formData.terminal = 1;
title: '正在获取验证码' // #endif
}) },
setTimeout(() => { codeChange(text) {
uni.hideLoading(); this.tips = text;
// this.start() },
uni.$u.toast('验证码已发送'); getCode() {
// if (this.$refs.uCode.canGetCode) {
this.$refs.uCode.start(); //
}, 2000); uni.showLoading({
} else { title: '正在获取验证码'
uni.$u.toast('倒计时结束后再发送'); })
} setTimeout(() => {
}, uni.hideLoading();
end() { // this.start()
// uni.$u.toast(''); uni.$u.toast('验证码已发送');
}, //
start() { this.$refs.uCode.start();
// uni.$u.toast(''); }, 2000);
}, } else {
// uni.$u.toast('倒计时结束后再发送');
forgetPWD(){ }
Toast('暂未开放') },
} end() {
}, // uni.$u.toast('');
mounted() { },
this.initTerminal(); start() {
} // uni.$u.toast('');
} },
//
forgetPWD() {
Toast('暂未开放')
}
},
mounted() {
this.initTerminal();
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
.login { .login {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
position: relative; position: relative;
/* #ifdef H5 */ /* #ifdef H5 */
background-image: url('../../static/img/login/login_back_img.png'); background-image: url('../../static/img/login/login_back_img.png');
/* #endif */ /* #endif */
.bg-iamge { .bg-iamge {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
position: absolute; position: absolute;
z-index: -99; z-index: -99;
} }
.body { .body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.title { .title {
width: 694rpx; width: 694rpx;
height: 74rpx; height: 74rpx;
margin-top: 200rpx; margin-top: 200rpx;
margin-bottom: 51rpx; margin-bottom: 51rpx;
font-size: 53rpx; font-size: 53rpx;
font-weight: 500; font-weight: 500;
color: #FFFFFF; color: #FFFFFF;
line-height: 68rpx; line-height: 68rpx;
-webkit-background-clip: text; -webkit-background-clip: text;
} }
.login-card { .login-card {
width: 694rpx; width: 694rpx;
height: 643rpx; height: 643rpx;
background: #FFFFFF; background: #FFFFFF;
border-radius: 21rpx 21rpx 21rpx 21rpx; border-radius: 21rpx 21rpx 21rpx 21rpx;
opacity: 1; opacity: 1;
box-sizing: border-box; box-sizing: border-box;
padding: 38.5rpx 0; padding: 38.5rpx 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.top { .top {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
flex-direction: column; flex-direction: column;
.item { .item {
margin-bottom: 35rpx; margin-bottom: 35rpx;
} }
.text { .text {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
color: rgba(0, 0, 0, 0.8); color: rgba(0, 0, 0, 0.8);
line-height: 35rpx; line-height: 35rpx;
} }
.mobile, .mobile,
.code { .code {
width: 613rpx; width: 613rpx;
height: 112rpx; height: 112rpx;
background: #F5F5F5; background: #F5F5F5;
border-radius: 56rpx 56rpx 56rpx 56rpx; border-radius: 56rpx 56rpx 56rpx 56rpx;
opacity: 1; opacity: 1;
padding: 0 45.56rpx; padding: 0 45.56rpx;
box-sizing: border-box; box-sizing: border-box;
font-size: 28rpx; font-size: 28rpx;
font-weight: 400; font-weight: 400;
color: #333; color: #333;
line-height: 35rpx; line-height: 35rpx;
} }
.code { .code {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
input { input {
font-size: 28rpx; font-size: 28rpx;
} }
.get-code { .get-code {
color: $theme-oa-color; color: $theme-oa-color;
} }
} }
.btn { .btn {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
} }
.submit_btn { .submit_btn {
width: 613rpx; width: 613rpx;
height: 112rpx; height: 112rpx;
background: $theme-oa-color; background: $theme-oa-color;
border-radius: 56rpx 56rpx 56rpx 56rpx; border-radius: 56rpx 56rpx 56rpx 56rpx;
opacity: 1; opacity: 1;
text-align: center; text-align: center;
line-height: 112rpx; line-height: 112rpx;
color: #FFFFFF; color: #FFFFFF;
font-size: 35rpx; font-size: 35rpx;
font-weight: 500; font-weight: 500;
} }
} }
} }
} }
</style> </style>