add.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. goodsName: '',
  182. grossWeight: 0,
  183. num: 0,
  184. productionDate: '',
  185. expirationDate: '',
  186. productionMode: '',
  187. origin: '',
  188. sendUnit: '',
  189. producerCode: '',
  190. receiveUnit: '',
  191. route: '',
  192. storageMode: '',
  193. driverName: '',
  194. driverPhone: '',
  195. agent: '',
  196. chinaCarNo: '',
  197. carNo: '',
  198. customProof: '',
  199. quarantineProof: '',
  200. shop: '',
  201. productionCode: '',
  202. containerCode: ''
  203. },
  204. }
  205. },
  206. onShow() {},
  207. mounted() {
  208. this.checkStore();
  209. },
  210. methods: {
  211. createModal(){
  212. return {
  213. goodsName: '',
  214. grossWeight: 0,
  215. num: 0,
  216. productionDate: '',
  217. expirationDate: '',
  218. productionMode: '',
  219. origin: '',
  220. sendUnit: '',
  221. producerCode: '',
  222. receiveUnit: '',
  223. route: '',
  224. storageMode: '',
  225. driverName: '',
  226. driverPhone: '',
  227. agent: '',
  228. chinaCarNo: '',
  229. carNo: '',
  230. customProof: '',
  231. quarantineProof: '',
  232. shop: '',
  233. productionCode: '',
  234. containerCode: ''
  235. }
  236. },
  237. cleanFn() {
  238. this.form = this.createModal();
  239. this.cleanStore();
  240. },
  241. cleanStore() {
  242. uni.removeStorageSync('declare')
  243. },
  244. handler() {
  245. uni.setStorageSync('declare', this.form);
  246. },
  247. checkStore() {
  248. let store = uni.getStorageSync('declare');
  249. if (store&&JSON.stringify(store)!==JSON.stringify(this.createModal())) {
  250. let that = this;
  251. uni.showModal({
  252. title: '提示',
  253. content: '检测到您有未完成表单,是否继续?',
  254. success(resp) {
  255. if (resp.confirm) {
  256. that.form = store
  257. } else {
  258. that.cleanFn();
  259. }
  260. }
  261. })
  262. }
  263. },
  264. saveFn() {
  265. if(!this.form.declarePeople){
  266. this.$common.toast('请填写申报人');
  267. return;
  268. }
  269. if(!this.form.declarePhone){
  270. this.$common.toast('请填写申报电话');
  271. return;
  272. }
  273. if(!this.form.goodsName){
  274. this.$common.toast('请填写产品');
  275. return;
  276. }
  277. if(!this.form.productionCode){
  278. this.$common.toast('请填写生产批号');
  279. return;
  280. }
  281. if(!this.form.grossWeight||this.form.grossWeight<=0){
  282. this.$common.toast('请填写毛重');
  283. return;
  284. }
  285. this.$api.addDeclare(this.$common.removeNull(this.form)).then(resp => {
  286. this.cleanStore();
  287. this.$common.to('/pages/declare/addDeclareSuccess')
  288. })
  289. }
  290. },
  291. }
  292. </script>
  293. <style lang="scss">
  294. page {
  295. background-color: #fff;
  296. }
  297. .hs-item {
  298. text-align: center;
  299. }
  300. .item-line {
  301. color: #a2a2a2;
  302. padding: 5px 0 10px 29px;
  303. border-bottom: 1px solid #E5E5E5;
  304. }
  305. .hj {
  306. padding: 50rpx;
  307. font-size: 40rpx;
  308. color: red;
  309. font-weight: bold;
  310. }
  311. .save-btn {
  312. background-color: #ff4200;
  313. height: 88rpx;
  314. display: flex;
  315. justify-content: center;
  316. align-items: center;
  317. margin: 60rpx;
  318. color: #fff;
  319. font-size: 30rpx;
  320. font-weight: bold;
  321. border-radius: 10rpx;
  322. }
  323. @import '@/common/common.scss'
  324. </style>