fill.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view>
  3. <u-popup :show="show" @close="$emit('close')" :round="10" closeable>
  4. <view class="title"> 填写快递信息 </view>
  5. <view class="content">
  6. <view class="_label" @click="openSelect">
  7. <view class="name">快递公司</view>
  8. <u--input
  9. placeholder="请选择快递公司"
  10. border="none"
  11. v-model="expressName"
  12. inputAlign="right"
  13. @change="searchExpress"
  14. ></u--input>
  15. </view>
  16. <view class="_label">
  17. <view class="name">快递单号</view>
  18. <u--input
  19. placeholder="请填写快递单号"
  20. border="none"
  21. v-model="expressNum"
  22. inputAlign="right"
  23. ></u--input>
  24. </view>
  25. <SelectExpress
  26. :show="nameShow"
  27. :filterList="filterList"
  28. @selected="selected"
  29. className="select-list"
  30. />
  31. </view>
  32. <button
  33. class="btn"
  34. @click="
  35. $emit('close', {
  36. expressCode,
  37. expressNum,
  38. })
  39. "
  40. >
  41. 立即保存
  42. </button>
  43. </u-popup>
  44. </view>
  45. </template>
  46. <script>
  47. import SelectExpress from "../../components/selectExpress.vue";
  48. export default {
  49. components: { SelectExpress },
  50. props: {
  51. show: {
  52. typeof: Boolean,
  53. default: false,
  54. },
  55. },
  56. name: "fill",
  57. data() {
  58. return {
  59. expressName: "",
  60. expressNum: "",
  61. expressCode: "",
  62. expressNameList: [], //快递公司
  63. nameShow: false,
  64. filterList: [],
  65. };
  66. },
  67. methods: {
  68. //过滤搜索结果
  69. searchExpress(e) {
  70. this.nameShow = true;
  71. this.filterList = this.expressNameList
  72. .filter((item) => item.name.includes(e))
  73. .map((item) => item);
  74. },
  75. //获取选中的快递公司
  76. selected(value) {
  77. this.expressName = value.name;
  78. this.expressCode = value.code;
  79. this.nameShow = false;
  80. },
  81. //打开下拉
  82. openSelect() {
  83. this.nameShow = true;
  84. },
  85. getExpressNameList() {
  86. uni.$u.http.get(`/api/express-company`).then((res) => {
  87. this.expressNameList = res;
  88. this.filterList = res;
  89. });
  90. },
  91. },
  92. mounted() {
  93. this.getExpressNameList();
  94. },
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. .title {
  99. height: 100rpx;
  100. text-align: center;
  101. line-height: 100rpx;
  102. font-size: 36rpx;
  103. color: rgba(34, 34, 34, 1);
  104. font-weight: 600;
  105. }
  106. .content {
  107. padding: 0 32rpx;
  108. margin-bottom: 126rpx;
  109. position: relative;
  110. ._label {
  111. display: flex;
  112. justify-content: space-around;
  113. align-items: center;
  114. height: 100rpx;
  115. margin-top: 16rpx 24rpx;
  116. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  117. .name {
  118. color: rgba(85, 85, 85, 1);
  119. font-size: 30rpx;
  120. }
  121. }
  122. }
  123. .btn {
  124. background-color: #f83224;
  125. color: #fff;
  126. border-radius: 44rpx;
  127. margin: 0 auto 50rpx;
  128. width: 90%;
  129. }
  130. </style>