sending.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="page" @click="closeName">
  3. <view class="address">
  4. <view class="address-top">
  5. <text space="emsp" class="top_left_text"
  6. >跨境中转仓库地址 {{ "&emsp;" }}</text
  7. >
  8. <text class="top_right_text">请先将包裹寄往这个地址~</text>
  9. </view>
  10. <view class="address-content">
  11. <image
  12. class="address-icon"
  13. src="../../static/mine/346.png"
  14. mode=""
  15. ></image>
  16. <view class="">
  17. <view class="warehouse-phone">
  18. <text class="warehouse-name">{{ addressDetail.name }}</text>
  19. <text class="phone" space="emsp"
  20. >{{ "&emsp;" }} {{ addressDetail.mobile }}</text
  21. >
  22. </view>
  23. <view class="detail"> {{ addressDetail.address }} </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="express">
  28. <view class="_input-1 _input-2">
  29. <view class="_label">快递单号</view>
  30. <u--input
  31. placeholder="请输入快递单号"
  32. border="none"
  33. v-model="expressNum"
  34. clearable
  35. ></u--input>
  36. </view>
  37. <view class="_input-1" @click.stop="openName">
  38. <view class="_label">快递公司</view>
  39. <u--input
  40. placeholder="请输入快递公司名称"
  41. border="none"
  42. @change="searchExpress"
  43. v-model="expressName"
  44. clearable
  45. ></u--input>
  46. </view>
  47. <SelectExpress
  48. :show="nameShow"
  49. :filterList="filterList"
  50. @selected="selected"
  51. className="sending-name"
  52. />
  53. </view>
  54. <view class="footer">
  55. <button class="btn-2" @click="submit">保存</button>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import SelectExpress from "../components/selectExpress.vue";
  61. export default {
  62. components: { SelectExpress },
  63. data() {
  64. return {
  65. nameShow: false,
  66. filterList: [], //过滤之后的快递公司
  67. expressName: "",
  68. expressNum: "",
  69. expressCode: "", //选中的快递公司编号
  70. expressNameList: [], //快递公司
  71. orderId: "", //订单id
  72. addressDetail: {}, //中转地址信息
  73. };
  74. },
  75. onLoad(options) {
  76. this.orderId = options.orderId;
  77. },
  78. methods: {
  79. //过滤搜索结果
  80. searchExpress(e) {
  81. this.nameShow = true;
  82. this.filterList = this.expressNameList
  83. .filter((item) => item.name.includes(e))
  84. .map((item) => item);
  85. },
  86. openName() {
  87. this.nameShow = true;
  88. },
  89. //关闭
  90. closeName() {
  91. this.nameShow = false;
  92. },
  93. //获取选中的快递公司
  94. selected(value) {
  95. this.expressName = value.name;
  96. this.expressCode = value.code;
  97. this.nameShow = false;
  98. },
  99. //保存
  100. submit() {
  101. uni.$u.http
  102. .post(`/api/express-order/delivery/${this.orderId}`, {
  103. domestic_logistics_company_code: this.expressCode,
  104. domestic_logistics_no: this.expressNum,
  105. })
  106. .then((res) => {
  107. uni.navigateBack({
  108. delta: 1,
  109. });
  110. uni.showToast({
  111. title: "已保存",
  112. icon: "none",
  113. });
  114. });
  115. },
  116. getExpressNameList() {
  117. uni.$u.http.get(`/api/express-company`).then((res) => {
  118. this.expressNameList = res;
  119. this.filterList = res;
  120. });
  121. uni.$u.http.get(`/api/transit`).then((res) => {
  122. this.addressDetail = res;
  123. });
  124. },
  125. },
  126. mounted() {
  127. this.getExpressNameList();
  128. uni.setNavigationBarTitle({
  129. title: "寄快递",
  130. });
  131. },
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. .page {
  136. padding: 20rpx 24rpx;
  137. position: relative;
  138. .address {
  139. padding: 0 20rpx;
  140. background-color: #fff;
  141. border-radius: 16rpx;
  142. .address-top {
  143. height: 96rpx;
  144. line-height: 96rpx;
  145. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  146. .top_left_text {
  147. font-size: 28rpx;
  148. color: #222;
  149. font-weight: 600;
  150. }
  151. .top_right_text {
  152. font-size: 24rpx;
  153. color: #f83224;
  154. }
  155. }
  156. .address-content {
  157. display: flex;
  158. align-items: center;
  159. padding: 22rpx 0 32rpx;
  160. .address-icon {
  161. width: 28rpx;
  162. height: 28rpx;
  163. margin-right: 24rpx;
  164. }
  165. .warehouse-phone {
  166. display: flex;
  167. align-items: center;
  168. margin-bottom: 14rpx;
  169. .warehouse-name {
  170. font-size: 30rpx;
  171. font-weight: 600;
  172. color: #222222;
  173. }
  174. .phone {
  175. color: #555555;
  176. font-size: 24rpx;
  177. }
  178. }
  179. .detail {
  180. font-size: 26rpx;
  181. color: #777777;
  182. }
  183. }
  184. }
  185. .express {
  186. border-radius: 16rpx;
  187. background-color: #fff;
  188. padding: 0 20rpx;
  189. margin-top: 20rpx;
  190. position: relative;
  191. ._input-1 {
  192. display: flex;
  193. align-items: center;
  194. height: 100rpx;
  195. ._label {
  196. font-size: 28rpx;
  197. color: #222;
  198. margin-right: 32rpx;
  199. }
  200. }
  201. ._input-2 {
  202. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  203. }
  204. }
  205. .footer {
  206. position: fixed;
  207. bottom: 0;
  208. left: 0;
  209. width: 95%;
  210. background-color: #fff;
  211. height: 126rpx;
  212. justify-content: center;
  213. padding: 20rpx;
  214. .btn-2 {
  215. height: 76rpx;
  216. padding: 0;
  217. margin: 0;
  218. font-size: 28rpx;
  219. color: #fff;
  220. min-width: 188rpx;
  221. background-color: #f83224;
  222. border-radius: 38rpx;
  223. box-shadow: 0rpx 16rpx 40rpx -12rpx rgba(255, 21, 21, 0.5);
  224. }
  225. }
  226. }
  227. </style>