123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <template>
- <view class="container">
- <u-cell-group :border="false">
- <u-field label="快递单号" placeholder="请输入快递单号(仅限顺丰)" v-model="logisticsNum">
- <u-icon name="scan" slot="right" color="#52A63A" size="35" @click="scan"></u-icon>
- </u-field>
- </u-cell-group>
- <view class="form-handle">
- <u-button type="success" shape="circle" :ripple="true" @click="submitData" class="handle-custom" :disabled="!logisticsNum">绑定</u-button>
- </view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- data() {
- return {
- orderId: '',
- logisticsNum: '',
- }
- },
- onLoad(options) {
- this.orderId = options.orderId
- },
- methods: {
- // 调起扫码
- scan() {
- let that = this;
- // 调起条码扫描
- uni.scanCode({
- scanType: 'barCode',
- success: function (res) {
- console.log(res)
- that.logisticsNum = res.result;
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- }
- });
- },
- // 提交数据
- submitData() {
- NET.request(API.bindOrder, {
- orderId: this.orderId,
- logisticsNum: this.logisticsNum,
- }, 'GET').then(res => {
- this.$refs.uTips.show({
- title: '绑定成功',
- type: 'success',
- })
- setTimeout(() => {
- uni.redirectTo({
- url: '/pagesMain/orderList?type=3'
- });
- }, 1000)
- }).catch(error => {
- this.$refs.uTips.show({
- title: error.data.msg,
- type: 'warning',
- })
- })
- },
- },
- }
- </script>
- <style lang="less" scoped>
- page {
- width: 100%;
- height: 100%;
- }
- .container {
- width: 100%;
- height: 100%;
- float: left;
- position: absolute;
- box-sizing: border-box;
- padding-bottom: 70px;
- overflow-y: auto;
- .form-handle {
- width: calc(100% - 30px);
- height: 40px;
- position: fixed;
- bottom: 20px;
- left: 15px;
- .handle-custom {
- background-color: #51A539;
- /deep/button {
- background-color: #56a83a;
- }
- /deep/.u-btn--success--disabled {
- background-color: #74bd60 !important;
- }
- }
- }
- }
- </style>
|