addDisinfect.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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" style="flex: 7;"><text style="color: red;">*</text>发货人名称:</view>
  9. <view class="r">
  10. <u-input placeholder="发货人名称" @input="handler()" v-model="form.sendPeople">
  11. </u-input>
  12. </view>
  13. </view>
  14. <view class="item">
  15. <view class="l" style="flex: 7;"><text style="color: red;">*</text>收货人名称:</view>
  16. <view class="r">
  17. <u-input placeholder="收货人名称" @input="handler()" v-model="form.receivePeople">
  18. </u-input>
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="l"><text style="color: red;">*</text>品名:</view>
  23. <view class="r">
  24. <u-input placeholder="输入品名" @input="handler()" v-model="form.goodsName">
  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 type="number" placeholder="输入数量" @input="handler()" v-model="form.num">
  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"><text style="color: red;">*</text>产地:</view>
  45. <view class="r">
  46. <u-input placeholder="输入产地" @input="handler()" v-model="form.origin">
  47. </u-input>
  48. </view>
  49. </view>
  50. <view class="item">
  51. <view class="l"><text style="color: red;">*</text>规格:</view>
  52. <view class="r">
  53. <u-input type="number" placeholder="输入规格" @input="handler()" v-model="form.unit">
  54. <text slot="suffix">米</text>
  55. </u-input>
  56. </view>
  57. </view>
  58. <view class="item">
  59. <view class="l"><text style="color: red;">*</text>包装:</view>
  60. <view class="r">
  61. <view class="r">
  62. <u-input placeholder="输入包装" @input="handler()" v-model="form.pack" />
  63. </view>
  64. </view>
  65. </view>
  66. <view class="item">
  67. <view class="l"><text style="color: red;">*</text>标记:</view>
  68. <view class="r">
  69. <u-input placeholder="标记" @input="handler()" v-model="form.flag" />
  70. </view>
  71. </view>
  72. <view class="item">
  73. <view class="l"><text style="color: red;">*</text>号码:</view>
  74. <view class="r">
  75. <u-input type="number" placeholder="号码" @input="handler()" v-model="form.phone" />
  76. </view>
  77. </view>
  78. <view class="item">
  79. <view class="l"><text style="color: red;">*</text>启运地:</view>
  80. <view class="r">
  81. <u-input placeholder="启运地" @input="handler()" v-model="form.sourceAddress" />
  82. </view>
  83. </view>
  84. <view class="item">
  85. <view class="l"><text style="color: red;">*</text>到货口岸:</view>
  86. <view class="r">
  87. <u-input placeholder="到货口岸" @input="handler()" v-model="form.arrivePart" />
  88. </view>
  89. </view>
  90. <view class="item">
  91. <view class="l"><text style="color: red;">*</text>运输工具:</view>
  92. <view class="r">
  93. <u-input placeholder="运输工具" @input="handler()" v-model="form.carName" />
  94. </view>
  95. </view>
  96. <view class="item">
  97. <view class="l"><text style="color: red;">*</text>工具号码:</view>
  98. <view class="r">
  99. <u-input placeholder="运输工具号码" @input="handler()" v-model="form.carNo" />
  100. </view>
  101. </view>
  102. <view class="item">
  103. <view class="l" style="flex: 7;"><text style="color: red;">*</text>国内运输工具:</view>
  104. <view class="r">
  105. <u-input placeholder="国内运输工具" @input="handler()" v-model="form.chinaCarName" />
  106. </view>
  107. </view>
  108. <view class="item">
  109. <view class="l"><text style="color: red;">*</text>工具号码:</view>
  110. <view class="r">
  111. <u-input placeholder="工具号码" @input="handler()" v-model="form.chinaCarNo" />
  112. </view>
  113. </view>
  114. <view class="item">
  115. <view class="l"><text style="color: red;">*</text>申报人:</view>
  116. <view class="r">
  117. <u-input placeholder="申报人" @input="handler()" v-model="form.declarePeople">
  118. </u-input>
  119. </view>
  120. </view>
  121. <view class="item">
  122. <view class="l"><text style="color: red;">*</text>申报电话:</view>
  123. <view class="r">
  124. <u-input type="number" placeholder="申报电话" @input="handler()" v-model="form.declarePhone">
  125. </u-input>
  126. </view>
  127. </view>
  128. <view class="item">
  129. <view class="l"><text style="color: red;">*</text>申报单位:</view>
  130. <view class="r">
  131. <u-input placeholder="申报单位" @input="handler()" v-model="form.applyUnit">
  132. </u-input>
  133. </view>
  134. </view>
  135. <view class="item">
  136. <view class="l" style="flex: 7;">其他要求:</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: '',
  158. num: '',
  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. sendPeople:'',
  182. receivePeople:'',
  183. declarePeople: '',
  184. declarePhone: '',
  185. goodsName: '',
  186. grossWeight: '',
  187. num: '',
  188. origin: '',
  189. unit: '',
  190. pack: '',
  191. flag: '',
  192. phone: '',
  193. sourceAddress: '',
  194. arrivePart: '',
  195. carName: '',
  196. carNo: '',
  197. chinaCarName: '',
  198. chinaCarNo: '',
  199. remark: ''
  200. }
  201. },
  202. cleanFn() {
  203. this.form = this.createModal();
  204. this.cleanStore();
  205. },
  206. cleanStore() {
  207. uni.removeStorageSync('disinfect')
  208. uni.removeStorageSync('declare')
  209. },
  210. handler() {
  211. let cacheObj = {
  212. count: 0,
  213. cache: this.form
  214. }
  215. uni.setStorageSync('disinfect', cacheObj);
  216. },
  217. addStoreCount() {
  218. let cacheObj = {
  219. count: 1,
  220. cache: this.form
  221. }
  222. uni.setStorageSync('disinfect', cacheObj);
  223. },
  224. checkStore() {
  225. let disinfectStore = uni.getStorageSync('disinfect');
  226. if (disinfectStore && disinfectStore.count == 0) {
  227. let that = this;
  228. let cache=disinfectStore.cache;
  229. uni.showModal({
  230. title: '提示',
  231. content: '检测到您有未完成表单,是否继续?',
  232. success(resp) {
  233. if (resp.confirm) {
  234. that.form =cache
  235. } else {
  236. that.cleanFn();
  237. }
  238. }
  239. })
  240. }
  241. let declareStore = uni.getStorageSync('declare');
  242. if(declareStore){
  243. let that = this;
  244. let cache=declareStore.cache;
  245. that.form.declarePeople=cache.declarePeople
  246. that.form.declarePhone=cache.declarePhone
  247. uni.showModal({
  248. title: '提示',
  249. content: '检测到最近有相似申报信息,是否导入?',
  250. success(resp) {
  251. if (resp.confirm) {
  252. that.form=cache;
  253. } else {
  254. that.cleanFn();
  255. }
  256. }
  257. })
  258. }
  259. },
  260. saveFn() {
  261. if(!this.check()){
  262. return;
  263. }
  264. this.$api.addDisinfect(this.$common.removeNull(this.form)).then(resp => {
  265. this.addStoreCount();
  266. this.$common.to('/pages/disinfect/addDisinfectSuccess')
  267. })
  268. },
  269. check(){
  270. if (!this.form.sendPeople) {
  271. this.$common.toast('请填写发货人信息');
  272. return false;
  273. }
  274. if (!this.form.receivePeople) {
  275. this.$common.toast('请填写接货人信息');
  276. return false;
  277. }
  278. if (!this.form.goodsName) {
  279. this.$common.toast('请填写品名');
  280. return false;
  281. }
  282. if (!this.$common.isNum(this.form.num)) {
  283. this.$common.toast('数量请填写数字');
  284. return false;
  285. }
  286. if (!this.$common.isNum(this.form.grossWeight)) {
  287. this.$common.toast('请填写重量');
  288. return false;
  289. }
  290. if (!this.form.origin) {
  291. this.$common.toast('请填写原产地');
  292. return false;
  293. }
  294. if (!this.$common.isNum(this.form.unit)) {
  295. this.$common.toast('规格只能填写数字');
  296. return false;
  297. }
  298. if (!this.form.pack) {
  299. this.$common.toast('请填写包装');
  300. return false;
  301. }
  302. if (!this.form.flag) {
  303. this.$common.toast('请填写标记');
  304. return false;
  305. }
  306. if (!this.$common.isPhone(this.form.phone)) {
  307. this.$common.toast('请填写正确号码');
  308. return false;
  309. }
  310. if (!this.form.sourceAddress) {
  311. this.$common.toast('请填写启运地');
  312. return false;
  313. }
  314. if (!this.form.arrivePart) {
  315. this.$common.toast('请填写到货口岸');
  316. return false;
  317. }
  318. if (!this.form.carName) {
  319. this.$common.toast('请填写运输工具');
  320. return false;
  321. }
  322. if (!this.form.carNo) {
  323. this.$common.toast('请填写工具号码');
  324. return false;
  325. }
  326. if (!this.form.chinaCarName) {
  327. this.$common.toast('请填写国内运输工具');
  328. return false;
  329. }
  330. if (!this.form.chinaCarNo) {
  331. this.$common.toast('请填写国内运输工具号码');
  332. return false;
  333. }
  334. if (!this.form.declarePeople) {
  335. this.$common.toast('请填写申请人');
  336. return false;
  337. }
  338. if (!this.$common.isPhone(this.form.declarePhone)) {
  339. this.$common.toast('请填写正确申请电话');
  340. return false;
  341. }
  342. if (!this.form.applyUnit) {
  343. this.$common.toast('请填写申请单位');
  344. return false;
  345. }
  346. return true;
  347. }
  348. },
  349. }
  350. </script>
  351. <style lang="scss">
  352. page {
  353. background-color: #fff;
  354. }
  355. .hs-item {
  356. text-align: center;
  357. }
  358. .item-line {
  359. color: #a2a2a2;
  360. padding: 5px 0 10px 29px;
  361. border-bottom: 1px solid #E5E5E5;
  362. }
  363. .hj {
  364. padding: 50rpx;
  365. font-size: 40rpx;
  366. color: red;
  367. font-weight: bold;
  368. }
  369. .save-btn {
  370. background-color: #ff4200;
  371. height: 88rpx;
  372. display: flex;
  373. justify-content: center;
  374. align-items: center;
  375. margin: 60rpx;
  376. color: #fff;
  377. font-size: 30rpx;
  378. font-weight: bold;
  379. border-radius: 10rpx;
  380. }
  381. @import '@/common/common.scss'
  382. </style>