sending.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. {{ i18n.warehouseAddress + "&emsp;" }}</text
  7. >
  8. <text class="top_right_text">{{ i18n.addressFirst }}</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">{{ i18n.TrackingNumber }}</view>
  30. <u--input
  31. :placeholder="i18n.trackingNumber"
  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">{{ i18n.Expresscompany }}</view>
  39. <u--input
  40. :placeholder="i18n.pleaseCompany"
  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">{{ i18n.preserve }}</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. computed: {
  79. i18n() {
  80. return this.$t("index");
  81. },
  82. },
  83. methods: {
  84. //过滤搜索结果
  85. searchExpress(e) {
  86. this.nameShow = true;
  87. this.filterList = this.expressNameList
  88. .filter((item) => item.name.includes(e))
  89. .map((item) => item);
  90. },
  91. openName() {
  92. this.nameShow = true;
  93. },
  94. //关闭
  95. closeName() {
  96. this.nameShow = false;
  97. },
  98. //获取选中的快递公司
  99. selected(value) {
  100. this.expressName = value.name;
  101. this.expressCode = value.code;
  102. this.nameShow = false;
  103. },
  104. //保存
  105. submit() {
  106. uni.$u.http
  107. .post(`/api/express-order/delivery/${this.orderId}`, {
  108. domestic_logistics_company_code: this.expressCode,
  109. domestic_logistics_no: this.expressNum,
  110. })
  111. .then((res) => {
  112. uni.navigateBack({
  113. delta: 1,
  114. });
  115. uni.showToast({
  116. title: this.i18n.saved,
  117. icon: "none",
  118. });
  119. });
  120. },
  121. getExpressNameList() {
  122. uni.$u.http.get(`/api/express-company`).then((res) => {
  123. this.expressNameList = res;
  124. this.filterList = res;
  125. });
  126. uni.$u.http.get(`/api/transit`).then((res) => {
  127. this.addressDetail = res;
  128. });
  129. },
  130. },
  131. mounted() {
  132. this.getExpressNameList();
  133. uni.setNavigationBarTitle({
  134. title: this.i18n.useDelivery,
  135. });
  136. },
  137. };
  138. </script>
  139. <style lang="scss" scoped>
  140. .page {
  141. padding: 20rpx 24rpx;
  142. position: relative;
  143. .address {
  144. padding: 0 20rpx;
  145. background-color: #fff;
  146. border-radius: 16rpx;
  147. .address-top {
  148. height: 96rpx;
  149. line-height: 96rpx;
  150. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  151. .top_left_text {
  152. font-size: 28rpx;
  153. color: #222;
  154. font-weight: 600;
  155. }
  156. .top_right_text {
  157. font-size: 24rpx;
  158. color: #f83224;
  159. }
  160. }
  161. .address-content {
  162. display: flex;
  163. align-items: center;
  164. padding: 22rpx 0 32rpx;
  165. .address-icon {
  166. width: 28rpx;
  167. height: 28rpx;
  168. margin-right: 24rpx;
  169. }
  170. .warehouse-phone {
  171. display: flex;
  172. align-items: center;
  173. margin-bottom: 14rpx;
  174. .warehouse-name {
  175. font-size: 30rpx;
  176. font-weight: 600;
  177. color: #222222;
  178. }
  179. .phone {
  180. color: #555555;
  181. font-size: 24rpx;
  182. }
  183. }
  184. .detail {
  185. font-size: 26rpx;
  186. color: #777777;
  187. }
  188. }
  189. }
  190. .express {
  191. border-radius: 16rpx;
  192. background-color: #fff;
  193. padding: 0 20rpx;
  194. margin-top: 20rpx;
  195. position: relative;
  196. ._input-1 {
  197. display: flex;
  198. align-items: center;
  199. height: 100rpx;
  200. ._label {
  201. font-size: 28rpx;
  202. color: #222;
  203. margin-right: 32rpx;
  204. }
  205. }
  206. ._input-2 {
  207. border-bottom: 2rpx solid rgba(151, 151, 151, 0.1);
  208. }
  209. }
  210. .footer {
  211. position: fixed;
  212. bottom: 0;
  213. left: 0;
  214. width: 95%;
  215. background-color: #fff;
  216. height: 126rpx;
  217. justify-content: center;
  218. padding: 20rpx;
  219. .btn-2 {
  220. height: 76rpx;
  221. padding: 0;
  222. margin: 0;
  223. font-size: 28rpx;
  224. color: #fff;
  225. min-width: 188rpx;
  226. background-color: #f83224;
  227. border-radius: 38rpx;
  228. box-shadow: 0rpx 16rpx 40rpx -12rpx rgba(255, 21, 21, 0.5);
  229. }
  230. }
  231. }
  232. </style>