<template> <!-- 添加包裹 --> <view class="back"> <view class="box" style="border-radius: 16rpx 16rpx 0 0 "> <view class="boxitem u-flex"> <text class="name">{{i18n.TrackingNumber}}</text> <input style="flex: 1;" type="text" :placeholder="i18n.trackingNumber" v-model="logistics_no" /> </view> </view> <view class="box"> <view class="boxitem u-flex u-row-between"> <text class="name">{{i18n.Expresscompany}}</text> <view class="u-flex" @click="toexpress"> <view class="selection">{{logistics_company_name||i18n.selection}}</view> <image src="../static/express/next1.png" style="width: 30rpx;height: 30rpx;" mode=""></image> </view> </view> </view> <view class="box" style="border-radius:0 0 16rpx 16rpx"> <view class="boxitem u-flex u-row-end"> <text class="name">{{i18n.Parcelweight}}</text> <input style="flex: 1;" type="text" :placeholder="i18n.parcelWeight" v-model="estimated_weight" /> <text>kg</text> </view> </view> <view class="btn" @click="offline"> {{i18n.Addlist}} </view> </view> </template> <script> export default { data() { return { logistics_company_name: '', // 顺丰快递 是 String 快递公司 logistics_no: '', //11111111 是 String 快递单号 estimated_weight: '', // 222 是 String 包裹重量 code: '' }; }, computed: { i18n() { return this.$t('index') } }, onShow() { uni.setNavigationBarTitle({ title: this.i18n.Addparcel }) }, methods: { toexpress() { uni.navigateTo({ url: '/pageB/expresstype', events: { todcp: (res) => { this.logistics_company_name = res.concant this.code = res.code } } }) }, //线下下单 offline() { if (this.logistics_no == '') { this.$u.toast(this.i18n.trackingNumber) return } if (this.logistics_company_name == '') { this.$u.toast(this.i18n.selectCourier) return } if (this.estimated_weight == '') { this.$u.toast(this.i18n.parcelWeight) return } uni.$u.http.post('/api/express-order/offline-create', { logistics_company_code: this.code, // 顺丰快递 是 String 快递公司 logistics_no: this.logistics_no, //11111111 是 String 快递单号 estimated_weight: this.estimated_weight, // 222 是 String 包裹重量 }).then((res) => { this.$u.toast(this.i18n.successfullyAdded) // uni.navigateTo({ // url:'pageB/myPackage' // }) setTimeout(() => { uni.navigateBack() }, 800) }).catch(() => { }) }, } } </script> <style lang="scss" scoped> .selection { font-family: PingFangSC, PingFang SC; font-weight: 400; font-size: 28rpx; color: #666666; line-height: 40rpx; text-align: left; font-style: normal; } .btn { width: 686rpx; height: 88rpx; background: #F83224; border-radius: 44rpx; font-family: PingFangSC, PingFang SC; font-weight: 500; font-size: 32rpx; color: #FFFFFF; line-height: 88rpx; text-align: center; font-style: normal; margin-top: 94rpx; } .back { box-sizing: border-box; padding: 20rpx 24rpx; } .box { padding: 0 28rpx; box-sizing: border-box; width: 702rpx; // height: 324rpx; background: #FFFFFF; // border-radius: 16rpx; box-sizing: border-box; .boxitem { height: 100rpx; width: 646rpx; border-bottom: 2rpx solid rgba(151, 151, 151, 0.1); box-sizing: border-box; } .name { width: 150rpx; display: block; font-family: PingFangSC, PingFang SC; font-weight: 400; font-size: 30rpx; color: #222222; line-height: 42rpx; text-align: left; font-style: normal; margin-right: 44rpx; } } </style>