addIceRaft.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <!-- 添加运单 -->
  3. <view>
  4. <u-navbar :title="headline" autoBack placeholder></u-navbar>
  5. <x-form ref="recipients" :list="list" :model="recipientsModel" :rules="rules"></x-form>
  6. <view style="width: 100%;height: 150rpx;"></view>
  7. <view class="btn_print" @click="printWaybill">
  8. <u-button type="primary" :text="headline"></u-button>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import {
  14. iceRaftRulesil
  15. } from "./waybill.js";
  16. export default {
  17. name: 'addIceRaft',
  18. data() {
  19. return {
  20. recipientsModel: {
  21. id: null,
  22. code: '',
  23. label: '',
  24. status: '',
  25. freezeClaim: [],
  26. suitableForCold: null,
  27. iceColdAddress: '',
  28. },
  29. rules: {
  30. code: {
  31. required: true,
  32. message: '请输入编号',
  33. trigger: ['blur', 'change']
  34. },
  35. label: {
  36. required: true,
  37. message: '请输入冰排备注',
  38. trigger: ['blur', 'change']
  39. },
  40. status: {
  41. required: true,
  42. message: '请选择状态',
  43. trigger: ['blur', 'change']
  44. },
  45. freezeClaim: {
  46. type: 'array',
  47. required: true,
  48. message: '请输入冷冻要求',
  49. trigger: ['blur', 'change']
  50. },
  51. iceColdAddress: {
  52. required: true,
  53. message: '请输入释冷地点',
  54. trigger: ['blur', 'change']
  55. },
  56. suitableForCold: {
  57. required: true,
  58. message: '请输入释冷温度',
  59. trigger: ['blur', 'change']
  60. },
  61. },
  62. list: [],
  63. isIceInfo: {},
  64. headline: '添加冰排',
  65. type: 1,
  66. }
  67. },
  68. onShow() {
  69. var userInfo = this.$cache.getCache('userInfo')
  70. this.isIceInfo = userInfo.dept
  71. if (this.isIceInfo.isIceReleaseCold) {
  72. this.list = iceRaftRulesil()
  73. } else {
  74. var arrIce = iceRaftRulesil()
  75. this.list = removePointById(arrIce, ['suitableForCold', 'iceColdAddress'])
  76. }
  77. function removePointById(arr1, arr2) {
  78. for (let i = 0; i < arr2.length; i++) {
  79. for (let j = 0; j < arr1.length; j++) {
  80. if (arr2[i] == arr1[j].field) {
  81. let indexs = arr1.indexOf(arr1[j]);
  82. arr1.splice(indexs, 1);
  83. }
  84. }
  85. }
  86. return arr1
  87. }
  88. },
  89. onLoad(option) {
  90. if (option.list) {
  91. let arrValue = JSON.parse(option.list)
  92. if (arrValue.id) {
  93. this.$nextTick(() => {
  94. this.headline = '编辑冰排'
  95. this.recipientsModel = arrValue
  96. if (arrValue.freezeClaim) {
  97. this.recipientsModel.freezeClaim = arrValue.freezeClaim
  98. }
  99. this.recipientsModel.suitableForCold = String(arrValue.suitableForCold)
  100. if (arrValue.status == '2') {
  101. this.recipientsModel.status = '正常'
  102. } else {
  103. this.recipientsModel.status = '停用'
  104. }
  105. })
  106. } else {
  107. this.headline = '添加冰排'
  108. }
  109. }
  110. },
  111. mounted() {},
  112. methods: {
  113. // tianjia运单
  114. async printWaybill() {
  115. let flag1 = await this.$refs['recipients'].validateForm();
  116. if (flag1) {
  117. let params = {
  118. codeList: [],
  119. label: this.recipientsModel.label,
  120. freezeClaim: this.recipientsModel.freezeClaim,
  121. iceColdAddress: this.recipientsModel.iceColdAddress,
  122. suitableForCold: Number(this.recipientsModel.suitableForCold),
  123. status: null,
  124. }
  125. if (this.recipientsModel.status == '正常') {
  126. params.status = '2'
  127. } else {
  128. params.status = '1'
  129. }
  130. params.codeList.push(this.recipientsModel.code)
  131. if (this.recipientsModel.id) {
  132. params.id = this.recipientsModel.id
  133. params.code = this.recipientsModel.code
  134. delete params.codeList
  135. this.$api.put('/api/ice-raft', params).then(res => {
  136. if (res.code == 200) {
  137. uni.navigateBack({
  138. delta: 1
  139. });
  140. }
  141. })
  142. } else {
  143. this.$api.post('/api/ice-raft', params).then(res => {
  144. if (res.code == 200) {
  145. uni.navigateBack({
  146. delta: 1
  147. });
  148. }
  149. })
  150. }
  151. } else {
  152. uni.$u.toast('请先完善表单')
  153. }
  154. },
  155. }
  156. }
  157. </script>
  158. <style lang="scss">
  159. page {
  160. background-color: #fff !important;
  161. }
  162. .title_waybill {
  163. font-size: 32rpx;
  164. padding: 20rpx;
  165. }
  166. .title_waybill1 {
  167. position: relative;
  168. margin: 20rpx;
  169. border-bottom: 1rpx;
  170. padding-bottom: 20rpx;
  171. }
  172. .card_Address {
  173. position: relative;
  174. }
  175. .card_flex_il {
  176. display: flex;
  177. align-items: center;
  178. padding: 20rpx;
  179. }
  180. .title_sou {
  181. font-size: 32rpx;
  182. }
  183. .card_Address:before {
  184. content: " ";
  185. position: absolute;
  186. left: 0;
  187. bottom: 0;
  188. width: 100%;
  189. height: 1px;
  190. border-top: 1px solid #e7e6e4;
  191. -webkit-transform-origin: 0 0;
  192. transform-origin: 0 0;
  193. -webkit-transform: scaleY(0.5);
  194. transform: scaleY(0.5);
  195. }
  196. .card_courier {
  197. min-height: 600rpx;
  198. padding-bottom: 20rpx;
  199. }
  200. .scroll-view {
  201. max-height: 60vh;
  202. overflow: hidden;
  203. }
  204. .headline {
  205. padding: 30rpx 30rpx 0rpx 30rpx;
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. padding-bottom: 30rpx;
  210. font-size: 32rpx;
  211. font-weight: 600;
  212. }
  213. .search_card {
  214. padding: 0rpx 30rpx 10rpx 30rpx;
  215. }
  216. .courier_item {
  217. margin: 20rpx 20rpx;
  218. width: calc(100% - 80rpx);
  219. padding: 20rpx;
  220. border-radius: 20rpx;
  221. // box-shadow: 0 2rpx 10rpx 0 rgba(0, 0, 0, .1);
  222. border: 1rpx solid #e7e6e4;
  223. }
  224. .courier_name {
  225. display: flex;
  226. flex-direction: column;
  227. }
  228. .title_name {
  229. font-weight: 600;
  230. font-size: 32rpx;
  231. margin-bottom: 10rpx;
  232. }
  233. .title_phone {
  234. font-size: 28rpx;
  235. }
  236. .xd_title {
  237. width: auto;
  238. font-size: 28rpx;
  239. font-weight: 500;
  240. padding: 15rpx 30rpx;
  241. border-radius: 35rpx;
  242. // border: 3rpx solid #82848a;
  243. background-color: #E4E7ED;
  244. }
  245. </style>