transferBox.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <!-- 中转箱 -->
  3. <view>
  4. <u-navbar title="中转保温箱" autoBack placeholder></u-navbar>
  5. <view class="card_order_details">
  6. <view class="card_search">
  7. <view class="details_title">保温箱(转)<span class="line_title">*</span></view>
  8. <view class="card_form_item_selectil frameil" @click="incubatorChange(true)">
  9. <view class="title_input_selectil" :class="incubatorName ? '' : 'hsColor'">
  10. {{incubatorName || '选择保温箱'}}
  11. </view>
  12. <u-icon name="arrow-down" size="18px"></u-icon>
  13. </view>
  14. </view>
  15. <view class="card_search">
  16. <view class="details_title">保温箱(收)<span class="line_title">*</span></view>
  17. <view class="card_form_item_selectil frameil" @click="incubatorChange(false)">
  18. <view class="title_input_selectil" :class="transferIncubator ? '' : 'hsColor'">
  19. {{transferIncubator || '选择中转保温箱'}}
  20. </view>
  21. <u-icon name="arrow-down" size="18px"></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="card_btn">
  26. <u-button style="margin-bottom: 20rpx;" type="primary" @click="submit">提交</u-button>
  27. </view>
  28. <u-popup :show="incubatorShow" closeable @close="close">
  29. <view class="card_incubator">
  30. <view class="head_place">选择保温箱</view>
  31. <view class="card_search_il">
  32. <u-search placeholder="请输入保温箱名称" v-model="keyword" :showAction="false"
  33. @change="searchChange"></u-search>
  34. </view>
  35. <view style="display: flex;flex-direction: column;overflow-y: auto;max-height: 600rpx;"
  36. v-if="incubatorData.length > 0">
  37. <view class="card_title_item" :class="item.name == pitchName ? 'color_blue' : ''"
  38. v-for="(item,index) in incubatorData" :key="index" @click="incubatorClick(item)">
  39. {{item.name}}
  40. </view>
  41. </view>
  42. <view style="margin-bottom: 20px;" v-else>
  43. <u-empty mode="list" text="暂无保温箱" marginTop="50"></u-empty>
  44. </view>
  45. </view>
  46. </u-popup>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. keyword: '',
  54. incubatorShow: false,
  55. incubatorData: [],
  56. incubatorId: null,
  57. incubatorName: '',
  58. transferId: null,
  59. transferIncubator: '',
  60. pitchName: '',
  61. incubatorFlag: false,
  62. }
  63. },
  64. methods: {
  65. submit() {
  66. if (this.incubatorId) {
  67. if (this.transferId) {
  68. uni.showLoading();
  69. this.$api.post('/api/waybill/transfer', {
  70. OldCoolerBoxId: this.incubatorId,
  71. NewCoolerBoxId: this.transferId,
  72. }).then(res => {
  73. if (res.code == 200) {
  74. this.incubatorId = null
  75. this.incubatorName = ''
  76. this.transferId = null
  77. this.transferIncubator = ''
  78. uni.$u.toast(res.msg)
  79. } else {
  80. uni.$u.toast(res.data.msg)
  81. }
  82. uni.hideLoading();
  83. }).catch(() => {
  84. uni.hideLoading();
  85. })
  86. } else {
  87. uni.$u.toast('请选择接收保温箱')
  88. }
  89. } else {
  90. uni.$u.toast('请选择需要中转的保温箱')
  91. }
  92. },
  93. // 保温箱选择
  94. incubatorChange(event) {
  95. if (event) {
  96. this.pitchName = this.incubatorName
  97. } else {
  98. this.pitchName = this.transferIncubator
  99. }
  100. this.incubatorFlag = event
  101. this.incubatorShow = true
  102. this.$api.get('/api/cooler-box', {
  103. page: 1,
  104. pageSize: 999,
  105. isBind: true,
  106. name: this.keyword,
  107. }).then(res => {
  108. if (res.code == 200) {
  109. this.incubatorData = res.data.list
  110. }
  111. })
  112. },
  113. // 搜索
  114. searchChange() {
  115. this.incubatorData = []
  116. this.incubatorChange()
  117. },
  118. // 选择保温箱
  119. incubatorClick(event) {
  120. this.pitchName = event.name
  121. if (this.incubatorFlag) {
  122. this.incubatorId = event.id
  123. this.incubatorName = event.name
  124. } else {
  125. this.transferId = event.id
  126. this.transferIncubator = event.name
  127. }
  128. this.incubatorShow = false
  129. },
  130. close() {
  131. this.incubatorShow = false
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. page {
  138. background-color: #fff !important;
  139. }
  140. .card_order_details {
  141. margin: 10rpx 30rpx 30rpx 30rpx;
  142. }
  143. .card_search {
  144. display: flex;
  145. align-items: center;
  146. margin: 20rpx 0rpx;
  147. }
  148. .details_title {
  149. position: relative;
  150. width: 160rpx;
  151. flex: none;
  152. color: #333;
  153. font-size: 32rpx;
  154. font-weight: 500;
  155. margin-bottom: 10rpx;
  156. margin-right: 15rpx;
  157. padding-left: 15rpx;
  158. }
  159. .line_title {
  160. position: absolute;
  161. top: 0rpx;
  162. left: 0rpx;
  163. color: red;
  164. }
  165. .card_form_item_selectil {
  166. width: 100%;
  167. display: flex;
  168. flex-direction: row;
  169. align-items: center;
  170. justify-content: space-between;
  171. padding: 6px 9px;
  172. height: 52rpx;
  173. }
  174. .title_input_selectil {
  175. font-size: 30rpx;
  176. // width: 100%;
  177. }
  178. .hsColor {
  179. color: rgb(192, 196, 204);
  180. }
  181. // 伪元素1rpx边框
  182. .frameil {
  183. position: relative; //重要
  184. }
  185. .frameil::after {
  186. position: absolute;
  187. content: '';
  188. border: 2rpx solid #dadbde;
  189. width: 200%;
  190. height: 200%;
  191. top: 0;
  192. left: 0;
  193. transform: scale(0.5);
  194. transform-origin: 0 0;
  195. pointer-events: none;
  196. border-radius: 20rpx;
  197. /* 使伪元素不会阻止鼠标事件 */
  198. }
  199. .card_incubator {
  200. min-height: 600rpx;
  201. max-height: 900rpx;
  202. }
  203. .head_place {
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. padding: 20rpx;
  208. }
  209. .card_search_il {
  210. margin: 20rpx;
  211. }
  212. .card_title_item {
  213. position: relative;
  214. padding: 30rpx;
  215. // border-bottom: 1rpx solid #dadbde;
  216. }
  217. .color_blue {
  218. color: #2979ff;
  219. }
  220. .card_title_item:before {
  221. content: " ";
  222. position: absolute;
  223. left: 0;
  224. bottom: 0;
  225. width: 100%;
  226. height: 1px;
  227. border-top: 1px solid #e7e6e4;
  228. -webkit-transform-origin: 0 0;
  229. transform-origin: 0 0;
  230. -webkit-transform: scaleY(0.5);
  231. transform: scaleY(0.5);
  232. }
  233. .card_btn {
  234. position: fixed;
  235. left: 0;
  236. right: 0;
  237. bottom: 0;
  238. padding-left: 30rpx;
  239. padding-right: 30rpx;
  240. padding-top: 20rpx;
  241. background-color: #fff;
  242. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  243. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  244. }
  245. </style>