addDisinfect.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">申报单录入</text>
  6. </view>
  7. <view class="item">
  8. <view class="l"><text style="color: red;">*</text>申报人:</view>
  9. <view class="r">
  10. <u-input placeholder="申报人" @input="handler()" v-model="form.declarePeople">
  11. </u-input>
  12. </view>
  13. </view>
  14. <view class="item">
  15. <view class="l"><text style="color: red;">*</text>申报电话:</view>
  16. <view class="r">
  17. <u-input placeholder="申报电话" @input="handler()" v-model="form.declarePhone">
  18. </u-input>
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="l">申报单位:</view>
  23. <view class="r">
  24. <u-input placeholder="申报单位" @input="handler()" v-model="form.applyUnit">
  25. </u-input>
  26. </view>
  27. </view>
  28. <view class="item">
  29. <view class="l"><text style="color: red;">*</text>品名:</view>
  30. <view class="r">
  31. <u-input placeholder="输入品名" @input="handler()" v-model="form.goodsName">
  32. </u-input>
  33. </view>
  34. </view>
  35. <view class="item">
  36. <view class="l"><text style="color: red;">*</text>重量:</view>
  37. <view class="r">
  38. <u-input type="number" placeholder="输入毛重" @input="handler()" v-model="form.grossWeight">
  39. <text slot="suffix">吨</text>
  40. </u-input>
  41. </view>
  42. </view>
  43. <view class="item">
  44. <view class="l">数量:</view>
  45. <view class="r">
  46. <u-input type="number" placeholder="输入数量" @input="handler()" v-model="form.num">
  47. </u-input>
  48. </view>
  49. </view>
  50. <view class="item">
  51. <view class="l">产地:</view>
  52. <view class="r">
  53. <u-input placeholder="输入产地" @input="handler()" v-model="form.origin">
  54. </u-input>
  55. </view>
  56. </view>
  57. <view class="item">
  58. <view class="l">发货人名称:</view>
  59. <view class="r">
  60. <u-input placeholder="发货人名称" @input="handler()" v-model="form.sendPeople">
  61. </u-input>
  62. </view>
  63. </view>
  64. <view class="item">
  65. <view class="l">收货人名称:</view>
  66. <view class="r">
  67. <u-input placeholder="收货人名称" @input="handler()" v-model="form.receivePeople">
  68. </u-input>
  69. </view>
  70. </view>
  71. <view class="item">
  72. <view class="l">规格:</view>
  73. <view class="r">
  74. <u-input type="number" placeholder="输入规格" @input="handler()" v-model="form.unit">
  75. <text slot="suffix">米</text>
  76. </u-input>
  77. </view>
  78. </view>
  79. <view class="item">
  80. <view class="l">包装:</view>
  81. <view class="r">
  82. <view class="r">
  83. <u-input placeholder="输入包装" @input="handler()" v-model="form.pack" />
  84. </view>
  85. </view>
  86. </view>
  87. <view class="item">
  88. <view class="l">标记:</view>
  89. <view class="r">
  90. <u-input placeholder="标记" @input="handler()" v-model="form.flag" />
  91. </view>
  92. </view>
  93. <view class="item">
  94. <view class="l">号码:</view>
  95. <view class="r">
  96. <u-input placeholder="号码" @input="handler()" v-model="form.phone" />
  97. </view>
  98. </view>
  99. <view class="item">
  100. <view class="l">启运地:</view>
  101. <view class="r">
  102. <u-input placeholder="启运地" @input="handler()" v-model="form.sourceAddress" />
  103. </view>
  104. </view>
  105. <view class="item">
  106. <view class="l">到货口岸:</view>
  107. <view class="r">
  108. <u-input placeholder="到货口岸" @input="handler()" v-model="form.arrivePart" />
  109. </view>
  110. </view>
  111. <view class="item">
  112. <view class="l">运输工具:</view>
  113. <view class="r">
  114. <u-input placeholder="运输工具" @input="handler()" v-model="form.carName" />
  115. </view>
  116. </view>
  117. <view class="item">
  118. <view class="l">工具号码:</view>
  119. <view class="r">
  120. <u-input placeholder="运输工具号码" @input="handler()" v-model="form.carNo" />
  121. </view>
  122. </view>
  123. <view class="item">
  124. <view class="l">国内运输工具:</view>
  125. <view class="r">
  126. <u-input placeholder="国内运输工具" @input="handler()" v-model="form.chinaCarName" />
  127. </view>
  128. </view>
  129. <view class="item">
  130. <view class="l">工具号码:</view>
  131. <view class="r">
  132. <u-input placeholder="工具号码" @input="handler()" v-model="form.chinaCarNo" />
  133. </view>
  134. </view>
  135. <view class="item">
  136. <view class="l" style="flex: 6;">其他要求:</view>
  137. <view class="r">
  138. <u--textarea @input="handler()" v-model="form.remark" placeholder="其他要求及备注">
  139. </u--textarea>
  140. </view>
  141. </view>
  142. </view>
  143. <u-button type="primary" text="确定" @click="saveFn"></u-button>
  144. <u-button type="info" text="重置" @click="cleanFn" style="margin-top: 20rpx;"></u-button>
  145. <!-- ---------------------------------------------------------- -->
  146. <view class="bottom-safety"></view>
  147. </view>
  148. </template>
  149. <script>
  150. export default {
  151. data() {
  152. return {
  153. form: {
  154. declarePeople: '',
  155. declarePhone: '',
  156. goodsName: '',
  157. grossWeight: 0,
  158. num: 0,
  159. origin: '',
  160. unit: '',
  161. pack: '',
  162. flag: '',
  163. phone: '',
  164. sourceAddress: '',
  165. arrivePart: '',
  166. carName: '',
  167. carNo: '',
  168. chinaCarName: '',
  169. chinaCarNo: '',
  170. remark: ''
  171. },
  172. }
  173. },
  174. onShow() {},
  175. mounted() {
  176. this.checkStore();
  177. },
  178. methods: {
  179. createModal() {
  180. return {
  181. declarePeople: '',
  182. declarePhone: '',
  183. goodsName: '',
  184. grossWeight: 0,
  185. num: 0,
  186. origin: '',
  187. unit: '',
  188. pack: '',
  189. flag: '',
  190. phone: '',
  191. sourceAddress: '',
  192. arrivePart: '',
  193. carName: '',
  194. carNo: '',
  195. chinaCarName: '',
  196. chinaCarNo: '',
  197. remark: ''
  198. }
  199. },
  200. cleanFn() {
  201. this.form = this.createModal();
  202. this.cleanStore();
  203. },
  204. cleanStore() {
  205. uni.removeStorageSync('declare')
  206. },
  207. handler() {
  208. uni.setStorageSync('declare', this.form);
  209. },
  210. checkStore() {
  211. let store = uni.getStorageSync('declare');
  212. if (store && JSON.stringify(store) !== JSON.stringify(this.createModal())) {
  213. let that = this;
  214. uni.showModal({
  215. title: '提示',
  216. content: '检测到您有未完成表单,是否继续?',
  217. success(resp) {
  218. if (resp.confirm) {
  219. that.form = store
  220. } else {
  221. that.cleanFn();
  222. }
  223. }
  224. })
  225. }
  226. },
  227. saveFn() {
  228. if (!this.form.declarePeople) {
  229. this.$common.toast('请填写申报人');
  230. return;
  231. }
  232. if (!this.form.declarePhone) {
  233. this.$common.toast('请填写申报电话');
  234. return;
  235. }
  236. if (!this.form.grossWeight || this.form.grossWeight <= 0) {
  237. this.$common.toast('请填写重量');
  238. return;
  239. }
  240. this.$api.addDisinfect(this.$common.removeNull(this.form)).then(resp => {
  241. this.cleanStore();
  242. this.$common.to('/pages/disinfect/addDisinfectSuccess')
  243. })
  244. }
  245. },
  246. }
  247. </script>
  248. <style lang="scss">
  249. page {
  250. background-color: #fff;
  251. }
  252. .hs-item {
  253. text-align: center;
  254. }
  255. .item-line {
  256. color: #a2a2a2;
  257. padding: 5px 0 10px 29px;
  258. border-bottom: 1px solid #E5E5E5;
  259. }
  260. .hj {
  261. padding: 50rpx;
  262. font-size: 40rpx;
  263. color: red;
  264. font-weight: bold;
  265. }
  266. .save-btn {
  267. background-color: #ff4200;
  268. height: 88rpx;
  269. display: flex;
  270. justify-content: center;
  271. align-items: center;
  272. margin: 60rpx;
  273. color: #fff;
  274. font-size: 30rpx;
  275. font-weight: bold;
  276. border-radius: 10rpx;
  277. }
  278. @import '@/common/common.scss'
  279. </style>