addIceRaft.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. required: true,
  47. message: '请输入冷冻要求',
  48. trigger: ['blur', 'change']
  49. },
  50. iceColdAddress: {
  51. required: true,
  52. message: '请输入释冷地点',
  53. trigger: ['blur', 'change']
  54. },
  55. suitableForCold: {
  56. required: true,
  57. message: '请输入释冷温度',
  58. trigger: ['blur', 'change']
  59. },
  60. },
  61. list: [],
  62. isIceInfo: {},
  63. headline: '添加冰排',
  64. type: 1,
  65. }
  66. },
  67. onShow() {
  68. var userInfo = this.$cache.getCache('userInfo')
  69. this.isIceInfo = userInfo.dept
  70. console.log(this.isIceInfo.isIceReleaseCold,25)
  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. this.recipientsModel.freezeClaim = String(arrValue.freezeClaim)
  97. this.recipientsModel.suitableForCold = String(arrValue.suitableForCold)
  98. if (arrValue.status == '2') {
  99. this.recipientsModel.status = '正常'
  100. } else {
  101. this.recipientsModel.status = '停用'
  102. }
  103. })
  104. } else {
  105. this.headline = '添加冰排'
  106. }
  107. }
  108. },
  109. mounted() {},
  110. methods: {
  111. // tianjia运单
  112. async printWaybill() {
  113. let flag1 = await this.$refs['recipients'].validateForm();
  114. if (flag1) {
  115. let params = {
  116. codeList: [],
  117. label: this.recipientsModel.label,
  118. freezeClaim: Number(this.recipientsModel.freezeClaim),
  119. iceColdAddress: this.recipientsModel.iceColdAddress,
  120. suitableForCold: Number(this.recipientsModel.suitableForCold),
  121. status: null,
  122. }
  123. if (this.recipientsModel.status == '正常') {
  124. params.status = '2'
  125. } else {
  126. params.status = '1'
  127. }
  128. params.codeList.push(this.recipientsModel.code)
  129. if (this.recipientsModel.id) {
  130. params.id = this.recipientsModel.id
  131. params.code = this.recipientsModel.code
  132. delete params.codeList
  133. this.$api.put('/api/ice-raft', params).then(res => {
  134. if (res.code == 200) {
  135. uni.navigateBack({
  136. delta: 1
  137. });
  138. }
  139. })
  140. } else {
  141. this.$api.post('/api/ice-raft', params).then(res => {
  142. if (res.code == 200) {
  143. uni.navigateBack({
  144. delta: 1
  145. });
  146. }
  147. })
  148. }
  149. } else {
  150. uni.$u.toast('请先完善表单')
  151. }
  152. },
  153. }
  154. }
  155. </script>
  156. <style lang="scss">
  157. page {
  158. background-color: #fff !important;
  159. }
  160. .title_waybill {
  161. font-size: 32rpx;
  162. padding: 20rpx;
  163. }
  164. .title_waybill1 {
  165. position: relative;
  166. margin: 20rpx;
  167. border-bottom: 1rpx;
  168. padding-bottom: 20rpx;
  169. }
  170. .card_Address {
  171. position: relative;
  172. }
  173. .card_flex_il {
  174. display: flex;
  175. align-items: center;
  176. padding: 20rpx;
  177. }
  178. .title_sou {
  179. font-size: 32rpx;
  180. }
  181. .card_Address:before {
  182. content: " ";
  183. position: absolute;
  184. left: 0;
  185. bottom: 0;
  186. width: 100%;
  187. height: 1px;
  188. border-top: 1px solid #e7e6e4;
  189. -webkit-transform-origin: 0 0;
  190. transform-origin: 0 0;
  191. -webkit-transform: scaleY(0.5);
  192. transform: scaleY(0.5);
  193. }
  194. .card_courier {
  195. min-height: 600rpx;
  196. padding-bottom: 20rpx;
  197. }
  198. .scroll-view {
  199. max-height: 60vh;
  200. overflow: hidden;
  201. }
  202. .headline {
  203. padding: 30rpx 30rpx 0rpx 30rpx;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. padding-bottom: 30rpx;
  208. font-size: 32rpx;
  209. font-weight: 600;
  210. }
  211. .search_card {
  212. padding: 0rpx 30rpx 10rpx 30rpx;
  213. }
  214. .courier_item {
  215. margin: 20rpx 20rpx;
  216. width: calc(100% - 80rpx);
  217. padding: 20rpx;
  218. border-radius: 20rpx;
  219. // box-shadow: 0 2rpx 10rpx 0 rgba(0, 0, 0, .1);
  220. border: 1rpx solid #e7e6e4;
  221. }
  222. .courier_name {
  223. display: flex;
  224. flex-direction: column;
  225. }
  226. .title_name {
  227. font-weight: 600;
  228. font-size: 32rpx;
  229. margin-bottom: 10rpx;
  230. }
  231. .title_phone {
  232. font-size: 28rpx;
  233. }
  234. .xd_title {
  235. width: auto;
  236. font-size: 28rpx;
  237. font-weight: 500;
  238. padding: 15rpx 30rpx;
  239. border-radius: 35rpx;
  240. // border: 3rpx solid #82848a;
  241. background-color: #E4E7ED;
  242. }
  243. </style>