bindOrder.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="container">
  3. <u-cell-group :border="false">
  4. <u-field label="快递单号" placeholder="请输入快递单号(仅限顺丰)" v-model="logisticsNum">
  5. <u-icon name="scan" slot="right" color="#52A63A" size="35" @click="scan"></u-icon>
  6. </u-field>
  7. </u-cell-group>
  8. <view class="form-handle">
  9. <u-button type="success" shape="circle" :ripple="true" @click="submitData" class="handle-custom" :disabled="!logisticsNum">绑定</u-button>
  10. </view>
  11. <u-top-tips ref="uTips"></u-top-tips>
  12. </view>
  13. </template>
  14. <script>
  15. const NET = require('@/utils/request')
  16. const API = require('@/config/api')
  17. export default {
  18. data() {
  19. return {
  20. orderId: '',
  21. logisticsNum: '',
  22. }
  23. },
  24. onLoad(options) {
  25. this.orderId = options.orderId
  26. },
  27. methods: {
  28. // 调起扫码
  29. scan() {
  30. let that = this;
  31. // 调起条码扫描
  32. uni.scanCode({
  33. scanType: 'barCode',
  34. success: function (res) {
  35. console.log(res)
  36. that.logisticsNum = res.result;
  37. console.log('条码类型:' + res.scanType);
  38. console.log('条码内容:' + res.result);
  39. }
  40. });
  41. },
  42. // 提交数据
  43. submitData() {
  44. NET.request(API.bindOrder, {
  45. orderId: this.orderId,
  46. logisticsNum: this.logisticsNum,
  47. }, 'GET').then(res => {
  48. this.$refs.uTips.show({
  49. title: '绑定成功',
  50. type: 'success',
  51. })
  52. setTimeout(() => {
  53. uni.redirectTo({
  54. url: '/pagesMain/orderList?type=3'
  55. });
  56. }, 1000)
  57. }).catch(error => {
  58. this.$refs.uTips.show({
  59. title: error.data.msg,
  60. type: 'warning',
  61. })
  62. })
  63. },
  64. },
  65. }
  66. </script>
  67. <style lang="less" scoped>
  68. page {
  69. width: 100%;
  70. height: 100%;
  71. }
  72. .container {
  73. width: 100%;
  74. height: 100%;
  75. float: left;
  76. position: absolute;
  77. box-sizing: border-box;
  78. padding-bottom: 70px;
  79. overflow-y: auto;
  80. .form-handle {
  81. width: calc(100% - 30px);
  82. height: 40px;
  83. position: fixed;
  84. bottom: 20px;
  85. left: 15px;
  86. .handle-custom {
  87. background-color: #51A539;
  88. /deep/button {
  89. background-color: #56a83a;
  90. }
  91. /deep/.u-btn--success--disabled {
  92. background-color: #74bd60 !important;
  93. }
  94. }
  95. }
  96. }
  97. </style>