add.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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"><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.grossWeight">
  32. <text slot="suffix">吨</text>
  33. </u-input>
  34. </view>
  35. </view>
  36. <view class="item">
  37. <view class="l">件数:</view>
  38. <view class="r">
  39. <u-input type="number" placeholder="输入件数" @input="handler()" v-model="form.num">
  40. </u-input>
  41. </view>
  42. </view>
  43. <view class="item">
  44. <view class="l">生产日期:</view>
  45. <view class="r">
  46. <view class="r">
  47. <uni-datetime-picker placeholder="请选择" @input="handler()" :clear-icon="false" type="date"
  48. v-model="form.productionDate" />
  49. </view>
  50. </view>
  51. </view>
  52. <view class="item">
  53. <view class="l">保质期(天):</view>
  54. <view class="r">
  55. <view class="r">
  56. <u-input placeholder="输入保质期" type="number" @input="handler()" v-model="form.expirationDate" />
  57. </view>
  58. </view>
  59. </view>
  60. <view class="item">
  61. <view class="l">储藏条件:</view>
  62. <view class="r">
  63. <u-input placeholder="储存条件" @input="handler()" v-model="form.storageMode" />
  64. </view>
  65. </view>
  66. <view class="item">
  67. <view class="l">生产方式:</view>
  68. <view class="r">
  69. <u-input placeholder="生产方式" @input="handler()" v-model="form.productionMode" />
  70. </view>
  71. </view>
  72. <view class="item">
  73. <view class="l">原产国:</view>
  74. <view class="r">
  75. <u-input placeholder="原产国" @input="handler()" v-model="form.origin" />
  76. </view>
  77. </view>
  78. <view class="item">
  79. <view class="l">货主单位:</view>
  80. <view class="r">
  81. <u-input placeholder="货主单位" @input="handler()" v-model="form.sendUnit" />
  82. </view>
  83. </view>
  84. <view class="item">
  85. <view class="l">生产商出注册号:</view>
  86. <view class="r">
  87. <u-input placeholder="生产商出注册号" @input="handler()" v-model="form.producerCode" />
  88. </view>
  89. </view>
  90. <view class="item">
  91. <view class="l">收货单位:</view>
  92. <view class="r">
  93. <u-input placeholder="收货单位" @input="handler()" v-model="form.receiveUnit" />
  94. </view>
  95. </view>
  96. <view class="item">
  97. <view class="l">货物流向:</view>
  98. <view class="r">
  99. <u-input placeholder="货物流向" @input="handler()" v-model="form.route" />
  100. </view>
  101. </view>
  102. <view class="item">
  103. <view class="l" style="flex: 7;">运输车辆:</view>
  104. <view class="r">
  105. <u--textarea @input="handler()" v-model="form.chinaCarNo" placeholder="运输车车牌,多个请用逗号隔开">
  106. </u--textarea>
  107. </view>
  108. </view>
  109. <view class="item">
  110. <view class="l">司机姓名:</view>
  111. <view class="r">
  112. <u--textarea @input="handler()" v-model="form.driverName" placeholder="司机姓名,多个请用逗号隔开"></u--textarea>
  113. </view>
  114. </view>
  115. <view class="item">
  116. <view class="l">司机电话:</view>
  117. <view class="r">
  118. <u--textarea @input="handler()" v-model="form.driverPhone" placeholder="司机电话,多个请用逗号隔开">
  119. </u--textarea>
  120. </view>
  121. </view>
  122. <view class="item">
  123. <view class="l" style="flex: 7;">代理商电话:</view>
  124. <view class="r">
  125. <u-input placeholder="代理商电话" @input="handler()" v-model="form.agentPhone" />
  126. </view>
  127. </view>
  128. <view class="item">
  129. <view class="l" style="flex: 7;">海关报关单据:</view>
  130. <view class="r">
  131. <u-input placeholder="海关报关单据" @input="handler()" v-model="form.customProof" />
  132. </view>
  133. </view>
  134. <view class="item">
  135. <view class="l" style="flex: 7;">检验检疫证:</view>
  136. <view class="r">
  137. <u-input placeholder="检验检疫证" @input="handler()" v-model="form.quarantineProof" />
  138. </view>
  139. </view>
  140. <view class="item">
  141. <view class="l">商铺:</view>
  142. <view class="r">
  143. <u-input placeholder="商铺" @input="handler()" v-model="form.shop" />
  144. </view>
  145. </view>
  146. <view class="item">
  147. <view class="l"><text style="color: red;">*</text>生产批号:</view>
  148. <view class="r">
  149. <u-input placeholder="生产批号" @input="handler()" v-model="form.productionCode" />
  150. </view>
  151. </view>
  152. <view class="item">
  153. <view class="l">柜号:</view>
  154. <view class="r">
  155. <u-input placeholder="柜号" @input="handler()" v-model="form.containerCode" />
  156. </view>
  157. </view>
  158. <view class="item">
  159. <view class="l">越南车牌:</view>
  160. <view class="r">
  161. <u-input placeholder="越南车牌" @input="handler()" v-model="form.carNo" />
  162. </view>
  163. </view>
  164. </view>
  165. <u-button type="primary" text="确定" @click="saveFn"></u-button>
  166. <u-button type="info" text="重置" @click="cleanFn" style="margin-top: 20rpx;"></u-button>
  167. <!-- ---------------------------------------------------------- -->
  168. <view class="bottom-safety"></view>
  169. </view>
  170. </template>
  171. <script>
  172. export default {
  173. data() {
  174. return {
  175. form: {
  176. declarePeople: '',
  177. declarePhone: '',
  178. goodsName: '',
  179. grossWeight: 0,
  180. num: 0,
  181. productionDate: '',
  182. expirationDate: '',
  183. productionMode: '',
  184. origin: '',
  185. sendUnit: '',
  186. producerCode: '',
  187. receiveUnit: '',
  188. route: '',
  189. storageMode: '',
  190. driverName: '',
  191. driverPhone: '',
  192. agent: '',
  193. chinaCarNo: '',
  194. carNo: '',
  195. customProof: '',
  196. quarantineProof: '',
  197. shop: '',
  198. productionCode: '',
  199. containerCode: ''
  200. },
  201. }
  202. },
  203. onShow() {},
  204. mounted() {
  205. this.checkStore();
  206. },
  207. methods: {
  208. createModal() {
  209. return {
  210. declarePeople: '',
  211. declarePhone: '',
  212. goodsName: '',
  213. grossWeight: 0,
  214. num: 0,
  215. productionDate: '',
  216. expirationDate: '',
  217. productionMode: '',
  218. origin: '',
  219. sendUnit: '',
  220. producerCode: '',
  221. receiveUnit: '',
  222. route: '',
  223. storageMode: '',
  224. driverName: '',
  225. driverPhone: '',
  226. agent: '',
  227. chinaCarNo: '',
  228. carNo: '',
  229. customProof: '',
  230. quarantineProof: '',
  231. shop: '',
  232. productionCode: '',
  233. containerCode: ''
  234. }
  235. },
  236. cleanFn() {
  237. this.form = this.createModal();
  238. this.cleanStore();
  239. },
  240. cleanStore() {
  241. uni.removeStorageSync('declare')
  242. },
  243. handler() {
  244. uni.setStorageSync('declare', this.form);
  245. },
  246. checkStore() {
  247. let store = uni.getStorageSync('declare');
  248. if (store && JSON.stringify(store) !== JSON.stringify(this.createModal())) {
  249. let that = this;
  250. uni.showModal({
  251. title: '提示',
  252. content: '检测到您有未完成表单,是否继续?',
  253. success(resp) {
  254. if (resp.confirm) {
  255. that.form = store
  256. } else {
  257. that.cleanFn();
  258. }
  259. }
  260. })
  261. }
  262. },
  263. saveFn() {
  264. if (!this.form.declarePeople) {
  265. this.$common.toast('请填写申报人');
  266. return;
  267. }
  268. if (!this.form.declarePhone) {
  269. this.$common.toast('请填写申报电话');
  270. return;
  271. }
  272. if (!this.form.goodsName) {
  273. this.$common.toast('请填写产品');
  274. return;
  275. }
  276. if (!this.form.productionCode) {
  277. this.$common.toast('请填写生产批号');
  278. return;
  279. }
  280. if (!this.form.grossWeight || this.form.grossWeight <= 0) {
  281. this.$common.toast('请填写毛重');
  282. return;
  283. }
  284. this.$api.addDeclare(this.$common.removeNull(this.form)).then(resp => {
  285. this.cleanStore();
  286. this.$common.to('/pages/declare/addDeclareSuccess')
  287. })
  288. }
  289. },
  290. }
  291. </script>
  292. <style lang="scss">
  293. page {
  294. background-color: #fff;
  295. }
  296. .hs-item {
  297. text-align: center;
  298. }
  299. .item-line {
  300. color: #a2a2a2;
  301. padding: 5px 0 10px 29px;
  302. border-bottom: 1px solid #E5E5E5;
  303. }
  304. .hj {
  305. padding: 50rpx;
  306. font-size: 40rpx;
  307. color: red;
  308. font-weight: bold;
  309. }
  310. .save-btn {
  311. background-color: #ff4200;
  312. height: 88rpx;
  313. display: flex;
  314. justify-content: center;
  315. align-items: center;
  316. margin: 60rpx;
  317. color: #fff;
  318. font-size: 30rpx;
  319. font-weight: bold;
  320. border-radius: 10rpx;
  321. }
  322. @import '@/common/common.scss'
  323. </style>