sign.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <div>
  3. <div class="container">
  4. <van-search @search="check" v-model="value" placeholder="请输入快件单号或手机单号" />
  5. <img @click="onImg" src="@/assets/user/u4.png" alt="">
  6. <!-- <van-button style="width: 200px; border-radius: 6px; margin-left: 10px;" type="info"
  7. @click="check">查询</van-button> -->
  8. <Combine :isSign="isSign" :signList="signList" @isSign="isCombine" v-if="!isSign"></Combine>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import { appFindYourShipmentList, appFindYourShipment } from '@/api/index'
  14. import Combine from './combine.vue'
  15. import { Toast } from 'vant'
  16. import wx from "weixin-jsapi";
  17. export default {
  18. name: 'Sign',
  19. components: {
  20. Combine
  21. },
  22. data() {
  23. return {
  24. titlename: "派件签收",
  25. value: '',
  26. isSign: true,
  27. signList: []
  28. };
  29. },
  30. methods: {
  31. onImg() {
  32. wx.scanQRCode({
  33. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  34. scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
  35. success: (res) => {
  36. var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  37. if (result.indexOf(",") != -1) {
  38. let result1 = res.resultStr.split(",");
  39. result = result1[result1.length - 1];
  40. }
  41. this.value = result
  42. },
  43. error: function (res) {
  44. console.log(res, 'error++++++++++');
  45. }
  46. });
  47. },
  48. // 查询
  49. async check() {
  50. if (this.value == '') {
  51. this.$toast('请输入快件单号或手机单号')
  52. return
  53. }
  54. const Shipment = await appFindYourShipment({ expressNo: this.value }, { emulateJSON: true })
  55. if (Shipment.data == null) {
  56. Toast('没有数据')
  57. }
  58. const res = await appFindYourShipmentList({ userId: Shipment.data.user_id }, { emulateJSON: true })
  59. if (res.code == '0') {
  60. this.isSign = false
  61. // res.data[1].expressStatus = "0"
  62. this.signList = res.data
  63. console.log(this.signList, ' this.signList')
  64. } else {
  65. Toast('快递单号不正确')
  66. }
  67. },
  68. isCombine(value) {
  69. console.log(value)
  70. this.isSign = value
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="less" scoped>
  76. .container {
  77. background-color: #fff;
  78. height: 100vh;
  79. img {
  80. position: fixed;
  81. height: 20px;
  82. width: 20px;
  83. right: 22px;
  84. top: 18px;
  85. }
  86. }
  87. </style>