123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <template>
- <view>
- <view>
- <view class='wrap'>
- <view class="c-row">
- <view class="title">车牌号</view>
- <view class="con-list">
- <input v-model='detailData.carNo' placeholder="请输入车牌号" maxlength="7"></input>
- </view>
- </view>
- </view>
- <view @click='startTrack' class="button" v-if='titleBtn=="开始轨迹"'>{{titleBtn}}</view>
- <view @click='startTrack' class="button1" v-if='titleBtn=="结束轨迹"'>{{titleBtn}}</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- detailData: {
- carNo: '',
- travelStatus: '',
- originProvince: '',
- originCity: '',
- originArea: '',
- originLongitude: '',
- originLatitude: '',
- destinationProvince: '',
- destinationCity: '',
- destinationArea: '',
- destinationLongitude: '',
- destinationLatitude: '',
- trackFlag: '0',
- compId: '',
- commonId: '',
- mileage: '',
- sendWarehouse:'',
- receiveWarehouse:'',
- },
- titleBtn: "开始轨迹",
- }
- },
- onLoad(options) {
- this.id = options.id
- },
- onShow() {
- var that = this
- if (this.id) {
- this.seeInfo()
- }
- },
- methods: {
- seeInfo() {
- this.$api.doRequest('get', '/shortFillingInfo/getShortFilling', {
- id: this.id
- }).then(res => {
- if (res.data.code == 200) {
- this.detailData = res.data.data
- if (this.detailData.travelStatus == "已开始") {
- this.titleBtn = "结束轨迹"
- }
- }
- })
- },
- startTrack() {
- if (this.titleBtn == "开始轨迹") {
- var that = this
- uni.showModal({
- content: "确定开始轨迹?",
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
- that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
- that.detailData.driverName = uni.getStorageSync('userInfo').userName
- that.detailData.trackFlag = "0"
- that.detailData.fillingNo = "202207040004"
- that.detailData.originProvince = "黑龙江省"
- that.detailData.originCity = "齐齐哈尔市"
- that.detailData.originArea = "克东县"
- that.detailData.sendWarehouse = "克东千丰库"
- that.detailData.originLongitude = "123.188"
- that.detailData.originLatitude = "41.737"
- that.$api.doRequest('post', '/shortFillingInfo/api/addShortFilling',
- that.detailData
- )
- .then(res => {
- that.id = res.data.data
- if (res.data.code == 200) {
- that.$api.msg('提交成功')
- that.titleBtn = "结束轨迹"
- } else {
- that.$api.msg('提交失败')
- }
- })
- }
- }
- })
- } else if (this.titleBtn == "结束轨迹") {
- var that = this
- uni.showModal({
- content: "确定结束轨迹?",
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
- that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
- that.detailData.driverName = uni.getStorageSync('userInfo').userName
- that.detailData.trackFlag = "1"
- that.detailData.destinationProvince = "辽宁省"
- that.detailData.receiveWarehouse = "鲅鱼圈红运库"
- that.detailData.carNo
- that.detailData.mileage = "15"
- that.detailData.destinationLongitude = "118.291"
- that.detailData.destinationLatitude = "33.942"
- that.$api.doRequest('post', '/shortFillingInfo/api/addShortFilling',
- that.detailData
- )
- .then(res => {
- if (res.data.code == 200) {
- that.$api.msg('提交成功')
- uni.navigateTo({
- url: '/pages/shortDistance/short_distance_record'
- })
- } else {
- that.$api.msg('提交失败')
- }
- })
- }
- }
- })
- }
- },
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- }
- .title_b {
- margin: 20rpx 20rpx 0rpx 20rpx;
- padding: 20rpx 10rpx 20rpx 10rpx;
- font-size: 18px;
- font-weight: 550;
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 20rpx 30rpx;
- }
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- padding-right: 20rpx;
- }
- .wrap {
- font-size: 14px;
- background: #fff;
- margin: 10px;
- border-radius: 15px 10px;
- input {
- font-size: 14px;
- }
- >.title {
- padding: 10px 16px;
- }
- }
- .button {
- background: #22C572;
- width: 90%;
- margin: 250px auto;
- padding: 10px;
- color: #fff;
- text-align: center;
- border-radius: 30px;
- }
- .button1 {
- background: #ff0000;
- width: 90%;
- margin: 250px auto;
- padding: 10px;
- color: #fff;
- text-align: center;
- border-radius: 30px;
- }
- .buns_item {
- display: flex;
- padding: 80rpx 0 50rpx 0;
- justify-content: space-around;
- }
- .but_css {
- background: #22C572;
- width: 40%;
- padding: 20rpx;
- color: #fff;
- text-align: center;
- border-radius: 20rpx;
- }
- /deep/.u-radio-group {
- flex-direction: row-reverse;
- }
- .no-boder {
- border: 0;
- }
- .textarea {
- background: #F9F9FA;
- border: 1px solid #EEEEEE;
- }
- </style>
|