add.vue 8.9 KB

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